<div dir="ltr">Hi all, <div><br></div><div>Stephane, Thanks for the quick examples to illustrate this.</div><div><br></div><div>Claus, as shown by Stephane, this could be now by ourselves now from our own modules. Stephane has illustrated a quick demo on this, while the one I was testing with is the copy of toolbox skeleton inside the Scilab contrib, modified to 2 modules, installed with atoms and let it load at start, results are the same. </div><div><br></div><div>There are 2 potential issues which we should take notes: </div><div>1. The module which is loaded last, will have the "dominant" in the base function. for e.g.: the example that Stephane showed, we could call "lib1.foo" and "lib2.foo", and calling just "foo" will be the same as "lib2.foo".</div><div>2. Only macros function could be called this way, if a module has a scilab gateway that called direct from Scilab, (such as scicv), you could not call scicvlib.imread as the imread is directly expose from the C lib to Scilab. So during the design of the module, you could have a macros wrapper to call the gateway functions so that they could be listed in the library's macros list.</div><div><br></div><div>Thanks.</div><div><br></div><div>rgds,<br>CL</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 4 Dec 2020 at 00:36, Stéphane Mottelet <<a href="mailto:stephane.mottelet@utc.fr">stephane.mottelet@utc.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>This is the way it works in scilab for libraries:</p>
<pre style="font-family:Monospaced;font-style:normal"><span style="color:rgb(174,92,176);text-decoration:underline">mkdir</span> <span style="color:rgb(188,143,143)">lib1</span>
<span style="color:rgb(50,185,185)">mputl</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">function y=foo(x);y=x;end</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">lib1/foo.sci</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(74,85,219)">)</span>
<span style="color:rgb(50,185,185)">genlib</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">lib1</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">lib1</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(74,85,219)">)</span>
<span style="color:rgb(174,92,176);text-decoration:underline">mkdir</span> <span style="color:rgb(188,143,143)">lib2</span>
<span style="color:rgb(50,185,185)">mputl</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">function y=foo(x);y=2*x;end</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">lib2/foo.sci</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(74,85,219)">)</span>
<span style="color:rgb(50,185,185)">genlib</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">lib2</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">lib2</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(74,85,219)">)</span>
<span style="color:rgb(50,185,185)">lib</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">lib1</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(74,85,219)">)</span>
<span style="color:rgb(50,185,185)">lib</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">lib2</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(74,85,219)">)</span>
<span style="color:rgb(92,92,92)">-</span><span style="color:rgb(92,92,92)">></span> <span style="color:rgb(0,0,0)">lib1</span><span style="color:rgb(92,92,92)">.</span><span style="color:rgb(170,170,170)">foo</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(74,85,219)">)</span>
<span style="color:rgb(0,0,0)">ans</span> <span style="color:rgb(92,92,92)">=</span>
<span style="color:rgb(188,143,143)">1.</span>
<span style="color:rgb(92,92,92)">-</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(92,92,92)">></span> <span style="color:rgb(0,0,0)">lib2</span><span style="color:rgb(92,92,92)">.</span><span style="color:rgb(170,170,170)">foo</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(74,85,219)">)</span>
<span style="color:rgb(0,0,0)">ans</span> <span style="color:rgb(92,92,92)">=</span>
<span style="color:rgb(188,143,143)">2.</span></pre>
<div><br>
</div>
<div>S.</div>
<div><br>
</div>
<div>Le 03/12/2020 à 17:28, Antoine
Monmayrant a écrit :<br>
</div>
<blockquote type="cite">
<p><br>
</p>
<div>On 03/12/2020 02:10, TanCL wrote:<br>
</div>
<blockquote type="cite">
<pre>Hi, my previous message seems like not able to get posted due to some reason,
just to add some comment on this, I think the functions with same name under
2 different modules could be possibly called by:
</pre>
</blockquote>
<p>That is exactly how things are working in Ada:</p>
<blockquote>
<p>myfunc : local definition in the current file<br>
somepackage.myfunc : definition one can find in somepackage
that is included in the current file by "with somepackage;"</p>
</blockquote>
<p>And one can rename the package with "package S renames
somepackage" which allow writting "s.myfunc"<br>
I assume it's similar in Python too.<br>
</p>
<p>Antoine<br>
</p>
<blockquote type="cite">
<pre>moduleA.myfunc
moduleB.myfunc
______________________
Start Toolbox A
Load macros
Start Toolbox B
Load macros
--> toolboxAlib.scilab_sum(2,1)
"This is function from ToolboxA"
ans =
3.
--> toolboxBlib.scilab_sum(2,1)
"This is function from ToolboxB"
ans =
3.
--
Sent from: <a href="https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html" target="_blank">http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html</a>
_______________________________________________
users mailing list
<a href="mailto:users@lists.scilab.org" target="_blank">users@lists.scilab.org</a>
<a href="https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
users mailing list
<a href="mailto:users@lists.scilab.org" target="_blank">users@lists.scilab.org</a>
<a href="https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users" target="_blank">https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<pre cols="72">--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
<a href="http://www.utc.fr/~mottelet" target="_blank">http://www.utc.fr/~mottelet</a>
</pre>
</div>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.scilab.org" target="_blank">users@lists.scilab.org</a><br>
<a href="http://lists.scilab.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a><br>
</blockquote></div>