Next Previous Contents

43. SLclass_set_push_function

Synopsis

Set the push callback for a new data type

Usage

int SLclass_set_push_function (cl, push_fun)

    SLang_Class_Type *cl
    int (*push_fun) (unsigned char, VOID_STAR);
Description

SLclass_set_push_function is used to set the push callback for a new data type specified by cl, which must have been previously obtained via SLclass_allocate_class.

The parameter push_fun is a pointer to the push callback. It is required to take two arguments: an unsigned character representing the data type, and the address of the object to be pushed. It must return zero upon success, or -1 upon failure.

SLclass_set_push_function returns zero upon success, or -1 upon failure.

Example

The push callback for SLANG_COMPLEX_TYPE looks like:

      static int complex_push (unsigned char type, VOID_STAR ptr)
      {
         double *z = *(double **) ptr;
         return SLang_push_complex (z[0], z[1]);
      }
See Also

SLclass_allocate_class, SLclass_register_class


Next Previous Contents