diff options
author | Shashank | 2017-05-29 12:40:26 +0530 |
---|---|---|
committer | Shashank | 2017-05-29 12:40:26 +0530 |
commit | 0345245e860375a32c9a437c4a9d9cae807134e9 (patch) | |
tree | ad51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /contrib/xcos_toolbox_skeleton | |
download | scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2 scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip |
CMSCOPE changed
Diffstat (limited to 'contrib/xcos_toolbox_skeleton')
58 files changed, 1192 insertions, 0 deletions
diff --git a/contrib/xcos_toolbox_skeleton/DESCRIPTION b/contrib/xcos_toolbox_skeleton/DESCRIPTION new file mode 100755 index 000000000..a41835dca --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/DESCRIPTION @@ -0,0 +1,33 @@ +Toolbox: xcos_toolbox_skeleton + +Title: Xcos toolbox skeleton + +Summary: Add some blocks to a palette + +Version: 1.1 + +Author: Clément DAVID <clement.david@scilab-enterprises.com> + +Maintainer: Clément DAVID <clement.david@scilab-enterprises.com> + +Category: Xcos + +Entity: Scilab Enterprises + +WebSite: http://www.scilab.org + +License: CeCILL + +ScilabVersion: >= 5.5 + +Depends: + +Date: 2014-01-15 + +Description: Example for an Xcos toolbox + + exec builder.sce + exec loader.sce + + help xcos_toolbox_skeleton + diff --git a/contrib/xcos_toolbox_skeleton/DESCRIPTION-FUNCTIONS b/contrib/xcos_toolbox_skeleton/DESCRIPTION-FUNCTIONS new file mode 100755 index 000000000..df855fb44 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/DESCRIPTION-FUNCTIONS @@ -0,0 +1,4 @@ +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. +TBX_NOOP - Scilab or C no-op with any number of inputs and outputs + diff --git a/contrib/xcos_toolbox_skeleton/builder.sce b/contrib/xcos_toolbox_skeleton/builder.sce new file mode 100755 index 000000000..42b191d1a --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/builder.sce @@ -0,0 +1,53 @@ +// Copyright (C) 2008 - INRIA +// Copyright (C) 2009-2011 - DIGITEO + +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +mode(-1); +lines(0); + +function main_builder() + + TOOLBOX_NAME = "xcos_toolbox_skeleton"; + TOOLBOX_TITLE = "Xcos toolbox skeleton"; + toolbox_dir = get_absolute_file_path("builder.sce"); + + // Check Scilab's version + // ============================================================================= + + // check minimal version (xcosPal required) + if ~isdef("xcosPal") then + // and xcos features required + error(gettext("Scilab 5.3.2 or more is required.")); + end + + // Check modules_manager module availability + // ============================================================================= + + if ~isdef("tbx_build_loader") then + error(msprintf(gettext("%s module not installed."), "modules_manager")); + end + + + if ~isdir(toolbox_dir+filesep()+"images"+filesep()+"h5") + [status, msg] = mkdir(toolbox_dir+filesep()+"images"+filesep()+"h5"); + if and(status <> [1 2]) + error(msg); + end + end + + // Action + // ============================================================================= + + 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 + +if with_module("xcos") then + main_builder(); + clear main_builder; // remove main_builder on stack +end diff --git a/contrib/xcos_toolbox_skeleton/changelog.txt b/contrib/xcos_toolbox_skeleton/changelog.txt new file mode 100755 index 000000000..e9a9d9fc9 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/changelog.txt @@ -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/contrib/xcos_toolbox_skeleton/demos/Blocks.zcos b/contrib/xcos_toolbox_skeleton/demos/Blocks.zcos Binary files differnew file mode 100755 index 000000000..7676bee89 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/demos/Blocks.zcos diff --git a/contrib/xcos_toolbox_skeleton/demos/allSum.dem.sce b/contrib/xcos_toolbox_skeleton/demos/allSum.dem.sce new file mode 100755 index 000000000..9cc980398 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/demos/allSum.dem.sce @@ -0,0 +1,5 @@ +// +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +demopath = get_absolute_file_path("allSum.dem.sce"); +xcos(demopath+filesep()+".."+filesep()+"examples"+filesep()+"AllSum.zcos")
\ No newline at end of file diff --git a/contrib/xcos_toolbox_skeleton/demos/xcos_toolbox_skeleton.dem.gateway.sce b/contrib/xcos_toolbox_skeleton/demos/xcos_toolbox_skeleton.dem.gateway.sce new file mode 100755 index 000000000..7b953c516 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/demos/xcos_toolbox_skeleton.dem.gateway.sce @@ -0,0 +1,13 @@ +// +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function subdemolist = demo_gateway() + + demopath = get_absolute_file_path("xcos_toolbox_skeleton.dem.gateway.sce"); + subdemolist = ["All Sum functions overview", "allSum.dem.sce"]; // add demos here + subdemolist(:,2) = demopath + subdemolist(:,2); + +endfunction + +subdemolist = demo_gateway(); +clear demo_gateway; // remove demo_gateway on stack diff --git a/contrib/xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.quit b/contrib/xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.quit new file mode 100755 index 000000000..4e3b3ef2b --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.quit @@ -0,0 +1 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. diff --git a/contrib/xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.start b/contrib/xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.start new file mode 100755 index 000000000..027851ce1 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/etc/xcos_toolbox_skeleton.start @@ -0,0 +1,83 @@ +// Copyright (C) 2011 - DIGITEO + +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function xcos_skeletonlib = startModule() + + mprintf("Start Xcos toolbox skeleton\n"); + + if isdef("xcos_toolbox_skeletonlib") then + warning("Xcos toolbox skeleton library is already loaded"); + return; + end + +// check minimal version (xcosPal required) +// ============================================================================= + if ~isdef('xcosPal') then + // and xcos features required + error(gettext('Scilab 5.3.2 or more is required.')); + end +// ============================================================================= +// force to load some libraries (dependancies) + loadXcosLibs(); loadScicos(); +// ============================================================================= + 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(); + xcos_skeletonlib = lib(pathmacros); + +// Add blocks to the Xcos palette +// ============================================================================= + mprintf("\tLoad palette\n"); + exec(pathconvert(root_tlbx+"/macros/loader_pal.sce", %f)); + +// 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); + +// 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); + +// Append Modelica functionnals +// ============================================================================= + global %MODELICA_USER_LIBS; + %MODELICA_USER_LIBS = [%MODELICA_USER_LIBS ; root_tlbx+"/macros"]; + +// 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); + end + 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); + end + +endfunction + +if with_module('xcos') then + xcos_skeletonlib = startModule(); + clear startModule; // remove startModule on stack +end diff --git a/contrib/xcos_toolbox_skeleton/examples/AllSum.zcos b/contrib/xcos_toolbox_skeleton/examples/AllSum.zcos Binary files differnew file mode 100755 index 000000000..15ad06662 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/examples/AllSum.zcos diff --git a/contrib/xcos_toolbox_skeleton/help/builder_help.sce b/contrib/xcos_toolbox_skeleton/help/builder_help.sce new file mode 100755 index 000000000..42729d12b --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/help/builder_help.sce @@ -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/contrib/xcos_toolbox_skeleton/help/cleaner_help.sce b/contrib/xcos_toolbox_skeleton/help/cleaner_help.sce new file mode 100755 index 000000000..a2b5e7ef2 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/help/cleaner_help.sce @@ -0,0 +1,21 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function cleaner_help() + path = get_absolute_file_path("cleaner_help.sce"); + langdirs = dir(path); + langdirs = langdirs.name(langdirs.isdir); + + for l = 1:size(langdirs, "*") + masterfile = fullpath(path + filesep() + langdirs(l) + "/master_help.xml"); + mdelete(masterfile); + + jarfile = fullpath(path + "/../jar/scilab_" + langdirs(l) + "_help.jar"); + mdelete(jarfile); + + tmphtmldir = fullpath(path + "/" + langdirs(l) + "/scilab_" + langdirs(l) + "_help"); + rmdir(tmphtmldir, "s"); + end +endfunction + +cleaner_help(); +clear cleaner_help; diff --git a/contrib/xcos_toolbox_skeleton/help/en_US/TBX_SUM_c.xml b/contrib/xcos_toolbox_skeleton/help/en_US/TBX_SUM_c.xml new file mode 100755 index 000000000..ca66ca7ce --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/help/en_US/TBX_SUM_c.xml @@ -0,0 +1,85 @@ +<?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> + </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> + <simplelist type="inline"> + <member> + <link linkend="TBX_SUM_c">TBX_SUM_c</link> : corresponding scilab functionnality + </member> + <member> + <link type="scilab" linkend="scilab.help/sum">Link to the Scilab help page</link> + </member> + <member> + <link type="scilab" linkend="scilab.help/ABS_VALUE">Link to an Xcos help page</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/contrib/xcos_toolbox_skeleton/help/en_US/available_blocks.xml b/contrib/xcos_toolbox_skeleton/help/en_US/available_blocks.xml new file mode 100755 index 000000000..2f02ea181 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/help/en_US/available_blocks.xml @@ -0,0 +1,51 @@ +<?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" xmlns:scilab="http://www.scilab.org" version="5.0-subset Scilab" xml:id="xcos_toolbox_skeleton_available_blocks"> + <refnamediv> + <refname>Available blocks</refname> + <refpurpose>Example page to document some fonctionnalities</refpurpose> + </refnamediv> + <refsection> + <title>Schema</title> + <link type="scilab" linkend="xcos_toolbox_skeleton.xcos/demos/Blocks.zcos">Open the schema</link> + <para> + <inlinemediaobject> + <imageobject> + <imagedata align="center" fileref="../../demos/Blocks.zcos" valign="middle"/> + </imageobject> + </inlinemediaobject> + </para> + </refsection> + <refsection> + <title>Description</title> + <para> + This page describe how to use the Xcos specific helptools provided with Scilab. Using these tools you can automatically generate a diagram view and add a link to open it inside Xcos. + </para> + <para> + To add a link to an Xcos schema inside an help page, you should use the standard <literal>link</literal> element with a <literal>type="scilab"</literal> attribute and a toolbox specific <literal>linkend</literal> url. + </para> + <para> + Example for the <literal>xcos_toolbox_skeleton</literal> toolbox: + + </para> + <programlisting role="xml"><![CDATA[ +... +<link type="scilab" linkend="xcos_toolbox_skeleton.xcos/demos/Blocks.zcos">Open the schema</link> +... +]]></programlisting> + <para> + To render an Xcos schema inside an help page, you should use the standard <literal>imagedata</literal> element with a <literal>fileref</literal> attribute to an Xcos schema. + </para> + <para> + Example for the <literal>xcos_toolbox_skeleton</literal> toolbox and the <literal>demos/Blocks.zcos</literal>: + </para> + <programlisting role="xml"><![CDATA[ +... +<inlinemediaobject> + <imageobject> + <imagedata align="center" fileref="../../demos/Blocks.zcos" valign="middle"/> + </imageobject> +</inlinemediaobject> +... +]]></programlisting> + </refsection> +</refentry> diff --git a/contrib/xcos_toolbox_skeleton/help/en_US/build_help.sce b/contrib/xcos_toolbox_skeleton/help/en_US/build_help.sce new file mode 100755 index 000000000..70653160c --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/help/en_US/build_help.sce @@ -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/contrib/xcos_toolbox_skeleton/help/en_US/tbx_sum.xml b/contrib/xcos_toolbox_skeleton/help/en_US/tbx_sum.xml new file mode 100755 index 000000000..5ba551648 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/help/en_US/tbx_sum.xml @@ -0,0 +1,57 @@ +<?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> + <simplelist type="inline"> + <member> + <link linkend="TBX_SUM_c">TBX_SUM_c</link> : corresponding <link type="scilab" linkend="scilab.help/xcos">Xcos</link> block. + </member> + <member> + <link type="scilab" linkend="scilab.help/sum">Link to the Scilab help page</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/contrib/xcos_toolbox_skeleton/help/fr_FR/build_help.sce b/contrib/xcos_toolbox_skeleton/help/fr_FR/build_help.sce new file mode 100755 index 000000000..70653160c --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/help/fr_FR/build_help.sce @@ -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/contrib/xcos_toolbox_skeleton/images/gif/TBX_MUT_STYLE.gif b/contrib/xcos_toolbox_skeleton/images/gif/TBX_MUT_STYLE.gif Binary files differnew file mode 100755 index 000000000..21c795992 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/images/gif/TBX_MUT_STYLE.gif diff --git a/contrib/xcos_toolbox_skeleton/images/gif/TBX_NOOP.gif b/contrib/xcos_toolbox_skeleton/images/gif/TBX_NOOP.gif Binary files differnew file mode 100755 index 000000000..31bad09ea --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/images/gif/TBX_NOOP.gif diff --git a/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_c.gif b/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_c.gif Binary files differnew file mode 100755 index 000000000..959469d09 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_c.gif diff --git a/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_modelica.gif b/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_modelica.gif Binary files differnew file mode 100755 index 000000000..e7b590c30 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_modelica.gif diff --git a/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_sci.gif b/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_sci.gif Binary files differnew file mode 100755 index 000000000..83a4ed8ba --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_sci.gif diff --git a/contrib/xcos_toolbox_skeleton/images/svg/TBX_MUT_STYLE.svg b/contrib/xcos_toolbox_skeleton/images/svg/TBX_MUT_STYLE.svg new file mode 100755 index 000000000..e55da82e6 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/images/svg/TBX_MUT_STYLE.svg @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' + 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'> +<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="fill-opacity:1; color-rendering:auto; color-interpolation:auto; stroke:black; text-rendering:auto; stroke-linecap:square; stroke-miterlimit:10; stroke-opacity:1; shape-rendering:auto; fill:black; stroke-dasharray:none; font-weight:normal; stroke-width:1; font-family:'Dialog'; font-style:normal; stroke-linejoin:miter; font-size:12; stroke-dashoffset:0; image-rendering:auto;" width="610" height="460" xmlns="http://www.w3.org/2000/svg" +><!--Generated by Scilab with Batik SVG Generator--><defs id="genericDefs" + /><g + ><g style="fill:white; text-rendering:optimizeLegibility; stroke:white;" + ><rect x="0" width="610" height="460" y="0" style="stroke:none;" + /></g + ></g +></svg +> diff --git a/contrib/xcos_toolbox_skeleton/images/svg/TBX_NOOP.svg b/contrib/xcos_toolbox_skeleton/images/svg/TBX_NOOP.svg new file mode 100755 index 000000000..b2848496c --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/images/svg/TBX_NOOP.svg @@ -0,0 +1 @@ +<svg/> diff --git a/contrib/xcos_toolbox_skeleton/images/svg/TBX_SUM_c.svg b/contrib/xcos_toolbox_skeleton/images/svg/TBX_SUM_c.svg new file mode 100755 index 000000000..e55da82e6 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/images/svg/TBX_SUM_c.svg @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' + 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'> +<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="fill-opacity:1; color-rendering:auto; color-interpolation:auto; stroke:black; text-rendering:auto; stroke-linecap:square; stroke-miterlimit:10; stroke-opacity:1; shape-rendering:auto; fill:black; stroke-dasharray:none; font-weight:normal; stroke-width:1; font-family:'Dialog'; font-style:normal; stroke-linejoin:miter; font-size:12; stroke-dashoffset:0; image-rendering:auto;" width="610" height="460" xmlns="http://www.w3.org/2000/svg" +><!--Generated by Scilab with Batik SVG Generator--><defs id="genericDefs" + /><g + ><g style="fill:white; text-rendering:optimizeLegibility; stroke:white;" + ><rect x="0" width="610" height="460" y="0" style="stroke:none;" + /></g + ></g +></svg +> diff --git a/contrib/xcos_toolbox_skeleton/images/svg/TBX_SUM_modelica.svg b/contrib/xcos_toolbox_skeleton/images/svg/TBX_SUM_modelica.svg new file mode 100755 index 000000000..b2848496c --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/images/svg/TBX_SUM_modelica.svg @@ -0,0 +1 @@ +<svg/> diff --git a/contrib/xcos_toolbox_skeleton/images/svg/TBX_SUM_sci.svg b/contrib/xcos_toolbox_skeleton/images/svg/TBX_SUM_sci.svg new file mode 100755 index 000000000..e55da82e6 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/images/svg/TBX_SUM_sci.svg @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' + 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'> +<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="fill-opacity:1; color-rendering:auto; color-interpolation:auto; stroke:black; text-rendering:auto; stroke-linecap:square; stroke-miterlimit:10; stroke-opacity:1; shape-rendering:auto; fill:black; stroke-dasharray:none; font-weight:normal; stroke-width:1; font-family:'Dialog'; font-style:normal; stroke-linejoin:miter; font-size:12; stroke-dashoffset:0; image-rendering:auto;" width="610" height="460" xmlns="http://www.w3.org/2000/svg" +><!--Generated by Scilab with Batik SVG Generator--><defs id="genericDefs" + /><g + ><g style="fill:white; text-rendering:optimizeLegibility; stroke:white;" + ><rect x="0" width="610" height="460" y="0" style="stroke:none;" + /></g + ></g +></svg +> diff --git a/contrib/xcos_toolbox_skeleton/license.txt b/contrib/xcos_toolbox_skeleton/license.txt new file mode 100755 index 000000000..c3809713b --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/license.txt @@ -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/contrib/xcos_toolbox_skeleton/macros/TBX_MUT_STYLE.sci b/contrib/xcos_toolbox_skeleton/macros/TBX_MUT_STYLE.sci new file mode 100755 index 000000000..e049d9d36 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/macros/TBX_MUT_STYLE.sci @@ -0,0 +1,48 @@ +// +// This file is part of the Xcos skeleton toolbox +// +// see license.txt for more licensing information + +function [x,y,typ]=TBX_MUT_STYLE(job,arg1,arg2) + x=[];y=[];typ=[] + select job + case "set" then + x=arg1; + model = x.model; + graphics = x.graphics; + + // no parameters yet, just change the style of the block and the ports + hexa = [string(1:9) "A" "B" "C" "D" "E" "F"]; + graphics.style = "BIGSOM_f;fillColor=#" + strcat(hexa(15 * rand(1,6) + 1)); + + port_styles = ["actor" "cloud" "connector" "cylinder" "curve" "doubleEllipse" "ellipse" "hexagon" "image" "label" "line" "rectangle" "rhombus" "triangle"]; + graphics.in_style = "ExplicitInputPort;shape=" + port_styles(size(port_styles, "*") * rand(model.in) + ones(model.in)); + graphics.out_style = "ExplicitOutputPort;shape=" + port_styles(size(port_styles, "*") * rand(model.out) + ones(model.out)); + + disp(graphics.style); + disp(graphics.in_style); + disp(graphics.out_style); + + x.model = model; + x.graphics = graphics; + + case "define" then + model=scicos_model() + model.sim=list("block_sum",4) + // n inputs with a single "double" element + model.in=ones(4, 1); + model.intyp=ones(model.in); + // 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=[] + x=standard_define([2 2],model,exprs,gr_i); + x.graphics.style="BIGSOM_f"; + end +endfunction + diff --git a/contrib/xcos_toolbox_skeleton/macros/TBX_NOOP.sci b/contrib/xcos_toolbox_skeleton/macros/TBX_NOOP.sci new file mode 100755 index 000000000..5616d7f8d --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/macros/TBX_NOOP.sci @@ -0,0 +1,76 @@ +// +// This file is part of the Xcos skeleton toolbox +// +// see license.txt for more licensing information + +function [x,y,typ]=TBX_NOOP(job,arg1,arg2) + x=[];y=[];typ=[] + select job + case "set" then + x=arg1; + model=arg1.model; + graphics=arg1.graphics; + exprs=graphics.exprs; + + while %t do + [ok,sim,in1,in2,intyp,out1,out2,outyp,exprs]=scicos_getvalue(.. + "Set no-operation parameters",.. + ["(0=C, 1=Scilab)"; + "Input rows sizes"; + "Input columns sizes"; + "Input types"; + "Output rows sizes"; + "Output columns sizes"; + "Output types"],.. + list("vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-2,"vec",-2,"vec",-2),.. + exprs) + if ~ok then + break, + end //user cancel modification + + if or(size(in1) <> size(in2)) | or(size(in1) <> size(intyp)) then + message(["Some specified values are inconsistent:"; + " ";"All input parameters should have the same length"]) + ok = %f; + end + if or(size(out1) <> size(out2)) | or(size(out1) <> size(outyp)) then + message(["Some specified values are inconsistent:"; + " ";"All output parameters should have the same length"]) + ok = %f; + end + + if ok then + [model,graphics,ok]=set_io(model,graphics,list([in1,in2],intyp),list([out1,out2],outyp),1,[]) + end + + if ok then + if sim == 0 then + model.sim=list("tbx_block_noop",4); + graphics.style=["blockWithLabel;displayedLabel=""NOOP C"""] + else + model.sim=list("TBX_NOOP_sim",5); + graphics.style=["blockWithLabel;displayedLabel=""NOOP Scilab"""] + end + + graphics.exprs=exprs; + x.graphics=graphics; + x.model=model; + break; + end + end + + case "define" then + model=scicos_model() + model.sim=list("tbx_block_noop",4) + + model.evtin=1 + model.blocktype="d" + model.dep_ut=[%f %f] + + exprs=["0";"";"";"";"";"";""]; + gr_i=[] + x=standard_define([3 2],model,exprs,gr_i) + x.graphics.style=["blockWithLabel;displayedLabel=""NOOP C"""] + end +endfunction + diff --git a/contrib/xcos_toolbox_skeleton/macros/TBX_NOOP_sci.sci b/contrib/xcos_toolbox_skeleton/macros/TBX_NOOP_sci.sci new file mode 100755 index 000000000..9d2efc441 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/macros/TBX_NOOP_sci.sci @@ -0,0 +1,61 @@ +// +// This file is part of the Xcos skeleton toolbox +// +// see license.txt for more licensing information + +function [x,y,typ]=TBX_NOOP_sci(job,arg1,arg2) + x=[];y=[];typ=[] + select job + case "set" then + x=arg1; + model=arg1.model; + graphics=arg1.graphics; + exprs=graphics.exprs; + + while %t do + [ok,in1,in2,intyp,exprs]=scicos_getvalue(.. + "Set no-operation parameters",.. + ["Input rows sizes"; + "Input columns sizes"; + "Input types"],.. + list("vec",-1,"vec",-1,"vec",-1),.. + exprs) + if ~ok then + break, + end //user cancel modification + + if or(size(in1) <> size(in2)) | or(size(in1) <> size(in2)) then + message(["Some specified values are inconsistent:"; + " ";"All parameters should have the same length"]) + ok = %f; + end + + if ok then + model.in1=in1; + model.in2=in2; + model.intyp=intyp; + + graphics.pin=zeros(in1, 1); + + graphics.exprs=exprs; + x.graphics=graphics; + x.model=model; + break; + end + end + + case "define" then + model=scicos_model() + model.sim=list("TBX_NOOP_sim",5) + + model.evtin=1 + model.blocktype="d" + model.dep_ut=[%f %f] + + exprs=["[]";"[]";"[]"]; + gr_i=[] + x=standard_define([3 2],model,exprs,gr_i) + x.graphics.style=["blockWithLabel;displayedLabel=NOOP_sci"] + end +endfunction + diff --git a/contrib/xcos_toolbox_skeleton/macros/TBX_NOOP_sim.sci b/contrib/xcos_toolbox_skeleton/macros/TBX_NOOP_sim.sci new file mode 100755 index 000000000..fc1cf13ce --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/macros/TBX_NOOP_sim.sci @@ -0,0 +1,9 @@ +// +// This file is part of the Xcos skeleton toolbox +// +// see license.txt for more licensing information + + +function block=TBX_NOOP_sim(block,flag) +endfunction + diff --git a/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_c.sci b/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_c.sci new file mode 100755 index 000000000..af49df65d --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_c.sci @@ -0,0 +1,32 @@ +// +// This file is part of the Xcos skeleton toolbox +// +// see license.txt for more licensing information + +function [x,y,typ]=TBX_SUM_c(job,arg1,arg2) + x=[];y=[];typ=[] + select job + 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=[] + + x=standard_define([4 4],model,exprs,gr_i) + x.graphics.style="blockWithLabel;displayedLabel=TBX_SUM_c" + end +endfunction + diff --git a/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_modelica.sci b/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_modelica.sci new file mode 100755 index 000000000..8a6ddda04 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_modelica.sci @@ -0,0 +1,40 @@ +// +// This file is part of the Xcos skeleton toolbox +// +// see license.txt for more licensing information + +function [x,y,typ]=TBX_SUM_modelica(job,arg1,arg2) + x=[];y=[];typ=[] + select job + case "set" then + x=arg1; + // no parameters yet + case "define" then + model=scicos_model() + model.sim="XcosToolboxSkeleton.Sum" + // 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=[%t %f] + + mo=modelica(); + mo.model="XcosToolboxSkeleton.Sum" + mo.inputs=["in1","in2"]; + mo.outputs=["out"]; + mo.parameters=list([],list()) + model.equations=mo; + + exprs=string([]); + gr_i=[] + x=standard_define([4 4],model,exprs,gr_i) + x.graphics.in_implicit=["E";"E"]; + x.graphics.out_implicit=["E"]; + x.graphics.style=["blockWithLabel;displayedLabel=TBX_SUM_modelica"] + end +endfunction + diff --git a/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_sci.sci b/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_sci.sci new file mode 100755 index 000000000..37f2b0d7b --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_sci.sci @@ -0,0 +1,31 @@ +// +// This file is part of the Xcos skeleton toolbox +// +// see license.txt for more licensing information + +function [x,y,typ]=TBX_SUM_sci(job,arg1,arg2) + x=[];y=[];typ=[] + select job + case "set" then + x=arg1; + // no parameters yet + case "define" then + model=scicos_model() + model.sim=list("TBX_SUM_sim",5) + // one inputs with a variable size "double" element + model.in=[-1] + model.intyp=[1] + // one output with a single "double" element + model.out=1 + model.outtyp=1 + + model.blocktype="c" + model.dep_ut=[%t %f] + + exprs=string([]); + gr_i=[] + x=standard_define([4 4],model,exprs,gr_i) + x.graphics.style=["blockWithLabel;displayedLabel=TBX_SUM_sci"] + end +endfunction + diff --git a/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_sim.sci b/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_sim.sci new file mode 100755 index 000000000..fd698c8dc --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/macros/TBX_SUM_sim.sci @@ -0,0 +1,49 @@ +// +// This file is part of the Xcos skeleton toolbox +// +// see license.txt for more licensing information + + +function block=TBX_SUM_sim(block,flag) + function verboseMessage(debugMessage) + disp("[verboseMessage] time = "+string(scicos_time())+"] {"+block.label+"} SUM Simulation: "+debugMessage); + endfunction + + select flag + case -5 // Error + verboseMessage("Calling with flag Error(-5)") + + case 0 // Derivative State Update + verboseMessage("Calling with flag DerivativeStare(0)") + + case 1 // Output Update + verboseMessage("Calling with flag OutputUpdate(1)") + outptr = block.outptr; + inptr = block.inptr; + outptr(1) = sum(inptr(1)); + block.outptr = outptr; + + + case 2 // State Update + verboseMessage("Calling with flag StateUpdate(2)") + + case 3 // OutputEventTiming + verboseMessage("Calling with flag OutputEventTiming(3)") + + case 4 // Initialization + verboseMessage("Calling with flag Initialization(4)") + + case 5 // Ending + verboseMessage("Calling with flag Ending(5)") + + case 6 // Reinitialization + verboseMessage("Calling with flag Reinitialization(6)") + + case 9 // Zero-Crossing + verboseMessage("Calling with flag Zero-Crossing(9)") + + else // Unknown flag + verboseMessage("Calling with unknonw flag("+string(flag)+")") + + end +endfunction diff --git a/contrib/xcos_toolbox_skeleton/macros/XcosToolboxSkeleton.mo b/contrib/xcos_toolbox_skeleton/macros/XcosToolboxSkeleton.mo new file mode 100755 index 000000000..0398697c7 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/macros/XcosToolboxSkeleton.mo @@ -0,0 +1,18 @@ +// +// This file is part of the Xcos skeleton toolbox +// +// see license.txt for more licensing information + +package XcosToolboxSkeleton + + model Sum "Perfom the summation of the two inputs" + Real in1 "the first input"; + Real in2 "the second input"; + Real out "the output" ; + equation + out = in1 + in2; + end Sum; + +end XcosToolboxSkeleton; + + diff --git a/contrib/xcos_toolbox_skeleton/macros/buildmacros.sce b/contrib/xcos_toolbox_skeleton/macros/buildmacros.sce new file mode 100755 index 000000000..155410fae --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/macros/buildmacros.sce @@ -0,0 +1,15 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function buildmacros() + macros_path = get_absolute_file_path("buildmacros.sce"); + + blocks = ["TBX_SUM_c", "TBX_SUM_sci", "TBX_SUM_modelica", "TBX_MUT_STYLE", "TBX_NOOP"]; + + tbx_build_macros(TOOLBOX_NAME, macros_path); + tbx_build_blocks(toolbox_dir, blocks); + tbx_build_pal_loader(TOOLBOX_TITLE, blocks, toolbox_dir, macros_path) +endfunction + +buildmacros(); +clear buildmacros; // remove buildmacros on stack + diff --git a/contrib/xcos_toolbox_skeleton/macros/cleanmacros.sce b/contrib/xcos_toolbox_skeleton/macros/cleanmacros.sce new file mode 100755 index 000000000..eff1af0a8 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/macros/cleanmacros.sce @@ -0,0 +1,23 @@ +// ==================================================================== +// This file is released under the 3-clause BSD license. See COPYING-BSD. +// ==================================================================== +function cleanmacros() + 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 + +cleanmacros(); +clear cleanmacros; // remove cleanmacros on stack +// ==================================================================== diff --git a/contrib/xcos_toolbox_skeleton/sci_gateway/builder_gateway.sce b/contrib/xcos_toolbox_skeleton/sci_gateway/builder_gateway.sce new file mode 100755 index 000000000..93f8d6059 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/sci_gateway/builder_gateway.sce @@ -0,0 +1,15 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function builder_gateway() + + 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); + +endfunction + +builder_gateway(); +clear builder_gateway; // remove builder_gateway on stack diff --git a/contrib/xcos_toolbox_skeleton/sci_gateway/c/builder_gateway_c.sce b/contrib/xcos_toolbox_skeleton/sci_gateway/c/builder_gateway_c.sce new file mode 100755 index 000000000..973fd1f4a --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/sci_gateway/c/builder_gateway_c.sce @@ -0,0 +1,18 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function builder_gw_c() + + includes_src_c = ilib_include_flag(get_absolute_file_path("builder_gateway_c.sce") + "../../src/c"); + + 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); + +endfunction + +builder_gw_c(); +clear builder_gw_c; // remove builder_gw_c on stack diff --git a/contrib/xcos_toolbox_skeleton/sci_gateway/c/sci_tbx_sum.c b/contrib/xcos_toolbox_skeleton/sci_gateway/c/sci_tbx_sum.c new file mode 100755 index 000000000..bb1c41cbd --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/sci_gateway/c/sci_tbx_sum.c @@ -0,0 +1,70 @@ +/* This file is released under the 3-clause BSD license. See COPYING-BSD. */ + +#include "business.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 */ + CheckInputArgument(pvApiCtx, 2, 2); + CheckOutputArgument(pvApiCtx, 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); + + createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dOut); + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; +} + diff --git a/contrib/xcos_toolbox_skeleton/sci_gateway/loader_gateway.sce b/contrib/xcos_toolbox_skeleton/sci_gateway/loader_gateway.sce new file mode 100755 index 000000000..77f69b759 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/sci_gateway/loader_gateway.sce @@ -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/contrib/xcos_toolbox_skeleton/src/builder_src.sce b/contrib/xcos_toolbox_skeleton/src/builder_src.sce new file mode 100755 index 000000000..4994d2277 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/src/builder_src.sce @@ -0,0 +1,11 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function builder_src() + src_path = get_absolute_file_path("builder_src.sce"); + tbx_builder_src_lang("c", src_path); +endfunction + +builder_src(); +clear builder_src; // remove builder_src on stack + + diff --git a/contrib/xcos_toolbox_skeleton/src/c/block_sum.c b/contrib/xcos_toolbox_skeleton/src/c/block_sum.c new file mode 100755 index 000000000..e1e9cdb4d --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/src/c/block_sum.c @@ -0,0 +1,25 @@ +/* This file is released under the 3-clause BSD license. See COPYING-BSD. */ + +#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/contrib/xcos_toolbox_skeleton/src/c/builder_c.sce b/contrib/xcos_toolbox_skeleton/src/c/builder_c.sce new file mode 100755 index 000000000..747e36989 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/src/c/builder_c.sce @@ -0,0 +1,44 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +// This macro compiles the files + +function builder_c() + src_c_path = get_absolute_file_path("builder_c.sce"); + + CFLAGS = ilib_include_flag(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", "tbx_block_noop"], .. + ["block_sum.c", "business_sum.c" "tbx_block_noop.c"], .. + "c", .. + src_c_path, .. + "", .. + LDFLAGS, .. + CFLAGS, .. + "", .. + "", .. + "xcos_tbx_skel"); +endfunction + +builder_c(); +clear builder_c; // remove builder_c on stack diff --git a/contrib/xcos_toolbox_skeleton/src/c/business.h b/contrib/xcos_toolbox_skeleton/src/c/business.h new file mode 100755 index 000000000..698c9a3b0 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/src/c/business.h @@ -0,0 +1,7 @@ +/* This file is released under the 3-clause BSD license. See COPYING-BSD. */ + +/** + * @return in1 + in2 + */ +double business_sum(double in, double in2); + diff --git a/contrib/xcos_toolbox_skeleton/src/c/business_sum.c b/contrib/xcos_toolbox_skeleton/src/c/business_sum.c new file mode 100755 index 000000000..b0f01e7f2 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/src/c/business_sum.c @@ -0,0 +1,7 @@ +/* This file is released under the 3-clause BSD license. See COPYING-BSD. */ + +double business_sum(double in, double in2) +{ + return in + in2; +} + diff --git a/contrib/xcos_toolbox_skeleton/src/c/tbx_block_noop.c b/contrib/xcos_toolbox_skeleton/src/c/tbx_block_noop.c new file mode 100755 index 000000000..94c32d6db --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/src/c/tbx_block_noop.c @@ -0,0 +1,8 @@ +/* This file is released under the 3-clause BSD license. See COPYING-BSD. */ + +#include <scicos_block4.h> + +void tbx_block_noop(scicos_block* block, scicos_flag flag) +{ +} + diff --git a/contrib/xcos_toolbox_skeleton/src/cleaner_src.sce b/contrib/xcos_toolbox_skeleton/src/cleaner_src.sce new file mode 100755 index 000000000..921530d93 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/src/cleaner_src.sce @@ -0,0 +1,16 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function cleaner_src() + 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 + +cleaner_src(); +clear cleaner_src; // remove cleaner_src on stack diff --git a/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_matrices.zcos b/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_matrices.zcos Binary files differnew file mode 100755 index 000000000..520b8cf33 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_matrices.zcos diff --git a/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_matrices_c.tst b/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_matrices_c.tst new file mode 100755 index 000000000..604ea8aa2 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_matrices_c.tst @@ -0,0 +1,17 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. +//======================================================================= + +loadXcosLibs(); +loadScicos(); + +assert_checktrue(importXcosDiagram("tests/benchmark/noop_matrices.zcos")) + +context = struct(); +context.NOOP_mode = 0; // using a C simulation function + +// <-- BENCH START --> +timer(); +scicos_simulate(scs_m, context); +disp(timer()); +// <-- BENCH END --> + diff --git a/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_matrices_scilab.tst b/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_matrices_scilab.tst new file mode 100755 index 000000000..91cb94116 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_matrices_scilab.tst @@ -0,0 +1,17 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. +//======================================================================= + +loadXcosLibs(); +loadScicos(); + +assert_checktrue(importXcosDiagram("tests/benchmark/noop_matrices.zcos")) + +context = struct(); +context.NOOP_mode = 1; // using a Scilab simulation function + +// <-- BENCH START --> +timer(); +scicos_simulate(scs_m, context); +disp(timer()); +// <-- BENCH END --> + diff --git a/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_scalar.zcos b/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_scalar.zcos Binary files differnew file mode 100755 index 000000000..dd167c984 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_scalar.zcos diff --git a/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_scalar_c.tst b/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_scalar_c.tst new file mode 100755 index 000000000..377d271a7 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_scalar_c.tst @@ -0,0 +1,17 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. +//======================================================================= + +loadXcosLibs(); +loadScicos(); + +assert_checktrue(importXcosDiagram("tests/benchmark/noop_scalar.zcos")) + +context = struct(); +context.NOOP_mode = 0; // using a C simulation function + +// <-- BENCH START --> +timer(); +scicos_simulate(scs_m, context); +disp(timer()); +// <-- BENCH END --> + diff --git a/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_scalar_scilab.tst b/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_scalar_scilab.tst new file mode 100755 index 000000000..3f3e877c5 --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/tests/benchmark/noop_scalar_scilab.tst @@ -0,0 +1,17 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. +//======================================================================= + +loadXcosLibs(); +loadScicos(); + +assert_checktrue(importXcosDiagram("tests/benchmark/noop_scalar.zcos")) + +context = struct(); +context.NOOP_mode = 1; // using a Scilab simulation function + +// <-- BENCH START --> +timer(); +scicos_simulate(scs_m, context); +disp(timer()); +// <-- BENCH END --> + diff --git a/contrib/xcos_toolbox_skeleton/tests/unit_tests/tbx_sum.dia.ref b/contrib/xcos_toolbox_skeleton/tests/unit_tests/tbx_sum.dia.ref new file mode 100755 index 000000000..4634a932f --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/tests/unit_tests/tbx_sum.dia.ref @@ -0,0 +1,3 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. +//================================= +assert_checkequal(tbx_sum(3,5), 8); diff --git a/contrib/xcos_toolbox_skeleton/tests/unit_tests/tbx_sum.tst b/contrib/xcos_toolbox_skeleton/tests/unit_tests/tbx_sum.tst new file mode 100755 index 000000000..4cdc6a4dd --- /dev/null +++ b/contrib/xcos_toolbox_skeleton/tests/unit_tests/tbx_sum.tst @@ -0,0 +1,5 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. +//================================= +assert_checkequal(tbx_sum(3,5), 8); + + |