1
<?xml version="1.0" encoding="UTF-8"?>
2
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="newfun" xml:lang="en">
4
<refname>newfun</refname>
5
<refpurpose>add a name in the table of functions</refpurpose>
8
<title>Calling Sequence</title>
9
<synopsis>newfun(function_name, function_ptr)</synopsis>
12
<title>Arguments</title>
15
<term>function_name</term>
17
<para>a character string, giving a valid function name</para>
21
<term>function_ptr</term>
23
<para>a positive number with integer value (see below)</para>
29
<title>Description</title>
30
<para>Utility function (for experts only). </para>
32
Adds the name <literal>function_name</literal> in the table of
33
functions known to the interpreter.
36
<literal>function_ptr</literal> is an integer
37
<literal>1000*fun+fin</literal> where <literal>fun</literal> and
38
<literal>fin</literal> are the internal coding of the primitive
39
<literal>function_name</literal>.
41
<para>This function may be useful to associate a primitive to a
42
gateway called in <literal>"gw_user.c"</literal>
43
(<literal>fun=14</literal>). Note however that the <link linkend="ilib_build">ilib_build</link> function is a more easy way
44
to extend Scilab with new functions based on C, C++ or Fortran
47
<para>This function may also be used to add an alias or to rename
48
to an existing primitive function.
51
Used with <literal>funptr</literal> and <literal>clearfun</literal>
52
one can add an alias or rename an existing primitive function.
56
<title>Examples</title>
57
<programlisting role="example"><![CDATA[
58
absptr=funptr("abs");// get the function_ptr associated with the abs function
59
newfun("abs_bis",absptr) // create an alias of the abs function
61
clearfun("abs") // remove abs as a known function
71
<refsection role="see also">
72
<title>See Also</title>
73
<simplelist type="inline">
75
<link linkend="clearfun">clearfun</link>
78
<link linkend="funptr">funptr</link>
81
<link linkend="ilib_build">ilib_build</link>