Merge remote-tracking branch 'origin/master' into YaSp 01/12901/1
Cedric Delamarre [Fri, 11 Oct 2013 13:21:27 +0000 (15:21 +0200)]
Conflicts:
scilab/configure
scilab/configure.ac
scilab/modules/core/src/c/signal_mgmt.c
scilab/modules/core/src/c/tmpdir.c
scilab/modules/dynamic_link/src/c/addinter.c
scilab/modules/elementary_functions/sci_gateway/c/sci_dec2base.c
scilab/modules/elementary_functions/sci_gateway/c/sci_size.c
scilab/modules/fileio/sci_gateway/c/sci_basename.c
scilab/modules/fileio/sci_gateway/c/sci_copyfile.c
scilab/modules/fileio/sci_gateway/c/sci_fileinfo.c
scilab/modules/fileio/sci_gateway/c/sci_fileparts.c
scilab/modules/fileio/sci_gateway/c/sci_findfiles.c
scilab/modules/fileio/sci_gateway/c/sci_fprintfMat.c
scilab/modules/fileio/sci_gateway/c/sci_fscanfMat.c
scilab/modules/fileio/sci_gateway/c/sci_fullpath.c
scilab/modules/fileio/sci_gateway/c/sci_getrelativefilename.c
scilab/modules/fileio/sci_gateway/c/sci_isdir.c
scilab/modules/fileio/sci_gateway/c/sci_isfile.c
scilab/modules/fileio/sci_gateway/c/sci_mgetl.c
scilab/modules/fileio/sci_gateway/c/sci_mputl.c
scilab/modules/fileio/sci_gateway/c/sci_mscanf.c
scilab/modules/fileio/sci_gateway/c/sci_msscanf.c
scilab/modules/fileio/sci_gateway/c/sci_pathconvert.c
scilab/modules/fileio/sci_gateway/c/sci_pathsep.c
scilab/modules/fileio/src/c/dlManager.c
scilab/modules/fileio/src/c/do_xxscanf.c
scilab/modules/fileio/src/c/expandPathVariable.c
scilab/modules/fileio/src/c/fileinfo.c
scilab/modules/fileio/src/c/fullpath.c
scilab/modules/fileio/src/c/mgetl.c
scilab/modules/fileio/src/c/readline.c
scilab/modules/fileio/src/c/scanf_functions.c
scilab/modules/gui/sci_gateway/cpp/sci_datatip_manager_mode.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatip_set_display.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatip_set_interp.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatip_set_orient.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatip_set_style.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatip_toggle.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatipcreate.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatipmove.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatipremove.cpp
scilab/modules/gui/sci_gateway/cpp/sci_openged.cpp
scilab/modules/gui/sci_gateway/cpp/sci_plotbrowser.cpp
scilab/modules/gui/sci_gateway/cpp/sci_useeditor.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_export_to_hdf5.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_import_from_hdf5.cpp
scilab/modules/hdf5/src/cpp/listvar_in_hdf5_v1.cpp
scilab/modules/io/Makefile.in
scilab/modules/io/sci_gateway/c/sci_file.c
scilab/modules/io/sci_gateway/c/sci_getenv.c
scilab/modules/io/sci_gateway/c/sci_host.c
scilab/modules/io/sci_gateway/c/sci_save.c
scilab/modules/io/sci_gateway/c/sci_setenv.c
scilab/modules/io/src/c/GetenvB.c
scilab/modules/localization/src/c/charEncoding.c
scilab/modules/scicos/sci_gateway/c/sci_buildouttb.c
scilab/modules/scicos/sci_gateway/c/sci_diffobjs.c
scilab/modules/scicos/sci_gateway/c/sci_scicos_time.c
scilab/modules/scicos/sci_gateway/c/sci_set_blockerror.c
scilab/modules/scicos/src/c/extractblklist.c
scilab/modules/string/sci_gateway/c/sci_code2str.c
scilab/modules/string/sci_gateway/c/sci_convstr.c
scilab/modules/string/sci_gateway/c/sci_isalphanum.c
scilab/modules/string/sci_gateway/c/sci_isascii.c
scilab/modules/string/sci_gateway/c/sci_isdigit.c
scilab/modules/string/sci_gateway/c/sci_isnum.c
scilab/modules/string/sci_gateway/c/sci_regexp.c
scilab/modules/string/sci_gateway/c/sci_strcat.c
scilab/modules/string/sci_gateway/c/sci_strchr.c
scilab/modules/string/sci_gateway/c/sci_strindex.c
scilab/modules/string/sci_gateway/c/sci_strsplit.c
scilab/modules/string/sci_gateway/c/sci_strsubst.c
scilab/modules/string/sci_gateway/c/sci_strtod.c
scilab/modules/string/sci_gateway/c/sci_strtok.c
scilab/modules/string/sci_gateway/c/sci_tokens.c
scilab/modules/string/src/c/stringsstrrev.c

Change-Id: Ifc88376594531cae9c549a218b6bc0e03d3589f0

74 files changed:
1  2 
scilab/configure
scilab/configure.ac
scilab/desktop/Makefile.in
scilab/modules/core/src/c/signal_mgmt.c
scilab/modules/elementary_functions/sci_gateway/c/sci_base2dec.c
scilab/modules/elementary_functions/sci_gateway/c/sci_dec2base.c
scilab/modules/fileio/sci_gateway/c/sci_chdir.c
scilab/modules/fileio/sci_gateway/c/sci_copyfile.c
scilab/modules/fileio/sci_gateway/c/sci_fprintfMat.c
scilab/modules/fileio/sci_gateway/c/sci_fscanfMat.c
scilab/modules/fileio/sci_gateway/c/sci_getURL.c
scilab/modules/fileio/sci_gateway/c/sci_movefile.c
scilab/modules/fileio/sci_gateway/c/sci_splitURL.c
scilab/modules/fileio/sci_gateway/c/sci_tempname.c
scilab/modules/fileio/src/c/copyfile_others.c
scilab/modules/fileio/src/c/createtempfilename.c
scilab/modules/fileio/src/c/dlManager.c
scilab/modules/fileio/src/c/do_xxscanf.c
scilab/modules/fileio/src/c/fileinfo.c
scilab/modules/fileio/src/c/filesmanagement.c
scilab/modules/fileio/src/c/fscanfMat.c
scilab/modules/fileio/src/c/fullpath.c
scilab/modules/fileio/src/c/getlongpathname.c
scilab/modules/fileio/src/c/getrelativefilename.c
scilab/modules/fileio/src/c/removedir.c
scilab/modules/fileio/src/c/scanf_functions.c
scilab/modules/functions/sci_gateway/cpp/sci_exec.cpp
scilab/modules/gui/sci_gateway/c/sci_exportUI.c
scilab/modules/gui/sci_gateway/cpp/sci_datatip_manager_mode.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatip_set_display.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatip_set_interp.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatip_set_orient.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatip_set_style.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatip_toggle.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatipcreate.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatipmove.cpp
scilab/modules/gui/sci_gateway/cpp/sci_datatipremove.cpp
scilab/modules/gui/sci_gateway/cpp/sci_openged.cpp
scilab/modules/gui/sci_gateway/cpp/sci_plotbrowser.cpp
scilab/modules/gui/sci_gateway/cpp/sci_useeditor.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_export_to_hdf5.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_import_from_hdf5.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_is_hdf5_file.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_listvar_in_hdf5.cpp
scilab/modules/hdf5/src/c/h5_fileManagement.c
scilab/modules/hdf5/src/c/h5_readDataFromFile.c
scilab/modules/hdf5/src/c/h5_writeDataToFile.c
scilab/modules/hdf5/src/cpp/import_from_hdf5_v1.cpp
scilab/modules/hdf5/src/cpp/listvar_in_hdf5_v1.cpp
scilab/modules/io/Makefile.am
scilab/modules/io/Makefile.in
scilab/modules/io/sci_gateway/c/sci_getenv.c
scilab/modules/io/sci_gateway/c/sci_save.c
scilab/modules/io/sci_gateway/c/sci_setenv.c
scilab/modules/io/src/c/getenvc.c
scilab/modules/io/src/c/io.vcxproj
scilab/modules/io/src/c/io.vcxproj.filters
scilab/modules/localization/src/c/charEncoding.c
scilab/modules/scicos/sci_gateway/c/sci_buildouttb.c
scilab/modules/scicos/sci_gateway/c/sci_diffobjs.c
scilab/modules/scicos/sci_gateway/c/sci_model2blk.c
scilab/modules/scicos/sci_gateway/c/sci_scicos_time.c
scilab/modules/scicos/sci_gateway/c/sci_scicosim.c
scilab/modules/scicos/sci_gateway/c/sci_set_blockerror.c
scilab/modules/scicos/src/c/MlistGetFieldNumber.c
scilab/modules/scicos/src/c/extractblklist.c
scilab/modules/scicos/src/c/sciblk4.c
scilab/modules/scicos/src/c/scicos.c
scilab/modules/scicos_blocks/src/c/fromws_c.c
scilab/modules/scicos_blocks/src/c/tows_c.c
scilab/modules/string/src/c/partfunction.c
scilab/modules/string/src/c/stringToComplex.c
scilab/modules/string/src/c/stringsstrrev.c
scilab/modules/string/src/c/strsubst.c

@@@ -11290,7 -10885,7 +11285,7 @@@ $as_echo "$ac_java_classpath" >&6; 
  $as_echo_n "checking to see if the java compiler works... " >&6; }
  
      cat << \EOF > conftest.java
- // #line 11293 "configure"
 -// #line 10888 "configure"
++// #line 11288 "configure"
  import java.util.regex.Pattern;
  
  
@@@ -11377,7 -10972,7 +11372,7 @@@ $as_echo_n "checking type of jvm... " >
      if test "x$ac_java_jvm_name" = "x" ; then
  
      cat << \EOF > conftest.java
- // #line 11380 "configure"
 -// #line 10975 "configure"
++// #line 11375 "configure"
  import java.util.regex.Pattern;
  
  import gnu.java.io.EncodingManager;
@@@ -11461,7 -11056,7 +11456,7 @@@ $as_echo_n "checking java API version..
      # The class java.nio.charset.Charset is new to 1.4
  
      cat << \EOF > conftest.java
- // #line 11464 "configure"
 -// #line 11059 "configure"
++// #line 11459 "configure"
  import java.util.regex.Pattern;
  
  import java.nio.charset.Charset;
      # The class java.lang.StringBuilder is new to 1.5
  
      cat << \EOF > conftest.java
- // #line 11529 "configure"
 -// #line 11124 "configure"
++// #line 11524 "configure"
  import java.util.regex.Pattern;
  
  import java.lang.StringBuilder;
      # The class java.util.ArrayDeque is new to 1.6
  
      cat << \EOF > conftest.java
- // #line 11594 "configure"
 -// #line 11189 "configure"
++// #line 11589 "configure"
  import java.util.regex.Pattern;
  
  import java.util.ArrayDeque;
      # The class java.nio.file.Path is new to 1.7
  
      cat << \EOF > conftest.java
- // #line 11659 "configure"
 -// #line 11254 "configure"
++// #line 11654 "configure"
  import java.util.regex.Pattern;
  
  import java.nio.file.Path;
@@@ -13034,7 -12629,7 +13029,7 @@@ $as_echo_n "checking jgraphx... " >&6; 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 13037 "configure"
 -// #line 12632 "configure"
++// #line 13032 "configure"
  import java.util.regex.Pattern;
  
  import com.mxgraph.model.mxCell;
@@@ -13141,7 -12736,7 +13136,7 @@@ $as_echo_n "checking minimal version (2
     if test "x" == "x"; then
  
      cat << \EOF > conftest.java
- // #line 13144 "configure"
 -// #line 12739 "configure"
++// #line 13139 "configure"
  import java.util.regex.Pattern;
  
  import com.mxgraph.view.mxGraph;
     else
  
      cat << \EOF > conftest.java
- // #line 13216 "configure"
 -// #line 12811 "configure"
++// #line 13211 "configure"
  import java.util.regex.Pattern;
  
  import com.mxgraph.view.mxGraph;
@@@ -13307,7 -12902,7 +13302,7 @@@ $as_echo_n "checking scirenderer... " >
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 13310 "configure"
 -// #line 12905 "configure"
++// #line 13305 "configure"
  import java.util.regex.Pattern;
  
  import org.scilab.forge.scirenderer.PackageInfo;
@@@ -13414,7 -13009,7 +13409,7 @@@ $as_echo_n "checking minimal version (1
     if test "x" == "x"; then
  
      cat << \EOF > conftest.java
- // #line 13417 "configure"
 -// #line 13012 "configure"
++// #line 13412 "configure"
  import java.util.regex.Pattern;
  
  import org.scilab.forge.scirenderer.PackageInfo;
     else
  
      cat << \EOF > conftest.java
- // #line 13489 "configure"
 -// #line 13084 "configure"
++// #line 13484 "configure"
  import java.util.regex.Pattern;
  
  import org.scilab.forge.scirenderer.PackageInfo;
@@@ -13585,7 -13180,7 +13580,7 @@@ $as_echo_n "checking flexdock... " >&6
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 13588 "configure"
 -// #line 13183 "configure"
++// #line 13583 "configure"
  import java.util.regex.Pattern;
  
  import org.flexdock.docking.DockingManager;
@@@ -13692,7 -13287,7 +13687,7 @@@ $as_echo_n "checking minimal version (1
     if test "x" == "x"; then
  
      cat << \EOF > conftest.java
- // #line 13695 "configure"
 -// #line 13290 "configure"
++// #line 13690 "configure"
  import java.util.regex.Pattern;
  
  import org.flexdock.util.Utilities;
     else
  
      cat << \EOF > conftest.java
- // #line 13767 "configure"
 -// #line 13362 "configure"
++// #line 13762 "configure"
  import java.util.regex.Pattern;
  
  import org.flexdock.util.Utilities;
@@@ -13855,7 -13450,7 +13850,7 @@@ $as_echo_n "checking looks... " >&6; 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 13858 "configure"
 -// #line 13453 "configure"
++// #line 13853 "configure"
  import java.util.regex.Pattern;
  
  import com.jgoodies.looks.common.MenuItemRenderer;
@@@ -13972,7 -13567,7 +13967,7 @@@ $as_echo_n "checking jgoodies-looks... 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 13975 "configure"
 -// #line 13570 "configure"
++// #line 13970 "configure"
  import java.util.regex.Pattern;
  
  import com.jgoodies.looks.common.MenuItemRenderer;
@@@ -14090,7 -13685,7 +14085,7 @@@ $as_echo_n "checking skinlf... " >&6; 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 14093 "configure"
 -// #line 13688 "configure"
++// #line 14088 "configure"
  import java.util.regex.Pattern;
  
  import com.l2fprod.util.AccessUtils;
@@@ -14207,7 -13802,7 +14202,7 @@@ $as_echo_n "checking jogl2... " >&6; 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 14210 "configure"
 -// #line 13805 "configure"
++// #line 14205 "configure"
  import java.util.regex.Pattern;
  
  import javax.media.opengl.glu.GLUnurbs;
@@@ -14430,7 -14025,7 +14425,7 @@@ $as_echo_n "checking gluegen2-rt... " >
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 14433 "configure"
 -// #line 14028 "configure"
++// #line 14428 "configure"
  import java.util.regex.Pattern;
  
  import jogamp.common.os.MachineDescriptionRuntime;
@@@ -14604,7 -14199,7 +14599,7 @@@ $as_echo_n "checking jhall... " >&6; 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 14607 "configure"
 -// #line 14202 "configure"
++// #line 14602 "configure"
  import java.util.regex.Pattern;
  
  import javax.help.JHelp;
@@@ -14721,7 -14316,7 +14716,7 @@@ $as_echo_n "checking javahelp2... " >&6
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 14724 "configure"
 -// #line 14319 "configure"
++// #line 14719 "configure"
  import java.util.regex.Pattern;
  
  import javax.help.JHelp;
@@@ -14839,7 -14434,7 +14834,7 @@@ $as_echo_n "checking jrosetta-API... " 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 14842 "configure"
 -// #line 14437 "configure"
++// #line 14837 "configure"
  import java.util.regex.Pattern;
  
  import com.artenum.rosetta.interfaces.core.ConsoleConfiguration;
@@@ -14954,7 -14549,7 +14949,7 @@@ $as_echo_n "checking jrosetta-api... " 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 14957 "configure"
 -// #line 14552 "configure"
++// #line 14952 "configure"
  import java.util.regex.Pattern;
  
  import com.artenum.rosetta.interfaces.core.ConsoleConfiguration;
@@@ -15072,7 -14667,7 +15067,7 @@@ $as_echo_n "checking jrosetta-engine..
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 15075 "configure"
 -// #line 14670 "configure"
++// #line 15070 "configure"
  import java.util.regex.Pattern;
  
  import com.artenum.rosetta.core.action.AbstractConsoleAction;
@@@ -15178,7 -14773,7 +15173,7 @@@ $as_echo_n "checking minimal version (1
     if test "x" == "x"; then
  
      cat << \EOF > conftest.java
- // #line 15181 "configure"
 -// #line 14776 "configure"
++// #line 15176 "configure"
  import java.util.regex.Pattern;
  
  import com.artenum.rosetta.util.ConfigurationBuilder;
     else
  
      cat << \EOF > conftest.java
- // #line 15253 "configure"
 -// #line 14848 "configure"
++// #line 15248 "configure"
  import java.util.regex.Pattern;
  
  import com.artenum.rosetta.util.ConfigurationBuilder;
@@@ -15343,7 -14938,7 +15338,7 @@@ $as_echo_n "checking jeuclid-core... " 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 15346 "configure"
 -// #line 14941 "configure"
++// #line 15341 "configure"
  import java.util.regex.Pattern;
  
  import net.sourceforge.jeuclid.LayoutContext;
@@@ -15462,7 -15057,7 +15457,7 @@@ $as_echo_n "checking fop... " >&6; 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 15465 "configure"
 -// #line 15060 "configure"
++// #line 15460 "configure"
  import java.util.regex.Pattern;
  
  import org.apache.fop.pdf.PDFInfo;
@@@ -15579,7 -15174,7 +15574,7 @@@ $as_echo_n "checking batik-all... " >&6
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 15582 "configure"
 -// #line 15177 "configure"
++// #line 15577 "configure"
  import java.util.regex.Pattern;
  
  import org.apache.batik.parser.Parser;
@@@ -15696,7 -15291,7 +15691,7 @@@ $as_echo_n "checking batik... " >&6; 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 15699 "configure"
 -// #line 15294 "configure"
++// #line 15694 "configure"
  import java.util.regex.Pattern;
  
  import org.apache.batik.parser.Parser;
@@@ -15803,7 -15398,7 +15798,7 @@@ $as_echo_n "checking minimal version (1
     if test "x" == "x"; then
  
      cat << \EOF > conftest.java
- // #line 15806 "configure"
 -// #line 15401 "configure"
++// #line 15801 "configure"
  import java.util.regex.Pattern;
  
  import org.apache.batik.Version;
     else
  
      cat << \EOF > conftest.java
- // #line 15878 "configure"
 -// #line 15473 "configure"
++// #line 15873 "configure"
  import java.util.regex.Pattern;
  
  import org.apache.batik.Version;
@@@ -15966,7 -15561,7 +15961,7 @@@ $as_echo_n "checking commons-io... " >&
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 15969 "configure"
 -// #line 15564 "configure"
++// #line 15964 "configure"
  import java.util.regex.Pattern;
  
  import org.apache.commons.io.output.CountingOutputStream;
@@@ -16083,7 -15678,7 +16078,7 @@@ $as_echo_n "checking xmlgraphics-common
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 16086 "configure"
 -// #line 15681 "configure"
++// #line 16081 "configure"
  import java.util.regex.Pattern;
  
  import org.apache.xmlgraphics.util.Service;
@@@ -16200,7 -15795,7 +16195,7 @@@ $as_echo_n "checking avalon-framework..
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 16203 "configure"
 -// #line 15798 "configure"
++// #line 16198 "configure"
  import java.util.regex.Pattern;
  
  import org.apache.avalon.framework.configuration.ConfigurationException;
@@@ -16317,7 -15912,7 +16312,7 @@@ $as_echo_n "checking xml-apis-ext... " 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 16320 "configure"
 -// #line 15915 "configure"
++// #line 16315 "configure"
  import java.util.regex.Pattern;
  
  import org.w3c.dom.svg.SVGDocument;
@@@ -16434,7 -16029,7 +16429,7 @@@ $as_echo_n "checking xml-commons-apis-e
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 16437 "configure"
 -// #line 16032 "configure"
++// #line 16432 "configure"
  import java.util.regex.Pattern;
  
  import org.w3c.dom.svg.SVGDocument;
@@@ -16555,7 -16150,7 +16550,7 @@@ $as_echo_n "checking commons-logging..
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 16558 "configure"
 -// #line 16153 "configure"
++// #line 16553 "configure"
  import java.util.regex.Pattern;
  
  import org.apache.commons.logging.LogFactory;
