Xcos : rewrite sciblk2 to C++ 11/16111/9
Paul Bignier [Fri, 6 Mar 2015 09:53:21 +0000 (10:53 +0100)]
Change-Id: If3d8f877e36a5d07ae24b1f8b0f3f48ebed89c9d

14 files changed:
scilab/modules/scicos/Makefile.am
scilab/modules/scicos/Makefile.in
scilab/modules/scicos/includes/scicos.h
scilab/modules/scicos/src/c/cli/scicos-cli.vcxproj
scilab/modules/scicos/src/c/cli/scicos-cli.vcxproj.filters
scilab/modules/scicos/src/c/sciblk2.c [deleted file]
scilab/modules/scicos/src/c/sciblk2.h
scilab/modules/scicos/src/c/scicos.c
scilab/modules/scicos/src/c/scicos.vcxproj
scilab/modules/scicos/src/c/scicos.vcxproj.filters
scilab/modules/scicos/src/cpp/sciblk2.cpp [new file with mode: 0644]
scilab/modules/scicos/tests/unit_tests/pendulum_anim5.cosf [new file with mode: 0644]
scilab/modules/scicos/tests/unit_tests/sciblk2.dia.ref [new file with mode: 0644]
scilab/modules/scicos/tests/unit_tests/sciblk2.tst [new file with mode: 0644]

index 561b90e..70cd31a 100644 (file)
@@ -34,6 +34,7 @@ src/cpp/view_scilab/ParamsAdapter.cpp \
 src/cpp/view_scilab/ScsAdapter.cpp \
 src/cpp/view_scilab/StateAdapter.cpp \
 src/cpp/view_scilab/TextAdapter.cpp \
+src/cpp/sciblk2.cpp \
 src/cpp/sciblk4.cpp \
 src/cpp/createblklist.cpp \
 src/cpp/extractblklist.cpp
@@ -47,7 +48,6 @@ src/c/scicos_print.c \
 src/c/import.c \
 src/c/scicos.c \
 src/c/scicos_free.c \
-src/c/sciblk2.c \
 src/c/ezxml.c \
 src/c/var2sci.c \
 src/c/MlistGetFieldNumber.c \
index 442c777..68b397c 100644 (file)
@@ -219,11 +219,11 @@ am__libsciscicos_algo_la_SOURCES_DIST = src/c/noscicos/noscicos.c \
        src/cpp/view_scilab/ParamsAdapter.cpp \
        src/cpp/view_scilab/ScsAdapter.cpp \
        src/cpp/view_scilab/StateAdapter.cpp \
-       src/cpp/view_scilab/TextAdapter.cpp src/cpp/sciblk4.cpp \
-       src/cpp/createblklist.cpp src/cpp/extractblklist.cpp \
-       src/c/scilab5_needed_stubs.c src/c/tree.c \
-       src/c/scicos_malloc.c src/c/scicos_print.c src/c/import.c \
-       src/c/scicos.c src/c/scicos_free.c src/c/sciblk2.c \
+       src/cpp/view_scilab/TextAdapter.cpp src/cpp/sciblk2.cpp \
+       src/cpp/sciblk4.cpp src/cpp/createblklist.cpp \
+       src/cpp/extractblklist.cpp src/c/scilab5_needed_stubs.c \
+       src/c/tree.c src/c/scicos_malloc.c src/c/scicos_print.c \
+       src/c/import.c src/c/scicos.c src/c/scicos_free.c \
        src/c/ezxml.c src/c/var2sci.c src/c/MlistGetFieldNumber.c \
        src/c/lsodar.c src/c/ddaskr.c src/fortran/skipvars.f \
        src/fortran/coselm.f src/fortran/sctree.f src/fortran/scierr.f \
@@ -251,6 +251,7 @@ am__objects_2 = src/cpp/libsciscicos_algo_la-il_state.lo \
        src/cpp/view_scilab/libsciscicos_algo_la-ScsAdapter.lo \
        src/cpp/view_scilab/libsciscicos_algo_la-StateAdapter.lo \
        src/cpp/view_scilab/libsciscicos_algo_la-TextAdapter.lo \
+       src/cpp/libsciscicos_algo_la-sciblk2.lo \
        src/cpp/libsciscicos_algo_la-sciblk4.lo \
        src/cpp/libsciscicos_algo_la-createblklist.lo \
        src/cpp/libsciscicos_algo_la-extractblklist.lo
@@ -261,7 +262,6 @@ am__objects_3 = src/c/libsciscicos_algo_la-scilab5_needed_stubs.lo \
        src/c/libsciscicos_algo_la-import.lo \
        src/c/libsciscicos_algo_la-scicos.lo \
        src/c/libsciscicos_algo_la-scicos_free.lo \
-       src/c/libsciscicos_algo_la-sciblk2.lo \
        src/c/libsciscicos_algo_la-ezxml.lo \
        src/c/libsciscicos_algo_la-var2sci.lo \
        src/c/libsciscicos_algo_la-MlistGetFieldNumber.lo \
@@ -949,6 +949,7 @@ src/cpp/view_scilab/ParamsAdapter.cpp \
 src/cpp/view_scilab/ScsAdapter.cpp \
 src/cpp/view_scilab/StateAdapter.cpp \
 src/cpp/view_scilab/TextAdapter.cpp \
+src/cpp/sciblk2.cpp \
 src/cpp/sciblk4.cpp \
 src/cpp/createblklist.cpp \
 src/cpp/extractblklist.cpp
@@ -961,7 +962,6 @@ src/c/scicos_print.c \
 src/c/import.c \
 src/c/scicos.c \
 src/c/scicos_free.c \
-src/c/sciblk2.c \
 src/c/ezxml.c \
 src/c/var2sci.c \
 src/c/MlistGetFieldNumber.c \
@@ -1504,6 +1504,8 @@ src/cpp/view_scilab/libsciscicos_algo_la-StateAdapter.lo:  \
 src/cpp/view_scilab/libsciscicos_algo_la-TextAdapter.lo:  \
        src/cpp/view_scilab/$(am__dirstamp) \
        src/cpp/view_scilab/$(DEPDIR)/$(am__dirstamp)
+src/cpp/libsciscicos_algo_la-sciblk2.lo: src/cpp/$(am__dirstamp) \
+       src/cpp/$(DEPDIR)/$(am__dirstamp)
 src/cpp/libsciscicos_algo_la-sciblk4.lo: src/cpp/$(am__dirstamp) \
        src/cpp/$(DEPDIR)/$(am__dirstamp)
 src/cpp/libsciscicos_algo_la-createblklist.lo:  \
@@ -1530,8 +1532,6 @@ src/c/libsciscicos_algo_la-scicos.lo: src/c/$(am__dirstamp) \
        src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libsciscicos_algo_la-scicos_free.lo: src/c/$(am__dirstamp) \
        src/c/$(DEPDIR)/$(am__dirstamp)
-src/c/libsciscicos_algo_la-sciblk2.lo: src/c/$(am__dirstamp) \
-       src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libsciscicos_algo_la-ezxml.lo: src/c/$(am__dirstamp) \
        src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libsciscicos_algo_la-var2sci.lo: src/c/$(am__dirstamp) \
@@ -2089,7 +2089,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_algo_la-ezxml.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_algo_la-import.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_algo_la-lsodar.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_algo_la-sciblk2.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_algo_la-scicos.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_algo_la-scicos_free.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_algo_la-scicos_malloc.Plo@am__quote@
@@ -2107,6 +2106,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciscicos_algo_la-extractblklist.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciscicos_algo_la-il_sim.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciscicos_algo_la-il_state.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciscicos_algo_la-sciblk2.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciscicos_algo_la-sciblk4.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciscicos_algo_la-var2vec.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciscicos_algo_la-vec2var.Plo@am__quote@
@@ -2221,13 +2221,6 @@ src/c/libsciscicos_algo_la-scicos_free.lo: src/c/scicos_free.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciscicos_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libsciscicos_algo_la-scicos_free.lo `test -f 'src/c/scicos_free.c' || echo '$(srcdir)/'`src/c/scicos_free.c
 
-src/c/libsciscicos_algo_la-sciblk2.lo: src/c/sciblk2.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciscicos_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libsciscicos_algo_la-sciblk2.lo -MD -MP -MF src/c/$(DEPDIR)/libsciscicos_algo_la-sciblk2.Tpo -c -o src/c/libsciscicos_algo_la-sciblk2.lo `test -f 'src/c/sciblk2.c' || echo '$(srcdir)/'`src/c/sciblk2.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libsciscicos_algo_la-sciblk2.Tpo src/c/$(DEPDIR)/libsciscicos_algo_la-sciblk2.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='src/c/sciblk2.c' object='src/c/libsciscicos_algo_la-sciblk2.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciscicos_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libsciscicos_algo_la-sciblk2.lo `test -f 'src/c/sciblk2.c' || echo '$(srcdir)/'`src/c/sciblk2.c
-
 src/c/libsciscicos_algo_la-ezxml.lo: src/c/ezxml.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciscicos_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libsciscicos_algo_la-ezxml.lo -MD -MP -MF src/c/$(DEPDIR)/libsciscicos_algo_la-ezxml.Tpo -c -o src/c/libsciscicos_algo_la-ezxml.lo `test -f 'src/c/ezxml.c' || echo '$(srcdir)/'`src/c/ezxml.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libsciscicos_algo_la-ezxml.Tpo src/c/$(DEPDIR)/libsciscicos_algo_la-ezxml.Plo
@@ -2658,6 +2651,13 @@ src/cpp/view_scilab/libsciscicos_algo_la-TextAdapter.lo: src/cpp/view_scilab/Tex
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciscicos_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/view_scilab/libsciscicos_algo_la-TextAdapter.lo `test -f 'src/cpp/view_scilab/TextAdapter.cpp' || echo '$(srcdir)/'`src/cpp/view_scilab/TextAdapter.cpp
 
+src/cpp/libsciscicos_algo_la-sciblk2.lo: src/cpp/sciblk2.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciscicos_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciscicos_algo_la-sciblk2.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciscicos_algo_la-sciblk2.Tpo -c -o src/cpp/libsciscicos_algo_la-sciblk2.lo `test -f 'src/cpp/sciblk2.cpp' || echo '$(srcdir)/'`src/cpp/sciblk2.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciscicos_algo_la-sciblk2.Tpo src/cpp/$(DEPDIR)/libsciscicos_algo_la-sciblk2.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='src/cpp/sciblk2.cpp' object='src/cpp/libsciscicos_algo_la-sciblk2.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciscicos_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciscicos_algo_la-sciblk2.lo `test -f 'src/cpp/sciblk2.cpp' || echo '$(srcdir)/'`src/cpp/sciblk2.cpp
+
 src/cpp/libsciscicos_algo_la-sciblk4.lo: src/cpp/sciblk4.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciscicos_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciscicos_algo_la-sciblk4.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciscicos_algo_la-sciblk4.Tpo -c -o src/cpp/libsciscicos_algo_la-sciblk4.lo `test -f 'src/cpp/sciblk4.cpp' || echo '$(srcdir)/'`src/cpp/sciblk4.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciscicos_algo_la-sciblk4.Tpo src/cpp/$(DEPDIR)/libsciscicos_algo_la-sciblk4.Plo
index 2b0e382..0b18343 100644 (file)
@@ -44,6 +44,7 @@ typedef void (*voidf) (void);
 #define IP int*
 #define DP double*
 #define DPP double**
+#define VP void*
 #define DB scicos_block*
 #define F scicos_flag
 #define FP scicos_flag*
@@ -57,11 +58,11 @@ typedef void (*voidf) (void);
 /*       flag   nclock t    xd   x    nx   z   nz   tvec   ntvec  rpar  nrpar ipar  nipar  intabl  .... */
 #define ARGS_scicos FP,IP,DP,DP,DP,IP,DP,IP,DP,IP,DP,IP,IP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP,DP,IP
 
-/*        flag   nclock t    xd   x    nx   z   nz   tvec   ntvec  rpar  nrpar ipar  nipar   args_in sz_in, n_in  args_out sz_out, n_out  */
-#define ARGS_scicos2 FP,IP,DP,DP,DP,IP,DP,IP,DP,IP,DP,IP,IP,IP,DPP,IP,IP,DPP,IP,IP
+/*        flag   nclock t    xd   x    nx   z   nz   tvec   ntvec  rpar  nrpar ipar  nipar   args_in sz_in, n_in  args_out sz_out, n_out, funptr */
+#define ARGS_scicos2 FP,IP,DP,DP,DP,IP,DP,IP,DP,IP,DP,IP,IP,IP,DPP,IP,IP,DPP,IP,IP,VP
 
-/*        flag   nclock t    xd   x    nx   z   nz   tvec   ntvec  rpar  nrpar ipar  nipar   args_in sz_in, n_in  args_out sz_out, n_out g ng */
-#define ARGS_scicos2z FP,IP,DP,DP,DP,IP,DP,IP,DP,IP,DP,IP,IP,IP,DPP,IP,IP,DPP,IP,IP,DP,IP
+/*        flag   nclock t    xd   x    nx   z   nz   tvec   ntvec  rpar  nrpar ipar  nipar   args_in sz_in, n_in  args_out sz_out, n_out, funptr, g ng */
+#define ARGS_scicos2z FP,IP,DP,DP,DP,IP,DP,IP,DP,IP,DP,IP,IP,IP,DPP,IP,IP,DPP,IP,IP,VP,DP,IP
 
 /*       flag   nclock t    residual xd   x    nx   z   nz   tvec   ntvec  rpar  nrpar ipar  nipar  intabl  .... */
 
