summaryrefslogtreecommitdiff
path: root/modules/modules_manager/macros
diff options
context:
space:
mode:
Diffstat (limited to 'modules/modules_manager/macros')
-rwxr-xr-xmodules/modules_manager/macros/buildmacros.bat11
-rwxr-xr-xmodules/modules_manager/macros/buildmacros.sce15
-rwxr-xr-xmodules/modules_manager/macros/cleanmacros.bat13
-rwxr-xr-xmodules/modules_manager/macros/libbin0 -> 800 bytes
-rwxr-xr-xmodules/modules_manager/macros/names21
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_blocks.binbin0 -> 17012 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_blocks.sci112
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_cleaner.binbin0 -> 11956 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_cleaner.sci104
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_gateway.binbin0 -> 14176 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_gateway.sci160
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_gateway_clean.binbin0 -> 8988 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_gateway_clean.sci84
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_gateway_loader.binbin0 -> 9888 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_gateway_loader.sci92
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_help.binbin0 -> 6860 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_help.sci66
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_help_loader.binbin0 -> 7904 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_help_loader.sci69
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_loader.binbin0 -> 11628 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_loader.sci100
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_localization.binbin0 -> 9172 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_localization.sci72
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_macros.binbin0 -> 5588 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_macros.sci55
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_pal_loader.binbin0 -> 14108 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_pal_loader.sci82
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_src.binbin0 -> 3392 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_build_src.sci55
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder.binbin0 -> 2060 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder.sci27
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_gateway.binbin0 -> 4724 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_gateway.sci47
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_gateway_lang.binbin0 -> 6724 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_gateway_lang.sci73
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_help.binbin0 -> 3828 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_help.sci41
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_help_lang.binbin0 -> 6568 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_help_lang.sci63
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_macros.binbin0 -> 3872 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_macros.sci40
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_src.binbin0 -> 4640 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_src.sci47
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_src_lang.binbin0 -> 6596 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_builder_src_lang.sci63
-rwxr-xr-xmodules/modules_manager/macros/tbx_generate_pofile.binbin0 -> 21024 bytes
-rwxr-xr-xmodules/modules_manager/macros/tbx_generate_pofile.sci168
47 files changed, 1680 insertions, 0 deletions
diff --git a/modules/modules_manager/macros/buildmacros.bat b/modules/modules_manager/macros/buildmacros.bat
new file mode 100755
index 000000000..b9d36bdd4
--- /dev/null
+++ b/modules/modules_manager/macros/buildmacros.bat
@@ -0,0 +1,11 @@
+
+rem Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+rem Copyright (C) 2010 - DIGITEO - Allan CORNET
+rem
+rem This file must be used under the terms of the CeCILL.
+rem This source file is licensed as described in the file COPYING, which
+rem you should have received as part of this distribution. The terms
+rem are also available at
+rem http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+@..\..\..\bin\scilex -nwni -ns -e exec('buildmacros.sce');quit;
diff --git a/modules/modules_manager/macros/buildmacros.sce b/modules/modules_manager/macros/buildmacros.sce
new file mode 100755
index 000000000..7776102c8
--- /dev/null
+++ b/modules/modules_manager/macros/buildmacros.sce
@@ -0,0 +1,15 @@
+
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+if (isdef("genlib") == %f) then
+ exec(SCI+"/modules/functions/scripts/buildmacros/loadgenlib.sce");
+end
+
+genlib("modules_managerlib","SCI/modules/modules_manager/macros",%f,%t);
diff --git a/modules/modules_manager/macros/cleanmacros.bat b/modules/modules_manager/macros/cleanmacros.bat
new file mode 100755
index 000000000..e538965a5
--- /dev/null
+++ b/modules/modules_manager/macros/cleanmacros.bat
@@ -0,0 +1,13 @@
+
+rem Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+rem Copyright (C) 2010 - DIGITEO
+rem
+rem This file must be used under the terms of the CeCILL.
+rem This source file is licensed as described in the file COPYING, which
+rem you should have received as part of this distribution. The terms
+rem are also available at
+rem http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+@del *.bin 2>NUL
+@del lib 2>NUL
+@del names 2>NUL
diff --git a/modules/modules_manager/macros/lib b/modules/modules_manager/macros/lib
new file mode 100755
index 000000000..8e458dc30
--- /dev/null
+++ b/modules/modules_manager/macros/lib
Binary files differ
diff --git a/modules/modules_manager/macros/names b/modules/modules_manager/macros/names
new file mode 100755
index 000000000..a4fc4214d
--- /dev/null
+++ b/modules/modules_manager/macros/names
@@ -0,0 +1,21 @@
+tbx_build_blocks
+tbx_build_cleaner
+tbx_build_gateway
+tbx_build_gateway_clean
+tbx_build_gateway_loader
+tbx_build_help
+tbx_build_help_loader
+tbx_build_loader
+tbx_build_localization
+tbx_build_macros
+tbx_build_pal_loader
+tbx_build_src
+tbx_builder
+tbx_builder_gateway
+tbx_builder_gateway_lang
+tbx_builder_help
+tbx_builder_help_lang
+tbx_builder_macros
+tbx_builder_src
+tbx_builder_src_lang
+tbx_generate_pofile
diff --git a/modules/modules_manager/macros/tbx_build_blocks.bin b/modules/modules_manager/macros/tbx_build_blocks.bin
new file mode 100755
index 000000000..48332757f
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_blocks.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_build_blocks.sci b/modules/modules_manager/macros/tbx_build_blocks.sci
new file mode 100755
index 000000000..d7dd3128e
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_blocks.sci
@@ -0,0 +1,112 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Clément DAVID <clement.david@scilab.org>
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function tbx_build_blocks(module, names, macros_path)
+ // Build a default block instance
+ //
+ // Calling Sequence
+ // tbx_build_blocks(module, names)
+ //
+ // Parameters
+ // module: toolbox base directory
+ // names: list of block names (sci file name without extension)
+
+ if argn(2) < 2 then
+ error(msprintf(gettext("%s: Wrong number of input arguments: At least %d expected.\n"),"tbx_build_blocks",2));
+ end
+ if argn(2) > 3 then
+ error(msprintf(gettext("%s: Wrong number of input arguments: At most %d expected.\n"),"tbx_build_blocks",3));
+ end
+
+
+ // checking module argument
+ if type(module) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_blocks",1));
+ end
+ if size(module,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_blocks",1));
+ end
+ if ~isdir(module) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_build_blocks",module));
+ end
+
+ // checking names argument
+ if type(names) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_blocks",2));
+ end
+
+ // checking optional macros_path argument
+ if ~exists("macros_path", "l") then
+ macros_path = module + "/macros/";
+ end
+ if type(macros_path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_blocks",3));
+ end
+ if size(macros_path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_blocks",3));
+ end
+ if ~isdir(macros_path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_build_blocks",macros_path));
+ end
+
+ mprintf(gettext("Building blocks...\n"));
+
+ // load Xcos libraries when not already loaded.
+ if ~exists("scicos_diagram") then loadXcosLibs(); end
+
+ // create directories
+ if ~isdir(module + "/images") then
+ createdir(module + "/images");
+ end
+ if ~isdir(module + "/images/h5") then
+ createdir(module + "/images/h5");
+ end
+ if ~isdir(module + "/images/gif") then
+ createdir(module + "/images/gif");
+ end
+ if ~isdir(module + "/images/svg") then
+ createdir(module + "/images/svg");
+ end
+
+ names = names(:);
+ sciFiles = pathconvert(macros_path + "/") + names + ".sci";
+ h5Files = pathconvert(module + "/images/h5/") + names + ".sod";
+ gif_tlbx = pathconvert(module + "/images/gif");
+ svg_tlbx = pathconvert(module + "/images/svg");
+ for i=1:size(names, "*")
+ // load the interface function
+ exec(sciFiles(i), -1);
+
+ // export the instance
+ execstr(msprintf("scs_m = %s (''define'');", names(i)));
+ if ~export_to_hdf5(h5Files(i), "scs_m") then
+ error(msprintf(gettext("%s: Unable to export %s to %s.\n"),"tbx_build_blocks",names(i), h5Files(i)));
+ end
+
+ blk = scs_m;
+
+ // export a schema file if it doesn't exist
+ files = svg_tlbx + "/" + names(i) + [".svg" ".png" ".jpg" ".gif"];
+ files = files(isfile(files));
+ if files == [] then
+ filename = svg_tlbx + "/" + names(i) + ".svg";
+ if ~generateBlockImage(blk, svg_tlbx, names(i), "svg", %f) then
+ error(msprintf(gettext("%s: Unable to export %s to %s .\n"),"tbx_build_blocks",names(i), filename));
+ end
+ end
+
+ // export an image file if it doesn't exist
+ files = gif_tlbx + "/" + names(i) + [".png" ".jpg" ".gif"];
+ files = files(isfile(files));
+ if files == [] then
+ filename = gif_tlbx + "/" + names(i) + ".gif";
+ xcosPalGenerateIcon(filename);
+ end
+ end
+endfunction
diff --git a/modules/modules_manager/macros/tbx_build_cleaner.bin b/modules/modules_manager/macros/tbx_build_cleaner.bin
new file mode 100755
index 000000000..2905bfcbe
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_cleaner.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_build_cleaner.sci b/modules/modules_manager/macros/tbx_build_cleaner.sci
new file mode 100755
index 000000000..a1027873c
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_cleaner.sci
@@ -0,0 +1,104 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+// Copyright (C) 2009-2012 - DIGITEO - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Generate a cleaner.sce script for the toolbox
+
+function tbx_build_cleaner(name, path)
+
+ rhs = argn(2);
+
+ // Number of input arguments
+
+ if and(rhs <> [1 2]) then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"), "tbx_build_cleaner", 1, 2));
+ end
+
+ // Input argument N°1
+ // name
+
+ if type(name) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "tbx_build_cleaner", 1));
+ end
+
+ if size(name,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"), "tbx_build_cleaner", 1));
+ end
+
+ // Input argument N°2
+ // path
+
+ if rhs < 2 then
+ path = pwd();
+ else
+ if type(path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "tbx_build_cleaner", 2));
+ end
+
+ if size(path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"), "tbx_build_cleaner", 2));
+ end
+
+ if ~isdir(path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"), "tbx_build_cleaner", path));
+ end
+ end
+
+ // build the cleaner file
+
+ mprintf(gettext("Generating cleaner.sce...\n"));
+
+ cleanertxt = [
+ "// This file is released under the 3-clause BSD license. See COPYING-BSD.",
+ "// Generated by builder.sce: Please, do not edit this file",
+ "",
+ "try",
+ " getversion(""scilab"");",
+ "catch",
+ " error(""Scilab 5.0 or more is required."");",
+ "end",
+ "function perform_clean()",
+ " root_tlbx = get_absolute_file_path(''cleaner.sce'');",
+ "",
+ " if isfile(root_tlbx + ''/macros/cleanmacros.sce'') then",
+ " exec(root_tlbx+''/macros/cleanmacros.sce'');",
+ " end",
+ "",
+ " if isfile(root_tlbx + ''/src/cleaner_src.sce'') then",
+ " exec(root_tlbx+''/src/cleaner_src.sce'');",
+ " end",
+ "",
+ " if isfile(root_tlbx + ""/sci_gateway/cleaner_gateway.sce"") then",
+ " exec(root_tlbx + ""/sci_gateway/cleaner_gateway.sce"");",
+ " mdelete(root_tlbx + ""/sci_gateway/cleaner_gateway.sce"");",
+ " end",
+ "",
+ " if isfile(root_tlbx + ""/help/cleaner_help.sce"") then",
+ " exec(root_tlbx + ""/help/cleaner_help.sce"");",
+ " end",
+ "",
+ " if isfile(root_tlbx + ""/loader.sce"") then",
+ " mdelete(root_tlbx + ""/loader.sce"");",
+ " end",
+ "",
+ " if isfile(root_tlbx + ""/unloader.sce"") then",
+ " mdelete(root_tlbx + ""/unloader.sce"");",
+ " end",
+
+ "endfunction",
+ "perform_clean();",
+ "clear perform_clean;"];
+
+ cleanerfile = pathconvert(path+"/cleaner.sce", %F);
+
+ if ~mputl(cleanertxt, cleanerfile) then
+ error(msprintf(gettext("%s: The file %s cannot been created, please check if you have write access on this file.\n"), "tbx_build_cleaner", cleanerfile));
+ end
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_build_gateway.bin b/modules/modules_manager/macros/tbx_build_gateway.bin
new file mode 100755
index 000000000..5c1acf6e5
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_gateway.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_build_gateway.sci b/modules/modules_manager/macros/tbx_build_gateway.sci
new file mode 100755
index 000000000..feb009a49
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_gateway.sci
@@ -0,0 +1,160 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Simple wrapper around ilib_build
+function tbx_build_gateway(libname, ..
+ names, ..
+ files, ..
+ gateway_path, ..
+ libs, ..
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ cc, ..
+ makename, ..
+ ismex)
+
+
+ rhs = argn(2);
+ currentdirectory = pwd();
+
+ // Number of input arguments
+
+ if rhs<3 | rhs>11 then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"tbx_build_gateway",3,11))
+ end
+
+ // Input argument N°1
+ // → libname
+
+ if type(libname) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_gateway",1));
+ end
+
+ if size(libname,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_gateway",1));
+ end
+
+ // Input argument N°2
+ // → table
+
+ if type(names) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A matrix of strings expected.\n"),"tbx_build_gateway",2));
+ end
+
+ if size(names,"r") > 999 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: At most %d rows expected.\n"),"tbx_build_gateway",2,999));
+ end
+
+ // Input argument N°3
+ // → files
+
+ if type(files) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A matrix of strings expected.\n"),"tbx_build_gateway",3));
+ end
+
+ // Input argument N°4
+ // → gateway_path
+
+ if rhs<4 then
+ gateway_path = currentdirectory;
+
+ else
+ if type(gateway_path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_gateway",4));
+ end
+
+ if size(gateway_path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_gateway",4));
+ end
+
+ if ~isdir(gateway_path) then
+ error(msprintf(gettext("%s: Wrong value for input argument #%d: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_build_gateway",4,gateway_path));
+ end
+
+ if ~chdir(gateway_path) then
+ error(msprintf(gettext("%s: Wrong value for input argument #%d: Can''t go to ''%s''.\n"),"tbx_build_gateway",4,gateway_path));
+ end
+ end
+
+ // Input argument N°5
+ // → libs
+
+ if rhs<5 then
+ libs = [];
+ end
+
+ // Input argument N°6
+ // → ldflags
+
+ if rhs<6 then
+ ldflags = "";
+ end
+
+ // Input argument N°7
+ // → cflags
+
+ if rhs<7 then
+ cflags = "";
+ end
+
+ // Input argument N°8
+ // → fflags
+
+ if rhs<8 then
+ fflags = "";
+ end
+
+ // Input argument N°9
+ // → cc
+
+ if rhs<9 then
+ cc = "";
+ end
+
+ // Input argument N°10
+ // → makename
+
+ if rhs<10 then
+ makename = "";
+ end
+
+ // Input argument N°11
+ // → ismex
+
+ if rhs<11 then
+ ismex = %F;
+
+ else
+ if type(ismex) <> 4 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"tbx_build_gateway",11));
+ end
+
+ if size(ismex,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A boolean expected.\n"),"tbx_build_gateway",11));
+ end
+ end
+
+ ilib_build(libname, ..
+ names, ..
+ files, ..
+ libs, ..
+ makename, ..
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ ismex, ..
+ cc);
+
+ if ~chdir(currentdirectory) then
+ error(msprintf(gettext("%s: Can''t go to directory ''%s''.\n"),"tbx_builder_gateway",currentdirectory));
+ end
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_build_gateway_clean.bin b/modules/modules_manager/macros/tbx_build_gateway_clean.bin
new file mode 100755
index 000000000..d71eb8e01
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_gateway_clean.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_build_gateway_clean.sci b/modules/modules_manager/macros/tbx_build_gateway_clean.sci
new file mode 100755
index 000000000..3685d7222
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_gateway_clean.sci
@@ -0,0 +1,84 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009-2010 - DIGITEO - Allan CORNET
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Generate a cleaner_gateway.sce script for the gateway
+
+function tbx_build_gateway_clean(languages,path)
+
+ rhs = argn(2);
+
+ // Number of input arguments
+
+ if and(rhs<> [1 2]) then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"tbx_build_gateway_clean",1,2));
+ end
+
+ // Input argument N°1
+ // → languages
+
+ if type(languages) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_gateway_clean",1));
+ end
+
+ // Input argument N°2
+ // → path
+
+ if rhs < 2 then
+ path = pwd();
+
+ else
+ if type(path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_gateway_clean",2));
+ end
+
+ if size(path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_gateway_clean",2));
+ end
+
+ if ~isdir(path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_build_gateway_clean",path));
+ end
+ end
+
+ // build the cleaner file
+
+ mprintf(gettext("Generating cleaner_gateway.sce...\n"));
+
+ cleanertxt = [
+ "// This file is released under the 3-clause BSD license. See COPYING-BSD.",
+ "// Generated by builder_gateway.sce: Please, do not edit this file",
+ "",
+ "sci_gateway_dir = get_absolute_file_path(""cleaner_gateway.sce"");",
+ "current_dir = pwd();",
+ ""];
+
+ for i = 1:size(languages,"*") do
+ cleanertxt = [cleanertxt,
+ "chdir(sci_gateway_dir);",
+ "if ( isdir("""+languages(i)+""") ) then",
+ " chdir("""+languages(i)+""");",
+ " exec(""cleaner.sce"");",
+ " mdelete(""cleaner.sce"");",
+ "end",
+ ""
+ ];
+ end
+
+ cleanertxt = [cleanertxt,
+ "chdir(current_dir);",
+ "clear sci_gateway_dir current_dir;"];
+
+ cleanerfile = pathconvert(path+"/cleaner_gateway.sce",%F);
+
+ if ~mputl(cleanertxt,cleanerfile) then
+ error(msprintf(gettext("%s: The file %s cannot been created, please check if you have write access on this file.\n"),"tbx_build_gateway_clean",cleanerfile));
+ end
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_build_gateway_loader.bin b/modules/modules_manager/macros/tbx_build_gateway_loader.bin
new file mode 100755
index 000000000..cf4ea17f8
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_gateway_loader.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_build_gateway_loader.sci b/modules/modules_manager/macros/tbx_build_gateway_loader.sci
new file mode 100755
index 000000000..40d5f1e7a
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_gateway_loader.sci
@@ -0,0 +1,92 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Generate a loader_gateway.sce script for the gateway
+function tbx_build_gateway_loader(languages,path)
+
+ rhs = argn(2);
+
+ // Number of input arguments
+
+ if and(rhs<> [1 2]) then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"tbx_build_gateway_loader",1,2));
+ end
+
+ // Input argument N°1
+ // → languages
+
+ if type(languages) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_gateway_loader",1));
+ end
+
+ // Input argument N°2
+ // → path
+
+ if rhs < 2 then
+ path = pwd();
+
+ else
+ if type(path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_gateway_loader",2));
+ end
+
+ if size(path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_gateway_loader",2));
+ end
+
+ if ~isdir(path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_build_gateway_loader",path));
+ end
+ end
+
+ // build the loader file
+
+ mprintf(gettext("Generating loader_gateway.sce...\n"));
+
+ loadertxt = [
+ "// This file is released under the 3-clause BSD license. See COPYING-BSD.",
+ "// Generated by builder_gateway.sce: Please, do not edit this file",
+ "",
+ "try"
+ " v = getversion(""scilab"");",
+ "catch",
+ " v = [ 5 0 ]; // or older ",
+ "end",
+ "if (v(1) <= 5) & (v(2) < 3) then",
+ " // new API in scilab 5.3",
+ " error(gettext(""Scilab 5.3 or more is required.""));",
+ "end",
+ "",
+ "sci_gateway_dir = get_absolute_file_path(""loader_gateway.sce"");",
+ "current_dir = pwd();",
+ ""];
+
+ for i = 1:size(languages,"*") do
+
+ loadertxt = [loadertxt,
+ "chdir(sci_gateway_dir);",
+ "if ( isdir("""+languages(i)+""") ) then",
+ " chdir("""+languages(i)+""");",
+ " exec(""loader.sce"");",
+ "end",
+ ""];
+ end
+
+ loadertxt = [loadertxt,
+ "chdir(current_dir);",
+ "clear sci_gateway_dir current_dir v;"];
+
+ loaderfile = pathconvert(path+"/loader_gateway.sce",%F);
+
+ if ~mputl(loadertxt,loaderfile) then
+ error(msprintf(gettext("%s: The file %s cannot been created, please check if you have write access on this file.\n"),"tbx_build_gateway_loader",loaderfile));
+ end
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_build_help.bin b/modules/modules_manager/macros/tbx_build_help.bin
new file mode 100755
index 000000000..2090f2573
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_help.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_build_help.sci b/modules/modules_manager/macros/tbx_build_help.sci
new file mode 100755
index 000000000..0bb2ab6fe
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_help.sci
@@ -0,0 +1,66 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+// Copyright (C) 2010-2011 - DIGITEO - Allan CORNET
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Simple wrapper around xmltojar
+
+function tbx_build_help(moduletitle, path)
+
+ rhs = argn(2);
+
+ // Number of input arguments
+
+ if and(rhs<> [1 2]) then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"), "tbx_build_help", 1, 2));
+ end
+
+ // Input argument N°1
+ // → name
+
+ if type(moduletitle) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "tbx_build_help", 1));
+ end
+
+ if size(moduletitle,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"), "tbx_build_help", 1));
+ end
+
+ // Input argument N°2
+ // → path
+
+ if rhs < 2 then
+ path = pwd();
+ else
+ if type(path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "tbx_build_help", 2));
+ end
+
+ if size(path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"), "tbx_build_help", 2));
+ end
+
+ if ~isdir(path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"), "tbx_build_help", path));
+ end
+ end
+
+ path = pathconvert(path, %f, %t);
+
+ // Check scilab mode
+ if and(getscilabmode() <> ["STD" "NW"]) then
+ error(msprintf(gettext("%s: documentation cannot be built in this scilab mode: %s.\n"),"tbx_build_help",getscilabmode()));
+ end
+
+ directory_language = basename(path);
+ default_language = getlanguage();
+
+ xmltojar(path, moduletitle, directory_language, default_language);
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_build_help_loader.bin b/modules/modules_manager/macros/tbx_build_help_loader.bin
new file mode 100755
index 000000000..fc8a95f91
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_help_loader.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_build_help_loader.sci b/modules/modules_manager/macros/tbx_build_help_loader.sci
new file mode 100755
index 000000000..89b598e11
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_help_loader.sci
@@ -0,0 +1,69 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Generate a loader file for the help
+
+function tbx_build_help_loader(moduletitle,path)
+
+ rhs = argn(2);
+
+ // Number of input arguments
+
+ if and(rhs<> [1 2]) then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"tbx_build_help_loader",1,2));
+ end
+
+ // Input argument N°1
+ // → toolbox_title
+
+ if type(moduletitle) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_help_loader",1));
+ end
+
+ if size(moduletitle,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_help_loader",1));
+ end
+
+ // Input argument N°2
+ // → path
+
+ if rhs<2 then
+ path = pwd();
+
+ else
+ if type(path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_help_loader",1));
+ end
+
+ if size(path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_help_loader",1));
+ end
+
+ if ~isdir(path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_build_help_loader",path));
+ end
+ end
+
+ // build the loader file
+
+ loadertxt = [
+ "// This file is released under the 3-clause BSD license. See COPYING-BSD.",
+ "// Generated by tbx_build_help_loader: Please, do not edit this file",
+ "",
+ "add_help_chapter("""+toolbox_title+""",get_absolute_file_path(""addchapter.sce""),%F);",
+ "clear add_help_chapter;"];
+
+ loaderfile = pathconvert(path+"/addchapter.sce",%F);
+
+ if ~mputl(loadertxt,loaderfile) then
+ error(msprintf(gettext("%s: The file %s cannot been created, please check if you have write access on this file.\n"),"tbx_build_help_loader",loaderfile));
+ end
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_build_loader.bin b/modules/modules_manager/macros/tbx_build_loader.bin
new file mode 100755
index 000000000..8837a0352
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_loader.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_build_loader.sci b/modules/modules_manager/macros/tbx_build_loader.sci
new file mode 100755
index 000000000..36c491552
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_loader.sci
@@ -0,0 +1,100 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+// Copyright (C) 2010-2012 - DIGITEO - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Generate a loader.sce script for the toolbox
+
+function tbx_build_loader(name, path)
+
+ rhs = argn(2);
+
+ // Number of input arguments
+
+ if and(rhs <> [1 2]) then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"), "tbx_build_loader", 1, 2));
+ end
+
+ // Input argument N°1
+ // name
+
+ if type(name) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "tbx_build_loader", 1));
+ end
+
+ if size(name, "*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"), "tbx_build_loader", 1));
+ end
+
+ // Input argument N°2
+ // path
+
+ if rhs < 2 then
+ path = pwd();
+ else
+ if type(path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "tbx_build_loader", 2));
+ end
+
+ if size(path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"), "tbx_build_loader", 2));
+ end
+
+ if ~isdir(path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"), "tbx_build_loader", path));
+ end
+ end
+
+ // build the loader file
+
+ mprintf(gettext("Generating loader.sce...\n"));
+
+ loadertxt = [
+ "// This file is released under the 3-clause BSD license. See COPYING-BSD.",
+ "// Generated by builder.sce: Please, do not edit this file",
+ "",
+ "try",
+ " getversion(""scilab"");",
+ "catch",
+ " error(""Scilab 5.0 or more is required."");",
+ "end;",
+ "",
+ "exec(get_absolute_file_path(""loader.sce"")+""etc"+filesep()+"""+"""+name+".start"");"];
+
+ loaderfile = pathconvert(path + "/loader.sce", %F);
+
+ if ~mputl(loadertxt, loaderfile) then
+ error(msprintf(gettext("%s: The file %s cannot been created, please check if you have write access on this file.\n"), "tbx_build_loader", loaderfile));
+ end
+
+ mprintf(gettext("Generating unloader.sce...\n"));
+
+ unloadertxt = [
+ "// This file is released under the 3-clause BSD license. See COPYING-BSD.",
+ "// Generated by builder.sce: Please, do not edit this file",
+ "",
+ "try",
+ " getversion(""scilab"");",
+ "catch",
+ " error(""Scilab 5.4 or more is required."");",
+ "end;",
+ "",
+ "fileQuit = get_absolute_file_path(""unloader.sce"") + ""etc" + filesep() + """ + """ + name + ".quit"";",
+ "if isfile(fileQuit) then",
+ " exec(fileQuit);",
+ "end"
+ ""];
+
+ unloaderfile = pathconvert(path + "/unloader.sce", %F);
+
+ if ~mputl(unloadertxt, unloaderfile) then
+ error(msprintf(gettext("%s: The file %s cannot been created, please check if you have write access on this file.\n"), "tbx_build_loader", unloaderfile));
+ end
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_build_localization.bin b/modules/modules_manager/macros/tbx_build_localization.bin
new file mode 100755
index 000000000..6317ff0fb
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_localization.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_build_localization.sci b/modules/modules_manager/macros/tbx_build_localization.sci
new file mode 100755
index 000000000..44399430e
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_localization.sci
@@ -0,0 +1,72 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Antoine ELIAS
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function tbx_build_localization(tbx_name, tbx_path)
+
+ rhs = argn(2);
+
+ if and(rhs <> [1 2]) then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"tbx_build_localization",1,2));
+ end
+
+ if type(tbx_name) <> 10 then
+ error(tbx_name(gettext("%s: Wrong type for input argument #%d: A string array expected.\n"),"tbx_build_localization",1));
+ end
+
+ if rhs < 2 then
+ tbx_path = pwd();
+ else
+ if type(tbx_path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_localization",2));
+ end
+
+ if size(tbx_path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_localization",2));
+ end
+
+ if ~isdir(tbx_path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_build_localization", tbx_path));
+ end
+ end
+
+ //forge command
+ localePath = tbx_path + "locales/";
+
+ if isdir(localePath) == %f then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_build_localization",localePath));
+ end
+
+ //find list of .po files
+ poFiles = gsort(findfiles(localePath, "*.po"), "lr", "i");
+
+ if getos() == "Windows" then
+ cmd = SCI + filesep() + "tools/gettext/msgfmt";
+ else
+ cmd = "msgfmt";
+ end
+
+ mprintf(gettext("Generating localization\n"));
+ for i=1:size(poFiles, "*")
+ //generate moFile name and path
+ lang = fileparts(poFiles(i), "fname");
+ printf("-- Building for ""%s"" --\n", lang);
+ moFile = localePath + lang + "/LC_MESSAGES/";
+ mkdir(moFile); //to be sure path exists
+ poFile = moFile + tbx_name + ".po";
+ moFile = moFile + tbx_name + ".mo";
+
+
+ //check mo file is newest po, don't need to generate it
+ if newest(poFiles(i), moFile) == 1 then
+ copyfile(localePath + poFiles(i), poFile);
+ cmd1 = cmd + " -o " + moFile + " " + poFile;
+ host(cmd1)
+ end
+ end
+endfunction
diff --git a/modules/modules_manager/macros/tbx_build_macros.bin b/modules/modules_manager/macros/tbx_build_macros.bin
new file mode 100755
index 000000000..ed300382e
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_macros.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_build_macros.sci b/modules/modules_manager/macros/tbx_build_macros.sci
new file mode 100755
index 000000000..aeb964c01
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_macros.sci
@@ -0,0 +1,55 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Simple wrapper around genlib
+
+function tbx_build_macros(name,path)
+
+ rhs = argn(2);
+
+ // Number of input arguments
+
+ if and(rhs<> [1 2]) then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"tbx_build_macros",1,2));
+ end
+
+ // Input argument N°1
+ // → name
+
+ if type(name) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_macros",1));
+ end
+
+ if size(name,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_macros",1));
+ end
+
+ // Input argument N°2
+ // → path
+
+ if rhs < 2 then
+ path = pwd();
+
+ else
+ if type(path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_macros",2));
+ end
+
+ if size(path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_macros",2));
+ end
+
+ if ~isdir(path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_build_macros",path));
+ end
+ end
+
+ genlib(name+"lib",path,%F,%T);
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_build_pal_loader.bin b/modules/modules_manager/macros/tbx_build_pal_loader.bin
new file mode 100755
index 000000000..db793e344
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_pal_loader.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_build_pal_loader.sci b/modules/modules_manager/macros/tbx_build_pal_loader.sci
new file mode 100755
index 000000000..d4249895b
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_pal_loader.sci
@@ -0,0 +1,82 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - INRIA - Serge STEER
+// Copyright (C) 2014 - Scilab Enterprises - Clément DAVID
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function tbx_build_pal_loader(palettename,interfacefunctions,module_path,script_path)
+ if argn(2) < 3 then
+ error(msprintf(gettext("%s: Wrong number of input arguments: At least %d expected.\n"),"tbx_build_blocks",3));
+ end
+ // checking palettename argument
+ if type(palettename) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_blocks",1));
+ end
+ if size(palettename,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_blocks",1));
+ end
+
+ // checking module_path argument
+ if type(module_path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_blocks",3));
+ end
+ if size(module_path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_blocks",3));
+ end
+ if ~isdir(module_path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_build_blocks",module_path));
+ end
+
+ // checking interfacefunctions argument
+ if type(interfacefunctions) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string array expected.\n"),"tbx_build_blocks",2));
+ end
+
+ // checking optional script_path argument
+ if argn(2)==4 then
+ if type(script_path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_build_blocks",4));
+ end
+ if size(script_path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_build_blocks",4));
+ end
+ else
+ script_path=module_path + "/macros"
+ end
+ if ~isdir(script_path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_build_blocks",script_path));
+ end
+
+
+ t=["// This file is released under the 3-clause BSD license. See COPYING-BSD."
+ "// Generated by tbx_build_pal_loader: Please, do not edit this file"
+ ""
+ "function loaderpal()"
+ " xpal = xcosPal("""+palettename+""");"
+ " images_path = get_absolute_file_path(""loader_pal.sce"")+""/../images/"";"
+ " interfacefunctions ="+sci2exp(interfacefunctions);
+ " for i=1:size(interfacefunctions,""*"")"
+ " h5_instances = ls(images_path + ""h5/"" + interfacefunctions(i) + "".sod"");"
+ " if h5_instances==[] then"
+ " error(msprintf(_(""%s: block %s has not been built.\n""),""loader_pal.sce"",interfacefunctions(i)))"
+ " end"
+ " pal_icons = ls(images_path + ""gif/"" + interfacefunctions(i) + ""."" + [""png"" ""jpg"" ""gif""]);"
+ " if pal_icons==[] then"
+ " error(msprintf(_(""%s: block %s has no palette icon.\n""),""loader_pal.sce"",interfacefunctions(i)))"
+ " end"
+ " graph_icons = ls(images_path + ""svg/"" + interfacefunctions(i) + ""."" + [""svg"" ""png"" ""jpg"" ""gif""]);"
+ " if graph_icons==[] then"
+ " error(msprintf(_(""%s: block %s has no editor icon.\n""),""loader_pal.sce"",interfacefunctions(i)))"
+ " end"
+ " xpal = xcosPalAddBlock(xpal, interfacefunctions(i), pal_icons(1) , graph_icons(1));"
+ " end"
+ " xcosPalAdd(xpal);"
+ "endfunction"
+ "loaderpal(),clear loaderpal"]
+ mputl(t,script_path+"loader_pal.sce")
+endfunction
+
diff --git a/modules/modules_manager/macros/tbx_build_src.bin b/modules/modules_manager/macros/tbx_build_src.bin
new file mode 100755
index 000000000..02abc4241
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_src.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_build_src.sci b/modules/modules_manager/macros/tbx_build_src.sci
new file mode 100755
index 000000000..ef1640311
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_build_src.sci
@@ -0,0 +1,55 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.org>
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Simple wrapper around ilib_for_link
+
+function tbx_build_src(names, ..
+ files, ..
+ flag, ..
+ src_path, ..
+ libs, ..
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ cc, ..
+ libname, ..
+ loadername, ..
+ makename)
+
+ oldpath = pwd();
+
+ if exists("src_path","local") then
+ chdir(src_path);
+ end
+
+ if ~exists("libs", "local") then libs = []; end
+ if ~exists("ldflags", "local") then ldflags = ""; end
+ if ~exists("cflags", "local") then cflags = ""; end
+ if ~exists("fflags", "local") then fflags = ""; end
+ if ~exists("cc", "local") then cc = ""; end
+ if ~exists("libname", "local") then libname = ""; end
+ if ~exists("loadername", "local") then loadername = "loader.sce"; end
+ if ~exists("makename", "local") then makename = ""; end
+
+ ilib_for_link(names, ..
+ files, ..
+ libs, ..
+ flag, ..
+ makename, ..
+ loadername, ..
+ libname, ..
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ cc);
+
+ chdir(oldpath);
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_builder.bin b/modules/modules_manager/macros/tbx_builder.bin
new file mode 100755
index 000000000..0db1464b2
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_builder.sci b/modules/modules_manager/macros/tbx_builder.sci
new file mode 100755
index 000000000..d2b8a356f
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder.sci
@@ -0,0 +1,27 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function tbx_builder(files)
+
+ if type(files) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string array expected.\n"),"tbx_builder",1));
+ end
+
+ for i=1:size(files,"*") do
+
+ if ~isfile(files(i)) then
+ error(msprintf(gettext("%s: The file ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_builder",files(i)));
+ end
+
+ exec(files(i),-1);
+
+ end
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_builder_gateway.bin b/modules/modules_manager/macros/tbx_builder_gateway.bin
new file mode 100755
index 000000000..340dcfafb
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_gateway.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_builder_gateway.sci b/modules/modules_manager/macros/tbx_builder_gateway.sci
new file mode 100755
index 000000000..a0d740485
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_gateway.sci
@@ -0,0 +1,47 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Run the module+"/sci_gateway/builder_gateway.sce" script if it exists
+
+function tbx_builder_gateway(module)
+
+ // Number of input arguments
+
+ if argn(2)<>1 then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"tbx_builder_gateway",1));
+ end
+
+ // Input argument N°1
+ // → module
+
+ if type(module) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_builder_gateway",1));
+ end
+
+ if size(module,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_builder_gateway",1));
+ end
+
+ if ~isdir(module) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_builder_gateway",module));
+ end
+
+ // Check the compiler
+
+ if ~haveacompiler() then
+ error(msprintf(gettext("%s: This module required a C compiler and it has not been found.\n"),"tbx_builder_gateway"));
+ end
+
+
+ mprintf(gettext("Building gateway...\n"));
+ tbx_builder(pathconvert(module+"/sci_gateway/builder_gateway.sce",%F));
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_builder_gateway_lang.bin b/modules/modules_manager/macros/tbx_builder_gateway_lang.bin
new file mode 100755
index 000000000..2193ab11b
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_gateway_lang.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_builder_gateway_lang.sci b/modules/modules_manager/macros/tbx_builder_gateway_lang.sci
new file mode 100755
index 000000000..3d1574069
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_gateway_lang.sci
@@ -0,0 +1,73 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Run the builder_gateway_"+languages+".sce" scripts
+
+// Input arguments:
+//
+// 1. languages
+// Languages of the sources files ("c", "cpp", "fortran", ...)
+//
+// 2. path
+// Path to the sources of the gateway ; in a normal toolbox it should be
+// the directory containing the builder_gateway.sce script (which should
+// be the script calling this function). Default is current directory.
+
+function tbx_builder_gateway_lang(languages,path)
+
+ // Number of input arguments
+
+ rhs = argn(2);
+
+ if and(rhs <> [1 2]) then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"tbx_builder_gateway_lang",1,2));
+ end
+
+ // Input argument N°1
+ // → languages
+
+ if type(languages) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string array expected.\n"),"tbx_builder_gateway_lang",1));
+ end
+
+ // Input argument N°2
+ // → path
+
+ if rhs < 2 then
+ path = pwd();
+
+ else
+ if type(path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_builder_gateway_lang",2));
+ end
+
+ if size(path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_builder_gateway_lang",2));
+ end
+
+ if ~isdir(path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_builder_gateway_lang",path));
+ end
+ end
+
+ // Check path/languages
+
+ directories = pathconvert(path+"/"+languages,%F);
+
+ for i=1:size(directories,"*") do
+ if ~isdir(directories(i)) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_builder_gateway_lang",directories(i)));
+ end
+ end
+
+ // Exec builders files
+ tbx_builder(pathconvert(directories+"/builder_gateway_"+languages+".sce",%F));
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_builder_help.bin b/modules/modules_manager/macros/tbx_builder_help.bin
new file mode 100755
index 000000000..277cd961b
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_help.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_builder_help.sci b/modules/modules_manager/macros/tbx_builder_help.sci
new file mode 100755
index 000000000..42b4a8b59
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_help.sci
@@ -0,0 +1,41 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Run the modules+"/help/builder_help.sce" script if it exists
+// See devtools_run_builder
+
+function tbx_builder_help(module)
+
+ // Number of input arguments
+
+ if argn(2)<>1 then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"tbx_builder_help",1));
+ end
+
+ // Input argument N°1
+ // → module
+
+ if type(module) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_builder_help",1));
+ end
+
+ if size(module,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_builder_help",1));
+ end
+
+ if ~isdir(module) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_builder_help",module));
+ end
+
+
+ mprintf(gettext("Building help...\n"));
+ tbx_builder(pathconvert(module+"/help/builder_help.sce",%F));
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_builder_help_lang.bin b/modules/modules_manager/macros/tbx_builder_help_lang.bin
new file mode 100755
index 000000000..fc6aa3167
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_help_lang.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_builder_help_lang.sci b/modules/modules_manager/macros/tbx_builder_help_lang.sci
new file mode 100755
index 000000000..c2f4bed8a
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_help_lang.sci
@@ -0,0 +1,63 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Run the help_path+"/"+lang+"/build_help.sce" script if it exists
+
+function tbx_builder_help_lang(languages,path)
+
+ // Number of input arguments
+
+ rhs = argn(2);
+
+ if and(rhs <> [1 2]) then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"tbx_builder_help_lang",1,2));
+ end
+
+ // Input argument N°1
+ // → languages
+
+ if type(languages) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string array expected.\n"),"tbx_builder_help_lang",1));
+ end
+
+ // Input argument N°2
+ // → path
+
+ if rhs < 2 then
+ path = pwd();
+
+ else
+ if type(path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_builder_help_lang",2));
+ end
+
+ if size(path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_builder_help_lang",2));
+ end
+
+ if ~isdir(path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_builder_help_lang",path));
+ end
+ end
+
+ // Check path/languages
+
+ directories = pathconvert(path+"/"+languages,%F);
+
+ for i=1:size(directories,"*") do
+ if ~isdir(directories(i)) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_builder_help_lang",directories(i)));
+ end
+ end
+
+ // exec all build_help.sce
+ tbx_builder(pathconvert(directories+"/build_help.sce",%F));
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_builder_macros.bin b/modules/modules_manager/macros/tbx_builder_macros.bin
new file mode 100755
index 000000000..93112ecfc
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_macros.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_builder_macros.sci b/modules/modules_manager/macros/tbx_builder_macros.sci
new file mode 100755
index 000000000..658012bf5
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_macros.sci
@@ -0,0 +1,40 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Run the modules+"/macros/buildmacros.sce" script
+
+function tbx_builder_macros(module)
+
+
+ // Number of input arguments
+
+ if argn(2)<>1 then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"tbx_builder_macros",1));
+ end
+
+ // Input argument N°1
+ // → module
+
+ if type(module) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_builder_macros",1));
+ end
+
+ if size(module,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_builder_macros",1));
+ end
+
+ if ~isdir(module) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_builder_macros",module));
+ end
+
+ mprintf(gettext("Building macros...\n"));
+ tbx_builder(pathconvert(module+"/macros/buildmacros.sce",%F));
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_builder_src.bin b/modules/modules_manager/macros/tbx_builder_src.bin
new file mode 100755
index 000000000..5c2eefeb2
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_src.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_builder_src.sci b/modules/modules_manager/macros/tbx_builder_src.sci
new file mode 100755
index 000000000..f73772fc3
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_src.sci
@@ -0,0 +1,47 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Run the module+"/src/builder_src.sce" script if it exists
+
+function tbx_builder_src(module)
+
+ // Number of input arguments
+
+ if argn(2)<>1 then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"tbx_builder_src",1));
+ end
+
+ // Input argument N°1
+ // → module
+
+ if type(module) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_builder_src",1));
+ end
+
+ if size(module,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_builder_src",1));
+ end
+
+ if ~isdir(module) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_builder_src",module));
+ end
+
+ // Check the compiler
+
+ if ~haveacompiler() then
+ error(msprintf(gettext("%s: This module requires a C or Fortran compiler and it has not been found.\n"),"tbx_builder_src"));
+ end
+
+
+ mprintf(gettext("Building sources...\n"));
+ tbx_builder(pathconvert(module+"/src/builder_src.sce",%F));
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_builder_src_lang.bin b/modules/modules_manager/macros/tbx_builder_src_lang.bin
new file mode 100755
index 000000000..ca6ae9e0b
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_src_lang.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_builder_src_lang.sci b/modules/modules_manager/macros/tbx_builder_src_lang.sci
new file mode 100755
index 000000000..fbf07e0ac
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_builder_src_lang.sci
@@ -0,0 +1,63 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Run the src_path+"/src/"+lang+"builder_"+lang+".sce" script if it exists
+
+function tbx_builder_src_lang(languages,path)
+
+ // Number of input arguments
+
+ rhs = argn(2);
+
+ if and(rhs <> [1 2]) then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"tbx_builder_src_lang",1,2));
+ end
+
+ // Input argument N°1
+ // → languages
+
+ if type(languages) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string array expected.\n"),"tbx_builder_src_lang",1));
+ end
+
+ // Input argument N°2
+ // → path
+
+ if rhs < 2 then
+ path = pwd();
+
+ else
+ if type(path) <> 10 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"tbx_builder_src_lang",2));
+ end
+
+ if size(path,"*") <> 1 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),"tbx_builder_src_lang",2));
+ end
+
+ if ~isdir(path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_builder_src_lang",path));
+ end
+ end
+
+ // Check path/languages
+
+ directories = pathconvert(path+"/"+languages,%F);
+
+ for i=1:size(directories,"*") do
+ if ~isdir(directories(i)) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_builder_src_lang",directories(i)));
+ end
+ end
+
+ // Exec builders files
+ tbx_builder(pathconvert(directories+"/builder_"+languages+".sce",%F));
+
+endfunction
diff --git a/modules/modules_manager/macros/tbx_generate_pofile.bin b/modules/modules_manager/macros/tbx_generate_pofile.bin
new file mode 100755
index 000000000..1def3390e
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_generate_pofile.bin
Binary files differ
diff --git a/modules/modules_manager/macros/tbx_generate_pofile.sci b/modules/modules_manager/macros/tbx_generate_pofile.sci
new file mode 100755
index 000000000..4f16a790f
--- /dev/null
+++ b/modules/modules_manager/macros/tbx_generate_pofile.sci
@@ -0,0 +1,168 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Antoine ELIAS
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function ret=tbx_generate_pofile(tbx_name, tbx_path)
+
+ rhs = argn(2);
+
+ if ~or(rhs == [1,2]) then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d or %d expected.\n"),"tbx_generate_pofile", 1, 2));
+ end
+
+ if rhs == 1 then
+ tbx_path = pwd();
+ end
+
+ if type(tbx_name) <> 10 then
+ error(msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "tbx_generate_pofile", 1));
+ end
+
+ if type(tbx_path) <> 10 then
+ error(msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "tbx_generate_pofile", 1));
+ end
+
+ if ~isdir(tbx_path) then
+ error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"), "tbx_generate_pofile", tbx_path));
+ end
+
+ old = pwd();
+ cd(tbx_path);
+ if getos() == "Windows" then
+ XGETTEXT= WSCI + "\tools\gettext\xgettext";
+ else
+ XGETTEXT="xgettext";
+ end
+ XGETTEXT_OPTIONS=" --omit-header -k --keyword=dgettext:2 --keyword=xmlgettext:2 --keyword=_d:2 --language=python ";
+
+ EXTENSIONS=["c" "h" "cpp" "cxx" "hxx" "hpp" "java"];
+ EXTENSIONS_MACROS=["sci" "sce" "start" "quit"];
+ EXTENSIONS_XML=["xml" "xsl"];
+ TARGETDIR="locales";
+
+ mkdir(TARGETDIR);
+ srcFiles = getFilesList("src", EXTENSIONS);
+ srcFiles = [srcFiles ; getFilesList("sci_gateway", EXTENSIONS)];
+ srcFiles = [srcFiles ; getFilesList("macros", EXTENSIONS_MACROS)];
+ srcFiles = [srcFiles ; getFilesList("etc", EXTENSIONS_MACROS)];
+
+ //manage xml preferences files
+ xmlFiles = getFilesList("etc", EXTENSIONS_XML);
+
+ if size(xmlFiles, "*") > 0 then
+ xmlTmpFile = TMPDIR + "/tmpLoc.xml";
+ srcFiles = [srcFiles; xmlTmpFile];
+ xmlFake = mopen(xmlTmpFile, "w");
+ for i = 1:size(xmlFiles, "*")
+ content = mgetl(xmlFiles(i));
+ newLine = sedLoc(content, "/\""_d\(\s*(.*)\s*,\s*(.*)\s*\)\""/", "xmlgettext(""\1"", ""\2"")");// "_d(xxx,xxx)"
+ newLine = sedLoc(newLine, "/\""dgettext\(\s*(.*)\s*,\s*(.*)\s*\)\""/", "xmlgettext(""\1"", ""\2"")");
+ mputl(newLine, xmlFake);
+ end
+ mclose(xmlFake);
+ end
+
+ //parse all files
+ srcFiles = strcat(srcFiles, " ");
+ cmd = XGETTEXT + XGETTEXT_OPTIONS + " -d " + tbx_name + " " + srcFiles + " -p " + TARGETDIR + " -o " + "en_US.po.tmp";
+ host(cmd);
+
+ if exists("xmlTmpFile") then
+ deletefile(xmlTmpFile);
+ end
+
+ fi = fileinfo(TARGETDIR + "/en_US.po.tmp");
+ if fi == [] | fi(1) == 0 then
+ //nothing to extract
+ deletefile(TARGETDIR + "/en_US.po.tmp");
+ rmdir(TARGETDIR);
+ cd(old);
+ ret = [];
+ return;
+ end
+
+ //add header
+ header = ["msgid """"";
+ "msgstr """"";
+ """Content-Type: text/plain; charset=UTF-8\n""";
+ """Content-Transfer-Encoding: 8bit\n""";""];
+
+ poFile = mgetl(TARGETDIR + "/en_US.po.tmp");
+ poFile = [header ; poFile];
+ mputl(poFile, TARGETDIR + "/en_US.po");
+ deletefile(TARGETDIR + "/en_US.po.tmp");
+
+ cd(old);
+ ret = tbx_path + filesep() + TARGETDIR + filesep() + "en_US.po";
+endfunction
+
+function result = sedLoc(str, findExp, replaceExp)
+ result = str;
+ index = grep(result, findExp, "r");
+ while index <> []
+ idx = index(1);
+ [startPos, endPos, match, captured] = regexp(result(idx), findExp);
+
+ if captured <> [] then
+ //multiple matches on the same line, YOUHOU !
+ for i=1:size(captured, "r")
+ replace = replaceExp;
+ for j = 1:size(captured, "c")
+ replace = strsubst(replace, "\" + string(j), captured(i,j));
+ end
+
+ if size(replace, "*") > 1 & (startPos <> 1 | endPos <> length(result(idx))) then
+ //replace partial line by multiline expression
+ replace(1) = part(result(idx), 1:startPos) + " " + replace(1);
+ replace($) = replace($) + " " + part(result(idx), (endPos+1):length(result(idx)));
+
+ result = [result(1:(idx-1)); replace; result((idx+1):$)];
+ elseif size(replace, "*") > 1 then
+ //replace entire line by multiline expression
+ result = [result(1:(idx-1)); replace; result((idx+1):$)];
+ else
+ //replace partial line by 1-line expression
+ result(idx) = strsubst(result(idx), match(i), replace);
+ end
+ end
+ end
+
+ //update index with new "file"
+ index = grep(result, findExp, "r");
+ end
+endfunction
+
+function ret = getFilesList(folder, mask)
+ if ~isdir(folder) then
+ ret = [];
+ return;
+ end
+
+ old = pwd();
+ cd(folder)
+
+ ret = [];
+
+ files = ls();
+
+ for j = 1:size(files, "*")
+ if isdir(files(j)) then
+ ret = [ret ; getFilesList(files(j), mask)];
+ end
+ end
+
+ for i = 1:size(mask, "*")
+ srcFiles = findfiles(pwd(), "*." + mask(i));
+ if srcFiles <> [] then
+ ret = [ret ; pwd() + filesep() + srcFiles];
+ end
+ end
+
+ cd(old);
+endfunction
+