@@@ -16672,7 -16267,7 +16667,7 @@@ $as_echo_n "checking jlatexmath... " >&
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 16675 "configure"
 -// #line 16270 "configure"
++// #line 16670 "configure"
  import java.util.regex.Pattern;
  
  import org.scilab.forge.jlatexmath.TeXFormula;
@@@ -16779,7 -16374,7 +16774,7 @@@ $as_echo_n "checking minimal version (1
     if test "x" == "x"; then
  
      cat << \EOF > conftest.java
- // #line 16782 "configure"
 -// #line 16377 "configure"
++// #line 16777 "configure"
  import java.util.regex.Pattern;
  
  import org.scilab.forge.jlatexmath.TeXFormula;
     else
  
      cat << \EOF > conftest.java
- // #line 16854 "configure"
 -// #line 16449 "configure"
++// #line 16849 "configure"
  import java.util.regex.Pattern;
  
  import org.scilab.forge.jlatexmath.TeXFormula;
@@@ -16942,7 -16537,7 +16937,7 @@@ $as_echo_n "checking jlatexmath-fop... 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 16945 "configure"
 -// #line 16540 "configure"
++// #line 16940 "configure"
  import java.util.regex.Pattern;
  
  import org.scilab.forge.jlatexmath.fop.JLaTeXMathObj;
@@@ -17065,7 -16660,7 +17060,7 @@@ $as_echo_n "checking checkstyle... " >&
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 17068 "configure"
 -// #line 16663 "configure"
++// #line 17063 "configure"
  import java.util.regex.Pattern;
  
  import com.puppycrawl.tools.checkstyle.CheckStyleTask;
@@@ -17182,7 -16777,7 +17177,7 @@@ $as_echo_n "checking commons-beanutils.
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 17185 "configure"
 -// #line 16780 "configure"
++// #line 17180 "configure"
  import java.util.regex.Pattern;
  
  import org.apache.commons.beanutils.Converter;
@@@ -17299,7 -16894,7 +17294,7 @@@ $as_echo_n "checking antlr... " >&6; 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 17302 "configure"
 -// #line 16897 "configure"
++// #line 17297 "configure"
  import java.util.regex.Pattern;
  
  import antlr.TokenStreamException;
@@@ -17416,7 -17011,7 +17411,7 @@@ $as_echo_n "checking junit4... " >&6; 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 17419 "configure"
 -// #line 17014 "configure"
++// #line 17414 "configure"
  import java.util.regex.Pattern;
  
  import org.junit.Assert;
@@@ -17533,7 -17128,7 +17528,7 @@@ $as_echo_n "checking cobertura... " >&6
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 17536 "configure"
 -// #line 17131 "configure"
++// #line 17531 "configure"
  import java.util.regex.Pattern;
  
  import net.sourceforge.cobertura.merge.Main;
@@@ -17650,7 -17245,7 +17645,7 @@@ $as_echo_n "checking asm3... " >&6; 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 17653 "configure"
 -// #line 17248 "configure"
++// #line 17648 "configure"
  import java.util.regex.Pattern;
  
  import org.objectweb.asm.Type;
@@@ -17766,7 -17361,7 +17761,7 @@@ $as_echo_n "checking asm... " >&6; 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 17769 "configure"
 -// #line 17364 "configure"
