NAME mint - Produce syntax and usage report of a Maple program SYNOPSIS mint [ -a databaseFile ] [ -A databaseFile ] [ -b libraryDir ] [ -d databaseFile ] [ -D macroDef ] [ -i infoLevel ] [ -I includePath ] [ -l -o outputFile ] [-q -s -S -t errorNumber ] [ -U macroName ] [ -w width ] [ -x file ] DESCRIPTION Mint analyzes a Maple program, and produces a report about possible errors in a Maple source file. If file is not given, then the standard input is used to read Maple source statements. Unlike Maple, Mint does not terminate when it reads a quit statement. Instead, it terminates when it reaches the end of the input. OPTIONS -b libraryDir The library specification option (-b libraryDir) forces Mint to look in the library file located in the speci- fied directory for library routines. -D The -D (Define) option is used to predefine a macro for Maple's preprocessor, $define. The -D option can be followed by either a symbol or a symbol, equal sign, and the definition of the symbol. Multiple -D options can be used to define multiple symbols. -i infolevel The info level option (-i infoLevel) specifies the amount of information to be produced. The values allowed for infoLevel are: 0 Display no information 1 Display only severe errors 2 Display severe and serious errors (default) 3 Display warnings as well as severe and serious errors 4 Give a full report on variable usage as well as displaying errors and warnings A severe error is an undisputable error, such as a break statement outside of any loop. A serious error is almost certainly a coding error, such as two nested loops using the same control variable, or code appearing immediately after a return statement. Warnings indicate possible coding errors, such as using an equation as a stand- alone statement (sug- gesting that an assignment was probably intended). A report is displayed for each procedure in the file. A glo- bal report, for statements not contained within any pro- cedure, is displayed after the procedure reports. If the severity of errors found within a procedure is less than what the info level specifies, then no report is produced for that procedure. In all cases, the most severe error found in the file will be used to set the exit status for Mint. The possible values exit status values are: 0 No errors or warnings 1 Warnings 2 Serious errors 3 Severe errors With an infoLevel of 0, Mint will produce no output, but will quietly return an exit status indicating the highest severity of error encountered. If infoLevel is 4, a usage report is given for each pro- cedure as well as global statements within the file. Each usage report shows how parameters, local variables, global variables, system-defined names and catenated names are used. For example: Used as a value Used as a table or list element Used as a call-by-value parameter Used as a call-by-name parameter (a quoted parameter) Called as a function Assigned a procedure Assigned a list Assigned a set Assigned a range Assigned a value as a table or list element Assigned a function value (assigned a value to remember as a function value) In addition, a list of all the error messages generated, is given. -I The -I (Include) option specifies directories to be searched for files specified in $include directives. Multiple directories can be specified, separated by commas. Alternatively, multiple -I options can be used to specify multiple directories. -l The library file option (-l) suppresses warnings and errors that are commonly caused by Maple library source files. The use of global names beginning with an underscore ("_") is not reported, since such names are reserved for use by the Maple library. Warnings about the assignment of values to the system- defined names, such as Digits and printlevel, are suppressed since this often happens in a library file. This option also suppresses error messages regarding library file names being overwritten since one of the purposes of a library file is to assign a procedure to a library file name. -o fileName The output optin (-o fileName) specifies that Mint is to write its report to the specified file, instead of the standard output. This is often useful when Mint is used as part of script, or on platforms which don't have a concept of standard output. -q The quiet option (-q) suppresses printing of the Maple logo at startup. -s The suppress startup file option (-s) forces Mint to run without reading the Mint startup file. The Mint startup file can be used to specify command line options to Mint. This file can contain several lines containing command line options or arguments as you would type them on a command line. Since Mint first reads the file and then scans the command line, argu- ments on the actual command line can override arguments in the initialization file. A good use of the initiali- zation file may be to enter the name of the Maple library procedure database file when using the -d option, eliminating the need to type this each time Mint is used. The Mint startup file is called .mintrc under UNIX. -S The Syntax checking only option (-S) overrides the info level specification, and allows only syntax error mes- sages to appear in the output. -t errorNumber The toggle error reporting option (-t errorNumber) will switch between reporting and not reporting errors of the given type number. The error numbers and corresponding error messages are: Severe errors - return code 3 0 "The following statements are not inside any loop:" Indicates that a break or next statement has appeared outside of a loop. 1 "The following statements are not inside any pro- cedure:" Indicates that an error or return statement has appeared outside of a procedure. 2 "These names were declared more than once as a local variable:" Indicates that the same local variable has been declared more than once in a procedure's local state- ment. 3 "These names appeared more than once in the parameter list:" Indicates that the same parameter has been declared more than once in a procedure's parameter list. 4 "These names were declared as both a local variable and a parameter:" Indicates that a procedure has a parameter and local variable with the same name. 5 "Invalid left hand side of assignment:" Indicates that an invalid expression (e.g. a set, a sum, etc.) appears on the left hand side of an assign- ment. Serious errors - return code 2 6 "These names were used as the same loop variable for nested loops:" Indicates that an inner loop uses the same loop control variable as an outer loop. 7 "There is unreachable code that will never be exe- cuted;" Indicates that a statement occurs immediately after a break, next, return, or error statement. Such a state- ment can never be reached during the course of execu- tion. 8 "These names were used as iteration control variables for both a $, sum, or product construct and a loop:" Indicates that a construct such as seq, add, or $ uses the same control variable as an enclosing loop. 9 "These names were used as global names but were not declared:" Indicates that a procedure makes use of some global names, but has not declared them as such. 10 "Underscore names are reserved for use in the library. These global names start with _:" Indicates use of a global name beginning with the underscore ("_") character. Such names are reserved for use by Maple's supplied library. 11 "These local variables were never used:" Indicates that the local variables were declared, but never used within the procedure. Removing the declara- tions can marginally improve performance and reduce memory usage. 12 "These local variables were used but never assigned a value:" Indicates that a local variable's value was used, but that no value was ever assigned to it, suggesting a coding error. 13 "These local variables were assigned a value but other- wise not used:" Indicates that a value was assigned to a local vari- able, but that this variable was then never used, sug- gesting a coding error. 14 "These parameters were never used:" Indicates that the specified parameters of a procedure were never actually referred to by name within the pro- cedure. 15 "These names defined in a macro or alias statement were assigned a value: Indicates that a value that has a macro expansion appears on the right hand side of an assignment, mean- ing that the object being assigned to is not what it appears to be. 16 "These parameters were also used as macro or alias names:" Indicates that a procedure parameter name conflicts with a macro or alias name. 17 "These local variables were also used as macro or alias names:" Indicates that a procedure's local variable name con- flicts with a macro or alias name. 18 "These macro or alias names were expanded to a non-name where a name was needed:" Indicates that a macro or alias that expands to some- thing other than a name has appeared in a context where a name is required. 19 "Possible implied multiplication:" Indicates that an expression such as 2(x+1) has been encountered. In Maple, this means "apply the constant function 2 to the argument x+1", not "multiply 2 by x+1". 20 "Quotes are not needed around these names:" .IP Indicates that a name was written with backquotes (``) when such quotes were redundant. 21 "These local variables were not declared explicitly:" Indicates local variables that were implicitly declared (Maple declares as local any variables that are unde- clared, and appear on the left hand side of an assign- ment or as the control variable of a loop). Warnings - return code 1 22 "The following function calls disagree with number of parameters in the function definition:" Indicates that a function was called with the wrong number of arguments based on the information given in a library database. 23 "These library names were assigned a value:" Indicates that a name appearing in a library database was assigned to. 24 "These system defined names were assigned a value:" 25 "These system defined names were redefined in a macro or alias statement:" Indicates that a system-defined name (e.g. Pi) was assigned to. 26 "These catenated names were used:" Indicates that the concatenation operator (||) was used to create a name. 27 "These parameters or local variables are also system defined names:" Indicates that a parameter or local variable hides a system defined name from use inside a procedure. 28 "These names defined in a macro or alias statement were redefined:" Indicates that a pre-defined macro or alias has been redefined. 29 "Control variable of seq, add, or mul not referenced in body:" Indicates that the body expression of a seq, add, or mul call is not a function of the control variable. 30 "Equations were used as statements on the following lines:" Indicates that an equation (e.g. a=b) occurs by itself as a statement, suggesting that an assignment (a:=b) might have been intended instead. 31 "These parameters were never used explicitly:" Indicates that a named formal parameter of a procedure is never actually used within the body of the pro- cedure. -U The -U (Undefine) option is used to undefine a Maple preprocessor macro ($undef) that was defined earlier on the command line by a -D option. The -U option must be followed by the symbol to undefine. Multiple -U options can be used to undefine multiple symbols. -w width The width option (-w width) specifies the line width, in characters, to which Mint should format its report. The default is 79 characters. The minimum is 40 charac- ters. -x The cross-reference option (-x) lists all functions called in the code. DATABASE OPTIONS Procedure databases are files which contain information about the definition of procedures which is useful in ensur- ing that these procedures are used correctly. Each line in a database file contains the following: <name> <minArgs> <maxArgs> <nargsUsed> <fileName> where <name> is a legal Maple name without any embedded blanks, <minArgs> is the minimum number of arguments expected for name, <maxArgs> is the maximum number of argu- ments, <nargsUsed> is 1 if nargs is used in the procedure body and 0 otherwise. The last field, <fileName>, is optional, and is the name of the library source file in which name is defined. The entries on each line are in free format but must be separated from one another by at least one space character. The values for <minArgs> and <maxArgs> should be numbers in the range 0 to 999. If <maxArgs> is 999 for an entry, that denotes that the procedure has no upper limit on the number of arguments. There may be multiple entries for a particular procedure. Later entries supersede earlier ones. A procedure database file for the entire Maple library is generated or updated periodically. This file is "/usr/maple/data/mint.db" and contains over 4000 entries and it takes Mint several seconds to read this file. The database file options (-a databaseFile or -A database- File) append procedure information to the specified database file. Any procedures defined in the input file will have their definitions appended to the database file. The <minArgs> and <maxArgs> values will both be the number of format parameters that appear in the procedure definition. If the -A option was specified, the use of args or nargs in a procedure body sets the <nargsUsed> field to 1 in the database entry, which will turn off argument count checking for that procedure. If the -a option was specified, pro- cedures that use args or nargs are not written to the data- base at all, and the <fileName> field of the database is also not written. The library database option (-d databaseFile) forces Mint to use the specified library database as the procedure data- base. This allows Mint to check for improper usage of the procedures in the input file. Multiple library databases can be specified. SEE ALSO Other Maple related commands: maple, updtsrc
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |