The library contains some functions which can be used to create and delete easily arrays. The type of variables are the same as for objects (cf. 6):
Type 0 : integers
Type 1 : simple precision real numbers
Type 2 : double precision real numbers
Type 3 : simple precision complex numbers with usual coordinates
Type 4 : double precision complex numbers with usual coordinates
Type 5 : simple precision complex numbers with polar coordinates
Type 6 : double precision complex numbers with polar coordinates
(the way complex numbers are represented is explained in 12). The functions avalaible to create arrays are the following :
int* int_alloc1(int);} int** int_alloc2(int, int);} int*** int_alloc3(int, int, int);} int**** int_alloc4(int, int, int, int);} float* float_alloc1(int);} float** float_alloc2(int, int);} float*** float_alloc3(int, int, int);} float**** float_alloc4(int, int, int, int);} double* double_alloc1(int);} double** double_alloc2(int, int);} double*** double_alloc3(int, int, int);} double**** double_alloc4(int, int, int, int);} fcomplex* fcomplex_alloc1(int);} fcomplex** fcomplex_alloc2(int, int);} fcomplex*** fcomplex_alloc3(int, int, int);} fcomplex**** fcomplex_alloc4(int, int, int, int);} dcomplex* dcomplex_alloc1(int);} dcomplex** dcomplex_alloc2(int, int);} dcomplex*** dcomplex_alloc3(int, int, int);} dcomplex**** dcomplex_alloc4(int, int, int, int);} fpolaire* fpolaire_alloc1(int);} fpolaire** fpolaire_alloc2(int, int);} fpolaire*** fpolaire_alloc3(int, int, int);} fpolaire**** fpolaire_alloc4(int, int, int, int);} dpolaire* dpolaire_alloc1(int);} dpolaire** dpolaire_alloc2(int, int);} dpolaire*** dpolaire_alloc3(int, int, int);} dpolaire**** dpolaire_alloc4(int, int, int, int);}
The types fcomplex, dcomplex, fpolaire, dpolaire represent complex numbers (cf. 12). The number in the name of the function gives the number of dimensions of the created array. The parameters are the dimensions (which must be positive) (the indices which are allowed in such an array can vary between 0 and the given dimensions). For instance
float ***xx;
xx = float_alloc3(2,4,3);
will create a 3-dimensional array. The indices allowed for the first dimension can be 0, 1, or 2, and so on. There is a unique function to delete all such arrays. It is the macro XFREE.
XFREE(xx);
will free the memory used to store the array xx.
It is possible to create arrays with more than 4 dimensions, using the function
memm* memm_alloc(int*, int, int);
(the structure memm is defined in the file interp.h). To create an array with n dimensions we need for an array d which contain the dimensions of the array : d[0],...,d[n] must be positive numbers. Then we create a memm structure :
memm* M;
M = memm_alloc(d, n, type);
where type is the type of variables of the array (an integer between 0 and 6). To get the array we use then member ad of the structure M[0]. For instance, if it is an array of double precision real numbers with 5 dimensions (i.e n=5 and type=2) we have
double *****xx;
xx = (double*****) M[0].ad;
Most of these functions correspond to commands. They are of the following type
int func(int argc,char *argv[]);
where argc is the number of arguments (including the name of the command) and argv[] the arguments. It is possible to call these functions (to simulate the execution of the corresponding commands). The list of commands is given in 10.
int add_objet(int argc,char *argv[]);
This function corresponds to the command add.
int assign_membre(int argc, char *argv[]) ;
This function corresponds to the command assign.
This function returns a (null-terminated) copy of its argument (and allocates memory for this).
This function returns a string containing the value of the argument. For example if i=5785, ch_copy_int(i) will be the null-terminated string ``5785''.
void clean_exit_interp(flow_data *);
This function is called when the command exit is given. It frees all the memory used by the interpreter. The argument is the thread from which it is been called. It can be used when the interpreter is used non-interactively (cf. 13.3).
int Cmult_objet(int argc,char *argv[]);
This function corresponds to the command cmultiply.
int copie_objet(int argc,char *argv[]);
This function corresponds to the command copy.
int convert_int(char *, flow_data *);
This function sends the first argument to the expression evaluator and returns its evaluation casted to an int (see 7). The second argument is the flow_data structure corresponding to the thread from which the function is called.
double convert_float(char *, flow_data *) ;
This function sends the first argument to the expression evaluator and returns the evaluation (see 7). The second argument is the flow_data structure corresponding to the thread from which the function is called.
int delcom(int argc, char *argv[]);
This function corresponds to the command delcom.
int deldon(int argc, char *argv[]);
This function corresponds to the command deldat.
int delprog_cmd(int argc, char *argv[]);
This function corresponds to the command delprog.
int delres(int argc, char *argv[]);
This function corresponds to the command delres.
int desassign_membre(int argc, char *argv[]) ;
This function corresponds to the command desassign.
int detruit_obj(int argc, char *argv[]);
This function corresponds to the command destroy.
void error_mess(flow_data *, int);
This function prints the message whose number is the second argument. These messages are defined in the initialization file (cf. 3). The first argument is the flow_data structure corresponding to the thread from which the function is called.
void Exec_interp_command(char *);
This function executes the command contained in the argument. It should be used when the interpreter has to work non-interactively.
int init_obj(int, flow_data *);
This function deletes all the objects of the type given in argument. The second argument is the flow_data structure corresponding to the thread from which the function is called.
int init_str(int, flow_data *);
This function deletes all the structures of the type given in argument. The second argument is the flow_data structure corresponding to the thread from which the function is called.
int load_cmd(int argc, char *argv[]);
This function corresponds to the command load. It can also be used to load programs when the interpreter is working in a non-interactive way. In this case the function will load the programs contained in the string argv[1], argv[0] must be NULL and argc=0 (see 13.3).
This function loads the program file W in the command directory. This function should be useful in particular when the interpreter is used in a non-interactive way.
int mult_objet(int argc,char *argv[]);
This function corresponds to the command multiply.
int obj_create(int argc, char *argv[]);
This function corresponds to the commands creating objects (cf. 6).
void print(flow_data *, char *, ...);
This function is a version of printf (only the flags %d, %f and %s are supported) with the following modifications : if the interpreter is running silently (for instance inside a silent program or after the command silence...) nothing will be printed. Moreover if a monitor file has been defined this function will also print in this file. The first argument is the flow_data structure corresponding to the thread from which the function is called. See also the command send_print.
void prog_c(int, char *, char *, char *, int, char *, int) ;
This is the function that launches the command interpreter or initializes it when it is used non-interactively (cf. 13).
void read_char(char *, flow_data *);
This function can be used instead of scanf to read input (character strings). It will behave like scanf if the interperter is used in an interactive way, but differently if it is running a program (cf. 4.8.3). The second argument is the flow_data structure corresponding to the thread from which the function is called.
void read_float(float *, flow_data *);
This function can be used instead of scanf to read input (floating point numbers). It will behave like scanf if the interperter is used in an interactive way, but differently if it is running a program (cf. 4.8.3). The second argument is the flow_data structure corresponding to the thread from which the function is called.
void read_int(int *, flow_data *);
This function can be used instead of scanf to read input (integers). It will behave like scanf if the interperter is used in an interactive way, but differently if it is running a program (cf. 4.8.3). The second argument is the flow_data structure corresponding to the thread from which the function is called.
int restore_cmd(int argc,char *argv[]);
This function corresponds to the command restore.
int S_convert_int(char *, flow_data *) ;
This function is used to manipulate hidden variables of the expression evaluator (cf. 7). The second argument is the flow_data structure corresponding to the thread from which the function is called.
int S_convert_float(char *, flow_data *) ;
This function is used to manipulate hidden variables of the expression evaluator (cf. 7). The second argument is the flow_data structure corresponding to the thread from which the function is called.
int shell_cmd(int argc, char *argv[]);
This function corresponds to the command shell.
int sketch_obj(char *, int *, flow_data *);
This function is used to manipulate objects (cf. 6.2). The last argument is the flow_data structure corresponding to the thread from which the function is called.
int sketch_obj_restr(char *, int *, int, flow_data *) ;
This function is used to manipulate objects (cf. 6.2). The last argument is the flow_data structure corresponding to the thread from which the function is called.
int sketch_struc(int, int, char *, int *, flow_data *) ;
This function is used to manipulate structures (cf. 6.9). The last argument is the flow_data structure corresponding to the thread from which the function is called.
int struc_create(int argc, char *argv[]);
This function corresponds to the commands creating structures (cf. 6).
int sub_objet(int argc,char *argv[]);
This function corresponds to the command substract.
int svg_cmd(int argc,char *argv[]);
This function corresponds to the command svg.
int undef_cmd(int argc, char *argv[]);
This function corresponds to the command undef.