Update toolbox guide
Farid Belahcene [Fri, 1 Sep 2006 13:32:51 +0000 (13:32 +0000)]
13 files changed:
scilab_doc/toolbox_guide/toolbox_example/help/buildhelp.sce [new file with mode: 0644]
scilab_doc/toolbox_guide/toolbox_example/help/foo1.xml [new file with mode: 0644]
scilab_doc/toolbox_guide/toolbox_example/help/loadhelp.sce [new file with mode: 0644]
scilab_doc/toolbox_guide/toolbox_example/help/sumab.xml [new file with mode: 0644]
scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libmytoolbox.a [new file with mode: 0644]
scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libmytoolbox.lai [new file with mode: 0644]
scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libmytoolbox.so [new file with mode: 0755]
scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libtoolbox_example.a [new file with mode: 0644]
scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libtoolbox_example.lai [new file with mode: 0644]
scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libtoolbox_example.so [new file with mode: 0755]
scilab_doc/toolbox_guide/toolbox_example/sci_gateway/buildsci_gateway.sce [new file with mode: 0644]
scilab_doc/toolbox_guide/toolbox_example/sci_gateway/sci_fun.c [new file with mode: 0644]
scilab_doc/toolbox_guide/toolbox_example/sci_gateway/sci_sumab.c [new file with mode: 0644]