index c52f485..742df3d 100644 (file)
@@ -284,6 +284,7 @@ lib /DEF:"$(ProjectDir)../differential_equations_f_Import.def" /SUBSYSTEM:WINDOW
     <ClCompile Include="..\..\cpp\il_state.cpp" />
     <ClCompile Include="..\..\cpp\createblklist.cpp" />
     <ClCompile Include="..\..\cpp\extractblklist.cpp" />
+    <ClCompile Include="..\..\cpp\sciblk2.cpp" />
     <ClCompile Include="..\..\cpp\sciblk4.cpp" />
     <ClCompile Include="..\..\cpp\var2vec.cpp" />
     <ClCompile Include="..\..\cpp\vec2var.cpp" />
@@ -299,7 +300,6 @@ lib /DEF:"$(ProjectDir)../differential_equations_f_Import.def" /SUBSYSTEM:WINDOW
     <ClCompile Include="..\..\..\sci_gateway\c\sci_ftree3.c" />
     <ClCompile Include="..\..\..\sci_gateway\c\sci_ftree4.c" />
     <ClCompile Include="..\..\..\sci_gateway\c\sci_sctree.c" />
-    <ClCompile Include="..\sciblk2.c" />
     <ClCompile Include="..\scicos.c" />
     <ClCompile Include="..\scicos_free.c" />
     <ClCompile Include="..\scicos_malloc.c" />
index 20e86d1..5b3ae0f 100644 (file)
@@ -59,9 +59,6 @@
     <ClCompile Include="..\..\..\sci_gateway\c\sci_sctree.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sciblk2.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\scicos.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\..\cpp\il_state.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\cpp\createblklist.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\cpp\extractblklist.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\cpp\sciblk2.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\cpp\sciblk4.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\sci_gateway\cpp\sci_callblk.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\sci_gateway\cpp\sci_model2blk.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
     <ClCompile Include="..\scilab5_needed_stubs.c">
       <Filter>Source Files</Filter>
     </ClCompile>
diff --git a/scilab/modules/scicos/src/c/sciblk2.c b/scilab/modules/scicos/src/c/sciblk2.c
deleted file mode 100644 (file)
index e8a0d8c..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-/*  Scicos
-*
-*  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* See the file ./license.txt
-*/
-/*--------------------------------------------------------------------------*/
-#include "machine.h"
-#include "sciblk2.h"
-#include "sci_malloc.h"
-/*--------------------------------------------------------------------------*/
-void  sciblk2(int *flag, int *nevprt, double *t, double xd[], double x[], int *nx, double z[], int *nz, double tvec[], int *ntvec, double rpar[], int *nrpar,
-              int ipar[], int *nipar, double *inptr[], int insz[], int *nin, double *outptr[], int outsz[], int *nout)
-
-{
-    //    int k = 0;
-    //    double *y = NULL;
-    //    double *u = NULL;
-    //    /*int nev,ic;*/
-    //    int one = 1, skip = 0;
-    //    int nu = 0, ny = 0;
-    //    int nu2 = 0, ny2 = 0;
-    //    int mlhs = 5, mrhs = 8;
-    //    int ltop = 0;
-    //
-    //
-    //    C2F(itosci)(flag, &one, &one);
-    //    if (C2F(scierr)() != 0)
-    //    {
-    //        goto err;
-    //    }
-    //    C2F(itosci)(nevprt, &one, &one);
-    //    if (C2F(scierr)() != 0)
-    //    {
-    //        goto err;
-    //    }
-    //    C2F(dtosci)(t, &one, &one);
-    //    if (C2F(scierr)() != 0)
-    //    {
-    //        goto err;
-    //    }
-    //    C2F(dtosci)(x, nx, &one);
-    //    if (C2F(scierr)() != 0)
-    //    {
-    //        goto err;
-    //    }
-    //    /*    C2F(dtosci)(z,nz,&one);*/
-    //    C2F(vvtosci)(z, nz);
-    //    if (C2F(scierr)() != 0)
-    //    {
-    //        goto err;
-    //    }
-    //    C2F(vvtosci)(rpar, nrpar);
-    //    /*    C2F(dtosci)(rpar,nrpar,&one);*/
-    //    if (C2F(scierr)() != 0)
-    //    {
-    //        goto err;
-    //    }
-    //    C2F(itosci)(ipar, nipar, &one);
-    //    if (C2F(scierr)() != 0)
-    //    {
-    //        goto err;
-    //    }
-    //    for (k = 0; k < *nin; k++)
-    //    {
-    //        u = (double *)inptr[k];
-    //        nu = insz[k];
-    //        nu2 = insz[*nin + k];
-    //        //       C2F(dtosci)(u,&nu,&one);
-    //        C2F(dtosci)(u, &nu, &nu2);
-    //        if (C2F(scierr)() != 0)
-    //        {
-    //            goto err;
-    //        }
-    //    }
-    //    C2F(mklist)(nin);
-    //
-    //
-    //    C2F(scifunc)(&mlhs, &mrhs);
-    //    if (C2F(scierr)() != 0)
-    //    {
-    //        goto err;
-    //    }
-    //
-    //    switch (*flag)
-    //    {
-    //        case 1 :
-    //            /* y or z computation */
-    //        {
-    //            skip = 2;
-    //            C2F(skipvars)(&skip);
-    //            C2F(scitovv)(z, nz);
-    //            /*C2F(scitod)(z,nz,&one);*/
-    //            C2F(scitod)(x, nx, &one);
-    //        }
-    //        if (*nout == 0)
-    //        {
-    //            skip = 1;
-    //            C2F(skipvars)(&skip);
-    //        }
-    //        else
-    //        {
-    //            C2F(list2vars)(nout, &ltop);
-    //            if (C2F(scierr)() != 0)
-    //            {
-    //                goto err;
-    //            }
-    //            for (k = *nout - 1; k >= 0; k--)
-    //            {
-    //                y = (double *)outptr[k];
-    //                ny = outsz[k];
-    //                ny2 = outsz[*nout + k];
-    //                //         C2F(scitod)(y,&ny,&one);
-    //                C2F(scitod)(y, &ny, &ny2);
-    //                if (C2F(scierr)() != 0)
-    //                {
-    //                    goto err;
-    //                }
-    //            }
-    //            /* list2vars has changed the Lstk(top+1) value.
-    //               reset the correct value */
-    //            C2F(ltopadj)(&ltop);
-    //        }
-    //        break;
-    //        case 0 :
-    //            /*  x'  computation */
-    //        {
-    //            /*skip=4;
-    //              C2F(skipvars)(&skip);*/
-    //            C2F(scitod)(xd, nx, &one);
-    //            skip = 4;
-    //            C2F(skipvars)(&skip);
-    //            break;
-    //        }
-    //        case 2 :
-    //        {
-    //            skip = 2;
-    //            C2F(skipvars)(&skip);
-    //            C2F(scitovv)(z, nz);
-    //            /*C2F(scitod)(z,nz,&one);*/
-    //            C2F(scitod)(x, nx, &one);
-    //            skip = 1;
-    //            C2F(skipvars)(&skip);
-    //        }
-    //        break;
-    //        case 3 :
-    //            skip = 1;
-    //            C2F(skipvars)(&skip);
-    //            C2F(scitod)(tvec, ntvec, &one);
-    //            skip = 3;
-    //            C2F(skipvars)(&skip);
-    //            break;
-    //        case 4 :
-    //            skip = 2;
-    //            C2F(skipvars)(&skip);
-    //            C2F(scitovv)(z, nz);
-    //            /*C2F(scitod)(z,nz,&one);*/
-    //            C2F(scitod)(x, nx, &one);
-    //            skip = 1;
-    //            C2F(skipvars)(&skip);
-    //            break;
-    //        case 5 :
-    //            skip = 2;
-    //            C2F(skipvars)(&skip);
-    //            C2F(scitovv)(z, nz);
-    //            /*C2F(scitod)(z,nz,&one);*/
-    //            C2F(scitod)(x, nx, &one);
-    //            skip = 1;
-    //            C2F(skipvars)(&skip);
-    //            break;
-    //        case 6 :
-    //            skip = 2;
-    //            C2F(skipvars)(&skip);
-    //            C2F(scitovv)(z, nz);
-    //            /*C2F(scitod)(z,nz,&one);*/
-    //            C2F(scitod)(x, nx, &one);
-    //            if (*nout == 0)
-    //            {
-    //                skip = 1;
-    //                C2F(skipvars)(&skip);
-    //            }
-    //            else
-    //            {
-    //                C2F(list2vars)(nout, &ltop);
-    //                if (C2F(scierr)() != 0)
-    //                {
-    //                    goto err;
-    //                }
-    //                for (k = *nout - 1; k >= 0; k--)
-    //                {
-    //                    y = (double *)outptr[k];
-    //                    ny = outsz[k];
-    //                    C2F(scitod)(y, &ny, &one);
-    //                    if (C2F(scierr)() != 0)
-    //                    {
-    //                        goto err;
-    //                    }
-    //                }
-    //                /* list2vars has changed the Lstk(top+1) value.
-    //                   reset the correct value */
-    //                C2F(ltopadj)(&ltop);
-    //            }
-    //            break;
-    //    }
-    //    return;
-    //err:
-    //    *flag = -1;
-}
-/*--------------------------------------------------------------------------*/
index ff0cb6c..33d67e9 100644 (file)
@@ -25,9 +25,8 @@
 /**
 *
 */
-void  sciblk2(int *flag, int *nevprt, double *t, double xd[], double x[], int *nx, double z[], int *nz, double tvec[], int *ntvec, double rpar[], int *nrpar,
-              int ipar[], int *nipar, double *inptr[], int insz[], int *nin, double *outptr[], int outsz[], int *nout);
-
+void sciblk2(int *flag, int *nevprt, double *t, double xd[], double x[], int *nx, double z[], int *nz, double tvec[], int *ntvec, double rpar[], int *nrpar,
+             int ipar[], int *nipar, double *inptr[], int insz[], int *nin, double *outptr[], int outsz[], int *nout, void *scsptr);
 
 #endif /* __SCIBLK2_H__ */
 /*--------------------------------------------------------------------------*/
index 6ff0f6a..b8f515e 100644 (file)
@@ -3877,7 +3877,8 @@ void callf(double *t, scicos_block *block, scicos_flag *flag)
                         block->evout, &block->nevout, block->rpar, &block->nrpar,
                         block->ipar, &block->nipar, (double **)block->inptr,
                         block->insz, &block->nin,
-                        (double **)block->outptr, block->outsz, &block->nout);
+                        (double **)block->outptr, block->outsz, &block->nout,
+                        block->scsptr);
             }
             /* with zero crossing */
             else
@@ -3889,6 +3890,7 @@ void callf(double *t, scicos_block *block, scicos_flag *flag)
                          block->ipar, &block->nipar, (double **)block->inptr,
                          block->insz, &block->nin,
                          (double **)block->outptr, block->outsz, &block->nout,
+                         block->scsptr,
                          block->g, &block->ng);
             }
 
index 4916f43..936437f 100644 (file)
@@ -280,6 +280,7 @@ lib /DEF:"$(ProjectDir)differential_equations_f_Import.def" /SUBSYSTEM:WINDOWS /
     <ClCompile Include="..\..\sci_gateway\cpp\sci_vec2var.cpp" />
     <ClCompile Include="..\cpp\createblklist.cpp" />
     <ClCompile Include="..\cpp\extractblklist.cpp" />
+    <ClCompile Include="..\cpp\sciblk2.cpp" />
     <ClCompile Include="..\cpp\sciblk4.cpp" />
     <ClCompile Include="..\cpp\copyvarfromtlist.cpp" />
     <ClCompile Include="..\cpp\var2vec.cpp" />
@@ -315,7 +316,6 @@ lib /DEF:"$(ProjectDir)differential_equations_f_Import.def" /SUBSYSTEM:WINDOWS /
     <ClCompile Include="..\..\sci_gateway\c\sci_ftree4.c" />
     <ClCompile Include="..\..\sci_gateway\c\sci_loadScicos.c" />
     <ClCompile Include="..\..\sci_gateway\c\sci_sctree.c" />
-    <ClCompile Include="sciblk2.c" />
     <ClCompile Include="scicos.c" />
     <ClCompile Include="scicos_free.c" />
     <ClCompile Include="scicos_malloc.c" />
index a4101ba..8bbf606 100644 (file)
@@ -80,9 +80,6 @@
     <ClCompile Include="..\..\sci_gateway\c\sci_sctree.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="sciblk2.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="scicos.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\cpp\createblklist.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\cpp\sciblk2.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
     <ClCompile Include="..\cpp\sciblk4.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
