summaryrefslogtreecommitdiffstats
path: root/scilab_doc
diff options
context:
space:
mode:
authorPierre Marechal <pierre.marechal@scilab.org>2006-04-19 13:49:56 +0000
committerPierre Marechal <pierre.marechal@scilab.org>2006-04-19 13:49:56 +0000
commit62f0407b4f6da66a39ea077ce5dcdd606f9d76fd (patch)
tree69fbd877c17984dbb7314b46e59ab72beb475522 /scilab_doc
parentc1352445e7641929df8127ece934b131dc61a288 (diff)
downloadscilab-62f0407b4f6da66a39ea077ce5dcdd606f9d76fd.zip
scilab-62f0407b4f6da66a39ea077ce5dcdd606f9d76fd.tar.gz
First import of the toolbox guide
Diffstat (limited to 'scilab_doc')
-rw-r--r--scilab_doc/toolbox_guide/html/toolbox.css7
-rw-r--r--scilab_doc/toolbox_guide/html/toolbox.html717
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/README73
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/builder.sce24
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/interface/builder.sce8
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/interface/intfun1.c56
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/interface/intsumab.c41
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/loader.sce19
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/macros/builder.sce6
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/macros/foo1.sci18
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/macros/loader.sce5
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/man/builder.sce6
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/man/foo1.xml68
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/man/loader.sce4
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/man/scifoo2.xml83
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/man/scisum.xml83
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/src/builder.sce1
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/src/fun1.c17
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/src/fun2.c8
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/src/sumab.c5
-rw-r--r--scilab_doc/toolbox_guide/toolbox_example/tests/tests.sce20
21 files changed, 1269 insertions, 0 deletions
diff --git a/scilab_doc/toolbox_guide/html/toolbox.css b/scilab_doc/toolbox_guide/html/toolbox.css
new file mode 100644
index 0000000..1651fc0
--- /dev/null
+++ b/scilab_doc/toolbox_guide/html/toolbox.css
@@ -0,0 +1,7 @@
1<style type="text/css">
2var {font-style:italic;}
3table.entete {background-color:"#CCCCCC";
4 border:thin solid black;}
5.souligne {text-decoration:underline;}
6P EM {text-decoration:underline;}
7</style> \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/html/toolbox.html b/scilab_doc/toolbox_guide/html/toolbox.html
new file mode 100644
index 0000000..e4d9869
--- /dev/null
+++ b/scilab_doc/toolbox_guide/html/toolbox.html
@@ -0,0 +1,717 @@
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4
5<title>toolbox_example</title>
6<LINK rel=STYLESHEET href="toolbox.css" type="text/css">
7</head>
8
9<body>
10
11<h1 center>Guide for the toolboxes contribution (general application)</h1>
12<p>This article describes a standart method to create a Scilab toolbox.<br>
13The objective is to help the contributors to build a toolbox easily, but also that the users are able to install it with just the execution of a main builder and a main loader script.<br>
14We show in first time how to structure your toolbox (sub-directories contents, files, ...), in second time how to customize the templates to create the builder(s), the loader(s), and the Scilab help files. To finish we explain how to upload your contribution on the scilab website.<br>
15For this article the reference toolbox name is <b>toolbox_example</b>.
16(The above standarisation is not mandatory) </p>
17
18<a href="#chap1">1. Toolbox composition</a><br><br>
19
20<a href="#chap2">2. Sub-builders and sub-loaders</a><br>
21<ul>
22<li><a href="#chap2.1">2.1 The macros directory</a><br></li>
23<ul>
24<li><a href="#chap2.1.1">2.1.1 Creation of the builder</a><br></li>
25<li><a href="#chap2.1.2">2.1.2 Creation of the loader</a><br></li>
26</ul>
27<li><a href="#chap2.2">2.2 The src directory</a><br></li>
28<ul>
29<li><a href="#chap2.2.1">2.2.1 Interface</a><br></li>
30<li><a href="#chap2.2.2">2.2.2 Creation of the builder</a><br></li>
31</ul>
32<li><a href="#chap2.3">2.3 The man directory</a><br>
33<ul>
34<li><a href="#chap2.3.1">2.3.1 Creation of .xml files</a><br></li>
35<li><a href="#chap2.3.2">2.3.2 Creation of the builder</a><br></li>
36<li><a href="#chap2.3.3">2.3.3 Creation of the loader</a><br><br></li>
37</ul>
38</ul>
39<a href="#chap3">3. The main builder and loader</a><br><br>
40<a href="#chap4">4. Upload your toolbox</a><br>
41
42
43<a name="#chap1"></a>
44<h2 class=souligne>1. Toolbox composition</h2>
45<p>The root directory has the generic name of the toolbox (here <b>toolbox_example</b>), it contains 7 sub-directories:</p>
46
47<ul style="list-style-type: disc">
48<li><b>macros</b>: Scilab macros (all .sci files),the builder and loader scripts</li>
49<li><b>src</b>: code source (all .c and .f files), a builder script</li>
50<li><b>interface</b>: interface programs, a builder</li>
51<li><b>man</b>: all .xml files, the builder and loader scripts</li>
52<li><b>doc</b>: .html, .pdf, .txt, .jpeg, ...</li>
53<li><b>tests</b>: scripts to test your toolbox</li>
54<li><b>demos</b>: different examples to illustrate your toolbox</li>
55</ul>
56and 3 files:
57<ul style="list-style-type: disc">
58<li><b>README</b>: toolbox description and installation</li>
59<li><b>builder.sce</b></li>
60<li><b>loader.sce</b></li>
61</ul>
62
63<a name="#chap2"></a>
64<h2 class=souligne>2. Sub-builders and sub-loaders</h2>
65<p>The main builder and main loader scripts launch respectively the sub-builders and sub-loaders included in the sub-directories (macros, src, man, ...), to generate and to load the necessary libraries and the Scilab help files.
66</p>
67
68<a name="#chap2.1"></a>
69<h3 class=souligne>2.1 The macros directoy</h3>
70<p>The main builder and main loader scripts launche respectively the sub-builders and sub-loaders included in the sub-directories (macros, man, ...), to generate and to load the necessary libraries and the Scilab help files.
71This directory included macros Scilab functions, a builder and a loader script.<br>
72A macros is a function written in Scilab code (included in .sci file)<br>
73We consider that the macros directory of the toolbox <b>toolbox_example</b> contains just one .sci file: the function <var><strong>foo1</strong></var> (see above script). Given a matrix A, this function returns the positive components of the A diagonal.
74</p>
75foo1.sci<br />
76
77<table class=entete>
78 <tr>
79 <td>
80<pre>
81function [X]=foo1(A)
82// This function returns the positive components of the A diagonal
83
84// Check the type and the size of A
85if type(A)<>1 then
86 error("type of input argument must be a double");
87end
88if size(A,1)<>size(A,2) then
89 error("input argument must be a square matrix");
90end
91//Extraction of the positive components
92X=[];
93for i=1:size(A,1)
94 if A(i,i)>0 then
95 X($+1)=A(i,i);
96 end
97end
98endfunction
99</pre>
100 </td>
101 </tr>
102</table>
103
104
105<a name="#chap2.1.1"></a>
106<h4 class=souligne>2.1.1 Creation of the builder</h4>
107<p>The builder (see above script) creates a library variable, (named here: toolbox_examplelib= toolbox name +'lib') from functions .sci include in the directory macros, and saves it in the file lib.
108 The builder code is generic, it's done in 2 steps, the first to locate macrosbuilder.sce script (see help <var><strong>get_absolute_file_path</strong></var> function), and the second to generate the library (see help <strong><var>genlib</strong></var> function).
109
110</p>
111builder.sce
112<table class=entete>
113 <tr>
114 <td>
115<pre>
116mode(-1)
117toolboxname='toolbox_example'
118pathB=get_absolute_file_path('builder.sce')
119disp('Building macros in ' +pathB)
120genlib(toolboxname+'lib',pathB,%t)
121clear pathB genlib toolboxname
122</pre>
123 </td>
124 </tr>
125</table>
126
127<br>
128To customize this template, replace the characters string 'toolbox_example' by the name of your toolbox.
129
130<a name="#chap2.1.2"></a>
131<h4 class=souligne>2.1.2 Creation of the loader</h4>
132<p>The loader (see above script) loads the library lib included in the directory macros. Like the builder, the code is generic, the first step to locate macrosloader.sce script, and the second to load the library (see help <strong><var>load</strong></var> function)
133</p>
134
135loader.sce
136<table class=entete>
137 <tr>
138 <td>
139<pre>
140mode(-1)
141pathL=get_absolute_file_path('loader.sce')
142disp('Loading macros in ' +pathL)
143load(pathL+'/lib')
144clear pathL
145</pre>
146 </td>
147 </tr>
148</table>
149
150
151<a name="#chap2.2"></a>
152<h3 class=souligne>2.2 The src directory</h3>
153<p>This directory included .c files and a builder script<br>
154A Scilab primitive is a Scilab function which calls a function written in C or fortran code (using an interface program)<br>
155Before to write the builder, its necessary to create for each primitives the corresponding interface programs. When a Scilab primitive is called, the interface program checks that the number, the type and the size of inputs/outputs arguments is correct (using CheckRhs and CheckLhs functions), and get the adress of the rhs arguments which are in Scilab internal stack to give this information at the interfaced function. So in the first part we explain, thanks to template, how to implement some interfaces programs (written in C code). In this article we don't describe all the possibilities of the interface programs, for more explanations see the directory SCI/examples.
156</p>
157
158<a name="#chap2.2.1"></a>
159<h4 class=souligne>2.2.1 Interface</h4>
160<p>Here two examples which enable to write many interfaces, so it's important to understand it, and know how to customize it for your toolbox.
161</p>
162
163<p>
164<EM>Example a</EM>: <br>
165We consider an C routine sumab which returns the sum of two vectors. I suppose that the name of the corresponding primitive is <var><strong>scisum</strong></var>. We can keep the same name that the C routine (sumab) or try an other name.<br>
166The both following scripts represent the C code of <var><strong>sumab</strong></var> and its associated interface program when we call the primitive <var><strong>scisum </strong></var>in a Scilab window as follows:<br>
167<var><strong>--> Y=scisum(A,B )</strong></var> <br><br>
168
169</p>
170
171sumab.c
172<table class=entete>
173 <tr>
174 <td>
175<pre>
176void sumab(int n, double * a, double * b, double * y)
177{
178int k;
179for (k = 0; k < n; ++k)
180 y[k] = a[k] + b[k];
181}
182</pre>
183 </td>
184 </tr>
185</table>
186
187<br>
188intsumab.c<br>
189<table class=entete>
190 <tr>
191 <td>
192<pre>
193#include "stack-c.h"
194extern int sumab(int n, double * a, double * b, double * y);
195
196void intsumab(char *fname){
197 int l1, m1, n1, l2, m2, n2, l3, n;
198
199/* 1 - Check the nuumber of input/output arguments */
200 int minlhs=1, maxlhs=1, minrhs=2, maxrhs=2;
201 CheckRhs(minrhs,maxrhs) ;
202 CheckLhs(minlhs,maxlhs) ;
203
204/* 2 - Check input arguments type and get input arguments adress in the Scilab stack */
205 GetRhsVar(1, "d", &m1, &n1, &l1);
206 GetRhsVar(2, "d", &m2, &n2, &l2);
207
208/* 3 - Check that the input arguments have the same size */
209 n=m2*n2;
210 if( n1!=n2 || m1!=m2)
211 {
212 cerro("input arguments must have the same size");
213 return 0;
214 }
215 if(n1!=0 && m1!=0)
216 if(n1!=1 && m1!=1)
217 {
218 cerro("input arguments must be vectors");
219 return(0);
220 }
221
222/* it's possible to use the chekdims and getscalar functions: a completer ................*/
223
224/* 4 - Create the output argument */
225 CreateVar(3,"d",&m2,&n2,&l3);
226 sumab(n,stk(l1),stk(l2),stk(l3));
227
228/* 5 - Specif the ouput argument */
229 LhsVar(1) = 3;
230 return 0;
231}
232</pre>
233 </td>
234 </tr>
235</table>
236
237<br>
238<p>
239<EM>In Step 1</EM>: call the instructions <var><strong>CheckRhsVar(minrhs,maxrhs)</strong></var> and <var><strong>CheckLhsVar(minlhs,maxlhs)</strong></var><br>
240<var><strong>CheckRhsVar</strong></var> function uses the arguments <strong><var>minrhs</strong></var> and <var><strong>maxrhs</strong></var> to check that:<br>
241<var><strong>minrhs <= number of input arguments <= maxrhs</strong></var><br>
242In this example the numbers of input (=2) and output (=1) arguments are constant, but for certains functions (see example2) they can be variable, in this case the variables <var><strong>minrhs/minlhs</strong></var> and <var><strong>maxrhs/maxlhs</strong></var> are different.<br>
243We can use directly the defined variables <var><strong>Rhs</strong></var>(=number of inputs) and <var><strong>Lhs</strong></var>(=number of outputs) instead of the functions <var><strong>CheckRhsVar</strong></var> and </var><strong>CheckLhsVar</strong></var>.<br>
244
245<br>
246
247<EM>In Step 2</EM>: call the instruction <b><i>GetRhsVar(1,"d",&m1,&n1,&l1)</b></i><br>
248<b><i>GetRhsVar</b></i> function checks that the type of inputs argument is correct, and gets their size and their adress in the Scilab stack.<br>
249We describe above all arguments of <b><i>GetRhsVar</b></i> function:<br>
250<b><i>1</b></i> : corresponds to the position of the first input argument of scisum(A,B ), i.e A, (2 corresponds to B,...)<br>
251<b><i>m1 </b></i>: gets the rows number of A (m2 for B)<br>
252<b><i>n1 </b></i>: gets the columns number of A (n2 for B)<br>
253<b><i>l1 </b></i>: gets the adress of A in the Scilab stack (l2 for B)<br>
254
255<br>
256
257<EM>In Step 3</EM>: instruction <b><i>CreateVar(3,"d",&m2,&n2,&l3)</b></i><br>
258<b><i>CreateVar</b></i> function creates the ouput argument (here Y) at the 3th position<br>
259<b><i>3 </b></i>: corresponds to the position of the first output argument Y. We should take the number which follows immediatly the last position of the input arguments (which is 2)<br>
260<b><i>"d"</b></i>: sets the type of the output argument, a double <br>
261<b><i>m2</b></i>: sets the rows number of the output argument (here equal to the rows number of the second input argument B: m2)<br>
262<b><i>n2</b></i>: sets the columns number of the first output argument (here equal to the columns number of the second input argument B: n2)<br>
263<b><i>l3</b></i>: gets the adress of the lhs in the Scilab stack <br>
264
265<br>
266
267<EM>In Step 4</EM>: instruction <b><i>LhsVar(1) = 3</b></i><br>
268The instruction <b><i>LhsVar(1) = 3</b></i> means the first output argument take the value of the variable placed in the 3th position (i.e Y)<br>
269
270<br>
271<br>
272
273<EM>Example b</EM>:<br>
274 In the second example we describe the interface program (see above script) of the primitive </b></i>scifun1</b></i> which uses the C functions <b><i>fun1</b></i> and <b><i>fun2</b></i> (see above script). This primitive have two syntaxes:<br>
275
276<br>
277the first syntax is:</b></i><br>
278<b><i>--> [X, Y ]=scifun1(A);</b></i><br>
279Given a vector <b><i>A</b></i>, this function returns the positive components of <b><i>A</b></i> in a vector <b><i>X</b></i> and the sum of its positive components in a scalar <b><i>Y</b></i>. In this case the number of output arguments (=Lhs) is 2.<br>
280
281<br>
282the second syntax is:<br>
283<b><i>--> [X ]=scifun1(A);</b></i><br>
284Given a vector <b><i>A</b></i>, this function returns the positive components of <b><i>A</b></i> in a vector <b><i>X</b></i>. In this case <b><i>Lhs=1</b></i>.<br>
285</p>
286
287<br>
288fun1.c
289<table class=entete>
290 <tr>
291 <td>
292<pre>
293extern void fun2(double *, int, int *);
294
295void fun1(double * a, int na, int * nb, double ** b , double * positive_sum){
296 int i, k1=0;
297 *positive_sum=0;
298 fun2(a, na, nb);
299 *b=(double *)malloc((*nb)*sizeof(double));
300 *positive_sum=0;
301 for(i=0;i<na;i++)
302 if(a[i]>0) {
303 *(*b+k1)=a[i];
304 *positive_sum += a[i];
305 k1++;
306 };
307}
308</pre>
309 </td>
310 </tr>
311</table>
312
313<br>
314
315fun2.c
316<table class=entete>
317 <tr>
318 <td>
319<pre>
320void fun2(double * a, int na, int * m)
321{
322int i;
323*m=0;
324for(i=0;i<na;i++)
325 if (a[i]>0)
326 (*m)++;
327}
328</pre>
329 </td>
330 </tr>
331</table>
332
333<br>
334
335intfun1.c
336<table class=entete>
337 <tr>
338 <td>
339<pre>
340#include "stack-c.h"
341
342extern void fun1(double * , int, int *, double **, double *);
343
344int intfun1(char *fname)
345{
346 int l1, m1, n1, m=1, nX, i, l2, l3;
347 double * X, S;
348
349/* 1 - Check the number of inputs and outputs arguments */
350/* You can use the variables: Lhs and Rhs */
351 int minlhs=1, maxlhs=2, minrhs=1, maxrhs=1;
352 CheckRhs(minrhs,maxrhs) ;
353 CheckLhs(minlhs,maxlhs) ;
354
355/* 2 - Check rhs type, get the rows number (m1) and the columns number (n1) of rhs, and its adress (l1) in the Scilab stack */
356 GetRhsVar(1, "d", &m1, &n1, &l1);
357
358/* 3 - Check rhs is a vector */
359 if(m1!=0 && n1!=0 )
360 {
361 if(m1!=1 && n1!=1)
362 {
363 cerro("input argument must be a vector");
364 return(0);
365 }
366 }
367
368 fun1(stk(l1), n1*m1, &nX, &X, &S);
369
370/* 4 - Create the place for the first output X ( a vector of doubles, size: m*n ) to the adress l2 in the Scilab stack */
371 CreateVar(2, "d", &m, &nX, &l2);
372
373/* if there are two outputs variable then: Create the place for the second output S ( a double, size 1*1) to the adress l3 in the Scilab stack */
374/* get the value of S, and put it in the Scilab stack */
375 if(Lhs==2)
376 {
377 CreateVar(3, "d", &m, &m, &l3);
378 *stk(l3)=S;
379 }
380
381/* get the components of X, and put them in the Scilab stack */
382 for(i=0;i&gt;nX;i++)
383 stk(l2)[i]=X[i];
384
385/* free memory */
386 free(X);
387
388/* 5 - Specification of outputs variables */
389 LhsVar(1) = 2;
390 if(Lhs==2)
391 LhsVar(2) = 3;
392 return 0;
393}
394</pre>
395 </td>
396 </tr>
397</table>
398
399<br>
400
401<a name="#chap2.2.2"></a>
402<h4 class=souligne>2.2.2 Creation of the builder</h4>
403<p>Now the src directory of the toolbox toolbox_example contains all the necessary files (<b><i>fun1.c</b></i>, <b><i>fun2.c</b></i>, <b><i>intfun1.c</b></i>, <b><i>sumab.c</b></i>, <b><i>intsumab.c</b></i>) to create the builder (see above template) for the primitives scifun1 and scisum.
404<br>
405We need to write two builders: one the hand, the src builder (see above script) which creates a shared libraries (see help <i><b>ilib_for_link</b></i> function) corresponding to the .c functions.
406And the other hand, the interface builder (see above script) which creates new shared libraries to link the compiled C or Fortran
407new Scilab interface routines (thanks to src libraries), and generates a loader (see help <i><b>ilib_build</b></i> function).
408This loader file calls the addinter function to dynamically load the shared library (see help <i><b>addinter</b></i> function)</p>
409
410the src builder
411<table class=entete>
412 <tr>
413 <td>
414<pre>
415ilib_for_link('toolboxsrc',['fun1.o' 'fun2.o','sumab.o'],[],"c")
416</pre>
417 </td>
418 </tr>
419</table>
420
421<br>
422the interface builder<br>
423
424<table class=entete>
425 <tr>
426 <td>
427<pre>
428// must be run from this directory
429ilib_name = 'libtoolbox_example' // interface library name
430files = ['intfun1.o', 'intsumab.o']; // objects files
431libs = ["../src/libtooloxsrc"] // other libs needed for linking
432table = [ 'scifun1', 'intfun1';
433 'scisum','intsumab']; // table of (scilab_name,interface-name)
434// do not modify below
435ilib_build(ilib_name,table,files,libs)
436</pre>
437 </td>
438 </tr>
439</table>
440
441<br>
442
443 <td>
444 <tr>
445</table>
446
447<br>
448
449<a name="#chap2.2.2"></a>
450<h4 class=souligne>2.2.2 Creation of the builder</h4>
451<p>Now the src directory of the toolbox toolbox_example contains all the necessary files (<b><i>fun1.c</b></i>, <b><i>fun2.c</b></i>, <b><i>intfun1.c</b></i>, <b><i>sumab.c</b></i>, <b><i>intsumab.c</b></i>) to create the builder (see above template) for the primitives scifun1 and scisum.
452<br>
453We need to write two builders: one the hand, the src builder (see above script) which creates a shared libraries (see help <i><b>ilib_for_link</b></i> function) corresponding to the .c functions.
454And the other hand, the interface builder (see above script) which creates new shared libraries to link the compiled C or Fortran
455new Scilab interface routines (thanks to src libraries), and generates a loader (see help <i><b>ilib_build</b></i> function).
456This loader file calls the addinter function to dynamically load the shared library (see help <i><b>addinter</b></i> function)</p>
457
458the src builder
459<table class=entete>
460 <tr>
461 <td>
462<pre>
463ilib_for_link('toolbox_examplesrc',['fun1.o' 'fun2.o','sumab.o'],[],"c")
464</pre>
465 </td>
466 </tr>
467</table>
468
469<br>
470the interface builder<br>
471
472<table class=entete>
473 <tr>
474 <td>
475<pre>
476// must be run from this directory
477ilib_name = 'libtoolbox_example' // interface library name
478files = ['intfun1.o', 'intsumab.o']; // objects files
479libs = ["../src/libtoolbox_examplesrc"] // other libs needed for linking
480table = [ 'scifun1', 'intfun1';
481 'scisum','intsumab']; // table of (scilab_name,interface-name)
482// do not modify below
483ilib_build(ilib_name,table,files,libs)
484</pre>
485 </td>
486 </tr>
487</table>
488
489
490
491<br>
492The <i><b>ilib_name</b></i> value is the interface library name, the vector <i><b>files</b></i> contains all the object interface files,
493the vector <i><b>libs</b></i> contains the libraries needed for linking (here the library included in the src directory),
494the variable <i><b>table</b></i> contains the primitives names (first column) and the corresponding interface program names (second column)
495
496<a name="#chap2.3"></a>
497<h3 class=souligne>2.3 The man directory</h3>
498<p>This directory included .xml files, a manbuilder and a manloader scripts
499 On Unix/Linux systems: to create the manual pages you need 'sabcmd', an XML parser which is part of the Sablotron package.<br>
500 (here link to download it:<A href="http://www.scilab.org/download/index_download.php?page=related_tool.html"> http://www.scilab.org/download/index_download.php?page=related_tool.html</A>)<br>
501 (.................... a completer ............................)
502</p>
503
504<a name="#chap2.3.1"></a>
505<h4 class=souligne>2.3.1 Creation of .xml files</h4>
506<p>
507Here a template which helps you to write the .xml help files. You should just fill the different items(Langage, title, type, date, short description, ...) for the .xml files of your functions (here <b><i>foo1.xml</i></b>, <b><i>scifun1.xml</i></b>, <b><i>scisum.xml</i></b>) and put them in the man directory.
508</p>
509
510<table class=entete>
511 <tr>
512 <td>
513<pre>
514&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot; standalone=&quot;no&quot;?&gt;
515&lt;!DOCTYPE MAN SYSTEM &quot;/home/scilab/scilab-3.0/man/manrev.dtd&quot;&gt;
516&lt;MAN&gt;
517 &lt;LANGUAGE&gt;eng&lt;/LANGUAGE&gt;
518 &lt;TITLE&gt;scifoo2&lt;/TITLE&gt;
519 &lt;TYPE&gt;Scilab Function &lt;/TYPE&gt;
520 &lt;DATE&gt;20-Mar-2006&lt;/DATE&gt;
521 &lt;SHORT_DESCRIPTION name=&quot;add function name&quot;&gt; add short decription here&lt;/SHORT_DESCRIPTION&gt;
522
523 &lt;CALLING_SEQUENCE&gt;
524 &lt;CALLING_SEQUENCE_ITEM&gt;add function syntax&lt;/CALLING_SEQUENCE_ITEM&gt;
525 &lt;/CALLING_SEQUENCE&gt;
526
527 &lt;PARAM&gt;
528 &lt;PARAM_INDENT&gt;
529 &lt;PARAM_ITEM&gt;
530 &lt;PARAM_NAME&gt;add param name&lt;/PARAM_NAME&gt;
531 &lt;PARAM_DESCRIPTION&gt;
532 &lt;SP&gt;
533 : add here the parameter description
534 &lt;/SP&gt;
535 &lt;/PARAM_DESCRIPTION&gt;
536
537 &lt;PARAM_ITEM&gt;
538 &lt;PARAM_NAME&gt;add param name&lt;/PARAM_NAME&gt;
539 &lt;PARAM_DESCRIPTION&gt;
540 &lt;SP&gt;
541 : add here the parameter description
542 &lt;/SP&gt;
543 &lt;/PARAM_DESCRIPTION&gt;
544 &lt;/PARAM_ITEM&gt;
545 &lt;/PARAM_INDENT&gt;
546 &lt;/PARAM&gt;
547
548 &lt;DESCRIPTION&gt;
549 &lt;DESCRIPTION_INDENT&gt;
550 &lt;DESCRIPTION_ITEM&gt;
551 &lt;P&gt;
552 Add here a paragraph of the function description.
553 Other paragraph can be added
554 &lt;/P&gt;
555 &lt;/DESCRIPTION_ITEM&gt;
556 &lt;DESCRIPTION_ITEM&gt;
557 &lt;P&gt;
558 Add here a paragraph of the function description
559 &lt;/P&gt;
560 &lt;/DESCRIPTION_ITEM&gt;
561 &lt;/DESCRIPTION_INDENT&gt;
562 &lt;/DESCRIPTION&gt;
563
564 &lt;EXAMPLE&gt;&lt;![CDATA[
565 Add here scilab instructions and comments
566 ]]&gt;&lt;/EXAMPLE&gt;
567
568 &lt;SEE_ALSO&gt;
569 &lt;SEE_ALSO_ITEM&gt; &lt;LINK&gt; add a key here&lt;/LINK&gt; &lt;/SEE_ALSO_ITEM&gt;
570 &lt;SEE_ALSO_ITEM&gt; &lt;LINK&gt; add a key here&lt;/LINK&gt; &lt;/SEE_ALSO_ITEM&gt;
571 &lt;/SEE_ALSO&gt;
572
573 &lt;BIBLIO&gt;
574 Add here the function bibliography if any
575 &lt;/BIBLIO&gt;
576
577 &lt;AUTHORS&gt;
578 &lt;AUTHORS_ITEM label='enter here the author name'&gt;
579 Add here the author references
580 &lt;/AUTHORS_ITEM&gt;
581 &lt;/AUTHORS&gt;
582 &lt;USED_FUNCTIONS&gt;
583 Add here the used function name and references
584 &lt;/USED_FUNCTIONS&gt;
585&lt;/MAN&gt;
586</pre>
587 </td>
588 </tr>
589</table>
590
591<a name="#chap2.3.2"></a>
592<h4 class=souligne>2.3.2 Creation of the builder</h4>
593<p>The manbuilder (see above) creates a whatis.htm file which is a short description of the functions, and translates the xml files to html (see help xmltohtml function)
594</p>
595
596<br>
597
598builder.sce
599<table class=entete>
600 <tr>
601 <td>
602<pre>
603mode(-1) //force silent execution
604path=get_absolute_file_path('builder.sce');//get the absolute path of this file
605add_help_chapter("Title1",path);//add help chapter
606xmltohtml(path,"Title1")
607//clear the variable stack
608clear path add_help_chapter get_absolute_file_path
609</pre>
610 </td>
611 </tr>
612</table>
613
614
615<a name="#chap2.3.3"></a>
616<h4 class=souligne>2.3.3 Creation of the loader</h4>
617<p>The loader(see above script) add your help functions files in the help Scilab browser
618</p>
619
620loader.sce
621<table class=entete>
622 <tr>
623 <td>
624<pre>
625mode(-1) //force silent execution
626path=get_absolute_file_path('loader.sce');//get the absolute path of this file
627add_help_chapter("Title1",path);//add help chapter
628clear path add_help_chapter get_absolute_file_
629</pre>
630 </td>
631 </tr>
632</table>
633
634<a name="#chap3"></a>
635<h2 class=souligne>3. The main builder and loader</h2>
636The builder and loader are generic, they execute all sub-builder(s) and sub-loader(s), here the both scripts:<br><br>
637
638builder.sce
639<table class=entete>
640 <tr>
641 <td>
642<pre>
643mode(-1);
644mainpathB=get_absolute_file_path('builder.sce');
645chdir(mainpathB);
646if isdir('src') then
647 chdir('src');
648 exec('builder.sce');
649 chdir('..');
650end
651if isdir('interface') then
652 chdir('interface');
653 exec('builder.sce');
654 chdir('..');
655end
656if isdir('macros') then
657 chdir('macros');
658 exec('builder.sce');
659 chdir('..');
660end
661if isdir('man') then
662 chdir('man');
663 exec('builder.sce');
664 chdir('..');
665end
666clear mainpathB
667</pre>
668 </td>
669 </tr>
670</table>
671
672<br>
673
674loader.sce
675<table class=entete>
676 <tr>
677 <td>
678<pre>
679mode(-1);
680mainpathL=get_absolute_file_path('loader.sce');
681chdir(mainpathL);
682if isdir('interface') then
683 chdir('interface');
684 exec('loader.sce');
685 chdir('..');
686end
687if isdir('macros') then
688 chdir('macros');
689 exec('loader.sce');
690 chdir('..');
691end
692if isdir('man') then
693 chdir('man');
694 exec('loader.sce');
695 chdir('..');
696end
697clear mainpathL
698</pre>
699 </td>
700 </tr>
701</table>
702
703
704<a name="#chap4"></a>
705<h2 class=souligne>4. Upload your toolbox</h2>
706<ul style="list-style-type: disc">
707<li>Read the instructions about how to contribute , see the link: <A href="http://www.scilab.org/contrib/index_contrib.php?page=howto.html
708">http://www.scilab.org/contrib/index_contrib.php?page=howto.html </A></li>
709<li>Archive and Compress your toolbox: </li>
710<li>Complete the submission form document and add your package (here <b>toolbox_example.tar.gz</b> and <b>toolbox_example.zip</b>),
711see the link: <A href="http://www.scilab.fr/contrib/index_contrib.php?page=upload.html">http://www.scilab.fr/contrib/index_contrib.php?page=upload.html </A> </li>
712</ul>
713<p>
714
715</body>
716
717</html> \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/README b/scilab_doc/toolbox_guide/toolbox_example/README
new file mode 100644
index 0000000..1b5d646
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/README
@@ -0,0 +1,73 @@
1 Guide for the toolboxes contribution
2 ===================================
3
4
5
6Guide (version xxx)
7====================
8
9Information about toolbox_example can be found at
10http://xxx.xxx//toolbox_example.html
11
12The program has been written by
13XXXXXXXXX
14
15
16Installation
17============
18To Install this toolbox: (Scilab-4.0)
19
20We Suppose here that <PATH> stands for the path of the directory
21containing this README file.
22
23- On Unix/Linux systems
24 * User
25 Has to execute,once and for all, the following instruction
26 within Scilab:
27 exec <PATH>/builder.sce
28
29 Should execute the following instruction within Scilab:
30 exec <PATH>/loader.sce
31 before using the toolbox, he can also put it in his
32 .scilab startup file for automatic loading.
33
34- On Windows systems
35 * user
36 Has to execute, once and for all, the following instruction
37 within Scilab:
38 exec <PATH>\builder.sce
39
40Should execute the following instruction within Scilab:
41 exec <PATH>\loader.sce
42 before using the toolbox, he can also put it in his
43 .scilab startup file for automatic loading.
44
45
46Contents
47========
48README : this file
49builder.sce : script to launche the sub-builders
50loader.sce : script to launche the sub-loaders
51
52src : directory of Fortran and C routines
53 builder.sce : script for building library (compilation and linking)
54 loader.sce : script for loading library (generated)
55
56macros : directory of Scilab functions
57 builder.sce : script for building library
58 loader.sce : script for loading library
59 *.sci : source versions
60 *.bin : precompiled binary versions (generated)
61 lib : scilab library binary save (generated)
62
63man : directory for help.
64 builder.sce : translates the xml files to html
65 loader.sce : add your help functions files in the help Scilab browser
66 *.xml : xml help file
67 *.html : html help file (generated)
68 whatis : short function description (generated)
69
70demos : examples to illustrate your toolbox
71
72tests : directory of tests
73 tests.sce : script to test toolbox_example \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/builder.sce b/scilab_doc/toolbox_guide/toolbox_example/builder.sce
new file mode 100644
index 0000000..098c7c7
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/builder.sce
@@ -0,0 +1,24 @@
1mode(-1);
2mainpathB=get_absolute_file_path('builder.sce');
3chdir(mainpathB);
4if isdir('src') then
5 chdir('src');
6 exec('builder.sce');
7 chdir('..');
8end
9if isdir('interface') then
10 chdir('interface');
11 exec('builder.sce');
12 chdir('..');
13end
14if isdir('macros') then
15 chdir('macros');
16 exec('builder.sce');
17 chdir('..');
18end
19if isdir('man') then
20 chdir('man');
21 exec('builder.sce');
22 chdir('..');
23end
24clear mainpathB \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/interface/builder.sce b/scilab_doc/toolbox_guide/toolbox_example/interface/builder.sce
new file mode 100644
index 0000000..18f6570
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/interface/builder.sce
@@ -0,0 +1,8 @@
1// must be run from this directory
2ilib_name = 'libtoolbox_example' // interface library name
3files = ['intfun1.o', 'intsumab.o']; // objects files
4libs = ["../src/libtoolboxsrc"] // other libs needed for linking
5table = [ 'scifun1', 'intfun1';
6 'scisum','intsumab']; // table of (scilab_name,interface-name)
7// do not modify below
8ilib_build(ilib_name,table,files,libs)
diff --git a/scilab_doc/toolbox_guide/toolbox_example/interface/intfun1.c b/scilab_doc/toolbox_guide/toolbox_example/interface/intfun1.c
new file mode 100644
index 0000000..c819308
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/interface/intfun1.c
@@ -0,0 +1,56 @@
1#include "stack-c.h"
2
3extern void fun2(double * , int, int *);
4extern void fun1(double * , int, int *, double **, double *);
5
6int intfun1(char *fname)
7{
8 int l1, m1, n1, m=1, nX, i, l2, l3;
9 double * X, S;
10
11 /* 1 - Check the number of inputs and outputs arguments */
12 /* You can use the variables: Lhs and Rhs */
13 int minlhs=1, maxlhs=2, minrhs=1, maxrhs=1;
14 CheckRhs(minrhs,maxrhs) ;
15 CheckLhs(minlhs,maxlhs) ;
16
17 /* 2 - Check rhs type, get the rows number(m1) and the columns number(n1) of rhs, and its adress(l1) in the Scilab stack */
18 GetRhsVar(1, "d", &m1, &n1, &l1);
19
20 if(m1!=0 && n1!=0 )
21 {
22 if(m1!=1 && n1!=1)
23 {
24 cerro("input argument must be a vector");
25 return(0);
26 }
27 }
28
29 fun1(stk(l1), n1*m1, &nX, &X, &S);
30
31 /* 4 - Create the place for the firts output X ( a vector of doubles, size: m*n ) to the adress l2 in the Scilab stack */
32 CreateVar(2, "d", &m, &nX, &l2);
33
34 /* if there are two outputs variable then: Create the place for the second output S ( a double, size 1*1) to the adress l3 in the Scilab stack */
35 /* get the value of S, and put it in the Scilab stack */
36 if(Lhs==2)
37 {
38 CreateVar(3, "d", &m, &m, &l3);
39 *stk(l3)=S;
40 }
41
42 /* get the components of X, and put them in the Scilab stack */
43 for(i=0;i<nX;i++)
44 stk(l2)[i]=X[i];
45
46 /* free memory */
47 free(X);
48
49 /* 5 - Specification of outputs variables */
50 LhsVar(1) = 2;
51
52 if(Lhs==2)
53 LhsVar(2) = 3;
54
55 return 0;
56} \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/interface/intsumab.c b/scilab_doc/toolbox_guide/toolbox_example/interface/intsumab.c
new file mode 100644
index 0000000..68278a8
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/interface/intsumab.c
@@ -0,0 +1,41 @@
1#include "stack-c.h"
2
3extern int sumab(int n, double * a, double * b, double * y);
4
5void intsumab(char *fname)
6{
7 int l1, m1, n1, l2, m2, n2, l3, n;
8
9 /* 1 - Check rhs and lhs number */
10 int minlhs=1, maxlhs=1, minrhs=2, maxrhs=2;
11 CheckRhs(minrhs,maxrhs) ;
12 CheckLhs(minlhs,maxlhs) ;
13
14 /* 2 - Check rhs type and get rhs adress in the Scilab stack */
15 GetRhsVar(1, "d", &m1, &n1, &l1);
16 GetRhsVar(2, "d", &m2, &n2, &l2);
17
18 n=m2*n2;
19 if( n1!=n2 || m1!=m2)
20 {
21 cerro("input arguments must have the same size");
22 return 0;
23 }
24
25 if(n1!=0 && m1!=0)
26 if(n1!=1 && m1!=1)
27 {
28 cerro("input arguments must be vectors");
29 return(0);
30 }
31
32 /* use chekdims and getscalar functions: a completer ................*/
33
34 /* 4 - Create the output argument */
35 CreateVar(3,"d",&m2,&n2,&l3);
36 sumab(n,stk(l1),stk(l2),stk(l3));
37
38 /* 5 - Specif the ouput argument */
39 LhsVar(1) = 3;
40 return 0;
41} \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/loader.sce b/scilab_doc/toolbox_guide/toolbox_example/loader.sce
new file mode 100644
index 0000000..0597483
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/loader.sce
@@ -0,0 +1,19 @@
1mode(-1);
2mainpathL=get_absolute_file_path('loader.sce');
3chdir(mainpathL);
4if isdir('interface') then
5 chdir('interface');
6 exec('loader.sce');
7 chdir('..');
8end
9if isdir('macros') then
10 chdir('macros');
11 exec('loader.sce');
12 chdir('..');
13end
14if isdir('man') then
15 chdir('man');
16 exec('loader.sce');
17 chdir('..');
18end
19clear mainpathL \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/macros/builder.sce b/scilab_doc/toolbox_guide/toolbox_example/macros/builder.sce
new file mode 100644
index 0000000..22e69e5
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/macros/builder.sce
@@ -0,0 +1,6 @@
1mode(-1)
2toolboxname='toolbox_example'
3pathB=get_absolute_file_path('builder.sce')
4disp('Building macros in ' +pathB)
5genlib(toolboxname+'lib',pathB,%t)
6clear pathB genlib toolboxname \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/macros/foo1.sci b/scilab_doc/toolbox_guide/toolbox_example/macros/foo1.sci
new file mode 100644
index 0000000..60743b4
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/macros/foo1.sci
@@ -0,0 +1,18 @@
1function [X]=foo1(A)
2// This function returns the positive components fo A diagonal
3
4// Check the type and the size of A
5if type(A)<>1 then
6 error("type of input argument must be a double");
7end
8if size(A,1)<>size(A,2) then
9 error("input argument must be square matrix");
10end
11//extraction of the positive components
12X=[];
13for i=1:size(A,1)
14 if A(i,i)>0 then
15 X($+1)=A(i,i);
16 end
17end
18endfunction
diff --git a/scilab_doc/toolbox_guide/toolbox_example/macros/loader.sce b/scilab_doc/toolbox_guide/toolbox_example/macros/loader.sce
new file mode 100644
index 0000000..db9389d
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/macros/loader.sce
@@ -0,0 +1,5 @@
1mode(-1)
2pathL=get_absolute_file_path('loader.sce')
3disp('Loading macros in ' +pathL)
4load(pathL+'/lib')
5clear pathL \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/man/builder.sce b/scilab_doc/toolbox_guide/toolbox_example/man/builder.sce
new file mode 100644
index 0000000..321eb41
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/man/builder.sce
@@ -0,0 +1,6 @@
1mode(-1) //force silent execution
2path=get_absolute_file_path('builder.sce');//get the absolute path of this file
3add_help_chapter("Title1",path);//add help chapter
4xmltohtml(path,"Title1")
5//clear the variable stack
6clear path add_help_chapter get_absolute_file_path \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/man/foo1.xml b/scilab_doc/toolbox_guide/toolbox_example/man/foo1.xml
new file mode 100644
index 0000000..480b982
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/man/foo1.xml
@@ -0,0 +1,68 @@
1<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2<!DOCTYPE MAN SYSTEM "/home/scilab/scilab-3.0/man/manrev.dtd">
3<MAN>
4 <LANGUAGE>eng</LANGUAGE>
5 <TITLE>foo1</TITLE>
6 <TYPE>Scilab Function </TYPE>
7 <DATE>25-Mar-2006</DATE>
8 <SHORT_DESCRIPTION name="foo1"> Returns the positive components of A diagonal</SHORT_DESCRIPTION>
9
10 <CALLING_SEQUENCE>
11 <CALLING_SEQUENCE_ITEM>X = foo1(A)</CALLING_SEQUENCE_ITEM>
12 </CALLING_SEQUENCE>
13
14 <PARAM>
15 <PARAM_INDENT>
16
17 <PARAM_ITEM>
18 <PARAM_NAME>A</PARAM_NAME>
19 <PARAM_DESCRIPTION>
20 <SP>
21 : a square matrix of reals
22 </SP>
23 </PARAM_DESCRIPTION>
24 </PARAM_ITEM>
25
26 <PARAM_ITEM>
27 <PARAM_NAME>X</PARAM_NAME>
28 <PARAM_DESCRIPTION>
29 <SP>
30 : a vector of positive reals
31 </SP>
32 </PARAM_DESCRIPTION>
33 </PARAM_ITEM>
34 </PARAM_INDENT>
35 </PARAM>
36
37 <DESCRIPTION>
38 <DESCRIPTION_INDENT>
39 <DESCRIPTION_ITEM>
40 <P>
41 This function returns a vector containing the positive components of the A diagonal. A must be a square matrix.
42 Other paragraph can be added
43 </P>
44 </DESCRIPTION_ITEM>
45 </DESCRIPTION_INDENT>
46 </DESCRIPTION>
47
48 <EXAMPLE><![CDATA[
49 A=rand(5,5)-1/2;
50 X=foo1(A);
51 ]]></EXAMPLE>
52
53 <SEE_ALSO>
54 <SEE_ALSO_ITEM> <LINK> diag</LINK> </SEE_ALSO_ITEM>
55 </SEE_ALSO>
56
57 <BIBLIO>
58 Add here the function bibliography if any
59 </BIBLIO>
60
61 <AUTHORS>
62 <AUTHORS_ITEM label='F.Belahcene'>
63 </AUTHORS_ITEM>
64 </AUTHORS>
65 <USED_FUNCTIONS>
66 Add here the used function name and references
67 </USED_FUNCTIONS>
68</MAN>
diff --git a/scilab_doc/toolbox_guide/toolbox_example/man/loader.sce b/scilab_doc/toolbox_guide/toolbox_example/man/loader.sce
new file mode 100644
index 0000000..8ccc114
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/man/loader.sce
@@ -0,0 +1,4 @@
1mode(-1) //force silent execution
2path=get_absolute_file_path('loader.sce');//get the absolute path of this file
3add_help_chapter("Title1",path);//add help chapter
4clear path add_help_chapter get_absolute_file_path \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/man/scifoo2.xml b/scilab_doc/toolbox_guide/toolbox_example/man/scifoo2.xml
new file mode 100644
index 0000000..93a4202
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/man/scifoo2.xml
@@ -0,0 +1,83 @@
1<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2<!DOCTYPE MAN SYSTEM "/home/scilab/scilab-3.0/man/manrev.dtd">
3<MAN>
4 <LANGUAGE>eng</LANGUAGE>
5 <TITLE>scifoo2</TITLE>
6 <TYPE>Scilab Function </TYPE>
7 <DATE>25-Mar-2006</DATE>
8 <SHORT_DESCRIPTION name="scifoo2"> add short decription here</SHORT_DESCRIPTION>
9
10 <CALLING_SEQUENCE>
11 <CALLING_SEQUENCE_ITEM>[x,y] = scifoo2(a)</CALLING_SEQUENCE_ITEM>
12 </CALLING_SEQUENCE>
13
14 <PARAM>
15 <PARAM_INDENT>
16
17 <PARAM_ITEM>
18 <PARAM_NAME>a</PARAM_NAME>
19 <PARAM_DESCRIPTION>
20 <SP>
21 : add here the parameter description
22 </SP>
23 </PARAM_DESCRIPTION>
24 </PARAM_ITEM>
25
26 <PARAM_ITEM>
27 <PARAM_NAME>x</PARAM_NAME>
28 <PARAM_DESCRIPTION>
29 <SP>
30 : add here the parameter description
31 </SP>
32 </PARAM_DESCRIPTION>
33 </PARAM_ITEM>
34
35 <PARAM_ITEM>
36 <PARAM_NAME>y</PARAM_NAME>
37 <PARAM_DESCRIPTION>
38 <SP>
39 : add here the parameter description
40 </SP>
41 </PARAM_DESCRIPTION>
42 </PARAM_ITEM>
43 </PARAM_INDENT>
44 </PARAM>
45
46 <DESCRIPTION>
47 <DESCRIPTION_INDENT>
48 <DESCRIPTION_ITEM>
49 <P>
50 Add here a paragraph of the function description.
51 Other paragraph can be added
52 </P>
53 </DESCRIPTION_ITEM>
54 <DESCRIPTION_ITEM>
55 <P>
56 Add here a paragraph of the function description
57 </P>
58 </DESCRIPTION_ITEM>
59 </DESCRIPTION_INDENT>
60 </DESCRIPTION>
61
62 <EXAMPLE><![CDATA[
63 Add here scilab instructions and comments
64 ]]></EXAMPLE>
65
66 <SEE_ALSO>
67 <SEE_ALSO_ITEM> <LINK> add a key here</LINK> </SEE_ALSO_ITEM>
68 <SEE_ALSO_ITEM> <LINK> add a key here</LINK> </SEE_ALSO_ITEM>
69 </SEE_ALSO>
70
71 <BIBLIO>
72 Add here the function bibliography if any
73 </BIBLIO>
74
75 <AUTHORS>
76 <AUTHORS_ITEM label='enter here the author name'>
77 Add here the author references
78 </AUTHORS_ITEM>
79 </AUTHORS>
80 <USED_FUNCTIONS>
81 Add here the used function name and references
82 </USED_FUNCTIONS>
83</MAN>
diff --git a/scilab_doc/toolbox_guide/toolbox_example/man/scisum.xml b/scilab_doc/toolbox_guide/toolbox_example/man/scisum.xml
new file mode 100644
index 0000000..b53db11
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/man/scisum.xml
@@ -0,0 +1,83 @@
1<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2<!DOCTYPE MAN SYSTEM "/home/scilab/scilab-3.0/man/manrev.dtd">
3<MAN>
4 <LANGUAGE>eng</LANGUAGE>
5 <TITLE>scisum</TITLE>
6 <TYPE>Scilab Function </TYPE>
7 <DATE>25-Mar-2006</DATE>
8 <SHORT_DESCRIPTION name="scisum"> add short decription here</SHORT_DESCRIPTION>
9
10 <CALLING_SEQUENCE>
11 <CALLING_SEQUENCE_ITEM>y = scisum(a,b)</CALLING_SEQUENCE_ITEM>
12 </CALLING_SEQUENCE>
13
14 <PARAM>
15 <PARAM_INDENT>
16
17 <PARAM_ITEM>
18 <PARAM_NAME>a</PARAM_NAME>
19 <PARAM_DESCRIPTION>
20 <SP>
21 : add here the parameter description
22 </SP>
23 </PARAM_DESCRIPTION>
24 </PARAM_ITEM>
25
26 <PARAM_ITEM>
27 <PARAM_NAME>b</PARAM_NAME>
28 <PARAM_DESCRIPTION>
29 <SP>
30 : add here the parameter description
31 </SP>
32 </PARAM_DESCRIPTION>
33 </PARAM_ITEM>
34
35 <PARAM_ITEM>
36 <PARAM_NAME>y</PARAM_NAME>
37 <PARAM_DESCRIPTION>
38 <SP>
39 : add here the parameter description
40 </SP>
41 </PARAM_DESCRIPTION>
42 </PARAM_ITEM>
43 </PARAM_INDENT>
44 </PARAM>
45
46 <DESCRIPTION>
47 <DESCRIPTION_INDENT>
48 <DESCRIPTION_ITEM>
49 <P>
50 Add here a paragraph of the function description.
51 Other paragraph can be added
52 </P>
53 </DESCRIPTION_ITEM>
54 <DESCRIPTION_ITEM>
55 <P>
56 Add here a paragraph of the function description
57 </P>
58 </DESCRIPTION_ITEM>
59 </DESCRIPTION_INDENT>
60 </DESCRIPTION>
61
62 <EXAMPLE><![CDATA[
63 Add here scilab instructions and comments
64 ]]></EXAMPLE>
65
66 <SEE_ALSO>
67 <SEE_ALSO_ITEM> <LINK> add a key here</LINK> </SEE_ALSO_ITEM>
68 <SEE_ALSO_ITEM> <LINK> add a key here</LINK> </SEE_ALSO_ITEM>
69 </SEE_ALSO>
70
71 <BIBLIO>
72 Add here the function bibliography if any
73 </BIBLIO>
74
75 <AUTHORS>
76 <AUTHORS_ITEM label='enter here the author name'>
77 Add here the author references
78 </AUTHORS_ITEM>
79 </AUTHORS>
80 <USED_FUNCTIONS>
81 Add here the used function name and references
82 </USED_FUNCTIONS>
83</MAN>
diff --git a/scilab_doc/toolbox_guide/toolbox_example/src/builder.sce b/scilab_doc/toolbox_guide/toolbox_example/src/builder.sce
new file mode 100644
index 0000000..66a1a85
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/src/builder.sce
@@ -0,0 +1 @@
ilib_for_link('toolboxsrc',['fun1.o' 'fun2.o','sumab.o'],[],"c")
diff --git a/scilab_doc/toolbox_guide/toolbox_example/src/fun1.c b/scilab_doc/toolbox_guide/toolbox_example/src/fun1.c
new file mode 100644
index 0000000..833a0a9
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/src/fun1.c
@@ -0,0 +1,17 @@
1void fun2(double *, int, int *);
2
3void fun1(double * a, int na, int * nb, double ** b , double * positive_sum)
4{
5int i, k1=0;
6*positive_sum=0;
7fun2(a, na, nb);
8*b=(double *)malloc((*nb)*sizeof(double));
9*positive_sum=0;
10for(i=0;i<na;i++)
11 if(a[i]>0)
12 {
13 *(*b+k1)=a[i];
14 *positive_sum += a[i];
15 k1++;
16 };
17} \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/src/fun2.c b/scilab_doc/toolbox_guide/toolbox_example/src/fun2.c
new file mode 100644
index 0000000..fb26887
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/src/fun2.c
@@ -0,0 +1,8 @@
1void fun2(double * a, int na, int * m)
2{
3int i;
4*m=0;
5for(i=0;i<na;i++)
6 if (a[i]>0)
7 (*m)++;
8} \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/src/sumab.c b/scilab_doc/toolbox_guide/toolbox_example/src/sumab.c
new file mode 100644
index 0000000..994e967
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/src/sumab.c
@@ -0,0 +1,5 @@
1void sumab(int n, double * a, double * b, double * y)
2{int k;
3for (k = 0; k < n; ++k)
4 y[k] = a[k] + b[k];
5} \ No newline at end of file
diff --git a/scilab_doc/toolbox_guide/toolbox_example/tests/tests.sce b/scilab_doc/toolbox_guide/toolbox_example/tests/tests.sce
new file mode 100644
index 0000000..92af3e6
--- /dev/null
+++ b/scilab_doc/toolbox_guide/toolbox_example/tests/tests.sce
@@ -0,0 +1,20 @@
1// Test the macros scilab: foo1
2 B=[1 2 3 4; 5 -6 7 8; 9 10 -11 12 ;-13 14 -15 16]
3 Xtest=[1;16]
4 X=foo1(B)
5 if norm(X-Xtest) > %eps then pause,end
6
7// Test the primitive: scisum
8 a=[1,2,3];b=[4,5,6]
9 c=scisum(a,b)
10 if norm(c-(a+b)) > %eps then pause,end
11
12// Test the primitivre: scifoo
13 A=[2 -4 6 8 9 -7 10 -3]
14 [X,Y]=scifun1(A)
15 Xtest=[2 6 8 9 10]
16 Ytest=35
17 if (norm(X-Xtest) > %eps | norm(Y-Ytest)) then pause,end
18 [Z]=scifun1(A)
19 Ztest=[2 6 8 9 10]
20 if norm(Z-Ztest) > %eps then pause,end