summaryrefslogtreecommitdiff
path: root/modules/scicos/src/c
diff options
context:
space:
mode:
authorShashank2017-05-29 12:40:26 +0530
committerShashank2017-05-29 12:40:26 +0530
commit0345245e860375a32c9a437c4a9d9cae807134e9 (patch)
treead51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/scicos/src/c
downloadscilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip
CMSCOPE changed
Diffstat (limited to 'modules/scicos/src/c')
-rwxr-xr-xmodules/scicos/src/c/.deps/.dirstamp0
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-MlistGetFieldNumber.Plo180
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-copyvarfromlistentry.Plo195
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-createblklist.Plo215
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-ddaskr.Plo181
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-extractblklist.Plo152
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-ezxml.Plo172
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-il_sim.Plo91
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-il_state.Plo91
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-import.Plo180
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-lsodar.Plo149
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-sciblk2.Plo93
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-sciblk4.Plo256
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-scicos.Plo360
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-scicos_free.Plo93
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-scicos_malloc.Plo93
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-scicos_print.Plo13
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-tree.Plo134
-rwxr-xr-xmodules/scicos/src/c/.deps/libsciscicos_algo_la-var2sci.Plo212
-rwxr-xr-xmodules/scicos/src/c/.dirstamp0
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-MlistGetFieldNumber.obin0 -> 6400 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-copyvarfromlistentry.obin0 -> 6752 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-createblklist.obin0 -> 28184 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-ddaskr.obin0 -> 56272 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-extractblklist.obin0 -> 131008 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-ezxml.obin0 -> 137816 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-il_sim.obin0 -> 3776 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-il_state.obin0 -> 3792 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-import.obin0 -> 76352 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-lsodar.obin0 -> 35000 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-sciblk2.obin0 -> 12368 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-sciblk4.obin0 -> 34664 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-scicos.obin0 -> 545664 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-scicos_free.obin0 -> 3848 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-scicos_malloc.obin0 -> 4032 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-scicos_print.obin0 -> 3840 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-tree.obin0 -> 14680 bytes
-rwxr-xr-xmodules/scicos/src/c/.libs/libsciscicos_algo_la-var2sci.obin0 -> 16760 bytes
-rwxr-xr-xmodules/scicos/src/c/Action_binding_Import.def7
-rwxr-xr-xmodules/scicos/src/c/Core_f_Import.def14
-rwxr-xr-xmodules/scicos/src/c/DllmainScicos.c23
-rwxr-xr-xmodules/scicos/src/c/Dynamic_link_Import.def6
-rwxr-xr-xmodules/scicos/src/c/Graphics_Import.def4
-rwxr-xr-xmodules/scicos/src/c/Intersci_Import.def4
-rwxr-xr-xmodules/scicos/src/c/Localization_Import.def5
-rwxr-xr-xmodules/scicos/src/c/MlistGetFieldNumber.c57
-rwxr-xr-xmodules/scicos/src/c/MlistGetFieldNumber.h33
-rwxr-xr-xmodules/scicos/src/c/Output_stream_Import.def12
-rwxr-xr-xmodules/scicos/src/c/Scicos_Export.def24
-rwxr-xr-xmodules/scicos/src/c/Scicos_blocks_f_Import.def81
-rwxr-xr-xmodules/scicos/src/c/String_Import.def8
-rwxr-xr-xmodules/scicos/src/c/cli/scicos-cli.rc96
-rwxr-xr-xmodules/scicos/src/c/cli/scicos-cli.vcxproj381
-rwxr-xr-xmodules/scicos/src/c/cli/scicos-cli.vcxproj.filters303
-rwxr-xr-xmodules/scicos/src/c/cli/scicos-cli_Export.def24
-rwxr-xr-xmodules/scicos/src/c/copyvarfromlistentry.c61
-rwxr-xr-xmodules/scicos/src/c/copyvarfromlistentry.h58
-rwxr-xr-xmodules/scicos/src/c/core_Import.def38
-rwxr-xr-xmodules/scicos/src/c/createblklist.c546
-rwxr-xr-xmodules/scicos/src/c/createblklist.h61
-rwxr-xr-xmodules/scicos/src/c/ddaskr.c1076
-rwxr-xr-xmodules/scicos/src/c/ddaskr.h155
-rwxr-xr-xmodules/scicos/src/c/differential_equations_f_Import.def4
-rwxr-xr-xmodules/scicos/src/c/elementary_functions_f_Import.def6
-rwxr-xr-xmodules/scicos/src/c/extractblklist.c2959
-rwxr-xr-xmodules/scicos/src/c/extractblklist.h43
-rwxr-xr-xmodules/scicos/src/c/ezxml.c1696
-rwxr-xr-xmodules/scicos/src/c/ezxml.h172
-rwxr-xr-xmodules/scicos/src/c/il_sim.c37
-rwxr-xr-xmodules/scicos/src/c/il_sim.h36
-rwxr-xr-xmodules/scicos/src/c/il_state.c37
-rwxr-xr-xmodules/scicos/src/c/il_state.h36
-rwxr-xr-xmodules/scicos/src/c/import.c1103
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-MlistGetFieldNumber.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-copyvarfromlistentry.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-createblklist.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-ddaskr.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-extractblklist.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-ezxml.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-il_sim.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-il_state.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-import.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-lsodar.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-sciblk2.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-sciblk4.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-scicos.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-scicos_free.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-scicos_malloc.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-scicos_print.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-tree.lo12
-rwxr-xr-xmodules/scicos/src/c/libsciscicos_algo_la-var2sci.lo12
-rwxr-xr-xmodules/scicos/src/c/lsodar.c586
-rwxr-xr-xmodules/scicos/src/c/lsodar.h107
-rwxr-xr-xmodules/scicos/src/c/nographics_Import.def4
-rwxr-xr-xmodules/scicos/src/c/noscicos/.deps/libsciscicos_algo_la-noscicos.Plo1
-rwxr-xr-xmodules/scicos/src/c/noscicos/noscicos.c13
-rwxr-xr-xmodules/scicos/src/c/noscicos/noscicos.h13
-rwxr-xr-xmodules/scicos/src/c/noscicos/noscicos.rc97
-rwxr-xr-xmodules/scicos/src/c/noscicos/noscicos.vcxproj191
-rwxr-xr-xmodules/scicos/src/c/noscicos/noscicos.vcxproj.filters30
-rwxr-xr-xmodules/scicos/src/c/sciblk2.c235
-rwxr-xr-xmodules/scicos/src/c/sciblk2.h33
-rwxr-xr-xmodules/scicos/src/c/sciblk4.c874
-rwxr-xr-xmodules/scicos/src/c/sciblk4.h101
-rwxr-xr-xmodules/scicos/src/c/scicos.c7147
-rwxr-xr-xmodules/scicos/src/c/scicos.rc96
-rwxr-xr-xmodules/scicos/src/c/scicos.vcxproj387
-rwxr-xr-xmodules/scicos/src/c/scicos.vcxproj.filters303
-rwxr-xr-xmodules/scicos/src/c/scicos_f_Import.def23
-rwxr-xr-xmodules/scicos/src/c/scicos_free.c32
-rwxr-xr-xmodules/scicos/src/c/scicos_internal.h43
-rwxr-xr-xmodules/scicos/src/c/scicos_malloc.c34
-rwxr-xr-xmodules/scicos/src/c/scicos_print.c32
-rwxr-xr-xmodules/scicos/src/c/tree.c250
-rwxr-xr-xmodules/scicos/src/c/tree.h36
-rwxr-xr-xmodules/scicos/src/c/var2sci.c274
-rwxr-xr-xmodules/scicos/src/c/var2sci.h61
117 files changed, 23285 insertions, 0 deletions
diff --git a/modules/scicos/src/c/.deps/.dirstamp b/modules/scicos/src/c/.deps/.dirstamp
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/modules/scicos/src/c/.deps/.dirstamp
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-MlistGetFieldNumber.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-MlistGetFieldNumber.Plo
new file mode 100755
index 000000000..d0e42e6e2
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-MlistGetFieldNumber.Plo
@@ -0,0 +1,180 @@
+src/c/libsciscicos_algo_la-MlistGetFieldNumber.lo: \
+ src/c/MlistGetFieldNumber.c /usr/include/stdc-predef.h \
+ /usr/include/string.h /usr/include/features.h \
+ /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \
+ /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/stdlib.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h src/c/MlistGetFieldNumber.h \
+ ../../modules/string/includes/cvstr.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/string/includes/dynlib_string.h \
+ ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h \
+ ../../modules/core/includes/core_math.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+ /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/local_lim.h \
+ /usr/include/linux/limits.h \
+ /usr/include/x86_64-linux-gnu/bits/posix2_lim.h /usr/include/math.h \
+ /usr/include/x86_64-linux-gnu/bits/math-vector.h \
+ /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_val.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_valf.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_vall.h \
+ /usr/include/x86_64-linux-gnu/bits/inf.h \
+ /usr/include/x86_64-linux-gnu/bits/nan.h \
+ /usr/include/x86_64-linux-gnu/bits/mathdef.h \
+ /usr/include/x86_64-linux-gnu/bits/mathcalls.h \
+ /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/values.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/float.h \
+ ../../modules/core/includes/stack-def.h \
+ ../../modules/core/includes/machine.h
+
+/usr/include/stdc-predef.h:
+
+/usr/include/string.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+src/c/MlistGetFieldNumber.h:
+
+../../modules/string/includes/cvstr.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/string/includes/dynlib_string.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
+
+../../modules/core/includes/core_math.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
+
+/usr/include/math.h:
+
+/usr/include/x86_64-linux-gnu/bits/math-vector.h:
+
+/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_val.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_valf.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_vall.h:
+
+/usr/include/x86_64-linux-gnu/bits/inf.h:
+
+/usr/include/x86_64-linux-gnu/bits/nan.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathdef.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathcalls.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathinline.h:
+
+/usr/include/values.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/float.h:
+
+../../modules/core/includes/stack-def.h:
+
+../../modules/core/includes/machine.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-copyvarfromlistentry.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-copyvarfromlistentry.Plo
new file mode 100755
index 000000000..100f6ee68
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-copyvarfromlistentry.Plo
@@ -0,0 +1,195 @@
+src/c/libsciscicos_algo_la-copyvarfromlistentry.lo: \
+ src/c/copyvarfromlistentry.c /usr/include/stdc-predef.h \
+ src/c/copyvarfromlistentry.h ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h /usr/include/stdlib.h \
+ /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h \
+ ../../modules/core/includes/stack-c.h /usr/include/string.h \
+ /usr/include/xlocale.h /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h \
+ ../../modules/core/includes/core_math.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+ /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/local_lim.h \
+ /usr/include/linux/limits.h \
+ /usr/include/x86_64-linux-gnu/bits/posix2_lim.h /usr/include/math.h \
+ /usr/include/x86_64-linux-gnu/bits/math-vector.h \
+ /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_val.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_valf.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_vall.h \
+ /usr/include/x86_64-linux-gnu/bits/inf.h \
+ /usr/include/x86_64-linux-gnu/bits/nan.h \
+ /usr/include/x86_64-linux-gnu/bits/mathdef.h \
+ /usr/include/x86_64-linux-gnu/bits/mathcalls.h \
+ /usr/include/x86_64-linux-gnu/bits/mathinline.h \
+ ../../modules/core/includes/stack-def.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/core/includes/stackTypeVariable.h \
+ ../../modules/core/includes/BOOL.h \
+ ../../modules/core/includes/doublecomplex.h \
+ ../../modules/core/includes/stack1.h \
+ ../../modules/core/includes/scisparse.h \
+ ../../modules/core/includes/stack2.h \
+ ../../modules/core/includes/stack3.h \
+ ../../modules/core/includes/stack-optional.h \
+ ../../modules/core/includes/sci_types.h
+
+/usr/include/stdc-predef.h:
+
+src/c/copyvarfromlistentry.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+../../modules/core/includes/stack-c.h:
+
+/usr/include/string.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+../../modules/core/includes/core_math.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
+
+/usr/include/math.h:
+
+/usr/include/x86_64-linux-gnu/bits/math-vector.h:
+
+/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_val.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_valf.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_vall.h:
+
+/usr/include/x86_64-linux-gnu/bits/inf.h:
+
+/usr/include/x86_64-linux-gnu/bits/nan.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathdef.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathcalls.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathinline.h:
+
+../../modules/core/includes/stack-def.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/core/includes/stackTypeVariable.h:
+
+../../modules/core/includes/BOOL.h:
+
+../../modules/core/includes/doublecomplex.h:
+
+../../modules/core/includes/stack1.h:
+
+../../modules/core/includes/scisparse.h:
+
+../../modules/core/includes/stack2.h:
+
+../../modules/core/includes/stack3.h:
+
+../../modules/core/includes/stack-optional.h:
+
+../../modules/core/includes/sci_types.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-createblklist.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-createblklist.Plo
new file mode 100755
index 000000000..2b2657e08
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-createblklist.Plo
@@ -0,0 +1,215 @@
+src/c/libsciscicos_algo_la-createblklist.lo: src/c/createblklist.c \
+ /usr/include/stdc-predef.h src/c/createblklist.h \
+ ../../modules/scicos_blocks/includes/scicos_block4.h /usr/include/math.h \
+ /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/include/x86_64-linux-gnu/bits/math-vector.h \
+ /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_val.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_valf.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_vall.h \
+ /usr/include/x86_64-linux-gnu/bits/inf.h \
+ /usr/include/x86_64-linux-gnu/bits/nan.h \
+ /usr/include/x86_64-linux-gnu/bits/mathdef.h \
+ /usr/include/x86_64-linux-gnu/bits/mathcalls.h \
+ /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/assert.h \
+ /usr/include/stdlib.h /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/core/includes/stack-c.h /usr/include/string.h \
+ /usr/include/xlocale.h /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h \
+ ../../modules/core/includes/core_math.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+ /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/local_lim.h \
+ /usr/include/linux/limits.h \
+ /usr/include/x86_64-linux-gnu/bits/posix2_lim.h /usr/include/values.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/float.h \
+ ../../modules/core/includes/stack-def.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/core/includes/stackTypeVariable.h \
+ ../../modules/core/includes/BOOL.h \
+ ../../modules/core/includes/doublecomplex.h \
+ ../../modules/core/includes/stack1.h \
+ ../../modules/core/includes/scisparse.h \
+ ../../modules/core/includes/stack2.h \
+ ../../modules/core/includes/stack3.h \
+ ../../modules/core/includes/stack-optional.h \
+ ../../modules/core/includes/sci_types.h includes/import.h \
+ includes/dynlib_scicos.h src/c/var2sci.h \
+ ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h
+
+/usr/include/stdc-predef.h:
+
+src/c/createblklist.h:
+
+../../modules/scicos_blocks/includes/scicos_block4.h:
+
+/usr/include/math.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/include/x86_64-linux-gnu/bits/math-vector.h:
+
+/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_val.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_valf.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_vall.h:
+
+/usr/include/x86_64-linux-gnu/bits/inf.h:
+
+/usr/include/x86_64-linux-gnu/bits/nan.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathdef.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathcalls.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathinline.h:
+
+/usr/include/assert.h:
+
+/usr/include/stdlib.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/core/includes/stack-c.h:
+
+/usr/include/string.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+../../modules/core/includes/core_math.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
+
+/usr/include/values.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/float.h:
+
+../../modules/core/includes/stack-def.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/core/includes/stackTypeVariable.h:
+
+../../modules/core/includes/BOOL.h:
+
+../../modules/core/includes/doublecomplex.h:
+
+../../modules/core/includes/stack1.h:
+
+../../modules/core/includes/scisparse.h:
+
+../../modules/core/includes/stack2.h:
+
+../../modules/core/includes/stack3.h:
+
+../../modules/core/includes/stack-optional.h:
+
+../../modules/core/includes/sci_types.h:
+
+includes/import.h:
+
+includes/dynlib_scicos.h:
+
+src/c/var2sci.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-ddaskr.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-ddaskr.Plo
new file mode 100755
index 000000000..589c5a6d7
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-ddaskr.Plo
@@ -0,0 +1,181 @@
+src/c/libsciscicos_algo_la-ddaskr.lo: src/c/ddaskr.c \
+ /usr/include/stdc-predef.h /usr/include/stdio.h /usr/include/features.h \
+ /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/libio.h \
+ /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio2.h /usr/include/stdlib.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h /usr/include/string.h \
+ /usr/include/xlocale.h /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h \
+ ../../modules/core/includes/machine.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/float.h /usr/include/math.h \
+ /usr/include/x86_64-linux-gnu/bits/math-vector.h \
+ /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_val.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_valf.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_vall.h \
+ /usr/include/x86_64-linux-gnu/bits/inf.h \
+ /usr/include/x86_64-linux-gnu/bits/nan.h \
+ /usr/include/x86_64-linux-gnu/bits/mathdef.h \
+ /usr/include/x86_64-linux-gnu/bits/mathcalls.h \
+ /usr/include/x86_64-linux-gnu/bits/mathinline.h src/c/ddaskr.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_extension.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_config.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_types.h \
+ ../../modules/scicos/src/scicos_sundials/include/nvector/nvector_serial.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_nvector.h \
+ src/c/../scicos_sundials/src/ida/ida_impl.h \
+ ../../modules/scicos/src/scicos_sundials/include/ida/ida.h
+
+/usr/include/stdc-predef.h:
+
+/usr/include/stdio.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/sys_errlist.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio2.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+/usr/include/string.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+../../modules/core/includes/machine.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/float.h:
+
+/usr/include/math.h:
+
+/usr/include/x86_64-linux-gnu/bits/math-vector.h:
+
+/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_val.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_valf.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_vall.h:
+
+/usr/include/x86_64-linux-gnu/bits/inf.h:
+
+/usr/include/x86_64-linux-gnu/bits/nan.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathdef.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathcalls.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathinline.h:
+
+src/c/ddaskr.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_extension.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_config.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_types.h:
+
+../../modules/scicos/src/scicos_sundials/include/nvector/nvector_serial.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_nvector.h:
+
+src/c/../scicos_sundials/src/ida/ida_impl.h:
+
+../../modules/scicos/src/scicos_sundials/include/ida/ida.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-extractblklist.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-extractblklist.Plo
new file mode 100755
index 000000000..a43855c05
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-extractblklist.Plo
@@ -0,0 +1,152 @@
+src/c/libsciscicos_algo_la-extractblklist.lo: src/c/extractblklist.c \
+ /usr/include/stdc-predef.h /usr/include/string.h /usr/include/features.h \
+ /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \
+ /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/stdlib.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h /usr/include/assert.h \
+ ../../modules/core/includes/machine.h src/c/extractblklist.h \
+ ../../modules/scicos_blocks/includes/scicos_block4.h /usr/include/math.h \
+ /usr/include/x86_64-linux-gnu/bits/math-vector.h \
+ /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_val.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_valf.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_vall.h \
+ /usr/include/x86_64-linux-gnu/bits/inf.h \
+ /usr/include/x86_64-linux-gnu/bits/nan.h \
+ /usr/include/x86_64-linux-gnu/bits/mathdef.h \
+ /usr/include/x86_64-linux-gnu/bits/mathcalls.h \
+ /usr/include/x86_64-linux-gnu/bits/mathinline.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h src/c/MlistGetFieldNumber.h \
+ ../../modules/string/includes/cvstr.h \
+ ../../modules/string/includes/dynlib_string.h \
+ ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h
+
+/usr/include/stdc-predef.h:
+
+/usr/include/string.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+/usr/include/assert.h:
+
+../../modules/core/includes/machine.h:
+
+src/c/extractblklist.h:
+
+../../modules/scicos_blocks/includes/scicos_block4.h:
+
+/usr/include/math.h:
+
+/usr/include/x86_64-linux-gnu/bits/math-vector.h:
+
+/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_val.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_valf.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_vall.h:
+
+/usr/include/x86_64-linux-gnu/bits/inf.h:
+
+/usr/include/x86_64-linux-gnu/bits/nan.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathdef.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathcalls.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathinline.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+src/c/MlistGetFieldNumber.h:
+
+../../modules/string/includes/cvstr.h:
+
+../../modules/string/includes/dynlib_string.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-ezxml.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-ezxml.Plo
new file mode 100755
index 000000000..3cd893cf2
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-ezxml.Plo
@@ -0,0 +1,172 @@
+src/c/libsciscicos_algo_la-ezxml.lo: src/c/ezxml.c \
+ /usr/include/stdc-predef.h /usr/include/stdlib.h /usr/include/features.h \
+ /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h /usr/include/stdio.h \
+ /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio2.h /usr/include/string.h \
+ /usr/include/xlocale.h /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h /usr/include/ctype.h \
+ /usr/include/unistd.h /usr/include/x86_64-linux-gnu/bits/posix_opt.h \
+ /usr/include/x86_64-linux-gnu/bits/environments.h \
+ /usr/include/x86_64-linux-gnu/bits/confname.h /usr/include/getopt.h \
+ /usr/include/x86_64-linux-gnu/bits/unistd.h \
+ /usr/include/x86_64-linux-gnu/sys/mman.h \
+ /usr/include/x86_64-linux-gnu/bits/mman.h \
+ /usr/include/x86_64-linux-gnu/bits/mman-linux.h \
+ /usr/include/x86_64-linux-gnu/sys/stat.h \
+ /usr/include/x86_64-linux-gnu/bits/stat.h src/c/ezxml.h \
+ /usr/include/fcntl.h /usr/include/x86_64-linux-gnu/bits/fcntl.h \
+ /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h \
+ /usr/include/x86_64-linux-gnu/bits/fcntl2.h \
+ ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h
+
+/usr/include/stdc-predef.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+/usr/include/stdio.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/sys_errlist.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio2.h:
+
+/usr/include/string.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+/usr/include/ctype.h:
+
+/usr/include/unistd.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix_opt.h:
+
+/usr/include/x86_64-linux-gnu/bits/environments.h:
+
+/usr/include/x86_64-linux-gnu/bits/confname.h:
+
+/usr/include/getopt.h:
+
+/usr/include/x86_64-linux-gnu/bits/unistd.h:
+
+/usr/include/x86_64-linux-gnu/sys/mman.h:
+
+/usr/include/x86_64-linux-gnu/bits/mman.h:
+
+/usr/include/x86_64-linux-gnu/bits/mman-linux.h:
+
+/usr/include/x86_64-linux-gnu/sys/stat.h:
+
+/usr/include/x86_64-linux-gnu/bits/stat.h:
+
+src/c/ezxml.h:
+
+/usr/include/fcntl.h:
+
+/usr/include/x86_64-linux-gnu/bits/fcntl.h:
+
+/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:
+
+/usr/include/x86_64-linux-gnu/bits/fcntl2.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-il_sim.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-il_sim.Plo
new file mode 100755
index 000000000..4bd4dd2ba
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-il_sim.Plo
@@ -0,0 +1,91 @@
+src/c/libsciscicos_algo_la-il_sim.lo: src/c/il_sim.c \
+ /usr/include/stdc-predef.h src/c/il_sim.h \
+ ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h /usr/include/stdlib.h \
+ /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h
+
+/usr/include/stdc-predef.h:
+
+src/c/il_sim.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-il_state.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-il_state.Plo
new file mode 100755
index 000000000..b5c7e5a0d
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-il_state.Plo
@@ -0,0 +1,91 @@
+src/c/libsciscicos_algo_la-il_state.lo: src/c/il_state.c \
+ /usr/include/stdc-predef.h src/c/il_state.h \
+ ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h /usr/include/stdlib.h \
+ /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h
+
+/usr/include/stdc-predef.h:
+
+src/c/il_state.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-import.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-import.Plo
new file mode 100755
index 000000000..e0276007d
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-import.Plo
@@ -0,0 +1,180 @@
+src/c/libsciscicos_algo_la-import.lo: src/c/import.c \
+ /usr/include/stdc-predef.h /usr/include/string.h /usr/include/features.h \
+ /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \
+ /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/stdlib.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h /usr/include/stdio.h \
+ /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio2.h \
+ ../../modules/core/includes/machine.h includes/import.h \
+ includes/dynlib_scicos.h \
+ ../../modules/scicos_blocks/includes/scicos_block4.h /usr/include/math.h \
+ /usr/include/x86_64-linux-gnu/bits/math-vector.h \
+ /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_val.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_valf.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_vall.h \
+ /usr/include/x86_64-linux-gnu/bits/inf.h \
+ /usr/include/x86_64-linux-gnu/bits/nan.h \
+ /usr/include/x86_64-linux-gnu/bits/mathdef.h \
+ /usr/include/x86_64-linux-gnu/bits/mathcalls.h \
+ /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/assert.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h includes/scicos.h \
+ includes/import.h src/c/scicos_internal.h includes/scicos-def.h \
+ ../../modules/string/includes/cvstr.h \
+ ../../modules/string/includes/dynlib_string.h
+
+/usr/include/stdc-predef.h:
+
+/usr/include/string.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+/usr/include/stdio.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/sys_errlist.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio2.h:
+
+../../modules/core/includes/machine.h:
+
+includes/import.h:
+
+includes/dynlib_scicos.h:
+
+../../modules/scicos_blocks/includes/scicos_block4.h:
+
+/usr/include/math.h:
+
+/usr/include/x86_64-linux-gnu/bits/math-vector.h:
+
+/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_val.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_valf.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_vall.h:
+
+/usr/include/x86_64-linux-gnu/bits/inf.h:
+
+/usr/include/x86_64-linux-gnu/bits/nan.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathdef.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathcalls.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathinline.h:
+
+/usr/include/assert.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+includes/scicos.h:
+
+includes/import.h:
+
+src/c/scicos_internal.h:
+
+includes/scicos-def.h:
+
+../../modules/string/includes/cvstr.h:
+
+../../modules/string/includes/dynlib_string.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-lsodar.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-lsodar.Plo
new file mode 100755
index 000000000..26cf53e07
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-lsodar.Plo
@@ -0,0 +1,149 @@
+src/c/libsciscicos_algo_la-lsodar.lo: src/c/lsodar.c \
+ /usr/include/stdc-predef.h /usr/include/stdio.h /usr/include/features.h \
+ /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/libio.h \
+ /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio2.h /usr/include/stdlib.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h /usr/include/string.h \
+ /usr/include/xlocale.h /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h \
+ ../../modules/core/includes/machine.h src/c/lsodar.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_extension.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_config.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_types.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/float.h \
+ ../../modules/scicos/src/scicos_sundials/include/nvector/nvector_serial.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_nvector.h \
+ src/c/../scicos_sundials/src/cvode/cvode_impl.h \
+ ../../modules/scicos/src/scicos_sundials/include/cvode/cvode.h
+
+/usr/include/stdc-predef.h:
+
+/usr/include/stdio.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/sys_errlist.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio2.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+/usr/include/string.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+../../modules/core/includes/machine.h:
+
+src/c/lsodar.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_extension.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_config.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_types.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/float.h:
+
+../../modules/scicos/src/scicos_sundials/include/nvector/nvector_serial.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_nvector.h:
+
+src/c/../scicos_sundials/src/cvode/cvode_impl.h:
+
+../../modules/scicos/src/scicos_sundials/include/cvode/cvode.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-sciblk2.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-sciblk2.Plo
new file mode 100755
index 000000000..4f6e26400
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-sciblk2.Plo
@@ -0,0 +1,93 @@
+src/c/libsciscicos_algo_la-sciblk2.lo: src/c/sciblk2.c \
+ /usr/include/stdc-predef.h ../../modules/core/includes/machine.h \
+ src/c/sciblk2.h ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h /usr/include/stdlib.h \
+ /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h
+
+/usr/include/stdc-predef.h:
+
+../../modules/core/includes/machine.h:
+
+src/c/sciblk2.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-sciblk4.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-sciblk4.Plo
new file mode 100755
index 000000000..7e35b0b23
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-sciblk4.Plo
@@ -0,0 +1,256 @@
+src/c/libsciscicos_algo_la-sciblk4.lo: src/c/sciblk4.c \
+ /usr/include/stdc-predef.h /usr/include/string.h /usr/include/features.h \
+ /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \
+ /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/stdlib.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h /usr/include/stdio.h \
+ /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio2.h \
+ ../../modules/core/includes/stack-c.h \
+ ../../modules/core/includes/core_math.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+ /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/local_lim.h \
+ /usr/include/linux/limits.h \
+ /usr/include/x86_64-linux-gnu/bits/posix2_lim.h /usr/include/math.h \
+ /usr/include/x86_64-linux-gnu/bits/math-vector.h \
+ /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_val.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_valf.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_vall.h \
+ /usr/include/x86_64-linux-gnu/bits/inf.h \
+ /usr/include/x86_64-linux-gnu/bits/nan.h \
+ /usr/include/x86_64-linux-gnu/bits/mathdef.h \
+ /usr/include/x86_64-linux-gnu/bits/mathcalls.h \
+ /usr/include/x86_64-linux-gnu/bits/mathinline.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h \
+ ../../modules/core/includes/stack-def.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/core/includes/stackTypeVariable.h \
+ ../../modules/core/includes/BOOL.h \
+ ../../modules/core/includes/doublecomplex.h \
+ ../../modules/core/includes/stack1.h \
+ ../../modules/core/includes/scisparse.h \
+ ../../modules/core/includes/stack2.h \
+ ../../modules/core/includes/stack3.h \
+ ../../modules/core/includes/stack-optional.h \
+ ../../modules/core/includes/sci_types.h \
+ ../../modules/scicos_blocks/includes/scicos_block4.h \
+ /usr/include/assert.h ../../modules/output_stream/includes/Scierror.h \
+ ../../modules/output_stream/includes/do_error_number.h \
+ ../../modules/core/includes/machine.h includes/scicos.h \
+ includes/import.h includes/dynlib_scicos.h src/c/sciblk4.h \
+ includes/import.h src/c/createblklist.h \
+ ../../modules/localization/includes/localization.h \
+ /usr/include/libintl.h /usr/include/locale.h \
+ /usr/include/x86_64-linux-gnu/bits/locale.h \
+ ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h
+
+/usr/include/stdc-predef.h:
+
+/usr/include/string.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+/usr/include/stdio.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/sys_errlist.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio2.h:
+
+../../modules/core/includes/stack-c.h:
+
+../../modules/core/includes/core_math.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
+
+/usr/include/math.h:
+
+/usr/include/x86_64-linux-gnu/bits/math-vector.h:
+
+/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_val.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_valf.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_vall.h:
+
+/usr/include/x86_64-linux-gnu/bits/inf.h:
+
+/usr/include/x86_64-linux-gnu/bits/nan.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathdef.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathcalls.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathinline.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+../../modules/core/includes/stack-def.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/core/includes/stackTypeVariable.h:
+
+../../modules/core/includes/BOOL.h:
+
+../../modules/core/includes/doublecomplex.h:
+
+../../modules/core/includes/stack1.h:
+
+../../modules/core/includes/scisparse.h:
+
+../../modules/core/includes/stack2.h:
+
+../../modules/core/includes/stack3.h:
+
+../../modules/core/includes/stack-optional.h:
+
+../../modules/core/includes/sci_types.h:
+
+../../modules/scicos_blocks/includes/scicos_block4.h:
+
+/usr/include/assert.h:
+
+../../modules/output_stream/includes/Scierror.h:
+
+../../modules/output_stream/includes/do_error_number.h:
+
+../../modules/core/includes/machine.h:
+
+includes/scicos.h:
+
+includes/import.h:
+
+includes/dynlib_scicos.h:
+
+src/c/sciblk4.h:
+
+includes/import.h:
+
+src/c/createblklist.h:
+
+../../modules/localization/includes/localization.h:
+
+/usr/include/libintl.h:
+
+/usr/include/locale.h:
+
+/usr/include/x86_64-linux-gnu/bits/locale.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-scicos.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-scicos.Plo
new file mode 100755
index 000000000..462885dc0
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-scicos.Plo
@@ -0,0 +1,360 @@
+src/c/libsciscicos_algo_la-scicos.lo: src/c/scicos.c \
+ /usr/include/stdc-predef.h /usr/include/stdlib.h /usr/include/features.h \
+ /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h /usr/include/string.h \
+ /usr/include/xlocale.h /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h /usr/include/math.h \
+ /usr/include/x86_64-linux-gnu/bits/math-vector.h \
+ /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_val.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_valf.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_vall.h \
+ /usr/include/x86_64-linux-gnu/bits/inf.h \
+ /usr/include/x86_64-linux-gnu/bits/nan.h \
+ /usr/include/x86_64-linux-gnu/bits/mathdef.h \
+ /usr/include/x86_64-linux-gnu/bits/mathcalls.h \
+ /usr/include/x86_64-linux-gnu/bits/mathinline.h \
+ ../../modules/scicos/src/scicos_sundials/include/cvode/cvode.h \
+ /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \
+ /usr/include/wchar.h /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio2.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_nvector.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_types.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_config.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/float.h \
+ ../../modules/scicos/src/scicos_sundials/include/cvode/cvode_dense.h \
+ ../../modules/scicos/src/scicos_sundials/include/cvode/cvode_direct.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_direct.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_dense.h \
+ ../../modules/scicos/src/scicos_sundials/include/ida/ida.h \
+ ../../modules/scicos/src/scicos_sundials/include/ida/ida_dense.h \
+ ../../modules/scicos/src/scicos_sundials/include/ida/ida_direct.h \
+ ../../modules/scicos/src/scicos_sundials/include/nvector/nvector_serial.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_math.h \
+ ../../modules/scicos/src/scicos_sundials/include/kinsol/kinsol.h \
+ ../../modules/scicos/src/scicos_sundials/include/kinsol/kinsol_dense.h \
+ ../../modules/scicos/src/scicos_sundials/include/kinsol/kinsol_direct.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_extension.h \
+ ../../modules/scicos/src/scicos_sundials/src/ida/ida_impl.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/dynamic_link/includes/dynamic_link.h \
+ ../../modules/dynamic_link/includes/dynlib_dynamic_link.h \
+ ../../modules/core/includes/BOOL.h includes/scicos-def.h \
+ ../../modules/core/includes/stack-def.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/output_stream/includes/sciprint.h includes/scicos.h \
+ ../../modules/scicos_blocks/includes/scicos_block4.h \
+ /usr/include/assert.h includes/import.h includes/dynlib_scicos.h \
+ includes/import.h src/c/scicos_internal.h \
+ ../../modules/scicos_blocks/includes/blocks.h \
+ ../../modules/core/includes/core_math.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+ /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/local_lim.h \
+ /usr/include/linux/limits.h \
+ /usr/include/x86_64-linux-gnu/bits/posix2_lim.h /usr/include/values.h \
+ ../../modules/core/includes/storeCommand.h \
+ ../../modules/core/includes/syncexec.h \
+ ../../modules/time/includes/realtime.h \
+ ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h \
+ ../../modules/string/includes/cvstr.h \
+ ../../modules/string/includes/dynlib_string.h src/c/ezxml.h \
+ /usr/include/fcntl.h /usr/include/x86_64-linux-gnu/bits/fcntl.h \
+ /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h \
+ /usr/include/x86_64-linux-gnu/bits/stat.h \
+ /usr/include/x86_64-linux-gnu/bits/fcntl2.h \
+ ../../modules/core/includes/xscion.h src/c/sciblk2.h src/c/sciblk4.h \
+ includes/dynlib_scicos.h src/c/lsodar.h \
+ ../../modules/scicos/src/scicos_sundials/include/sundials/sundials_extension.h \
+ src/c/../scicos_sundials/src/cvode/cvode_impl.h src/c/ddaskr.h \
+ src/c/../scicos_sundials/src/ida/ida_impl.h \
+ ../../modules/localization/includes/localization.h \
+ /usr/include/libintl.h /usr/include/locale.h \
+ /usr/include/x86_64-linux-gnu/bits/locale.h \
+ ../../modules/localization/includes/charEncoding.h \
+ /usr/include/x86_64-linux-gnu/bits/wchar.h \
+ /usr/include/x86_64-linux-gnu/bits/wchar2.h \
+ /usr/include/x86_64-linux-gnu/sys/stat.h
+
+/usr/include/stdc-predef.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+/usr/include/string.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+/usr/include/math.h:
+
+/usr/include/x86_64-linux-gnu/bits/math-vector.h:
+
+/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_val.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_valf.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_vall.h:
+
+/usr/include/x86_64-linux-gnu/bits/inf.h:
+
+/usr/include/x86_64-linux-gnu/bits/nan.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathdef.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathcalls.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathinline.h:
+
+../../modules/scicos/src/scicos_sundials/include/cvode/cvode.h:
+
+/usr/include/stdio.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/sys_errlist.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio2.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_nvector.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_types.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_config.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/float.h:
+
+../../modules/scicos/src/scicos_sundials/include/cvode/cvode_dense.h:
+
+../../modules/scicos/src/scicos_sundials/include/cvode/cvode_direct.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_direct.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_dense.h:
+
+../../modules/scicos/src/scicos_sundials/include/ida/ida.h:
+
+../../modules/scicos/src/scicos_sundials/include/ida/ida_dense.h:
+
+../../modules/scicos/src/scicos_sundials/include/ida/ida_direct.h:
+
+../../modules/scicos/src/scicos_sundials/include/nvector/nvector_serial.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_math.h:
+
+../../modules/scicos/src/scicos_sundials/include/kinsol/kinsol.h:
+
+../../modules/scicos/src/scicos_sundials/include/kinsol/kinsol_dense.h:
+
+../../modules/scicos/src/scicos_sundials/include/kinsol/kinsol_direct.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_extension.h:
+
+../../modules/scicos/src/scicos_sundials/src/ida/ida_impl.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/dynamic_link/includes/dynamic_link.h:
+
+../../modules/dynamic_link/includes/dynlib_dynamic_link.h:
+
+../../modules/core/includes/BOOL.h:
+
+includes/scicos-def.h:
+
+../../modules/core/includes/stack-def.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/output_stream/includes/sciprint.h:
+
+includes/scicos.h:
+
+../../modules/scicos_blocks/includes/scicos_block4.h:
+
+/usr/include/assert.h:
+
+includes/import.h:
+
+includes/dynlib_scicos.h:
+
+includes/import.h:
+
+src/c/scicos_internal.h:
+
+../../modules/scicos_blocks/includes/blocks.h:
+
+../../modules/core/includes/core_math.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
+
+/usr/include/values.h:
+
+../../modules/core/includes/storeCommand.h:
+
+../../modules/core/includes/syncexec.h:
+
+../../modules/time/includes/realtime.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
+
+../../modules/string/includes/cvstr.h:
+
+../../modules/string/includes/dynlib_string.h:
+
+src/c/ezxml.h:
+
+/usr/include/fcntl.h:
+
+/usr/include/x86_64-linux-gnu/bits/fcntl.h:
+
+/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:
+
+/usr/include/x86_64-linux-gnu/bits/stat.h:
+
+/usr/include/x86_64-linux-gnu/bits/fcntl2.h:
+
+../../modules/core/includes/xscion.h:
+
+src/c/sciblk2.h:
+
+src/c/sciblk4.h:
+
+includes/dynlib_scicos.h:
+
+src/c/lsodar.h:
+
+../../modules/scicos/src/scicos_sundials/include/sundials/sundials_extension.h:
+
+src/c/../scicos_sundials/src/cvode/cvode_impl.h:
+
+src/c/ddaskr.h:
+
+src/c/../scicos_sundials/src/ida/ida_impl.h:
+
+../../modules/localization/includes/localization.h:
+
+/usr/include/libintl.h:
+
+/usr/include/locale.h:
+
+/usr/include/x86_64-linux-gnu/bits/locale.h:
+
+../../modules/localization/includes/charEncoding.h:
+
+/usr/include/x86_64-linux-gnu/bits/wchar.h:
+
+/usr/include/x86_64-linux-gnu/bits/wchar2.h:
+
+/usr/include/x86_64-linux-gnu/sys/stat.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-scicos_free.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-scicos_free.Plo
new file mode 100755
index 000000000..b424d9728
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-scicos_free.Plo
@@ -0,0 +1,93 @@
+src/c/libsciscicos_algo_la-scicos_free.lo: src/c/scicos_free.c \
+ /usr/include/stdc-predef.h ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h /usr/include/stdlib.h \
+ /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h includes/scicos_free.h \
+ ../../modules/scicos_blocks/includes/scicos_block.h
+
+/usr/include/stdc-predef.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+includes/scicos_free.h:
+
+../../modules/scicos_blocks/includes/scicos_block.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-scicos_malloc.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-scicos_malloc.Plo
new file mode 100755
index 000000000..80c1aa197
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-scicos_malloc.Plo
@@ -0,0 +1,93 @@
+src/c/libsciscicos_algo_la-scicos_malloc.lo: src/c/scicos_malloc.c \
+ /usr/include/stdc-predef.h ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h /usr/include/stdlib.h \
+ /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h includes/scicos_malloc.h \
+ ../../modules/scicos_blocks/includes/scicos_block.h
+
+/usr/include/stdc-predef.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+includes/scicos_malloc.h:
+
+../../modules/scicos_blocks/includes/scicos_block.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-scicos_print.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-scicos_print.Plo
new file mode 100755
index 000000000..d4be0e775
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-scicos_print.Plo
@@ -0,0 +1,13 @@
+src/c/libsciscicos_algo_la-scicos_print.lo: src/c/scicos_print.c \
+ /usr/include/stdc-predef.h \
+ ../../modules/output_stream/includes/sciprint.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+ ../../modules/core/includes/BOOL.h
+
+/usr/include/stdc-predef.h:
+
+../../modules/output_stream/includes/sciprint.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h:
+
+../../modules/core/includes/BOOL.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-tree.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-tree.Plo
new file mode 100755
index 000000000..67cf0bf9a
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-tree.Plo
@@ -0,0 +1,134 @@
+src/c/libsciscicos_algo_la-tree.lo: src/c/tree.c \
+ /usr/include/stdc-predef.h /usr/include/stdio.h /usr/include/features.h \
+ /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/libio.h \
+ /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio.h \
+ /usr/include/x86_64-linux-gnu/bits/stdio2.h /usr/include/memory.h \
+ /usr/include/string.h /usr/include/xlocale.h \
+ /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/stdlib.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h src/c/tree.h
+
+/usr/include/stdc-predef.h:
+
+/usr/include/stdio.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/sys_errlist.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdio2.h:
+
+/usr/include/memory.h:
+
+/usr/include/string.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+src/c/tree.h:
diff --git a/modules/scicos/src/c/.deps/libsciscicos_algo_la-var2sci.Plo b/modules/scicos/src/c/.deps/libsciscicos_algo_la-var2sci.Plo
new file mode 100755
index 000000000..e7a3cc27f
--- /dev/null
+++ b/modules/scicos/src/c/.deps/libsciscicos_algo_la-var2sci.Plo
@@ -0,0 +1,212 @@
+src/c/libsciscicos_algo_la-var2sci.lo: src/c/var2sci.c \
+ /usr/include/stdc-predef.h src/c/var2sci.h includes/import.h \
+ ../../modules/core/includes/machine.h includes/dynlib_scicos.h \
+ ../../modules/scicos_blocks/includes/scicos_block4.h /usr/include/math.h \
+ /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/include/x86_64-linux-gnu/bits/math-vector.h \
+ /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_val.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_valf.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_vall.h \
+ /usr/include/x86_64-linux-gnu/bits/inf.h \
+ /usr/include/x86_64-linux-gnu/bits/nan.h \
+ /usr/include/x86_64-linux-gnu/bits/mathdef.h \
+ /usr/include/x86_64-linux-gnu/bits/mathcalls.h \
+ /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/assert.h \
+ /usr/include/stdlib.h /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h \
+ ../../modules/core/includes/stack-c.h /usr/include/string.h \
+ /usr/include/xlocale.h /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h \
+ ../../modules/core/includes/core_math.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+ /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/local_lim.h \
+ /usr/include/linux/limits.h \
+ /usr/include/x86_64-linux-gnu/bits/posix2_lim.h /usr/include/values.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/float.h \
+ ../../modules/core/includes/stack-def.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/core/includes/stackTypeVariable.h \
+ ../../modules/core/includes/BOOL.h \
+ ../../modules/core/includes/doublecomplex.h \
+ ../../modules/core/includes/stack1.h \
+ ../../modules/core/includes/scisparse.h \
+ ../../modules/core/includes/stack2.h \
+ ../../modules/core/includes/stack3.h \
+ ../../modules/core/includes/stack-optional.h \
+ ../../modules/core/includes/sci_types.h \
+ ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h
+
+/usr/include/stdc-predef.h:
+
+src/c/var2sci.h:
+
+includes/import.h:
+
+../../modules/core/includes/machine.h:
+
+includes/dynlib_scicos.h:
+
+../../modules/scicos_blocks/includes/scicos_block4.h:
+
+/usr/include/math.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/include/x86_64-linux-gnu/bits/math-vector.h:
+
+/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_val.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_valf.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_vall.h:
+
+/usr/include/x86_64-linux-gnu/bits/inf.h:
+
+/usr/include/x86_64-linux-gnu/bits/nan.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathdef.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathcalls.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathinline.h:
+
+/usr/include/assert.h:
+
+/usr/include/stdlib.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+../../modules/core/includes/stack-c.h:
+
+/usr/include/string.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+../../modules/core/includes/core_math.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
+
+/usr/include/values.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/float.h:
+
+../../modules/core/includes/stack-def.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/core/includes/stackTypeVariable.h:
+
+../../modules/core/includes/BOOL.h:
+
+../../modules/core/includes/doublecomplex.h:
+
+../../modules/core/includes/stack1.h:
+
+../../modules/core/includes/scisparse.h:
+
+../../modules/core/includes/stack2.h:
+
+../../modules/core/includes/stack3.h:
+
+../../modules/core/includes/stack-optional.h:
+
+../../modules/core/includes/sci_types.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
diff --git a/modules/scicos/src/c/.dirstamp b/modules/scicos/src/c/.dirstamp
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/modules/scicos/src/c/.dirstamp
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-MlistGetFieldNumber.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-MlistGetFieldNumber.o
new file mode 100755
index 000000000..788728ea4
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-MlistGetFieldNumber.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-copyvarfromlistentry.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-copyvarfromlistentry.o
new file mode 100755
index 000000000..1b20fdbd3
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-copyvarfromlistentry.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-createblklist.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-createblklist.o
new file mode 100755
index 000000000..8190e6838
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-createblklist.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-ddaskr.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-ddaskr.o
new file mode 100755
index 000000000..4ba3a7543
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-ddaskr.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-extractblklist.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-extractblklist.o
new file mode 100755
index 000000000..f8719835b
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-extractblklist.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-ezxml.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-ezxml.o
new file mode 100755
index 000000000..45e2fe60b
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-ezxml.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-il_sim.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-il_sim.o
new file mode 100755
index 000000000..5391baaea
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-il_sim.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-il_state.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-il_state.o
new file mode 100755
index 000000000..5befbe1ae
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-il_state.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-import.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-import.o
new file mode 100755
index 000000000..ea3f20055
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-import.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-lsodar.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-lsodar.o
new file mode 100755
index 000000000..cf7a9fa74
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-lsodar.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-sciblk2.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-sciblk2.o
new file mode 100755
index 000000000..a77fbeb95
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-sciblk2.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-sciblk4.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-sciblk4.o
new file mode 100755
index 000000000..c3eb0e756
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-sciblk4.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-scicos.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-scicos.o
new file mode 100755
index 000000000..82379945e
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-scicos.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-scicos_free.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-scicos_free.o
new file mode 100755
index 000000000..a4d50d709
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-scicos_free.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-scicos_malloc.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-scicos_malloc.o
new file mode 100755
index 000000000..ae8e1511d
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-scicos_malloc.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-scicos_print.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-scicos_print.o
new file mode 100755
index 000000000..8e394c957
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-scicos_print.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-tree.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-tree.o
new file mode 100755
index 000000000..bcaf63efc
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-tree.o
Binary files differ
diff --git a/modules/scicos/src/c/.libs/libsciscicos_algo_la-var2sci.o b/modules/scicos/src/c/.libs/libsciscicos_algo_la-var2sci.o
new file mode 100755
index 000000000..2159bce3b
--- /dev/null
+++ b/modules/scicos/src/c/.libs/libsciscicos_algo_la-var2sci.o
Binary files differ
diff --git a/modules/scicos/src/c/Action_binding_Import.def b/modules/scicos/src/c/Action_binding_Import.def
new file mode 100755
index 000000000..17db2d097
--- /dev/null
+++ b/modules/scicos/src/c/Action_binding_Import.def
@@ -0,0 +1,7 @@
+LIBRARY sciaction_binding.dll
+
+
+EXPORTS
+;
+
+
diff --git a/modules/scicos/src/c/Core_f_Import.def b/modules/scicos/src/c/Core_f_Import.def
new file mode 100755
index 000000000..42f597647
--- /dev/null
+++ b/modules/scicos/src/c/Core_f_Import.def
@@ -0,0 +1,14 @@
+ LIBRARY core_f.dll
+
+
+EXPORTS
+;
+;core_f
+;
+dtosci_
+funs_
+itosci_
+mktlist_
+mkmlist_
+mklist_
+
diff --git a/modules/scicos/src/c/DllmainScicos.c b/modules/scicos/src/c/DllmainScicos.c
new file mode 100755
index 000000000..87ca713cd
--- /dev/null
+++ b/modules/scicos/src/c/DllmainScicos.c
@@ -0,0 +1,23 @@
+/*--------------------------------------------------------------------------*/
+/* INRIA 2008 */
+/* Allan CORNET */
+/*--------------------------------------------------------------------------*/
+#include <windows.h>
+/*--------------------------------------------------------------------------*/
+int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
+{
+ switch (reason)
+ {
+ case DLL_PROCESS_ATTACH:
+ break;
+ case DLL_PROCESS_DETACH:
+ break;
+ case DLL_THREAD_ATTACH:
+ break;
+ case DLL_THREAD_DETACH:
+ break;
+ }
+ return 1;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/modules/scicos/src/c/Dynamic_link_Import.def b/modules/scicos/src/c/Dynamic_link_Import.def
new file mode 100755
index 000000000..84b42a58a
--- /dev/null
+++ b/modules/scicos/src/c/Dynamic_link_Import.def
@@ -0,0 +1,6 @@
+LIBRARY dynamic_link.dll
+
+
+EXPORTS
+GetDynFunc
+iislink_ \ No newline at end of file
diff --git a/modules/scicos/src/c/Graphics_Import.def b/modules/scicos/src/c/Graphics_Import.def
new file mode 100755
index 000000000..0602db1be
--- /dev/null
+++ b/modules/scicos/src/c/Graphics_Import.def
@@ -0,0 +1,4 @@
+LIBRARY graphics.dll
+
+
+EXPORTS
diff --git a/modules/scicos/src/c/Intersci_Import.def b/modules/scicos/src/c/Intersci_Import.def
new file mode 100755
index 000000000..aa1b41329
--- /dev/null
+++ b/modules/scicos/src/c/Intersci_Import.def
@@ -0,0 +1,4 @@
+LIBRARY intersci.dll
+
+
+EXPORTS
diff --git a/modules/scicos/src/c/Localization_Import.def b/modules/scicos/src/c/Localization_Import.def
new file mode 100755
index 000000000..055946802
--- /dev/null
+++ b/modules/scicos/src/c/Localization_Import.def
@@ -0,0 +1,5 @@
+ LIBRARY scilocalization.dll
+
+
+EXPORTS
+to_wide_string \ No newline at end of file
diff --git a/modules/scicos/src/c/MlistGetFieldNumber.c b/modules/scicos/src/c/MlistGetFieldNumber.c
new file mode 100755
index 000000000..340683e60
--- /dev/null
+++ b/modules/scicos/src/c/MlistGetFieldNumber.c
@@ -0,0 +1,57 @@
+/* Scicos
+*
+* Copyright (C) INRIA - Allan LAYEC
+*
+* 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 <string.h>
+#include <stdlib.h>
+#include "MlistGetFieldNumber.h"
+#include "cvstr.h"
+#include "MALLOC.h"
+#include "core_math.h"
+#include "stack-def.h"
+/*--------------------------------------------------------------------------*/
+extern int *listentry(int *header, int i);
+/*--------------------------------------------------------------------------*/
+int MlistGetFieldNumber(int *ptr, const char *string)
+{
+ int nf = 0, longueur = 0, istart = 0, k = 0, ilocal = 0, retval = 0;
+ int *headerstr = NULL;
+ /* allocate a place for the trailing '\0' */
+ static char str[nlgh + 1];
+
+ headerstr = listentry(ptr , 1);
+ nf = headerstr[1] * headerstr[2] - 1; /* number of fields */
+ retval = -1;
+ for (k = 0; k < nf; k++)
+ {
+ longueur = Min( headerstr[6 + k] - headerstr[5 + k] , nlgh); /* size of kth fieldname */
+ istart = 5 + nf + headerstr[5 + k]; /* start of kth fieldname code */
+
+ C2F(cvstr)(&longueur, &headerstr[istart], str, (ilocal = 1, &ilocal), longueur);
+ str[longueur] = '\0';
+ if (strcmp(string, str) == 0)
+ {
+ retval = k + 2;
+ break;
+ }
+ }
+ return retval;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/MlistGetFieldNumber.h b/modules/scicos/src/c/MlistGetFieldNumber.h
new file mode 100755
index 000000000..edeeb0d1a
--- /dev/null
+++ b/modules/scicos/src/c/MlistGetFieldNumber.h
@@ -0,0 +1,33 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - Allan CORNET
+*
+* 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
+*/
+/*--------------------------------------------------------------------------*/
+#ifndef __MLISTGETFIELDNUMBER_H__
+#define __MLISTGETFIELDNUMBER_H__
+
+/**
+* Get number of Field from the name of MList
+*
+*/
+int MlistGetFieldNumber(int *ptr, const char *string);
+
+#endif /* __MLISTGETFIELDNUMBER_H__ */
+/*--------------------------------------------------------------------------*/
+
diff --git a/modules/scicos/src/c/Output_stream_Import.def b/modules/scicos/src/c/Output_stream_Import.def
new file mode 100755
index 000000000..7ef76e2bd
--- /dev/null
+++ b/modules/scicos/src/c/Output_stream_Import.def
@@ -0,0 +1,12 @@
+LIBRARY output_stream.dll
+
+
+EXPORTS
+;
+; output_stream
+error_
+Scierror
+msgs_
+sciprint
+scivprint
+
diff --git a/modules/scicos/src/c/Scicos_Export.def b/modules/scicos/src/c/Scicos_Export.def
new file mode 100755
index 000000000..54fbaa9d2
--- /dev/null
+++ b/modules/scicos/src/c/Scicos_Export.def
@@ -0,0 +1,24 @@
+LIBRARY scicos.dll
+
+
+EXPORTS
+;
+; SEP 35
+scicos_malloc
+scicos_free
+scicos_print
+scicos_
+callf
+get_phase_simulation
+set_block_error
+get_scicos_time
+set_scicos_time
+set_pointer_xproperty
+do_cold_restart
+get_block_number
+end_scicos_sim
+Coserror
+Set_Jacobian_flag
+Get_Jacobian_parameter
+write_xml_states
+read_xml_initial_states
diff --git a/modules/scicos/src/c/Scicos_blocks_f_Import.def b/modules/scicos/src/c/Scicos_blocks_f_Import.def
new file mode 100755
index 000000000..8cd3f8c07
--- /dev/null
+++ b/modules/scicos/src/c/Scicos_blocks_f_Import.def
@@ -0,0 +1,81 @@
+LIBRARY scicos_blocks_f.dll
+
+
+EXPORTS
+sciblk_
+csslti_
+cstblk_
+delay_
+delayv_
+demux_
+diffblk_
+dlradp_
+dollar_
+dsslti_
+eselect_
+evtdly_
+expblk_
+forblk_
+fsv_
+gensin_
+gensqr_
+hltblk_
+ifthel_
+integr_
+intplt_
+intpol_
+intrp2_
+intrpl_
+invblk_
+iocopy_
+logblk_
+lookup_
+lsplit_
+lusat_
+maxblk_
+memo_
+mfclck_
+minblk_
+mux_
+pload_
+powblk_
+qzcel_
+qzflr_
+qzrnd_
+qztrn_
+readf_
+rndblk_
+samphold_
+sawtth_
+selblk_
+sinblk_
+sqrblk_
+sum2_
+sum3_
+tanblk_
+tcslti_
+tcsltj_
+timblk_
+trash_
+writef_
+zcross_
+sciblk_
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/scicos/src/c/String_Import.def b/modules/scicos/src/c/String_Import.def
new file mode 100755
index 000000000..566bb3c13
--- /dev/null
+++ b/modules/scicos/src/c/String_Import.def
@@ -0,0 +1,8 @@
+LIBRARY string.dll
+
+
+EXPORTS
+;
+; string
+cvstr_
+
diff --git a/modules/scicos/src/c/cli/scicos-cli.rc b/modules/scicos/src/c/cli/scicos-cli.rc
new file mode 100755
index 000000000..556827a51
--- /dev/null
+++ b/modules/scicos/src/c/cli/scicos-cli.rc
@@ -0,0 +1,96 @@
+// Microsoft Visual C++ generated resource script.
+//
+
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+//#include "afxres.h"
+#define APSTUDIO_HIDDEN_SYMBOLS
+#include "windows.h"
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// French (France) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
+#ifdef _WIN32
+LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 5,5,2,0
+ PRODUCTVERSION 5,5,2,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040c04b0"
+ BEGIN
+ VALUE "FileDescription", "scicos-cli module"
+ VALUE "FileVersion", "5, 5, 2, 0"
+ VALUE "InternalName", "scicos-cli module"
+ VALUE "LegalCopyright", "Copyright (C) 2017"
+ VALUE "OriginalFilename", "scicos-cli.dll"
+ VALUE "ProductName", "scicos-cli module"
+ VALUE "ProductVersion", "5, 5, 2, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40c, 1200
+ END
+END
+
+#endif // French (France) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/modules/scicos/src/c/cli/scicos-cli.vcxproj b/modules/scicos/src/c/cli/scicos-cli.vcxproj
new file mode 100755
index 000000000..4a095e575
--- /dev/null
+++ b/modules/scicos/src/c/cli/scicos-cli.vcxproj
@@ -0,0 +1,381 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{A1CE241B-0FA7-488D-B737-1A1BC0F6A85E}</ProjectGuid>
+ <RootNamespace>scicos</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../;../../../includes;../../../../core/includes;../../../../time/includes;../../../../api_scilab/includes;../../../../output_stream/includes;../../../../scicos_blocks/includes;../../../../windows_tools/includes;../../../../localization/includes;../../../../string/includes;../../../../intersci/src/lib;../../../../dynamic_link/includes;../../scicos_sundials/include;../../scicos_sundials/include/sundials;../../scicos_sundials/src/ida;../../../../action_binding/includes;../../../../../libs/intl;../../../../intersci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCICOS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <WarningLevel>Level3</WarningLevel>
+ </ClCompile>
+ <PreLinkEvent>
+ <Message>Make dependencies</Message>
+ <Command>lib /DEF:"$(ProjectDir)../core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Scicos_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Output_stream_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)output_stream.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../String_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)string.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Dynamic_link_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)dynamic_link.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../nographics_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)nographics.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Scicos_blocks_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_blocks_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../core_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../differential_equations_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)differential_equations_f.lib" 1&gt;NUL 2&gt;NUL</Command>
+ </PreLinkEvent>
+ <Link>
+ <AdditionalDependencies>../../../../../bin/libintl.lib;../../../../../bin/lapack.lib;../../../../../bin/blasplus.lib;../../../../../bin/linpack_f.lib;core.lib;output_stream.lib;string.lib;dynamic_link.lib;nographics.lib;scicos_blocks_f.lib;scicos_f.lib;scilocalization.lib;elementary_functions_f.lib;core_f.lib;differential_equations_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
+ <IgnoreSpecificDefaultLibraries>
+ </IgnoreSpecificDefaultLibraries>
+ <ModuleDefinitionFile>scicos-cli_export.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ </Link>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <Midl>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../;../../../includes;../../../../core/includes;../../../../time/includes;../../../../api_scilab/includes;../../../../output_stream/includes;../../../../scicos_blocks/includes;../../../../windows_tools/includes;../../../../localization/includes;../../../../string/includes;../../../../intersci/src/lib;../../../../dynamic_link/includes;../../scicos_sundials/include;../../scicos_sundials/include/sundials;../../scicos_sundials/src/ida;../../../../action_binding/includes;../../../../../libs/intl;../../../../intersci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCICOS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <WarningLevel>Level3</WarningLevel>
+ </ClCompile>
+ <PreLinkEvent>
+ <Message>Make dependencies</Message>
+ <Command>lib /DEF:"$(ProjectDir)../core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Scicos_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Output_stream_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)output_stream.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../String_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)string.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Dynamic_link_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)dynamic_link.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../nographics_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)nographics.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Scicos_blocks_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_blocks_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../core_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../differential_equations_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)differential_equations_f.lib" 1&gt;NUL 2&gt;NUL</Command>
+ </PreLinkEvent>
+ <Link>
+ <AdditionalDependencies>../../../../../bin/libintl.lib;../../../../../bin/lapack.lib;../../../../../bin/blasplus.lib;../../../../../bin/linpack_f.lib;core.lib;output_stream.lib;string.lib;dynamic_link.lib;nographics.lib;scicos_blocks_f.lib;scicos_f.lib;scilocalization.lib;elementary_functions_f.lib;core_f.lib;differential_equations_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
+ <IgnoreSpecificDefaultLibraries>
+ </IgnoreSpecificDefaultLibraries>
+ <ModuleDefinitionFile>scicos-cli_export.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ </Link>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <ClCompile>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../;../../../includes;../../../../core/includes;../../../../time/includes;../../../../api_scilab/includes;../../../../output_stream/includes;../../../../scicos_blocks/includes;../../../../windows_tools/includes;../../../../localization/includes;../../../../string/includes;../../../../intersci/src/lib;../../../../dynamic_link/includes;../../scicos_sundials/include;../../scicos_sundials/include/sundials;../../scicos_sundials/src/ida;../../../../action_binding/includes;../../../../../libs/intl;../../../../intersci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCICOS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <WarningLevel>Level3</WarningLevel>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <PreLinkEvent>
+ <Message>Make dependencies</Message>
+ <Command>lib /DEF:"$(ProjectDir)../core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Scicos_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Output_stream_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)output_stream.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../String_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)string.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Dynamic_link_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)dynamic_link.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../nographics_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)nographics.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Scicos_blocks_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_blocks_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../core_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../differential_equations_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)differential_equations_f.lib" 1&gt;NUL 2&gt;NUL</Command>
+ </PreLinkEvent>
+ <Link>
+ <AdditionalDependencies>../../../../../bin/libintl.lib;../../../../../bin/lapack.lib;../../../../../bin/blasplus.lib;../../../../../bin/linpack_f.lib;core.lib;output_stream.lib;string.lib;dynamic_link.lib;nographics.lib;scicos_blocks_f.lib;scicos_f.lib;scilocalization.lib;elementary_functions_f.lib;core_f.lib;differential_equations_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
+ <IgnoreSpecificDefaultLibraries>
+ </IgnoreSpecificDefaultLibraries>
+ <ModuleDefinitionFile>scicos-cli_export.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ </Link>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <Midl>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../;../../../includes;../../../../core/includes;../../../../time/includes;../../../../api_scilab/includes;../../../../output_stream/includes;../../../../scicos_blocks/includes;../../../../windows_tools/includes;../../../../localization/includes;../../../../string/includes;../../../../intersci/src/lib;../../../../dynamic_link/includes;../../scicos_sundials/include;../../scicos_sundials/include/sundials;../../scicos_sundials/src/ida;../../../../action_binding/includes;../../../../../libs/intl;../../../../intersci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCICOS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <WarningLevel>Level3</WarningLevel>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <PreLinkEvent>
+ <Message>Make dependencies</Message>
+ <Command>lib /DEF:"$(ProjectDir)../core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Scicos_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Output_stream_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)output_stream.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../String_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)string.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Dynamic_link_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)dynamic_link.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../nographics_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)nographics.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Scicos_blocks_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_blocks_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../core_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)../differential_equations_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)differential_equations_f.lib" 1&gt;NUL 2&gt;NUL</Command>
+ </PreLinkEvent>
+ <Link>
+ <AdditionalDependencies>../../../../../bin/libintl.lib;../../../../../bin/lapack.lib;../../../../../bin/blasplus.lib;../../../../../bin/linpack_f.lib;core.lib;output_stream.lib;string.lib;dynamic_link.lib;nographics.lib;scicos_blocks_f.lib;scicos_f.lib;scilocalization.lib;elementary_functions_f.lib;core_f.lib;differential_equations_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
+ <IgnoreSpecificDefaultLibraries>
+ </IgnoreSpecificDefaultLibraries>
+ <ModuleDefinitionFile>scicos-cli_export.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ </Link>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_loadScicos.c" />
+ <ClCompile Include="..\copyvarfromlistentry.c" />
+ <ClCompile Include="..\createblklist.c" />
+ <ClCompile Include="..\ddaskr.c" />
+ <ClCompile Include="..\DllmainScicos.c" />
+ <ClCompile Include="..\extractblklist.c" />
+ <ClCompile Include="..\ezxml.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\gw_scicos.c" />
+ <ClCompile Include="..\il_sim.c" />
+ <ClCompile Include="..\il_state.c" />
+ <ClCompile Include="..\import.c" />
+ <ClCompile Include="..\MlistGetFieldNumber.c" />
+ <ClCompile Include="..\lsodar.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_buildouttb.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_callblk.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_coserror.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_ctree2.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_ctree3.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_ctree4.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_curblock.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_curblockc.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_data2sig.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_diffobjs.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_duplicate.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_end_scicosim.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_ftree2.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_ftree3.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_ftree4.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_getblocklabel.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_getscicosvars.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_haltscicos.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_model2blk.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_phase_simulation.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_pointer_xproperty.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_scicos_debug.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_scicos_debug_count.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_scicos_time.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_scicosim.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_sctree.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_set_blockerror.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_set_xproperty.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_sig2data.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_var2vec.c" />
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_vec2var.c" />
+ <ClCompile Include="..\sciblk2.c" />
+ <ClCompile Include="..\sciblk4.c" />
+ <ClCompile Include="..\scicos.c" />
+ <ClCompile Include="..\scicos_free.c" />
+ <ClCompile Include="..\scicos_malloc.c" />
+ <ClCompile Include="..\scicos_print.c" />
+ <ClCompile Include="..\tree.c" />
+ <ClCompile Include="..\var2sci.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\copyvarfromlistentry.h" />
+ <ClInclude Include="..\createblklist.h" />
+ <ClInclude Include="..\..\..\includes\dynlib_scicos.h" />
+ <ClInclude Include="..\ddaskr.h" />
+ <ClInclude Include="..\extractblklist.h" />
+ <ClInclude Include="..\ezxml.h" />
+ <ClInclude Include="..\..\..\includes\gw_scicos.h" />
+ <ClInclude Include="..\il_sim.h" />
+ <ClInclude Include="..\il_state.h" />
+ <ClInclude Include="..\..\..\includes\import.h" />
+ <ClInclude Include="..\MlistGetFieldNumber.h" />
+ <ClInclude Include="..\lsodar.h" />
+ <ClInclude Include="..\..\..\includes\scicos-def.h" />
+ <ClInclude Include="..\..\..\includes\scicos.h" />
+ <ClInclude Include="..\..\..\includes\scicos_free.h" />
+ <ClInclude Include="..\..\..\includes\scicos_malloc.h" />
+ <ClInclude Include="..\..\..\includes\scicos_math.h" />
+ <ClInclude Include="..\..\..\includes\scicos_print.h" />
+ <ClInclude Include="..\sciblk2.h" />
+ <ClInclude Include="..\sciblk4.h" />
+ <ClInclude Include="..\tree.h" />
+ <ClInclude Include="..\var2sci.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\..\locales\scicos.pot" />
+ <None Include="..\Core_f_Import.def" />
+ <None Include="..\differential_equations_f_Import.def" />
+ <None Include="..\Dynamic_link_Import.def" />
+ <None Include="..\elementary_functions_f_Import.def" />
+ <None Include="..\nographics_Import.def" />
+ <None Include="..\core_import.def" />
+ <None Include="..\Localization_Import.def" />
+ <None Include="..\Output_stream_Import.def" />
+ <None Include="..\Scicos_blocks_f_Import.def" />
+ <None Include="..\scicos_f_Import.def" />
+ <None Include="..\String_Import.def" />
+ <None Include="..\..\..\Makefile.am" />
+ <None Include="..\..\..\scicos.iss" />
+ <None Include="..\..\..\sci_gateway\scicos_gateway.xml" />
+ <None Include="scicos-cli_Export.def" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="scicos-cli.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\..\..\tools\Dumpexts\Dumpexts.vcxproj">
+ <Project>{3170e4c2-1173-4264-a222-7ee8ccb3ddf7}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\api_scilab\api_scilab.vcxproj">
+ <Project>{43c5bab1-1dca-4743-a183-77e0d42fe7d0}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\elementary_functions\src\c\elementary_functions.vcxproj">
+ <Project>{5b110267-7c18-437c-b87d-dba2b50729e9}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\scicos_blocks\src\c\cli\scicos_blocks-cli.vcxproj">
+ <Project>{424a5578-ba28-435f-8313-8d85886a3539}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\time\time.vcxproj">
+ <Project>{05d8f60b-332a-4161-b946-b8ab30ed439c}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\windows_tools\src\c\scilab_windows\scilab_windows.vcxproj">
+ <Project>{8028f371-6a94-4a26-8804-6e7f05f1d1aa}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\..\scicos_sundials\scicos_sundials.vcxproj">
+ <Project>{c781737a-7c97-4cf9-acbc-f68c2bbf0ffa}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/modules/scicos/src/c/cli/scicos-cli.vcxproj.filters b/modules/scicos/src/c/cli/scicos-cli.vcxproj.filters
new file mode 100755
index 000000000..a86117e7e
--- /dev/null
+++ b/modules/scicos/src/c/cli/scicos-cli.vcxproj.filters
@@ -0,0 +1,303 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{f25272a1-9c37-4283-b9be-f02b20fa554e}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{0600940f-c932-4a19-852b-1fa288604839}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="localization">
+ <UniqueIdentifier>{6ce5747b-ba49-43df-bba9-ab7c4a42174f}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Libraries Dependencies">
+ <UniqueIdentifier>{c851460c-fc36-41ef-a010-d914f8d07eb1}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Libraries Dependencies\Imports">
+ <UniqueIdentifier>{065bc75d-7cea-49da-8175-18022b52059b}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Libraries Dependencies\Export">
+ <UniqueIdentifier>{085b96c7-ebd7-4309-aa96-7bf92c81cf41}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{1111ba6f-2a3d-4841-9870-995a4fc81bad}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\copyvarfromlistentry.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\createblklist.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\DllmainScicos.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\extractblklist.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\ezxml.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\gw_scicos.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\il_sim.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\il_state.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\import.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\MlistGetFieldNumber.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\lsodar.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_buildouttb.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_callblk.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_coserror.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_ctree2.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_ctree3.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_ctree4.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_curblock.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_curblockc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_data2sig.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_diffobjs.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_duplicate.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_end_scicosim.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_ftree2.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_ftree3.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_ftree4.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_getblocklabel.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_getscicosvars.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_haltscicos.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_model2blk.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_phase_simulation.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_pointer_xproperty.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_scicos_debug.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_scicos_debug_count.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_scicos_time.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_scicosim.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_sctree.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_set_blockerror.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_set_xproperty.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_sig2data.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_var2vec.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_vec2var.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\sciblk2.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\sciblk4.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scicos.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scicos_free.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scicos_malloc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scicos_print.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\tree.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\var2sci.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\sci_gateway\c\sci_loadScicos.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\ddaskr.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\copyvarfromlistentry.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\createblklist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\includes\dynlib_scicos.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\extractblklist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\ezxml.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\includes\gw_scicos.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\il_sim.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\il_state.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\includes\import.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\MlistGetFieldNumber.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\lsodar.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\includes\scicos-def.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\includes\scicos.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\includes\scicos_free.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\includes\scicos_malloc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\includes\scicos_math.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\includes\scicos_print.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\tree.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\var2sci.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\sciblk2.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\sciblk4.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\ddaskr.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\Dynamic_link_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="..\nographics_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="..\core_import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="..\Output_stream_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="..\Scicos_blocks_f_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="..\scicos_f_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="..\String_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="..\..\..\Makefile.am" />
+ <None Include="..\..\..\scicos.iss" />
+ <None Include="..\..\..\sci_gateway\scicos_gateway.xml" />
+ <None Include="..\Localization_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="..\elementary_functions_f_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="..\..\..\locales\scicos.pot">
+ <Filter>localization</Filter>
+ </None>
+ <None Include="..\Core_f_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="..\differential_equations_f_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="scicos-cli_Export.def">
+ <Filter>Libraries Dependencies\Export</Filter>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="scicos-cli.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/modules/scicos/src/c/cli/scicos-cli_Export.def b/modules/scicos/src/c/cli/scicos-cli_Export.def
new file mode 100755
index 000000000..697785eb4
--- /dev/null
+++ b/modules/scicos/src/c/cli/scicos-cli_Export.def
@@ -0,0 +1,24 @@
+LIBRARY scicos-cli.dll
+
+
+EXPORTS
+;
+; SEP 35
+scicos_malloc
+scicos_free
+scicos_print
+scicos_
+callf
+get_phase_simulation
+set_block_error
+get_scicos_time
+set_scicos_time
+set_pointer_xproperty
+do_cold_restart
+get_block_number
+end_scicos_sim
+Coserror
+Set_Jacobian_flag
+Get_Jacobian_parameter
+write_xml_states
+read_xml_initial_states
diff --git a/modules/scicos/src/c/copyvarfromlistentry.c b/modules/scicos/src/c/copyvarfromlistentry.c
new file mode 100755
index 000000000..cec01d83c
--- /dev/null
+++ b/modules/scicos/src/c/copyvarfromlistentry.c
@@ -0,0 +1,61 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* 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 "copyvarfromlistentry.h"
+#include "MALLOC.h"
+#include "stack-c.h"
+/*--------------------------------------------------------------------------*/
+extern int *listentry(int *header, int i); /* mexlib.h */
+/*--------------------------------------------------------------------------*/
+int CopyVarFromlistentry(int lw, int *header, int i)
+{
+ /* Local variable definition*/
+ int ret, un = 1;
+ double *l;
+ int n;
+
+ /* Test if we receive a NULL ptr header */
+ if (header == NULL)
+ {
+ return FALSE;
+ }
+
+ /* Get the start address of the i element of the input list*/
+ if ((l = (double *) listentry(header, i)) == NULL)
+ {
+ return FALSE;
+ }
+
+ /* Compute the length of the i element in double word */
+ n = header[i + 2] - header[i + 1];
+
+ /* Create empty data of a size n*sizeof(double) at the position lw */
+ if ((ret = C2F(createdata)(&lw, n * sizeof(double))) == FALSE)
+ {
+ return ret;
+ }
+
+ /* Copy the element i to position lw*/
+ C2F(unsfdcopy)(&n, l, &un, stk(*Lstk(lw + Top - Rhs)), &un);
+ return TRUE;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/modules/scicos/src/c/copyvarfromlistentry.h b/modules/scicos/src/c/copyvarfromlistentry.h
new file mode 100755
index 000000000..0c4957057
--- /dev/null
+++ b/modules/scicos/src/c/copyvarfromlistentry.h
@@ -0,0 +1,58 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* 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
+*/
+/*--------------------------------------------------------------------------*/
+#ifndef __COPYVARFROMLISTENTRY_H__
+#define __COPYVARFROMLISTENTRY_H__
+
+/* CopyVarFromlistentry
+* Copy a Scilab object in a list to the variable position lw
+*
+* Calling sequence :
+* int CopyVarFromlistentry(int lw, int *header, int i)
+*
+* Input parameters : lw : integer, the free position
+* header : int pointer, a pointer of a list.
+* i : integer, give the number of the element to copy
+*
+* Output : FALSE if failed, TRUE else.
+*
+* Examples of use
+*
+* 1 - put the third element of a list given in position lw=1
+* to position lw=2 :
+*
+* int *il_list;
+* il_list = (int *) Getdata(1);
+* CopyVarFromlistentry(2, il_list, 3)
+*
+* 2 - put the second element of a list stored in the fourth element
+* of a list in position lw=1 to position lw=3 :
+*
+* int *il_list;
+* il_list = (int *) Getdata(1);
+* int *il_sublist;
+* il_sublist = (int *) listentry(il_list,4);
+* CopyVarFromlistentry(3, il_sublist, 2)
+*/
+int CopyVarFromlistentry(int lw, int *header, int i);
+
+#endif /* __COPYVARFROMLISTENTRY_H__ */
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/core_Import.def b/modules/scicos/src/c/core_Import.def
new file mode 100755
index 000000000..c76d7122e
--- /dev/null
+++ b/modules/scicos/src/c/core_Import.def
@@ -0,0 +1,38 @@
+LIBRARY core.dll
+
+
+EXPORTS
+;
+; core
+stack_
+com_
+vstk_
+listentry
+createdata_
+str2sci
+cha1_
+callFunctionFromGateway
+createlistcvarfromptr_
+createvar_
+putlhsvar_
+intersci_
+GetData
+getrhsvar_
+vartype_
+checkrhs_
+checklhs_
+iop_
+namstr_
+createvarfromptr_
+errgst_
+check_dims
+check_scalar
+ierode_
+syncexec
+GetCommand
+ismenu
+xscion_
+createlistvarfromptr_
+MyHeapAlloc
+MyHeapFree
+MyHeapRealloc
diff --git a/modules/scicos/src/c/createblklist.c b/modules/scicos/src/c/createblklist.c
new file mode 100755
index 000000000..8d77b112f
--- /dev/null
+++ b/modules/scicos/src/c/createblklist.c
@@ -0,0 +1,546 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* 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 "createblklist.h"
+#include "machine.h"
+#include "stack-c.h"
+#include "import.h"
+#include "var2sci.h"
+#include "MALLOC.h"
+/*--------------------------------------------------------------------------*/
+extern void str2sci(char** x, int n, int m); /* core/src/c/str2sci.h */
+extern void C2F(itosci)();
+extern void C2F(dtosci)();
+extern int C2F(scierr)();
+extern void C2F(vvtosci)();
+extern int C2F(mktlist)();
+/*--------------------------------------------------------------------------*/
+int createblklist(scicos_block *Blocks, int *ierr, int flag_imp, int funtyp)
+{
+ /*local variable declaration*/
+ int j, k;
+ int nu, mu, ny, my;
+ int u_typ, y_typ;
+ int oz_typ, opar_typ;
+
+ /*variable used when imp_flag>=0*/
+ int nv, mv; /* length of data */
+ int nblk, ng; /* to store number of blocks and number of zero cross. */
+ void *ptr; /* ptr for data comming from import structure */
+ int *ptr_int; /* ptr to store ptr on integer */
+ double *ptr_double; /* ptr to store ptr on double */
+ int *xptr = NULL; /* to retrieve xptr by import and zcptr of scicos_blocks */
+ int *zcptr = NULL;
+ double *x = NULL; /* ptr for x, xd and g for scicos_blocks */
+ double *xd = NULL;
+ double *g = NULL;
+
+ /* set string of first element of scilab Blocks tlist -please update me- */
+ static char *str_blklst[] = { "scicos_block", "nevprt" , "funpt" , "type" ,
+ "scsptr" , "nz" , "z" , "noz" ,
+ "ozsz" , "oztyp" , "oz" , "nx" ,
+ "x" , "xd" , "res" , "nin" ,
+ "insz" , "inptr" , "nout" , "outsz" ,
+ "outptr" , "nevout" , "evout" , "nrpar" ,
+ "rpar" , "nipar" , "ipar" , "nopar" ,
+ "oparsz" , "opartyp" , "opar" , "ng" ,
+ "g" , "ztyp" , "jroot" , "label" ,
+ "work" , "nmode" , "mode" , "xprop" ,
+ "uid"
+ };
+
+ /* auto length of block list */
+ static int nblklst = sizeof(str_blklst) / sizeof(str_blklst[0]);
+
+ /* char ptr for str2sci - see below - */
+ char **str1;
+
+ /* set nblk, x, xd ptr coming from import strucuture,
+ * if flag_imp >=0
+ */
+ if (flag_imp >= 0)
+ {
+ /*retrieve nblk by import structure*/
+ strcpy(C2F(cha1).buf, "nblk");
+ *ierr = getscicosvarsfromimport(C2F(cha1).buf, &ptr, &nv, &mv);
+ if (*ierr == 0)
+ {
+ return 0;
+ }
+ ptr_int = (int *) ptr;
+ nblk = *ptr_int;
+
+ /* retrieve ng by import structure */
+ strcpy(C2F(cha1).buf, "ng");
+ *ierr = getscicosvarsfromimport(C2F(cha1).buf, &ptr, &nv, &mv);
+ ptr_int = (int *) ptr; /* cast void* ptr to int* ptr */
+ ng = *ptr_int;
+
+ /*retrieve xptr by import structure*/
+ strcpy(C2F(cha1).buf, "xptr");
+ *ierr = getscicosvarsfromimport(C2F(cha1).buf, &ptr, &nv, &mv);
+ if (*ierr == 0)
+ {
+ return 0;
+ }
+ ptr_int = (int *) ptr;
+ xptr = ptr_int;
+
+ /*retrieve zcptr by import structure*/
+ strcpy(C2F(cha1).buf, "zcptr");
+ *ierr = getscicosvarsfromimport(C2F(cha1).buf, &ptr, &nv, &mv);
+ ptr_int = (int *) ptr;
+ zcptr = ptr_int;
+
+ /*retrieve x and xd by import structure*/
+ strcpy(C2F(cha1).buf, "x");
+ *ierr = getscicosvarsfromimport(C2F(cha1).buf, &ptr, &nv, &mv);
+ if (*ierr == 0)
+ {
+ return 0;
+ }
+ ptr_double = (double *) ptr;
+ x = ptr_double;
+ xd = &x[xptr[nblk] - 1];
+
+ /*retrieve g by import structure*/
+ strcpy(C2F(cha1).buf, "g");
+ *ierr = getscicosvarsfromimport(C2F(cha1).buf, &ptr, &nv, &mv);
+ ptr_double = (double *) ptr;
+ g = ptr_double;
+ }
+
+ /****************************
+ * create scilab tlist Blocks
+ ****************************/
+ /* 1 - scicos_block */
+ str2sci(str_blklst, 1, nblklst);
+
+ /* 2 - nevprt */
+ C2F(itosci)(&Blocks[0].nevprt, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 3 - funpt */
+ if (sizeof(voidg) >= sizeof(double))
+ {
+ // store N double values as the function pointer value
+ j = sizeof(voidg) / sizeof(double);
+ }
+ else
+ {
+ // push at least one double
+ j = 1;
+ }
+ C2F(dtosci)(&Blocks[0].funpt, &j, (k = 1, &k));
+
+ /* 4 - type */
+ C2F(itosci)(&Blocks[0].type, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 5 - scsptr */
+ C2F(itosci)(&Blocks[0].scsptr, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 6 - nz */
+ C2F(itosci)(&Blocks[0].nz, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 7 - z */
+ if (Blocks[0].scsptr > 0)
+ {
+ C2F(vvtosci)(Blocks[0].z, &Blocks[0].nz);
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ *ierr = var2sci(Blocks[0].z, Blocks[0].nz, 1, SCSREAL_N);
+ if (*ierr != 0)
+ {
+ return 0;
+ }
+ }
+
+ /* 8 - noz */
+ C2F(itosci)(&Blocks[0].noz, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 9 - ozsz */
+ C2F(itosci)(Blocks[0].ozsz, (j = Blocks[0].noz, &j), (k = 2, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 10 - oztyp */
+ C2F(itosci)(Blocks[0].oztyp, (j = Blocks[0].noz, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 11 - oz */
+ for (k = 0; k < Blocks[0].noz; k++)
+ {
+ nu = Blocks[0].ozsz[k]; /* retrieve number of rows */
+ mu = Blocks[0].ozsz[Blocks[0].noz + k]; /* retrieve number of cols */
+ oz_typ = Blocks[0].oztyp[k]; /* retrieve type */
+ *ierr = var2sci(Blocks[0].ozptr[k], nu, mu, oz_typ);
+ if (*ierr != 0)
+ {
+ return 0;
+ }
+ }
+ /* if C blocks or null size then concatenate in a single list */
+ if ((funtyp == 4) || (Blocks[0].noz == 0))
+ {
+ C2F(mklist)(&Blocks[0].noz); /*create oz list*/
+ }
+
+ /* 12 - nx */
+ C2F(itosci)(&Blocks[0].nx, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 13 - x */
+ if (flag_imp >= 0)
+ {
+ *ierr = var2sci(&x[xptr[flag_imp] - 1], Blocks[0].nx, 1, SCSREAL_N);
+ }
+ else
+ {
+ *ierr = var2sci(Blocks[0].x, Blocks[0].nx, 1, SCSREAL_N);
+ }
+ if (*ierr != 0)
+ {
+ return 0;
+ }
+
+ /* 14 - xd */
+ if (flag_imp >= 0)
+ {
+ *ierr = var2sci(&xd[xptr[flag_imp] - 1], Blocks[0].nx, 1, SCSREAL_N);
+ }
+ else
+ {
+ *ierr = var2sci(Blocks[0].xd, Blocks[0].nx, 1, SCSREAL_N);
+ }
+ if (*ierr != 0)
+ {
+ return 0;
+ }
+
+ /* 15 - res */
+ *ierr = var2sci(Blocks[0].res, Blocks[0].nx, 1, SCSREAL_N);
+ if (*ierr != 0)
+ {
+ return 0;
+ }
+
+ /* 16 - nin */
+ C2F(itosci)(&Blocks[0].nin, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 17 - insz */
+ C2F(itosci)(Blocks[0].insz, (j = 3 * Blocks[0].nin, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 18 - inptr */
+ for (k = 0; k < Blocks[0].nin; k++)
+ {
+ nu = Blocks[0].insz[k]; /* retrieve number of rows */
+ mu = Blocks[0].insz[Blocks[0].nin + k]; /* retrieve number of cols */
+ u_typ = Blocks[0].insz[2 * Blocks[0].nin + k]; /* retrieve type */
+ *ierr = var2sci(Blocks[0].inptr[k], nu, mu, u_typ);
+ if (*ierr != 0)
+ {
+ return 0;
+ }
+ }
+ C2F(mklist)(&Blocks[0].nin); /*create inptr list*/
+
+ /* 19 - nout */
+ C2F(itosci)(&Blocks[0].nout, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 20 - outsz */
+ C2F(itosci)(Blocks[0].outsz, (j = 3 * Blocks[0].nout, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 21 - outptr */
+ for (k = 0; k < Blocks[0].nout; k++)
+ {
+ ny = Blocks[0].outsz[k]; /* retrieve number of rows */
+ my = Blocks[0].outsz[Blocks[0].nout + k]; /* retrieve number of cols */
+ y_typ = Blocks[0].outsz[2 * Blocks[0].nout + k]; /* retrieve type */
+ *ierr = var2sci(Blocks[0].outptr[k], ny, my, y_typ);
+ if (*ierr != 0)
+ {
+ return 0;
+ }
+ }
+ C2F(mklist)(&Blocks[0].nout); /*create outptr list*/
+
+ /* 22 - nevout */
+ C2F(itosci)(&Blocks[0].nevout, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 23 - evout */
+ *ierr = var2sci(Blocks[0].evout, Blocks[0].nevout, 1, SCSREAL_N);
+ if (*ierr != 0)
+ {
+ return 0;
+ }
+
+ /* 24 - nrpar */
+ C2F(itosci)(&Blocks[0].nrpar, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 25 - rpar */
+ if (Blocks[0].scsptr > 0)
+ {
+ C2F(vvtosci)(Blocks[0].rpar, &Blocks[0].nrpar);
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ *ierr = var2sci(Blocks[0].rpar, Blocks[0].nrpar, 1, SCSREAL_N);
+ if (*ierr != 0)
+ {
+ return 0;
+ }
+ }
+
+ /* 26 - nipar */
+ C2F(itosci)(&Blocks[0].nipar, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 27 - ipar */
+ C2F(itosci)(Blocks[0].ipar, (j = Blocks[0].nipar, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 28 - nopar */
+ C2F(itosci)(&Blocks[0].nopar, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 29 - oparsz */
+ C2F(itosci)(Blocks[0].oparsz, (j = Blocks[0].nopar, &j), (k = 2, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 30 - opartyp */
+ C2F(itosci)(Blocks[0].opartyp, (j = Blocks[0].nopar, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 31 - opar */
+ for (k = 0; k < Blocks[0].nopar; k++)
+ {
+ nu = Blocks[0].oparsz[k]; /* retrieve number of rows */
+ mu = Blocks[0].oparsz[Blocks[0].nopar + k]; /* retrieve number of cols */
+ opar_typ = Blocks[0].opartyp[k]; /* retrieve type */
+ *ierr = var2sci(Blocks[0].oparptr[k], nu, mu, opar_typ);
+ if (*ierr != 0)
+ {
+ return 0;
+ }
+ }
+ /* if C blocks or null size then concatenate in a single list */
+ if ((funtyp == 4) || (Blocks[0].nopar == 0))
+ {
+ C2F(mklist)(&Blocks[0].nopar); /*create opar list*/
+ }
+
+ /* 32 - ng */
+ C2F(itosci)(&Blocks[0].ng, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 33 - g */
+ if (flag_imp >= 0)
+ {
+ *ierr = var2sci(&g[zcptr[flag_imp] - 1], Blocks[0].ng, 1, SCSREAL_N);
+ }
+ else
+ {
+ *ierr = var2sci(Blocks[0].g, Blocks[0].ng, 1, SCSREAL_N);
+ }
+ if (*ierr != 0)
+ {
+ return 0;
+ }
+
+ /* 34 - ztyp */
+ C2F(itosci)(&Blocks[0].ztyp, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 35 - jroot */
+ C2F(itosci)(Blocks[0].jroot, (j = Blocks[0].ng, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 36 - label */
+ if ((str1 = MALLOC(sizeof(char*))) == NULL )
+ {
+ return 0;
+ }
+ if ((str1[0] = MALLOC(sizeof(char) * (strlen(Blocks[0].label) + 1))) == NULL )
+ {
+ FREE(str1);
+ return 0;
+ }
+ (str1[0])[strlen(Blocks[0].label)] = '\0';
+ strncpy(str1[0], Blocks[0].label, strlen(Blocks[0].label));
+ str2sci(str1, 1, 1);
+ FREE(str1[0]);
+ FREE(str1);
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 37 - work*/
+ C2F(itosci)(&Blocks[0].work, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 38 - nmode*/
+ C2F(itosci)(&Blocks[0].nmode, (j = 1, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 39 - mode */
+ C2F(itosci)(Blocks[0].mode, (j = Blocks[0].nmode, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 40 - xprop */
+ C2F(itosci)(Blocks[0].xprop, (j = Blocks[0].nx, &j), (k = 1, &k));
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /* 41 - uid */
+ if ((str1 = MALLOC(sizeof(char*))) == NULL )
+ {
+ return 0;
+ }
+ if (Blocks[0].uid != NULL)
+ {
+ if ((str1[0] = MALLOC(sizeof(char) * (strlen(Blocks[0].uid) + 1))) == NULL )
+ {
+ FREE(str1);
+ return 0;
+ }
+ (str1[0])[strlen(Blocks[0].uid)] = '\0';
+ strncpy(str1[0], Blocks[0].uid, strlen(Blocks[0].uid));
+ }
+ else
+ {
+ str1[0] = MALLOC(sizeof(char));
+ (str1[0])[0] = '\0';
+ }
+ str2sci(str1, 1, 1);
+ FREE(str1[0]);
+ FREE(str1);
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ C2F(mktlist)(&nblklst); /*create Blocks list*/
+ if (C2F(scierr)() != 0)
+ {
+ return 0;
+ }
+
+ /*return 1 if succeeded */
+ return 1;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/modules/scicos/src/c/createblklist.h b/modules/scicos/src/c/createblklist.h
new file mode 100755
index 000000000..459735f72
--- /dev/null
+++ b/modules/scicos/src/c/createblklist.h
@@ -0,0 +1,61 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* 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
+*/
+/*--------------------------------------------------------------------------*/
+#ifndef __CREATEBLKLIST_H__
+#define __CREATEBLKLIST_H__
+
+#include "scicos_block4.h"
+
+/* createblklist : function to create a Typed List
+* of a scicos_block structure
+* at the top+1 postion of the stack
+*
+* needs/depends : var2sci, C2F(mklist), C2F(mtklist),
+* vvtosci, itosci, string.h, C2F(scierr), str2sci
+*
+* input argument : Blocks :scicos_block ptr on a scicos_block structure
+* ierr : int ptr, an error flag
+* flag_imp : if flag_imp>=0 then use
+* import structure for x, xd and g.
+* In this case flag_imp is the block number.
+* kfun : the current indexe of the block in the compiled structure
+*
+* output argument : return 0 if failed, 1 else.
+*
+*
+* 23/06/06, Alan : extracted from sciblk4 to be used
+* in intgetscicosvars
+*
+* 26/06/06, Alan : Add flag_imp in input arguments.
+* This is done to disable scilab crash with getscicosvars("blocks")
+* because when calling at the beginning of the simulation, x, xd and
+* g are not yet informed for all blocks with nx!=0 and ng!=0.
+* (They are not yet called with callf in scicos.c)
+*
+* 09/02/07, Alan : Add kfun flag and oz/opar
+*
+*/
+
+int createblklist(scicos_block *Blocks, int *ierr, int flag_imp, int funtyp);
+
+#endif /* __CREATEBLKLIST_H__ */
+/*--------------------------------------------------------------------------*/
+
diff --git a/modules/scicos/src/c/ddaskr.c b/modules/scicos/src/c/ddaskr.c
new file mode 100755
index 000000000..f8e97bf3b
--- /dev/null
+++ b/modules/scicos/src/c/ddaskr.c
@@ -0,0 +1,1076 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Scilab Enterprises - 2013 - Paul Bignier
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <machine.h>
+#include <float.h> // DBL_EPSILON, to define UNIT_ROUNDOFF
+#include <math.h> // fabs() and pow() functions
+
+#include "ddaskr.h"
+
+#define NO_FPRINTF_OUTPUT 1
+
+/*
+ * Control constant for tolerances
+ *
+ * Scicos only uses scalar tolerances, so we only need the scalar-scalar (SS) value for info[1].
+ * --------------------------------
+ */
+#define DDAS_SS 0
+
+/* Flags for stop mode */
+#define DDAS_NORMAL 0
+#define DDAS_ONE_STEP 1
+
+/*
+ * Flags for initial values calculation.
+ *
+ * Indicating whether the components have been qualified (differential / algebraic).
+ * --------------------------------
+ */
+#define DDAS_YA_YDP_INIT 1
+#define DDAS_Y_INIT 2
+
+#define UNIT_ROUNDOFF DBL_EPSILON
+
+/* =============================
+ *
+ * ddaskr
+ *
+ * =============================
+ *
+ * Actual solving function, from 'ODEPACK' in 'differential_equations' module.
+ * Since we use ddaskr's built-in jacobian function, set jacpsol type to DDasJacPsolFn.
+ */
+
+extern void C2F(ddaskr) (DDASResFn res, int *neq, realtype *t, realtype *y, realtype *yp, realtype *tout, int *info, realtype *reltol, realtype *abstol, int *istate, struct DDrWork_t *rwork, int *lrw, int *iwork, int *liw, double *dummy1, int *dummy2, DDASJacPsolFn jacpsol, DDASPsolFn psol, DDASRootFn grblk, int *ng, int *jroot);
+
+/* =============================
+ *
+ * DDaskrCreate
+ *
+ * =============================
+ *
+ * DDaskrCreate creates an internal memory block for a problem to be solved by DDASKR.
+ * If successful, DDaskrCreate returns a pointer to the problem memory.
+ * This pointer should be passed to DDaskrInit.
+ * If an initialization error occurs,
+ * DDaskrCreate prints an error message to standard err and returns NULL.
+ */
+
+void * DDaskrCreate (int * neq, int ng, int solverIndex)
+{
+ int lIw = 0, lRw = 0, LENWP = 0, LENIWP = 0;
+ DDaskrMem ddaskr_mem = NULL;
+
+ /* Allocate the problem memory space */
+ ddaskr_mem = NULL;
+ ddaskr_mem = (DDaskrMem) malloc(sizeof(struct DDaskrMemRec));
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, 0, "DDASKR", "DDaskrCreate", MSG_MEM_FAIL);
+ return (NULL);
+ }
+
+ /* Zero out ddas_mem */
+ memset(ddaskr_mem, 0, sizeof(struct DDaskrMemRec));
+
+ /* Set the 'rwork' and 'iwork' workspaces lengths by default
+ LENWP and LENIWP are lentghts of segments of rwork and iwork (respectively),
+ that will contain factored preconditioner matrix information */
+ LENWP = (*neq) * (*neq);
+ LENIWP = (*neq);
+ lRw = 60 + (*neq) * (max(MAXORD_DEFAULT + 4, 7) + (*neq)) + 3 * ng;
+ lIw = 40 + 2 * (*neq);
+
+ /* If we are going to use the Krylov method, resize the workspaces adequately */
+ if (solverIndex == 102)
+ {
+ lRw = 101 + 18 * (*neq) + 3 * ng + LENWP;
+ lIw = 40 + (*neq) + LENIWP;
+ }
+
+ /* Copy the variables into the problem memory space */
+ ddaskr_mem->nEquations = neq;
+ ddaskr_mem->user_data = NULL;
+ ddaskr_mem->iState = 0;
+ ddaskr_mem->info = NULL;
+ ddaskr_mem->rwork = NULL;
+ ddaskr_mem->lrw = lRw;
+ ddaskr_mem->iwork = NULL;
+ ddaskr_mem->liw = lIw;
+ ddaskr_mem->ehfun = NULL;
+ ddaskr_mem->g_fun = NULL;
+ ddaskr_mem->ng_fun = ng;
+ ddaskr_mem->jroot = NULL;
+ ddaskr_mem->solver = solverIndex;
+ ddaskr_mem->jacpsol = NULL;
+ ddaskr_mem->psol = NULL;
+ ddaskr_mem->rpar = NULL;
+ ddaskr_mem->ipar = NULL;
+
+ return ((void *) ddaskr_mem);
+}
+
+/* Shortcuts to problem memory space parameters */
+# define res ddas_mem->res
+# define nEq ddas_mem->nEquations
+# define user_data ddas_mem->user_data
+# define yVec ddas_mem->yVector
+# define ypVec ddas_mem->yPrimeVector
+# define tStart ddas_mem->tStart
+# define info ddas_mem->info
+# define relTol ddas_mem->relTol
+# define absTol ddas_mem->absTol
+# define iState ddas_mem->iState
+# define rwork ddas_mem->rwork
+# define lrw ddas_mem->lrw
+# define iwork ddas_mem->iwork
+# define liw ddas_mem->liw
+# define maxnhIC ddas_mem->maxnhIC
+# define g_fun ddas_mem->g_fun
+# define ng_fun ddas_mem->ng_fun
+# define jroot ddas_mem->jroot
+# define solver ddas_mem->solver
+# define jacpsol ddas_mem->jacpsol
+# define psol ddas_mem->psol
+# define rpar ddas_mem->rpar
+# define ipar ddas_mem->ipar
+
+/* =============================
+ *
+ * DDaskrInit
+ *
+ * =============================
+ *
+ * DDaskrInit allocates and initializes memory for a problem.
+ * All problem inputs are checked for errors. If any error occurs during initialization,
+ * it is reported to the file whose file pointer is errfp and an error flag is returned.
+ * Otherwise, it returns IDA_SUCCESS.
+ */
+
+int DDaskrInit (void * ddaskr_mem, DDASResFn Res, realtype t0, N_Vector yy0, N_Vector yp0, DDASJacPsolFn Jacpsol, DDASPsolFn Psol)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ /* Check the input arguments */
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrInit", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ if (yy0 == NULL)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrInit", MSG_Y0_NULL);
+ return (IDA_ILL_INPUT);
+ }
+
+ if (yp0 == NULL)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrInit", MSG_YP0_NULL);
+ return (IDA_ILL_INPUT);
+ }
+
+ if (Res == NULL)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrInit", MSG_RES_NULL);
+ return (IDA_ILL_INPUT);
+ }
+
+ /* Jacpsol = NULL or Psol = NULL is a problem only if the user decided to use the GMRes solver */
+ if (solver == 102)
+ {
+ if (Jacpsol == NULL || Psol == NULL)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrInit", MSG_BAD_KRY_INPUT);
+ return (IDA_ILL_INPUT);
+ }
+ }
+
+ /* Copy the arguments into the problem memory space */
+ res = Res;
+ yVec = NV_DATA_S(yy0);
+ ypVec = NV_DATA_S(yp0);
+ tStart = t0;
+ jacpsol = Jacpsol;
+ psol = Psol;
+
+ /* Allocate the info[20] tab to zero, used to store parameters (zero is default value for mostof them) */
+ info = calloc(20, sizeof(int));
+
+ /* info[11] = 1 => Krylov method selected
+ info[14] = 1 => providing jacobian function (to evaluate and LU-factor the preconditioner) */
+ if (solver == 102)
+ {
+ info[11] = 1;
+ info[14] = 1;
+ }
+
+ /* Allocate rwork and iwork workspaces and set them to zero.
+ Their size is lrw and liw, respectively */
+ rwork = (struct DDrWork_t *) calloc(lrw, sizeof(realtype));
+ iwork = calloc(liw, sizeof(int));
+
+ /* Save their lengths in iwork */
+ iwork[16] = lrw;
+ iwork[17] = liw;
+
+ /* Solve the problem without invoking any special inequality constraints */
+ info[9] = 0;
+
+ /* Default values for heuristic control quantities in the initial values calculation */
+ iwork[31] = (info[11] == 0) ? 5 : 15; // maxnit, depends on dense / Krylov method
+ iwork[32] = (info[11] == 0) ? 6 : 2; // maxnj, depends on dense / Krylov method
+ iwork[33] = 5; // maxnh
+ iwork[34] = 0; // lsoff, flag to turn linesearch on / off (0 = on)
+ rwork->steptol = pow(UNIT_ROUNDOFF, 2. / 3); // steptol
+ rwork->epinit = 0.01; // epinit, swing factor in the Newton iteration convergence test.
+ maxnhIC = 5; // maxnh for IC calculation
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrReInit
+ *
+ * =============================
+ *
+ * DDaskrReInit reinitializes DDASKR's memory for a problem,
+ * assuming it has already been allocated in a prior DDaskrInit call.
+ * All problem specification inputs are checked for errors.
+ * If any error occurs during initialization, it is reported to the file whose file pointer is errfp.
+ * The return value is IDA_SUCCESS = 0 if no errors occurred, or a negative value otherwise.
+ */
+
+int DDaskrReInit (void * ddaskr_mem, realtype tOld, N_Vector yy0, N_Vector yp0)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ /* Check the input arguments */
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrReInit", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ if (yy0 == NULL)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrInit", MSG_Y0_NULL);
+ return (IDA_ILL_INPUT);
+ }
+
+ if (yp0 == NULL)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrInit", MSG_YP0_NULL);
+ return (IDA_ILL_INPUT);
+ }
+
+ /* Reset the problem memory space variables to the arguments */
+ *nEq = NV_LENGTH_S(yy0);
+ yVec = NV_DATA_S(yy0);
+ ypVec = NV_DATA_S(yp0);
+ tStart = tOld;
+ iState = 0;
+ info[0] = 0;
+
+ /* Tell DDaskr to get new consitent values */
+ info[10] = 1;
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrSStolerances
+ *
+ * =============================
+ *
+ * This function specifies the scalar integration tolerances.
+ * It MUST be called before the first call to DDaskr.
+ */
+
+int DDaskrSStolerances (void * ddaskr_mem, realtype reltol, realtype abstol)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDaskr", "DDaskrSStolerances", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ /* Check inputs */
+
+ if (reltol < 0.)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrSStolerances", MSG_BAD_RTOL);
+ return (IDA_ILL_INPUT);
+ }
+
+ if (abstol < 0.)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrSStolerances", MSG_BAD_ATOL);
+ return (IDA_ILL_INPUT);
+ }
+
+ /* Copy tolerances into memory */
+
+ relTol = reltol;
+ absTol = abstol;
+ info[1] = DDAS_SS;
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrRootInit
+ *
+ * =============================
+ *
+ * DDaskrRootInit initializes a rootfinding problem to be solved during the integration of the ODE system.
+ * It loads the root function pointer and the number of root functions, and allocates workspace memory.
+ * The return value is IDA_SUCCESS = 0 if no errors occurred, or a negative value otherwise.
+ */
+
+int DDaskrRootInit (void * ddaskr_mem, int ng, DDASRootFn g)
+{
+ DDaskrMem ddas_mem = NULL;
+ int nrt = 0;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrRootInit", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ if (g == NULL)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrRootInit", MSG_ROOT_FUNC_NULL);
+ return (IDA_ILL_INPUT);
+ }
+
+ g_fun = g;
+ nrt = (ng < 0) ? 0 : ng;
+ ng_fun = nrt;
+
+ /* Allocate jroot and set it to zero */
+ if (ng > 0)
+ {
+ jroot = calloc(ng, sizeof(int));
+ }
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrSetUserData
+ *
+ * =============================
+ *
+ * Sets a pointer to user_data that will be passed to the user's res function
+ * every time a user-supplied function is called.
+ */
+
+int DDaskrSetUserData (void * ddaskr_mem, void * User_data)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrSetUserData", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ user_data = User_data;
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrSetMaxStep
+ *
+ * =============================
+ *
+ * Sets the maximum step size, stocked in rwork->hmax.
+ * Sets info[6] to 1 for rwork->hmax to be taken in consideration by ddaskr().
+ */
+
+int DDaskrSetMaxStep (void * ddaskr_mem, realtype hMax)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrSetMaxStep", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ if (info[6] == 0)
+ {
+ info[6] = 1;
+ }
+ rwork->hmax = hMax;
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrSetStopTime
+ *
+ * =============================
+ *
+ * Specifies the time beyond which the integration is not to proceed, stocked in rwork->tcrit.
+ * Sets info[3] to 1 for rwork->tcrit to be taken in consideration by ddaskr().
+ */
+
+int DDaskrSetStopTime (void * ddaskr_mem, realtype tCrit)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrSetStopTime", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ if (info[3] == 0)
+ {
+ info[3] = 1;
+ }
+
+ rwork->tcrit = tCrit;
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrSetMaxNumSteps
+ *
+ * =============================
+ *
+ * Sets the maximum number of steps in an integration interval.
+ * Ensure that ddaskr will consider it via flag info[16], and stock it in iwork[33].
+ */
+
+int DDaskrSetMaxNumSteps (void * ddaskr_mem, long int maxnh)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrSetMaxNumSteps", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ if (maxnh <= 0)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "IDA", "DDaskrSetMaxNumSteps", MSG_BAD_MAXNH);
+ return (IDA_ILL_INPUT);
+ }
+
+ if (info[16] == 0)
+ {
+ info[16] = 1;
+ }
+
+ iwork[33] = maxnh;
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrSetMaxNumJacsIC
+ *
+ * =============================
+ *
+ * Sets the maximum number of Jacobian or preconditioner evaluations.
+ * Ensure that ddaskr will consider it via flag info[16], and stock it in iwork[32].
+ */
+
+int DDaskrSetMaxNumJacsIC (void * ddaskr_mem, int maxnj)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrSetMaxNumJacsIC", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ if (maxnj <= 0)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "IDA", "DDaskrSetMaxNumJacsIC", MSG_BAD_MAXNJ);
+ return (IDA_ILL_INPUT);
+ }
+
+ if (info[16] == 0)
+ {
+ info[16] = 1;
+ }
+
+ iwork[32] = maxnj;
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrSetMaxNumItersIC
+ *
+ * =============================
+ *
+ * Sets the maximum number of Newton iterations per Jacobian or preconditioner evaluation.
+ * Ensure that ddaskr will consider it via flag info[16], and stock it in iwork[31].
+ */
+
+int DDaskrSetMaxNumItersIC (void * ddaskr_mem, int maxnit)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrSetMaxNumItersIC", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ if (maxnit <= 0)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "IDA", "DDaskrSetMaxNumItersIC", MSG_BAD_MAXNIT);
+ return (IDA_ILL_INPUT);
+ }
+
+ if (info[16] == 0)
+ {
+ info[16] = 1;
+ }
+
+ iwork[31] = maxnit;
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrSetMaxNumStepsIC
+ *
+ * =============================
+ *
+ * Sets the maximum number of values of the artificial stepsize parameter H to be tried if info[10] = 1,
+ * during the Initial Conditions calculation.
+ * Ensure that ddaskr will consider it via flag info[16], and stock it in iwork[33].
+ */
+
+int DDaskrSetMaxNumStepsIC (void * ddaskr_mem, int MaxnhIC)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrSetMaxNumStepsIC", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ if (MaxnhIC <= 0)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "IDA", "DDaskrSetMaxNumStepsIC", MSG_BAD_MAXNH);
+ return (IDA_ILL_INPUT);
+ }
+
+ if (info[16] == 0)
+ {
+ info[16] = 1;
+ }
+
+ maxnhIC = MaxnhIC;
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrSetLineSearchOffIC
+ *
+ * =============================
+ *
+ * Sets the flag to turn off the linesearch algorithm.
+ * lsoff = 0 means linesearch is on, lsoff = 1 means it is turned off.
+ * Ensure that ddaskr will consider it via flag info[16], and stock it in iwork[34].
+ */
+
+int DDaskrSetLineSearchOffIC (void * ddaskr_mem, int lsoff)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrSetLineSearchOffIC", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ if (info[16] == 0)
+ {
+ info[16] = 1;
+ }
+
+ if (lsoff)
+ {
+ iwork[34] = 1;
+ }
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrSetID
+ *
+ * =============================
+ *
+ * Specifies which components are differential and which ones are algrebraic, in order to get consistent initial values.
+ * They are stocked in xproperty[neq] in the form:
+ * - xproperty[i] = 1 => differential component
+ * - xproperty[i] = 0 => algebraic component
+ */
+
+int DDaskrSetId (void * ddaskr_mem, N_Vector xproperty)
+{
+ DDaskrMem ddas_mem = NULL;
+ realtype * temp = NULL;
+ int i = 0, LID = 0;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrSetID", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ /* Copy xproperty data */
+ temp = NULL;
+ temp = NV_DATA_S(xproperty);
+
+ /* Inform ddaskr that we are going to define components
+ This is also a flag to compute consistent initial values */
+ if (info[10] == 0)
+ {
+ info[10] = 1;
+ }
+
+ /* Since we don't use the non-negative constraints in scicos, LID = 40 (otherwise, LID = 40+neq) */
+ LID = (info[9] == 0) ? 40 : 40 + *nEq;
+
+ /* Stock xproperty in a segment of iwork
+ temp[i] = 0 or 1, but that segment needs to be -1 or 1 (respectively) */
+ for (i = 0; i < *nEq; ++i)
+ {
+ iwork[i + LID] = (temp[i] == 0) ? -1 : 1;
+ }
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrSolve
+ *
+ * =============================
+ *
+ * This routine is the main driver of DDASKR.
+ *
+ * It integrates and looks for roots over a time interval defined by the user.
+ *
+ * The first time that DDaskr is called for a successfully initialized problem,
+ * it computes a tentative initial step size h.
+ *
+ * DDaskr supports five modes, specified by itask: DDAS_NORMAL, DDAS_ONE_STEP, DDAS_MESH_STEP, DDAS_NORMAL_TSTOP, and DDAS_ONE_STEP_TSTOP.
+ *
+ * In the DDAS_NORMAL mode, the solver steps until it reaches or passes tout and then interpolates to obtain y(tOut).
+ * In the DDAS_ONE_STEP mode, it takes one internal step and returns.
+ * DDAS_MESH_STEP means stop at the first internal mesh point at or beyond t = tout and return.
+ * DDAS_NORMAL_TSTOP and DDAS_ONE_STEP_TSTOP are similar to DDAS_NORMAL and DDAS_ONE_STEP, respectively,
+ * but the integration never proceeds past tcrit (which must have been defined through a call to DDaskrSetStopTime).
+ *
+ * It returns IDA_ROOT_RETURN if a root was detected, IDA_SUCCESS if the integration went correctly,
+ * or a corresponding error flag.
+ */
+
+int DDaskrSolve (void * ddaskr_mem, realtype tOut, realtype * tOld, N_Vector yOut, N_Vector ypOut, int itask)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ /* Check the input arguments */
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrSolve", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ if (yOut == NULL)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrSolve", MSG_YRET_NULL);
+ return (IDA_ILL_INPUT);
+ }
+
+ if (ypOut == NULL)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrSolve", MSG_YPRET_NULL);
+ return (IDA_ILL_INPUT);
+ }
+
+ if (tOld == NULL)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrSolve", MSG_TRET_NULL);
+ return (IDA_ILL_INPUT);
+ }
+
+ if ((itask != DDAS_NORMAL) && (itask != DDAS_ONE_STEP))
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrSolve", MSG_BAD_ITASK);
+ return (IDA_ILL_INPUT);
+ }
+
+ /* Retrieve nEq if it has changed, use a copy of the solution vector and stock the simulation times */
+ *nEq = NV_LENGTH_S(yOut);
+ yVec = NV_DATA_S(yOut);
+ ypVec = NV_DATA_S(ypOut);
+ tStart = *tOld;
+
+ /* Save the task mode in info[2] */
+ info[2] = itask;
+
+ /* Launch the simulation with the memory space parameters.
+ ddaskr() will update yVec, iState, rwork, iwork and jroot */
+ C2F(ddaskr) (res, nEq, &tStart, yVec, ypVec, &tOut, info, &relTol, &absTol, &iState, rwork, &lrw, iwork, &liw, rpar, ipar, jacpsol, psol, g_fun, &ng_fun, jroot);
+
+ /* Increment the start time */
+ *tOld = tStart;
+
+ /* For continuation calls, avoiding recomputation of consistent values (if info[10] used to be 1) */
+ info[10] = 0;
+
+ /* ddaskr() stocked the completion status in iState; return accordingly */
+ switch (iState)
+ {
+ case 5:
+ return (IDA_ROOT_RETURN);
+ case 6:
+ return (IDA_ZERO_DETACH_RETURN);
+ case -1:
+ DDASProcessError(ddas_mem, IDA_TOO_MUCH_WORK, "DDASKR", "DDaskrSolve", MSG_MAX_STEPS, tStart);
+ return (IDA_TOO_MUCH_WORK);
+ case -2:
+ DDASProcessError(ddas_mem, IDA_TOO_MUCH_ACC, "DDASKR", "DDaskrSolve", MSG_TOO_MUCH_ACC, tStart);
+ return (IDA_TOO_MUCH_ACC);
+ case -3:
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrSolve", MSG_BAD_ATOL, tStart);
+ return (IDA_ILL_INPUT);
+ case -6:
+ DDASProcessError(ddas_mem, IDA_ERR_FAIL, "DDASKR", "DDaskrSolve", MSG_ERR_FAILS, tStart);
+ return (IDA_ERR_FAIL);
+ case -7:
+ DDASProcessError(ddas_mem, IDA_CONV_FAIL, "DDASKR", "DDaskrSolve", MSG_CONV_FAILS, tStart);
+ return (IDA_CONV_FAIL);
+ case -8:
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrSolve", MSG_SINGULAR);
+ return (IDA_ILL_INPUT);
+ case -9:
+ DDASProcessError(ddas_mem, IDA_CONV_FAIL, "DDASKR", "DDaskrSolve", MSG_CONV_FAILS, tStart);
+ return (IDA_CONV_FAIL);
+ case -10:
+ DDASProcessError(ddas_mem, IDA_CONV_FAIL, "DDASKR", "DDaskrSolve", MSG_CONV_FAILS, tStart);
+ return (IDA_CONV_FAIL);
+ case -11:
+ DDASProcessError(ddas_mem, IDA_RES_FAIL, "DDASKR", "DDaskrSolve", MSG_RES_NONRECOV, tStart);
+ return (IDA_RES_FAIL);
+ case -12:
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrSolve", MSG_IC_FAIL_CONSTR);
+ return (IDA_ILL_INPUT);
+ case -33:
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrSolve", MSG_BAD_INPUT);
+ return (IDA_ILL_INPUT);
+ default:
+ return (IDA_SUCCESS);
+ }
+}
+
+/* =============================
+ *
+ * DDaskrCalcIC
+ *
+ * =============================
+ *
+ * Computing consistent initial values for the problem.
+ * This is done by launching the solver with a "stop after consistent initial values computation" flag
+ * (info[10] and info[13]).
+ */
+
+int DDaskrCalcIC (void * ddaskr_mem, int icopt, realtype tout1)
+{
+ DDaskrMem ddas_mem = NULL;
+ double tdist = 0, troundoff = 0, maxnhTemp = 0;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrCalcIC", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ /* icopt is a flag to determine whether the DDaskrSetID has been called,
+ in which case it is now known which components are differential / algebraic.
+ Here, we only use DDAS_YA_YDP_INIT (DDaskr has been called) */
+ if (icopt != DDAS_YA_YDP_INIT && icopt != DDAS_Y_INIT)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrCalcIC", MSG_IC_BAD_ICOPT);
+ return (IDA_ILL_INPUT);
+ }
+
+ /* Checking for valid tout1, not too close to tStart */
+ tdist = fabs(tout1 - tStart);
+ troundoff = 2 * UNIT_ROUNDOFF * (fabs(tStart) + fabs(tout1));
+ if (tdist < troundoff)
+ {
+ DDASProcessError(ddas_mem, IDA_ILL_INPUT, "DDASKR", "DDaskrCalcIC", MSG_IC_TOO_CLOSE);
+ return (IDA_ILL_INPUT);
+ }
+
+ /* info[10] = icopt => Flag on which initial values to compute (differential, algebraic or both)
+ info[13] = 1 => Do not proceed to integration after calculation */
+ info[10] = icopt;
+ if (info[13] == 0)
+ {
+ info[13] = 1;
+ }
+
+ /* Giving maxnh a specific value for IC calculation, switching back right after */
+ if (info[16] == 1)
+ {
+ maxnhTemp = iwork[33];
+ iwork[33] = maxnhIC;
+ }
+
+ C2F(ddaskr) (res, nEq, &tStart, yVec, ypVec, &tout1, info, &relTol, &absTol, &iState, rwork, &lrw, iwork, &liw, rpar, ipar, jacpsol, psol, g_fun, &ng_fun, jroot);
+
+ if (info[16] == 1)
+ {
+ iwork[33] = maxnhTemp;
+ }
+
+ /* The continuation of the program will not need initial values computation again, unless ReInit */
+ info[10] = 0;
+ info[13] = 0;
+
+ switch (iState)
+ {
+ case 4:
+ return (IDA_SUCCESS);
+ default:
+ DDASProcessError(ddas_mem, IDA_CONV_FAIL, "DDASKR", "DDaskrCalcIC", MSG_IC_CONV_FAILED);
+ return (IDA_CONV_FAIL);
+ }
+}
+
+/* =============================
+ *
+ * DDaskrGetConsistentIC
+ *
+ * =============================
+ *
+ * Following on DDasCalcIC, copying yy0 and yp0 (computed consistent values) into the memory space.
+ */
+
+int DDaskrGetConsistentIC (void * ddaskr_mem, N_Vector yy0, N_Vector yp0)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrGetConsistentIC", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ if (yy0 != NULL)
+ {
+ NV_DATA_S(yy0) = yVec;
+ }
+ if (yp0 != NULL)
+ {
+ NV_DATA_S(yp0) = ypVec;
+ }
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDaskrGetRootInfo
+ *
+ * =============================
+ *
+ * Updates rootsfound[] to the computed roots stocked in jroot[].
+ */
+
+int DDaskrGetRootInfo (void * ddaskr_mem, int * rootsfound)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrGetRootInfo", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ /* Copy jroot to rootsfound */
+ memcpy(rootsfound, jroot, ng_fun * sizeof(int));
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDASFree
+ *
+ * =============================
+ *
+ * This routine frees the problem memory allocated by DDaskrInit.
+ */
+
+void DDaskrFree (void ** ddaskr_mem)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ if (*ddaskr_mem == NULL)
+ {
+ return;
+ }
+ ddas_mem = (DDaskrMem) (*ddaskr_mem);
+
+ /* Free the inner vectors */
+ DDASFreeVectors (ddas_mem);
+
+ free (*ddaskr_mem);
+ *ddaskr_mem = NULL;
+}
+
+/* =============================
+ *
+ * DDASFreeVectors
+ *
+ * =============================
+ *
+ * Frees the problem memory space vectors.
+ */
+
+void DDASFreeVectors (DDaskrMem ddas_mem)
+{
+ /* info, rwork, iwork and jroot have been allocated; free them */
+ free (info);
+ free (rwork);
+ free (iwork);
+ free (jroot);
+}
+
+#define ehfun ddas_mem->ehfun
+
+/* =============================
+ *
+ * DDaskrSetErrHandlerFn
+ *
+ * =============================
+ *
+ * Specifies the error handler function.
+ */
+
+int DDaskrSetErrHandlerFn (void * ddaskr_mem, DDASErrHandlerFn ehFun, void * eh_data)
+{
+ DDaskrMem ddas_mem = NULL;
+
+ if (ddaskr_mem == NULL)
+ {
+ DDASProcessError(NULL, IDA_MEM_NULL, "DDASKR", "DDaskrSetErrHandlerFn", MSG_NO_MEM);
+ return (IDA_MEM_NULL);
+ }
+
+ ddas_mem = (DDaskrMem) ddaskr_mem;
+
+ ehfun = ehFun;
+
+ return (IDA_SUCCESS);
+}
+
+/* =============================
+ *
+ * DDASProcessError
+ *
+ * =============================
+ *
+ * Error handling function.
+ */
+
+void DDASProcessError (DDaskrMem ddas_mem, int error_code, const char *module, const char *fname, const char *msgfmt, ...)
+{
+ va_list ap;
+ char msg[256];
+
+ /* Initialize the argument pointer variable
+ (msgfmt is the last required argument to DDASProcessError) */
+ va_start(ap, msgfmt);
+
+ if (ddas_mem == NULL) /* We write to stderr */
+ {
+#ifndef NO_FPRINTF_OUTPUT
+ fprintf(stderr, "\n[%s ERROR] %s\n ", module, fname);
+ fprintf(stderr, msgfmt);
+ fprintf(stderr, "\n\n");
+#endif
+ }
+ else /* We can call ehfun */
+ {
+ /* Compose the message */
+ vsprintf(msg, msgfmt, ap);
+
+ /* Call ehfun */
+ ehfun(error_code, module, fname, msg, NULL);
+ }
+
+ /* Finalize argument processing */
+ va_end(ap);
+}
diff --git a/modules/scicos/src/c/ddaskr.h b/modules/scicos/src/c/ddaskr.h
new file mode 100755
index 000000000..48d38a74e
--- /dev/null
+++ b/modules/scicos/src/c/ddaskr.h
@@ -0,0 +1,155 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Scilab Enterprises - 2013 - Paul Bignier
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+
+#ifndef _DDASKR_H
+#define _DDASKR_H
+
+#include "sundials_extension.h"
+#include "sundials/sundials_types.h" // Definition of types 'realtype' and 'booleantype'
+#include "nvector/nvector_serial.h" // Type 'N_Vector'
+#include "../scicos_sundials/src/ida/ida_impl.h" // Error handling
+
+#ifndef max
+#define max(A,B) ((A>B) ? A:B) // 'max()' function
+#endif
+
+/* By default, we set the maximum order to 5 */
+#define MAXORD_DEFAULT 5
+
+// realtype workspace
+struct DDrWork_t
+{
+ realtype tcrit;
+ realtype hmax;
+ realtype hnext;
+ realtype tfarthest;
+ realtype rwork5;
+ realtype rwork6;
+ realtype hlast;
+ realtype rwork8;
+ realtype rwork9;
+ realtype rwork10;
+ realtype rwork11;
+ realtype rwork12;
+ realtype rwork13;
+ realtype steptol;
+ realtype epinit;
+ realtype rwork[1];
+};
+
+// Derivative computation, root functions, preconditioner calculation and application
+typedef void (*DDASResFn) (realtype *tOld, realtype *y, realtype *yp, realtype *res, int *flag, realtype *dummy1, int *dummy2);
+typedef void (*DDASRootFn) (int *neq, realtype *tOld, realtype *y, int *ng, realtype *groot, realtype *dummy1, int *dummy2);
+typedef void (*DDASJacPsolFn) (realtype *res, int *ires, int *neq, realtype *tOld, realtype *actual, realtype *actualP,
+ realtype *rewt, realtype *savr, realtype *wk, realtype *h, realtype *cj, realtype *wp,
+ int *iwp, int *ier, realtype *dummy1, int *dummy2);
+typedef void (*DDASPsolFn) (int *neq, realtype *tOld, realtype *actual, realtype *actualP,
+ realtype *savr, realtype *wk, realtype *cj, realtype *wght, realtype *wp,
+ int *iwp, realtype *b, realtype *eplin, int *ier, realtype *dummy1, int *dummy2);
+typedef void (*DDASErrHandlerFn) (int error_code, const char *module, const char *function, char *msg, void *user_data);
+
+// DDaskr problem memory structure
+typedef struct DDaskrMemRec
+{
+ DDASResFn res;
+ int * nEquations;
+ void * user_data;
+ realtype tStart;
+ realtype relTol;
+ realtype absTol;
+ realtype * yVector;
+ realtype * yPrimeVector;
+ int iState;
+ int * info;
+ struct DDrWork_t * rwork;
+ int lrw;
+ int * iwork;
+ int liw;
+ int maxnhIC;
+ DDASErrHandlerFn ehfun;
+ DDASRootFn g_fun;
+ int ng_fun;
+ int * jroot;
+ int solver;
+ DDASJacPsolFn jacpsol;
+ DDASPsolFn psol;
+ realtype * rpar;
+ int * ipar;
+} *DDaskrMem;
+
+// Creating the problem
+void * DDaskrCreate (int * neq, int ng, int solverIndex);
+
+// Allocating the problem
+int DDaskrInit (void * ddaskr_mem, DDASResFn Res, realtype t0, N_Vector yy0, N_Vector yp0, DDASJacPsolFn jacpsol, DDASPsolFn psol);
+
+// Reinitializing the problem
+int DDaskrReInit (void * ddaskr_mem, realtype tOld, N_Vector yy0, N_Vector yp0);
+
+// Specifying the tolerances
+int DDaskrSStolerances (void * ddaskr_mem, realtype reltol, realtype abstol);
+
+// Initializing the root-finding problem
+int DDaskrRootInit (void * ddaskr_mem, int ng, DDASRootFn g);
+
+// Setting a pointer to user_data that will be passed to the user's res function every time a user-supplied function is called
+int DDaskrSetUserData (void * ddaskr_mem, void * User_data);
+
+// Specifying the maximum step size
+int DDaskrSetMaxStep (void * ddaskr_mem, realtype hmax);
+
+// Specifying the time beyond which the integration is not to proceed
+int DDaskrSetStopTime (void * ddaskr_mem, realtype tcrit);
+
+// Sets the maximum number of steps in an integration interval
+int DDaskrSetMaxNumSteps (void * ddaskr_mem, long int maxnh);
+
+// Sets the maximum number of Jacobian or preconditioner evaluations
+int DDaskrSetMaxNumJacsIC (void * ddaskr_mem, int maxnj);
+
+// Sets the maximum number of Newton iterations per Jacobian or preconditioner evaluation
+int DDaskrSetMaxNumItersIC (void * ddaskr_mem, int maxnit);
+
+// Sets the maximum number of values of the artificial stepsize parameter H to be tried
+int DDaskrSetMaxNumStepsIC (void * ddaskr_mem, int MaxnhIC);
+
+// Sets the flag to turn off the linesearch algorithm
+int DDaskrSetLineSearchOffIC (void * ddaskr_mem, int lsoff);
+
+// Specifying which components are differential and which ones are algrebraic, in order to get consistent initial values
+int DDaskrSetId (void * ddaskr_mem, N_Vector xproperty);
+
+// Solving the problem
+int DDaskrSolve (void * ddaskr_mem, realtype tOut, realtype * tOld, N_Vector yOut, N_Vector ypOut, int itask);
+
+// Computing consistent initial values for the problem
+int DDaskrCalcIC (void * ddaskr_mem, int icopt, realtype tout1);
+
+// Following on DDasCalcIC, copying yy0 and yp0 (computed consistent values) into the memory space
+int DDaskrGetConsistentIC (void * ddaskr_mem, N_Vector yy0, N_Vector yp0);
+
+// Update rootsfound to the computed jroots
+int DDaskrGetRootInfo (void * ddaskr_mem, int * rootsfound);
+
+// Freeing the problem memory allocated by ddaskrMalloc
+void DDaskrFree (void ** ddaskr_mem);
+
+// Freeing the ddaskr vectors allocated in ddaskrAllocVectors
+void DDASFreeVectors (DDaskrMem ddaskr_mem);
+
+// Specifies the error handler function
+int DDaskrSetErrHandlerFn (void * ddaskr_mem, DDASErrHandlerFn ehfun, void * eh_data);
+
+// Error handling function
+void DDASProcessError (DDaskrMem ddas_mem, int error_code, const char *module, const char *fname, const char *msgfmt, ...);
+
+#endif
diff --git a/modules/scicos/src/c/differential_equations_f_Import.def b/modules/scicos/src/c/differential_equations_f_Import.def
new file mode 100755
index 000000000..da734d80a
--- /dev/null
+++ b/modules/scicos/src/c/differential_equations_f_Import.def
@@ -0,0 +1,4 @@
+LIBRARY differential_equations_f.dll
+EXPORTS
+ lsodar_
+ ddaskr_ \ No newline at end of file
diff --git a/modules/scicos/src/c/elementary_functions_f_Import.def b/modules/scicos/src/c/elementary_functions_f_Import.def
new file mode 100755
index 000000000..d844d5ec2
--- /dev/null
+++ b/modules/scicos/src/c/elementary_functions_f_Import.def
@@ -0,0 +1,6 @@
+LIBRARY elementary_functions_f.dll
+
+
+EXPORTS
+dset_
+isort_
diff --git a/modules/scicos/src/c/extractblklist.c b/modules/scicos/src/c/extractblklist.c
new file mode 100755
index 000000000..fa4195ac3
--- /dev/null
+++ b/modules/scicos/src/c/extractblklist.c
@@ -0,0 +1,2959 @@
+/* Scicos
+*
+* Copyright (C) INRIA - Alan LAYEC
+* Copyright (C) 2013 - Scilab Enterprises - Clement DAVID
+*
+* 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 <string.h>
+#include <assert.h>
+#include "machine.h" /* C2F */
+#include "extractblklist.h"
+#include "MlistGetFieldNumber.h"
+#include "cvstr.h"
+#include "MALLOC.h"
+/*--------------------------------------------------------------------------*/
+extern int *listentry(int *header, int i);
+/*--------------------------------------------------------------------------*/
+int extractblklist(int *il, scicos_block *Block, int *ierr)
+{
+ /*
+ * error table :
+ * ierr = 0 : no errors
+ * ierr = -39 : allocation error
+ * ierr = 98 : invalid field name
+ *
+ */
+
+ /* variables for scilab stack */
+ int *ilh = NULL;
+ int mh = 0, nh = 0;
+ int *ilh2 = NULL;
+ int mh2 = 0, nh2 = 0;
+ int len_str = 0;
+
+ /* local counter variables */
+ int n = 0;
+ int i = 0, j = 0;
+
+ *ierr = 0;
+
+ /* 2 - nevprt */
+ n = MlistGetFieldNumber(il, "nevprt");
+ if (n == -1)
+ {
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->nevprt = (int) * ((double *)(&ilh[4]));
+
+ /* 3 - funpt */
+ n = MlistGetFieldNumber(il, "funpt");
+ if (n == -1)
+ {
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ // pointer value is stored on double values, restoring as a copy will take
+ // care of alignement issues and pointer size issues.
+ memcpy(&Block->funpt, &ilh[4], sizeof(voidg));
+
+ /* 4 - type */
+ n = MlistGetFieldNumber(il, "type");
+ if (n == -1)
+ {
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->type = (int) * ((double *)(&ilh[4]));
+
+ /* 5 - scsptr */
+ n = MlistGetFieldNumber(il, "scsptr");
+ if (n == -1)
+ {
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->scsptr = (int) * ((double *)(&ilh[4]));
+
+ /* 6 - nz */
+ n = MlistGetFieldNumber(il, "nz");
+ if (n == -1)
+ {
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->nz = (int) * ((double *)(&ilh[4]));
+
+ /* 7 - z */
+ n = MlistGetFieldNumber(il, "z");
+ if (n == -1)
+ {
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->z = NULL;
+ assert(Block->nz == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->z = (double *) MALLOC(Block->nz * sizeof(double))) == NULL)
+ {
+ *ierr = -39;
+ return 0;
+ }
+ for (j = 0; j < Block->nz; j++)
+ {
+ Block->z[j] = *((double *)(&ilh[4]) + j);
+ }
+ }
+
+ /* 8 - noz */
+ n = MlistGetFieldNumber(il, "noz");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->noz = (int) * ((double *)(&ilh[4]));
+
+ /* 9 - ozsz */
+ n = MlistGetFieldNumber(il, "ozsz");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->ozsz = NULL;
+ assert(2 * Block->noz == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->ozsz = (int *) MALLOC(2 * Block->noz * sizeof(int))) == NULL)
+ {
+ FREE(Block->z);
+ *ierr = -39;
+ return 0;
+ }
+ }
+
+ for (j = 0; j < 2 * Block->noz; j++)
+ {
+ Block->ozsz[j] = (int) * ((double *)(&ilh[4]) + j);
+ }
+
+ /* 10 - oztyp */
+ n = MlistGetFieldNumber(il, "oztyp");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->oztyp = NULL;
+ assert(Block->noz == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->oztyp = (int *) MALLOC(Block->noz * sizeof(int))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ *ierr = -39;
+ return 0;
+ }
+ }
+ for (j = 0; j < Block->noz; j++)
+ {
+ Block->oztyp[j] = (int) * ((double *)(&ilh[4]) + j);
+ }
+
+ /* 11 - oz */
+ n = MlistGetFieldNumber(il, "oz");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->ozptr = NULL;
+ assert(Block->noz == mh);
+ if (Block->noz > 0)
+ {
+ if ((Block->ozptr = (void **) MALLOC(Block->noz * sizeof(void *))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ *ierr = -39;
+ return 0;
+ }
+
+ for (i = 0; i < Block->noz; i++)
+ {
+ ilh2 = (int *) (listentry(ilh, i + 1));
+ mh2 = ilh2[1];
+ nh2 = ilh2[2];
+ Block->ozptr[i] = NULL;
+ assert(mh2 * nh2 >= 0);
+ switch (Block->oztyp[i])
+ {
+ case 10 :
+ if ((Block->ozptr[i] = (double *) MALLOC(mh2 * nh2 * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((double *)Block->ozptr[i], \
+ (double *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(double));
+ break;
+
+ case 11 :
+ if ((Block->ozptr[i] = (double *) MALLOC(2 * mh2 * nh2 * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((double *)Block->ozptr[i], \
+ (double *)(&ilh2[4]), \
+ 2 * mh2 * nh2 * sizeof(double));
+ break;
+
+ case 84 :
+ if ((Block->ozptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((SCSINT32_COP *)Block->ozptr[i], \
+ (SCSINT32_COP *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(SCSINT32_COP));
+ break;
+
+ case 82 :
+ if ((Block->ozptr[i] = (short *) MALLOC(mh2 * nh2 * sizeof(short))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((short *)Block->ozptr[i], \
+ (short *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(short));
+ break;
+
+ case 81 :
+ if ((Block->ozptr[i] = (char *) MALLOC(mh2 * nh2 * sizeof(char))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((char *)Block->ozptr[i], \
+ (char *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(char));
+ break;
+
+ case 814 :
+ if ((Block->ozptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((SCSUINT32_COP *)Block->ozptr[i], \
+ (SCSUINT32_COP *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(SCSUINT32_COP));
+ break;
+
+ case 812 :
+ if ((Block->ozptr[i] = (unsigned short *) MALLOC(mh2 * nh2 * sizeof(unsigned short))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((unsigned short *)Block->ozptr[i], \
+ (unsigned short *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(unsigned short));
+ break;
+
+ case 811 :
+ if ((Block->ozptr[i] = (unsigned char *) MALLOC(mh2 * nh2 * sizeof(unsigned char))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((unsigned char *)Block->ozptr[i], \
+ (unsigned char *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(unsigned char));
+ break;
+ }
+ }
+ }
+
+ /* 12 - nx */
+ n = MlistGetFieldNumber(il, "nx");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->nx = (int) * ((double *)(&ilh[4]));
+
+ /* 13 - x */
+ n = MlistGetFieldNumber(il, "x");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->x = NULL;
+ assert(Block->nx == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->x = (double *) MALLOC(Block->nx * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ *ierr = -39;
+ return 0;
+ }
+ }
+ for (j = 0; j < (mh * nh); j++)
+ {
+ Block->x[j] = *((double *)(&ilh[4]) + j);
+ }
+
+ /* 14 - xd */
+ n = MlistGetFieldNumber(il, "xd");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->xd = NULL;
+ assert(Block->nx == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->xd = (double *) MALLOC(Block->nx * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ *ierr = -39;
+ return 0;
+ }
+ }
+ for (j = 0; j < (mh * nh); j++)
+ {
+ Block->xd[j] = *((double *)(&ilh[4]) + j);
+ }
+
+ /* 15 - res */
+ n = MlistGetFieldNumber(il, "res");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->res = NULL;
+ assert(Block->nx == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->res = (double *) MALLOC(Block->nx * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ *ierr = -39;
+ return 0;
+ }
+ }
+
+ for (j = 0; j < (mh * nh); j++)
+ {
+ Block->res[j] = *((double *)(&ilh[4]) + j);
+ }
+
+ /* 16 - nin */
+ n = MlistGetFieldNumber(il, "nin");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->nin = (int) * ((double *)(&ilh[4]));
+
+ /* 17 - insz */
+ n = MlistGetFieldNumber(il, "insz");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->insz = NULL;
+ assert(3 * Block->nin == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->insz = (int *) MALLOC(3 * Block->nin * sizeof(int))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ *ierr = -39;
+ return 0;
+ }
+ }
+ for (j = 0; j < 3 * Block->nin; j++)
+ {
+ Block->insz[j] = (int) * ((double *)(&ilh[4]) + j);
+ }
+
+ /* 18 - inptr */
+ n = MlistGetFieldNumber(il, "inptr");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->inptr = NULL;
+ assert(Block->nin == mh);
+ assert(mh >= 0);
+ if (Block->nin > 0)
+ {
+ if ((Block->inptr = (void **) MALLOC(Block->nin * sizeof(void *))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ *ierr = -39;
+ return 0;
+ }
+ for (i = 0; i < Block->nin; i++)
+ {
+ ilh2 = (int *) (listentry(ilh, i + 1));
+ mh2 = ilh2[1];
+ nh2 = ilh2[2];
+ Block->inptr[i] = NULL;
+ assert(mh2 * nh2 >= 0);
+ switch (Block->insz[2 * Block->nin + i])
+ {
+ case 10 :
+ if ((Block->inptr[i] = (double *) MALLOC(mh2 * nh2 * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((double *)Block->inptr[i], \
+ (double *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(double));
+ break;
+
+ case 11 :
+ if ((Block->inptr[i] = (double *) MALLOC(2 * mh2 * nh2 * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((double *)Block->inptr[i], \
+ (double *)(&ilh2[4]), \
+ 2 * mh2 * nh2 * sizeof(double));
+ break;
+
+ case 84 :
+ if ((Block->inptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((SCSINT32_COP *)Block->inptr[i], \
+ (SCSINT32_COP *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(SCSINT32_COP));
+ break;
+
+ case 82 :
+ if ((Block->inptr[i] = (short *) MALLOC(mh2 * nh2 * sizeof(short))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((short *)Block->inptr[i], \
+ (short *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(short));
+ break;
+
+ case 81 :
+ if ((Block->inptr[i] = (char *) MALLOC(mh2 * nh2 * sizeof(char))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((char *)Block->inptr[i], \
+ (char *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(char));
+ break;
+
+ case 814 :
+ if ((Block->inptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((SCSUINT32_COP *)Block->inptr[i], \
+ (SCSUINT32_COP *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(SCSUINT32_COP));
+ break;
+
+ case 812 :
+ if ((Block->inptr[i] = (unsigned short *) MALLOC(mh2 * nh2 * sizeof(unsigned short))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((unsigned short *)Block->inptr[i], \
+ (unsigned short *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(unsigned short));
+ break;
+
+ case 811 :
+ if ((Block->inptr[i] = (unsigned char *) MALLOC(mh2 * nh2 * sizeof(unsigned char))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((unsigned char *)Block->inptr[i], \
+ (unsigned char *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(unsigned char));
+ break;
+ }
+ }
+ }
+
+ /* 19 - nout */
+ n = MlistGetFieldNumber(il, "nout");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->nout = (int) * ((double *)(&ilh[4]));
+
+ /* 20 - outsz */
+ n = MlistGetFieldNumber(il, "outsz");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ *ierr = 98;
+ return 0;
+ }
+
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->outsz = NULL;
+ assert(3 * Block->nout == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->outsz = (int *) MALLOC(3 * Block->nout * sizeof(int))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ *ierr = -39;
+ return 0;
+ }
+ }
+
+ for (j = 0; j < 3 * Block->nout; j++)
+ {
+ Block->outsz[j] = (int) * ((double *)(&ilh[4]) + j);
+ }
+
+ /* 21 - outptr */
+ n = MlistGetFieldNumber(il, "outptr");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->outptr = NULL;
+ assert(Block->nout == mh);
+ assert(mh >= 0);
+ if (Block->nout > 0)
+ {
+ if ((Block->outptr = (void **) MALLOC(Block->nout * sizeof(void *))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ *ierr = -39;
+ return 0;
+ }
+ for (i = 0; i < Block->nout; i++)
+ {
+ ilh2 = (int *) (listentry(ilh, i + 1));
+ mh2 = ilh2[1];
+ nh2 = ilh2[2];
+ Block->outptr[i] = NULL;
+ assert(mh2 * nh2 >= 0);
+ switch (Block->outsz[2 * Block->nout + i])
+ {
+ case 10 :
+ if ((Block->outptr[i] = (double *) MALLOC(mh2 * nh2 * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((double *)Block->outptr[i], \
+ (double *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(double));
+ break;
+
+ case 11 :
+ if ((Block->outptr[i] = (double *) MALLOC(2 * mh2 * nh2 * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((double *)Block->outptr[i], \
+ (double *)(&ilh2[4]), \
+ 2 * mh2 * nh2 * sizeof(double));
+ break;
+
+ case 84 :
+ if ((Block->outptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((SCSINT32_COP *)Block->outptr[i], \
+ (SCSINT32_COP *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(SCSINT32_COP));
+ break;
+
+ case 82 :
+ if ((Block->outptr[i] = (short *) MALLOC(mh2 * nh2 * sizeof(short))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((short *)Block->outptr[i], \
+ (short *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(short));
+ break;
+
+ case 81 :
+ if ((Block->outptr[i] = (char *) MALLOC(mh2 * nh2 * sizeof(char))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((char *)Block->outptr[i], \
+ (char *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(char));
+ break;
+
+ case 814 :
+ if ((Block->outptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((SCSUINT32_COP *)Block->outptr[i], \
+ (SCSUINT32_COP *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(SCSUINT32_COP));
+ break;
+
+ case 812 :
+ if ((Block->outptr[i] = (unsigned short *) MALLOC(mh2 * nh2 * sizeof(unsigned short))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((unsigned short *)Block->outptr[i], \
+ (unsigned short *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(unsigned short));
+ break;
+
+ case 811 :
+ if ((Block->outptr[i] = (unsigned char *) MALLOC(mh2 * nh2 * sizeof(unsigned char))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((unsigned char *)Block->outptr[i], \
+ (unsigned char *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(unsigned char));
+ break;
+ }
+ }
+ }
+
+ /* 22 - nevout */
+ n = MlistGetFieldNumber(il, "nevout");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->nevout = (int) * ((double *)(&ilh[4]));
+
+ /* 23 - evout */
+ n = MlistGetFieldNumber(il, "evout");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->evout = NULL;
+ assert(Block->nevout == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->evout = (double *) MALLOC(Block->nevout * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ *ierr = -39;
+ return 0;
+ }
+ }
+
+ for (j = 0; j < (mh * nh); j++)
+ {
+ Block->evout[j] = *((double *)(&ilh[4]) + j);
+ }
+
+ /* 24 - nrpar */
+ n = MlistGetFieldNumber(il, "nrpar");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->nrpar = (int) * ((double *)(&ilh[4]));
+
+ /* 25 - rpar */
+ n = MlistGetFieldNumber(il, "rpar");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->rpar = NULL;
+ assert(Block->nrpar == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->rpar = (double *) MALLOC(Block->nrpar * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ *ierr = -39;
+ return 0;
+ }
+ }
+
+ for (j = 0; j < (mh * nh); j++)
+ {
+ Block->rpar[j] = *((double *)(&ilh[4]) + j);
+ }
+
+ /* 26 - nipar */
+ n = MlistGetFieldNumber(il, "nipar");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->nipar = (int) * ((double *)(&ilh[4]));
+
+ /* 27 - ipar */
+ n = MlistGetFieldNumber(il, "ipar");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->ipar = NULL;
+ assert(Block->nipar == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->ipar = (int *) MALLOC(Block->nipar * sizeof(int))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ *ierr = -39;
+ return 0;
+ }
+ }
+ for (j = 0; j < (mh * nh); j++)
+ {
+ Block->ipar[j] = (int) * ((double *)(&ilh[4]) + j);
+ }
+
+ /* 28 - nopar */
+ n = MlistGetFieldNumber(il, "nopar");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->nopar = (int) * ((double *)(&ilh[4]));
+
+ /* 29 - oparsz */
+ n = MlistGetFieldNumber(il, "oparsz");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->oparsz = NULL;
+ assert(2 * Block->nopar == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->oparsz = (int *) MALLOC(2 * Block->nopar * sizeof(int))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ *ierr = -39;
+ return 0;
+ }
+ }
+
+ for (j = 0; j < 2 * Block->nopar; j++)
+ {
+ Block->oparsz[j] = (int) * ((double *)(&ilh[4]) + j);
+ }
+
+ /* 30 - opartyp */
+ n = MlistGetFieldNumber(il, "opartyp");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->opartyp = NULL;
+ assert(Block->nopar == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->opartyp = (int *) MALLOC(Block->nopar * sizeof(int))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ *ierr = -39;
+ return 0;
+ }
+ }
+
+ for (j = 0; j < Block->nopar; j++)
+ {
+ Block->opartyp[j] = (int) * ((double *)(&ilh[4]) + j);
+ }
+
+ /* 31 - opar */
+ n = MlistGetFieldNumber(il, "opar");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->oparptr = NULL;
+ assert(Block->nopar == mh);
+ assert(mh >= 0);
+ if (Block->nopar > 0)
+ {
+ if ((Block->oparptr = (void **) MALLOC(Block->nopar * sizeof(void *))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ *ierr = -39;
+ return 0;
+ }
+
+ for (i = 0; i < Block->nopar; i++)
+ {
+ ilh2 = (int *) (listentry(ilh, i + 1));
+ mh2 = ilh2[1];
+ nh2 = ilh2[2];
+ Block->oparptr[i] = NULL;
+ assert(mh2 * nh2 >= 0);
+ switch (Block->opartyp[i])
+ {
+ case 10 :
+ if ((Block->oparptr[i] = (double *) MALLOC(mh2 * nh2 * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((double *)Block->oparptr[i], \
+ (double *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(double));
+ break;
+
+ case 11 :
+ if ((Block->oparptr[i] = (double *) MALLOC(2 * mh2 * nh2 * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((double *)Block->oparptr[i], \
+ (double *)(&ilh2[4]), \
+ 2 * mh2 * nh2 * sizeof(double));
+ break;
+
+ case 84 :
+ if ((Block->oparptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((SCSINT32_COP *)Block->oparptr[i], \
+ (SCSINT32_COP *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(SCSINT32_COP));
+ break;
+
+ case 82 :
+ if ((Block->oparptr[i] = (short *) MALLOC(mh2 * nh2 * sizeof(short))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((short *)Block->oparptr[i], \
+ (short *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(short));
+ break;
+
+ case 81 :
+ if ((Block->oparptr[i] = (char *) MALLOC(mh2 * nh2 * sizeof(char))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((char *)Block->oparptr[i], \
+ (char *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(char));
+ break;
+
+ case 814 :
+ if ((Block->oparptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((SCSUINT32_COP *)Block->oparptr[i], \
+ (SCSUINT32_COP *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(SCSUINT32_COP));
+ break;
+
+ case 812 :
+ if ((Block->oparptr[i] = (unsigned short *) MALLOC(mh2 * nh2 * sizeof(unsigned short))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((unsigned short *)Block->oparptr[i], \
+ (unsigned short *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(unsigned short));
+ break;
+
+ case 811 :
+ if ((Block->oparptr[i] = (unsigned char *) MALLOC(mh2 * nh2 * sizeof(unsigned char))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < i; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ *ierr = -39;
+ return 0;
+ }
+ memcpy((unsigned char *)Block->oparptr[i], \
+ (unsigned char *)(&ilh2[4]), \
+ mh2 * nh2 * sizeof(unsigned char));
+ break;
+ }
+ }
+ }
+
+ /* 32 - ng */
+ n = MlistGetFieldNumber(il, "ng");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->ng = (int) * ((double *)(&ilh[4]));
+
+ /* 33 - g */
+ n = MlistGetFieldNumber(il, "g");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->g = NULL;
+ assert(Block->ng == mh * nh);
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->g = (double *) MALLOC(Block->ng * sizeof(double))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ *ierr = -39;
+ return 0;
+ }
+ }
+
+ for (j = 0; j < (mh * nh); j++)
+ {
+ Block->g[j] = *((double *)(&ilh[4]) + j);
+ }
+
+ /* 34 - ztyp */
+ n = MlistGetFieldNumber(il, "ztyp");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ FREE(Block->g);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->ztyp = (int) * ((double *)(&ilh[4]));
+
+ /* 35 - jroot */
+ n = MlistGetFieldNumber(il, "jroot");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ FREE(Block->g);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->jroot = NULL;
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->jroot = (int *) MALLOC((mh * nh) * sizeof(int))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ FREE(Block->g);
+ *ierr = -39;
+ return 0;
+ }
+ }
+
+ for (j = 0; j < (mh * nh); j++)
+ {
+ Block->jroot[j] = (int) * ((double *)(&ilh[4]) + j);
+ }
+
+ /* 36 - label */
+ n = MlistGetFieldNumber(il, "label");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ FREE(Block->g);
+ FREE(Block->jroot);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->label = NULL;
+ if (mh * nh != 0)
+ {
+ len_str = ilh[5] - 1;
+ if (len_str < 0)
+ {
+ len_str = 0;
+ }
+ }
+ else
+ {
+ len_str = 0;
+ }
+ if ((Block->label = (char *) MALLOC((len_str + 1) * sizeof(char))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ FREE(Block->g);
+ FREE(Block->jroot);
+ *ierr = -39;
+ return 0;
+ }
+ Block->label[len_str] = '\0';
+ if (len_str > 0)
+ {
+ C2F(cvstr)(&len_str, &ilh[4 + mh * nh + 1], Block->label, (j = 1, &j), len_str);
+ }
+
+ /* 37 - work*/
+ n = MlistGetFieldNumber(il, "work");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ FREE(Block->g);
+ FREE(Block->jroot);
+ FREE(Block->label);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->work = (void**) ((int) * ((double *)(&ilh[4])));
+
+ /* 38 - nmode*/
+ n = MlistGetFieldNumber(il, "nmode");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ FREE(Block->g);
+ FREE(Block->jroot);
+ FREE(Block->label);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->nmode = (int) * ((double *)(&ilh[4]));
+
+ /* 39 - mode */
+ n = MlistGetFieldNumber(il, "mode");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ FREE(Block->g);
+ FREE(Block->jroot);
+ FREE(Block->label);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->mode = NULL;
+ assert(Block->nmode == mh * nh);
+ assert(mh * nh >= 0);
+ if (Block->nmode > 0)
+ {
+ if ((Block->mode = (int *) MALLOC(Block->nmode * sizeof(int))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ FREE(Block->g);
+ FREE(Block->jroot);
+ FREE(Block->label);
+ *ierr = -39;
+ return 0;
+ }
+ }
+
+ for (j = 0; j < (mh * nh); j++)
+ {
+ Block->mode[j] = (int) * ((double *)(&ilh[4]) + j);
+ }
+
+ /* 40 - xprop */
+ n = MlistGetFieldNumber(il, "xprop");
+ if (n == -1)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ FREE(Block->g);
+ FREE(Block->jroot);
+ FREE(Block->label);
+ FREE(Block->mode);
+ *ierr = 98;
+ return 0;
+ }
+ ilh = (int *) (listentry(il, n));
+ mh = ilh[1];
+ nh = ilh[2];
+ Block->xprop = NULL;
+ assert(mh * nh >= 0);
+ if (mh * nh > 0)
+ {
+ if ((Block->xprop = (int *) MALLOC((mh * nh) * sizeof(int))) == NULL)
+ {
+ FREE(Block->z);
+ FREE(Block->ozsz);
+ FREE(Block->oztyp);
+ for (j = 0; j < Block->noz; j++)
+ {
+ FREE(Block->ozptr[j]);
+ }
+ FREE(Block->ozptr);
+ FREE(Block->x);
+ FREE(Block->xd);
+ FREE(Block->res);
+ FREE(Block->insz);
+ for (j = 0; j < Block->nin; j++)
+ {
+ FREE(Block->inptr[j]);
+ }
+ FREE(Block->inptr);
+ FREE(Block->outsz);
+ for (j = 0; j < Block->nout; j++)
+ {
+ FREE(Block->outptr[j]);
+ }
+ FREE(Block->outptr);
+ FREE(Block->evout);
+ FREE(Block->rpar);
+ FREE(Block->ipar);
+ FREE(Block->oparsz);
+ FREE(Block->opartyp);
+ for (j = 0; j < Block->nopar; j++)
+ {
+ FREE(Block->oparptr[j]);
+ }
+ FREE(Block->oparptr);
+ FREE(Block->g);
+ FREE(Block->jroot);
+ FREE(Block->label);
+ FREE(Block->mode);
+ *ierr = -39;
+ return 0;
+ }
+ }
+
+ for (j = 0; j < (mh * nh); j++)
+ {
+ Block->xprop[j] = (int) * ((double *)(&ilh[4]) + j);
+ }
+
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/extractblklist.h b/modules/scicos/src/c/extractblklist.h
new file mode 100755
index 000000000..3ef1e3e4b
--- /dev/null
+++ b/modules/scicos/src/c/extractblklist.h
@@ -0,0 +1,43 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - Allan CORNET
+*
+* 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
+*/
+/*--------------------------------------------------------------------------*/
+
+#ifndef __EXTRACTBLKLIST_H__
+#define __EXTRACTBLKLIST_H__
+
+#include "scicos_block4.h"
+
+/* extractblklist : create a scicos_block C structure from
+* a scicos_block scilab structure.
+*
+* Input : il : the ptr of the scicos_block scilab structure
+* in the stack
+*
+* Output : Block : C scicos_block structure
+* ierr : an error number (ifany)
+*
+* initial rev 13/11/07, Alan Layec
+*/
+
+int extractblklist(int *il, scicos_block *Block, int *ierr);
+
+#endif /* __EXTRACTBLKLIST_H__ */
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/ezxml.c b/modules/scicos/src/c/ezxml.c
new file mode 100755
index 000000000..3abcbe776
--- /dev/null
+++ b/modules/scicos/src/c/ezxml.c
@@ -0,0 +1,1696 @@
+/* ezxml.c
+ *
+ * Copyright 2004-2006 Aaron Voisine <aaron@voisine.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <ctype.h>
+#ifndef _MSC_VER
+#include <unistd.h>
+#else
+#include <io.h>
+#endif
+#include <sys/types.h>
+#if defined(_MSC_VER)
+#define EZXML_NOMMAP
+#endif
+
+#ifndef EZXML_NOMMAP
+#include <sys/mman.h>
+#endif // EZXML_NOMMAP
+#include <sys/stat.h>
+#include "ezxml.h"
+
+#include "MALLOC.h"
+
+#ifdef _MSC_VER
+#include "strdup_windows.h"
+#endif
+
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#define open _open
+#define read _read
+#define close _close
+#endif
+
+#define EZXML_WS "\t\n " // whitespace
+#define EZXML_ERRL 128 // maximum error string length
+
+typedef struct ezxml_root *ezxml_root_t;
+struct ezxml_root // additional data for the root tag
+{
+ struct ezxml xml; // is a super-struct built on top of ezxml struct
+ ezxml_t cur; // current xml tree insertion point
+ char *m; // original xml string
+ size_t len; // length of allocated memory for mmap, -1 for malloc
+ char *u; // UTF-8 conversion of string if original was UTF-16
+ char *s; // start of work area
+ char *e; // end of work area
+ char **ent; // general entities (ampersand sequences)
+ char ***attr; // default attributes
+ char ***pi; // processing instructions
+ short standalone; // non-zero if <?xml standalone="yes"?>
+ char err[EZXML_ERRL]; // error string
+};
+
+char *EZXML_NIL[] = { NULL }; // empty, null terminated array of strings
+
+// returns the first child tag with the given name or NULL if not found
+ezxml_t ezxml_child(ezxml_t xml, const char *name)
+{
+ xml = (xml) ? xml->child : NULL;
+ while (xml && strcmp(name, xml->name))
+ {
+ xml = xml->sibling;
+ }
+ return xml;
+}
+
+// returns the Nth tag with the same name in the same subsection or NULL if not
+// found
+ezxml_t ezxml_idx(ezxml_t xml, int idx)
+{
+ for (; xml && idx; idx--)
+ {
+ xml = xml->next;
+ }
+ return xml;
+}
+
+// returns the value of the requested tag attribute or NULL if not found
+const char *ezxml_attr(ezxml_t xml, const char *attr)
+{
+ int i = 0, j = 1;
+ ezxml_root_t root = (ezxml_root_t)xml;
+
+ if (! xml || ! xml->attr)
+ {
+ return NULL;
+ }
+ while (xml->attr[i] && strcmp(attr, xml->attr[i]))
+ {
+ i += 2;
+ }
+ if (xml->attr[i])
+ {
+ return xml->attr[i + 1]; // found attribute
+ }
+
+ while (root->xml.parent)
+ {
+ root = (ezxml_root_t)root->xml.parent; // root tag
+ }
+ for (i = 0; root->attr[i] && strcmp(xml->name, root->attr[i][0]); i++)
+ {
+ ;
+ }
+ if (! root->attr[i])
+ {
+ return NULL; // no matching default attributes
+ }
+ while (root->attr[i][j] && strcmp(attr, root->attr[i][j]))
+ {
+ j += 3;
+ }
+ return (root->attr[i][j]) ? root->attr[i][j + 1] : NULL; // found default
+}
+
+// same as ezxml_get but takes an already initialized va_list
+ezxml_t ezxml_vget(ezxml_t xml, va_list ap)
+{
+ char *name = va_arg(ap, char *);
+ int idx = -1;
+
+ if (name && *name)
+ {
+ idx = va_arg(ap, int);
+ xml = ezxml_child(xml, name);
+ }
+ return (idx < 0) ? xml : ezxml_vget(ezxml_idx(xml, idx), ap);
+}
+
+// Traverses the xml tree to retrieve a specific subtag. Takes a variable
+// length list of tag names and indexes. The argument list must be terminated
+// by either an index of -1 or an empty string tag name. Example:
+// title = ezxml_get(library, "shelf", 0, "book", 2, "title", -1);
+// This retrieves the title of the 3rd book on the 1st shelf of library.
+// Returns NULL if not found.
+ezxml_t ezxml_get(ezxml_t xml, ...)
+{
+ va_list ap;
+ ezxml_t r;
+
+ va_start(ap, xml);
+ r = ezxml_vget(xml, ap);
+ va_end(ap);
+ return r;
+}
+
+// returns a null terminated array of processing instructions for the given
+// target
+const char **ezxml_pi(ezxml_t xml, const char *target)
+{
+ ezxml_root_t root = (ezxml_root_t)xml;
+ int i = 0;
+
+ if (! root)
+ {
+ return (const char **)EZXML_NIL;
+ }
+ while (root->xml.parent)
+ {
+ root = (ezxml_root_t)root->xml.parent; // root tag
+ }
+ while (root->pi[i] && strcmp(target, root->pi[i][0]))
+ {
+ i++; // find target
+ }
+ return (const char **)((root->pi[i]) ? root->pi[i] + 1 : EZXML_NIL);
+}
+
+// set an error string and return root
+ezxml_t ezxml_err(ezxml_root_t root, char *s, const char *err, ...)
+{
+ va_list ap;
+ int line = 1;
+ char *t, fmt[EZXML_ERRL];
+
+ for (t = root->s; t < s; t++) if (*t == '\n')
+ {
+ line++;
+ }
+ snprintf(fmt, EZXML_ERRL, "[error near line %d]: %s", line, err);
+
+ va_start(ap, err);
+ vsnprintf(root->err, EZXML_ERRL, fmt, ap);
+ va_end(ap);
+
+ return &root->xml;
+}
+
+// Recursively decodes entity and character references and normalizes new lines
+// ent is a null terminated array of alternating entity names and values. set t
+// to '&' for general entity decoding, '%' for parameter entity decoding, 'c'
+// for cdata sections, ' ' for attribute normalization, or '*' for non-cdata
+// attribute normalization. Returns s, or if the decoded string is longer than
+// s, returns a malloced string that must be freed.
+char *ezxml_decode(char *s, char **ent, char t)
+{
+ char *e, *r = s, *m = s;
+ long b, c, d, l;
+
+ for (; *s; s++) // normalize line endings
+ {
+ while (*s == '\r')
+ {
+ *(s++) = '\n';
+ if (*s == '\n')
+ {
+ memmove(s, (s + 1), strlen(s));
+ }
+ }
+ }
+
+ for (s = r; ; )
+ {
+ while (*s && *s != '&' && (*s != '%' || t != '%') && !isspace(*s))
+ {
+ s++;
+ }
+
+ if (! *s)
+ {
+ break;
+ }
+ else if (t != 'c' && ! strncmp(s, "&#", 2)) // character reference
+ {
+ if (s[2] == 'x')
+ {
+ c = strtol(s + 3, &e, 16); // base 16
+ }
+ else
+ {
+ c = strtol(s + 2, &e, 10); // base 10
+ }
+ if (! c || *e != ';')
+ {
+ s++; // not a character ref
+ continue;
+ }
+
+ if ((long)c < 0x80)
+ {
+ *(s++) = (char)c; // US-ASCII subset
+ }
+ else // multi-byte UTF-8 sequence
+ {
+ for (b = 0, d = c; d; d /= 2)
+ {
+ b++; // number of bits in c
+ }
+ b = (b - 2) / 5; // number of bytes in payload
+ *(s++) = (char)(0xFF << (7 - b)) | (char)(c >> (6 * b)); // head
+ while (b)
+ {
+ *(s++) = 0x80 | ((c >> (6 * --b)) & 0x3F); // payload
+ }
+ }
+
+ memmove(s, strchr(s, ';') + 1, strlen(strchr(s, ';')));
+ }
+ else if ((*s == '&' && (t == '&' || t == ' ' || t == '*')) ||
+ (*s == '%' && t == '%')) // entity reference
+ {
+ for (b = 0; ent[b] && strncmp(s + 1, ent[b], strlen(ent[b]));
+ b += 2)
+ {
+ ; // find entity in entity list
+ }
+
+ if (ent[b++]) // found a match
+ {
+ if ((c = (long)strlen(ent[b])) - 1 > (e = strchr(s, ';')) - s)
+ {
+ l = (long)(d = (long)(s - r)) + c + (long)strlen(e); // new length
+ r = (r == m) ? strcpy(MALLOC(l), r) : REALLOC(r, l);
+ e = strchr((s = r + d), ';'); // fix up pointers
+ }
+
+ memmove(s + c, e + 1, strlen(e)); // shift rest of string
+ strncpy(s, ent[b], c); // copy in replacement text
+ }
+ else
+ {
+ s++; // not a known entity
+ }
+ }
+ else if ((t == ' ' || t == '*') && isspace(*s))
+ {
+ *(s++) = ' ';
+ }
+ else
+ {
+ s++; // no decoding needed
+ }
+ }
+
+ if (t == '*') // normalize spaces for non-cdata attributes
+ {
+ for (s = r; *s; s++)
+ {
+ if ((l = (long)strspn(s, " ")))
+ {
+ memmove(s, s + l, (long)strlen(s + l) + 1);
+ }
+ while (*s && *s != ' ')
+ {
+ s++;
+ }
+ }
+ if (--s >= r && *s == ' ')
+ {
+ *s = '\0'; // trim any trailing space
+ }
+ }
+ return r;
+}
+
+// called when parser finds start of new tag
+void ezxml_open_tag(ezxml_root_t root, char *name, char **attr)
+{
+ ezxml_t xml = root->cur;
+
+ if (xml->name)
+ {
+ xml = ezxml_add_child(xml, name, strlen(xml->txt));
+ }
+ else
+ {
+ xml->name = name; // first open tag
+ }
+
+ xml->attr = attr;
+ root->cur = xml; // update tag insertion point
+}
+
+// called when parser finds character content between open and closing tag
+void ezxml_char_content(ezxml_root_t root, char *s, size_t len, char t)
+{
+ ezxml_t xml = root->cur;
+ char *m = s;
+ size_t l;
+
+ if (! xml || ! xml->name || ! len)
+ {
+ return; // sanity check
+ }
+
+ s[len] = '\0'; // null terminate text (calling functions anticipate this)
+ len = strlen(s = ezxml_decode(s, root->ent, t)) + 1;
+
+ if (! *(xml->txt))
+ {
+ xml->txt = s; // initial character content
+ }
+ else // allocate our own memory and make a copy
+ {
+ xml->txt = (xml->flags & EZXML_TXTM) // allocate some space
+ ? REALLOC(xml->txt, (l = strlen(xml->txt)) + len)
+ : strcpy(MALLOC((l = strlen(xml->txt)) + len), xml->txt);
+ strcpy(xml->txt + l, s); // add new char content
+ if (s != m)
+ {
+ FREE(s); // free s if it was malloced by ezxml_decode()
+ }
+ }
+
+ if (xml->txt != m)
+ {
+ ezxml_set_flag(xml, EZXML_TXTM);
+ }
+}
+
+// called when parser finds closing tag
+ezxml_t ezxml_close_tag(ezxml_root_t root, char *name, char *s)
+{
+ if (! root->cur || ! root->cur->name || strcmp(name, root->cur->name))
+ {
+ return ezxml_err(root, s, "unexpected closing tag </%s>", name);
+ }
+
+ root->cur = root->cur->parent;
+ return NULL;
+}
+
+// checks for circular entity references, returns non-zero if no circular
+// references are found, zero otherwise
+int ezxml_ent_ok(char *name, char *s, char **ent)
+{
+ int i;
+
+ for (; ; s++)
+ {
+ while (*s && *s != '&')
+ {
+ s++; // find next entity reference
+ }
+ if (! *s)
+ {
+ return 1;
+ }
+ if (! strncmp(s + 1, name, strlen(name)))
+ {
+ return 0; // circular ref.
+ }
+ for (i = 0; ent[i] && strncmp(ent[i], s + 1, strlen(ent[i])); i += 2)
+ {
+ ;
+ }
+ if (ent[i] && ! ezxml_ent_ok(name, ent[i + 1], ent))
+ {
+ return 0;
+ }
+ }
+}
+
+// called when the parser finds a processing instruction
+void ezxml_proc_inst(ezxml_root_t root, char *s, size_t len)
+{
+ int i = 0, j = 1;
+ char *target = s;
+
+ s[len] = '\0'; // null terminate instruction
+ if (*(s += strcspn(s, EZXML_WS)))
+ {
+ *s = '\0'; // null terminate target
+ s += strspn(s + 1, EZXML_WS) + 1; // skip whitespace after target
+ }
+
+ if (! strcmp(target, "xml")) // <?xml ... ?>
+ {
+ if ((s = strstr(s, "standalone")) && ! strncmp(s + strspn(s + 10,
+ EZXML_WS "='\"") + 10, "yes", 3))
+ {
+ root->standalone = 1;
+ }
+ return;
+ }
+
+ if (! root->pi[0])
+ {
+ *(root->pi = MALLOC(sizeof(char **))) = NULL; //first pi
+ }
+
+ while (root->pi[i] && strcmp(target, root->pi[i][0]))
+ {
+ i++; // find target
+ }
+ if (! root->pi[i]) // new target
+ {
+ root->pi = REALLOC(root->pi, sizeof(char **) * (i + 2));
+ root->pi[i] = MALLOC(sizeof(char *) * 3);
+ root->pi[i][0] = target;
+ root->pi[i][1] = (char *)(root->pi[i + 1] = NULL); // terminate pi list
+ root->pi[i][2] = strdup(""); // empty document position list
+ }
+
+ while (root->pi[i][j])
+ {
+ j++; // find end of instruction list for this target
+ }
+ root->pi[i] = REALLOC(root->pi[i], sizeof(char *) * (j + 3));
+ root->pi[i][j + 2] = REALLOC(root->pi[i][j + 1], j + 1);
+ strcpy(root->pi[i][j + 2] + j - 1, (root->xml.name) ? ">" : "<");
+ root->pi[i][j + 1] = NULL; // null terminate pi list for this target
+ root->pi[i][j] = s; // set instruction
+}
+
+// called when the parser finds an internal doctype subset
+short ezxml_internal_dtd(ezxml_root_t root, char *s, size_t len)
+{
+ char q, *c, *t, *n = NULL, *v, **ent, **pe;
+ int i, j;
+
+ pe = memcpy(MALLOC(sizeof(EZXML_NIL)), EZXML_NIL, sizeof(EZXML_NIL));
+
+ for (s[len] = '\0'; s; )
+ {
+ while (*s && *s != '<' && *s != '%')
+ {
+ s++; // find next declaration
+ }
+
+ if (! *s)
+ {
+ break;
+ }
+ else if (! strncmp(s, "<!ENTITY", 8)) // parse entity definitions
+ {
+ c = s += strspn(s + 8, EZXML_WS) + 8; // skip white space separator
+ n = s + strspn(s, EZXML_WS "%"); // find name
+ *(s = n + strcspn(n, EZXML_WS)) = ';'; // append ; to name
+
+ v = s + strspn(s + 1, EZXML_WS) + 1; // find value
+ if ((q = *(v++)) != '"' && q != '\'') // skip externals
+ {
+ s = strchr(s, '>');
+ continue;
+ }
+
+ for (i = 0, ent = (*c == '%') ? pe : root->ent; ent[i]; i++)
+ {
+ ;
+ }
+ ent = REALLOC(ent, (i + 3) * sizeof(char *)); // space for next ent
+ if (*c == '%')
+ {
+ pe = ent;
+ }
+ else
+ {
+ root->ent = ent;
+ }
+
+ *(++s) = '\0'; // null terminate name
+ if ((s = strchr(v, q)))
+ {
+ *(s++) = '\0'; // null terminate value
+ }
+ ent[i + 1] = ezxml_decode(v, pe, '%'); // set value
+ ent[i + 2] = NULL; // null terminate entity list
+ if (! ezxml_ent_ok(n, ent[i + 1], ent)) // circular reference
+ {
+ if (ent[i + 1] != v)
+ {
+ FREE(ent[i + 1]);
+ }
+ ezxml_err(root, v, "circular entity declaration &%s", n);
+ break;
+ }
+ else
+ {
+ ent[i] = n; // set entity name
+ }
+ }
+ else if (! strncmp(s, "<!ATTLIST", 9)) // parse default attributes
+ {
+ t = s + strspn(s + 9, EZXML_WS) + 9; // skip whitespace separator
+ if (! *t)
+ {
+ ezxml_err(root, t, "unclosed <!ATTLIST");
+ break;
+ }
+ if (*(s = t + strcspn(t, EZXML_WS ">")) == '>')
+ {
+ continue;
+ }
+ else
+ {
+ *s = '\0'; // null terminate tag name
+ }
+ for (i = 0; root->attr[i] && strcmp(n, root->attr[i][0]); i++)
+ {
+ ;
+ }
+
+ while (*(n = ++s + strspn(s, EZXML_WS)) && *n != '>')
+ {
+ if (*(s = n + strcspn(n, EZXML_WS)))
+ {
+ *s = '\0'; // attr name
+ }
+ else
+ {
+ ezxml_err(root, t, "malformed <!ATTLIST");
+ break;
+ }
+
+ s += strspn(s + 1, EZXML_WS) + 1; // find next token
+ c = (strncmp(s, "CDATA", 5)) ? "*" : " "; // is it cdata?
+ if (! strncmp(s, "NOTATION", 8))
+ {
+ s += strspn(s + 8, EZXML_WS) + 8;
+ }
+ s = (*s == '(') ? strchr(s, ')') : s + strcspn(s, EZXML_WS);
+ if (! s)
+ {
+ ezxml_err(root, t, "malformed <!ATTLIST");
+ break;
+ }
+
+ s += strspn(s, EZXML_WS ")"); // skip white space separator
+ if (! strncmp(s, "#FIXED", 6))
+ {
+ s += strspn(s + 6, EZXML_WS) + 6;
+ }
+ if (*s == '#') // no default value
+ {
+ s += strcspn(s, EZXML_WS ">") - 1;
+ if (*c == ' ')
+ {
+ continue; // cdata is default, nothing to do
+ }
+ v = NULL;
+ }
+ else if ((*s == '"' || *s == '\'') && // default value
+ (s = strchr(v = s + 1, *s)))
+ {
+ *s = '\0';
+ }
+ else
+ {
+ ezxml_err(root, t, "malformed <!ATTLIST");
+ break;
+ }
+
+ if (! root->attr[i]) // new tag name
+ {
+ root->attr = (! i) ? MALLOC(2 * sizeof(char **))
+ : REALLOC(root->attr,
+ (i + 2) * sizeof(char **));
+ root->attr[i] = MALLOC(2 * sizeof(char *));
+ root->attr[i][0] = t; // set tag name
+ root->attr[i][1] = (char *)(root->attr[i + 1] = NULL);
+ }
+
+ for (j = 1; root->attr[i][j]; j += 3)
+ {
+ ; // find end of list
+ }
+ root->attr[i] = REALLOC(root->attr[i],
+ (j + 4) * sizeof(char *));
+
+ root->attr[i][j + 3] = NULL; // null terminate list
+ root->attr[i][j + 2] = c; // is it cdata?
+ root->attr[i][j + 1] = (v) ? ezxml_decode(v, root->ent, *c)
+ : NULL;
+ root->attr[i][j] = n; // attribute name
+ }
+ }
+ else if (! strncmp(s, "<!--", 4))
+ {
+ s = strstr(s + 4, "-->"); // comments
+ }
+ else if (! strncmp(s, "<?", 2)) // processing instructions
+ {
+ if ((s = strstr(c = s + 2, "?>")))
+ {
+ ezxml_proc_inst(root, c, s++ - c);
+ }
+ }
+ else if (*s == '<')
+ {
+ s = strchr(s, '>'); // skip other declarations
+ }
+ else if (*(s++) == '%' && ! root->standalone)
+ {
+ break;
+ }
+ }
+
+ FREE(pe);
+ return ! *root->err;
+}
+
+// Converts a UTF-16 string to UTF-8. Returns a new string that must be freed
+// or NULL if no conversion was needed.
+char *ezxml_str2utf8(char **s, size_t *len)
+{
+ char *u;
+ size_t l = 0, sl, max = *len;
+ long c, d;
+ int b, be = (**s == '\xFE') ? 1 : (**s == '\xFF') ? 0 : -1;
+
+ if (be == -1)
+ {
+ return NULL; // not UTF-16
+ }
+
+ u = MALLOC(max);
+ for (sl = 2; sl < *len - 1; sl += 2)
+ {
+ c = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF) //UTF-16BE
+ : (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF); //UTF-16LE
+ if (c >= 0xD800 && c <= 0xDFFF && (sl += 2) < *len - 1) // high-half
+ {
+ d = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF)
+ : (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF);
+ c = (((c & 0x3FF) << 10) | (d & 0x3FF)) + 0x10000;
+ }
+
+ while (l + 6 > max)
+ {
+ u = REALLOC(u, max += EZXML_BUFSIZE);
+ }
+ if (c < 0x80)
+ {
+ u[l++] = (char)c; // US-ASCII subset
+ }
+ else // multi-byte UTF-8 sequence
+ {
+ for (b = 0, d = c; d; d /= 2)
+ {
+ b++; // bits in c
+ }
+ b = (b - 2) / 5; // bytes in payload
+ u[l++] = (char)(0xFF << (7 - b)) | (char)(c >> (6 * b)); // head
+ while (b)
+ {
+ u[l++] = 0x80 | ((c >> (6 * --b)) & 0x3F); // payload
+ }
+ }
+ }
+ return *s = REALLOC(u, *len = l);
+}
+
+// frees a tag attribute list
+void ezxml_free_attr(char **attr)
+{
+ int i = 0;
+ char *m;
+
+ if (! attr || attr == EZXML_NIL)
+ {
+ return; // nothing to free
+ }
+ while (attr[i])
+ {
+ i += 2; // find end of attribute list
+ }
+ m = attr[i + 1]; // list of which names and values are malloced
+ for (i = 0; m[i]; i++)
+ {
+ if (m[i] & EZXML_NAMEM)
+ {
+ FREE(attr[i * 2]);
+ }
+ if (m[i] & EZXML_TXTM)
+ {
+ FREE(attr[(i * 2) + 1]);
+ }
+ }
+ FREE(m);
+ FREE(attr);
+}
+
+// parse the given xml string and return an ezxml structure
+ezxml_t ezxml_parse_str(char *s, size_t len)
+{
+ ezxml_root_t root = (ezxml_root_t)ezxml_new(NULL);
+ char q, e, *d, **attr, **a = NULL; // initialize a to avoid compile warning
+ int l, i, j;
+
+ root->m = s;
+ if (! len)
+ {
+ return ezxml_err(root, NULL, "root tag missing");
+ }
+ root->u = ezxml_str2utf8(&s, &len); // convert utf-16 to utf-8
+ root->e = (root->s = s) + len; // record start and end of work area
+
+ e = s[len - 1]; // save end char
+ s[len - 1] = '\0'; // turn end char into null terminator
+
+ while (*s && *s != '<')
+ {
+ s++; // find first tag
+ }
+ if (! *s)
+ {
+ return ezxml_err(root, s, "root tag missing");
+ }
+
+ for (; ; )
+ {
+ attr = (char **)EZXML_NIL;
+ d = ++s;
+
+ if (isalpha(*s) || *s == '_' || *s == ':' || *s < '\0') // new tag
+ {
+ if (! root->cur)
+ {
+ return ezxml_err(root, d, "markup outside of root element");
+ }
+
+ s += strcspn(s, EZXML_WS "/>");
+ while (isspace(*s))
+ {
+ *(s++) = '\0'; // null terminate tag name
+ }
+
+ if (*s && *s != '/' && *s != '>') // find tag in default attr list
+ for (i = 0; (a = root->attr[i]) && strcmp(a[0], d); i++)
+ {
+ ;
+ }
+
+ for (l = 0; *s && *s != '/' && *s != '>'; l += 2) // new attrib
+ {
+ attr = (l) ? REALLOC(attr, (l + 4) * sizeof(char *))
+ : MALLOC(4 * sizeof(char *)); // allocate space
+ attr[l + 3] = (l) ? REALLOC(attr[l + 1], (l / 2) + 2)
+ : MALLOC(2); // mem for list of maloced vals
+ strcpy(attr[l + 3] + (l / 2), " "); // value is not malloced
+ attr[l + 2] = NULL; // null terminate list
+ attr[l + 1] = ""; // temporary attribute value
+ attr[l] = s; // set attribute name
+
+ s += strcspn(s, EZXML_WS "=/>");
+ if (*s == '=' || isspace(*s))
+ {
+ *(s++) = '\0'; // null terminate tag attribute name
+ q = *(s += strspn(s, EZXML_WS "="));
+ if (q == '"' || q == '\'') // attribute value
+ {
+ attr[l + 1] = ++s;
+ while (*s && *s != q)
+ {
+ s++;
+ }
+ if (*s)
+ {
+ *(s++) = '\0'; // null terminate attribute val
+ }
+ else
+ {
+ ezxml_free_attr(attr);
+ return ezxml_err(root, d, "missing %c", q);
+ }
+
+ for (j = 1; a && a[j] && strcmp(a[j], attr[l]); j += 3)
+ {
+ ;
+ }
+ attr[l + 1] = ezxml_decode(attr[l + 1], root->ent, (a
+ && a[j]) ? *a[j + 2] : ' ');
+ if (attr[l + 1] < d || attr[l + 1] > s)
+ {
+ attr[l + 3][l / 2] = EZXML_TXTM; // value malloced
+ }
+ }
+ }
+ while (isspace(*s))
+ {
+ s++;
+ }
+ }
+
+ if (*s == '/') // self closing tag
+ {
+ *(s++) = '\0';
+ if ((*s && *s != '>') || (! *s && e != '>'))
+ {
+ if (l)
+ {
+ ezxml_free_attr(attr);
+ }
+ return ezxml_err(root, d, "missing >");
+ }
+ ezxml_open_tag(root, d, attr);
+ ezxml_close_tag(root, d, s);
+ }
+ else if ((q = *s) == '>' || (! *s && e == '>')) // open tag
+ {
+ *s = '\0'; // temporarily null terminate tag name
+ ezxml_open_tag(root, d, attr);
+ *s = q;
+ }
+ else
+ {
+ if (l)
+ {
+ ezxml_free_attr(attr);
+ }
+ return ezxml_err(root, d, "missing >");
+ }
+ }
+ else if (*s == '/') // close tag
+ {
+ s += strcspn(d = s + 1, EZXML_WS ">") + 1;
+ if (! (q = *s) && e != '>')
+ {
+ return ezxml_err(root, d, "missing >");
+ }
+ *s = '\0'; // temporarily null terminate tag name
+ if (ezxml_close_tag(root, d, s))
+ {
+ return &root->xml;
+ }
+ if (isspace(*s = q))
+ {
+ s += strspn(s, EZXML_WS);
+ }
+ }
+ else if (! strncmp(s, "!--", 3)) // xml comment
+ {
+ if (! (s = strstr(s + 3, "--")) || (*(s += 2) != '>' && *s) ||
+ (! *s && e != '>'))
+ {
+ return ezxml_err(root, d, "unclosed <!--");
+ }
+ }
+ else if (! strncmp(s, "![CDATA[", 8)) // cdata
+ {
+ if ((s = strstr(s, "]]>")))
+ {
+ ezxml_char_content(root, d + 8, (s += 2) - d - 10, 'c');
+ }
+ else
+ {
+ return ezxml_err(root, d, "unclosed <![CDATA[");
+ }
+ }
+ else if (! strncmp(s, "!DOCTYPE", 8)) // dtd
+ {
+ for (l = 0; *s && ((! l && *s != '>') || (l && (*s != ']' ||
+ *(s + strspn(s + 1, EZXML_WS) + 1) != '>')));
+ l = (*s == '[') ? 1 : l)
+ {
+ s += strcspn(s + 1, "[]>") + 1;
+ }
+ if (! *s && e != '>')
+ {
+ return ezxml_err(root, d, "unclosed <!DOCTYPE");
+ }
+ d = (l) ? strchr(d, '[') + 1 : d;
+ if (l && ! ezxml_internal_dtd(root, d, s++ - d))
+ {
+ return &root->xml;
+ }
+ }
+ else if (*s == '?') // <?...?> processing instructions
+ {
+ do
+ {
+ s = strchr(s, '?');
+ }
+ while (s && *(++s) && *s != '>');
+ if (! s || (! *s && e != '>'))
+ {
+ return ezxml_err(root, d, "unclosed <?");
+ }
+ else
+ {
+ ezxml_proc_inst(root, d + 1, s - d - 2);
+ }
+ }
+ else
+ {
+ return ezxml_err(root, d, "unexpected <");
+ }
+
+ if (! s || ! *s)
+ {
+ break;
+ }
+ *s = '\0';
+ d = ++s;
+ if (*s && *s != '<') // tag character content
+ {
+ while (*s && *s != '<')
+ {
+ s++;
+ }
+ if (*s)
+ {
+ ezxml_char_content(root, d, s - d, '&');
+ }
+ else
+ {
+ break;
+ }
+ }
+ else if (! *s)
+ {
+ break;
+ }
+ }
+
+ if (! root->cur)
+ {
+ return &root->xml;
+ }
+ else if (! root->cur->name)
+ {
+ return ezxml_err(root, d, "root tag missing");
+ }
+ else
+ {
+ return ezxml_err(root, d, "unclosed tag <%s>", root->cur->name);
+ }
+}
+
+// Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire
+// stream into memory and then parses it. For xml files, use ezxml_parse_file()
+// or ezxml_parse_fd()
+ezxml_t ezxml_parse_fp(FILE *fp)
+{
+ ezxml_root_t root;
+ size_t l, len = 0;
+ char *s;
+
+ if (! (s = MALLOC(EZXML_BUFSIZE)))
+ {
+ return NULL;
+ }
+ do
+ {
+ len += (l = fread((s + len), 1, EZXML_BUFSIZE, fp));
+ if (l == EZXML_BUFSIZE)
+ {
+ s = REALLOC(s, len + EZXML_BUFSIZE);
+ }
+ }
+ while (s && l == EZXML_BUFSIZE);
+
+ if (! s)
+ {
+ return NULL;
+ }
+ root = (ezxml_root_t)ezxml_parse_str(s, len);
+ root->len = (size_t) - 1; // so we know to free s in ezxml_free()
+ return &root->xml;
+}
+
+// A wrapper for ezxml_parse_str() that accepts a file descriptor. First
+// attempts to mem map the file. Failing that, reads the file into memory.
+// Returns NULL on failure.
+ezxml_t ezxml_parse_fd(int fd)
+{
+ ezxml_root_t root;
+ struct stat st;
+ size_t l;
+ void *m;
+
+ if (fd < 0)
+ {
+ return NULL;
+ }
+ fstat(fd, &st);
+
+#ifndef EZXML_NOMMAP
+ l = (st.st_size + sysconf(_SC_PAGESIZE) - 1) & ~(sysconf(_SC_PAGESIZE) - 1);
+ if ((m = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0)) != MAP_FAILED)
+ {
+ madvise(m, l, MADV_SEQUENTIAL); // optimize for sequential access
+ root = (ezxml_root_t)ezxml_parse_str(m, st.st_size);
+ madvise(m, root->len = l, MADV_NORMAL); // put it back to normal
+ }
+ else // mmap failed, read file into memory
+ {
+#endif // EZXML_NOMMAP
+ l = read(fd, m = MALLOC(st.st_size), st.st_size);
+ root = (ezxml_root_t)ezxml_parse_str(m, l);
+ root->len = (size_t) - 1; // so we know to free s in ezxml_free()
+#ifndef EZXML_NOMMAP
+ }
+#endif // EZXML_NOMMAP
+
+ return &root->xml;
+}
+
+// a wrapper for ezxml_parse_fd that accepts a file name
+ezxml_t ezxml_parse_file(const char *file)
+{
+ int fd = open(file, O_RDONLY, 0);
+ ezxml_t xml = ezxml_parse_fd(fd);
+ if (fd >= 0)
+ {
+ close(fd);
+ }
+ return xml;
+}
+
+// Encodes ampersand sequences appending the results to *dst, reallocating *dst
+// if length exceeds max. a is non-zero for attribute encoding. Returns *dst
+char *ezxml_ampencode(const char *s, size_t len, char **dst, size_t *dlen,
+ size_t *max, short a)
+{
+ const char *e;
+
+ for (e = s + len; s != e; s++)
+ {
+ while (*dlen + 10 > *max)
+ {
+ *dst = REALLOC(*dst, *max += EZXML_BUFSIZE);
+ }
+
+ switch (*s)
+ {
+ case '\0':
+ return *dst;
+ case '&':
+ *dlen += sprintf(*dst + *dlen, "&amp;");
+ break;
+ case '<':
+ *dlen += sprintf(*dst + *dlen, "&lt;");
+ break;
+ case '>':
+ *dlen += sprintf(*dst + *dlen, "&gt;");
+ break;
+ case '"':
+ *dlen += sprintf(*dst + *dlen, (a) ? "&quot;" : "\"");
+ break;
+ case '\n':
+ *dlen += sprintf(*dst + *dlen, (a) ? "&#xA;" : "\n");
+ break;
+ case '\t':
+ *dlen += sprintf(*dst + *dlen, (a) ? "&#x9;" : "\t");
+ break;
+ case '\r':
+ *dlen += sprintf(*dst + *dlen, "&#xD;");
+ break;
+ default:
+ (*dst)[(*dlen)++] = *s;
+ }
+ }
+ return *dst;
+}
+
+// Recursively converts each tag to xml appending it to *s. Reallocates *s if
+// its length excedes max. start is the location of the previous tag in the
+// parent tag's character content. Returns *s.
+char *ezxml_toxml_r(ezxml_t xml, char **s, size_t *len, size_t *max,
+ size_t start, char ***attr)
+{
+ int i, j;
+ char *txt = (xml->parent) ? xml->parent->txt : "";
+ size_t off = 0;
+
+ // parent character content up to this tag
+ *s = ezxml_ampencode(txt + start, xml->off - start, s, len, max, 0);
+
+ while (*len + strlen(xml->name) + 4 > *max) // reallocate s
+ {
+ *s = REALLOC(*s, *max += EZXML_BUFSIZE);
+ }
+
+ *len += sprintf(*s + *len, "<%s", xml->name); // open tag
+ for (i = 0; xml->attr[i]; i += 2) // tag attributes
+ {
+ if (ezxml_attr(xml, xml->attr[i]) != xml->attr[i + 1])
+ {
+ continue;
+ }
+ while (*len + strlen(xml->attr[i]) + 7 > *max) // reallocate s
+ {
+ *s = REALLOC(*s, *max += EZXML_BUFSIZE);
+ }
+
+ *len += sprintf(*s + *len, " %s=\"", xml->attr[i]);
+ ezxml_ampencode(xml->attr[i + 1], (size_t)(-1), s, len, max, 1);
+ *len += sprintf(*s + *len, "\"");
+ }
+
+ for (i = 0; attr[i] && strcmp(attr[i][0], xml->name); i++)
+ {
+ ;
+ }
+ for (j = 1; attr[i] && attr[i][j]; j += 3) // default attributes
+ {
+ if (! attr[i][j + 1] || ezxml_attr(xml, attr[i][j]) != attr[i][j + 1])
+ {
+ continue; // skip duplicates and non-values
+ }
+ while (*len + strlen(attr[i][j]) + 7 > *max) // reallocate s
+ {
+ *s = REALLOC(*s, *max += EZXML_BUFSIZE);
+ }
+
+ *len += sprintf(*s + *len, " %s=\"", attr[i][j]);
+ ezxml_ampencode(attr[i][j + 1], (size_t)(-1), s, len, max, 1);
+ *len += sprintf(*s + *len, "\"");
+ }
+ *len += sprintf(*s + *len, ">");
+
+ *s = (xml->child) ? ezxml_toxml_r(xml->child, s, len, max, 0, attr) //child
+ : ezxml_ampencode(xml->txt, (size_t)(-1), s, len, max, 0); //data
+
+ while (*len + strlen(xml->name) + 4 > *max) // reallocate s
+ {
+ *s = REALLOC(*s, *max += EZXML_BUFSIZE);
+ }
+
+ *len += sprintf(*s + *len, "</%s>", xml->name); // close tag
+
+ while (txt[off] && off < xml->off)
+ {
+ off++; // make sure off is within bounds
+ }
+ return (xml->ordered) ? ezxml_toxml_r(xml->ordered, s, len, max, off, attr)
+ : ezxml_ampencode(txt + off, (size_t)(-1), s, len, max, 0);
+}
+
+// Converts an ezxml structure back to xml. Returns a string of xml data that
+// must be freed.
+char *ezxml_toxml(ezxml_t xml)
+{
+ ezxml_t p = (xml) ? xml->parent : NULL, o = (xml) ? xml->ordered : NULL;
+ ezxml_root_t root = (ezxml_root_t)xml;
+ size_t len = 0, max = EZXML_BUFSIZE;
+ char *s = strcpy(MALLOC(max), ""), *t, *n;
+ int i, j, k;
+
+ if (! xml || ! xml->name)
+ {
+ return REALLOC(s, len + 1);
+ }
+ while (root->xml.parent)
+ {
+ root = (ezxml_root_t)root->xml.parent; // root tag
+ }
+
+ for (i = 0; ! p && root->pi[i]; i++) // pre-root processing instructions
+ {
+ for (k = 2; root->pi[i][k - 1]; k++)
+ {
+ ;
+ }
+ for (j = 1; (n = root->pi[i][j]); j++)
+ {
+ if (root->pi[i][k][j - 1] == '>')
+ {
+ continue; // not pre-root
+ }
+ while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max)
+ {
+ s = REALLOC(s, max += EZXML_BUFSIZE);
+ }
+ len += sprintf(s + len, "<?%s%s%s?>\n", t, *n ? " " : "", n);
+ }
+ }
+
+ xml->parent = xml->ordered = NULL;
+ s = ezxml_toxml_r(xml, &s, &len, &max, 0, root->attr);
+ xml->parent = p;
+ xml->ordered = o;
+
+ for (i = 0; ! p && root->pi[i]; i++) // post-root processing instructions
+ {
+ for (k = 2; root->pi[i][k - 1]; k++)
+ {
+ ;
+ }
+ for (j = 1; (n = root->pi[i][j]); j++)
+ {
+ if (root->pi[i][k][j - 1] == '<')
+ {
+ continue; // not post-root
+ }
+ while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max)
+ {
+ s = REALLOC(s, max += EZXML_BUFSIZE);
+ }
+ len += sprintf(s + len, "\n<?%s%s%s?>", t, *n ? " " : "", n);
+ }
+ }
+ return REALLOC(s, len + 1);
+}
+
+// free the memory allocated for the ezxml structure
+void ezxml_free(ezxml_t xml)
+{
+ ezxml_root_t root = (ezxml_root_t)xml;
+ int i, j;
+ char **a, *s;
+
+ if (! xml)
+ {
+ return;
+ }
+ ezxml_free(xml->child);
+ ezxml_free(xml->ordered);
+
+ if (! xml->parent) // free root tag allocations
+ {
+ for (i = 10; root->ent[i]; i += 2) // 0 - 9 are default entites (<>&"')
+ if ((s = root->ent[i + 1]) < root->s || s > root->e)
+ {
+ free(s);
+ }
+ FREE(root->ent); // free list of general entities
+
+ for (i = 0; (a = root->attr[i]); i++)
+ {
+ for (j = 1; a[j++]; j += 2) // free malloced attribute values
+ if (a[j] && (a[j] < root->s || a[j] > root->e))
+ {
+ FREE(a[j]);
+ }
+ FREE(a);
+ }
+ if (root->attr[0])
+ {
+ FREE(root->attr); // free default attribute list
+ }
+
+ for (i = 0; root->pi[i]; i++)
+ {
+ for (j = 1; root->pi[i][j]; j++)
+ {
+ ;
+ }
+ FREE(root->pi[i][j + 1]);
+ FREE(root->pi[i]);
+ }
+ if (root->pi[0])
+ {
+ FREE(root->pi); // free processing instructions
+ }
+
+ if (root->len == -1)
+ {
+ FREE(root->m); // malloced xml data
+ }
+#ifndef EZXML_NOMMAP
+ else if (root->len)
+ {
+ munmap(root->m, root->len); // mem mapped xml data
+ }
+#endif // EZXML_NOMMAP
+ if (root->u)
+ {
+ FREE(root->u); // utf8 conversion
+ }
+ }
+
+ ezxml_free_attr(xml->attr); // tag attributes
+ if ((xml->flags & EZXML_TXTM))
+ {
+ FREE(xml->txt); // character content
+ }
+ if ((xml->flags & EZXML_NAMEM))
+ {
+ FREE(xml->name); // tag name
+ }
+ FREE(xml);
+}
+
+// return parser error message or empty string if none
+const char *ezxml_error(ezxml_t xml)
+{
+ while (xml && xml->parent)
+ {
+ xml = xml->parent; // find root tag
+ }
+ return (xml) ? ((ezxml_root_t)xml)->err : "";
+}
+
+// returns a new empty ezxml structure with the given root tag name
+ezxml_t ezxml_new(const char *name)
+{
+ static char *ent[] = { "lt;", "&#60;", "gt;", "&#62;", "quot;", "&#34;",
+ "apos;", "&#39;", "amp;", "&#38;", NULL
+ };
+ ezxml_root_t root = (ezxml_root_t)memset(MALLOC(sizeof(struct ezxml_root)),
+ '\0', sizeof(struct ezxml_root));
+ root->xml.name = (char *)name;
+ root->cur = &root->xml;
+ strcpy(root->err, root->xml.txt = "");
+ root->ent = memcpy(MALLOC(sizeof(ent)), ent, sizeof(ent));
+ root->attr = root->pi = (char ***)(root->xml.attr = EZXML_NIL);
+ return &root->xml;
+}
+
+// inserts an existing tag into an ezxml structure
+ezxml_t ezxml_insert(ezxml_t xml, ezxml_t dest, size_t off)
+{
+ ezxml_t cur, prev, head;
+
+ xml->next = xml->sibling = xml->ordered = NULL;
+ xml->off = off;
+ xml->parent = dest;
+
+ if ((head = dest->child)) // already have sub tags
+ {
+ if (head->off <= off) // not first subtag
+ {
+ for (cur = head; cur->ordered && cur->ordered->off <= off;
+ cur = cur->ordered)
+ {
+ ;
+ }
+ xml->ordered = cur->ordered;
+ cur->ordered = xml;
+ }
+ else // first subtag
+ {
+ xml->ordered = head;
+ dest->child = xml;
+ }
+
+ for (cur = head, prev = NULL; cur && strcmp(cur->name, xml->name);
+ prev = cur, cur = cur->sibling)
+ {
+ ; // find tag type
+ }
+ if (cur && cur->off <= off) // not first of type
+ {
+ while (cur->next && cur->next->off <= off)
+ {
+ cur = cur->next;
+ }
+ xml->next = cur->next;
+ cur->next = xml;
+ }
+ else // first tag of this type
+ {
+ if (prev && cur)
+ {
+ prev->sibling = cur->sibling; // remove old first
+ }
+ xml->next = cur; // old first tag is now next
+ for (cur = head, prev = NULL; cur && cur->off <= off;
+ prev = cur, cur = cur->sibling)
+ {
+ ; // new sibling insert point
+ }
+ xml->sibling = cur;
+ if (prev)
+ {
+ prev->sibling = xml;
+ }
+ }
+ }
+ else
+ {
+ dest->child = xml; // only sub tag
+ }
+
+ return xml;
+}
+
+// Adds a child tag. off is the offset of the child tag relative to the start
+// of the parent tag's character content. Returns the child tag.
+ezxml_t ezxml_add_child(ezxml_t xml, const char *name, size_t off)
+{
+ ezxml_t child;
+
+ if (! xml)
+ {
+ return NULL;
+ }
+ child = (ezxml_t)memset(MALLOC(sizeof(struct ezxml)), '\0',
+ sizeof(struct ezxml));
+ child->name = (char *)name;
+ child->attr = EZXML_NIL;
+ child->txt = "";
+
+ return ezxml_insert(child, xml, off);
+}
+
+// sets the character content for the given tag and returns the tag
+ezxml_t ezxml_set_txt(ezxml_t xml, const char *txt)
+{
+ if (! xml)
+ {
+ return NULL;
+ }
+ if (xml->flags & EZXML_TXTM)
+ {
+ FREE(xml->txt); // existing txt was malloced
+ }
+ xml->flags &= ~EZXML_TXTM;
+ xml->txt = (char *)txt;
+ return xml;
+}
+
+// Sets the given tag attribute or adds a new attribute if not found. A value
+// of NULL will remove the specified attribute. Returns the tag given.
+ezxml_t ezxml_set_attr(ezxml_t xml, const char *name, char *value)
+{
+ int l = 0, c;
+ if (! xml)
+ {
+ return NULL;
+ }
+ while (xml->attr[l] && strcmp(xml->attr[l], name))
+ {
+ l += 2;
+ }
+
+ if (! xml->attr[l]) // not found, add as new attribute
+ {
+ if (! value)
+ {
+ return xml; // nothing to do
+ }
+ if (xml->attr == EZXML_NIL) // first attribute
+ {
+ xml->attr = MALLOC(4 * sizeof(char *));
+ xml->attr[1] = strdup(""); // empty list of malloced names/vals
+ }
+ else
+ {
+ xml->attr = REALLOC(xml->attr, (l + 4) * sizeof(char *));
+ }
+
+ xml->attr[l] = (char *)name; // set attribute name
+ xml->attr[l + 2] = NULL; // null terminate attribute list
+ xml->attr[l + 3] = REALLOC(xml->attr[l + 1], (c = (int)strlen(xml->attr[l + 1])) + 2);
+ strcpy(xml->attr[l + 3] + c, " "); // set name/value as not malloced
+ if (xml->flags & EZXML_DUP)
+ {
+ xml->attr[l + 3][c] = EZXML_NAMEM;
+ }
+ }
+ else if (xml->flags & EZXML_DUP)
+ {
+ FREE((char *)name); // name was strduped
+ }
+
+ for (c = l; xml->attr[c]; c += 2)
+ {
+ ; // find end of attribute list
+ }
+ if (xml->attr[c + 1][l / 2] & EZXML_TXTM)
+ {
+ FREE(xml->attr[l + 1]); //old val
+ }
+ if (xml->flags & EZXML_DUP)
+ {
+ xml->attr[c + 1][l / 2] |= EZXML_TXTM;
+ }
+ else
+ {
+ xml->attr[c + 1][l / 2] &= ~EZXML_TXTM;
+ }
+
+ if (value)
+ {
+ xml->attr[l + 1] = (char *)value; // set attribute value
+ }
+ else // remove attribute
+ {
+ if (xml->attr[c + 1][l / 2] & EZXML_NAMEM)
+ {
+ FREE(xml->attr[l]);
+ }
+ memmove(xml->attr + l, xml->attr + l + 2, (c - l + 2) * sizeof(char*));
+ xml->attr = REALLOC(xml->attr, (c + 2) * sizeof(char *));
+ memmove(xml->attr[c + 1] + (l / 2), xml->attr[c + 1] + (l / 2) + 1,
+ (c / 2) - (l / 2)); // fix list of which name/vals are malloced
+ }
+ xml->flags &= ~EZXML_DUP; // clear strdup() flag
+ return xml;
+}
+
+// sets a flag for the given tag and returns the tag
+ezxml_t ezxml_set_flag(ezxml_t xml, short flag)
+{
+ if (xml)
+ {
+ xml->flags |= flag;
+ }
+ return xml;
+}
+
+// removes a tag along with its subtags without freeing its memory
+ezxml_t ezxml_cut(ezxml_t xml)
+{
+ ezxml_t cur;
+
+ if (! xml)
+ {
+ return NULL; // nothing to do
+ }
+ if (xml->next)
+ {
+ xml->next->sibling = xml->sibling; // patch sibling list
+ }
+
+ if (xml->parent) // not root tag
+ {
+ cur = xml->parent->child; // find head of subtag list
+ if (cur == xml)
+ {
+ xml->parent->child = xml->ordered; // first subtag
+ }
+ else // not first subtag
+ {
+ while (cur->ordered != xml)
+ {
+ cur = cur->ordered;
+ }
+ cur->ordered = cur->ordered->ordered; // patch ordered list
+
+ cur = xml->parent->child; // go back to head of subtag list
+ if (strcmp(cur->name, xml->name)) // not in first sibling list
+ {
+ while (strcmp(cur->sibling->name, xml->name))
+ {
+ cur = cur->sibling;
+ }
+ if (cur->sibling == xml) // first of a sibling list
+ {
+ cur->sibling = (xml->next) ? xml->next
+ : cur->sibling->sibling;
+ }
+ else
+ {
+ cur = cur->sibling; // not first of a sibling list
+ }
+ }
+
+ while (cur->next && cur->next != xml)
+ {
+ cur = cur->next;
+ }
+ if (cur->next)
+ {
+ cur->next = cur->next->next; // patch next list
+ }
+ }
+ }
+ xml->ordered = xml->sibling = xml->next = NULL;
+ return xml;
+}
+/*----------------------------------------------------------*/
+int write_in_child(ezxml_t *parent, char *idx, char *w)
+{
+ ezxml_t terminal, structx, subnode, i_value;
+
+ int result;
+
+
+ for (terminal = ezxml_child(*parent, "terminal"); terminal; terminal = terminal->next)
+ {
+ if (strcmp(ezxml_child(terminal, "id")->txt, idx) == 0)
+ {
+ i_value = ezxml_child(terminal, "initial_value");
+ ezxml_set_attr(i_value, "value", w);
+ return 1; /* found */
+ }
+ }
+
+ for (structx = ezxml_child(*parent, "struct"); structx; structx = structx->next)
+ {
+ for (subnode = ezxml_child(structx, "subnodes"); subnode; subnode = subnode->next)
+ {
+ result = write_in_child(&subnode, idx, w);
+ if (result == 1 )
+ {
+ return result;
+ }
+ }
+ }
+
+ return 0; /* not found*/
+}
+/*----------------------------------------------------------*/
+int search_in_child(ezxml_t *parent, char *idx, char *value)
+{
+ ezxml_t terminal, structx, subnode, i_value;
+ const char *teamname;
+ int result;
+
+ for (terminal = ezxml_child(*parent, "terminal"); terminal; terminal = terminal->next)
+ {
+ if (strcmp(ezxml_child(terminal, "id")->txt, idx) == 0)
+ {
+ i_value = ezxml_child(terminal, "initial_value");
+ teamname = ezxml_attr(i_value, "value");
+ strcpy (value, teamname);
+ return 1; /* found */
+ }
+ }
+
+ for (structx = ezxml_child(*parent, "struct"); structx; structx = structx->next)
+ {
+ for (subnode = ezxml_child(structx, "subnodes"); subnode; subnode = subnode->next)
+ {
+ result = search_in_child(&subnode, idx, value);
+ if (result == 1 )
+ {
+ return result;
+ }
+ }
+ }
+
+ return 0; /* not found*/
+}
+
+/*----------------------------------------------------------*/
diff --git a/modules/scicos/src/c/ezxml.h b/modules/scicos/src/c/ezxml.h
new file mode 100755
index 000000000..0dff76af2
--- /dev/null
+++ b/modules/scicos/src/c/ezxml.h
@@ -0,0 +1,172 @@
+/* ezxml.h
+ *
+ * Copyright 2004-2006 Aaron Voisine <aaron@voisine.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _EZXML_H
+#define _EZXML_H
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <fcntl.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define EZXML_BUFSIZE 1024 // size of internal memory buffers
+#define EZXML_NAMEM 0x80 // name is malloced
+#define EZXML_TXTM 0x40 // txt is malloced
+#define EZXML_DUP 0x20 // attribute name and value are strduped
+
+typedef struct ezxml *ezxml_t;
+struct ezxml {
+ char *name; // tag name
+ char **attr; // tag attributes { name, value, name, value, ... NULL }
+ char *txt; // tag character content, empty string if none
+ size_t off; // tag offset from start of parent tag character content
+ ezxml_t next; // next tag with same name in this section at this depth
+ ezxml_t sibling; // next tag with different name in same section and depth
+ ezxml_t ordered; // next tag, same section and depth, in original order
+ ezxml_t child; // head of sub tag list, NULL if none
+ ezxml_t parent; // parent tag, NULL if current tag is root tag
+ short flags; // additional information
+};
+
+// Given a string of xml data and its length, parses it and creates an ezxml
+// structure. For efficiency, modifies the data by adding null terminators
+// and decoding ampersand sequences. If you don't want this, copy the data and
+// pass in the copy. Returns NULL on failure.
+ezxml_t ezxml_parse_str(char *s, size_t len);
+
+// A wrapper for ezxml_parse_str() that accepts a file descriptor. First
+// attempts to mem map the file. Failing that, reads the file into memory.
+// Returns NULL on failure.
+ezxml_t ezxml_parse_fd(int fd);
+
+// a wrapper for ezxml_parse_fd() that accepts a file name
+ezxml_t ezxml_parse_file(const char *file);
+
+// Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire
+// stream into memory and then parses it. For xml files, use ezxml_parse_file()
+// or ezxml_parse_fd()
+ezxml_t ezxml_parse_fp(FILE *fp);
+
+// returns the first child tag (one level deeper) with the given name or NULL
+// if not found
+ezxml_t ezxml_child(ezxml_t xml, const char *name);
+
+// returns the next tag of the same name in the same section and depth or NULL
+// if not found
+#define ezxml_next(xml) ((xml) ? xml->next : NULL)
+
+// Returns the Nth tag with the same name in the same section at the same depth
+// or NULL if not found. An index of 0 returns the tag given.
+ezxml_t ezxml_idx(ezxml_t xml, int idx);
+
+// returns the name of the given tag
+#define ezxml_name(xml) ((xml) ? xml->name : NULL)
+
+// returns the given tag's character content or empty string if none
+#define ezxml_txt(xml) ((xml) ? xml->txt : "")
+
+// returns the value of the requested tag attribute, or NULL if not found
+const char *ezxml_attr(ezxml_t xml, const char *attr);
+
+// Traverses the ezxml sturcture to retrieve a specific subtag. Takes a
+// variable length list of tag names and indexes. The argument list must be
+// terminated by either an index of -1 or an empty string tag name. Example:
+// title = ezxml_get(library, "shelf", 0, "book", 2, "title", -1);
+// This retrieves the title of the 3rd book on the 1st shelf of library.
+// Returns NULL if not found.
+ezxml_t ezxml_get(ezxml_t xml, ...);
+
+// Converts an ezxml structure back to xml. Returns a string of xml data that
+// must be freed.
+char *ezxml_toxml(ezxml_t xml);
+
+// returns a NULL terminated array of processing instructions for the given
+// target
+const char **ezxml_pi(ezxml_t xml, const char *target);
+
+// frees the memory allocated for an ezxml structure
+void ezxml_free(ezxml_t xml);
+
+// returns parser error message or empty string if none
+const char *ezxml_error(ezxml_t xml);
+
+// returns a new empty ezxml structure with the given root tag name
+ezxml_t ezxml_new(const char *name);
+
+// wrapper for ezxml_new() that strdup()s name
+#define ezxml_new_d(name) ezxml_set_flag(ezxml_new(strdup(name)), EZXML_NAMEM)
+
+// Adds a child tag. off is the offset of the child tag relative to the start
+// of the parent tag's character content. Returns the child tag.
+ezxml_t ezxml_add_child(ezxml_t xml, const char *name, size_t off);
+
+// wrapper for ezxml_add_child() that strdup()s name
+#define ezxml_add_child_d(xml, name, off) \
+ ezxml_set_flag(ezxml_add_child(xml, strdup(name), off), EZXML_NAMEM)
+
+// sets the character content for the given tag and returns the tag
+ezxml_t ezxml_set_txt(ezxml_t xml, const char *txt);
+
+// wrapper for ezxml_set_txt() that strdup()s txt
+#define ezxml_set_txt_d(xml, txt) \
+ ezxml_set_flag(ezxml_set_txt(xml, strdup(txt)), EZXML_TXTM)
+
+// Sets the given tag attribute or adds a new attribute if not found. A value
+// of NULL will remove the specified attribute. Returns the tag given.
+ezxml_t ezxml_set_attr(ezxml_t xml, const char *name, char *);
+
+// Wrapper for ezxml_set_attr() that strdup()s name/value. Value cannot be NULL
+#define ezxml_set_attr_d(xml, name, value) \
+ ezxml_set_attr(ezxml_set_flag(xml, EZXML_DUP), strdup(name), strdup(value))
+
+// sets a flag for the given tag and returns the tag
+ezxml_t ezxml_set_flag(ezxml_t xml, short flag);
+
+// removes a tag along with its subtags without freeing its memory
+ezxml_t ezxml_cut(ezxml_t xml);
+
+// inserts an existing tag into an ezxml structure
+ezxml_t ezxml_insert(ezxml_t xml, ezxml_t dest, size_t off);
+
+int search_in_child(ezxml_t *, char *, char *);
+
+int write_in_child(ezxml_t *, char *, char *);
+
+
+// Moves an existing tag to become a subtag of dest at the given offset from
+// the start of dest's character content. Returns the moved tag.
+#define ezxml_move(xml, dest, off) ezxml_insert(ezxml_cut(xml), dest, off)
+
+// removes a tag along with all its subtags
+#define ezxml_remove(xml) ezxml_free(ezxml_cut(xml))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _EZXML_H
diff --git a/modules/scicos/src/c/il_sim.c b/modules/scicos/src/c/il_sim.c
new file mode 100755
index 000000000..89ce2e4a1
--- /dev/null
+++ b/modules/scicos/src/c/il_sim.c
@@ -0,0 +1,37 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* 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 "il_sim.h"
+#include "MALLOC.h"
+/*--------------------------------------------------------------------------*/
+static int *il_sim_save = NULL;
+/*--------------------------------------------------------------------------*/
+int *get_il_sim(void)
+{
+ return il_sim_save;
+}
+/*--------------------------------------------------------------------------*/
+int *set_il_sim(int *_sim)
+{
+ il_sim_save = _sim;
+ return il_sim_save;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/il_sim.h b/modules/scicos/src/c/il_sim.h
new file mode 100755
index 000000000..5dda326cf
--- /dev/null
+++ b/modules/scicos/src/c/il_sim.h
@@ -0,0 +1,36 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* 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
+*/
+/*--------------------------------------------------------------------------*/
+#ifndef __IL_SIM_H__
+#define __IL_SIM_H__
+
+/**
+* get il_sim saved
+*/
+int *get_il_sim(void);
+
+/**
+* set il_sim
+*/
+int *set_il_sim(int *_state);
+
+#endif /* __IL_SIM_H__ */
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/il_state.c b/modules/scicos/src/c/il_state.c
new file mode 100755
index 000000000..57c0d8ae1
--- /dev/null
+++ b/modules/scicos/src/c/il_state.c
@@ -0,0 +1,37 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* 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 "il_state.h"
+#include "MALLOC.h"
+/*--------------------------------------------------------------------------*/
+static int *il_state_save = NULL;
+/*--------------------------------------------------------------------------*/
+int *get_il_state(void)
+{
+ return il_state_save;
+}
+/*--------------------------------------------------------------------------*/
+int *set_il_state(int *_state)
+{
+ il_state_save = _state;
+ return il_state_save;
+}
+/*--------------------------------------------------------------------------*/ \ No newline at end of file
diff --git a/modules/scicos/src/c/il_state.h b/modules/scicos/src/c/il_state.h
new file mode 100755
index 000000000..c38d4e907
--- /dev/null
+++ b/modules/scicos/src/c/il_state.h
@@ -0,0 +1,36 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* 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
+*/
+/*--------------------------------------------------------------------------*/
+#ifndef __IL_STATE_H__
+#define __IL_STATE_H__
+
+/**
+* get il_state
+*/
+int *get_il_state(void);
+
+/**
+* set il_state
+*/
+int *set_il_state(int *_state);
+
+#endif /* __IL_STATE_H__ */
+/*--------------------------------------------------------------------------*/ \ No newline at end of file
diff --git a/modules/scicos/src/c/import.c b/modules/scicos/src/c/import.c
new file mode 100755
index 000000000..6d05167b0
--- /dev/null
+++ b/modules/scicos/src/c/import.c
@@ -0,0 +1,1103 @@
+/* Scicos
+*
+* Copyright (C) INRIA -
+*
+* 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 <string.h>
+#include <stdio.h>
+#include "machine.h"
+#include "import.h"
+#include "scicos.h"
+#include "scicos_internal.h"
+#include "cvstr.h"
+/*--------------------------------------------------------------------------*/
+ScicosImport scicos_imp =
+{
+ (double *) NULL, /* x ** */
+ (int *) NULL, /* nx */
+ (int *) NULL, /* xptr ** */
+ (int *) NULL, /* zcptr ** */
+ (double *) NULL, /* z ** */
+ (int *) NULL, /* nz */
+ (int *) NULL, /* zptr ** */
+ (int *) NULL, /* noz */
+ (void **) NULL, /* oz */
+ (int *) NULL, /* ozsz */
+ (int *) NULL, /* oztyp */
+ (int *) NULL, /* ozptr */
+ (double *) NULL, /* g */
+ (int *) NULL, /* ng */
+ (int *) NULL, /* mod */
+ (int *) NULL, /* nmod */
+ (int *) NULL, /* modptr ** */
+ (int *) NULL, /* iz */
+ (int *) NULL, /* izptr */
+ (int *) NULL, /* uid */
+ (int *) NULL, /* uidptr */
+ (int *) NULL, /* inpptr ** */
+ (int *) NULL, /* inplnk ** */
+ (int *) NULL, /* outptr ** */
+ (int *) NULL, /* outlnk ** */
+ (double *) NULL, /* rpar ** */
+ (int *) NULL, /* rpptr ** */
+ (int *) NULL, /* ipar ** */
+ (int *) NULL, /* ipptr ** */
+ (void **) NULL, /* opar */
+ (int *) NULL, /* oparsz */
+ (int *) NULL, /* opartyp */
+ (int *) NULL, /* opptr */
+ (int *) NULL, /* nblk */
+ (void **) NULL, /* outtbptr */
+ (int *) NULL, /* outtbsz */
+ (int *) NULL, /* outtbtyp */
+ (int *) NULL, /* nlnk */
+ (int *) NULL, /* subs ** */
+ (int *) NULL, /* nsubs */
+ (double *) NULL, /* tevts ** */
+ (int *) NULL, /* evtspt ** */
+ (int *) NULL, /* nevts */
+ (int *) NULL, /* pointi ** */
+ (int *) NULL, /* iord ** */
+ (int *) NULL, /* niord */
+ (int *) NULL, /* oord ** */
+ (int *) NULL, /* noord */
+ (int *) NULL, /* zord ** */
+ (int *) NULL, /* nzord */
+ (int *) NULL, /* funptr */
+ (int *) NULL, /* funtyp ** */
+ (int *) NULL, /* ztyp ** */
+ (int *) NULL, /* cord ** */
+ (int *) NULL, /* ncord */
+ (int *) NULL, /* ordclk ** */
+ (int *) NULL, /* nordclk ** */
+ (int *) NULL, /* clkptr ** */
+ (int *) NULL, /* ordptr ** */
+ (int *) NULL, /* nordptr */
+ (int *) NULL, /* critev ** */
+ (int *) NULL, /* iwa */
+ (int *) NULL, /* mask */
+ (scicos_block *) NULL, /* blocks */
+ (double *) NULL, /* t0 */
+ (double *) NULL, /* tf */
+ (double *) NULL, /* Atol */
+ (double *) NULL, /* rtol */
+ (double *) NULL, /* ttol */
+ (double *) NULL, /* deltat */
+ (double *) NULL, /* hmax */
+ (outtb_el *) NULL, /* outtb_elem */
+ (int *) NULL, /* nelem */
+ (int *) NULL, /* xprop */
+ (double *) NULL, /* xd */
+};
+
+/*--------------------------------------------------------------------------*/
+/* getscicosimportptr returns a pointer
+ * to the imported structure
+ */
+ScicosImport* getscicosimportptr(void)
+{
+ return &scicos_imp;
+}
+/*--------------------------------------------------------------------------*/
+void makescicosimport(double *x, int *nx,
+ int *xptr, int *zcptr,
+ double *z, int *nz, int *zptr,
+ int *noz, void **oz, int *ozsz, int *oztyp, int *ozptr,
+ double *g, int *ng,
+ int *mod, int *nmod, int *modptr,
+ int *iz, int *izptr, int *uid, int *uidptr, int *inpptr, int *inplnk,
+ int *outptr, int *outlnk, void **outtbptr, int *outtbsz, int *outtbtyp,
+ outtb_el *outtb_elem, int *nelem,
+ int *nlnk, double *rpar, int *rpptr, int *ipar, int *ipptr,
+ void **opar, int *oparsz, int *opartyp, int *opptr,
+ int *nblk, int *subs, int *nsubs,
+ double *tevts, int *evtspt, int *nevts, int *pointi,
+ int *iord, int *niord, int *oord, int *noord, int *zord, int *nzord,
+ int *funptr, int *funtyp, int *ztyp,
+ int *cord, int *ncord, int *ordclk, int *nordclk, int *clkptr,
+ int *ordptr, int *nordptr, int *critev, int *iwa, scicos_block *blocks,
+ double *t0, double *tf, double *Atol, double *rtol, double *ttol, double *deltat, double *hmax,
+ int *xprop, double *xd)
+{
+ scicos_imp.x = x;
+ scicos_imp.nx = nx;
+ scicos_imp.xptr = xptr;
+ scicos_imp.zcptr = zcptr;
+ scicos_imp.z = z;
+ scicos_imp.nz = nz;
+ scicos_imp.zptr = zptr;
+
+ scicos_imp.noz = noz;
+ scicos_imp.oz = oz;
+ scicos_imp.ozsz = ozsz;
+ scicos_imp.oztyp = oztyp;
+ scicos_imp.ozptr = ozptr;
+
+ scicos_imp.g = g;
+ scicos_imp.ng = ng;
+ scicos_imp.mod = mod;
+ scicos_imp.nmod = nmod;
+ scicos_imp.modptr = modptr;
+ scicos_imp.iz = iz;
+ scicos_imp.izptr = izptr;
+ scicos_imp.uid = uid;
+ scicos_imp.uidptr = uidptr;
+
+ scicos_imp.inpptr = inpptr;
+ scicos_imp.inplnk = inplnk;
+ scicos_imp.outptr = outptr;
+ scicos_imp.outlnk = outlnk;
+
+ scicos_imp.rpar = rpar;
+ scicos_imp.rpptr = rpptr;
+ scicos_imp.ipar = ipar;
+ scicos_imp.ipptr = ipptr;
+
+ scicos_imp.opar = opar;
+ scicos_imp.oparsz = oparsz;
+ scicos_imp.opartyp = opartyp;
+ scicos_imp.opptr = opptr;
+
+ scicos_imp.nblk = nblk;
+ scicos_imp.outtbptr = outtbptr;
+ scicos_imp.outtbsz = outtbsz;
+ scicos_imp.outtbtyp = outtbtyp;
+ scicos_imp.outtb_elem = outtb_elem;
+ scicos_imp.nelem = nelem;
+ scicos_imp.nlnk = nlnk;
+
+ scicos_imp.subs = subs;
+ scicos_imp.nsubs = nsubs;
+
+ scicos_imp.tevts = tevts;
+ scicos_imp.evtspt = evtspt;
+ scicos_imp.nevts = nevts;
+ scicos_imp.pointi = pointi;
+
+ scicos_imp.iord = iord;
+ scicos_imp.niord = niord;
+ scicos_imp.oord = oord;
+ scicos_imp.noord = noord;
+ scicos_imp.zord = zord;
+ scicos_imp.nzord = nzord;
+
+ scicos_imp.funptr = funptr;
+ scicos_imp.funtyp = funtyp;
+
+ scicos_imp.ztyp = ztyp;
+ scicos_imp.cord = cord;
+ scicos_imp.ncord = ncord;
+ scicos_imp.ordclk = ordclk;
+ scicos_imp.nordclk = nordclk;
+ scicos_imp.clkptr = clkptr;
+ scicos_imp.ordptr = ordptr;
+ scicos_imp.nordptr = nordptr;
+ scicos_imp.critev = critev;
+ scicos_imp.iwa = iwa;
+ scicos_imp.blocks = blocks;
+
+ scicos_imp.t0 = t0;
+ scicos_imp.tf = tf;
+ scicos_imp.Atol = Atol;
+ scicos_imp.ttol = ttol;
+ scicos_imp.rtol = rtol;
+ scicos_imp.deltat = deltat;
+ scicos_imp.hmax = hmax;
+
+ scicos_imp.xprop = xprop;
+ scicos_imp.xd = xd;
+}
+/*--------------------------------------------------------------------------*/
+void C2F(clearscicosimport)()
+{
+ scicos_imp.x = (double *) NULL;
+ scicos_imp.nx = (int *) NULL;
+ scicos_imp.xptr = (int *) NULL;
+ scicos_imp.zcptr = (int *) NULL;
+ scicos_imp.z = (double *) NULL;
+ scicos_imp.nz = (int *) NULL;
+ scicos_imp.zptr = (int *) NULL;
+
+ scicos_imp.noz = (int *) NULL;
+ scicos_imp.oz = (void **) NULL;
+ scicos_imp.ozsz = (int *) NULL;
+ scicos_imp.oztyp = (int *) NULL;
+ scicos_imp.ozptr = (int *) NULL;
+
+ scicos_imp.g = (double *) NULL;
+ scicos_imp.ng = (int *) NULL;
+ scicos_imp.mod = (int *) NULL;
+ scicos_imp.nmod = (int *) NULL;
+ scicos_imp.modptr = (int *) NULL;
+ scicos_imp.iz = (int *) NULL;
+ scicos_imp.izptr = (int *) NULL;
+ scicos_imp.uid = (int *) NULL;
+ scicos_imp.uidptr = (int *) NULL;
+
+ scicos_imp.inpptr = (int *) NULL;
+ scicos_imp.inplnk = (int *) NULL;
+ scicos_imp.outptr = (int *) NULL;
+ scicos_imp.outlnk = (int *) NULL;
+
+ scicos_imp.rpar = (double *) NULL;
+ scicos_imp.rpptr = (int *) NULL;
+ scicos_imp.ipar = (int *) NULL;
+ scicos_imp.ipptr = (int *) NULL;
+
+ scicos_imp.opar = (void **) NULL;
+ scicos_imp.oparsz = (int *) NULL;
+ scicos_imp.opartyp = (int *) NULL;
+ scicos_imp.opptr = (int *) NULL;
+
+ scicos_imp.nblk = (int *) NULL;
+ scicos_imp.outtbptr = (void **) NULL;
+ scicos_imp.outtbsz = (int *) NULL;
+ scicos_imp.outtbtyp = (int *) NULL;
+ scicos_imp.outtb_elem = (outtb_el *) NULL;
+ scicos_imp.nelem = (int *) NULL;
+ scicos_imp.nlnk = (int *) NULL;
+
+ scicos_imp.subs = (int *) NULL;
+ scicos_imp.nsubs = (int *) NULL;
+ scicos_imp.tevts = (double *) NULL;
+ scicos_imp.evtspt = (int *) NULL;
+ scicos_imp.nevts = (int *) NULL;
+ scicos_imp.pointi = (int *) NULL;
+
+ scicos_imp.iord = (int *) NULL;
+ scicos_imp.niord = (int *) NULL;
+ scicos_imp.oord = (int *) NULL;
+ scicos_imp.noord = (int *) NULL;
+ scicos_imp.zord = (int *) NULL;
+ scicos_imp.nzord = (int *) NULL;
+
+ scicos_imp.funptr = (int *) NULL;
+ scicos_imp.funtyp = (int *) NULL;
+
+ scicos_imp.ztyp = (int *) NULL;
+ scicos_imp.cord = (int *) NULL;
+ scicos_imp.ncord = (int *) NULL;
+ scicos_imp.ordclk = (int *) NULL;
+ scicos_imp.nordclk = (int *) NULL;
+ scicos_imp.clkptr = (int *) NULL;
+ scicos_imp.ordptr = (int *) NULL;
+ scicos_imp.nordptr = (int *) NULL;
+ scicos_imp.critev = (int *) NULL;
+
+ scicos_imp.iwa = (int *) NULL;
+ scicos_imp.mask = (int *) NULL;
+ scicos_imp.blocks = (scicos_block *) NULL;
+
+ scicos_imp.t0 = (double *) NULL;
+ scicos_imp.tf = (double *) NULL;
+ scicos_imp.Atol = (double *) NULL;
+ scicos_imp.ttol = (double *) NULL;
+ scicos_imp.rtol = (double *) NULL;
+ scicos_imp.deltat = (double *) NULL;
+ scicos_imp.hmax = (double *) NULL;
+
+ scicos_imp.xprop = (int *) NULL;
+ scicos_imp.xd = (double *) NULL;
+}
+/*--------------------------------------------------------------------------*/
+/* 20/06/06, Alan : review
+ * 08/02/07, Alan : update
+ */
+
+int getscicosvarsfromimport(char *what, void **v, int *nv, int *mv)
+/*char *what; data structure selection -see import.h for definition-*/
+/*void **v; Pointer to the beginning of the imported data */
+/*int *nv; size 1 of the imported data */
+/*int *mv; size 1 of the imported data */
+{
+ /*variable declaration*/
+ int nx, nz, noz, nmod, nblk, nlnk, nsubs, nevts, ng;
+ int niord, noord, ncord, nordptr, nzord, nelem;
+
+ /*test if scicosim is running*/
+ if (scicos_imp.x == (double *)NULL)
+ {
+ v = (void *) NULL;
+ return 0; /* undefined import table scicos is not running */
+ }
+
+ /* retrieve length of x register */
+ nx = (int) scicos_imp.nx[0];
+ /* retrieve length of z register */
+ nz = (int) scicos_imp.nz[0];
+ /* retrieve length of oz register */
+ noz = (int) scicos_imp.noz[0];
+ /* retrieve number of block */
+ nmod = (int) scicos_imp.nmod[0];
+ /* retrieve number of block */
+ nblk = (int) scicos_imp.nblk[0];
+ /* retrieve number of link */
+ nlnk = (int) scicos_imp.nlnk[0];
+ /* retrieve number nsubs */
+ nsubs = (int) scicos_imp.nsubs[0];
+ /* retrieve number nevts */
+ nevts = (int) scicos_imp.nevts[0];
+ /* retrieve number niord */
+ niord = (int) scicos_imp.niord[0];
+ /* retrieve number noord */
+ noord = (int) scicos_imp.noord[0];
+ /* retrieve number ncord */
+ ncord = (int) scicos_imp.ncord[0];
+ /* retrieve number nordptr */
+ nordptr = (int) scicos_imp.nordptr[0];
+ /* retrieve number nzord */
+ nzord = (int) scicos_imp.nzord[0];
+ /* retrieve number ng */
+ ng = (int) scicos_imp.ng[0];
+ /* retrieve number nelem */
+ nelem = (int) scicos_imp.nelem[0];
+
+ /* imported from */
+ if (strcmp(what, "x") == 0)
+ {
+ /* x - continuous state */
+ *nv = (int) (scicos_imp.xptr[nblk] - scicos_imp.xptr[0]);
+ *mv = 1;
+ *v = (double *)(scicos_imp.x);
+ }
+ else if (strcmp(what, "nx") == 0)
+ {
+ /* length of x register */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.nx);
+ }
+ else if (strcmp(what, "xptr") == 0)
+ {
+ /* xptr - continuous state splitting array */
+ *nv = nblk + 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.xptr);
+ }
+ else if (strcmp(what, "zcptr") == 0)
+ {
+ /* zcptr - zero crossing splitting array */
+ *nv = nblk + 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.zcptr);
+ }
+ else if (strcmp(what, "z") == 0)
+ {
+ /* z - discrete state */
+ *nv = (int)(scicos_imp.zptr[nblk] - scicos_imp.zptr[0]);
+ *mv = 1;
+ *v = (double *) (scicos_imp.z);
+ }
+ else if (strcmp(what, "nz") == 0)
+ {
+ /* length of z register */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.nz);
+ }
+ else if (strcmp(what, "noz") == 0)
+ {
+ /* length of oz register */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.noz);
+ }
+ else if (strcmp(what, "oz") == 0)
+ {
+ /* oz - vector of ptr of object discrete states */
+ *nv = (int)(scicos_imp.ozptr[nblk] - scicos_imp.ozptr[0]);
+ *mv = 1;
+ *v = (int *) (scicos_imp.oz);
+ }
+ else if (strcmp(what, "ozptr") == 0)
+ {
+ /* ozptr - object discrete states splitting array */
+ *nv = nblk + 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.ozptr);
+ }
+ else if (strcmp(what, "ozsz") == 0)
+ {
+ /* oparsz - object discrete states size array */
+ *nv = (int)(scicos_imp.ozptr[nblk] - scicos_imp.ozptr[0]);
+ *mv = 2;
+ *v = (int *) (scicos_imp.ozsz);
+ }
+ else if (strcmp(what, "oztyp") == 0)
+ {
+ /* opartyp - object discrete states type array */
+ *nv = (int)(scicos_imp.ozptr[nblk] - scicos_imp.ozptr[0]);
+ *mv = 1;
+ *v = (int *) (scicos_imp.oztyp);
+ }
+ else if (strcmp(what, "zptr") == 0)
+ {
+ /* zptr - discrete state splitting array */
+ *nv = nblk + 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.zptr);
+ }
+ else if (strcmp(what, "mod") == 0)
+ {
+ /* modes - block discontinuities array */
+ *nv = (int)(scicos_imp.modptr[nblk] - scicos_imp.modptr[0]);
+ *mv = 1;
+ *v = (int *) (scicos_imp.mod);
+ }
+ else if (strcmp(what, "nmod") == 0)
+ {
+ /* nmodes - number of block discontinuities array */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.nmod);
+ }
+ else if (strcmp(what, "modptr") == 0)
+ {
+ /* modptr - block discontinuities splitting array */
+ *nv = nblk + 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.modptr);
+ }
+ else if (strcmp(what, "iz") == 0)
+ {
+ /* iz - label integer code of blocks array */
+ *nv = (int)(scicos_imp.izptr[nblk] - scicos_imp.izptr[0]);
+ *mv = 1;
+ *v = (int *) (scicos_imp.iz);
+ }
+ else if (strcmp(what, "izptr") == 0)
+ {
+ /* izptr - label integer code of blocks splitting array */
+ *nv = nblk + 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.izptr);
+ }
+ else if (strcmp(what, "uid") == 0)
+ {
+ /* uid */
+ *nv = (int)(scicos_imp.uidptr[nblk] - scicos_imp.uidptr[0]);
+ *mv = 1;
+ *v = (int *) (scicos_imp.uid);
+ }
+ else if (strcmp(what, "uidptr") == 0)
+ {
+ /* uidptr */
+ *nv = nblk + 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.uidptr);
+ }
+ else if (strcmp(what, "inpptr") == 0)
+ {
+ /* inpptr */
+ *nv = nblk + 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.inpptr);
+ }
+ else if (strcmp(what, "inplnk") == 0)
+ {
+ /* inplnk */
+ *nv = (int)(scicos_imp.inpptr[nblk] - scicos_imp.inpptr[0]);
+ *mv = 1;
+ *v = (int *) (scicos_imp.inplnk);
+ }
+ else if (strcmp(what, "outptr") == 0)
+ {
+ /* outptr */
+ *nv = nblk + 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.outptr);
+ }
+ else if (strcmp(what, "outlnk") == 0)
+ {
+ /* outlnk */
+ *nv = (int)(scicos_imp.outptr[nblk] - scicos_imp.outptr[0]);
+ *mv = 1;
+ *v = (int *) (scicos_imp.outlnk);
+ }
+ else if (strcmp(what, "rpar") == 0)
+ {
+ /* rpar - vector of real parameters */
+ *nv = (int)(scicos_imp.rpptr[nblk] - scicos_imp.rpptr[0]);
+ *mv = 1;
+ *v = (double *) (scicos_imp.rpar);
+ }
+ else if (strcmp(what, "rpptr") == 0)
+ {
+ /* rpptr - real parameters splitting array */
+ *nv = nblk + 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.rpptr);
+ }
+ else if (strcmp(what, "ipar") == 0)
+ {
+ /* ipar - vector of integer parameters */
+ *nv = (int)(scicos_imp.ipptr[nblk] - scicos_imp.ipptr[0]);
+ *mv = 1;
+ *v = (int *) (scicos_imp.ipar);
+ }
+ else if (strcmp(what, "ipptr") == 0)
+ {
+ /* ipptr - integer parameters splitting array */
+ *nv = nblk + 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.ipptr);
+ }
+ else if (strcmp(what, "opar") == 0)
+ {
+ /* opar - vector of ptr of objects parameters */
+ *nv = (int)(scicos_imp.opptr[nblk] - scicos_imp.opptr[0]);
+ *mv = 1;
+ *v = (int *) (scicos_imp.opar);
+ }
+ else if (strcmp(what, "opptr") == 0)
+ {
+ /* opptr - object parameters splitting array */
+ *nv = nblk + 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.opptr);
+ }
+ else if (strcmp(what, "oparsz") == 0)
+ {
+ /* oparsz - object parameters size array */
+ *nv = (int)(scicos_imp.opptr[nblk] - scicos_imp.opptr[0]);
+ *mv = 2;
+ *v = (int *) (scicos_imp.oparsz);
+ }
+ else if (strcmp(what, "opartyp") == 0)
+ {
+ /* opartyp - object parameters type array */
+ *nv = (int)(scicos_imp.opptr[nblk] - scicos_imp.opptr[0]);
+ *mv = 1;
+ *v = (int *) (scicos_imp.opartyp);
+ }
+ else if (strcmp(what, "nblk") == 0)
+ {
+ /* number of block */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.nblk);
+ }
+ else if (strcmp(what, "outtbptr") == 0)
+ {
+ /* ptr on output register */
+ *nv = nlnk;
+ *mv = 1;
+ *v = (int *) (scicos_imp.outtbptr);
+ }
+ else if (strcmp(what, "outtbsz") == 0)
+ {
+ /* size of output register */
+ *nv = nlnk;
+ *mv = 2;
+ *v = (int *) (scicos_imp.outtbsz);
+ }
+ else if (strcmp(what, "outtbtyp") == 0)
+ {
+ /* type of output register */
+ *nv = nlnk;
+ *mv = 1;
+ *v = (int *) (scicos_imp.outtbtyp);
+ }
+ else if (strcmp(what, "nlnk") == 0)
+ {
+ /* number of link */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.nlnk);
+ }
+ else if (strcmp(what, "subs") == 0) /* Aquoisertsubs?? */
+ {
+ /* */
+ *nv = nsubs;
+ *mv = 1;
+ *v = (int *) (scicos_imp.subs);
+ }
+ else if (strcmp(what, "nsubs") == 0)
+ {
+ /* */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.nsubs);
+ }
+ else if (strcmp(what, "tevts") == 0)
+ {
+ /* */
+ *nv = nevts;
+ *mv = 1;
+ *v = (double *) (scicos_imp.tevts);
+ }
+ else if (strcmp(what, "evtspt") == 0)
+ {
+ /* */
+ *nv = nevts;
+ *mv = 1;
+ *v = (int *) (scicos_imp.evtspt);
+ }
+ else if (strcmp(what, "nevts") == 0)
+ {
+ /* */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.nevts);
+ }
+ else if (strcmp(what, "pointi") == 0)
+ {
+ /* */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.pointi);
+ }
+ else if (strcmp(what, "iord") == 0)
+ {
+ /* */
+ *nv = niord;
+ *mv = 2;
+ *v = (int *) (scicos_imp.iord);
+ }
+ else if (strcmp(what, "niord") == 0)
+ {
+ /* */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.niord);
+ }
+ else if (strcmp(what, "oord") == 0)
+ {
+ /* */
+ *nv = noord;
+ *mv = 2;
+ *v = (int *) (scicos_imp.oord);
+ }
+ else if (strcmp(what, "noord") == 0)
+ {
+ /* */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.noord);
+ }
+ else if (strcmp(what, "zord") == 0)
+ {
+ /* */
+ *nv = nzord;
+ *mv = 2;
+ *v = (int *) (scicos_imp.zord);
+ }
+ else if (strcmp(what, "nzord") == 0)
+ {
+ /* */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.nzord);
+ }
+ else if (strcmp(what, "funptr") == 0)
+ {
+ /* */
+ *nv = nblk;
+ *mv = 1;
+ *v = (int *) (scicos_imp.funptr);
+ }
+ else if (strcmp(what, "funtyp") == 0)
+ {
+ /* */
+ *nv = nblk;
+ *mv = 1;
+ *v = (int *) (scicos_imp.funtyp);
+ }
+ else if (strcmp(what, "ztyp") == 0)
+ {
+ /* */
+ *nv = nblk;
+ *mv = 1;
+ *v = (int *) (scicos_imp.ztyp);
+ }
+ else if (strcmp(what, "cord") == 0)
+ {
+ /* */
+ *nv = ncord;
+ *mv = 2;
+ *v = (int *) (scicos_imp.cord);
+ }
+ else if (strcmp(what, "ncord") == 0)
+ {
+ /* */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.ncord);
+ }
+ else if (strcmp(what, "ordclk") == 0)
+ {
+ /* */
+ *nv = (int)(scicos_imp.ordptr[nordptr] - 1);
+ *mv = 2;
+ *v = (int *) (scicos_imp.ordclk);
+ }
+ else if (strcmp(what, "clkptr") == 0)
+ {
+ /* */
+ *nv = (int)(nblk + 1);
+ *mv = 1;
+ *v = (int *) (scicos_imp.clkptr);
+ }
+ else if (strcmp(what, "ordptr") == 0)
+ {
+ /* */
+ *nv = nordptr;
+ *mv = 1;
+ *v = (int *) (scicos_imp.ordptr);
+ }
+ else if (strcmp(what, "nordptr") == 0)
+ {
+ /* */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.nordptr);
+ }
+ else if (strcmp(what, "critev") == 0)
+ {
+ /* */
+ *nv = (int)(scicos_imp.clkptr[nblk] - 1); /* !! a faire verifier !! */
+ *mv = 1;
+ *v = (int *) (scicos_imp.critev);
+ }
+ else if (strcmp(what, "iwa") == 0)
+ {
+ /* */
+ *nv = nevts; /* !! a faire verifier !! */
+ *mv = 1;
+ *v = (int *) (scicos_imp.iwa);
+ }
+ else if (strcmp(what, "blocks") == 0)
+ {
+ /* */
+ *nv = 1;
+ *mv = 1;
+ *v = (scicos_block *) (scicos_imp.blocks);
+ }
+ else if (strcmp(what, "ng") == 0)
+ {
+ /* */
+ *nv = 1;
+ *mv = 1;
+ *v = (int *) (scicos_imp.ng);
+ }
+ else if (strcmp(what, "g") == 0)
+ {
+ /* g */
+ *nv = ng;
+ *mv = 1;
+ *v = (double *) (scicos_imp.g);
+ }
+ else if (strcmp(what, "t0") == 0)
+ {
+ /* g */
+ *nv = 1;
+ *mv = 1;
+ *v = (double *) (scicos_imp.t0);
+ }
+ else if (strcmp(what, "tf") == 0)
+ {
+ /* g */
+ *nv = 1;
+ *mv = 1;
+ *v = (double *) (scicos_imp.tf);
+ }
+ else if (strcmp(what, "Atol") == 0)
+ {
+ /* g */
+ *nv = 1;
+ *mv = 1;
+ *v = (double *) (scicos_imp.Atol);
+ }
+ else if (strcmp(what, "rtol") == 0)
+ {
+ /* g */
+ *nv = 1;
+ *mv = 1;
+ *v = (double *) (scicos_imp.rtol);
+ }
+ else if (strcmp(what, "ttol") == 0)
+ {
+ /* g */
+ *nv = 1;
+ *mv = 1;
+ *v = (double *) (scicos_imp.ttol);
+ }
+ else if (strcmp(what, "deltat") == 0)
+ {
+ /* g */
+ *nv = 1;
+ *mv = 1;
+ *v = (double *) (scicos_imp.deltat);
+ }
+ else if (strcmp(what, "hmax") == 0)
+ {
+ /* g */
+ *nv = 1;
+ *mv = 1;
+ *v = (double *) (scicos_imp.hmax);
+ }
+ else if (strcmp(what, "nelem") == 0)
+ {
+ /* g */
+ *nv = 1;
+ *mv = 1;
+ *v = (int*) (scicos_imp.nelem);
+ }
+ else if (strcmp(what, "outtb_elem") == 0)
+ {
+ /* */
+ *nv = nelem;
+ *mv = 2;
+ *v = (outtb_el *) (scicos_imp.outtb_elem);
+ }
+ else /*return FALSE_*/
+ {
+ return 0;
+ }
+
+ /* return TRUE_ */
+ return 1;
+}
+/*--------------------------------------------------------------------------*/
+/* Used in some scicos block */
+void C2F(getlabel)(int *kfun, char *label, int *n)
+/*int *n, *kfun; length of the label as input n gives the max length expected*/
+{
+ int k;
+ int job = 1;
+
+ k = *kfun;
+ if (*n > (int)(scicos_imp.izptr[k] - scicos_imp.izptr[k - 1]))
+ {
+ *n = (int)(scicos_imp.izptr[k] - scicos_imp.izptr[k - 1]);
+ }
+ if (*n > 0 )
+ {
+ F2C(cvstr)(n, &(scicos_imp.iz[scicos_imp.izptr[k - 1] - 1]), label, &job, *n);
+ }
+}
+
+/*never used, never interfaced */
+void C2F(getblockbylabel)(int *kfun, char **label, int *n)
+{
+ int k, i, i0, nblk, n1;
+ int job = 0;
+ int lab[40];
+
+ nblk = scicos_imp.nblk[0];
+ F2C(cvstr)(n, lab, *label, &job, *n);
+
+ *kfun = 0;
+ for (k = 0; k < nblk; k++)
+ {
+ n1 = (int)(scicos_imp.izptr[k] - scicos_imp.izptr[k - 1]);
+ if (n1 == *n)
+ {
+ i0 = scicos_imp.izptr[k - 1] - 1;
+ i = 0;
+ while ((lab[i] == scicos_imp.iz[i0 + i]) & (i < n1))
+ {
+ i++;
+ }
+ if (i == n1)
+ {
+ *kfun = k + 1;
+ return;
+ }
+ }
+ }
+}
+/*--------------------------------------------------------------------------*/
+/*never used, never interfaced */
+int C2F(getsciblockbylabel)(int*kfun, int label[], int *n)
+{
+ int k, i, i0, nblk, n1;
+ if (scicos_imp.x == (double *)NULL)
+ {
+ return (2); /* undefined import table scicos is not running */
+ }
+ nblk = scicos_imp.nblk[0];
+
+ *kfun = 0;
+ for (k = 0; k < nblk; k++)
+ {
+ n1 = (int)(scicos_imp.izptr[k] - scicos_imp.izptr[k - 1]);
+ if (n1 == *n)
+ {
+ i0 = scicos_imp.izptr[k - 1] - 1;
+ i = 0;
+ while ((label[i] == scicos_imp.iz[i0 + i]) & (i < n1))
+ {
+ i++;
+ }
+ if (i == n1)
+ {
+ *kfun = k + 1;
+ return 0;
+ }
+ }
+ }
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
+int C2F(getscilabel)(int *kfun, int label[], int *n)
+{
+ int k, i;
+ int *u, *y;
+
+ if (scicos_imp.x == (double *)NULL)
+ {
+ return (2); /* undefined import table scicos is not running */
+ }
+ k = *kfun;
+ *n = (int)(scicos_imp.izptr[k] - scicos_imp.izptr[k - 1]);
+ if (*n > 0 )
+ {
+ u = (int *) & (scicos_imp.iz[scicos_imp.izptr[k - 1] - 1]);
+ y = label;
+ for (i = 0; i < *n; i++)
+ {
+ *(y++) = *(u++);
+ }
+ }
+ return (0);
+}
+/*--------------------------------------------------------------------------*/
+int C2F(getcurblock)()
+{
+ return (C2F(curblk).kfun);
+}
+/*--------------------------------------------------------------------------*/
+/* used in fscope
+ *
+ * 30/06/06, Alan : Rewritte to preserve compatibility with fscope.f.
+ * Only first element of matrix is delivred and converted to double data.
+ *
+ */
+void C2F(getouttb)(int *nsize, int *nvec, double *outtc)
+{
+ /* declaration of ptr for typed port */
+ void **outtbptr; /*to store outtbptr*/
+ SCSREAL_COP *outtbdptr; /*to store double of outtb*/
+ SCSINT8_COP *outtbcptr; /*to store int8 of outtb*/
+ SCSINT16_COP *outtbsptr; /*to store int16 of outtb*/
+ SCSINT32_COP *outtblptr; /*to store int32 of outtb*/
+ SCSUINT8_COP *outtbucptr; /*to store unsigned int8 of outtb */
+ SCSUINT16_COP *outtbusptr; /*to store unsigned int16 of outtb */
+ SCSUINT32_COP *outtbulptr; /*to store unsigned int32 of outtb */
+ int *outtb_nelem; /*to store maximum number of element*/
+ int outtbtyp; /*to store type of data*/
+ int *outtbsz; /*to store size of data*/
+ outtb_el *outtb_elem; /*to store ptr of outtb_elem structure */
+
+ /*auxiliary variable*/
+ int j, sz, lnk, pos;
+
+ /*get outtbptr from import struct.*/
+ outtbptr = scicos_imp.outtbptr;
+ /*get outtb_elem from import struct.*/
+ outtb_elem = scicos_imp.outtb_elem;
+ /*get outtbsz from import struct.*/
+ outtbsz = scicos_imp.outtbsz;
+ /*get max number of elem in outtb*/
+ outtb_nelem = scicos_imp.nelem;
+
+ /*initialization of position in outtc */
+ j = 0;
+
+ while (j < *nsize)
+ {
+ /*test to know if we are outside outtb_elem*/
+ if (nvec[j] > (*outtb_nelem))
+ {
+ set_block_error(-1);
+ return;
+ }
+
+ lnk = outtb_elem[nvec[j] - 1].lnk;
+ pos = outtb_elem[nvec[j] - 1].pos;
+ outtbtyp = scicos_imp.outtbtyp[lnk];
+
+ /*double data type*/
+ if (outtbtyp == SCSREAL_N)
+ {
+ outtbdptr = (SCSREAL_COP *)outtbptr[lnk];
+ outtc[j] = (double)outtbdptr[pos];
+ j++;
+ }
+ /*complex data type*/
+ else if (outtbtyp == SCSCOMPLEX_N)
+ {
+ sz = outtbsz[2 * lnk] + outtbsz[(2 * lnk) + 1];
+ outtbdptr = (SCSCOMPLEX_COP *)outtbptr[lnk];
+ outtc[j] = (double)outtbdptr[pos];
+ /*outtc[j+1] = (double)outtbdptr[pos+sz];*/
+ /*j=j+2;*/
+ j++;
+ }
+ /*int data type*/
+ else
+ {
+ switch (outtbtyp)
+ {
+ case SCSINT8_N :
+ outtbcptr = (SCSINT8_COP *)outtbptr[lnk]; /*int8*/
+ outtc[j] = (double)outtbcptr[pos];
+ j++;
+ break;
+
+ case SCSINT16_N :
+ outtbsptr = (SCSINT16_COP *)outtbptr[lnk]; /*int16*/
+ outtc[j] = (double)outtbsptr[pos];
+ j++;
+ break;
+
+ case SCSINT32_N :
+ outtblptr = (SCSINT32_COP *)outtbptr[lnk]; /*int32*/
+ outtc[j] = (double)outtblptr[pos];
+ j++;
+ break;
+
+ case SCSUINT8_N :
+ outtbucptr = (SCSUINT8_COP *)outtbptr[lnk]; /*uint8*/
+ outtc[j] = (double)outtbucptr[pos];
+ j++;
+ break;
+
+ case SCSUINT16_N :
+ outtbusptr = (SCSUINT16_COP *)outtbptr[lnk]; /*uint16*/
+ outtc[j] = (double)outtbusptr[pos];
+ j++;
+ break;
+
+ case SCSUINT32_N :
+ outtbulptr = (SCSUINT32_COP *)outtbptr[lnk]; /*uint32*/
+ outtc[j] = (double)outtbulptr[pos];
+ j++;
+ break;
+
+ default :
+ outtc[j] = 0;
+ j++;
+ break;
+ }
+ }
+ }
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-MlistGetFieldNumber.lo b/modules/scicos/src/c/libsciscicos_algo_la-MlistGetFieldNumber.lo
new file mode 100755
index 000000000..8a95ed429
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-MlistGetFieldNumber.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-MlistGetFieldNumber.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-MlistGetFieldNumber.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-copyvarfromlistentry.lo b/modules/scicos/src/c/libsciscicos_algo_la-copyvarfromlistentry.lo
new file mode 100755
index 000000000..d52a2867b
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-copyvarfromlistentry.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-copyvarfromlistentry.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-copyvarfromlistentry.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-createblklist.lo b/modules/scicos/src/c/libsciscicos_algo_la-createblklist.lo
new file mode 100755
index 000000000..5131c3a56
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-createblklist.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-createblklist.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-createblklist.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-ddaskr.lo b/modules/scicos/src/c/libsciscicos_algo_la-ddaskr.lo
new file mode 100755
index 000000000..6d4f4bd88
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-ddaskr.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-ddaskr.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-ddaskr.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-extractblklist.lo b/modules/scicos/src/c/libsciscicos_algo_la-extractblklist.lo
new file mode 100755
index 000000000..f07a31ec8
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-extractblklist.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-extractblklist.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-extractblklist.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-ezxml.lo b/modules/scicos/src/c/libsciscicos_algo_la-ezxml.lo
new file mode 100755
index 000000000..bce48ba52
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-ezxml.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-ezxml.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-ezxml.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-il_sim.lo b/modules/scicos/src/c/libsciscicos_algo_la-il_sim.lo
new file mode 100755
index 000000000..1f29925a3
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-il_sim.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-il_sim.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-il_sim.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-il_state.lo b/modules/scicos/src/c/libsciscicos_algo_la-il_state.lo
new file mode 100755
index 000000000..b26e5506f
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-il_state.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-il_state.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-il_state.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-import.lo b/modules/scicos/src/c/libsciscicos_algo_la-import.lo
new file mode 100755
index 000000000..73a0b4b4b
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-import.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-import.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-import.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-lsodar.lo b/modules/scicos/src/c/libsciscicos_algo_la-lsodar.lo
new file mode 100755
index 000000000..4bb3bbcf5
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-lsodar.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-lsodar.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-lsodar.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-sciblk2.lo b/modules/scicos/src/c/libsciscicos_algo_la-sciblk2.lo
new file mode 100755
index 000000000..6d580972f
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-sciblk2.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-sciblk2.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-sciblk2.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-sciblk4.lo b/modules/scicos/src/c/libsciscicos_algo_la-sciblk4.lo
new file mode 100755
index 000000000..3e326b059
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-sciblk4.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-sciblk4.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-sciblk4.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-scicos.lo b/modules/scicos/src/c/libsciscicos_algo_la-scicos.lo
new file mode 100755
index 000000000..9d07772d8
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-scicos.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-scicos.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-scicos.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-scicos_free.lo b/modules/scicos/src/c/libsciscicos_algo_la-scicos_free.lo
new file mode 100755
index 000000000..e7032ce14
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-scicos_free.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-scicos_free.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-scicos_free.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-scicos_malloc.lo b/modules/scicos/src/c/libsciscicos_algo_la-scicos_malloc.lo
new file mode 100755
index 000000000..56b57bdc2
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-scicos_malloc.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-scicos_malloc.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-scicos_malloc.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-scicos_print.lo b/modules/scicos/src/c/libsciscicos_algo_la-scicos_print.lo
new file mode 100755
index 000000000..095f6ffb9
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-scicos_print.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-scicos_print.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-scicos_print.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-tree.lo b/modules/scicos/src/c/libsciscicos_algo_la-tree.lo
new file mode 100755
index 000000000..b89e2ccde
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-tree.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-tree.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-tree.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/libsciscicos_algo_la-var2sci.lo b/modules/scicos/src/c/libsciscicos_algo_la-var2sci.lo
new file mode 100755
index 000000000..119a429dd
--- /dev/null
+++ b/modules/scicos/src/c/libsciscicos_algo_la-var2sci.lo
@@ -0,0 +1,12 @@
+# src/c/libsciscicos_algo_la-var2sci.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libsciscicos_algo_la-var2sci.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/scicos/src/c/lsodar.c b/modules/scicos/src/c/lsodar.c
new file mode 100755
index 000000000..9fc59d99c
--- /dev/null
+++ b/modules/scicos/src/c/lsodar.c
@@ -0,0 +1,586 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Scilab Enterprises - 2012 - Paul Bignier
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <machine.h>
+
+#include "lsodar.h"
+
+#define NO_FPRINTF_OUTPUT 1
+
+/*
+ * Control constant for tolerances
+ *
+ * Scicos only uses scalar tolerances, so we only need the scalar-scalar (SS) value for iTol.
+ * --------------------------------
+ */
+#define LS_SS 1
+
+#define LS_NORMAL 1
+#define LS_ONE_STEP 2
+#define LS_MESH_STEP 3
+#define LS_NORMAL_TSTOP 4
+#define LS_ONE_STEP_TSTOP 5
+
+/* =============================
+ *
+ * lsodar
+ *
+ * =============================
+ *
+ * Actual solving function, from 'ODEPACK' in 'differential_equations' module
+ */
+
+extern void C2F(lsodar) (LSRhsFn f, int *neq, realtype *y, realtype *t, realtype *tout, int *itol, realtype *reltol, realtype *abstol, int *itask, int *istate, int *iopt, struct rWork_t *rwork, int *lrw, int *iwork, int *liw, int *jacobian, int *jacType, LSRootFn grblk, int *ng, int *jroot);
+
+/* =============================
+ *
+ * LSodarCreate
+ *
+ * =============================
+ *
+ * LSodarCreate creates an internal memory block for a problem to be solved by LSODAR.
+ * If successful, LSodarCreate returns a pointer to the problem memory.
+ * This pointer should be passed to LSodarInit.
+ * If an initialization error occurs,
+ * LSodarCreate prints an error message to standard err and returns NULL.
+ */
+
+void * LSodarCreate (int * neq, int ng)
+{
+ int lRn = 0, lRs = 0, lIw = 0, lRw = 0;
+ LSodarMem lsodar_mem = NULL;
+
+ /* Allocate the problem memory space */
+ lsodar_mem = NULL;
+ lsodar_mem = (LSodarMem) malloc(sizeof(struct LSodarMemRec));
+ if (lsodar_mem == NULL)
+ {
+ LSProcessError(NULL, 0, "LSODAR", "LSodarCreate", MSGCV_CVMEM_FAIL);
+ return (NULL);
+ }
+
+ /* Zero out ls_mem */
+ memset(lsodar_mem, 0, sizeof(struct LSodarMemRec));
+
+ /* Set the 'rwork' and 'iwork' workspaces lengths */
+ lRn = 20 + 16 * (*neq) + 3 * ng;
+ lRs = 22 + ((*neq) * (9 + (*neq))) + 3 * ng;
+ lIw = 20 + (*neq);
+ lRw = max(lRn, lRs);
+
+ /* Copy the variables into the problem memory space */
+ lsodar_mem->nEquations = neq;
+ lsodar_mem->iState = 1;
+ lsodar_mem->iOpt = 0;
+ lsodar_mem->rwork = NULL;
+ lsodar_mem->lrw = lRw;
+ lsodar_mem->iwork = NULL;
+ lsodar_mem->liw = lIw;
+ lsodar_mem->jacobian = 0;
+ lsodar_mem->jacType = 2;
+ lsodar_mem->g_fun = NULL;
+ lsodar_mem->ng_fun = ng;
+ lsodar_mem->jroot = NULL;
+ lsodar_mem->ehfun = NULL;
+
+ return ((void *) lsodar_mem);
+}
+
+/* Shortcuts to problem memory space parameters */
+# define func ls_mem->func
+# define nEq ls_mem->nEquations
+# define yVec ls_mem->yVector
+# define tStart ls_mem->tStart
+# define tEnd ls_mem->tEnd
+# define iTol ls_mem->iTol
+# define relTol ls_mem->relTol
+# define absTol ls_mem->absTol
+# define iState ls_mem->iState
+# define iOpt ls_mem->iOpt
+# define rwork ls_mem->rwork
+# define lrw ls_mem->lrw
+# define iwork ls_mem->iwork
+# define liw ls_mem->liw
+# define jac ls_mem->jacobian
+# define jacType ls_mem->jacType
+# define g_fun ls_mem->g_fun
+# define ng_fun ls_mem->ng_fun
+# define jroot ls_mem->jroot
+
+/* =============================
+ *
+ * LSodarInit
+ *
+ * =============================
+ *
+ * LSodarInit allocates and initializes memory for a problem.
+ * All problem inputs are checked for errors. If any error occurs during initialization,
+ * it is reported to the file whose file pointer is errfp and an error flag is returned.
+ * Otherwise, it returns CV_SUCCESS.
+ */
+
+int LSodarInit (void * lsodar_mem, LSRhsFn f, realtype t0, N_Vector y)
+{
+ LSodarMem ls_mem = NULL;
+
+ /* Check the input arguments */
+
+ if (lsodar_mem == NULL)
+ {
+ LSProcessError(NULL, CV_MEM_NULL, "LSODAR", "LSodarInit", MSGCV_NO_MEM);
+ return (CV_MEM_NULL);
+ }
+ ls_mem = (LSodarMem) lsodar_mem;
+
+ if (y == NULL)
+ {
+ LSProcessError(ls_mem, CV_ILL_INPUT, "LSODAR", "LSodarInit", MSGCV_NULL_Y0);
+ return (CV_ILL_INPUT);
+ }
+
+ if (f == NULL)
+ {
+ LSProcessError(ls_mem, CV_ILL_INPUT, "LSODAR", "LSodarInit", MSGCV_NULL_F);
+ return (CV_ILL_INPUT);
+ }
+
+ /* Copy the arguments into the problem memory space */
+ func = f;
+ yVec = NV_DATA_S(y);
+ tStart = t0;
+
+ /* Allocate rwork and iwork workspaces and set them to zero.
+ Their size is lrw and liw, respectively */
+ rwork = (struct rWork_t *) calloc(lrw, sizeof(realtype));
+ iwork = calloc(liw, sizeof(int));
+
+ return (CV_SUCCESS);
+}
+
+/* =============================
+ *
+ * LSodarReInit
+ *
+ * =============================
+ *
+ * LSodarReInit reinitializes LSODAR's memory for a problem,
+ * assuming it has already been allocated in a prior LSodarInit call.
+ * All problem specification inputs are checked for errors.
+ * If any error occurs during initialization, it is reported to the file whose file pointer is errfp.
+ * The return value is CV_SUCCESS = 0 if no errors occurred, or a negative value otherwise.
+ */
+
+int LSodarReInit (void * lsodar_mem, realtype tOld, N_Vector y)
+{
+ LSodarMem ls_mem = NULL;
+
+ /* Check the input arguments */
+
+ if (lsodar_mem == NULL)
+ {
+ LSProcessError(NULL, CV_MEM_NULL, "LSODAR", "LSodarReInit", MSGCV_NO_MEM);
+ return (CV_MEM_NULL);
+ }
+ ls_mem = (LSodarMem) lsodar_mem;
+
+ if (y == NULL)
+ {
+ LSProcessError(ls_mem, CV_ILL_INPUT, "LSODAR", "LSodarReInit", MSGCV_NULL_Y0);
+ return (CV_ILL_INPUT);
+ }
+
+ /* Reset the problem memory space variables to the arguments */
+ *nEq = NV_LENGTH_S(y);
+ yVec = NV_DATA_S(y);
+ tStart = tOld;
+ iState = 1;
+
+ return (CV_SUCCESS);
+}
+
+/* =============================
+ *
+ * LSodarSStolerances
+ *
+ * =============================
+ *
+ * This function specifies the scalar integration tolerances.
+ * It MUST be called before the first call to LSodar.
+ */
+
+int LSodarSStolerances (void * lsodar_mem, realtype reltol, realtype abstol)
+{
+ LSodarMem ls_mem = NULL;
+
+ if (lsodar_mem == NULL)
+ {
+ LSProcessError(NULL, CV_MEM_NULL, "LSodar", "LSodarSStolerances", MSGCV_NO_MEM);
+ return (CV_MEM_NULL);
+ }
+ ls_mem = (LSodarMem) lsodar_mem;
+
+ /* Check inputs */
+
+ if (reltol < 0.)
+ {
+ LSProcessError(ls_mem, CV_ILL_INPUT, "LSODAR", "LSodarSStolerances", MSGCV_BAD_RELTOL);
+ return (CV_ILL_INPUT);
+ }
+
+ if (abstol < 0.)
+ {
+ LSProcessError(ls_mem, CV_ILL_INPUT, "LSODAR", "LSodarSStolerances", MSGCV_BAD_ABSTOL);
+ return (CV_ILL_INPUT);
+ }
+
+ /* Copy tolerances into memory */
+
+ relTol = reltol;
+ absTol = abstol;
+ iTol = LS_SS;
+
+ return (CV_SUCCESS);
+}
+
+/* =============================
+ *
+ * LSodarRootInit
+ *
+ * =============================
+ *
+ * LSodarRootInit initializes a rootfinding problem to be solved during the integration of the ODE system.
+ * It loads the root function pointer and the number of root functions, and allocates workspace memory.
+ * The return value is CV_SUCCESS = 0 if no errors occurred, or a negative value otherwise.
+ */
+
+int LSodarRootInit (void * lsodar_mem, int ng, LSRootFn g)
+{
+ LSodarMem ls_mem = NULL;
+ int nrt = 0;
+
+ if (lsodar_mem == NULL)
+ {
+ LSProcessError(NULL, CV_MEM_NULL, "LSODAR", "LSodarRootInit", MSGCV_NO_MEM);
+ return (CV_MEM_NULL);
+ }
+ ls_mem = (LSodarMem) lsodar_mem;
+
+ if (g == NULL)
+ {
+ LSProcessError(ls_mem, CV_ILL_INPUT, "LSODAR", "LSodarRootInit", MSGCV_NULL_G);
+ return (CV_ILL_INPUT);
+ }
+
+ g_fun = g;
+ nrt = (ng < 0) ? 0 : ng;
+ ng_fun = nrt;
+
+ /* Allocate jroot and set it to zero */
+ if (ng > 0)
+ {
+ jroot = calloc(ng, sizeof(int));
+ }
+
+ return (CV_SUCCESS);
+}
+
+/* =============================
+ *
+ * LSodarSetMaxStep
+ *
+ * =============================
+ *
+ * Sets the maximum step size, stocked in rwork->hmax.
+ * Sets iOpt to 1 for rwork->hmax to be taken in consideration by lsodar().
+ */
+
+int LSodarSetMaxStep (void * lsodar_mem, realtype hMax)
+{
+ LSodarMem ls_mem = NULL;
+
+ if (lsodar_mem == NULL)
+ {
+ LSProcessError(NULL, CV_MEM_NULL, "LSODAR", "LSodarSetMaxStep", MSGCV_NO_MEM);
+ return (CV_MEM_NULL);
+ }
+ ls_mem = (LSodarMem) lsodar_mem;
+
+ if (iOpt == 0)
+ {
+ iOpt = 1;
+ }
+ rwork->hmax = hMax;
+
+ return (CV_SUCCESS);
+}
+
+/* =============================
+ *
+ * LSodarSetStopTime
+ *
+ * =============================
+ *
+ * Specifies the time beyond which the integration is not to proceed, stocked in rwork->tcrit.
+ * Sets iOpt to 1 for rwork->tcrit to be taken in consideration by lsodar().
+ */
+
+int LSodarSetStopTime (void * lsodar_mem, realtype tCrit)
+{
+ LSodarMem ls_mem = NULL;
+
+ if (lsodar_mem == NULL)
+ {
+ LSProcessError(NULL, CV_MEM_NULL, "LSODAR", "LSodarSetStopTime", MSGCV_NO_MEM);
+ return (CV_MEM_NULL);
+ }
+ ls_mem = (LSodarMem) lsodar_mem;
+
+ if (iOpt == 0)
+ {
+ iOpt = 1;
+ }
+ rwork->tcrit = tCrit;
+
+ return (CV_SUCCESS);
+}
+
+/* =============================
+ *
+ * LSodar
+ *
+ * =============================
+ *
+ * This routine is the main driver of LSODAR.
+ *
+ * It integrates and looks for roots over a time interval defined by the user.
+ *
+ * The first time that LSodar is called for a successfully initialized problem,
+ * it computes a tentative initial step size h.
+ *
+ * LSodar supports five modes, specified by itask: LS_NORMAL, LS_ONE_STEP, LS_MESH_STEP, LS_NORMAL_TSTOP, and LS_ONE_STEP_TSTOP.
+ *
+ * In the LS_NORMAL mode, the solver steps until it reaches or passes tout and then interpolates to obtain y(tOut).
+ * In the LS_ONE_STEP mode, it takes one internal step and returns.
+ * LS_MESH_STEP means stop at the first internal mesh point at or beyond t = tout and return.
+ * LS_NORMAL_TSTOP and LS_ONE_STEP_TSTOP are similar to LS_NORMAL and LS_ONE_STEP, respectively,
+ * but the integration never proceeds past tcrit (which must have been defined through a call to LSodarSetStopTime).
+ *
+ * It returns CV_ROOT_RETURN if a root was detected, CV_SUCCESS if the integration went correctly,
+ * or a corresponding error flag.
+ */
+
+int LSodar (void * lsodar_mem, realtype tOut, N_Vector yOut, realtype * tOld, int itask)
+{
+ LSodarMem ls_mem = NULL;
+
+ /* Check the input arguments */
+
+ if (lsodar_mem == NULL)
+ {
+ LSProcessError(NULL, CV_MEM_NULL, "LSODAR", "LSodar", MSGCV_NO_MEM);
+ return (CV_MEM_NULL);
+ }
+ ls_mem = (LSodarMem) lsodar_mem;
+
+ if (yOut == NULL)
+ {
+ LSProcessError(ls_mem, CV_ILL_INPUT, "LSODAR", "LSodar", MSGCV_YOUT_NULL);
+ return (CV_ILL_INPUT);
+ }
+
+ if ((itask != LS_NORMAL) && (itask != LS_ONE_STEP) && (itask != LS_MESH_STEP) &&
+ (itask != LS_NORMAL_TSTOP) && (itask != LS_ONE_STEP_TSTOP))
+ {
+ LSProcessError(ls_mem, CV_ILL_INPUT, "LSODAR", "LSodar", MSGCV_BAD_ITASK);
+ return (CV_ILL_INPUT);
+ }
+
+ /* Retrieve nEq if it has changed, use a copy of the solution vector and stock the simulation times */
+ *nEq = NV_LENGTH_S(yOut);
+ yVec = NV_DATA_S(yOut);
+ tStart = *tOld;
+ tEnd = tOut;
+
+ /* Launch the simulation with the memory space parameters.
+ lsodar() will update yVec, iState, rwork, iwork and jroot */
+ C2F(lsodar) (func, nEq, yVec, &tStart, &tEnd, &iTol, &relTol, &absTol, &itask, &iState, &iOpt, rwork, &lrw, iwork, &liw, &jac, &jacType, g_fun, &ng_fun, jroot);
+
+ /* Increment the start times */
+ *tOld = tStart;
+
+ /* lsodar() stocked the completion status in iState; return accordingly */
+ switch (iState)
+ {
+ case 3:
+ return (CV_ROOT_RETURN);
+ case -1:
+ LSProcessError(ls_mem, CV_TOO_MUCH_WORK, "LSODAR", "LSodar", MSGCV_MAX_STEPS, tStart);
+ return (CV_TOO_MUCH_WORK);
+ case -2:
+ LSProcessError(ls_mem, CV_TOO_MUCH_ACC, "LSODAR", "LSodar", MSGCV_TOO_MUCH_ACC, tStart);
+ return (CV_TOO_MUCH_ACC);
+ case -3:
+ LSProcessError(ls_mem, CV_ILL_INPUT, "LSODAR", "LSodar", MSGCV_BAD_INPUT, tStart);
+ return (CV_ILL_INPUT);
+ case -4:
+ LSProcessError(ls_mem, CV_ERR_FAILURE, "LSODAR", "LSodar", MSGCV_ERR_FAILS, tStart);
+ return (CV_ERR_FAILURE);
+ case -5:
+ LSProcessError(ls_mem, CV_CONV_FAILURE, "LSODAR", "LSodar", MSGCV_CONV_FAILS, tStart);
+ return (CV_CONV_FAILURE);
+ case -6:
+ LSProcessError(ls_mem, CV_ILL_INPUT, "LSODAR", "LSodar", MSGCV_EWT_NOW_BAD, tStart);
+ return (CV_ILL_INPUT);
+ default:
+ return (CV_SUCCESS);
+ }
+}
+
+/* =============================
+ *
+ * LSodarGetRootInfo
+ *
+ * =============================
+ *
+ * Updates rootsfound[] to the computed roots stocked in jroot[].
+ */
+
+int LSodarGetRootInfo (void * lsodar_mem, int * rootsfound)
+{
+ LSodarMem ls_mem = NULL;
+
+ if (lsodar_mem == NULL)
+ {
+ LSProcessError(NULL, CV_MEM_NULL, "LSODAR", "LSodarGetRootInfo", MSGCV_NO_MEM);
+ return (CV_MEM_NULL);
+ }
+ ls_mem = (LSodarMem) lsodar_mem;
+
+ /* Copy jroot to rootsfound */
+ memcpy(rootsfound, jroot, ng_fun * sizeof(int));
+
+ return (CV_SUCCESS);
+}
+
+/* =============================
+ *
+ * LSFree
+ *
+ * =============================
+ *
+ * This routine frees the problem memory allocated by LSodarInit.
+ */
+
+void LSodarFree (void ** lsodar_mem)
+{
+ LSodarMem ls_mem = NULL;
+
+ if (*lsodar_mem == NULL)
+ {
+ return;
+ }
+ ls_mem = (LSodarMem) (*lsodar_mem);
+
+ /* Free the inner vectors */
+ LSFreeVectors (ls_mem);
+
+ free (*lsodar_mem);
+ *lsodar_mem = NULL;
+}
+
+/* =============================
+ *
+ * LSFreeVectors
+ *
+ * =============================
+ *
+ * Frees the problem memory space vectors.
+ */
+
+void LSFreeVectors (LSodarMem ls_mem)
+{
+ /* rwork, iwork and jroot have been allocated; free them */
+ free (rwork);
+ free (iwork);
+ free (jroot);
+}
+
+/* =============================
+ *
+ * LSodarSetErrHandlerFn
+ *
+ * =============================
+ *
+ * Specifies the error handler function.
+ */
+
+int LSodarSetErrHandlerFn (void * lsodar_mem, LSErrHandlerFn ehfun, void * eh_data)
+{
+ LSodarMem ls_mem = NULL;
+
+ if (lsodar_mem == NULL)
+ {
+ LSProcessError(NULL, CV_MEM_NULL, "LSODAR", "LSodarSetErrHandlerFn", MSGCV_NO_MEM);
+ return(CV_MEM_NULL);
+ }
+
+ ls_mem = (LSodarMem) lsodar_mem;
+
+ ls_mem->ehfun = ehfun;
+
+ return(CV_SUCCESS);
+}
+
+#define ehfun ls_mem->ehfun
+
+/* =============================
+ *
+ * LSProcessError
+ *
+ * =============================
+ *
+ * Error handling function.
+ */
+
+void LSProcessError (LSodarMem ls_mem, int error_code, const char *module, const char *fname, const char *msgfmt, ...)
+{
+ va_list ap;
+ char msg[256];
+
+ /* Initialize the argument pointer variable
+ (msgfmt is the last required argument to LSProcessError) */
+ va_start(ap, msgfmt);
+
+ if (ls_mem == NULL) /* We write to stderr */
+ {
+#ifndef NO_FPRINTF_OUTPUT
+ fprintf(stderr, "\n[%s ERROR] %s\n ", module, fname);
+ fprintf(stderr, msgfmt);
+ fprintf(stderr, "\n\n");
+#endif
+ }
+ else /* We can call ehfun */
+ {
+ /* Compose the message */
+ vsprintf(msg, msgfmt, ap);
+
+ /* Call ehfun */
+ ehfun(error_code, module, fname, msg, NULL);
+ }
+
+ /* Finalize argument processing */
+ va_end(ap);
+}
diff --git a/modules/scicos/src/c/lsodar.h b/modules/scicos/src/c/lsodar.h
new file mode 100755
index 000000000..b3b01eeaf
--- /dev/null
+++ b/modules/scicos/src/c/lsodar.h
@@ -0,0 +1,107 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Scilab Enterprises - 2012 - Paul Bignier
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+
+#ifndef _LSODAR_H
+#define _LSODAR_H
+
+#include "sundials_extension.h"
+#include "sundials/sundials_types.h" // Definition of types 'realtype' and 'booleantype'
+#include "nvector/nvector_serial.h" // Type 'N_Vector'
+#include "../scicos_sundials/src/cvode/cvode_impl.h" // Error handling
+
+#ifndef max
+#define max(A,B) ((A>B) ? A:B) // 'max()' function
+#endif
+
+// realtype workspace
+struct rWork_t
+{
+ realtype tcrit;
+ realtype rwork2;
+ realtype rwork3;
+ realtype rwork4;
+ realtype h0;
+ realtype hmax;
+ realtype hmin;
+ realtype rwork[1];
+};
+
+// Derivative computation and Root functions
+typedef void (*LSRhsFn) (int * neq, realtype * t, realtype * y, realtype * rwork);
+typedef void (*LSRootFn) (int * neq, realtype * t, realtype * y, int * ng, realtype * rwork);
+typedef void (*LSErrHandlerFn) (int error_code, const char *module, const char *function, char *msg, void *user_data);
+
+// LSodar problem memory structure
+typedef struct LSodarMemRec
+{
+ LSRhsFn func;
+ int * nEquations;
+ realtype * yVector;
+ realtype tStart;
+ realtype tEnd;
+ int iTol;
+ realtype relTol;
+ realtype absTol;
+ int iState;
+ int iOpt;
+ struct rWork_t * rwork;
+ int lrw;
+ int * iwork;
+ int liw;
+ int jacobian;
+ int jacType;
+ LSRootFn g_fun;
+ int ng_fun;
+ int * jroot;
+ LSErrHandlerFn ehfun;
+} *LSodarMem;
+
+// Creating the problem
+void * LSodarCreate (int * neq, int ng);
+
+// Allocating the problem
+int LSodarInit (void * lsodar_mem, LSRhsFn f, realtype t0, N_Vector y);
+
+// Reinitializing the problem
+int LSodarReInit (void * lsodar_mem, realtype tOld, N_Vector y);
+
+// Specifying the tolerances
+int LSodarSStolerances (void * lsodar_mem, realtype reltol, realtype abstol);
+
+// Initializing the root-finding problem
+int LSodarRootInit (void * lsodar_mem, int ng, LSRootFn g);
+
+// Specifying the maximum step size
+int LSodarSetMaxStep (void * lsodar_mem, realtype hmax);
+
+// Specifying the time beyond which the integration is not to proceed
+int LSodarSetStopTime (void * lsodar_mem, realtype tcrit);
+
+// Solving the problem
+int LSodar (void * lsodar_mem, realtype tOut, N_Vector yVec, realtype * tOld, int itask);
+
+// Update rootsfound to the computed jroots
+int LSodarGetRootInfo (void * lsodar_mem, int * rootsfound);
+
+// Freeing the problem memory allocated by lsodarMalloc
+void LSodarFree (void ** lsodar_mem);
+
+// Freeing the lsodar vectors allocated in lsodarAllocVectors
+void LSFreeVectors (LSodarMem lsodar_mem);
+
+// Specifies the error handler function
+int LSodarSetErrHandlerFn (void * lsodar_mem, LSErrHandlerFn ehfun, void * eh_data);
+
+// Error handling function
+void LSProcessError (LSodarMem ls_mem, int error_code, const char *module, const char *fname, const char *msgfmt, ...);
+
+#endif
diff --git a/modules/scicos/src/c/nographics_Import.def b/modules/scicos/src/c/nographics_Import.def
new file mode 100755
index 000000000..1710fec7e
--- /dev/null
+++ b/modules/scicos/src/c/nographics_Import.def
@@ -0,0 +1,4 @@
+LIBRARY nographics.dll
+
+
+EXPORTS
diff --git a/modules/scicos/src/c/noscicos/.deps/libsciscicos_algo_la-noscicos.Plo b/modules/scicos/src/c/noscicos/.deps/libsciscicos_algo_la-noscicos.Plo
new file mode 100755
index 000000000..9ce06a81e
--- /dev/null
+++ b/modules/scicos/src/c/noscicos/.deps/libsciscicos_algo_la-noscicos.Plo
@@ -0,0 +1 @@
+# dummy
diff --git a/modules/scicos/src/c/noscicos/noscicos.c b/modules/scicos/src/c/noscicos/noscicos.c
new file mode 100755
index 000000000..33bb85fde
--- /dev/null
+++ b/modules/scicos/src/c/noscicos/noscicos.c
@@ -0,0 +1,13 @@
+/*--------------------------------------------------------------------------*/
+/* INRIA 2006 */
+/* Allan CORNET */
+/*--------------------------------------------------------------------------*/
+#include "gw_scicos.h"
+#include "Scierror.h"
+/*--------------------------------------------------------------------------*/
+int gw_scicos(void)
+{
+ Scierror(999, "Scicos interface not installed.\n");
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/noscicos/noscicos.h b/modules/scicos/src/c/noscicos/noscicos.h
new file mode 100755
index 000000000..90b6e2f30
--- /dev/null
+++ b/modules/scicos/src/c/noscicos/noscicos.h
@@ -0,0 +1,13 @@
+/*--------------------------------------------------------------------------*/
+/* INRIA 2007 */
+/* Sylvestre LEDRU */
+/*--------------------------------------------------------------------------*/
+#ifndef __NOSCICOS_H__
+#define __NOSCICOS_H__
+
+
+int gw_scicos(void);
+int haltscicos(char *name, int *win, int *entry, long int name_len);
+
+#endif
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/noscicos/noscicos.rc b/modules/scicos/src/c/noscicos/noscicos.rc
new file mode 100755
index 000000000..1d888022e
--- /dev/null
+++ b/modules/scicos/src/c/noscicos/noscicos.rc
@@ -0,0 +1,97 @@
+// Microsoft Visual C++ generated resource script.
+//
+
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+//#include "afxres.h"
+#define APSTUDIO_HIDDEN_SYMBOLS
+#include "windows.h"
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// French (France) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
+#ifdef _WIN32
+LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 5,5,2,0
+ PRODUCTVERSION 5,5,2,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x0L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040c04b0"
+ BEGIN
+ VALUE "FileDescription", "noscicos module"
+ VALUE "FileVersion", "5, 5, 2, 0"
+ VALUE "InternalName", "noscicos module"
+ VALUE "LegalCopyright", "Copyright (C) 2017"
+ VALUE "OriginalFilename", "noscicos.dll"
+ VALUE "ProductName", " noscicos"
+ VALUE "ProductVersion", "5, 5, 2, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40c, 1200
+ END
+END
+
+#endif // French (France) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/modules/scicos/src/c/noscicos/noscicos.vcxproj b/modules/scicos/src/c/noscicos/noscicos.vcxproj
new file mode 100755
index 000000000..91bee337a
--- /dev/null
+++ b/modules/scicos/src/c/noscicos/noscicos.vcxproj
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{0A0B68FA-98F5-4FC2-A9E9-4AC9CEE6A6B4}</ProjectGuid>
+ <RootNamespace>noscicos</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../core/includes;../../../../output_stream/includes;../../../../api_scilab/includes;../../../includes;../../../../../libs/intl;../../../../intersci/includes;../../../api_scilab/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCICOS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <WarningLevel>Level3</WarningLevel>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../core/includes;../../../../output_stream/includes;../../../../api_scilab/includes;../../../includes;../../../../../libs/intl;../../../../intersci/includes;../../../api_scilab/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCICOS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <WarningLevel>Level3</WarningLevel>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../../../core/includes;../../../../output_stream/includes;../../../../api_scilab/includes;../../../includes;../../../../../libs/intl;../../../../intersci/includes;../../../api_scilab/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCICOS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <WarningLevel>Level3</WarningLevel>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../../../core/includes;../../../../output_stream/includes;../../../../api_scilab/includes;../../../includes;../../../../../libs/intl;../../../../intersci/includes;../../../api_scilab/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCICOS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <WarningLevel>Level3</WarningLevel>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="noscicos.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="noscicos.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\..\..\tools\Dumpexts\Dumpexts.vcxproj">
+ <Project>{3170e4c2-1173-4264-a222-7ee8ccb3ddf7}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\localization\src\localization.vcxproj">
+ <Project>{ecffeb0c-1eda-45ee-9a10-b18143852e17}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\output_stream\src\c\output_stream.vcxproj">
+ <Project>{a5911cd7-f8e8-440c-a23e-4843a0636f3a}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/modules/scicos/src/c/noscicos/noscicos.vcxproj.filters b/modules/scicos/src/c/noscicos/noscicos.vcxproj.filters
new file mode 100755
index 000000000..a01f95a92
--- /dev/null
+++ b/modules/scicos/src/c/noscicos/noscicos.vcxproj.filters
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ <Filter Include="Libraries Dependencies">
+ <UniqueIdentifier>{5a1d3fbb-ccbf-48a4-915c-682a2bdd67d9}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="noscicos.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="noscicos.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/modules/scicos/src/c/sciblk2.c b/modules/scicos/src/c/sciblk2.c
new file mode 100755
index 000000000..18d898f51
--- /dev/null
+++ b/modules/scicos/src/c/sciblk2.c
@@ -0,0 +1,235 @@
+/* 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 "MALLOC.h"
+/*--------------------------------------------------------------------------*/
+extern int C2F(scierr)();
+extern void C2F(itosci)();
+extern void C2F(dtosci)();
+extern void C2F(vvtosci)();
+extern void C2F(scitovv)();
+extern void C2F(skipvars)();
+extern void C2F(scitod)();
+extern void C2F(list2vars)();
+extern void C2F(ltopadj)();
+extern void C2F(scifunc)();
+extern void C2F(mklist)();
+/*--------------------------------------------------------------------------*/
+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;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/sciblk2.h b/modules/scicos/src/c/sciblk2.h
new file mode 100755
index 000000000..ff0cb6c4a
--- /dev/null
+++ b/modules/scicos/src/c/sciblk2.h
@@ -0,0 +1,33 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* 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
+*/
+/*--------------------------------------------------------------------------*/
+#ifndef __SCIBLK2_H__
+#define __SCIBLK2_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);
+
+
+#endif /* __SCIBLK2_H__ */
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/sciblk4.c b/modules/scicos/src/c/sciblk4.c
new file mode 100755
index 000000000..faf211dc3
--- /dev/null
+++ b/modules/scicos/src/c/sciblk4.c
@@ -0,0 +1,874 @@
+/* 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 <string.h>
+#include <stdio.h>
+#include "stack-c.h"
+#include "scicos_block4.h"
+#include "Scierror.h"
+#include "scicos.h"
+#include "sciblk4.h"
+#include "import.h"
+#include "createblklist.h"
+#include "localization.h"
+#include "MALLOC.h"
+/*--------------------------------------------------------------------------*/
+/* Define external function */
+extern int C2F(scierr)();
+extern void C2F(scifunc)();
+extern int *listentry(int *header, int i);
+extern void C2F(itosci)();
+/*--------------------------------------------------------------------------*/
+static int sci2var(void *x, void *y, int typ_var);
+/*--------------------------------------------------------------------------*/
+void sciblk4(scicos_block *Blocks, int flag)
+{
+ /*counter and address variable declaration*/
+ int i = 0, j = 0, k = 0, topsave = 0;
+ int ierr = 0;
+ int kfun = 0;
+
+ int *header = NULL, ne1 = 0;
+ double *le111 = NULL;
+
+ int *il_xd = NULL, *il_res = NULL, *il_out = NULL, *il_outptr = NULL;
+ int *il_xprop = NULL;
+
+ int *il_z = NULL, *il_oz = NULL, *il_ozptr = NULL, *il_x = NULL;
+ int *il_mode = NULL, *il_evout = NULL, *il_g = NULL;
+ double *l_mode = NULL;
+ double *l_xprop = NULL;
+
+ /* variable for output typed port */
+ int nout = 0;
+
+ int nv = 0, mv = 0;
+ int *ptr = NULL, *funtyp = NULL;
+
+ /* set number of left and right hand side parameters */
+ int mlhs = 1, mrhs = 2;
+
+ /* Save Top counter */
+ topsave = Top;
+
+ /* Retrieve block number */
+ kfun = get_block_number();
+
+ /* Retrieve funtyp by import structure */
+ strcpy(C2F(cha1).buf, "funtyp");
+ ierr = getscicosvarsfromimport(C2F(cha1).buf, (void**)&ptr, &nv, &mv);
+ if (ierr == 0)
+ {
+ goto err;
+ }
+ funtyp = (int *) ptr;
+
+ /****************************
+ * create scilab tlist Blocks
+ ****************************/
+ if ((createblklist(&Blocks[0], &ierr, (i = -1), funtyp[kfun - 1])) == 0)
+ {
+ goto err;
+ }
+
+ /* * flag * */
+ C2F(itosci)(&flag, (i = 1, &i), (j = 1, &j));
+ if (C2F(scierr)() != 0)
+ {
+ goto err;
+ }
+
+ /**********************
+ * Call scilab function
+ **********************/
+ C2F(scifunc)(&mlhs, &mrhs);
+ if (C2F(scierr)() != 0)
+ {
+ goto err;
+ }
+
+ /***************************
+ * Update C block structure
+ **************************/
+ /* get header of output variable Blocks of sciblk4 */
+ header = (int *) stk(*Lstk(Top));
+
+ /* switch to appropriate flag */
+ switch (flag)
+ {
+
+ /**************************
+ * update continuous state
+ **************************/
+ case 0 :
+ {
+ if (Blocks[0].nx != 0)
+ {
+ /* 14 - xd */
+ il_xd = (int *) listentry(header, 14);
+ ierr = sci2var(il_xd, Blocks[0].xd, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+
+ if ((funtyp[kfun - 1] == 10004) || (funtyp[kfun - 1] == 10005))
+ {
+ /* 15 - res */
+ il_res = (int *) listentry(header, 15);
+ ierr = sci2var(il_res, Blocks[0].res, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+ }
+ break;
+
+ /**********************
+ * update output state
+ **********************/
+ case 1 :
+ {
+ /* 21 - outptr */
+ if (Blocks[0].nout != 0)
+ {
+ il_out = (int*) listentry(header, 21);
+ nout = il_out[1];
+
+ for (j = 0; j < nout; j++)
+ {
+ il_outptr = (int *) listentry(il_out, j + 1);
+ ierr = sci2var(il_outptr, Blocks[0].outptr[j], Blocks[0].outsz[2 * nout + j]);
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+ }
+ break;
+
+ /***********************
+ * update discrete state
+ ***********************/
+ case 2 :
+ {
+ /* 7 - z */
+ if (Blocks[0].nz != 0)
+ {
+ il_z = (int *) listentry(header, 7);
+ if (Blocks[0].scsptr > 0)
+ {
+ le111 = (double *) listentry(header, 7);
+ ne1 = header[7 + 2] - header[7 + 1];
+ C2F(unsfdcopy)(&ne1, le111, (i = -1, &i), Blocks[0].z, (j = -1, &j));
+ }
+ else
+ {
+ ierr = sci2var(il_z, Blocks[0].z, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+
+ /* 11 - oz */
+ if (Blocks[0].noz != 0)
+ {
+ il_oz = (int *) listentry(header, 11);
+ /* C blocks : extract */
+ if ((funtyp[kfun - 1] == 4) || (funtyp[kfun - 1] == 10004))
+ {
+ for (j = 0; j < Blocks[0].noz; j++)
+ {
+ il_ozptr = (int *) listentry(il_oz, j + 1);
+ if (Blocks[0].oztyp[j] == SCSUNKNOW_N)
+ {
+ ne1 = Blocks[0].ozsz[j];
+ C2F(unsfdcopy)(&ne1, (double *)il_ozptr, \
+ (i = 1, &i), (double *)Blocks[0].ozptr[j], (k = 1, &k));
+ }
+ else
+ {
+ ierr = sci2var(il_ozptr, Blocks[0].ozptr[j], Blocks[0].oztyp[j]);
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+ }
+ /* sci blocks : don't extract */
+ else if ((funtyp[kfun - 1] == 5) || (funtyp[kfun - 1] == 10005))
+ {
+ ne1 = Blocks[0].ozsz[0];
+ C2F(unsfdcopy)(&ne1, (double *)il_oz, \
+ (i = 1, &i), (double *)Blocks[0].ozptr[0], (j = 1, &j));
+ }
+ }
+
+ if (Blocks[0].nx != 0)
+ {
+ /* 13 - x */
+ il_x = (int *) listentry(header, 13);
+ ierr = sci2var(il_x, Blocks[0].x, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+
+ /* 14 - xd */
+ il_xd = (int *) listentry(header, 14);
+ ierr = sci2var(il_xd, Blocks[0].xd, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+ break;
+
+ /***************************
+ * update event output state
+ ***************************/
+ case 3 :
+ {
+ /* 23 - evout */
+ il_evout = (int *) listentry(header, 23);
+ ierr = sci2var(il_evout, Blocks[0].evout, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ break;
+
+ /**********************
+ * state initialisation
+ **********************/
+ case 4 :
+ {
+ /* 7 - z */
+ if (Blocks[0].nz != 0)
+ {
+ il_z = (int *) listentry(header, 7);
+ if (Blocks[0].scsptr > 0)
+ {
+ le111 = (double *) listentry(header, 7);
+ ne1 = header[7 + 2] - header[7 + 1];
+ C2F(unsfdcopy)(&ne1, le111, (i = -1, &i), Blocks[0].z, (j = -1, &j));
+ }
+ else
+ {
+ ierr = sci2var(il_z, Blocks[0].z, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+
+ /* 11 - oz */
+ if (Blocks[0].noz != 0)
+ {
+ il_oz = (int *) listentry(header, 11);
+ /* C blocks : extract */
+ if ((funtyp[kfun - 1] == 4) || (funtyp[kfun - 1] == 10004))
+ {
+ for (j = 0; j < Blocks[0].noz; j++)
+ {
+ il_ozptr = (int *) listentry(il_oz, j + 1);
+ if (Blocks[0].oztyp[j] == SCSUNKNOW_N)
+ {
+ ne1 = Blocks[0].ozsz[j];
+ C2F(unsfdcopy)(&ne1, (double *)il_ozptr, \
+ (i = 1, &i), (double *)Blocks[0].ozptr[j], (k = 1, &k));
+ }
+ else
+ {
+ ierr = sci2var(il_ozptr, Blocks[0].ozptr[j], Blocks[0].oztyp[j]);
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+ }
+ /* sci blocks : don't extract */
+ else if ((funtyp[kfun - 1] == 5) || (funtyp[kfun - 1] == 10005))
+ {
+ ne1 = Blocks[0].ozsz[0];
+ C2F(unsfdcopy)(&ne1, (double *)il_oz, \
+ (i = 1, &i), (double *)Blocks[0].ozptr[0], (j = 1, &j));
+ }
+ }
+
+ if (Blocks[0].nx != 0)
+ {
+ /* 13 - x */
+ il_x = (int *) listentry(header, 13);
+ ierr = sci2var(il_x, Blocks[0].x, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+
+ /* 14 - xd */
+ il_xd = (int *) listentry(header, 14);
+ ierr = sci2var(il_xd, Blocks[0].xd, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+ break;
+
+ /*********
+ * finish
+ *********/
+ case 5 :
+ {
+ /* 7 - z */
+ if (Blocks[0].nz != 0)
+ {
+ il_z = (int *) listentry(header, 7);
+ if (Blocks[0].scsptr > 0)
+ {
+ le111 = (double *) listentry(header, 7);
+ ne1 = header[7 + 2] - header[7 + 1];
+ C2F(unsfdcopy)(&ne1, le111, (i = -1, &i), Blocks[0].z, (j = -1, &j));
+ }
+ else
+ {
+ ierr = sci2var(il_z, Blocks[0].z, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+
+ /* 11 - oz */
+ if (Blocks[0].noz != 0)
+ {
+ il_oz = (int *) listentry(header, 11);
+ /* C blocks : extract */
+ if ((funtyp[kfun - 1] == 4) || (funtyp[kfun - 1] == 10004))
+ {
+ for (j = 0; j < Blocks[0].noz; j++)
+ {
+ il_ozptr = (int *) listentry(il_oz, j + 1);
+ if (Blocks[0].oztyp[j] == SCSUNKNOW_N)
+ {
+ ne1 = Blocks[0].ozsz[j];
+ C2F(unsfdcopy)(&ne1, (double *)il_ozptr, \
+ (i = 1, &i), (double *)Blocks[0].ozptr[j], (k = 1, &k));
+ }
+ else
+ {
+ ierr = sci2var(il_ozptr, Blocks[0].ozptr[j], Blocks[0].oztyp[j]);
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+ }
+ /* sci blocks : don't extract */
+ else if ((funtyp[kfun - 1] == 5) || (funtyp[kfun - 1] == 10005))
+ {
+ ne1 = Blocks[0].ozsz[0];
+ C2F(unsfdcopy)(&ne1, (double *)il_oz, \
+ (i = 1, &i), (double *)Blocks[0].ozptr[0], (j = 1, &j));
+ }
+ }
+ }
+ break;
+
+ /*****************************
+ * output state initialisation
+ *****************************/
+ case 6 :
+ {
+ /* 7 - z */
+ if (Blocks[0].nz != 0)
+ {
+ il_z = (int *) listentry(header, 7);
+ if (Blocks[0].scsptr > 0)
+ {
+ le111 = (double *) listentry(header, 7);
+ ne1 = header[7 + 2] - header[7 + 1];
+ C2F(unsfdcopy)(&ne1, le111, (i = -1, &i), Blocks[0].z, (j = -1, &j));
+ }
+ else
+ {
+ ierr = sci2var(il_z, Blocks[0].z, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+
+ /* 11 - oz */
+ if (Blocks[0].noz != 0)
+ {
+ il_oz = (int *) listentry(header, 11);
+ /* C blocks : extract */
+ if ((funtyp[kfun - 1] == 4) || (funtyp[kfun - 1] == 10004))
+ {
+ for (j = 0; j < Blocks[0].noz; j++)
+ {
+ il_ozptr = (int *) listentry(il_oz, j + 1);
+ if (Blocks[0].oztyp[j] == SCSUNKNOW_N)
+ {
+ ne1 = Blocks[0].ozsz[j];
+ C2F(unsfdcopy)(&ne1, (double *)il_ozptr, \
+ (i = 1, &i), (double *)Blocks[0].ozptr[j], (k = 1, &k));
+ }
+ else
+ {
+ ierr = sci2var(il_ozptr, Blocks[0].ozptr[j], Blocks[0].oztyp[j]);
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+ }
+ /* sci blocks : don't extract */
+ else if ((funtyp[kfun - 1] == 5) || (funtyp[kfun - 1] == 10005))
+ {
+ ne1 = Blocks[0].ozsz[0];
+ C2F(unsfdcopy)(&ne1, (double *)il_oz, \
+ (i = 1, &i), (double *)Blocks[0].ozptr[0], (j = 1, &j));
+ }
+ }
+
+ if (Blocks[0].nx != 0)
+ {
+ /* 13 - x */
+ il_x = (int *) listentry(header, 13);
+ ierr = sci2var(il_x, Blocks[0].x, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+
+ /* 14 - xd */
+ il_xd = (int *) listentry(header, 14);
+ ierr = sci2var(il_xd, Blocks[0].xd, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+
+ /* 21 - outptr */
+ if (Blocks[0].nout != 0)
+ {
+ il_out = (int *) listentry(header, 21);
+ nout = il_out[1];
+ for (j = 0; j < nout; j++)
+ {
+ il_outptr = (int *) listentry(il_out, j + 1);
+ ierr = sci2var(il_outptr, Blocks[0].outptr[j], Blocks[0].outsz[2 * nout + j]);
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+ }
+ break;
+
+ /*******************************************
+ * define property of continuous time states
+ * (algebraic or differential states)
+ *******************************************/
+ case 7 :
+ {
+ if (Blocks[0].nx != 0)
+ {
+ /* 40 - x */
+ il_xprop = (int *) listentry(header, 40);
+ l_xprop = (double *)(il_xprop + 4);
+ for (nv = 0; nv < Blocks[0].nx; nv++)
+ {
+ Blocks[0].xprop[nv] = (int) l_xprop[nv];
+ }
+ }
+ }
+ break;
+
+ /****************************
+ * zero crossing computation
+ ****************************/
+ case 9 :
+ {
+ /* 33 - g */
+ il_g = (int *) listentry(header, 33);
+ ierr = sci2var(il_g, Blocks[0].g, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+
+ if (get_phase_simulation() == 1)
+ {
+ /* 39 - mode */
+ il_mode = (int *) listentry(header, 39);
+ // Alan, 16/10/07 : fix : mode is an int array
+ l_mode = (double *)(il_mode + 4);
+ for (nv = 0; nv < (il_mode[1]*il_mode[2]); nv++)
+ {
+ Blocks[0].mode[nv] = (int) l_mode[nv];
+ }
+ //ierr=sci2var(il_mode,Blocks[0].mode,SCSINT_N); /* int */
+ //if (ierr!=0) goto err;
+ }
+ }
+ break;
+
+ /**********************
+ * Jacobian computation
+ **********************/
+ case 10 :
+ {
+ if ((funtyp[kfun - 1] == 10004) || (funtyp[kfun - 1] == 10005))
+ {
+ /* 15 - res */
+ il_res = (int *) listentry(header, 15);
+ ierr = sci2var(il_res, Blocks[0].res, SCSREAL_N); /* double */
+ if (ierr != 0)
+ {
+ goto err;
+ }
+ }
+ }
+ break;
+ }
+
+ /* Restore initial position Top */
+ Top = topsave;
+ return;
+
+ /* if error then restore initial position Top
+ * and set_block_error with flag -1 */
+err:
+ Top = topsave;
+ if (ierr != 0) /*var2sci or sci2var error*/
+ {
+ /* Please update me !*/
+ if (ierr < 1000) /*var2sci error*/
+ {
+ switch (ierr)
+ {
+ case 1 :
+ Scierror(888, _("%s: error %d. Stack is full.\n"), "var2sci", ierr);
+ break;
+
+ case 2 :
+ Scierror(888, _("%s: error %d. No more space on the stack for new data.\n"), "var2sci", ierr);
+ break;
+
+ default :
+ Scierror(888, _("%s: error %d. Undefined error.\n"), "var2sci", ierr);
+ break;
+ }
+ }
+ else /*sci2var error*/
+ {
+ switch (ierr)
+ {
+ case 1001 :
+ Scierror(888, _("%s: error %d. Only int or double object are accepted.\n"), "sci2var", ierr);
+ break;
+
+ case 1002 :
+ Scierror(888, _("%s: error %d. Bad double object sub_type.\n"), "sci2var", ierr);
+ break;
+
+ case 1003 :
+ Scierror(888, _("%s: error %d. Bad int object sub_type.\n"), "sci2var", ierr);
+ break;
+
+ case 1004 :
+ Scierror(888, _("%s: error %d. A type of a scilab object has changed.\n"), "sci2var", ierr);
+ break;
+
+ default :
+ Scierror(888, _("%s: error %d. Undefined error.\n"), "sci2var", ierr);
+ break;
+ }
+ }
+ }
+ set_block_error(-1);
+}
+/*--------------------------------------------------------------------------*/
+/* sci2var function to convert scilab object
+ * to an array of scicos blocks.
+ *
+ * Input parameters :
+ * *x : void ptr of scilab object.
+ * *y : void ptr of scicos blocks array.
+ * typ_var : integer, type of scicos data :
+ * SCSREAL_N : double real
+ * SCSCOMPLEX_N : double complex
+ * SCSINT_N : int
+ * SCSINT8_N : int8
+ * SCSINT16_N : int16
+ * SCSINT32_N : int32
+ * SCSUINT _N : uint
+ * SCSUINT8_N : uint8
+ * SCSUINT16_N : uint16
+ * SCSUINT32_N : uint32
+ * SCSUNKNOW_N :
+ *
+ * Output parameters : int (>1000), error flag
+ * (0 if no error)
+ *
+ * 15/06/06, Alan : Initial version.
+ *
+ */
+
+/* prototype */
+static int sci2var(void *x, void *y, int typ_var)
+{
+ /************************************
+ * variables and constants definition
+ ************************************/
+ /* counter and address variable declaration */
+ int err, i, j;
+
+ /* variables to store n,m and type of scilab object */
+ int n, m, nm, typ, sub_typ;
+
+ /* define int *header */
+ int *header;
+
+ /*define all type of accepted ptr */
+ SCSREAL_COP *ptr_d, *y_d;
+ SCSINT8_COP *ptr_c, *y_c;
+ SCSUINT8_COP *ptr_uc, *y_uc;
+ SCSINT16_COP *ptr_s, *y_s;
+ SCSUINT16_COP *ptr_us, *y_us;
+ SCSINT_COP *ptr_i, *y_i;
+ SCSUINT_COP *ptr_ui, *y_ui;
+ SCSINT32_COP *ptr_l, *y_l;
+ SCSUINT32_COP *ptr_ul, *y_ul;
+
+ /*****************************************
+ * get header,n,m and typ of scilab object
+ *****************************************/
+ /* retrieve header address */
+ header = (int *) x;
+
+ /* retieve number of rows and columns */
+ n = header[1];
+ m = header[2];
+
+ /* retrieve type of scilab object */
+ typ = header[0];
+
+ /* Test if scilab object is a typed scicos
+ * accepted data */
+ if ((typ != 1) & (typ != 8))
+ {
+ err = 1001;
+ return err;
+ }
+
+ /* retrieve sub_type of scilab object */
+ sub_typ = header[3];
+
+ /* cross type of data checking
+ * and copy scilab object in
+ * scicos blocks array structure
+ */
+ switch (typ)
+ {
+ case 1 :
+ {
+ /*check type of double matrix*/
+ if ((sub_typ != 0) & (sub_typ != 1))
+ {
+ err = 1002;
+ return err;
+ }
+ if ((sub_typ == 0) & (typ_var != SCSREAL_N))
+ {
+ err = 1004;
+ return err;
+ }
+ if ((sub_typ == 1) & (typ_var != SCSCOMPLEX_N))
+ {
+ err = 1004;
+ return err;
+ }
+
+ /*copy double matrix*/
+ switch (sub_typ)
+ {
+ case 0 :
+ nm = n * m;
+ ptr_d = (SCSREAL_COP *) (header + 4);
+ y_d = (SCSREAL_COP *) y;
+ C2F(unsfdcopy)(&nm, ptr_d, (i = -1, &i), y_d, (j = -1, &j));
+ break;
+
+ case 1 :
+ nm = 2 * n * m;
+ ptr_d = (SCSCOMPLEX_COP *) (header + 4);
+ y_d = (SCSCOMPLEX_COP *) y;
+ C2F(unsfdcopy)(&nm, ptr_d, (i = -1, &i), y_d, (j = -1, &j));
+ break;
+ }
+ }
+ break;
+
+ case 8 :
+ {
+ /*check type of int matrix*/
+ if ((sub_typ != 1) && (sub_typ != 2) && (sub_typ != 4) &&
+ (sub_typ != 11) && (sub_typ != 12) && (sub_typ != 14))
+ {
+ err = 1003;
+ return err;
+ }
+ if ((sub_typ == 1) & (typ_var != SCSINT8_N))
+ {
+ err = 1004;
+ return err;
+ }
+ if ((sub_typ == 2) & (typ_var != SCSINT16_N))
+ {
+ err = 1004;
+ return err;
+ }
+ if ((sub_typ == 4) & (typ_var != SCSINT_N) & (typ_var != SCSINT32_N))
+ {
+ err = 1004;
+ return err;
+ }
+ if ((sub_typ == 11) & (typ_var != SCSUINT8_N))
+ {
+ err = 1004;
+ return err;
+ }
+ if ((sub_typ == 12) & (typ_var != SCSUINT16_N))
+ {
+ err = 1004;
+ return err;
+ }
+ if ((sub_typ == 14) & (typ_var != SCSUINT_N) & (typ_var != SCSUINT32_N))
+ {
+ err = 1004;
+ return err;
+ }
+
+ /*copy int matrix*/
+ switch (typ_var)
+ {
+ case SCSINT_N :
+ ptr_i = (SCSINT_COP *) (header + 4);
+ y_i = (SCSINT_COP *) y;
+ for (i = 0; i < n * m; i++)
+ {
+ y_i[i] = ptr_i[i];
+ }
+ break;
+
+ case SCSINT8_N :
+ ptr_c = (SCSINT8_COP *) (header + 4);
+ y_c = (SCSINT8_COP *) y;
+ for (i = 0; i < n * m; i++)
+ {
+ y_c[i] = ptr_c[i];
+ }
+ break;
+
+ case SCSINT16_N :
+ ptr_s = (SCSINT16_COP *) (header + 4);
+ y_s = (SCSINT16_COP *) y;
+ for (i = 0; i < n * m; i++)
+ {
+ y_s[i] = ptr_s[i];
+ }
+ break;
+
+ case SCSINT32_N :
+ ptr_l = (SCSINT32_COP *) (header + 4);
+ y_l = (SCSINT32_COP *) y;
+ for (i = 0; i < n * m; i++)
+ {
+ y_l[i] = ptr_l[i];
+ }
+ break;
+
+ case SCSUINT_N :
+ ptr_ui = (SCSUINT_COP *) (header + 4);
+ y_ui = (SCSUINT_COP *) y;
+ for (i = 0; i < n * m; i++)
+ {
+ y_ui[i] = ptr_ui[i];
+ }
+ break;
+
+ case SCSUINT8_N :
+ ptr_uc = (SCSUINT8_COP *) (header + 4);
+ y_uc = (SCSUINT8_COP *) y;
+ for (i = 0; i < n * m; i++)
+ {
+ y_uc[i] = ptr_uc[i];
+ }
+ break;
+
+ case SCSUINT16_N :
+ ptr_us = (SCSUINT16_COP *) (header + 4);
+ y_us = (SCSUINT16_COP *) y;
+ for (i = 0; i < n * m; i++)
+ {
+ y_us[i] = ptr_us[i];
+ }
+ break;
+
+ case SCSUINT32_N :
+ ptr_ul = (SCSUINT32_COP *) (header + 4);
+ y_ul = (SCSUINT32_COP *) y;
+ for (i = 0; i < n * m; i++)
+ {
+ y_ul[i] = ptr_ul[i];
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ /* return error flag = 0 */
+ err = 0;
+ return 0;
+}
diff --git a/modules/scicos/src/c/sciblk4.h b/modules/scicos/src/c/sciblk4.h
new file mode 100755
index 000000000..b9fe5aaf1
--- /dev/null
+++ b/modules/scicos/src/c/sciblk4.h
@@ -0,0 +1,101 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* 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
+*/
+/*--------------------------------------------------------------------------*/
+#ifndef __SCIBLK4_H__
+#define __SCIBLK4_H__
+
+#include "scicos_block4.h"
+
+/* sciblk4. Run scilab block type 5.
+*
+* Input parameters :
+* Blocks : Tlist
+* - 1 : Blocks(1) : !scicos_block nevprt funpt type scsptr nz
+* z nx x xd res nin
+* insz inptr nout outsz outptr nevout
+* evout nrpar rpar nipar ipar ng
+* g ztyp jroot label work nmode
+* mode !
+* - 2 : Blocks.nevprt :
+* - 3 : Blocks.funpt :
+* - 4 : Blocks.type :
+* - 5 : Blocks.scsptr :
+* - 6 : Blocks.nz :
+* - 7 : Blocks.z :
+* - 8 : Blocks.noz :
+* - 9 : Blocks.ozsz :
+* - 10 : Blocks.oztyp :
+* - 11 : Blocks.oz :
+* - 12 : Blocks.nx :
+* - 13 : Blocks.x :
+* - 14 : Blocks.xd :
+* - 15 : Blocks.res :
+* - 16 : Blocks.nin :
+* - 17 : Blocks.insz :
+* - 18 : Blocks.inptr :
+* - 19 : Blocks.nout :
+* - 20 : Blocks.outsz :
+* - 21 : Blocks.outptr :
+* - 22 : Blocks.nevout :
+* - 23 : Blocks.evout :
+* - 24 : Blocks.nrpar :
+* - 25 : Blocks.rpar :
+* - 26 : Blocks.nipar :
+* - 27 : Blocks.ipar :
+* - 28 : Blocks.nopar :
+* - 29 : Blocks.oparsz :
+* - 30 : Blocks.opartyp :
+* - 31 : Blocks.opar :
+* - 32 : Blocks.ng :
+* - 33 : Blocks.g :
+* - 34 : Blocks.ztyp :
+* - 35 : Blocks.jroot :
+* - 36 : Blocks.label :
+* - 37 : Blocks.work :
+* - 38 : Blocks.nmode :
+* - 39 : Blocks.mode :
+*
+* flag : integer
+* 0 : update continuous state
+* 1 : update output state
+* 2 : update state
+* 3 : update event output state
+* 4 : state initialisation
+* 5 : finish
+* 6 : output state initialisation
+* 7 : define property of continuous time states
+* 9 : zero crossing surface computation
+* 10 : Jacobian computation
+*
+* Output parameters :
+* Blocks : Scilab Tlist (updated blocks Scilab list)
+*
+* 08/06/06, Alan : Rewritten from original code of sciblk4.c
+* of scicos 2.7.
+* 09/02/07, Alan : Add oz as a discrete state
+* Update taking to account implicit/explicit call of simulator
+* for some output elements
+*/
+
+void sciblk4(scicos_block *Blocks, int flag);
+
+#endif /* __SCIBLK4_H__ */
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/scicos.c b/modules/scicos/src/c/scicos.c
new file mode 100755
index 000000000..18e12522f
--- /dev/null
+++ b/modules/scicos/src/c/scicos.c
@@ -0,0 +1,7147 @@
+/* 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
+*/
+/* 11-03-2005, Masoud
+* adding A-Jacobian
+* istate =-1 case;
+*
+* xx/03/06, Alan
+* enable matrix typed
+* input/output regular ports
+*
+* xx/02/07, Alan
+* added object paramaters/states
+*
+* 20/07/07, Masoud
+* CVODE (Sundials) replaced LSODAR
+* IDA (Sundials) replaced DASKR
+*/
+/*--------------------------------------------------------------------------*/
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+/* Sundials includes */
+#include <cvode/cvode.h> /* prototypes for CVODES fcts. and consts. */
+#include <cvode/cvode_dense.h> /* prototype for CVDense */
+#include <cvode/cvode_direct.h> /* prototypes for various DlsMat operations */
+#include <ida/ida.h>
+#include <ida/ida_dense.h>
+#include <ida/ida_direct.h>
+#include <nvector/nvector_serial.h> /* serial N_Vector types, fcts., and macros */
+#include <sundials/sundials_dense.h> /* prototypes for various DlsMat operations */
+#include <sundials/sundials_direct.h> /* definitions of DlsMat and DENSE_ELEM */
+#include <sundials/sundials_types.h> /* definition of type realtype */
+#include <sundials/sundials_math.h>
+#include <kinsol/kinsol.h>
+#include <kinsol/kinsol_dense.h>
+#include <kinsol/kinsol_direct.h>
+#include <sundials/sundials_extension.h> /* uses extension for scicos */
+#include "ida_impl.h"
+
+#include "machine.h" /* C2F */
+#include "dynamic_link.h"
+#include "scicos-def.h"
+#include "stack-def.h"
+#include "sciprint.h"
+#include "scicos.h"
+#include "import.h"
+#include "scicos_internal.h"
+#include "blocks.h"
+#include "core_math.h"
+#include "storeCommand.h"
+#include "syncexec.h"
+#include "realtime.h"
+#include "MALLOC.h"
+#include "cvstr.h"
+#include "ezxml.h"
+#include "xscion.h"
+
+#include "sciblk2.h"
+#include "sciblk4.h"
+#include "dynlib_scicos.h"
+
+#include "lsodar.h" /* prototypes for lsodar fcts. and consts. */
+#include "ddaskr.h" /* prototypes for ddaskr fcts. and consts. */
+
+#if defined(linux) && defined(__i386__)
+#include "setPrecisionFPU.h"
+#endif
+
+#include "localization.h"
+#include "charEncoding.h"
+/*--------------------------------------------------------------------------*/
+typedef struct
+{
+ void *dae_mem;
+ N_Vector ewt;
+ double *rwork;
+ int *iwork;
+ double *gwork; /* just added for a very special use: a
+ space passing to grblkdakr for zero crossing surfaces
+ when updating mode variables during initialization */
+} *UserData;
+
+SCICOS_IMPEXP SCSPTR_struct C2F(scsptr);
+
+enum Solver
+{
+ LSodar_Dynamic = 0,
+ CVode_BDF_Newton,
+ CVode_BDF_Functional,
+ CVode_Adams_Newton,
+ CVode_Adams_Functional,
+ Dormand_Prince,
+ Runge_Kutta,
+ Implicit_Runge_Kutta,
+ IDA_BDF_Newton = 100,
+ DDaskr_BDF_Newton = 101,
+ DDaskr_BDF_GMRes = 102
+};
+/*--------------------------------------------------------------------------*/
+
+#define freeall \
+ if (*neq>0) ODEFree(&ode_mem); \
+ if (*neq>0) N_VDestroy_Serial(y); \
+ if ( ng>0 ) FREE(jroot); \
+ if ( ng>0 ) FREE(zcros);
+
+
+/* TJacque allocated by sundials */
+#define freeallx \
+ if (*neq>0) free(TJacque); \
+ if (*neq>0) FREE(data->rwork); \
+ if (( ng>0 )&& (*neq>0)) FREE(data->gwork); \
+ if (*neq>0) N_VDestroy_Serial(data->ewt); \
+ if (*neq>0) FREE(data); \
+ if (*neq>0) DAEFree(&dae_mem); \
+ if (*neq>0) N_VDestroy_Serial(IDx); \
+ if (*neq>0) N_VDestroy_Serial(yp); \
+ if (*neq>0) N_VDestroy_Serial(yy); \
+ if ( ng>0 ) FREE(jroot); \
+ if ( ng>0 ) FREE(zcros); \
+ if (nmod>0) FREE(Mode_save);
+
+#define freeouttbptr \
+ FREE(outtbd); \
+ FREE(outtbc); \
+ FREE(outtbs); \
+ FREE(outtbl); \
+ FREE(outtbuc); \
+ FREE(outtbus); \
+ FREE(outtbul);
+
+#define freekinsol \
+ FREE(Mode_save); \
+ N_VDestroy_Serial(y); \
+ N_VDestroy_Serial(fscale); \
+ N_VDestroy_Serial(yscale); \
+ KINFree(&kin_mem);
+
+
+#define ONE RCONST(1.0)
+#define ZERO RCONST(0.0)
+#define T0 RCONST(0.0)
+/*--------------------------------------------------------------------------*/
+/* Table of constant values */
+static int c__90 = 90;
+static int c__91 = 91;
+static int c__0 = 0;
+static double c_b14 = 0.;
+static int c__1 = 1;
+
+int TCritWarning = 0;
+
+static double *t0 = NULL, *tf = NULL;
+static double *x = NULL, *tevts = NULL, *xd = NULL, *g = NULL;
+static double Atol = 0., rtol = 0., ttol = 0., deltat = 0., hmax = 0.;
+static int *ierr = NULL;
+static int *pointi = NULL;
+static int *xptr = NULL, *modptr = NULL, *evtspt = NULL;
+static int *funtyp = NULL, *inpptr = NULL, *outptr = NULL, *inplnk = NULL, *outlnk = NULL;
+static int *clkptr = NULL, *ordptr = NULL, *ordclk = NULL, *cord = NULL, *iord = NULL, *oord = NULL, *zord = NULL, *critev = NULL, *zcptr = NULL;
+static int nblk = 0, nordptr = 0, nlnk = 0, nx = 0, ng = 0, ncord = 0, noord = 0, nzord = 0;
+static int nordclk = 0, niord = 0, nmod = 0;
+static int nelem = 0;
+static int *mod = NULL;
+static int *neq = NULL;
+static int *xprop = NULL; /* xproperty */
+static int debug_block = 0;
+static int *iwa = NULL;
+static int hot;
+
+/* declaration of ptr for typed port */
+static void **outtbptr = NULL; /*pointer array of object of outtb*/
+static int *outtbsz = NULL; /*size of object of outtb*/
+static int *outtbtyp = NULL; /*type of object of outtb*/
+
+SCSREAL_COP *outtbdptr = NULL; /*to store double of outtb*/
+SCSINT8_COP *outtbcptr = NULL; /*to store int8 of outtb*/
+SCSINT16_COP *outtbsptr = NULL; /*to store int16 of outtb*/
+SCSINT32_COP *outtblptr = NULL; /*to store int32 of outtb*/
+SCSUINT8_COP *outtbucptr = NULL; /*to store unsigned int8 of outtb */
+SCSUINT16_COP *outtbusptr = NULL; /*to store unsigned int16 of outtb */
+SCSUINT32_COP *outtbulptr = NULL; /*to store unsigned int32 of outtb */
+
+static outtb_el *outtb_elem = NULL;
+
+static scicos_block *Blocks = NULL;
+
+/* pass to external variable for code generation */
+/* reserved variable name */
+int *block_error = NULL;
+double scicos_time = 0.;
+int phase = 0;
+int Jacobian_Flag = 0;
+// double CI = 0., CJ = 0.; // doubles returned by Get_Jacobian_ci and Get_Jacobian_cj respectively
+double CJJ = 0.; // returned by Get_Jacobian_parameter
+double SQuround = 0.;
+/* Jacobian*/
+static int AJacobian_block = 0;
+
+
+/* Variable declaration moved to scicos.c because it was in the scicos-def.h therefore
+* multiple declaration of the variable and linkers were complaining about duplicate
+* symbols
+*/
+SCICOS_IMPEXP COSDEBUGCOUNTER_struct C2F(cosdebugcounter);
+SCICOS_IMPEXP RTFACTOR_struct C2F(rtfactor);
+SCICOS_IMPEXP SOLVER_struct C2F(cmsolver);
+SCICOS_IMPEXP CURBLK_struct C2F(curblk);
+SCICOS_IMPEXP COSDEBUG_struct C2F(cosdebug);
+SCICOS_IMPEXP COSHLT_struct C2F(coshlt);
+SCICOS_IMPEXP DBCOS_struct C2F(dbcos);
+SCICOS_IMPEXP COSTOL_struct C2F(costol);
+SCICOS_IMPEXP COSERR_struct coserr;
+/*--------------------------------------------------------------------------*/
+static void FREE_blocks();
+static void cosini(double *told);
+static void cosend(double *told);
+static void cossim(double *told);
+static void cossimdaskr(double *told);
+static void doit(double *told);
+static void idoit(double *told);
+static void zdoit(double *told, double *xt, double *xtd, double *g);
+static void cdoit(double *told);
+static void ozdoit(double *told, double *xt, double *xtd, int *kiwa);
+static void odoit(double *told, double *xt, double *xtd, double *residual);
+static void ddoit(double *told);
+static void edoit(double *told, int *kiwa);
+static void reinitdoit(double *told);
+static int CallKinsol(double *told);
+static int simblk(realtype t, N_Vector yy, N_Vector yp, void *f_data);
+static int grblkdaskr(realtype t, N_Vector yy, N_Vector yp, realtype *gout, void *g_data);
+static int grblk(realtype t, N_Vector yy, realtype *gout, void *g_data);
+static void simblklsodar(int * nequations, realtype * tOld, realtype * actual, realtype * res);
+static void grblklsodar(int * nequations, realtype * tOld, realtype * actual, int * ngc, realtype * res);
+static void simblkddaskr(realtype *tOld, realtype *actual, realtype *actualP, realtype *res, int *flag, double *dummy1, int *dummy2);
+static void grblkddaskr(int *nequations, realtype *tOld, realtype *actual, int *ngc, realtype *res, double *dummy1, int *dummy2);
+static void jacpsol(realtype *res, int *ires, int *nequations, realtype *tOld, realtype *actual, realtype *actualP,
+ realtype *rewt, realtype *savr, realtype *wk, realtype *h, realtype *cj, realtype *wp,
+ int *iwp, int *ier, double *dummy1, int *dummy2);
+static void psol(int *nequations, realtype *tOld, realtype *actual, realtype *actualP,
+ realtype *savr, realtype *wk, realtype *cj, realtype *wght, realtype *wp,
+ int *iwp, realtype *b, realtype *eplin, int *ier, double *dummy1, int *dummy2);
+static void addevs(double t, int *evtnb, int *ierr1);
+static int synchro_g_nev(ScicosImport *scs_imp, double *g, int kf, int *ierr);
+static void Multp(double *A, double *B, double *R, int ra, int rb, int ca, int cb);
+static int read_id(ezxml_t *elements, char *id, double *value);
+static int simblkdaskr(realtype tres, N_Vector yy, N_Vector yp, N_Vector resval, void *rdata);
+static void SundialsErrHandler(int error_code, const char *module, const char *function, char *msg, void *user_data);
+static int Jacobians(long int Neq, realtype tt, realtype cj, N_Vector yy,
+ N_Vector yp, N_Vector resvec, DlsMat Jacque, void *jdata,
+ N_Vector tempv1, N_Vector tempv2, N_Vector tempv3);
+static void call_debug_scicos(scicos_block *block, scicos_flag *flag, int flagi, int deb_blk);
+static int synchro_nev(ScicosImport *scs_imp, int kf, int *ierr);
+/*--------------------------------------------------------------------------*/
+extern int C2F(dset)(int *n, double *dx, double *dy, int *incy);
+extern int C2F(dcopy)(int *, double *, int *, double *, int *);
+extern int C2F(dgefa)(double *A, int *lead_dim_A, int *n, int *ipivots, int *info);
+extern int C2F(dgesl)(double *A, int *lead_dim_A, int *n, int *ipivots, double *B, int *job);
+extern int C2F(msgs)();
+extern void C2F(clearscicosimport)();
+/*--------------------------------------------------------------------------*/
+void putevs(double *t, int *evtnb, int *ierr1);
+void Jdoit(double *told, double *xt, double *xtd, double *residual, int *job);
+int simblkKinsol(N_Vector yy, N_Vector resval, void *rdata);
+/*--------------------------------------------------------------------------*/
+int C2F(scicos)(double *x_in, int *xptr_in, double *z__,
+ void **work, int *zptr, int *modptr_in,
+ void **oz, int *ozsz, int *oztyp, int *ozptr,
+ int *iz, int *izptr, int* uid, int* uidptr, double *t0_in,
+ double *tf_in, double *tevts_in, int *evtspt_in,
+ int *nevts, int *pointi_in, void **outtbptr_in,
+ int *outtbsz_in, int *outtbtyp_in,
+ outtb_el *outtb_elem_in, int *nelem1, int *nlnk1,
+ int *funptr, int *funtyp_in, int *inpptr_in,
+ int *outptr_in, int *inplnk_in, int *outlnk_in,
+ double *rpar, int *rpptr, int *ipar, int *ipptr,
+ void **opar, int *oparsz, int *opartyp, int *opptr,
+ int *clkptr_in, int *ordptr_in, int *nordptr1,
+ int *ordclk_in, int *cord_in, int *ncord1,
+ int *iord_in, int *niord1, int *oord_in,
+ int *noord1, int *zord_in, int *nzord1,
+ int *critev_in, int *nblk1, int *ztyp,
+ int *zcptr_in, int *subscr, int *nsubs,
+ double *simpar, int *flag__, int *ierr_out)
+{
+ int i1, kf, lprt, in, out, job = 1;
+
+
+ static int mxtb = 0, ierr0 = 0, kfun0 = 0, i = 0, j = 0, k = 0, jj = 0;
+ static int ni = 0, no = 0;
+ static int nz = 0, noz = 0, nopar = 0;
+ double *W = NULL;
+
+ // Set FPU Flag to Extended for scicos simulation
+ // in order to override Java setting it to Double.
+#if defined(linux) && defined(__i386__)
+ setFPUToExtended();
+#endif
+ /* Copyright INRIA */
+ /* iz,izptr are used to pass block labels */
+ TCritWarning = 0;
+
+ t0 = t0_in;
+ tf = tf_in;
+ ierr = ierr_out;
+
+ /* Parameter adjustments */
+ pointi = pointi_in;
+ x = x_in;
+ xptr = xptr_in - 1;
+ modptr = modptr_in - 1;
+ --zptr;
+ --izptr;
+ --ozptr;
+ evtspt = evtspt_in - 1;
+ tevts = tevts_in - 1;
+ outtbptr = outtbptr_in;
+ outtbsz = outtbsz_in;
+ outtbtyp = outtbtyp_in;
+ outtb_elem = outtb_elem_in;
+ funtyp = funtyp_in - 1;
+ inpptr = inpptr_in - 1;
+ outptr = outptr_in - 1;
+ inplnk = inplnk_in - 1;
+ outlnk = outlnk_in - 1;
+ --rpptr;
+ --ipptr;
+ --opptr;
+ clkptr = clkptr_in - 1;
+ ordptr = ordptr_in - 1;
+ ordclk = ordclk_in - 1;
+ cord = cord_in - 1;
+ iord = iord_in - 1;
+ oord = oord_in - 1;
+ zord = zord_in - 1;
+
+ critev = critev_in - 1;
+ --ztyp;
+ zcptr = zcptr_in - 1;
+ --simpar;
+
+ /* Function Body */
+ Atol = simpar[1];
+ rtol = simpar[2];
+ ttol = simpar[3];
+ deltat = simpar[4];
+ C2F(rtfactor).scale = simpar[5];
+ C2F(cmsolver).solver = (int) simpar[6];
+ hmax = simpar[7];
+
+ nordptr = *nordptr1;
+ nblk = *nblk1;
+ ncord = *ncord1;
+ noord = *noord1;
+ nzord = *nzord1;
+ niord = *niord1;
+ nlnk = *nlnk1;
+ nelem = *nelem1;
+ *ierr = 0;
+
+ nordclk = ordptr[nordptr] - 1; /* number of rows in ordclk is ordptr(nclkp1)-1 */
+ ng = zcptr[nblk + 1] - 1; /* computes number of zero crossing surfaces */
+ nmod = modptr[nblk + 1] - 1; /* computes number of modes */
+ nz = zptr[nblk + 1] - 1; /* number of discrete real states */
+ noz = ozptr[nblk + 1] - 1; /* number of discrete object states */
+ nopar = opptr[nblk + 1] - 1; /* number of object parameters */
+ nx = xptr[nblk + 1] - 1; /* number of object parameters */
+ neq = &nx;
+
+ xd = &x[xptr[nblk + 1] - 1];
+
+ /* check for hard coded maxsize */
+ for (i = 1; i <= nblk; ++i)
+ {
+ if (funtyp[i] < 10000)
+ {
+ funtyp[i] %= 1000;
+ }
+ else
+ {
+ funtyp[i] = funtyp[i] % 1000 + 10000;
+ }
+ ni = inpptr[i + 1] - inpptr[i];
+ no = outptr[i + 1] - outptr[i];
+ if (funtyp[i] == 1)
+ {
+ if (ni + no > 11)
+ {
+ /* hard coded maxsize in callf.c */
+ C2F(msgs)(&c__90, &c__0);
+ C2F(curblk).kfun = i;
+ *ierr = i + 1005;
+ return 0;
+ }
+ }
+ else if (funtyp[i] == 2 || funtyp[i] == 3)
+ {
+ /* hard coded maxsize in scicos.h */
+ if (ni + no > SZ_SIZE)
+ {
+ C2F(msgs)(&c__90, &c__0);
+ C2F(curblk).kfun = i;
+ *ierr = i + 1005;
+ return 0;
+ }
+ }
+ mxtb = 0;
+ if (funtyp[i] == 0)
+ {
+ if (ni > 1)
+ {
+ for (j = 1; j <= ni; ++j)
+ {
+ k = inplnk[inpptr[i] - 1 + j];
+ mxtb = mxtb + (outtbsz[k - 1] * outtbsz[(k - 1) + nlnk]);
+ }
+ }
+ if (no > 1)
+ {
+ for (j = 1; j <= no; ++j)
+ {
+ k = outlnk[outptr[i] - 1 + j];
+ mxtb = mxtb + (outtbsz[k - 1] * outtbsz[(k - 1) + nlnk]);
+ }
+ }
+ if (mxtb > TB_SIZE)
+ {
+ C2F(msgs)(&c__91, &c__0);
+ C2F(curblk).kfun = i;
+ *ierr = i + 1005;
+ return 0;
+ }
+ }
+ }
+
+ if (nx > 0) /* xprop */
+ {
+ if ((xprop = MALLOC(sizeof(int) * nx)) == NULL )
+ {
+ *ierr = 5;
+ return 0;
+ }
+ }
+ for (i = 0; i < nx; i++) /* initialize */
+ {
+ xprop[i] = 1;
+ }
+ if (nmod > 0) /* mod */
+ {
+ if ((mod = MALLOC(sizeof(int) * nmod)) == NULL )
+ {
+ *ierr = 5;
+ if (nx > 0)
+ {
+ FREE(xprop);
+ }
+ return 0;
+ }
+ }
+ if (ng > 0) /* g becomes global */
+ {
+ if ((g = MALLOC(sizeof(double) * ng)) == NULL )
+ {
+ *ierr = 5;
+ if (nmod > 0)
+ {
+ FREE(mod);
+ }
+ if (nx > 0)
+ {
+ FREE(xprop);
+ }
+ return 0;
+ }
+ }
+
+ debug_block = -1; /* no debug block for start */
+ C2F(cosdebugcounter).counter = 0;
+
+ /** Create Block's array **/
+ if ((Blocks = MALLOC(sizeof(scicos_block) * nblk)) == NULL )
+ {
+ *ierr = 5;
+ if (nx > 0)
+ {
+ FREE(xprop);
+ }
+ if (nmod > 0)
+ {
+ FREE(mod);
+ }
+ if (ng > 0)
+ {
+ FREE(g);
+ }
+ return 0;
+ }
+
+ /** Setting blocks properties for each entry in Block's array **/
+
+ /* 1 : type and pointer on simulation function */
+ for (kf = 0; kf < nblk; ++kf) /*for each block */
+ {
+ C2F(curblk).kfun = kf + 1;
+ i = funptr[kf];
+ Blocks[kf].type = funtyp[kf + 1];
+ if (i < 0)
+ {
+ switch (funtyp[kf + 1])
+ {
+ case 0:
+ Blocks[kf].funpt = (voidg) F2C(sciblk);
+ break;
+ case 1:
+ sciprint(_("type 1 function not allowed for scilab blocks\n"));
+ *ierr = 1000 + kf + 1;
+ FREE_blocks();
+ return 0;
+ case 2:
+ sciprint(_("type 2 function not allowed for scilab blocks\n"));
+ *ierr = 1000 + kf + 1;
+ FREE_blocks();
+ return 0;
+ case 3:
+ Blocks[kf].funpt = (voidg) sciblk2;
+ Blocks[kf].type = 2;
+ break;
+ case 5:
+ Blocks[kf].funpt = (voidg) sciblk4;
+ Blocks[kf].type = 4;
+ break;
+ case 99: /* debugging block */
+ Blocks[kf].funpt = (voidg) sciblk4;
+ /*Blocks[kf].type=4;*/
+ debug_block = kf;
+ break;
+
+ case 10005:
+ Blocks[kf].funpt = (voidg) sciblk4;
+ Blocks[kf].type = 10004;
+ break;
+ default :
+ sciprint(_("Undefined Function type\n"));
+ *ierr = 1000 + kf + 1;
+ FREE_blocks();
+ return 0;
+ }
+ Blocks[kf].scsptr = -i; /* set scilab function adress for sciblk */
+ }
+ else if (i <= ntabsim)
+ {
+ Blocks[kf].funpt = (voidg) * (tabsim[i - 1].fonc);
+ Blocks[kf].scsptr = 0; /* this is done for being able to test if a block
+ is a scilab block in the debugging phase when
+ sciblk4 is called */
+ }
+ else
+ {
+ i -= (ntabsim + 1);
+ GetDynFunc(i, &Blocks[kf].funpt);
+ if ( Blocks[kf].funpt == (voidf) 0)
+ {
+ sciprint(_("Function not found\n"));
+ *ierr = 1000 + kf + 1;
+ FREE_blocks();
+ return 0;
+ }
+ Blocks[kf].scsptr = 0; /* this is done for being able to test if a block
+ is a scilab block in the debugging phase when
+ sciblk4 is called */
+ }
+
+ /* 2 : Dimension properties */
+ Blocks[kf].ztyp = ztyp[kf + 1];
+ Blocks[kf].nx = xptr[kf + 2] - xptr[kf + 1]; /* continuuous state dimension*/
+ Blocks[kf].ng = zcptr[kf + 2] - zcptr[kf + 1]; /* number of zero crossing surface*/
+ Blocks[kf].nz = zptr[kf + 2] - zptr[kf + 1]; /* number of double discrete state*/
+ Blocks[kf].noz = ozptr[kf + 2] - ozptr[kf + 1]; /* number of other discrete state*/
+ Blocks[kf].nrpar = rpptr[kf + 2] - rpptr[kf + 1]; /* size of double precision parameter vector*/
+ Blocks[kf].nipar = ipptr[kf + 2] - ipptr[kf + 1]; /* size of integer precision parameter vector*/
+ Blocks[kf].nopar = opptr[kf + 2] - opptr[kf + 1]; /* number of other parameters (matrix, data structure,..)*/
+ Blocks[kf].nin = inpptr[kf + 2] - inpptr[kf + 1]; /* number of input ports */
+ Blocks[kf].nout = outptr[kf + 2] - outptr[kf + 1]; /* number of output ports */
+
+ /* 3 : input port properties */
+ /* in insz, we store :
+ * - insz[0..nin-1] : first dimension of input ports
+ * - insz[nin..2*nin-1] : second dimension of input ports
+ * - insz[2*nin..3*nin-1] : type of data of input ports
+ */
+ /* allocate size and pointer arrays (number of input ports)*/
+ Blocks[kf].insz = NULL;
+ Blocks[kf].inptr = NULL;
+ if (Blocks[kf].nin != 0)
+ {
+ if ((Blocks[kf].insz = MALLOC(Blocks[kf].nin * 3 * sizeof(int))) == NULL )
+ {
+ FREE_blocks();
+ *ierr = 5;
+ return 0;
+ }
+ if ((Blocks[kf].inptr = MALLOC(Blocks[kf].nin * sizeof(double*))) == NULL )
+ {
+ FREE_blocks();
+ *ierr = 5;
+ return 0;
+ }
+ }
+ for (in = 0; in < Blocks[kf].nin; in++)
+ {
+ lprt = inplnk[inpptr[kf + 1] + in];
+ Blocks[kf].inptr[in] = outtbptr[lprt - 1]; /* pointer on the data*/
+ Blocks[kf].insz[in] = outtbsz[lprt - 1]; /* row dimension of the input port*/
+ Blocks[kf].insz[Blocks[kf].nin + in] = outtbsz[(lprt - 1) + nlnk]; /* column dimension of the input port*/
+ Blocks[kf].insz[2 * Blocks[kf].nin + in] = outtbtyp[lprt - 1]; /*type of data of the input port*/
+ }
+ /* 4 : output port properties */
+ /* in outsz, we store :
+ * - outsz[0..nout-1] : first dimension of output ports
+ * - outsz[nout..2*nout-1] : second dimension of output ports
+ * - outsz[2*nout..3*nout-1] : type of data of output ports
+ */
+ /* allocate size and pointer arrays (number of output ports)*/
+ Blocks[kf].outsz = NULL;
+ Blocks[kf].outptr = NULL;
+ if (Blocks[kf].nout != 0)
+ {
+ if ((Blocks[kf].outsz = MALLOC(Blocks[kf].nout * 3 * sizeof(int))) == NULL )
+ {
+ FREE_blocks();
+ *ierr = 5;
+ return 0;
+ }
+ if ((Blocks[kf].outptr = MALLOC(Blocks[kf].nout * sizeof(double*))) == NULL )
+ {
+ FREE_blocks();
+ *ierr = 5;
+ return 0;
+ }
+ }
+ /* set the values */
+ for (out = 0; out < Blocks[kf].nout; out++) /*for each output port */
+ {
+ lprt = outlnk[outptr[kf + 1] + out];
+ Blocks[kf].outptr[out] = outtbptr[lprt - 1]; /*pointer on data */
+ Blocks[kf].outsz[out] = outtbsz[lprt - 1]; /*row dimension of output port*/
+ Blocks[kf].outsz[Blocks[kf].nout + out] = outtbsz[(lprt - 1) + nlnk]; /*column dimension of output ports*/
+ Blocks[kf].outsz[2 * Blocks[kf].nout + out] = outtbtyp[lprt - 1]; /*type of data of output port */
+ }
+
+ /* 5 : event output port properties */
+ Blocks[kf].evout = NULL;
+ Blocks[kf].nevout = clkptr[kf + 2] - clkptr[kf + 1];
+ if (Blocks[kf].nevout != 0)
+ {
+ if ((Blocks[kf].evout = CALLOC(Blocks[kf].nevout, sizeof(double))) == NULL )
+ {
+ FREE_blocks();
+ *ierr = 5;
+ return 0;
+ }
+ }
+
+ /* 6 : pointer on the begining of the double discrete state array ( z) */
+ Blocks[kf].z = &(z__[zptr[kf + 1] - 1]);
+
+ /* 7 : type, size and pointer on the other discrete states data structures (oz) */
+ Blocks[kf].ozsz = NULL;
+ if (Blocks[kf].noz == 0)
+ {
+ Blocks[kf].ozptr = NULL;
+ Blocks[kf].oztyp = NULL;
+ }
+ else
+ {
+ Blocks[kf].ozptr = &(oz[ozptr[kf + 1] - 1]);
+ if ((Blocks[kf].ozsz = MALLOC(Blocks[kf].noz * 2 * sizeof(int))) == NULL )
+ {
+ FREE_blocks();
+ *ierr = 5;
+ return 0;
+ }
+ for (i = 0; i < Blocks[kf].noz; i++)
+ {
+ Blocks[kf].ozsz[i] = ozsz[(ozptr[kf + 1] - 1) + i];
+ Blocks[kf].ozsz[i + Blocks[kf].noz] = ozsz[(ozptr[kf + 1] - 1 + noz) + i];
+ }
+ Blocks[kf].oztyp = &(oztyp[ozptr[kf + 1] - 1]);
+ }
+
+ /* 8 : pointer on the begining of the double parameter array ( rpar ) */
+ Blocks[kf].rpar = &(rpar[rpptr[kf + 1] - 1]);
+
+ /* 9 : pointer on the begining of the integer parameter array ( ipar ) */
+ Blocks[kf].ipar = &(ipar[ipptr[kf + 1] - 1]);
+
+ /* 10 : type, size and pointer on the other parameters data structures (opar) */
+ Blocks[kf].oparsz = NULL;
+ if (Blocks[kf].nopar == 0)
+ {
+ Blocks[kf].oparptr = NULL;
+ Blocks[kf].opartyp = NULL;
+ }
+ else
+ {
+ Blocks[kf].oparptr = &(opar[opptr[kf + 1] - 1]);
+ if ((Blocks[kf].oparsz = MALLOC(Blocks[kf].nopar * 2 * sizeof(int))) == NULL)
+ {
+ FREE_blocks();
+ *ierr = 5;
+ return 0;
+ }
+ for (i = 0; i < Blocks[kf].nopar; i++)
+ {
+ Blocks[kf].oparsz[i] = oparsz[(opptr[kf + 1] - 1) + i];
+ Blocks[kf].oparsz[i + Blocks[kf].nopar] = oparsz[(opptr[kf + 1] - 1 + nopar) + i];
+ }
+ Blocks[kf].opartyp = &(opartyp[opptr[kf + 1] - 1]);
+ }
+
+ /* 10 : pointer on the beginning of the residual array (res) */
+ Blocks[kf].res = NULL;
+ if (Blocks[kf].nx != 0)
+ {
+ if ((Blocks[kf].res = MALLOC(Blocks[kf].nx * sizeof(double))) == NULL)
+ {
+ FREE_blocks();
+ *ierr = 5;
+ return 0;
+ }
+ }
+
+ /* 11 : block label (label) */
+ i1 = izptr[kf + 2] - izptr[kf + 1];
+ if ((Blocks[kf].label = MALLOC(sizeof(char) * (i1 + 1))) == NULL)
+ {
+ FREE_blocks();
+ *ierr = 5;
+ return 0;
+ }
+ Blocks[kf].label[i1] = '\0';
+ C2F(cvstr)(&i1, &(iz[izptr[kf + 1] - 1]), Blocks[kf].label, &job, i1);
+
+ /* block uid (uid) */
+ i1 = uidptr[kf + 1] - uidptr[kf];
+ if ((Blocks[kf].uid = MALLOC(sizeof(char) * (i1 + 1))) == NULL)
+ {
+ FREE_blocks();
+ *ierr = 5;
+ return 0;
+ }
+ Blocks[kf].uid[i1] = '\0';
+ C2F(cvstr)(&i1, &(uid[uidptr[kf] - 1]), Blocks[kf].uid, &job, i1);
+
+ /* 12 : block array of crossed surfaces (jroot) */
+ Blocks[kf].jroot = NULL;
+ if (Blocks[kf].ng > 0)
+ {
+ if ((Blocks[kf].jroot = CALLOC(Blocks[kf].ng, sizeof(int))) == NULL)
+ {
+ FREE_blocks();
+ *ierr = 5;
+ return 0;
+ }
+ }
+
+ /* 13 : block work array (work) */
+ Blocks[kf].work = (void **)(((double *)work) + kf);
+
+ /* 14 : block modes array (mode) */
+ Blocks[kf].nmode = modptr[kf + 2] - modptr[kf + 1];
+ if (Blocks[kf].nmode != 0)
+ {
+ Blocks[kf].mode = &(mod[modptr[kf + 1] - 1]);
+ }
+
+ /* 15 : block xprop array (xprop) */
+ Blocks[kf].xprop = NULL;
+ if (Blocks[kf].nx != 0)
+ {
+ Blocks[kf].xprop = &(xprop[xptr[kf + 1] - 1]);
+ }
+
+ /* 16 : pointer on the zero crossing surface computation function of the block (g) */
+ Blocks[kf].g = NULL;
+ if (Blocks[kf].ng != 0)
+ {
+ Blocks[kf].g = &(g[zcptr[kf + 1] - 1]);
+ }
+ }
+ /** all block properties are stored in the Blocks array **/
+
+ /* iwa */
+ iwa = NULL;
+ if ((*nevts) != 0)
+ {
+ if ((iwa = MALLOC(sizeof(int) * (*nevts))) == NULL)
+ {
+ FREE_blocks();
+ *ierr = 5;
+ return 0;
+ }
+ }
+
+ /* save ptr of scicos in import structure */
+ makescicosimport(x, &nx, &xptr[1], &zcptr[1], z__, &nz, &zptr[1],
+ &noz, oz, ozsz, oztyp, &ozptr[1],
+ g, &ng, mod, &nmod, &modptr[1], iz, &izptr[1],
+ uid, uidptr,
+ &inpptr[1], &inplnk[1], &outptr[1], &outlnk[1],
+ outtbptr, outtbsz, outtbtyp,
+ outtb_elem, &nelem,
+ &nlnk, rpar, &rpptr[1], ipar, &ipptr[1],
+ opar, oparsz, opartyp, &opptr[1],
+ &nblk, subscr, nsubs,
+ &tevts[1], &evtspt[1], nevts, pointi,
+ &iord[1], &niord, &oord[1], &noord, &zord[1], &nzord,
+ funptr, &funtyp[1], &ztyp[1],
+ &cord[1], &ncord, &ordclk[1], &nordclk, &clkptr[1],
+ &ordptr[1], &nordptr, &critev[1], iwa, Blocks,
+ t0, tf, &Atol, &rtol, &ttol, &deltat, &hmax,
+ xprop, xd);
+
+ if (*flag__ == 1) /*start*/
+ {
+ /* blocks initialization */
+ for (kf = 0; kf < nblk; ++kf)
+ {
+ *(Blocks[kf].work) = NULL;
+ }
+ cosini(t0);
+ if (*ierr != 0)
+ {
+ ierr0 = *ierr;
+ kfun0 = C2F(curblk).kfun;
+ cosend(t0);
+ *ierr = ierr0;
+ C2F(curblk).kfun = kfun0;
+ }
+
+ }
+ else if (*flag__ == 2) /*run*/
+ {
+
+ /* integration */
+ switch (C2F(cmsolver).solver)
+ {
+ case LSodar_Dynamic:
+ case CVode_BDF_Newton:
+ case CVode_BDF_Functional:
+ case CVode_Adams_Newton:
+ case CVode_Adams_Functional:
+ case Dormand_Prince:
+ case Runge_Kutta:
+ case Implicit_Runge_Kutta:
+ cossim(t0);
+ break;
+ case IDA_BDF_Newton:
+ case DDaskr_BDF_Newton:
+ case DDaskr_BDF_GMRes:
+ cossimdaskr(t0);
+ break;
+ default: // Unknown solver number
+ *ierr = 1000;
+ return 0;
+ }
+ if (*ierr != 0)
+ {
+ ierr0 = *ierr;
+ kfun0 = C2F(curblk).kfun;
+ cosend(t0);
+ *ierr = ierr0;
+ C2F(curblk).kfun = kfun0;
+ }
+
+ }
+ else if (*flag__ == 3) /*finish*/
+ {
+ /* blocks closing */
+ cosend(t0);
+ }
+ else if (*flag__ == 4) /*linear*/
+ {
+ phase = 1;
+ idoit(t0);
+ if (*ierr == 0)
+ {
+ if ((W = MALLOC(sizeof(double) * (Max(nx, ng)))) == NULL )
+ {
+ FREE(iwa);
+ FREE_blocks();
+ *ierr = 5;
+ return 0;
+ }
+
+ /*---------instead of old simblk--------*/
+ /* C2F(simblk)(&nx, t0, x, W); */
+
+ if (ng > 0 && nmod > 0)
+ {
+ zdoit(t0, x, x + nx, W); /* updating modes as a function of state values; this was necessary in iGUI*/
+ }
+ for (jj = 0; jj < nx; jj++)
+ {
+ W[jj] = 0.0;
+ }
+ C2F(ierode).iero = 0;
+ *ierr = 0;
+ if (C2F(cmsolver).solver < 100)
+ {
+ odoit(t0, x, W, W);
+ }
+ else
+ {
+ odoit(t0, x, x + nx, W);
+ }
+ C2F(ierode).iero = *ierr;
+ /*-----------------------------------------*/
+ for (i = 0; i < nx; ++i)
+ {
+ x[i] = W[i];
+ }
+ FREE(W);
+ }
+ }
+ else if (*flag__ == 5) /* initial_KINSOL= "Kinsol" */
+ {
+ C2F(ierode).iero = 0;
+ *ierr = 0;
+ idoit(t0);
+ CallKinsol(t0);
+ *ierr = C2F(ierode).iero;
+ }
+
+
+ FREE(iwa);
+ FREE_blocks();
+
+ C2F(clearscicosimport)();
+ return 0;
+} /* scicos_ */
+/*--------------------------------------------------------------------------*/
+/* check_flag */
+static int check_flag(void *flagvalue, char *funcname, int opt)
+{
+ int *errflag = NULL;
+
+ /* Check if SUNDIALS function returned NULL pointer - no memory allocated */
+ if (opt == 0 && flagvalue == NULL)
+ {
+ sciprint(_("\nSUNDIALS_ERROR: %s() failed - returned NULL pointer\n\n"), funcname);
+ return (1);
+ }
+ /* Check if flag < 0 */
+ else if (opt == 1)
+ {
+ errflag = (int *) flagvalue;
+ if (*errflag < 0)
+ {
+ sciprint(_("\nSUNDIALS_ERROR: %s() failed with flag = %d\n\n"),
+ funcname, *errflag);
+ return (1);
+ }
+ }
+ /* Check if function returned NULL pointer - no memory allocated */
+ else if (opt == 2 && flagvalue == NULL)
+ {
+ sciprint(_("\nMEMORY_ERROR: %s() failed - returned NULL pointer\n\n"), funcname);
+ return (1);
+ }
+
+ return (0);
+} /* check_flag */
+
+/*--------------------------------------------------------------------------*/
+static void cosini(double *told)
+{
+ static scicos_flag flag__ = 0;
+ static int i = 0;
+
+ static int kfune = 0;
+ static int jj = 0;
+
+ SCSREAL_COP *outtbd = NULL; /*to save double of outtb*/
+ SCSINT8_COP *outtbc = NULL; /*to save int8 of outtb*/
+ SCSINT16_COP *outtbs = NULL; /*to save int16 of outtb*/
+ SCSINT32_COP *outtbl = NULL; /*to save int32 of outtb*/
+ SCSUINT8_COP *outtbuc = NULL; /*to save unsigned int8 of outtb*/
+ SCSUINT16_COP *outtbus = NULL; /*to save unsigned int16 of outtb*/
+ SCSUINT32_COP *outtbul = NULL; /*to save unsigned int32 of outtb*/
+ int szouttbd = 0; /*size of arrays*/
+ int szouttbc = 0, szouttbs = 0, szouttbl = 0;
+ int szouttbuc = 0, szouttbus = 0, szouttbul = 0;
+ int curouttbd = 0; /*current position in arrays*/
+ int curouttbc = 0, curouttbs = 0, curouttbl = 0;
+ int curouttbuc = 0, curouttbus = 0, curouttbul = 0;
+
+ int ii = 0, kk = 0; /*local counters*/
+ int sszz = 0; /*local size of element of outtb*/
+ /*Allocation of arrays for outtb*/
+ for (ii = 0; ii < nlnk; ii++)
+ {
+ switch (outtbtyp[ii])
+ {
+ case SCSREAL_N :
+ szouttbd += outtbsz[ii] * outtbsz[ii + nlnk]; /*double real matrix*/
+ outtbd = (SCSREAL_COP *) REALLOC (outtbd, szouttbd * sizeof(SCSREAL_COP));
+ break;
+
+ case SCSCOMPLEX_N :
+ szouttbd += 2 * outtbsz[ii] * outtbsz[ii + nlnk]; /*double complex matrix*/
+ outtbd = (SCSCOMPLEX_COP *) REALLOC (outtbd, szouttbd * sizeof(SCSCOMPLEX_COP));
+ break;
+
+ case SCSINT8_N :
+ szouttbc += outtbsz[ii] * outtbsz[ii + nlnk]; /*int8*/
+ outtbc = (SCSINT8_COP *) REALLOC (outtbc, szouttbc * sizeof(SCSINT8_COP));
+ break;
+
+ case SCSINT16_N :
+ szouttbs += outtbsz[ii] * outtbsz[ii + nlnk]; /*int16*/
+ outtbs = (SCSINT16_COP *) REALLOC (outtbs, szouttbs * sizeof(SCSINT16_COP));
+ break;
+
+ case SCSINT32_N :
+ szouttbl += outtbsz[ii] * outtbsz[ii + nlnk]; /*int32*/
+ outtbl = (SCSINT32_COP *) REALLOC (outtbl, szouttbl * sizeof(SCSINT32_COP));
+ break;
+
+ case SCSUINT8_N :
+ szouttbuc += outtbsz[ii] * outtbsz[ii + nlnk]; /*uint8*/
+ outtbuc = (SCSUINT8_COP *) REALLOC (outtbuc, szouttbuc * sizeof(SCSUINT8_COP));
+ break;
+
+ case SCSUINT16_N :
+ szouttbus += outtbsz[ii] * outtbsz[ii + nlnk]; /*uint16*/
+ outtbus = (SCSUINT16_COP *) REALLOC (outtbus, szouttbus * sizeof(SCSUINT16_COP));
+ break;
+
+ case SCSUINT32_N :
+ szouttbul += outtbsz[ii] * outtbsz[ii + nlnk]; /*uint32*/
+ outtbul = (SCSUINT32_COP *) REALLOC (outtbul, szouttbul * sizeof(SCSUINT32_COP));
+ break;
+
+ default : /* Add a message here */
+ break;
+ }
+ }
+
+ /* Jacobian*/
+ AJacobian_block = 0;
+
+ /* Function Body */
+ *ierr = 0;
+
+ /* initialization (flag 4) */
+ /* loop on blocks */
+ C2F(dset)(&ng, &c_b14, g, &c__1);
+
+ for (C2F(curblk).kfun = 1; C2F(curblk).kfun <= nblk; ++C2F(curblk).kfun)
+ {
+ flag__ = 4;
+ if (Blocks[C2F(curblk).kfun - 1].nx > 0)
+ {
+ Blocks[C2F(curblk).kfun - 1].x = &x[xptr[C2F(curblk).kfun] - 1];
+ Blocks[C2F(curblk).kfun - 1].xd = &xd[xptr[C2F(curblk).kfun] - 1];
+ }
+ Blocks[C2F(curblk).kfun - 1].nevprt = 0;
+ if (funtyp[C2F(curblk).kfun] >= 0) /* debug_block is not called here */
+ {
+ /*callf(told, xd, x, x,g,&flag__);*/
+ Jacobian_Flag = 0;
+ callf(told, &Blocks[C2F(curblk).kfun - 1], &flag__);
+ if (flag__ < 0 && *ierr == 0)
+ {
+ *ierr = 5 - flag__;
+ kfune = C2F(curblk).kfun;
+ }
+ if ((Jacobian_Flag == 1) && (AJacobian_block == 0))
+ {
+ AJacobian_block = C2F(curblk).kfun;
+ }
+ }
+ }
+ if (*ierr != 0)
+ {
+ C2F(curblk).kfun = kfune;
+ freeouttbptr;
+ return;
+ }
+
+ /* initialization (flag 6) */
+ flag__ = 6;
+ for (jj = 1; jj <= ncord; ++jj)
+ {
+ C2F(curblk).kfun = cord[jj];
+ Blocks[C2F(curblk).kfun - 1].nevprt = 0;
+ if (funtyp[C2F(curblk).kfun] >= 0)
+ {
+ /*callf(told, xd, x, x,g,&flag__);*/
+ callf(told, &Blocks[C2F(curblk).kfun - 1], &flag__);
+ if (flag__ < 0)
+ {
+ *ierr = 5 - flag__;
+ freeouttbptr;
+ return;
+ }
+ }
+ }
+
+ /* point-fix iterations */
+ flag__ = 6;
+ for (i = 1; i <= nblk + 1; ++i) /*for each block*/
+ {
+ /* loop on blocks */
+ for (C2F(curblk).kfun = 1; C2F(curblk).kfun <= nblk; ++C2F(curblk).kfun)
+ {
+ Blocks[C2F(curblk).kfun - 1].nevprt = 0;
+ if (funtyp[C2F(curblk).kfun] >= 0)
+ {
+ /*callf(told, xd, x, x,g,&flag__);*/
+ callf(told, &Blocks[C2F(curblk).kfun - 1], &flag__);
+ if (flag__ < 0)
+ {
+ *ierr = 5 - flag__;
+ freeouttbptr;
+ return;
+ }
+ }
+ }
+
+ flag__ = 6;
+ for (jj = 1; jj <= ncord; ++jj) /*for each continous block*/
+ {
+ C2F(curblk).kfun = cord[jj];
+ if (funtyp[C2F(curblk).kfun] >= 0)
+ {
+ /*callf(told, xd, x, x,g,&flag__);*/
+ callf(told, &Blocks[C2F(curblk).kfun - 1], &flag__);
+ if (flag__ < 0)
+ {
+ *ierr = 5 - flag__;
+ freeouttbptr;
+ return;
+ }
+ }
+ }
+
+ /*comparison between outtb and arrays*/
+ curouttbd = 0;
+ curouttbc = 0;
+ curouttbs = 0;
+ curouttbl = 0;
+ curouttbuc = 0;
+ curouttbus = 0;
+ curouttbul = 0;
+ for (jj = 0; jj < nlnk; jj++)
+ {
+ switch (outtbtyp[jj]) /*for each type of ports*/
+ {
+ case SCSREAL_N :
+ outtbdptr = (SCSREAL_COP *)outtbptr[jj]; /*double real matrix*/
+ sszz = outtbsz[jj] * outtbsz[jj + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ int outtbdptr_isnan = outtbdptr[kk] != outtbdptr[kk];
+ int outtbd_isnan = (SCSREAL_COP)outtbd[curouttbd + kk] != (SCSREAL_COP)outtbd[curouttbd + kk];
+
+ if (outtbdptr_isnan && outtbd_isnan)
+ {
+ continue;
+ }
+ if (outtbdptr[kk] != (SCSREAL_COP)outtbd[curouttbd + kk])
+ {
+ goto L30;
+ }
+ }
+ curouttbd += sszz;
+ break;
+
+ case SCSCOMPLEX_N :
+ outtbdptr = (SCSCOMPLEX_COP *)outtbptr[jj]; /*double complex matrix*/
+ sszz = 2 * outtbsz[jj] * outtbsz[jj + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ int outtbdptr_isnan = outtbdptr[kk] != outtbdptr[kk];
+ int outtbd_isnan = (SCSCOMPLEX_COP)outtbd[curouttbd + kk] != (SCSCOMPLEX_COP)outtbd[curouttbd + kk];
+
+ if (outtbdptr_isnan && outtbd_isnan)
+ {
+ continue;
+ }
+ if (outtbdptr[kk] != (SCSCOMPLEX_COP)outtbd[curouttbd + kk])
+ {
+ goto L30;
+ }
+ }
+ curouttbd += sszz;
+ break;
+
+ case SCSINT8_N :
+ outtbcptr = (SCSINT8_COP *)outtbptr[jj]; /*int8*/
+ sszz = outtbsz[jj] * outtbsz[jj + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ if (outtbcptr[kk] != (SCSINT8_COP)outtbc[curouttbc + kk])
+ {
+ goto L30;
+ }
+ }
+ curouttbc += sszz;
+ break;
+
+ case SCSINT16_N :
+ outtbsptr = (SCSINT16_COP *)outtbptr[jj]; /*int16*/
+ sszz = outtbsz[jj] * outtbsz[jj + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ if (outtbsptr[kk] != (SCSINT16_COP)outtbs[curouttbs + kk])
+ {
+ goto L30;
+ }
+ }
+ curouttbs += sszz;
+ break;
+
+ case SCSINT32_N :
+ outtblptr = (SCSINT32_COP *)outtbptr[jj]; /*int32*/
+ sszz = outtbsz[jj] * outtbsz[jj + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ if (outtblptr[kk] != (SCSINT32_COP)outtbl[curouttbl + kk])
+ {
+ goto L30;
+ }
+ }
+ curouttbl += sszz;
+ break;
+
+ case SCSUINT8_N :
+ outtbucptr = (SCSUINT8_COP *)outtbptr[jj]; /*uint8*/
+ sszz = outtbsz[jj] * outtbsz[jj + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ if (outtbucptr[kk] != (SCSUINT8_COP)outtbuc[curouttbuc + kk])
+ {
+ goto L30;
+ }
+ }
+ curouttbuc += sszz;
+ break;
+
+ case SCSUINT16_N :
+ outtbusptr = (SCSUINT16_COP *)outtbptr[jj]; /*uint16*/
+ sszz = outtbsz[jj] * outtbsz[jj + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ if (outtbusptr[kk] != (SCSUINT16_COP)outtbus[curouttbus + kk])
+ {
+ goto L30;
+ }
+ }
+ curouttbus += sszz;
+ break;
+
+ case SCSUINT32_N :
+ outtbulptr = (SCSUINT32_COP *)outtbptr[jj]; /*uint32*/
+ sszz = outtbsz[jj] * outtbsz[jj + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ if (outtbulptr[kk] != (SCSUINT32_COP)outtbul[curouttbul + kk])
+ {
+ goto L30;
+ }
+ }
+ curouttbul += sszz;
+ break;
+
+ default : /* Add a message here */
+ break;
+ }
+ }
+ freeouttbptr;
+ return;
+
+L30:
+ /*Save data of outtb in arrays*/
+ curouttbd = 0;
+ curouttbc = 0;
+ curouttbs = 0;
+ curouttbl = 0;
+ curouttbuc = 0;
+ curouttbus = 0;
+ curouttbul = 0;
+ for (ii = 0; ii < nlnk; ii++) /*for each link*/
+ {
+ switch (outtbtyp[ii]) /*switch to type of outtb object*/
+ {
+ case SCSREAL_N :
+ outtbdptr = (SCSREAL_COP *)outtbptr[ii]; /*double real matrix*/
+ sszz = outtbsz[ii] * outtbsz[ii + nlnk];
+ C2F(dcopy)(&sszz, outtbdptr, &c__1, &outtbd[curouttbd], &c__1);
+ curouttbd += sszz;
+ break;
+
+ case SCSCOMPLEX_N :
+ outtbdptr = (SCSCOMPLEX_COP *)outtbptr[ii]; /*double complex matrix*/
+ sszz = 2 * outtbsz[ii] * outtbsz[ii + nlnk];
+ C2F(dcopy)(&sszz, outtbdptr, &c__1, &outtbd[curouttbd], &c__1);
+ curouttbd += sszz;
+ break;
+
+ case SCSINT8_N :
+ outtbcptr = (SCSINT8_COP *)outtbptr[ii]; /*int8*/
+ sszz = outtbsz[ii] * outtbsz[ii + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ outtbc[curouttbc + kk] = (SCSINT8_COP)outtbcptr[kk];
+ }
+ curouttbc += sszz;
+ break;
+
+ case SCSINT16_N :
+ outtbsptr = (SCSINT16_COP *)outtbptr[ii]; /*int16*/
+ sszz = outtbsz[ii] * outtbsz[ii + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ outtbs[curouttbs + kk] = (SCSINT16_COP)outtbsptr[kk];
+ }
+ curouttbs += sszz;
+ break;
+
+ case SCSINT32_N :
+ outtblptr = (SCSINT32_COP *)outtbptr[ii]; /*int32*/
+ sszz = outtbsz[ii] * outtbsz[ii + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ outtbl[curouttbl + kk] = (SCSINT32_COP)outtblptr[kk];
+ }
+ curouttbl += sszz;
+ break;
+
+ case SCSUINT8_N :
+ outtbucptr = (SCSUINT8_COP *)outtbptr[ii]; /*uint8*/
+ sszz = outtbsz[ii] * outtbsz[ii + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ outtbuc[curouttbuc + kk] = (SCSUINT8_COP)outtbucptr[kk];
+ }
+ curouttbuc += sszz;
+ break;
+
+ case SCSUINT16_N :
+ outtbusptr = (SCSUINT16_COP *)outtbptr[ii]; /*uint16*/
+ sszz = outtbsz[ii] * outtbsz[ii + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ outtbus[curouttbus + kk] = (SCSUINT16_COP)outtbusptr[kk];
+ }
+ curouttbus += sszz;
+ break;
+
+ case SCSUINT32_N :
+ outtbulptr = (SCSUINT32_COP *)outtbptr[ii]; /*uint32*/
+ sszz = outtbsz[ii] * outtbsz[ii + nlnk];
+ for (kk = 0; kk < sszz; kk++)
+ {
+ outtbul[curouttbul + kk] = (SCSUINT32_COP)outtbulptr[kk];
+ }
+ curouttbul += sszz;
+ break;
+
+ default : /* Add a message here */
+ break;
+ }
+ }
+ }
+ *ierr = 20;
+ freeouttbptr;
+} /* cosini_ */
+
+/*--------------------------------------------------------------------------*/
+static void cossim(double *told)
+{
+ /* System generated locals */
+ int i3 = 0;
+
+ //** used for the [stop] button
+ static char CommandToUnstack[1024];
+ static int CommandLength = 0;
+ static int SeqSync = 0;
+ static int one = 1;
+
+ /* Local variables */
+ static scicos_flag flag__ = 0;
+ static int ierr1 = 0;
+ static int j = 0, k = 0;
+ static double t = 0.;
+ static int jj = 0;
+ static double rhotmp = 0., tstop = 0.;
+ static int inxsci = 0;
+ static int kpo = 0, kev = 0;
+ int Discrete_Jump = 0;
+ int *jroot = NULL, *zcros = NULL;
+ realtype reltol = 0., abstol = 0.;
+ N_Vector y = NULL;
+ void *ode_mem = NULL;
+ int flag = 0, flagr = 0;
+ int cnt = 0;
+ /* Saving solver number */
+ int solver = C2F(cmsolver).solver;
+ /* Defining function pointers, for more readability */
+ void(* ODEFree) (void**);
+ int (* ODE) (void*, realtype, N_Vector, realtype*, int);
+ int (* ODEReInit) (void*, realtype, N_Vector);
+ int (* ODESetMaxStep) (void*, realtype);
+ int (* ODESetStopTime) (void*, realtype);
+ int (* ODEGetRootInfo) (void*, int*);
+ int (* ODESStolerances) (void*, realtype, realtype);
+ /* Generic flags for stop mode */
+ int ODE_NORMAL = 1; /* ODE_NORMAL = CV_NORMAL = LS_NORMAL = 1 */
+ int ODE_ONE_STEP = 2; /* ODE_ONE_STEP = CV_ONE_STEP = LS_ONE_STEP = 2 */
+ switch (solver)
+ {
+ case LSodar_Dynamic:
+ ODEFree = &LSodarFree;
+ ODE = &LSodar;
+ ODEReInit = &LSodarReInit;
+ ODESetMaxStep = &LSodarSetMaxStep;
+ ODESetStopTime = &LSodarSetStopTime;
+ ODEGetRootInfo = &LSodarGetRootInfo;
+ ODESStolerances = &LSodarSStolerances;
+ break;
+ case CVode_BDF_Newton:
+ case CVode_BDF_Functional:
+ case CVode_Adams_Newton:
+ case CVode_Adams_Functional:
+ case Dormand_Prince:
+ case Runge_Kutta:
+ case Implicit_Runge_Kutta:
+ ODEFree = &CVodeFree;
+ ODE = &CVode;
+ ODEReInit = &CVodeReInit;
+ ODESetMaxStep = &CVodeSetMaxStep;
+ ODESetStopTime = &CVodeSetStopTime;
+ ODEGetRootInfo = &CVodeGetRootInfo;
+ ODESStolerances = &CVodeSStolerances;
+ break;
+ default: // Unknown solver number
+ *ierr = 1000;
+ return;
+ }
+
+ jroot = NULL;
+ if (ng > 0)
+ {
+ if ((jroot = MALLOC(sizeof(int) * ng)) == NULL )
+ {
+ *ierr = 10000;
+ return;
+ }
+ }
+
+ for ( jj = 0 ; jj < ng ; jj++ )
+ {
+ jroot[jj] = 0 ;
+ }
+
+ zcros = NULL;
+ if (ng > 0)
+ {
+ if ((zcros = MALLOC(sizeof(int) * ng)) == NULL )
+ {
+ *ierr = 10000;
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ return;
+ }
+ }
+
+ reltol = (realtype) rtol;
+ abstol = (realtype) Atol; /* Ith(abstol,1) = realtype) Atol;*/
+
+ if (*neq > 0) /* Unfortunately CVODE does not work with NEQ==0 */
+ {
+ y = N_VNewEmpty_Serial(*neq);
+ if (check_flag((void *)y, "N_VNewEmpty_Serial", 0))
+ {
+ *ierr = 10000;
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ return;
+ }
+
+ NV_DATA_S(y) = x;
+
+ ode_mem = NULL;
+
+ /* Set extension of Sundials for scicos */
+ set_sundials_with_extension(TRUE);
+
+ switch (solver)
+ {
+ case LSodar_Dynamic:
+ ode_mem = LSodarCreate(neq, ng); /* Create the lsodar problem */
+ break;
+ case CVode_BDF_Newton:
+ ode_mem = CVodeCreate(CV_BDF, CV_NEWTON);
+ break;
+ case CVode_BDF_Functional:
+ ode_mem = CVodeCreate(CV_BDF, CV_FUNCTIONAL);
+ break;
+ case CVode_Adams_Newton:
+ ode_mem = CVodeCreate(CV_ADAMS, CV_NEWTON);
+ break;
+ case CVode_Adams_Functional:
+ ode_mem = CVodeCreate(CV_ADAMS, CV_FUNCTIONAL);
+ break;
+ case Dormand_Prince:
+ ode_mem = CVodeCreate(CV_DOPRI, CV_FUNCTIONAL);
+ break;
+ case Runge_Kutta:
+ ode_mem = CVodeCreate(CV_ExpRK, CV_FUNCTIONAL);
+ break;
+ case Implicit_Runge_Kutta:
+ ode_mem = CVodeCreate(CV_ImpRK, CV_FUNCTIONAL);
+ break;
+ }
+
+ /* ode_mem = CVodeCreate(CV_ADAMS, CV_FUNCTIONAL);*/
+
+ if (check_flag((void *)ode_mem, "CVodeCreate", 0))
+ {
+ *ierr = 10000;
+ N_VDestroy_Serial(y);
+ FREE(jroot);
+ FREE(zcros);
+ return;
+ }
+
+ if (solver == LSodar_Dynamic)
+ {
+ flag = LSodarSetErrHandlerFn(ode_mem, SundialsErrHandler, NULL);
+ }
+ else
+ {
+ flag = CVodeSetErrHandlerFn(ode_mem, SundialsErrHandler, NULL);
+ }
+ if (check_flag(&flag, "CVodeSetErrHandlerFn", 1))
+ {
+ *ierr = 300 + (-flag);
+ freeall
+ return;
+ }
+
+ if (solver == LSodar_Dynamic)
+ {
+ flag = LSodarInit(ode_mem, simblklsodar, T0, y);
+ }
+ else
+ {
+ flag = CVodeInit (ode_mem, simblk, T0, y);
+ }
+ if (check_flag(&flag, "CVodeInit", 1))
+ {
+ *ierr = 300 + (-flag);
+ freeall
+ return;
+ }
+
+ flag = ODESStolerances(ode_mem, reltol, abstol);
+ if (check_flag(&flag, "CVodeSStolerances", 1))
+ {
+ *ierr = 300 + (-flag);
+ freeall
+ return;
+ }
+
+ if (solver == LSodar_Dynamic)
+ {
+ flag = LSodarRootInit(ode_mem, ng, grblklsodar);
+ }
+ else
+ {
+ flag = CVodeRootInit(ode_mem, ng, grblk);
+ }
+ if (check_flag(&flag, "CVodeRootInit", 1))
+ {
+ *ierr = 300 + (-flag);
+ freeall
+ return;
+ }
+
+ if (solver != LSodar_Dynamic) /* Call CVDense to specify the CVDENSE dense linear solver */
+ {
+ flag = CVDense(ode_mem, *neq);
+ }
+ if (check_flag(&flag, "CVDense", 1))
+ {
+ *ierr = 300 + (-flag);
+ freeall
+ return;
+ }
+
+ if (hmax > 0)
+ {
+ flag = ODESetMaxStep(ode_mem, (realtype) hmax);
+ if (check_flag(&flag, "CVodeSetMaxStep", 1))
+ {
+ *ierr = 300 + (-flag);
+ freeall;
+ return;
+ }
+ }
+ /* Set the Jacobian routine to Jac (user-supplied)
+ flag = CVDlsSetDenseJacFn(ode_mem, Jac);
+ if (check_flag(&flag, "CVDlsSetDenseJacFn", 1)) return(1); */
+
+ }/* testing if neq>0 */
+
+ /* Function Body */
+ C2F(coshlt).halt = 0;
+ *ierr = 0;
+
+ C2F(xscion)(&inxsci);
+ /* initialization */
+ C2F(realtimeinit)(told, &C2F(rtfactor).scale);
+
+ phase = 1;
+ hot = 0;
+
+ jj = 0;
+ for (C2F(curblk).kfun = 1; C2F(curblk).kfun <= nblk; ++C2F(curblk).kfun)
+ {
+ if (Blocks[C2F(curblk).kfun - 1].ng >= 1)
+ {
+ zcros[jj] = C2F(curblk).kfun;
+ ++jj;
+ }
+ }
+ /* . ng >= jj required */
+ if (jj != ng)
+ {
+ zcros[jj] = -1;
+ }
+ /* initialization (propagation of constant blocks outputs) */
+ idoit(told);
+ if (*ierr != 0)
+ {
+ freeall;
+ return;
+ }
+ /*--discrete zero crossings----dzero--------------------*/
+ if (ng > 0) /* storing ZC signs just after a solver call*/
+ {
+ /*zdoit(told, g, x, x);*/
+ zdoit(told, x, x, g);
+ if (*ierr != 0)
+ {
+ freeall;
+ return;
+ }
+ for (jj = 0; jj < ng; ++jj)
+ if (g[jj] >= 0)
+ {
+ jroot[jj] = 5;
+ }
+ else
+ {
+ jroot[jj] = -5;
+ }
+ }
+ /*--discrete zero crossings----dzero--------------------*/
+
+ /* main loop on time */
+ while (*told < *tf)
+ {
+ while (ismenu()) //** if the user has done something, do the actions
+ {
+ int ierr2 = 0;
+ SeqSync = GetCommand(CommandToUnstack); //** get to the action
+ CommandLength = (int)strlen(CommandToUnstack);
+ syncexec(CommandToUnstack, &CommandLength, &ierr2, &one, CommandLength); //** execute it
+ }
+ if (C2F(coshlt).halt != 0)
+ {
+ if (C2F(coshlt).halt == 2)
+ {
+ *told = *tf; /* end simulation */
+ }
+ C2F(coshlt).halt = 0;
+ freeall;
+ return;
+ }
+ if (*pointi == 0)
+ {
+ t = *tf;
+ }
+ else
+ {
+ t = tevts[*pointi];
+ }
+ if (fabs(t - *told) < ttol)
+ {
+ t = *told;
+ /* update output part */
+ }
+ if (*told > t)
+ {
+ /* ! scheduling problem */
+ *ierr = 1;
+ freeall;
+ return;
+ }
+ if (*told != t)
+ {
+ if (xptr[nblk + 1] == 1)
+ {
+ /* . no continuous state */
+ if (*told + deltat + ttol > t)
+ {
+ *told = t;
+ }
+ else
+ {
+ *told += deltat;
+ }
+ /* . update outputs of 'c' type blocks with no continuous state */
+ if (*told >= *tf)
+ {
+ /* . we are at the end, update continuous part before leaving */
+ if (ncord > 0)
+ {
+ cdoit(told);
+ freeall;
+ return;
+ }
+ }
+ }
+ else
+ {
+ /* integrate */
+ rhotmp = *tf + ttol;
+ if (*pointi != 0)
+ {
+ kpo = *pointi;
+L20:
+ if (critev[kpo] == 1)
+ {
+ rhotmp = tevts[kpo];
+ goto L30;
+ }
+ kpo = evtspt[kpo];
+ if (kpo != 0)
+ {
+ goto L20;
+ }
+L30:
+ if (rhotmp < tstop)
+ {
+ hot = 0;
+ }
+ }
+ tstop = rhotmp;
+ t = Min(*told + deltat, Min(t, *tf + ttol));
+
+ if (ng > 0 && hot == 0 && nmod > 0)
+ {
+ zdoit(told, x, x, g);
+ if (*ierr != 0)
+ {
+ freeall;
+ return;
+ }
+ }
+
+ if (hot == 0) /* hot==0 : cold restart*/
+ {
+ flag = ODESetStopTime(ode_mem, (realtype)tstop); /* Setting the stop time*/
+ if (check_flag(&flag, "CVodeSetStopTime", 1))
+ {
+ *ierr = 300 + (-flag);
+ freeall;
+ return;
+ }
+
+ flag = ODEReInit(ode_mem, (realtype)(*told), y);
+ if (check_flag(&flag, "CVodeReInit", 1))
+ {
+ *ierr = 300 + (-flag);
+ freeall;
+ return;
+ }
+ }
+
+ if ((C2F(cosdebug).cosd >= 1) && (C2F(cosdebug).cosd != 3))
+ {
+ sciprint(_("****SUNDIALS.Cvode from: %f to %f hot= %d \n"), *told, t, hot);
+ }
+
+ /*--discrete zero crossings----dzero--------------------*/
+ /*--check for Dzeros after Mode settings or ddoit()----*/
+ Discrete_Jump = 0;
+
+ if (ng > 0 && hot == 0)
+ {
+ zdoit(told, x, x, g);
+ if (*ierr != 0)
+ {
+ freeall;
+ return;
+ }
+ for (jj = 0; jj < ng; ++jj)
+ {
+ if ((g[jj] >= 0.0) && (jroot[jj] == -5))
+ {
+ Discrete_Jump = 1;
+ jroot[jj] = 1;
+ }
+ else if ((g[jj] < 0.0) && (jroot[jj] == 5))
+ {
+ Discrete_Jump = 1;
+ jroot[jj] = -1;
+ }
+ else
+ {
+ jroot[jj] = 0;
+ }
+ }
+ }
+ /*--discrete zero crossings----dzero--------------------*/
+
+ if (Discrete_Jump == 0) /* if there was a dzero, its event should be activated*/
+ {
+ phase = 2;
+ flag = ODE(ode_mem, t, y, told, ODE_NORMAL);
+ if (*ierr != 0)
+ {
+ freeall;
+ return;
+ }
+ phase = 1;
+ }
+ else
+ {
+ flag = CV_ROOT_RETURN; /* in order to handle discrete jumps */
+ }
+
+ /* . update outputs of 'c' type blocks if we are at the end*/
+ if (*told >= *tf)
+ {
+ if (ncord > 0)
+ {
+ cdoit(told);
+ freeall;
+ return;
+ }
+ }
+
+ if (flag >= 0)
+ {
+ if ((C2F(cosdebug).cosd >= 1) && (C2F(cosdebug).cosd != 3))
+ {
+ sciprint(_("****SUNDIALS.Cvode reached: %f\n"), *told);
+ }
+ hot = 1;
+ cnt = 0;
+ }
+ else if ( flag == CV_TOO_MUCH_WORK || flag == CV_CONV_FAILURE || flag == CV_ERR_FAILURE)
+ {
+ if ((C2F(cosdebug).cosd >= 1) && (C2F(cosdebug).cosd != 3))
+ {
+ sciprint(_("****SUNDIALS.Cvode: too much work at time=%g (stiff region, change RTOL and ATOL)\n"), *told);
+ }
+ hot = 0;
+ cnt++;
+ if (cnt > 5)
+ {
+ *ierr = 300 + (-flag);
+ freeall;
+ return;
+ }
+ }
+ else
+ {
+ if (flag < 0)
+ {
+ *ierr = 300 + (-flag); /* raising errors due to internal errors, otherwise error due to flagr*/
+ }
+ freeall;
+ return;
+ }
+
+ if (flag == CV_ZERO_DETACH_RETURN)
+ {
+ hot = 0;
+ }; /* new feature of sundials, detects zero-detaching */
+
+ if (flag == CV_ROOT_RETURN)
+ {
+ /* . at a least one root has been found */
+ hot = 0;
+ if (Discrete_Jump == 0)
+ {
+ flagr = ODEGetRootInfo(ode_mem, jroot);
+ if (check_flag(&flagr, "CVodeGetRootInfo", 1))
+ {
+ *ierr = 300 + (-flagr);
+ freeall;
+ return;
+ }
+ }
+ /* . at a least one root has been found */
+ if ((C2F(cosdebug).cosd >= 1) && (C2F(cosdebug).cosd != 3))
+ {
+ sciprint(_("root found at t=: %f\n"), *told);
+ }
+ /* . update outputs affecting ztyp blocks ONLY FOR OLD BLOCKS */
+ zdoit(told, x, xd, g);
+ if (*ierr != 0)
+ {
+ freeall;
+ return;
+ }
+ for (jj = 0; jj < ng; ++jj)
+ {
+ C2F(curblk).kfun = zcros[ jj];
+ if (C2F(curblk).kfun == -1)
+ {
+ break;
+ }
+ kev = 0;
+
+ for (j = zcptr[C2F(curblk).kfun] - 1 ;
+ j < zcptr[C2F(curblk).kfun + 1] - 1 ; ++j)
+ {
+ if (jroot[j] != 0)
+ {
+ kev = 1;
+ break;
+ }
+ }
+ /* */
+ if (kev != 0)
+ {
+ Blocks[C2F(curblk).kfun - 1].jroot = &jroot[zcptr[C2F(curblk).kfun] - 1];
+ if (funtyp[C2F(curblk).kfun] > 0)
+ {
+
+ if (Blocks[C2F(curblk).kfun - 1].nevout > 0)
+ {
+ flag__ = 3;
+ if (Blocks[C2F(curblk).kfun - 1].nx > 0)
+ {
+ Blocks[C2F(curblk).kfun - 1].x = &x[xptr[C2F(curblk).kfun] - 1];
+ Blocks[C2F(curblk).kfun - 1].xd = &xd[xptr[C2F(curblk).kfun] - 1];
+ }
+ /* call corresponding block to determine output event (kev) */
+ Blocks[C2F(curblk).kfun - 1].nevprt = -kev;
+ /*callf(told, xd, x, x,g,&flag__);*/
+ callf(told, &Blocks[C2F(curblk).kfun - 1], &flag__);
+ if (flag__ < 0)
+ {
+ *ierr = 5 - flag__;
+ freeall;
+ return;
+ }
+ /* . update event agenda */
+ for (k = 0; k < Blocks[C2F(curblk).kfun - 1].nevout; ++k)
+ {
+ if (Blocks[C2F(curblk).kfun - 1].evout[k] >= 0.)
+ {
+ i3 = k + clkptr[C2F(curblk).kfun] ;
+ addevs(Blocks[C2F(curblk).kfun - 1].evout[k] + (*told), &i3, &ierr1);
+ if (ierr1 != 0)
+ {
+ /* . nevts too small */
+ *ierr = 3;
+ freeall;
+ return;
+ }
+ }
+ }
+ }
+ /* . update state */
+ if (Blocks[C2F(curblk).kfun - 1].nx > 0)
+ {
+ /* . call corresponding block to update state */
+ flag__ = 2;
+ Blocks[C2F(curblk).kfun - 1].x = &x[xptr[C2F(curblk).kfun] - 1];
+ Blocks[C2F(curblk).kfun - 1].xd = &xd[xptr[C2F(curblk).kfun] - 1];
+ Blocks[C2F(curblk).kfun - 1].nevprt = -kev;
+ /*callf(told, xd, x, x,g,&flag__);*/
+ callf(told, &Blocks[C2F(curblk).kfun - 1], &flag__);
+
+ if (flag__ < 0)
+ {
+ *ierr = 5 - flag__;
+ freeall;
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ /*--discrete zero crossings----dzero--------------------*/
+ if (ng > 0) /* storing ZC signs just after a sundials call*/
+ {
+ zdoit(told, x, x, g);
+ if (*ierr != 0)
+ {
+ freeall;
+ return;
+ }
+ for (jj = 0; jj < ng; ++jj)
+ {
+ if (g[jj] >= 0)
+ {
+ jroot[jj] = 5;
+ }
+ else
+ {
+ jroot[jj] = -5;
+ }
+ }
+ }
+ /*--discrete zero crossings----dzero--------------------*/
+
+ C2F(realtime)(told);
+ }
+ else
+ {
+ /* . t==told */
+ if ((C2F(cosdebug).cosd >= 1) && (C2F(cosdebug).cosd != 3))
+ {
+ sciprint(_("Event: %d activated at t=%f\n"), *pointi, *told);
+ for (kev = 0; kev < nblk; kev++)
+ {
+ if (Blocks[kev].nmode > 0)
+ {
+ sciprint(_("mode of block %d=%d, "), kev, Blocks[kev].mode[0]);
+ }
+ }
+ sciprint(_("**mod**\n"));
+ }
+
+ ddoit(told);
+ if ((C2F(cosdebug).cosd >= 1) && (C2F(cosdebug).cosd != 3))
+ {
+ sciprint(_("End of activation\n"));
+ }
+ if (*ierr != 0)
+ {
+ freeall;
+ return;
+ }
+
+ }
+ /* end of main loop on time */
+ }
+ freeall;
+} /* cossim_ */
+
+/*--------------------------------------------------------------------------*/
+static void cossimdaskr(double *told)
+{
+ /* System generated locals */
+ int i3;
+ //** used for the [stop] button
+ static char CommandToUnstack[1024];
+ static int CommandLength = 0;
+ static int SeqSync = 0;
+ static int one = 1;
+
+ /* Local variables */
+ static scicos_flag flag__ = 0;
+ static int ierr1 = 0;
+ static int j = 0, k = 0;
+ static double t = 0.;
+ static int jj = 0;
+ static double rhotmp = 0., tstop = 0.;
+ static int inxsci = 0;
+ static int kpo = 0, kev = 0;
+
+ int *jroot = NULL, *zcros = NULL;
+ int *Mode_save = NULL;
+ int Mode_change = 0;
+
+ int flag = 0, flagr = 0;
+ N_Vector yy = NULL, yp = NULL;
+ realtype reltol = 0., abstol = 0.;
+ int Discrete_Jump = 0;
+ N_Vector IDx = NULL;
+ realtype *scicos_xproperty = NULL;
+ DlsMat TJacque = NULL;
+
+ void *dae_mem = NULL;
+ UserData data = NULL;
+ IDAMem copy_IDA_mem = NULL;
+ int maxnj = 0, maxnit = 0, maxnh = 0;
+ /*-------------------- Analytical Jacobian memory allocation ----------*/
+ int Jn = 0, Jnx = 0, Jno = 0, Jni = 0, Jactaille = 0;
+ double uround = 0.;
+ int cnt = 0, N_iters = 0;
+ /* Saving solver number */
+ int solver = C2F(cmsolver).solver;
+ /* Flags for initial values calculation */
+ int DAE_YA_YDP_INIT = 1;
+ int DAE_Y_INIT = 2;
+ /* Defining function pointers, for more readability*/
+ void(* DAEFree) (void**);
+ int (* DAESolve) (void*, realtype, realtype*, N_Vector, N_Vector, int);
+ int (* DAEReInit) (void*, realtype, N_Vector, N_Vector);
+ int (* DAESetId) (void*, N_Vector);
+ int (* DAECalcIC) (void*, int, realtype);
+ int (* DAESetMaxStep) (void*, realtype);
+ int (* DAESetUserData) (void*, void*);
+ int (* DAESetStopTime) (void*, realtype);
+ int (* DAEGetRootInfo) (void*, int*);
+ int (* DAESStolerances) (void*, realtype, realtype);
+ int (* DAEGetConsistentIC) (void*, N_Vector, N_Vector);
+ int (* DAESetMaxNumSteps) (void*, long int);
+ int (* DAESetMaxNumJacsIC) (void*, int);
+ int (* DAESetMaxNumItersIC) (void*, int);
+ int (* DAESetMaxNumStepsIC) (void*, int);
+ int (* DAESetLineSearchOffIC) (void*, int);
+ /* For DAEs, the generic flags for stop mode depend on the used solver */
+ int DAE_NORMAL = 0, DAE_ONE_STEP = 0;
+ DAE_NORMAL = (solver == IDA_BDF_Newton) ? 1 : 0; /* IDA_NORMAL = 1, DDAS_NORMAL = 0 */
+ DAE_ONE_STEP = (solver == IDA_BDF_Newton) ? 2 : 1; /* IDA_ONE_STEP = 2, DDAS_ONE_STEP = 1 */
+ switch (solver)
+ {
+ case IDA_BDF_Newton:
+ DAEFree = &IDAFree;
+ DAESolve = &IDASolve;
+ DAESetId = &IDASetId;
+ DAEReInit = &IDAReInit;
+ DAECalcIC = &IDACalcIC;
+ DAESetMaxStep = &IDASetMaxStep;
+ DAESetUserData = &IDASetUserData;
+ DAESetStopTime = &IDASetStopTime;
+ DAEGetRootInfo = &IDAGetRootInfo;
+ DAESStolerances = &IDASStolerances;
+ DAESetMaxNumSteps = &IDASetMaxNumSteps;
+ DAEGetConsistentIC = &IDAGetConsistentIC;
+ DAESetMaxNumJacsIC = &IDASetMaxNumJacsIC;
+ DAESetMaxNumItersIC = &IDASetMaxNumItersIC;
+ DAESetMaxNumStepsIC = &IDASetMaxNumStepsIC;
+ DAESetLineSearchOffIC = &IDASetLineSearchOffIC;
+ break;
+ case DDaskr_BDF_Newton:
+ case DDaskr_BDF_GMRes:
+ DAEFree = &DDaskrFree;
+ DAESolve = &DDaskrSolve;
+ DAESetId = &DDaskrSetId;
+ DAEReInit = &DDaskrReInit;
+ DAECalcIC = &DDaskrCalcIC;
+ DAESetMaxStep = &DDaskrSetMaxStep;
+ DAESetUserData = &DDaskrSetUserData;
+ DAESetStopTime = &DDaskrSetStopTime;
+ DAEGetRootInfo = &DDaskrGetRootInfo;
+ DAESStolerances = &DDaskrSStolerances;
+ DAESetMaxNumSteps = &DDaskrSetMaxNumSteps;
+ DAEGetConsistentIC = &DDaskrGetConsistentIC;
+ DAESetMaxNumJacsIC = &DDaskrSetMaxNumJacsIC;
+ DAESetMaxNumItersIC = &DDaskrSetMaxNumItersIC;
+ DAESetMaxNumStepsIC = &DDaskrSetMaxNumStepsIC;
+ DAESetLineSearchOffIC = &DDaskrSetLineSearchOffIC;
+ break;
+ default: // Unknown solver number
+ *ierr = 1000;
+ return;
+ }
+
+ /* Set extension of Sundials for scicos */
+ set_sundials_with_extension(TRUE);
+
+ // CI=1.0; /* for function Get_Jacobian_ci */
+ jroot = NULL;
+ if (ng > 0)
+ {
+ if ((jroot = MALLOC(sizeof(int) * ng)) == NULL )
+ {
+ *ierr = 10000;
+ return;
+ }
+ }
+ for ( jj = 0 ; jj < ng ; jj++ )
+ {
+ jroot[jj] = 0 ;
+ }
+
+ zcros = NULL;
+ if (ng > 0)
+ {
+ if ((zcros = MALLOC(sizeof(int) * ng)) == NULL )
+ {
+ *ierr = 10000;
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ return;
+ }
+ }
+
+ Mode_save = NULL;
+ if (nmod > 0)
+ {
+ if ((Mode_save = MALLOC(sizeof(int) * nmod)) == NULL )
+ {
+ *ierr = 10000;
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ return;
+ }
+ }
+
+ reltol = (realtype) rtol;
+ abstol = (realtype) Atol; /* Ith(abstol,1) = (realtype) Atol;*/
+
+ if (*neq > 0)
+ {
+ yy = NULL;
+ yy = N_VNewEmpty_Serial(*neq);
+ if (check_flag((void *)yy, "N_VNew_Serial", 0))
+ {
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ if (nmod > 0)
+ {
+ FREE(Mode_save);
+ }
+ }
+ NV_DATA_S(yy) = x;
+
+ yp = NULL;
+ yp = N_VNewEmpty_Serial(*neq);
+ if (check_flag((void *)yp, "N_VNew_Serial", 0))
+ {
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yy);
+ }
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ if (nmod > 0)
+ {
+ FREE(Mode_save);
+ }
+ return;
+ }
+ NV_DATA_S(yp) = xd;
+
+ IDx = NULL;
+ IDx = N_VNew_Serial(*neq);
+ if (check_flag((void *)IDx, "N_VNew_Serial", 0))
+ {
+ *ierr = 10000;
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yp);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yy);
+ }
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ if (nmod > 0)
+ {
+ FREE(Mode_save);
+ }
+ return;
+ }
+
+ /* Call the Create and Init functions to initialize DAE memory */
+ dae_mem = NULL;
+ if (solver == DDaskr_BDF_Newton || solver == DDaskr_BDF_GMRes)
+ {
+ dae_mem = DDaskrCreate(neq, ng, solver);
+ }
+ else
+ {
+ dae_mem = IDACreate();
+ }
+ if (check_flag((void *)dae_mem, "IDACreate", 0))
+ {
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(IDx);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yp);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yy);
+ }
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ if (nmod > 0)
+ {
+ FREE(Mode_save);
+ }
+ return;
+ }
+ if (C2F(cmsolver).solver == 100)
+ {
+ copy_IDA_mem = (IDAMem) dae_mem;
+ }
+
+ if (solver == DDaskr_BDF_Newton || solver == DDaskr_BDF_GMRes)
+ {
+ flag = DDaskrSetErrHandlerFn(dae_mem, SundialsErrHandler, NULL);
+ }
+ else
+ {
+ flag = IDASetErrHandlerFn(dae_mem, SundialsErrHandler, NULL);
+ }
+ if (check_flag(&flag, "IDASetErrHandlerFn", 1))
+ {
+ *ierr = 200 + (-flag);
+ if (*neq > 0)
+ {
+ DAEFree(&dae_mem);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(IDx);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yp);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yy);
+ }
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ if (nmod > 0)
+ {
+ FREE(Mode_save);
+ }
+ return;
+ }
+
+ if (solver == DDaskr_BDF_Newton || solver == DDaskr_BDF_GMRes)
+ {
+ flag = DDaskrInit(dae_mem, simblkddaskr, T0, yy, yp, jacpsol, psol);
+ }
+ else
+ {
+ flag = IDAInit(dae_mem, simblkdaskr, T0, yy, yp);
+ }
+ if (check_flag(&flag, "IDAInit", 1))
+ {
+ *ierr = 200 + (-flag);
+ if (*neq > 0)
+ {
+ DAEFree(&dae_mem);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(IDx);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yp);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yy);
+ }
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ if (nmod > 0)
+ {
+ FREE(Mode_save);
+ }
+ return;
+ }
+
+ flag = DAESStolerances(dae_mem, reltol, abstol);
+ if (check_flag(&flag, "IDASStolerances", 1))
+ {
+ *ierr = 200 + (-flag);
+ if (*neq > 0)
+ {
+ DAEFree(&dae_mem);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(IDx);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yp);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yy);
+ }
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ if (nmod > 0)
+ {
+ FREE(Mode_save);
+ }
+ return;
+ }
+
+ if (solver == DDaskr_BDF_Newton || solver == DDaskr_BDF_GMRes)
+ {
+ flag = DDaskrRootInit(dae_mem, ng, grblkddaskr);
+ }
+ else
+ {
+ flag = IDARootInit(dae_mem, ng, grblkdaskr);
+ }
+ if (check_flag(&flag, "IDARootInit", 1))
+ {
+ *ierr = 200 + (-flag);
+ if (*neq > 0)
+ {
+ DAEFree(&dae_mem);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(IDx);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yp);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yy);
+ }
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ if (nmod > 0)
+ {
+ FREE(Mode_save);
+ }
+ return;
+ }
+
+ if (solver == IDA_BDF_Newton)
+ {
+ flag = IDADense(dae_mem, *neq);
+ }
+ if (check_flag(&flag, "IDADense", 1))
+ {
+ *ierr = 200 + (-flag);
+ if (*neq > 0)if (solver == IDA_BDF_Newton)
+ {
+ IDAFree(&dae_mem);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(IDx);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yp);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yy);
+ }
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ if (nmod > 0)
+ {
+ FREE(Mode_save);
+ }
+ return;
+ }
+
+ data = NULL;
+ if ((data = (UserData) MALLOC(sizeof(*data))) == NULL)
+ {
+ *ierr = 10000;
+ if (*neq > 0)
+ {
+ IDAFree(&dae_mem);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(IDx);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yp);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yy);
+ }
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ if (nmod > 0)
+ {
+ FREE(Mode_save);
+ }
+ return;
+ }
+ data->dae_mem = dae_mem;
+ data->ewt = NULL;
+ data->iwork = NULL;
+ data->rwork = NULL;
+ data->gwork = NULL;
+
+ data->ewt = N_VNew_Serial(*neq);
+ if (check_flag((void *)data->ewt, "N_VNew_Serial", 0))
+ {
+ *ierr = 200 + (-flag);
+ if (*neq > 0)
+ {
+ FREE(data);
+ }
+ if (*neq > 0)
+ {
+ DAEFree(&dae_mem);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(IDx);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yp);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yy);
+ }
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ if (nmod > 0)
+ {
+ FREE(Mode_save);
+ }
+ return;
+ }
+ if ( ng > 0 )
+ {
+ if ((data->gwork = (double *) MALLOC(ng * sizeof(double))) == NULL)
+ {
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(data->ewt);
+ }
+ if (*neq > 0)
+ {
+ FREE(data);
+ }
+ if (*neq > 0)
+ {
+ DAEFree(&dae_mem);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(IDx);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yp);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yy);
+ }
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ if (nmod > 0)
+ {
+ FREE(Mode_save);
+ }
+ return;
+ }
+ }
+ /*Jacobian_Flag=0; */
+ if (AJacobian_block > 0) /* set by the block with A-Jac in flag-4 using Set_Jacobian_flag(1); */
+ {
+ Jn = *neq;
+ Jnx = Blocks[AJacobian_block - 1].nx;
+ Jno = Blocks[AJacobian_block - 1].nout;
+ Jni = Blocks[AJacobian_block - 1].nin;
+ }
+ else
+ {
+ Jn = *neq;
+ Jnx = 0;
+ Jno = 0;
+ Jni = 0;
+ }
+ Jactaille = 3 * Jn + (Jn + Jni) * (Jn + Jno) + Jnx * (Jni + 2 * Jn + Jno) + (Jn - Jnx) * (2 * (Jn - Jnx) + Jno + Jni) + 2 * Jni * Jno;
+
+ if ((data->rwork = (double *) MALLOC(Jactaille * sizeof(double))) == NULL)
+ {
+ if ( ng > 0 )
+ {
+ FREE(data->gwork);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(data->ewt);
+ }
+ if (*neq > 0)
+ {
+ FREE(data);
+ }
+ if (*neq > 0)
+ {
+ DAEFree(&dae_mem);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(IDx);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yp);
+ }
+ if (*neq > 0)
+ {
+ N_VDestroy_Serial(yy);
+ }
+ if (ng > 0)
+ {
+ FREE(jroot);
+ }
+ if (ng > 0)
+ {
+ FREE(zcros);
+ }
+ if (nmod > 0)
+ {
+ FREE(Mode_save);
+ }
+ *ierr = 10000;
+ return;
+ }
+
+ if (solver == IDA_BDF_Newton)
+ {
+ flag = IDADlsSetDenseJacFn(dae_mem, Jacobians);
+ }
+ if (check_flag(&flag, "IDADlsSetDenseJacFn", 1))
+ {
+ *ierr = 200 + (-flag);
+ freeallx
+ return;
+ }
+
+ TJacque = (DlsMat) NewDenseMat(*neq, *neq);
+
+ flag = DAESetUserData(dae_mem, data);
+ if (check_flag(&flag, "IDASetUserData", 1))
+ {
+ *ierr = 200 + (-flag);
+ freeallx
+ return;
+ }
+
+ if (hmax > 0)
+ {
+ flag = DAESetMaxStep(dae_mem, (realtype) hmax);
+ if (check_flag(&flag, "IDASetMaxStep", 1))
+ {
+ *ierr = 200 + (-flag);
+ freeallx
+ return;
+ }
+ }
+
+ maxnj = 100; /* setting the maximum number of Jacobian evaluations during a Newton step */
+ flag = DAESetMaxNumJacsIC(dae_mem, maxnj);
+ if (check_flag(&flag, "IDASetMaxNumJacsIC", 1))
+ {
+ *ierr = 200 + (-flag);
+ freeallx
+ return;
+ }
+
+ maxnit = 10; /* setting the maximum number of Newton iterations in any attempt to solve CIC */
+ if (C2F(cmsolver).solver == 102)
+ {
+ maxnit = 15; /* By default, the Krylov max iterations should be 15 */
+ }
+ flag = DAESetMaxNumItersIC(dae_mem, maxnit);
+ if (check_flag(&flag, "IDASetMaxNumItersIC", 1))
+ {
+ *ierr = 200 + (-flag);
+ freeallx
+ return;
+ }
+
+ /* setting the maximum number of steps in an integration interval */
+ maxnh = 2000;
+ flag = DAESetMaxNumSteps(dae_mem, maxnh);
+ if (check_flag(&flag, "IDASetMaxNumSteps", 1))
+ {
+ *ierr = 200 + (-flag);
+ freeallx
+ return;
+ }
+
+ } /* testing if neq>0 */
+
+ uround = 1.0;
+ do
+ {
+ uround = uround * 0.5;
+ }
+ while ( 1.0 + uround != 1.0);
+ uround = uround * 2.0;
+ SQuround = sqrt(uround);
+ /* Function Body */
+
+ C2F(coshlt).halt = 0;
+ *ierr = 0;
+ /* hot = .false. */
+ phase = 1;
+ hot = 0;
+
+ /* stuck=.false. */
+ C2F(xscion)(&inxsci);
+ /* initialization */
+ C2F(realtimeinit)(told, &C2F(rtfactor).scale);
+ /* ATOL and RTOL are scalars */
+
+ jj = 0;
+ for (C2F(curblk).kfun = 1; C2F(curblk).kfun <= nblk; ++C2F(curblk).kfun)
+ {
+ if (Blocks[C2F(curblk).kfun - 1].ng >= 1)
+ {
+ zcros[jj] = C2F(curblk).kfun;
+ ++jj;
+ }
+ }
+ /* . ng >= jj required */
+ if (jj != ng)
+ {
+ zcros[jj] = -1;
+ }
+ /* initialization (propagation of constant blocks outputs) */
+ idoit(told);
+ if (*ierr != 0)
+ {
+ freeallx;
+ return;
+ }
+
+ /*--discrete zero crossings----dzero--------------------*/
+ if (ng > 0) /* storing ZC signs just after a solver call*/
+ {
+ zdoit(told, x, x, g);
+ if (*ierr != 0)
+ {
+ freeallx;
+ return;
+ }
+ for (jj = 0; jj < ng; ++jj)
+ if (g[jj] >= 0)
+ {
+ jroot[jj] = 5;
+ }
+ else
+ {
+ jroot[jj] = -5;
+ }
+ }
+ /* main loop on time */
+ while (*told < *tf)
+ {
+ while (ismenu()) //** if the user has done something, do the actions
+ {
+ int ierr2 = 0;
+ SeqSync = GetCommand(CommandToUnstack); //** get to the action
+ CommandLength = (int)strlen(CommandToUnstack);
+ syncexec(CommandToUnstack, &CommandLength, &ierr2, &one, CommandLength); //** execute it
+ }
+ if (C2F(coshlt).halt != 0)
+ {
+ if (C2F(coshlt).halt == 2)
+ {
+ *told = *tf; /* end simulation */
+ }
+ C2F(coshlt).halt = 0;
+ freeallx;
+ return;
+ }
+ if (*pointi == 0)
+ {
+ t = *tf;
+ }
+ else
+ {
+ t = tevts[*pointi];
+ }
+ if (fabs(t - *told) < ttol)
+ {
+ t = *told;
+ /* update output part */
+ }
+ if (*told > t)
+ {
+ /* ! scheduling problem */
+ *ierr = 1;
+ freeallx;
+ return;
+ }
+ if (*told != t)
+ {
+ if (xptr[nblk + 1] == 1)
+ {
+ /* . no continuous state */
+ if (*told + deltat + ttol > t)
+ {
+ *told = t;
+ }
+ else
+ {
+ *told += deltat;
+ }
+ /* . update outputs of 'c' type blocks with no continuous state */
+ if (*told >= *tf)
+ {
+ /* . we are at the end, update continuous part before leaving */
+ cdoit(told);
+ freeallx;
+ return;
+ }
+ }
+ else
+ {
+ rhotmp = *tf + ttol;
+ if (*pointi != 0)
+ {
+ kpo = *pointi;
+L20:
+ if (critev[kpo] == 1)
+ {
+ rhotmp = tevts[kpo];
+ goto L30;
+ }
+ kpo = evtspt[kpo];
+ if (kpo != 0)
+ {
+ goto L20;
+ }
+L30:
+ if (rhotmp < tstop)
+ {
+ hot = 0;/* Cold-restart the solver if the new TSTOP isn't beyong the previous one*/
+ }
+ }
+ tstop = rhotmp;
+ t = Min(*told + deltat, Min(t, *tf + ttol));
+
+ if (hot == 0) /* CIC calculation when hot==0 */
+ {
+
+ /* Setting the stop time*/
+ flag = DAESetStopTime(dae_mem, (realtype)tstop);
+ if (check_flag(&flag, "IDASetStopTime", 1))
+ {
+ *ierr = 200 + (-flag);
+ freeallx;
+ return;
+ }
+
+ if (ng > 0 && nmod > 0)
+ {
+ phase = 1;
+ zdoit(told, x, xd, g);
+ if (*ierr != 0)
+ {
+ freeallx;
+ return;
+ }
+ }
+
+ /*----------ID setting/checking------------*/
+ N_VConst(ONE, IDx); /* Initialize id to 1's. */
+ scicos_xproperty = NV_DATA_S(IDx);
+ reinitdoit(told);
+ if (*ierr > 0)
+ {
+ freeallx;
+ return;
+ }
+ for (jj = 0; jj < *neq; jj++)
+ {
+ if (xprop[jj] == 1)
+ {
+ scicos_xproperty[jj] = ONE;
+ }
+ if (xprop[jj] == -1)
+ {
+ scicos_xproperty[jj] = ZERO;
+ }
+ }
+ /* CI=0.0;CJ=100.0; // for functions Get_Jacobian_ci and Get_Jacobian_cj
+ Jacobians(*neq, (realtype) (*told), yy, yp, bidon, (realtype) CJ, data, TJacque, tempv1, tempv2, tempv3);
+ for (jj=0;jj<*neq;jj++){
+ Jacque_col=DENSE_COL(TJacque,jj);
+ CI=ZERO;
+ for (kk=0;kk<*neq;kk++){
+ if ((Jacque_col[kk]-Jacque_col[kk]!=0)) {
+ CI=-ONE;
+ break;
+ }else{
+ if (Jacque_col[kk]!=0){
+ CI=ONE;
+ break;
+ }
+ }
+ }
+ if (CI>=ZERO){ scicos_xproperty[jj]=CI;}else{fprintf(stderr,"\nWarinng! Xproperties are not match for i=%d!",jj);}
+ } */
+ /* printf("\n"); for(jj=0;jj<*neq;jj++) { printf("x%d=%g ",jj,scicos_xproperty[jj]); }*/
+
+ flag = DAESetId(dae_mem, IDx);
+ if (check_flag(&flag, "IDASetId", 1))
+ {
+ *ierr = 200 + (-flag);
+ freeallx
+ return;
+ }
+ // CI=1.0; // for function Get_Jacobian_ci
+ /*--------------------------------------------*/
+ // maxnj=100; /* setting the maximum number of Jacobian evaluation during a Newton step */
+ // flag=DAESetMaxNumJacsIC(dae_mem, maxnj);
+ // if (check_flag(&flag, "IDASetMaxNumJacsIC", 1)) {
+ // *ierr=200+(-flag);
+ // freeallx;
+ // return;
+ // };
+ // flag=DAESetLineSearchOffIC(dae_mem,FALSE); /* (def=false) */
+ // if (check_flag(&flag, "IDASetLineSearchOffIC", 1)) {
+ // *ierr=200+(-flag);
+ // freeallx;
+ // return;
+ // };
+ // flag=DAESetMaxNumItersIC(dae_mem, 10);/* (def=10) setting the maximum number of Newton iterations in any attempt to solve CIC */
+ // if (check_flag(&flag, "IDASetMaxNumItersIC", 1)) {
+ // *ierr=200+(-flag);
+ // freeallx;
+ // return;
+ // };
+
+ N_iters = 4 + nmod * 4;
+ for (j = 0; j <= N_iters; j++)
+ {
+ /* counter to reevaluate the
+ modes in mode->CIC->mode->CIC-> loop
+ do it once in the absence of mode (nmod=0) */
+ /* updating the modes through Flag==9, Phase==1 */
+
+ /* Serge Steer 29/06/2009 */
+ while (ismenu()) //** if the user has done something, do the actions
+ {
+ int ierr2 = 0;
+ SeqSync = GetCommand(CommandToUnstack); //** get to the action
+ CommandLength = (int)strlen(CommandToUnstack);
+ syncexec(CommandToUnstack, &CommandLength, &ierr2, &one, CommandLength); //** execute it
+ }
+ if (C2F(coshlt).halt != 0)
+ {
+ if (C2F(coshlt).halt == 2)
+ {
+ *told = *tf; /* end simulation */
+ }
+ C2F(coshlt).halt = 0;
+ freeallx;
+ return;
+ }
+
+ /* yy->PH */
+ flag = DAEReInit(dae_mem, (realtype)(*told), yy, yp);
+ if (check_flag(&flag, "IDAReInit", 1))
+ {
+ *ierr = 200 + (-flag);
+ freeallx;
+ return;
+ }
+
+ phase = 2; /* IDACalcIC: PHI-> yy0: if (ok) yy0_cic-> PHI*/
+ if (C2F(cmsolver).solver == 100)
+ {
+ copy_IDA_mem->ida_kk = 1;
+ }
+ // the initial conditons y0 and yp0 do not satisfy the DAE
+ flagr = DAECalcIC(dae_mem, DAE_YA_YDP_INIT, (realtype)(t));
+ phase = 1;
+ flag = DAEGetConsistentIC(dae_mem, yy, yp); /* PHI->YY */
+ if (*ierr > 5) /* *ierr>5 => singularity in block */
+ {
+ freeallx;
+ return;
+ }
+
+ if ((C2F(cosdebug).cosd >= 1) && (C2F(cosdebug).cosd != 3))
+ {
+ if (flagr >= 0)
+ {
+ sciprint(_("**** SUNDIALS.IDA successfully initialized *****\n") );
+ }
+ else
+ {
+ sciprint(_("**** SUNDIALS.IDA failed to initialize ->try again *****\n") );
+ }
+ }
+ /*-------------------------------------*/
+ /* saving the previous modes*/
+ for (jj = 0; jj < nmod; ++jj)
+ {
+ Mode_save[jj] = mod[jj];
+ }
+ if (ng > 0 && nmod > 0)
+ {
+ phase = 1;
+ zdoit(told, x, xd, g);
+ if (*ierr != 0)
+ {
+ freeallx;
+ return;
+ }
+ }
+ /*------------------------------------*/
+ Mode_change = 0;
+ for (jj = 0; jj < nmod; ++jj)
+ {
+ if (Mode_save[jj] != mod[jj])
+ {
+ Mode_change = 1;
+ break;
+ }
+ }
+ if (Mode_change == 0)
+ {
+ if (flagr >= 0 )
+ {
+ break; /* if (flagr>=0) break; else{ *ierr=200+(-flagr); freeallx; return; }*/
+ }
+ else if (j >= (int)( N_iters / 2))
+ {
+ /* DAESetMaxNumStepsIC(mem,10); */ /* maxnh (def=5) */
+ DAESetMaxNumJacsIC(dae_mem, 10); /* maxnj 100 (def=4)*/
+ /* DAESetMaxNumItersIC(mem,100000); */ /* maxnit in IDANewtonIC (def=10) */
+ DAESetLineSearchOffIC(dae_mem, TRUE); /* (def=false) */
+ /* DAESetNonlinConvCoefIC(mem,1.01);*/ /* (def=0.01-0.33*/
+ flag = DAESetMaxNumItersIC(dae_mem, 1000);
+ if (check_flag(&flag, "IDASetMaxNumItersIC", 1))
+ {
+ *ierr = 200 + (-flag);
+ freeallx;
+ return;
+ };
+ }
+ }
+ }/* mode-CIC counter*/
+ if (Mode_change == 1)
+ {
+ /* In this case, we try again by relaxing all modes and calling DAECalcIC again
+ /Masoud */
+ phase = 1;
+ if (C2F(cmsolver).solver == 100)
+ {
+ copy_IDA_mem->ida_kk = 1;
+ }
+ flagr = DAECalcIC(dae_mem, DAE_YA_YDP_INIT, (realtype)(t));
+ phase = 1;
+ flag = DAEGetConsistentIC(dae_mem, yy, yp); /* PHI->YY */
+ if ((flagr < 0) || (*ierr > 5)) /* *ierr>5 => singularity in block */
+ {
+ *ierr = 23;
+ freeallx;
+ return;
+ }
+ }
+ /*-----If flagr<0 the initialization solver has not converged-----*/
+ if (flagr < 0)
+ {
+ *ierr = 237;
+ freeallx;
+ return;
+ }
+
+ } /* CIC calculation when hot==0 */
+
+ if ((C2F(cosdebug).cosd >= 1) && (C2F(cosdebug).cosd != 3))
+ {
+ sciprint(_("****daskr from: %f to %f hot= %d \n"), *told, t, hot);
+ }
+
+ /*--discrete zero crossings----dzero--------------------*/
+ /*--check for Dzeros after Mode settings or ddoit()----*/
+ Discrete_Jump = 0;
+ if (ng > 0 && hot == 0)
+ {
+ zdoit(told, x, xd, g);
+ if (*ierr != 0)
+ {
+ freeallx;
+ return;
+ }
+ for (jj = 0; jj < ng; ++jj)
+ {
+ if ((g[jj] >= 0.0) && ( jroot[jj] == -5))
+ {
+ Discrete_Jump = 1;
+ jroot[jj] = 1;
+ }
+ else if ((g[jj] < 0.0) && ( jroot[jj] == 5))
+ {
+ Discrete_Jump = 1;
+ jroot[jj] = -1;
+ }
+ else
+ {
+ jroot[jj] = 0;
+ }
+ }
+ }
+
+ /*--discrete zero crossings----dzero--------------------*/
+ if (Discrete_Jump == 0) /* if there was a dzero, its event should be activated*/
+ {
+ phase = 2;
+ flagr = DAESolve(dae_mem, t, told, yy, yp, DAE_NORMAL);
+ phase = 1;
+ if (*ierr != 0)
+ {
+ freeallx;
+ return;
+ }
+ }
+ else
+ {
+ flagr = IDA_ROOT_RETURN; /* in order to handle discrete jumps */
+ }
+ if (flagr >= 0)
+ {
+ if ((C2F(cosdebug).cosd >= 1) && (C2F(cosdebug).cosd != 3))
+ {
+ sciprint(_("****SUNDIALS.Ida reached: %f\n"), *told);
+ }
+ hot = 1;
+ cnt = 0;
+ }
+ else if ( flagr == IDA_TOO_MUCH_WORK || flagr == IDA_CONV_FAIL || flagr == IDA_ERR_FAIL)
+ {
+ if ((C2F(cosdebug).cosd >= 1) && (C2F(cosdebug).cosd != 3))
+ {
+ sciprint(_("**** SUNDIALS.Ida: too much work at time=%g (stiff region, change RTOL and ATOL)\n"), *told);
+ }
+ hot = 0;
+ cnt++;
+ if (cnt > 5)
+ {
+ *ierr = 200 + (-flagr);
+ freeallx;
+ return;
+ }
+ }
+ else
+ {
+ if (flagr < 0)
+ {
+ *ierr = 200 + (-flagr); /* raising errors due to internal errors, otherwise error due to flagr*/
+ }
+ freeallx;
+ return;
+ }
+
+ /* update outputs of 'c' type blocks if we are at the end*/
+ if (*told >= *tf)
+ {
+ cdoit(told);
+ freeallx;
+ return;
+ }
+
+ if (flagr == IDA_ZERO_DETACH_RETURN)
+ {
+ hot = 0;
+ }; /* new feature of sundials, detects unmasking */
+ if (flagr == IDA_ROOT_RETURN)
+ {
+ /* . at least one root has been found */
+ hot = 0;
+ if (Discrete_Jump == 0)
+ {
+ flagr = DAEGetRootInfo(dae_mem, jroot);
+ if (check_flag(&flagr, "IDAGetRootInfo", 1))
+ {
+ *ierr = 200 + (-flagr);
+ freeallx;
+ return;
+ }
+ }
+
+ if ((C2F(cosdebug).cosd >= 1) && (C2F(cosdebug).cosd != 3))
+ {
+ sciprint(_("root found at t=: %f\n"), *told);
+ }
+ /* . update outputs affecting ztyp blocks ONLY FOR OLD BLOCKS*/
+ zdoit(told, x, xd, g);
+ if (*ierr != 0)
+ {
+ freeallx;
+ return;
+ }
+ for (jj = 0; jj < ng; ++jj)
+ {
+ C2F(curblk).kfun = zcros[jj];
+ if (C2F(curblk).kfun == -1)
+ {
+ break;
+ }
+ kev = 0;
+ for (j = zcptr[C2F(curblk).kfun] - 1 ;
+ j < zcptr[C2F(curblk).kfun + 1] - 1 ; ++j)
+ {
+ if (jroot[j] != 0)
+ {
+ kev = 1;
+ break;
+ }
+ }
+ if (kev != 0)
+ {
+ Blocks[C2F(curblk).kfun - 1].jroot = &jroot[zcptr[C2F(curblk).kfun] - 1];
+ if (funtyp[C2F(curblk).kfun] > 0)
+ {
+ if (Blocks[C2F(curblk).kfun - 1].nevout > 0)
+ {
+ flag__ = 3;
+ if (Blocks[C2F(curblk).kfun - 1].nx > 0)
+ {
+ Blocks[C2F(curblk).kfun - 1].x = &x[xptr[C2F(curblk).kfun] - 1];
+ Blocks[C2F(curblk).kfun - 1].xd = &xd[xptr[C2F(curblk).kfun] - 1];
+ }
+ /* call corresponding block to determine output event (kev) */
+ Blocks[C2F(curblk).kfun - 1].nevprt = -kev;
+ /*callf(told, xd, x, x,g,&flag__);*/
+ callf(told, &Blocks[C2F(curblk).kfun - 1], &flag__);
+ if (flag__ < 0)
+ {
+ *ierr = 5 - flag__;
+ freeallx;
+ return;
+ }
+ /* update event agenda */
+ for (k = 0; k < Blocks[C2F(curblk).kfun - 1].nevout; ++k)
+ {
+ if (Blocks[C2F(curblk).kfun - 1].evout[k] >= 0)
+ {
+ i3 = k + clkptr[C2F(curblk).kfun] ;
+ addevs(Blocks[C2F(curblk).kfun - 1].evout[k] + (*told), &i3, &ierr1);
+ if (ierr1 != 0)
+ {
+ /* . nevts too small */
+ *ierr = 3;
+ freeallx;
+ return;
+ }
+ }
+ }
+ }
+ /* update state */
+ if ((Blocks[C2F(curblk).kfun - 1].nx > 0) || (*Blocks[C2F(curblk).kfun - 1].work != NULL) )
+ {
+ /* call corresponding block to update state */
+ flag__ = 2;
+ if (Blocks[C2F(curblk).kfun - 1].nx > 0)
+ {
+ Blocks[C2F(curblk).kfun - 1].x = &x[xptr[C2F(curblk).kfun] - 1];
+ Blocks[C2F(curblk).kfun - 1].xd = &xd[xptr[C2F(curblk).kfun] - 1];
+ }
+ Blocks[C2F(curblk).kfun - 1].nevprt = -kev;
+
+ Blocks[C2F(curblk).kfun - 1].xprop = &xprop[-1 + xptr[C2F(curblk).kfun]];
+ /*callf(told, xd, x, x,g,&flag__);*/
+ callf(told, &Blocks[C2F(curblk).kfun - 1], &flag__);
+
+ if (flag__ < 0)
+ {
+ *ierr = 5 - flag__;
+ freeallx;
+ return;
+ }
+ for (j = 0; j < *neq; j++) /* Adjust xprop for IDx */
+ {
+ if (xprop[j] == 1)
+ {
+ scicos_xproperty[j] = ONE;
+ }
+ if (xprop[j] == -1)
+ {
+ scicos_xproperty[j] = ZERO;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ /* Serge Steer 29/06/2009 */
+ while (ismenu()) //** if the user has done something, do the actions
+ {
+ int ierr2 = 0;
+ SeqSync = GetCommand(CommandToUnstack); //** get to the action
+ CommandLength = (int)strlen(CommandToUnstack);
+ syncexec(CommandToUnstack, &CommandLength, &ierr2, &one, CommandLength); //** execute it
+ }
+
+ if (C2F(coshlt).halt != 0)
+ {
+ if (C2F(coshlt).halt == 2)
+ {
+ *told = *tf; /* end simulation */
+ }
+ C2F(coshlt).halt = 0;
+ freeallx;
+ return;
+ }
+ /* if(*pointi!=0){
+ t=tevts[*pointi];
+ if(*told<t-ttol){
+ cdoit(told);
+ goto L15;
+ }
+ }else{
+ if(*told<*tf){
+ cdoit(told);
+ goto L15;
+ }
+ }*/
+
+ /*--discrete zero crossings----dzero--------------------*/
+ if (ng > 0) /* storing ZC signs just after a ddaskr call*/
+ {
+ zdoit(told, x, xd, g);
+ if (*ierr != 0)
+ {
+ freeallx;
+ return;
+ }
+ for (jj = 0; jj < ng; ++jj)
+ {
+ if (g[jj] >= 0)
+ {
+ jroot[jj] = 5;
+ }
+ else
+ {
+ jroot[jj] = -5;
+ }
+ }
+ }
+ /*--discrete zero crossings----dzero--------------------*/
+ }
+ C2F(realtime)(told);
+ }
+ else
+ {
+ /* . t==told */
+ if ((C2F(cosdebug).cosd >= 1) && (C2F(cosdebug).cosd != 3))
+ {
+ sciprint(_("Event: %d activated at t=%f\n"), *pointi, *told);
+ }
+
+ ddoit(told);
+ if ((C2F(cosdebug).cosd >= 1) && (C2F(cosdebug).cosd != 3))
+ {
+ sciprint(_("End of activation\n"));
+ }
+ if (*ierr != 0)
+ {
+ freeallx;
+ return;
+ }
+ }
+ /* end of main loop on time */
+ }
+ freeallx;
+} /* cossimdaskr_ */
+/*--------------------------------------------------------------------------*/
+/* Subroutine cosend */
+static void cosend(double *told)
+{
+ /* Local variables */
+ static scicos_flag flag__ = 0;
+
+ static int kfune = 0;
+
+ /* Function Body */
+ *ierr = 0;
+ /* loop on blocks */
+ for (C2F(curblk).kfun = 1; C2F(curblk).kfun <= nblk; ++C2F(curblk).kfun)
+ {
+ flag__ = 5;
+ Blocks[C2F(curblk).kfun - 1].nevprt = 0;
+ if (funtyp[C2F(curblk).kfun] >= 0)
+ {
+ if (Blocks[C2F(curblk).kfun - 1].nx > 0)
+ {
+ Blocks[C2F(curblk).kfun - 1].x = &x[xptr[C2F(curblk).kfun] - 1];
+ Blocks[C2F(curblk).kfun - 1].xd = &xd[xptr[C2F(curblk).kfun] - 1];
+ }
+ /*callf(told, xd, x, x,x,&flag__);*/
+ callf(told, &Blocks[C2F(curblk).kfun - 1], &flag__);
+ if (flag__ < 0 && *ierr == 0)
+ {
+ *ierr = 5 - flag__;
+ kfune = C2F(curblk).kfun;
+ }
+ }
+ }
+ if (*ierr != 0)
+ {
+ C2F(curblk).kfun = kfune;
+ return;
+ }
+} /* cosend_ */
+/*--------------------------------------------------------------------------*/
+/* callf */
+void callf(double *t, scicos_block *block, scicos_flag *flag)
+{
+ double* args[SZ_SIZE];
+ int sz[SZ_SIZE];
+ double intabl[TB_SIZE];
+ double outabl[TB_SIZE];
+
+ int ii = 0, in = 0, out = 0, ki = 0, ko = 0, no = 0, ni = 0, k = 0, j = 0;
+ int szi = 0, flagi = 0;
+ double *ptr_d = NULL;
+
+ /* function pointers type def */
+ voidf loc ;
+ ScicosF0 loc0;
+ ScicosF loc1;
+ /* ScicosFm1 loc3;*/
+ ScicosF2 loc2;
+ ScicosF2z loc2z;
+ ScicosFi loci1;
+ ScicosFi2 loci2;
+ ScicosFi2z loci2z;
+ ScicosF4 loc4;
+
+ int solver = C2F(cmsolver).solver;
+ int cosd = C2F(cosdebug).cosd;
+ /*int kf = C2F(curblk).kfun;*/
+ scicos_time = *t;
+ block_error = (int*) flag;
+
+ /* debug block is never called */
+ /*if (kf==(debug_block+1)) return;*/
+ if (block->type == 99)
+ {
+ return;
+ }
+
+ /* flag 7 implicit initialization */
+ flagi = (int) * flag;
+ /* change flag to zero if flagi==7 for explicit block */
+ if (flagi == 7 && block->type < 10000)
+ {
+ *flag = 0;
+ }
+
+ /* display information for debugging mode */
+ if (cosd > 1)
+ {
+ if (cosd != 3)
+ {
+ sciprint(_("block %d is called "), C2F(curblk).kfun);
+ sciprint(_("with flag %d "), *flag);
+ sciprint(_("at time %f \n"), *t);
+ }
+ if (debug_block > -1)
+ {
+ if (cosd != 3)
+ {
+ sciprint(_("Entering the block \n"));
+ }
+ call_debug_scicos(block, flag, flagi, debug_block);
+ if (*flag < 0)
+ {
+ return; /* error in debug block */
+ }
+ }
+ }
+
+ C2F(scsptr).ptr = block->scsptr;
+
+ /* get pointer of the function */
+ loc = block->funpt;
+
+ /* continuous state */
+ if ((solver == IDA_BDF_Newton || solver == DDaskr_BDF_Newton || solver == DDaskr_BDF_GMRes) && block->type < 10000 && *flag == 0)
+ {
+ ptr_d = block->xd;
+ block->xd = block->res;
+ }
+
+ /* switch loop */
+ //sciprint("callf type=%d flag=%d\n",block->type,flagi);
+ switch (block->type)
+ {
+ /*******************/
+ /* function type 0 */
+ /*******************/
+ case 0 :
+ {
+ /* This is for compatibility */
+ /* jroot is returned in g for old type */
+ if (block->nevprt < 0)
+ {
+ for (j = 0; j < block->ng; ++j)
+ {
+ block->g[j] = (double)block->jroot[j];
+ }
+ }
+
+ /* concatenated entries and concatened outputs */
+ /* catenate inputs if necessary */
+ ni = 0;
+ if (block->nin > 1)
+ {
+ ki = 0;
+ for (in = 0; in < block->nin; in++)
+ {
+ szi = block->insz[in] * block->insz[in + block->nin];
+ for (ii = 0; ii < szi; ii++)
+ {
+ intabl[ki++] = *((double *)(block->inptr[in]) + ii);
+ }
+ ni = ni + szi;
+ }
+ args[0] = &(intabl[0]);
+ }
+ else
+ {
+ if (block->nin == 0)
+ {
+ args[0] = NULL;
+ }
+ else
+ {
+ args[0] = (double *)(block->inptr[0]);
+ ni = block->insz[0] * block->insz[1];
+ }
+ }
+
+ /* catenate outputs if necessary */
+ no = 0;
+ if (block->nout > 1)
+ {
+ ko = 0;
+ for (out = 0; out < block->nout; out++)
+ {
+ szi = block->outsz[out] * block->outsz[out + block->nout];
+ for (ii = 0; ii < szi; ii++)
+ {
+ outabl[ko++] = *((double *)(block->outptr[out]) + ii);
+ }
+ no = no + szi;
+ }
+ args[1] = &(outabl[0]);
+ }
+ else
+ {
+ if (block->nout == 0)
+ {
+ args[1] = NULL;
+ }
+ else
+ {
+ args[1] = (double *)(block->outptr[0]);
+ no = block->outsz[0] * block->outsz[1];
+ }
+ }
+
+ loc0 = (ScicosF0) loc;
+
+ (*loc0)(flag, &block->nevprt, t, block->xd, block->x, &block->nx,
+ block->z, &block->nz,
+ block->evout, &block->nevout, block->rpar, &block->nrpar,
+ block->ipar, &block->nipar, (double *)args[0], &ni,
+ (double *)args[1], &no);
+
+ /* split output vector on each port if necessary */
+ if (block->nout > 1)
+ {
+ ko = 0;
+ for (out = 0; out < block->nout; out++)
+ {
+ szi = block->outsz[out] * block->outsz[out + block->nout];
+ for (ii = 0; ii < szi; ii++)
+ {
+ *((double *)(block->outptr[out]) + ii) = outabl[ko++];
+ }
+ }
+ }
+
+ /* adjust values of output register */
+ for (in = 0; in < block->nevout; ++in)
+ {
+ block->evout[in] = block->evout[in] - *t;
+ }
+
+ break;
+ }
+
+ /*******************/
+ /* function type 1 */
+ /*******************/
+ case 1 :
+ {
+ /* This is for compatibility */
+ /* jroot is returned in g for old type */
+ if (block->nevprt < 0)
+ {
+ for (j = 0; j < block->ng; ++j)
+ {
+ block->g[j] = (double)block->jroot[j];
+ }
+ }
+
+ /* one entry for each input or output */
+ for (in = 0 ; in < block->nin ; in++)
+ {
+ args[in] = block->inptr[in];
+ sz[in] = block->insz[in];
+ }
+ for (out = 0; out < block->nout; out++)
+ {
+ args[in + out] = block->outptr[out];
+ sz[in + out] = block->outsz[out];
+ }
+ /* with zero crossing */
+ if (block->ztyp > 0)
+ {
+ args[block->nin + block->nout] = block->g;
+ sz[block->nin + block->nout] = block->ng;
+ }
+
+ loc1 = (ScicosF) loc;
+
+ (*loc1)(flag, &block->nevprt, t, block->xd, block->x, &block->nx,
+ block->z, &block->nz,
+ block->evout, &block->nevout, block->rpar, &block->nrpar,
+ block->ipar, &block->nipar,
+ (double *)args[0], &sz[0],
+ (double *)args[1], &sz[1], (double *)args[2], &sz[2],
+ (double *)args[3], &sz[3], (double *)args[4], &sz[4],
+ (double *)args[5], &sz[5], (double *)args[6], &sz[6],
+ (double *)args[7], &sz[7], (double *)args[8], &sz[8],
+ (double *)args[9], &sz[9], (double *)args[10], &sz[10],
+ (double *)args[11], &sz[11], (double *)args[12], &sz[12],
+ (double *)args[13], &sz[13], (double *)args[14], &sz[14],
+ (double *)args[15], &sz[15], (double *)args[16], &sz[16],
+ (double *)args[17], &sz[17]);
+
+ /* adjust values of output register */
+ for (in = 0; in < block->nevout; ++in)
+ {
+ block->evout[in] = block->evout[in] - *t;
+ }
+
+ break;
+ }
+
+ /*******************/
+ /* function type 2 */
+ /*******************/
+ case 2 :
+ {
+ /* This is for compatibility */
+ /* jroot is returned in g for old type */
+ if (block->nevprt < 0)
+ {
+ for (j = 0; j < block->ng; ++j)
+ {
+ block->g[j] = (double)block->jroot[j];
+ }
+ }
+
+ /* no zero crossing */
+ if (block->ztyp == 0)
+ {
+ loc2 = (ScicosF2) loc;
+ (*loc2)(flag, &block->nevprt, t, block->xd, block->x, &block->nx,
+ block->z, &block->nz,
+ 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);
+ }
+ /* with zero crossing */
+ else
+ {
+ loc2z = (ScicosF2z) loc;
+ (*loc2z)(flag, &block->nevprt, t, block->xd, block->x, &block->nx,
+ block->z, &block->nz,
+ 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,
+ block->g, &block->ng);
+ }
+
+ /* adjust values of output register */
+ for (in = 0; in < block->nevout; ++in)
+ {
+ block->evout[in] = block->evout[in] - *t;
+ }
+
+ break;
+ }
+
+ /*******************/
+ /* function type 4 */
+ /*******************/
+ case 4 :
+ {
+ /* get pointer of the function type 4*/
+ loc4 = (ScicosF4) loc;
+
+ (*loc4)(block, *flag);
+
+ break;
+ }
+
+ /***********************/
+ /* function type 10001 */
+ /***********************/
+ case 10001 :
+ {
+ /* This is for compatibility */
+ /* jroot is returned in g for old type */
+ if (block->nevprt < 0)
+ {
+ for (j = 0; j < block->ng; ++j)
+ {
+ block->g[j] = (double)block->jroot[j];
+ }
+ }
+
+ /* implicit block one entry for each input or output */
+ for (in = 0 ; in < block->nin ; in++)
+ {
+ args[in] = block->inptr[in];
+ sz[in] = block->insz[in];
+ }
+ for (out = 0; out < block->nout; out++)
+ {
+ args[in + out] = block->outptr[out];
+ sz[in + out] = block->outsz[out];
+ }
+ /* with zero crossing */
+ if (block->ztyp > 0)
+ {
+ args[block->nin + block->nout] = block->g;
+ sz[block->nin + block->nout] = block->ng;
+ }
+
+ loci1 = (ScicosFi) loc;
+ (*loci1)(flag, &block->nevprt, t, block->res, block->xd, block->x,
+ &block->nx, block->z, &block->nz,
+ block->evout, &block->nevout, block->rpar, &block->nrpar,
+ block->ipar, &block->nipar,
+ (double *)args[0], &sz[0],
+ (double *)args[1], &sz[1], (double *)args[2], &sz[2],
+ (double *)args[3], &sz[3], (double *)args[4], &sz[4],
+ (double *)args[5], &sz[5], (double *)args[6], &sz[6],
+ (double *)args[7], &sz[7], (double *)args[8], &sz[8],
+ (double *)args[9], &sz[9], (double *)args[10], &sz[10],
+ (double *)args[11], &sz[11], (double *)args[12], &sz[12],
+ (double *)args[13], &sz[13], (double *)args[14], &sz[14],
+ (double *)args[15], &sz[15], (double *)args[16], &sz[16],
+ (double *)args[17], &sz[17]);
+
+ /* adjust values of output register */
+ for (in = 0; in < block->nevout; ++in)
+ {
+ block->evout[in] = block->evout[in] - *t;
+ }
+
+ break;
+ }
+
+ /***********************/
+ /* function type 10002 */
+ /***********************/
+ case 10002 :
+ {
+ /* This is for compatibility */
+ /* jroot is returned in g for old type */
+ if (block->nevprt < 0)
+ {
+ for (j = 0; j < block->ng; ++j)
+ {
+ block->g[j] = (double)block->jroot[j];
+ }
+ }
+
+ /* implicit block, inputs and outputs given by a table of pointers */
+ /* no zero crossing */
+ if (block->ztyp == 0)
+ {
+ loci2 = (ScicosFi2) loc;
+ (*loci2)(flag, &block->nevprt, t, block->res,
+ block->xd, block->x, &block->nx,
+ block->z, &block->nz,
+ 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);
+ }
+ /* with zero crossing */
+ else
+ {
+ loci2z = (ScicosFi2z) loc;
+ (*loci2z)(flag, &block->nevprt, t, block->res,
+ block->xd, block->x, &block->nx,
+ block->z, &block->nz,
+ 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,
+ block->g, &block->ng);
+ }
+
+ /* adjust values of output register */
+ for (in = 0; in < block->nevout; ++in)
+ {
+ block->evout[in] = block->evout[in] - *t;
+ }
+
+ break;
+ }
+
+ /***********************/
+ /* function type 10004 */
+ /***********************/
+ case 10004 :
+ {
+ /* get pointer of the function type 4*/
+ loc4 = (ScicosF4) loc;
+
+ (*loc4)(block, *flag);
+
+ break;
+ }
+
+ /***********/
+ /* default */
+ /***********/
+ default :
+ {
+ sciprint(_("Undefined Function type\n"));
+ *flag = -1000;
+ return; /* exit */
+ }
+ }
+ // sciprint("callf end flag=%d\n",*flag);
+ /* Implicit Solver & explicit block & flag==0 */
+ /* adjust continuous state vector after call */
+ if ((solver == IDA_BDF_Newton || solver == DDaskr_BDF_Newton || solver == DDaskr_BDF_GMRes) && block->type < 10000 && *flag == 0)
+ {
+ block->xd = ptr_d;
+ if (flagi != 7)
+ {
+ for (k = 0; k < block->nx; k++)
+ {
+ block->res[k] = block->res[k] - block->xd[k];
+ }
+ }
+ else
+ {
+ for (k = 0; k < block->nx; k++)
+ {
+ block->xd[k] = block->res[k];
+ }
+ }
+ }
+
+ /* debug block */
+ if (cosd > 1)
+ {
+ if (debug_block > -1)
+ {
+ if (*flag < 0)
+ {
+ return; /* error in block */
+ }
+ if (cosd != 3)
+ {
+ sciprint(_("Leaving block %d \n"), C2F(curblk).kfun);
+ }
+ call_debug_scicos(block, flag, flagi, debug_block);
+ /*call_debug_scicos(flag,kf,flagi,debug_block);*/
+ }
+ }
+} /* callf */
+/*--------------------------------------------------------------------------*/
+/* call_debug_scicos */
+static void call_debug_scicos(scicos_block *block, scicos_flag *flag, int flagi, int deb_blk)
+{
+ voidf loc ;
+ int solver = C2F(cmsolver).solver, k = 0;
+ ScicosF4 loc4;
+ double *ptr_d = NULL;
+
+ C2F(cosdebugcounter).counter = C2F(cosdebugcounter).counter + 1;
+ C2F(scsptr).ptr = Blocks[deb_blk].scsptr;
+
+ loc = Blocks[deb_blk].funpt; /* GLOBAL */
+ loc4 = (ScicosF4) loc;
+
+ /* continuous state */
+ if ((solver == IDA_BDF_Newton || solver == DDaskr_BDF_Newton || solver == DDaskr_BDF_GMRes) && block->type < 10000 && *flag == 0)
+ {
+ ptr_d = block->xd;
+ block->xd = block->res;
+ }
+
+ (*loc4)(block, *flag);
+
+ /* Implicit Solver & explicit block & flag==0 */
+ /* adjust continuous state vector after call */
+ if ((solver == IDA_BDF_Newton || solver == DDaskr_BDF_Newton || solver == DDaskr_BDF_GMRes) && block->type < 10000 && *flag == 0)
+ {
+ block->xd = ptr_d;
+ if (flagi != 7)
+ {
+ for (k = 0; k < block->nx; k++)
+ {
+ block->res[k] = block->res[k] - block->xd[k];
+ }
+ }
+ else
+ {
+ for (k = 0; k < block->nx; k++)
+ {
+ block->xd[k] = block->res[k];
+ }
+ }
+ }
+
+ if (*flag < 0)
+ {
+ sciprint(_("Error in the Debug block \n"));
+ }
+} /* call_debug_scicos */
+/*--------------------------------------------------------------------------*/
+/* simblk */
+static int simblk(realtype t, N_Vector yy, N_Vector yp, void *f_data)
+{
+ double tx = 0., *x = NULL, *xd = NULL;
+ int i = 0, nantest = 0;
+
+ tx = (double) t;
+ x = (double *) NV_DATA_S(yy);
+ xd = (double *) NV_DATA_S(yp);
+
+ for (i = 0; i < *neq; i++)
+ {
+ xd[i] = 0; /* à la place de "C2F(dset)(neq, &c_b14,xcdot , &c__1);"*/
+ }
+ C2F(ierode).iero = 0;
+ *ierr = 0;
+ odoit(&tx, x, xd, xd);
+ C2F(ierode).iero = *ierr;
+
+ if (*ierr == 0)
+ {
+ nantest = 0;
+ for (i = 0; i < *neq; i++) /* NaN checking */
+ {
+ if ((xd[i] - xd[i] != 0))
+ {
+ sciprint(_("\nWarning: The computing function #%d returns a NaN/Inf"), i);
+ nantest = 1;
+ break;
+ }
+ }
+ if (nantest == 1)
+ {
+ return 349; /* recoverable error; */
+ }
+ }
+
+ return (abs(*ierr)); /* ierr>0 recoverable error; ierr>0 unrecoverable error; ierr=0: ok*/
+
+} /* simblk */
+/*--------------------------------------------------------------------------*/
+/* grblk */
+static int grblk(realtype t, N_Vector yy, realtype *gout, void *g_data)
+{
+ double tx = 0., *x = NULL;
+ int jj = 0, nantest = 0;
+
+ tx = (double) t;
+ x = (double *) NV_DATA_S(yy);
+
+ C2F(ierode).iero = 0;
+ *ierr = 0;
+
+ zdoit(&tx, x, x, (double*) gout);
+
+ if (*ierr == 0)
+ {
+ nantest = 0;
+ for (jj = 0; jj < ng; jj++)
+ if (gout[jj] - gout[jj] != 0)
+ {
+ sciprint(_("\nWarning: The zero_crossing function #%d returns a NaN/Inf"), jj);
+ nantest = 1;
+ break;
+ } /* NaN checking */
+ if (nantest == 1)
+ {
+ return 350; /* recoverable error; */
+ }
+ }
+ C2F(ierode).iero = *ierr;
+
+ return 0;
+} /* grblk */
+/*--------------------------------------------------------------------------*/
+/* simblklsodar */
+static void simblklsodar(int * nequations, realtype * tOld, realtype * actual, realtype * res)
+{
+ double tx = 0.;
+ int i = 0;
+
+ tx = (double) * tOld;
+
+ for (i = 0; i < *nequations; ++i)
+ {
+ res[i] = 0; /* à la place de "C2F(dset)(neq, &c_b14,xcdot , &c__1);"*/
+ }
+ C2F(ierode).iero = 0;
+ *ierr = 0;
+ odoit(&tx, actual, res, res);
+ C2F(ierode).iero = *ierr;
+
+ if (*ierr == 0)
+ {
+ for (i = 0; i < *nequations; i++) /* NaN checking */
+ {
+ if ((res[i] - res[i] != 0))
+ {
+ sciprint(_("\nWarning: The computing function #%d returns a NaN/Inf"), i);
+ }
+ }
+ }
+} /* simblklsodar */
+/*--------------------------------------------------------------------------*/
+/* grblklsodar */
+static void grblklsodar(int * nequations, realtype * tOld, realtype * actual, int * ngc, realtype * res)
+{
+ double tx = 0.;
+ int jj = 0;
+
+ tx = (double) * tOld;
+
+ C2F(ierode).iero = 0;
+ *ierr = 0;
+
+ zdoit(&tx, actual, actual, res);
+
+ if (*ierr == 0)
+ {
+ for (jj = 0; jj < *ngc; jj++)
+ {
+ if (res[jj] - res[jj] != 0)
+ {
+ sciprint(_("\nWarning: The zero_crossing function #%d returns a NaN/Inf"), jj);
+ } /* NaN checking */
+ }
+ }
+} /* grblklsodar */
+/*--------------------------------------------------------------------------*/
+/* simblkdaskr */
+static int simblkdaskr(realtype tres, N_Vector yy, N_Vector yp, N_Vector resval, void *rdata)
+{
+ double tx = 0.;
+ double *xc = NULL, *xcdot = NULL, *residual = NULL;
+ realtype alpha = 0.;
+
+ UserData data;
+
+ realtype hh = 0.;
+ int qlast = 0;
+ int jj = 0, flag = 0, nantest = 0;
+
+ data = (UserData) rdata;
+
+ if (get_phase_simulation() == 1)
+ {
+ /* Just to update mode in a very special case, i.e., when initialization using modes fails.
+ in this case, we relax all modes and try again one more time.
+ */
+ zdoit(&tx, NV_DATA_S(yy), NV_DATA_S(yp), NULL);
+ }
+
+ hh = ZERO;
+ flag = IDAGetCurrentStep(data->dae_mem, &hh);
+ if (flag < 0)
+ {
+ *ierr = 200 + (-flag);
+ return (*ierr);
+ };
+
+ qlast = 0;
+ flag = IDAGetCurrentOrder(data->dae_mem, &qlast);
+ if (flag < 0)
+ {
+ *ierr = 200 + (-flag);
+ return (*ierr);
+ };
+
+ alpha = ZERO;
+ for (jj = 0; jj < qlast; jj++)
+ {
+ alpha = alpha - ONE / (jj + 1);
+ }
+ if (hh != 0)
+ // CJ=-alpha/hh; // For function Get_Jacobian_cj
+ {
+ CJJ = -alpha / hh;
+ }
+ else
+ {
+ *ierr = 217;
+ return (*ierr);
+ }
+ xc = (double *) NV_DATA_S(yy);
+ xcdot = (double *) NV_DATA_S(yp);
+ residual = (double *) NV_DATA_S(resval);
+ tx = (double) tres;
+
+ C2F(dcopy)(neq, xcdot, &c__1, residual, &c__1);
+ *ierr = 0;
+ C2F(ierode).iero = 0;
+ odoit(&tx, xc, xcdot, residual);
+
+ C2F(ierode).iero = *ierr;
+
+ if (*ierr == 0)
+ {
+ nantest = 0;
+ for (jj = 0; jj < *neq; jj++)
+ if (residual[jj] - residual[jj] != 0) /* NaN checking */
+ {
+ //sciprint(_("\nWarning: The residual function #%d returns a NaN"),jj);
+ nantest = 1;
+ break;
+ }
+ if (nantest == 1)
+ {
+ return 257; /* recoverable error; */
+ }
+ }
+
+ return (abs(*ierr)); /* ierr>0 recoverable error; ierr>0 unrecoverable error; ierr=0: ok*/
+}/* simblkdaskr */
+/*--------------------------------------------------------------------------*/
+/* grblkdaskr */
+static int grblkdaskr(realtype t, N_Vector yy, N_Vector yp, realtype *gout, void *g_data)
+{
+ double tx = 0.;
+ int jj = 0, nantest = 0;
+
+ tx = (double) t;
+
+ *ierr = 0;
+ C2F(ierode).iero = 0;
+ zdoit(&tx, NV_DATA_S(yy), NV_DATA_S(yp), (double *) gout);
+ if (*ierr == 0)
+ {
+ nantest = 0; /* NaN checking */
+ for (jj = 0; jj < ng; jj++)
+ {
+ if (gout[jj] - gout[jj] != 0)
+ {
+ sciprint(_("\nWarning: The zero-crossing function #%d returns a NaN"), jj);
+ nantest = 1;
+ break;
+ }
+ }
+ if (nantest == 1)
+ {
+ return 258; /* recoverable error; */
+ }
+ }
+ C2F(ierode).iero = *ierr;
+ return (*ierr);
+}/* grblkdaskr */
+/*--------------------------------------------------------------------------*/
+/* simblkddaskr */
+static void simblkddaskr(realtype *tOld, realtype *actual, realtype *actualP, realtype *res, int *flag, double *dummy1, int *dummy2)
+{
+ double tx = 0.;
+
+ int jj = 0;
+
+ if (get_phase_simulation() == 1)
+ {
+ /* Just to update mode in a very special case, i.e., when initialization using modes fails.
+ in this case, we relax all modes and try again one more time.
+ */
+ zdoit(&tx, actual, actualP, NULL);
+ }
+
+ CJJ = 6;
+
+ tx = (double) * tOld;
+ *flag = 0;
+
+ C2F(dcopy)(neq, actualP, &c__1, res, &c__1);
+ *ierr = 0;
+ C2F(ierode).iero = 0;
+ odoit(&tx, actual, actualP, res);
+ C2F(ierode).iero = *ierr;
+
+ if (*ierr == 0)
+ {
+ for (jj = 0; jj < *neq; jj++)
+ if (res[jj] - res[jj] != 0) /* NaN checking */
+ {
+ sciprint(_("\nWarning: The residual function #%d returns a NaN"), jj);
+ *flag = -1; /* recoverable error; */
+ return;
+ }
+ }
+ else
+ {
+ *flag = -2;
+ return;
+ }
+ /* *flag=-1 recoverable error; *flag=-2 unrecoverable error; *flag=0: ok*/
+
+}/* simblkddaskr */
+/*--------------------------------------------------------------------------*/
+/* grblkddaskr */
+static void grblkddaskr(int *nequations, realtype *tOld, realtype *actual, int *ngc, realtype *res, double *dummy1, int *dummy2)
+{
+ double tx = 0.;
+ int jj = 0;
+
+ tx = (double) * tOld;
+
+ *ierr = 0;
+ C2F(ierode).iero = 0;
+ zdoit(&tx, actual, actual, res);
+ C2F(ierode).iero = *ierr;
+
+ if (*ierr == 0)
+ {
+ /* NaN checking */
+ for (jj = 0; jj < *ngc; jj++)
+ {
+ if (res[jj] - res[jj] != 0)
+ {
+ sciprint(_("\nWarning: The zero-crossing function #%d returns a NaN"), jj);
+ return;
+ }
+ }
+ }
+ else
+ {
+ sciprint(_("\nError: Problem in the evaluation of a root function"));
+ return;
+ }
+
+}/* grblkddaskr */
+/*--------------------------------------------------------------------------*/
+/* jacpsol */
+static void jacpsol(realtype *res, int *ires, int *neq, realtype *tOld, realtype *actual, realtype *actualP,
+ realtype *rewt, realtype *savr, realtype *wk, realtype *h, realtype *cj, realtype *wp, int *iwp,
+ int *ier, double *dummy1, int *dummy2)
+{
+ /* Here, we compute the system preconditioner matrix P, which is actually the jacobian matrix,
+ so P(i,j) = dres(i)/dactual(j) + cj*dres(i)/dactualP(j), and we LU-decompose it. */
+ int i = 0, j = 0, nrow = 0, info = 0;
+ realtype tx = 0, del = 0, delinv = 0, ysave = 0, ypsave = 0;
+ realtype * e = NULL;
+
+ tx = *tOld;
+
+ /* Work array used to evaluate res(*tOld, actual + small_increment, actualP + small_increment).
+ savr already contains res(*tOld, actual, actualP). */
+ e = (realtype *) calloc(*neq, sizeof(realtype));
+
+ for (i = 0; i < *neq; ++i)
+ {
+ del = max (SQuround * max(fabs(actual[i]), fabs(*h * actualP[i])), 1. / rewt[i]);
+ del *= (*h * actualP[i] >= 0) ? 1 : -1;
+ del = (actual[i] + del) - actual[i];
+ ysave = actual[i];
+ ypsave = actualP[i];
+ actual[i] += del;
+ actualP[i] += *cj * del;
+ *ierr = 0;
+ C2F(ierode).iero = 0;
+ simblkddaskr(tOld, actual, actualP, e, ires, dummy1, dummy2);
+ C2F(ierode).iero = *ierr;
+ if (*ires == 0)
+ {
+ delinv = 1. / del;
+ for (j = 0; j < *neq; ++j)
+ {
+ wp[nrow + j] = (e[j] - savr[j]) * delinv;
+ /* NaN test */
+ if (wp[nrow + j] - wp[nrow + j] != 0)
+ {
+ sciprint(_("\nWarning: The preconditioner evaluation function returns a NaN at index #%d."), nrow + j);
+ *ier = -1;
+ }
+ }
+ nrow += *neq;
+ actual[i] = ysave;
+ actualP[i] = ypsave;
+ }
+ else
+ {
+ sciprint(_("\nError: The preconditioner evaluation function failed."));
+ *ier = -1;
+ free(e);
+ return;
+ }
+ }
+
+ /* Proceed to LU factorization of P. */
+ C2F(dgefa) (wp, neq, neq, iwp, &info);
+ if (info != 0)
+ {
+ sciprint(_("\nError: Failed to factor the preconditioner."));
+ *ier = -1;
+ }
+
+ free(e);
+}/* jacpsol */
+/*--------------------------------------------------------------------------*/
+/* psol */
+static void psol(int *neq, realtype *tOld, realtype *actual, realtype *actualP,
+ realtype *savr, realtype *wk, realtype *cj, realtype *wght, realtype *wp,
+ int *iwp, realtype *b, realtype *eplin, int *ier, double *dummy1, int *dummy2)
+{
+ /* This function "applies" the inverse of the preconditioner to 'b' (computes P^-1*b).
+ It is done by solving P*x = b using the linpack routine 'dgesl'. */
+ int i = 0, job = 0;
+
+ C2F(dgesl) (wp, neq, neq, iwp, b, &job);
+
+ /* NaN test */
+ for (i = 0; i < *neq; ++i)
+ {
+ if (b[i] - b[i] != 0)
+ {
+ sciprint(_("\nWarning: The preconditioner application function returns a NaN at index #%d."), i);
+ /* Indicate a recoverable error, meaning that the step will be retried with the same step size
+ but with a call to 'jacpsol' to update necessary data, unless the Jacobian data is current,
+ in which case the step will be retried with a smaller step size. */
+ *ier = 1;
+ }
+ }
+}/* psol */
+/*--------------------------------------------------------------------------*/
+/* Subroutine addevs */
+static void addevs(double t, int *evtnb, int *ierr1)
+{
+ static int i = 0, j = 0;
+
+ /* Function Body */
+ *ierr1 = 0;
+ if (evtspt[*evtnb] != -1)
+ {
+ if ((evtspt[*evtnb] == 0) && (*pointi == *evtnb))
+ {
+ tevts[*evtnb] = t;
+ return;
+ }
+ else
+ {
+ if (*pointi == *evtnb)
+ {
+ *pointi = evtspt[*evtnb]; /* remove from chain */
+ }
+ else
+ {
+ i = *pointi;
+ while (*evtnb != evtspt[i])
+ {
+ i = evtspt[i];
+ }
+ evtspt[i] = evtspt[*evtnb]; /* remove old evtnb from chain */
+ if (TCritWarning == 0)
+ {
+ sciprint(_("\n Warning: an event is reprogrammed at t=%g by removing another"), t );
+ sciprint(_("\n (already programmed) event. There may be an error in"));
+ sciprint(_("\n your model. Please check your model\n"));
+ TCritWarning = 1;
+ }
+ do_cold_restart(); /* the erased event could be a critical
+ event, so do_cold_restart is added to
+ refresh the critical event table */
+ }
+ evtspt[*evtnb] = 0;
+ tevts[*evtnb] = t;
+ }
+ }
+ else
+ {
+ evtspt[*evtnb] = 0;
+ tevts[*evtnb] = t;
+ }
+ if (*pointi == 0)
+ {
+ *pointi = *evtnb;
+ return;
+ }
+ if (t < tevts[*pointi])
+ {
+ evtspt[*evtnb] = *pointi;
+ *pointi = *evtnb;
+ return;
+ }
+ i = *pointi;
+
+L100:
+ if (evtspt[i] == 0)
+ {
+ evtspt[i] = *evtnb;
+ return;
+ }
+ if (t >= tevts[evtspt[i]])
+ {
+ j = evtspt[i];
+ if (evtspt[j] == 0)
+ {
+ evtspt[j] = *evtnb;
+ return;
+ }
+ i = j;
+ goto L100;
+ }
+ else
+ {
+ evtspt[*evtnb] = evtspt[i];
+ evtspt[i] = *evtnb;
+ }
+} /* addevs */
+/*--------------------------------------------------------------------------*/
+/* Subroutine putevs */
+void putevs(double *t, int *evtnb, int *ierr1)
+{
+ /* Function Body */
+ *ierr1 = 0;
+ if (evtspt[*evtnb] != -1)
+ {
+ *ierr1 = 1;
+ return;
+ }
+ else
+ {
+ evtspt[*evtnb] = 0;
+ tevts[*evtnb] = *t;
+ }
+ if (*pointi == 0)
+ {
+ *pointi = *evtnb;
+ return;
+ }
+ evtspt[*evtnb] = *pointi;
+ *pointi = *evtnb;
+} /* putevs */
+/*--------------------------------------------------------------------------*/
+/* Subroutine idoit */
+static void idoit(double *told)
+{
+ /* initialisation (propagation of constant blocks outputs) */
+ /* Copyright INRIA */
+
+ int i2 = 0;
+ scicos_flag flag = 0;
+ int i = 0, j = 0;
+ int ierr1 = 0;
+
+ ScicosImport *scs_imp = NULL;
+ int *kf = NULL;
+
+ scs_imp = getscicosimportptr();
+
+ flag = 1;
+ for (j = 0; j < * (scs_imp->niord); j++)
+ {
+ kf = &scs_imp->iord[j];
+ C2F(curblk).kfun = *kf; /* */
+ if (scs_imp->funtyp[*kf - 1] > -1)
+ {
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &scs_imp->x[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &scs_imp->xd[scs_imp->xptr[*kf - 1] - 1];
+ }
+ scs_imp->blocks[*kf - 1].nevprt = scs_imp->iord[j + * (scs_imp->niord)];
+ /*callf(told, xd, x, x,x,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+ if (scs_imp->blocks[*kf - 1].nevout > 0)
+ {
+ if (scs_imp->funtyp[*kf - 1] < 0)
+ {
+ i = synchro_nev(scs_imp, *kf, ierr);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ i2 = i + scs_imp->clkptr[*kf - 1] - 1;
+ putevs(told, &i2, &ierr1);
+ if (ierr1 != 0)
+ {
+ /* event conflict */
+ *ierr = 3;
+ return;
+ }
+ doit(told);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ }
+ }
+ }
+} /* idoit_ */
+/*--------------------------------------------------------------------------*/
+/* Subroutine doit */
+static void doit(double *told)
+{
+ /* propagation of blocks outputs on discrete activations */
+ /* Copyright INRIA */
+
+ int i = 0, i2 = 0;
+ scicos_flag flag = 0;
+ int nord = 0;
+ int ierr1 = 0;
+ int ii = 0, kever = 0;
+
+ ScicosImport *scs_imp = NULL;
+ int *kf = NULL;
+
+ scs_imp = getscicosimportptr();
+
+ kever = *pointi;
+ *pointi = evtspt[kever];
+ evtspt[kever] = -1;
+
+ nord = scs_imp->ordptr[kever] - scs_imp->ordptr[kever - 1];
+ if (nord == 0)
+ {
+ return;
+ }
+
+ for (ii = scs_imp->ordptr[kever - 1]; ii <= scs_imp->ordptr[kever] - 1 ; ii++)
+ {
+ kf = &scs_imp->ordclk[ii - 1];
+ C2F(curblk).kfun = *kf;
+ if (scs_imp->funtyp[*kf - 1] > -1)
+ {
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &scs_imp->x[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &scs_imp->xd[scs_imp->xptr[*kf - 1] - 1];
+ }
+ scs_imp->blocks[*kf - 1].nevprt = abs(scs_imp->ordclk[ii + * (scs_imp->nordclk) - 1]);
+ flag = 1;
+ /*callf(told, xd, x, x,x,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+
+ /* Initialize tvec */
+ if (scs_imp->blocks[*kf - 1].nevout > 0)
+ {
+ if (scs_imp->funtyp[*kf - 1] < 0)
+ {
+ i = synchro_nev(scs_imp, *kf, ierr);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ i2 = i + scs_imp->clkptr[*kf - 1] - 1;
+ putevs(told, &i2, &ierr1);
+ if (ierr1 != 0)
+ {
+ /* event conflict */
+ *ierr = 3;
+ return;
+ }
+ doit(told);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ }
+ }
+ }
+} /* doit_ */
+/*--------------------------------------------------------------------------*/
+/* Subroutine cdoit */
+static void cdoit(double *told)
+{
+ /* propagation of continuous blocks outputs */
+ /* Copyright INRIA */
+
+ int i2 = 0;
+ scicos_flag flag = 0;
+ int ierr1 = 0;
+ int i = 0, j = 0;
+
+ ScicosImport *scs_imp = NULL;
+ int *kf = NULL;
+
+ scs_imp = getscicosimportptr();
+
+ /* Function Body */
+ for (j = 0; j < * (scs_imp->ncord); j++)
+ {
+ kf = &scs_imp->cord[j];
+ C2F(curblk).kfun = *kf;
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &scs_imp->x[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &scs_imp->xd[scs_imp->xptr[*kf - 1] - 1];
+ }
+ scs_imp->blocks[*kf - 1].nevprt = scs_imp->cord[j + * (scs_imp->ncord)];
+ if (scs_imp->funtyp[*kf - 1] > -1)
+ {
+ flag = 1;
+ /*callf(told, xd, x, x,x,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+
+ /* Initialize tvec */
+ if (scs_imp->blocks[*kf - 1].nevout > 0)
+ {
+ if (scs_imp->funtyp[*kf - 1] < 0)
+ {
+ i = synchro_nev(scs_imp, *kf, ierr);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ i2 = i + scs_imp->clkptr[*kf - 1] - 1;
+ putevs(told, &i2, &ierr1);
+ if (ierr1 != 0)
+ {
+ /* event conflict */
+ *ierr = 3;
+ return;
+ }
+ doit(told);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ }
+ }
+ }
+} /* cdoit_ */
+/*--------------------------------------------------------------------------*/
+/* Subroutine ddoit */
+static void ddoit(double *told)
+{
+ /* update states & event out on discrete activations */
+ /* Copyright INRIA */
+
+ int i2 = 0, j = 0;
+ scicos_flag flag = 0;
+ int kiwa = 0;
+ int i = 0, i3 = 0, ierr1 = 0;
+ int ii = 0, keve = 0;
+
+ ScicosImport *scs_imp = NULL;
+ int *kf = NULL;
+
+ scs_imp = getscicosimportptr();
+
+ /* Function Body */
+ kiwa = 0;
+ edoit(told, &kiwa);
+ if (*ierr != 0)
+ {
+ return;
+ }
+
+ /* update continuous and discrete states on event */
+ if (kiwa == 0)
+ {
+ return;
+ }
+ for (i = 0; i < kiwa; i++)
+ {
+ keve = iwa[i];
+ if (critev[keve] != 0)
+ {
+ hot = 0;
+ }
+ i2 = scs_imp->ordptr[keve] - 1;
+ for (ii = scs_imp->ordptr[keve - 1]; ii <= i2; ii++)
+ {
+ kf = &scs_imp->ordclk[ii - 1];
+ C2F(curblk).kfun = *kf;
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &scs_imp->x[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &scs_imp->xd[scs_imp->xptr[*kf - 1] - 1];
+ }
+
+ scs_imp->blocks[*kf - 1].nevprt = scs_imp->ordclk[ii + * (scs_imp->nordclk) - 1];
+
+ if (scs_imp->blocks[*kf - 1].nevout > 0)
+ {
+ if (scs_imp->funtyp[*kf - 1] >= 0)
+ {
+ /* initialize evout */
+ for (j = 0; j < scs_imp->blocks[*kf - 1].nevout; j++)
+ {
+ scs_imp->blocks[*kf - 1].evout[j] = -1;
+ }
+ flag = 3;
+
+ if (scs_imp->blocks[*kf - 1].nevprt > 0) /* if event has continuous origin don't call*/
+ {
+ /*callf(told, xd, x, x ,x,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+
+ for (j = 0; j < scs_imp->blocks[*kf - 1].nevout; j++)
+ {
+ if (scs_imp->blocks[*kf - 1].evout[j] >= 0.)
+ {
+ i3 = j + scs_imp->clkptr[*kf - 1] ;
+ addevs(scs_imp->blocks[*kf - 1].evout[j] + (*told), &i3, &ierr1);
+ if (ierr1 != 0)
+ {
+ /* event conflict */
+ *ierr = 3;
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ if (scs_imp->blocks[*kf - 1].nevprt > 0)
+ {
+ if (scs_imp->blocks[*kf - 1].nx + scs_imp->blocks[*kf - 1].nz + scs_imp->blocks[*kf - 1].noz > 0 || \
+ *scs_imp->blocks[*kf - 1].work != NULL)
+ {
+ /* if a hidden state exists, must also call (for new scope eg) */
+ /* to avoid calling non-real activations */
+ flag = 2;
+ /*callf(told, xd, x, x,x,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+ }
+ else
+ {
+ if (*scs_imp->blocks[*kf - 1].work != NULL)
+ {
+ flag = 2;
+ scs_imp->blocks[*kf - 1].nevprt = 0; /* in case some hidden continuous blocks need updating */
+ /*callf(told, xd, x, x,x,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+ }
+ }
+ }
+} /* ddoit_ */
+/*--------------------------------------------------------------------------*/
+/* Subroutine edoit */
+static void edoit(double *told, int *kiwa)
+{
+ /* update blocks output on discrete activations */
+ /* Copyright INRIA */
+
+ int i2 = 0;
+ scicos_flag flag = 0;
+ int ierr1 = 0, i = 0;
+ int kever = 0, ii = 0;
+
+ ScicosImport *scs_imp = NULL;
+ int *kf = NULL;
+ int nord = 0;
+
+ scs_imp = getscicosimportptr();
+
+ /* Function Body */
+ kever = *pointi;
+
+ *pointi = evtspt[kever];
+ evtspt[kever] = -1;
+
+ nord = scs_imp->ordptr[kever] - scs_imp->ordptr[kever - 1];
+ if (nord == 0)
+ {
+ return;
+ }
+ iwa[*kiwa] = kever;
+ ++(*kiwa);
+ for (ii = scs_imp->ordptr[kever - 1]; ii <= scs_imp->ordptr[kever] - 1; ii++)
+ {
+ kf = &scs_imp->ordclk[ii - 1];
+ C2F(curblk).kfun = *kf;
+
+ if (scs_imp->funtyp[*kf - 1] > -1)
+ {
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &scs_imp->x[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &scs_imp->xd[scs_imp->xptr[*kf - 1] - 1];
+ }
+
+ scs_imp->blocks[*kf - 1].nevprt = abs(scs_imp->ordclk[ii + * (scs_imp->nordclk) - 1]);
+
+ flag = 1;
+ /*callf(told, xd, x, x,x,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+
+ /* Initialize tvec */
+ if (scs_imp->blocks[*kf - 1].nevout > 0)
+ {
+ if (scs_imp->funtyp[*kf - 1] < 0)
+ {
+ i = synchro_nev(scs_imp, *kf, ierr);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ i2 = i + scs_imp->clkptr[*kf - 1] - 1;
+ putevs(told, &i2, &ierr1);
+ if (ierr1 != 0)
+ {
+ /* event conflict */
+ *ierr = 3;
+ return;
+ }
+ edoit(told, kiwa);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ }
+ }
+ }
+} /* edoit_ */
+/*--------------------------------------------------------------------------*/
+/* Subroutine odoit */
+static void odoit(double *told, double *xt, double *xtd, double *residual)
+{
+ /* update blocks derivative of continuous time block */
+ /* Copyright INRIA */
+
+ int i2 = 0;
+ scicos_flag flag = 0;
+ int keve = 0, kiwa = 0;
+ int ierr1 = 0, i = 0;
+ int ii = 0, jj = 0;
+
+ ScicosImport *scs_imp = NULL;
+ int *kf = NULL;
+
+ scs_imp = getscicosimportptr();
+
+ /* Function Body */
+ kiwa = 0;
+ for (jj = 0; jj < * (scs_imp->noord); jj++)
+ {
+ kf = &scs_imp->oord[jj];
+ C2F(curblk).kfun = *kf;
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &xt[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &xtd[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].res = &residual[scs_imp->xptr[*kf - 1] - 1];
+ }
+
+ scs_imp->blocks[*kf - 1].nevprt = scs_imp->oord[jj + * (scs_imp->noord)];
+ if (scs_imp->funtyp[*kf - 1] > -1)
+ {
+ flag = 1;
+ /*callf(told, xtd, xt, residual,x,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+
+ if (scs_imp->blocks[*kf - 1].nevout > 0)
+ {
+ if (scs_imp->funtyp[*kf - 1] < 0)
+ {
+ if (scs_imp->blocks[*kf - 1].nmode > 0)
+ {
+ i2 = scs_imp->blocks[*kf - 1].mode[0] + scs_imp->clkptr[*kf - 1] - 1;
+ }
+ else
+ {
+ i = synchro_nev(scs_imp, *kf, ierr);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ i2 = i + scs_imp->clkptr[*kf - 1] - 1;
+ }
+ putevs(told, &i2, &ierr1);
+ if (ierr1 != 0)
+ {
+ /* event conflict */
+ *ierr = 3;
+ return;
+ }
+ ozdoit(told, xt, xtd, &kiwa);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ }
+ }
+ }
+
+ /* update states derivatives */
+ for (ii = 0; ii < * (scs_imp->noord); ii++)
+ {
+ kf = &scs_imp->oord[ii];
+ C2F(curblk).kfun = *kf;
+ if (scs_imp->blocks[*kf - 1].nx > 0 || \
+ *scs_imp->blocks[*kf - 1].work != NULL)
+ {
+ /* work tests if a hidden state exists, used for delay block */
+ flag = 0;
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &xt[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &xtd[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].res = &residual[scs_imp->xptr[*kf - 1] - 1];
+ }
+ scs_imp->blocks[*kf - 1].nevprt = scs_imp->oord[ii + * (scs_imp->noord)];
+ /*callf(told, xtd, xt, residual,xt,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+ }
+
+ for (i = 0; i < kiwa; i++)
+ {
+ keve = iwa[i];
+ for (ii = scs_imp->ordptr[keve - 1]; ii <= scs_imp->ordptr[keve] - 1; ii++)
+ {
+ kf = &scs_imp->ordclk[ii - 1];
+ C2F(curblk).kfun = *kf;
+ if (scs_imp->blocks[*kf - 1].nx > 0 || \
+ *scs_imp->blocks[*kf - 1].work != NULL)
+ {
+ /* work tests if a hidden state exists */
+ flag = 0;
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &xt[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &xtd[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].res = &residual[scs_imp->xptr[*kf - 1] - 1];
+ }
+ scs_imp->blocks[*kf - 1].nevprt = abs(scs_imp->ordclk[ii + * (scs_imp->nordclk) - 1]);
+ /*callf(told, xtd, xt, residual,xt,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+ }
+ }
+} /* odoit_ */
+/*--------------------------------------------------------------------------*/
+/* Subroutine reinitdoit */
+static void reinitdoit(double *told)
+{
+ /* update blocks xproperties of continuous time block */
+ /* Copyright INRIA */
+
+ int i2 = 0;
+ scicos_flag flag = 0;
+ int keve = 0, kiwa = 0;
+ int ierr1 = 0, i = 0;
+ int ii = 0, jj = 0;
+
+ ScicosImport *scs_imp = NULL;
+ int *kf = NULL;
+
+ scs_imp = getscicosimportptr();
+
+ /* Function Body */
+ kiwa = 0;
+ for (jj = 0; jj < * (scs_imp->noord); jj++)
+ {
+ kf = &scs_imp->oord[jj];
+ C2F(curblk).kfun = *kf;
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &scs_imp->x[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &scs_imp->xd[scs_imp->xptr[*kf - 1] - 1];
+ }
+ scs_imp->blocks[*kf - 1].nevprt = scs_imp->oord[jj + * (scs_imp->noord)];
+ if (scs_imp->funtyp[*kf - 1] > -1)
+ {
+ flag = 1;
+ /*callf(told, xd, x, x,x,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+
+ if (scs_imp->blocks[*kf - 1].nevout > 0 && scs_imp->funtyp[*kf - 1] < 0)
+ {
+ i = synchro_nev(scs_imp, *kf, ierr);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ if (scs_imp->blocks[*kf - 1].nmode > 0)
+ {
+ scs_imp->blocks[*kf - 1].mode[0] = i;
+ }
+ i2 = i + scs_imp->clkptr[*kf - 1] - 1;
+ putevs(told, &i2, &ierr1);
+ if (ierr1 != 0)
+ {
+ /* event conflict */
+ *ierr = 3;
+ return;
+ }
+ doit(told);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ }
+ }
+
+ /* reinitialize */
+ for (ii = 0; ii < * (scs_imp->noord); ii++)
+ {
+ kf = &scs_imp->oord[ii];
+ C2F(curblk).kfun = *kf;
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ flag = 7;
+ scs_imp->blocks[*kf - 1].x = &scs_imp->x[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &scs_imp->xd[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].res = &scs_imp->xd[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].nevprt = scs_imp->oord[ii + * (scs_imp->noord)];
+ scs_imp->blocks[*kf - 1].xprop = &scs_imp->xprop[-1 + scs_imp->xptr[*kf - 1]];
+ /*callf(told, xd, x, xd,x,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+ }
+
+ for (i = 0; i < kiwa; i++)
+ {
+ keve = iwa[i];
+ for (ii = scs_imp->ordptr[keve - 1]; ii <= scs_imp->ordptr[keve] - 1; ii++)
+ {
+ kf = &scs_imp->ordclk[ii - 1];
+ C2F(curblk).kfun = *kf;
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ flag = 7;
+ scs_imp->blocks[*kf - 1].x = &scs_imp->x[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &scs_imp->xd[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].res = &scs_imp->xd[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].nevprt = abs(scs_imp->ordclk[ii + * (scs_imp->nordclk) - 1]);
+ scs_imp->blocks[*kf - 1].xprop = &scs_imp->xprop[-1 + scs_imp->xptr[*kf - 1]];
+ /*callf(told, xd, x, xd,x,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+ }
+ }
+} /* reinitdoit_ */
+/*--------------------------------------------------------------------------*/
+/* Subroutine ozdoit */
+static void ozdoit(double *told, double *xt, double *xtd, int *kiwa)
+{
+ /* update blocks output of continuous time block on discrete activations */
+ /* Copyright INRIA */
+
+ int i2 = 0;
+ scicos_flag flag = 0;
+ int nord = 0;
+ int ierr1 = 0, i = 0;
+ int ii = 0, kever = 0;
+
+ ScicosImport *scs_imp = NULL;
+ int *kf = NULL;
+
+ scs_imp = getscicosimportptr();
+
+ /* Function Body */
+ kever = *pointi;
+ *pointi = evtspt[kever];
+ evtspt[kever] = -1;
+
+ nord = scs_imp->ordptr[kever] - scs_imp->ordptr[kever - 1];
+ if (nord == 0)
+ {
+ return;
+ }
+ iwa[*kiwa] = kever;
+ ++(*kiwa);
+
+ for (ii = scs_imp->ordptr[kever - 1]; ii <= scs_imp->ordptr[kever] - 1; ii++)
+ {
+ kf = &scs_imp->ordclk[ii - 1];
+ C2F(curblk).kfun = *kf;
+ if (scs_imp->funtyp[*kf - 1] > -1)
+ {
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &xt[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &xtd[scs_imp->xptr[*kf - 1] - 1];
+ }
+ scs_imp->blocks[*kf - 1].nevprt = abs(scs_imp->ordclk[ii + * (scs_imp->nordclk) - 1]);
+ flag = 1;
+ /*callf(told, xtd, xt, xt,x,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+
+ /* Initialize tvec */
+ if (scs_imp->blocks[*kf - 1].nevout > 0)
+ {
+ if (scs_imp->funtyp[*kf - 1] < 0)
+ {
+ if (phase == 1 || scs_imp->blocks[*kf - 1].nmode == 0)
+ {
+ i = synchro_nev(scs_imp, *kf, ierr);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ }
+ else
+ {
+ i = scs_imp->blocks[*kf - 1].mode[0];
+ }
+ i2 = i + scs_imp->clkptr[*kf - 1] - 1;
+ putevs(told, &i2, &ierr1);
+ if (ierr1 != 0)
+ {
+ /* event conflict */
+ *ierr = 3;
+ return;
+ }
+ ozdoit(told, xt, xtd, kiwa);
+ }
+ }
+ }
+} /* ozdoit_ */
+/*--------------------------------------------------------------------------*/
+/* Subroutine zdoit */
+static void zdoit(double *told, double *xt, double *xtd, double *g)
+{
+ /* update blocks zcross of continuous time block */
+ /* Copyright INRIA */
+ int i2 = 0;
+ scicos_flag flag = 0;
+ int keve = 0, kiwa = 0;
+ int ierr1 = 0, i = 0, j = 0;
+ int ii = 0, jj = 0;
+
+ ScicosImport *scs_imp = NULL;
+ int *kf = NULL;
+
+ scs_imp = getscicosimportptr();
+
+ /* Function Body */
+ for (i = 0; i < * (scs_imp->ng); i++)
+ {
+ g[i] = 0.;
+ }
+
+ kiwa = 0;
+ for (jj = 0; jj < * (scs_imp->nzord); jj++)
+ {
+ kf = &scs_imp->zord[jj];
+ C2F(curblk).kfun = *kf;
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &xt[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &xtd[scs_imp->xptr[*kf - 1] - 1];
+ }
+ scs_imp->blocks[*kf - 1].nevprt = scs_imp->zord[jj + * (scs_imp->nzord)];
+
+ if (scs_imp->funtyp[*kf - 1] > -1)
+ {
+ flag = 1;
+ /*callf(told, xtd, xt, xt,xt,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+
+ /* Initialize tvec */
+ if (scs_imp->blocks[*kf - 1].nevout > 0)
+ {
+ if (scs_imp->funtyp[*kf - 1] < 0)
+ {
+ if (phase == 1 || scs_imp->blocks[*kf - 1].nmode == 0)
+ {
+ i = synchro_nev(scs_imp, *kf, ierr);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ }
+ else
+ {
+ i = scs_imp->blocks[*kf - 1].mode[0];
+ }
+ i2 = i + scs_imp->clkptr[*kf - 1] - 1;
+ putevs(told, &i2, &ierr1);
+ if (ierr1 != 0)
+ {
+ /* event conflict */
+ *ierr = 3;
+ return;
+ }
+ ozdoit(told, xt, xtd, &kiwa);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ }
+ }
+ }
+
+ /* update zero crossing surfaces */
+ for (ii = 0; ii < * (scs_imp->nzord); ii++)
+ {
+ kf = &scs_imp->zord[ii];
+ C2F(curblk).kfun = *kf;
+ if (scs_imp->blocks[*kf - 1].ng > 0)
+ {
+ /* update g array ptr */
+ scs_imp->blocks[*kf - 1].g = &g[scs_imp->zcptr[*kf - 1] - 1];
+ if (scs_imp->funtyp[*kf - 1] > 0)
+ {
+ flag = 9;
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &xt[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &xtd[scs_imp->xptr[*kf - 1] - 1];
+ }
+ scs_imp->blocks[*kf - 1].nevprt = scs_imp->zord[ii + * (scs_imp->nzord)];
+ /*callf(told, xtd, xt, xtd,g,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+ else
+ {
+ j = synchro_g_nev(scs_imp, g, *kf, ierr);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ if ( (phase == 1) && (scs_imp->blocks[*kf - 1].nmode > 0) )
+ {
+ scs_imp->blocks[*kf - 1].mode[0] = j;
+ }
+ }
+
+ // scs_imp->blocks[*kf-1].g = &scs_imp->g[scs_imp->zcptr[*kf]-1];
+
+ }
+ }
+
+ for (i = 0; i < kiwa; i++)
+ {
+ keve = iwa[i];
+ for (ii = scs_imp->ordptr[keve - 1]; ii <= scs_imp->ordptr[keve] - 1; ii++)
+ {
+ kf = &scs_imp->ordclk[ii - 1];
+ C2F(curblk).kfun = *kf;
+ if (scs_imp->blocks[*kf - 1].ng > 0)
+ {
+ /* update g array ptr */
+ scs_imp->blocks[*kf - 1].g = &g[scs_imp->zcptr[*kf - 1] - 1];
+ if (scs_imp->funtyp[*kf - 1] > 0)
+ {
+ flag = 9;
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &xt[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &xtd[scs_imp->xptr[*kf - 1] - 1];
+ }
+ scs_imp->blocks[*kf - 1].nevprt = abs(scs_imp->ordclk[ii + * (scs_imp->nordclk) - 1]);
+ /*callf(told, xtd, xt, xtd,g,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+ else
+ {
+ j = synchro_g_nev(scs_imp, g, *kf, ierr);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ if ((phase == 1) && (scs_imp->blocks[*kf - 1].nmode > 0))
+ {
+ scs_imp->blocks[*kf - 1].mode[0] = j;
+ }
+ }
+
+ //scs_imp->blocks[*kf-1].g = &scs_imp->g[scs_imp->zcptr[*kf]-1];
+ }
+ }
+ }
+} /* zdoit_ */
+/*--------------------------------------------------------------------------*/
+/* Subroutine Jdoit */
+void Jdoit(double *told, double *xt, double *xtd, double *residual, int *job)
+{
+ /* update blocks jacobian of continuous time block */
+ /* Copyright INRIA */
+
+ int i2 = 0;
+ scicos_flag flag = 0;
+ int keve = 0, kiwa = 0;
+ int ierr1 = 0, i = 0;
+ int ii = 0, jj = 0;
+
+ ScicosImport *scs_imp = NULL;
+ int *kf = NULL;
+
+ scs_imp = getscicosimportptr();
+
+ /* Function Body */
+ kiwa = 0;
+ for (jj = 0; jj < * (scs_imp->noord); jj++)
+ {
+ kf = &scs_imp->oord[jj];
+ C2F(curblk).kfun = *kf;
+ scs_imp->blocks[*kf - 1].nevprt = scs_imp->oord[jj + * (scs_imp->noord)];
+ if (scs_imp->funtyp[*kf - 1] > -1)
+ {
+ flag = 1;
+ /* applying desired output */
+ if ((*job == 2) && (scs_imp->oord[jj] == AJacobian_block))
+ {
+ }
+ else
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &xt[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &xtd[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].res = &residual[scs_imp->xptr[*kf - 1] - 1];
+ }
+
+ /*callf(told, xtd, xt, residual,x,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+
+ if (scs_imp->blocks[*kf - 1].nevout > 0)
+ {
+ if (scs_imp->funtyp[*kf - 1] < 0)
+ {
+ if (scs_imp->blocks[*kf - 1].nmode > 0)
+ {
+ i2 = scs_imp->blocks[*kf - 1].mode[0] + scs_imp->clkptr[*kf - 1] - 1;
+ }
+ else
+ {
+ i = synchro_nev(scs_imp, *kf, ierr);
+ if (*ierr != 0)
+ {
+ return;
+ }
+ i2 = i + scs_imp->clkptr[*kf - 1] - 1;
+ }
+ putevs(told, &i2, &ierr1);
+ if (ierr1 != 0)
+ {
+ /* event conflict */
+ *ierr = 3;
+ return;
+ }
+ ozdoit(told, xt, xtd, &kiwa);
+ }
+ }
+ }
+
+ /* update states derivatives */
+ for (ii = 0; ii < * (scs_imp->noord); ii++)
+ {
+ kf = &scs_imp->oord[ii];
+ C2F(curblk).kfun = *kf;
+ if (scs_imp->blocks[*kf - 1].nx > 0 || \
+ *scs_imp->blocks[*kf - 1].work != NULL)
+ {
+ /* work tests if a hidden state exists, used for delay block */
+ flag = 0;
+ if (((*job == 1) && (scs_imp->oord[ii] == AJacobian_block)) || (*job != 1))
+ {
+ if (*job == 1)
+ {
+ flag = 10;
+ }
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &xt[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &xtd[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].res = &residual[scs_imp->xptr[*kf - 1] - 1];
+ }
+ scs_imp->blocks[*kf - 1].nevprt = scs_imp->oord[ii + * (scs_imp->noord)];
+ /*callf(told, xtd, xt, residual,xt,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ }
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+ }
+
+ for (i = 0; i < kiwa; i++)
+ {
+ keve = iwa[i];
+ for (ii = scs_imp->ordptr[keve - 1]; ii <= scs_imp->ordptr[keve] - 1; ii++)
+ {
+ kf = &scs_imp->ordclk[ii - 1];
+ C2F(curblk).kfun = *kf;
+ if (scs_imp->blocks[*kf - 1].nx > 0 || \
+ *scs_imp->blocks[*kf - 1].work != NULL)
+ {
+ /* work tests if a hidden state exists */
+ flag = 0;
+ if (((*job == 1) && (scs_imp->oord[ii - 1] == AJacobian_block)) || (*job != 1))
+ {
+ if (*job == 1)
+ {
+ flag = 10;
+ }
+ /* continuous state */
+ if (scs_imp->blocks[*kf - 1].nx > 0)
+ {
+ scs_imp->blocks[*kf - 1].x = &xt[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].xd = &xtd[scs_imp->xptr[*kf - 1] - 1];
+ scs_imp->blocks[*kf - 1].res = &residual[scs_imp->xptr[*kf - 1] - 1];
+ }
+ scs_imp->blocks[*kf - 1].nevprt = abs(scs_imp->ordclk[ii + * (scs_imp->nordclk) - 1]);
+ /*callf(told, xtd, xt, residual,xt,&flag);*/
+ callf(told, &scs_imp->blocks[*kf - 1], &flag);
+ }
+ if (flag < 0)
+ {
+ *ierr = 5 - flag;
+ return;
+ }
+ }
+ }
+ }
+} /* Jdoit_ */
+/*--------------------------------------------------------------------------*/
+/* Subroutine synchro_nev */
+static int synchro_nev(ScicosImport *scs_imp, int kf, int *ierr)
+{
+ /* synchro blocks computation */
+ /* Copyright INRIA */
+ SCSREAL_COP *outtbdptr = NULL; /*to store double of outtb*/
+ SCSINT8_COP *outtbcptr = NULL; /*to store int8 of outtb*/
+ SCSINT16_COP *outtbsptr = NULL; /*to store int16 of outtb*/
+ SCSINT32_COP *outtblptr = NULL; /*to store int32 of outtb*/
+ SCSUINT8_COP *outtbucptr = NULL; /*to store unsigned int8 of outtb */
+ SCSUINT16_COP *outtbusptr = NULL; /*to store unsigned int16 of outtb */
+ SCSUINT32_COP *outtbulptr = NULL; /*to store unsigned int32 of outtb */
+
+ int cond = 0;
+ int i = 0; /* return 0 by default */
+
+ /* variable for param */
+ int *outtbtyp = 0;
+ void **outtbptr = NULL;
+ int *funtyp = 0;
+ int *inplnk = 0;
+ int *inpptr = 0;
+
+ /* get param ptr */
+ outtbtyp = scs_imp->outtbtyp;
+ outtbptr = scs_imp->outtbptr;
+ funtyp = scs_imp->funtyp;
+ inplnk = scs_imp->inplnk;
+ inpptr = scs_imp->inpptr;
+
+ /* if-then-else blk */
+ if (funtyp[kf - 1] == -1)
+ {
+ switch (outtbtyp[-1 + inplnk[inpptr[kf - 1] - 1]])
+ {
+ case SCSREAL_N :
+ outtbdptr = (SCSREAL_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ cond = (*outtbdptr <= 0.);
+ break;
+
+ case SCSCOMPLEX_N :
+ outtbdptr = (SCSCOMPLEX_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ cond = (*outtbdptr <= 0.);
+ break;
+
+ case SCSINT8_N :
+ outtbcptr = (SCSINT8_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ cond = (*outtbcptr <= 0);
+ break;
+
+ case SCSINT16_N :
+ outtbsptr = (SCSINT16_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ cond = (*outtbsptr <= 0);
+ break;
+
+ case SCSINT32_N :
+ outtblptr = (SCSINT32_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ cond = (*outtblptr <= 0);
+ break;
+
+ case SCSUINT8_N :
+ outtbucptr = (SCSUINT8_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ cond = (*outtbucptr <= 0);
+ break;
+
+ case SCSUINT16_N :
+ outtbusptr = (SCSUINT16_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ cond = (*outtbusptr <= 0);
+ break;
+
+ case SCSUINT32_N :
+ outtbulptr = (SCSUINT32_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ cond = (*outtbulptr <= 0);
+ break;
+
+ default : /* Add a message here */
+ *ierr = 25;
+ return 0;
+ }
+ if (cond)
+ {
+ i = 2;
+ }
+ else
+ {
+ i = 1;
+ }
+ }
+ /* eselect blk */
+ else if (funtyp[kf - 1] == -2)
+ {
+ switch (outtbtyp[-1 + inplnk[inpptr[kf - 1] - 1]])
+ {
+ case SCSREAL_N :
+ outtbdptr = (SCSREAL_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ i = Max(Min((int) * outtbdptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSCOMPLEX_N :
+ outtbdptr = (SCSCOMPLEX_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ i = Max(Min((int) * outtbdptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSINT8_N :
+ outtbcptr = (SCSINT8_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ i = Max(Min((int) * outtbcptr,
+ scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSINT16_N :
+ outtbsptr = (SCSINT16_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ i = Max(Min((int) * outtbsptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSINT32_N :
+ outtblptr = (SCSINT32_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ i = Max(Min((int) * outtblptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSUINT8_N :
+ outtbucptr = (SCSUINT8_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ i = Max(Min((int) * outtbucptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSUINT16_N :
+ outtbusptr = (SCSUINT16_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ i = Max(Min((int) * outtbusptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSUINT32_N :
+ outtbulptr = (SCSUINT32_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ i = Max(Min((int) * outtbulptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ default : /* Add a message here */
+ *ierr = 25;
+ return 0;
+ }
+ }
+ return i;
+} /* synchro_nev */
+/*--------------------------------------------------------------------------*/
+/* Subroutine synchro_g_nev */
+static int synchro_g_nev(ScicosImport *scs_imp, double *g, int kf, int *ierr)
+{
+ /* synchro blocks with zcross computation */
+ /* Copyright INRIA */
+ SCSREAL_COP *outtbdptr = NULL; /*to store double of outtb*/
+ SCSINT8_COP *outtbcptr = NULL; /*to store int8 of outtb*/
+ SCSINT16_COP *outtbsptr = NULL; /*to store int16 of outtb*/
+ SCSINT32_COP *outtblptr = NULL; /*to store int32 of outtb*/
+ SCSUINT8_COP *outtbucptr = NULL; /*to store unsigned int8 of outtb */
+ SCSUINT16_COP *outtbusptr = NULL; /*to store unsigned int16 of outtb */
+ SCSUINT32_COP *outtbulptr = NULL; /*to store unsigned int32 of outtb */
+
+ int cond = 0;
+ int i = 0; /* return 0 by default */
+ int jj = 0;
+
+ /* variable for param */
+ int *outtbtyp = NULL;
+ void **outtbptr = NULL;
+ int *funtyp = NULL;
+ int *inplnk = NULL;
+ int *inpptr = NULL;
+ int *zcptr = NULL;
+
+ /* get param ptr */
+ outtbtyp = scs_imp->outtbtyp;
+ outtbptr = scs_imp->outtbptr;
+ funtyp = scs_imp->funtyp;
+ inplnk = scs_imp->inplnk;
+ inpptr = scs_imp->inpptr;
+ zcptr = scs_imp->zcptr;
+
+ /* if-then-else blk */
+ if (funtyp[kf - 1] == -1)
+ {
+ switch (outtbtyp[-1 + inplnk[inpptr[kf - 1] - 1]])
+ {
+ case SCSREAL_N :
+ outtbdptr = (SCSREAL_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ g[zcptr[kf - 1] - 1] = *outtbdptr;
+ cond = (*outtbdptr <= 0.);
+ break;
+
+ case SCSCOMPLEX_N :
+ outtbdptr = (SCSCOMPLEX_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ g[zcptr[kf - 1] - 1] = *outtbdptr;
+ cond = (*outtbdptr <= 0.);
+ break;
+
+ case SCSINT8_N :
+ outtbcptr = (SCSINT8_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ g[zcptr[kf - 1] - 1] = (double) * outtbcptr;
+ cond = (*outtbcptr <= 0);
+ break;
+
+ case SCSINT16_N :
+ outtbsptr = (SCSINT16_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ g[zcptr[kf - 1] - 1] = (double) * outtbsptr;
+ cond = (*outtbsptr <= 0);
+ break;
+
+ case SCSINT32_N :
+ outtblptr = (SCSINT32_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ g[zcptr[kf - 1] - 1] = (double) * outtblptr;
+ cond = (*outtblptr <= 0);
+ break;
+
+ case SCSUINT8_N :
+ outtbucptr = (SCSUINT8_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ g[zcptr[kf - 1] - 1] = (double) * outtbucptr;
+ cond = (*outtbucptr <= 0);
+ break;
+
+ case SCSUINT16_N :
+ outtbusptr = (SCSUINT16_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ g[zcptr[kf - 1] - 1] = (double) * outtbusptr;
+ cond = (*outtbusptr <= 0);
+ break;
+
+ case SCSUINT32_N :
+ outtbulptr = (SCSUINT32_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ g[zcptr[kf - 1] - 1] = (double) * outtbulptr;
+ cond = (*outtbulptr <= 0);
+ break;
+
+ default : /* Add a message here */
+ *ierr = 25;
+ return 0;
+ }
+ if (cond)
+ {
+ i = 2;
+ }
+ else
+ {
+ i = 1;
+ }
+ }
+ /* eselect blk */
+ else if (funtyp[kf - 1] == -2)
+ {
+ switch (outtbtyp[-1 + inplnk[inpptr[kf - 1] - 1]])
+ {
+ case SCSREAL_N :
+ outtbdptr = (SCSREAL_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ for (jj = 0; jj < scs_imp->blocks[kf - 1].nevout - 1; jj++)
+ {
+ g[zcptr[kf - 1] - 1 + jj] = *outtbdptr - (double)(jj + 2);
+ }
+ i = Max(Min((int) * outtbdptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSCOMPLEX_N :
+ outtbdptr = (SCSCOMPLEX_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ for (jj = 0; jj < scs_imp->blocks[kf - 1].nevout - 1; jj++)
+ {
+ g[zcptr[kf - 1] - 1 + jj] = *outtbdptr - (double)(jj + 2);
+ }
+ i = Max(Min((int) * outtbdptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSINT8_N :
+ outtbcptr = (SCSINT8_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ for (jj = 0; jj < scs_imp->blocks[kf - 1].nevout - 1; jj++)
+ {
+ g[zcptr[kf - 1] - 1 + jj] = (double) * outtbcptr - (double)(jj + 2);
+ }
+ i = Max(Min((int) * outtbcptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSINT16_N :
+ outtbsptr = (SCSINT16_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ for (jj = 0; jj < scs_imp->blocks[kf - 1].nevout - 1; jj++)
+ {
+ g[zcptr[kf - 1] - 1 + jj] = (double) * outtbsptr - (double)(jj + 2);
+ }
+ i = Max(Min((int) * outtbsptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSINT32_N :
+ outtblptr = (SCSINT32_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ for (jj = 0; jj < scs_imp->blocks[kf - 1].nevout - 1; jj++)
+ {
+ g[zcptr[kf - 1] - 1 + jj] = (double) * outtblptr - (double)(jj + 2);
+ }
+ i = Max(Min((int) * outtblptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSUINT8_N :
+ outtbucptr = (SCSUINT8_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ for (jj = 0; jj < scs_imp->blocks[kf - 1].nevout - 1; jj++)
+ {
+ g[zcptr[kf - 1] - 1 + jj] = (double) * outtbucptr - (double)(jj + 2);
+ }
+ i = Max(Min((int) * outtbucptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSUINT16_N :
+ outtbusptr = (SCSUINT16_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ for (jj = 0; jj < scs_imp->blocks[kf - 1].nevout - 1; jj++)
+ {
+ g[zcptr[kf - 1] - 1 + jj] = (double) * outtbusptr - (double)(jj + 2);
+ }
+ i = Max(Min((int) * outtbusptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ case SCSUINT32_N :
+ outtbulptr = (SCSUINT32_COP *)outtbptr[-1 + inplnk[inpptr[kf - 1] - 1]];
+ for (jj = 0; jj < scs_imp->blocks[kf - 1].nevout - 1; jj++)
+ {
+ g[zcptr[kf - 1] - 1 + jj] = (double) * outtbulptr - (double)(jj + 2);
+ }
+ i = Max(Min((int) * outtbulptr, scs_imp->blocks[kf - 1].nevout), 1);
+ break;
+
+ default : /* Add a message here */
+ *ierr = 25;
+ return 0;
+ }
+ }
+ return i;
+} /* synchro_g_nev */
+/*--------------------------------------------------------------------------*/
+/* FREE_blocks */
+static void FREE_blocks()
+{
+ int kf = 0;
+ for (kf = 0; kf < nblk; ++kf)
+ {
+ if (Blocks[kf].insz != NULL)
+ {
+ FREE(Blocks[kf].insz);
+ }
+ else
+ {
+ break;
+ }
+ if (Blocks[kf].inptr != NULL)
+ {
+ FREE(Blocks[kf].inptr);
+ }
+ else
+ {
+ break;
+ }
+ if (Blocks[kf].outsz != NULL)
+ {
+ FREE(Blocks[kf].outsz);
+ }
+ else
+ {
+ break;
+ }
+ if (Blocks[kf].outptr != NULL)
+ {
+ FREE(Blocks[kf].outptr);
+ }
+ else
+ {
+ break;
+ }
+ if (Blocks[kf].oparsz != NULL)
+ {
+ FREE(Blocks[kf].oparsz);
+ }
+ else
+ {
+ break;
+ }
+ if (Blocks[kf].ozsz != NULL)
+ {
+ FREE(Blocks[kf].ozsz);
+ }
+ else
+ {
+ break;
+ }
+ if (Blocks[kf].label != NULL)
+ {
+ FREE(Blocks[kf].label);
+ }
+ else
+ {
+ break;
+ }
+ if (Blocks[kf].uid != NULL)
+ {
+ FREE(Blocks[kf].uid);
+ }
+ else
+ {
+ break;
+ }
+ if (Blocks[kf].evout != NULL)
+ {
+ FREE(Blocks[kf].evout);
+ }
+ else
+ {
+ break;
+ }
+ }
+ FREE(Blocks);
+
+ if (nx > 0)
+ {
+ FREE(xprop);
+ }
+
+ if (nmod > 0)
+ {
+ FREE(mod);
+ }
+
+ if (ng > 0)
+ {
+ FREE(g);
+ }
+
+ return;
+} /* FREE_blocks */
+/*--------------------------------------------------------------------------*/
+/* Subroutine funnum */
+int C2F(funnum)(char * fname)
+{
+ int i = 0, ln = 0;
+ int loc = -1;
+ while ( tabsim[i].name != (char *) NULL)
+ {
+ if ( strcmp(fname, tabsim[i].name) == 0 )
+ {
+ return (i + 1);
+ }
+ i++;
+ }
+ ln = (int)strlen(fname);
+ C2F(iislink)(fname, &loc);
+ C2F(iislink)(fname, &loc);
+ if (loc >= 0)
+ {
+ return (ntabsim + (int)loc + 1);
+ }
+ return (0);
+}/* funnum */
+/*--------------------------------------------------------------------------*/
+int get_phase_simulation(void)
+{
+ return phase;
+}
+/*--------------------------------------------------------------------------*/
+void do_cold_restart(void)
+{
+ hot = 0;
+ return;
+}
+/*--------------------------------------------------------------------------*/
+/* get_scicos_time : return the current
+* simulation time
+*/
+double get_scicos_time(void)
+{
+ return scicos_time;
+}
+/*--------------------------------------------------------------------------*/
+/*! \brief set the current simulation time before calling blocks
+ *
+ * As some of the blocks call get_scicos_time(), this is the only way to force
+ * a local time for these blocks. This call does not modify the Xcos solver
+ * time but is only used to step to a future point while calling blocks.
+ */
+void set_scicos_time(double t)
+{
+ scicos_time = t;
+}
+/*--------------------------------------------------------------------------*/
+/* get_block_number : return the current
+* block number
+*/
+int get_block_number(void)
+{
+ return C2F(curblk).kfun;
+}
+/*--------------------------------------------------------------------------*/
+/* set_block_error : set an error number
+* for block_error
+*/
+void set_block_error(int err)
+{
+ *block_error = err;
+}
+/*--------------------------------------------------------------------------*/
+/* Coserror : copy an error message
+* in coserr.buf an set block_error to
+* -16
+*/
+#if _MSC_VER
+#ifndef vsnprintf
+#define vsnprintf _vsnprintf
+#endif
+#endif
+
+
+void Coserror(const char *fmt, ...)
+{
+ int retval;
+ va_list ap;
+
+ va_start(ap, fmt);
+
+#ifdef vsnprintf
+ retval = vsnprintf(coserr.buf, COSERR_len, fmt, ap);
+#else
+ retval = vsprintf(coserr.buf, fmt, ap);
+#endif
+
+ if (retval == -1)
+ {
+ coserr.buf[0] = '\0';
+ }
+
+ va_end(ap);
+
+ /* coserror use error number 10 */
+ *block_error = -5;
+}
+/*--------------------------------------------------------------------------*/
+/* SundialsErrHandler: in case of a Sundials error,
+* call Coserror() to write it in coserr.buf
+*
+* The unused parameters are there to square with Sundials' IDA error function, for better genericity.
+*/
+void SundialsErrHandler(int error_code, const char *module, const char *function, char *msg, void *user_data)
+{
+ Coserror("%s: %s", function, msg);
+}
+/*--------------------------------------------------------------------------*/
+/* get_block_error : get the block error
+* number
+*/
+int get_block_error()
+{
+ return *block_error;
+}
+/*--------------------------------------------------------------------------*/
+void end_scicos_sim()
+{
+ C2F(coshlt).halt = 2;
+ return;
+}
+/*--------------------------------------------------------------------------*/
+/* get_pointer_xproperty */
+int* get_pointer_xproperty()
+{
+ return &xprop[-1 + xptr[C2F(curblk).kfun]];
+}
+/*--------------------------------------------------------------------------*/
+/* get_Npointer_xproperty */
+int get_npointer_xproperty()
+{
+ return Blocks[C2F(curblk).kfun - 1].nx;
+}
+/*--------------------------------------------------------------------------*/
+/* set_pointer_xproperty */
+void set_pointer_xproperty(int* pointer)
+{
+ int i;
+ for (i = 0; i < Blocks[C2F(curblk).kfun - 1].nx; i++)
+ {
+ Blocks[C2F(curblk).kfun - 1].xprop[i] = pointer[i];
+ }
+}
+/*--------------------------------------------------------------------------*/
+/* Jacobian */
+void Set_Jacobian_flag(int flag)
+{
+ Jacobian_Flag = flag;
+ return;
+}
+/*--------------------------------------------------------------------------*/
+/* Get_Jacobian_ci et Get_Jacobian_cj were called by the C file only produced
+by Modelicac v 1.11.2 */
+/* double Get_Jacobian_ci(void)
+{
+return CI;
+} */
+/*--------------------------------------------------------------------------*/
+/* double Get_Jacobian_cj(void)
+{
+return CJ;
+} */
+/*--------------------------------------------------------------------------*/
+/* Function called by the C file produced by Modelicac 1.7.3 and 1.12.1 */
+double Get_Jacobian_parameter(void)
+{
+ return CJJ;
+}
+/*--------------------------------------------------------------------------*/
+double Get_Scicos_SQUR(void)
+{
+ return SQuround;
+}
+/*--------------------------------------------------------------------------*/
+static int Jacobians(long int Neq, realtype tt, realtype cj, N_Vector yy,
+ N_Vector yp, N_Vector resvec, DlsMat Jacque, void *jdata,
+ N_Vector tempv1, N_Vector tempv2, N_Vector tempv3)
+{
+ double ttx = 0;
+ double *xc = NULL, *xcdot = NULL, *residual = NULL;
+ /* char chr;*/
+ int i = 0, j = 0, n = 0, nx = 0, ni = 0, no = 0, nb = 0, m = 0, flag = 0;
+ double *RX = NULL, *Fx = NULL, *Fu = NULL, *Gx = NULL, *Gu = NULL, *ERR1 = NULL, *ERR2 = NULL;
+ double *Hx = NULL, *Hu = NULL, *Kx = NULL, *Ku = NULL, *HuGx = NULL, *FuKx = NULL, *FuKuGx = NULL, *HuGuKx = NULL;
+ double ysave = 0;
+ int job = 0;
+ double **y = NULL;
+ double **u = NULL;
+ /* taill1= 3*n+(n+ni)*(n+no)+nx(2*nx+ni+2*m+no)+m*(2*m+no+ni)+2*ni*no*/
+ double inc = 0., inc_inv = 0., xi = 0., xpi = 0., srur = 0.;
+ realtype *Jacque_col = NULL;
+
+ UserData data;
+ realtype hh = 0.;
+ N_Vector ewt;
+ double *ewt_data = NULL;
+
+ *ierr = 0;
+
+ data = (UserData) jdata;
+ ewt = data->ewt;
+
+ flag = IDAGetCurrentStep(data->dae_mem, &hh);
+ if (flag < 0)
+ {
+ *ierr = 200 + (-flag);
+ return (*ierr);
+ };
+
+ flag = IDAGetErrWeights(data->dae_mem, ewt);
+ if (flag < 0)
+ {
+ *ierr = 200 + (-flag);
+ return (*ierr);
+ };
+
+ ewt_data = NV_DATA_S(ewt);
+ xc = (double *) N_VGetArrayPointer(yy);
+ xcdot = (double *) N_VGetArrayPointer(yp);
+ /*residual=(double *) NV_DATA_S(resvec);*/
+ ttx = (double)tt;
+ // CJ=(double)cj; // for fonction Get_Jacobian_cj
+ CJJ = (double)cj; // returned by Get_Jacobian_parameter
+
+ srur = (double) RSqrt(UNIT_ROUNDOFF);
+
+ if (AJacobian_block > 0)
+ {
+ nx = Blocks[AJacobian_block - 1].nx; /* quant on est là cela signifie que AJacobian_block>0 */
+ no = Blocks[AJacobian_block - 1].nout;
+ ni = Blocks[AJacobian_block - 1].nin;
+ y = (double **)Blocks[AJacobian_block - 1].outptr; /*for compatibility */
+ u = (double **)Blocks[AJacobian_block - 1].inptr; /*warning pointer of y and u have changed to void ***/
+ }
+ else
+ {
+ nx = 0;
+ no = 0;
+ ni = 0;
+ }
+ n = Neq;
+ nb = nblk;
+ m = n - nx;
+
+ residual = (double *)data->rwork;
+ ERR1 = residual + n;
+ ERR2 = ERR1 + n;
+ RX = ERR2 + n;
+ Fx = RX + (n + ni) * (n + no); /* car (nx+ni)*(nx+no) peut etre > `a n*n*/
+ Fu = Fx + nx * nx;
+ Gx = Fu + nx * ni;
+ Gu = Gx + no * nx;
+ Hx = Gu + no * ni;
+ Hu = Hx + m * m;
+ Kx = Hu + m * no;
+ Ku = Kx + ni * m;
+ HuGx = Ku + ni * no;
+ FuKx = HuGx + m * nx;
+ FuKuGx = FuKx + nx * m;
+ HuGuKx = FuKuGx + nx * nx;
+ /* HuGuKx+m*m; => m*m=size of HuGuKx */
+ /* ------------------ Numerical Jacobian--->> Hx,Kx */
+
+ /* read residuals;*/
+ job = 0;
+ Jdoit(&ttx, xc, xcdot, residual, &job);
+ if (*ierr < 0)
+ {
+ return -1;
+ }
+
+ /* "residual" already contains the current residual,
+ so the first call to Jdoit can be removed */
+
+ for (i = 0; i < m; i++)
+ for (j = 0; j < ni; j++)
+ {
+ Kx[j + i * ni] = u[j][0];
+ }
+
+ for (i = 0; i < m; i++)
+ {
+ xi = xc[i];
+ xpi = xcdot[i];
+ inc = MAX( srur * MAX( ABS(xi), ABS(hh * xpi)), ONE / ewt_data[i] );
+ if (hh * xpi < ZERO)
+ {
+ inc = -inc;
+ }
+ inc = (xi + inc) - xi;
+
+ /* if (CI==0) {
+ inc = MAX( srur * ABS(hh*xpi),ONE );
+ if (hh*xpi < ZERO) inc = -inc;
+ inc = (xpi + inc) - xi;
+ } */
+ // xc[i] += CI*inc;
+ // xcdot[i] += CJ*inc;
+ xc[i] += inc;
+ xcdot[i] += CJJ * inc;
+ /*a= Max(abs(H[0]*xcdot[i]),abs(1.0/Ewt[i]));
+ b= Max(1.0,abs(xc[i]));
+ del=SQUR[0]*Max(a,b); */
+ job = 0; /* read residuals */
+ Jdoit(&ttx, xc, xcdot, ERR2, &job);
+ if (*ierr < 0)
+ {
+ return -1;
+ }
+ inc_inv = ONE / inc;
+ for (j = 0; j < m; j++)
+ {
+ Hx[m * i + j] = (ERR2[j] - residual[j]) * inc_inv;
+ }
+ for (j = 0; j < ni; j++)
+ {
+ Kx[j + i * ni] = (u[j][0] - Kx[j + i * ni]) * inc_inv;
+ }
+ xc[i] = xi;
+ xcdot[i] = xpi;
+ }
+ /*----- Numerical Jacobian--->> Hu,Ku */
+
+ if (AJacobian_block == 0)
+ {
+ for (j = 0; j < m; j++)
+ {
+ Jacque_col = DENSE_COL(Jacque, j);
+ for (i = 0; i < m; i++)
+ {
+ Jacque_col[i] = Hx[i + j * m];
+ }
+ }
+ C2F(ierode).iero = *ierr;
+ return 0;
+ }
+ /****------------------***/
+ job = 0;
+ Jdoit(&ttx, xc, xcdot, ERR1, &job);
+ for (i = 0; i < no; i++)
+ for (j = 0; j < ni; j++)
+ {
+ Ku[j + i * ni] = u[j][0];
+ }
+
+ for (i = 0; i < no; i++)
+ {
+ ysave = y[i][0];
+ inc = srur * MAX( ABS(ysave), 1);
+ inc = (ysave + inc) - ysave;
+ /*del=SQUR[0]* Max(1.0,abs(y[i][0]));
+ del=(y[i][0]+del)-y[i][0];*/
+ y[i][0] += inc;
+ job = 2; /* applying y[i][0] to the output of imp block*/
+ Jdoit(&ttx, xc, xcdot, ERR2, &job);
+ if (*ierr < 0)
+ {
+ return -1;
+ }
+ inc_inv = ONE / inc;
+ for (j = 0; j < m; j++)
+ {
+ Hu[m * i + j] = (ERR2[j] - ERR1[j]) * inc_inv;
+ }
+ for (j = 0; j < ni; j++)
+ {
+ Ku[j + i * ni] = (u[j][0] - Ku[j + i * ni]) * inc_inv;
+ }
+ y[i][0] = ysave;
+ }
+ /*----------------------------------------------*/
+ job = 1; /* read jacobian through flag=10; */
+ *block_error = 0;
+ Jdoit(&ttx, xc, xcdot, &Fx[-m], &job);/* Filling up the FX:Fu:Gx:Gu*/
+ if (*block_error != 0)
+ {
+ sciprint(_("\n error in Jacobian"));
+ }
+ /*-------------------------------------------------*/
+
+ Multp(Fu, Ku, RX, nx, ni, ni, no);
+ Multp(RX, Gx, FuKuGx, nx, no, no, nx);
+
+ for (j = 0; j < nx; j++)
+ {
+ Jacque_col = DENSE_COL(Jacque, j + m);
+ for (i = 0; i < nx; i++)
+ {
+ Jacque_col[i + m] = Fx[i + j * nx] + FuKuGx[i + j * nx];
+ }
+ }
+
+ Multp(Hu, Gx, HuGx, m, no, no, nx);
+
+ for (i = 0; i < nx; i++)
+ {
+ Jacque_col = DENSE_COL(Jacque, i + m);
+ for (j = 0; j < m; j++)
+ {
+ Jacque_col[j] = HuGx[j + i * m];
+ }
+ }
+
+ Multp(Fu, Kx, FuKx, nx, ni, ni, m);
+
+ for (i = 0; i < m; i++)
+ {
+ Jacque_col = DENSE_COL(Jacque, i);
+ for (j = 0; j < nx; j++)
+ {
+ Jacque_col[j + m] = FuKx[j + i * nx];
+ }
+ }
+
+
+ Multp(Hu, Gu, RX, m, no, no, ni);
+ Multp(RX, Kx, HuGuKx, m, ni, ni, m);
+
+ for (j = 0; j < m; j++)
+ {
+ Jacque_col = DENSE_COL(Jacque, j);
+ for (i = 0; i < m; i++)
+ {
+ Jacque_col[i] = Hx[i + j * m] + HuGuKx[i + j * m];
+ }
+ }
+
+ /* chr='Z'; printf("\n t=%g",ttx); DISP(Z,n,n,chr);*/
+ C2F(ierode).iero = *ierr;
+ return 0;
+
+}
+/*--------------------------------------------------------------------------*/
+static void Multp(double *A, double *B, double *R, int ra, int rb, int ca, int cb)
+{
+ int i = 0, j = 0, k = 0;
+ /*if (ca!=rb) sciprint(_("\n Error in matrix multiplication"));*/
+ for (i = 0; i < ra; i++)
+ for (j = 0; j < cb; j++)
+ {
+ R[i + ra * j] = 0.0;
+ for (k = 0; k < ca; k++)
+ {
+ R[i + ra * j] += A[i + k * ra] * B[k + j * rb];
+ }
+ }
+ return;
+}
+/*--------------------------------------------------------------------------*/
+int read_xml_initial_states(int nvar, const char * xmlfile, char **ids, double *svars)
+{
+ ezxml_t model, elements;
+ int result = 0, i = 0;
+ double vr = 0.;
+
+ if (nvar == 0)
+ {
+ return 0;
+ }
+ result = 0;
+ for (i = 0; i < nvar; i++)
+ {
+ if (strcmp(ids[i], "") != 0)
+ {
+ result = 1;
+ break;
+ }
+ }
+ if (result == 0)
+ {
+ return 0;
+ }
+
+ model = ezxml_parse_file(xmlfile);
+
+ if (model == NULL)
+ {
+ sciprint(_("Error: Cannot find file '%s'.\n"), xmlfile);
+ return -1;/* file does not exist*/
+ }
+
+ elements = ezxml_child(model, "elements");
+ for (i = 0; i < nvar; i++)
+ {
+ vr = 0.0;
+ result = read_id(&elements, ids[i], &vr);
+ if (result == 1)
+ {
+ svars[i] = vr;
+ }
+ }
+ ezxml_free(model);
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
+static int read_id(ezxml_t *elements, char *id, double *value)
+{
+ char V1[100], V2[100];
+ int ok = 0, i = 0, ln = 0;
+
+ if (strcmp(id, "") == 0)
+ {
+ return 0;
+ }
+ ok = search_in_child(elements, id, V1);
+ if (ok == 0 )
+ {
+ /*sciprint(_("Cannot find: %s=%s \n"),id,V1); */
+ return 0;
+ }
+ else
+ {
+ if (Convert_number(V1, value) != 0)
+ {
+ ln = (int)(strlen(V1));
+ if (ln > 2)
+ {
+ for (i = 1; i <= ln - 2; i++)
+ {
+ V2[i - 1] = V1[i];
+ }
+ V2[ln - 2] = '\0';
+ ok = read_id(elements, V2, value);
+ return ok;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ /* printf("\n ---->>>%s= %g",V1,*value);*/
+ return 1;
+ }
+ }
+}
+/*--------------------------------------------------------------------------*/
+int Convert_number(char *s, double *out)
+{
+ char *endp = NULL;
+ double d = 0.;
+ long int l = 0;
+ d = strtod(s, &endp);
+ if (s != endp && *endp == '\0')
+ {
+ /* printf(" It's a float with value %g ", d); */
+ *out = d;
+ return 0;
+ }
+ else
+ {
+ l = strtol(s, &endp, 0);
+ if (s != endp && *endp == '\0')
+ {
+ /*printf(" It's an int with value %ld ", 1); */
+ *out = (double)l;
+ return 0;
+ }
+ else
+ {
+ /*printf(" string "); */
+ return -1;
+ }
+ }
+}
+/*--------------------------------------------------------------------------*/
+int write_xml_states(int nvar, const char * xmlfile, char **ids, double *x)
+{
+ ezxml_t model, elements;
+ int result = 0, i = 0, err = 0;
+ FILE *fd = NULL;
+ char *s = NULL;
+ char **xv = NULL;
+
+ if (nvar == 0)
+ {
+ return 0;
+ }
+ result = 0;
+ for (i = 0; i < nvar; i++)
+ {
+ if (strcmp(ids[i], "") != 0)
+ {
+ result = 1;
+ break;
+ }
+ }
+ if (result == 0)
+ {
+ return 0;
+ }
+
+ xv = MALLOC(nvar * sizeof(char*));
+ for (i = 0; i < nvar; i++)
+ {
+ xv[i] = MALLOC(nvar * 100 * sizeof(char));
+ sprintf(xv[i], "%g", x[i]);
+ }
+
+ model = ezxml_parse_file(xmlfile);
+ if (model == NULL)
+ {
+ sciprint(_("Error: Cannot find file '%s'.\n"), xmlfile);
+ err = -1;
+ goto err_free_xv;
+ }
+
+ elements = ezxml_child(model, "elements");
+
+ for (i = 0; i < nvar; i++)
+ {
+ if (strcmp(ids[i], "") == 0)
+ {
+ continue;
+ }
+ result = write_in_child(&elements, ids[i], xv[i]);
+ if (result == 0 )
+ {
+ /* sciprint(_("cannot find %s in '%s' \n"),ids[i],xmlfile); */
+ /* err= -1;*/ /* Variable does not exist*/
+ }
+ }
+
+ s = ezxml_toxml(model);
+ ezxml_free(model);
+
+
+ wcfopen(fd, (char*)xmlfile, "wb");
+ if (fd == NULL)
+ {
+ err = -3;/* cannot write to file*/
+ goto err_free_s;
+ }
+
+ fputs (s, fd);
+ fclose(fd);
+
+err_free_s:
+ free(s);
+err_free_xv:
+ for (i = 0; i < nvar; i++)
+ {
+ FREE(xv[i]);
+ }
+ FREE(xv);
+ return err;
+}
+/*--------------------------------------------------------------------------*/
+int C2F(fx)(double *x, double *residual) /* used for homotopy*/
+{
+ double *xdot = NULL, t = 0;
+ xdot = x + *neq;
+ t = 0;
+ *ierr = 0;
+ C2F(ierode).iero = 0;
+ odoit(&t, x, xdot, residual);
+ C2F(ierode).iero = *ierr;
+ return (*ierr);
+}
+/*--------------------------------------------------------------------------*/
+int rho_(double *a, double *L, double *x, double *rho, double *rpar, int *ipar) /* used for homotopy*/
+{
+ int i = 0, N = 0;
+ N = *neq;
+
+ fx_(x, rho);
+ for (i = 0; i < N; i++)
+ {
+ rho[i] += (-1 + *L) * a[i];
+ }
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
+int rhojac_(double *a, double *lambda, double *x, double *jac, int *col, double *rpar, int *ipar) /* used for homotopy*/
+{
+ /* MATRIX [d_RHO/d_LAMBDA, d_RHO/d_X_col] */
+ int j = 0, N = 0;
+ double *work = NULL;
+ double inc = 0., inc_inv = 0., xi = 0., srur = 0.;
+ N = *neq;
+ if (*col == 1)
+ {
+ for (j = 0; j < N; j++)
+ {
+ jac[j] = a[j];
+ }
+ }
+ else
+ {
+ if ((work = (double *) MALLOC(N * sizeof(double))) == NULL)
+ {
+ *ierr = 10000;
+ return *ierr;
+ }
+ rho_(a, lambda, x, work, rpar, ipar);
+ srur = 1e-10;
+ xi = x[*col - 2];
+ inc = srur * Max(fabs(xi), 1);
+ inc = (xi + inc) - xi;
+ x[*col - 2] += inc;
+
+ rho_(a, lambda, x, jac, rpar, ipar);
+ inc_inv = 1.0 / inc;
+
+ for (j = 0; j < N; j++)
+ {
+ jac[j] = (jac[j] - work[j]) * inc_inv;
+ }
+
+ x[*col - 2] = xi;
+ FREE(work);
+ }
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
+int C2F(hfjac)(double *x, double *jac, int *col)
+{
+ int N = 0, j = 0;
+ double *work = NULL;
+ double *xdot = NULL;
+ double inc = 0., inc_inv = 0., xi = 0., srur = 0.;
+
+ N = *neq;
+ if ((work = (double *) MALLOC(N * sizeof(double))) == NULL)
+ {
+ *ierr = 10000;
+ return *ierr;
+ }
+ srur = (double) RSqrt(UNIT_ROUNDOFF);
+
+ fx_(x, work);
+
+ xi = x[*col - 1];
+ inc = srur * MAX (ABS(xi), 1);
+ inc = (xi + inc) - xi;
+ x[*col - 1] += inc;
+ xdot = x + N;
+
+ fx_(x, jac);
+ if (*ierr < 0)
+ {
+ FREE(work);
+ return *ierr;
+ }
+
+ inc_inv = ONE / inc;
+
+ for (j = 0; j < N; j++)
+ {
+ jac[j] = (jac[j] - work[j]) * inc_inv;
+ }
+
+ x[*col - 1] = xi;
+
+ FREE(work);
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
+int simblkKinsol(N_Vector yy, N_Vector resval, void *rdata)
+{
+ double t = 0., *xc = NULL , *xcdot = NULL, *residual = NULL;
+ UserData data;
+ int jj = 0, nantest = 0, N = 0;
+ N = *neq;
+
+ t = 0;
+ xc = (double *) NV_DATA_S(yy);
+ residual = (double *) NV_DATA_S(resval);
+ data = (UserData) rdata;
+ xcdot = xc;
+ if (phase == 1) if ( ng > 0 && nmod > 0 )
+ {
+ zdoit(&t, xc, xcdot, g);
+ }
+
+ *ierr = 0;
+ C2F(ierode).iero = 0;
+ odoit(&t, xc, xcdot, residual);
+
+ if (*ierr == 0)
+ {
+ nantest = 0; /* NaN checking */
+ for (jj = 0; jj < N; jj++)
+ {
+ if (residual[jj] - residual[jj] != 0)
+ {
+ sciprint(_("\nWarning: The initialization system #%d returns a NaN/Inf"), jj);
+ nantest = 1;
+ break;
+ }
+ }
+ if (nantest == 1)
+ {
+ return 258; /* recoverable error; */
+ }
+ }
+ C2F(ierode).iero = *ierr;
+
+ return (abs(*ierr)); /* ierr>0 recoverable error; ierr>0 unrecoverable error; ierr=0: ok*/
+}
+/*--------------------------------------------------------------------------*/
+static int CallKinsol(double *told)
+{
+ //** used for the [stop] button
+ static char CommandToUnstack[1024];
+ static int CommandLength = 0;
+ static int SeqSync = 0;
+ static int one = 1;
+
+ N_Vector y = NULL, yscale = NULL, fscale = NULL;
+ double *fsdata = NULL, *ysdata = NULL;
+ int N = 0, strategy = 0, i = 0, j = 0, k = 0, status = 0;
+ /* int mxiter, msbset, msbsetsub, etachoice, mxnbcf; */
+ /* double eta, egamma, ealpha, mxnewtstep, relfunc, fnormtol, scsteptol; */
+ /* booleantype noInitSetup, noMinEps; */
+ void *kin_mem = NULL;
+ realtype reltol = 0., abstol = 0.;
+ int *Mode_save = NULL;
+ int Mode_change = 0;
+ static int PH = 0;
+ int N_iters = 0;
+ double ratio = 0.;
+
+ N = *neq;
+ if (N <= 0)
+ {
+ return 0;
+ }
+
+ reltol = (realtype) rtol;
+ abstol = (realtype) Atol;
+
+ Mode_save = NULL;
+ if (nmod > 0)
+ {
+ if ((Mode_save = MALLOC(sizeof(int) * nmod)) == NULL )
+ {
+ *ierr = 10000;
+ return -1;
+ }
+ }
+
+ y = N_VNewEmpty_Serial(N);
+ if (y == NULL)
+ {
+ FREE(Mode_save);
+ return -1;
+ }
+ yscale = N_VNew_Serial(N);
+ if (yscale == NULL)
+ {
+ FREE(Mode_save);
+ N_VDestroy_Serial(y);
+ return -1;
+ }
+ fscale = N_VNew_Serial(N);
+ if (fscale == NULL)
+ {
+ FREE(Mode_save);
+ N_VDestroy_Serial(y);
+ N_VDestroy_Serial(yscale);
+ return -1;
+ }
+ ysdata = NV_DATA_S(yscale);
+ fsdata = NV_DATA_S(fscale);
+
+ NV_DATA_S(y) = x;
+ kin_mem = KINCreate();
+ if (kin_mem == NULL)
+ {
+ FREE(Mode_save);
+ N_VDestroy_Serial(y);
+ N_VDestroy_Serial(yscale);
+ N_VDestroy_Serial(fscale);
+ return -1;
+ }
+
+ status = KINInit(kin_mem, simblkKinsol, y);
+ strategy = KIN_NONE; /*without LineSearch */
+ status = KINDense(kin_mem, N);
+
+ status = KINSetNumMaxIters(kin_mem, 2000); /* MaxNumIter=200->2000 */
+ status = KINSetRelErrFunc(kin_mem, reltol); /* FuncRelErr=eps->RTOL */
+ status = KINSetMaxSetupCalls(kin_mem, 1); /* MaxNumSetups=10->1=="Exact Newton" */
+ status = KINSetMaxSubSetupCalls(kin_mem, 1); /* MaxNumSubSetups=5->1 */
+ /* status = KINSetNoInitSetup(kin_mem,noInitSetup); // InitialSetup=true */
+ /* status = KINSetNoMinEps(kin_mem,noMinEps); // MinBoundEps=true */
+ /* status = KINSetMaxBetaFails(kin_mem,mxnbcf); // MaxNumBetaFails=10 */
+ /* status = KINSetEtaForm(kin_mem,etachoice); // EtaForm=Type1 */
+ /* status = KINSetEtaConstValue(kin_mem,eta);*/ // Eta=0.1 */
+ /* status = KINSetEtaParams(kin_mem,egamma,ealpha); // EtaGamma=0.9 EtaAlpha=2.0 */
+ /* status = KINSetMaxNewtonStep(kin_mem,mxnewtstep); // MaxNewtonStep=0.0 */
+ /* status = KINSetFuncNormTol(kin_mem,fnormtol); // FuncNormTol=eps^(1/3) */
+ /* status = KINSetScaledStepTol(kin_mem,scsteptol); // ScaledStepTol={eps^(2/3) */
+ for ( j = 0; j < N; j++)
+ {
+ ysdata[j] = 1;
+ fsdata[j] = 1;
+ }
+ /*========================================================*/
+ if (PH == 2)
+ {
+ PH = 1;
+ }
+ else
+ {
+ PH = 2; /* remind that PH is a static variable*/
+ }
+
+ status = -1;
+ N_iters = 10 + nmod * 3;
+ for (k = 0; k <= N_iters; k++) /* loop for mode fixin*/
+ {
+ phase = PH;
+ /*------------KINSOL calls-----------*/
+ for (i = 0; i < 10; i++)
+ {
+ simblkKinsol(y, fscale, NULL);
+
+ for (j = 0; j < N; j++)
+ if (fsdata[j] - fsdata[j] != 0)
+ {
+ sciprint(_("\nWarning: The residual function #%d returns a NaN/Inf"), j);
+ sciprint(_("\n The residual function returns NAN/Inf. \n Please verify your model:\n some functions might be called with illegal inputs."));
+ freekinsol;
+ *ierr = 400 - status;
+ C2F(ierode).iero = *ierr;
+ return -1;
+ }
+ ratio = 0.3;
+ for ( j = 0; j < N; j++)
+ {
+ if (x[j] == 0)
+ {
+ ysdata[j] += 1 * ratio;
+ }
+ else
+ {
+ ysdata[j] += ratio / fabs(x[j]);
+ }
+ if (fsdata[j] == 0)
+ {
+ fsdata[j] = 1;
+ }
+ else
+ {
+ fsdata[j] = 1 / fabs(fsdata[j]);
+ }
+ ysdata[j] /= ratio + 1;
+ }
+ status = KINSol(kin_mem, y, strategy, yscale, fscale);/* Calling the Newton Solver */
+ if (status >= 0)
+ {
+ break;
+ }
+ /* Serge Steer 29/06/2009 */
+ while (ismenu()) //** if the user has done something, do the actions
+ {
+ int ierr2 = 0;
+ SeqSync = GetCommand(CommandToUnstack); //** get at the action
+ CommandLength = (int)strlen(CommandToUnstack);
+ syncexec(CommandToUnstack, &CommandLength, &ierr2, &one, CommandLength); //** execute it
+ }
+
+ if (C2F(coshlt).halt != 0)
+ {
+ C2F(coshlt).halt = 0;
+ freekinsol;
+ return 0;
+ }
+ }
+ /*---------end of KINSOL calls-----------*/
+ if (PH == 2 )
+ {
+ for (j = 0; j < nmod; ++j)
+ {
+ Mode_save[j] = mod[j];
+ }
+
+ if (ng > 0 && nmod > 0)
+ {
+ phase = 1; // updating the modes
+ zdoit(told, x, xd, g);
+ if (*ierr != 0)
+ {
+ freekinsol;
+ C2F(ierode).iero = *ierr;
+ return -1;
+ }
+ }
+
+ Mode_change = 0;
+ for (j = 0; j < nmod; ++j)
+ {
+ if (Mode_save[j] != mod[j])
+ {
+ Mode_change = 1;
+ break;
+ }
+ }
+
+ if (Mode_change == 0 && status >= 0 )
+ {
+ break; /*Successful termination*/
+ }
+
+ }
+ else
+ {
+ /* calling with phase=1*/
+ if (status >= 0)
+ {
+ break;
+ }
+ }
+
+ } /* end of the loop for mode fixing*/
+
+ if (status < 0 )
+ {
+ *ierr = 400 - status;
+ C2F(ierode).iero = *ierr;
+ }
+ freekinsol;
+ return status;
+} /* CallKinSol_ */
+/*--------------------------------------------------------------------------*/
+
diff --git a/modules/scicos/src/c/scicos.rc b/modules/scicos/src/c/scicos.rc
new file mode 100755
index 000000000..58dd99f30
--- /dev/null
+++ b/modules/scicos/src/c/scicos.rc
@@ -0,0 +1,96 @@
+// Microsoft Visual C++ generated resource script.
+//
+
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+//#include "afxres.h"
+#define APSTUDIO_HIDDEN_SYMBOLS
+#include "windows.h"
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// French (France) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
+#ifdef _WIN32
+LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 5,5,2,0
+ PRODUCTVERSION 5,5,2,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040c04b0"
+ BEGIN
+ VALUE "FileDescription", "scicos module"
+ VALUE "FileVersion", "5, 5, 2, 0"
+ VALUE "InternalName", "scicos module"
+ VALUE "LegalCopyright", "Copyright (C) 2017"
+ VALUE "OriginalFilename", "scicos.dll"
+ VALUE "ProductName", "scicos module"
+ VALUE "ProductVersion", "5, 5, 2, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40c, 1200
+ END
+END
+
+#endif // French (France) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/modules/scicos/src/c/scicos.vcxproj b/modules/scicos/src/c/scicos.vcxproj
new file mode 100755
index 000000000..c74abe6e2
--- /dev/null
+++ b/modules/scicos/src/c/scicos.vcxproj
@@ -0,0 +1,387 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{B7A0273E-8E71-4663-8497-0895945ED54D}</ProjectGuid>
+ <RootNamespace>scicos</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>.;../../includes;../../../core/includes;../../../time/includes;../../../api_scilab/includes;../../../output_stream/includes;../../../scicos_blocks/includes;../../../windows_tools/includes;../../../graphics/includes;../../../localization/includes;../../../string/includes;../../../intersci/src/lib;../../../dynamic_link/includes;../scicos_sundials/include;../scicos_sundials/include/sundials;../scicos_sundials/src/ida;../../../action_binding/includes;../../../../libs/intl;../../../intersci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCICOS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <WarningLevel>Level3</WarningLevel>
+ </ClCompile>
+ <PreLinkEvent>
+ <Message>Make dependencies</Message>
+ <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Scicos_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Output_stream_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)output_stream.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)String_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)string.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Dynamic_link_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)dynamic_link.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Graphics_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)graphics.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Scicos_blocks_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_blocks_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)core_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)differential_equations_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)differential_equations_f.lib" 1&gt;NUL 2&gt;NUL</Command>
+ </PreLinkEvent>
+ <Link>
+ <AdditionalDependencies>../../../../bin/libintl.lib;../../../../bin/blasplus.lib;../../../../bin/linpack_f.lib;core.lib;output_stream.lib;string.lib;dynamic_link.lib;graphics.lib;scicos_blocks_f.lib;scicos_f.lib;scilocalization.lib;elementary_functions_f.lib;core_f.lib;differential_equations_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
+ <IgnoreSpecificDefaultLibraries>
+ </IgnoreSpecificDefaultLibraries>
+ <ModuleDefinitionFile>scicos_export.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ </Link>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <Midl>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>.;../../includes;../../../core/includes;../../../time/includes;../../../api_scilab/includes;../../../output_stream/includes;../../../scicos_blocks/includes;../../../windows_tools/includes;../../../graphics/includes;../../../localization/includes;../../../string/includes;../../../intersci/src/lib;../../../dynamic_link/includes;../scicos_sundials/include;../scicos_sundials/include/sundials;../scicos_sundials/src/ida;../../../action_binding/includes;../../../../libs/intl;../../../intersci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCICOS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <WarningLevel>Level3</WarningLevel>
+ </ClCompile>
+ <PreLinkEvent>
+ <Message>Make dependencies</Message>
+ <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Scicos_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Output_stream_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)output_stream.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)String_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)string.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Dynamic_link_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)dynamic_link.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Graphics_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)graphics.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Scicos_blocks_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_blocks_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)core_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)differential_equations_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)differential_equations_f.lib" 1&gt;NUL 2&gt;NUL</Command>
+ </PreLinkEvent>
+ <Link>
+ <AdditionalDependencies>../../../../bin/libintl.lib;../../../../bin/blasplus.lib;../../../../bin/linpack_f.lib;core.lib;output_stream.lib;string.lib;dynamic_link.lib;graphics.lib;scicos_blocks_f.lib;scicos_f.lib;scilocalization.lib;elementary_functions_f.lib;core_f.lib;differential_equations_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
+ <IgnoreSpecificDefaultLibraries>
+ </IgnoreSpecificDefaultLibraries>
+ <ModuleDefinitionFile>scicos_export.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ </Link>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <ClCompile>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>.;../../includes;../../../core/includes;../../../time/includes;../../../api_scilab/includes;../../../output_stream/includes;../../../scicos_blocks/includes;../../../windows_tools/includes;../../../graphics/includes;../../../localization/includes;../../../string/includes;../../../intersci/src/lib;../../../dynamic_link/includes;../scicos_sundials/include;../scicos_sundials/include/sundials;../scicos_sundials/src/ida;../../../action_binding/includes;../../../../libs/intl;../../../intersci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCICOS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <WarningLevel>Level3</WarningLevel>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <PreLinkEvent>
+ <Message>Make dependencies</Message>
+ <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Scicos_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Output_stream_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)output_stream.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)String_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)string.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Dynamic_link_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)dynamic_link.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Graphics_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)graphics.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Scicos_blocks_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_blocks_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)core_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)differential_equations_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)differential_equations_f.lib" 1&gt;NUL 2&gt;NUL</Command>
+ </PreLinkEvent>
+ <Link>
+ <AdditionalDependencies>../../../../bin/libintl.lib;../../../../bin/blasplus.lib;../../../../bin/linpack_f.lib;core.lib;output_stream.lib;string.lib;dynamic_link.lib;graphics.lib;scicos_blocks_f.lib;scicos_f.lib;scilocalization.lib;elementary_functions_f.lib;core_f.lib;differential_equations_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
+ <IgnoreSpecificDefaultLibraries>
+ </IgnoreSpecificDefaultLibraries>
+ <ModuleDefinitionFile>scicos_export.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ </Link>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <Midl>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>.;../../includes;../../../core/includes;../../../time/includes;../../../api_scilab/includes;../../../output_stream/includes;../../../scicos_blocks/includes;../../../windows_tools/includes;../../../graphics/includes;../../../localization/includes;../../../string/includes;../../../intersci/src/lib;../../../dynamic_link/includes;../scicos_sundials/include;../scicos_sundials/include/sundials;../scicos_sundials/src/ida;../../../action_binding/includes;../../../../libs/intl;../../../intersci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCICOS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <WarningLevel>Level3</WarningLevel>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <PreLinkEvent>
+ <Message>Make dependencies</Message>
+ <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Scicos_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Output_stream_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)output_stream.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)String_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)string.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Dynamic_link_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)dynamic_link.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Graphics_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)graphics.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Scicos_blocks_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scicos_blocks_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)core_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)differential_equations_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)differential_equations_f.lib" 1&gt;NUL 2&gt;NUL</Command>
+ </PreLinkEvent>
+ <Link>
+ <AdditionalDependencies>../../../../bin/libintl.lib;../../../../bin/blasplus.lib;../../../../bin/linpack_f.lib;core.lib;output_stream.lib;string.lib;dynamic_link.lib;graphics.lib;scicos_blocks_f.lib;scicos_f.lib;scilocalization.lib;elementary_functions_f.lib;core_f.lib;differential_equations_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
+ <IgnoreSpecificDefaultLibraries>
+ </IgnoreSpecificDefaultLibraries>
+ <ModuleDefinitionFile>scicos_export.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ </Link>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\sci_gateway\c\sci_loadScicos.c" />
+ <ClCompile Include="copyvarfromlistentry.c" />
+ <ClCompile Include="createblklist.c" />
+ <ClCompile Include="DllmainScicos.c" />
+ <ClCompile Include="extractblklist.c" />
+ <ClCompile Include="ezxml.c" />
+ <ClCompile Include="..\..\sci_gateway\c\gw_scicos.c" />
+ <ClCompile Include="il_sim.c" />
+ <ClCompile Include="il_state.c" />
+ <ClCompile Include="import.c" />
+ <ClCompile Include="MlistGetFieldNumber.c" />
+ <ClCompile Include="lsodar.c" />
+ <ClCompile Include="ddaskr.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_buildouttb.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_callblk.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_coserror.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_ctree2.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_ctree3.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_ctree4.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_curblock.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_curblockc.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_data2sig.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_diffobjs.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_duplicate.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_end_scicosim.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_ftree2.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_ftree3.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_ftree4.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_getblocklabel.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_getscicosvars.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_haltscicos.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_model2blk.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_phase_simulation.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_pointer_xproperty.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_scicos_debug.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_scicos_debug_count.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_scicos_time.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_scicosim.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_sctree.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_set_blockerror.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_set_xproperty.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_sig2data.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_var2vec.c" />
+ <ClCompile Include="..\..\sci_gateway\c\sci_vec2var.c" />
+ <ClCompile Include="sciblk2.c" />
+ <ClCompile Include="sciblk4.c" />
+ <ClCompile Include="scicos.c" />
+ <ClCompile Include="scicos_free.c" />
+ <ClCompile Include="scicos_malloc.c" />
+ <ClCompile Include="scicos_print.c" />
+ <ClCompile Include="tree.c" />
+ <ClCompile Include="var2sci.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="copyvarfromlistentry.h" />
+ <ClInclude Include="createblklist.h" />
+ <ClInclude Include="..\..\includes\dynlib_scicos.h" />
+ <ClInclude Include="extractblklist.h" />
+ <ClInclude Include="ezxml.h" />
+ <ClInclude Include="..\..\includes\gw_scicos.h" />
+ <ClInclude Include="il_sim.h" />
+ <ClInclude Include="il_state.h" />
+ <ClInclude Include="..\..\includes\import.h" />
+ <ClInclude Include="MlistGetFieldNumber.h" />
+ <ClInclude Include="lsodar.h" />
+ <ClInclude Include="ddaskr.h" />
+ <ClInclude Include="..\..\includes\scicos-def.h" />
+ <ClInclude Include="..\..\includes\scicos.h" />
+ <ClInclude Include="..\..\includes\scicos_free.h" />
+ <ClInclude Include="..\..\includes\scicos_malloc.h" />
+ <ClInclude Include="..\..\includes\scicos_math.h" />
+ <ClInclude Include="..\..\includes\scicos_print.h" />
+ <ClInclude Include="sciblk2.h" />
+ <ClInclude Include="sciblk4.h" />
+ <ClInclude Include="tree.h" />
+ <ClInclude Include="var2sci.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\locales\scicos.pot" />
+ <None Include="Core_f_Import.def" />
+ <None Include="differential_equations_f_Import.def" />
+ <None Include="Dynamic_link_Import.def" />
+ <None Include="elementary_functions_f_Import.def" />
+ <None Include="Graphics_Import.def" />
+ <None Include="core_import.def" />
+ <None Include="Localization_Import.def" />
+ <None Include="Output_stream_Import.def" />
+ <None Include="Scicos_blocks_f_Import.def" />
+ <None Include="scicos_f_Import.def" />
+ <None Include="String_Import.def" />
+ <None Include="Scicos_Export.def" />
+ <None Include="..\..\Makefile.am" />
+ <None Include="..\..\scicos.iss" />
+ <None Include="..\..\sci_gateway\scicos_gateway.xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="scicos.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\..\tools\Dumpexts\Dumpexts.vcxproj">
+ <Project>{3170e4c2-1173-4264-a222-7ee8ccb3ddf7}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\api_scilab\api_scilab.vcxproj">
+ <Project>{43c5bab1-1dca-4743-a183-77e0d42fe7d0}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\elementary_functions\src\c\elementary_functions.vcxproj">
+ <Project>{5b110267-7c18-437c-b87d-dba2b50729e9}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\scicos_blocks\src\c\scicos_blocks.vcxproj">
+ <Project>{70f677f1-b535-4d0f-a16f-5093b799a540}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\time\time.vcxproj">
+ <Project>{05d8f60b-332a-4161-b946-b8ab30ed439c}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\windows_tools\src\c\scilab_windows\scilab_windows.vcxproj">
+ <Project>{8028f371-6a94-4a26-8804-6e7f05f1d1aa}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\scicos_sundials\scicos_sundials.vcxproj">
+ <Project>{c781737a-7c97-4cf9-acbc-f68c2bbf0ffa}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/modules/scicos/src/c/scicos.vcxproj.filters b/modules/scicos/src/c/scicos.vcxproj.filters
new file mode 100755
index 000000000..40bb83deb
--- /dev/null
+++ b/modules/scicos/src/c/scicos.vcxproj.filters
@@ -0,0 +1,303 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{f25272a1-9c37-4283-b9be-f02b20fa554e}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{0600940f-c932-4a19-852b-1fa288604839}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="localization">
+ <UniqueIdentifier>{6ce5747b-ba49-43df-bba9-ab7c4a42174f}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Libraries Dependencies">
+ <UniqueIdentifier>{c851460c-fc36-41ef-a010-d914f8d07eb1}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Libraries Dependencies\Imports">
+ <UniqueIdentifier>{065bc75d-7cea-49da-8175-18022b52059b}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Libraries Dependencies\Export">
+ <UniqueIdentifier>{085b96c7-ebd7-4309-aa96-7bf92c81cf41}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{1111ba6f-2a3d-4841-9870-995a4fc81bad}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="copyvarfromlistentry.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="createblklist.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="DllmainScicos.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="extractblklist.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ezxml.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\gw_scicos.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="il_sim.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="il_state.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="import.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="MlistGetFieldNumber.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="lsodar.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ddaskr.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_buildouttb.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_callblk.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_coserror.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_ctree2.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_ctree3.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_ctree4.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_curblock.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_curblockc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_data2sig.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_diffobjs.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_duplicate.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_end_scicosim.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_ftree2.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_ftree3.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_ftree4.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_getblocklabel.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_getscicosvars.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_haltscicos.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_model2blk.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_phase_simulation.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_pointer_xproperty.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_scicos_debug.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_scicos_debug_count.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_scicos_time.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_scicosim.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_sctree.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_set_blockerror.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_set_xproperty.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_sig2data.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_var2vec.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_vec2var.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="sciblk2.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="sciblk4.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="scicos.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="scicos_free.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="scicos_malloc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="scicos_print.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="tree.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="var2sci.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\sci_gateway\c\sci_loadScicos.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="copyvarfromlistentry.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="createblklist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\includes\dynlib_scicos.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="extractblklist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ezxml.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\includes\gw_scicos.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="il_sim.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="il_state.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\includes\import.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="MlistGetFieldNumber.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="lsodar.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ddaskr.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\includes\scicos-def.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\includes\scicos.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\includes\scicos_free.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\includes\scicos_malloc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\includes\scicos_math.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\includes\scicos_print.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="tree.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="var2sci.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="sciblk2.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="sciblk4.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Dynamic_link_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="Graphics_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="core_import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="Output_stream_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="Scicos_blocks_f_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="scicos_f_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="String_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="Scicos_Export.def">
+ <Filter>Libraries Dependencies\Export</Filter>
+ </None>
+ <None Include="..\..\Makefile.am" />
+ <None Include="..\..\scicos.iss" />
+ <None Include="..\..\sci_gateway\scicos_gateway.xml" />
+ <None Include="Localization_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="elementary_functions_f_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="..\..\locales\scicos.pot">
+ <Filter>localization</Filter>
+ </None>
+ <None Include="Core_f_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ <None Include="differential_equations_f_Import.def">
+ <Filter>Libraries Dependencies\Imports</Filter>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="scicos.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+</Project>
diff --git a/modules/scicos/src/c/scicos_f_Import.def b/modules/scicos/src/c/scicos_f_Import.def
new file mode 100755
index 000000000..7e6f3df3d
--- /dev/null
+++ b/modules/scicos/src/c/scicos_f_Import.def
@@ -0,0 +1,23 @@
+LIBRARY scicos_f.dll
+
+
+EXPORTS
+;
+vvtosci_
+scifunc_
+skipvars_
+scitovv_
+scitod_
+list2vars_
+ltopadj_
+intvec2var_
+intvar2vec_
+intctree_
+scicosdebugcount_
+scicosdebug_
+intgetlabel_
+intree4_
+intree3_
+intree2_
+intcurblk_
+scierr_
diff --git a/modules/scicos/src/c/scicos_free.c b/modules/scicos/src/c/scicos_free.c
new file mode 100755
index 000000000..72adea61a
--- /dev/null
+++ b/modules/scicos/src/c/scicos_free.c
@@ -0,0 +1,32 @@
+/* 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 "MALLOC.h"
+#include "scicos_free.h"
+#include "scicos_block.h"
+/*--------------------------------------------------------------------------*/
+#define SCICOS_FREE(x) FREE((char *) x);
+/*--------------------------------------------------------------------------*/
+void scicos_free(void *p)
+{
+ SCICOS_FREE(p);
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/scicos_internal.h b/modules/scicos/src/c/scicos_internal.h
new file mode 100755
index 000000000..41f212895
--- /dev/null
+++ b/modules/scicos/src/c/scicos_internal.h
@@ -0,0 +1,43 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Scilab Enterprises - 2013 - Clement DAVID
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+
+#include "scicos-def.h"
+
+void makescicosimport(double *x, int *nx,
+ int *xptr, int *zcptr,
+ double *z, int *nz, int *zptr,
+ int *noz, void **oz, int *ozsz, int *oztyp, int *ozptr,
+ double *g, int *ng,
+ int *mod, int *nmod, int *modptr,
+ int *iz, int *izptr, int *uid, int *uidptr, int *inpptr, int *inplnk,
+ int *outptr, int *outlnk, void **outtbptr, int *outtbsz, int *outtbtyp,
+ outtb_el *outtb_elem, int *nelem,
+ int *nlnk, double *rpar, int *rpptr, int *ipar, int *ipptr,
+ void **opar, int *oparsz, int *opartyp, int *opptr,
+ int *nblk, int *subs, int *nsubs,
+ double *tevts, int *evtspt, int *nevts, int *pointi,
+ int *iord, int *niord, int *oord, int *noord, int *zord, int *nzord,
+ int *funptr, int *funtyp, int *ztyp,
+ int *cord, int *ncord, int *ordclk, int *nordclk, int *clkptr,
+ int *ordptr, int *nordptr, int *critev, int *iwa, scicos_block *blocks,
+ double *t0, double *tf, double *Atol, double *rtol, double *ttol, double *deltat, double *hmax,
+ int *xprop, double *xd);
+
+extern SCICOS_IMPEXP COSDEBUGCOUNTER_struct C2F(cosdebugcounter);
+extern SCICOS_IMPEXP RTFACTOR_struct C2F(rtfactor);
+extern SCICOS_IMPEXP SOLVER_struct C2F(cmsolver);
+extern SCICOS_IMPEXP CURBLK_struct C2F(curblk);
+extern SCICOS_IMPEXP COSDEBUG_struct C2F(cosdebug);
+extern SCICOS_IMPEXP COSHLT_struct C2F(coshlt);
+extern SCICOS_IMPEXP DBCOS_struct C2F(dbcos);
+extern SCICOS_IMPEXP COSTOL_struct C2F(costol);
+extern SCICOS_IMPEXP COSERR_struct coserr;
diff --git a/modules/scicos/src/c/scicos_malloc.c b/modules/scicos/src/c/scicos_malloc.c
new file mode 100755
index 000000000..094a8fbb9
--- /dev/null
+++ b/modules/scicos/src/c/scicos_malloc.c
@@ -0,0 +1,34 @@
+/* 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 "MALLOC.h" /* malloc */
+#include "scicos_malloc.h"
+#include "scicos_block.h"
+/*--------------------------------------------------------------------------*/
+void * scicos_malloc(size_t size)
+{
+ if (size == 0)
+ {
+ return NULL;
+ }
+ return MALLOC(size);
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/scicos_print.c b/modules/scicos/src/c/scicos_print.c
new file mode 100755
index 000000000..a738cca5d
--- /dev/null
+++ b/modules/scicos/src/c/scicos_print.c
@@ -0,0 +1,32 @@
+/* Scicos
+*
+* Copyright (C) Scilab Enterprises
+*
+* 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 "sciprint.h"
+
+void scicos_print(const char* fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ scivprint(fmt, ap);
+ va_end (ap);
+}
+
diff --git a/modules/scicos/src/c/tree.c b/modules/scicos/src/c/tree.c
new file mode 100755
index 000000000..6361c0bff
--- /dev/null
+++ b/modules/scicos/src/c/tree.c
@@ -0,0 +1,250 @@
+/* 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 <stdio.h>
+#include <memory.h>
+#include "machine.h"
+#include "MALLOC.h" /* malloc */
+#include "tree.h"
+
+extern int C2F(isort)();
+
+void Inver(int* vect, int nb)
+{
+ int i;
+ for (i = 0; i < nb; i++)
+ {
+ vect[i] = -vect[i];
+ }
+}
+
+
+/************************* function tree2 *********************************/
+int ctree2(int *vect, int nb, int *depu, int *depuptr, int *outoin, int *outoinptr, int *ord, int *nord, int *ok)
+
+{
+ int fini = 0, i, j, k, m, ii;
+
+ *ok = 1;
+ for (j = 1; (j <= nb + 2) && (! fini); j++)
+ {
+ fini = 1;
+ for (i = 0; i < nb; i++)
+ {
+ if (vect[i] == j - 1 )
+ {
+ if (j == nb + 2)
+ {
+ *ok = 0;
+ *nord = 0;
+ return 0;
+ }
+ if (outoinptr[i + 1] - outoinptr[i] != 0)
+ {
+ for (k = outoinptr[i]; k <= outoinptr[i + 1] - 1; k++)
+ {
+ ii = outoin[k - 1];
+ if (vect[ii - 1] > -1 && depu[depuptr[ii - 1] - 2 + outoin[outoinptr[nb] + k - 2]] == 1)
+ {
+ fini = 0;
+ vect[ii - 1] = j;
+ }
+ }
+ }
+ }
+ }
+ }
+ Inver(vect, nb);
+ C2F(isort)(vect, &nb, ord);
+ for (m = 0 ; m < nb; m++)
+ {
+ if (vect[m] < 1)
+ {
+ if (m == 0)
+ {
+ *nord = nb;
+ return 0;
+ }
+ else
+ {
+ *nord = nb - m;
+ for (i = 0; i < *nord; i++)
+ {
+ ord[i] = ord[i + nb - *nord];
+ }
+ return 0;
+ }
+ }
+ }
+ *nord = 0;
+ return 0;
+}
+
+/* =========================================== fin de tree2 ======================================== */
+/* ********************************************** function tree3 ***************************************** */
+int ctree3(int *vec, int nb, int *depu, int*depuptr, int *typl, int*bexe, int*boptr, int*blnk, int*blptr, int*ord, int*nord, int*ok)
+{
+ int fini = 0, i, j, m, nkk, kk;
+
+ *ok = 1;
+ for ( i = 0; i < nb; i++)
+ {
+ if ((vec[i] == 0) && (typl[i] == 1))
+ {
+ vec[i] = 1;
+ }
+ }
+ for (j = 1; (j <= nb + 2) && (! fini); j++)
+ {
+ fini = 1;
+ if (j == nb + 2)
+ {
+ *ok = 0;
+ *nord = 0;
+ return 0;
+ }
+
+ for (i = 0; i < nb; i++)
+ {
+ if (vec[i] > -1 && typl[i] != -1)
+ {
+ if (typl[i] == 1)
+ {
+ nkk = boptr[i + 1] - boptr[i];
+ if (nkk != 0)
+ {
+ for (m = 0; m < nkk; m++)
+ {
+ kk = bexe[m + boptr[i] - 1];
+ if (typl[kk - 1] == 1)
+ {
+ if (vec[kk - 1] < vec[i] + 2)
+ {
+ fini = 0;
+ vec[kk - 1] = vec[i] + 2;
+ }
+ }
+ else
+ {
+ if (vec[kk - 1] < vec[i] + 1)
+ {
+ fini = 0;
+ vec[kk - 1] = vec[i] + 1;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ nkk = blptr[i + 1] - blptr[i];
+ if (nkk != 0)
+ {
+ for (m = 0; m < nkk; m++)
+ {
+ kk = blnk[m + blptr[i] - 1];
+ if (vec[kk - 1] > -1 && (depu[depuptr[kk - 1] - 2 + blnk[blptr[nb] + blptr[i] - 2]] == 1 || typl[kk - 1] == 1))
+ {
+ if (vec[kk - 1] < vec[i])
+ {
+ fini = 0;
+ vec[kk - 1] = vec[i];
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+ }
+ Inver(vec, nb);
+ C2F(isort)(vec, &nb, ord);
+ for (m = 0 ; m < nb; m++)
+ {
+ if (vec[m] < 1)
+ {
+ if (m == 0)
+ {
+ *nord = nb;
+ return 0;
+ }
+ else
+ {
+ *nord = nb - m;
+ for (i = 0; i < *nord; i++)
+ {
+ ord[i] = ord[i + nb - *nord];
+ }
+ return 0;
+ }
+ }
+ }
+ *nord = 0;
+ return 0;
+}
+/*=========================================== fin de tree3 ======================================== */
+/********************** function tree4 *********************************************/
+int ctree4(int* vec, int nb, int* nd, int nnd, int* typ_r, int* outoin,
+ int* outoinptr, int* r1, int* r2, int* nr)
+{
+ int i, j, fini = 0, k, ii, nprt;
+ *nr = 0;
+ for (j = 1 ; (j < nb) && (! fini); j++)
+ {
+ fini = 1;
+ for (i = 0; i < nb; i++)
+ {
+ if (vec[i] > -1)
+ {
+ if (outoinptr[i + 1] - outoinptr[i] != 0)
+ {
+ for (k = outoinptr[i]; k < outoinptr[i + 1]; k++)
+ {
+ ii = outoin[k - 1];
+ if (typ_r[ii - 1] == 1)
+ {
+ nprt = outoin[k + outoinptr[nb] - 2];
+ if (nd[nprt + (ii - 1)*nnd] == 0)
+ {
+ r1[*nr] = ii;
+ r2[*nr] = nprt;
+ fini = 0;
+ vec[ii - 1] = 0;
+ nd[nprt + (ii - 1)*nnd] = 1;
+ nr[0]++;
+ }
+ }
+ }
+ }
+ }
+ }
+ if (fini == 1)
+ {
+ return 0;
+ }
+ }
+ return 0;
+
+} /* end function*/
+
+/* =================== endfunction tree4 ========================================== */
+
+
diff --git a/modules/scicos/src/c/tree.h b/modules/scicos/src/c/tree.h
new file mode 100755
index 000000000..b1ed84cb6
--- /dev/null
+++ b/modules/scicos/src/c/tree.h
@@ -0,0 +1,36 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* 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
+*/
+
+#ifndef __TREE_H__
+#define __TREE_H__
+/*--------------------------------------------------------------------------*/
+
+int ctree2(int* vect, int nb, int* deput, int* depuptr, int* outoin, int* outoinptr,
+ int* ord, int* nord, int* ok);
+
+int ctree3(int*vec, int nb, int* depu, int* depuptr, int* typl, int* bexe, int* boptr,
+ int* blnk, int* blptr, int* ord, int* nord, int* ok);
+
+int ctree4(int* vec, int nb, int *nd, int nnd, int* typ_r, int* outoin,
+ int* outoinptr, int* r1, int* r2, int* nr);
+
+/*--------------------------------------------------------------------------*/
+#endif /* __TREE_H__ */
diff --git a/modules/scicos/src/c/var2sci.c b/modules/scicos/src/c/var2sci.c
new file mode 100755
index 000000000..a47d8634b
--- /dev/null
+++ b/modules/scicos/src/c/var2sci.c
@@ -0,0 +1,274 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* 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 "var2sci.h"
+#include "import.h"
+#include "stack-c.h"
+#include "MALLOC.h"
+/*--------------------------------------------------------------------------*/
+int var2sci(void *x, int n, int m, int typ_var)
+{
+ /************************************
+ * variables and constants d?inition
+ ************************************/
+ /*counter and address variable declaration*/
+ int nm = 0, il = 0, l = 0, j = 0, i = 0, err = 0;
+
+ /*define all type of accepted ptr */
+ SCSREAL_COP *x_d = NULL, *ptr_d = NULL;
+ SCSINT8_COP *x_c = NULL, *ptr_c = NULL;
+ SCSUINT8_COP *x_uc = NULL, *ptr_uc = NULL;
+ SCSINT16_COP *x_s = NULL, *ptr_s = NULL;
+ SCSUINT16_COP *x_us = NULL, *ptr_us = NULL;
+ SCSINT_COP *x_i = NULL, *ptr_i = NULL;
+ SCSUINT_COP *x_ui = NULL, *ptr_ui = NULL;
+ SCSINT32_COP *x_l = NULL, *ptr_l = NULL;
+ SCSUINT32_COP *x_ul = NULL, *ptr_ul = NULL;
+
+ /* Check if the stack is not full */
+ if (Top >= Bot)
+ {
+ return 1;
+ }
+ else
+ {
+ Top = Top + 1;
+ il = iadr(*Lstk(Top));
+ l = sadr(il + 4);
+ }
+
+ /* set number of double needed to store data */
+ if (typ_var == SCSREAL_N)
+ {
+ nm = n * m; /*double real matrix*/
+ }
+ else if (typ_var == SCSCOMPLEX_N)
+ {
+ nm = n * m * 2; /*double real matrix*/
+ }
+ else if (typ_var == SCSINT_N)
+ {
+ nm = (int)(ceil((n * m) / 2) + 1); /*int*/
+ }
+ else if (typ_var == SCSINT8_N)
+ {
+ nm = (int)(ceil((n * m) / 8) + 1); /*int8*/
+ }
+ else if (typ_var == SCSINT16_N)
+ {
+ nm = (int)(ceil((n * m) / 4) + 1); /*int16*/
+ }
+ else if (typ_var == SCSINT32_N)
+ {
+ nm = (int)(ceil((n * m) / 2) + 1); /*int32*/
+ }
+ else if (typ_var == SCSUINT_N)
+ {
+ nm = (int)(ceil((n * m) / 2) + 1); /*uint*/
+ }
+ else if (typ_var == SCSUINT8_N)
+ {
+ nm = (int)(ceil((n * m) / 8) + 1); /*uint8*/
+ }
+ else if (typ_var == SCSUINT16_N)
+ {
+ nm = (int)(ceil((n * m) / 4) + 1); /*uint16*/
+ }
+ else if (typ_var == SCSUINT32_N)
+ {
+ nm = (int)(ceil((n * m) / 2) + 1); /*uint32*/
+ }
+ else if (typ_var == SCSUNKNOW_N)
+ {
+ nm = n * m; /*arbitrary scilab object*/
+ }
+ else
+ {
+ nm = n * m; /*double real matrix*/
+ }
+
+ /*check if there is free space for new data*/
+ err = l + nm - *Lstk(Bot);
+ if (err > 0)
+ {
+ return 2;
+ }
+
+ /**************************
+ * store data on the stack
+ *************************/
+ switch (typ_var) /*for each type of data*/
+ {
+ case SCSREAL_N : /* set header */
+ *istk(il) = sci_matrix; /*double real matrix*/
+ *istk(il + 1) = n;
+ *istk(il + 2) = m;
+ *istk(il + 3) = 0;
+ x_d = (SCSREAL_COP *) x;
+ ptr_d = (SCSREAL_COP *) stk(l);
+ for (j = 0; j < m * n; j++)
+ {
+ ptr_d[j] = x_d[j];
+ }
+ break;
+
+ case SCSCOMPLEX_N : /* set header */
+ *istk(il) = 1; /*double complex matrix*/
+ *istk(il + 1) = n;
+ *istk(il + 2) = m;
+ *istk(il + 3) = 1;
+ x_d = (SCSCOMPLEX_COP *) x;
+ ptr_d = (SCSCOMPLEX_COP *) stk(l);
+ for (j = 0; j < 2 * m * n; j++)
+ {
+ ptr_d[j] = x_d[j];
+ }
+ break;
+
+ case SCSINT_N : /* set header */
+ *istk(il) = sci_ints; /*int*/
+ *istk(il + 1) = n;
+ *istk(il + 2) = m;
+ *istk(il + 3) = 4;
+ x_i = (SCSINT_COP *) x;
+ for (j = 0; j < m * n; j++)
+ {
+ ptr_i = (SCSINT_COP *) istk(il + 4);
+ ptr_i[j] = x_i[j];
+ }
+ break;
+
+ case SCSINT8_N : /* set header */
+ *istk(il) = sci_ints; /*int8*/
+ *istk(il + 1) = n;
+ *istk(il + 2) = m;
+ *istk(il + 3) = 1;
+ x_c = (SCSINT8_COP *) x;
+ for (j = 0; j < m * n; j++)
+ {
+ ptr_c = (SCSINT8_COP *) istk(il + 4);
+ ptr_c[j] = x_c[j];
+ }
+ break;
+
+ case SCSINT16_N : /* set header */
+ *istk(il) = sci_ints; /*int16*/
+ *istk(il + 1) = n;
+ *istk(il + 2) = m;
+ *istk(il + 3) = 2;
+ x_s = (SCSINT16_COP *) x;
+ for (j = 0; j < m * n; j++)
+ {
+ ptr_s = (SCSINT16_COP *) istk(il + 4);
+ ptr_s[j] = x_s[j];
+ }
+ break;
+
+ case SCSINT32_N : /* set header */
+ *istk(il) = sci_ints; /*int32*/
+ *istk(il + 1) = n;
+ *istk(il + 2) = m;
+ *istk(il + 3) = 4;
+ x_l = (SCSINT32_COP *) x;
+ for (j = 0; j < m * n; j++)
+ {
+ ptr_l = (SCSINT32_COP *) istk(il + 4);
+ ptr_l[j] = x_l[j];
+ }
+ break;
+
+ case SCSUINT_N : /* set header */
+ *istk(il) = sci_ints; /*uint*/
+ *istk(il + 1) = n;
+ *istk(il + 2) = m;
+ *istk(il + 3) = 14;
+ x_ui = (SCSUINT_COP *) x;
+ for (j = 0; j < m * n; j++)
+ {
+ ptr_ui = (SCSUINT_COP *) istk(il + 4);
+ ptr_ui[j] = x_ui[j];
+ }
+ break;
+
+ case SCSUINT8_N : /* set header */
+ *istk(il) = sci_ints; /*uint8*/
+ *istk(il + 1) = n;
+ *istk(il + 2) = m;
+ *istk(il + 3) = 11;
+ x_uc = (SCSUINT8_COP *) x;
+ for (j = 0; j < m * n; j++)
+ {
+ ptr_uc = (SCSUINT8_COP *) istk(il + 4);
+ ptr_uc[j] = x_uc[j];
+ }
+ break;
+
+ case SCSUINT16_N : /* set header */
+ *istk(il) = sci_ints; /*uint16*/
+ *istk(il + 1) = n;
+ *istk(il + 2) = m;
+ *istk(il + 3) = 12;
+ x_us = (SCSUINT16_COP *) x;
+ for (j = 0; j < m * n; j++)
+ {
+ ptr_us = (SCSUINT16_COP *) istk(il + 4);
+ ptr_us[j] = x_us[j];
+ }
+ break;
+
+ case SCSUINT32_N : /* set header */
+ *istk(il) = sci_ints; /*uint32*/
+ *istk(il + 1) = n;
+ *istk(il + 2) = m;
+ *istk(il + 3) = 14;
+ x_ul = (SCSUINT32_COP *) x;
+ for (j = 0; j < m * n; j++)
+ {
+ ptr_ul = (SCSUINT32_COP *) istk(il + 4);
+ ptr_ul[j] = x_ul[j];
+ }
+ break;
+
+ case SCSUNKNOW_N :
+ x_d = (double *) x;
+ C2F(unsfdcopy)(&nm, x_d, (j = 1, &j), stk(*Lstk(Top)), (i = 1, &i));
+ break;
+
+ default : /* set header */
+ *istk(il) = sci_matrix; /* double by default */
+ *istk(il + 1) = n;
+ *istk(il + 2) = m;
+ *istk(il + 3) = 0;
+ x_d = (double *) x;
+ for (j = 0; j < m * n; j++)
+ {
+ ptr_d = (double *) stk(il + 4);
+ ptr_d[j] = x_d[j];
+ }
+ break;
+ }
+
+ /* set value in lstk */
+ *Lstk(Top + 1) = l + nm;
+
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/scicos/src/c/var2sci.h b/modules/scicos/src/c/var2sci.h
new file mode 100755
index 000000000..3dc220ac9
--- /dev/null
+++ b/modules/scicos/src/c/var2sci.h
@@ -0,0 +1,61 @@
+/* Scicos
+*
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* 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
+*/
+/*--------------------------------------------------------------------------*/
+/* var2sci function to convert an array of scicos
+* blocks to scilab object in the Top+1 position
+* in the stack.
+*
+* Input parameters :
+* *x : void ptr, scicos blocks array to store
+* in the Top+1 position in the stack.
+* n : integer, number of rows.
+* m : integer, number of columns.
+* typ_var : integer, type of scicos data :
+* SCSREAL : double real
+* SCSCOMPLEX : double complex
+* SCSINT : int
+* SCSINT8 : int8
+* SCSINT16 : int16
+* SCSINT32 : int32
+* SCSUINT : uint
+* SCSUINT8 : uint8
+* SCSUINT16 : uint16
+* SCSUINT32 : uint32
+* SCSUNKNOW : Unknow type
+*
+* Output parameters : int (<1000), error flag
+* (0 if no error)
+*
+* 07/06/06, Alan : initial version.
+*
+* 23/06/06, Alan : moved in intcscicos.c to do
+* the connection with getscicosvars("blocks")
+*
+* 09/02/07, Alan : add unknown type of objects
+*
+*/
+
+#ifndef __VAR2SCI_H__
+#define __VAR2SCI_H__
+
+int var2sci(void *x, int n, int m, int typ_var);
+
+#endif /* __VAR2SCI_H__ */