Merge remote-tracking branch 'origin/master' into YaSp 40/9540/2
Antoine ELIAS [Thu, 25 Oct 2012 12:42:40 +0000 (14:42 +0200)]
Conflicts:
scilab/Scilab_f2c.sln
scilab/modules/api_scilab/Makefile.am
scilab/modules/api_scilab/Makefile.in
scilab/modules/core/includes/version.h.in
scilab/modules/core/includes/version.h.vc
scilab/modules/core/src/c/callDynamicGateway.c
scilab/modules/core/src/c/stack2.c
scilab/modules/graphics/core_Import.def
scilab/modules/graphics/includes/gw_graphics.h
scilab/modules/graphics/sci_gateway/c/gw_graphics.c
scilab/modules/graphics/sci_gateway/c/sci_clear_pixmap.c
scilab/modules/graphics/sci_gateway/c/sci_rotate_axes.c
scilab/modules/graphics/sci_gateway/c/sci_show_pixmap.c
scilab/modules/graphics/sci_gateway/c/sci_winsid.c
scilab/modules/graphics/src/c/StringMatrix.c
scilab/modules/graphics/src/c/getHandleProperty/get_auto_ticks_property.c
scilab/modules/graphics/src/c/getHandleProperty/get_axes_reverse_property.c
scilab/modules/graphics/src/c/getHandleProperty/setGetHashTable.c
scilab/modules/gui/sci_gateway/c/sci_ClipBoard.c
scilab/modules/gui/sci_gateway/c/sci_helpbrowser.c
scilab/modules/gui/sci_gateway/c/sci_uimenu.c
scilab/modules/gui/sci_gateway/cpp/sci_about.cpp
scilab/modules/gui/sci_gateway/cpp/sci_displaytree.cpp
scilab/modules/gui/sci_gateway/cpp/sci_fire_closing_finished.cpp
scilab/modules/gui/src/cpp/displaytree.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_export_to_hdf5.cpp
scilab/modules/hdf5/src/cpp/listvar_in_hdf5_v1.cpp
scilab/modules/special_functions/Makefile.am
scilab/modules/special_functions/Makefile.in
scilab/modules/special_functions/sci_gateway/c/sci_dlgamma.c
scilab/modules/special_functions/sci_gateway/c/sci_gamma.c
scilab/modules/special_functions/sci_gateway/c/sci_lgamma.c
scilab/modules/spreadsheet/Makefile.am
scilab/modules/spreadsheet/Makefile.in
scilab/modules/spreadsheet/sci_gateway/c/sci_csvDefault.c
scilab/modules/spreadsheet/sci_gateway/c/sci_csvIsnum.c
scilab/modules/spreadsheet/sci_gateway/c/sci_csvRead.c
scilab/modules/spreadsheet/sci_gateway/c/sci_csvStringToDouble.c
scilab/modules/spreadsheet/sci_gateway/c/sci_csvTextScan.c
scilab/modules/spreadsheet/sci_gateway/c/sci_csvWrite.c
scilab/modules/spreadsheet/sci_gateway/cpp/gw_csv_tools.h
scilab/modules/spreadsheet/spreadsheet.vcxproj
scilab/modules/spreadsheet/spreadsheet.vcxproj.filters
scilab/modules/spreadsheet/src/c/csvDefault.c
scilab/modules/spreadsheet/src/c/csv_strsubst.c
scilab/modules/umfpack/sci_gateway/c/sci_umf_luget.c
scilab/modules/xcos/sci_gateway/cpp/sci_xcosPalGenerateIcon.cpp

Change-Id: I8719eb508d13aa6e545eb348bdd918f68c6e916e

218 files changed:
1  2 
scilab/Makefile.am
scilab/Makefile.in
scilab/Scilab_f2c.sln
scilab/modules/api_scilab/Makefile.am
scilab/modules/api_scilab/Makefile.in
scilab/modules/api_scilab/api_scilab.vcxproj
scilab/modules/api_scilab/api_scilab.vcxproj.filters
scilab/modules/api_scilab/core_Import.def
scilab/modules/api_scilab/includes/api_optional.h
scilab/modules/api_scilab/includes/api_scilab.h
scilab/modules/api_scilab/src/cpp/api_optional.cpp
scilab/modules/arnoldi/sci_gateway/c/sci_eigs.c
scilab/modules/boolean/includes/gw_boolean.h
scilab/modules/console/includes/gw_console.h
scilab/modules/core/includes/stack-c.h
scilab/modules/core/sci_gateway/c/sci_getdebuginfo.c
scilab/modules/core/sci_gateway/c/sci_type.c
scilab/modules/core/src/c/getdynamicDebugInfo_Windows.c
scilab/modules/core/src/c/getval.c
scilab/modules/core/src/c/getval.h
scilab/modules/core/src/c/returnProperty.c
scilab/modules/core/src/c/stack2.c
scilab/modules/development_tools/macros/test_run.sci
scilab/modules/elementary_functions/sci_gateway/c/sci_nearfloat.c
scilab/modules/elementary_functions/sci_gateway/c/sci_number_properties.c
scilab/modules/elementary_functions/sci_gateway/c/sci_prod.c
scilab/modules/elementary_functions/sci_gateway/c/sci_real.c
scilab/modules/elementary_functions/sci_gateway/c/sci_round.c
scilab/modules/elementary_functions/sci_gateway/c/sci_sign.c
scilab/modules/elementary_functions/sci_gateway/c/sci_sqrt.c
scilab/modules/elementary_functions/sci_gateway/c/sci_testmatrix.c
scilab/modules/elementary_functions/sci_gateway/c/sci_tril.c
scilab/modules/elementary_functions/sci_gateway/c/sci_triu.c
scilab/modules/fftw/sci_gateway/c/sci_disposefftwlibrary.c
scilab/modules/fftw/sci_gateway/c/sci_fftw.c
scilab/modules/fftw/sci_gateway/c/sci_fftwlibraryisloaded.c
scilab/modules/fftw/src/c/sci_data_utilities.c
scilab/modules/fileio/sci_gateway/c/sci_pwd.c
scilab/modules/fileio/src/c/scanf_functions.c
scilab/modules/fileio/src/cpp/expandPathVariable.cpp
scilab/modules/functions/src/c/isScilabFunction.c
scilab/modules/graphics/Makefile.am
scilab/modules/graphics/Makefile.in
scilab/modules/graphics/core_Import.def
scilab/modules/graphics/graphics.vcxproj
scilab/modules/graphics/graphics.vcxproj.filters
scilab/modules/graphics/includes/GetCommandArg.h
scilab/modules/graphics/includes/gw_graphics.h
scilab/modules/graphics/sci_gateway/c/sci_Legend.c
scilab/modules/graphics/sci_gateway/c/sci_StringBox.c
scilab/modules/graphics/sci_gateway/c/sci_champ.c
scilab/modules/graphics/sci_gateway/c/sci_clear_pixmap.c
scilab/modules/graphics/sci_gateway/c/sci_contour2di.c
scilab/modules/graphics/sci_gateway/c/sci_copy.c
scilab/modules/graphics/sci_gateway/c/sci_delete.c
scilab/modules/graphics/sci_gateway/c/sci_demo.c
scilab/modules/graphics/sci_gateway/c/sci_draw.c
scilab/modules/graphics/sci_gateway/c/sci_drawaxis.c
scilab/modules/graphics/sci_gateway/c/sci_drawlater.c
scilab/modules/graphics/sci_gateway/c/sci_drawnow.c
scilab/modules/graphics/sci_gateway/c/sci_fec.c
scilab/modules/graphics/sci_gateway/c/sci_geom3d.c
scilab/modules/graphics/sci_gateway/c/sci_get.c
scilab/modules/graphics/sci_gateway/c/sci_glue.c
scilab/modules/graphics/sci_gateway/c/sci_grayplot.c
scilab/modules/graphics/sci_gateway/c/sci_is_handle_valid.c
scilab/modules/graphics/sci_gateway/c/sci_matplot.c
scilab/modules/graphics/sci_gateway/c/sci_matplot1.c
scilab/modules/graphics/sci_gateway/c/sci_move.c
scilab/modules/graphics/sci_gateway/c/sci_newaxes.c
scilab/modules/graphics/sci_gateway/c/sci_param3d.c
scilab/modules/graphics/sci_gateway/c/sci_param3d1.c
scilab/modules/graphics/sci_gateway/c/sci_plot2d.c
scilab/modules/graphics/sci_gateway/c/sci_plot2d1.c
scilab/modules/graphics/sci_gateway/c/sci_plot3d.c
scilab/modules/graphics/sci_gateway/c/sci_relocate_handle.c
scilab/modules/graphics/sci_gateway/c/sci_rotate_axes.c
scilab/modules/graphics/sci_gateway/c/sci_rubberbox.c
scilab/modules/graphics/sci_gateway/c/sci_set.c
scilab/modules/graphics/sci_gateway/c/sci_show_pixmap.c
scilab/modules/graphics/sci_gateway/c/sci_show_window.c
scilab/modules/graphics/sci_gateway/c/sci_swap_handles.c
scilab/modules/graphics/sci_gateway/c/sci_unglue.c
scilab/modules/graphics/sci_gateway/c/sci_unzoom.c
scilab/modules/graphics/sci_gateway/c/sci_winsid.c
scilab/modules/graphics/sci_gateway/c/sci_xarc.c
scilab/modules/graphics/sci_gateway/c/sci_xarcs.c
scilab/modules/graphics/sci_gateway/c/sci_xarrows.c
scilab/modules/graphics/sci_gateway/c/sci_xchange.c
scilab/modules/graphics/sci_gateway/c/sci_xclick.c
scilab/modules/graphics/sci_gateway/c/sci_xdel.c
scilab/modules/graphics/sci_gateway/c/sci_xfarcs.c
scilab/modules/graphics/sci_gateway/c/sci_xfpoly.c
scilab/modules/graphics/sci_gateway/c/sci_xfpolys.c
scilab/modules/graphics/sci_gateway/c/sci_xget.c
scilab/modules/graphics/sci_gateway/c/sci_xgetmouse.c
scilab/modules/graphics/sci_gateway/c/sci_xgraduate.c
scilab/modules/graphics/sci_gateway/c/sci_xgrid.c
scilab/modules/graphics/sci_gateway/c/sci_xlfont.c
scilab/modules/graphics/sci_gateway/c/sci_xname.c
scilab/modules/graphics/sci_gateway/c/sci_xpoly.c
scilab/modules/graphics/sci_gateway/c/sci_xpolys.c
scilab/modules/graphics/sci_gateway/c/sci_xrect.c
scilab/modules/graphics/sci_gateway/c/sci_xrects.c
scilab/modules/graphics/sci_gateway/c/sci_xsegs.c
scilab/modules/graphics/sci_gateway/c/sci_xset.c
scilab/modules/graphics/sci_gateway/c/sci_xstring.c
scilab/modules/graphics/sci_gateway/c/sci_xstringb.c
scilab/modules/graphics/sci_gateway/c/sci_xtitle.c
scilab/modules/graphics/sci_gateway/c/sci_zoom_rect.c
scilab/modules/graphics/src/c/DrawObjects.c
scilab/modules/graphics/src/c/GetCommandArg.c
scilab/modules/graphics/src/c/GetProperty.c
scilab/modules/graphics/src/c/SetProperty.c
scilab/modules/graphics/src/c/StringMatrix.c
scilab/modules/graphics/src/c/getHandleProperty/SetHashTable.c
scilab/modules/graphics/src/c/getHandleProperty/getPropertyAssignedValue.c
scilab/modules/graphics/src/c/getHandleProperty/getPropertyAssignedValue.h
scilab/modules/graphics/src/c/getHandleProperty/get_auto_ticks_property.c
scilab/modules/graphics/src/c/getHandleProperty/get_axes_reverse_property.c
scilab/modules/graphics/src/c/getHandleProperty/get_axes_visible_property.c
scilab/modules/graphics/src/c/getHandleProperty/setGetHashTable.c
scilab/modules/graphics/src/c/getHandleProperty/set_callback_property.c
scilab/modules/graphics/src/c/getHandleProperty/set_line_style_property.c
scilab/modules/graphics/src/c/getHandleProperty/set_user_data_property.c
scilab/modules/graphics/src/nographics/nographics.c
scilab/modules/gui/includes/gw_gui.h
scilab/modules/gui/sci_gateway/c/sci_ClipBoard.c
scilab/modules/gui/sci_gateway/c/sci_delmenu.c
scilab/modules/gui/sci_gateway/c/sci_exportUI.c
scilab/modules/gui/sci_gateway/c/sci_getcallbackobject.c
scilab/modules/gui/sci_gateway/c/sci_messagebox.c
scilab/modules/gui/sci_gateway/c/sci_progressionbar.c
scilab/modules/gui/sci_gateway/c/sci_setmenu.c
scilab/modules/gui/sci_gateway/c/sci_toolbar.c
scilab/modules/gui/sci_gateway/c/sci_uicontextmenu.c
scilab/modules/gui/sci_gateway/c/sci_uicontrol.c
scilab/modules/gui/sci_gateway/c/sci_uigetcolor.c
scilab/modules/gui/sci_gateway/c/sci_uigetfont.c
scilab/modules/gui/sci_gateway/c/sci_uimenu.c
scilab/modules/gui/sci_gateway/c/sci_uiwait.c
scilab/modules/gui/sci_gateway/c/sci_unsetmenu.c
scilab/modules/gui/sci_gateway/c/sci_waitbar.c
scilab/modules/gui/sci_gateway/c/sci_x_choice.c
scilab/modules/gui/sci_gateway/c/sci_x_choose.c
scilab/modules/gui/sci_gateway/c/sci_x_choose_modeless.c
scilab/modules/gui/sci_gateway/c/sci_x_dialog.c
scilab/modules/gui/sci_gateway/c/sci_x_mdialog.c
scilab/modules/gui/sci_gateway/cpp/sci_about.cpp
scilab/modules/gui/sci_gateway/cpp/sci_displaytree.cpp
scilab/modules/gui/sci_gateway/cpp/sci_fire_closing_finished.cpp
scilab/modules/gui/sci_gateway/cpp/sci_getinstalledlookandfeels.cpp
scilab/modules/gui/sci_gateway/cpp/sci_getlookandfeel.cpp
scilab/modules/gui/sci_gateway/cpp/sci_printfigure.cpp
scilab/modules/gui/sci_gateway/cpp/sci_printsetupbox.cpp
scilab/modules/gui/sci_gateway/cpp/sci_raise_window.cpp
scilab/modules/gui/sci_gateway/cpp/sci_setlookandfeel.cpp
scilab/modules/gui/sci_gateway/cpp/sci_toprint.cpp
scilab/modules/gui/sci_gateway/cpp/sci_uigetdir.cpp
scilab/modules/gui/sci_gateway/cpp/sci_uigetfile.cpp
scilab/modules/gui/sci_gateway/cpp/sci_uiputfile.cpp
scilab/modules/gui/sci_gateway/cpp/sci_usecanvas.cpp
scilab/modules/gui/src/c/ScilabTermination.c
scilab/modules/gui/src/cpp/InitUIMenu.cpp
scilab/modules/gui/src/cpp/SetUicontrolBackgroundColor.cpp
scilab/modules/gui/src/cpp/SetUicontrolPosition.cpp
scilab/modules/gui/src/cpp/SetUicontrolSliderStep.cpp
scilab/modules/gui/src/cpp/SetUicontrolValue.cpp
scilab/modules/gui/src/cpp/SetUiobjectForegroundColor.cpp
scilab/modules/gui/src/cpp/displaytree.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_export_to_hdf5.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/cpp/listvar_in_hdf5_v1.cpp
scilab/modules/io/sci_gateway/c/sci_save.c
scilab/modules/io/sci_gateway/c/sci_setenv.c
scilab/modules/matio/src/c/CreateSparseVariable.c
scilab/modules/matio/src/c/GetSparseVariable.c
scilab/modules/special_functions/Makefile.am
scilab/modules/special_functions/Makefile.in
scilab/modules/special_functions/includes/gw_special_functions.h
scilab/modules/special_functions/sci_gateway/c/gw_special_functions.c
scilab/modules/special_functions/sci_gateway/c/sci_bessely.c
scilab/modules/special_functions/sci_gateway/c/sci_calerf.c
scilab/modules/special_functions/sci_gateway/c/sci_dlgamma.c
scilab/modules/special_functions/sci_gateway/c/sci_gamma.c
scilab/modules/special_functions/sci_gateway/c/sci_lgamma.c
scilab/modules/spreadsheet/Makefile.am
scilab/modules/spreadsheet/Makefile.in
scilab/modules/spreadsheet/sci_gateway/c/gw_csv_helpers.c
scilab/modules/spreadsheet/sci_gateway/c/gw_csv_helpers.h
scilab/modules/spreadsheet/sci_gateway/c/sci_csvDefault.c
scilab/modules/spreadsheet/sci_gateway/c/sci_csvIsnum.c
scilab/modules/spreadsheet/sci_gateway/c/sci_csvRead.c
scilab/modules/spreadsheet/sci_gateway/c/sci_csvStringToDouble.c
scilab/modules/spreadsheet/sci_gateway/c/sci_csvTextScan.c
scilab/modules/spreadsheet/sci_gateway/c/sci_csvWrite.c
scilab/modules/spreadsheet/spreadsheet.vcxproj
scilab/modules/spreadsheet/spreadsheet.vcxproj.filters
scilab/modules/spreadsheet/src/c/checkCsvWriteFormat.c
scilab/modules/spreadsheet/src/c/csvDefault.c
scilab/modules/spreadsheet/src/c/csvRead.c
scilab/modules/spreadsheet/src/c/csvWrite.c
scilab/modules/spreadsheet/src/c/csv_strsubst.c
scilab/modules/spreadsheet/src/c/getRange.c
scilab/modules/spreadsheet/src/c/latintoutf.c
scilab/modules/spreadsheet/src/c/stringToComplex.c
scilab/modules/spreadsheet/src/c/utftolatin.c
scilab/modules/umfpack/sci_gateway/c/sci_taucs_chfact.c
scilab/modules/umfpack/sci_gateway/c/sci_taucs_chget.c
scilab/modules/umfpack/sci_gateway/c/sci_taucs_chinfo.c
scilab/modules/umfpack/sci_gateway/c/sci_umf_lufact.c
scilab/modules/umfpack/sci_gateway/c/sci_umf_luget.c
scilab/modules/umfpack/sci_gateway/c/sci_umf_luinfo.c
scilab/modules/umfpack/sci_gateway/c/sci_umf_lusolve.c
scilab/modules/umfpack/sci_gateway/c/sci_umfpack.c
scilab/modules/xcos/sci_gateway/cpp/sci_xcosPalGenerateIcon.cpp

@@@ -45,49 -45,22 +45,51 @@@ if IS_MACOS
  scilab_bin_LDFLAGS            += -framework Cocoa
  endif
  
- scilab_bin_CPPFLAGS = -I$(top_srcdir)/modules/console/includes/ \
 -scilab_bin_CPPFLAGS = -I$(top_srcdir)/modules/io/includes/ \
 -                    -I$(top_srcdir)/modules/console/includes/ \
 -                    -I$(top_srcdir)/modules/localization/includes/ \
 -                    $(AM_CPPFLAGS)
++scilab_bin_CPPFLAGS = \
++    -I$(top_srcdir)/modules/console/includes/ \
 +      -I$(top_srcdir)/modules/output_stream/includes/ \
 +    -I$(top_srcdir)/modules/parse/includes/ \
 +    -I$(top_srcdir)/modules/ast/includes/ \
 +    -I$(top_srcdir)/modules/symbol/includes/ \
 +    -I$(top_srcdir)/modules/functions_manager/includes/ \
 +    -I$(top_srcdir)/modules/types/includes/ \
 +    -I$(top_srcdir)/modules/system_env/includes/ \
 +    -I$(top_srcdir)/modules/operations/includes/ \
 +    -I$(top_srcdir)/modules/elementary_functions/includes/ \
 +    -I$(top_srcdir)/modules/fileio/includes/ \
 +    -I$(top_srcdir)/modules/string/includes/ \
 +    -I$(top_srcdir)/modules/history_manager/includes/ \
 +    -I$(top_srcdir)/modules/threads/includes/ \
 +    -I$(top_srcdir)/modules/api_scilab/includes/ \
 +    -I$(top_srcdir)/modules/localization/includes/ \
 +    -I$(top_srcdir)/libs/dynamiclibrary/includes/ \
 +    -I$(top_srcdir)/libs/MALLOC/includes/ \
 +    $(EIGEN_CPPFLAGS) \
 +      $(AM_CPPFLAGS)
  # --no-undefined --relax
  
  # Localization dep already exists because of the `exportLocaleToSystem' symbol
  # (causing issues on some platform)
  COMMON_LIBS = $(LTLIBINTL)
  
- scilab_bin_SOURCES            = $(top_srcdir)/modules/core/src/cpp/scilab.cpp \
 -scilab_bin_SOURCES            = $(top_srcdir)/modules/console/src/c/others/mainscic.c
++scilab_bin_SOURCES = \
++    $(top_srcdir)/modules/core/src/cpp/scilab.cpp \
 +    $(top_srcdir)/modules/core/src/cpp/tasks.cpp
  
 -scilab_bin_LDADD              = $(COMMON_LIBS) $(top_builddir)/modules/libscilab.la $(FLIBS)
 +if IS_MACOSX
 +scilab_bin_SOURCES            +=  $(top_srcdir)/modules/core/src/c/initMacOSXEnv.c
 +endif
 +
 +scilab_bin_LDADD              = $(COMMON_LIBS)
 +if GUI
 +# Force the libscijvm to be linked first. Under Debian, this avoid some reordering issues during the link
 +scilab_bin_LDADD += $(top_builddir)/modules/jvm/libscijvm.la
 +endif
 +scilab_bin_LDADD += $(top_builddir)/modules/libscilab.la $(FLIBS)
  
  # Match scilab -nwni (ie command line without graphics)
 -scilab_cli_bin_SOURCES        = $(top_srcdir)/modules/console/src/c/others/mainscic.c
 +scilab_cli_bin_SOURCES        =       $(top_srcdir)/modules/core/src/cpp/scilab.cpp \
 +                                                      $(top_srcdir)/modules/core/src/cpp/tasks.cpp
  
  scilab_cli_bin_CPPFLAGS = -DWITHOUT_GUI $(scilab_bin_CPPFLAGS)
  scilab_cli_bin_LDADD  = $(COMMON_LIBS) $(top_builddir)/modules/libscilab-cli.la $(FLIBS)
@@@ -662,26 -633,10 +662,27 @@@ bin_SCRIPTS = bin/scilab bin/scilab-adv
        $(am__append_1)
  scilab_bin_LDFLAGS = $(AM_LDFLAGS) $(am__append_2)
  scilab_cli_bin_LDFLAGS = $(AM_LDFLAGS)
- scilab_bin_CPPFLAGS = -I$(top_srcdir)/modules/console/includes/ \
 -scilab_bin_CPPFLAGS = -I$(top_srcdir)/modules/io/includes/ \
 -                    -I$(top_srcdir)/modules/console/includes/ \
 -                    -I$(top_srcdir)/modules/localization/includes/ \
 -                    $(AM_CPPFLAGS)
