The Arity/Prolog32 Alint Utility

Using Alint

The Alint utility is used during the development of your application to help you identify common errors, including typos. Alint looks for local errors in each of your files, such as predicates that are not defined contiguously, predicates with more than one mode declaration or predicates that are simply not defined. The Alint utility then examines the interactions between modules for global errors. For example, whether each extrn declaration has a matching public declaration.

Alint accepts as input two lists of files (using "+" as a separator) that will comprise your application: The first list are those source files that will be compiled and the second are those files that will be interpreted (consulted into the application's database). In addition, you may also specify an output file for the messages that Alint produces. If no output file is specified, Alint will create a file with the name lintXXXX.lnt, where XXXX is a number, starting from 0000.

The format for the Alint command is:

c:> alint [options] <compiled files>,<interpreted files>, outputfile

For example, if you were compiling the files myapp.ari, member.ari and sent.ari, which would consult at runtime the file rules.ari, you would specify the following:

c:> alint myapp+member+sent, rules, myapp.lnt

This command will process the specified files and output information in the file myapp.lnt.

Alint provides three options:

-v

The Alint message LNT101 for reporting the single use of variables in a clause can take one of two formats. By default, all variables are listed. If the -v switch is specified, then two lists are returned of those variables that have a single use in the head of a clause and those that have a single use in the body of a clause.

-q

The -q switch can be used to "quiet" Alint's output. If you are inspecting many files, you may not wish to see Alint's activity and Alint will run slightly faster if this switch is specified.

-x(Msg1,...,Msgn)

You may find that there are messages generated by Alint that you have no interest in seeing. The -x option is provided to suppress these messages.

For instance, in our previous example, if you do not care about single uses of variables within clauses (message 101) or public predicates that are not used anywhere else in your program (message 105), then you would specify the following:

c:> alint -x(101,105) app+member+sent, rules, app.lnt

If you are inspecting a large number of files, you may need more space than the command line allows. In this case you can use a response file where you specify in a file all of the arguments that you would on the command line. Alint searches for the commas as separators between the file arguments and will ignore line breaks. So, for the previous example you could create the file app.res:

-x(101,105) app+member+sent, rules, app.lnt

You specify a response file to Alint with the @ symbol. For example:

c:>alint @app.res

Alint level 100 messages

Level 100 messages indicate problems that most likely will not affect compilation or execution

LNT 101 Variables used once in the following clauses:

The following clauses in this file contain variables that are used only once in the clause, this may indicate a misspelling. NOTE: if the -v switch was chosen then variables are split into two lists, those used in the rule body (marked with an *) and those used in the rule head.

LNT 103 Predicate not contiguous – <<N/A>>

Predicate's clauses are in more than one place in file. This may suggest an errant clause.

LNT 104 Mode declarations for the following undefined predicates:

The following predicates have mode declarations, but no clauses. This may indicate an extra/missing mode argument.

LNT 105 The following predicates are declared public but not used:

The following predicates have public declarations, but are not used as extrns anywhere.

LNT 106 Directive ignored in interpreted file – <<Directive>>

Directives in interpreted code may affect execution, but are not checked by ALINT. Note: all predicates used in a directive should be visible.

Alint level 200 messages

Level 200 messages indicate that although compilation may succeed, errors in execution are likely.

LNT 200 Begin without end for resource in program – <<File>>

A resource (dialog box, menu or choices) is defined without the corresponding end mark.

LNT 201 C declaration area defined (":- c") without corresponding :- prolog

A C declaration area ends at the end of file mark. Check for misspelling in ":- prolog." declaration.

LNT 202 Resource in compiled program – <<Name>>

The compiler will accept resource (dialog box, menu or choices) as prolog predicates, but will not parse them as resources.

LNT 203 Builtin predicate redefined – <<N/A>>

The Arity/Prolog32 predicate is redefined by your program. Use another name if this is not your intent.

LNT 204 Control redefined – <<N/A>>

A control structure (ifthen/2, [!!]/1, !/0, etc.) has been redefined. Most likely indicates a misplaced period.

LNT 205 More than one mode declaration for predicate – <<N/A>>

Only one of the mode declarations for a predicate is used by the compiler, remove extraneous ones.

LNT 206 More than one public declaration for predicate – <<N/A>>

Only one public declaration for a predicate is used by the compiler, remove extraneous ones.

LNT 207 Conflicting extrn types for predicate – <<N/A>>, <<Type1>> and <<Type2>>

A predicate is used in two files with different types.

LNT 208 C expressions/declarations not processed in compiled program – <<File>>

Alint does not check for embedded C errors.

LNT 209 C expressions will cause failure in interpreted predicate – <<N/A>>

Embedded C expressions are not processed in the interpreter, failure will occur.

LNT 210 The following predicates are defined but not used:

The following predicates are defined in the file, but are used only recursively or not at all.

LNT 211 The following predicates must be visible:

The following predicates are called from within interpreted predicates and must therefore be visible.

LNT 212 The following builtin predicates must be visible:

The following builtin predicates are called from within interpreted predicates and must therefore be visible.

LNT 213 More than one extrn declaration for predicate – <<N/A>>

Only one extrn declaration for a predicate is used by the compiler, remove extraneous ones.

LNT 214 Segmodule declaration places module in more than one segment – <<Module>> <<Seg1>> and <<Seg2>>

Two segmodule declarations place the specified Module into more than one segment, fix the declarations.

LNT 215 Predicate defined in file and with extrn – <<Pred>>

The specified predicate is defined both by clauses and with an extrn declaration determine the correct one and remove the other.

LNT 216 Expecting an atom for module name – <<Module>>

The module was specified using a datatype other than an atom (ie. a string or integer). Replace this use with an atom.

Alint level 300 messages

Level 300 messages indicate that compilation will most likely not succeed.

LNT 300 The following predicates are used but not defined:

The following predicates are used in this file, but are not defined or declared extrn.

LNT 301 More than one segment declaration – <<Seg1>> and <<Seg2>>

Only one segment declaration will be processed by the compiler, remove any extraneous ones.

LNT 302 Multiple module declarations in file – <<File>>

Only one module declaration will be processed by the compiler, remove any extraneous ones.

LNT 303 Illegal directive: <<D>>

The directive could not be parsed.

LNT 304 Illegal atomic goal: <<Goal>> in clause <<C>> of <<N/A>>

Predicate names must be atoms.

LNT 305 Illegal case expression syntax in clause <<C>> of <<N/A>>

A single goal should not be placed within a case.

LNT 306 Illegal extrn type in declaration – <<N/A:Type>>

Type cannot be parsed in the extrn declaration.

LNT 307 Illegal public type in declaration – <<N/A:Type>>

Type cannot be parsed in the public declaration.

LNT 308 The following predicates are declared public but not defined:

These predicates are declared public in the file, but are not defined, remove the public declarations.

LNT 309 The following predicates are declared visible but not defined:

These predicates are declared visible in the file, but are not defined, remove the visible declarations.

LNT 310 Module extrn for predicate without corresponding segmodule – <<Pred>>

The specified predicate is defined using an extrn module(Module) declaration, but there was no corresponding segmodule declaration to define which segment the Module is in. Provide the segmodule declaration.

Alint level 400 messages

Level 400 messages indicate that although compilation may succeed, errors during linking are likely to occur.

LNT 400 Files are defined as the same module – <<F1>> and <<F2>>.

Both files are compiled as the same module.

LNT 401 The following Prolog externals lack corresponding publics:

The following predicates are declared as extrn prolog predicates and are not defined as public in the files specified.

LNT 402 Remember to link the following non-Prolog externals to application:

The following are extrn predicates that are not prolog and must be linked to form the application.

LNT 403 The following predicates are used as near extrns in more than one segment:

The following prolog predicates can only be used as a near extrn in the segment where they are defined.

LNT 404 The following predicates are used as near extrns in the wrong segment:

The following prolog predicates can only be used as a near extrn in the segment where they are defined.

LNT 405 The following near publics are used as far extrns:

The following predicates need to be declared public :far.

LNT 406 The following Prolog publics are used as other language extrns:

Then names used by the following public prolog predicates are also used in an extrn, but with another language type.

LNT 407 Predicate made public in more than one file – <<N/A>> in File1 and File2

The specified predicate is defined and made public in more than one file. Only use one as the public definition.