genlib
builds a library from a set of *.sci files defining functions in a given directory
Syntax
genlib(lib_name) genlib(lib_name, dir_name) genlib(lib_name, dir_name, Force) genlib(lib_name, dir_name, Force, verb) genlib(lib_name [,path=dir_name] [,verbose=verb] [,force=Force])
Arguments
- lib_name
- Scilab string: The identifying name ascribed to the library to build.
- dir_name
- Scilab string: The pathname of the directory containing
.scifunctions files, and where thelibfile generated and defining the library will be stored. By default, the current working directory is considered.
Thedir_namedirectory and itsliband.binfiles must be writable. - Force
- boolean value (default value is
%f). Set it to%tto force the sci-files recompilation. - verb
- boolean value (default value is
%f). Set it to%tto display more information during the build.
Description
genlib(..) selects all files belonging to the
dir_name directory and with the .sci extension.
If any, subdirectories are never considered. If it is required, they must be compiled
apart into independent libraries.
Then, an XML editable file named lib is created in the
dir_name directory. The name lib_name
of the library is recorded into it.
Then, for each .sci file:
- If
- there is no related
.binfile indir_namewith the same basename (as for the initial build of the library), or - the content of the
.scifile has changed since the previous build,
the
.scifile is compiled (almost as it would be withexec(..)):If it contains at least one
function .. endfunctionblock, a.binbinary file with the same basename is generated and stored indir_name. It contains the binary code of ALL functions defined in the.scisource file.- If the name of one of the function(s) defined in the
file is the basename of the
.scifile, this function is registered in thelibfile. - Otherwise, no function from the
.scifile is registered: Its whole content is considered as dead code.
If atest.scifile defines thetest()function AND other functions like sub(), sub() functions are then considered as private to test(). For instance,
Hence, sub() and other() won't exist out of test(), and won't be registered in the library.function r = sub(a) r = 2*a endfunction function test() disp("A test") endfunction function r = other(b) r = 2^b endfunctionis equivalent to function test() function r = sub(a) r = 2*a endfunction function r = other(b) r = 2^b endfunction disp("A test") endfunction- If the name of one of the function(s) defined in the
file is the basename of the
- Otherwise, no
.binfile is generated: The whole content of the.scifile is considered as dead code.
- there is no related
- Otherwise: If the file's content has not changed and has already a function
entry in the
libfile, this entry is kept.
Finally, genlib(..) loads the created or updated library and sets
its identifier to a variable named lib_name, in the current scope.
If the variable lib_name already exists and is protected,
an error occurs: The library has been created but can't be loaded
(predef all can be used to unprotect the variable
named lib_name before running genlib(..)).
If the option force=%t is used, all .sci files
are compiled, even if their content has not changed.
When in the directory of a library some former .sci files have been removed while
all remaining .sci files are unchanged, rebuilding the library without the
force=%t will anyway update the list of library's members.
If the option verbose is true, more information is displayed during
the build process.
See also
History
| Version | Description |
| 6.0.0 |
|
| Report an issue | ||
| << Libraries | Libraries | get_function_path >> |