++scilab_bin_CPPFLAGS = \
++    -I$(top_srcdir)/modules/console/includes/ \
 +      -I$(top_srcdir)/modules/output_stream/includes/ \
 +    -I$(top_srcdir)/modules/parse/includes/ \
 +    -I$(top_srcdir)/modules/ast/includes/ \
 +    -I$(top_srcdir)/modules/symbol/includes/ \
 +    -I$(top_srcdir)/modules/functions_manager/includes/ \
 +    -I$(top_srcdir)/modules/types/includes/ \
 +    -I$(top_srcdir)/modules/system_env/includes/ \
 +    -I$(top_srcdir)/modules/operations/includes/ \
 +    -I$(top_srcdir)/modules/elementary_functions/includes/ \
 +    -I$(top_srcdir)/modules/fileio/includes/ \
 +    -I$(top_srcdir)/modules/string/includes/ \
 +    -I$(top_srcdir)/modules/history_manager/includes/ \
 +    -I$(top_srcdir)/modules/threads/includes/ \
 +    -I$(top_srcdir)/modules/api_scilab/includes/ \
 +    -I$(top_srcdir)/modules/localization/includes/ \
 +    -I$(top_srcdir)/libs/dynamiclibrary/includes/ \
 +    -I$(top_srcdir)/libs/MALLOC/includes/ \
 +    $(EIGEN_CPPFLAGS) \
 +      $(AM_CPPFLAGS)
  
  # --no-undefined --relax
  
