Note
When lauching anyflo with a file *.js, if error occures anyflo is automatically relaunched
so it is not possible to make a diagnosis.
Then launch anyflo with file
anyflo_video.js, read the function to debug and call it.
The emitted messages allow to make the diagnosis, commande edit func
gives the list of compiled functions, the last is probaly the incorrect...
Else, call the function to debug,
error messages allow correct.
Compilation errors
Format
These are errors of syntax in the form:
1) A message indicating the type of error.
2) The erroneous instruction.
3) The name of the function in which the error occurred.
edit func prints the names of all compiled functions,
therefore the latter is where the error occured.
Correction
The most common mistakes are:
Forgetting a ; (semicolon) at the end of a statement or a declaration of extern.
: Instead of a ; product the message: NO LABEL FOUND.
An error in () (parentheses) [] (bracket) or {} (curly).
The use of a word does not belong to the language (eg iff instead of if).
Note:
edit func: prints the names of compiled functions, the error
probably occured in the laste or the next.
Debug mode
debug compile(v)
shows the code compiled correctly (v = 1 in symbolic form, v = 2 macro assembler).
Link errors
They are in the form::
1) A message indicating the type of error.
2) The instruction erroneous.
3) The name of the function in which the error occurred.
Correction
The most common mistakes are:
1) The include a function which has not been set before
2) No references defined.
Debug mode
debug link(v) shows the code correctly linké (v = 1 in symbolic form, v = 2 macro assembler).
Execution errors
Functions written in anyflo language are dynamically compiled.
In order to verify their execution you can set print and
input, it is then possible to consult or change any variables,
execute any function and, more generally, execut any commande.
You can also run any function independently of the main function.
func error returne the name of the function where an error
occured.
These are errors that occur during the execution of the code, they have the form:
A message indicating the type of error.
The name of the function in which the error occurred.
The erroneous instruction involved in the control error.
Possibly n lines before and n lines after if dim error(n).
Processing is interrupted unless no error is set.
Notes:
if debug exec(1) is set, the compiled code is printed.
error returne the name of the command concerned
by this error, error(0) rersets to no error.
Correction
The most common mistakes are:
1) A non initialized variable.
2) The call to a non defined function or corresponding to neither file on the disk whose first
function name is the same
3) An illegal operation, such as division by zero, or operation of mixing float and char.
Function bug1.func gives a frame for debuging.
Tags:
/* AJOUTER du code */
and
/* FIN AJOUTER du code */
delimit areas where it is possible to add code, while tags:
/* NE PAS MODIFIER */
and
/* FIN NE PAS MODIFIER */
delimit unmodifiable areas .
A minimal menu containing:
Two boxes APP1 and APP2 corresponding to the functions APP1(), func_APP1(), APP2(), func_APP2()
in which you write the code to debug.
A box DEBUG corresponding to functions DEBUG(), func_DEBUG() allowing to interactively modify extern variables
Vi (0 <= i <= 23) by the command interaction debug.
A box VAR corresponding to functions VAR(), func_VAR() in which these variables can be used.
Debug mode
debug exec(v) shows the code involved (v = 1 in symbolic form, v = 2 macro assembler).
List some errors
OVERFLOW
Stack overflow.
PATENTHESIS ERROR ()
As in:
x=1+2*3);
BRACKETS ERROR ()
As in:
x=tab[1,2]];
BLOCK ERROR {}\
Badly nested blocks.
ILLEGAL ASSIGNMENT
the symbol to the left of the = sign is a constant, as:
2=x;
PI=3.14;
MALLOC ERROR
As in:
x=malloc(-1);
x=malloc(0);
x=malloc(100000000000);
NOT INITIALIZED VARIABLE
a variable is used without having been initialized.
DIRECTIVE ERROR
For example: #defin x 3 instead of #define x 3
arc r,a,da,n
Incomplete definition of an arc (it takes 4 parameters).
attach(num)com1(p1)....obj(id)
Usually it takes num = 0 (for a new attach)).
COMPILATION OFF
Attempt to execute code compiled wrong.
OVERFLOW, increase Dim_ev (in enva.h)
Evaluation stack overflow.
OVERFLOW, increase Dim_mac (in enva.h)
Compile stack overflow
DIVISUIN BY ZERO
As in: x / y when y = 0.
READ ERROR
Reading a non-existent file.
WRITE ERROR
Writing a protected file.
LINK ERROR
Link error, usually an undefined function.
OPERATOR ERROR
Unrecognized operator, for example: x = 1 ++ 2;
FUNCTION(liste)
In general a function defined within a function.
NO LABEL FOUND
goto label; while label: does not exist.
NON DEFINED FUNCTION
Calling a function not present in memory and do not correspond to the first function of a file with that name.
for(ini;cond;inc) { ... }
Synta error for loop, example for(i=1)$i;
if(cond) {bloc} ou if(cond) {bloc1} else {bloc2}
Synta error for a condition.
obj(id)
Attempt to define an object without specifying its identifier id.
Example: cube; prints: cube (id)
obj(id) IS NOT A GRID
Command involving object id requires it of grid type:
ball, geod, grid,
rev, pipe
OBJECT(id) NOT FOUND
The object id does not exist.