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