Xcos skeleton: 35/3535/11
Clément DAVID [Tue, 15 Mar 2011 14:01:12 +0000 (15:01 +0100)]
 * add a basic toolbox example
 * add tbx_build_blocks macros to build the blocks (h5 and images)

Change-Id: I6f6b32ee03d9fdc829e22081877b4b6a76cc6d4a

43 files changed:
SEP/SEP_53_tbx_build_block.odt [new file with mode: 0644]
scilab/contrib/Makefile.am
scilab/contrib/Makefile.in
scilab/contrib/toolbox_skeleton.iss [moved from scilab/contrib/toolbox_skeleton/toolbox_skeleton.iss with 53% similarity]
scilab/contrib/xcos_toolbox_skeleton/.gitignore [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/DESCRIPTION [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/DESCRIPTION-FUNCTIONS [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/builder.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/changelog.txt [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/demos/xcos_toolbox_skeleton.dem.gateway.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.quit [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.start [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/help/.gitignore [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/help/builder_help.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/help/cleaner_help.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/help/en_US/TBX_SUM_c.xml [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/help/en_US/build_help.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/help/en_US/tbx_sum.xml [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/help/fr_FR/build_help.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_c.gif [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/images/h5/.gitignore [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/images/svg/TBX_SUM_c.svg [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/license.txt [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/macros/.gitignore [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_c.sci [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/macros/buildmacros.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/macros/cleanmacros.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/sci_gateway/.gitignore [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/sci_gateway/builder_gateway.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/sci_gateway/c/builder_gateway_c.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/sci_gateway/c/sci_tbx_sum.c [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/sci_gateway/loader_gateway.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/src/builder_src.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/src/c/.gitignore [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/src/c/block_sum.c [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/src/c/builder_c.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/src/c/business.h [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/src/c/business_sum.c [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/src/cleaner_src.sce [new file with mode: 0644]
scilab/contrib/xcos_toolbox_skeleton/tests/unit_tests/tbx_sum.tst [new file with mode: 0644]
scilab/modules/modules_manager/help/en_US/tbx_build_blocks.xml [new file with mode: 0644]
scilab/modules/modules_manager/macros/tbx_build_blocks.sci [new file with mode: 0644]
scilab/tools/innosetup/files.iss

diff --git a/SEP/SEP_53_tbx_build_block.odt b/SEP/SEP_53_tbx_build_block.odt
new file mode 100644 (file)
index 0000000..05f0ad1
Binary files /dev/null and b/SEP/SEP_53_tbx_build_block.odt differ
index c9982cf..7f0ef95 100644 (file)
@@ -60,11 +60,49 @@ toolbox_skeleton/macros/scilab_sum.sci \
 toolbox_skeleton/macros/buildmacros.sce \
 toolbox_skeleton/macros/cleanmacros.sce \
 toolbox_skeleton/toolbox_skeleton_redist.iss \
-toolbox_skeleton/toolbox_skeleton.iss
+toolbox_skeleton/toolbox_skeleton.iss \
+xcos_toolbox_skeleton/builder.sce \
+xcos_toolbox_skeleton/changelog.txt \
+xcos_toolbox_skeleton/cleaner.sce \
+xcos_toolbox_skeleton/demos/xcos_toolbox_skeleton.dem.gateway.sce \
+xcos_toolbox_skeleton/DESCRIPTION \
+xcos_toolbox_skeleton/DESCRIPTION-FUNCTIONS \
+xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.quit \
+xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.start \
+xcos_toolbox_skeleton/.gitignore \
+xcos_toolbox_skeleton/help/builder_help.sce \
+xcos_toolbox_skeleton/help/cleaner_help.sce \
+xcos_toolbox_skeleton/help/en_US/build_help.sce \
+xcos_toolbox_skeleton/help/en_US/TBX_SUM_c.xml \
+xcos_toolbox_skeleton/help/en_US/tbx_sum.xml \
+xcos_toolbox_skeleton/help/fr_FR/build_help.sce \
+xcos_toolbox_skeleton/help/.gitignore \
+xcos_toolbox_skeleton/images/gif/TBX_SUM_c.gif \
+xcos_toolbox_skeleton/images/h5/.gitignore \
+xcos_toolbox_skeleton/images/svg/TBX_SUM_c.svg \
+xcos_toolbox_skeleton/license.txt \
+xcos_toolbox_skeleton/macros/buildmacros.sce \
+xcos_toolbox_skeleton/macros/cleanmacros.sce \
+xcos_toolbox_skeleton/macros/.gitignore \
+xcos_toolbox_skeleton/macros/TBX_SUM_c.sci \
+xcos_toolbox_skeleton/sci_gateway/builder_gateway.sce \
+xcos_toolbox_skeleton/sci_gateway/c/builder_gateway_c.sce \
+xcos_toolbox_skeleton/sci_gateway/c/sci_tbx_sum.c \
+xcos_toolbox_skeleton/sci_gateway/.gitignore \
+xcos_toolbox_skeleton/sci_gateway/loader_gateway.sce \
+xcos_toolbox_skeleton/src/builder_src.sce \
+xcos_toolbox_skeleton/src/c/block_sum.c \
+xcos_toolbox_skeleton/src/c/builder_c.sce \
+xcos_toolbox_skeleton/src/c/business.h \
+xcos_toolbox_skeleton/src/c/business_sum.c \
+xcos_toolbox_skeleton/src/c/.gitignore \
+xcos_toolbox_skeleton/src/cleaner_src.sce \
+xcos_toolbox_skeleton/tests/unit_tests/tbx_sum.tst
 
 install-data-local:
        $(mkinstalldirs) -m 755 $(DESTDIR)$(pkgdatadir)/contrib/; \
        $(mkinstalldirs) -m 755 $(DESTDIR)$(pkgdatadir)/contrib/toolbox_skeleton; \
+       $(mkinstalldirs) -m 755 $(DESTDIR)$(pkgdatadir)/contrib/xcos_toolbox_skeleton; \
        for file in $(SKELETON_FILES) ; do \
                filePath=`dirname $(DESTDIR)$(pkgdatadir)/contrib/$$file`; \
                echo "$(mkinstalldirs) -m 755 $$filePath/"; \
index 330ac0e..26cee93 100644 (file)
@@ -373,7 +373,44 @@ toolbox_skeleton/macros/scilab_sum.sci \
 toolbox_skeleton/macros/buildmacros.sce \
 toolbox_skeleton/macros/cleanmacros.sce \
 toolbox_skeleton/toolbox_skeleton_redist.iss \
-toolbox_skeleton/toolbox_skeleton.iss
+toolbox_skeleton/toolbox_skeleton.iss \
+xcos_toolbox_skeleton/builder.sce \
+xcos_toolbox_skeleton/changelog.txt \
+xcos_toolbox_skeleton/cleaner.sce \
+xcos_toolbox_skeleton/demos/xcos_toolbox_skeleton.dem.gateway.sce \
+xcos_toolbox_skeleton/DESCRIPTION \
+xcos_toolbox_skeleton/DESCRIPTION-FUNCTIONS \
+xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.quit \
+xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.start \
+xcos_toolbox_skeleton/.gitignore \
+xcos_toolbox_skeleton/help/builder_help.sce \
+xcos_toolbox_skeleton/help/cleaner_help.sce \
+xcos_toolbox_skeleton/help/en_US/build_help.sce \
+xcos_toolbox_skeleton/help/en_US/TBX_SUM_c.xml \
+xcos_toolbox_skeleton/help/en_US/tbx_sum.xml \
+xcos_toolbox_skeleton/help/fr_FR/build_help.sce \
+xcos_toolbox_skeleton/help/.gitignore \
+xcos_toolbox_skeleton/images/gif/TBX_SUM_c.gif \
+xcos_toolbox_skeleton/images/h5/.gitignore \
+xcos_toolbox_skeleton/images/svg/TBX_SUM_c.svg \
+xcos_toolbox_skeleton/license.txt \
+xcos_toolbox_skeleton/macros/buildmacros.sce \
+xcos_toolbox_skeleton/macros/cleanmacros.sce \
+xcos_toolbox_skeleton/macros/.gitignore \
+xcos_toolbox_skeleton/macros/TBX_SUM_c.sci \
+xcos_toolbox_skeleton/sci_gateway/builder_gateway.sce \
+xcos_toolbox_skeleton/sci_gateway/c/builder_gateway_c.sce \
+xcos_toolbox_skeleton/sci_gateway/c/sci_tbx_sum.c \
+xcos_toolbox_skeleton/sci_gateway/.gitignore \
+xcos_toolbox_skeleton/sci_gateway/loader_gateway.sce \
+xcos_toolbox_skeleton/src/builder_src.sce \
+xcos_toolbox_skeleton/src/c/block_sum.c \
+xcos_toolbox_skeleton/src/c/builder_c.sce \
+xcos_toolbox_skeleton/src/c/business.h \
+xcos_toolbox_skeleton/src/c/business_sum.c \
+xcos_toolbox_skeleton/src/c/.gitignore \
+xcos_toolbox_skeleton/src/cleaner_src.sce \
+xcos_toolbox_skeleton/tests/unit_tests/tbx_sum.tst
 
 all: all-am
 
@@ -564,6 +601,7 @@ uninstall-am:
 install-data-local:
        $(mkinstalldirs) -m 755 $(DESTDIR)$(pkgdatadir)/contrib/; \
        $(mkinstalldirs) -m 755 $(DESTDIR)$(pkgdatadir)/contrib/toolbox_skeleton; \
+       $(mkinstalldirs) -m 755 $(DESTDIR)$(pkgdatadir)/contrib/xcos_toolbox_skeleton; \
        for file in $(SKELETON_FILES) ; do \
                filePath=`dirname $(DESTDIR)$(pkgdatadir)/contrib/$$file`; \
                echo "$(mkinstalldirs) -m 755 $$filePath/"; \
similarity index 53%
rename from scilab/contrib/toolbox_skeleton/toolbox_skeleton.iss
rename to scilab/contrib/toolbox_skeleton.iss
index 6066a21..ce77df5 100644 (file)
@@ -50,3 +50,33 @@ Source: contrib\{#TOOLBOX_SKELETON}\src\fortran\builder_fortran.sce; DestDir: {a
 Source: contrib\{#TOOLBOX_SKELETON}\src\fortran\fsum.f; DestDir: {app}\contrib\{#TOOLBOX_SKELETON}\src\fortran; Components: {#COMPN_TOOLBOX_SKELETON}
 Source: contrib\{#TOOLBOX_SKELETON}\tests\*.*; DestDir: {app}\contrib\{#TOOLBOX_SKELETON}\tests; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
 ;--------------------------------------------------------------------------------------------------------------
+#define XCOS_TOOLBOX_SKELETON "xcos_toolbox_skeleton"
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\DESCRIPTION; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\DESCRIPTION-FUNCTIONS; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\license.txt; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\builder.sce; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\changelog.txt; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\demos\{#XCOS_TOOLBOX_SKELETON}.dem.gateway.sce; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\demos; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\etc\{#XCOS_TOOLBOX_SKELETON}.quit; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\etc; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\etc\{#XCOS_TOOLBOX_SKELETON}.start; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\etc; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\help\builder_help.sce; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\help; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\help\en_US\tbx_sum.xml; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\help\en_US; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\help\en_US\build_help.sce; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\help\en_US; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\help\fr_FR\build_help.sce; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\help\fr_FR; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\images\gif\TBX_SUM_c.gif; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\images\gif; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\images\svg\TBX_SUM_c.svg; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\images\svg; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\macros\TBX_SUM_c.sci; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\macros; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\macros\buildmacros.sce; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\macros; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\macros\cleanmacros.sce; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\macros; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\sci_gateway\builder_gateway.sce; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\sci_gateway; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\sci_gateway\c\builder_gateway_c.sce; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\sci_gateway\c; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\sci_gateway\c\sci_tbx_sum.c; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\sci_gateway\c; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\sci_gateway\loader_gateway.sce; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\sci_gateway; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\src\builder_src.sce; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\src; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\src\c\block_sum.c; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\src\c; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\src\c\builder_c.sce; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\src\c; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\src\c\business.h; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\src\c; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\src\c\business_sum.c; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\src\c; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\src\cleaner_src.sce; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\src; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+Source: contrib\{#XCOS_TOOLBOX_SKELETON}\tests\unit_tests\tbx_sum.tst; DestDir: {app}\contrib\{#XCOS_TOOLBOX_SKELETON}\tests\unit_test; Flags: recursesubdirs; Components: {#COMPN_TOOLBOX_SKELETON}
+;--------------------------------------------------------------------------------------------------------------
diff --git a/scilab/contrib/xcos_toolbox_skeleton/.gitignore b/scilab/contrib/xcos_toolbox_skeleton/.gitignore
new file mode 100644 (file)
index 0000000..507ecd7
--- /dev/null
@@ -0,0 +1,7 @@
+cleaner.sce
+loader.sce
+jar/
+*.dll
+*.lib
+*.def
+*.mak
diff --git a/scilab/contrib/xcos_toolbox_skeleton/DESCRIPTION b/scilab/contrib/xcos_toolbox_skeleton/DESCRIPTION
new file mode 100644 (file)
index 0000000..99e45b4
--- /dev/null
@@ -0,0 +1,33 @@
+Toolbox: xcos_toolbox_skeleton
+
+Title: Xcos toolbox skeleton
+
+Summary: Add some blocks to a palette
+
+Version: 1.0
+
+Author: Clément DAVID <clement.david@scilab.org>
+
+Maintainer: Clément DAVID <clement.david@scilab.org>
+
+Category: Xcos
+
+Entity: Digiteo
+
+WebSite: http://www.scilab.org
+
+License: CeCILL
+
+ScilabVersion: >= 5.3
+
+Depends: 
+
+Date: 2011-03-15
+
+Description: Example for an Xcos toolbox
+ exec builder.sce
+ exec loader.sce
+ help xcos_toolbox_skeleton 
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/DESCRIPTION-FUNCTIONS b/scilab/contrib/xcos_toolbox_skeleton/DESCRIPTION-FUNCTIONS
new file mode 100644 (file)
index 0000000..5ca2fc7
--- /dev/null
@@ -0,0 +1,3 @@
+TBX_SUM_c - block which perform a basic sum of the inputs
+tbx_sum - Scilab native function which perform the same operation as TBX_SUM.
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/builder.sce b/scilab/contrib/xcos_toolbox_skeleton/builder.sce
new file mode 100644 (file)
index 0000000..22e76af
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright (C) 2008 - INRIA
+// Copyright (C) 2009-2010 - DIGITEO
+
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+mode(-1);
+lines(0);
+
+TOOLBOX_NAME  = "xcos_toolbox_skeleton";
+TOOLBOX_TITLE = "Xcos toolbox skeleton";
+toolbox_dir   = get_absolute_file_path("builder.sce");
+
+// Check Scilab's version
+// =============================================================================
+
+try
+    v = getversion("scilab");
+catch
+    error(gettext("Scilab 5.3 or more is required."));
+end
+
+if v(2) < 3 then
+    // new API in scilab 5.3
+    error(gettext('Scilab 5.3 or more is required.'));
+end
+clear v;
+
+// Check modules_manager module availability
+// =============================================================================
+
+if ~isdef('tbx_build_loader') then
+  error(msprintf(gettext('%s module not installed."), 'modules_manager'));
+end
+
+// Action
+// =============================================================================
+
+function perform()
+    tbx_builder_macros(toolbox_dir);
+    tbx_builder_src(toolbox_dir);
+    tbx_builder_gateway(toolbox_dir);
+    tbx_builder_help(toolbox_dir);
+    tbx_build_loader(TOOLBOX_NAME, toolbox_dir);
+    tbx_build_cleaner(TOOLBOX_NAME, toolbox_dir);
+endfunction
+perform();
+clear perform;
+
+// Clean variables
+// =============================================================================
+clear toolbox_dir TOOLBOX_NAME TOOLBOX_TITLE;
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/changelog.txt b/scilab/contrib/xcos_toolbox_skeleton/changelog.txt
new file mode 100644 (file)
index 0000000..e9a9d9f
--- /dev/null
@@ -0,0 +1,6 @@
+changelog of the Xcos toolbox skeleton
+
+xcos_toolbox_skeleton (1.0)
+    * Default implementation
+ -- Clément DAVID <clement.david@scilab.org> Tue, 15 Mar 2011 13:34:06 +0100
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/demos/xcos_toolbox_skeleton.dem.gateway.sce b/scilab/contrib/xcos_toolbox_skeleton/demos/xcos_toolbox_skeleton.dem.gateway.sce
new file mode 100644 (file)
index 0000000..98cabbe
--- /dev/null
@@ -0,0 +1,9 @@
+// Copyright (C) 2010 - DIGITEO - Clément DAVID
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+demopath = get_absolute_file_path("xcos_toolbox_skeleton.dem.gateway.sce");
+
+subdemolist = [];
+
+subdemolist(:,2) = demopath + subdemolist(:,2);
diff --git a/scilab/contrib/xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.quit b/scilab/contrib/xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.quit
new file mode 100644 (file)
index 0000000..4e3b3ef
--- /dev/null
@@ -0,0 +1 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
diff --git a/scilab/contrib/xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.start b/scilab/contrib/xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.start
new file mode 100644 (file)
index 0000000..bc3e437
--- /dev/null
@@ -0,0 +1,82 @@
+// Copyright (C) 2011 - DIGITEO
+
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+mprintf("Start Xcos toolbox skeleton\n");
+
+if isdef("xcos_toolbox_skeletonlib") then
+       warning("Xcos toolbox skeleton library is already loaded");
+       return;
+end
+
+etc_tlbx  = get_absolute_file_path("xcos_toolbox_skeleton.start");
+etc_tlbx  = getshortpathname(etc_tlbx);
+root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc\") );
+
+// Load functions library
+// =============================================================================
+mprintf("\tLoad macros\n");
+pathmacros = pathconvert( root_tlbx ) + "macros" + filesep();
+toolbox_skeletonlib = lib(pathmacros);
+clear pathmacros;
+
+// Add blocks to the Xcos palette
+// =============================================================================
+mprintf("\tLoad palette\n");
+pal = xcosPal("Xcos toolbox blocks");
+
+h5Files = gsort(ls(root_tlbx + "/images/h5/*.h5"));
+gifFiles = gsort(ls(root_tlbx + "/images/gif/*.gif"));
+svgFiles = gsort(ls(root_tlbx + "/images/svg/*.svg"));
+
+for i=1:size(h5Files, '*')
+    pal = xcosPalAddBlock(pal, h5Files(i), gifFiles(i), svgFiles(i));
+end
+if ~xcosPalAdd(pal) then
+    error(msprintf(gettext("%s: Unable to export %s.\n"),"xcos_toolbox_skeleton.start","pal")));
+end
+
+clear pal h5Files gifFiles svgFiles
+
+// Load simulation functions
+// =============================================================================
+mprintf("\tLoad simulations functions\n");
+verboseMode = ilib_verbose();
+ilib_verbose(0);
+exec(pathconvert(root_tlbx+"/src/c/loader.sce",%f));
+ilib_verbose(verboseMode);
+clear verboseMode;
+
+// load gateways
+// =============================================================================
+mprintf("\tLoad gateways\n");
+verboseMode = ilib_verbose();
+ilib_verbose(0);
+exec(pathconvert(root_tlbx+"/sci_gateway/loader_gateway.sce",%f));
+ilib_verbose(verboseMode);
+clear verboseMode;
+
+// Load and add help chapter
+// =============================================================================
+if or(getscilabmode() == ["NW";"STD"]) then
+       mprintf("\tLoad help\n");
+       path_addchapter = pathconvert(root_tlbx+"/jar");
+       if ( isdir(path_addchapter) <> [] ) then
+               add_help_chapter("Xcos toolbox skeleton", path_addchapter, %F);
+               clear add_help_chapter;
+       end
+       clear path_addchapter;
+end
+
+// Load demos
+// =============================================================================
+if or(getscilabmode() == ["NW";"STD"]) then
+       mprintf("\tLoad demos\n");
+       pathdemos = pathconvert(root_tlbx+"/demos/xcos_toolbox_skeleton.dem.gateway.sce",%F,%T);
+       add_demo("Xcos toolbox skeleton",pathdemos);
+       clear pathdemos add_demo;
+end
+
+clear root_tlbx;
+clear etc_tlbx;
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/help/.gitignore b/scilab/contrib/xcos_toolbox_skeleton/help/.gitignore
new file mode 100644 (file)
index 0000000..1eca475
--- /dev/null
@@ -0,0 +1,2 @@
+master_help.xml
+scilab_*_help
diff --git a/scilab/contrib/xcos_toolbox_skeleton/help/builder_help.sce b/scilab/contrib/xcos_toolbox_skeleton/help/builder_help.sce
new file mode 100644 (file)
index 0000000..91f6987
--- /dev/null
@@ -0,0 +1,4 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+tbx_builder_help_lang(["en_US"], ..
+                      get_absolute_file_path("builder_help.sce"));
diff --git a/scilab/contrib/xcos_toolbox_skeleton/help/cleaner_help.sce b/scilab/contrib/xcos_toolbox_skeleton/help/cleaner_help.sce
new file mode 100644 (file)
index 0000000..5478a05
--- /dev/null
@@ -0,0 +1,21 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+path = get_absolute_file_path("cleaner_help.sce");
+langdirs = dir(path);
+langdirs = langdirs.name(langdirs.isdir);
+
+masterfiles = ls(path + "/" + langdirs + "/master_help.xml");
+for i = 1:size(masterfiles,'*')
+  mdelete(masterfiles(i));
+end
+
+helpdirs = ls(path + "/" + langdirs + "/scilab_*_help");
+for i = 1:size(helpdirs,'*')
+  rmdir(helpdirs(i), 's');
+end
+
+jarhelpfiles = ls(path + "/../jar/scilab_*_help.jar");
+for i = 1:size(jarhelpfiles,'*')
+  mdelete(jarhelpfiles(i));
+end
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/help/en_US/TBX_SUM_c.xml b/scilab/contrib/xcos_toolbox_skeleton/help/en_US/TBX_SUM_c.xml
new file mode 100644 (file)
index 0000000..c6973c7
--- /dev/null
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="TBX_SUM_c">
+  <refnamediv>
+    <refname>TBX_SUM_c</refname>
+    <refpurpose>Simple sum with 2 inputs and 1 output.</refpurpose>
+  </refnamediv>
+  <refsection>
+    <title>Block Screenshot</title>
+    <para>
+      <inlinemediaobject>
+        <imageobject>
+          <imagedata align="center" fileref="../../images/gif/TBX_SUM_c.gif" valign="middle"/>
+        </imageobject>
+      </inlinemediaobject>
+    </para>
+  </refsection>
+  <refsection id="Contents_TBX_SUM_c">
+    <title>Contents</title>
+    <itemizedlist>
+      <listitem>
+        <para>
+          <link linkend="TBX_SUM_c">TBX_SUM_c block</link>
+        </para>
+      </listitem>
+      <listitem>
+        <itemizedlist>
+          <listitem>
+            <para>
+              <xref linkend="Description_TBX_SUM_c">Description</xref>
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              <xref linkend="Interfacingfunction_TBX_SUM_c">Interfacing function</xref>
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              <xref linkend="Computationalfunction_TBX_SUM_c">Computational function</xref>
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              <xref linkend="SeeAlso_TBX_SUM_c">See also</xref>
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              <xref linkend="Authors_TBX_SUM_c">Authors</xref>
+            </para>
+          </listitem>
+        </itemizedlist>
+      </listitem>
+    </itemizedlist>
+  </refsection>
+  <refsection id="Description_TBX_SUM_c">
+    <title>Description</title>
+    <para>Perform the sum of the two inputs.</para>
+  </refsection>
+  <refsection id="Interfacingfunction_TBX_SUM_c">
+    <title>Interfacing function</title>
+    <itemizedlist>
+      <listitem>
+        <para>macros/TBX_SUM_c.sci</para>
+      </listitem>
+    </itemizedlist>
+  </refsection>
+  <refsection id="Computationalfunction_TBX_SUM_c">
+    <title>Computational function</title>
+    <itemizedlist>
+      <listitem>
+        <para>src/c/block_sum.c</para>
+      </listitem>
+    </itemizedlist>
+  </refsection>
+  <refsection id="SeeAlso_TBX_SUM_c">
+    <title>See Also</title>
+    <itemizedlist>
+      <listitem>
+        <para><link linkend="TBX_SUM_c">TBX_SUM_c</link> : corresponding scilab functionnality</para>
+      </listitem>
+    </itemizedlist>
+  </refsection>
+  <refsection id="Authors_TBX_SUM_c">
+    <title>Authors</title>
+    <para>
+      <emphasis role="bold"/>
+    </para>
+    <itemizedlist>
+      <listitem>
+        <para><emphasis role="bold">Clément DAVID</emphasis> - DIGITEO</para>
+      </listitem>
+    </itemizedlist>
+  </refsection>
+</refentry>
diff --git a/scilab/contrib/xcos_toolbox_skeleton/help/en_US/build_help.sce b/scilab/contrib/xcos_toolbox_skeleton/help/en_US/build_help.sce
new file mode 100644 (file)
index 0000000..7065316
--- /dev/null
@@ -0,0 +1,3 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+tbx_build_help(TOOLBOX_TITLE,get_absolute_file_path("build_help.sce"));
diff --git a/scilab/contrib/xcos_toolbox_skeleton/help/en_US/tbx_sum.xml b/scilab/contrib/xcos_toolbox_skeleton/help/en_US/tbx_sum.xml
new file mode 100644 (file)
index 0000000..3eb437a
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="tbx_sum">
+  <refnamediv>
+    <refname>tbx_sum</refname>
+    <refpurpose>Simple sum with 2 inputs and 1 output</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <title>Calling Sequence</title>
+    <synopsis>
+      out = tbx_sum(in1, in2);
+    </synopsis>
+  </refsynopsisdiv>
+  <refsection id="Module_tbx_sum">
+    <title>Module</title>
+    <itemizedlist>
+      <listitem>
+        <para>
+          <link linkend="tbx_sum">tbx_sum</link>
+        </para>
+      </listitem>
+    </itemizedlist>
+  </refsection>
+  <refsection id="Parameters_tbx_sum">
+    <title>Arguments</title>
+    <itemizedlist>
+      <listitem>
+        <para><emphasis role="bold">in1 : </emphasis> a double.</para>
+      </listitem>
+      <listitem>
+        <para><emphasis role="bold">in2 : </emphasis> a double.</para>
+      </listitem>
+      <listitem>
+        <para><emphasis role="bold">out : </emphasis> a double with value:</para>
+        <para>
+          <latex>out=in1+in2</latex>
+        </para>
+      </listitem>
+    </itemizedlist>
+  </refsection>
+  <refsection id="SeeAlso_tbx_sum">
+    <title>See Also</title>
+    <itemizedlist>
+      <listitem>
+        <para><link linkend="TBX_SUM_c">TBX_SUM_c</link> : corresponding <link type="scilab" linkend="scilab.help/xcos">Xcos</link> block.</para>
+      </listitem>
+    </itemizedlist>
+  </refsection>
+</refentry>
diff --git a/scilab/contrib/xcos_toolbox_skeleton/help/fr_FR/build_help.sce b/scilab/contrib/xcos_toolbox_skeleton/help/fr_FR/build_help.sce
new file mode 100644 (file)
index 0000000..7065316
--- /dev/null
@@ -0,0 +1,3 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+tbx_build_help(TOOLBOX_TITLE,get_absolute_file_path("build_help.sce"));
diff --git a/scilab/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_c.gif b/scilab/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_c.gif
new file mode 100644 (file)
index 0000000..8c585a2
Binary files /dev/null and b/scilab/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_c.gif differ
diff --git a/scilab/contrib/xcos_toolbox_skeleton/images/h5/.gitignore b/scilab/contrib/xcos_toolbox_skeleton/images/h5/.gitignore
new file mode 100644 (file)
index 0000000..dfc8249
--- /dev/null
@@ -0,0 +1 @@
+*.h5
diff --git a/scilab/contrib/xcos_toolbox_skeleton/images/svg/TBX_SUM_c.svg b/scilab/contrib/xcos_toolbox_skeleton/images/svg/TBX_SUM_c.svg
new file mode 100644 (file)
index 0000000..3e64368
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="40px" height="40px">
+    <text x="1.5" y="20" font-size="8">TBX_SUM</text>
+</svg>
diff --git a/scilab/contrib/xcos_toolbox_skeleton/license.txt b/scilab/contrib/xcos_toolbox_skeleton/license.txt
new file mode 100644 (file)
index 0000000..c380971
--- /dev/null
@@ -0,0 +1,9 @@
+Licence of the Xcos_Toolbox_skeleton
+
+Please update this file with the license terms (Copy and paste the license agreement).
+Note that all the files of the toolbox_skeleton are released into the public domain.
+Therefor, there is no limitation on the use of these files.
+
+Please note that Scilab is released under the terms of the CeCILL license :
+http://www.cecill.info/index.en.html
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/macros/.gitignore b/scilab/contrib/xcos_toolbox_skeleton/macros/.gitignore
new file mode 100644 (file)
index 0000000..9492b52
--- /dev/null
@@ -0,0 +1,3 @@
+*.bin
+lib
+names
diff --git a/scilab/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_c.sci b/scilab/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_c.sci
new file mode 100644 (file)
index 0000000..4816244
--- /dev/null
@@ -0,0 +1,41 @@
+//
+// This file is part of the Xcos skeleton toolbox
+//
+// Copyright (C) 2011 - DIGITEO - Clément DAVID <clement.david@scilab.org>
+// see license.txt for more licensing informations
+
+function [x,y,typ]=TBX_SUM_c(job,arg1,arg2)
+  x=[];y=[];typ=[]
+  select job
+   case 'plot' then
+    standard_draw(arg1)
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1;
+    // no parameters yet
+   case 'define' then
+    model=scicos_model()
+    model.sim=list('block_sum',4)
+    // two inputs with a single "double" element
+    model.in=[1;1]
+    model.intyp=[1;1]
+    // one output with a single "double" element
+    model.out=1
+    model.outtyp=1
+    
+    model.blocktype='c'
+    model.dep_ut=[%f %f]
+
+    exprs=string([]);
+    gr_i=['txt=[''TBX_SUM_c''];';
+          'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'')']
+
+    x=standard_define([2 2],model,exprs,gr_i)
+  end
+endfunction
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/macros/buildmacros.sce b/scilab/contrib/xcos_toolbox_skeleton/macros/buildmacros.sce
new file mode 100644 (file)
index 0000000..8d293dd
--- /dev/null
@@ -0,0 +1,7 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+tbx_build_macros(TOOLBOX_NAME,get_absolute_file_path("buildmacros.sce"));
+tbx_build_blocks(toolbox_dir, ["TBX_SUM_c"]);
+
+clear tbx_build_macros tbx_build_blocks;
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/macros/cleanmacros.sce b/scilab/contrib/xcos_toolbox_skeleton/macros/cleanmacros.sce
new file mode 100644 (file)
index 0000000..7ccf297
--- /dev/null
@@ -0,0 +1,24 @@
+// ====================================================================
+// Allan CORNET
+// DIGITEO 2009-2011
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+// ====================================================================
+function perform()
+    libpath = get_absolute_file_path('cleanmacros.sce');
+
+    binfiles = ls(libpath+'/*.bin');
+    for i = 1:size(binfiles,'*')
+      mdelete(binfiles(i));
+    end
+
+    mdelete(libpath+'/names');
+    mdelete(libpath+'/lib');
+
+    blockfiles = ls(libpath+'../images/h5/*.h5');
+    for i = 1:size(blockfiles,'*')
+      mdelete(blockfiles(i));
+    end
+endfunction
+perform();
+clear perform;
+// ====================================================================
diff --git a/scilab/contrib/xcos_toolbox_skeleton/sci_gateway/.gitignore b/scilab/contrib/xcos_toolbox_skeleton/sci_gateway/.gitignore
new file mode 100644 (file)
index 0000000..97cfea4
--- /dev/null
@@ -0,0 +1,2 @@
+libxcos_toolbox_skeleton*.*
+cleaner_gateway.sce
diff --git a/scilab/contrib/xcos_toolbox_skeleton/sci_gateway/builder_gateway.sce b/scilab/contrib/xcos_toolbox_skeleton/sci_gateway/builder_gateway.sce
new file mode 100644 (file)
index 0000000..7e6586c
--- /dev/null
@@ -0,0 +1,12 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+sci_gateway_dir = get_absolute_file_path("builder_gateway.sce");
+languages       = ["c"];
+
+tbx_builder_gateway_lang(languages,sci_gateway_dir);
+tbx_build_gateway_loader(languages,sci_gateway_dir);
+tbx_build_gateway_clean(languages,sci_gateway_dir);
+
+clear tbx_builder_gateway_lang tbx_build_gateway_loader;
+clear sci_gateway_dir languages;
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/sci_gateway/c/builder_gateway_c.sce b/scilab/contrib/xcos_toolbox_skeleton/sci_gateway/c/builder_gateway_c.sce
new file mode 100644 (file)
index 0000000..0e22147
--- /dev/null
@@ -0,0 +1,19 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+if getos() == "Windows" then
+    // to manage long pathname
+    includes_src_c = "-I""" + get_absolute_file_path("builder_gateway_c.sce") + "../../src/c""";
+else
+    includes_src_c = "-I" + get_absolute_file_path("builder_gateway_c.sce") + "../../src/c";
+end
+
+tbx_build_gateway("xcos_toolbox_skeleton_c",                        ..
+                  ["tbx_sum", "sci_tbx_sum"],                       ..
+                  ["sci_tbx_sum.c"],                                ..
+                  get_absolute_file_path("builder_gateway_c.sce"),  ..
+                  ["../../src/c/libxcos_tbx_skel"],                 ..
+                  "",                                               ..
+                  includes_src_c);
+
+clear tbx_build_gateway;
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/sci_gateway/c/sci_tbx_sum.c b/scilab/contrib/xcos_toolbox_skeleton/sci_gateway/c/sci_tbx_sum.c
new file mode 100644 (file)
index 0000000..bb914fa
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2011-2011 - DIGITEO - 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-en.txt
+ *
+ */
+
+#include "business.h"
+
+#include "stack-c.h"
+#include "api_scilab.h"
+#include "Scierror.h"
+
+int sci_tbx_sum(char *fname) {
+  SciErr sciErr;
+  
+  int *piAddressVarOne = NULL;
+  double dVarOne = 0.0;
+  
+  int *piAddressVarTwo = NULL;
+  double dVarTwo = 0.0;
+  
+  double dOut = 0.0;
+  
+  /* check that we have only 2 input arguments */
+  /* check that we have only 1 output argument */
+  CheckRhs(2,2);
+  CheckLhs(1,1);
+  
+    /* get Address of inputs */
+  sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
+  if(sciErr.iErr)
+  {
+    printError(&sciErr, 0);
+    return 0;
+  }
+  
+  sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo);
+  if(sciErr.iErr)
+  {
+    printError(&sciErr, 0);
+    return 0;
+  }
+  
+  /* check input type */
+  if ( !isDoubleType(pvApiCtx, piAddressVarOne) )
+  {
+    Scierror(999,"%s: Wrong type for input argument #%d: A scalar expected.\n", fname, 1);
+    return 0;
+  }
+  
+  if ( !isDoubleType(pvApiCtx, piAddressVarTwo) )
+  {
+    Scierror(999,"%s: Wrong type for input argument #%d: A scalar expected.\n", fname, 2);
+    return 0;
+  }
+
+  if ( getScalarDouble(pvApiCtx, piAddressVarOne, &dVarOne) )
+  {
+    Scierror(999,"%s: Wrong size for input argument #%d: A scalar expected.\n", fname, 1);
+    return 0;
+  }
+
+  if ( getScalarDouble(pvApiCtx, piAddressVarTwo, &dVarTwo) )
+  {
+    Scierror(999,"%s: Wrong size for input argument #%d: A scalar expected.\n", fname, 2);
+    return 0;
+  }
+  
+  /* call c business function */  
+  dOut = business_sum(dVarOne, dVarTwo);
+  
+  /* create result on stack */
+  createScalarDouble(pvApiCtx, Rhs + 1, dOut);
+  LhsVar(1) = Rhs + 1; 
+}
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/sci_gateway/loader_gateway.sce b/scilab/contrib/xcos_toolbox_skeleton/sci_gateway/loader_gateway.sce
new file mode 100644 (file)
index 0000000..e3e7807
--- /dev/null
@@ -0,0 +1,24 @@
+// 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();
+
+chdir(sci_gateway_dir);
+if ( isdir("c") ) then
+    chdir("c");
+    exec("loader.sce");
+end
+
+chdir(current_dir);
+clear sci_gateway_dir current_dir v;
diff --git a/scilab/contrib/xcos_toolbox_skeleton/src/builder_src.sce b/scilab/contrib/xcos_toolbox_skeleton/src/builder_src.sce
new file mode 100644 (file)
index 0000000..21bed17
--- /dev/null
@@ -0,0 +1,5 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+tbx_builder_src_lang("c",get_absolute_file_path("builder_src.sce"));
+clear tbx_builder_src_lang;
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/src/c/.gitignore b/scilab/contrib/xcos_toolbox_skeleton/src/c/.gitignore
new file mode 100644 (file)
index 0000000..140f8cf
--- /dev/null
@@ -0,0 +1 @@
+*.so
diff --git a/scilab/contrib/xcos_toolbox_skeleton/src/c/block_sum.c b/scilab/contrib/xcos_toolbox_skeleton/src/c/block_sum.c
new file mode 100644 (file)
index 0000000..06c629a
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2011-2011 - DIGITEO - 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-en.txt
+ *
+ */
+
+#include <business.h>
+#include <scicos_block4.h>
+
+void block_sum(scicos_block* block, scicos_flag flag) {
+    double* y;
+    double* u1;
+    double* u2;
+    
+    if (flag == OutputUpdate) {
+        // output
+        y = (double *) block->outptr[0];
+        
+        // input are indexed in order
+        u1 = (double *) block->inptr[0];
+        u2 = (double *) block->inptr[1];
+        
+        // call business layer
+        *y = business_sum(*u1, *u2);
+    }
+}
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/src/c/builder_c.sce b/scilab/contrib/xcos_toolbox_skeleton/src/c/builder_c.sce
new file mode 100644 (file)
index 0000000..5914ba4
--- /dev/null
@@ -0,0 +1,43 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+// This macro compiles the files
+
+function perform()
+    src_c_path = get_absolute_file_path("builder_c.sce");
+
+    CFLAGS = "-I" + src_c_path;
+    LDFLAGS = "";
+    if (getos()<>"Windows") then
+        if ~isdir(SCI+"/../../share") then
+            // Source version
+            CFLAGS = CFLAGS + " -I" + SCI + "/modules/scicos_blocks/includes" ;
+            CFLAGS = CFLAGS + " -I" + SCI + "/modules/scicos/includes" ;
+        else
+            // Release version
+            CFLAGS = CFLAGS + " -I" + SCI + "/../../include/scilab/scicos_blocks";
+            CFLAGS = CFLAGS + " -I" + SCI + "/../../include/scilab/scicos";
+        end
+    else
+        CFLAGS = CFLAGS + " -I" + SCI + "/modules/scicos_blocks/includes";
+        CFLAGS = CFLAGS + " -I" + SCI + "/modules/scicos/includes";
+
+        // Getting symbols
+        if findmsvccompiler() <> "unknown" & haveacompiler() then
+            LDFLAGS = LDFLAGS + " """ + SCI + "/bin/scicos.lib""";
+            LDFLAGS = LDFLAGS + " """ + SCI + "/bin/scicos_f.lib""";
+        end
+    end
+
+    tbx_build_src(["block_sum", "business_sum"],        ..
+                  ["block_sum.c", "business_sum.c"],    ..
+                  "c",                                  ..
+                  src_c_path,                           ..
+                  "",                                   ..
+                  LDFLAGS,                              ..
+                  CFLAGS,                               ..
+                  "",                                   ..
+                  "",                                   ..
+                  "xcos_tbx_skel");
+endfunction
+perform();
+clear perform;
diff --git a/scilab/contrib/xcos_toolbox_skeleton/src/c/business.h b/scilab/contrib/xcos_toolbox_skeleton/src/c/business.h
new file mode 100644 (file)
index 0000000..a12b4b2
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2011-2011 - DIGITEO - 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-en.txt
+ *
+ */
+
+/**
+ * @return in1 + in2
+ */
+double business_sum(double in, double in2);
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/src/c/business_sum.c b/scilab/contrib/xcos_toolbox_skeleton/src/c/business_sum.c
new file mode 100644 (file)
index 0000000..e01b721
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2011-2011 - DIGITEO - 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-en.txt
+ *
+ */
+
+double business_sum(double in, double in2) {
+    return in + in2;
+}
+
diff --git a/scilab/contrib/xcos_toolbox_skeleton/src/cleaner_src.sce b/scilab/contrib/xcos_toolbox_skeleton/src/cleaner_src.sce
new file mode 100644 (file)
index 0000000..05f5a70
--- /dev/null
@@ -0,0 +1,15 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+function perform()
+    src_dir = get_absolute_file_path("cleaner_src.sce");
+
+    for language = ["c","cpp","fortran"]
+           cleaner_file = src_dir + filesep() + language + filesep() + "cleaner.sce";
+           if isfile(cleaner_file) then
+                   exec(cleaner_file);
+                   mdelete(cleaner_file);
+           end
+    end
+endfunction
+perform();
+clear perform;
diff --git a/scilab/contrib/xcos_toolbox_skeleton/tests/unit_tests/tbx_sum.tst b/scilab/contrib/xcos_toolbox_skeleton/tests/unit_tests/tbx_sum.tst
new file mode 100644 (file)
index 0000000..0df708b
--- /dev/null
@@ -0,0 +1,10 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+//=================================
+// load xcos toolbox_skeleton
+if funptr('tbx_sum') == 0 then
+  root_tlbx_path = SCI+'\contrib\xcos_toolbox_skeleton\';
+  exec(root_tlbx_path + 'loader.sce',-1); 
+end
+
+if tbx_sum(3,5) <> 8 then pause,end
+
diff --git a/scilab/modules/modules_manager/help/en_US/tbx_build_blocks.xml b/scilab/modules/modules_manager/help/en_US/tbx_build_blocks.xml
new file mode 100644 (file)
index 0000000..4d7ead1
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) - DIGITEO 
+ * 
+ * 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-en.txt
+ *
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="tbx_build_blocks" xml:lang="en">
+  <refnamediv>
+    <refname>tbx_build_blocks</refname>
+    <refpurpose>Compile blocks (toolbox compilation process)</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <title>Calling Sequence</title>
+    <synopsis>
+         tbx_build_blocks(toolbox_name, block_names)
+    </synopsis>
+  </refsynopsisdiv>
+  <refsection>
+    <title>Arguments</title>
+    <variablelist>
+      <varlistentry>
+        <term>toolbox_name</term>
+        <listitem>
+          <para>Toolbox short name ; that is, the prefix of the .start file of the toolbox (which shall be in the etc subdirectory).</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>block_names</term>
+        <listitem>
+          <para>Block interface function list (in a string vector) ; all name should have a corresponding interface function macro (on the macros subdirectory).</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsection>
+  <refsection>
+    <title>Examples</title>
+    <programlisting role="example"><![CDATA[ 
+// Recommended usage
+tbx_build_blocks("toolbox_example", ["EXAMPLE_BLOCK"])
+ ]]></programlisting>
+  </refsection>
+  <refsection>
+    <title>Authors</title>
+    <simplelist type="vert">
+      <member>Clément DAVID</member>
+    </simplelist>
+  </refsection>
+</refentry>
diff --git a/scilab/modules/modules_manager/macros/tbx_build_blocks.sci b/scilab/modules/modules_manager/macros/tbx_build_blocks.sci
new file mode 100644 (file)
index 0000000..8bb0374
--- /dev/null
@@ -0,0 +1,81 @@
+// 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-en.txt
+
+function tbx_build_blocks(module, names)
+    // 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: %d expected.\n"),"tbx_build_blocks",2));
+    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
+
+    mprintf(gettext("Building blocks...\n"));
+
+    // load Xcos libraries when not already loaded.
+    if ~exists("scicos_diagram") then loadXcosLibs(); end
+
+    sciFiles = pathconvert(module + "/macros/") + names + ".sci";
+    h5Files = pathconvert(module + "/images/h5/") + names + ".h5";
+    gif_tlbx = pathconvert(module + "/images/gif");
+    gifFiles = pathconvert(module + "/images/gif/") + names + ".gif";
+    svg_tlbx = pathconvert(module + "/images/svg");
+    svgFiles = pathconvert(module + "/images/svg/") + names + ".svg";
+    handle = gcf();
+    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
+
+        block = scs_m;
+
+        // export a gif file if it doesn't exist
+        if ~isfile(gifFiles(i)) then
+            if ~generateBlockImage(block, gif_tlbx, names(i), handle, "gif", %t) then
+                error(msprintf(gettext("%s: Unable to export %s to %s.\n"),"tbx_build_blocks",names(i), gifFiles(i)));
+            end
+        end
+
+        // export an svg file if it doesn't exist
+        if ~isfile(svgFiles(i)) then
+            if ~generateBlockImage(block, svg_tlbx, names(i), handle, "svg", %f) then
+                error(msprintf(gettext("%s: Unable to export %s to %s.\n"),"tbx_build_blocks",names(i), svgFiles(i)));
+            end
+        end
+    end
+
+    delete(handle);
+endfunction
+
index 92abb8a..9910a6c 100644 (file)
@@ -18,7 +18,7 @@
 #include BinariesSourcePath + "\tools\innosetup\atlas.iss"
 #endif
 #include BinariesSourcePath + "\tools\tools.iss"
-#include BinariesSourcePath + "\contrib\toolbox_skeleton\toolbox_skeleton.iss"
+#include BinariesSourcePath + "\contrib\toolbox_skeleton.iss"
 #include BinariesSourcePath + "\modules\core\core.iss"
 #include BinariesSourcePath + "\modules\helptools\helptools.iss"
 #include BinariesSourcePath + "\modules\demo_tools\demo_tools.iss"