Sophie

Sophie

distrib > Mandriva > 8.1 > i586 > by-pkgid > 700475c8ae73fb4d57b6df4485c29e1c > files > 99

slang-doc-1.4.4-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
 <TITLE> {The S-lang C Library Reference}: SLclass_set_pop_function</TITLE>
 <LINK HREF="cref-46.html" REL=next>
 <LINK HREF="cref-44.html" REL=previous>
 <LINK HREF="cref.html#toc45" REL=contents>
</HEAD>
<BODY>
<A HREF="cref-46.html">Next</A>
<A HREF="cref-44.html">Previous</A>
<A HREF="cref.html#toc45">Contents</A>
<HR>
<H2><A NAME="SLclass_set_pop_function"></A> <A NAME="s45">45. <B>SLclass_set_pop_function</B></A></H2>

<P>
<DL>
<DT><B> Synopsis </B><DD><P>Set the pop callback for a new data type
<DT><B> Usage </B><DD><P><CODE>int SLclass_set_pop_function (cl, pop_fun)</CODE>
<BLOCKQUOTE><CODE>
<PRE>
    SLang_Class_Type *cl
    int (*pop_fun) (unsigned char, VOID_STAR);
</PRE>
</CODE></BLOCKQUOTE>
<DT><B> Description </B><DD><P><CODE>SLclass_set_pop_function</CODE> is used to set the callback for
popping an object from the stack for a new data type specified by
<CODE>cl</CODE>, which must have been previously obtained via
<CODE>SLclass_allocate_class</CODE>. 
<P>The parameter <CODE>pop_fun</CODE> 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 <CODE>-1</CODE> upon
failure.
<P><CODE>SLclass_set_pop_function</CODE> returns zero upon success, or <CODE>-1</CODE>
upon failure.
<DT><B> Example </B><DD><P>The pop callback for <CODE>SLANG_COMPLEX_TYPE</CODE> looks like:
<BLOCKQUOTE><CODE>
<PRE>
      static int complex_push (unsigned char type, VOID_STAR ptr)
      {
         double *z = *(double **) ptr;
         return SLang_pop_complex (&amp;z[0], &amp;z[1]);
      }
</PRE>
</CODE></BLOCKQUOTE>
<DT><B> See Also </B><DD><P><CODE>SLclass_allocate_class, SLclass_register_class</CODE>
</DL>
<P>
<P>
<P>
<HR>
<A HREF="cref-46.html">Next</A>
<A HREF="cref-44.html">Previous</A>
<A HREF="cref.html#toc45">Contents</A>
</BODY>
</HTML>