maplemint - Maple Programming Help

Home : Support : Online Help : Programming : Debugging : maplemint

maplemint

procedural mint

 Calling Sequence maplemint(Procedure);

Parameters

 Procedure - a Maple procedure or module

Description

 • The call maplemint(Procedure) generates semantic information for a procedure or module and displays code that can never be executed.
 • Some of the things that maplemint generates reports for include:
 – system name/declared parameter conflicts
 – system name/declared local variable conflicts
 – system name/declared global variable conflicts
 – constants that are assigned a value
 – declared global variables that begin with '_'
 – declared global variables that are never used
 – global variables that are used but not declared
 – declared local variables that are never used
 – declared local variables that are assigned a value, but unused
 – local variables that are used before being assigned a value
 – unused parameters
 – loop variables that are used repeatedly in nested loops
 – unreachable code
 – equations used as statements
 – break or next found outside of loop
 – missing '*'  -  as in 2(x+1)
 • For a full list of the warnings that can be reported by maplemint, see the -t toggle section on the mint help page.
 • Unlike mint, maplemint does not report syntax errors since the interpreter/parser takes care of that before you can call maplemint.

Examples

 > a:=proc()    local b; global c;    if (b=5) then       b:=6;       return(true);       lprint(test);    end if; end proc:
 > $\mathrm{maplemint}\left(a\right)$
 Procedure a()   These names were used as global names but were not declared:  test   These global variables were declared, but never used:  c   These local variables were used before they were assigned a value:  b   There is unreachable code following a RETURN or return statement at       statement 4: lprint(test)
 > a:=proc() local b,i;    b:=6;    while (b>0) do       for i from 1 to 6 do          break;          printf(%d,i);       end do;       for i in [1,3,5] do          lprint(i);          break;          lprint(test);       end do;       b:=b-1;    end do; end proc:
 > $\mathrm{maplemint}\left(a\right)$
 Procedure a()   These names were used as global names but were not declared:  %d, test   There is unreachable code following a break statement at statement 5:       printf(%d,i)   There is unreachable code following a break statement at statement 9:       lprint(test)
 > a:=proc() local i;    for i from 1 to 10 do       lprint(i);       for i from 1 to 6 do          lprint(i);       end do;    end do; end proc:
 > $\mathrm{maplemint}\left(a\right)$
 Procedure a()   These variables were used as the same loop variable for nested loops:  i
 > a:=proc() local i;   i:=5;   while(i<10) do      lprint(test);   end do; end proc:
 > $\mathrm{maplemint}\left(a\right)$
 Procedure a()   These names were used as global names but were not declared:  test
 > a:=proc() global _abc; end proc:
 > $\mathrm{maplemint}\left(a\right)$
 Procedure a()   These global variables were declared, but never used:  _abc
 > a:=proc();    5=6; end proc:
 > $\mathrm{maplemint}\left(a\right)$
 > a:=proc(); 2(x+1); end proc:
 > $\mathrm{maplemint}\left(a\right)$
 Procedure a()   These names were used as global names but were not declared:  x   An expression may be missing a * operator at statement 1: 2(x+1)
 > a:=proc() local T,i;    T[i]:=8; end proc:
 > $\mathrm{maplemint}\left(a\right)$
 Procedure a()   These local variables were used but never assigned a value:  i

Compatibility

 • The maplemint command was updated in Maple 2018.