diff --git a/scilab/modules/scicos/src/cpp/sciblk2.cpp b/scilab/modules/scicos/src/cpp/sciblk2.cpp
new file mode 100644 (file)
index 0000000..55e842e
--- /dev/null
@@ -0,0 +1,244 @@
+/*  Scicos
+*
+*  Copyright (C) 2015 - Scilab Enterprises - Paul Bignier
+*  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+* See the file ./license.txt
+*/
+/*--------------------------------------------------------------------------*/
+#include <vector>
+#include <algorithm>
+#include <cstring>
+
+#include "var2vec.hxx"
+#include "vec2var.hxx"
+
+#include "internal.hxx"
+#include "callable.hxx"
+#include "list.hxx"
+#include "double.hxx"
+#include "function.hxx"
+#include "execvisitor.hxx"
+
+extern "C"
+{
+#include "sciblk2.h"
+#include "scicos.h" /* set_block_error() */
+}
+
+static double toDouble(const int i)
+{
+    return static_cast<double>(i);
+}
+
+static void setErrAndFree(const int flag, types::typed_list out)
+{
+    set_block_error(flag);
+    for (size_t i = 0; i < out.size(); ++i)
+    {
+        out[i]->killMe();
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+void sciblk2(int* flag, int* nevprt, double* t, double xd[], double x[], int* nx, double z[], int* nz, double tvec[], int* ntvec, double rpar[], int* nrpar,
+             int ipar[], int* nipar, double* inptr[], int insz[], int* nin, double* outptr[], int outsz[], int* nout, void* scsptr)
+{
+    types::typed_list in(8), out;
+
+    types::Double* Flag = new types::Double(*flag);
+    in[0] = Flag;
+
+    types::Double* Nevprt = new types::Double(*nevprt);
+    in[1] = Nevprt;
+
+    types::Double* T = new types::Double(*t);
+    in[2] = T;
+
+    types::Double* X = new types::Double(*nx, 1);
+    memcpy(X->get(), x, *nx * sizeof(double));
+    in[3] = X;
+
+    types::InternalType* Z;
+    if (*nz == 0)
+    {
+        Z = types::Double::Empty();
+    }
+    else
+    {
+        if (!vec2var(std::vector<double>(z, z + *nz), Z))
+        {
+            setErrAndFree(-1, out);
+            return;
+        }
+        if (!Z->isDouble())
+        {
+            setErrAndFree(-1, out);
+            return;
+        }
+        //types::Double* Z = new types::Double(*nz, 1);
+        //memcpy(Z->get(), z, *nz * sizeof(double));
+    }
+    in[4] = Z->getAs<types::Double>();
+
+    types::Double* Rpar = new types::Double(*nrpar, 1);
+    memcpy(Rpar->get(), rpar, *nrpar * sizeof(double));
+    in[5] = Rpar;
+
+    // Treating 'ipar' differently because it is an int tab, unlike the other double ones
+    types::Double* Ipar = new types::Double(*nipar, 1);
+    std::transform(ipar, ipar + *nipar, Ipar, toDouble);
+    in[6] = Ipar;
+
+    types::List* Nin = new types::List();
+    for (int i = 0; i < *nin; ++i)
+    {
+        int nu = insz[i];
+        int nu2 = insz[*nin + i];
+        types::Double* U = new types::Double(nu, nu2);
+        memcpy(U->get(), inptr[i], nu * nu2 * sizeof(double));
+        Nin->append(U);
+    }
+    in[7] = Nin;
+
+    /***********************
+    * Call Scilab function *
+    ***********************/
+    ast::ExecVisitor exec;
+    types::Callable* pCall = static_cast<types::Callable*>(scsptr);
+
+    try
+    {
+        types::optional_list opt;
+        if (pCall->call(in, opt, 5, out, &exec) != types::Function::OK)
+        {
+            setErrAndFree(-1, out);
+            return;
+        }
+
+        if (out.size() != 5)
+        {
+            setErrAndFree(-1, out);
+            return;
+        }
+    }
+    catch (ast::ScilabMessage& /*sm*/)
+    {
+        setErrAndFree(-1, out);
+        return;
+    }
+
+    switch (*flag)
+    {
+        case 1 :
+        case 2 :
+        case 4 :
+        case 5 :
+        case 6 :
+        {
+            if (!out[2]->isDouble())
+            {
+                setErrAndFree(-1, out);
+                return;
+            }
+            std::vector<double> Zout;
+            if (!var2vec(out[2], Zout))
+            {
+                setErrAndFree(-1, out);
+                return;
+            }
+            memcpy(z, &Zout[0], *nz * sizeof(double));
+
+            if (!out[3]->isDouble())
+            {
+                setErrAndFree(-1, out);
+                return;
+            }
+            types::Double* Xout = out[3]->getAs<types::Double>();
+            memcpy(x, Xout->get(), *nx * sizeof(double));
+
+            if (*nout != 0)
+            {
+                if (!out[4]->isList())
+                {
+                    setErrAndFree(-1, out);
+                    return;
+                }
+                types::List* Yout = out[4]->getAs<types::List>();
+                if (Yout->getSize() < *nout)
+                {
+                    // Consider that 'outptr' has not been defined in the macro: do not update the current 'outptr'
+                    break;
+                }
+                for (int k = *nout - 1; k >= 0; --k)
+                {
+                    if (!Yout->get(k)->isDouble())
+                    {
+                        setErrAndFree(-1, out);
+                        return;
+                    }
+                    types::Double* KthElement = Yout->get(k)->getAs<types::Double>();
+                    double* y = (double*)outptr[k];
+                    int ny = outsz[k];
+                    int ny2 = 1;
+                    if (*flag == 1)
+                    {
+                        ny2 = outsz[*nout + k];
+                    }
+                    memcpy(y, KthElement->get(), ny * ny2 * sizeof(double));
+                }
+            }
+            break;
+        }
+
+        case 0 :
+            /*  x'  computation */
+        {
+            if (!out[0]->isDouble())
+            {
+                setErrAndFree(-1, out);
+                return;
+            }
+            types::Double* XDout = out[0]->getAs<types::Double>();
+            memcpy(xd, XDout->get(), *nx * sizeof(double));
+            break;
+        }
+
+        case 3 :
+        {
+            if (!out[1]->isDouble())
+            {
+                setErrAndFree(-1, out);
+                return;
+            }
+            types::Double* Tout = out[1]->getAs<types::Double>();
+            memcpy(tvec, Tout->get(), *ntvec * sizeof(double));
+            break;
+        }
+
+        default :
+        {
+            setErrAndFree(-1, out);
+            return;
+        }
+    }
+
+    for (size_t i = 0; i < out.size(); ++i)
+    {
+        out[i]->killMe();
+    }
+}
diff --git a/scilab/modules/scicos/tests/unit_tests/pendulum_anim5.cosf b/scilab/modules/scicos/tests/unit_tests/pendulum_anim5.cosf
new file mode 100644 (file)
index 0000000..8bdfd4d
--- /dev/null
@@ -0,0 +1,1639 @@
+scs_m=scicos_diagram(..
+      version="scicos4.3",..
+      props=scicos_params(..
+            wpar=[600,450,0,0,600,450],..
+            Title="pendulum_anim5",..
+            tol=[0.000001;0.000001;1.000D-10;100001;0.1;1;0],..
+            tf=30,..
+            context=["M=10;";
+            "m=3;";
+            "l=3;";
+            "ph=0.1;";
+            "for i=1:length(scs_m.objs)";
+            " if typeof(scs_m.objs(i)) == ''Block'' then";
+            " if scs_m.objs(i).gui==''SUPER_f'' then";
+            " scs_m=scs_m.objs(i).model.rpar;";
+            " break;";
+            " end";
+            " end";
+            "end";
+            "[X,U,Y,XP]=steadycos(scs_m,[],[],[],[],1,1:$);";
+            "sys= lincos(scs_m,X,U);";
+            "Kc=-ppol(sys.A,sys.B,[-1,-1,-1,-1]);";
+            "Kf=-ppol(sys.A'',sys.C'',[-2,-2,-2,-2]);Kf=Kf'';";
+            "Contr=obscont(sys,Kc,Kf);";
+            "clear(''scs_m'',''X'',''Y'',''XP'',''Kc'',''Kp'',''sys'',''%cpr'');";
+            "z0=-4;";
+            "th0=.02;"],..
+            void1=[],..
+            options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],..
+            list([5,1],[4,1]),[0.8,0.8,0.8]),..
+            void2=[],..
+            void3=[],..
+            doc=list()))
+scs_m.objs(1)=scicos_block(..
+              gui="CONST_f",..
+              graphics=scicos_graphics(..
+                       orig=[-3.24962,-71.03729],..
+                       sz=[40,40],..
+                       flip=%t,..
+                       theta=-180,..
+                       exprs="U",..
+                       pin=[],..
+                       pout=33,..
+                       pein=[],..
+                       peout=[],..
+                       gr_i=list("xstringb(orig(1),orig(2),""CONST_f"",sz(1),sz(2));",8),..
+                       id="",..
+                       in_implicit=[],..
+                       out_implicit="E",..
+                       in_style=[],..
+                       out_style="ExplicitOutputPort;rotation=180;flip=false;mirror=false",..
+                       in_label=[],..
+                       out_label="",..
+                       style="CONST_f;rotation=180;flip=false;mirror=false"),..
+              model=scicos_model(..
+                       sim=list("cstblk",1),..
+                       in=[],..
+                       in2=[],..
+                       intyp=[],..
+                       out=1,..
+                       out2=-2,..
+                       outtyp=1,..
+                       evtin=[],..
+                       evtout=[],..
+                       state=[],..
+                       dstate=[],..
+                       odstate=[],..
+                       rpar=12.731756,..
+                       ipar=[],..
+                       opar=list(),..
+                       blocktype="d",..
+                       firing=[],..
+                       dep_ut=[%f,%f],..
+                       label="",..
+                       nzcross=0,..
+                       nmode=0,..
+                       equations=list(),..
+                       uid="fa5a0fb:12507670d3c:-7b81"),..
+              doc=list("fa5a0fb:12507670d3c:-7b81"))
+scs_m.objs(2)=scicos_block(..
+              gui="CMSCOPE",..
+              graphics=scicos_graphics(..
+                       orig=[307.04788,-117.47024],..
+                       sz=[50,40],..
+                       flip=%t,..
+                       theta=0,..
+                       exprs=["1 1 1";
+                       "1 3 5 7 9 11 13 15";
+                       "1";
+                       "[]";
+                       "[]";
+                       "-10 -1 -10";
+                       "10 1 70";
+                       "30 30 30";
+                       "20";
+                       "0";
+                       ""],..
+                       pin=[24;27;22],..
+                       pout=[],..
+                       pein=19,..
+                       peout=[],..
+                       gr_i=list("xstringb(orig(1),orig(2),""CMSCOPE"",sz(1),sz(2));",8),..
+                       id="",..
+                       in_implicit=["E";"E";"E"],..
+                       out_implicit=[],..
+                       in_style=["ExplicitInputPort;rotation=0;flip=false;mirror=false";
+                       "ExplicitInputPort;rotation=0;flip=false;mirror=false";
+                       "ExplicitInputPort;rotation=0;flip=false;mirror=false"],..
+                       out_style=[],..
+                       in_label=["";"";""],..
+                       out_label=[],..
+                       style="CMSCOPE;rotation=0;flip=false;mirror=false"),..
+              model=scicos_model(..
+                       sim=list("cmscope",4),..
+                       in=[1;1;1],..
+                       in2=[1;1;1],..
+                       intyp=[1;1;1],..
+                       out=[],..
+                       out2=[],..
+                       outtyp=[],..
+                       evtin=-1,..
+                       evtout=[],..
+                       state=[],..
+                       dstate=[],..
+                       odstate=[],..
+                       rpar=[0;30;30;30;-10;10;-1;1;-10;70],..
+                       ipar=[1;3;20;-1;-1;-1;-1;1;1;1;1;3;5;0],..
+                       opar=list(),..
+                       blocktype="c",..
+                       firing=[],..
+                       dep_ut=[%t,%f],..
+                       label="",..
+                       nzcross=0,..
+                       nmode=0,..
+                       equations=list(),..
+                       uid="fa5a0fb:12507670d3c:-7b80"),..
+              doc=list("fa5a0fb:12507670d3c:-7b80"))
+scs_m_1=scicos_diagram(..
+        version="scicos4.3",..
+        props=scicos_params(..
+              wpar=[600,450,0,0,600,450],..
+              Title="Untitled",..
+              tol=[0.0001;0.000001;1.000D-10;100001;0;0;0],..
+              tf=100000,..
+              context="",..
+              void1=[],..
+              options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],..
+              list([5,1],[4,1]),[0.8,0.8,0.8]),..
+              void2=[],..
+              void3=[],..
+              doc=list()))
+scs_m_1.objs(1)=scicos_block(..
+                gui="CLKOUT_f",..
+                graphics=scicos_graphics(..
+                         orig=[79,-140],..
+                         sz=[40,40],..
+                         flip=%t,..
+                         theta=0,..
+                         exprs="1",..
+                         pin=[],..
+                         pout=[],..
+                         pein=5,..
+                         peout=[],..
+                         gr_i=list("xstringb(orig(1),orig(2),""CLKOUT_f"",sz(1),sz(2));",8),..
+                         id="",..
+                         in_implicit=[],..
+                         out_implicit=[],..
+                         in_style=[],..
+                         out_style=[],..
+                         in_label=[],..
+                         out_label=[],..
+                         style="CLKOUT_f"),..
+                model=scicos_model(..
+                         sim="output",..
+                         in=[],..
+                         in2=[],..
+                         intyp=[],..
+                         out=[],..
+                         out2=[],..
+                         outtyp=[],..
+                         evtin=-1,..
+                         evtout=[],..
+                         state=[],..
+                         dstate=[],..
+                         odstate=list(),..
+                         rpar=[],..
+                         ipar=1,..
+                         opar=list(),..
+                         blocktype="d",..
+                         firing=[],..
+                         dep_ut=[%f,%f],..
+                         label="",..
+                         nzcross=0,..
+                         nmode=0,..
+                         equations=list(),..
+                         uid="-7ea004eb:12577f592d7:-6eff"),..
+                doc=list("-7ea004eb:12577f592d7:-6eff"))
+scs_m_1.objs(2)=scicos_block(..
+                gui="EVTDLY_f",..
+                graphics=scicos_graphics(..
+                         orig=[0,-70],..
+                         sz=[40,40],..
+                         flip=%t,..
+                         theta=0,..
+                         exprs=[".1";"0"],..
+                         pin=[],..
+                         pout=[],..
+                         pein=6,..
+                         peout=4,..
+                         gr_i=list("xstringb(orig(1),orig(2),""EVTDLY_f"",sz(1),sz(2));",8),..
+                         id="",..
+                         in_implicit=[],..
+                         out_implicit=[],..
+                         in_style=[],..
+                         out_style=[],..
+                         in_label=[],..
+                         out_label=[],..
+                         style="EVTDLY_f"),..
+                model=scicos_model(..
+                         sim="evtdly",..
+                         in=[],..
+                         in2=[],..
+                         intyp=[],..
+                         out=[],..
+                         out2=[],..
+                         outtyp=[],..
+                         evtin=-1,..
+                         evtout=-1,..
+                         state=[],..
+                         dstate=[],..
+                         odstate=list(),..
+                         rpar=0.1,..
+                         ipar=[],..
+                         opar=list(),..
+                         blocktype="d",..
+                         firing=0,..
+                         dep_ut=[%f,%f],..
+                         label="",..
+                         nzcross=0,..
+                         nmode=0,..
+                         equations=list(),..
+                         uid="-7ea004eb:12577f592d7:-6efb"),..
+                doc=list("-7ea004eb:12577f592d7:-6efb"))
+scs_m_1.objs(3)=scicos_block(..
+                gui="CLKSPLIT_f",..
+                graphics=scicos_graphics(..
+                         orig=[93.71066,-163],..
+                         sz=[7,7],..
+                         flip=%t,..
+                         theta=0,..
+                         exprs=[],..
+                         pin=[],..
+                         pout=[],..
+                         pein=4,..
+                         peout=[5;6],..
+                         gr_i=list("xstringb(orig(1),orig(2),""CLKSPLIT_f"",sz(1),sz(2));",8),..
+                         id="",..
+                         in_implicit=[],..
+                         out_implicit=[],..
+                         in_style=[],..
+                         out_style=[],..
+                         in_label=[],..
+                         out_label=[],..
+                         style="CLKSPLIT_f"),..
+                model=scicos_model(..
+                         sim="split",..
+                         in=[],..
+                         in2=[],..
+                         intyp=[],..
+                         out=[],..
+                         out2=[],..
+                         outtyp=[],..
+                         evtin=-1,..
+                         evtout=[-1;-1],..
+                         state=[],..
+                         dstate=[],..
+                         odstate=list(),..
+                         rpar=[],..
+                         ipar=[],..
+                         opar=list(),..
+                         blocktype="d",..
+                         firing=[-1;-1],..
+                         dep_ut=[%f,%f],..
+                         label="",..
+                         nzcross=0,..
+                         nmode=0,..
+                         equations=list(),..
+                         uid="-7ea004eb:12577f592d7:-6ef6"),..
+                doc=list("-7ea004eb:12577f592d7:-6ef6"))
+scs_m_1.objs(4)=scicos_link(..
+                  xx=[60;60;104.21066],..
+                  yy=[-74;-170;-152],..
+                  id="drawlink",..
+                  thick=[0,0],..
+                  ct=[5,-1],..
+                  from=[2,1,0],..
+                  to=[3,1,1])
+scs_m_1.objs(5)=scicos_link(..
+                  xx=[103.04399;139],..
+                  yy=[-167;-96],..
+                  id="drawlink",..
+                  thick=[0,0],..
+                  ct=[5,-1],..
+                  from=[3,1,0],..
+                  to=[1,1,1])
+scs_m_1.objs(6)=scicos_link(..
+                  xx=[105.37733;100.71;60;60],..
+                  yy=[-167;-40;-40;-26],..
+                  id="drawlink",..
+                  thick=[0,0],..
+                  ct=[5,-1],..
+                  from=[3,2,0],..
+                  to=[2,1,1])
+scs_m.objs(3)=scicos_block(..
+              gui="CLOCK_f",..
+              graphics=scicos_graphics(..
+                       orig=[322.04788,-20],..
+                       sz=[40,40],..
+                       flip=%t,..
+                       theta=0,..
+                       exprs=[],..
+                       pin=[],..
+                       pout=[],..
+                       pein=[],..
+                       peout=15,..
+                       gr_i=list("xstringb(orig(1),orig(2),""CLOCK_f"",sz(1),sz(2));",8),..
+                       id="",..
+                       in_implicit=[],..
+                       out_implicit=[],..
+                       in_style=[],..
+                       out_style=[],..
+                       in_label=[],..
+                       out_label=[],..
+                       style="CLOCK_f;rotation=0;flip=false;mirror=false"),..
+              model=scicos_model(..
+                       sim="csuper",..
+                       in=[],..
+                       in2=[],..
+                       intyp=[],..
+                       out=[],..
+                       out2=[],..
+                       outtyp=[],..
+                       evtin=[],..
+                       evtout=-1,..
+                       state=[],..
+                       dstate=[],..
+                       odstate=[],..
+                       rpar=scs_m_1,..
+                       ipar=[],..
+                       opar=list(),..
+                       blocktype="h",..
+                       firing=-1,..
+                       dep_ut=[%f,%f],..
+                       label="",..
+                       nzcross=0,..
+                       nmode=0,..
+                       equations=list(),..
+                       uid="fa5a0fb:12507670d3c:-7b7f"),..
+              doc=list("fa5a0fb:12507670d3c:-7b7f"))
+scs_m_1=scicos_diagram(..
+        version="scicos4.3",..
+        props=scicos_params(..
+              wpar=[600,450,0,0,600,450],..
+              Title="non_lin",..
+              tol=[0.0001;0.000001;1.000D-10;100001;0;0;0],..
+              tf=30,..
+              context="",..
+              void1=[],..
+              options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],..
+              list([5,1],[4,1]),[0.8,0.8,0.8]),..
+              void2=[],..
+              void3=[],..
+              doc=list()))
+scs_m_1.objs(1)=scicos_block(..
+                gui="CBLOCK",..
+                graphics=scicos_graphics(..
+                         orig=[114.1369,-75.29762],..
+                         sz=[60,40],..
+                         flip=%t,..
+                         theta=0,..
+                         exprs=list(..
+                         ["inv_pend";
+                         "n";
+                         "1 1 1";
+                         "1 1";
+                         "[]";
+                         "[]";
+                         "[]";
+                         "0";
+                         "[]";
+                         "[M m l ph]";
+                         "[]";
+                         "[]";
+                         "y";
+                         "n"],..
+                         ["#include <math.h>";
+                         "#include <scicos_block.h>";
+                         "void inv_pend(scicos_block *block,int flag)";
+                         "{";
+                         "double M,m,l,g,ph,th,thd,zdd,thdd,u,delta;";
+                         "M=block->rpar[0];";
+                         "m=block->rpar[1];";
+                         "l=block->rpar[2];";
+                         "ph=block->rpar[3];";
+                         "g=9.81;";
+                         "th=block->inptr[0][0];";
+                         "thd=block->inptr[1][0];";
+                         "u=block->inptr[2][0];";
+                         "";
+                         "";
+                         "delta=M*m*l*l+m*m*l*l*pow(sin(th-ph),2);";
+                         "zdd=(m*l*l*(m*l*thd*thd*sin(th-ph)+u-";
+                         "(M+m)*g*sin(ph))-m*m*l*l*g*sin(th)*cos(th-ph))/delta;";
+                         "thdd=(-m*l*cos(th-ph)*(m*l*thd*thd*sin(th-ph)+u-";
+                         "(M+m)*g*sin(ph))+(M+m)*m*g*l*sin(th))/delta;";
+                         "block->outptr[0][0]=zdd;";
+                         "block->outptr[1][0]=thdd;";
+                         "}"]),..
+                         pin=[18;17;19],..
+                         pout=[11;14],..
+                         pein=[],..
+                         peout=[],..
+                         gr_i=list("xstringb(orig(1),orig(2),""CBLOCK"",sz(1),sz(2));",8),..
+                         id="",..
+                         in_implicit=["E";"E";"E"],..
+                         out_implicit=["E";"E"],..
+                         in_style=["ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0";
+                         "ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0";
+                         "ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0"],..
+                         out_style=["ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0";
+                         "ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0"],..
+                         in_label=["";"";""],..
+                         out_label=["";""],..
+                         style="CBLOCK"),..
+                model=scicos_model(..
+                         sim=list("inv_pend",-1),..
+                         in=[1;1;1],..
+                         in2=[1;1;1],..
+                         intyp=[1;1;1],..
+                         out=[1;1],..
+                         out2=[1;1],..
+                         outtyp=[1;1],..
+                         evtin=[],..
+                         evtout=[],..
+                         state=[],..
+                         dstate=[],..
+                         odstate=list(),..
+                         rpar=[10;3;3;0.1],..
+                         ipar=[],..
+                         opar=list(),..
+                         blocktype="c",..
+                         firing=[],..
+                         dep_ut=[%t,%f],..
+                         label="",..
+                         nzcross=0,..
+                         nmode=0,..
+                         equations=list(),..
+                         uid="-7ea004eb:12577f592d7:-6ee9"),..
+                doc=list("-7ea004eb:12577f592d7:-6ee9"))
+scs_m_1.objs(2)=scicos_block(..
+                gui="INTEGRAL",..
+                graphics=scicos_graphics(..
+                         orig=[237.55952,-50],..
+                         sz=[40,40],..
+                         flip=%t,..
+                         theta=0,..
+                         exprs=["0";"0";"0";"1";"-1"],..
+                         pin=11,..
+                         pout=12,..
+                         pein=[],..
+                         peout=[],..
+                         gr_i=list("xstringb(orig(1),orig(2),""INTEGRAL"",sz(1),sz(2));",8),..
+                         id="",..
+                         in_implicit="E",..
+                         out_implicit="E",..
+                         in_style="ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0",..
+                         out_style="ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0",..
+                         in_label="",..
+                         out_label="",..
+                         style="INTEGRAL"),..
+                model=scicos_model(..
+                         sim=list("integral_func",4),..
+                         in=1,..
+                         in2=1,..
+                         intyp=1,..
+                         out=1,..
+                         out2=1,..
+                         outtyp=1,..
+                         evtin=[],..
+                         evtout=[],..
+                         state=0,..
+                         dstate=[],..
+                         odstate=list(),..
+                         rpar=[],..
+                         ipar=[],..
+                         opar=list(),..
+                         blocktype="c",..
+                         firing=[],..
+                         dep_ut=[%f,%t],..
+                         label="",..
+                         nzcross=0,..
+                         nmode=0,..
+                         equations=list(),..
+                         uid="-7ea004eb:12577f592d7:-6ee5"),..
+                doc=list("-7ea004eb:12577f592d7:-6ee5"))
+scs_m_1.objs(3)=scicos_block(..
+                gui="INTEGRAL",..
+                graphics=scicos_graphics(..
+                         orig=[320.89286,-50],..
+                         sz=[40,40],..
+                         flip=%t,..
+                         theta=0,..
+                         exprs=["z0";"0";"0";"1";"-1"],..
+                         pin=12,..
+                         pout=20,..
+                         pein=[],..
+                         peout=[],..
+                         gr_i=list("xstringb(orig(1),orig(2),""INTEGRAL"",sz(1),sz(2));",8),..
+                         id="",..
+                         in_implicit="E",..
+                         out_implicit="E",..
+                         in_style="ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0",..
+                         out_style="ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0",..
+                         in_label="",..
+                         out_label="",..
+                         style="INTEGRAL"),..
+                model=scicos_model(..
+                         sim=list("integral_func",4),..
+                         in=1,..
+                         in2=1,..
+                         intyp=1,..
+                         out=1,..
+                         out2=1,..
+                         outtyp=1,..
+                         evtin=[],..
+                         evtout=[],..
+                         state=-4,..
+                         dstate=[],..
+                         odstate=list(),..
+                         rpar=[],..
+                         ipar=[],..
+                         opar=list(),..
+                         blocktype="c",..
+                         firing=[],..
+                         dep_ut=[%f,%t],..
+                         label="",..
+                         nzcross=0,..
+                         nmode=0,..
+                         equations=list(),..
+                         uid="-7ea004eb:12577f592d7:-6ee1"),..
+                doc=list("-7ea004eb:12577f592d7:-6ee1"))
+scs_m_1.objs(4)=scicos_block(..
+                gui="INTEGRAL",..
+                graphics=scicos_graphics(..
+                         orig=[237.55952,-132.58929],..
+                         sz=[40,40],..
+                         flip=%t,..
+                         theta=0,..
+                         exprs=["0";"0";"0";"1";"-1"],..
+                         pin=14,..
+                         pout=13,..
+                         pein=[],..
+                         peout=[],..
+                         gr_i=list("xstringb(orig(1),orig(2),""INTEGRAL"",sz(1),sz(2));",8),..
+                         id="",..
+                         in_implicit="E",..
+                         out_implicit="E",..
+                         in_style="ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0",..
+                         out_style="ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0",..
+                         in_label="",..
+                         out_label="",..
+                         style="INTEGRAL"),..
+                model=scicos_model(..
+                         sim=list("integral_func",4),..
+                         in=1,..
+                         in2=1,..
+                         intyp=1,..
+                         out=1,..
+                         out2=1,..
+                         outtyp=1,..
+                         evtin=[],..
+                         evtout=[],..
+                         state=0,..
+                         dstate=[],..
+                         odstate=list(),..
+                         rpar=[],..
+                         ipar=[],..
+                         opar=list(),..
+                         blocktype="c",..
+                         firing=[],..
+                         dep_ut=[%f,%t],..
+                         label="",..
+                         nzcross=0,..
+                         nmode=0,..
+                         equations=list(),..
+                         uid="-7ea004eb:12577f592d7:-6edd"),..
+                doc=list("-7ea004eb:12577f592d7:-6edd"))
+scs_m_1.objs(5)=scicos_block(..
+                gui="INTEGRAL",..
+                graphics=scicos_graphics(..
+                         orig=[320.89286,-132.58929],..
+                         sz=[40,40],..
+                         flip=%t,..
+                         theta=0,..
+                         exprs=["th0";"0";"0";"1";"-1"],..
+                         pin=16,..
+                         pout=15,..
+                         pein=[],..
+                         peout=[],..
+                         gr_i=list("xstringb(orig(1),orig(2),""INTEGRAL"",sz(1),sz(2));",8),..
+                         id="",..
+                         in_implicit="E",..
+                         out_implicit="E",..
+                         in_style="ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0",..
+                         out_style="ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0",..
+                         in_label="",..
+                         out_label="",..
+                         style="INTEGRAL"),..
+                model=scicos_model(..
+                         sim=list("integral_func",4),..
+                         in=1,..
+                         in2=1,..
+                         intyp=1,..
+                         out=1,..
+                         out2=1,..
+                         outtyp=1,..
+                         evtin=[],..
+                         evtout=[],..
+                         state=0.02,..
+                         dstate=[],..
+                         odstate=list(),..
+                         rpar=[],..
+                         ipar=[],..
+                         opar=list(),..
+                         blocktype="c",..
+                         firing=[],..
+                         dep_ut=[%f,%t],..
+                         label="",..
+                         nzcross=0,..
+                         nmode=0,..
+                         equations=list(),..
+                         uid="-7ea004eb:12577f592d7:-6ed9"),..
+                doc=list("-7ea004eb:12577f592d7:-6ed9"))
+scs_m_1.objs(6)=scicos_block(..
+                gui="SPLIT_f",..
+                graphics=scicos_graphics(..
+                         orig=[333.05952,-145.58929],..
+                         sz=[7,7],..
+                         flip=%t,..
+                         theta=0,..
+                         exprs=[],..
+                         pin=13,..
+                         pout=[16;17;0],..
+                         pein=[],..
+                         peout=[],..
+                         gr_i=list("xstringb(orig(1),orig(2),""SPLIT_f"",sz(1),sz(2));",8),..
+                         id="",..
+                         in_implicit="E",..
+                         out_implicit=["E";"E";"E"],..
+                         in_style="ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0",..
+                         out_style=["ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0";
+                         "ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0";
+                         "ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0"],..
+                         in_label="",..
+                         out_label=["";"";""],..
+                         style="SPLIT_f"),..
+                model=scicos_model(..
+                         sim="lsplit",..
+                         in=-1,..
+                         in2=1,..
+                         intyp=1,..
+                         out=[-1;-1;-1],..
+                         out2=[1;1;1],..
+                         outtyp=[1;1;1],..
+                         evtin=[],..
+                         evtout=[],..
+                         state=[],..
+                         dstate=[],..
+                         odstate=list(),..
+                         rpar=[],..
+                         ipar=[],..
+                         opar=list(),..
+                         blocktype="c",..
+                         firing=[],..
+                         dep_ut=[%t,%f],..
+                         label="",..
+                         nzcross=0,..
+                         nmode=0,..
+                         equations=list(),..
+                         uid="-7ea004eb:12577f592d7:-6ed3"),..
+                doc=list("-7ea004eb:12577f592d7:-6ed3"))
+scs_m_1.objs(7)=scicos_block(..
+                gui="SPLIT_f",..
+                graphics=scicos_graphics(..
+                         orig=[419.36905,-146.33334],..
+                         sz=[7,7],..
+                         flip=%t,..
+                         theta=0,..
+                         exprs=[],..
+                         pin=15,..
+                         pout=[18;21;0],..
+                         pein=[],..
+                         peout=[],..
+                         gr_i=list("xstringb(orig(1),orig(2),""SPLIT_f"",sz(1),sz(2));",8),..
+                         id="",..
+                         in_implicit="E",..
+                         out_implicit=["E";"E";"E"],..
+                         in_style="ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0",..
+                         out_style=["ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0";
+                         "ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0";
+                         "ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0"],..
+                         in_label="",..
+                         out_label=["";"";""],..
+                         style="SPLIT_f"),..
+                model=scicos_model(..
+                         sim="lsplit",..
+                         in=-1,..
+                         in2=1,..
+                         intyp=1,..
+                         out=[-1;-1;-1],..
+                         out2=[1;1;1],..
+                         outtyp=[1;1;1],..
+                         evtin=[],..
+                         evtout=[],..
+                         state=[],..
+                         dstate=[],..
+                         odstate=list(),..
+                         rpar=[],..
+                         ipar=[],..
+                         opar=list(),..
+                         blocktype="c",..
+                         firing=[],..
+                         dep_ut=[%t,%f],..
+                         label="",..
+                         nzcross=0,..
+                         nmode=0,..
+                         equations=list(),..
+                         uid="-7ea004eb:12577f592d7:-6ecd"),..
+                doc=list("-7ea004eb:12577f592d7:-6ecd"))
+scs_m_1.objs(8)=scicos_block(..
+                gui="IN_f",..
+                graphics=scicos_graphics(..
+                         orig=[0,-75.29762],..
+                         sz=[40,40],..
+                         flip=%t,..
+                         theta=0,..
+                         exprs="1",..
+                         pin=[],..
+                         pout=19,..
+                         pein=[],..
+                         peout=[],..
+                         gr_i=list("xstringb(orig(1),orig(2),""IN_f"",sz(1),sz(2));",8),..
+                         id="",..
+                         in_implicit=[],..
+                         out_implicit="E",..
+                         in_style=[],..
+                         out_style="ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0",..
+                         in_label=[],..
+                         out_label="",..
+                         style="IN_f"),..
+                model=scicos_model(..
+                         sim="input",..
+                         in=[],..
+                         in2=[],..
+                         intyp=[],..
+                         out=-1,..
+                         out2=-2,..
+                         outtyp=1,..
+                         evtin=[],..
+                         evtout=[],..
+                         state=[],..
+                         dstate=[],..
+                         odstate=list(),..
+                         rpar=[],..
+                         ipar=1,..
+                         opar=list(),..
+                         blocktype="c",..
+                         firing=[],..
+                         dep_ut=[%f,%f],..
+                         label="",..
+                         nzcross=0,..
+                         nmode=0,..
+                         equations=list(),..
+                         uid="-7ea004eb:12577f592d7:-6eca"),..
+                doc=list("-7ea004eb:12577f592d7:-6eca"))
+scs_m_1.objs(9)=scicos_block(..
+                gui="OUT_f",..
+                graphics=scicos_graphics(..
+                         orig=[389.46428,-40],..
+                         sz=[40,40],..
+                         flip=%t,..
+                         theta=0,..
+                         exprs="1",..
+                         pin=20,..
+                         pout=[],..
+                         pein=[],..
+                         peout=[],..
+                         gr_i=list("xstringb(orig(1),orig(2),""OUT_f"",sz(1),sz(2));",8),..
+                         id="",..
+                         in_implicit="E",..
+                         out_implicit=[],..
+                         in_style="ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0",..
+                         out_style=[],..
+                         in_label="",..
+                         out_label=[],..
+                         style="OUT_f"),..
+                model=scicos_model(..
+                         sim="output",..
+                         in=-1,..
+                         in2=-2,..
+                         intyp=-1,..
+                         out=[],..
+                         out2=[],..
+                         outtyp=[],..
+                         evtin=[],..
+                         evtout=[],..
+                         state=[],..
+                         dstate=[],..
+                         odstate=list(),..
+                         rpar=[],..
+                         ipar=1,..
+                         opar=list(),..
+                         blocktype="c",..
+                         firing=[],..
+                         dep_ut=[%f,%f],..
+                         label="",..
+                         nzcross=0,..
+                         nmode=0,..
+                         equations=list(),..
+                         uid="-7ea004eb:12577f592d7:-6ec7"),..
+                doc=list("-7ea004eb:12577f592d7:-6ec7"))
+scs_m_1.objs(10)=scicos_block(..
+                 gui="OUT_f",..
+                 graphics=scicos_graphics(..
+                          orig=[406.36905,-123.33334],..
+                          sz=[40,40],..
+                          flip=%t,..
+                          theta=0,..
+                          exprs="2",..
+                          pin=21,..
+                          pout=[],..
+                          pein=[],..
+                          peout=[],..
+                          gr_i=list("xstringb(orig(1),orig(2),""OUT_f"",sz(1),sz(2));",8),..
+                          id="",..
+                          in_implicit="E",..
+                          out_implicit=[],..
+                          in_style="ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0",..
+                          out_style=[],..
+                          in_label="",..
+                          out_label=[],..
+                          style="OUT_f"),..
+                 model=scicos_model(..
+                          sim="output",..
+                          in=-1,..
+                          in2=-2,..
+                          intyp=-1,..
+                          out=[],..
+                          out2=[],..
+                          outtyp=[],..
+                          evtin=[],..
+                          evtout=[],..
+                          state=[],..
+                          dstate=[],..
+                          odstate=list(),..
+                          rpar=[],..
+                          ipar=2,..
+                          opar=list(),..
+                          blocktype="c",..
+                          firing=[],..
+                          dep_ut=[%f,%f],..
+                          label="",..
+                          nzcross=0,..
+                          nmode=0,..
+                          equations=list(),..
+                          uid="-7ea004eb:12577f592d7:-6ec4"),..
+                 doc=list("-7ea004eb:12577f592d7:-6ec4"))
+scs_m_1.objs(11)=scicos_link(..
+                   xx=[238.1369;230.68452;230.68452;273.55952],..
+                   yy=[-48.630953;-88.63096;-70;-30],..
+                   id="drawlink",..
+                   thick=[0,0],..
+                   ct=[1,1],..
+                   from=[1,1,0],..
+                   to=[2,1,1])
+scs_m_1.objs(12)=scicos_link(..
+                   xx=[321.55952;356.89286],..
+                   yy=[-30;-30],..
+                   id="drawlink",..
+                   thick=[0,0],..
+                   ct=[1,1],..
+                   from=[2,1,0],..
+                   to=[3,1,1])
+scs_m_1.objs(13)=scicos_link(..
+                   xx=[321.55952;336.05952],..
+                   yy=[-112.58929;-142.08929],..
+                   id="drawlink",..
+                   thick=[0,0],..
+                   ct=[1,1],..
+                   from=[4,1,0],..
+                   to=[6,1,1])
+scs_m_1.objs(14)=scicos_link(..
+                   xx=[238.1369;231.42857;231.42857;273.55952],..
+                   yy=[-61.964287;-101.96429;-152.58929;-112.58929],..
+                   id="drawlink",..
+                   thick=[0,0],..
+                   ct=[1,1],..
+                   from=[1,2,0],..
+                   to=[4,1,1])
+scs_m_1.objs(15)=scicos_link(..
+                   xx=[404.89286;426.36905;422.36905],..
+                   yy=[-112.58929;-152.58929;-142.83334],..
+                   id="drawlink",..
+                   thick=[0,0],..
+                   ct=[1,1],..
+                   from=[5,1,0],..
+                   to=[7,1,1])
+scs_m_1.objs(16)=scicos_link(..
+                   xx=[351.05952;356.89286],..
+                   yy=[-140.33929;-112.58929],..
+                   id="drawlink",..
+                   thick=[0,0],..
+                   ct=[1,1],..
+                   from=[6,1,0],..
+                   to=[5,1,1])
+scs_m_1.objs(17)=scicos_link(..
+                   xx=[351.05952;340.05952;141.39881;141.39881;170.1369],..
+                   yy=[-142.08929;-210.53572;-210.53572;-95.29762;-55.29762],..
+                   id="drawlink",..
+                   thick=[0,0],..
+                   ct=[1,1],..
+                   from=[6,2,0],..
+                   to=[1,2,1])
+scs_m_1.objs(18)=scicos_link(..
+                   xx=[437.36905;426.36905;117.58928;117.58928;170.1369],..
+                   yy=[-141.08334;-238.80953;-238.80953;-85.29762;-45.29762],..
+                   id="drawlink",..
+                   thick=[0,0],..
+                   ct=[1,1],..
+                   from=[7,1,0],..
+                   to=[1,1,1])
+scs_m_1.objs(19)=scicos_link(..
+                   xx=[84;170.1369],..
+                   yy=[-55.29762;-65.29762],..
+                   id="drawlink",..
+                   thick=[0,0],..
+                   ct=[1,1],..
+                   from=[8,1,0],..
+                   to=[1,3,1])
+scs_m_1.objs(20)=scicos_link(..
+                   xx=[404.89286;425.46428],..
+                   yy=[-30;-20],..
+                   id="drawlink",..
+                   thick=[0,0],..
+                   ct=[1,1],..
+                   from=[3,1,0],..
+                   to=[9,1,1])
+scs_m_1.objs(21)=scicos_link(..
+                   xx=[437.36905;442.36905],..
+                   yy=[-142.83334;-103.33334],..
+                   id="drawlink",..
+                   thick=[0,0],..
+                   ct=[1,1],..
+                   from=[7,2,0],..
+                   to=[10,1,1])
+scs_m.objs(4)=scicos_block(..
+              gui="SUPER_f",..
+              graphics=scicos_graphics(..
+                       orig=[92.43479,-157.55953],..
+                       sz=[40,40],..
+                       flip=%t,..
+                       theta=0,..
+                       exprs=[],..
+                       pin=21,..
+                       pout=[23;26],..
+                       pein=[],..
+                       peout=[],..
+                       gr_i=list("xstringb(orig(1),orig(2),""SUPER_f"",sz(1),sz(2));",8),..
+                       id="",..
+                       in_implicit="E",..
+                       out_implicit=["E";"E"],..
+                       in_style="ExplicitInputPort;rotation=0;flip=false;mirror=false",..
+                       out_style=["ExplicitOutputPort;rotation=0;flip=false;mirror=false";
+                       "ExplicitOutputPort;rotation=0;flip=false;mirror=false"],..
+                       in_label="",..
+                       out_label=["";""],..
+                       style="SUPER_f;rotation=0;flip=false;mirror=false"),..
+              model=scicos_model(..
+                       sim="super",..
+                       in=-1,..
+                       in2=-2,..
+                       intyp=-1,..
+                       out=[-1;-1],..
+                       out2=[-2;-2],..
+                       outtyp=[1;1],..
+                       evtin=[],..
+                       evtout=[],..
+                       state=[],..
+                       dstate=[],..
+                       odstate=[],..
+                       rpar=scs_m_1,..
+                       ipar=[],..
+                       opar=list(),..
+                       blocktype="h",..
+                       firing=[],..
+                       dep_ut=[%f,%f],..
+                       label="",..
+                       nzcross=0,..
+                       nmode=0,..
+                       equations=list(),..
+                       uid="fa5a0fb:12507670d3c:-7b7e"),..
+              doc=list("fa5a0fb:12507670d3c:-7b7e"))
+scs_m.objs(5)=scicos_block(..
+              gui="CLSS_f",..
+              graphics=scicos_graphics(..
+                       orig=[26.7205,-249.16667],..
+                       sz=[90,50],..
+                       flip=%t,..
+                       theta=-180,..
+                       exprs=["Contr.A";"Contr.B";"Contr.C";"[Contr.D]";"[0;0;0;0]"],..
+                       pin=16,..
+                       pout=18,..
+                       pein=[],..
+                       peout=[],..
+                       gr_i=list("xstringb(orig(1),orig(2),""CLSS_f"",sz(1),sz(2));",8),..
+                       id="",..
+                       in_implicit="E",..
+                       out_implicit="E",..
+                       in_style="ExplicitInputPort;rotation=180;flip=false;mirror=false",..
+                       out_style="ExplicitOutputPort;rotation=180;flip=false;mirror=false",..
+                       in_label="",..
+                       out_label="",..
+                       style="CLSS_f;rotation=180;flip=false;mirror=false"),..
+              model=scicos_model(..
+                       sim=list("csslti",1),..
+                       in=2,..
+                       in2=-2,..
+                       intyp=1,..
+                       out=1,..
+                       out2=-2,..
+                       outtyp=1,..
+                       evtin=[],..
+                       evtout=[],..
+                       state=[0;0;0;0],..
+                       dstate=[],..
+                       odstate=[],..
+                       rpar=[1.2232416;1;-0.4057101;0;-3.6941896;-4;-0.1014262;0.0000007;15.748401;0;
+                       -5.2232416;1;31.791238;8.962D-08;-14.544138;-4;4;4;-0.0000013;-0.0000007;
+                       -2.9195685;-8.962D-08;8.2383277;4;12.268991;3.0672477;157.95489;318.86294;0;0],..
+                       ipar=[],..
+                       opar=list(),..
+                       blocktype="c",..
+                       firing=[],..
+                       dep_ut=[%f,%t],..
+                       label="",..
+                       nzcross=0,..
+                       nmode=0,..
+                       equations=list(),..
+                       uid="fa5a0fb:12507670d3c:-7b7d"),..
+              doc=list("fa5a0fb:12507670d3c:-7b7d"))
+scs_m.objs(6)=scicos_block(..
+              gui="MUX",..
+              graphics=scicos_graphics(..
+                       orig=[200.32169,-250.16667],..
+                       sz=[40,40],..
+                       flip=%t,..
+                       theta=-180,..
+                       exprs="2",..
+                       pin=[31;29],..
+                       pout=16,..
+                       pein=[],..
+                       peout=[],..
+                       gr_i=list("xstringb(orig(1),orig(2),""MUX"",sz(1),sz(2));",8),..
+                       id="",..
+                       in_implicit=["E";"E"],..
+                       out_implicit="E",..
+                       in_style=["ExplicitInputPort;rotation=180;flip=false;mirror=false";
+                       "ExplicitInputPort;rotation=180;flip=false;mirror=false"],..
+                       out_style="ExplicitOutputPort;rotation=180;flip=false;mirror=false",..
+                       in_label=["";""],..
+                       out_label="",..
+                       style="MUX;rotation=180;flip=false;mirror=false"),..
+              model=scicos_model(..
+                       sim=list("multiplex",4),..
+                       in=[-1;-2],..
+                       in2=[-2;-2],..
+                       intyp=[1;1],..
+                       out=-1,..
+                       out2=-2,..
+                       outtyp=1,..
+                       evtin=[],..
+                       evtout=[],..
+                       state=[],..
+                       dstate=[],..
+                       odstate=[],..
+                       rpar=[],..
+                       ipar=2,..
+                       opar=list(),..
+                       blocktype="c",..
+                       firing=[],..
+                       dep_ut=[%t,%f],..
+                       label="",..
+                       nzcross=0,..
+                       nmode=0,..
+                       equations=list(),..
+                       uid="fa5a0fb:12507670d3c:-7b7c"),..
+              doc=list("fa5a0fb:12507670d3c:-7b7c"))
+scs_m.objs(7)=scicos_block(..
+              gui="SUMMATION",..
+              graphics=scicos_graphics(..
+                       orig=[-3.63664,-147.55953],..
+                       sz=[40,60],..
+                       flip=%t,..
+                       theta=0,..
+                       exprs=["1";"[1;1]";"0"],..
+                       pin=[33;18],..
+                       pout=17,..
+                       pein=[],..
+                       peout=[],..
+                       gr_i=list("xstringb(orig(1),orig(2),""SUMMATION"",sz(1),sz(2));",8),..
+                       id="",..
+                       in_implicit=["E";"E"],..
+                       out_implicit="E",..
+                       in_style=["ExplicitInputPort;rotation=0;flip=false;mirror=false";
+                       "ExplicitInputPort;rotation=0;flip=false;mirror=false"],..
+                       out_style="ExplicitOutputPort;rotation=0;flip=false;mirror=false",..
+                       in_label=["";""],..
+                       out_label="",..
+                       style="SUMMATION;rotation=0;flip=false;mirror=false"),..
+              model=scicos_model(..
+                       sim=list("summation",4),..
+                       in=[-1;-1],..
+                       in2=[-2;-2],..
+                       intyp=[1;1],..
+                       out=-1,..
+                       out2=-2,..
+                       outtyp=1,..
+                       evtin=[],..
+                       evtout=[],..
+                       state=[],..
+                       dstate=[],..
+                       odstate=[],..
+                       rpar=0,..
+                       ipar=[1;1],..
+                       opar=list(),..
+                       blocktype="c",..
+                       firing=[],..
+                       dep_ut=[%t,%f],..
+                       label="",..
+                       nzcross=0,..
+                       nmode=0,..
+                       equations=list(),..
+                       uid="fa5a0fb:12507670d3c:-7b7b"),..
+              doc=list("fa5a0fb:12507670d3c:-7b7b"))
+scs_m.objs(8)=scicos_block(..
+              gui="PENDULUM_ANIM",..
+              graphics=scicos_graphics(..
+                       orig=[237.00297,-196.19077],..
+                       sz=[100,60],..
+                       flip=%t,..
+                       theta=0,..
+                       exprs=["l";"2";"ph";"-5";"5";"-5";"5"],..
+                       pin=[32;30],..
+                       pout=[],..
+                       pein=20,..
+                       peout=[],..
+                       gr_i=list("xstringb(orig(1),orig(2),""PENDULUM_ANIM"",sz(1),sz(2));",8),..
+                       id="",..
+                       in_implicit=["E";"E"],..
+                       out_implicit=[],..
+                       in_style=["ExplicitInputPort;rotation=0;flip=false;mirror=false";
+                       "ExplicitInputPort;rotation=0;flip=false;mirror=false"],..
+                       out_style=[],..
+                       in_label=["";""],..
+                       out_label=[],..
+                       style="PENDULUM_ANIM;rotation=0;flip=false;mirror=false"),..
+              model=scicos_model(..
+                       sim=list("anim_pen",5),..
+                       in=[1;1],..
+                       in2=[-2;-2],..
+                       intyp=[1;1],..
+                       out=[],..
+                       out2=[],..
+                       outtyp=[],..
+                       evtin=-1,..
+                       evtout=[],..
+                       state=[],..
+                       dstate=0,..
+                       odstate=[],..
+                       rpar=[3;2;0.1;-5;5;-5;5],..
+                       ipar=[],..
+                       opar=list(),..
+                       blocktype="d",..
+                       firing=[],..
+                       dep_ut=[%f,%f],..
+                       label="",..
+                       nzcross=0,..
+                       nmode=0,..
+                       equations=list(),..
+                       uid="fa5a0fb:12507670d3c:-7b7a"),..
+              doc=list("fa5a0fb:12507670d3c:-7b7a"))
+scs_m.objs(9)=scicos_block(..
+              gui="CLKSPLIT_f",..
+              graphics=scicos_graphics(..
+                       orig=[371.54788,-83.19474],..
+                       sz=[7,7],..
+                       flip=%t,..
+                       theta=0,..
+                       exprs=[],..
+                       pin=[],..
+                       pout=[],..
+                       pein=15,..
+                       peout=[19;20;0],..
+                       gr_i=list("xstringb(orig(1),orig(2),""CLKSPLIT_f"",sz(1),sz(2));",8),..
+                       id="",..
+                       in_implicit=[],..
+                       out_implicit=[],..
+                       in_style=[],..
+                       out_style=[],..
+                       in_label=[],..
+                       out_label=[],..
+                       style="CLKSPLIT_f;rotation=0;flip=false;mirror=false"),..
+              model=scicos_model(..
+                       sim="split",..
+                       in=[],..
+                       in2=[],..
+                       intyp=[],..
+                       out=[],..
+                       out2=[],..
+                       outtyp=[],..
+                       evtin=-1,..
+                       evtout=[-1;-1;-1],..
+                       state=[],..
+                       dstate=[],..
+                       odstate=[],..
+                       rpar=[],..
+                       ipar=[],..
+                       opar=list(),..
+                       blocktype="d",..
+                       firing=[-1;-1;-1],..
+                       dep_ut=[%f,%f],..
+                       label="",..
+                       nzcross=0,..
+                       nmode=0,..
+                       equations=list(),..
+                       uid="fa5a0fb:12507670d3c:-7b79"),..
+              doc=list("fa5a0fb:12507670d3c:-7b79"))
+scs_m.objs(10)=scicos_block(..
+               gui="SPLIT_f",..
+               graphics=scicos_graphics(..
+                        orig=[96.19715,-174.05953],..
+                        sz=[7,7],..
+                        flip=%t,..
+                        theta=0,..
+                        exprs=[],..
+                        pin=17,..
+                        pout=[21;22;0],..
+                        pein=[],..
+                        peout=[],..
+                        gr_i=list("xstringb(orig(1),orig(2),""SPLIT_f"",sz(1),sz(2));",8),..
+                        id="",..
+                        in_implicit="E",..
+                        out_implicit=["E";"E";"E"],..
+                        in_style="ExplicitInputPort;flip=false;mirror=false",..
+                        out_style=["ExplicitOutputPort;flip=false;mirror=false";
+                        "ExplicitOutputPort;flip=false;mirror=false";
+                        "ExplicitOutputPort;flip=false;mirror=false"],..
+                        in_label="",..
+                        out_label=["";"";""],..
+                        style="SPLIT_f;rotation=0;flip=false;mirror=false"),..
+               model=scicos_model(..
+                        sim="lsplit",..
+                        in=-1,..
+                        in2=-2,..
+                        intyp=1,..
+                        out=[-1;-1;-1],..
+                        out2=[-2;-2;-2],..
+                        outtyp=[1;1;1],..
+                        evtin=[],..
+                        evtout=[],..
+                        state=[],..
+                        dstate=[],..
+                        odstate=[],..
+                        rpar=[],..
+                        ipar=[],..
+                        opar=list(),..
+                        blocktype="c",..
+                        firing=[],..
+                        dep_ut=[%t,%f],..
+                        label="",..
+                        nzcross=0,..
+                        nmode=0,..
+                        equations=list(),..
+                        uid="fa5a0fb:12507670d3c:-7b78"),..
+               doc=list("fa5a0fb:12507670d3c:-7b78"))
+scs_m.objs(11)=scicos_block(..
+               gui="SPLIT_f",..
+               graphics=scicos_graphics(..
+                        orig=[284.27957,-120.47024],..
+                        sz=[7,7],..
+                        flip=%t,..
+                        theta=0,..
+                        exprs=[],..
+                        pin=23,..
+                        pout=[24;25;0],..
+                        pein=[],..
+                        peout=[],..
+                        gr_i=list("xstringb(orig(1),orig(2),""SPLIT_f"",sz(1),sz(2));",8),..
+                        id="",..
+                        in_implicit="E",..
+                        out_implicit=["E";"E";"E"],..
+                        in_style="ExplicitInputPort;flip=false;mirror=false",..
+                        out_style=["ExplicitOutputPort;flip=false;mirror=false";
+                        "ExplicitOutputPort;flip=false;mirror=false";
+                        "ExplicitOutputPort;flip=false;mirror=false"],..
+                        in_label="",..
+                        out_label=["";"";""],..
+                        style="SPLIT_f;rotation=0;flip=false;mirror=false"),..
+               model=scicos_model(..
+                        sim="lsplit",..
+                        in=-1,..
+                        in2=-2,..
+                        intyp=1,..
+                        out=[-1;-1;-1],..
+                        out2=[-2;-2;-2],..
+                        outtyp=[1;1;1],..
+                        evtin=[],..
+                        evtout=[],..
+                        state=[],..
+                        dstate=[],..
+                        odstate=[],..
+                        rpar=[],..
+                        ipar=[],..
+                        opar=list(),..
+                        blocktype="c",..
+                        firing=[],..
+                        dep_ut=[%t,%f],..
+                        label="",..
+                        nzcross=0,..
+                        nmode=0,..
+                        equations=list(),..
+                        uid="fa5a0fb:12507670d3c:-7b77"),..
+               doc=list("fa5a0fb:12507670d3c:-7b77"))
+scs_m.objs(12)=scicos_block(..
+               gui="SPLIT_f",..
+               graphics=scicos_graphics(..
+                        orig=[299.16432,-130.47024],..
+                        sz=[7,7],..
+                        flip=%t,..
+                        theta=0,..
+                        exprs=[],..
+                        pin=26,..
+                        pout=[27;28;0],..
+                        pein=[],..
+                        peout=[],..
+                        gr_i=list("xstringb(orig(1),orig(2),""SPLIT_f"",sz(1),sz(2));",8),..
+                        id="",..
+                        in_implicit="E",..
+                        out_implicit=["E";"E";"E"],..
+                        in_style="ExplicitInputPort;flip=false;mirror=false",..
+                        out_style=["ExplicitOutputPort;flip=false;mirror=false";
+                        "ExplicitOutputPort;flip=false;mirror=false";
+                        "ExplicitOutputPort;flip=false;mirror=false"],..
+                        in_label="",..
+                        out_label=["";"";""],..
+                        style="SPLIT_f;rotation=0;flip=false;mirror=false"),..
+               model=scicos_model(..
+                        sim="lsplit",..
+                        in=-1,..
+                        in2=-2,..
+                        intyp=1,..
+                        out=[-1;-1;-1],..
+                        out2=[-2;-2;-2],..
+                        outtyp=[1;1;1],..
+                        evtin=[],..
+                        evtout=[],..
+                        state=[],..
+                        dstate=[],..
+                        odstate=[],..
+                        rpar=[],..
+                        ipar=[],..
+                        opar=list(),..
+                        blocktype="c",..
+                        firing=[],..
+                        dep_ut=[%t,%f],..
+                        label="",..
+                        nzcross=0,..
+                        nmode=0,..
+                        equations=list(),..
+                        uid="fa5a0fb:12507670d3c:-7b76"),..
+               doc=list("fa5a0fb:12507670d3c:-7b76"))
+scs_m.objs(13)=scicos_block(..
+               gui="SPLIT_f",..
+               graphics=scicos_graphics(..
+                        orig=[299.16432,-229.19077],..
+                        sz=[7,7],..
+                        flip=%t,..
+                        theta=0,..
+                        exprs=[],..
+                        pin=28,..
+                        pout=[29;30;0],..
+                        pein=[],..
+                        peout=[],..
+                        gr_i=list("xstringb(orig(1),orig(2),""SPLIT_f"",sz(1),sz(2));",8),..
+                        id="",..
+                        in_implicit="E",..
+                        out_implicit=["E";"E";"E"],..
+                        in_style="ExplicitInputPort;flip=false;mirror=false",..
+                        out_style=["ExplicitOutputPort;flip=false;mirror=false";
+                        "ExplicitOutputPort;flip=false;mirror=false";
+                        "ExplicitOutputPort;flip=false;mirror=false"],..
+                        in_label="",..
+                        out_label=["";"";""],..
+                        style="SPLIT_f;rotation=0;flip=false;mirror=false"),..
+               model=scicos_model(..
+                        sim="lsplit",..
+                        in=-1,..
+                        in2=-2,..
+                        intyp=1,..
+                        out=[-1;-1;-1],..
+                        out2=[-2;-2;-2],..
+                        outtyp=[1;1;1],..
+                        evtin=[],..
+                        evtout=[],..
+                        state=[],..
+                        dstate=[],..
+                        odstate=[],..
+                        rpar=[],..
+                        ipar=[],..
+                        opar=list(),..
+                        blocktype="c",..
+                        firing=[],..
+                        dep_ut=[%t,%f],..
+                        label="",..
+                        nzcross=0,..
+                        nmode=0,..
+                        equations=list(),..
+                        uid="fa5a0fb:12507670d3c:-7b75"),..
+               doc=list("fa5a0fb:12507670d3c:-7b75"))
+scs_m.objs(14)=scicos_block(..
+               gui="SPLIT_f",..
+               graphics=scicos_graphics(..
+                        orig=[284.27957,-209.19077],..
+                        sz=[7,7],..
+                        flip=%t,..
+                        theta=0,..
+                        exprs=[],..
+                        pin=25,..
+                        pout=[31;32;0],..
+                        pein=[],..
+                        peout=[],..
+                        gr_i=list("xstringb(orig(1),orig(2),""SPLIT_f"",sz(1),sz(2));",8),..
+                        id="",..
+                        in_implicit="E",..
+                        out_implicit=["E";"E";"E"],..
+                        in_style="ExplicitInputPort;flip=false;mirror=false",..
+                        out_style=["ExplicitOutputPort;flip=false;mirror=false";
+                        "ExplicitOutputPort;flip=false;mirror=false";
+                        "ExplicitOutputPort;flip=false;mirror=false"],..
+                        in_label="",..
+                        out_label=["";"";""],..
+                        style="SPLIT_f;rotation=0;flip=false;mirror=false"),..
+               model=scicos_model(..
+                        sim="lsplit",..
+                        in=-1,..
+                        in2=-2,..
+                        intyp=1,..
+                        out=[-1;-1;-1],..
+                        out2=[-2;-2;-2],..
+                        outtyp=[1;1;1],..
+                        evtin=[],..
+                        evtout=[],..
+                        state=[],..
+                        dstate=[],..
+                        odstate=[],..
+                        rpar=[],..
+                        ipar=[],..
+                        opar=list(),..
+                        blocktype="c",..
+                        firing=[],..
+                        dep_ut=[%t,%f],..
+                        label="",..
+                        nzcross=0,..
+                        nmode=0,..
+                        equations=list(),..
+                        uid="fa5a0fb:12507670d3c:-7b74"),..
+               doc=list("fa5a0fb:12507670d3c:-7b74"))
+scs_m.objs(15)=scicos_link(..
+                 xx=[382.04788;382.04788],..
+                 yy=[-24;-72.19474],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[5,-1],..
+                 from=[3,1,0],..
+                 to=[9,1,1])
+scs_m.objs(16)=scicos_link(..
+                 xx=[236.32169;210.7205],..
+                 yy=[-230.16667;-224.16667],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[6,1,0],..
+                 to=[5,1,1])
+scs_m.objs(17)=scicos_link(..
+                 xx=[80.36336;99.19715],..
+                 yy=[-117.55953;-170.55953],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[7,1,0],..
+                 to=[10,1,1])
+scs_m.objs(18)=scicos_link(..
+                 xx=[112.7205;20;20;32.36336],..
+                 yy=[-224.16667;-269.16667;-187.55953;-127.55953],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[5,1,0],..
+                 to=[7,2,1])
+scs_m.objs(19)=scicos_link(..
+                 xx=[380.88121;382.04788],..
+                 yy=[-87.19474;-73.47024],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[5,-1],..
+                 from=[9,1,0],..
+                 to=[2,1,1])
+scs_m.objs(20)=scicos_link(..
+                 xx=[383.21455;420;420;380;387.00297],..
+                 yy=[-87.19474;-80;-170;-170;-132.19077],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[5,-1],..
+                 from=[9,2,0],..
+                 to=[8,1,1])
+scs_m.objs(21)=scicos_link(..
+                 xx=[114.19715;128.43479],..
+                 yy=[-168.80953;-137.55953],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[10,1,0],..
+                 to=[4,1,1])
+scs_m.objs(22)=scicos_link(..
+                 xx=[114.19715;103.19715;353.04788],..
+                 yy=[-170.55953;-147.47024;-107.47024],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[10,2,0],..
+                 to=[2,3,1])
+scs_m.objs(23)=scicos_link(..
+                 xx=[176.43479;248.85804;248.85804;287.27957],..
+                 yy=[-130.89286;-170.89286;-127.47024;-116.97024],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[4,1,0],..
+                 to=[11,1,1])
+scs_m.objs(24)=scicos_link(..
+                 xx=[302.27957;353.04788],..
+                 yy=[-115.22024;-87.47024],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[11,1,0],..
+                 to=[2,1,1])
+scs_m.objs(25)=scicos_link(..
+                 xx=[302.27957;287.27957],..
+                 yy=[-116.97024;-205.69077],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[11,2,0],..
+                 to=[14,1,1])
+scs_m.objs(26)=scicos_link(..
+                 xx=[176.43479;260.76584;260.76584;302.16432],..
+                 yy=[-144.2262;-184.22619;-137.47024;-126.97024],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[4,2,0],..
+                 to=[12,1,1])
+scs_m.objs(27)=scicos_link(..
+                 xx=[317.16432;353.04788],..
+                 yy=[-125.22024;-97.47024],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[12,1,0],..
+                 to=[2,2,1])
+scs_m.objs(28)=scicos_link(..
+                 xx=[317.16432;302.16432],..
+                 yy=[-126.97024;-225.69077],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[12,2,0],..
+                 to=[13,1,1])
+scs_m.objs(29)=scicos_link(..
+                 xx=[317.16432;306.16432;284.32169],..
+                 yy=[-223.94077;-275.83334;-236.83334],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[13,1,0],..
+                 to=[6,2,1])
+scs_m.objs(30)=scicos_link(..
+                 xx=[317.16432;333.00297],..
+                 yy=[-225.69077;-176.19077],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[13,2,0],..
+                 to=[8,2,1])
+scs_m.objs(31)=scicos_link(..
+                 xx=[302.27957;291.27957;284.32169],..
+                 yy=[-203.94077;-262.5;-223.5],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[14,1,0],..
+                 to=[6,1,1])
+scs_m.objs(32)=scicos_link(..
+                 xx=[302.27957;333.00297],..
+                 yy=[-205.69077;-156.19077],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[14,2,0],..
+                 to=[8,1,1])
+scs_m.objs(33)=scicos_link(..
+                 xx=[32.75038;21.1214;21.1214;32.36336],..
+                 yy=[-51.03729;-91.03729;-167.55953;-107.55953],..
+                 id="drawlink",..
+                 thick=[0,0],..
+                 ct=[1,1],..
+                 from=[1,1,0],..
+                 to=[7,1,1])
diff --git a/scilab/modules/scicos/tests/unit_tests/sciblk2.dia.ref b/scilab/modules/scicos/tests/unit_tests/sciblk2.dia.ref
new file mode 100644 (file)
index 0000000..0a7f21d
--- /dev/null
@@ -0,0 +1,200 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2015 - Scilab Enterprises - Paul Bignier
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- XCOS TEST -->
+// Load and run a diagram that calls a Scilab macro (tkscaleblk.sci)
+exec("SCI/modules/scicos/tests/unit_tests/bug_8348.cosf", -1);
+// Call sciblk2 instead of sciblk4
+scs_m.objs(1).model.sim = list("tkscaleblk", 3);
+scs_m.props.tf = 100;
+// Rewrite tkscaleblk so it minds sciblk2's calling sequence
+wMode = warning("query");
+warning("off")
+function [xd, tvec, z, x, outptr] = tkscaleblk(flag, nevprt, t, x, z, rpar, ipar, inptr)
+    outptr = list();
+    if flag == 1 then
+        // Output update
+        slider = get("-38f07e57:12bd41b596e:-7f2b#slider");
+        if slider <> [] then
+            // Calculate real value
+            value = get(slider,"value") / rpar(3);
+            w = get("-38f07e57:12bd41b596e:-7f2b");
+            if w <> [] then
+                set(w, "info_message", string(value));
+            end
+            outptr = list(value);
+        end
+    elseif flag == 4 then
+        // Initialization
+        // If already exists (stopped) then reuse
+        f = get("-38f07e57:12bd41b596e:-7f2b");
+        if f <> [] then
+            return;
+        end
+        f = figure("Figure_name", "TK Source: " + "", ...
+        "dockable", "off", ...
+        "infobar_visible" , "on", ...
+        "toolbar", "none", ...
+        "menubar_visible", "off", ...
+        "menubar", "none", ...
+        "backgroundcolor", [1 1 1], ...
+        "default_axes", "off", ...
+        "figure_size", [180 350], ...
+        "layout", "border", ...
+        "figure_position", [40 40], ...
+        "Tag", "-38f07e57:12bd41b596e:-7f2b");
+        frame_slider = uicontrol(f, ...
+        "style", "frame", ...
+        "constraints", createConstraints("border", "left", [180, 0]), ...
+        "border", createBorder("line", "lightGray", 1), ...
+        "backgroundcolor", [1 1 1], ...
+        "layout", "gridbag");
+        // Slider
+        bounds = rpar(1:2);
+        initial = mean(bounds);
+        uicontrol(frame_slider, ...
+        "Style", "slider", ...
+        "Tag", "-38f07e57:12bd41b596e:-7f2b#slider", ...
+        "Min", bounds(1), ...
+        "Max", bounds(2), ...
+        "Value", initial, ...
+        "Position", [0 0 10 20], ...
+        "SliderStep", [rpar(3) 2*rpar(3)]);
+        frame_label = uicontrol(frame_slider, ...
+        "style", "frame", ...
+        "constraints", createConstraints("border", "right"), ...
+        "backgroundcolor", [1 1 1], ...
+        "layout", "gridbag");
+        // Labels
+        labels = string([bounds(2) ; ...
+        mean([bounds(2) initial])  ; ...
+        initial                    ; ...
+        mean([bounds(1) initial])  ; ...
+        bounds(1)]);
+        labels = "<html>" + strcat(labels, "<br /><br /><br />") + "</html>";
+        uicontrol(frame_label, ...
+        "Style", "text", ...
+        "String", labels(1), ...
+        "FontWeight", "bold", ...
+        "backgroundcolor", [1 1 1]);
+        // Update default value
+        outptr = list(initial / rpar(3));
+    elseif flag == 5 then
+        // Ending
+        f = get("-38f07e57:12bd41b596e:-7f2b");
+        if f <> [] then
+            close(f);
+        end
+    end
+    xd = 0;
+    tvec = [];
+endfunction
+warning(wMode);
+cpr = scicos_simulate(scs_m);
+cpr229 = [ ...
+1;
+5.5;
+5.5;
+5.5];
+// Check the sensitive value of the continuous state
+assert_checkalmostequal(list2vec(cpr(2)(2)(9)), cpr229);
+close(gcf());
+// Load and run a diagram that calls a Scilab macro (anim_pen.sci)
+exec("SCI/modules/scicos/tests/unit_tests/pendulum_anim5.cosf", -1);
+// Call sciblk2 instead of sciblk4
+scs_m.objs(8).model.sim = list("anim_pen", 3);
+// Rewrite anim_pen so it minds sciblk2's calling sequence
+wMode = warning("query");
+warning("off")
+function [xd, tvec, z, x, outptr] = anim_pen(flag, nevprt, t, x, z, rpar, ipar, inptr)
+    win=20000+curblock()
+    if flag<>4 then
+        H=scf(win)
+    end
+    xold=z
+    plen=rpar(1)*1.6;
+    csiz=rpar(2)/4;
+    phi=rpar(3);
+    rcirc=csiz/3;
+    if flag==4 then
+        //** INIT
+        xset("window",win)
+        set("figure_style","new")
+        H=scf(win)
+        clf(H)
+        Axe=H.children
+        Axe.data_bounds=rpar(4:7)
+        Axe.isoview="on"
+        S=[cos(phi),-sin(phi);sin(phi),cos(phi)]
+        XY=S*[rpar(4),rpar(5);-csiz,-csiz]
+        xset("color",3)
+        xsegs(XY(1,:),XY(2,:)-rcirc)
+        xTemp=0;
+        theta=0;
+        x1=xTemp-csiz;
+        x2=xTemp+csiz;
+        y1=-csiz;
+        y2=csiz
+        XY=S*[x1 x2 x2 x1 x1;y1,y1,y2,y2,y1]
+        xset("color",5)
+        xfpoly(XY(1,:),XY(2,:))// cart
+        xset("color",2)
+        xfarc(XY(1,1),XY(2,1),rcirc,rcirc,0,360*64) //wheel
+        xfarc(XY(1,2),XY(2,2),rcirc,rcirc,0,360*64) //wheel
+        XY=S*[xTemp,xTemp+plen*sin(theta);0,0+plen*cos(theta)]//pendulum
+        xset("color",2)
+        xsegs(XY(1,:),XY(2,:))
+    elseif flag==2 then
+        //** UPDATE
+        Axe=H.children
+        xTemp=inptr(1)(1)
+        theta=inptr(2)(1)
+        drawlater();
+        XY=Axe.children(4).data'+ [cos(phi)*(xTemp-xold);sin(phi)*(xTemp-xold)]*ones(1,5)
+        Axe.children(4).data=XY'
+        Axe.children(3).data(1)=XY(1,1)
+        Axe.children(3).data(2)=XY(2,1)
+        XY=Axe.children(4).data'+ [cos(phi)*(xTemp-xold-rcirc);sin(phi)*(xTemp-xold-rcirc)]*ones(1,5)
+        Axe.children(2).data(1)=XY(1,2)
+        Axe.children(2).data(2)=XY(2,2)
+        x1=xTemp*cos(phi);
+        y1=xTemp*sin(phi)
+        XY=[x1,x1+plen*sin(theta);y1,y1+plen*cos(theta)]
+        Axe.children(1).data=XY'
+        drawnow();
+        z=xTemp
+    end
+    xd = 0;
+    tvec = [];
+    outptr = list();
+endfunction
+warning(wMode);
+cpr = scicos_simulate(scs_m);
+   Generate a loader file
+   Generate a Makefile
+   ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
+   ilib_gen_Make: Copy inv_pend.c to TMPDIR
+   ilib_gen_Make: configure : Generate Makefile.
+   ilib_gen_Make: Modification of the Makefile in TMPDIR.
+   Running the Makefile
+   Generate a cleaner file
+Shared archive loaded.
+Link done.
+cpr229 = [ ...
+-0.00000010072892435; ...
+-0.0000000093251865; ...
+12.731754622278423; ...
+0.00000000775393652; ...
+-0.00000007274473145; ...
+0.00000008598899216; ...
+-0.00000000636625628; ...
+-0.00000010072892435;
+-0.0000000093251865; ...
+-0.00000100269157242; ...
+12.7317556249699955; ];
+// Check the sensitive value of the continuous state
+assert_checkalmostequal(list2vec(cpr(2)(2)(9)), cpr229);
diff --git a/scilab/modules/scicos/tests/unit_tests/sciblk2.tst b/scilab/modules/scicos/tests/unit_tests/sciblk2.tst
new file mode 100644 (file)
index 0000000..982a13b
--- /dev/null
@@ -0,0 +1,216 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2015 - Scilab Enterprises - Paul Bignier
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- XCOS TEST -->
+
+// Load and run a diagram that calls a Scilab macro (tkscaleblk.sci)
+exec("SCI/modules/scicos/tests/unit_tests/bug_8348.cosf", -1);
+// Call sciblk2 instead of sciblk4
+scs_m.objs(1).model.sim = list("tkscaleblk", 3);
+scs_m.props.tf = 100;
+
+// Rewrite tkscaleblk so it minds sciblk2's calling sequence
+wMode = warning("query");
+warning("off")
+function [xd, tvec, z, x, outptr] = tkscaleblk(flag, nevprt, t, x, z, rpar, ipar, inptr)
+    outptr = list();
+    if flag == 1 then
+        // Output update
+        slider = get("-38f07e57:12bd41b596e:-7f2b#slider");
+
+        if slider <> [] then
+            // Calculate real value
+            value = get(slider,"value") / rpar(3);
+
+            w = get("-38f07e57:12bd41b596e:-7f2b");
+            if w <> [] then
+                set(w, "info_message", string(value));
+            end
+
+            outptr = list(value);
+        end
+    elseif flag == 4 then
+        // Initialization
+
+        // If already exists (stopped) then reuse
+        f = get("-38f07e57:12bd41b596e:-7f2b");
+        if f <> [] then
+            return;
+        end
+
+        f = figure("Figure_name", "TK Source: " + "", ...
+        "dockable", "off", ...
+        "infobar_visible" , "on", ...
+        "toolbar", "none", ...
+        "menubar_visible", "off", ...
+        "menubar", "none", ...
+        "backgroundcolor", [1 1 1], ...
+        "default_axes", "off", ...
+        "figure_size", [180 350], ...
+        "layout", "border", ...
+        "figure_position", [40 40], ...
+        "Tag", "-38f07e57:12bd41b596e:-7f2b");
+
+        frame_slider = uicontrol(f, ...
+        "style", "frame", ...
+        "constraints", createConstraints("border", "left", [180, 0]), ...
+        "border", createBorder("line", "lightGray", 1), ...
+        "backgroundcolor", [1 1 1], ...
+        "layout", "gridbag");
+
+        // Slider
+        bounds = rpar(1:2);
+        initial = mean(bounds);
+        uicontrol(frame_slider, ...
+        "Style", "slider", ...
+        "Tag", "-38f07e57:12bd41b596e:-7f2b#slider", ...
+        "Min", bounds(1), ...
+        "Max", bounds(2), ...
+        "Value", initial, ...
+        "Position", [0 0 10 20], ...
+        "SliderStep", [rpar(3) 2*rpar(3)]);
+
+        frame_label = uicontrol(frame_slider, ...
+        "style", "frame", ...
+        "constraints", createConstraints("border", "right"), ...
+        "backgroundcolor", [1 1 1], ...
+        "layout", "gridbag");
+
+        // Labels
+        labels = string([bounds(2) ; ...
+        mean([bounds(2) initial])  ; ...
+        initial                    ; ...
+        mean([bounds(1) initial])  ; ...
+        bounds(1)]);
+        labels = "<html>" + strcat(labels, "<br /><br /><br />") + "</html>";
+
+        uicontrol(frame_label, ...
+        "Style", "text", ...
+        "String", labels(1), ...
+        "FontWeight", "bold", ...
+        "backgroundcolor", [1 1 1]);
+
+        // Update default value
+        outptr = list(initial / rpar(3));
+    elseif flag == 5 then
+        // Ending
+        f = get("-38f07e57:12bd41b596e:-7f2b");
+        if f <> [] then
+            close(f);
+        end
+    end
+    xd = 0;
+    tvec = [];
+endfunction
+warning(wMode);
+
+cpr = scicos_simulate(scs_m);
+
+cpr229 = [ ...
+1;
+5.5;
+5.5;
+5.5];
+
+// Check the sensitive value of the continuous state
+assert_checkalmostequal(list2vec(cpr(2)(2)(9)), cpr229);
+close(gcf());
+
+// Load and run a diagram that calls a Scilab macro (anim_pen.sci)
+exec("SCI/modules/scicos/tests/unit_tests/pendulum_anim5.cosf", -1);
+// Call sciblk2 instead of sciblk4
+scs_m.objs(8).model.sim = list("anim_pen", 3);
+
+// Rewrite anim_pen so it minds sciblk2's calling sequence
+wMode = warning("query");
+warning("off")
+function [xd, tvec, z, x, outptr] = anim_pen(flag, nevprt, t, x, z, rpar, ipar, inptr)
+    win=20000+curblock()
+    if flag<>4 then
+        H=scf(win)
+    end
+    xold=z
+    plen=rpar(1)*1.6;
+    csiz=rpar(2)/4;
+    phi=rpar(3);
+    rcirc=csiz/3;
+    if flag==4 then
+        //** INIT
+        xset("window",win)
+        set("figure_style","new")
+        H=scf(win)
+        clf(H)
+        Axe=H.children
+        Axe.data_bounds=rpar(4:7)
+        Axe.isoview="on"
+
+        S=[cos(phi),-sin(phi);sin(phi),cos(phi)]
+        XY=S*[rpar(4),rpar(5);-csiz,-csiz]
+        xset("color",3)
+        xsegs(XY(1,:),XY(2,:)-rcirc)
+
+        xTemp=0;
+        theta=0;
+        x1=xTemp-csiz;
+        x2=xTemp+csiz;
+        y1=-csiz;
+        y2=csiz
+        XY=S*[x1 x2 x2 x1 x1;y1,y1,y2,y2,y1]
+        xset("color",5)
+        xfpoly(XY(1,:),XY(2,:))// cart
+        xset("color",2)
+        xfarc(XY(1,1),XY(2,1),rcirc,rcirc,0,360*64) //wheel
+        xfarc(XY(1,2),XY(2,2),rcirc,rcirc,0,360*64) //wheel
+
+        XY=S*[xTemp,xTemp+plen*sin(theta);0,0+plen*cos(theta)]//pendulum
+        xset("color",2)
+        xsegs(XY(1,:),XY(2,:))
+
+    elseif flag==2 then
+        //** UPDATE
+        Axe=H.children
+        xTemp=inptr(1)(1)
+        theta=inptr(2)(1)
+        drawlater();
+        XY=Axe.children(4).data'+ [cos(phi)*(xTemp-xold);sin(phi)*(xTemp-xold)]*ones(1,5)
+        Axe.children(4).data=XY'
+
+        Axe.children(3).data(1)=XY(1,1)
+        Axe.children(3).data(2)=XY(2,1)
+        XY=Axe.children(4).data'+ [cos(phi)*(xTemp-xold-rcirc);sin(phi)*(xTemp-xold-rcirc)]*ones(1,5)
+        Axe.children(2).data(1)=XY(1,2)
+        Axe.children(2).data(2)=XY(2,2)
+        x1=xTemp*cos(phi);
+        y1=xTemp*sin(phi)
+        XY=[x1,x1+plen*sin(theta);y1,y1+plen*cos(theta)]
+        Axe.children(1).data=XY'
+        drawnow();
+        z=xTemp
+    end
+    xd = 0;
+    tvec = [];
+    outptr = list();
+endfunction
+warning(wMode);
+
+cpr = scicos_simulate(scs_m);
+
+cpr229 = [ ...
+-0.00000010072892435; ...
+-0.0000000093251865; ...
+12.731754622278423; ...
+0.00000000775393652; ...
+-0.00000007274473145; ...
+0.00000008598899216; ...
+-0.00000000636625628; ...
+-0.00000010072892435;
+-0.0000000093251865; ...
+-0.00000100269157242; ...
+12.7317556249699955; ];
+
+// Check the sensitive value of the continuous state
+assert_checkalmostequal(list2vec(cpr(2)(2)(9)), cpr229);