Set the pop callback for a new data type
int SLclass_set_pop_function (cl, pop_fun)
SLang_Class_Type *cl
int (*pop_fun) (unsigned char, VOID_STAR);
SLclass_set_pop_function
is used to set the callback for
popping an object from the stack for a new data type specified by
cl
, which must have been previously obtained via
SLclass_allocate_class
.
The parameter pop_fun
is a pointer to the pop callback
function, which is required to take two arguments: an unsigned
character representing the data type, and the address of the object
to be popped. It must return zero upon success, or -1
upon
failure.
SLclass_set_pop_function
returns zero upon success, or -1
upon failure.
The pop callback for SLANG_COMPLEX_TYPE
looks like:
static int complex_push (unsigned char type, VOID_STAR ptr)
{
double *z = *(double **) ptr;
return SLang_pop_complex (&z[0], &z[1]);
}
SLclass_allocate_class, SLclass_register_class