[Scilab-Dev] Private functions in a .sci file <= Re: Multiple Functions in a sci file

Samuel Gougeon sgougeon at free.fr
Tue Feb 21 22:22:48 CET 2017


Hi,

Le 16/02/2017 à 06:04, Tan Chin Luh a écrit :
>
> Hi,
>
> I am trying to troubleshoot the issue on the guibuilder in Scilab 6 
> windows platform as reported by :
>
> https://atoms.scilab.org/toolboxes/guibuilder/3.1#comment2713
>
> -----------
> I used guibuilder in 5.5.2 and was able to create a gui, open an existing gui.  I just
> installed it for 6.0 and the guibuilder launches, but am unable to create anything, i
> get the error "Undefined variable: draw_uicontrol5" for anything that I click on
> to
> create. Or even to open an existing GUI.
> -----------
>
> I tried to reproduce the error in a simpler manner:
>
> 1. Write a simple sci file with 2 functions in it.
>
> function y = test1(x)
>     y = x+1;
> endfunction
>
> function y = testa(x)
>     y = x+2;
> endfunction
>
> 2. Put the file in a folder and use genlib to generate the lib
>
> 3. Load the library and call "test1(1)" and "testa(1)"
>
> In Scilab 5.5.2, both functions are callable, but in Scilab 6, only 
> test1 is, and calling testa will either return error "undefined 
> variable" or just crashed the Scilab.
>
> Is this meant to behave this way under "new parser and new core"?
>

AFAIK : yes.
Now, only the first function defined in the file (or the one whose name 
matches the file name? To be tested) is public. All other ones are 
private (their domain is unclear: (likely) only the main function? or 
the whole library it belongs to? To be tested and documented).
One of the (nice) consequences is that, now none of the private 
functions appears in the whos list of defined functions. They were 
formerly rather spamming the list.

> I try to screen through what's news in Scilab 6 and bugzilla, and the 
> similar but not exact issue found is : 
> http://bugzilla.scilab.org/show_bug.cgi?id=14525
>

You are right, i don't think it is already correctly documented. There 
were some discussions on users@ about this change since mid-2015, but 
since Scilab 5.5.2, the genlib() help page was improved for Scilab 5, 
without being updated for Scilab 6.

> I try to avoid breaking out all the functions to separate files as it 
> will be tones of files in the folder then.
>

I am afraid that, if each of your functions is -- say -- a callback, it 
must be public, and then now it requires to be defined in a separate 
.sci file.

Regards
Samuel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20170221/7b3b0d07/attachment.htm>


More information about the dev mailing list