1 // Copyright (C) 2011 - DIGITEO
3 // This file is released under the 3-clause BSD license. See COPYING-BSD.
5 function xcos_skeletonlib = startModule()
7 mprintf("Start Xcos toolbox skeleton\n");
9 if isdef("xcos_toolbox_skeletonlib") then
10 warning("Xcos toolbox skeleton library is already loaded");
14 // check minimal version (xcosPal required)
15 // =============================================================================
16 if ~isdef('xcosPal') then
17 // and xcos features required
18 error(gettext('Scilab 5.3.2 or more is required.'));
20 // =============================================================================
21 // force to load some libraries (dependancies)
22 loadXcosLibs(); loadScicos();
23 // =============================================================================
24 etc_tlbx = get_absolute_file_path("xcos_toolbox_skeleton.start");
25 etc_tlbx = getshortpathname(etc_tlbx);
26 root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc\") );
28 // Load functions library
29 // =============================================================================
30 mprintf("\tLoad macros\n");
31 pathmacros = pathconvert( root_tlbx ) + "macros" + filesep();
32 xcos_skeletonlib = lib(pathmacros);
34 // Add blocks to the Xcos palette
35 // =============================================================================
36 mprintf("\tLoad palette\n");
37 exec(pathconvert(root_tlbx+"/macros/loader_pal.sce", %f));
39 // Load simulation functions
40 // =============================================================================
41 mprintf("\tLoad simulations functions\n");
42 verboseMode = ilib_verbose();
44 exec(pathconvert(root_tlbx+"/src/c/loader.sce", %f));
45 ilib_verbose(verboseMode);
48 // =============================================================================
49 mprintf("\tLoad gateways\n");
50 verboseMode = ilib_verbose();
52 exec(pathconvert(root_tlbx+"/sci_gateway/loader_gateway.sce", %f));
53 ilib_verbose(verboseMode);
55 // Append Modelica functionnals
56 // =============================================================================
57 global %MODELICA_USER_LIBS;
58 %MODELICA_USER_LIBS = [%MODELICA_USER_LIBS ; root_tlbx+"/macros"];
60 // Load and add help chapter
61 // =============================================================================
62 if or(getscilabmode() == ["NW";"STD"]) then
63 mprintf("\tLoad help\n");
64 path_addchapter = pathconvert(root_tlbx+"/jar");
65 if isdir(path_addchapter) then
66 add_help_chapter("Xcos toolbox skeleton", path_addchapter, %F);
71 // =============================================================================
72 if or(getscilabmode() == ["NW";"STD"]) then
73 mprintf("\tLoad demos\n");
74 pathdemos = pathconvert(root_tlbx+"/demos/xcos_toolbox_skeleton.dem.gateway.sce", %F, %T);
75 add_demo("Xcos toolbox skeleton", pathdemos);
80 if with_module('xcos') then
81 xcos_skeletonlib = startModule();
82 clear startModule; // remove startModule on stack