@@@ -1811,14 -1518,32 +1811,40 @@@ Globa
                {F1D56B26-F11F-4ECE-AB82-127B5E1C58E0}.Debug|x64.ActiveCfg = Debug|x64
                {F1D56B26-F11F-4ECE-AB82-127B5E1C58E0}.Release|Win32.ActiveCfg = Release|Win32
                {F1D56B26-F11F-4ECE-AB82-127B5E1C58E0}.Release|x64.ActiveCfg = Release|x64
 +              {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Debug|Win32.ActiveCfg = Debug|Win32
 +              {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Debug|Win32.Build.0 = Debug|Win32
 +              {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Debug|x64.ActiveCfg = Debug|x64
 +              {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Debug|x64.Build.0 = Debug|x64
 +              {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Release|Win32.ActiveCfg = Release|Win32
 +              {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Release|Win32.Build.0 = Release|Win32
 +              {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Release|x64.ActiveCfg = Release|x64
 +              {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Release|x64.Build.0 = Release|x64
+               {56A2E2F3-26CF-45D5-BE7A-534C39CD7003}.Debug|Win32.ActiveCfg = Debug|Win32
+               {56A2E2F3-26CF-45D5-BE7A-534C39CD7003}.Debug|x64.ActiveCfg = Debug|x64
+               {56A2E2F3-26CF-45D5-BE7A-534C39CD7003}.Debug|x64.Build.0 = Debug|x64
+               {56A2E2F3-26CF-45D5-BE7A-534C39CD7003}.Release|Win32.ActiveCfg = Release|Win32
+               {56A2E2F3-26CF-45D5-BE7A-534C39CD7003}.Release|x64.ActiveCfg = Release|x64
+               {56A2E2F3-26CF-45D5-BE7A-534C39CD7003}.Release|x64.Build.0 = Release|x64
+               {A9A2020D-5541-44F2-B080-DF3C9426C409}.Debug|Win32.ActiveCfg = Debug|Win32
+               {A9A2020D-5541-44F2-B080-DF3C9426C409}.Debug|Win32.Build.0 = Debug|Win32
+               {A9A2020D-5541-44F2-B080-DF3C9426C409}.Debug|x64.ActiveCfg = Debug|x64
+               {A9A2020D-5541-44F2-B080-DF3C9426C409}.Debug|x64.Build.0 = Debug|x64
+               {A9A2020D-5541-44F2-B080-DF3C9426C409}.Release|Win32.ActiveCfg = Release|Win32
+               {A9A2020D-5541-44F2-B080-DF3C9426C409}.Release|Win32.Build.0 = Release|Win32
+               {A9A2020D-5541-44F2-B080-DF3C9426C409}.Release|x64.ActiveCfg = Release|x64
+               {A9A2020D-5541-44F2-B080-DF3C9426C409}.Release|x64.Build.0 = Release|x64
+               {85303A11-CF6B-432F-B3FD-24DEFFB51025}.Debug|Win32.ActiveCfg = Debug|Win32
+               {85303A11-CF6B-432F-B3FD-24DEFFB51025}.Debug|x64.ActiveCfg = Debug|x64
+               {85303A11-CF6B-432F-B3FD-24DEFFB51025}.Release|Win32.ActiveCfg = Release|Win32
+               {85303A11-CF6B-432F-B3FD-24DEFFB51025}.Release|x64.ActiveCfg = Release|x64
+               {88E95224-A931-4B3E-AC6C-5A40B3961421}.Debug|Win32.ActiveCfg = Debug|Win32
+               {88E95224-A931-4B3E-AC6C-5A40B3961421}.Debug|x64.ActiveCfg = Debug|x64
+               {88E95224-A931-4B3E-AC6C-5A40B3961421}.Release|Win32.ActiveCfg = Release|Win32
+               {88E95224-A931-4B3E-AC6C-5A40B3961421}.Release|x64.ActiveCfg = Release|x64
+               {439D04EC-A444-48BE-8E55-8CD2BB66B782}.Debug|Win32.ActiveCfg = Debug|Win32
+               {439D04EC-A444-48BE-8E55-8CD2BB66B782}.Debug|x64.ActiveCfg = Debug|x64
+               {439D04EC-A444-48BE-8E55-8CD2BB66B782}.Release|Win32.ActiveCfg = Release|Win32
+               {439D04EC-A444-48BE-8E55-8CD2BB66B782}.Release|x64.ActiveCfg = Release|x64
                {337A52F8-310E-49E3-A2BA-F19CA32EB617}.Debug|Win32.ActiveCfg = Debug|Win32
                {337A52F8-310E-49E3-A2BA-F19CA32EB617}.Debug|Win32.Build.0 = Debug|Win32
                {337A52F8-310E-49E3-A2BA-F19CA32EB617}.Debug|x64.ActiveCfg = Debug|x64
@@@ -5,40 -5,33 +5,41 @@@
  
  ### SOURCES ###
  
 -
 -API_SCILAB_CXX_SOURCES = src/cpp/api_boolean.cpp \
 +API_SCILAB_CXX_SOURCES = \
-     src/cpp/api_boolean.cpp \
-     src/cpp/api_boolean_sparse.cpp \
-     src/cpp/api_common.cpp \
-     src/cpp/api_double.cpp \
-     src/cpp/api_int.cpp \
-     src/cpp/api_list.cpp \
-     src/cpp/api_poly.cpp \
-     src/cpp/api_sparse.cpp \
-     src/cpp/api_string.cpp \
-     src/cpp/api_pointer.cpp \
-     src/cpp/api_handle.cpp \
-     src/cpp/overload.cpp \
-     src/cpp/api_error.cpp
++src/cpp/api_boolean.cpp \
+ src/cpp/api_boolean_sparse.cpp \
+ src/cpp/api_common.cpp \
+ src/cpp/api_double.cpp \
+ src/cpp/api_int.cpp \
+ src/cpp/api_list.cpp \
+ src/cpp/api_poly.cpp \
+ src/cpp/api_sparse.cpp \
+ src/cpp/api_string.cpp \
+ src/cpp/api_pointer.cpp \
+ src/cpp/api_handle.cpp \
+ src/cpp/api_error.cpp \
++src/cpp/overload.cpp \
+ src/cpp/api_optional.cpp
  
 -
 -libsciapi_scilab_la_CPPFLAGS=-I$(srcdir)/includes/ \
 +libsciapi_scilab_la_CPPFLAGS= \
-     -I$(srcdir)/includes/ \
-     -I$(srcdir)/src/cpp/ \
-     -I$(srcdir)/src/c/ \
-     -I$(top_srcdir)/modules/core/includes \
-     -I$(top_srcdir)/modules/call_scilab/includes \
-     -I$(top_srcdir)/libs/MALLOC/includes/ \
-     -I$(top_srcdir)/modules/localization/includes \
-     -I$(top_srcdir)/modules/output_stream/includes \
-     -I$(top_srcdir)/modules/operations/includes \
-     -I$(top_srcdir)/modules/types/includes \
-     -I$(top_srcdir)/modules/symbol/includes \
-     -I$(top_srcdir)/modules/ast/includes \
-     -I$(top_srcdir)/modules/elementary_functions/includes \
-     -I$(top_srcdir)/modules/string/includes \
-     -I$(top_srcdir)/libs/dynamiclibrary/includes
++-I$(srcdir)/includes/ \
+ -I$(srcdir)/src/cpp/ \
 --I$(top_srcdir)/modules/core/includes/ \
 --I$(top_srcdir)/modules/call_scilab/includes/ \
++-I$(srcdir)/src/c/ \
++-I$(top_srcdir)/modules/core/includes \
++-I$(top_srcdir)/modules/call_scilab/includes \
+ -I$(top_srcdir)/libs/MALLOC/includes/ \
 --I$(top_srcdir)/modules/localization/includes/ \
 --I$(top_srcdir)/modules/output_stream/includes/ \
 --I$(top_srcdir)/modules/string/includes/ \
++-I$(top_srcdir)/modules/localization/includes \
++-I$(top_srcdir)/modules/output_stream/includes \
++-I$(top_srcdir)/modules/operations/includes \
++-I$(top_srcdir)/modules/types/includes \
++-I$(top_srcdir)/modules/symbol/includes \
++-I$(top_srcdir)/modules/types/includes \
++-I$(top_srcdir)/modules/ast/includes \
++-I$(top_srcdir)/modules/elementary_functions/includes \
++-I$(top_srcdir)/modules/string/includes \
++-I$(top_srcdir)/libs/dynamiclibrary/includes \
+ $(AM_CPPFLAGS)
  
 -
  if MAINTAINER_MODE
  pkglib_LTLIBRARIES = libsciapi_scilab.la
  else
@@@ -147,13 -147,10 +147,14 @@@ am__objects_1 = libsciapi_scilab_la-api
        libsciapi_scilab_la-api_string.lo \
        libsciapi_scilab_la-api_pointer.lo \
        libsciapi_scilab_la-api_handle.lo \
+       libsciapi_scilab_la-api_error.lo \
 +      libsciapi_scilab_la-overload.lo \
-       libsciapi_scilab_la-api_error.lo
+       libsciapi_scilab_la-api_optional.lo
  am_libsciapi_scilab_la_OBJECTS = $(am__objects_1)
  libsciapi_scilab_la_OBJECTS = $(am_libsciapi_scilab_la_OBJECTS)
 +libsciapi_scilab_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
 +      $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
 +      $(CXXFLAGS) $(libsciapi_scilab_la_LDFLAGS) $(LDFLAGS) -o $@
  @MAINTAINER_MODE_FALSE@am_libsciapi_scilab_la_rpath =
  @MAINTAINER_MODE_TRUE@am_libsciapi_scilab_la_rpath = -rpath \
  @MAINTAINER_MODE_TRUE@        $(pkglibdir)
@@@ -441,38 -432,29 +442,41 @@@ target_alias = @target_alias
  top_build_prefix = @top_build_prefix@
  top_builddir = @top_builddir@
  top_srcdir = @top_srcdir@
 -API_SCILAB_CXX_SOURCES = src/cpp/api_boolean.cpp \
 +yacc_present = @yacc_present@
 +API_SCILAB_CXX_SOURCES = \
-     src/cpp/api_boolean.cpp \
-     src/cpp/api_boolean_sparse.cpp \
-     src/cpp/api_common.cpp \
-     src/cpp/api_double.cpp \
-     src/cpp/api_int.cpp \
-     src/cpp/api_list.cpp \
-     src/cpp/api_poly.cpp \
-     src/cpp/api_sparse.cpp \
-     src/cpp/api_string.cpp \
-     src/cpp/api_pointer.cpp \
-     src/cpp/api_handle.cpp \
-     src/cpp/overload.cpp \
-     src/cpp/api_error.cpp
++src/cpp/api_boolean.cpp \
+ src/cpp/api_boolean_sparse.cpp \
+ src/cpp/api_common.cpp \
+ src/cpp/api_double.cpp \
+ src/cpp/api_int.cpp \
+ src/cpp/api_list.cpp \
+ src/cpp/api_poly.cpp \
+ src/cpp/api_sparse.cpp \
+ src/cpp/api_string.cpp \
+ src/cpp/api_pointer.cpp \
+ src/cpp/api_handle.cpp \
+ src/cpp/api_error.cpp \
++src/cpp/overload.cpp \
+ src/cpp/api_optional.cpp
  
 -libsciapi_scilab_la_CPPFLAGS = -I$(srcdir)/includes/ \
 +libsciapi_scilab_la_CPPFLAGS = \
-     -I$(srcdir)/includes/ \
-     -I$(srcdir)/src/cpp/ \
-     -I$(srcdir)/src/c/ \
-     -I$(top_srcdir)/modules/core/includes \
-     -I$(top_srcdir)/modules/call_scilab/includes \
-     -I$(top_srcdir)/libs/MALLOC/includes/ \
-     -I$(top_srcdir)/modules/localization/includes \
-     -I$(top_srcdir)/modules/output_stream/includes \
-     -I$(top_srcdir)/modules/operations/includes \
-     -I$(top_srcdir)/modules/types/includes \
-     -I$(top_srcdir)/modules/symbol/includes \
-     -I$(top_srcdir)/modules/ast/includes \
-     -I$(top_srcdir)/modules/elementary_functions/includes \
-     -I$(top_srcdir)/modules/string/includes \
-     -I$(top_srcdir)/libs/dynamiclibrary/includes
++-I$(srcdir)/includes/ \
+ -I$(srcdir)/src/cpp/ \
 --I$(top_srcdir)/modules/core/includes/ \
 --I$(top_srcdir)/modules/call_scilab/includes/ \
++-I$(srcdir)/src/c/ \
++-I$(top_srcdir)/modules/core/includes \
++-I$(top_srcdir)/modules/call_scilab/includes \
+ -I$(top_srcdir)/libs/MALLOC/includes/ \
 --I$(top_srcdir)/modules/localization/includes/ \
 --I$(top_srcdir)/modules/output_stream/includes/ \
 --I$(top_srcdir)/modules/string/includes/ \
++-I$(top_srcdir)/modules/localization/includes \
++-I$(top_srcdir)/modules/output_stream/includes \
++-I$(top_srcdir)/modules/operations/includes \
++-I$(top_srcdir)/modules/types/includes \
++-I$(top_srcdir)/modules/symbol/includes \
++-I$(top_srcdir)/modules/types/includes \
++-I$(top_srcdir)/modules/ast/includes \
++-I$(top_srcdir)/modules/elementary_functions/includes \
++-I$(top_srcdir)/modules/string/includes \
++-I$(top_srcdir)/libs/dynamiclibrary/includes \
+ $(AM_CPPFLAGS)
  
  @MAINTAINER_MODE_TRUE@pkglib_LTLIBRARIES = libsciapi_scilab.la
  @MAINTAINER_MODE_FALSE@noinst_LTLIBRARIES = libsciapi_scilab.la
@@@ -782,19 -764,19 +788,26 @@@ libsciapi_scilab_la-api_handle.lo: src/
  @AMDEP_TRUE@@am__fastdepCXX_FALSE@    DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
  @am__fastdepCXX_FALSE@        $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsciapi_scilab_la-api_handle.lo `test -f 'src/cpp/api_handle.cpp' || echo '$(srcdir)/'`src/cpp/api_handle.cpp
  
+ libsciapi_scilab_la-api_error.lo: src/cpp/api_error.cpp
+ @am__fastdepCXX_TRUE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsciapi_scilab_la-api_error.lo -MD -MP -MF $(DEPDIR)/libsciapi_scilab_la-api_error.Tpo -c -o libsciapi_scilab_la-api_error.lo `test -f 'src/cpp/api_error.cpp' || echo '$(srcdir)/'`src/cpp/api_error.cpp
+ @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsciapi_scilab_la-api_error.Tpo $(DEPDIR)/libsciapi_scilab_la-api_error.Plo
+ @AMDEP_TRUE@@am__fastdepCXX_FALSE@    source='src/cpp/api_error.cpp' object='libsciapi_scilab_la-api_error.lo' libtool=yes @AMDEPBACKSLASH@
+ @AMDEP_TRUE@@am__fastdepCXX_FALSE@    DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ @am__fastdepCXX_FALSE@        $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsciapi_scilab_la-api_error.lo `test -f 'src/cpp/api_error.cpp' || echo '$(srcdir)/'`src/cpp/api_error.cpp
 +libsciapi_scilab_la-overload.lo: src/cpp/overload.cpp
 +@am__fastdepCXX_TRUE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsciapi_scilab_la-overload.lo -MD -MP -MF $(DEPDIR)/libsciapi_scilab_la-overload.Tpo -c -o libsciapi_scilab_la-overload.lo `test -f 'src/cpp/overload.cpp' || echo '$(srcdir)/'`src/cpp/overload.cpp
 +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsciapi_scilab_la-overload.Tpo $(DEPDIR)/libsciapi_scilab_la-overload.Plo
 +@AMDEP_TRUE@@am__fastdepCXX_FALSE@    source='src/cpp/overload.cpp' object='libsciapi_scilab_la-overload.lo' libtool=yes @AMDEPBACKSLASH@
 +@AMDEP_TRUE@@am__fastdepCXX_FALSE@    DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 +@am__fastdepCXX_FALSE@        $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsciapi_scilab_la-overload.lo `test -f 'src/cpp/overload.cpp' || echo '$(srcdir)/'`src/cpp/overload.cpp
 +
- libsciapi_scilab_la-api_error.lo: src/cpp/api_error.cpp
- @am__fastdepCXX_TRUE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsciapi_scilab_la-api_error.lo -MD -MP -MF $(DEPDIR)/libsciapi_scilab_la-api_error.Tpo -c -o libsciapi_scilab_la-api_error.lo `test -f 'src/cpp/api_error.cpp' || echo '$(srcdir)/'`src/cpp/api_error.cpp
- @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsciapi_scilab_la-api_error.Tpo $(DEPDIR)/libsciapi_scilab_la-api_error.Plo
- @AMDEP_TRUE@@am__fastdepCXX_FALSE@    source='src/cpp/api_error.cpp' object='libsciapi_scilab_la-api_error.lo' libtool=yes @AMDEPBACKSLASH@
+ libsciapi_scilab_la-api_optional.lo: src/cpp/api_optional.cpp
+ @am__fastdepCXX_TRUE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsciapi_scilab_la-api_optional.lo -MD -MP -MF $(DEPDIR)/libsciapi_scilab_la-api_optional.Tpo -c -o libsciapi_scilab_la-api_optional.lo `test -f 'src/cpp/api_optional.cpp' || echo '$(srcdir)/'`src/cpp/api_optional.cpp
+ @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsciapi_scilab_la-api_optional.Tpo $(DEPDIR)/libsciapi_scilab_la-api_optional.Plo
+ @AMDEP_TRUE@@am__fastdepCXX_FALSE@    source='src/cpp/api_optional.cpp' object='libsciapi_scilab_la-api_optional.lo' libtool=yes @AMDEPBACKSLASH@
  @AMDEP_TRUE@@am__fastdepCXX_FALSE@    DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCXX_FALSE@        $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsciapi_scilab_la-api_error.lo `test -f 'src/cpp/api_error.cpp' || echo '$(srcdir)/'`src/cpp/api_error.cpp
+ @am__fastdepCXX_FALSE@        $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsciapi_scilab_la-api_optional.lo `test -f 'src/cpp/api_optional.cpp' || echo '$(srcdir)/'`src/cpp/api_optional.cpp
  
  mostlyclean-libtool:
        -rm -f *.lo
@@@ -3,5 -3,19 +3,7 @@@ LIBRARY    core.dl
  
  EXPORTS
  ;core
 -intersci_
 -str2name_
 -vstk_
 -com_
 -putlhsvar_
 -recu_
 -overload_
 -stack_
 -iop_
 -vGetPointerFromDoubleComplex
 -oGetDoubleComplexFromPointer
  getExecMode
 -getstackinfo_
  freeArrayOfString
+ isopt_
 -numopt_
++numopt_
index 0000000,9e8daad..14474c2
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,35 +1,46 @@@
+ /*
+  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+  * Copyright (C) 2012 - Scilab Enterprises - 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
+  */
+ #ifndef __OPTINAL_API__
+ #define __OPTINAL_API__
+ #if !defined(__INTERNAL_API_SCILAB__)
+ #error Do not include api_optinal.h. Include api_scilab.h instead.
+ #endif
 -#include "stack-c.h"
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
++    typedef struct rhs_opts__
++    {
++        int iPos ; /** stack position : -1 if not present */
++        char* pstName;
++        int iType;// -1 not yet defined
++        int iRows;
++        int iCols;
++        int* piAddr;
++    } rhs_opts;
++
+     /**
+      * Get optional variable
+      * @param[in] name of function caller
+      * @param[in/out] opts structure of optional arguments
+      * @return if the operation succeeded ( 0 ) or not ( !0 )
+      */
+     int getOptionals(void* _pvCtx, char* fname, rhs_opts opts[]);
 -
++    int FirstOpt();
++    int NumOpt();
++    int FindOpt(char* pstProperty, rhs_opts opts[]);
+ #ifdef __cplusplus
+ }
+ #endif
+ #endif /* __OPTINAL_API__ */
index 0000000,e9b8a97..5a1117c
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,117 +1,135 @@@
+ /*
+  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+  * Copyright (C) 2012 - Scilab Enterprises - 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 "api_scilab.h"
+ #include "localization.h"
+ #include "Scierror.h"
+ #include "call_scilab.h"
+ #include "sciprint.h"
+ static int findOptional(void* _pvCtx, char *fname, rhs_opts opts[]);
+ static void printOptionalNames(void* _pvCtx, rhs_opts opts[]);
+ /**************************/
+ /*   optional functions   */
+ /**************************/
++
++
+ int getOptionals(void* _pvCtx, char* fname, rhs_opts opts[])
+ {
 -    int k, i = 0;
 -    char name[nlgh + 1];
 -    int nopt = NumOpt();        /* optional arguments on the stack */
++    //int k, i = 0;
++    //char name[nlgh + 1];
++    //int nopt = NumOpt();        /* optional arguments on the stack */
 -    /* reset first field since opts is declared static in calling function */
 -    /* this could be avoided with ansi compilers by removing static in the
 -     * opts declaration */
++    ///* reset first field since opts is declared static in calling function */
++    ///* this could be avoided with ansi compilers by removing static in the
++    // * opts declaration */
 -    while (opts[i].pstName != NULL)
 -    {
 -        opts[i].iPos = -1;
 -        i++;
 -    }
++    //while (opts[i].pstName != NULL)
++    //{
++    //    opts[i].iPos = -1;
++    //    i++;
++    //}
 -    /* Walking through last arguments */
++    ///* Walking through last arguments */
 -    for (k = Rhs - nopt + 1; k <= Rhs; k++)
 -    {
 -        if (IsOpt(k, name) == 0)
 -        {
 -            Scierror(999, _("%s: Optional arguments name=val must be at the end.\n"), fname);
 -            return 0;
 -        }
 -        else
 -        {
 -            int isopt = findOptional(_pvCtx, name, opts);
 -
 -            if (isopt >= 0)
 -            {
 -                rhs_opts *ro = &opts[isopt];
 -                ro->iPos = k;
 -                getVarAddressFromPosition(_pvCtx, k, &ro->piAddr);
 -                getVarType(_pvCtx, ro->piAddr, &ro->iType);
 -                getVarDimension(_pvCtx, ro->piAddr, &ro->iRows, &ro->iCols);
 -            }
 -            else
 -            {
 -                sciprint(_("%s: Unrecognized optional arguments %s.\n"), fname, name);
 -                printOptionalNames(_pvCtx, opts);
 -                SciError(999);
 -                return 0;
 -            }
 -        }
 -    }
++    //for (k = Rhs - nopt + 1; k <= Rhs; k++)
++    //{
++    //    if (IsOpt(k, name) == 0)
++    //    {
++    //        Scierror(999, _("%s: Optional arguments name=val must be at the end.\n"), fname);
++    //        return 0;
++    //    }
++    //    else
++    //    {
++    //        int isopt = findOptional(_pvCtx, name, opts);
++
++    //        if (isopt >= 0)
++    //        {
++    //            rhs_opts *ro = &opts[isopt];
++    //            ro->iPos = k;
++    //            getVarAddressFromPosition(_pvCtx, k, &ro->piAddr);
++    //            getVarType(_pvCtx, ro->piAddr, &ro->iType);
++    //            getVarDimension(_pvCtx, ro->piAddr, &ro->iRows, &ro->iCols);
++    //        }
++    //        else
++    //        {
++    //            sciprint(_("%s: Unrecognized optional arguments %s.\n"), fname, name);
++    //            printOptionalNames(_pvCtx, opts);
++    //            SciError(999);
++    //            return 0;
++    //        }
++    //    }
++    //}
++    return 1;
++}
++
++int FirstOpt()
++{
++    return 1;
++}
++
++int NumOpt()
++{
++    return 1;
++}
++
++int FindOpt(char* pstProperty, rhs_opts opts[])
++{
+     return 1;
+ }
+ static int findOptional(void* _pvCtx, char *fname, rhs_opts opts[])
+ {
+     int rep = -1, i = 0;
+     while (opts[i].pstName != NULL)
+     {
+         int cmp;
+         /* name is terminated by white space and we want to ignore them */
+         if ((cmp = strcmp(fname, opts[i].pstName)) == 0)
+         {
+             rep = i;
+             break;
+         }
+         else if (cmp < 0)
+         {
+             break;
+         }
+         else
+         {
+             i++;
+         }
+     }
+     return rep;
+ }
+ void printOptionalNames(void* _pvCtx, rhs_opts opts[])
+ /* array of optinal names (in alphabetical order)
+ * the array is null terminated */
+ {
+     int i = 0;
+     if (opts[i].pstName == NULL)
+     {
+         sciprint(_("Optional argument list is empty.\n"));
+         return;
+     }
+     sciprint(_("Optional arguments list: \n"));
+     while (opts[i + 1].pstName != NULL)
+     {
+         sciprint("%s, ", opts[i].pstName);
+         i++;
+     }
+     sciprint(_("and %s.\n"), opts[i].pstName);
+ }
@@@ -12,7 -12,7 +12,6 @@@
  
  #include <math.h>
  #include <string.h>
--#include "stack-c.h"
  #include "isanan.h"
  #include "core_math.h"
  #include "gw_arnoldi.h"
  #ifndef __GW_BOOLEAN__
  #define __GW_BOOLEAN__
  /*--------------------------------------------------------------------------*/
--#include "machine.h"
- #include "api_scilab.h"
 -/*--------------------------------------------------------------------------*/
 -int gw_boolean(void);
 +#include "c_gateway_prototype.h"
 +#include "dynlib_boolean.h"
- #include "dynlib_boolean_gw.h"
  /*--------------------------------------------------------------------------*/
 -int sci_or(char *fname,unsigned long fname_len);
 -int sci_and(char *fname,unsigned long fname_len);
 -int C2F(sci_find)(char *fname,unsigned long fname_len);
 -int C2F(sci_bool2s)(char *fname,unsigned long fname_len);
 +C_GATEWAY_PROTOTYPE(sci_or);
 +C_GATEWAY_PROTOTYPE(sci_and);
  /*--------------------------------------------------------------------------*/
  #endif /*  __GW_BOOLEAN__ */
  /*--------------------------------------------------------------------------*/
@@@ -15,7 -15,7 +15,6 @@@
  #define __GW_CONSOLE_H__
  /*--------------------------------------------------------------------------*/
  #include "dynlib_console.h"
--#include "api_scilab.h"
  /*--------------------------------------------------------------------------*/
  CONSOLE_IMPEXP int gw_console(void);
  /*--------------------------------------------------------------------------*/
@@@ -36,10 -35,10 +36,10 @@@ int sci_getdebuginfo(char *fname, void
        CheckLhs(0,2);
  
  #ifdef _MSC_VER
-       outputDynamicList = getDynamicDebugInfo_Windows(&m1, pvApiCtx);
+       outputDynamicList = getDynamicDebugInfo_Windows(&m1);
        outputStaticList = getStaticDebugInfo_Windows(&m2);
  #else
 -      outputDynamicList = getDynamicDebugInfo(&m1);
 +      outputDynamicList = getDynamicDebugInfo(&m1, pvApiCtx);
        outputStaticList = getStaticDebugInfo(&m2);
  #endif
  
   *
   */
  #include "gw_core.h"
--#include "stack-c.h"
 +#include "api_scilab.h"
  /*--------------------------------------------------------------------------*/
 -int C2F(sci_type)(char *fname,unsigned long fname_len)
 +int sci_type(char *fname, void* pvApiCtx)
  {
 -      int iType = 0;
 -      int l = 0, lc = 0;
 -      int one = 1;
 -      int zero = 0;
 +      SciErr sciErr;
 +      int* piAddr     = NULL;
 +      int iType               = 0;
 +      int iRet = 0;
  
        CheckRhs(1,1);
 -      CheckLhs(1,2); 
 -      
 -      iType = GetType(1);
 -      if (! C2F(cremat)(fname, &Top, &zero, &one, &one, &l, &lc, fname_len)) return 0;
 -      *stk(l) = (double) iType;
 +      CheckLhs(1,1);
  
 +      sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      sciErr = getVarType(pvApiCtx, piAddr, &iType);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      iRet = createMatrixOfDoubleFromInteger(pvApiCtx, Rhs + 1, 1, 1, &iType);
 +      if(iRet)
 +      {
 +              return 0;
 +      }
 +
 +      LhsVar(1) = Rhs + 1;
 +      PutLhsVar();
        return 0;
  }
  /*--------------------------------------------------------------------------*/
@@@ -40,7 -40,7 +40,6 @@@ char **getDynamicDebugInfo_Windows(int 
  #define WIDTH 7
  #define BUFFER_LEN 255
  
--    SciErr sciErr;
      int nb_info = 0;
      char *str_info = NULL;
      char **outputDynamicList = NULL;
  #include <stdio.h>
  #include <math.h>
  #include <stdlib.h>
--#include "stack-c.h"
++#include "api_scilab.h"
  #include "getval.h"
  #include "parserConstant.h"
+ #include "localization.h"
 -#include "warningmode.h"
++#include "sci_warning.h"
++#include "sciprint.h"
  /* Table of constant values */
  #define EXPMAX 309
  #define EXPMIN -324
@@@ -159,217 -160,272 +161,272 @@@ extern int C2F(fortrangetch)()
  
  int C2F(getval)(double *s, int *dotdet)
  {
-   /* Initialized constants */
-   static double toto = 0.;
-   static double c10 = 10.;
 -    /* Initialized constants */
 -    static double toto = 0.;
 -    static double c10 = 10.;
++    ///* Initialized constants */
++    //static double toto = 0.;
++    //static double c10 = 10.;
  
-   /* Local variables */
-   static int expo;
-   static int code0;
-   static int i, k;
-   static int digit[25], ndgrec;
-   static int detdot;
-   static int ndgexp, expcor, sgnexp;
-   static char string[31];
-   static int ndg;
 -    /* Local variables */
 -    static int expo;
 -    static int code0;
 -    static int i, k;
 -    static int digit[25], ndgrec;
 -    static int detdot;
 -    static int ndgexp, expcor, sgnexp;
 -    static char string[31];
 -    static int ndg;
++    ///* Local variables */
++    //static int expo;
++    //static int code0;
++    //static int i, k;
++    //static int digit[25], ndgrec;
++    //static int detdot;
++    //static int ndgexp, expcor, sgnexp;
++    //static char string[31];
++    //static int ndg;
  
-   /* System generated locals */
-   static double d1;
-   int i1;
 -    /* System generated locals */
 -    static double d1;
 -    int i1;
++    ///* System generated locals */
++    //static double d1;
++    //int i1;
  
-   Fin = 0;
-   /*     beginning of the code */
-   detdot = *dotdet;
-   ndg = 0;
-   ndgrec = 0;
-   if (! detdot) {
-     /*  1) got the int part of the mantissa of the pattern
-       1-a) may be there is some 0 at the beginning */
-     while(C2F(com).char1 == 0) {
-       C2F(fortrangetch)();
-     }
-     /* 1-b) now record the digits (inside the digit array) 
-        (but we record a maximum of ndgmax digits)*/
-     while(abs(C2F(com).char1) <= 9) {
-       ++ndg;
-       if (ndgrec < 25) {
-       ++ndgrec;
-       digit[ndgrec - 1] = C2F(com).char1;
-       }
-       C2F(fortrangetch)();
-     }
-     /*1-c) at this point we have detected something which is not a digit 
-            may be a point, may be a d,D,e,E, or something else 
-            here we only test for the dot and let the others cases
-          to be treated after ... */
-     if (abs(C2F(com).char1) == dot) {
-       detdot = TRUE;
-       C2F(fortrangetch)();
-     }
-   }
-   /*first correction for the (future) exponent : if the first part 
-     of the string have more then ndgmax digits we have to add 
-     ndg - ndgrec (else we have expcor=0) */
-   expcor = ndg - ndgrec;
-   if (detdot) {
-     /*2) got the "fractionnal" part of the "mantissa" */
-     if (ndgrec == 0) {
-       /*we have not passed throw the part 1) or only zeros have been met
-       and may be the number start with .000xxx : so clean up those 0 */
-       while(C2F(com).char1 == 0) {
-       --expcor;
-       C2F(fortrangetch)();
-       }
-     }
-     /*now we begin to record the digits */
-     while(abs(C2F(com).char1) <= 9) {
-       if (ndgrec < 25) {
-       ++ndgrec;
-       --expcor;
-       digit[ndgrec - 1] = C2F(com).char1;
-       }
-       C2F(fortrangetch)();
-     }
-   }
-   /*3) at this point the "mantissa" of the string decimal number
-     must be recorded, now detect the exponent */
-   expo = 0;
-   ndgexp = 0;
-   sgnexp = plus;
-   if (abs(C2F(com).char1) == D || abs(C2F(com).char1) == E) {
-     /*the string have an exponent part (which, in Scilab, may be empty or 
-       may had only a sign ! => expo = 0) */
-     C2F(fortrangetch)();
-     if (C2F(com).char1 == minus || C2F(com).char1 == plus) {
-       sgnexp = C2F(com).char1;
-       C2F(fortrangetch)();
-     } else {
-       sgnexp = plus;
-     }
-     /*may be the exponent start by some 0 */
-     while(C2F(com).char1 == 0) {
-       C2F(fortrangetch)();
-     }
-     /*now form the exponent : the var ndgexp is here
-       to treat spurious int overflow ... */
-     while(abs(C2F(com).char1) <= 9) {
-       expo = expo * 10 + C2F(com).char1;
-       ++ndgexp;
-       C2F(fortrangetch)();
-     }
-   }
-   /*4) Now we can form the double float number s
-     4-1/ only zeros in the mantissa */
-   if (ndgrec == 0) {
-     /*no digits have been recorded : this is the case
-       when the mantissa part is of the form [000][.][000] 
-       the number is 0 */
-     *s = 0.;
-     return 0;
-   }
-   /*4-2/ ndgexp is to large => the exponent expo is perhaps badly 
-     computed (int "overflow") or in all cases the 
-     exponent is too large (positive or negative) such that it result 
-     (for s) in an overflow or underflow depending the exponent sign */
-   if (ndgexp >= NDEMAX) {
-     if (sgnexp == minus) {/*underflow */
-       *s = 0.;
-     } else {/*overflow : got an inf ... */
-       *s = 1. / (toto - toto);
-     }
-     return 0;
-   }
-   /*4-3/ now build the final exponent */
-   if (sgnexp == plus) {
-     expo += expcor;
-   } else {
-     expo = -expo + expcor;
-   }
-   /*4-4/ here some tests to avoid unnecessary call to  "strtod"
-     Now we have a number s of the form  d_1 d_2 ... d_ndgrec 10^expo
-     which is equal to d_1 . d_2 ... d_ndgrec 10^(expo + ndgrec - 1) 
-     with d_1 .ne. 0 
-     so it comes :  s >= 10^(expo + ndgrec - 1)
-     s <= 10^(expo + ndgrec) 
 -    Fin = 0;
 -    /*     beginning of the code */
 -    detdot = *dotdet;
 -    ndg = 0;
 -    ndgrec = 0;
 -    if (! detdot)
 -    {
 -        /*  1) got the int part of the mantissa of the pattern
 -          1-a) may be there is some 0 at the beginning */
 -        while (C2F(com).char1 == 0)
 -        {
 -            C2F(fortrangetch)();
 -        }
 -        /* 1-b) now record the digits (inside the digit array)
 -           (but we record a maximum of ndgmax digits)*/
 -        while (abs(C2F(com).char1) <= 9)
 -        {
 -            ++ndg;
 -            if (ndgrec < 25)
 -            {
 -                ++ndgrec;
 -                digit[ndgrec - 1] = C2F(com).char1;
 -            }
 -            C2F(fortrangetch)();
 -        }
 -        /*1-c) at this point we have detected something which is not a digit
 -               may be a point, may be a d,D,e,E, or something else
 -               here we only test for the dot and let the others cases
 -           to be treated after ... */
 -        if (abs(C2F(com).char1) == dot)
 -        {
 -            detdot = TRUE;
 -            C2F(fortrangetch)();
 -            if (getWarningMode())
 -            {
 -                if ((abs(C2F(com).char1) == slash) || (abs(C2F(com).char1) == bchar_slash))
 -                {
 -                    int v = 0;
++    //Fin = 0;
++    ///*     beginning of the code */
++    //detdot = *dotdet;
++    //ndg = 0;
++    //ndgrec = 0;
++    //if (! detdot)
++    //{
++    //    /*  1) got the int part of the mantissa of the pattern
++    //      1-a) may be there is some 0 at the beginning */
++    //    while (C2F(com).char1 == 0)
++    //    {
++    //        C2F(fortrangetch)();
++    //    }
++    //    /* 1-b) now record the digits (inside the digit array)
++    //       (but we record a maximum of ndgmax digits)*/
++    //    while (abs(C2F(com).char1) <= 9)
++    //    {
++    //        ++ndg;
++    //        if (ndgrec < 25)
++    //        {
++    //            ++ndgrec;
++    //            digit[ndgrec - 1] = C2F(com).char1;
++    //        }
++    //        C2F(fortrangetch)();
++    //    }
++    //    /*1-c) at this point we have detected something which is not a digit
++    //           may be a point, may be a d,D,e,E, or something else
++    //           here we only test for the dot and let the others cases
++    //       to be treated after ... */
++    //    if (abs(C2F(com).char1) == dot)
++    //    {
++    //        detdot = TRUE;
++    //        C2F(fortrangetch)();
++    //        if (getWarningMode())
++    //        {
++    //            if ((abs(C2F(com).char1) == slash) || (abs(C2F(com).char1) == bchar_slash))
++    //            {
++    //                int v = 0;
  
-     Suppose given EXPMAX such that  10^EXPMAX > max positive float number 
-     and EXPMIN such that  10^EXPMIN < min positive float number 
 -                    for (i = 0; i < ndgrec; ++i)
 -                    {
 -                        v = v * 10 + digit[i];
 -                    }
 -                    if (abs(C2F(com).char1) == slash)
 -                        sciprint(_("%s: \"%d.%s ...\" is interpreted as \"%d.0%s ...\". Use \"%d .%s ...\" for element wise operation \n") ,
 -                                 "Warning", v, "/", v, "/", v, "/");
 -                    else
 -                        sciprint(_("%s: \"%d.%s ...\" is interpreted as \"%d.0%s ...\". Use \"%d .%s ...\" for element wise operation \n") ,
 -                                 "Warning", v, "\\", v, "\\", v, "\\");
 -                }
 -            }
 -        }
 -    }
 -    /*first correction for the (future) exponent : if the first part
 -      of the string have more then ndgmax digits we have to add
 -      ndg - ndgrec (else we have expcor=0) */
 -    expcor = ndg - ndgrec;
 -    if (detdot)
 -    {
 -        /*2) got the "fractionnal" part of the "mantissa" */
 -        if (ndgrec == 0)
 -        {
 -            /*we have not passed throw the part 1) or only zeros have been met
 -            and may be the number start with .000xxx : so clean up those 0 */
 -            while (C2F(com).char1 == 0)
 -            {
 -                --expcor;
 -                C2F(fortrangetch)();
 -            }
 -        }
 -        /*now we begin to record the digits */
 -        while (abs(C2F(com).char1) <= 9)
 -        {
 -            if (ndgrec < 25)
 -            {
 -                ++ndgrec;
 -                --expcor;
 -                digit[ndgrec - 1] = C2F(com).char1;
 -            }
 -            C2F(fortrangetch)();
 -        }
 -    }
 -    /*3) at this point the "mantissa" of the string decimal number
 -      must be recorded, now detect the exponent */
 -    expo = 0;
 -    ndgexp = 0;
 -    sgnexp = plus;
 -    if (abs(C2F(com).char1) == D || abs(C2F(com).char1) == E)
 -    {
 -        /*the string have an exponent part (which, in Scilab, may be empty or
 -          may had only a sign ! => expo = 0) */
 -        C2F(fortrangetch)();
 -        if (C2F(com).char1 == minus || C2F(com).char1 == plus)
 -        {
 -            sgnexp = C2F(com).char1;
 -            C2F(fortrangetch)();
 -        }
 -        else
 -        {
 -            sgnexp = plus;
 -        }
 -        /*may be the exponent start by some 0 */
 -        while (C2F(com).char1 == 0)
 -        {
 -            C2F(fortrangetch)();
 -        }
 -        /*now form the exponent : the var ndgexp is here
 -          to treat spurious int overflow ... */
 -        while (abs(C2F(com).char1) <= 9)
 -        {
 -            expo = expo * 10 + C2F(com).char1;
 -            ++ndgexp;
 -            C2F(fortrangetch)();
 -        }
 -    }
 -    /*4) Now we can form the double float number s
 -      4-1/ only zeros in the mantissa */
 -    if (ndgrec == 0)
 -    {
 -        /*no digits have been recorded : this is the case
 -          when the mantissa part is of the form [000][.][000]
 -          the number is 0 */
 -        *s = 0.;
 -        return 0;
 -    }
 -    /*4-2/ ndgexp is to large => the exponent expo is perhaps badly
 -      computed (int "overflow") or in all cases the
 -      exponent is too large (positive or negative) such that it result
 -      (for s) in an overflow or underflow depending the exponent sign */
 -    if (ndgexp >= NDEMAX)
 -    {
 -        if (sgnexp == minus)  /*underflow */
 -        {
 -            *s = 0.;
 -        }
 -        else    /*overflow : got an inf ... */
 -        {
 -            *s = 1. / (toto - toto);
 -        }
 -        return 0;
 -    }
 -    /*4-3/ now build the final exponent */
 -    if (sgnexp == plus)
 -    {
 -        expo += expcor;
 -    }
 -    else
 -    {
 -        expo = -expo + expcor;
 -    }
 -    /*4-4/ here some tests to avoid unnecessary call to  "strtod"
 -      Now we have a number s of the form  d_1 d_2 ... d_ndgrec 10^expo
 -      which is equal to d_1 . d_2 ... d_ndgrec 10^(expo + ndgrec - 1)
 -      with d_1 .ne. 0
 -      so it comes :  s >= 10^(expo + ndgrec - 1)
 -      s <= 10^(expo + ndgrec)
++    //                for (i = 0; i < ndgrec; ++i)
++    //                {
++    //                    v = v * 10 + digit[i];
++    //                }
++    //                if (abs(C2F(com).char1) == slash)
++    //                    sciprint(_("%s: \"%d.%s ...\" is interpreted as \"%d.0%s ...\". Use \"%d .%s ...\" for element wise operation \n") ,
++    //                             "Warning", v, "/", v, "/", v, "/");
++    //                else
++    //                    sciprint(_("%s: \"%d.%s ...\" is interpreted as \"%d.0%s ...\". Use \"%d .%s ...\" for element wise operation \n") ,
++    //                             "Warning", v, "\\", v, "\\", v, "\\");
++    //            }
++    //        }
++    //    }
++    //}
++    ///*first correction for the (future) exponent : if the first part
++    //  of the string have more then ndgmax digits we have to add
++    //  ndg - ndgrec (else we have expcor=0) */
++    //expcor = ndg - ndgrec;
++    //if (detdot)
++    //{
++    //    /*2) got the "fractionnal" part of the "mantissa" */
++    //    if (ndgrec == 0)
++    //    {
++    //        /*we have not passed throw the part 1) or only zeros have been met
++    //        and may be the number start with .000xxx : so clean up those 0 */
++    //        while (C2F(com).char1 == 0)
++    //        {
++    //            --expcor;
++    //            C2F(fortrangetch)();
++    //        }
++    //    }
++    //    /*now we begin to record the digits */
++    //    while (abs(C2F(com).char1) <= 9)
++    //    {
++    //        if (ndgrec < 25)
++    //        {
++    //            ++ndgrec;
++    //            --expcor;
++    //            digit[ndgrec - 1] = C2F(com).char1;
++    //        }
++    //        C2F(fortrangetch)();
++    //    }
++    //}
++    ///*3) at this point the "mantissa" of the string decimal number
++    //  must be recorded, now detect the exponent */
++    //expo = 0;
++    //ndgexp = 0;
++    //sgnexp = plus;
++    //if (abs(C2F(com).char1) == D || abs(C2F(com).char1) == E)
++    //{
++    //    /*the string have an exponent part (which, in Scilab, may be empty or
++    //      may had only a sign ! => expo = 0) */
++    //    C2F(fortrangetch)();
++    //    if (C2F(com).char1 == minus || C2F(com).char1 == plus)
++    //    {
++    //        sgnexp = C2F(com).char1;
++    //        C2F(fortrangetch)();
++    //    }
++    //    else
++    //    {
++    //        sgnexp = plus;
++    //    }
++    //    /*may be the exponent start by some 0 */
++    //    while (C2F(com).char1 == 0)
++    //    {
++    //        C2F(fortrangetch)();
++    //    }
++    //    /*now form the exponent : the var ndgexp is here
++    //      to treat spurious int overflow ... */
++    //    while (abs(C2F(com).char1) <= 9)
++    //    {
++    //        expo = expo * 10 + C2F(com).char1;
++    //        ++ndgexp;
++    //        C2F(fortrangetch)();
++    //    }
++    //}
++    ///*4) Now we can form the double float number s
++    //  4-1/ only zeros in the mantissa */
++    //if (ndgrec == 0)
++    //{
++    //    /*no digits have been recorded : this is the case
++    //      when the mantissa part is of the form [000][.][000]
++    //      the number is 0 */
++    //    *s = 0.;
++    //    return 0;
++    //}
++    ///*4-2/ ndgexp is to large => the exponent expo is perhaps badly
++    //  computed (int "overflow") or in all cases the
++    //  exponent is too large (positive or negative) such that it result
++    //  (for s) in an overflow or underflow depending the exponent sign */
++    //if (ndgexp >= NDEMAX)
++    //{
++    //    if (sgnexp == minus)  /*underflow */
++    //    {
++    //        *s = 0.;
++    //    }
++    //    else    /*overflow : got an inf ... */
++    //    {
++    //        *s = 1. / (toto - toto);
++    //    }
++    //    return 0;
++    //}
++    ///*4-3/ now build the final exponent */
++    //if (sgnexp == plus)
++    //{
++    //    expo += expcor;
++    //}
++    //else
++    //{
++    //    expo = -expo + expcor;
++    //}
++    ///*4-4/ here some tests to avoid unnecessary call to  "strtod"
++    //  Now we have a number s of the form  d_1 d_2 ... d_ndgrec 10^expo
++    //  which is equal to d_1 . d_2 ... d_ndgrec 10^(expo + ndgrec - 1)
++    //  with d_1 .ne. 0
++    //  so it comes :  s >= 10^(expo + ndgrec - 1)
++    //  s <= 10^(expo + ndgrec)
  
-     then if  expo + ndgrec - 1 >= EXPMAX then overflow occurs necessarily 
-     and  if  expo + ndgrec <= EXPMIN then underflow occurs 
 -      Suppose given EXPMAX such that  10^EXPMAX > max positive float number
 -      and EXPMIN such that  10^EXPMIN < min positive float number
++    //  Suppose given EXPMAX such that  10^EXPMAX > max positive float number
++    //  and EXPMIN such that  10^EXPMIN < min positive float number
  
-     On IEEE 754 we have : max positive float num = (approx) 1.8E+308 
-     min positive float num = (approx) 4.9EEXPMIN 
-     (if denormalised number are used) 
 -      then if  expo + ndgrec - 1 >= EXPMAX then overflow occurs necessarily
 -      and  if  expo + ndgrec <= EXPMIN then underflow occurs
++    //  then if  expo + ndgrec - 1 >= EXPMAX then overflow occurs necessarily
++    //  and  if  expo + ndgrec <= EXPMIN then underflow occurs
  
-     So that EXPMAX = 309 
-     and  EXPMIN = -324  are OK (but larger limits are possible to take 
-     into account others f.p. arithmetics) 
-     Note that after the test (with these values) the exponent have a 
-     maximum of 3 (decimals) digits */
-   if (expo + ndgrec - 1 >= EXPMAX) {/*overflow : got an inf ... */
-     *s = 1. / (toto - toto);
-     return 0;
-   }
-   if (expo + ndgrec <= EXPMIN) { /*underflow : got an 0 */
-     *s = 0.;
-     return 0;
-   }
-   /*4-5/ Now the usual case where we can get the near floating point
-     without any problem */
-   if (ndgrec <= DGLIM && abs(expo) <= EXPLIM) {
-     *s = 0.;
-     i1 = ndgrec;
-     for (i = 1; i <= i1; ++i) {
-       *s = *s * 10. + digit[i - 1];
-     }
-     if (expo < 0) {
-       d1 = -expo;
-       *s /= pow(c10, d1);
-     } else {
-        d1 = expo;
-       *s *= pow(c10, d1);
-     }
-     return 0;
-   }
-   /*4-6/ The other easy case where we can compute s : 
-     if expo = EXPLIM + k  but [int part]*10^k < max_int_coded_in_double 
-     then it is OK (retrieve k in the exponent and multiply the int 
-     part by 10^k and do the same job as previus) */
-   if (expo > EXPLIM && expo - EXPLIM + ndgrec <= DGLIM) {
-     *s = 0.;
-     i1 = ndgrec;
-     for (i = 1; i <= i1; ++i) {
-       *s = *s * 10. + digit[i - 1];
-     }
-     /*peut etre dangereux avec des options d'optimisation ? 
-       (le compilo peut etre tente d'ecrire directement s = s*10**expo 
-       ce qui detruit le truc ...) */
-     /*         s = s*10.d0**(expo-EXPLIM)
-              s = s*10.d0**EXPLIM*/
 -      On IEEE 754 we have : max positive float num = (approx) 1.8E+308
 -      min positive float num = (approx) 4.9EEXPMIN
 -      (if denormalised number are used)
++    //  On IEEE 754 we have : max positive float num = (approx) 1.8E+308
++    //  min positive float num = (approx) 4.9EEXPMIN
++    //  (if denormalised number are used)
 -      So that EXPMAX = 309
 -      and  EXPMIN = -324  are OK (but larger limits are possible to take
 -      into account others f.p. arithmetics)
 -      Note that after the test (with these values) the exponent have a
 -      maximum of 3 (decimals) digits */
 -    if (expo + ndgrec - 1 >= EXPMAX)  /*overflow : got an inf ... */
 -    {
 -        *s = 1. / (toto - toto);
 -        return 0;
 -    }
 -    if (expo + ndgrec <= EXPMIN)   /*underflow : got an 0 */
 -    {
 -        *s = 0.;
 -        return 0;
 -    }
 -    /*4-5/ Now the usual case where we can get the near floating point
 -      without any problem */
 -    if (ndgrec <= DGLIM && abs(expo) <= EXPLIM)
 -    {
 -        *s = 0.;
 -        i1 = ndgrec;
 -        for (i = 1; i <= i1; ++i)
 -        {
 -            *s = *s * 10. + digit[i - 1];
 -        }
 -        if (expo < 0)
 -        {
 -            d1 = -expo;
 -            *s /= pow(c10, d1);
 -        }
 -        else
 -        {
 -            d1 = expo;
 -            *s *= pow(c10, d1);
 -        }
 -        return 0;
 -    }
 -    /*4-6/ The other easy case where we can compute s :
 -      if expo = EXPLIM + k  but [int part]*10^k < max_int_coded_in_double
 -      then it is OK (retrieve k in the exponent and multiply the int
 -      part by 10^k and do the same job as previus) */
 -    if (expo > EXPLIM && expo - EXPLIM + ndgrec <= DGLIM)
 -    {
 -        *s = 0.;
 -        i1 = ndgrec;
 -        for (i = 1; i <= i1; ++i)
 -        {
 -            *s = *s * 10. + digit[i - 1];
 -        }
 -        /*peut etre dangereux avec des options d'optimisation ?
 -          (le compilo peut etre tente d'ecrire directement s = s*10**expo
 -          ce qui detruit le truc ...) */
 -        /*         s = s*10.d0**(expo-EXPLIM)
 -               s = s*10.d0**EXPLIM*/
++    //  So that EXPMAX = 309
++    //  and  EXPMIN = -324  are OK (but larger limits are possible to take
++    //  into account others f.p. arithmetics)
++    //  Note that after the test (with these values) the exponent have a
++    //  maximum of 3 (decimals) digits */
++    //if (expo + ndgrec - 1 >= EXPMAX)  /*overflow : got an inf ... */
++    //{
++    //    *s = 1. / (toto - toto);
++    //    return 0;
++    //}
++    //if (expo + ndgrec <= EXPMIN)   /*underflow : got an 0 */
++    //{
++    //    *s = 0.;
++    //    return 0;
++    //}
++    ///*4-5/ Now the usual case where we can get the near floating point
++    //  without any problem */
++    //if (ndgrec <= DGLIM && abs(expo) <= EXPLIM)
++    //{
++    //    *s = 0.;
++    //    i1 = ndgrec;
++    //    for (i = 1; i <= i1; ++i)
++    //    {
++    //        *s = *s * 10. + digit[i - 1];
++    //    }
++    //    if (expo < 0)
++    //    {
++    //        d1 = -expo;
++    //        *s /= pow(c10, d1);
++    //    }
++    //    else
++    //    {
++    //        d1 = expo;
++    //        *s *= pow(c10, d1);
++    //    }
++    //    return 0;
++    //}
++    ///*4-6/ The other easy case where we can compute s :
++    //  if expo = EXPLIM + k  but [int part]*10^k < max_int_coded_in_double
++    //  then it is OK (retrieve k in the exponent and multiply the int
++    //  part by 10^k and do the same job as previus) */
++    //if (expo > EXPLIM && expo - EXPLIM + ndgrec <= DGLIM)
++    //{
++    //    *s = 0.;
++    //    i1 = ndgrec;
++    //    for (i = 1; i <= i1; ++i)
++    //    {
++    //        *s = *s * 10. + digit[i - 1];
++    //    }
++    //    /*peut etre dangereux avec des options d'optimisation ?
++    //      (le compilo peut etre tente d'ecrire directement s = s*10**expo
++    //      ce qui detruit le truc ...) */
++    //    /*         s = s*10.d0**(expo-EXPLIM)
++    //           s = s*10.d0**EXPLIM*/
  
-     d1 = (double)(expo - EXPLIM);
-     *s *= pow(c10,d1);
-     d1 = (double) EXPLIM;
-     *s *= pow(c10, d1);
 -        d1 = (double)(expo - EXPLIM);
 -        *s *= pow(c10, d1);
 -        d1 = (double) EXPLIM;
 -        *s *= pow(c10, d1);
++    //    d1 = (double)(expo - EXPLIM);
++    //    *s *= pow(c10, d1);
++    //    d1 = (double) EXPLIM;
++    //    *s *= pow(c10, d1);
  
 -        return 0;
 -    }
 -    /*4-7/ else use langage routines to do the job
 -      the overhead is a retranslation into a string... */
 -    code0 = '0';
 -    i1 = ndgrec;
 -    for (i = 1; i <= i1; ++i)
 -    {
 -        *(unsigned char *)&string[i - 1] = (char) (digit[i - 1] + code0);
 -    }
 -    i1 = ndgrec;
 -    if (expo < 0)
 -    {
 -        sprintf(string + i1, ".e-%d", abs(expo));
 -    }
 -    else
 -    {
 -        sprintf(string + i1, ".e+%d", abs(expo));
 -    }
 -    k = ndgrec + 4;
 -    *s = strtod(string, NULL);
++    //    return 0;
++    //}
++    ///*4-7/ else use langage routines to do the job
++    //  the overhead is a retranslation into a string... */
++    //code0 = '0';
++    //i1 = ndgrec;
++    //for (i = 1; i <= i1; ++i)
++    //{
++    //    *(unsigned char *)&string[i - 1] = (char) (digit[i - 1] + code0);
++    //}
++    //i1 = ndgrec;
++    //if (expo < 0)
++    //{
++    //    sprintf(string + i1, ".e-%d", abs(expo));
++    //}
++    //else
++    //{
++    //    sprintf(string + i1, ".e+%d", abs(expo));
++    //}
++    //k = ndgrec + 4;
++    //*s = strtod(string, NULL);
      return 0;
-   }
-   /*4-7/ else use langage routines to do the job
-     the overhead is a retranslation into a string... */
-   code0 = '0';
-   i1 = ndgrec;
-   for (i = 1; i <= i1; ++i) {
-     *(unsigned char *)&string[i - 1] = (char) (digit[i - 1] + code0);
-   }
-   i1 = ndgrec;
-   if (expo < 0) {
-     sprintf(string+i1,".e-%d",abs(expo));
-   } else {
-     sprintf(string+i1,".e+%d",abs(expo));
-   }
-   k = ndgrec + 4;
-   *s=strtod(string,NULL);
-   return 0;
  }
  
@@@ -13,6 -13,6 +13,7 @@@
  #ifndef __GETVAL_H__
  #define __GETVAL_H__
  
++#include "machine.h"
  
  /**
   * @TODO add comment
@@@ -173,11 -148,12 +148,12 @@@ int sciReturnStringMatrix(void* _pvCtx
  /*--------------------------------------------------------------------------*/
  int sciReturnUserData(void* _pvCtx, const int * userData, int userDataSize)
  {
-   int * data_ptr = NULL ;
-   int data_size = (userDataSize + 1) / 2 ;
-   SetWorkSize(Rhs+1,&data_size);
-   data_ptr = GetRawData(Rhs+1);
-   memcpy(data_ptr, userData, userDataSize * sizeof (int));
-   return 0 ;
+     /*NOT COMPATIBLE WITH SCILAB 6*/
 -    int * data_ptr = NULL ;
 -    int data_size = (userDataSize + 1) / 2 ;
 -    SetWorkSize(Rhs + 1, &data_size);
 -    data_ptr = (int*)GetRawData(Rhs + 1);
 -    memcpy(data_ptr, userData, userDataSize * sizeof (int));
++    //int * data_ptr = NULL ;
++    //int data_size = (userDataSize + 1) / 2 ;
++    //SetWorkSize(nbInputArgument(_pvCtx) + 1, &data_size);
++    //data_ptr = (int*)GetRawData(nbInputArgument(_pvCtx) + 1);
++    //memcpy(data_ptr, userData, userDataSize * sizeof (int));
+     return 0 ;
  }
  /*--------------------------------------------------------------------------*/
@@@ -166,12 -206,14 +166,12 @@@ int C2F(firstopt) (void
  
  int C2F(findopt) (char *str, rhs_opts opts[])
  {
--    int i;
++    //int i;
  
--    i = rhs_opt_find(str, opts);
--    if (i >= 0)
-         if (opts[i].position > 0)
-             return opts[i].position;
 -        if (opts[i].iPos > 0)
 -        {
 -            return opts[i].iPos;
 -        }
++    //i = rhs_opt_find(str, opts);
++    //if (i >= 0)
++    //    if (opts[i].position > 0)
++    //        return opts[i].position;
  
      return 0;
  }
@@@ -369,25 -412,25 +369,25 @@@ int rhs_opt_find(char *name, rhs_opts o
  {
      int rep = -1, i = 0;
  
-     while (opts[i].name != NULL)
-     {
-         int cmp;
 -    while (opts[i].pstName != NULL)
 -    {
 -        int cmp;
 -
 -        /* name is terminated by white space and we want to ignore them */
 -        if ((cmp = strcmp(name, opts[i].pstName)) == 0)
 -        {
 -            rep = i;
 -            break;
 -        }
 -        else if (cmp < 0)
 -        {
 -            break;
 -        }
 -        else
 -        {
 -            i++;
 -        }
 -    }
++    //while (opts[i].name != NULL)
++    //{
++    //    int cmp;
 +
-         /* name is terminated by white space and we want to ignore them */
-         if ((cmp = strcmp(name, opts[i].name)) == 0)
-         {
-             rep = i;
-             break;
-         }
-         else if (cmp < 0)
-         {
-             break;
-         }
-         else
-         {
-             i++;
-         }
-     }
++    //    /* name is terminated by white space and we want to ignore them */
++    //    if ((cmp = strcmp(name, opts[i].name)) == 0)
++    //    {
++    //        rep = i;
++    //        break;
++    //    }
++    //    else if (cmp < 0)
++    //    {
++    //        break;
++    //    }
++    //    else
++    //    {
++    //        i++;
++    //    }
++    //}
      return rep;
  }
  
@@@ -395,20 -438,20 +395,20 @@@ void rhs_opt_print_names(rhs_opts opts[
  /* array of optinal names (in alphabetical order)
  * the array is null terminated */
  {
--    int i = 0;
++    //int i = 0;
  
-     if (opts[i].name == NULL)
-     {
-         sciprint(_("Optional argument list is empty.\n"));
-         return;
-     }
-     sciprint(_("Optional arguments list: \n"));
-     while (opts[i + 1].name != NULL)
-     {
-         sciprint("%s, ", opts[i].name);
-         i++;
-     }
-     sciprint(_("and %s.\n"), opts[i].name);
 -    if (opts[i].pstName == NULL)
 -    {
 -        sciprint(_("Optional argument list is empty.\n"));
 -        return;
 -    }
 -    sciprint(_("Optional arguments list: \n"));
 -    while (opts[i + 1].pstName != NULL)
 -    {
 -        sciprint("%s, ", opts[i].pstName);
 -        i++;
 -    }
 -    sciprint(_("and %s.\n"), opts[i].pstName);
++    //if (opts[i].name == NULL)
++    //{
++    //    sciprint(_("Optional argument list is empty.\n"));
++    //    return;
++    //}
++    //sciprint(_("Optional arguments list: \n"));
++    //while (opts[i + 1].name != NULL)
++    //{
++    //    sciprint("%s, ", opts[i].name);
++    //    i++;
++    //}
++    //sciprint(_("and %s.\n"), opts[i].name);
  }
  
  /*---------------------------------------------------------------------
   * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
   *
   */
 -/*--------------------------------------------------------------------------*/ 
 -#include "gw_elementary_functions.h"
  /*--------------------------------------------------------------------------*/
 -extern int C2F(intnearfl)(int *id);
 -/*--------------------------------------------------------------------------*/
 -int sci_nearfloat(char *fname,unsigned long fname_len)
++#include <string.h>
 +#include "gw_elementary_functions.h"
- #include "stack-c.h"
 +#include "basic_functions.h"
 +#include "api_scilab.h"
 +#include "Scierror.h"
 +
 +
 +int sci_nearfloat(char *fname, void* pvApiCtx)
  {
 -      static int id[6];
 -      C2F(intnearfl)(id);
 +      SciErr sciErr;
 +      int i;
 +
 +      int* piAddr1                            = NULL;
 +      int iRows1                                      = 0;
 +      int iCols1                                      = 0;
 +      int iType1                                      = 0;
 +      int* piLen                                      = NULL;
 +      char **pstData                  = NULL;
 +
 +      int* piAddr2                            = NULL;
 +      int iRows2                                      = 0;
 +      int iCols2                                      = 0;
 +      int iType2                                      = 0;
 +      double *pdblReal                = NULL;
 +
 +      double dblMode                  = 0;
 +
 +      double *pdblRealRet     = NULL;
 +
 +
 +      CheckRhs(2,2);
 +      CheckLhs(1,1);
 +
 +      sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      sciErr = getVarType(pvApiCtx, piAddr1, &iType1);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      sciErr = getVarType(pvApiCtx, piAddr2, &iType2);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      if(iType1 != sci_strings)
 +      {
-               Err = 1;
++              //Err = 1;
 +              SciError(55);
 +              return 0;
 +      }
 +
 +      if(iType2 != sci_matrix)
 +      {
-               Err = 2;
++              //Err = 2;
 +              SciError(53);
 +              return 0;
 +      }
 +
 +      sciErr = getMatrixOfString(pvApiCtx, piAddr1, &iRows1, &iCols1, NULL, NULL);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      if(iRows1 != 1 || iCols1 != 1)
 +      {
 +              return 1;
 +      }
 +
 +      piLen = (int*)malloc(sizeof(int) * iRows1 * iCols1);
 +      sciErr = getMatrixOfString(pvApiCtx, piAddr1, &iRows1, &iCols1, piLen, NULL);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      pstData = (char**)malloc(sizeof(char*) * iRows1 * iCols1);
 +      for(i = 0 ; i < iRows1 * iCols1 ; i++)
 +      {
 +              pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+1 for null termination
 +      }
 +
 +      sciErr = getMatrixOfString(pvApiCtx, piAddr1, &iRows1, &iCols1, piLen, pstData);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows2, &iCols2, &pdblReal);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      if(strcmp(pstData[0], "succ") == 0)
 +      {
 +              dblMode = 1.0;
 +      }
 +      else if(strcmp(pstData[0], "pred") == 0)
 +      {
 +              dblMode = -1.0;
 +      }
 +      else
 +      {
 +              SciError(999);
 +              return 0;
 +      }
 +
 +      sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows2, iCols2, &pdblRealRet);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      for(i = 0 ; i < iRows2 * iCols2 ; i++)
 +      {
 +              pdblRealRet[i] = dblNearFloat(pdblReal[i], dblMode);
 +      }
 +
 +      free(piLen);
 +      for(i = 0 ; i < iRows1 * iCols1 ; i++)
 +      {
 +              free(pstData[i]);
 +      }
 +      free(pstData);
 +
 +      LhsVar(1) = Rhs + 1;
 +      PutLhsVar();
        return 0;
  }
  /*--------------------------------------------------------------------------*/
   * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
   *
   */
 -/*--------------------------------------------------------------------------*/ 
 -#include "gw_elementary_functions.h"
  /*--------------------------------------------------------------------------*/
 -extern int C2F(intnbprop)(int *id);
++#include <string.h>
 +#include "gw_elementary_functions.h"
- #include "stack-c.h"
 +#include "basic_functions.h"
 +#include "sciprint.h"
 +#include "localization.h"
 +#include "api_scilab.h"
 +#include "Scierror.h"
 +
  /*--------------------------------------------------------------------------*/
 -int sci_number_properties(char *fname,unsigned long fname_len)
 +int sci_number_properties(char *fname, void* pvApiCtx)
  {
 -      static int id[6];
 -      C2F(intnbprop)(id);
 +      SciErr sciErr;
 +      int i;
 +      int iRet                                = 0;
 +
 +      int iRows                               = 0;
 +      int iCols                               = 0;
 +      char **pstData  = NULL;
 +      int* piAddr                     = NULL;
 +
 +      double dblRet           = 0;
 +      int bRet                                = 0;
 +
 +      int bBoolFlag           = 0;
 +
 +      CheckRhs(1,1);
 +      CheckLhs(1,1);
 +
 +      sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      iRet = getAllocatedMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, &pstData);
 +      if(iRet)
 +      {
 +              freeAllocatedMatrixOfString(iRows, iCols, pstData);
 +              return 1;
 +      }
 +
 +      if(strcmp(pstData[0], "eps") == 0)
 +      {
 +              dblRet  = F2C(dlamch)("e",1L);
 +      }
 +      else if(strcmp(pstData[0], "huge") == 0)
 +      {
 +              dblRet  = F2C(dlamch)("oe",1L);
 +      }
 +      else if(strcmp(pstData[0], "tiny") == 0)
 +      {
 +              dblRet  = F2C(dlamch)("u",1L);
 +      }
 +      else if(strcmp(pstData[0], "radix") == 0)
 +      {
 +              dblRet  = F2C(dlamch)("b",1L);
 +      }
 +      else if(strcmp(pstData[0], "digits") == 0)
 +      {
 +              dblRet  = F2C(dlamch)("n",1L);
 +      }
 +      else if(strcmp(pstData[0], "minexp") == 0)
 +      {
 +              dblRet  = F2C(dlamch)("m",1L);
 +      }
 +      else if(strcmp(pstData[0], "maxexp") == 0)
 +      {
 +              dblRet  = F2C(dlamch)("l",1L);
 +      }
 +      else if(strcmp(pstData[0], "denorm") == 0)
 +      {
 +              bBoolFlag = 1;
 +              if(F2C(dlamch)("u",1L) / F2C(dlamch)("b",1L) > 0)
 +              {
 +                      bRet    = 1;
 +              }
 +              else
 +              {
 +                      bRet    = 0;
 +              }
 +      }
 +      else if(strcmp(pstData[0], "tiniest") == 0)
 +      {
 +              double dblRadix = F2C(dlamch)("b",1L);
 +              dblRet  = F2C(dlamch)("u",1L);
 +
 +              if(dblRet       / dblRadix != 0)
 +              {//denormalised number are used
 +                      int iDigits = (int)F2C(dlamch)("n",1L);
 +                      for(i = 1 ; i < iDigits ; i++)
 +                              dblRet  /= dblRadix;
 +              }
 +      }
 +      else
 +      {
 +              sciprint(_("%s: unknown property kind.\n"), fname);
 +              SciError(999);
 +              return 0;
 +      }
 +
 +      if(bBoolFlag)
 +      {
 +              iRet = createScalarBoolean(pvApiCtx, Rhs + 1, bRet);
 +      }
 +      else
 +      {
 +              iRet = createScalarDouble(pvApiCtx, Rhs + 1, dblRet);
 +      }
 +
 +      if(iRet)
 +      {
 +              return 1;
 +      }
 +
 +      LhsVar(1) = Rhs + 1;
 +      PutLhsVar();
        return 0;
  }
  /*--------------------------------------------------------------------------*/
   * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
   *
   */
 -/*--------------------------------------------------------------------------*/ 
 -#include "gw_elementary_functions.h"
  /*--------------------------------------------------------------------------*/
 -extern int C2F(intprod)(int *id);
 +#include "gw_elementary_functions.h"
- #include "stack-c.h"
 +#include "basic_functions.h"
 +#include "api_scilab.h"
 +#include "Scierror.h"
 +
  /*--------------------------------------------------------------------------*/
 -int sci_prod(char *fname,unsigned long fname_len)
 +int sci_prod(char *fname, void* pvApiCtx)
  {
 -      static int id[6];
 -      C2F(intprod)(id);
 +      SciErr sciErr;
 +      int iRows                                               = 0;
 +      int iCols                                               = 0;
 +      int*piAddr                                      = NULL;
 +      double* pdblReal                = NULL;
 +      double* pdblImg                 = NULL;
 +
 +      int iRowsRet                            = 0;
 +      int iColsRet                            = 0;
 +      double* pdblRealRet     = NULL;
 +      double* pdblImgRet      = NULL;
 +      int iMode                                               = 0;
 +
 +      CheckRhs(1,2);
 +      CheckLhs(1,1);
 +
 +      sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      if(Rhs == 2)
 +      {
 +              sciErr = getProcessMode(pvApiCtx, 2, piAddr, &iMode);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +      }
 +
 +      sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      if(iRows * iCols == 0)
 +      {
 +              double dblVal   = 0;
 +              if(iMode == 0)
 +              {
 +                      iRows = 1;
 +                      iCols = 1;
 +                      dblVal = 1;
 +              }
 +              else
 +              {
 +                      iRows = 0;
 +                      iCols = 0;
 +              }
 +
 +              sciErr = createMatrixOfDouble(pvApiCtx, Rhs + 1, 1, 1, &dblVal);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +
 +              LhsVar(1) = Rhs + 1;
 +              PutLhsVar();
 +              return 0;
 +      }
 +
 +      switch(iMode)
 +      {
 +      case BY_ROWS :
 +              iRowsRet = 1;
 +              iColsRet = iCols;
 +              break;
 +      case BY_COLS :
 +              iRowsRet = iRows;
 +              iColsRet = 1;
 +              break;
 +      default : //BY_ALL
 +              iRowsRet = 1;
 +              iColsRet = 1;
 +              break;
 +      }
 +
 +
 +      if(isVarComplex(pvApiCtx, piAddr))
 +      {
 +              sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +
 +              sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRowsRet, iColsRet, &pdblRealRet, &pdblImgRet);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +
 +              vWDmProd(iMode, pdblReal, pdblImg, iRows, iRows, iCols, pdblRealRet, pdblImgRet, 1);
 +      }
 +      else
 +      {
 +              sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +
 +              sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRowsRet, iColsRet, &pdblRealRet);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +
 +              vDmProd(iMode, pdblReal, iRows, iRows, iCols, pdblRealRet, 1);
 +      }
 +
 +      LhsVar(1) = Rhs + 1;
 +      PutLhsVar();
        return 0;
  }
  /*--------------------------------------------------------------------------*/
   * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
   *
   */
 -/*--------------------------------------------------------------------------*/ 
 -#include "gw_elementary_functions.h"
  /*--------------------------------------------------------------------------*/
 -extern int C2F(intreal)(int *id);
++#include <string.h>
 +#include "gw_elementary_functions.h"
- #include "stack-c.h"
 +#include "MALLOC.h"
 +#include "basic_functions.h"
 +#include "api_scilab.h"
 +#include "Scierror.h"
 +
 +SciErr real_poly(void* pvApiCtx, int* _piAddress);
 +SciErr real_sparse(void* pvApiCtx, int* _piAddress);
 +SciErr real_double(void* pvApiCtx, int* _piAddress);
 +
  /*--------------------------------------------------------------------------*/
 -int sci_real(char *fname,unsigned long fname_len)
 +int sci_real(char *fname, void* pvApiCtx)
  {
 -      static int id[6];
 -      C2F(intreal)(id);
 +      SciErr sciErr;
 +      int iType               = 0;
 +      int* piAddr             = NULL;
 +
 +      CheckRhs(1,1);
 +      CheckLhs(1,1);
 +
 +      sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      sciErr = getVarType(pvApiCtx, piAddr, &iType);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      switch(iType)
 +      {
 +      case sci_matrix :
 +              sciErr = real_double(pvApiCtx, piAddr);
 +              break;
 +      case sci_poly :
 +              sciErr = real_poly(pvApiCtx, piAddr);
 +              break;
 +      case sci_sparse :
 +              sciErr = real_sparse(pvApiCtx, piAddr);
 +              break;
 +      default:
 +              OverLoad(1);
 +              break;
 +      }
 +
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      LhsVar(1) = Rhs + 1;
 +      PutLhsVar();
        return 0;
  }
 +
 +SciErr real_poly(void* pvApiCtx, int* _piAddress)
 +{
 +      SciErr sciErr;
 +      int i,j;
 +      int iRows                                                       = 0;
 +      int iCols                                                       = 0;
 +      int iLen                                                        = 0;
 +      int *piCoeff                                    = NULL;
 +      char* pstVarName                        = NULL;
 +
 +      double** pdblReal                       = NULL;
 +      double** pdblImg                        = NULL;
 +      double** pdblRealRet    = NULL;
 +
 +      sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
 +      if(sciErr.iErr)
 +      {
 +              return sciErr;
 +      }
 +
 +      pstVarName = (char*)MALLOC(sizeof(char) * (iLen + 1));
 +
 +      sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
 +      if(sciErr.iErr)
 +      {
 +              return sciErr;
 +      }
 +
 +      if(isVarComplex(pvApiCtx, _piAddress))
 +      {
 +              sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              piCoeff = (int*)malloc(iRows * iCols * sizeof(int));
 +              sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              pdblReal                = (double**)malloc(sizeof(double*) * iRows * iCols);
 +              pdblImg                 = (double**)malloc(sizeof(double*) * iRows * iCols);
 +
 +              for(i = 0 ; i < iRows * iCols ; i++)
 +              {
 +                      pdblReal[i]                     = (double*)malloc(sizeof(double) * piCoeff[i]);
 +                      pdblImg[i]                      = (double*)malloc(sizeof(double) * piCoeff[i]);
 +              }
 +
 +              sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              for(i = 0 ; i < iRows * iCols ; i++)
 +              {
 +                      int iCoeff = piCoeff[i];
 +                      for(j = iCoeff - 1 ; j >= 0 ; j--)
 +                      {
 +                              if(pdblReal[i][j] == 0)
 +                              {
 +                                      piCoeff[i]--;
 +                              }
 +                              else
 +                              {
 +                                      break;
 +                              }
 +                      }
 +              }
 +
 +              sciErr = createMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +      }
 +      else
 +      {
 +              sciErr  = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              piCoeff = (int*)malloc(iRows * iCols * sizeof(int));
 +              sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols);
 +
 +              for(i = 0 ; i < iRows * iCols ; i++)
 +              {
 +                      pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]);
 +              }
 +
 +              sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              sciErr = createMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +      }
 +      return sciErr;
 +}
 +
 +SciErr real_sparse(void* pvApiCtx, int* _piAddress)
 +{
 +      SciErr sciErr;
 +      int i,j,x,y;
 +      int iRows                                               = 0;
 +      int iCols                                               = 0;
 +      int iNbItem                                     = 0;
 +      int *piNbItemRow                = NULL;
 +      int *piColPos                           = NULL;
 +
 +      int iNbItemNew                  = 0;
 +      int* piNbItemRowNew     = NULL;
 +      int* piColPosNew                = NULL;
 +
 +      double *pdblReal                = 0;
 +      double *pdblImg                 = 0;
 +      double *pdblRealRet     = NULL;
 +
 +      if(isVarComplex(pvApiCtx, _piAddress))
 +      {
 +              sciErr = getComplexSparseMatrix(pvApiCtx, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              for(i = 0 ; i < iNbItem ; i++)
 +              {
 +                      if(pdblReal[i] != 0)
 +                      {
 +                              iNbItemNew++;
 +                      }
 +              }
 +
 +              sciErr = allocSparseMatrix(pvApiCtx, Rhs + 1, iRows, iCols, iNbItemNew, &piNbItemRowNew, &piColPosNew, &pdblRealRet);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              x = 0;
 +              y = 0;
 +              for(i = 0 ; i < iRows ; i++)
 +              {
 +                      piNbItemRowNew[i] = 0;
 +                      for(j = 0 ; j < piNbItemRow[i] ; j++)
 +                      {
 +                              if(pdblReal[x] != 0)
 +                              {
 +                                      piNbItemRowNew[i]++;
 +                                      piColPosNew[y] = piColPos[x];
 +                                      pdblRealRet[y] = pdblReal[x];
 +                                      y++;
 +                              }
 +                              x++;
 +                      }
 +              }
 +      }
 +      else
 +      {
 +              sciErr = getSparseMatrix(pvApiCtx, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              sciErr = createSparseMatrix(pvApiCtx, Rhs + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +      }
 +      return sciErr;
 +}
 +
 +SciErr real_double(void* pvApiCtx, int* _piAddress)
 +{
 +      SciErr sciErr;
 +      int iRows                                               = 0;
 +      int iCols                                               = 0;
 +      double *pdblReal                = NULL;
 +      double *pdblImg                 = NULL;
 +      double *pdblRealRet = NULL;
 +
 +      if(isVarComplex(pvApiCtx, _piAddress))
 +      {
 +              sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +      }
 +      else
 +      {
 +              sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +      }
 +
 +      sciErr = createMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, pdblReal);
 +      if(sciErr.iErr)
 +      {
 +              return sciErr;
 +      }
 +
 +      return sciErr;
 +}
  /*--------------------------------------------------------------------------*/
   * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
   *
   */
 -/*--------------------------------------------------------------------------*/ 
 -#include "gw_elementary_functions.h"
  /*--------------------------------------------------------------------------*/
 -extern int C2F(intround)(int *id);
++#include <string.h>
 +#include "gw_elementary_functions.h"
- #include "stack-c.h"
 +#include "MALLOC.h"
 +#include "basic_functions.h"
 +#include "api_scilab.h"
 +#include "Scierror.h"
 +
 +SciErr round_double(void* pvApiCtx, int* _piAddress);
 +SciErr round_poly(void* pvApiCtx, int* _piAddress);
 +
  /*--------------------------------------------------------------------------*/
 -int sci_round(char *fname,unsigned long fname_len)
 +int sci_round(char *fname, void* pvApiCtx)
  {
 -      static int id[6];
 -      C2F(intround)(id);
 +      SciErr sciErr;
 +      int iType               = 0;
 +      int* piAddr             = NULL;
 +
 +      CheckRhs(1,1);
 +      CheckLhs(1,1);
 +
 +      sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      sciErr = getVarType(pvApiCtx, piAddr, &iType);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      switch(iType)
 +      {
 +      case sci_matrix :
 +              sciErr = round_double(pvApiCtx, piAddr);
 +              break;
 +      case sci_poly :
 +              sciErr = round_poly(pvApiCtx, piAddr);
 +              break;
 +      default:
 +              OverLoad(1);
 +              return 0;
 +              break;
 +      }
 +
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      LhsVar(1) = Rhs + 1;
 +      PutLhsVar();
        return 0;
  }
 +
 +SciErr round_double(void* pvApiCtx, int* _piAddress)
 +{
 +      SciErr sciErr;
 +      int i;
 +      int iRows                                               = 0;
 +      int iCols                                               = 0;
 +
 +      double *pdblReal                = NULL;
 +      double *pdblImg                 = NULL;
 +      double *pdblRealRet     = NULL;
 +      double *pdblImgRet      = NULL;
 +
 +      if(isVarComplex(pvApiCtx, _piAddress))
 +      {
 +              sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              for(i = 0 ; i < iRows * iCols; i++)
 +              {
 +                      pdblRealRet[i] = danints(pdblReal[i]);
 +                      pdblImgRet[i]   = danints(pdblImg[i]);
 +              }
 +      }
 +      else
 +      {
 +              sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              for(i = 0 ; i < iRows * iCols; i++)
 +              {
 +                      pdblRealRet[i] = danints(pdblReal[i]);
 +              }
 +      }
 +
 +      return sciErr;
 +}
 +
 +SciErr round_poly(void* pvApiCtx, int* _piAddress)
 +{
 +      SciErr sciErr;
 +      int i,j;
 +      int iRows                                                       = 0;
 +      int iCols                                                       = 0;
 +      int iLen                                                        = 0;
 +      int *piCoeff                                    = NULL;
 +      char* pstVarName                        = NULL;
 +
 +      double** pdblReal                       = NULL;
 +      double** pdblImg                        = NULL;
 +      double** pdblRealRet    = NULL;
 +      double** pdblImgRet     = NULL;
 +
 +      sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
 +      if(sciErr.iErr)
 +      {
 +              return sciErr;
 +      }
 +
 +      pstVarName = (char*)MALLOC(sizeof(char) * (iLen + 1));
 +
 +      sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
 +      if(sciErr.iErr)
 +      {
 +              return sciErr;
 +      }
 +
 +      if(isVarComplex(pvApiCtx, _piAddress))
 +      {
 +              sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              piCoeff = (int*)malloc(iRows * iCols * sizeof(int));
 +              sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              pdblReal                = (double**)malloc(sizeof(double*) * iRows * iCols);
 +              pdblImg                 = (double**)malloc(sizeof(double*) * iRows * iCols);
 +              pdblRealRet     = (double**)malloc(sizeof(double*) * iRows * iCols);
 +              pdblImgRet      = (double**)malloc(sizeof(double*) * iRows * iCols);
 +
 +              for(i = 0 ; i < iRows * iCols ; i++)
 +              {
 +                      pdblReal[i]                     = (double*)malloc(sizeof(double) * piCoeff[i]);
 +                      pdblImg[i]                      = (double*)malloc(sizeof(double) * piCoeff[i]);
 +                      pdblRealRet[i]  = (double*)malloc(sizeof(double) * piCoeff[i]);
 +                      pdblImgRet[i]           = (double*)malloc(sizeof(double) * piCoeff[i]);
 +              }
 +
 +              sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              for(i = 0 ; i < iRows * iCols ; i++)
 +              {
 +                      for(j = 0 ; j < piCoeff[i] ; j++)
 +                      {
 +                              pdblRealRet[i][j] = danints(pdblReal[i][j]);
 +                              pdblImgRet[i][j] = danints(pdblImg[i][j]);
 +                      }
 +              }
 +
 +              sciErr = createComplexMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +      }
 +      else
 +      {
 +              sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              piCoeff = (int*)malloc(iRows * iCols * sizeof(int));
 +              sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              pdblReal                = (double**)malloc(sizeof(double*) * iRows * iCols);
 +              pdblRealRet     = (double**)malloc(sizeof(double*) * iRows * iCols);
 +
 +              for(i = 0 ; i < iRows * iCols ; i++)
 +              {
 +                      pdblReal[i]                     = (double*)malloc(sizeof(double) * piCoeff[i]);
 +                      pdblRealRet[i]  = (double*)malloc(sizeof(double) * piCoeff[i]);
 +              }
 +
 +              sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +
 +              for(i = 0 ; i < iRows * iCols ; i++)
 +              {
 +                      for(j = 0 ; j < piCoeff[i] ; j++)
 +                      {
 +                              pdblRealRet[i][j] = danints(pdblReal[i][j]);
 +                      }
 +              }
 +
 +              sciErr = createMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
 +              if(sciErr.iErr)
 +              {
 +                      return sciErr;
 +              }
 +      }
 +      return sciErr;
 +}
 +
  /*--------------------------------------------------------------------------*/
   * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
   *
   */
 -/*--------------------------------------------------------------------------*/ 
 -#include "gw_elementary_functions.h"
  /*--------------------------------------------------------------------------*/
 -extern int C2F(intsign)(int *id);
++#include <string.h>
 +#include "gw_elementary_functions.h"
- #include "stack-c.h"
 +#include "basic_functions.h"
 +#include "api_scilab.h"
 +#include "Scierror.h"
 +
  /*--------------------------------------------------------------------------*/
 -int sci_sign(char *fname,unsigned long fname_len)
 +int sci_sign(char *fname,void* pvApiCtx)
  {
 -      static int id[6];
 -      C2F(intsign)(id);
 +      SciErr sciErr;
 +      int i;
 +      int iRows                                               = 0;
 +      int iCols                                               = 0;
 +      int iType                                               = 0;
 +      int* piAddr                                     = NULL;
 +
 +      double *pdblReal                = NULL;
 +      double *pdblImg                 = NULL;
 +      double *pdblRealRet     = NULL;
 +      double *pdblImgRet      = NULL;
 +
 +      CheckRhs(1,1);
 +      CheckLhs(1,1);
 +
 +      sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      sciErr = getVarType(pvApiCtx, piAddr, &iType);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      if(iType != sci_matrix)
 +      {
 +              OverLoad(1);
 +              return 0;
 +      }
 +
 +      if(isVarComplex(pvApiCtx, piAddr))
 +      {
 +              sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +
 +              sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +
 +              for(i = 0 ; i < iRows * iCols ; i++)
 +              {
 +                      double dblTemp = dpythags(pdblReal[i], pdblImg[i]);
 +                      if(dblTemp == 0)
 +                      {
 +                              pdblRealRet[i]  = 0;
 +                              pdblImgRet[i]           = 0;
 +                      }
 +                      else
 +                      {
 +                              pdblRealRet[i]  = pdblReal[i] / dblTemp;
 +                              pdblImgRet[i]           = pdblImg[i] / dblTemp;;
 +                      }
 +              }
 +      }
 +      else
 +      {
 +              sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +
 +              sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +
 +              for(i = 0 ; i < iRows * iCols ; i++)
 +              {
 +                      pdblRealRet[i] = dsignsEx(pdblReal[i]);
 +              }
 +      }
 +
 +      LhsVar(1) = Rhs + 1;
 +      PutLhsVar();
        return 0;
  }
  /*--------------------------------------------------------------------------*/
   *
   */
  /*--------------------------------------------------------------------------*/ 
++#include <string.h>
  #include "gw_elementary_functions.h"
- #include "stack-c.h"
 -/*--------------------------------------------------------------------------*/
 -extern int C2F(intsqrt)(int *id);
 -/*--------------------------------------------------------------------------*/
 -int sci_sqrt(char *fname,unsigned long fname_len)
 +#include "basic_functions.h"
 +#include "api_scilab.h"
 +
 +
 +int sci_sqrt(char *fname,void* pvApiCtx)
  {
 -      static int id[6];
 -      C2F(intsqrt)(id);
 +      SciErr sciErr;
 +      int i;
 +      int iRet                                                = 0;
 +      int iComplex                            = 0;
 +      int iRows                                               = 0;
 +      int iCols                                               = 0;
 +      int* piAddr                                     = NULL;
 +
 +      double* pdblReal                = NULL;
 +      double* pdblImg                 = NULL;
 +      double* pdblRealRet     = NULL;
 +      double* pdblImgRet      = NULL;
 +
 +
 +      CheckRhs(1,1);
 +      CheckLhs(1,1);
 +
 +      sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      if(!isDoubleType(pvApiCtx, piAddr))
 +      {
 +              OverLoad(1);
 +              return 0;
 +      }
 +
 +      if(isVarComplex(pvApiCtx, piAddr))
 +      {
 +              iComplex = 1;
 +              sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +      }
 +      else
 +      {
 +              iComplex = 0;
 +              sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +      }
 +
 +      for(i = 0 ; i < iRows * iCols && iComplex == 0 ; i++)
 +      {
 +              if(pdblReal[i] < 0)
 +              {
 +                      iComplex = 1;
 +              }
 +      }
 +
 +      if(iComplex)
 +      {
 +              sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +
 +              if(isVarComplex(pvApiCtx, piAddr))
 +              {
 +                      for(i = 0 ; i < iRows * iCols ; i++)
 +                      {
 +                              zsqrts(pdblReal[i], pdblImg[i], &pdblRealRet[i], &pdblImgRet[i]);
 +                      }
 +              }
 +              else
 +              {
 +                      for(i = 0 ; i < iRows * iCols ; i++)
 +                      {
 +                              zsqrts(pdblReal[i], 0, &pdblRealRet[i], &pdblImgRet[i]);
 +                      }
 +              }
 +      }
 +      else
 +      {
 +              sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +
 +              for(i = 0 ; i < iRows * iCols ; i++)
 +              {
 +                      pdblRealRet[i] = dsqrts(pdblReal[i]);
 +              }
 +      }
 +      LhsVar(1) = Rhs + 1;
 +      PutLhsVar();
        return 0;
  }
  /*--------------------------------------------------------------------------*/
   */
  /*--------------------------------------------------------------------------*/ 
  #include "gw_elementary_functions.h"
- #include "stack-c.h"
 +#include "basic_functions.h"
 +#include "Scierror.h"
 +#include "api_scilab.h"
 +
 +#define MAGI_LETTER           'm'
 +#define FRK_LETTER            'f'
 +#define HILB_LETTER           'h'
 +
 +char getGenerateMode(void* pvApiCtx, int* _piAddress);
 +int getGenerateSize(void* pvApiCtx, int* _piAddress);
  /*--------------------------------------------------------------------------*/
 -extern int C2F(inttestmatrix)(int *id);
 -/*--------------------------------------------------------------------------*/
 -int sci_testmatrix(char *fname,unsigned long fname_len)
 +int sci_testmatrix(char *fname, void* pvApiCtx)
  {
 -      static int id[6];
 -      C2F(inttestmatrix)(id);
 +      SciErr sciErr;
 +      int iRet                                                = 0;
 +
 +      int iRows1                                      = 0;
 +      int iCols1                                      = 0;
 +      int* piAddr1                            = NULL;
 +      char cMode                                      = 0;
 +
 +
 +      int iRows2                                      = 0;
 +      int iCols2                                      = 0;
 +      int* piAddr2                            = NULL;
 +      int iDim                                                = 0;
 +
 +      double *pdblRealRet = NULL;
 +      
 +      CheckRhs(2,2);
 +      CheckLhs(1,1);
 +
 +      /*check input 1*/
 +      sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      cMode = getGenerateMode(pvApiCtx, piAddr1);
 +
 +      if(cMode == -1)
 +      {
 +              return 1;
 +      }
 +
 +      iDim = getGenerateSize(pvApiCtx, piAddr2);
 +
 +
 +      if(cMode != FRK_LETTER && cMode != HILB_LETTER && iDim == 2)
 +      {
 +              iDim = 0;
 +      }
 +
 +      if(iDim == 0)
 +      {
 +              iRet = createEmptyMatrix(pvApiCtx, Rhs + 1);
 +              if(iRet)
 +              {
 +                      return 1;
 +              }
 +              LhsVar(1) = Rhs + 1;
 +              PutLhsVar();
 +              return 0;
 +      }
 +
 +      sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iDim, iDim, &pdblRealRet);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      switch(cMode)
 +      {
 +      case FRK_LETTER :
 +              franck_matrix(iDim, pdblRealRet);
 +              break;
 +      case HILB_LETTER :
 +              hilb_matrix(iDim, pdblRealRet);
 +              break;
 +      default : //Magic case and others
 +              magic_matrix(iDim, pdblRealRet);
 +              break;
 +      }
 +
 +      LhsVar(1) = Rhs + 1;
 +      PutLhsVar();
        return 0;
  }
 +
 +char getGenerateMode(void* pvApiCtx, int* _piAddress)
 +{
 +      int iRet = 0;
 +
 +      char* pstData;
 +
 +      iRet = getAllocatedSingleString(pvApiCtx, _piAddress, &pstData);
 +      if(iRet)
 +      {
 +              return -1;
 +      }
 +      
 +      return pstData[0];
 +}
 +
 +int getGenerateSize(void* pvApiCtx, int* _piAddress)
 +{
 +      SciErr sciErr;
 +      int iRet = 0;
 +      int iRows = 0;
 +      int iCols = 0;
 +
 +      double* pdblReal = NULL;
 +      double* pdblImg  = NULL;
 +
 +      if(isVarComplex(pvApiCtx, _piAddress))
 +      {
 +              sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +      }
 +      else
 +      {
 +              sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +      }
 +      return abs((int)pdblReal[0]);
 +      
 +}
  /*--------------------------------------------------------------------------*/
   *
   */
  /*--------------------------------------------------------------------------*/ 
++#include <string.h>
  #include "gw_elementary_functions.h"
- #include "stack-c.h"
 +#include "basic_functions.h"
 +#include "Scierror.h"
 +#include "api_scilab.h"
 +
  /*--------------------------------------------------------------------------*/
 -extern int C2F(inttril)(int *id);
 +int tril_matrix(int* _piAddress, int _iOffset, void* pvApiCtx);
 +
  /*--------------------------------------------------------------------------*/
 -int sci_tril(char *fname,unsigned long fname_len)
 +int sci_tril(char *fname, void* pvApiCtx)
  {
 -      static int id[6];
 -      C2F(inttril)(id);
 +      SciErr sciErr;
 +      int iRet                        = 0;
 +      int iOffset             = 0;
 +      int *piAddr1    = NULL;
 +
 +      CheckRhs(1,2);
 +      CheckLhs(1,1);
 +
 +
 +      if(Rhs == 2)
 +      {//Get offset
 +              int* piAddr2                    = 0;
 +              double dblReal          = 0;
 +
 +              sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +
 +              iRet = getScalarDouble(pvApiCtx, piAddr2, &dblReal);
 +              if(iRet)
 +              {
 +                      return 1;
 +              }
 +              
 +              iOffset = (int)dblReal;
 +      }
 +
 +      sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      if(isDoubleType(pvApiCtx, piAddr1))
 +      {
 +              iRet = tril_matrix(piAddr1, iOffset, pvApiCtx);
 +      }
 +      else if(isPolyType(pvApiCtx, piAddr1))
 +      {
 +              //call sci_ptril
 +      }
 +      else
 +      {
 +              OverLoad(1);
 +      }
 +
 +      if(iRet)
 +      {
 +              return 1;
 +      }
 +
 +      LhsVar(1) = Rhs + 1;
 +      PutLhsVar();
        return 0;
  }
 +
 +int tril_matrix(int* _piAddress, int _iOffset, void* pvApiCtx)
 +{
 +      SciErr sciErr;
 +      int i;
 +      int iRows                                               = 0;
 +      int iCols                                               = 0;
 +
 +      double *pdblReal                = NULL;
 +      double *pdblImg                 = NULL;
 +
 +      double *pdblRealRet     = NULL;
 +      double *pdblImgRet      = NULL;
 +
 +      if(isVarComplex(pvApiCtx, _piAddress))
 +      {
 +              sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return sciErr.iErr;
 +              }
 +
 +              sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return sciErr.iErr;
 +              }
 +
 +              memcpy(pdblRealRet, pdblReal, sizeof(double) * iRows * iCols);
 +              memcpy(pdblImgRet       , pdblImg       , sizeof(double) * iRows * iCols);
 +
 +              for(i = 0 ; i < iCols ; i++)
 +              {
 +                      int iSize       = Min(Max(i - _iOffset, 0), iRows);
 +                      memset(&pdblRealRet[i * iRows], 0x00, sizeof(double) * iSize);
 +                      memset(&pdblImgRet[i * iRows],  0x00, sizeof(double) * iSize);
 +              }
 +      }
 +      else
 +      {
 +              sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return sciErr.iErr;
 +              }
 +
 +              sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return sciErr.iErr;
 +              }
 +
 +              memcpy(pdblRealRet, pdblReal, sizeof(double) * iRows * iCols);
 +
 +              for(i = 0 ; i < iCols ; i++)
 +              {
 +                      int iSize       = Min(Max(i - _iOffset, 0), iRows);
 +                      memset(&pdblRealRet[i * iRows], 0x00, sizeof(double) * iSize);
 +              }
 +      }
 +
 +      return 0;
 +}
 +
 +
  /*--------------------------------------------------------------------------*/
   *
   */
  /*--------------------------------------------------------------------------*/ 
++#include <string.h>
  #include "gw_elementary_functions.h"
- #include "stack-c.h"
 +#include "Scierror.h"
 +#include "basic_functions.h"
 +#include "Scierror.h"
 +#include "api_scilab.h"
 +
 +int triu_matrix(void* pvApiCtx, int* _piAddress, int _iOffset);
  /*--------------------------------------------------------------------------*/
 -extern int C2F(inttriu)(int *id);
 -/*--------------------------------------------------------------------------*/
 -int sci_triu(char *fname,unsigned long fname_len)
 +int sci_triu(char *fname,void* pvApiCtx)
 +{
 +      SciErr sciErr;
 +      int iRet                        = 0;
 +      int iOffset             = 0;
 +      int *piAddr1    = NULL;
 +
 +      CheckRhs(1,2);
 +      CheckLhs(1,1);
 +
 +
 +      if(Rhs == 2)
 +      {//Get offset
 +              int* piAddr2                    = 0;
 +              double dblReal          = 0;
 +
 +              sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return 0;
 +              }
 +
 +              iRet = getScalarDouble(pvApiCtx, piAddr2, &dblReal);
 +              if(iRet)
 +              {
 +                      return 1;
 +              }
 +              
 +              iOffset = (int)dblReal;
 +      }
 +
 +      sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
 +      if(sciErr.iErr)
 +      {
 +              printError(&sciErr, 0);
 +              return 0;
 +      }
 +
 +      if(isDoubleType(pvApiCtx, piAddr1))
 +      {
 +              iRet = triu_matrix(pvApiCtx, piAddr1, iOffset);
 +      }
 +      else if(isPolyType(pvApiCtx, piAddr1))
 +      {
 +              //call sci_ptriu
 +      }
 +      else
 +      {
 +              OverLoad(1);
 +      }
 +
 +      if(iRet)
 +      {
 +              return 1;
 +      }
 +
 +      LhsVar(1) = Rhs + 1;
 +      PutLhsVar();
 +      return 0;
 +}
 +
 +int triu_matrix(void* pvApiCtx, int* _piAddress, int _iOffset)
  {
 -      static int id[6];
 -      C2F(inttriu)(id);
 +      SciErr sciErr;
 +      int i;
 +      int iRet                                                = 0;
 +      int iRows                                               = 0;
 +      int iCols                                               = 0;
 +
 +      double *pdblReal                = NULL;
 +      double *pdblImg                 = NULL;
 +
 +      double *pdblRealRet     = NULL;
 +      double *pdblImgRet      = NULL;
 +
 +      if(isVarComplex(pvApiCtx, _piAddress))
 +      {
 +              sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return sciErr.iErr;
 +              }
 +
 +              sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return sciErr.iErr;
 +              }
 +
 +              memset(pdblRealRet, 0x00        , sizeof(double) * iRows * iCols);
 +              memset(pdblImgRet       , 0x00  , sizeof(double) * iRows * iCols);
 +
 +              for(i = 0 ; i < iCols ; i++)
 +              {
 +                      int iSize       = Min(Max(i + 1 - _iOffset, 0), iRows);
 +                      memcpy(&pdblRealRet[i * iRows], &pdblReal[i * iRows], sizeof(double) * iSize);
 +                      memcpy(&pdblImgRet[i * iRows]   , &pdblImg[i * iRows]   , sizeof(double) * iSize);
 +              }
 +      }
 +      else
 +      {
 +              sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return sciErr.iErr;
 +              }
 +
 +              sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
 +              if(sciErr.iErr)
 +              {
 +                      printError(&sciErr, 0);
 +                      return sciErr.iErr;
 +              }
 +
 +              memset(pdblRealRet, 0x00, sizeof(double) * iRows * iCols);
 +
 +              for(i = 0 ; i < iCols ; i++)
 +              {
 +                      int iSize       = Min(Max(i + 1 - _iOffset, 0), iRows);
 +                      memcpy(&pdblRealRet[i * iRows], &pdblReal[i * iRows], sizeof(double) * iSize);
 +              }
 +      }
 +
        return 0;
  }
  /*--------------------------------------------------------------------------*/
  #include "gw_fftw.h"
  #include "localization.h"
  #include "api_scilab.h"