++// #line 17764 "configure"
  import java.util.regex.Pattern;
  
  import org.objectweb.asm.Type;
  
  
  #################
 +## EIGEN
 +#################
 +
 +
 +ac_ext=cpp
 +ac_cpp='$CXXCPP $CPPFLAGS'
 +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
 +$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
 +if test -z "$CXXCPP"; then
 +  if ${ac_cv_prog_CXXCPP+:} false; then :
 +  $as_echo_n "(cached) " >&6
 +else
 +      # Double quotes because CXXCPP needs to be expanded
 +    for CXXCPP in "$CXX -E" "/lib/cpp"
 +    do
 +      ac_preproc_ok=false
 +for ac_cxx_preproc_warn_flag in '' yes
 +do
 +  # Use a header file that comes with gcc, so configuring glibc
 +  # with a fresh cross-compiler works.
 +  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
 +  # <limits.h> exists even on freestanding compilers.
 +  # On the NeXT, cc -E runs the code through the compiler's parser,
 +  # not just through cpp. "Syntax error" is here to catch this case.
 +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 +/* end confdefs.h.  */
 +#ifdef __STDC__
 +# include <limits.h>
 +#else
 +# include <assert.h>
 +#endif
 +                   Syntax error
 +_ACEOF
 +if ac_fn_cxx_try_cpp "$LINENO"; then :
 +
 +else
 +  # Broken: fails on valid input.
 +continue
 +fi
 +rm -f conftest.err conftest.i conftest.$ac_ext
 +
 +  # OK, works on sane cases.  Now check whether nonexistent headers
 +  # can be detected and how.
 +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 +/* end confdefs.h.  */
 +#include <ac_nonexistent.h>
 +_ACEOF
 +if ac_fn_cxx_try_cpp "$LINENO"; then :
 +  # Broken: success on invalid input.
 +continue
 +else
 +  # Passes both tests.
 +ac_preproc_ok=:
 +break
 +fi
 +rm -f conftest.err conftest.i conftest.$ac_ext
 +
 +done
 +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
 +rm -f conftest.i conftest.err conftest.$ac_ext
 +if $ac_preproc_ok; then :
 +  break
 +fi
 +
 +    done
 +    ac_cv_prog_CXXCPP=$CXXCPP
 +
 +fi
 +  CXXCPP=$ac_cv_prog_CXXCPP
 +else
 +  ac_cv_prog_CXXCPP=$CXXCPP
 +fi
 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
 +$as_echo "$CXXCPP" >&6; }
 +ac_preproc_ok=false
 +for ac_cxx_preproc_warn_flag in '' yes
 +do
 +  # Use a header file that comes with gcc, so configuring glibc
 +  # with a fresh cross-compiler works.
 +  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
 +  # <limits.h> exists even on freestanding compilers.
 +  # On the NeXT, cc -E runs the code through the compiler's parser,
 +  # not just through cpp. "Syntax error" is here to catch this case.
 +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 +/* end confdefs.h.  */
 +#ifdef __STDC__
 +# include <limits.h>
 +#else
 +# include <assert.h>
 +#endif
 +                   Syntax error
 +_ACEOF
 +if ac_fn_cxx_try_cpp "$LINENO"; then :
 +
 +else
 +  # Broken: fails on valid input.
 +continue
 +fi
 +rm -f conftest.err conftest.i conftest.$ac_ext
 +
 +  # OK, works on sane cases.  Now check whether nonexistent headers
 +  # can be detected and how.
 +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 +/* end confdefs.h.  */
 +#include <ac_nonexistent.h>
 +_ACEOF
 +if ac_fn_cxx_try_cpp "$LINENO"; then :
 +  # Broken: success on invalid input.
 +continue
 +else
 +  # Passes both tests.
 +ac_preproc_ok=:
 +break
 +fi
 +rm -f conftest.err conftest.i conftest.$ac_ext
 +
 +done
 +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
 +rm -f conftest.i conftest.err conftest.$ac_ext
 +if $ac_preproc_ok; then :
 +
 +else
 +  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 +as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
 +See \`config.log' for more details" "$LINENO" 5; }
 +fi
 +
 +ac_ext=cpp
 +ac_cpp='$CXXCPP $CPPFLAGS'
 +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 +
 +
 +
 +ac_ext=cpp
 +ac_cpp='$CXXCPP $CPPFLAGS'
 +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 +
 +
 +
 +# Check whether --with-eigen_include was given.
 +if test "${with_eigen_include+set}" = set; then :
 +  withval=$with_eigen_include; with_eigen_include=$withval
 +else
 +  with_eigen_include='yes'
 +
 +fi
 +
 +
 +
 +save_CPPFLAGS="$CPPFLAGS"
 +
 +if test "x$with_eigen_include" != "xyes"; then
 +      CPPFLAGS="-I$with_eigen_include"
 +      ac_fn_cxx_check_header_mongrel "$LINENO" "Eigen/Sparse" "ac_cv_header_Eigen_Sparse" "$ac_includes_default"
 +if test "x$ac_cv_header_Eigen_Sparse" = xyes; then :
 +  EIGEN_CPPFLAGS="$CPPFLAGS"
 +else
 +  as_fn_error $? "Cannot find headers (Eigen/Sparse) of the library EIGEN in $with_eigen_include. Please install the dev package (Debian : libeigen3-dev)" "$LINENO" 5
 +
 +fi
 +
 +
 +    PATH_TO_EIGEN=$with_eigen_include
 +else
 +      ac_fn_cxx_check_header_mongrel "$LINENO" "Eigen/Sparse" "ac_cv_header_Eigen_Sparse" "$ac_includes_default"
 +if test "x$ac_cv_header_Eigen_Sparse" = xyes; then :
 +  EIGEN_CPPFLAGS=""
 +else
 +         $as_unset ac_cv_header_Eigen_Sparse
 +                CPPFLAGS="-I/usr/include/eigen3/"
 +                ac_fn_cxx_check_header_mongrel "$LINENO" "Eigen/Sparse" "ac_cv_header_Eigen_Sparse" "$ac_includes_default"
 +if test "x$ac_cv_header_Eigen_Sparse" = xyes; then :
 +  EIGEN_CPPFLAGS=$CPPFLAGS
 +else
 +  as_fn_error $? "Cannot find headers (Eigen/Sparse) of the library eigen. Please install the dev package (Debian : libeigen3-dev)" "$LINENO" 5
 +
 +fi
 +
 +
 +
 +fi
 +
 +
 +    PATH_TO_EIGEN="/usr/include/eigen3/"
 +fi
 +CPPFLAGS="$save_CPPFLAGS"
 +
 +CHK_EIGEN_WORLD=3
 +CHK_EIGEN_MAJOR=1
 +CHK_EIGEN_MINOR=0
 +
 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if Eigen is version $CHK_EIGEN_WORLD.$CHK_EIGEN_MAJOR.$CHK_EIGEN_MINOR or later" >&5
 +$as_echo_n "checking if Eigen is version $CHK_EIGEN_WORLD.$CHK_EIGEN_MAJOR.$CHK_EIGEN_MINOR or later... " >&6; }
 +cat > conftest.$ac_ext <<EOF
- #line 21901 "configure"
++#line 21896 "configure"
 +#include "confdefs.h"
 +
 +#include "$PATH_TO_EIGEN/Eigen/Sparse"
 +#if EIGEN_VERSION_AT_LEAST(3,1,0)
 +EIGEN_VERSION_OK
 +#endif
 +
 +EOF
 +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
 +  grep "EIGEN_VERSION_OK" >/dev/null 2>&1; then
 +  rm -rf conftest*
 +  \
 +EIGEN_VERSION_OK=1
 +else
 +  rm -rf conftest*
 +  \
 +EIGEN_VERSION_OK=0
 +fi
 +rm -f conftest*
 +
 +if test $EIGEN_VERSION_OK = 0; then
 +   as_fn_error $? "Version $CHK_EIGEN_WORLD.$CHK_EIGEN_MAJOR.$CHK_EIGEN_MINOR of Eigen expected (at least)" "$LINENO" 5
 +else
 +   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 +$as_echo "yes" >&6; }
 +fi
 +
 +
 +
 +$as_echo "#define WITH_EIGEN /**/" >>confdefs.h
 +
 +ac_ext=c
 +ac_cpp='$CPP $CPPFLAGS'
 +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 +ac_compiler_gnu=$ac_cv_c_compiler_gnu
 +
 +
 +
 +
 +#################
  ## MPI
  #################
  
@@@ -26439,7 -25791,7 +26434,7 @@@ CPPFLAGS="$CPPFLAGS -I$CHK_TCL_INCLUDE_
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if tcl is version $CHK_TCL_MAJOR.$CHK_TCL_MINOR or later" >&5
  $as_echo_n "checking if tcl is version $CHK_TCL_MAJOR.$CHK_TCL_MINOR or later... " >&6; }
  cat > conftest.$ac_ext <<EOF
- #line 26442 "configure"
 -#line 25794 "configure"
++#line 26437 "configure"
  #include "confdefs.h"
  
  #include "$CHK_TCL_INCLUDE_PATH/$CHK_TCL_INC_NAME"
@@@ -26750,7 -26102,7 +26745,7 @@@ CPPFLAGS="$CPPFLAGS $TCL_INC_PATH -I$CH
  $as_echo_n "checking if tk is version $CHK_TK_MAJOR.$CHK_TK_MINOR or later... " >&6; }
  
  cat > conftest.$ac_ext <<EOF
- #line 26753 "configure"
 -#line 26105 "configure"
++#line 26748 "configure"
  #include "confdefs.h"
  
  #include "$CHK_TK_INCLUDE_PATH/$CHK_TK_INC_NAME"
@@@ -27334,7 -26686,7 +27329,7 @@@ $as_echo_n "checking saxon9he... " >&6
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 27337 "configure"
 -// #line 26689 "configure"
++// #line 27332 "configure"
  import java.util.regex.Pattern;
  
  import net.sf.saxon.Version;
@@@ -27449,7 -26801,7 +27444,7 @@@ $as_echo_n "checking saxon... " >&6; 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 27452 "configure"
 -// #line 26804 "configure"
++// #line 27447 "configure"
  import java.util.regex.Pattern;
  
  import net.sf.saxon.Version;
@@@ -27565,7 -26917,7 +27560,7 @@@ $as_echo_n "checking saxon... " >&6; 
              export ac_java_classpath="$jar_resolved:$ac_java_classpath"
  
      cat << \EOF > conftest.java
- // #line 27568 "configure"
 -// #line 26920 "configure"
++// #line 27563 "configure"
  import java.util.regex.Pattern;
  
  import com.icl.saxon.Loader;
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
- #line 33995 "configure"
 -#line 33347 "configure"
++#line 33990 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
- #line 34101 "configure"
 -#line 33453 "configure"
++#line 34096 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
Simple merge
Simple merge
@@@ -413,35 -415,12 +415,9 @@@ static void sig_fatal(int signum, sigin
  void base_error_init(void)
  {
      struct sigaction act;
--
      int j;
--
      struct sigaction ToSuspend;
--
      struct sigaction ToContinue;
-     /* Initialise Suspend Signal (CTRL-Z) */
-     ToSuspend.sa_handler = suspendProcess;
-     ToSuspend.sa_flags = 0;
-     sigemptyset(&ToSuspend.sa_mask);
-     sigaction(SIGTSTP, &ToSuspend, NULL);
-     /* Initialise Continue Signal (fg) */
-     ToContinue.sa_handler = continueProcess;
-     ToContinue.sa_flags = 0;
-     sigemptyset(&ToContinue.sa_mask);
-     sigaction(SIGCONT, &ToContinue, NULL);
-     /* Signal handlers */
-     //csignal();
-     memset(&act, 0, sizeof(act));
-     act.sa_sigaction = sig_fatal;
-     act.sa_flags = SA_SIGINFO;
- #ifdef SA_ONESHOT
-     act.sa_flags |= SA_ONESHOT;
- #else
-     act.sa_flags |= SA_RESETHAND;
- #endif
-     sigemptyset(&act.sa_mask);
      int signals[] =
      {
  #ifdef SIGABRT
@@@ -90,8 -89,13 +90,13 @@@ int sci_base2dec(char *fname, void* pvA
  
      if (getAllocatedMatrixOfString(pvApiCtx, piAddressVarOne, &m, &n, &pStrs) != 0)
      {
+         if (pStrs)
+         {
+             freeAllocatedMatrixOfString(m, n, pStrs);
+         }
          Scierror(999, _("%s: No more memory.\n"), fname);
 -        return 0;
 +        return 1;
      }
  
      dResults = (double*)MALLOC(sizeof(double) * (m * n));
@@@ -157,16 -157,9 +157,9 @@@ int sci_dec2base(char *fname, void* pvA
      {
          printError(&sciErr, 0);
          Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
 -        return 0;
 +        return 1;
      }
  
-     convertedValues = (char **)MALLOC(sizeof(char*) * (m * n));
-     if (convertedValues == NULL)
-     {
-         Scierror(999, _("%s: No more memory.\n"), fname);
-         return 1;
-     }
      convertedValues = convertMatrixOfDec2Base(dValues, m * n, iBaseUsed, nbDigits, &err);
      if ((err != ERROR_CONVERTBASE_OK) || (convertedValues == NULL))
      {
@@@ -208,19 -184,10 +185,10 @@@ int sci_copyfile(char *fname, void* pvA
              }
              else
              {
-                 if (pStVarOneExpanded)
-                 {
-                     FREE(pStVarOneExpanded);
-                     pStVarOneExpanded = NULL;
-                 }
-                 if (pStVarTwoExpanded)
-                 {
-                     FREE(pStVarTwoExpanded);
-                     pStVarTwoExpanded = NULL;
-                 }
+                 FREE(pStVarOneExpanded);
+                 FREE(pStVarTwoExpanded);
                  Scierror(999, _("%s: Wrong value for input argument #%d: A valid filename or directory expected.\n"), fname, 1);
 -                return 0;
 +                return 1;
              }
          }
          else
      else
      {
          Scierror(999, _("%s: Wrong value for input argument #%d: A valid filename or directory expected.\n"), fname, 1);
 +        return 1;
      }
  
-     if (pStVarOneExpanded)
-     {
-         FREE(pStVarOneExpanded);
-         pStVarOneExpanded = NULL;
-     }
-     if (pStVarTwoExpanded)
-     {
-         FREE(pStVarTwoExpanded);
-         pStVarTwoExpanded = NULL;
-     }
+     FREE(pStVarOneExpanded);
+     FREE(pStVarTwoExpanded);
  
      return 0;
  }
@@@ -309,9 -247,8 +249,8 @@@ static wchar_t *getFilenameWithExtensio
      }
      return wcfilename;
  }
  /*--------------------------------------------------------------------------*/
 -static int returnCopyFileResultOnStack(int ierr, char *fname)
 +static int returnCopyFileResultOnStack(int ierr, char *fname, void* pvApiCtx)
  {
      double dError = 0.;
      wchar_t *sciError = NULL;
  #include "localization.h"
  #include "freeArrayOfString.h"
  #include "expandPathVariable.h"
 -
 -#ifdef _MSC_VER
 -#include "strdup_windows.h"
 -#endif
 +#include "os_strdup.h"
  #include "fprintfMat.h"
+ static void freeVar(char** filename, char** expandedFilename, char*** textAdded, int m4n4, char** Format, char** separator);
  /*--------------------------------------------------------------------------*/
 -int sci_fprintfMat(char *fname, unsigned long fname_len)
 +int sci_fprintfMat(char *fname, void* pvApiCtx)
  {
      SciErr sciErr;
      int *piAddressVarOne = NULL;
@@@ -43,8 -48,8 +45,7 @@@
      int m4n4 = 0;
      int i = 0;
  
-     //Nbvars = 0;
-     CheckRhs(1, 5);
 -    Nbvars = 0;
+     CheckRhs(2, 5);
      CheckLhs(1, 1);
  
      if (Rhs >= 3)
  #include "localization.h"
  #include "freeArrayOfString.h"
  #include "expandPathVariable.h"
 -
 -#ifdef _MSC_VER
 -#include "strdup_windows.h"
 -#endif
 +#include "os_strdup.h"
  #include "fscanfMat.h"
+ /*--------------------------------------------------------------------------*/
+ static void freeVar(char** filename, char** expandedFilename, char** Format, char** separator);
  /*--------------------------------------------------------------------------*/
 -int sci_fscanfMat(char *fname, unsigned long fname_len)
 +int sci_fscanfMat(char *fname, void* pvApiCtx)
  {
      SciErr sciErr;
      int *piAddressVarOne = NULL;
                      }
                  }
  
-                 freeFscanfMatResult(results);
-                 results = NULL;
-                 if (filename)
-                 {
-                     FREE(filename);
-                     filename = NULL;
-                 }
-                 PutLhsVar();
-             }
-             break;
-             case FSCANFMAT_MOPEN_ERROR:
-             {
-                 Scierror(999, _("%s: can not open file %s.\n"), fname, filename);
-             }
-             break;
-             case FSCANFMAT_READLINES_ERROR:
-             {
-                 Scierror(999, _("%s: can not read file %s.\n"), fname, filename);
-             }
-             break;
-             case FSCANFMAT_FORMAT_ERROR:
-             {
-                 Scierror(999, _("%s: Invalid format.\n"), fname);
-             }
-             break;
-             case FSCANFMAT_MEMORY_ALLOCATION:
-             {
-                 Scierror(999, _("%s: Memory allocation error.\n"), fname);
-             }
-             break;
-             default:
-             case FSCANFMAT_ERROR:
-             {
-                 Scierror(999, _("%s: error.\n"), fname);
+                 LhsVar(2) = Rhs + 2;
              }
-             break;
+             freeFscanfMatResult(results);
+             FREE(filename);
+             PutLhsVar();
+             return 0;
+         }
+         break;
+         case FSCANFMAT_MOPEN_ERROR:
+         {
+             Scierror(999, _("%s: can not open file %s.\n"), fname, filename);
+         }
+         break;
+         case FSCANFMAT_READLINES_ERROR:
+         {
+             Scierror(999, _("%s: can not read file %s.\n"), fname, filename);
+         }
+         break;
+         case FSCANFMAT_FORMAT_ERROR:
+         {
+             Scierror(999, _("%s: Invalid format.\n"), fname);
+         }
+         break;
+         case FSCANFMAT_MEMORY_ALLOCATION:
+         {
+             Scierror(999, _("%s: Memory allocation error.\n"), fname);
+         }
+         break;
+         default:
+         case FSCANFMAT_ERROR:
+         {
+             Scierror(999, _("%s: error.\n"), fname);
          }
+         break;
      }
-     else
+     FREE(filename);
+     freeFscanfMatResult(results);
+     return 0;
+ }
+ /*--------------------------------------------------------------------------*/
+ static void freeVar(char** filename, char** expandedFilename, char** Format, char** separator)
+ {
+     if (filename && *filename)
      {
-         Scierror(999, _("%s: Memory allocation error.\n"), fname);
+         FREE(*filename);
+         *filename = NULL;
      }
  
-     if (filename)
+     if (expandedFilename && *expandedFilename)
      {
-         FREE(filename);
-         filename = NULL;
+         FREE(*expandedFilename);
+         *expandedFilename = NULL;
      }
  
-     return 0;
+     if (Format && *Format)
+     {
+         FREE(*Format);
+         *Format = NULL;
+     }
+     if (separator && *separator)
+     {
+         FREE(*separator);
+         *separator = NULL;
+     }
 -}
 +}
- /*--------------------------------------------------------------------------*/
  #include "dlManager.h"
  #include "localization.h"
  /* ==================================================================== */
- static void freeAllocatedStrings(char *url, char *dest, char *username, char *password, char* content);
+ static void freeAllocatedStrings(char** url, char** dest, char** username, char** password, char** content, char** filePath);
  /* ==================================================================== */
 -int sci_getURL(char *fname, int fname_len)
 +int sci_getURL(char *fname, void* pvApiCtx)
  {
      SciErr sciErr;
 -    int length = 0;
  
 -    int *piAddr = NULL;
      char *url = NULL;
      char *dest = NULL;
      char *username = NULL;
@@@ -270,20 -213,11 +214,11 @@@ static wchar_t *getFilenameWithExtensio
      }
      return wcfilename;
  }
  /*--------------------------------------------------------------------------*/
 -static int returnMoveFileResultOnStack(int ierr, char *fname)
 +static int returnMoveFileResultOnStack(int ierr, char *fname, void* pvApiCtx)
  {
      double dError = 0.;
-     wchar_t **sciError = NULL;
-     int m_out = 1, n_out = 1;
-     sciError = (wchar_t **) MALLOC(sizeof(wchar_t *) * 1);
-     if (sciError == NULL)
-     {
-         Scierror(999, _("%s: Memory allocation error.\n"), fname);
-         return 0;
-     }
+     wchar_t *sciError = NULL;
  
  #ifdef _MSC_VER
      if (ierr)
  #include <string.h>
  #include "dlManager.h"
  #include "Scierror.h"
 -#include "SCIHOME.h"
 +#include "sci_home.h"
- #include "getos.h"
  #include "PATH_MAX.h"
- #include "MALLOC.h"
  #include "isdir.h"
  #include "charEncoding.h"
  #include "localization.h"
@@@ -281,11 -291,12 +281,12 @@@ int do_xxscanf (wchar_t *fname, FILE *f
                      type[num_conversion] = SF_LI;
                      break;
  
 -                case 'n':
 +                case L'n':
                      n_directive_count++;
+                     //pass to next statement
  
 -                case 'i':
 -                case 'd':
 +                case L'i':
 +                case L'd':
                      if (l_flag)
                      {
                          ptrtab[num_conversion] = &buf[num_conversion].li;
  #include "charEncoding.h"
  #include "MALLOC.h"
  #include "returnanan.h"
 +#include "os_swprintf.h"
  #include "expandPathVariable.h"
 -/*--------------------------------------------------------------------------*/
 -#define FILEINFO_ARRAY_SIZE 13
 -
 -#define FILEINFO_TOTAL_SIZE_INDICE 0
 -#define FILEINFO_MODE_INDICE       1
 -#define FILEINFO_UID_INDICE        2
 -#define FILEINFO_GID_INDICE        3
 -#define FILEINFO_DEV_INDICE        4
 -#define FILEINFO_MTIME_INDICE      5
 -#define FILEINFO_CTIME_INDICE      6
 -#define FILEINFO_ATIME_INDICE      7
 -#define FILEINFO_RDEV_INDICE       8
 -#define FILEINFO_BLKSIZE_INDICE    9
 -#define FILEINFO_BLOCKS_INDICE    10
 -#define FILEINFO_INO_INDICE       11
 -#define FILEINFO_NLINK_INDICE     12
  
 -#define FILEINFO_DEFAULT_ERROR    -1
  /*--------------------------------------------------------------------------*/
  #ifdef _MSC_VER
 -static double *fileinfo_Windows(char *filepathname, int *ierr);
 +static double* fileinfo_WindowsW(wchar_t* _pwstFilename, int* _piErr);
  #else
 -static double *fileinfo_Others(char *filepathname, int *ierr);
 +static double* fileinfo_OthersW(wchar_t* _pwstFilename, int* _piErr);
  #endif
  /*--------------------------------------------------------------------------*/
 -double * fileinfo(char *filename, int *ierr)
 +double* filesinfoW(wchar_t** _pwstFilename, int _iSize, int* _piErr)
  {
 -    char *expandedpath = NULL;
 -    double *FILEINFO_ARRAY = NULL;
 -
 -    if (filename == NULL)
 +    int i = 0, j = 0;
 +    double *FILES_INFO_ARRAY = (double*)MALLOC(sizeof(double ) * _iSize * FILEINFO_ARRAY_SIZE);
 +    for (i = 0 ; i < _iSize ; i++)
      {
 -        *ierr = FILEINFO_DEFAULT_ERROR;
 -        return NULL;
 -    }
 +        wchar_t* pwstExp = expandPathVariableW(_pwstFilename[i]);
  
 -    expandedpath = expandPathVariable(filename);
 -    if (expandedpath)
 -    {
 +        if (pwstExp)
 +        {
 +            double *FILEINFO_ARRAY = NULL;
  #ifdef _MSC_VER
 -        FILEINFO_ARRAY = fileinfo_Windows(expandedpath, ierr);
 +            FILEINFO_ARRAY = fileinfo_WindowsW(pwstExp, &_piErr[i]);
  #else
 -        FILEINFO_ARRAY = fileinfo_Others(expandedpath, ierr);
 +            FILEINFO_ARRAY = fileinfo_OthersW(pwstExp, &_piErr[i]);
  #endif
 -        FREE(expandedpath);
 -        expandedpath = NULL;
 -    }
 -
 -    return FILEINFO_ARRAY;
 -}
 -/*--------------------------------------------------------------------------*/
 -double * filesinfo(char **filenames, int dim_filenames, int *ierrs)
 -{
 -    double *FILES_INFO_ARRAY = NULL;
 -
 -    if (dim_filenames > 0)
 -    {
 -        int i = 0;
 -        int j = 0;
 -        FILES_INFO_ARRAY = (double*)MALLOC(sizeof(double ) * (dim_filenames * FILEINFO_ARRAY_SIZE));
 -        if (FILES_INFO_ARRAY == NULL)
 -        {
 -            return NULL;
 -        }
 -
 -        for (i = 0; i < dim_filenames; i++)
 -        {
 -            int k = 0;
 -            int ierr = 0;
 -            double * FILEINFO_ARRAY = fileinfo(filenames[i], &ierr);
 -            if (FILEINFO_ARRAY == NULL)
 +            if (FILEINFO_ARRAY != NULL)
              {
 -                FILEINFO_ARRAY = (double*)MALLOC(sizeof(double) * FILEINFO_ARRAY_SIZE);
 -
 -                FILEINFO_ARRAY[FILEINFO_TOTAL_SIZE_INDICE] = C2F(returnanan)();
 -                FILEINFO_ARRAY[FILEINFO_MODE_INDICE] = C2F(returnanan)();
 -                FILEINFO_ARRAY[FILEINFO_UID_INDICE] =  C2F(returnanan)();
 -                FILEINFO_ARRAY[FILEINFO_GID_INDICE] =  C2F(returnanan)();
 -                FILEINFO_ARRAY[FILEINFO_DEV_INDICE] =  C2F(returnanan)();
 -                FILEINFO_ARRAY[FILEINFO_MTIME_INDICE] =  C2F(returnanan)();
 -                FILEINFO_ARRAY[FILEINFO_CTIME_INDICE] =  C2F(returnanan)();
 -                FILEINFO_ARRAY[FILEINFO_ATIME_INDICE] =  C2F(returnanan)();
 -                FILEINFO_ARRAY[FILEINFO_RDEV_INDICE] =  C2F(returnanan)();
 -                FILEINFO_ARRAY[FILEINFO_BLKSIZE_INDICE] =  C2F(returnanan)();
 -                FILEINFO_ARRAY[FILEINFO_BLOCKS_INDICE] =  C2F(returnanan)();
 -                FILEINFO_ARRAY[FILEINFO_INO_INDICE] =  C2F(returnanan)();
 -                FILEINFO_ARRAY[FILEINFO_NLINK_INDICE] =  C2F(returnanan)();
 +                for (j = 0 ; j < FILEINFO_ARRAY_SIZE ; j++)
 +                {
 +                    FILES_INFO_ARRAY[i + j * _iSize] = FILEINFO_ARRAY[j];
 +                }
              }
 -
 -            for (k = 0; k < FILEINFO_ARRAY_SIZE; k++)
 +            else
              {
 -                FILES_INFO_ARRAY[j + k] = FILEINFO_ARRAY[k];
 +                for (j = 0 ; j < FILEINFO_ARRAY_SIZE ; j++)
 +                {
 +                    FILES_INFO_ARRAY[i + j * _iSize] = C2F(returnanan)();
 +                }
              }
 -            j = j + FILEINFO_ARRAY_SIZE;
              FREE(FILEINFO_ARRAY);
 -            FILEINFO_ARRAY = NULL;
 -            ierrs[i] = ierr;
 +            FREE(pwstExp);
          }
      }
      return FILES_INFO_ARRAY;
@@@ -178,133 -144,10 +146,124 @@@ char* getrelativefilename(char *current
      // copy the rest of the filename into the result string
      strcpy(&relativeFilename[rfMarker], &_absoluteFilename[afMarker]);
  
-     if (_currentDirectory)
-     {
-         FREE(_currentDirectory);
-         _currentDirectory = NULL;
-     }
-     if (_absoluteFilename)
-     {
-         FREE(_absoluteFilename);
-         _absoluteFilename = NULL;
-     }
+     FREE(_currentDirectory);
+     FREE(_absoluteFilename);
      return relativeFilename;
  }
 +
 +wchar_t* getrelativefilenameW(wchar_t *currentDirectory, wchar_t *absoluteFilename)
 +{
 +    // declarations - put here so this should work in a C compiler
 +    int afMarker = 0, rfMarker = 0;
 +    int cdLen = 0, afLen = 0;
 +    int i = 0;
 +    int levels = 0;
 +    wchar_t *relativeFilename = (wchar_t*)MALLOC(PATH_MAX * sizeof(wchar_t));
 +    wchar_t *_currentDirectory = normalizeFileSeparatorW(currentDirectory);
 +    wchar_t *_absoluteFilename = normalizeFileSeparatorW(absoluteFilename);
 +
 +    cdLen = (int)wcslen(_currentDirectory);
 +    afLen = (int)wcslen(_absoluteFilename);
 +
 +    // make sure the names are not too short
 +    if ( cdLen < ABSOLUTE_NAME_START + 1 || afLen < ABSOLUTE_NAME_START + 1)
 +    {
 +        // fix bug 2181
 +        wcscpy(relativeFilename, _absoluteFilename);
 +        return relativeFilename;
 +    }
 +
 +    // Handle DOS names that are on different drives:
 +    if (tolower(_currentDirectory[0]) != tolower(_absoluteFilename[0]))
 +    {
 +        // not on the same drive, so only absolute filename will do
 +        wcscpy(relativeFilename, _absoluteFilename);
 +        return relativeFilename;
 +    }
 +
 +    // they are on the same drive, find out how much of the current directory
 +    // is in the absolute filename
 +    i = ABSOLUTE_NAME_START;
 +
 +#if defined(_MSC_VER)
 +    while (i < afLen && i < cdLen && tolower(_currentDirectory[i]) == tolower(_absoluteFilename[i]) )
 +    {
 +        i++;
 +    }
 +#else
 +    while (i < afLen && i < cdLen && _currentDirectory[i] == _absoluteFilename[i])
 +    {
 +        i++;
 +    }
 +#endif
 +
 +    if (i == cdLen && (_absoluteFilename[i] == DIR_SEPARATOR[0] || _absoluteFilename[i - 1] == DIR_SEPARATOR[0]))
 +    {
 +        // the whole current directory name is in the file name,
 +        // so we just trim off the current directory name to get the
 +        // current file name.
 +        if (_absoluteFilename[i] == DIR_SEPARATOR[0])
 +        {
 +            // a directory name might have a trailing slash but a relative
 +            // file name should not have a leading one...
 +            i++;
 +        }
 +
 +        wcscpy(relativeFilename, &_absoluteFilename[i]);
 +        return relativeFilename;
 +    }
 +
 +    // The file is not in a child directory of the current directory, so we
 +    // need to step back the appropriate number of parent directories by
 +    // using "..\"s.  First find out how many levels deeper we are than the
 +    // common directory
 +    afMarker = i;
 +    levels = 1;
 +
 +    // count the number of directory levels we have to go up to get to the
 +    // common directory
 +    while (i < cdLen)
 +    {
 +        i++;
 +        if (_currentDirectory[i] == DIR_SEPARATOR[0])
 +        {
 +            // make sure it's not a trailing slash
 +            i++;
 +            if (currentDirectory[i] != '\0')
 +            {
 +                levels++;
 +            }
 +        }
 +    }
 +
 +    // move the absolute filename marker back to the start of the directory name
 +    // that it has stopped in.
 +    while (afMarker > 0 && _absoluteFilename[afMarker - 1] != DIR_SEPARATOR[0])
 +    {
 +        afMarker--;
 +    }
 +
 +    // check that the result will not be too long
 +    if (levels * 3 + afLen - afMarker > PATH_MAX)
 +    {
 +        return NULL;
 +    }
 +
 +    // add the appropriate number of "..\"s.
 +    rfMarker = 0;
 +    for (i = 0; i < levels; i++)
 +    {
 +        relativeFilename[rfMarker++] = '.';
 +        relativeFilename[rfMarker++] = '.';
 +        relativeFilename[rfMarker++] = DIR_SEPARATOR[0];
 +    }
 +
 +    // copy the rest of the filename into the result string
 +    wcscpy(&relativeFilename[rfMarker], &_absoluteFilename[afMarker]);
 +
 +    return relativeFilename;
 +}
 +
  /* ================================================================================== */
  char *normalizeFileSeparator(const char *path)
  {
  #include "cvstr.h"
  #include "localization.h"
  #include "Scierror.h"
 -/*--------------------------------------------------------------------------*/
 -int Sci_Store(int nrow, int ncol, entry *data, sfdir *type, int retval_s)
 -{
 -    int cur_i, i, j, i1, one = 1, zero = 0, k, l, iarg, colcount;
 -    sfdir cur_type;
 -    char ** temp;
 -
 -
 -    /* create Scilab variable with each column of data */
 -    if (ncol + Rhs > intersiz )
 -    {
 -        Scierror(998, _("%s: Too many directives in scanf.\n"), "Sci_Store");
 -        return RET_BUG;
 -    }
 -    iarg = Rhs;
 -    if (Lhs > 1)
 -    {
 -        if (nrow == 0) /* eof encountered before any data */
 -        {
 -            CreateVar(++iarg, MATRIX_OF_DOUBLE_DATATYPE, &one, &one, &l);
 -            LhsVar(1) = iarg;
 -            *stk(l) = -1.0;
 -            for ( i = 2; i <= Lhs ; i++)
 -            {
 -                iarg++;
 -                CreateVar(iarg, MATRIX_OF_DOUBLE_DATATYPE, &zero, &zero, &l);
 -                LhsVar(i) = iarg;
 -            }
 -            PutLhsVar();
 -            return 0;
 -        }
 -        CreateVar(++iarg, MATRIX_OF_DOUBLE_DATATYPE, &one, &one, &l);
 -        *stk(l) = (double) retval_s;
 -        LhsVar(1) = iarg;
 -        if (ncol == 0)
 -        {
 -            goto Complete;
 -        }
 -
 -        for ( i = 0 ; i < ncol ; i++)
 -        {
 -            if ( (type[i] == SF_C) || (type[i] == SF_S) )
 -            {
 -                if ( (temp = (char**)MALLOC(nrow * ncol * sizeof(char*))) == NULL)
 -                {
 -                    return MEM_LACK;
 -                }
 -                k = 0;
 -                for (j = 0; j < nrow; j++)
 -                {
 -                    temp[k++] = data[i + ncol * j].s;
 -                }
 -                CreateVarFromPtr(++iarg, MATRIX_OF_STRING_DATATYPE, &nrow, &one, temp);
 -                FREE(temp);
 -                /*for (j=0;j<nrow;j++) FREE(data[i+ncol*j].s);*/
 -            }
 -            else
 -            {
 -                CreateVar(++iarg, MATRIX_OF_DOUBLE_DATATYPE, &nrow, &one, &l);
 -                for ( j = 0 ; j < nrow ; j++)
 -                {
 -                    *stk(l + j) = data[i + ncol * j].d;
 -                }
 -            }
 -
 -            LhsVar(i + 2) = iarg;
 -        }
 -        /*FREE(data);*/
 -        /** we must complete the returned arguments up to Lhs **/
 -Complete:
 -        for ( i = ncol + 2; i <= Lhs ; i++)
 -        {
 -            iarg++;
 -            CreateVar(iarg, MATRIX_OF_DOUBLE_DATATYPE, &zero, &zero, &l);
 -            LhsVar(i) = iarg;
 -        }
 -    }
 -    else  /* Lhs==1 */
 -    {
 -        char *ltype = "cblock";
 -        int multi = 0, endblk, ii, n;
 -
 -        cur_type = type[0];
 -
 -        for (i = 0; i < ncol; i++)
 -            if (type[i] != cur_type)
 -            {
 -                multi = 1;
 -                break;
 -            }
 -        if (multi)
 -        {
 -            i = (int)strlen(ltype);
 -            iarg = Rhs;
 -            CreateVarFromPtr(++iarg, STRING_DATATYPE, &one, &i, &ltype); /* the mlist type field */
 -            cur_type = type[0];
 -            i = 0;
 -            cur_i = i;
 -
 -            while (1)
 -            {
 -                if (i < ncol)
 -                {
 -                    endblk = (type[i] != cur_type);
 -                }
 -                else
 -                {
 -                    endblk = 1;
 -                }
 -                if (endblk)
 -                {
 -                    colcount = i - cur_i;
 -                    if (nrow == 0)
 -                    {
 -                        CreateVar(++iarg, MATRIX_OF_DOUBLE_DATATYPE, &zero, &zero, &l);
 -                    }
 -                    else if ( (cur_type == SF_C) || (cur_type == SF_S) )
 -                    {
 -                        if ( (temp = (char **) MALLOC(nrow * colcount * sizeof(char **))) == NULL)
 -                        {
 -                            return MEM_LACK;
 -                        }
 -                        k = 0;
 -                        for (i1 = cur_i; i1 < i; i1++)
 -                            for (j = 0; j < nrow; j++)
 -                            {
 -                                temp[k++] = data[i1 + ncol * j].s;
 -                            }
 -                        CreateVarFromPtr(++iarg, MATRIX_OF_STRING_DATATYPE, &nrow, &colcount, temp);
 -                        FREE(temp);
 -                        /*for (i1=cur_i;i1<i;i1++)
 -                          for (j=0;j<nrow;j++) FREE(data[i1+ncol*j].s);*/
 -                    }
 -                    else
 -                    {
 -                        CreateVar(++iarg, MATRIX_OF_DOUBLE_DATATYPE, &nrow, &colcount, &l);
 -                        ii = 0;
 -                        for (i1 = cur_i; i1 < i; i1++)
 -                        {
 -                            for ( j = 0 ; j < nrow ; j++)
 -                            {
 -                                *stk(l + j + nrow * ii) = data[i1 + ncol * j].d;
 -                            }
 -                            ii++;
 -                        }
 -                    }
 -                    if (i >= ncol)
 -                    {
 -                        break;
 -                    }
 -                    cur_i = i;
 -                    cur_type = type[i];
 -
 -                }
 -                i++;
 -            }
 -            n = iarg - Rhs; /* number of list fields*/
 -
 -            iarg++;
 -            i = Rhs + 1;
 -            C2F(mkmlistfromvars)(&i, &n);
 -            LhsVar(1) = i;
 -        }
 -        else
 -        {
 -            if (nrow == 0)
 -            {
 -                CreateVar(Rhs + 1, MATRIX_OF_DOUBLE_DATATYPE, &zero, &zero, &l);
 -            }
 -            else if ( (cur_type == SF_C) || (cur_type == SF_S) )
 -            {
 -                if ( (temp = (char **) MALLOC(nrow * ncol * sizeof(char *))) == NULL)
 -                {
 -                    return MEM_LACK;
 -                }
 -                k = 0;
 -                for (i1 = 0; i1 < ncol; i1++)
 -                    for (j = 0; j < nrow; j++)
 -                    {
 -                        temp[k++] = data[i1 + ncol * j].s;
 -                    }
 -                CreateVarFromPtr(Rhs + 1, MATRIX_OF_STRING_DATATYPE, &nrow, &ncol, temp);
 -                FREE(temp);
 -                /*for (i1=0;i1<ncol;i1++)
 -                  for (j=0;j<nrow;j++) FREE(data[i1+ncol*j].s);*/
 -            }
 -            else
 -            {
 -                CreateVar(Rhs + 1, MATRIX_OF_DOUBLE_DATATYPE, &nrow, &ncol, &l);
 -                ii = 0;
 -                for (i1 = 0; i1 < ncol; i1++)
 -                {
 -                    for ( j = 0 ; j < nrow ; j++)
 -                    {
 -                        *stk(l + j + nrow * ii) = data[i1 + ncol * j].d;
 -                    }
 -                    ii++;
 -                }
 -            }
 -        }
 -        LhsVar(1) = Rhs + 1;
 -    }
 -    PutLhsVar();
 -    return 0;
 -}
 -/*--------------------------------------------------------------------------*/
  /* ************************************************************************
   *   Store data scanned by a single call to do_scan in line rowcount of data
   *   table
index 5fe4791,0000000..77e1ad6
mode 100644,000000..100644
--- /dev/null
@@@ -1,676 -1,0 +1,675 @@@
 +/*
 +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 +* Copyright (C) 2006 - INRIA - Antoine ELIAS
 +*
 +* This file must be used under the terms of the CeCILL.
 +* This source file is licensed as described in the file COPYING, which
 +* you should have received as part of this distribution.  The terms
 +* are also available at
 +* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 +*
 +*/
 +
 +#include <string.h>
 +#include "parser.hxx"
 +#include "funcmanager.hxx"
 +#include "context.hxx"
 +#include "functions_gw.hxx"
 +#include "execvisitor.hxx"
 +#include "mutevisitor.hxx"
 +#include "scilabWrite.hxx"
 +#include "scilabexception.hxx"
 +#include "configvariable.hxx"
 +
 +#include <iostream>
 +#include <fstream>
 +#include <string>
 +
 +extern "C"
 +{
 +#include "os_wcsicmp.h"
 +#include "expandPathVariable.h"
 +#include "prompt.h"
 +#include "Scierror.h"
 +#include "localization.h"
 +#include "os_swprintf.h"
 +#include "mopen.h"
 +#include "mclose.h"
 +#include "fullpath.h"
 +#include "PATH_MAX.h"
 +}
 +
 +bool checkPrompt(int _iMode, int _iCheck);
 +void printLine(const std::string& _stPrompt, const std::string& _stLine, bool _bLF);
 +std::string printExp(std::ifstream& _File, Exp* _pExp, const std::string& _stPrompt, int* _piLine /* in/out */, int* _piCol /* in/out */, std::string& _stPreviousBuffer);
 +std::string getExpression(const std::string& _stFile, Exp* _pExp);
 +
 +/*--------------------------------------------------------------------------*/
 +types::Function::ReturnValue sci_exec(types::typed_list &in, int _iRetCount, types::typed_list &out)
 +{
 +    int promptMode      = 0;//default value at startup, overthise 3 or verbose ";"
 +    bool bPromptMode    = false;
 +    int iErr            = 0;
 +    bool bErrCatch      = false;
 +    Exp* pExp           = NULL;
 +    int iID             = 0;
 +    Parser parser;
 +
 +    if (ConfigVariable::getStartFinished())
 +    {
 +        if (ConfigVariable::getVerbose())
 +        {
 +            promptMode = 3;
 +        }
 +        else
 +        {
 +            promptMode = -1;
 +        }
 +    }
 +
 +    if (in.size() < 1 || in.size() > 3)
 +    {
 +        Scierror(999, _("%s: Wrong number of input arguments: %d to %d expected.\n"), "exec" , 1, 3);
 +        return Function::Error;
 +    }
 +
 +    if (in.size() > 1)
 +    {
 +        //errcatch or mode
 +        if (in[1]->isString() && in[1]->getAs<types::String>()->isScalar())
 +        {
 +            //errcatch
 +            String* pS = in[1]->getAs<types::String>();
 +            if (os_wcsicmp(pS->get(0), L"errcatch") == 0)
 +            {
 +                bErrCatch = true;
 +            }
 +            else
 +            {
 +                Scierror(999, _("%s: Wrong value for input argument #%d: 'errcatch' expected.\n"), "exec", 2);
 +                return Function::Error;
 +            }
 +
 +            if (in.size() > 2)
 +            {
 +                if (in[2]->isDouble() == false || in[2]->getAs<Double>()->isScalar() == false)
 +                {
 +                    //mode
 +                    Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), "exec", 3);
 +                    return Function::Error;
 +                }
 +
 +                promptMode = (int)in[2]->getAs<Double>()->getReal()[0];
 +                bPromptMode = true;
 +            }
 +        }
 +        else if (in[1]->isDouble() && in[1]->getAs<Double>()->isScalar())
 +        {
 +            //mode
 +            promptMode = (int)in[1]->getAs<Double>()->getReal()[0];
 +            bPromptMode = true;
 +        }
 +        else
 +        {
 +            //not managed
 +            Scierror(999, _("%s: Wrong type for input argument #%d: A integer or string expected.\n"), "exec", 2);
 +            return Function::Error;
 +        }
 +    }
 +
 +    if (in[0]->isString() && in[0]->getAs<types::String>()->isScalar())
 +    {
 +        //1st argument is a path, parse file and execute it
 +        int iParsePathLen             = 0;
 +        String* pS = in[0]->getAs<types::String>();
 +
 +        wchar_t* pstFile = pS->get(0);
 +        wchar_t *expandedPath = expandPathVariableW(pstFile);
 +        wchar_t* pwstTemp = (wchar_t*)MALLOC(sizeof(wchar_t) * (PATH_MAX * 2));
 +        get_full_pathW(pwstTemp, (const wchar_t*)expandedPath, PATH_MAX * 2);
 +
 +        /*fake call to mopen to show file within file()*/
 +        if (mopen(pwstTemp, L"r", 0, &iID) != MOPEN_NO_ERROR)
 +        {
 +            FREE(pwstTemp);
 +            char* pstPath = wide_string_to_UTF8(expandedPath);
 +            Scierror(999, _("%s: Cannot open file %s.\n"), "exec", pstPath);
 +            FREE(pstPath);
 +            return Function::Error;
 +        }
 +
 +        parser.parseFile(pwstTemp, L"exec");
 +        FREE(expandedPath);
 +        FREE(pwstTemp);
 +        if (parser.getExitStatus() !=  Parser::Succeded)
 +        {
 +            scilabWriteW(parser.getErrorMessage());
 +            delete parser.getTree();
 +            mclose(iID);
 +            return Function::Error;
 +        }
 +
 +        pExp = parser.getTree();
 +    }
 +    else if (in[0]->isMacro())
 +    {
 +        //1st argument is a macro name, execute it in the current environnement
 +        pExp = in[0]->getAs<Macro>()->getBody();
 +    }
 +    else if (in[0]->isMacroFile())
 +    {
 +        //1st argument is a macro name, parse and execute it in the current environnement
 +        if (in[0]->getAs<MacroFile>()->parse() == false)
 +        {
 +            char* pstMacro = wide_string_to_UTF8(in[0]->getAs<MacroFile>()->getName().c_str());
 +            Scierror(999, _("%s: Unable to parse macro '%s'"), "exec", pstMacro);
 +            FREE(pstMacro);
 +            mclose(iID);
 +            return Function::Error;
 +        }
 +        pExp = in[0]->getAs<MacroFile>()->getMacro()->getBody();
 +    }
 +    else
 +    {
 +        Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), "exec", 1);
-         mclose(iID);
 +        return Function::Error;
 +    }
 +
 +    std::list<Exp *>::iterator j;
 +    std::list<Exp *>LExp = ((SeqExp*)pExp)->exps_get();
 +
 +    char pstPrompt[64];
 +    //get prompt
 +    GetCurrentPrompt(pstPrompt);
 +    std::string stPrompt(pstPrompt);
 +    //    MessageBoxA(NULL, stPrompt, "", 0);
 +
 +    wchar_t* pwstFile =  expandPathVariableW(in[0]->getAs<types::String>()->get(0));
 +    char* pstFile = wide_string_to_UTF8(pwstFile);
 +    std::string stFile(pstFile);
 +    std::ifstream file(pstFile);
 +
 +    std::string str;
 +    int iCurrentLine = -1; //no data in str
 +    int iCurrentCol = 0; //no data in str
 +
 +    //save current prompt mode
 +    int oldVal = ConfigVariable::getPromptMode();
 +
 +    ConfigVariable::setPromptMode(promptMode);
 +
 +    for (j = LExp.begin() ; j != LExp.end() ; j++)
 +    {
 +        try
 +        {
 +            std::list<Exp *>::iterator k = j;
 +            //mode == 0, print new variable but not command
 +            if (ConfigVariable::getPromptMode() != 0 && ConfigVariable::getPromptMode() != 2)
 +            {
 +                int iLastLine = (*j)->location_get().last_line;
 +                do
 +                {
 +                    str = printExp(file, *k, stPrompt, &iCurrentLine, &iCurrentCol, str);
 +                    iLastLine = (*k)->location_get().last_line;
 +                    k++;
 +                }
 +                while (k != LExp.end() && (*k)->location_get().first_line == iLastLine);
 +
 +                // In case where the line ends by spaces, iCurrentCol is not reset
 +                // by printExp because we don't know if that's the end of the expression
 +                // before go out of the loop. So we have to reset column count
 +                // and print a new line before manage the next line.
 +                if (iCurrentCol != 0)
 +                {
 +                    iCurrentCol = 0;
 +                    printLine("", "", true);
 +                }
 +            }
 +            else
 +            {
 +                k++;
 +            }
 +
 +
 +            std::list<Exp *>::iterator p = j;
 +            for (; p != k; p++)
 +            {
 +                bool bImplicitCall = false;
 +                j = p;
 +                //excecute script
 +                //force -1 to prevent recursive call to exec to write in console
 +                //ConfigVariable::setPromptMode(-1);
 +                ExecVisitor execMe;
 +                (*j)->accept(execMe);
 +                //ConfigVariable::setPromptMode(promptMode);
 +
 +
 +                //to manage call without ()
 +                if (execMe.result_get() != NULL && execMe.result_get()->isCallable())
 +                {
 +                    Callable *pCall = execMe.result_get()->getAs<Callable>();
 +                    types::typed_list out;
 +                    types::typed_list in;
 +                    types::optional_list opt;
 +
 +                    try
 +                    {
 +                        //in this case of calling, we can return only one values
 +                        ExecVisitor execCall;
 +                        execCall.expected_setSize(1);
 +                        Function::ReturnValue Ret = pCall->call(in, opt, 1, out, &execCall);
 +
 +                        if (Ret == Callable::OK)
 +                        {
 +                            if (out.size() == 0)
 +                            {
 +                                execMe.result_set(NULL);
 +                            }
 +                            else if (out.size() == 1)
 +                            {
 +                                out[0]->DecreaseRef();
 +                                execMe.result_set(out[0]);
 +                                bImplicitCall = true;
 +                            }
 +                            else
 +                            {
 +                                for (int i = 0 ; i < static_cast<int>(out.size()) ; i++)
 +                                {
 +                                    out[i]->DecreaseRef();
 +                                    execMe.result_set(i, out[i]);
 +                                }
 +                            }
 +                        }
 +                        else if (Ret == Callable::Error)
 +                        {
 +                            if (ConfigVariable::getLastErrorFunction() == L"")
 +                            {
 +                                ConfigVariable::setLastErrorFunction(pCall->getName());
 +                            }
 +
 +                            if (pCall->isMacro() || pCall->isMacroFile())
 +                            {
 +                                wchar_t szError[bsiz];
 +                                os_swprintf(szError, bsiz, _W("at line % 5d of function %ls called by :\n"), (*j)->location_get().first_line, pCall->getName().c_str());
 +                                throw ScilabMessage(szError);
 +                            }
 +                            else
 +                            {
 +                                throw ScilabMessage();
 +                            }
 +                        }
 +                    }
 +                    catch (ScilabMessage sm)
 +                    {
 +                        wostringstream os;
 +                        PrintVisitor printMe(os);
 +                        (*j)->accept(printMe);
 +                        os << std::endl << std::endl;
 +                        if (ConfigVariable::getLastErrorFunction() == L"")
 +                        {
 +                            ConfigVariable::setLastErrorFunction(pCall->getName());
 +                        }
 +
 +                        if (pCall->isMacro() || pCall->isMacroFile())
 +                        {
 +                            wstring szAllError;
 +                            wchar_t szError[bsiz];
 +                            os_swprintf(szError, bsiz, _W("at line % 5d of function %ls called by :\n"), sm.GetErrorLocation().first_line, pCall->getName().c_str());
 +                            szAllError = szError + os.str();
 +                            os_swprintf(szError, bsiz, _W("at line % 5d of exec file called by :\n"), (*j)->location_get().first_line);
 +                            szAllError += szError;
 +                            throw ScilabMessage(szAllError);
 +                        }
 +                        else
 +                        {
 +                            sm.SetErrorMessage(sm.GetErrorMessage() + os.str());
 +                            throw sm;
 +                        }
 +                    }
 +                }
 +
 +                //update ans variable
 +                SimpleVar* pVar = dynamic_cast<SimpleVar*>(*j);
 +                //don't output Simplevar and empty result
 +                if (execMe.result_get() != NULL && (pVar == NULL || bImplicitCall))
 +                {
 +                    InternalType* pITAns = execMe.result_get();
 +                    symbol::Context::getInstance()->put(symbol::Symbol(L"ans"), *pITAns);
 +                    if ( (*j)->is_verbose() && bErrCatch == false)
 +                    {
 +                        //TODO manage multiple returns
 +                        scilabWriteW(L" ans  =\n\n");
 +                        execMe.VariableToString(pITAns);
 +                    }
 +                }
 +            }
 +        }
 +        catch (ScilabMessage sm)
 +        {
 +            scilabErrorW(sm.GetErrorMessage().c_str());
 +
 +            CallExp* pCall = dynamic_cast<CallExp*>(*j);
 +            if (pCall != NULL)
 +            {
 +                //to print call expression only of it is a macro
 +                ExecVisitor execFunc;
 +                pCall->name_get().accept(execFunc);
 +
 +                if (execFunc.result_get() != NULL &&
 +                        (execFunc.result_get()->isMacro() || execFunc.result_get()->isMacroFile()))
 +                {
 +                    wostringstream os;
 +
 +                    //add function failed
 +                    PrintVisitor printMe(os);
 +                    pCall->accept(printMe);
 +                    os << std::endl;
 +
 +                    //add info on file failed
 +                    wchar_t szError[bsiz];
 +                    os_swprintf(szError, bsiz, _W("at line % 5d of exec file called by :\n"), (*j)->location_get().first_line);
 +                    os << szError;
 +
 +                    if (ConfigVariable::getLastErrorFunction() == L"")
 +                    {
 +                        ConfigVariable::setLastErrorFunction(execFunc.result_get()->getAs<Callable>()->getName());
 +                    }
 +
 +
 +                    mclose(iID);
 +                    //restore previous prompt mode
 +                    ConfigVariable::setPromptMode(oldVal);
 +                    throw ScilabMessage(os.str(), 0, (*j)->location_get());
 +                }
 +            }
 +
 +            mclose(iID);
 +            throw ScilabMessage((*j)->location_get());
 +        }
 +        catch (ScilabError se)
 +        {
 +            if (ConfigVariable::getLastErrorNumber() == 0)
 +            {
 +                ConfigVariable::setLastErrorMessage(se.GetErrorMessage());
 +                ConfigVariable::setLastErrorNumber(se.GetErrorNumber());
 +                ConfigVariable::setLastErrorLine(se.GetErrorLocation().first_line);
 +                ConfigVariable::setLastErrorFunction(wstring(L""));
 +            }
 +
 +            //store message
 +            iErr = ConfigVariable::getLastErrorNumber();
 +            if (bErrCatch == false)
 +            {
 +                file.close();
 +                //print failed command
 +                scilabError(getExpression(stFile, *j).c_str());
 +                scilabErrorW(L"\n");
 +
 +                //write error
 +                scilabErrorW(se.GetErrorMessage().c_str());
 +
 +                //write position
 +                wchar_t szError[bsiz];
 +                os_swprintf(szError, bsiz, _W("at line % 5d of exec file called by :\n"), (*j)->location_get().first_line);
 +                scilabErrorW(szError);
 +                mclose(iID);
 +                //restore previous prompt mode
 +                ConfigVariable::setPromptMode(oldVal);
 +                //throw ScilabMessage(szError, 1, (*j)->location_get());
 +                //print already done, so just foward exception but with message
 +                throw ScilabError();
 +            }
 +            break;
 +        }
 +    }
 +
 +    //restore previous prompt mode
 +    ConfigVariable::setPromptMode(oldVal);
 +
 +    if (bErrCatch)
 +    {
 +        out.push_back(new Double(iErr));
 +        //to lock last error information
 +        ConfigVariable::setLastErrorCall();
 +    }
 +
 +    delete parser.getTree();
 +    mclose(iID);
 +    file.close();
 +    FREE(pstFile);
 +    FREE(pwstFile);
 +    return Function::OK;
 +}
 +
 +std::string getExpression(const std::string& _stFile, Exp* _pExp)
 +{
 +    std::string out;
 +    std::string stBuffer;
 +    int iLine = 0;
 +    Location loc = _pExp->location_get();
 +    std::ifstream file(_stFile.c_str());
 +
 +    //bypass previous lines
 +    for (int i = 0 ; i < loc.first_line; i++)
 +    {
 +        std::getline(file, stBuffer);
 +    }
 +
 +    if (loc.first_line == loc.last_line)
 +    {
 +        int iStart = loc.first_column - 1;
 +        int iEnd = loc.last_column - 1;
 +        int iLen = iEnd - iStart;
 +        out += string(stBuffer.c_str() + iStart, iLen);
 +    }
 +    else
 +    {
 +        //
 +
 +        //first line, entire or not
 +        out += string(stBuffer.c_str() + loc.first_column - 1);
 +        out += "\n";
 +
 +        //print other full lines
 +        for (int i = loc.first_line; i < (loc.last_line - 1) ; i++)
 +        {
 +            std::getline(file, stBuffer);
 +            out += stBuffer;
 +            out += "\n";
 +        }
 +
 +
 +        //last line, entire or not
 +        getline(file, stBuffer);
 +        out += string(stBuffer.c_str(), loc.last_column - 1);
 +        out += "\n";
 +    }
 +    return out;
 +}
 +
 +bool checkPrompt(int _iMode, int _iCheck)
 +{
 +    return ((_iMode & _iCheck) == _iCheck);
 +}
 +
 +std::string printExp(std::ifstream& _File, Exp* _pExp, const std::string& _stPrompt, int* _piLine /* in/out */, int* _piCol /* in/out */, std::string& _stPreviousBuffer)
 +{
 +    //case 1, exp is on 1 line and take the entire line
 +
 +    //case 2, exp is multiline
 +
 +    //case 3, exp is part of a line.
 +    //ex : 3 exp on the same line a = 1; b = 2; c = 3;
 +
 +    //case 4, exp is multiline but start and/or finish in the middle of a line
 +    //ex :
 +    //a = 10;for i = 1 : a
 +    //        a
 +    //end, b = 1;
 +
 +    Location loc = _pExp->location_get();
 +
 +    //positionning file curser at loc.first_line
 +    {
 +        //strange case, current position is after the wanted position
 +        if (*_piLine > loc.first_line)
 +        {
 +            //reset line counter and restart reading at the start of the file.
 +            *_piLine = -1;
 +            _File.seekg( 0, ios_base::beg );
 +        }
 +
 +        //bypass previous lines
 +        for (int i = *_piLine ; i < loc.first_line - 1; i++)
 +        {
 +
 +            (*_piLine)++;
 +            if ((*_piLine) != (loc.first_line - 1))
 +            {
 +                //empty line but not sequential lines
 +                printLine("", "", true);
 +            }
 +            std::getline(_File, _stPreviousBuffer);
 +        }
 +    }
 +
 +    if (loc.first_line == loc.last_line)
 +    {
 +        //1 line
 +        int iStart = loc.first_column - 1;
 +        int iEnd = loc.last_column - 1;
 +        int iLen = iEnd - iStart;
 +        std::string strLastLine(_stPreviousBuffer.c_str() + iStart, iLen);
 +        int iExpLen = iLen;
 +        int iLineLen = (int)_stPreviousBuffer.size();
 +        //printLine(_pstPrompt, strLastLine, true, false);
 +
 +        if (iStart == 0 && iExpLen == iLineLen)
 +        {
 +            //entire line
 +            if (*_piCol)
 +            {
 +                //blank char at the end of previous line
 +                printLine("", "", true);
 +            }
 +            printLine(_stPrompt, strLastLine, true);
 +            *_piCol = 0;
 +        }
 +        else
 +        {
 +            if (iStart == 0)
 +            {
 +                //begin of line
 +                if (*_piCol)
 +                {
 +                    //blank char at the end of previous line
 +                    printLine("", "", true);
 +                }
 +                printLine(_stPrompt, strLastLine, false);
 +                *_piCol = loc.last_column;
 +            }
 +            else
 +            {
 +                if (*_piCol == 0)
 +                {
 +                    printLine(_stPrompt, "", false);
 +                    (*_piCol)++;
 +                }
 +
 +                if (*_piCol < loc.first_column)
 +                {
 +                    //pickup separator between expressionsfrom file and add to output
 +                    int iSize = loc.first_column - *_piCol;
 +                    std::string stTemp(_stPreviousBuffer.c_str() +  (*_piCol - 1), iSize);
 +                    printLine("", stTemp, false);
 +                    *_piCol = loc.first_column;
 +                }
 +
 +                if (iEnd == iLineLen)
 +                {
 +                    printLine("", strLastLine, true);
 +                    *_piCol = 0;
 +                }
 +                else
 +                {
 +                    printLine("", strLastLine, false);
 +                    *_piCol = loc.last_column;
 +                }
 +            }
 +        }
 +    }
 +    else
 +    {
 +        //multiline
 +
 +        if (loc.first_column == 1)
 +        {
 +            if (*_piCol)
 +            {
 +                //blank char at the end of previous line
 +                printLine("", "", true);
 +            }
 +            printLine(_stPrompt, _stPreviousBuffer.c_str() + (loc.first_column - 1), false);
 +        }
 +        else
 +        {
 +            if (*_piCol < loc.first_column)
 +            {
 +                //pickup separator between expressionsfrom file and add to output
 +                int iSize = loc.first_column - *_piCol;
 +                std::string stTemp(_stPreviousBuffer.c_str() +  (*_piCol - 1), iSize);
 +                printLine("", stTemp, false);
 +                *_piCol = loc.first_column;
 +            }
 +
 +            printLine("", _stPreviousBuffer.c_str() + (loc.first_column - 1), false);
 +        }
 +
 +        //print other full lines
 +        for (int i = loc.first_line; i < (loc.last_line - 1) ; i++)
 +        {
 +            (*_piLine)++;
 +            std::getline(_File, _stPreviousBuffer);
 +            printLine(_stPrompt, _stPreviousBuffer.c_str(), false);
 +        }
 +
 +        //last line
 +        std::getline(_File, _stPreviousBuffer);
 +        (*_piLine)++;
 +
 +        int iSize = loc.last_column - 1;
 +        std::string stLastLine(_stPreviousBuffer.c_str(), iSize);
 +        int iLineLen = (int)_stPreviousBuffer.size();
 +        if (iLineLen == iSize)
 +        {
 +            printLine(_stPrompt, stLastLine, true);
 +            *_piCol = 0;
 +        }
 +        else
 +        {
 +            printLine(_stPrompt, stLastLine, false);
 +            *_piCol = loc.last_column;
 +        }
 +    }
 +
 +    return _stPreviousBuffer;
 +}
 +
 +void printLine(const std::string& _stPrompt, const std::string& _stLine, bool _bLF)
 +{
 +    std::string st;
 +
 +    if (_stPrompt.size() != 0)
 +    {
 +        st = "\n" + _stPrompt;
 +    }
 +
 +    st += _stLine;
 +    if (_bLF)
 +    {
 +        st += "\n";
 +    }
 +
 +    scilabWrite(st.c_str());
 +}
 +/*--------------------------------------------------------------------------*/
@@@ -20,9 -20,9 +20,9 @@@
  #include "exportUserInterface.hxx"
  #include "graphicObjectProperties.h"
  #include "getGraphicObjectProperty.h"
--
++#include "FigureList.h"
  /*--------------------------------------------------------------------------*/
 -int sci_exportUI(char * fname, unsigned long fname_len)
 +int sci_exportUI(char * fname, void* pvApiCtx)
  {
      SciErr sciErr;
  
          if (iRows * iCols != 1)
          {
              Scierror(999, _("%s: Wrong size for input argument #%d: A Real Scalar or a 'Figure' handle expected.\n"), fname, 1);
+             return FALSE;
          }
  
 -        pstFigureUID = getObjectFromHandle((unsigned long) * stackPointer);
 +        pstFigureUID = (char*)getObjectFromHandle((unsigned long) * stackPointer);
  
          getGraphicObjectProperty(pstFigureUID, __GO_TYPE__, jni_int, (void **)&piHandleType);
-         if (iHandleType == __GO_FIGURE__)
+         if (iHandleType != __GO_FIGURE__)
          {
              Scierror(999, _("%s: Wrong type for input argument #%d: A Real Scalar or a 'Figure' handle expected.\n"), fname, 1);
              return FALSE;
@@@ -26,12 -25,13 +25,13 @@@ extern "C
  
  using namespace org_scilab_modules_gui_datatip;
  
 -int sci_datatip_manager_mode(char *fname, unsigned long fname_len)
 +int sci_datatip_manager_mode(char *fname, void* pvApiCtx)
  {
      const char* pstFigureUID = NULL;
-     int* piAddr               = NULL;
-     int * pbValue       = NULL;
-     char *pstData       = NULL;
+     int* piAddr         = NULL;
+     int* pbValue        = NULL;
+     char* pstData       = NULL;
      int iRows           = 0;
      int iCols           = 0;
      int stkAdr          = 0;
              Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
              return 1;
          }
++
          pstFigureUID = (char *)getObjectFromHandle((unsigned long) llHandle);
  
          sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr);
@@@ -28,19 -28,21 +28,21 @@@ extern "C
  
  using namespace org_scilab_modules_gui_datatip;
  
 -int sci_datatip_set_style(char *fname, unsigned long fname_len)
 +int sci_datatip_set_style(char *fname, void* pvApiCtx)
  {
-     int* piAddr       = NULL;
-     int nbRow = 0, nbCol = 0;
-     char* polylineUID = NULL;
-     double* markStyle = NULL;
-     int* pbBoxed = NULL;
-     int* pbLabeled = NULL;
-     int datatipSetStyleOption;
+     int* piAddr               = NULL;
+     char* polylineUID         = NULL;
+     double* markStyle         = NULL;
+     int* pbBoxed              = NULL;
+     int* pbLabeled            = NULL;
+     int datatipSetStyleOption = 0;
+     long long llHandle        = 0;
+     int nbRow                 = 0;
+     int nbCol                 = 0;
+     int iErr                  = 0;
      int iType = 0;
-     int iErr = 0;
      int *piType = &iType;
-     long long llHandle = 0;
  
      SciErr sciErr;
      CheckInputArgument(pvApiCtx, 1, 4);
@@@ -25,9 -25,10 +25,10 @@@ extern "C
  
  using namespace org_scilab_modules_gui_datatip;
  
 -int sci_datatip_toggle(char *fname, unsigned long fname_len)
 +int sci_datatip_toggle(char *fname, void* pvApiCtx)
  {
      const char* pstFigureUID = NULL;
      int iErr            = 0;
      bool enabled        = false;
      long long llHandle  = 0;
@@@ -27,16 -27,17 +27,17 @@@ extern "C
  
  using namespace org_scilab_modules_gui_datatip;
  
 -int sci_datatipmove(char *fname, unsigned long fname_len)
 +int sci_datatipmove(char *fname, void* pvApiCtx)
  {
-     int mouseButtonNumber = -1;
-     int pixelCoords[2];
+     char* datatipUID        = NULL;
+     int* piAddr             = NULL;
+     int mouseButtonNumber   = -1;
+     int pixelCoords[2]      = {0, 0};
+     int iErr                = 0;
+     long long llHandle      = 0;
      int iType = 0;
-     int iErr = 0;
-     int* piAddr = NULL;
-     int *piType = &iType;
-     char* datatipUID = NULL;
-     long long llHandle = 0;
+     int* piType = &iType;
  
      SciErr sciErr;
      CheckInputArgument(pvApiCtx, 1, 1);
@@@ -29,17 -29,19 +29,19 @@@ extern "C
  using namespace org_scilab_modules_gui_ged;
  
  /*--------------------------------------------------------------------------*/
 -int sci_openged(char *fname, unsigned long fname_len)
 +int sci_openged(char *fname, void* pvApiCtx)
  {
-     SciErr sciErr;
-     int m1 = 0, n1 = 0;
-     char const * figureUid;
+     char const * figureUid  = NULL;
      int* piAddr = NULL;
      int* piData = NULL;
-     int iErr = 0;
+     int m1      = 0;
+     int n1      = 0;
+     int iErr    = 0;
  
-     CheckLhs(0, 0);
-     CheckRhs(1, 1);
+     SciErr sciErr;
+     CheckInputArgument(pvApiCtx, 1, 1);
+     CheckOutputArgument(pvApiCtx, 0, 1);
  
      sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
      if (sciErr.iErr)
@@@ -29,17 -29,19 +29,19 @@@ extern "C
  using namespace org_scilab_modules_gui_plotbrowser;
  
  /*--------------------------------------------------------------------------*/
 -int sci_plotbrowser(char *fname, unsigned long fname_len)
 +int sci_plotbrowser(char *fname, void* pvApiCtx)
  {
-     SciErr sciErr;
-     int m1 = 0, n1 = 0;
-     char const * figureUid;
+     char const * figureUid = NULL;
      int* piAddr = NULL;
      int* piData = NULL;
-     int iErr = 0;
+     int m1      = 0;
+     int n1      = 0;
+     int iErr    = 0;
  
-     CheckLhs(0, 0);
-     CheckRhs(1, 1);
+     SciErr sciErr;
+     CheckInputArgument(pvApiCtx, 1, 1);
+     CheckOutputArgument(pvApiCtx, 0, 1);
  
      sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
      if (sciErr.iErr)
@@@ -29,12 -29,10 +29,10 @@@ extern "C
  using namespace org_scilab_modules_gui_editor;
  
  /*--------------------------------------------------------------------------*/
 -int sci_useeditor(char *fname, unsigned long fname_len)
 +int sci_useeditor(char *fname, void* pvApiCtx)
  {
-     SciErr sciErr;
-     int m1 = 0, n1 = 0;
-     int enable = 0;
-     char const * figureUid;
+     char const * figureUid = NULL;
      int* piAddr = NULL;
      int* piVar1 = NULL;
      int* piVar2 = NULL;
@@@ -68,6 -71,6 +68,7 @@@ int sci_export_to_hdf5(char *fname, int
      char *pstFileName   = NULL;
      bool bExport        = true;
      bool bAppendMode    = false;
++    int iRhs            = nbInputArgument(pvApiCtx);
  
      SciErr sciErr;
  
          piReturn[0] = 0;
      }
  
-     //free memory
-     for (int i = 0 ; i < nbInputArgument(pvApiCtx) ; i++)
-     {
-         FREE(pstNameList[i]);
-     }
-     FREE(pstNameList);
-     FREE(piAddrList);
 -    LhsVar(1) = iRhs + 1;
 -    PutLhsVar();
 +    AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
 +    ReturnArguments(pvApiCtx);
      return 0;
  }
  
@@@ -486,43 -503,18 +499,18 @@@ static bool export_poly(int* pvCtx, in
      int iVarNameLen = 0;
      int piDims[2];
  
 -    SciErr sciErr = getPolyVariableName(pvApiCtx, _piVar, pstVarName, &iVarNameLen);
 +    SciErr sciErr = getPolyVariableName(pvCtx, _piVar, pstVarName, &iVarNameLen);
      if (sciErr.iErr)
      {
          printError(&sciErr, 0);
          return false;
      }
  
 -    if (isVarComplex(pvApiCtx, _piVar))
 +    if (isVarComplex(pvCtx, _piVar))
      {
-         sciErr = getComplexMatrixOfPoly(pvCtx, _piVar, &piDims[0], &piDims[1], NULL, NULL, NULL);
-         if (sciErr.iErr)
 -        if (getAllocatedMatrixOfComplexPoly(pvApiCtx, _piVar, &piDims[0], &piDims[1], &piNbCoef, &pdblReal, &pdblImg))
++        if (getAllocatedMatrixOfComplexPoly(pvCtx, _piVar, &piDims[0], &piDims[1], &piNbCoef, &pdblReal, &pdblImg))
          {
-             printError(&sciErr, 0);
-             return false;
-         }
-         piNbCoef = (int*)MALLOC(piDims[0] * piDims[1] * sizeof(int));
-         sciErr = getComplexMatrixOfPoly(pvCtx, _piVar, &piDims[0], &piDims[1], piNbCoef, NULL, NULL);
-         if (sciErr.iErr)
-         {
-             printError(&sciErr, 0);
-             return false;
-         }
-         pdblReal = (double**)MALLOC(sizeof(double*) * piDims[0] * piDims[1]);
-         pdblImg = (double**)MALLOC(sizeof(double*) * piDims[0] * piDims[1]);
-         for (int i = 0 ; i < piDims[0] * piDims[1] ; i++)
-         {
-             pdblReal[i] = (double*)MALLOC(sizeof(double) * piNbCoef[i]);// for null termination
-             pdblImg[i]        = (double*)MALLOC(sizeof(double) * piNbCoef[i]);// for null termination
-         }
-         sciErr = getComplexMatrixOfPoly(pvCtx, _piVar, &piDims[0], &piDims[1], piNbCoef, pdblReal, pdblImg);
-         if (sciErr.iErr)
-         {
-             printError(&sciErr, 0);
+             freeAllocatedMatrixOfComplexPoly(piDims[0], piDims[1], piNbCoef, pdblReal, pdblImg);
              return false;
          }
  
      }
      else
      {
-         sciErr = getMatrixOfPoly(pvCtx, _piVar, &piDims[0], &piDims[1], NULL, NULL);
-         if (sciErr.iErr)
 -        if (getAllocatedMatrixOfPoly(pvApiCtx, _piVar, &piDims[0], &piDims[1], &piNbCoef, &pdblReal))
++        if (getAllocatedMatrixOfPoly(pvCtx, _piVar, &piDims[0], &piDims[1], &piNbCoef, &pdblReal))
          {
-             printError(&sciErr, 0);
-             return false;
-         }
-         piNbCoef = (int*)MALLOC(piDims[0] * piDims[1] * sizeof(int));
-         sciErr = getMatrixOfPoly(pvCtx, _piVar, &piDims[0], &piDims[1], piNbCoef, NULL);
-         if (sciErr.iErr)
-         {
-             printError(&sciErr, 0);
-             return false;
-         }
-         pdblReal = (double**)MALLOC(sizeof(double*) * piDims[0] * piDims[1]);
-         for (int i = 0 ; i < piDims[0] * piDims[1] ; i++)
-         {
-             pdblReal[i] = (double*)MALLOC(sizeof(double) * piNbCoef[i]);// for null termination
-         }
-         sciErr = getMatrixOfPoly(pvCtx, _piVar, &piDims[0], &piDims[1], piNbCoef, pdblReal);
-         if (sciErr.iErr)
-         {
-             printError(&sciErr, 0);
+             freeAllocatedMatrixOfPoly(piDims[0], piDims[1], piNbCoef, pdblReal);
              return false;
          }
  
@@@ -690,9 -643,9 +639,9 @@@ static bool export_sparse(int* pvCtx, i
      return true;
  }
  
 -static bool export_matlab_sparse(int *_piVar, char* _pstName)
 +static bool export_matlab_sparse(int* pvCtx, int *_piVar, char* _pstName)
  {
-     print_type(_pstName);
+     //print_type(_pstName);
      return false;
  }
  
@@@ -800,16 -753,15 +749,15 @@@ static bool export_ints(int* pvCtx, in
      return true;
  }
  
 -static bool export_handles(int *_piVar, char* _pstName)
 +static bool export_handles(int* pvCtx, int *_piVar, char* _pstName)
  {
-     print_type(_pstName);
+     //print_type(_pstName);
      return false;
  }
  
 -static bool export_strings(int _iH5File, int *_piVar, char* _pstName)
 +static bool export_strings(int* pvCtx, int _iH5File, int *_piVar, char* _pstName)
  {
      int iRet = 0;
-     int* piLen = NULL;
      char** pstData = NULL;
      int piDims[2];
  
          return false;
      }
  
-     piLen = (int*)MALLOC(piDims[0] * piDims[1] * sizeof(int));
-     sciErr = getMatrixOfString(pvCtx, _piVar, &piDims[0], &piDims[1], piLen, NULL);
-     if (sciErr.iErr)
-     {
-         printError(&sciErr, 0);
-         return false;
-     }
-     pstData = (char**)MALLOC(sizeof(char*) * piDims[0] * piDims[1]);
-     for (int i = 0 ; i < piDims[0] * piDims[1] ; i++)
 -    if (getAllocatedMatrixOfString(pvApiCtx, _piVar, &piDims[0], &piDims[1], &pstData))
++    if (getAllocatedMatrixOfString(pvCtx, _piVar, &piDims[0], &piDims[1], &pstData))
      {
-         pstData[i] = (char*)MALLOC(sizeof(char) * (piLen[i] + 1));// for null termination
-     }
+         if (pstData)
+         {
+             freeAllocatedMatrixOfString(piDims[0], piDims[1], pstData);
+         }
  
-     sciErr = getMatrixOfString(pvCtx, _piVar, &piDims[0], &piDims[1], piLen, pstData);
-     if (sciErr.iErr)
-     {
-         printError(&sciErr, 0);
          return false;
      }
  
      return true;
  }
  
 -static bool export_u_function(int *_piVar, char* _pstName)
 +static bool export_u_function(int* pvCtx, int *_piVar, char* _pstName)
  {
-     print_type(_pstName);
+     //print_type(_pstName);
      return false;
  }
  
 -static bool export_c_function(int *_piVar, char* _pstName)
 +static bool export_c_function(int* pvCtx, int *_piVar, char* _pstName)
  {
-     print_type(_pstName);
+     //print_type(_pstName);
      return false;
  }
  
 -static bool export_lib(int *_piVar, char* _pstName)
 +static bool export_lib(int* pvCtx, int *_piVar, char* _pstName)
  {
-     print_type(_pstName);
+     //print_type(_pstName);
      return false;
  }
  
 -static bool export_lufact_pointer(int *_piVar, char* _pstName)
 +static bool export_lufact_pointer(int* pvCtx, int *_piVar, char* _pstName)
  {
-     print_type(_pstName);
+     /*print_type*/(_pstName);
      return false;
  }
  
@@@ -24,8 -24,10 +24,9 @@@ extern "C
  #include "h5_fileManagement.h"
  #include "h5_readDataFromFile.h"
  #include "h5_attributeConstants.h"
 -#include "intmacr2tree.h"
  #include "expandPathVariable.h"
  #include "stdlib.h"
+ #include "freeArrayOfString.h"
  }
  
  #include "import_from_hdf5_v1.hxx"
@@@ -124,8 -136,9 +135,9 @@@ int sci_import_from_hdf5(char *fname, i
                  return 1;
              }
  
 -            if (import_variable(iFile, pstVarName) == false)
 +            if (import_variable(pvApiCtx, iFile, pstVarName) == false)
              {
+                 FREE(pstVarName);
                  bImport = false;
                  break;
              }
@@@ -647,9 -675,10 +674,10 @@@ static bool import_integer(int* pvCtx, 
              }
              else
              {
 -                sciErr = createMatrixOfInteger64InNamedList(_pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], pllData);
 +                sciErr = createMatrixOfInteger64InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], pllData);
              }
  #else
+             FREE(piDims);
              return false;
  #endif
          }
              }
              else
              {
 -                sciErr = createMatrixOfUnsignedInteger64InNamedList(_pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], pullData);
 +                sciErr = createMatrixOfUnsignedInteger64InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], pullData);
              }
  #else
+             FREE(piDims);
              return false;
  #endif
          }
@@@ -729,20 -765,9 +764,9 @@@ static bool import_boolean(int* pvCtx, 
      }
      else                        //if not null this variable is in a list
      {
 -        sciErr = createMatrixOfBooleanInNamedList(pvApiCtx, _pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], piData);
 +        sciErr = createMatrixOfBooleanInNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], piData);
      }
  
-     if (sciErr.iErr)
-     {
-         printError(&sciErr, 0);
-         FREE(piDims);
-         if (piData)
-         {
-             FREE(piData);
-         }
-         return false;
-     }
      FREE(piDims);
      if (piData)
      {
@@@ -899,21 -952,18 +951,18 @@@ static bool import_sparse(int* pvCtx, i
          }
          else
          {
 -            sciErr = createNamedSparseMatrix(pvApiCtx, _pstVarname, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal);
 +            sciErr = createNamedSparseMatrix(pvCtx, _pstVarname, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal);
          }
      }
-     else                        //if not null this variable is in a list
+     else //if not null this variable is in a list
      {
          if (iComplex)
          {
-             sciErr =
-                 createComplexSparseMatrixInNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, iNbItem, piNbItemRow, piColPos,
-                         pdblReal, pdblImg);
 -            sciErr = createComplexSparseMatrixInNamedList(pvApiCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal, pdblImg);
++            sciErr = createComplexSparseMatrixInNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal, pdblImg);
          }
          else
          {
-             sciErr =
-                 createSparseMatrixInNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal);
 -            sciErr = createSparseMatrixInNamedList(pvApiCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal);
++            sciErr = createSparseMatrixInNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal);
          }
      }
  
@@@ -970,23 -1016,15 +1015,15 @@@ static bool import_boolean_sparse(int* 
      }
      else                        //if not null this variable is in a list
      {
 -        sciErr = createBooleanSparseMatrixInNamedList(pvApiCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, iNbItem, piNbItemRow, piColPos);
 +        sciErr = createBooleanSparseMatrixInNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, iNbItem, piNbItemRow, piColPos);
      }
  
-     if (sciErr.iErr)
-     {
-         printError(&sciErr, 0);
-         return false;
-     }
      FREE(piNbItemRow);
-     if (piColPos)
-     {
-         FREE(piColPos);
-     }
+     FREE(piColPos);
  
-     if (iRet)
+     if (sciErr.iErr)
      {
+         printError(&sciErr, 0);
          return false;
      }
  
@@@ -24,7 -24,9 +24,8 @@@ extern "C
  #include "h5_fileManagement.h"
  #include "h5_readDataFromFile_v1.h"
  #include "h5_attributeConstants.h"
 -#include "intmacr2tree.h"
  #include "expandPathVariable.h"
+ #include "freeArrayOfString.h"
  }
  
  //#define PRINT_DEBUG
@@@ -110,8 -122,9 +121,9 @@@ int sci_import_from_hdf5_v1(char *fname
                  return 1;
              }
  
 -            if (import_variable_v1(iFile, pstVarName) == false)
 +            if (import_variable_v1(pvApiCtx, iFile, pstVarName) == false)
              {
+                 FREE(pstVarName);
                  bImport = false;
                  break;
              }
@@@ -460,9 -479,10 +478,10 @@@ static bool import_string_v1(int* pvCtx
      }
      else                        //if not null this variable is in a list
      {
 -        sciErr = createMatrixOfStringInNamedList(pvApiCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pstData);
 +        sciErr = createMatrixOfStringInNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pstData);
      }
  
+     freeArrayOfString(pstData, iRows * iCols);
      if (sciErr.iErr)
      {
          printError(&sciErr, 0);
@@@ -754,9 -766,10 +765,10 @@@ static bool import_boolean_v1(int* pvCt
      }
      else                        //if not null this variable is in a list
      {
 -        sciErr = createMatrixOfBooleanInNamedList(pvApiCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, piData);
 +        sciErr = createMatrixOfBooleanInNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, piData);
      }
  
+     FREE(piData);
      if (sciErr.iErr)
      {
          printError(&sciErr, 0);
      return true;
  }
  
 -static bool import_poly_v1(int _iDatasetId, int _iItemPos, int *_piAddress, char *_pstVarname)
 +static bool import_poly_v1(int* pvCtx, int _iDatasetId, int _iItemPos, int *_piAddress, char *_pstVarname)
  {
      int iRet = 0;
-     int i = 0;
      int iRows = 0;
      int iCols = 0;
      int iComplex = 0;
@@@ -1003,9 -1032,12 +1031,12 @@@ static bool import_boolean_sparse_v1(in
      }
      else                        //if not null this variable is in a list
      {
 -        sciErr = createBooleanSparseMatrixInNamedList(pvApiCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, iNbItem, piNbItemRow, piColPos);
 +        sciErr = createBooleanSparseMatrixInNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, iNbItem, piNbItemRow, piColPos);
      }
  
+     FREE(piNbItemRow);
+     FREE(piColPos);
      if (sciErr.iErr)
      {
          printError(&sciErr, 0);
@@@ -73,8 -74,13 +74,13 @@@ int sci_listvar_in_hdf5_v1(char *fname
          return 1;
      }
  
 -    if (getAllocatedSingleString(pvApiCtx, piAddr, &pstFile))
 +    if (getAllocatedSingleString(pvCtx, piAddr, &pstFile))
      {
+         if (pstFile)
+         {
+             FREE(pstFile);
+         }
          Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), fname, 1);
          return 1;
      }
                  break;
              }
  
-             strcpy(pInfo[i].varName, pstVarNameList[i]);
-             FREE(pstVarNameList[i]);
+             strncpy(pInfo[i].varName, pstVarNameList[i], sizeof(pInfo[i].varName));
 -            b = read_data_v1(iDataSetId, 0, NULL, &pInfo[i]) == false;
 +            b = read_data_v1(pvCtx, iDataSetId, 0, NULL, &pInfo[i]) == false;
              closeDataSet_v1(iDataSetId);
  
              if (b)
      {
          //2nd Lhs
          double* pdblType;
 -        sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 2, iNbItem, 1, &pdblType);
 +        sciErr = allocMatrixOfDouble(pvCtx, nbInputArgument(pvCtx) + 2, iNbItem, 1, &pdblType);
          if (sciErr.iErr)
          {
+             FREE(pInfo);
              printError(&sciErr, 0);
              return 1;
          }
@@@ -8,10 -8,11 +8,9 @@@ IO_C_SOURCES = src/c/getpidc.c 
  src/c/setenvc.c \
  src/c/systemc.c \
  src/c/getenvc.c \
- src/c/GetenvB.c \
  src/c/v2cuniterror.c
  
 -IO_FORTRAN_SOURCES = src/fortran/v2unit.f \
 -src/fortran/newsave.f \
 -src/fortran/v2cunit.f
 +IO_CPP_SOURCES = src/cpp/io_gw.cpp
  
  GATEWAY_C_SOURCES = sci_gateway/c/sci_read4b.c \
  sci_gateway/c/sci_getio.c \
@@@ -164,9 -164,8 +164,8 @@@ LTLIBRARIES = $(noinst_LTLIBRARIES) $(p
  libsciio_algo_la_LIBADD =
  am__objects_1 = libsciio_algo_la-getpidc.lo \
        libsciio_algo_la-setenvc.lo libsciio_algo_la-systemc.lo \
-       libsciio_algo_la-getenvc.lo libsciio_algo_la-GetenvB.lo \
-       libsciio_algo_la-v2cuniterror.lo
+       libsciio_algo_la-getenvc.lo libsciio_algo_la-v2cuniterror.lo
 -am__objects_2 = v2unit.lo newsave.lo v2cunit.lo
 +am__objects_2 = libsciio_algo_la-io_gw.lo
  am_libsciio_algo_la_OBJECTS = $(am__objects_1) $(am__objects_2)
  libsciio_algo_la_OBJECTS = $(am_libsciio_algo_la_OBJECTS)
  AM_V_lt = $(am__v_lt_@AM_V@)
@@@ -548,10 -538,12 +547,9 @@@ IO_C_SOURCES = src/c/getpidc.c 
  src/c/setenvc.c \
  src/c/systemc.c \
  src/c/getenvc.c \
- src/c/GetenvB.c \
  src/c/v2cuniterror.c
  
 -IO_FORTRAN_SOURCES = src/fortran/v2unit.f \
 -src/fortran/newsave.f \
 -src/fortran/v2cunit.f
 -
 +IO_CPP_SOURCES = src/cpp/io_gw.cpp
  GATEWAY_C_SOURCES = sci_gateway/c/sci_read4b.c \
  sci_gateway/c/sci_getio.c \
  sci_gateway/c/sci_readb.c \
@@@ -788,10 -771,8 +786,9 @@@ mostlyclean-compile
  distclean-compile:
        -rm -f *.tab.c
  
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciio_algo_la-GetenvB.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciio_algo_la-getenvc.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciio_algo_la-getpidc.Plo@am__quote@
 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciio_algo_la-io_gw.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciio_algo_la-setenvc.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciio_algo_la-systemc.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciio_algo_la-v2cuniterror.Plo@am__quote@
  #include "freeArrayOfString.h"
  #include "localization.h"
  #include "Scierror.h"
 -#include "api_scilab.h"
  #include "getenvc.h"
  #include "PATH_MAX.h"
 +#include "api_scilab.h"
++#include "getenvc.h"
  /*--------------------------------------------------------------------------*/
 -int sci_getenv(char *fname, unsigned long fname_len)
 +int sci_getenv(char *fname, void* pvApiCtx)
  {
      SciErr sciErr;
      int ierr = 0;
          return 0;
      }
  
-     default_env_value =  pStVarTwo;
-     env_name = pStVarOne;
--
-     getenvc(&ierr, env_name, NULL, &length_env, &iflag);
-     if (ierr == 0)
 -    C2F(getenvc)(&ierr, pStVarOne, NULL, &length_env, &iflag);
 -
++    getenvc(&ierr, pStVarOne, NULL, &length_env, &iflag);
+     if (ierr)
      {
-         env_value = (char*)MALLOC( (length_env + 1) * sizeof(char) );
-         if (env_value == NULL)
-         {
-             Scierror(999, _("%s: No more memory.\n"), fname);
-         }
-         else
+         if (pStVarTwo)
          {
-             getenvc(&ierr, env_name, env_value, &length_env, &iflag);
-             //create variable on stack and return it.
-             sciErr = createMatrixOfString(pvApiCtx, Rhs + 1, m_out, n_out, (const char**)&env_value);
-             if (sciErr.iErr)
+             if (createSingleString(pvApiCtx, Rhs + 1, pStVarTwo))
              {
-                 printError(&sciErr, 0);
+                 freeAllocatedSingleString(pStVarOne);
+                 freeAllocatedSingleString(pStVarTwo);
                  Scierror(999, _("%s: Memory allocation error.\n"), fname);
                  return 0;
              }
          }
      }
  
+     //variable exists in env, we don't need default any more
+     freeAllocatedSingleString(pStVarTwo);
  
-     if (default_env_value)
+     env_value = (char*)MALLOC(sizeof(char) * (length_env + 1));
+     if (env_value == NULL)
      {
-         FREE(default_env_value);
-         default_env_value = NULL;
+         freeAllocatedSingleString(pStVarOne);
+         Scierror(999, _("%s: No more memory.\n"), fname);
+         return 0;
      }
  
-     if (env_name)
-     {
-         FREE(env_name);
-         env_name = NULL;
-     }
 -    C2F(getenvc)(&ierr, pStVarOne, env_value, &length_env, &iflag);
++    getenvc(&ierr, pStVarOne, env_value, &length_env, &iflag);
  
-     if (env_value)
+     //create variable on stack and return it.
+     if (createSingleString(pvApiCtx, Rhs + 1, env_value))
      {
          FREE(env_value);
-         env_value = NULL;
+         printError(&sciErr, 0);
+         Scierror(999, _("%s: Memory allocation error.\n"), fname);
+         return 0;
      }
  
+     FREE(env_value);
+     LhsVar(1) = Rhs + 1;
+     PutLhsVar();
      return 0;
  }
  /*--------------------------------------------------------------------------*/
  /*--------------------------------------------------------------------------*/
  extern int C2F(intsave)(); /* fortran subroutine */
  /*--------------------------------------------------------------------------*/
 -int sci_save(char *fname, unsigned long fname_len)
 +int sci_save(char *fname, void *pvApiCtx)
  {
      SciErr sciErr;
      int iOldSave    = FALSE;
      int* piAddr1    = NULL;
-     int iType1      = 0;
      BOOL bWarning   = TRUE;
-     int iErrorRhs = 0;
+     int iRhs = nbInputArgument(pvApiCtx);
  
-     CheckRhs(1, 100000);
+     CheckInputArgumentAtLeast(pvApiCtx, 1);
      CheckLhs(0, 1);
  
      //filename or file descriptor
      {
          int lw = 0;
          //call "overload" to prepare data to export_to_hdf5 function.
 -        C2F(overload) (&lw, "save", (unsigned long)strlen("save"));
 -    }
 -    else
 -    {
 -        //show warning only for variable save, not for environment
 -        if (bWarning && getWarningMode() && iRhs > 1)
 -        {
 -            sciprint(_("%s: Scilab 6 will not support the file format used.\n"), _("Warning"));
 -            sciprint(_("%s: Please quote the variable declaration. Example, save('myData.sod',a) becomes save('myData.sod','a').\n"), _("Warning"));
 -            sciprint(_("%s: See help('save') for the rational.\n"), _("Warning"));
 -        }
 -
 -        C2F(intsave)();
 +        OverLoad(0);
      }
  
-     //old save ( not available in scilab 6
- //    if (iOldSave)
- //    {
- //        if (bWarning)
- //        {
- //            //show warning only for variable save, not for environment
- //            if (getWarningMode() && Rhs > 1)
- //            {
- //                sciprint(_("%s: Scilab 6 will not support the file format used.\n"), _("Warning"));
- //                sciprint(_("%s: Please quote the variable declaration. Example, save('myData.sod',a) becomes save('myData.sod','a').\n"), _("Warning"));
- //                sciprint(_("%s: See help('save') for the rational.\n"), _("Warning"));
- //            }
- //
- //            C2F(intsave)();
- //        }
- //        else
- //        {
- //            Scierror(248, _("Wrong value for argument #%d: Valid variable name expected.\n"), iErrorRhs);
- //            return 0;
- //        }
- //    }
      return 0;
  }
  /*--------------------------------------------------------------------------*/
  #include "Scierror.h"
  #include "localization.h"
  /*--------------------------------------------------------------------------*/
 -int sci_setenv(char *fname, unsigned long fname_len)
 +int sci_setenv(char *fname, void* pvApiCtx)
  {
      SciErr sciErr;
-     int m1 = 0, n1 = 0;
-     int *piAddressVarOne = NULL;
-     int iType1 = 0;
-     char *pStVarOne = NULL;
-     int lenStVarOne = 0;
  
-     int m2 = 0, n2 = 0;
-     int *piAddressVarTwo = NULL;
-     int iType2 = 0;
-     char *pStVarTwo = NULL;
-     int lenStVarTwo = 0;
+     int *piAddr1 = NULL;
+     char *pstVar = NULL;
  
-     int m_out1 = 0, n_out1 = 0;
+     int *piAddr2 = NULL;
+     char *pstValue = NULL;
  
-     int result = 0;
+     int ret = 0;
  
 -    Rhs = Max(0, Rhs);
      CheckRhs(2, 2);
      CheckLhs(0, 1);
  
@@@ -218,37 -217,4 +218,39 @@@ char *searchEnv(const char *name, cons
      return buffer;
  }
  /*--------------------------------------------------------------------------*/
 +wchar_t* searchEnvW(const wchar_t* _pwstName, const wchar_t* _pwstEnv)
 +{
 +    wchar_t* pwstRet = NULL;
 +    wchar_t pwstFullpath[PATH_MAX];
 +
++#if !_MSC_VER
++    char* pstName   = wide_string_to_UTF8(_pwstName);
++    char* pstEnv    = wide_string_to_UTF8(_pwstEnv);
++    char pstFullpath[PATH_MAX];
++#endif
++
 +    wcscpy(pwstFullpath, L"");
 +
 +#if _MSC_VER
 +    {
 +        _wsearchenv(_pwstName, _pwstEnv, pwstFullpath);
 +
 +        if (wcslen(pwstFullpath) > 0)
 +        {
 +            pwstRet = os_wcsdup(pwstFullpath);
 +        }
 +    }
 +#else
-     char* pstName   = wide_string_to_UTF8(_pwstName);
-     char* pstEnv    = wide_string_to_UTF8(_pwstEnv);
-     char pstFullpath[PATH_MAX];
 +    searchenv_others(pstName, pstEnv, pstFullpath);
 +    if (strlen(pstFullpath) > 0)
 +    {
 +        pwstRet = to_wide_string(pstFullpath);
 +    }
 +
 +    FREE(pstName);
 +    FREE(pstEnv);
 +#endif
 +    return pwstRet;
 +}
 +/*--------------------------------------------------------------------------*/
  
Simple merge
@@@ -107,79 -118,77 +107,85 @@@ int wcstat(char* filename, struct _sta
  #else //Linux check for MAC OS X
  char *wide_string_to_UTF8(const wchar_t *_wide)
  {
-     if (_wide == NULL)
-     {
-         return NULL;
-     }
 -    size_t iCharLen = 0;
 -    wchar_t *pwstr = _wide;
 -    char* pchar = NULL;
 -    /* The value of MB_CUR_MAX is the maximum number of bytes
 -    in a multibyte character for the current locale. */
 -    int iMaxLen =  0;
 +    char* pOutSave = NULL;
-     wchar_t* pSaveIn = _wide;
++    wchar_t* pSaveIn = NULL;
 +    size_t iSize = 0;
-     size_t iLeftIn = wcslen(_wide) * sizeof(wchar_t);
++    size_t iLeftIn = 0;
 +    size_t iLeftOut = 0;
 +    char* pOut = NULL;
 +    iconv_t cd_UTF16_to_UTF8 = iconv_open("UTF-8", "UTF-32LE");
  
+     if (_wide == NULL)
+     {
+         return NULL;
+     }
 -    iMaxLen =  (int)wcslen(_wide) * MB_CUR_MAX ;
++    pSaveIn = _wide;
++    iLeftIn = wcslen(_wide) * sizeof(wchar_t);
 -    pchar = (char*) MALLOC(( iMaxLen + 1) * sizeof(char));
 -    if (pchar == NULL)
 -    {
 -        return NULL;
 -    }
 -    iCharLen = wcstombs (pchar, pwstr, iMaxLen);
 -    if ( iCharLen == (size_t)(-1) )
 +    iLeftOut = iLeftIn + (1 * sizeof(wchar_t));
 +    pOut = (char*)MALLOC(iLeftOut);
 +    memset(pOut, 0x00, iLeftOut);
 +    pOutSave = pOut;
 +
 +    iSize = iconv(cd_UTF16_to_UTF8, (char**)&pSaveIn, &iLeftIn, &pOut, &iLeftOut);
 +    iconv_close(cd_UTF16_to_UTF8);
 +    if (iSize == (size_t)(-1))
      {
 -        if (pchar)
 -        {
 -            FREE(pchar);
 -            pchar = NULL;
 -        }
          return NULL;
      }
 -    pchar[iCharLen] = '\0';
 -    return pchar;
 +
 +    return pOutSave;
  }
  /*--------------------------------------------------------------------------*/
  wchar_t *to_wide_string(const char *_UTFStr)
  {
-     if (_UTFStr == NULL)
-     {
-         return NULL;
-     }
 -    wchar_t *_buf = NULL;
 -    size_t pszLen = 0;
 -    char *psz = _UTFStr;
 -    mbstate_t ps;
 +    wchar_t* pOutSave = NULL;
-     char* pInSave = _UTFStr;
++    char* pInSave = NULL;
 +    size_t iSize = 0;
-     size_t iLeftIn = strlen(_UTFStr);
++    size_t iLeftIn = 0;
 +    size_t iLeftOut = 0;
 +
 +    wchar_t* pOut = NULL;
 +
 +    iconv_t cd_UTF8_to_UTF16 = iconv_open("UTF-32LE", "UTF-8");
  
+     if (_UTFStr == NULL)
+     {
+         return NULL;
+     }
 -    memset (&ps, 0x00, sizeof(ps));
 -    pszLen = mbsrtowcs(NULL, (const char**)&psz, 0, &ps);
++    iLeftIn = strlen(_UTFStr);
++    pInSave = _UTFStr;
 -    if ( pszLen == (size_t)(-1) )
 -    {
 -        return NULL;
 -    }
 +    iLeftOut = (iLeftIn + 1) * sizeof(wchar_t);
 +    pOut = (wchar_t*)MALLOC(iLeftOut);
 +    memset(pOut, 0x00, iLeftOut);
 +    pOutSave = pOut;
  
 -    _buf = (wchar_t*)MALLOC((pszLen + 1) * sizeof(wchar_t));
 -    if (_buf == NULL)
 +    iSize = iconv(cd_UTF8_to_UTF16, &_UTFStr, &iLeftIn, (char**)&pOut, &iLeftOut);
 +    iconv_close(cd_UTF8_to_UTF16);
 +    if (iSize == (size_t)(-1))
      {
 -        return NULL;
 -    }
 +        iconv_t cd_ISO8851_to_UTF16 = iconv_open("UTF-32LE", "ISO_8859-1");
  
 -    pszLen = mbsrtowcs(_buf, (const char**)&psz, (int)strlen(psz), &ps);
 +        _UTFStr = pInSave;
 +        iLeftIn = strlen(_UTFStr);
  
 -    if ( pszLen == (size_t)(-1) )
 -    {
 -        FREE(_buf);
 -        return NULL;
 -    }
 -    else
 -    {
 -        _buf[pszLen] = L'\0';
 +        iLeftOut = (iLeftIn + 1) * sizeof(wchar_t);
 +        pOut = pOutSave;
 +        memset(pOut, 0x00, iLeftOut);
 +
 +
 +        iSize = iconv(cd_ISO8851_to_UTF16, &_UTFStr, &iLeftIn, (char**)&pOut, &iLeftOut);
 +        iconv_close(cd_ISO8851_to_UTF16);
 +        if (iSize == (size_t)(-1))
 +        {
 +            return NULL;
 +        }
      }
 -    return _buf;
 +
 +    return pOutSave;
  }
  /*--------------------------------------------------------------------------*/
  int wcstat(char* filename, struct stat *st)
  /*--------------------------------------------------------------------------*/
  int sci_buildouttb(char *fname, unsigned long fname_len)
  {
-     //static int l1 = 0, m1 = 0,   n1 = 0;
-     //static int l2 = 0, m2 = 0,   n2 = 0;
-     //static int l3 = 0, n3 = 1;
-     //SciIntMat M1, M2, M3;
-     //int n_lnksz = 0, n_lnktyp = 0;
-     //int *lnksz = NULL, *lnktyp = NULL;
-     //double *ptr_d = NULL;
-     //double *ptr_dc = NULL;
-     //int *ptr_i = NULL;
-     //short *ptr_s = NULL;
-     //char *ptr_c = NULL;
-     //int *ptr_ui = NULL;
-     //short *ptr_us = NULL;
-     //char *ptr_uc = NULL;
-     //int nm = 0, i = 0, j = 0, ierr = 0;
-     //static int minlhs = 1, maxlhs = 1;
-     //static int minrhs = 2, maxrhs = 2;
-     ///*check number of lhs/rhs*/
-     //CheckLhs(minlhs, maxlhs);
-     //CheckRhs(minrhs, maxrhs);
-     ///*check type of Rhs 1*/
-     //if (VarType(1) == 1)
-     //{
-     //    GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
-     //}
-     //else if (VarType(1) == sci_ints)
-     //{
-     //    GetRhsVar(1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &m1, &n1, &M1);
-     //}
-     //else
-     //{
-     //    Scierror(888, _("%s : lnksz argument must be double or integer.\n"), fname);
-     //    return 0;
-     //}
-     ///*check type of Rhs 2*/
-     //if (VarType(2) == 1)
-     //{
-     //    GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m2, &n2, &l2);
-     //}
-     //else if (VarType(2) == sci_ints)
-     //{
-     //    GetRhsVar(2, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &m2, &n2, &M2);
-     //}
-     //else
-     //{
-     //    Scierror(888, _("%s : lnktyp argument must be double or integer.\n"), fname);
-     //    if (lnksz != NULL)
-     //    {
-     //        FREE(lnksz);
-     //    }
-     //    return 0;
-     //}
-     ///*check size of Rhs 1*/
-     //if (m1 == 2)
-     //{
-     //    n_lnksz = n1;
-     //}
-     //else if (n1 == 2)
-     //{
-     //    n_lnksz = m1;
-     //}
-     ///*void double input give void list output*/
-     //else if ((n1 == 0) || (m1 == 0))
-     //{
-     //    if ((n2 == 0) || (m2 == 0))
-     //    {
-     //        /*manually code a void list on rhs(1)*/
-     //        ptr_i = (int*)GetData(1);
-     //        ptr_i[0] = sci_list;
-     //        ptr_i[1] = 0;
-     //        ptr_i[2] = 1;
-     //        LhsVar(1) = 1;
-     //        PutLhsVar();
-     //        return 0;
-     //    }
-     //    else
-     //    {
-     //        Scierror(888, _("%s : inconsistent dimension between lnksz and lnktyp.\n"), fname);
-     //        return 0;
-     //    }
-     //}
-     //else
-     //{
-     //    Scierror(888, _("%s : bad dimension for lnksz argument.\n"), fname);
-     //    return 0;
-     //}
-     ///*check size of Rhs 2*/
-     //if (m2 == 1)
-     //{
-     //    n_lnktyp = n2;
-     //}
-     //else if (n2 == 1)
-     //{
-     //    n_lnktyp = m2;
-     //}
-     //else if ((n2 == 0) || (m2 == 0))
-     //{
-     //    if ( (n1 != 0) && (m1 != 0) )
-     //    {
-     //        Scierror(888, _("%s : inconsistent dimension between lnksz and lnktyp.\n"), fname);
-     //        return 0;
-     //    }
-     //}
-     //else
-     //{
-     //    Scierror(888, _("%s : bad dimension for lnktyp argument.\n"), fname);
-     //    return 0;
-     //}
-     ///*cross size checking*/
-     //if (n_lnksz != n_lnktyp)
-     //{
-     //    Scierror(888, _("%s : lnksz and lnktyp argument must have the same length.\n"), fname);
-     //    return 0;
-     //}
-     ///*allocate lnksz*/
-     //if ((lnksz = MALLOC(2 * n_lnksz * sizeof(int))) == NULL)
-     //{
-     //    Scierror(999, _("%s : No more free memory.\n"), fname);
-     //    return 0;
-     //}
-     ///* Allocate lnktyp*/
-     //if ((lnktyp = MALLOC(n_lnktyp * sizeof(int))) == NULL)
-     //{
-     //    Scierror(999, _("%s : No more free memory.\n"), fname);
-     //    if (lnksz != NULL)
-     //    {
-     //        FREE(lnksz);
-     //    }
-     //    return 0;
-     //}
-     ///*store rhs 1 in lnksz */
-     //if ((m1 == n1) && (m2 == m1))
-     //{
-     //    m1 = -1;    /* this is done for matrix 2,2 */
-     //}
-     //if (VarType(1) == 8)
-     //{
-     //    switch (M1.it)
-     //    {
-     //        case I_CHAR   :
-     //            if (m1 == 2)
-     //            {
-     //                for (j = 0; j < n_lnksz; j++)
-     //                {
-     //                    lnksz[j] = (int) IC_CHAR(M1.D)[j * 2];
-     //                    lnksz[n_lnksz + j] = (int) IC_CHAR(M1.D)[2 * j + 1];
-     //                }
-     //            }
-     //            else
-     //            {
-     //                for (j = 0; j < 2 * n_lnksz; j++)
-     //                {
-     //                    lnksz[j] = (int) IC_CHAR(M1.D)[j];
-     //                }
-     //            }
-     //            break;
-     //        case I_INT16  :
-     //            if (m1 == 2)
-     //            {
-     //                for (j = 0; j < n_lnksz; j++)
-     //                {
-     //                    lnksz[j] = (int) IC_INT16(M1.D)[j * 2];
-     //                    lnksz[n_lnksz + j] = (int) IC_INT16(M1.D)[2 * j + 1];
-     //                }
-     //            }
-     //            else
-     //            {
-     //                for (j = 0; j < 2 * n_lnksz; j++)
-     //                {
-     //                    lnksz[j] = (int) IC_INT16(M1.D)[j];
-     //                }
-     //            }
-     //            break;
-     //        case I_INT32  :
-     //            if (m1 == 2)
-     //            {
-     //                for (j = 0; j < n_lnksz; j++)
-     //                {
-     //                    lnksz[j] = (int) IC_INT32(M1.D)[j * 2];
-     //                    lnksz[n_lnksz + j] = (int) IC_INT32(M1.D)[2 * j + 1];
-     //                }
-     //            }
-     //            else
-     //            {
-     //                for (j = 0; j < 2 * n_lnksz; j++)
-     //                {
-     //                    lnksz[j] = (int) IC_INT32(M1.D)[j];
-     //                }
-     //            }
-     //            break;
-     //        case I_UCHAR  :
-     //            if (m1 == 2)
-     //            {
-     //                for (j = 0; j < n_lnksz; j++)
-     //                {
-     //                    lnksz[j] = (int) IC_UCHAR(M1.D)[j * 2];
-     //                    lnksz[n_lnksz + j] = (int) IC_UCHAR(M1.D)[2 * j + 1];
-     //                }
-     //            }
-     //            else
-     //            {
-     //                for (j = 0; j < 2 * n_lnksz; j++)
-     //                {
-     //                    lnksz[j] = (int) IC_UCHAR(M1.D)[j];
-     //                }
-     //            }
-     //            break;
-     //        case I_UINT16 :
-     //            if (m1 == 2)
-     //            {
-     //                for (j = 0; j < n_lnksz; j++)
-     //                {
-     //                    lnksz[j] = (int) IC_UINT16(M1.D)[j * 2];
-     //                    lnksz[n_lnksz + j] = (int) IC_UINT16(M1.D)[2 * j + 1];
-     //                }
-     //            }
-     //            else
-     //            {
-     //                for (j = 0; j < 2 * n_lnksz; j++)
-     //                {
-     //                    lnksz[j] = (int) IC_UINT16(M1.D)[j];
-     //                }
-     //            }
-     //            break;
-     //        case I_UINT32 :
-     //            if (m1 == 2)
-     //            {
-     //                for (j = 0; j < n_lnksz; j++)
-     //                {
-     //                    lnksz[j] = (int) IC_UINT32(M1.D)[j * 2];
-     //                    lnksz[n_lnksz + j] = (int) IC_UINT32(M1.D)[2 * j + 1];
-     //                }
-     //            }
-     //            else
-     //            {
-     //                for (j = 0; j < 2 * n_lnksz; j++)
-     //                {
-     //                    lnksz[j] = (int) IC_UINT32(M1.D)[j];
-     //                }
-     //            }
-     //            break;
-     //    }
-     //}
-     //else
-     //{
-     //    if (m1 == 2)
-     //    {
-     //        for (j = 0; j < n_lnksz; j++)
-     //        {
-     //            lnksz[j] = (int) ((double *) stk(l1))[j * 2];
-     //            lnksz[n_lnksz + j] = (int) ((double *) stk(l1))[2 * j + 1];
-     //        }
-     //    }
-     //    else
-     //    {
-     //        for (j = 0; j < 2 * n_lnksz; j++)
-     //        {
-     //            lnksz[j] = (int) ((double *) stk(l1))[j];
-     //        }
-     //    }
-     //}
-     ///*store rhs 2 in lnktyp */
-     //if (VarType(2) == sci_ints)
-     //{
-     //    switch (M2.it)
-     //    {
-     //        case I_CHAR   :
-     //            for (j = 0; j < n_lnktyp; j++)
-     //            {
-     //                lnktyp[j] = (int) IC_CHAR(M2.D)[j];
-     //            }
-     //            break;
-     //        case I_INT16  :
-     //            for (j = 0; j < n_lnktyp; j++)
-     //            {
-     //                lnktyp[j] = (int) IC_INT16(M2.D)[j];
-     //            }
-     //            break;
-     //        case I_INT32  :
-     //            for (j = 0; j < n_lnktyp; j++)
-     //            {
-     //                lnktyp[j] = (int) IC_INT32(M2.D)[j];
-     //            }
-     //            break;
-     //        case I_UCHAR  :
-     //            for (j = 0; j < n_lnktyp; j++)
-     //            {
-     //                lnktyp[j] = (int) IC_UCHAR(M2.D)[j];
-     //            }
-     //            break;
-     //        case I_UINT16 :
-     //            for (j = 0; j < n_lnktyp; j++)
-     //            {
-     //                lnktyp[j] = (int) IC_UINT16(M2.D)[j];
-     //            }
-     //            break;
-     //        case I_UINT32 :
-     //            for (j = 0; j < n_lnktyp; j++)
-     //            {
-     //                lnktyp[j] = (int) IC_UINT32(M2.D)[j];
-     //            }
-     //            break;
-     //    }
-     //}
-     //else
-     //{
-     //    for (j = 0; j < n_lnktyp; j++)
-     //    {
-     //        lnktyp[j] = (int) ((double *) stk(l2))[j];
-     //    }
-     //}
-     ///* build output list */
-     //CreateVar(3, LIST_DATATYPE, &n_lnktyp, &n3, &l3);
-     //for (i = 0; i < n_lnktyp; i++)
-     //{
-     //    nm = lnksz[i] * lnksz[i + n_lnktyp];
-     //    switch (lnktyp[i])
-     //    {
-     //        case 1  :
-     //            if ((ptr_d = MALLOC(nm * sizeof(double))) == NULL)
-     //            {
-     //                ierr = -1;
-     //                break;
-     //            }
-     //            for (j = 0; j < nm; j++)
-     //            {
-     //                ptr_d[j] = 0;
-     //            }
-     //            CreateListVarFromPtr(3, i + 1, MATRIX_OF_DOUBLE_DATATYPE, &lnksz[i], &lnksz[i + n_lnktyp], &ptr_d);
-     //            FREE(ptr_d);
-     //            break;
-     //        case 2  :
-     //            if ((ptr_d = MALLOC(2 * nm * sizeof(double))) == NULL)
-     //            {
-     //                ierr = -1;
-     //                break;
-     //            }
-     //            for (j = 0; j < 2 * nm; j++)
-     //            {
-     //                ptr_d[j] = 0;
-     //            }
-     //            ptr_dc = &ptr_d[nm];
-     //            CreateListCVarFromPtr(3, i + 1, MATRIX_OF_DOUBLE_DATATYPE, (j = 1, &j), &lnksz[i], &lnksz[i + n_lnktyp], &ptr_d, &ptr_dc);
-     //            FREE(ptr_d);
-     //            break;
-     //        case 3  :
-     //            if ((ptr_i = MALLOC(nm * sizeof(int))) == NULL)
-     //            {
-     //                ierr = -1;
-     //                break;
-     //            }
-     //            for (j = 0; j < nm; j++)
-     //            {
-     //                ptr_i[j] = 0;
-     //            }
-     //            M3.m = lnksz[i];
-     //            M3.n = lnksz[i + n_lnktyp];
-     //            M3.it = 4;
-     //            M3.l = -1;
-     //            M3.D = ptr_i;
-     //            CreateListVarFromPtr(3, i + 1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &M3.m, &M3.n, &M3);
-     //            FREE(ptr_i);
-     //            break;
-     //        case 4  :
-     //            if ((ptr_s = MALLOC(nm * sizeof(short))) == NULL)
-     //            {
-     //                ierr = -1;
-     //                break;
-     //            }
-     //            for (j = 0; j < nm; j++)
-     //            {
-     //                ptr_s[j] = 0;
-     //            }
-     //            M3.m = lnksz[i];
-     //            M3.n = lnksz[i + n_lnktyp];
-     //            M3.it = 2;
-     //            M3.l = -1;
-     //            M3.D = ptr_s;
-     //            CreateListVarFromPtr(3, i + 1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &M3.m, &M3.n, &M3);
-     //            FREE(ptr_s);
-     //            break;
-     //        case 5  :
-     //            if ((ptr_c = MALLOC(nm * sizeof(char))) == NULL)
-     //            {
-     //                ierr = -1;
-     //                break;
-     //            }
-     //            for (j = 0; j < nm; j++)
-     //            {
-     //                ptr_c[j] = 0;
-     //            }
-     //            M3.m = lnksz[i];
-     //            M3.n = lnksz[i + n_lnktyp];
-     //            M3.it = 1;
-     //            M3.l = -1;
-     //            M3.D = ptr_c;
-     //            CreateListVarFromPtr(3, i + 1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &M3.m, &M3.n, &M3);
-     //            FREE(ptr_c);
-     //            break;
-     //        case 6  :
-     //            if ((ptr_ui = MALLOC(nm * sizeof(unsigned int))) == NULL)
-     //            {
-     //                ierr = -1;
-     //                break;
-     //            }
-     //            for (j = 0; j < nm; j++)
-     //            {
-     //                ptr_ui[j] = 0;
-     //            }
-     //            M3.m = lnksz[i];
-     //            M3.n = lnksz[i + n_lnktyp];
-     //            M3.it = 14;
-     //            M3.l = -1;
-     //            M3.D = ptr_ui;
-     //            CreateListVarFromPtr(3, i + 1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &M3.m, &M3.n, &M3);
-     //            FREE(ptr_ui);
-     //            break;
-     //        case 7  :
-     //            if ((ptr_us = MALLOC(nm * sizeof(unsigned short))) == NULL)
-     //            {
-     //                ierr = -1;
-     //                break;
-     //            }
-     //            for (j = 0; j < nm; j++)
-     //            {
-     //                ptr_us[j] = 0;
-     //            }
-     //            M3.m = lnksz[i];
-     //            M3.n = lnksz[i + n_lnktyp];
-     //            M3.it = 12;
-     //            M3.l = -1;
-     //            M3.D = ptr_us;
-     //            CreateListVarFromPtr(3, i + 1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &M3.m, &M3.n, &M3);
-     //            FREE(ptr_us);
-     //            break;
-     //        case 8  :
-     //            if ((ptr_uc = MALLOC(nm * sizeof(unsigned char))) == NULL)
-     //            {
-     //                ierr = -1;
-     //                break;
-     //            }
-     //            for (j = 0; j < nm; j++)
-     //            {
-     //                ptr_uc[j] = 0;
-     //            }
-     //            M3.m = lnksz[i];
-     //            M3.n = lnksz[i + n_lnktyp];
-     //            M3.it = 11;
-     //            M3.l = -1;
-     //            M3.D = ptr_uc;
-     //            CreateListVarFromPtr(3, i + 1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &M3.m, &M3.n, &M3);
-     //            FREE(ptr_uc);
-     //            break;
-     //        default :
-     //            if ((ptr_d = MALLOC(nm * sizeof(double))) == NULL)
-     //            {
-     //                ierr = -1;
-     //                break;
-     //            }
-     //            for (j = 0; j < nm; j++)
-     //            {
-     //                ptr_d[j] = 0;
-     //            }
-     //            CreateListVarFromPtr(3, i + 1, MATRIX_OF_DOUBLE_DATATYPE, &lnksz[i], &lnksz[i + n_lnktyp], &ptr_d);
-     //            FREE(ptr_d);
-     //            break;
-     //    }
-     //    if (ierr == -1)
-     //    {
-     //        Scierror(999, _("%s : No more free memory.\n"), fname);
-     //        FREE(lnksz);
-     //        FREE(lnktyp);
-     //        return 0;
-     //    }
-     //}
-     //LhsVar(1) = 3;
-     //FREE(lnksz);
-     //FREE(lnktyp);
-     //PutLhsVar();
++#if 0
+     static int l1 = 0, m1 = 0,   n1 = 0;
+     static int l2 = 0, m2 = 0,   n2 = 0;
+     static int l3 = 0, n3 = 1;
+     SciIntMat M1, M2, M3;
+     int n_lnksz = 0, n_lnktyp = 0;
+     int *lnksz = NULL, *lnktyp = NULL;
+     double *ptr_d = NULL;
+     double *ptr_dc = NULL;
+     int *ptr_i = NULL;
+     short *ptr_s = NULL;
+     char *ptr_c = NULL;
+     int *ptr_ui = NULL;
+     short *ptr_us = NULL;
+     char *ptr_uc = NULL;
+     int nm = 0, i = 0, j = 0, ierr = 0;
+     static int minlhs = 1, maxlhs = 1;
+     static int minrhs = 2, maxrhs = 2;
+     /*check number of lhs/rhs*/
+     CheckLhs(minlhs, maxlhs);
+     CheckRhs(minrhs, maxrhs);
+     /*check type of Rhs 1*/
+     if (VarType(1) == 1)
+     {
+         GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
+     }
+     else if (VarType(1) == sci_ints)
+     {
+         GetRhsVar(1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &m1, &n1, &M1);
+     }
+     else
+     {
+         Scierror(888, _("%s : lnksz argument must be double or integer.\n"), fname);
+         return 0;
+     }
+     /*check type of Rhs 2*/
+     if (VarType(2) == 1)
+     {
+         GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m2, &n2, &l2);
+     }
+     else if (VarType(2) == sci_ints)
+     {
+         GetRhsVar(2, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &m2, &n2, &M2);
+     }
+     else
+     {
+         Scierror(888, _("%s : lnktyp argument must be double or integer.\n"), fname);
+         return 0;
+     }
+     /*check size of Rhs 1*/
+     if (m1 == 2)
+     {
+         n_lnksz = n1;
+     }
+     else if (n1 == 2)
+     {
+         n_lnksz = m1;
+     }
+     /*void double input give void list output*/
+     else if ((n1 == 0) || (m1 == 0))
+     {
+         if ((n2 == 0) || (m2 == 0))
+         {
+             /*manually code a void list on rhs(1)*/
+             ptr_i = (int*)GetData(1);
+             ptr_i[0] = sci_list;
+             ptr_i[1] = 0;
+             ptr_i[2] = 1;
+             LhsVar(1) = 1;
+             PutLhsVar();
+             return 0;
+         }
+         else
+         {
+             Scierror(888, _("%s : inconsistent dimension between lnksz and lnktyp.\n"), fname);
+             return 0;
+         }
+     }
+     else
+     {
+         Scierror(888, _("%s : bad dimension for lnksz argument.\n"), fname);
+         return 0;
+     }
+     /*check size of Rhs 2*/
+     if (m2 == 1)
+     {
+         n_lnktyp = n2;
+     }
+     else if (n2 == 1)
+     {
+         n_lnktyp = m2;
+     }
+     else if ((n2 == 0) || (m2 == 0))
+     {
+         if ( (n1 != 0) && (m1 != 0) )
+         {
+             Scierror(888, _("%s : inconsistent dimension between lnksz and lnktyp.\n"), fname);
+             return 0;
+         }
+     }
+     else
+     {
+         Scierror(888, _("%s : bad dimension for lnktyp argument.\n"), fname);
+         return 0;
+     }
+     /*cross size checking*/
+     if (n_lnksz != n_lnktyp)
+     {
+         Scierror(888, _("%s : lnksz and lnktyp argument must have the same length.\n"), fname);
+         return 0;
+     }
+     /*allocate lnksz*/
+     if ((lnksz = MALLOC(2 * n_lnksz * sizeof(int))) == NULL)
+     {
+         Scierror(999, _("%s : No more free memory.\n"), fname);
+         return 0;
+     }
+     /* Allocate lnktyp*/
+     if ((lnktyp = MALLOC(n_lnktyp * sizeof(int))) == NULL)
+     {
+         Scierror(999, _("%s : No more free memory.\n"), fname);
+         FREE(lnksz);
+         return 0;
+     }
+     /*store rhs 1 in lnksz */
+     if ((m1 == n1) && (m2 == m1))
+     {
+         m1 = -1;    /* this is done for matrix 2,2 */
+     }
+     if (VarType(1) == 8)
+     {
+         switch (M1.it)
+         {
+             case I_CHAR   :
+                 if (m1 == 2)
+                 {
+                     for (j = 0; j < n_lnksz; j++)
+                     {
+                         lnksz[j] = (int) IC_CHAR(M1.D)[j * 2];
+                         lnksz[n_lnksz + j] = (int) IC_CHAR(M1.D)[2 * j + 1];
+                     }
+                 }
+                 else
+                 {
+                     for (j = 0; j < 2 * n_lnksz; j++)
+                     {
+                         lnksz[j] = (int) IC_CHAR(M1.D)[j];
+                     }
+                 }
+                 break;
+             case I_INT16  :
+                 if (m1 == 2)
+                 {
+                     for (j = 0; j < n_lnksz; j++)
+                     {
+                         lnksz[j] = (int) IC_INT16(M1.D)[j * 2];
+                         lnksz[n_lnksz + j] = (int) IC_INT16(M1.D)[2 * j + 1];
+                     }
+                 }
+                 else
+                 {
+                     for (j = 0; j < 2 * n_lnksz; j++)
+                     {
+                         lnksz[j] = (int) IC_INT16(M1.D)[j];
+                     }
+                 }
+                 break;
+             case I_INT32  :
+                 if (m1 == 2)
+                 {
+                     for (j = 0; j < n_lnksz; j++)
+                     {
+                         lnksz[j] = (int) IC_INT32(M1.D)[j * 2];
+                         lnksz[n_lnksz + j] = (int) IC_INT32(M1.D)[2 * j + 1];
+                     }
+                 }
+                 else
+                 {
+                     for (j = 0; j < 2 * n_lnksz; j++)
+                     {
+                         lnksz[j] = (int) IC_INT32(M1.D)[j];
+                     }
+                 }
+                 break;
+             case I_UCHAR  :
+                 if (m1 == 2)
+                 {
+                     for (j = 0; j < n_lnksz; j++)
+                     {
+                         lnksz[j] = (int) IC_UCHAR(M1.D)[j * 2];
+                         lnksz[n_lnksz + j] = (int) IC_UCHAR(M1.D)[2 * j + 1];
+                     }
+                 }
+                 else
+                 {
+                     for (j = 0; j < 2 * n_lnksz; j++)
+                     {
+                         lnksz[j] = (int) IC_UCHAR(M1.D)[j];
+                     }
+                 }
+                 break;
+             case I_UINT16 :
+                 if (m1 == 2)
+                 {
+                     for (j = 0; j < n_lnksz; j++)
+                     {
+                         lnksz[j] = (int) IC_UINT16(M1.D)[j * 2];
+                         lnksz[n_lnksz + j] = (int) IC_UINT16(M1.D)[2 * j + 1];
+                     }
+                 }
+                 else
+                 {
+                     for (j = 0; j < 2 * n_lnksz; j++)
+                     {
+                         lnksz[j] = (int) IC_UINT16(M1.D)[j];
+                     }
+                 }
+                 break;
+             case I_UINT32 :
+                 if (m1 == 2)
+                 {
+                     for (j = 0; j < n_lnksz; j++)
+                     {
+                         lnksz[j] = (int) IC_UINT32(M1.D)[j * 2];
+                         lnksz[n_lnksz + j] = (int) IC_UINT32(M1.D)[2 * j + 1];
+                     }
+                 }
+                 else
+                 {
+                     for (j = 0; j < 2 * n_lnksz; j++)
+                     {
+                         lnksz[j] = (int) IC_UINT32(M1.D)[j];
+                     }
+                 }
+                 break;
+         }
+     }
+     else
+     {
+         if (m1 == 2)
+         {
+             for (j = 0; j < n_lnksz; j++)
+             {
+                 lnksz[j] = (int) ((double *) stk(l1))[j * 2];
+                 lnksz[n_lnksz + j] = (int) ((double *) stk(l1))[2 * j + 1];
+             }
+         }
+         else
+         {
+             for (j = 0; j < 2 * n_lnksz; j++)
+             {
+                 lnksz[j] = (int) ((double *) stk(l1))[j];
+             }
+         }
+     }
+     /*store rhs 2 in lnktyp */
+     if (VarType(2) == sci_ints)
+     {
+         switch (M2.it)
+         {
+             case I_CHAR   :
+                 for (j = 0; j < n_lnktyp; j++)
+                 {
+                     lnktyp[j] = (int) IC_CHAR(M2.D)[j];
+                 }
+                 break;
+             case I_INT16  :
+                 for (j = 0; j < n_lnktyp; j++)
+                 {
+                     lnktyp[j] = (int) IC_INT16(M2.D)[j];
+                 }
+                 break;
+             case I_INT32  :
+                 for (j = 0; j < n_lnktyp; j++)
+                 {
+                     lnktyp[j] = (int) IC_INT32(M2.D)[j];
+                 }
+                 break;
+             case I_UCHAR  :
+                 for (j = 0; j < n_lnktyp; j++)
+                 {
+                     lnktyp[j] = (int) IC_UCHAR(M2.D)[j];
+                 }
+                 break;
+             case I_UINT16 :
+                 for (j = 0; j < n_lnktyp; j++)
+                 {
+                     lnktyp[j] = (int) IC_UINT16(M2.D)[j];
+                 }
+                 break;
+             case I_UINT32 :
+                 for (j = 0; j < n_lnktyp; j++)
+                 {
+                     lnktyp[j] = (int) IC_UINT32(M2.D)[j];
+                 }
+                 break;
+             default :
+                 /* Invalid integer type */
+                 Scierror(999, _("%s: Wrong value for input argument #%d: An integer expected.\n"), fname, 2);
+                 FREE(lnksz);
+                 FREE(lnktyp);
+                 return 0;
+         }
+     }
+     else
+     {
+         for (j = 0; j < n_lnktyp; j++)
+         {
+             lnktyp[j] = (int) ((double *) stk(l2))[j];
+         }
+     }
+     /* build output list */
+     CreateVar(3, LIST_DATATYPE, &n_lnktyp, &n3, &l3);
+     for (i = 0; i < n_lnktyp; i++)
+     {
+         nm = lnksz[i] * lnksz[i + n_lnktyp];
+         switch (lnktyp[i])
+         {
+             case 1  :
+                 if ((ptr_d = MALLOC(nm * sizeof(double))) == NULL)
+                 {
+                     ierr = -1;
+                     break;
+                 }
+                 for (j = 0; j < nm; j++)
+                 {
+                     ptr_d[j] = 0;
+                 }
+                 CreateListVarFromPtr(3, i + 1, MATRIX_OF_DOUBLE_DATATYPE, &lnksz[i], &lnksz[i + n_lnktyp], &ptr_d);
+                 FREE(ptr_d);
+                 break;
+             case 2  :
+                 if ((ptr_d = MALLOC(2 * nm * sizeof(double))) == NULL)
+                 {
+                     ierr = -1;
+                     break;
+                 }
+                 for (j = 0; j < 2 * nm; j++)
+                 {
+                     ptr_d[j] = 0;
+                 }
+                 ptr_dc = &ptr_d[nm];
+                 CreateListCVarFromPtr(3, i + 1, MATRIX_OF_DOUBLE_DATATYPE, (j = 1, &j), &lnksz[i], &lnksz[i + n_lnktyp], &ptr_d, &ptr_dc);
+                 FREE(ptr_d);
+                 break;
+             case 3  :
+                 if ((ptr_i = MALLOC(nm * sizeof(int))) == NULL)
+                 {
+                     ierr = -1;
+                     break;
+                 }
+                 for (j = 0; j < nm; j++)
+                 {
+                     ptr_i[j] = 0;
+                 }
+                 M3.m = lnksz[i];
+                 M3.n = lnksz[i + n_lnktyp];
+                 M3.it = 4;
+                 M3.l = -1;
+                 M3.D = ptr_i;
+                 CreateListVarFromPtr(3, i + 1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &M3.m, &M3.n, &M3);
+                 FREE(ptr_i);
+                 break;
+             case 4  :
+                 if ((ptr_s = MALLOC(nm * sizeof(short))) == NULL)
+                 {
+                     ierr = -1;
+                     break;
+                 }
+                 for (j = 0; j < nm; j++)
+                 {
+                     ptr_s[j] = 0;
+                 }
+                 M3.m = lnksz[i];
+                 M3.n = lnksz[i + n_lnktyp];
+                 M3.it = 2;
+                 M3.l = -1;
+                 M3.D = ptr_s;
+                 CreateListVarFromPtr(3, i + 1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &M3.m, &M3.n, &M3);
+                 FREE(ptr_s);
+                 break;
+             case 5  :
+                 if ((ptr_c = MALLOC(nm * sizeof(char))) == NULL)
+                 {
+                     ierr = -1;
+                     break;
+                 }
+                 for (j = 0; j < nm; j++)
+                 {
+                     ptr_c[j] = 0;
+                 }
+                 M3.m = lnksz[i];
+                 M3.n = lnksz[i + n_lnktyp];
+                 M3.it = 1;
+                 M3.l = -1;
+                 M3.D = ptr_c;
+                 CreateListVarFromPtr(3, i + 1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &M3.m, &M3.n, &M3);
+                 FREE(ptr_c);
+                 break;
+             case 6  :
+                 if ((ptr_ui = MALLOC(nm * sizeof(unsigned int))) == NULL)
+                 {
+                     ierr = -1;
+                     break;
+                 }
+                 for (j = 0; j < nm; j++)
+                 {
+                     ptr_ui[j] = 0;
+                 }
+                 M3.m = lnksz[i];
+                 M3.n = lnksz[i + n_lnktyp];
+                 M3.it = 14;
+                 M3.l = -1;
+                 M3.D = ptr_ui;
+                 CreateListVarFromPtr(3, i + 1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &M3.m, &M3.n, &M3);
+                 FREE(ptr_ui);
+                 break;
+             case 7  :
+                 if ((ptr_us = MALLOC(nm * sizeof(unsigned short))) == NULL)
+                 {
+                     ierr = -1;
+                     break;
+                 }
+                 for (j = 0; j < nm; j++)
+                 {
+                     ptr_us[j] = 0;
+                 }
+                 M3.m = lnksz[i];
+                 M3.n = lnksz[i + n_lnktyp];
+                 M3.it = 12;
+                 M3.l = -1;
+                 M3.D = ptr_us;
+                 CreateListVarFromPtr(3, i + 1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &M3.m, &M3.n, &M3);
+                 FREE(ptr_us);
+                 break;
+             case 8  :
+                 if ((ptr_uc = MALLOC(nm * sizeof(unsigned char))) == NULL)
+                 {
+                     ierr = -1;
+                     break;
+                 }
+                 for (j = 0; j < nm; j++)
+                 {
+                     ptr_uc[j] = 0;
+                 }
+                 M3.m = lnksz[i];
+                 M3.n = lnksz[i + n_lnktyp];
+                 M3.it = 11;
+                 M3.l = -1;
+                 M3.D = ptr_uc;
+                 CreateListVarFromPtr(3, i + 1, MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE, &M3.m, &M3.n, &M3);
+                 FREE(ptr_uc);
+                 break;
+             default :
+                 if ((ptr_d = MALLOC(nm * sizeof(double))) == NULL)
+                 {
+                     ierr = -1;
+                     break;
+                 }
+                 for (j = 0; j < nm; j++)
+                 {
+                     ptr_d[j] = 0;
+                 }
+                 CreateListVarFromPtr(3, i + 1, MATRIX_OF_DOUBLE_DATATYPE, &lnksz[i], &lnksz[i + n_lnktyp], &ptr_d);
+                 FREE(ptr_d);
+                 break;
+         }
+         if (ierr == -1)
+         {
+             Scierror(999, _("%s : No more free memory.\n"), fname);
+             FREE(lnksz);
+             FREE(lnktyp);
+             return 0;
+         }
+     }
+     LhsVar(1) = 3;
+     FREE(lnksz);
+     FREE(lnktyp);
+     PutLhsVar();
++#endif
      return 0;
  }
  /*--------------------------------------------------------------------------*/
  /*--------------------------------------------------------------------------*/
  int sci_diffobjs(char *fname, unsigned long fname_len)
  {
-     //int one = 1, l3 = 0, k = 0;
-     //int size1 = 0;
-     //int size2 = 0;
-     //int *header1 = NULL;
-     //int *header2 = NULL;
++#if 0
+     int one = 1, l3 = 0, k = 0;
+     int size1 = 0;
+     int size2 = 0;
+     int *header1 = NULL;
+     int *header2 = NULL;
  
-     //CheckRhs(2, 2);
-     //CheckLhs(1, 1);
+     CheckRhs(2, 2);
+     CheckLhs(1, 1);
  
-     //header1 = GetData(1);
-     //header2 = GetData(2);
+     header1 = GetData(1);
+     header2 = GetData(2);
  
-     //CreateVar(3, MATRIX_OF_DOUBLE_DATATYPE, (one = 1, &one), (one = 1, &one), &l3);
+     CreateVar(3, MATRIX_OF_DOUBLE_DATATYPE, &one, &one, &l3);
  
-     //LhsVar(1) = 3;
+     LhsVar(1) = 3;
  
-     //size1 = 2 * (*Lstk(Top - Rhs + 2) - *Lstk(Top - Rhs + 1));
-     //size2 = 2 * (*Lstk(Top - Rhs + 3) - *Lstk(Top - Rhs + 2));
+     size1 = 2 * (*Lstk(Top - Rhs + 2) - *Lstk(Top - Rhs + 1));
+     size2 = 2 * (*Lstk(Top - Rhs + 3) - *Lstk(Top - Rhs + 2));
  
-     //if (size1 != size2)
-     //{
-     //    *stk(l3) = 1;
-     //    PutLhsVar();
-     //    return 0;
-     //}
-     //for (k = 0; k < size1; k++)
-     //{
-     //    if (header1[k] != header2[k])
-     //    {
-     //        *stk(l3) = 1;
-     //        PutLhsVar();
-     //        return 0;
-     //    }
-     //    *stk(l3) = 0;
-     //}
-     //PutLhsVar();
+     if (size1 != size2)
+     {
+         *stk(l3) = 1;
+         PutLhsVar();
+         return 0;
+     }
  
+     for (k = 0; k < size1; k++)
+     {
+         if (header1[k] != header2[k])
+         {
+             *stk(l3) = 1;
+             PutLhsVar();
+             return 0;
+         }
+         *stk(l3) = 0;
+     }
+     PutLhsVar();
 -
++#endif
      return 0;
  }
  /*--------------------------------------------------------------------------*/
  /*--------------------------------------------------------------------------*/
  int sci_scicos_time(char *fname, unsigned long fname_len)
  {
-     //int un = 1, l1 = 0;
++#if 0
+     int one = 1, l1 = 0;
  
-     //CheckRhs(-1, 0);
-     //CheckLhs(1, 1);
+     CheckRhs(-1, 0);
+     CheckLhs(1, 1);
  
-     //CreateVar(1, MATRIX_OF_DOUBLE_DATATYPE, (un = 1, &un), (un = 1, &un), &l1);
+     CreateVar(1, MATRIX_OF_DOUBLE_DATATYPE, &one, &one, &l1);
  
-     //*stk(l1) = get_scicos_time();
-     //LhsVar(1) = 1;
-     //PutLhsVar();
+     *stk(l1) = get_scicos_time();
  
+     LhsVar(1) = 1;
+     PutLhsVar();
 -
++#endif
      return 0;
  }
- /*--------------------------------------------------------------------------*/
+ /*--------------------------------------------------------------------------*/
@@@ -31,23 -31,23 +31,25 @@@ extern COSIM_struct C2F(cosim)
  /*--------------------------------------------------------------------------*/
  int sci_set_blockerror(char *fname, unsigned long fname_len)
  {
-     //int one = 1, l1 = 0;
-     //int isrun = C2F(cosim).isrun;
++#if 0
+     int one = 1, l1 = 0;
+     int isrun = C2F(cosim).isrun;
  
-     //CheckRhs(1, 1);
+     CheckRhs(1, 1);
  
-     //if (!isrun)
-     //{
-     //    Scierror(999, _("%s: scicosim is not running.\n"), fname);
-     //}
-     //else
-     //{
-     //    GetRhsVar(1, MATRIX_OF_INTEGER_DATATYPE, (one = 1, &one), (one = 1, &one), &l1);
-     //    set_block_error(*istk(l1));
+     if (!isrun)
+     {
+         Scierror(999, _("%s: scicosim is not running.\n"), fname);
+     }
+     else
+     {
+         GetRhsVar(1, MATRIX_OF_INTEGER_DATATYPE, &one, &one, &l1);
+         set_block_error(*istk(l1));
  
-     //    LhsVar(1) = 0;
-     //    PutLhsVar();
-     //}
+         LhsVar(1) = 0;
+         PutLhsVar();
+     }
++#endif
      return 0;
  }
  /*--------------------------------------------------------------------------*/
@@@ -33,24 -33,25 +33,25 @@@ int MlistGetFieldNumber(int *ptr, cons
  {
      int nf = 0, longueur = 0, istart = 0, k = 0, ilocal = 0, retval = 0;
      int *headerstr = NULL;
-     static char str[nlgh];
+     /* 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 */
 +    //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;
 -        }
 -    }
 +    //    C2F(cvstr)(&longueur, &headerstr[istart], str, (ilocal = 1, &ilocal), longueur);
 +    //    str[longueur] = '\0';
 +    //    if (strcmp(string, str) == 0)
 +    //    {
 +    //        retval = k + 2;
 +    //        break;
 +    //    }
 +    //}
      return retval;
  }
  /*--------------------------------------------------------------------------*/
@@@ -30,2895 -31,2914 +31,2915 @@@ extern int *listentry(int *header, int 
  /*--------------------------------------------------------------------------*/
  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;
-     //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;
-     //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;
-     //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;
-     //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;
-     //        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;
-     //if (mh*nh != 0)
-     //{
-     //    if ((Block->x = (double *) MALLOC((mh * nh) * 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;
-     //if (mh*nh != 0)
-     //{
-     //    if ((Block->xd = (double *) MALLOC((mh * nh) * 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;
-     //if (mh*nh != 0)
-     //{
-     //    if ((Block->res = (double *) MALLOC((mh * nh) * 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;
-     //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;
-     //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;
-     //        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;
-     //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;
-     //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;
-     //        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;
-     //if (mh*nh != 0)
-     //{
-     //    if ((Block->evout = (double *) MALLOC((mh * nh) * 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;
-     //if (mh * nh != 0)
-     //{
-     //    if ((Block->rpar = (double *) MALLOC((mh * nh) * 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;
-     //if (mh*nh != 0)
-     //{
-     //    if ((Block->ipar = (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);
-     //        *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);