~ubuntu-branches/ubuntu/raring/scilab/raring-proposed

« back to all changes in this revision

Viewing changes to modules/functions/help/en_US/newfun.xml

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-08-30 14:42:38 UTC
  • mfrom: (1.4.7)
  • Revision ID: package-import@ubuntu.com-20120830144238-c1y2og7dbm7m9nig
Tags: 5.4.0-beta-3-1~exp1
* New upstream release
* Update the scirenderer dep
* Get ride of libjhdf5-java dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
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">
3
 
  <refnamediv>
4
 
    <refname>newfun</refname>
5
 
    <refpurpose>add a name in the table of functions</refpurpose>
6
 
  </refnamediv>
7
 
  <refsynopsisdiv>
8
 
    <title>Calling Sequence</title>
9
 
    <synopsis>newfun(function_name, function_ptr)</synopsis>
10
 
  </refsynopsisdiv>
11
 
  <refsection>
12
 
    <title>Arguments</title>
13
 
    <variablelist>
14
 
      <varlistentry>
15
 
        <term>function_name</term>
16
 
        <listitem>
17
 
          <para>a character string, giving a valid function name</para>
18
 
        </listitem>
19
 
      </varlistentry>
20
 
      <varlistentry>
21
 
        <term>function_ptr</term>
22
 
        <listitem>
23
 
          <para>a positive number with integer value (see below)</para>
24
 
        </listitem>
25
 
      </varlistentry>
26
 
    </variablelist>
27
 
  </refsection>
28
 
  <refsection>
29
 
    <title>Description</title>
30
 
    <para>Utility function (for experts only). </para>
31
 
    <para>
32
 
      Adds the name <literal>function_name</literal> in the table of
33
 
      functions known to the interpreter. 
34
 
    </para>
35
 
    <para>
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>. 
40
 
    </para>
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
45
 
      code.
46
 
    </para>
47
 
    <para>This function may also be used to add an alias or to rename
48
 
      to an existing primitive function.
49
 
    </para>
50
 
    <para>
51
 
      Used with <literal>funptr</literal> and <literal>clearfun</literal>
52
 
      one can add an alias or  rename an existing primitive function.
53
 
    </para>
54
 
  </refsection>
55
 
  <refsection>
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
60
 
     abs_bis(-1+%i)
61
 
     clearfun("abs") // remove abs as a known function
62
 
     
63
 
      //redefine abs
64
 
      function y=abs(x)
65
 
        y=abs_bis(real(x));
66
 
      endfunction
67
 
      
68
 
     abs(-1+%i)
69
 
  ]]></programlisting>
70
 
  </refsection>
71
 
  <refsection role="see also">
72
 
    <title>See Also</title>
73
 
    <simplelist type="inline">
74
 
      <member>
75
 
        <link linkend="clearfun">clearfun</link>
76
 
      </member>
77
 
      <member>
78
 
        <link linkend="funptr">funptr</link>
79
 
      </member>
80
 
      <member>
81
 
        <link linkend="ilib_build">ilib_build</link>
82
 
      </member>
83
 
    </simplelist>
84
 
  </refsection>
85
 
</refentry>