+ #include "Scierror.h"
  
  /*--------------------------------------------------------------------------*/
 -int sci_disposefftwlibrary(char *fname, unsigned long fname_len)
 +int sci_disposefftwlibrary(char *fname, void* pvApiCtx)
  {
      int iErr;
  
@@@ -14,7 -14,7 +14,6 @@@
  *
  */
  /*--------------------------------------------------------------------------*/
--#include "stack-c.h"
  #include "fftw_utilities.h"
  #include "sci_data_utilities.h"
  #include "callfftw.h"
  #include "gw_fftw.h"
  #include "api_scilab.h"
  #include "localization.h"
+ #include "Scierror.h"
  
  /*--------------------------------------------------------------------------*/
 -int sci_fftwlibraryisloaded(char *fname, unsigned long fname_len)
 +int sci_fftwlibraryisloaded(char *fname, void* pvApiCtx)
  {
      int iErr;
  
@@@ -9,7 -9,7 +9,7 @@@
  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  */
--#include "stack-c.h"
++#include <string.h>
  #include "MALLOC.h"
  #include "api_scilab.h"
  #include "localization.h"
@@@ -10,8 -9,8 +10,8 @@@
   * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
   *
   */
++#include <string.h>
  #include "gw_fileio.h"
--#include "stack-c.h"
  #include "scicurdir.h"
  #include "MALLOC.h"
  #include "Scierror.h"
@@@ -12,7 -12,7 +12,6 @@@
   */
  /*--------------------------------------------------------------------------*/
  #include "MALLOC.h"
--#include "stack-c.h"
  #include "do_xxprintf.h"
  #include "do_xxscanf.h"
  #include "scanf_functions.h"
index 89f63fb,0000000..d5bf3f6
mode 100644,000000..100644
--- /dev/null
@@@ -1,176 -1,0 +1,175 @@@
 +/*--------------------------------------------------------------------------*/
 +/*
 +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 +* Copyright (C) 2009 - DIGITEO - Allan CORNET
 +*
 +* 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 <wchar.h>
 +#include "context.hxx"
 +#include "string.hxx"
 +#include "expandPathVariable.h"
 +
 +extern "C"
 +{
- #include "stack-c.h"
 +#include "charEncoding.h"
 +#include "MALLOC.h"
 +#include "PATH_MAX.h"
 +#include "api_scilab.h"
 +#include "getlongpathname.h"
 +#include "os_strdup.h"
 +#include "os_wcsdup.h"
 +}
 +
 +
 +
 +/*--------------------------------------------------------------------------*/
 +struct VARIABLEALIAS
 +{
 +      wchar_t *Alias;
 +      wchar_t *VariableName;
 +};
 +/*--------------------------------------------------------------------------*/
 +#define NB_ALIAS 7
 +static struct VARIABLEALIAS VARIABLES_words[NB_ALIAS] =
 +{
 +      {L"SCIHOME", L"SCIHOME"},
 +      {L"WSCI", L"WSCI"},
 +      {L"SCI", L"SCI"},
 +      {L"~", L"home"},
 +      {L"HOME", L"home"},
 +      {L"home", L"home"},
 +      {L"TMPDIR", L"TMPDIR"}
 +};
 +/*--------------------------------------------------------------------------*/
 +static wchar_t *getVariableValueDefinedInScilab(wchar_t *wcVarName);
 +static wchar_t *convertFileSeparators(wchar_t *wcStr);
 +/*--------------------------------------------------------------------------*/
 +wchar_t *expandPathVariableW(wchar_t *wcstr)
 +{
 +      wchar_t *wcexpanded = NULL;
 +      if (wcstr)
 +      {
 +              int i = 0;
 +              int lenStr = (int)wcslen(wcstr);
 +
 +              for (i = 0; i < NB_ALIAS; i++)
 +              {
 +                      int lenAlias = 0;
 +
 +                      /* input is ALIAS without subdirectory */
 +                      if (wcscmp(VARIABLES_words[i].Alias, wcstr) == 0)
 +                      {
 +                              wchar_t *wcexpanded = getVariableValueDefinedInScilab(VARIABLES_words[i].VariableName);
 +                              if (wcexpanded)
 +                              {
 +                                       return convertFileSeparators(wcexpanded);
 +                              }
 +                      }
 +
 +                      lenAlias = (int)wcslen(VARIABLES_words[i].Alias);
 +
 +                      if (lenStr > lenAlias)
 +                      {
 +                              wchar_t *wcBegin = (wchar_t *)MALLOC(sizeof(wchar_t) * (lenAlias + 1));
 +                              if (wcBegin)
 +                              {
 +                                      wcsncpy(wcBegin, wcstr, lenAlias);
 +                                      wcBegin[lenAlias] = 0;
 +
 +                                      if (wcscmp(wcBegin,VARIABLES_words[i].Alias)== 0 )
 +                                      {
 +                                              if ( (wcstr[lenAlias] == L'/') || (wcstr[lenAlias] == L'\\') )
 +                                              {
 +                                                      wchar_t * newBegin = getVariableValueDefinedInScilab(VARIABLES_words[i].VariableName);
 +                                                      if (newBegin)
 +                                                      {
 +                                                              int lengthnewBegin = (int)wcslen(newBegin);
 +                                                              wcexpanded = (wchar_t *)MALLOC(sizeof(wchar_t)* (lengthnewBegin + (int)wcslen(&wcstr[lenAlias]) + 1));
 +                                                              if (wcexpanded)
 +                                                              {
 +                                                                      wcscpy(wcexpanded, newBegin);
 +                                                                      wcscat(wcexpanded, &wcstr[lenAlias]);
 +                                                                      FREE(wcBegin); wcBegin = NULL;
 +                                                                      free(newBegin); newBegin = NULL;
 +                                                                      return convertFileSeparators(wcexpanded);
 +                                                              }
 +                                                              FREE(newBegin); newBegin = NULL;
 +                                                      }
 +                                              }
 +                                      }
 +                                      FREE(wcBegin);wcBegin = NULL;
 +                              }
 +                      }
 +              }
 +
 +              /* Variables not founded returns a copy of input */
 +              wcexpanded = (wchar_t*)MALLOC(sizeof(wchar_t)* ((int)wcslen(wcstr) + 1));
 +              if (wcexpanded)
 +              {
 +                      wcscpy(wcexpanded, wcstr);
 +                      return convertFileSeparators(wcexpanded);
 +              }
 +      }
 +      return wcexpanded;
 +}
 +/*--------------------------------------------------------------------------*/
 +char *expandPathVariable(char* str)
 +{
 +      char *expanded = NULL;
 +      wchar_t *wstr = to_wide_string(str);
 +
 +      if (wstr)
 +      {
 +              wchar_t *wcexpanded = expandPathVariableW(wstr);
 +              if (wcexpanded)
 +              {
 +                      expanded = wide_string_to_UTF8(wcexpanded);
 +                      FREE(wcexpanded);
 +                      wcexpanded = NULL;
 +              }
 +              FREE(wstr);
 +              wstr = NULL;
 +      }
 +      return expanded;
 +}
 +/*--------------------------------------------------------------------------*/
 +wchar_t *getVariableValueDefinedInScilab(wchar_t *wcVarName)
 +{
 +      if (wcVarName)
 +      {
 +        types::InternalType *pIT = symbol::Context::getInstance()->get(symbol::Symbol(wcVarName));
 +        if(pIT->isString() == false)
 +        {
 +            return NULL;
 +        }
 +
 +        types::String* pS = pIT->getAs<types::String>();
 +        return os_wcsdup(pS->get(0));
 +      }
 +      return NULL;
 +}
 +/*--------------------------------------------------------------------------*/
 +wchar_t *convertFileSeparators(wchar_t *wcStr)
 +{
 +      if (wcStr)
 +      {
 +              int k = 0;
 +              int len = (int)wcslen(wcStr);
 +
 +#ifdef _MSC_VER
 +              for (k=0 ; k < len ;k++) if (wcStr[k] == L'/') wcStr[k] = L'\\';
 +#else
 +              for (k=0 ; k < len ;k++) if (wcStr[k] == L'\\') wcStr[k] = L'/';
 +#endif
 +      }
 +      return wcStr;
 +}
 +/*--------------------------------------------------------------------------*/
@@@ -14,7 -14,7 +14,6 @@@
  #include "isScilabFunction.h"
  #include "searchmacroinlibraries.h"
  #include "api_scilab.h"
--#include "stack-c.h"
  #include "sci_types.h"
  #include "stack-def.h"
  #include "Funtab.h"
@@@ -25,7 -25,7 +25,8 @@@ libscigraphics_la_etc_DATA = etc/graphi
  #### graphics : datatips sub-module ####
  MACROSDIRSEXT = macros/datatips
  
--GRAPHICS_C_SOURCES = src/c/GetCommandArg.c \
++GRAPHICS_C_SOURCES = \
++src/c/GetCommandArg.c \
  src/c/loadTextRenderingAPI.c \
  src/c/getHandleProperty/get_figure_position_property.c \
  src/c/getHandleProperty/get_figure_size_property.c \
@@@ -343,7 -343,7 +344,6 @@@ sci_gateway/c/sci_geom3d.c 
  sci_gateway/c/sci_xset.c \
  sci_gateway/c/sci_unzoom.c \
  sci_gateway/c/sci_xsegs.c \
--sci_gateway/c/sci_clear_pixmap.c \
  sci_gateway/c/sci_glue.c \
  sci_gateway/c/sci_xarc.c \
  sci_gateway/c/sci_xpolys.c \
@@@ -390,11 -390,9 +390,10 @@@ sci_gateway/c/sci_fec.c 
  sci_gateway/c/sci_rubberbox.c \
  sci_gateway/c/sci_rotate_axes.c \
  sci_gateway/c/sci_is_handle_valid.c \
--sci_gateway/c/sci_show_pixmap.c \
  sci_gateway/c/sci_Legend.c
  
 +GATEWAY_CXX_SOURCES = sci_gateway/cpp/graphics_gw.cpp
 +
  libscigraphics_la_CPPFLAGS = \
        -I$(srcdir)/includes/ \
        -I$(srcdir)/src/c/ \
@@@ -465,7 -464,7 +465,6 @@@ am__objects_2 = libscigraphics_la-sci_s
        libscigraphics_la-sci_xgrid.lo libscigraphics_la-sci_xclick.lo \
        libscigraphics_la-sci_geom3d.lo libscigraphics_la-sci_xset.lo \
        libscigraphics_la-sci_unzoom.lo libscigraphics_la-sci_xsegs.lo \
--      libscigraphics_la-sci_clear_pixmap.lo \
        libscigraphics_la-sci_glue.lo libscigraphics_la-sci_xarc.lo \
        libscigraphics_la-sci_xpolys.lo \
        libscigraphics_la-sci_xstring.lo \
        libscigraphics_la-sci_rubberbox.lo \
        libscigraphics_la-sci_rotate_axes.lo \
        libscigraphics_la-sci_is_handle_valid.lo \
--      libscigraphics_la-sci_show_pixmap.lo \
        libscigraphics_la-sci_Legend.lo
 -am_libscigraphics_la_OBJECTS = $(am__objects_2)
 +am__objects_3 = libscigraphics_la-graphics_gw.lo
 +am_libscigraphics_la_OBJECTS = $(am__objects_2) $(am__objects_3)
  libscigraphics_la_OBJECTS = $(am_libscigraphics_la_OBJECTS)
  @GUI_TRUE@am_libscigraphics_la_rpath = -rpath $(pkglibdir)
  DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/modules/core/includes
@@@ -822,7 -804,7 +820,8 @@@ libscigraphics_la_etc_DATA = etc/graphi
  
  #### graphics : datatips sub-module ####
  MACROSDIRSEXT = macros/datatips
--GRAPHICS_C_SOURCES = src/c/GetCommandArg.c \
++GRAPHICS_C_SOURCES = \
++src/c/GetCommandArg.c \
  src/c/loadTextRenderingAPI.c \
  src/c/getHandleProperty/get_figure_position_property.c \
  src/c/getHandleProperty/get_figure_size_property.c \
@@@ -1140,7 -1122,7 +1139,6 @@@ sci_gateway/c/sci_geom3d.c 
  sci_gateway/c/sci_xset.c \
  sci_gateway/c/sci_unzoom.c \
  sci_gateway/c/sci_xsegs.c \
--sci_gateway/c/sci_clear_pixmap.c \
  sci_gateway/c/sci_glue.c \
  sci_gateway/c/sci_xarc.c \
  sci_gateway/c/sci_xpolys.c \
@@@ -1187,10 -1169,9 +1185,9 @@@ sci_gateway/c/sci_fec.c 
  sci_gateway/c/sci_rubberbox.c \
  sci_gateway/c/sci_rotate_axes.c \
  sci_gateway/c/sci_is_handle_valid.c \
--sci_gateway/c/sci_show_pixmap.c \
  sci_gateway/c/sci_Legend.c
  
 +GATEWAY_CXX_SOURCES = sci_gateway/cpp/graphics_gw.cpp
  libscigraphics_la_CPPFLAGS = \
        -I$(srcdir)/includes/ \
        -I$(srcdir)/src/c/ \
@@@ -1779,7 -1737,7 +1776,6 @@@ distclean-compile
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_Legend.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_StringBox.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_champ.Plo@am__quote@
--@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_clear_pixmap.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_contour2di.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_copy.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_delete.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_rotate_axes.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_rubberbox.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_set.Plo@am__quote@
--@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_show_pixmap.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_show_window.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_swap_handles.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_unglue.Plo@am__quote@
@@@ -4086,13 -4044,13 +4081,6 @@@ libscigraphics_la-sci_xsegs.lo: sci_gat
  @AMDEP_TRUE@@am__fastdepCC_FALSE@     DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
  @am__fastdepCC_FALSE@ $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_la-sci_xsegs.lo `test -f 'sci_gateway/c/sci_xsegs.c' || echo '$(srcdir)/'`sci_gateway/c/sci_xsegs.c
  
--libscigraphics_la-sci_clear_pixmap.lo: sci_gateway/c/sci_clear_pixmap.c
--@am__fastdepCC_TRUE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscigraphics_la-sci_clear_pixmap.lo -MD -MP -MF $(DEPDIR)/libscigraphics_la-sci_clear_pixmap.Tpo -c -o libscigraphics_la-sci_clear_pixmap.lo `test -f 'sci_gateway/c/sci_clear_pixmap.c' || echo '$(srcdir)/'`sci_gateway/c/sci_clear_pixmap.c
--@am__fastdepCC_TRUE@  $(am__mv) $(DEPDIR)/libscigraphics_la-sci_clear_pixmap.Tpo $(DEPDIR)/libscigraphics_la-sci_clear_pixmap.Plo
--@AMDEP_TRUE@@am__fastdepCC_FALSE@     source='sci_gateway/c/sci_clear_pixmap.c' object='libscigraphics_la-sci_clear_pixmap.lo' libtool=yes @AMDEPBACKSLASH@
--@AMDEP_TRUE@@am__fastdepCC_FALSE@     DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
--@am__fastdepCC_FALSE@ $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_la-sci_clear_pixmap.lo `test -f 'sci_gateway/c/sci_clear_pixmap.c' || echo '$(srcdir)/'`sci_gateway/c/sci_clear_pixmap.c
--
  libscigraphics_la-sci_glue.lo: sci_gateway/c/sci_glue.c
  @am__fastdepCC_TRUE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscigraphics_la-sci_glue.lo -MD -MP -MF $(DEPDIR)/libscigraphics_la-sci_glue.Tpo -c -o libscigraphics_la-sci_glue.lo `test -f 'sci_gateway/c/sci_glue.c' || echo '$(srcdir)/'`sci_gateway/c/sci_glue.c
  @am__fastdepCC_TRUE@  $(am__mv) $(DEPDIR)/libscigraphics_la-sci_glue.Tpo $(DEPDIR)/libscigraphics_la-sci_glue.Plo
@@@ -4415,13 -4373,13 +4403,6 @@@ libscigraphics_la-sci_is_handle_valid.l
  @AMDEP_TRUE@@am__fastdepCC_FALSE@     DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
  @am__fastdepCC_FALSE@ $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_la-sci_is_handle_valid.lo `test -f 'sci_gateway/c/sci_is_handle_valid.c' || echo '$(srcdir)/'`sci_gateway/c/sci_is_handle_valid.c
  
--libscigraphics_la-sci_show_pixmap.lo: sci_gateway/c/sci_show_pixmap.c
--@am__fastdepCC_TRUE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscigraphics_la-sci_show_pixmap.lo -MD -MP -MF $(DEPDIR)/libscigraphics_la-sci_show_pixmap.Tpo -c -o libscigraphics_la-sci_show_pixmap.lo `test -f 'sci_gateway/c/sci_show_pixmap.c' || echo '$(srcdir)/'`sci_gateway/c/sci_show_pixmap.c
--@am__fastdepCC_TRUE@  $(am__mv) $(DEPDIR)/libscigraphics_la-sci_show_pixmap.Tpo $(DEPDIR)/libscigraphics_la-sci_show_pixmap.Plo
--@AMDEP_TRUE@@am__fastdepCC_FALSE@     source='sci_gateway/c/sci_show_pixmap.c' object='libscigraphics_la-sci_show_pixmap.lo' libtool=yes @AMDEPBACKSLASH@
--@AMDEP_TRUE@@am__fastdepCC_FALSE@     DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
--@am__fastdepCC_FALSE@ $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_la-sci_show_pixmap.lo `test -f 'sci_gateway/c/sci_show_pixmap.c' || echo '$(srcdir)/'`sci_gateway/c/sci_show_pixmap.c
--
  libscigraphics_la-sci_Legend.lo: sci_gateway/c/sci_Legend.c
  @am__fastdepCC_TRUE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscigraphics_la-sci_Legend.lo -MD -MP -MF $(DEPDIR)/libscigraphics_la-sci_Legend.Tpo -c -o libscigraphics_la-sci_Legend.lo `test -f 'sci_gateway/c/sci_Legend.c' || echo '$(srcdir)/'`sci_gateway/c/sci_Legend.c
  @am__fastdepCC_TRUE@  $(am__mv) $(DEPDIR)/libscigraphics_la-sci_Legend.Tpo $(DEPDIR)/libscigraphics_la-sci_Legend.Plo
@@@ -32,14 -17,8 +17,6 @@@ elementtype
  findopt_
  firstopt_
  freeArrayOfString
- get_optionals
- GetDataSize
- GetData
- getlistrhsvar_
- getmatdims_
- getrhsvar_
- gettype_
- GetVarDimension
 -getScilabMode
 -getWarningMode
  intersci_
  iop_
  numopt_
@@@ -62,4 -40,7 +38,7 @@@ sciReturnStrin
  sciReturnUserData
  stack_
  vartype_
- vstk_
+ vstk_
+ GetDataSize
+ GetData
 -cha1_
++cha1_
@@@ -403,7 -363,7 +403,6 @@@ lib /DEF:"$(ProjectDir)elementary_funct
      <ClCompile Include="src\c\Plo2dEch.c" />
      <ClCompile Include="src\c\Plo2dn.c" />
      <ClCompile Include="sci_gateway\c\sci_champ.c" />
--    <ClCompile Include="sci_gateway\c\sci_clear_pixmap.c" />
      <ClCompile Include="sci_gateway\c\sci_contour2di.c" />
      <ClCompile Include="sci_gateway\c\sci_copy.c" />
      <ClCompile Include="sci_gateway\c\sci_delete.c" />
      <ClCompile Include="sci_gateway\c\sci_rotate_axes.c" />
      <ClCompile Include="sci_gateway\c\sci_rubberbox.c" />
      <ClCompile Include="sci_gateway\c\sci_set.c" />
--    <ClCompile Include="sci_gateway\c\sci_show_pixmap.c" />
      <ClCompile Include="sci_gateway\c\sci_show_window.c" />
      <ClCompile Include="sci_gateway\c\sci_StringBox.c" />
      <ClCompile Include="sci_gateway\c\sci_swap_handles.c" />
      <ClCompile Include="sci_gateway\c\sci_champ.c">
        <Filter>Source Files</Filter>
      </ClCompile>
--    <ClCompile Include="sci_gateway\c\sci_clear_pixmap.c">
--      <Filter>Source Files</Filter>
--    </ClCompile>
      <ClCompile Include="sci_gateway\c\sci_contour2di.c">
        <Filter>Source Files</Filter>
      </ClCompile>
      <ClCompile Include="sci_gateway\c\sci_set.c">
        <Filter>Source Files</Filter>
      </ClCompile>
--    <ClCompile Include="sci_gateway\c\sci_show_pixmap.c">
--      <Filter>Source Files</Filter>
--    </ClCompile>
      <ClCompile Include="sci_gateway\c\sci_show_window.c">
        <Filter>Source Files</Filter>
      </ClCompile>
      <None Include="Elementary_functions_f_Import.def">
        <Filter>Libraries Dependencies\Imports</Filter>
      </None>
 +    <None Include="locales\graphics.pot" />
 +    <None Include="locales\graphics.pot" />
++    <None Include="locales\graphics.pot" />
    </ItemGroup>
    <ItemGroup>
      <ResourceCompile Include="graphic.rc">
@@@ -21,7 -21,7 +21,7 @@@
  #define _GET_COMMAND_ARG_H_
  
  #include "dynlib_graphics.h"
--#include "stack-c.h"
++#include "api_scilab.h"
  #include "BOOL.h"
  
  /*------------------------------------------------------------------------*/
  /*--------------------------------------------------------------------------*/
  GRAPHICS_IMPEXP int gw_graphics(void);
  
--GRAPHICS_IMPEXP int sci_addcb(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_champ(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_champ1(char *fname, unsigned long fname_len);
++GRAPHICS_IMPEXP int sci_addcb(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_champ(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_champ1(char *fname, void *pvApiCtx);
  GRAPHICS_IMPEXP int sci_champ_G(char *fname,
                                  int (*func) (double *, double *, double *, double *, int *, int *, char *, double *, double *, int),
--                                unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xarc(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xarcs(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_zoom_rect(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xtitle(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xstringb(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xstring(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xsetech(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xset(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xsegs(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xrects(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xrect(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xpolys(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xpoly(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xname(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xlfont(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xgrid(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xgraduate(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xgetmouse(char *fname, unsigned long fname_len);
--GRAPHICS_IMPEXP int sci_xgetech(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_xget(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_xfpolys(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_xfpoly(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_xfarcs(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_xdel(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_xclick(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_xchange(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_xarrows(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_winsid(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_unzoom(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_unglue(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_swap_handles(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_stringbox(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_show_window(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_set(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_rubberbox(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_rotate_axes(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_relocate_handle(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_plot3d(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_plot2d1(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_plot2d1_1(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_plot2d1_2(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_plot2d1_3(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_plot2d1_4(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_plot2d2(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_plot2d3(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_plot2d4(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_plot2d1_G(char *fname, int ptype, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_plot2d(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_param3d1(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_param3d(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_newaxes(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_move(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_matlot1(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_matplot1(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_matlot(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_matplot(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_Legend(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_is_handle_valid(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_grayplot(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_glue(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_get(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_geom3d(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_fec(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_drawnow(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_drawlater(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_drawaxis(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_demo(char *fname, int fname_len);
 -GRAPHICS_IMPEXP int sci_delete(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_copy(char *fname, unsigned long fname_len);
 -GRAPHICS_IMPEXP int sci_contour2di(char *fname, unsigned long fname_len);
++                                void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xarc(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xarcs(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_zoom_rect(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xtitle(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xstringb(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xstring(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xsetech(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xset(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xsegs(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xrects(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xrect(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xpolys(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xpoly(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xname(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xlfont(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xgrid(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xgraduate(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xgetmouse(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xgetech(char *fname, void *pvApiCtx);
 +GRAPHICS_IMPEXP int sci_xget(char *fname, void *pvApiCtx);
- GRAPHICS_IMPEXP int sci_xfpolys(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_xfpoly(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_xfarcs(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_xdel(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_xclick(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_xchange(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_xarrows(char *fname, unsigned long fname_len);
++GRAPHICS_IMPEXP int sci_xfpolys(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xfpoly(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xfarcs(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xdel(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xclick(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xchange(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_xarrows(char *fname, void *pvApiCtx);
 +GRAPHICS_IMPEXP int sci_winsid(char *fname, void *pvApiCtx);
- GRAPHICS_IMPEXP int sci_unzoom(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_unglue(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_swap_handles(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_stringbox(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_show_window(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_show_pixmap(char *fname, unsigned long fname_len);
++GRAPHICS_IMPEXP int sci_unzoom(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_unglue(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_swap_handles(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_stringbox(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_show_window(char *fname, void *pvApiCtx);
 +GRAPHICS_IMPEXP int sci_set(char *fname, void *pvApiCtx);
- GRAPHICS_IMPEXP int sci_rubberbox(char *fname, unsigned long fname_len);
++GRAPHICS_IMPEXP int sci_rubberbox(char *fname, void *pvApiCtx);
 +GRAPHICS_IMPEXP int sci_rotate_axes(char *fname, void *pvApiCtx);
- GRAPHICS_IMPEXP int sci_relocate_handle(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_plot3d(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_plot2d1(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_plot2d1_1(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_plot2d1_2(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_plot2d1_3(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_plot2d1_4(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_plot2d2(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_plot2d3(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_plot2d4(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_plot2d1_G(char *fname, int ptype, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_plot2d(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_param3d1(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_param3d(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_newaxes(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_move(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_matlot1(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_matplot1(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_matlot(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_matplot(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_Legend(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_is_handle_valid(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_grayplot(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_glue(char *fname, unsigned long fname_len);
++GRAPHICS_IMPEXP int sci_relocate_handle(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_plot3d(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_plot2d1(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_plot2d1_1(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_plot2d1_2(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_plot2d1_3(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_plot2d1_4(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_plot2d2(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_plot2d3(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_plot2d4(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_plot2d1_G(char *fname, int ptype, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_plot2d(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_param3d1(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_param3d(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_newaxes(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_move(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_matlot1(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_matplot1(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_matlot(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_matplot(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_Legend(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_is_handle_valid(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_grayplot(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_glue(char *fname, void *pvApiCtx);
 +GRAPHICS_IMPEXP int sci_get(char *fname, void *pvApiCtx);
- GRAPHICS_IMPEXP int sci_geom3d(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_fec(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_drawnow(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_drawlater(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_drawaxis(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_draw(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_demo(char *fname, int fname_len);
- GRAPHICS_IMPEXP int sci_delete(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_copy(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_contour2di(char *fname, unsigned long fname_len);
- GRAPHICS_IMPEXP int sci_clear_pixmap(char *fname, unsigned long fname_len);
++GRAPHICS_IMPEXP int sci_geom3d(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_fec(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_drawnow(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_drawlater(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_drawaxis(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_demo(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_delete(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_copy(char *fname, void *pvApiCtx);
++GRAPHICS_IMPEXP int sci_contour2di(char *fname, void *pvApiCtx);
  
  /*--------------------------------------------------------------------------*/
  #endif /* __INTGRAPHICS__ */
  #define DEF_LEGEND_LOCATION "in_upper_right"
  
  /*--------------------------------------------------------------------------*/
- int sci_Legend( char * fname, unsigned long fname_len )
 -int sci_Legend(char * fname, unsigned long fname_len)
++int sci_Legend(char * fname, void *pvApiCtx)
  {
-     int numrow = 0, numcol = 0, l1 = 0, l2 = 0, n = 0, m2 = 0, n2 = 0;
+     SciErr sciErr;
+     double* Empty = NULL;
+     int* piAddrl1 = NULL;
+     long long* l1 = NULL;
+     int* piAddrStr = NULL;
+     int* piAddrl2 = NULL;
+     char* l2 = NULL;
+     long long* outindex = NULL;
+     int numrow = 0, numcol = 0, n = 0, m2 = 0, n2 = 0;
      long handlesvalue = 0;
-     int outindex = 0, i = 0;
+     int i = 0;
      char *pobjUID = NULL;
      long long *tabofhandles = NULL;
      char * psubwinUID = NULL;
  #define DEFAULT_ANGLE 0.0
  
  /*--------------------------------------------------------------------------*/
- static int getScalarFromStack(int paramIndex, char * funcName, double * res);
 -static int getScalarFromStack(int paramIndex, char * funcName, double* res);
++static int getScalarFromStack(int paramIndex, char * funcName, double* res, void* pvApiCtx);
  /*--------------------------------------------------------------------------*/
- static int getScalarFromStack(int paramIndex, char * funcName, double * res)
 -static int getScalarFromStack(int paramIndex, char * funcName, double* res)
++static int getScalarFromStack(int paramIndex, char * funcName, double* res, void* pvApiCtx)
  {
+     SciErr sciErr;
      int m = 0;
      int n = 0;
-     size_t stackPointer = 0;
-     if ( VarType(paramIndex) != sci_matrix )
+     int* piAddrstackPointer = NULL;
+     double* stackPointer = NULL;
+     if ((!checkInputArgumentType(pvApiCtx, paramIndex, sci_matrix)))
      {
          Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), funcName, paramIndex);
-         return -1 ;
+         return -1;
      }
  
      /* get the handle */
      return 0;
  }
  /*--------------------------------------------------------------------------*/
- int sci_stringbox( char * fname, unsigned long fname_len )
 -int sci_stringbox(char * fname, unsigned long fname_len)
++int sci_stringbox(char * fname, void *pvApiCtx)
  {
+     SciErr sciErr;
+     int* piAddrstackPointer = NULL;
+     long long* stackPointer = NULL;
+     char** strStackPointer   = NULL;
+     double* pdblStackPointer = NULL;
      int type = -1;
      int *piType = &type;
      char* parentAxes = NULL;
      double* textCorners = NULL;
      int two   = 2;
          getGraphicObjectProperty(parentSubwinUID, __GO_FONT_SIZE__, jni_double, (void **)&pfontSize);
  
          /* Check that first argument is a string */
-         if ( VarType(1) != sci_strings )
+         if ((!checkInputArgumentType(pvApiCtx, 1, sci_strings)))
          {
              Scierror(999, _("%s: Wrong type for input argument #%d: 2D array of strings expected.\n"), fname, 1);
-             return 0 ;
+             return 0;
+         }
+         sciErr = getVarAddressFromPosition(pvApiCtx,  1, &piAddrstackPointer);
+         if (sciErr.iErr)
+         {
+             printError(&sciErr, 0);
+             return 1;
          }
-         GetRhsVar( 1, MATRIX_OF_STRING_DATATYPE, &textNbRow, &textNbCol, &stackPointer );
+         // Retrieve a matrix of string at position  1.
+         if (getAllocatedMatrixOfString(pvApiCtx, piAddrstackPointer, &textNbRow, &textNbCol, &strStackPointer))
+         {
+             Scierror(202, _("%s: Wrong type for argument #%d: String matrix expected.\n"), fname,  1);
+             return 1;
+         }
          /* retrieve it */
-         text = getStringMatrixFromStack(stackPointer);
+         text = strStackPointer;
  
          /* Second and third arguments should be scalars */
--        if (getScalarFromStack(2, fname, &xPos) < 0)
++        if (getScalarFromStack(2, fname, &xPos, pvApiCtx) < 0)
          {
-             freeArrayOfString(text, textNbRow * textNbCol);
+             freeAllocatedMatrixOfString(textNbRow, textNbCol, strStackPointer);
              return 0;
          }
-         if (getScalarFromStack(3, fname, &yPos) < 0)
 -        if (getScalarFromStack(3, fname, &yPos) < 0)
++        if (getScalarFromStack(3, fname, &yPos, pvApiCtx) < 0)
          {
-             freeArrayOfString(text, textNbRow * textNbCol);
+             freeAllocatedMatrixOfString(textNbRow, textNbCol, strStackPointer);
              return 0;
          }
  
-         if (Rhs >= 4)
+         if (nbInputArgument(pvApiCtx) >= 4)
          {
              /* angle is defined */
--            if (getScalarFromStack(4, fname, &angle) < 0)
++            if (getScalarFromStack(4, fname, &angle, pvApiCtx) < 0)
              {
-                 freeArrayOfString(text, textNbRow * textNbCol);
+                 freeAllocatedMatrixOfString(textNbRow, textNbCol, strStackPointer);
                  return 0;
              }
          }
          {
              double fontIdD;
              /* font style is defined */
--            if (getScalarFromStack(5, fname, &fontIdD) < 0)
++            if (getScalarFromStack(5, fname, &fontIdD, pvApiCtx) < 0)
              {
-                 freeArrayOfString(text, textNbRow * textNbCol);
+                 freeAllocatedMatrixOfString(textNbRow, textNbCol, strStackPointer);
                  return 0;
              }
              fontId = (int) fontIdD;
          }
  
-         if (Rhs >= 6)
+         if (nbInputArgument(pvApiCtx) >= 6)
          {
              /* font size is defined */
--            if (getScalarFromStack(6, fname, &fontSize) < 0)
++            if (getScalarFromStack(6, fname, &fontSize, pvApiCtx) < 0)
              {
-                 freeArrayOfString(text, textNbRow * textNbCol);
+                 freeAllocatedMatrixOfString(textNbRow, textNbCol, strStackPointer);
                  return 0;
              }
          }
@@@ -16,9 -16,9 +16,9 @@@
  /* file: sci_champ.c                                                      */
  /* desc : interface for champ (and champ1) routine                        */
  /*------------------------------------------------------------------------*/
--
++#include <string.h>
  #include "gw_graphics.h"
- #include "stack-c.h"
+ #include "api_scilab.h"
  #include "GetCommandArg.h"
  #include "BuildObjects.h"
  #include "DefaultCommandArg.h"
  #include "localization.h"
  #include "Scierror.h"
  /*--------------------------------------------------------------------------*/
- int sci_champ (char *fname,unsigned long fname_len)
 -int sci_champ (char *fname, unsigned long fname_len)
++int sci_champ (char *fname, void *pvApiCtx)
  {
-     return sci_champ_G(fname,C2F(champ),fname_len);
 -    return sci_champ_G(fname, C2F(champ), fname_len);
++    return sci_champ_G(fname, C2F(champ), pvApiCtx);
  }
  /*--------------------------------------------------------------------------*/
- int sci_champ1 (char *fname,unsigned long fname_len)
 -int sci_champ1 (char *fname, unsigned long fname_len)
++int sci_champ1 (char *fname, void *pvApiCtx)
  {
-     return sci_champ_G(fname,C2F(champ1),fname_len);
 -    return sci_champ_G(fname, C2F(champ1), fname_len);
++    return sci_champ_G(fname, C2F(champ1), pvApiCtx);
  }
  /*--------------------------------------------------------------------------*/
  int sci_champ_G(char *fname,
                  int (*func) (double *, double *, double *, double *, int *, int *, char *, double *, double *, int),
--                unsigned long fname_len)
++                void *pvApiCtx)
  {
+     SciErr sciErr;
      double arfact_def = 1.0;
-     double * arfact = &arfact_def;
-     int m1 = 0, n1 = 0, l1 = 0, m2 = 0, n2 = 0, l2 = 0, m3 = 0, n3 = 0, l3 = 0, m4 = 0, n4 = 0, l4 = 0;
-     static rhs_opts opts[]= { {-1,"arfact","?",0,0,0},
-                               {-1,"rect","?",0,0,0},
-                               {-1,"strf","?",0,0,0},
-                               {-1,NULL,NULL,0,0}};
+     double* arfact = &arfact_def;
+     int m1 = 0, n1 = 0, m2 = 0, n2 = 0, m3 = 0, n3 = 0, m4 = 0, n4 = 0;
+     static rhs_opts opts[] =
+     {
+         { -1, "arfact", -1, 0, 0, NULL},
+         { -1, "rect", -1, 0, 0, NULL},
+         { -1, "strf", -1, 0, 0, NULL},
+         { -1, NULL, -1, 0, 0, NULL}
+     };
+     char   * strf = NULL;
+     double* rect = NULL;
  
-     char   * strf = NULL ;
-     double * rect = NULL ;
+     int* piAddr1 = NULL;
+     int* piAddr2 = NULL;
+     int* piAddr3 = NULL;
+     int* piAddr4 = NULL;
  
-     CheckRhs(-1,7) ;
-     CheckLhs(0,1) ;
+     double* l1 = NULL;
+     double* l2 = NULL;
+     double* l3 = NULL;
+     double* l4 = NULL;
  
-     if (Rhs <= 0)
+     CheckInputArgument(pvApiCtx, -1, 7);
+     CheckOutputArgument(pvApiCtx, 0, 1);
+     if (nbInputArgument(pvApiCtx) <= 0)
      {
--        sci_demo(fname, fname_len);
++        sci_demo(fname, pvApiCtx);
          return 0;
      }
-     else if ( Rhs < 4 )
+     else if (nbInputArgument(pvApiCtx) < 4)
      {
-         Scierror(999,_("%s: Wrong number of input arguments: At least %d expected.\n"),fname,4);
+         Scierror(999, _("%s: Wrong number of input arguments: At least %d expected.\n"), fname, 4);
          return 0;
      }
  
diff --cc scilab/modules/graphics/sci_gateway/c/sci_clear_pixmap.c
index 28c517d,c5a384f..0000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,43 -1,43 +1,0 @@@
--/*
--* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
--* Copyright (C) 2008 - INRIA - Jean-Baptiste Silvy
--*
--* 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
--*
--*/
--
--/*------------------------------------------------------------------------*/
--/* file: sci_clear_pixmap.c                                               */
--/* desc : interface for clear_pixmap routine                              */
--/*------------------------------------------------------------------------*/
--
--#include "gw_graphics.h"
- #include "stack-c.h"
- //#include "warningmode.h"
- #include "sciprint.h"
- #include "localization.h"
- /*--------------------------------------------------------------------------*/
- //
- // FIXME: Remove GW after Scilab 5.4.0
- //
- int sci_clear_pixmap(char *fname, unsigned long fname_len )
- {
-     CheckRhs(0, 0);
-     CheckLhs(0, 1);
-     //    if (getWarningMode())
-     {
-         sciprint(_("%s: Function %s is obsolete.\n"), _("Warning"), fname);
-         sciprint(_("%s: Please use %s instead.\n"), _("Warning"), "drawlater/drawnow");
-         sciprint(_("%s: This function will be permanently removed in Scilab %s\n\n"), _("Warning"), "5.4.1");
-     }
-     LhsVar(1) = 0;
-     PutLhsVar();
-     return 0;
- }
- /*--------------------------------------------------------------------------*/
 -#include "api_scilab.h"
 -#include "warningmode.h"
 -#include "sciprint.h"
 -#include "localization.h"
 -/*--------------------------------------------------------------------------*/
 -//
 -// FIXME: Remove GW after Scilab 5.4.0
 -//
 -int sci_clear_pixmap(char *fname, unsigned long fname_len)
 -{
 -    CheckInputArgument(pvApiCtx, 0, 0);
 -    CheckOutputArgument(pvApiCtx, 0, 1);
 -
 -    if (getWarningMode())
 -    {
 -        sciprint(_("%s: Function %s is obsolete.\n"), _("Warning"), fname);
 -        sciprint(_("%s: Please use %s instead.\n"), _("Warning"), "drawlater/drawnow");
 -        sciprint(_("%s: This function will be permanently removed in Scilab %s\n\n"), _("Warning"), "5.4.1");
 -    }
 -
 -    AssignOutputVariable(pvApiCtx, 1) = 0;
 -    ReturnArguments(pvApiCtx);
 -    return 0;
 -}
 -/*--------------------------------------------------------------------------*/
  #include "localization.h"
  
  /*--------------------------------------------------------------------------*/
- int sci_contour2di( char * fname, unsigned long fname_len )
 -int sci_contour2di(char * fname, unsigned long fname_len)
++int sci_contour2di(char * fname, void* pvApiCtx)
  {
-   int flagx = 0, nz = 10; /* default number of level curves : 10 */
-   int m1 = 0, n1 = 0, l1 = 0, m2 = 0, n2 = 0, l2 = 0, m3 = 0, n3 = 0, l3 = 0, m4 = 0, n4 = 0, l4 = 0, l5 = 0;
-   double  *hl1 = NULL, *hl2 = NULL;
-   double *znz= NULL;
-   int ix4, i = 0, un = 1;
-   CheckRhs(3,4);
-   CheckLhs(2,2);
-   GetRhsVar(1,MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
-   CheckVector(1,m1,n1);
-   GetRhsVar(2,MATRIX_OF_DOUBLE_DATATYPE, &m2, &n2, &l2);
-   CheckVector(2,m2,n2);
-   GetRhsVar(3,MATRIX_OF_DOUBLE_DATATYPE, &m3, &n3, &l3);
-   if (m3 * n3 == 0) {
-               LhsVar(1) = 0;
-               PutLhsVar();
-               return 0;
-       }
-   if (m3 == 1 || n3 == 1) {
-     Scierror(999,_("%s: Wrong type for input argument #%d: Matrix expected.\n"),fname,3);
+     SciErr sciErr;
+     int flagx = 0, nz = 10; /* default number of level curves : 10 */
+     int m1 = 0, n1 = 0, m2 = 0, n2 = 0, m3 = 0, n3 = 0, m4 = 0, n4 = 0;
+     double* hl1 = NULL;
+     double* hl2 = NULL;
+     double* znz = NULL;
+     int ix4, i = 0, un = 1;
+     int* piAddr1 = NULL;
+     int* piAddr2 = NULL;
+     int* piAddr3 = NULL;
+     int* piAddr4 = NULL;
+     double* l1 = NULL;
+     double* l2 = NULL;
+     double* l3 = NULL;
+     double* l4 = NULL;
+     int* l5    = NULL;
+     CheckInputArgument(pvApiCtx, 4, 4);
+     CheckOutputArgument(pvApiCtx, 2, 2);
+     //get variable address
+     sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
+     if (sciErr.iErr)
+     {
+         printError(&sciErr, 0);
+         return 1;
+     }
+     // Retrieve a matrix of double at position 1.
+     sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &m1, &n1, &l1);
+     if (sciErr.iErr)
+     {
+         Scierror(202, _("%s: Wrong type for argument %d: A real expected.\n"), fname, 1);
+         printError(&sciErr, 0);
+         return 1;
+     }
+     //CheckVector
+     if (m1 != 1 && n1 != 1)
+     {
+         Scierror(999, _("%s: Wrong size for input argument #%d: Vector expected.\n"), fname, 1);
+         return 1;
+     }
+     //get variable address
+     sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
+     if (sciErr.iErr)
+     {
+         printError(&sciErr, 0);
+         return 1;
+     }
+     // Retrieve a matrix of double at position 2.
+     sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &m2, &n2, &l2);
+     if (sciErr.iErr)
+     {
+         Scierror(202, _("%s: Wrong type for argument %d: A real expected.\n"), fname, 2);
+         printError(&sciErr, 0);
+         return 1;
+     }
+     //CheckVector
+     if (m2 != 1 && n2 != 1)
+     {
+         Scierror(999, _("%s: Wrong size for input argument #%d: Vector expected.\n"), fname, 2);
+         return 1;
+     }
+     //get variable address
+     sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3);
+     if (sciErr.iErr)
+     {
+         printError(&sciErr, 0);
+         return 1;
+     }
+     // Retrieve a matrix of double at position 3.
+     sciErr = getMatrixOfDouble(pvApiCtx, piAddr3, &m3, &n3, &l3);
+     if (sciErr.iErr)
+     {
+         Scierror(202, _("%s: Wrong type for argument %d: A real expected.\n"), fname, 3);
+         printError(&sciErr, 0);
+         return 1;
+     }
+     if (m3 * n3 == 0)
+     {
+         AssignOutputVariable(pvApiCtx, 1) = 0;
+         ReturnArguments(pvApiCtx);
+         return 0;
+     }
+     if (m3 == 1 || n3 == 1)
+     {
+         Scierror(999, _("%s: Wrong type for input argument #%d: Matrix expected.\n"), fname, 3);
+         return 1;
+     }
+     //CheckDimProp
+     if (m1 * n1 != m3)
+     {
+         Scierror(999, _("%s: Wrong size for input arguments: Incompatible sizes.\n"), fname);
+         return 1;
+     }
+     //CheckDimProp
+     if (m2 * n2 != n3)
+     {
+         Scierror(999, _("%s: Wrong size for input arguments: Incompatible sizes.\n"), fname);
+         return 1;
+     }
+     /*     number of level curves */
+     //get variable address
+     sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddr4);
+     if (sciErr.iErr)
+     {
+         printError(&sciErr, 0);
+         return 1;
+     }
+     // Retrieve a matrix of double at position 4.
+     sciErr = getMatrixOfDouble(pvApiCtx, piAddr4, &m4, &n4, &l4);
+     if (sciErr.iErr)
+     {
+         Scierror(202, _("%s: Wrong type for argument %d: A real expected.\n"), fname, 4);
+         printError(&sciErr, 0);
+         return 1;
+     }
+     if (m4 * n4 == 1)
+     {
+         flagx = 0;
+         nz = Max(1, (int)  * (l4));
+         znz = (l4);
+     }
+     else
+     {
+         flagx = 1;
+         nz = m4 * n4;
+         znz = (l4);
+     }
+     ix4 = Max(nz, 2);
+     sciErr = allocMatrixOfDoubleAsInteger(pvApiCtx, 5, un, ix4, &l5);
+     if (sciErr.iErr)
+     {
+         printError(&sciErr, 0);
+         Scierror(999, _("%s: Memory allocation error.\n"), fname);
+         return 1;
+     }
+     for (i = 0 ; i < ix4 ; ++i)
+     {
+         l5[i] = i + 1;
+     }
+     if (nz == 1)
+     {
+         l5[1] = 1;
+     }
+     if (C2F(contourif)(l1, l2, l3, &m3, &n3, &flagx, &nz, znz, l5) != 0)
+     {
+         /* Something wrong happened */
+         return -1;
+     }
+     C2F(getconts)(&hl1, &hl2, &m1, &n1);
+     if (n1 == 0)
+     {
+         sciErr = allocMatrixOfDouble(pvApiCtx, 6, n1, n1, &hl1);
+         if (sciErr.iErr)
+         {
+             printError(&sciErr, 0);
+             Scierror(999, _("%s: Memory allocation error.\n"), fname);
+             return 1;
+         }
+         sciErr = allocMatrixOfDouble(pvApiCtx, 7, n1, n1, &hl2);
+         if (sciErr.iErr)
+         {
+             printError(&sciErr, 0);
+             Scierror(999, _("%s: Memory allocation error.\n"), fname);
+             return 1;
+         }
+     }
+     else
+     {
+         sciErr = createMatrixOfDouble(pvApiCtx, 6, m1, n1, hl1);
+         if (sciErr.iErr)
+         {
+             printError(&sciErr, 0);
+             Scierror(999, _("%s: Memory allocation error.\n"), fname);
+             return 1;
+         }
+         sciErr = createMatrixOfDouble(pvApiCtx, 7, m1, n1, hl2);
+         if (sciErr.iErr)
+         {
+             printError(&sciErr, 0);
+             Scierror(999, _("%s: Memory allocation error.\n"), fname);
+             return 1;
+         }
+     }
+     AssignOutputVariable(pvApiCtx, 1) = 6;
+     AssignOutputVariable(pvApiCtx, 2) = 7;
+     ReturnArguments(pvApiCtx);
      return 0;
-   }
-   CheckDimProp(1,3, m1 * n1 != m3); 
-   CheckDimProp(2,3, m2 * n2 != n3); 
-   /*     number of level curves */
-   if ( Rhs == 4 ) 
-   {
-     GetRhsVar(4,MATRIX_OF_DOUBLE_DATATYPE, &m4, &n4, &l4);
-     if (m4 * n4 == 1) {
-       flagx = 0;  nz = Max(1,(int)  *stk(l4)),znz= stk(l4);
-     } else {
-       flagx = 1;  nz = m4 * n4; znz=stk(l4);
-     }
-   }
-   ix4 = Max(nz,2);
-   CreateVar(Rhs+1,MATRIX_OF_INTEGER_DATATYPE,&un,&ix4,&l5);
-   for (i =0 ; i < ix4 ; ++i) *istk(l5 + i ) = i+1;
-   if (nz == 1) *istk(l5 +1) = 1;
-   if (C2F(contourif)(stk(l1),stk(l2),stk(l3),&m3,&n3,&flagx,&nz,znz,istk(l5)) != 0)
-       {
-               /* Something wrong happened */
-               return -1;      
-       }
-   C2F(getconts)(&hl1, &hl2, &m1, &n1);
-   if (n1 == 0)
-   {
-     CreateVar(6,MATRIX_OF_DOUBLE_DATATYPE, &n1, &n1, &l1);
-     CreateVar(7,MATRIX_OF_DOUBLE_DATATYPE, &n1, &n1, &l2);
-   }
-   else 
-   {
-     CreateVarFromPtr(6,MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &hl1);
-     CreateVarFromPtr(7,MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &hl2);
-   }
-   LhsVar(1)=Rhs+2;
-   LhsVar(2)=Rhs+3;
-   PutLhsVar();
-   return 0;
  }
  /*--------------------------------------------------------------------------*/
@@@ -19,9 -19,9 +19,9 @@@
  /*------------------------------------------------------------------------*/
  
  #include <stdlib.h>
--
++#include <string.h>
  #include "gw_graphics.h"
- #include "stack-c.h"
+ #include "api_scilab.h"
  #include "GetProperty.h"
  #include "CloneObjects.h"
  #include "localization.h"
  #include "graphicObjectProperties.h"
  #include "createGraphicObject.h"
  /*--------------------------------------------------------------------------*/
--int sci_copy(char *fname, unsigned long fname_len)
++int sci_copy(char *fname, void* pvApiCtx)
  {
+     SciErr sciErr;
+     int* piAddrl1 = NULL;
+     long long* l1 = NULL;
+     int* piAddrl2 = NULL;
+     long long* l2 = NULL;
+     long long* outindex = NULL;
      unsigned long hdl = 0, hdlparent = 0;
      char *pobjUID = NULL, *psubwinparenttargetUID = NULL, *pcopyobjUID = NULL;
-     int m1 = 0, n1 = 0, l1 = 0, l2 = 0;
-     int numrow = 0, numcol = 0, outindex = 0, lw = 0;
      int iType = -1;
      int *piType = &iType;
+     int m1 = 0, n1 = 0;
 -    int numrow = 0, numcol = 0, lw = 0;
++    int numrow = 0, numcol = 0;
      int isPolyline = 0;
  
-     CheckRhs(1, 2);
-     CheckLhs(0, 1);
+     CheckInputArgument(pvApiCtx, 1, 2);
+     CheckOutputArgument(pvApiCtx, 0, 1);
  
      /*  set or create a graphic window*/
-     lw = 1 + Top - Rhs;
-     GetRhsVar(1, GRAPHICAL_HANDLE_DATATYPE, &m1, &n1, &l1); /* Gets the Handle passed as argument*/
 -    lw = 1 + nbArgumentOnStack(pvApiCtx) - nbInputArgument(pvApiCtx);
+     sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrl1);
+     if (sciErr.iErr)
+     {
+         printError(&sciErr, 0);
+         return 1;
+     }
+     // Retrieve a matrix of handle at position 1.
+     sciErr = getMatrixOfHandle(pvApiCtx, piAddrl1, &m1, &n1, &l1); /* Gets the Handle passed as argument*/
+     if (sciErr.iErr)
+     {
+         printError(&sciErr, 0);
+         Scierror(202, _("%s: Wrong type for argument %d: Handle matrix expected.\n"), fname, 1);
+         return 1;
+     }
      if (m1 != 1 || n1 != 1)
      {
--        C2F(overload)(&lw, "copy", 4);
++        OverLoad(1);
          return 0;
      }
  
  
      getGraphicObjectProperty(pobjUID, __GO_TYPE__, jni_int, (void **)&piType);
  
-     if (piType != __GO_TEXT__ &&
-         piType != __GO_ARC__ &&
-         piType != __GO_POLYLINE__ &&
-         piType != __GO_RECTANGLE__)
+     if (iType != __GO_TEXT__ &&
+             iType != __GO_ARC__ &&
+             iType != __GO_POLYLINE__ &&
+             iType != __GO_RECTANGLE__)
      {
--        C2F(overload)(&lw, "copy", 4);
++        OverLoad(1);
          return 0;
      }
  
  #include "CurrentSubwin.h"
  #include "sciprint.h"
  
 -#ifdef _MSC_VER
 -#include "strdup_windows.h"
 -#endif
 +#include "os_strdup.h"
  /*--------------------------------------------------------------------------*/
--int sci_delete(char *fname, unsigned long fname_len)
++int sci_delete(char *fname, void* pvApiCtx)
  {
-     int m1 = 0, n1 = 0, l1 = 0, m2 = 0, n2 = 0, l2 = 0, lw = 0;
+     SciErr sciErr;
+     int* piAddrl1 = NULL;
+     long long* l1 = NULL;
+     int* piAddrl2 = NULL;
+     char* l2 = NULL;
 -    int m1 = 0, n1 = 0, lw = 0;
++    int m1 = 0, n1 = 0;
      unsigned long hdl = 0;
      int nb_handles = 0, i = 0, dont_overload = 0;
      char *pobjUID = NULL;
                  break;
              default:
                  // Overload
-                 lw = 1 + Top - Rhs;
-                 C2F(overload) (&lw, "delete", 6);
 -                lw = 1 + nbArgumentOnStack(pvApiCtx) - nbInputArgument(pvApiCtx);
 -                C2F(overload) (&lw, "delete", 6);
++                OverLoad(1);
                  return 0;
          }
      }
      if (!dont_overload)
      {
          // Overload
-         lw = 1 + Top - Rhs;
-         C2F(overload) (&lw, "delete", 6);
 -        lw = 1 + nbArgumentOnStack(pvApiCtx) - nbInputArgument(pvApiCtx);
 -        C2F(overload) (&lw, "delete", 6);
++        OverLoad(1);
      }
      else
      {
  /* desc : function used to launch a demo of a command                     */
  /*------------------------------------------------------------------------*/
  
- #include "stack2.h"
+ #include "api_scilab.h"
++#include <string.h>
++#include "gw_graphics.h"
  
- int sci_demo( char * fname, int fname_len)
 -int sci_demo(char * fname, int fname_len)
++int sci_demo(char * fname, void* pvApiCtx)
  {
-   int lw = 0;
-   C2F(overload)(&lw, fname, fname_len);
-   return 0;
 -    int lw = 0;
 -    C2F(overload)(&lw, fname, fname_len);
++    OverLoad(0);
+     return 0;
  }
  /* file: sci_draw.h                                                       */
  /* desc : interface for draw routine                                      */
  /*------------------------------------------------------------------------*/
- #include "stack-c.h"
+ #include "api_scilab.h"
  #include "gw_graphics.h"
 -#include "warningmode.h"
 +//#include "warningmode.h"
  #include "sciprint.h"
  #include "localization.h"
  /*--------------------------------------------------------------------------*/
  //
  // FIXME: Remove GW after Scilab 5.4.0
  //
- int sci_draw( char * fname, unsigned long fname_len )
 -int sci_draw(char * fname, unsigned long fname_len)
++int sci_draw(char * fname, void* pvApiCtx)
  {
  
-     CheckRhs(0, 1) ;
-     CheckLhs(0, 1) ;
+     CheckInputArgument(pvApiCtx, 0, 1);
+     CheckOutputArgument(pvApiCtx, 0, 1);
  
 -    if (getWarningMode())
 +    //    if (getWarningMode())
      {
          sciprint(_("%s: Function %s is obsolete.\n"), _("Warning"), fname);
          sciprint(_("%s: Please see documentation for more details.\n"), _("Warning"));
  #include "CurrentSubwin.h"
  
  /*--------------------------------------------------------------------------*/
+ // get_optionals not yet managed
+ /*--------------------------------------------------------------------------*/
  static int check_xy(char *fname, char dir, int mn, int xpos, int xm, int xn,
-                     long unsigned int xl, int ypos, int yRow, int yCol, long unsigned int yl, int *ntics);
+                     double* pdblX, int ypos, int yRow, int yCol, double* pdblY, int *ntics);
  
  /*--------------------------------------------------------------------------*/
--int sci_drawaxis(char *fname, unsigned long fname_len)
++int sci_drawaxis(char *fname, void* pvApiCtx)
  {
      /** XXXXX : un point en suspens c'est le "S" ou une adresse est
       *  stockees ds un unsigned long : est ce sufisant ?
@@@ -24,7 -26,7 +26,7 @@@
  #include "setGraphicObjectProperty.h"
  #include "graphicObjectProperties.h"
  /*--------------------------------------------------------------------------*/
- int sci_drawlater( char * fname, unsigned long fname_len )
 -int sci_drawlater(char * fname, unsigned long fname_len)
++int sci_drawlater(char * fname, void* pvApiCtx)
  {
      int iFalse =  (int)FALSE;
      char* pFigureUID = NULL;
@@@ -23,9 -25,9 +25,9 @@@
  #include "setGraphicObjectProperty.h"
  #include "graphicObjectProperties.h"
  /*--------------------------------------------------------------------------*/
--int sci_drawnow(char *fname, unsigned long fname_len)
++int sci_drawnow(char *fname, void* pvApiCtx)
  {
-     int iTrue =  (int)TRUE;
+     int iTrue = (int)TRUE;
      char* pFigureUID = NULL;
      char* pSubwinUID = NULL;
  
@@@ -16,9 -16,9 +16,9 @@@
  /* file: sci_fec.c                                                        */
  /* desc : interface for sci_fec routine                                   */
  /*------------------------------------------------------------------------*/
--
++#include <string.h>
  #include "gw_graphics.h"
- #include "stack-c.h"
+ #include "api_scilab.h"
  #include "GetCommandArg.h"
  #include "BuildObjects.h"
  #include "sciCall.h"
  #include "Scierror.h"
  
  /*--------------------------------------------------------------------------*/
- int sci_fec(char *fname,unsigned long fname_len)
 -int sci_fec(char *fname, unsigned long fname_len)
++int sci_fec(char *fname, void *pvApiCtx)
  {
-     int m1 = 0,n1 = 0,l1 = 0,m2 = 0,n2 = 0,l2 = 0,m3 = 0,n3 = 0,l3 = 0,m4 = 0,n4 = 0,l4 = 0, mn1 = 0;
-     static rhs_opts opts[]= { {-1,"colminmax","?",0,0,0},
-                               {-1,"colout","?",0,0,0},
-                               {-1,"leg","?",0,0,0},
-                               {-1,"mesh","?",0,0,0},
-                               {-1,"nax","?",0,0,0},
-                               {-1,"rect","?",0,0,0},
-                               {-1,"strf","?",0,0,0},
-                               {-1,"zminmax","?",0,0,0},
-                               {-1,NULL,NULL,0,0}        } ;
-     char * strf = NULL ;
-     char * legend = NULL ;
-     double * rect = NULL ;
-     double * zminmax = NULL ;
-     int * colminmax = NULL ;
-     int * nax = NULL ;
-     int * colOut = NULL ;
-     BOOL flagNax = FALSE ;
-     BOOL withMesh = FALSE ;
-     if (Rhs <= 0)
-     {
-               sci_demo(fname, fname_len);
-               return 0;
+     SciErr sciErr;
+     int m1 = 0, n1 = 0, m2 = 0, n2 = 0, m3 = 0, n3 = 0, m4 = 0, n4 = 0, mn1 = 0;
+     static rhs_opts opts[] =
+     {
+         { -1, "colminmax", -1, 0, 0, NULL},
+         { -1, "colout", -1, 0, 0, NULL},
+         { -1, "leg", -1, 0, 0, NULL},
+         { -1, "mesh", -1, 0, 0, NULL},
+         { -1, "nax", -1, 0, 0, NULL},
+         { -1, "rect", -1, 0, 0, NULL},
+         { -1, "strf", -1, 0, 0, NULL},
+         { -1, "zminmax", -1, 0, 0, NULL},
+         { -1, NULL, -1, 0, 0, NULL}
+     };
+     char* strf      = NULL;
+     char* legend    = NULL;
+     double* rect    = NULL;
+     double* zminmax = NULL;
+     int* colminmax  = NULL;
+     int* nax        = NULL;
+     int* colOut     = NULL;
+     BOOL flagNax    = FALSE;
+     BOOL withMesh   = FALSE;
+     int* piAddr1 = NULL;
+     int* piAddr2 = NULL;
+     int* piAddr3 = NULL;
+     int* piAddr4 = NULL;
+     double* l1 = NULL;
+     double* l2 = NULL;
+     double* l3 = NULL;
+     double* l4 = NULL;
+     if (nbInputArgument(pvApiCtx) <= 0)
+     {
 -        sci_demo(fname, fname_len);
++        sci_demo(fname, pvApiCtx);
+         return 0;
      }
  
-     CheckRhs(4,12);
+     CheckInputArgument(pvApiCtx, 4, 12);
  
-     if ( get_optionals(fname,opts) == 0)
+     if (getOptionals(pvApiCtx, fname, opts) == 0)
      {
-         PutLhsVar();
+         ReturnArguments(pvApiCtx);
          return 0;
      }
  
@@@ -45,22 -47,91 +47,91 @@@ int geom3d(double *x, double *y, doubl
  }
  
  /*--------------------------------------------------------------------------*/
--int sci_geom3d(char * fname, unsigned long fname_len)