GetListRhsVar — a C gateway function which allows to access a parameter stored in a [mt]list transmitted to a Scilab function
GetListRhsVar(StackPos,ListPos, Type, &m_rows, &n_cols, &l_stack_pos);
the rank of the [mt]list to be accessed (input parameter)
the rank in the list of the parameter to be accessed (input parameter)
the Scilab type of the parameter to be accessed (input parameter). Can be (see Scilab C Type for more informations):
STRING_DATATYPE "c"
MATRIX_OF_STRING_DATATYPE "S"
MATRIX_OF_DOUBLE_DATATYPE "d"
MATRIX_OF_RATIONAL_DATATYPE "r"
MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE "I"
MATRIX_OF_INTEGER_DATATYPE "i"
MATRIX_OF_BOOLEAN_DATATYPE "b"
MATRIX_OF_COMPLEX_DATATYPE "z"
SPARSE_MATRIX_DATATYPE "s"
TYPED_LIST_DATATYPE "t"
MATRIX_ORIENTED_TYPED_LIST_DATATYPE "m"
SCILAB_POINTER_DATATYPE "p"
GRAPHICAL_HANDLE_DATATYPE "h"
EXTERNAL_DATATYPE "f"
MATRIX_OF_POLYNOMIAL_DATATYPE "x"
the number of lines of the accessed parameter (output parameter)
the number of columns of the accessed parameter (output parameter)
the position on the stack of the accessed parameter (output parameter)
A C gateway function which allows to access a parameter stored in a [mt]list transmitted to a Scilab function
WARNING: This API is deprecated from Scilab 5.2.0 and is going to be removed with Scilab 6.0. Please use API Scilab (the new Scilab API).
In this example, the function has one input parameter. It gets a mlist and the prints some informations related to the content of the mlist.
#include <stack-c.h> #include <sciprint.h> int sci_print_list(char * fname) { int m_list_in, n_list_in, l_list_in; int m_type, n_type; int m_var1, n_var1, l_var1; int m_var2, n_var2, l_var2; char ** LabelList = NULL; CheckRhs(1,1); // We accept only 1 parameter GetRhsVar(1,"m",&m_list_in,&n_list_in,&l_list_in); // Get a mlist // Get the type and the name of the variables (the first element of the mlist) GetListRhsVar(1,1,"S",&m_type,&n_type,&LabelList); if (strcmp(LabelList[0],"mytype")!=0) { sciprint("error, you must ship a mlist or type mytype\n"); return 0; } // Get the first variable (a string) GetListRhsVar(1,2,"c",&m_var1,&n_var1,&l_var1); sciprint("var1 = %s\n",cstk(l_var1)); // Get the second variable (a double matrix) GetListRhsVar(1,3,"d",&m_var2,&n_var2,&l_var2); sciprint("var2 = [%f %f %f %f]\n",*stk(l_var2+0), *stk(l_var2+1), *stk(l_var2+2), *stk(l_var2+3)); return 0; }
This example is available in SCI/modules/core/example/print_list.