2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2009 - DIGITEO - Allan CORNET
4 // Copyright (C) 2011 - DIGITEO - Clément DAVID
6 // Copyright (C) 2012 - 2016 - Scilab Enterprises
8 // This file is hereby licensed under the terms of the GNU GPL v2.0,
9 // pursuant to article 5.3.4 of the CeCILL v.2.1.
10 // This file was originally licensed under the terms of the CeCILL v2.1,
11 // and continues to be available under such terms.
12 // For more information, see the COPYING file which you should have received
13 // along with this program.
16 function loadXcosLibs()
17 // Extracted from initial_scicos_tables
18 scicos_pal_libs = ["Branching","Events","Misc","Sinks","Threshold","Linear","MatrixOp","NonLinear","Sources","Electrical","Hydraulics","PDE","IntegerOp"];
19 scicos_libs = ["scicos_scicos"];
21 // list of scicos libraries that we need at xcos launch
24 for theLib = scicos_pal_libs
25 if isfile("SCI/modules/scicos_blocks/macros/" + theLib + "/lib") then
26 load("SCI/modules/scicos_blocks/macros/" + theLib + "/lib");
27 listlibsname = [listlibsname, theLib];
31 for theLib = scicos_libs
32 if isfile("SCI/modules/scicos/macros/" + theLib + "/lib") then
33 load("SCI/modules/scicos/macros/" + theLib + "/lib");
34 listlibsname = [listlibsname, theLib];
39 listlibsname(listlibsname == "MatrixOp") = "Matrixop";
40 listlibsname(listlibsname == "NonLinear") = "Nonlinear";
41 listlibsname(listlibsname == "IntegerOp") = "Integerop";
43 if listlibsname <> [] then
44 resumedLibs = listlibsname + "lib";
46 resumedLibs = string([]);
49 // Compatibility interface functions
50 function [x,y,typ]=COMPAT_BLOCK(job,arg1,arg2)
51 // Throw an error on block access
53 if ~exists("arg1") then
54 arg1 = mlist(["Block", "gui"], "COMPAT_BLOCK");
56 error(msprintf(gettext("%s: the block ""%s"" is no more available, please update the diagram with a compatible one."), "loadXcosLibs", arg1.gui));
66 execstr(strcat(removed + "=COMPAT_BLOCK; "));
69 resumedBlocks = removed';
71 // Put all resumed symbols into the parent scope
72 // Take care: resume() will also return to the parent scope
73 execstr("[" + strcat([resumedLibs resumedBlocks], ", ") + "] = resume(" + strcat([resumedLibs resumedBlocks], ", ") + ");");