1 // ============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2010 - DIGITEO - Clement DAVID
4 // Copyright (C) 2012 - Scilab Enterprises - Clement DAVID
6 // This file is distributed under the same license as the Scilab package.
7 // ============================================================================
9 // <-- ENGLISH IMPOSED -->
12 // <-- Short Description -->
13 // Check that the simulation function should exists.
16 defaultlibs = ["Branching",
27 defaultlibs = defaultlibs + "lib";
28 notTested = ["SUPER_f", "DSUPER", .. // Specific blocks
29 "IN_f", "OUT_f", "INIMPL_f", "OUTIMPL_f", ..
30 "CLKIN_f", "CLKINV_f", "CLKOUT_f", "CLKOUTV_f", ..
32 "SPLIT_f", "CLKSPLIT_f", ..
33 "TEXT_f", "PAL_f", "DEBUG", "DEBUG_SCICOS", ..
34 "SIGNUM", "MAXMIN", "ABS_VALUE", .. // buggy blocks
35 "PENDULUM_ANIM", "BPLATFORM", "MBLOCK", ..
36 "TKSCALE", "BARXY", ..
37 "SLIDER_f", "WFILE_f", "func_block", "SOM_f", .. // Deprecated blocks
38 "MPBLOCK", "c_block", "fortran_block", .. // blocks with code generation
39 "CBLOCK", "CBLOCK4", "scifunc_block", "scifunc_block_m"];
41 invalidFunctions = unique(gsort(["csuper", "junk", ..
42 "clkfrom", "clkgoto", ..
43 "goto", "from", "gotomo", "frommo", ..
44 "limpsplit", "sampleclk", ..
45 "gototagvisibility", "clkgototagvisibility", "gototagvisibilitymo"]));
50 // Stubbing the x_mdialog method
51 // checking it's arguments size only
52 function [result]=x_mdialog(title, labelsv, labelsh, default_inputs_vector)
55 default_inputs_vector = labelsh;
56 result = x_dialog(labelsv, default_inputs_vector);
58 vSize = size(labelsv, "*");
59 hSize = size(labelsh, "*");
60 if size(default_inputs_vector) <> [vSize, hSize] then
61 mprintf("%s\nError: dialog wrong size.", cmd); pause, end;
62 result = default_inputs_vector;
64 mprintf("%s\nError: dialog wrong size.", cmd); pause, end;
67 // Stubbing the x_dialog method
68 // checking it's arguments size only
69 function [result]=x_dialog(labels, default_inputs_vector)
70 if(or(size(labels) <> size(default_inputs_vector))) then
71 mprintf("%s\nError: dialog wrong size.", cmd); pause, end;
72 result = default_inputs_vector;
75 // Stubbing the dialog method
77 function [result]=x_dialog(labels,default_inputs_vector)
78 result = default_inputs_vector;
81 // Stubbing the edit_curv method
82 function [xx, yy, ok, gc] = edit_curv(xx, yy, axis, args, gc)
84 if ~exists("gc", "l") then
87 gc = list(rect, axisdata);
91 // Stubbing global scicos flags
94 %scicos_context = struct();
96 // define a function to fix model size
97 function model = configure(model)
98 model.in = ones(model.in);
99 model.in2 = ones(model.in2);
100 model.intyp = ones(model.intyp);
102 model.out = ones(model.out);
103 model.out2 = ones(model.out2);
104 model.outtyp = ones(model.outtyp);
107 // If the following block simulation function does not exists then fail the
109 for i = 1:size(defaultlibs,"*")
110 [macros, path] = libraryinfo(defaultlibs(i));
111 macros=gsort(macros);
112 for j = 1:size(macros,"*")
113 interfunction = macros(j);
115 // Not tested blocks (Xcos customs)
116 if or(interfunction == notTested) then
120 // Check for signature
121 vars=macrovar(evstr(interfunction));
122 if or([size(vars(1)) <> [3 1] , size(vars(2)) <> [3 1]]) then
126 // New Scilab instance
127 cmd = "scs_m=" + interfunction + "(""define"", [], []);";
128 if execstr(cmd, "errcatch")<>0 then
129 mprintf("%s\n",cmd); pause, end
130 cmd = "scs_m=" + interfunction + "(""set"", scs_m, []);";
131 if execstr(cmd, "errcatch")<>0 then
132 mprintf("%s\n",cmd); pause, end
134 // calling the model2blk will locate the funptr are error on
135 if ~or(scs_m.model.sim == invalidFunctions) then
136 model2blk(configure(scs_m.model));
140 clear invalidFunctions cmd vars interfunction macros path defaultlibs;
141 clear scs_m i j alreadyran needcompile notTested;