Re: [Scilab-users] Creation of a library with macros located in various folders
Hello Samuel, Those are great news, I am really looking forward the release of Scilab 6! In the mean time I've managed to make something that is working (similar to your script). It will be enough until the release. Regards, Pierre Le 15/10/2016 à 17:31, Samuel Gougeon a écrit : Hello Pierre, Scilab 6.0 will propose a new function *tbx_make*(..) that will be able to do exactly what you want: https://codereview.scilab.org/#/c/18071/ By the way, it will greatly simplify compilation of modules, and will no longer require many cooky-files .sce like buildmacros.sce buildoc.sce etc etc spread everywhere in the tree of files of a module. On the forefront, tbx_make() aims to replace & merge most of functions of the "modules manager" module, that are rather some atomic internals not really welcome as public functions: https://help.scilab.org/docs/6.0.0/en_US/section_d8452c14ec97df3c90ea90bb4f7d53b6.html If you use Scilab on Linux, you can already test tbx_make() in the nightly built release (*). If you are working with Scilab 5, you may use the attached script. Its how-to is in comments. Regards Samuel (*) tbx_make() merged on 2016-10-02 in the master release is still unavailable in the today NB sticking on the 2016-09-22 sources for Windows. Le 12/10/2016 22:00, Pierre Vuillemin a écrit : Hi all, I am trying to make a function similar to genlib but which goes recursively through folders to find .sci files, compile them and put them in a given target build folder. The idea is that I would like to be able to organize my 'macros' folder while still being able to generate a library. In particular, I would like to have that kind of folder organization : .../... ___ 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
Re: [Scilab-users] Creation of a library with macros located in various folders
Hello Pierre, Scilab 6.0 will propose a new function *tbx_make*(..) that will be able to do exactly what you want: https://codereview.scilab.org/#/c/18071/ By the way, it will greatly simplify compilation of modules, and will no longer require many cooky-files .sce like buildmacros.sce buildoc.sce etc etc spread everywhere in the tree of files of a module. On the forefront, tbx_make() aims to replace & merge most of functions of the "modules manager" module, that are rather some atomic internals not really welcome as public functions: https://help.scilab.org/docs/6.0.0/en_US/section_d8452c14ec97df3c90ea90bb4f7d53b6.html If you use Scilab on Linux, you can already test tbx_make() in the nightly built release (*). If you are working with Scilab 5, you may use the attached script. Its how-to is in comments. Regards Samuel (*) tbx_make() merged on 2016-10-02 in the master release is still unavailable in the today NB sticking on the 2016-09-22 sources for Windows. Le 12/10/2016 22:00, Pierre Vuillemin a écrit : Hi all, I am trying to make a function similar to genlib but which goes recursively through folders to find .sci files, compile them and put them in a given target build folder. The idea is that I would like to be able to organize my 'macros' folder while still being able to generate a library. In particular, I would like to have that kind of folder organization : .../... // "genlib" a folder of macros with subfolders of macros // The name of the folder yields the name of the main library (+"lib") // The name of each subfolder yields the name of the related sublibrary (+"lib") // // Put this script in the main macros folder and exec() it from anywhere. path = get_absolute_file_path("buildmacros.sce") tmp = strsplit(fileparts(path),filesep()); dirs = dir(path); dirs = dirs.name(dirs.isdir)' genlib(tmp($-1)+"lib", path, %t); for d = dirs genlib(d+"lib",path+d, %t); end ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] Creation of a library with macros located in various folders
Well, after some trials and (mainly) errors, it seems that when saving a function which name is given by the variable function_name, save(function_name + ".bin", function_name) does not work, while execstr("save("""function_name + ".bin""," +function_name+")") does work. The attached file contains a routine that goes recursively through folders in a given path to find the .sci files and create a library in a given build folder. It works as follows, rgenlib(lib_name, src_path, target_path) It seems to be 'working' but produces warnings due to: - the way binary files are saved (see above), which will change in Scilab 6 if I am correct, - the functions in the library being already loaded in Scilab for some reason. If anyone has an insight concerning the second point, I am interested. Best regards, Pierre Le 12/10/2016 à 22:00, Pierre Vuillemin a écrit : Hi all, I am trying to make a function similar to genlib but which goes recursively through folders to find .sci files, compile them and put them in a given target build folder. The idea is that I would like to be able to organize my 'macros' folder while still being able to generate a library. In particular, I would like to have that kind of folder organization : - build - src - sub-folder1 <.sci files> ... - sub-folder n - sub sub folder 1 <.sci files> < .sci files> At the moment, the function (build.sce in the attached file) goes through the folders contained in the initial 'src' folder, performs an 'exec' on the .sci files that are found, and save the corresponding binary files in the target folder 'build' (at the same level as 'src'). It also generates a 'names' file containing the names of the functions in the 'build' folder. Finally, it creates a library with the binary files contained in the 'build' folder. Yet, when I try to use my functions, I get the following error: !--error 999 Overloaded load cannot occur in this context So I guess that there is something wrong with the way I generate my library? My binary files are generated as follows, function_name = strsubst(fi,".sci","") // fi is the full name of the file names_to_write = [names_to_write;function_name] // used later to generate the file containing the names exec(file_path, -1) // file_path is the absolute path to my function save(target_path + function_name + ".bin", function_name) and the names file is generated as, names_file = target_path + "names" [fd, err] = mopen(names_file,"a") mputl(names_to_write, fd) mclose(fd) Best regards, Pierre Vuillemin ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users rgenlib.sci Description: application/scilab-sci ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users