Re: [Scilab-users] Functions lib

2016-09-23 Thread sgougeon
- Mail original -
De: "Dang Ngoc Chan, Christophe"

>Hello all, hello Samuel,
>
>> De : Samuel Gougeon
>> Envoyé : vendredi 23 septembre 2016 11:00
>>
>>> * a file named "name" (without any extension), which is an ascii file
>>> containing the names of the functions;
>>
>> That's true, this is required for Scilab 5, and no longer for Scilab 6.
>> [...]
>> This is not enough. The "lib" file is also required. It is generated with 
>> genlib(..)
>
>I did not try to create a library recently,
>but the help still mentions the "names" file
>(BTW I forgot the "s")
>https://help.scilab.org/docs/6.0.0/en_US/lib.html
>and does not mention any lib file.
>
>When reading the help page for genlib
>https://help.scilab.org/docs/6.0.0/en_US/genlib.html
>I understand it is an automated process to create the bin files,
>but it does not either mention any lib file.
>
>Maybe the help pages need an update?
>(Or maybe I need to read more cautiously.)

IMO, as already mentionned on this forum, lib() looks almost useless.
load() does exactly the same, except that it does not allow to rename
on loading the loaded library. It names it according to its default
name declared when compiling it.
But i never met circumstances where the default name was a problem.
Rather, most often we try to guess what is the default name of the library
to use it as LHS output of lib().

Yes, "help lib" is outdated.
"help genlib" actually speaks about the "lib" file:
"When all .sci files have been processed, genlib creates a library variable 
named lib_name and saves it in the file lib in dir_name."

Samuel
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Functions lib

2016-09-22 Thread Gerhard Kreuzer
.. ok… thanks.

 

Seems it took some time (for a newbee), try it this evening.

 

Thanks a lot.

 

Gerhard

 

Von: Samuel GOUGEON [via Scilab / Xcos - Mailing Lists Archives] 
[mailto:ml-node+s994242n4034590...@n3.nabble.com] 
Gesendet: Donnerstag, 22. September 2016 08:27
An: Gerhard Kreuzer
Betreff: Re: Functions lib

 

Hello, 

Le 22/09/2016 08:08, Gerhard Kreuzer a écrit : 
> Hi, 
> 
> I now have some functions and want to use it from different scripts. Copying 
> this functions into each script isn't that nice. Any way to have some 
> 'function library' which I can put all this common things? 
. 
You may 
* put all of them (.sci files) in a directory, 
* cd to this directory 
* do 
genlib mytoolslib   // where mytoolslib is the name you want to give 
to the library 
edit SCIHOME/scilab.ini 
// in your startup file scilab.ini, add the line, to load the 
library at startup of each new scilab session 
mytoolslib = lib(path_to_the_lib_directory); 

Then for each new Scilab session, the functions of your library with be 
available from anywhere in the session. 

HTH 
Samuel Gougeon 

___ 
users mailing list 
[hidden email] 
http://lists.scilab.org/mailman/listinfo/users



  _  

If you reply to this email, your message will be added to the discussion below:

http://mailinglists.scilab.org/Functions-lib-tp4034588p4034590.html 

To unsubscribe from Functions lib, click here 

 .
 

 NAML 





--
View this message in context: 
http://mailinglists.scilab.org/Functions-lib-tp4034588p4034591.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Functions lib

2016-09-21 Thread Samuel Gougeon

Hello,

Le 22/09/2016 08:08, Gerhard Kreuzer a écrit :

Hi,

I now have some functions and want to use it from different scripts. Copying
this functions into each script isn't that nice. Any way to have some
'function library' which I can put all this common things?

.
You may
* put all of them (.sci files) in a directory,
* cd to this directory
* do
   genlib mytoolslib   // where mytoolslib is the name you want to give 
to the library

   edit SCIHOME/scilab.ini
   // in your startup file scilab.ini, add the line, to load the 
library at startup of each new scilab session

   mytoolslib = lib(path_to_the_lib_directory);

Then for each new Scilab session, the functions of your library with be 
available from anywhere in the session.


HTH
Samuel Gougeon

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Functions lib

2016-09-21 Thread Clément David
Hello Gerhard,

Great question ! Use the toolbox_skeleton [1] and create you own Scilab toolbox 
to easily re-use you
own function set. It might be automatically loaded at Scilab startup and used 
by your scripts.

First, simply create a directory "myToolbox" and a sub-directory "macros". Put 
all your Scilab
function (aka macros) in this sub-directory.

Second, copy the builder.sce and macros/buildmacros.sce (from the skeleton) 
into your directories to
"build" the library. Change the TOOLBOX_NAME and TOOLBOX_TITLE on builder.sce 
to reflect your
toolbox name ("myToolbox" in this example). Still on builder.sce, remove all 
the non-macros builds
(no C / C++ / help).

Third, copy and rename etc/toolbox_skeleton.start and etc/toolbox_skeleton.quit 
into directory etc/
in your toolbox to "load" the library. In your "myToolbox" example, rename them 
to
etc/myToolbox.start and etc/myToolbox.quit. Edit the myToolbox.start file to 
only load the Scilab
function (no C / C++ / help / preferences). Still on myToolbox.start, change 
the library name
"toolbox_skeletonlib" to "myToolboxlib".

And that's it ! `exec builder.sce` to build the toolbox and `exec loader.sce` 
to load it. To load it
at Scilab startup, use `atomsInstall` with the directory argument.
 
[1]: https://wiki.scilab.org/howto/Create%20a%20toolbox

For in depth, understanding browse the wiki or any existing toolbox on ATOMS.

Thanks,

--
Clément

Le mercredi 21 septembre 2016 à 23:08 -0700, Gerhard Kreuzer a écrit :
> Hi,
> 
> I now have some functions and want to use it from different scripts. Copying
> this functions into each script isn't that nice. Any way to have some
> 'function library' which I can put all this common things?
> 
> Thanks for helping
> 
> Gerhard
> 
> 
> 
> --
> View this message in context: 
> http://mailinglists.scilab.org/Functions-lib-tp4034588.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
> Nabble.com.
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Functions lib

2016-09-21 Thread Gerhard Kreuzer
Hi,

I now have some functions and want to use it from different scripts. Copying
this functions into each script isn't that nice. Any way to have some
'function library' which I can put all this common things?

Thanks for helping

Gerhard



--
View this message in context: 
http://mailinglists.scilab.org/Functions-lib-tp4034588.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users