Sophie

Sophie

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

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}: SLang_run_hooks</TITLE>
 <LINK HREF="cref-81.html" REL=next>
 <LINK HREF="cref-79.html" REL=previous>
 <LINK HREF="cref.html#toc80" REL=contents>
</HEAD>
<BODY>
<A HREF="cref-81.html">Next</A>
<A HREF="cref-79.html">Previous</A>
<A HREF="cref.html#toc80">Contents</A>
<HR>
<H2><A NAME="SLang_run_hooks"></A> <A NAME="s80">80. <B>SLang_run_hooks</B></A></H2>

<P>
<DL>
<DT><B> Synopsis </B><DD><P>Run a user-defined hook with arguments
<DT><B> Usage </B><DD><P><CODE>int SLang_run_hooks (char *fname, unsigned int n, ...)</CODE>
<DT><B> Description </B><DD><P>The <CODE>SLang_run_hooks</CODE> function may be used to execute a
user-defined function named <CODE>fname</CODE>.  Before execution of the
function, the <CODE>n</CODE> string arguments specified by the variable
parameter list are pushed onto the stack.  If the function
<CODE>fname</CODE> does not exist, <CODE>SLang_run_hooks</CODE> returns zero;
otherwise, it returns <CODE>1</CODE> upon successful execution of the
function, or <CODE>-1</CODE> if an error occurred.
<DT><B> Example </B><DD><P>The <B>jed</B> editor uses <CODE>SLang_run_hooks</CODE> to setup the mode of a
buffer based on the filename extension of the file associated with
the buffer:
<BLOCKQUOTE><CODE>
<PRE>
      char *ext = get_filename_extension (filename);
      if (ext == NULL) return -1;
      if (-1 == SLang_run_hooks ("mode_hook", 1, ext))
        return -1;
      return 0;
</PRE>
</CODE></BLOCKQUOTE>
<DT><B> See Also </B><DD><P><CODE>SLang_is_defined, SLang_execute_function</CODE>
</DL>
<P>
<P>
<P>
<HR>
<A HREF="cref-81.html">Next</A>
<A HREF="cref-79.html">Previous</A>
<A HREF="cref.html#toc80">Contents</A>
</BODY>
</HTML>