diff --git a/scilab_doc/toolbox_guide/toolbox_example/help/buildhelp.sce b/scilab_doc/toolbox_guide/toolbox_example/help/buildhelp.sce
new file mode 100644 (file)
index 0000000..b4cd3b8
--- /dev/null
@@ -0,0 +1,6 @@
+mode(-1) //force silent execution
+path=get_absolute_file_path('builhelp.sce');//get the absolute path of this file
+add_help_chapter("Title1",path);//add help chapter
+xmltohtml(path,"Title1")
+//clear the variable stack
+clear path add_help_chapter get_absolute_file_path 
\ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/help/foo1.xml b/scilab_doc/toolbox_guide/toolbox_example/help/foo1.xml
new file mode 100644 (file)
index 0000000..480b982
--- /dev/null
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "/home/scilab/scilab-3.0/man/manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>foo1</TITLE>
+  <TYPE>Scilab Function  </TYPE>
+  <DATE>25-Mar-2006</DATE>
+  <SHORT_DESCRIPTION name="foo1">  Returns the positive components of A diagonal</SHORT_DESCRIPTION>
+
+  <CALLING_SEQUENCE>
+  <CALLING_SEQUENCE_ITEM>X = foo1(A)</CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+
+  <PARAM>
+  <PARAM_INDENT>
+
+    <PARAM_ITEM>
+    <PARAM_NAME>A</PARAM_NAME>
+    <PARAM_DESCRIPTION>
+       <SP>
+       : a square matrix of reals
+       </SP>
+    </PARAM_DESCRIPTION>
+    </PARAM_ITEM>
+
+    <PARAM_ITEM>
+    <PARAM_NAME>X</PARAM_NAME>
+    <PARAM_DESCRIPTION>
+       <SP>
+       : a vector of positive reals
+       </SP>
+    </PARAM_DESCRIPTION>
+    </PARAM_ITEM>
+  </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+     <DESCRIPTION_INDENT>
+     <DESCRIPTION_ITEM>
+     <P>
+      This function returns a vector containing the positive components of the A diagonal. A must be a square matrix. 
+      Other paragraph can be added 
+     </P>
+     </DESCRIPTION_ITEM>
+     </DESCRIPTION_INDENT>
+  </DESCRIPTION>
+
+  <EXAMPLE><![CDATA[
+  A=rand(5,5)-1/2;
+  X=foo1(A);
+  ]]></EXAMPLE>
+
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM> <LINK> diag</LINK> </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+
+  <BIBLIO>
+    Add here the function bibliography if any
+  </BIBLIO>
+
+  <AUTHORS>
+    <AUTHORS_ITEM label='F.Belahcene'>
+    </AUTHORS_ITEM>
+  </AUTHORS>
+  <USED_FUNCTIONS>
+     Add here the used function name and  references
+  </USED_FUNCTIONS>
+</MAN>
diff --git a/scilab_doc/toolbox_guide/toolbox_example/help/loadhelp.sce b/scilab_doc/toolbox_guide/toolbox_example/help/loadhelp.sce
new file mode 100644 (file)
index 0000000..8d9c3e1
--- /dev/null
@@ -0,0 +1,4 @@
+mode(-1) //force silent execution
+path=get_absolute_file_path('loadhelp.sce');//get the absolute path of this file
+add_help_chapter("Title1",path);//add help chapter
+clear path add_help_chapter get_absolute_file_
\ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/help/sumab.xml b/scilab_doc/toolbox_guide/toolbox_example/help/sumab.xml
new file mode 100644 (file)
index 0000000..b53db11
--- /dev/null
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "/home/scilab/scilab-3.0/man/manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>scisum</TITLE>
+  <TYPE>Scilab Function  </TYPE>
+  <DATE>25-Mar-2006</DATE>
+  <SHORT_DESCRIPTION name="scisum">  add short decription here</SHORT_DESCRIPTION>
+
+  <CALLING_SEQUENCE>
+  <CALLING_SEQUENCE_ITEM>y = scisum(a,b)</CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+
+  <PARAM>
+  <PARAM_INDENT>
+
+    <PARAM_ITEM>
+    <PARAM_NAME>a</PARAM_NAME>
+    <PARAM_DESCRIPTION>
+       <SP>
+       : add here the parameter description
+       </SP>
+    </PARAM_DESCRIPTION>
+    </PARAM_ITEM>
+
+    <PARAM_ITEM>
+    <PARAM_NAME>b</PARAM_NAME>
+    <PARAM_DESCRIPTION>
+       <SP>
+       : add here the parameter description
+       </SP>
+    </PARAM_DESCRIPTION>
+    </PARAM_ITEM>
+
+    <PARAM_ITEM>
+    <PARAM_NAME>y</PARAM_NAME>
+    <PARAM_DESCRIPTION>
+       <SP>
+       : add here the parameter description
+       </SP>
+    </PARAM_DESCRIPTION>
+    </PARAM_ITEM>
+  </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+     <DESCRIPTION_INDENT>
+     <DESCRIPTION_ITEM>
+     <P>
+      Add here a paragraph of the function description. 
+      Other paragraph can be added 
+     </P>
+     </DESCRIPTION_ITEM>
+     <DESCRIPTION_ITEM>
+     <P>
+      Add here a paragraph of the function description 
+     </P>
+     </DESCRIPTION_ITEM>
+     </DESCRIPTION_INDENT>
+  </DESCRIPTION>
+
+  <EXAMPLE><![CDATA[
+   Add here scilab instructions and comments
+  ]]></EXAMPLE>
+
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM> <LINK> add a key here</LINK> </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM> <LINK> add a key here</LINK> </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+
+  <BIBLIO>
+    Add here the function bibliography if any
+  </BIBLIO>
+
+  <AUTHORS>
+    <AUTHORS_ITEM label='enter here the author name'>
+    Add here the author  references
+    </AUTHORS_ITEM>
+  </AUTHORS>
+  <USED_FUNCTIONS>
+     Add here the used function name and  references
+  </USED_FUNCTIONS>
+</MAN>
diff --git a/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libmytoolbox.a b/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libmytoolbox.a
new file mode 100644 (file)
index 0000000..ffb9e4c
Binary files /dev/null and b/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libmytoolbox.a differ
diff --git a/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libmytoolbox.lai b/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libmytoolbox.lai
new file mode 100644 (file)
index 0000000..b229a60
--- /dev/null
@@ -0,0 +1,35 @@
+# libmytoolbox.la - a libtool library file
+# Generated by ltmain.sh - GNU libtool 1.5.20 (1.1220.2.287 2005/08/31 18:54:15)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='libmytoolbox.so'
+
+# Names of this library.
+library_names='libmytoolbox.so libmytoolbox.so libmytoolbox.so'
+
+# The name of the static archive.
+old_library='libmytoolbox.a'
+
+# Libraries that this one depends upon.
+dependency_libs=' -lieee'
+
+# Version information for libmytoolbox.
+current=0
+age=0
+revision=0
+
+# Is this an already installed library?
+installed=yes
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=yes
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir='/home/belahcene/Desktop/mytoolbox/sci_gateway'
diff --git a/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libmytoolbox.so b/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libmytoolbox.so
new file mode 100755 (executable)
index 0000000..585e167
Binary files /dev/null and b/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libmytoolbox.so differ
diff --git a/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libtoolbox_example.a b/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libtoolbox_example.a
new file mode 100644 (file)
index 0000000..b36ac1a
Binary files /dev/null and b/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libtoolbox_example.a differ
diff --git a/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libtoolbox_example.lai b/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libtoolbox_example.lai
new file mode 100644 (file)
index 0000000..c95b8b9
--- /dev/null
@@ -0,0 +1,35 @@
+# libtoolbox_example.la - a libtool library file
+# Generated by ltmain.sh - GNU libtool 1.5.20 (1.1220.2.287 2005/08/31 18:54:15)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='libtoolbox_example.so'
+
+# Names of this library.
+library_names='libtoolbox_example.so libtoolbox_example.so libtoolbox_example.so'
+
+# The name of the static archive.
+old_library='libtoolbox_example.a'
+
+# Libraries that this one depends upon.
+dependency_libs=' -lieee'
+
+# Version information for libtoolbox_example.
+current=0
+age=0
+revision=0
+
+# Is this an already installed library?
+installed=yes
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=yes
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir='/home/belahcene/Desktop/toolbox_example/interface'
diff --git a/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libtoolbox_example.so b/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libtoolbox_example.so
new file mode 100755 (executable)
index 0000000..a409396
Binary files /dev/null and b/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/.libs/libtoolbox_example.so differ
diff --git a/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/buildsci_gateway.sce b/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/buildsci_gateway.sce
new file mode 100644 (file)
index 0000000..01ee497
--- /dev/null
@@ -0,0 +1,8 @@
+// must be run from this directory
+ilib_name  = 'libmytoolbox'     // interface library name
+files = ['sci_fun.o', 'sci_sumab.o'];  // objects files
+libs  = ["../src/libmytoolboxsrc"]                 // other libs needed for linking
+table = [ 'fun', 'sci_fun';
+        'sumab','sci_sumab'];        // table of (scilab_name,interface-name)
+// do not modify below
+ilib_build(ilib_name,table,files,libs)
\ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/sci_fun.c b/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/sci_fun.c
new file mode 100644 (file)
index 0000000..66e77cd
--- /dev/null
@@ -0,0 +1,77 @@
+#include "stack-c.h"
+
+extern void fun1(double * ,  int, int *, double **, double *);
+
+int sci_fun(char *fname)
+{
+        int la, ma, na, m=1, nx, i, lx, ls;
+        double * x, s;
+
+        /* 1 - Check the number of inputs and outputs arguments */
+        /* You can use the variables: Lhs and Rhs */
+        int minlhs=1, maxlhs=2, minrhs=1, maxrhs=1;
+        CheckRhs(minrhs,maxrhs) ;
+        CheckLhs(minlhs,maxlhs) ;
+
+        /* 2 - Check the rhs type, get the rows number (ma) and the columns number (na) of rhs, and its adress (la) in the Scilab stack (first position) */
+        GetRhsVar(1, "d", &ma, &na, &la); 
+
+        /* 3 - Check rhs is a vector */
+        if(ma!=0 && na!=0 )
+        {
+                if(ma!=1 && na!=1)
+                {
+                        cerro("input argument must be a vector");
+                        return(0);
+                }
+        }
+
+        fun1(stk(la), na*ma, &nx, &x, &s);
+
+        /* 4 - Create the place for the first output argument x ( a vector of doubles, size: 1*nx ) to the address lx in the Scilab stack (second position) */
+        CreateVar(2, "d", &m, &nx, &lx);
+
+        /* if there are two outputs variables then: Create the place for the second output s ( a double, size 1*1) to the adress ls in the Scilab stack (third position) */ 
+        /* get the value of s, and put it in the Scilab stack */
+        if(Lhs==2)
+        {
+                CreateVar(3, "d", &m, &m, &ls);
+                *stk(ls)=s;
+        }
+
+        /* get the components of x, and put them in the Scilab stack */
+        for(i=0;i<nx;i++) 
+                stk(lx)[i]=x[i];
+
+        /* free memory */
+        free(x);
+
+        /* 5 - Specification of outputs variables */
+        LhsVar(1) = 2;
+        if(Lhs==2)
+                LhsVar(2) = 3;
+        return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/sci_sumab.c b/scilab_doc/toolbox_guide/toolbox_example/sci_gateway/sci_sumab.c
new file mode 100644 (file)
index 0000000..84e3019
--- /dev/null
@@ -0,0 +1,41 @@
+#include "stack-c.h"
+extern int vectsum(int n, double * a, double * b, double * y); 
+
+void sci_sumab(char *fname){  
+int l1, m1, n1, l2, m2, n2, l3, n;   
+                
+/* 1 - Check the number of inputs/outputs arguments  */  
+int minlhs=1, maxlhs=1, minrhs=2, maxrhs=2; 
+CheckRhs(minrhs,maxrhs) ; 
+CheckLhs(minlhs,maxlhs) ; 
+
+/* 2 - Check inputs arguments type, and get the size and the adress in the Scilab stack of the inputs arguments */  
+GetRhsVar(1, "d", &m1, &n1, &l1);
+GetRhsVar(2, "d", &m2, &n2, &l2);
+                
+/* 3 - Check that the inputs arguments have the same size */
+/* it's possible to use the chekdims and getscalar functions to do these checks*/ 
+n=m2*n2; 
+if( n1!=n2 || m1!=m2) 
+{
+        cerro("inputs arguments must have the same size"); 
+        return 0; 
+}       
+if(n1!=0 && m1!=0)    
+        if(n1!=1 && m1!=1)   
+        {
+                cerro("inputs arguments must be vectors");    
+                return(0); 
+        }
+                 
+                
+/* 4 - Create a new variable corresponding to the output argument */ 
+CreateVar(3,"d",&m2,&n2,&l3);   
+
+/* 5 -call vectmab routine to perform a+b */
+vectsum(n,stk(l1),stk(l2),stk(l3));  
+                
+/* 6 - Specif the ouput argument */  
+LhsVar(1) = 3;  
+return 0;
+}
\ No newline at end of file