tclsci plugged 74/17274/11
Cedric Delamarre [Mon, 16 Mar 2015 10:19:07 +0000 (11:19 +0100)]
test_run tclsci

Change-Id: I50c12d7255fd4a828b4a971a4dab15f2775776fe

138 files changed:
scilab/modules/ast/includes/system_env/threadmanagement.hxx
scilab/modules/ast/includes/types/threadId.hxx
scilab/modules/ast/src/cpp/system_env/threadmanagement.cpp
scilab/modules/ast/src/cpp/types/threadId.cpp
scilab/modules/core/Makefile.am
scilab/modules/core/Makefile.in
scilab/modules/core/includes/InitScilab.h
scilab/modules/core/includes/runner.hxx
scilab/modules/core/includes/storeCommand.h
scilab/modules/core/includes/tasks.hxx
scilab/modules/core/src/c/core.vcxproj
scilab/modules/core/src/c/core.vcxproj.filters
scilab/modules/core/src/c/dynamic_gateways.c
scilab/modules/core/src/c/dynamic_parallel.c [deleted file]
scilab/modules/core/src/c/dynamic_parallel.h [deleted file]
scilab/modules/core/src/c/dynamic_tclsci.c [deleted file]
scilab/modules/core/src/c/dynamic_tclsci.h [deleted file]
scilab/modules/core/src/c/getstaticDebugInfo_Windows.c
scilab/modules/core/src/cpp/InitScilab.cpp
scilab/modules/core/src/cpp/runner.cpp
scilab/modules/core/src/cpp/storeCommand.cpp
scilab/modules/core/src/cpp/tasks.cpp
scilab/modules/functions_manager/functions_manager.vcxproj
scilab/modules/functions_manager/includes/module_declaration.hxx
scilab/modules/functions_manager/src/cpp/funcmanager.cpp
scilab/modules/graphics/macros/ged.sci
scilab/modules/io/Makefile.am
scilab/modules/io/Makefile.in
scilab/modules/io/src/c/io.vcxproj
scilab/modules/io/src/c/setenvc.c
scilab/modules/scicos/src/c/scicos.c
scilab/modules/tclsci/Makefile.am
scilab/modules/tclsci/Makefile.in
scilab/modules/tclsci/core_Import.def
scilab/modules/tclsci/demos/tk/scale.dem.sce
scilab/modules/tclsci/demos/tk/vscale
scilab/modules/tclsci/includes/InitializeTclTk.h
scilab/modules/tclsci/includes/gw_tclsci.h
scilab/modules/tclsci/includes/tclsci_gw.hxx [new file with mode: 0644]
scilab/modules/tclsci/macros/CloseEditorSaveData.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/DestroyGlobals.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/Dist2polyline.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/EditData.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/GEDeditvar.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/GEDeditvar_get.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/GetSetValue.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/GetTab.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/GetTab2.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/Get_Depth.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/Get_handle_from_index.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/Get_handle_pos_in_list.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/Get_handles_list.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/Get_levels.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/List_handles.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/LoadTicks2TCL.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/LogtoggleX.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/LogtoggleY.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/LogtoggleZ.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ReLoadTicks2TCL.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/Subtickstoggle.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/TK_send_handles_list.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/build_args.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/dist2Arc.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/dist2Ellipse.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_Compound.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_arc.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_axes.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_axis.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_champ.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_copy_entity.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_delete_entity.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_eventhandler.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_fac3d.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_fec.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_figure.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_getobject.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_grayplot.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_legend.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_loop.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_matplot.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_move_entity.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_paste_entity.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_plot3d.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_polyline.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_rectangle.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_segs.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_select_axes.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/ged_text.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/getparaxe.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/getparfig.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/is_in_text.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/pixDist2Arc.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/set3dtlistXYZ.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/set3dtlistXYZC.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setA1val.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setA2val.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setFontStyle.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setGrayplottlist.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setHval.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setLabelsFontStyle.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setLineStyle.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setMarkStyle.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setStyle.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setTicksTList.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setWval.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setXdb.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setXval.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setYdb.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setYval.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setZb.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setZdb.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setZval.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/setchamptlistXYFXFY.sci [new file with mode: 0644]
scilab/modules/tclsci/macros/tkged.sci [new file with mode: 0644]
scilab/modules/tclsci/sci_gateway/c/sci_TCL_DeleteInterp.c
scilab/modules/tclsci/sci_gateway/c/sci_TCL_DoOneEvent.c
scilab/modules/tclsci/sci_gateway/c/sci_TCL_EvalFile.c
scilab/modules/tclsci/sci_gateway/c/sci_TCL_EvalStr.c
scilab/modules/tclsci/sci_gateway/c/sci_TCL_ExistArray.c
scilab/modules/tclsci/sci_gateway/c/sci_TCL_ExistInterp.c
scilab/modules/tclsci/sci_gateway/c/sci_TCL_ExistVar.c
scilab/modules/tclsci/sci_gateway/c/sci_TCL_GetVar.c
scilab/modules/tclsci/sci_gateway/c/sci_TCL_GetVersion.c
scilab/modules/tclsci/sci_gateway/c/sci_TCL_SetVar.c
scilab/modules/tclsci/sci_gateway/c/sci_TCL_UnsetVar.c
scilab/modules/tclsci/sci_gateway/c/sci_TCL_UpVar.c
scilab/modules/tclsci/sci_gateway/c/sci_opentk.c
scilab/modules/tclsci/sci_gateway/cpp/tclsci_gw.cpp [new file with mode: 0644]
scilab/modules/tclsci/sci_gateway/tclsci_gateway.xml
scilab/modules/tclsci/src/c/InitTclTk.c
scilab/modules/tclsci/src/c/LoadUnloadTclsci.c [moved from scilab/modules/tclsci/src/c/DllMainTclsci.c with 77% similarity]
scilab/modules/tclsci/src/c/ScilabEval.c [deleted file]
scilab/modules/tclsci/src/c/TCL_Command.c
scilab/modules/tclsci/src/c/setvar.c
scilab/modules/tclsci/src/c/setvar.h
scilab/modules/tclsci/src/cpp/ScilabEval.cpp [new file with mode: 0644]
scilab/modules/tclsci/tclsci.vcxproj
scilab/modules/tclsci/tclsci.vcxproj.filters

index fd2c603..0f0c141 100644 (file)
@@ -25,6 +25,7 @@ extern "C"
 class EXTERN_AST ThreadManagement
 {
 private :
+
     static __threadLock m_RunnerLock;
     static __threadLock m_ParseLock;
     static __threadLock m_StoreCommandLock;
@@ -48,6 +49,9 @@ private :
     static __threadSignal m_RunMe;
     static __threadSignalLock m_RunMeLock;
 
+    static __threadSignal m_EmptyQueue;
+    static __threadSignalLock m_EmptyQueueLock;
+
     // used to avoid "Spurious Wakeups"
     static bool m_AvailableRunnerWasSignalled;
     static bool m_ConsoleExecDoneWasSignalled;
@@ -55,6 +59,7 @@ private :
     static bool m_StartPendingWasSignalled;
     static bool m_CommandStoredWasSignalled;
     static bool m_RunMeWasSignalled;
+    static bool m_EmptyQueueWasSignalled;
 
 #ifdef DEBUG_THREAD
     static __threadKey m_tkMain;
@@ -94,7 +99,6 @@ private :
     static void PrintDebug(const char* pcfunName);
 #endif // DEBUG_THREAD
 
-
 };
 
 #endif /* !__THREADMANAGEMENT_HXX__ */
index 81c15ec..f80774a 100644 (file)
@@ -75,8 +75,8 @@ public :
     void                    setInterruptible(bool _isInterruptible);
     bool                    isInterruptible();
 
-    void                    setConsoleCommandFlag(bool _isConsoleCommand);
-    bool                    isConsoleCommand();
+    void                    setCommandOrigin(int _iCmdOrigin);
+    int                     getCommandOrigin();
 
 private :
     std::wstring            StatusToString(Status _status);
@@ -99,7 +99,7 @@ private :
     Status                  m_threadStatus;
     bool                    m_doInterrupt;
     bool                    m_isInterruptible;
-    bool                    m_isConsoleCommand;
+    int                     m_iCmdOrigin;
 };
 }
 #endif /* !__THREADID_HH__ */
index e599862..1e31081 100644 (file)
@@ -11,6 +11,7 @@
 */
 
 #include "threadmanagement.hxx"
+#include "runner.hxx"
 
 #ifdef DEBUG_THREAD
 #include <iostream>
@@ -221,6 +222,9 @@ void ThreadManagement::SendConsoleExecDoneSignal(void)
 
 void ThreadManagement::WaitForConsoleExecDoneSignal(void)
 {
+# ifdef __DEBUG_SIGNAL
+    std::cout << "WaitForConsoleExecDoneSignal" << std::endl;
+# endif // __DEBUG_SIGNAL
     __LockSignal(&m_ConsoleExecDoneLock);
     ThreadManagement::UnlockStoreCommand();
     m_ConsoleExecDoneWasSignalled = false;
@@ -248,8 +252,12 @@ void ThreadManagement::WaitForConsoleExecDoneSignal(void)
 
     The loop while is used to avoid spurious wakeup of __Wait.
 ***/
+
 void ThreadManagement::SendAwakeRunnerSignal(void)
 {
+# ifdef __DEBUG_SIGNAL
+    std::cout << "SendAwakeRunnerSignal" << std::endl;
+# endif // __DEBUG_SIGNAL
     __LockSignal(&m_AwakeRunnerLock);
     m_AwakeRunnerWasSignalled = true;
 #ifdef DEBUG_THREAD
@@ -261,6 +269,9 @@ void ThreadManagement::SendAwakeRunnerSignal(void)
 
 void ThreadManagement::WaitForAwakeRunnerSignal(void)
 {
+# ifdef __DEBUG_SIGNAL
+    std::cout << "WaitForAwakeRunnerSignal" << std::endl;
+# endif // __DEBUG_SIGNAL
     __LockSignal(&m_AwakeRunnerLock);
     ThreadManagement::UnlockRunner();
     m_AwakeRunnerWasSignalled = false;
@@ -290,6 +301,9 @@ void ThreadManagement::WaitForAwakeRunnerSignal(void)
 ***/
 void ThreadManagement::SendStartPendingSignal(void)
 {
+# ifdef __DEBUG_SIGNAL
+    std::cout << "SendStartPendingSignal" << std::endl;
+# endif // __DEBUG_SIGNAL
     __LockSignal(&m_StartPendingLock);
     m_StartPendingWasSignalled = true;
 #ifdef DEBUG_THREAD
@@ -301,6 +315,9 @@ void ThreadManagement::SendStartPendingSignal(void)
 
 void ThreadManagement::WaitForStartPendingSignal(void)
 {
+# ifdef __DEBUG_SIGNAL
+    std::cout << "WaitForStartPendingSignal" << std::endl;
+# endif // __DEBUG_SIGNAL
     __LockSignal(&m_StartPendingLock);
     while (m_StartPendingWasSignalled == false)
     {
@@ -356,7 +373,7 @@ void ThreadManagement::WaitForCommandStoredSignal(void)
     Wait : Wait for an available Runner.
 
     This signal can be sent without any threads are waiting for,
-    so we have to perform the Wait for each call to WaitForAwakeRunnerSignal.
+    so we have to perform the Wait for each call to WaitForRunMeSignal.
     (This can happends when an execution is interrupted by an other one.
      This signal is sent but the main thread is not waiting for.)
 
@@ -377,7 +394,10 @@ void ThreadManagement::WaitForRunMeSignal(void)
 {
     __LockSignal(&m_RunMeLock);
     m_RunMeWasSignalled = false;
-    while (m_RunMeWasSignalled == false)
+    // Some times, the signal "SendRunMeSignal" can be sent before the main thread is waiting for.
+    // If a Runner is available do not perform this wait.
+    bool bWait = StaticRunner_isRunnerAvailable() == false;
+    while (m_RunMeWasSignalled == false && bWait)
     {
 #ifdef DEBUG_THREAD
         PrintDebug("WaitForRunMeSignal");
index 8b3f29a..db120ef 100644 (file)
@@ -38,7 +38,7 @@ ThreadId::ThreadId(__threadId _id, __threadKey _key)
     m_threadStatus = Running;
     m_isInterruptible = true;
     m_doInterrupt = false;
-    m_isConsoleCommand = false;
+    m_iCmdOrigin = 0; // NONE
 }
 
 __threadId ThreadId::getThreadId()
@@ -167,14 +167,14 @@ bool ThreadId::isInterruptible()
     return m_isInterruptible;
 }
 
-void ThreadId::setConsoleCommandFlag(bool _isConsoleCommand)
+void ThreadId::setCommandOrigin(int _iCmdOrigin)
 {
-    m_isConsoleCommand = _isConsoleCommand;
+    m_iCmdOrigin = _iCmdOrigin;
 }
 
-bool ThreadId::isConsoleCommand()
+int ThreadId::getCommandOrigin()
 {
-    return m_isConsoleCommand;
+    return m_iCmdOrigin;
 }
 
 }
index 857715c..ad593b0 100644 (file)
@@ -30,8 +30,6 @@ CORE_C_SOURCES = \
     src/c/getos.c \
     src/c/transposeMatrix.c \
     src/c/getversion.c \
-    src/c/dynamic_tclsci.c \
-    src/c/dynamic_parallel.c \
     src/c/backtrace.c \
     src/c/signal_mgmt.c \
     src/c/suspendProcess.c \
index fdb7767..7e7634f 100644 (file)
@@ -206,8 +206,6 @@ am__objects_1 = src/c/libscicore_algo_la-csignal.lo \
        src/c/libscicore_algo_la-getos.lo \
        src/c/libscicore_algo_la-transposeMatrix.lo \
        src/c/libscicore_algo_la-getversion.lo \
-       src/c/libscicore_algo_la-dynamic_tclsci.lo \
-       src/c/libscicore_algo_la-dynamic_parallel.lo \
        src/c/libscicore_algo_la-backtrace.lo \
        src/c/libscicore_algo_la-signal_mgmt.lo \
        src/c/libscicore_algo_la-suspendProcess.lo \
@@ -704,8 +702,6 @@ CORE_C_SOURCES = \
     src/c/getos.c \
     src/c/transposeMatrix.c \
     src/c/getversion.c \
-    src/c/dynamic_tclsci.c \
-    src/c/dynamic_parallel.c \
     src/c/backtrace.c \
     src/c/signal_mgmt.c \
     src/c/suspendProcess.c \
@@ -1085,10 +1081,6 @@ src/c/libscicore_algo_la-transposeMatrix.lo: src/c/$(am__dirstamp) \
        src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libscicore_algo_la-getversion.lo: src/c/$(am__dirstamp) \
        src/c/$(DEPDIR)/$(am__dirstamp)
-src/c/libscicore_algo_la-dynamic_tclsci.lo: src/c/$(am__dirstamp) \
-       src/c/$(DEPDIR)/$(am__dirstamp)
-src/c/libscicore_algo_la-dynamic_parallel.lo: src/c/$(am__dirstamp) \
-       src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libscicore_algo_la-backtrace.lo: src/c/$(am__dirstamp) \
        src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libscicore_algo_la-signal_mgmt.lo: src/c/$(am__dirstamp) \
@@ -1384,8 +1376,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscicore_algo_la-commandwords.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscicore_algo_la-csignal.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscicore_algo_la-dynamic_gateways.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscicore_algo_la-dynamic_parallel.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscicore_algo_la-dynamic_tclsci.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscicore_algo_la-freeArrayOfString.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscicore_algo_la-getcommandlineargs.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscicore_algo_la-getdynamicdebuginfo.Plo@am__quote@
@@ -1594,20 +1584,6 @@ src/c/libscicore_algo_la-getversion.lo: src/c/getversion.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscicore_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libscicore_algo_la-getversion.lo `test -f 'src/c/getversion.c' || echo '$(srcdir)/'`src/c/getversion.c
 
-src/c/libscicore_algo_la-dynamic_tclsci.lo: src/c/dynamic_tclsci.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscicore_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libscicore_algo_la-dynamic_tclsci.lo -MD -MP -MF src/c/$(DEPDIR)/libscicore_algo_la-dynamic_tclsci.Tpo -c -o src/c/libscicore_algo_la-dynamic_tclsci.lo `test -f 'src/c/dynamic_tclsci.c' || echo '$(srcdir)/'`src/c/dynamic_tclsci.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libscicore_algo_la-dynamic_tclsci.Tpo src/c/$(DEPDIR)/libscicore_algo_la-dynamic_tclsci.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='src/c/dynamic_tclsci.c' object='src/c/libscicore_algo_la-dynamic_tclsci.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscicore_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libscicore_algo_la-dynamic_tclsci.lo `test -f 'src/c/dynamic_tclsci.c' || echo '$(srcdir)/'`src/c/dynamic_tclsci.c
-
-src/c/libscicore_algo_la-dynamic_parallel.lo: src/c/dynamic_parallel.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscicore_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libscicore_algo_la-dynamic_parallel.lo -MD -MP -MF src/c/$(DEPDIR)/libscicore_algo_la-dynamic_parallel.Tpo -c -o src/c/libscicore_algo_la-dynamic_parallel.lo `test -f 'src/c/dynamic_parallel.c' || echo '$(srcdir)/'`src/c/dynamic_parallel.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libscicore_algo_la-dynamic_parallel.Tpo src/c/$(DEPDIR)/libscicore_algo_la-dynamic_parallel.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='src/c/dynamic_parallel.c' object='src/c/libscicore_algo_la-dynamic_parallel.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscicore_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libscicore_algo_la-dynamic_parallel.lo `test -f 'src/c/dynamic_parallel.c' || echo '$(srcdir)/'`src/c/dynamic_parallel.c
-
 src/c/libscicore_algo_la-backtrace.lo: src/c/backtrace.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscicore_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libscicore_algo_la-backtrace.lo -MD -MP -MF src/c/$(DEPDIR)/libscicore_algo_la-backtrace.Tpo -c -o src/c/libscicore_algo_la-backtrace.lo `test -f 'src/c/backtrace.c' || echo '$(srcdir)/'`src/c/backtrace.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libscicore_algo_la-backtrace.Tpo src/c/$(DEPDIR)/libscicore_algo_la-backtrace.Plo
index 5188732..6991d1c 100644 (file)
 #ifndef __INITSCILAB_H__
 #define __INITSCILAB_H__
 
+#include "storeCommand.h" // command_origin_t
+
 typedef struct
 {
+    char* pstParseFile;
+    char* pstFile;
+    char* pstExec;
+    char* pstLang;
+    void* pExpTree;
     int iParseTrace;
     int iPrintAst;
     int iExecAst;
@@ -28,20 +35,15 @@ typedef struct
     int iNoJvm;
     int iNoStart;
     int iShowVersion;
-    char* pstParseFile;
-    char* pstFile;
-    char* pstExec;
-    char* pstLang;
     int iSerialize;
     int iKeepConsole;
     int iNoBanner;
-    void* pExpTree;
     int iMultiLine;
     int isInterruptible;
     int isPrioritary;
-    int isConsoleCommand;
     int iStartConsoleThread;
     int iForceQuit;
+    enum command_origin_t iCommandOrigin;
 } ScilabEngineInfo;
 
 ScilabEngineInfo* InitScilabEngineInfo();
index f1b5cd6..dd70f5a 100644 (file)
 extern "C"
 {
 #include "dynlib_core.h"
+#include "storeCommand.h" // command_origin_t
 }
 
 class CORE_IMPEXP Runner
 {
 public :
-    Runner(ast::Exp* _theProgram, ast::RunVisitor *_visitor) : m_theProgram(_theProgram), m_visitor(_visitor), m_isConsoleCommand(false), m_isInterruptible(true)
+    Runner(ast::Exp* _theProgram, ast::RunVisitor *_visitor) : m_theProgram(_theProgram), m_visitor(_visitor), m_iCommandOrigin(NONE), m_isInterruptible(true)
     { }
 
-    Runner(ast::Exp* _theProgram, ast::RunVisitor *_visitor, bool _isConsoleCommand, bool _isInterruptible) : m_theProgram(_theProgram), m_visitor(_visitor), m_isConsoleCommand(_isConsoleCommand), m_isInterruptible(_isInterruptible)
+    Runner(ast::Exp* _theProgram, ast::RunVisitor *_visitor, command_origin_t _iCommandOrigin, bool _isInterruptible) : m_theProgram(_theProgram), m_visitor(_visitor), m_iCommandOrigin(_iCommandOrigin), m_isInterruptible(_isInterruptible)
     { }
 
     ~Runner()
@@ -49,9 +50,9 @@ public :
         return m_theProgram;
     }
 
-    bool isConsoleCommand()
+    command_origin_t getCommandOrigin()
     {
-        return m_isConsoleCommand;
+        return m_iCommandOrigin;
     }
 
     bool isInterruptible()
@@ -62,12 +63,11 @@ public :
 private :
     ast::Exp* m_theProgram;
     std::unique_ptr<ast::RunVisitor> m_visitor;
-    bool m_isConsoleCommand;
+    command_origin_t m_iCommandOrigin;
     bool m_isInterruptible;
-
-    // static members to manage execution
 };
 
+// static members to manage execution
 class StaticRunner
 {
 public:
@@ -77,8 +77,9 @@ public:
     static bool isRunnerAvailable(void);
     static bool isInterruptibleCommand(void);
     static void setInterruptibleCommand(bool _isInterruptible);
+    static command_origin_t getCommandOrigin();
     static void execAndWait(ast::Exp* _theProgram, ast::RunVisitor *_visitor,
-                            bool _isInterruptible, bool _isPrioritary, bool _isConsoleCommand);
+                            bool _isInterruptible, bool _isPrioritary, command_origin_t _iCommandOrigin);
     static void exec(ast::Exp* _theProgram, ast::RunVisitor *_visitor);
 
 private:
@@ -92,6 +93,7 @@ extern "C"
     int StaticRunner_isRunnerAvailable(void);
     int StaticRunner_isInterruptibleCommand(void);
     void StaticRunner_setInterruptibleCommand(int val);
+    command_origin_t StaticRunner_getCommandOrigin(void);
 }
 
 #endif /* !__RUNNER_HXX__ */
index 961c7e8..014670e 100644 (file)
 #ifndef __STORECOMMAND_H__
 #define __STORECOMMAND_H__
 
-#include <wchar.h>
-#include "machine.h"
+enum command_origin_t
+{
+    NONE,
+    CONSOLE, // command from console
+    TCLSCI   // command from tclsci using ScilabEval interpreter
+};
+
+/**
+ * Store a non-prioritary and interruptible command
+ *
+ * @param command           : command wich will be stored
+ * @param piInterruptible   : 1 if it is a interruptible command
+ * @param piPrioritary      : 1 if it is a prioritary command
+ * @param iCmdorigin        : origine of the command
+ * @return <ReturnValue>
+ */
+int StoreCommandWithFlags(char* command, int iPrioritary, int iInterruptible, enum command_origin_t iCmdorigin);
 
 /**
  * Store a non-prioritary and interruptible command
@@ -47,10 +62,10 @@ int StorePrioritaryCommand(char *command);
  * @param command           : command wich will be executed
  * @param piInterruptible   : 1 if it is a interruptible command
  * @param piPrioritary      : 1 if it is a prioritary command
- * @param piConsole         : 1 if it is a console command
+ * @param iCmdorigin        : origine of the command
  * @return <ReturnValue>    : 0 if command queue is empty
  */
-int GetCommand (char** command, int* piInterruptible, int* piPrioritary, int* piConsole);
+int GetCommand(char** command, int* piPrioritary, int* piInterruptible, enum command_origin_t* iCmdorigin);
 
 /**
 * check if command queue is empty
@@ -58,8 +73,6 @@ int GetCommand (char** command, int* piInterruptible, int* piPrioritary, int* pi
 */
 int isEmptyCommandQueue(void);
 
-
-
 /*
  * Checks if there's something on the
  * commandQueue
@@ -68,10 +81,4 @@ int isEmptyCommandQueue(void);
 int ismenu(void);
 
 
-/**
-*
-*/
-int C2F(getmen)(char * btn_cmd, int * lb, int * entry);
-
-
 #endif /* __STORECOMMAND_H__ */
index 1d3f61b..6be99e2 100644 (file)
 
 #include "parser.hxx"
 
+extern "C"
+{
+#include "storeCommand.h" // command_origin_t
+}
+
 /*
 ** Parse
 **
@@ -49,7 +54,7 @@ void printAstTask(ast::Exp *tree, bool timed);
 ** Execute the stored AST.
 */
 void execAstTask(ast::Exp *tree, bool serialize, bool timed, bool ASTtimed, bool execVerbose,
-    bool _isInterruptibleThread, bool _isPrioritaryThread, bool _isConsoleCommand);
+                 bool _isInterruptibleThread, bool _isPrioritaryThread, command_origin_t _iCommandOrigin);
 
 /*
 ** Exec Tree with original visitor ( without template )
index 72177b6..76ccfed 100644 (file)
@@ -258,8 +258,6 @@ cd ..
     <ClCompile Include="commandwords.c" />
     <ClCompile Include="DllmainCore.c" />
     <ClCompile Include="dynamic_gateways.c" />
-    <ClCompile Include="dynamic_parallel.c" />
-    <ClCompile Include="dynamic_tclsci.c" />
     <ClCompile Include="freeArrayOfString.c" />
     <ClCompile Include="getcommandlineargs.c" />
     <ClCompile Include="getdynamicdebuginfo.c" />
@@ -369,8 +367,6 @@ cd ..
     <ClInclude Include="..\cpp\unrolled_algorithms.hxx" />
     <ClInclude Include="backtrace.h" />
     <ClInclude Include="dynamic_gateways.h" />
-    <ClInclude Include="dynamic_parallel.h" />
-    <ClInclude Include="dynamic_tclsci.h" />
     <ClInclude Include="getdebuginfo.h" />
     <ClInclude Include="getdynamicdebuginfo.h" />
     <ClInclude Include="getdynamicDebugInfo_Windows.h" />
@@ -434,6 +430,9 @@ cd ..
     <ProjectReference Include="..\..\..\string\src\c\string.vcxproj">
       <Project>{8d45767a-9b03-4905-97f6-d2f3f79141ea}</Project>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\tclsci\tclsci.vcxproj">
+      <Project>{c456d5b8-8a32-496a-a2ee-164b0d734126}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\..\..\threads\threads.vcxproj">
       <Project>{50a1ffc8-adc2-4d9e-a2d0-5dcd63188ae9}</Project>
     </ProjectReference>
index ae28e67..e1e189e 100644 (file)
     <ClCompile Include="dynamic_gateways.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="dynamic_parallel.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="dynamic_tclsci.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="freeArrayOfString.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClInclude Include="dynamic_gateways.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="dynamic_parallel.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="dynamic_tclsci.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="getdebuginfo.h">
       <Filter>Header Files</Filter>
     </ClInclude>
index 03322bf..c835622 100644 (file)
@@ -13,7 +13,6 @@
 #include <stdlib.h>
 #include "dynamic_gateways.h"
 #include "gw_dynamic_generic.h"
-#include "dynamic_parallel.h"
 #include "configvariable_interface.h"
 #include "sci_malloc.h"
 /*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/core/src/c/dynamic_parallel.c b/scilab/modules/core/src/c/dynamic_parallel.c
deleted file mode 100644 (file)
index 09c1877..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2010 - 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.1-en.txt
-*
-*/
-/*--------------------------------------------------------------------------*/
-//#include "callDynamicGateway.h"
-#include "gw_dynamic_generic.h"
-#include "sci_malloc.h"
-#include "dynamic_parallel.h"
-/*--------------------------------------------------------------------------*/
-/* PARALLEL module */
-#define PARALLEL_MODULE_NAME "parallel"
-static DynLibHandle hParallelLib = NULL;
-static void* ptr_gw_parallel = NULL;
-static char* dynlibname_parallel = NULL;
-static char* gatewayname_parallel = NULL;
-/*--------------------------------------------------------------------------*/
-int gw_dynamic_parallel(void)
-{
-    //return gw_dynamic_generic(PARALLEL_MODULE_NAME,
-    //    &dynlibname_parallel,
-    //    &gatewayname_parallel,
-    //    &hParallelLib,
-    //    &ptr_gw_parallel);
-    return 0;
-}
-/*--------------------------------------------------------------------------*/
-#define PARALLEL_CONCURRENCY_NAME "parallelConcurrency"
-typedef int (*PROC_PARALLEL_CONCURRENCY) (void);
-static PROC_PARALLEL_CONCURRENCY ptr_parallel_concurrency = NULL;
-/*--------------------------------------------------------------------------*/
-int dynParallelConcurrency(void)
-{
-    if (hParallelLib)
-    {
-        if (ptr_parallel_concurrency == NULL)
-        {
-            ptr_parallel_concurrency = (PROC_PARALLEL_CONCURRENCY) GetDynLibFuncPtr(hParallelLib,
-                                       PARALLEL_CONCURRENCY_NAME);
-            if (ptr_parallel_concurrency == NULL)
-            {
-                return 0;
-            }
-        }
-        return (ptr_parallel_concurrency)();
-    }
-    return 0;
-}
-/*--------------------------------------------------------------------------*/
-#define PARALLEL_FORBIDDEN_NAME "parallelForbidden"
-typedef BOOL (*PROC_PARALLEL_FORBIDDEN) (const char *);
-static PROC_PARALLEL_FORBIDDEN ptr_parallel_forbidden = NULL;
-/*--------------------------------------------------------------------------*/
-int dynParallelForbidden(char const* fname)
-{
-    if (hParallelLib)
-    {
-        if (ptr_parallel_forbidden == NULL)
-        {
-            ptr_parallel_forbidden = (PROC_PARALLEL_FORBIDDEN) GetDynLibFuncPtr(hParallelLib,
-                                     PARALLEL_FORBIDDEN_NAME);
-            if (ptr_parallel_forbidden == NULL)
-            {
-                return 0;
-            }
-        }
-        return (ptr_parallel_forbidden)(fname);
-    }
-    return 0;
-}
-/*--------------------------------------------------------------------------*/
-BOOL dynTerminateParallel(void)
-{
-    if (ptr_parallel_concurrency)
-    {
-        ptr_parallel_concurrency = NULL;
-    }
-    if (ptr_parallel_forbidden)
-    {
-        ptr_parallel_forbidden = NULL;
-    }
-    //return freeDynamicGateway(&dynlibname_parallel,
-    //    &gatewayname_parallel,
-    //    &hParallelLib,
-    //    &ptr_gw_parallel);
-    return 0;
-}
-/*--------------------------------------------------------------------------*/
-
diff --git a/scilab/modules/core/src/c/dynamic_parallel.h b/scilab/modules/core/src/c/dynamic_parallel.h
deleted file mode 100644 (file)
index b069e7d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2010 - 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.1-en.txt
-*
-*/
-
-#ifndef __DYNAMIC_PARALLEL_H__
-#define __DYNAMIC_PARALLEL_H__
-
-/**
-* parallel gateway
-* parallel is loaded dynamically at runtime
-* load gw_parallel in SCI/modules/parallel/sci_gateway/gw_parallel.c
-*/
-int gw_dynamic_parallel(void);
-
-/**
-* unload parallel gateway
-*/
-BOOL dynTerminateParallel(void);
-
-/**
-* see SCI/modules/parallel/includes/concurrency.h
-*/
-int dynParallelForbidden(char const* fname);
-
-/**
-* see SCI/modules/parallel/includes/concurrency.h
-*/
-int dynParallelConcurrency(void);
-
-#endif /* __DYNAMIC_PARALLEL_H__ */
diff --git a/scilab/modules/core/src/c/dynamic_tclsci.c b/scilab/modules/core/src/c/dynamic_tclsci.c
deleted file mode 100644 (file)
index 45d119b..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2010 - 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.1-en.txt
-*
-*/
-/*--------------------------------------------------------------------------*/
-#include "dynamic_tclsci.h"
-//#include "callDynamicGateway.h"
-#include "gw_dynamic_generic.h"
-#include "configvariable_interface.h"
-#include "with_module.h"
-#include "sci_malloc.h"
-/*--------------------------------------------------------------------------*/
-/* tclsci module */
-#define TCLSCI_MODULE_NAME "tclsci"
-static DynLibHandle hTclsciLib = NULL;
-static void* ptr_gw_tclsci = NULL;
-static char* dynlibname_tclsci = NULL;
-static char* gatewayname_tclsci = NULL;
-/*--------------------------------------------------------------------------*/
-#define SETENVTCL_NAME "setenvtcl"
-typedef int (*PROC_SETENVTCL) (const char *, const char *);
-static PROC_SETENVTCL ptr_setenvtcl = NULL;
-/*--------------------------------------------------------------------------*/
-#define TERMINATETCLTK_NAME "TerminateTclTk"
-typedef BOOL (*PROC_TERMINATETCLTK) (void);
-static PROC_TERMINATETCLTK ptr_TerminatTclTk = NULL;
-/*--------------------------------------------------------------------------*/
-int gw_dynamic_tclsci(void)
-{
-    //return gw_dynamic_generic(TCLSCI_MODULE_NAME,
-    //    &dynlibname_tclsci,
-    //    &gatewayname_tclsci,
-    //    &hTclsciLib,
-    //    &ptr_gw_tclsci);
-    return 0;
-}
-/*--------------------------------------------------------------------------*/
-int dynamic_setenvtcl(const char *string, const char *value)
-{
-    if (hTclsciLib)
-    {
-        if (ptr_setenvtcl == NULL)
-        {
-            ptr_setenvtcl = (PROC_SETENVTCL) GetDynLibFuncPtr(hTclsciLib,
-                            SETENVTCL_NAME);
-            if (ptr_setenvtcl == NULL)
-            {
-                return 0;
-            }
-        }
-        return (ptr_setenvtcl)(string , value);
-    }
-    return 0;
-}
-/*--------------------------------------------------------------------------*/
-BOOL dynamic_TerminateTclTk(void)
-{
-    if (hTclsciLib)
-    {
-        BOOL bResult = FALSE;
-        if (ptr_TerminatTclTk == NULL)
-        {
-            ptr_TerminatTclTk = (PROC_TERMINATETCLTK) GetDynLibFuncPtr(hTclsciLib,
-                                TERMINATETCLTK_NAME);
-            if (ptr_TerminatTclTk == NULL)
-            {
-                return FALSE;
-            }
-        }
-        bResult = (ptr_TerminatTclTk)();
-
-        //freeDynamicGateway(&dynlibname_tclsci,
-        //    &gatewayname_tclsci,
-        //    &hTclsciLib,
-        //    &ptr_gw_tclsci);
-
-        return bResult;
-    }
-    return FALSE;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/core/src/c/dynamic_tclsci.h b/scilab/modules/core/src/c/dynamic_tclsci.h
deleted file mode 100644 (file)
index 98ae609..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2010 - 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.1-en.txt
-*
-*/
-/*--------------------------------------------------------------------------*/
-#ifndef __DYNAMIC_TCLSCI_H__
-#define __DYNAMIC_TCLSCI_H__
-
-#include "BOOL.h"
-#include "machine.h" /* C2F */
-
-/**
-* see SCI/modules/tclsci/sci_gateway/c/gw_tclsci.c
-*/
-int gw_dynamic_tclsci(void);
-
-/*
-* see SCI/modules/tclsci/src/c/setenvtcl.c
-*/
-int dynamic_setenvtcl(const char *string, const char *value);
-
-/**
-* call & load TerminateTclTk in tclsci dynamic library
-* see SCI/modules/tclsci/src/c/TerminateTclTk.c
-* @return TRUE or FALSE
-*/
-BOOL dynamic_TerminateTclTk(void);
-
-#endif /* __DYNAMIC_TCLSCI_H__ */
-/*--------------------------------------------------------------------------*/
index 9a517c9..cb258d5 100644 (file)
@@ -23,7 +23,6 @@
 #include "localization.h"
 #include "version.h"
 #include "getversion.h"
-#include "dynamic_tclsci.h"
 #include "..\..\..\..\libs\pcre\pcre.h"
 #include "getBlasType.h"
 /*--------------------------------------------------------------------------*/
index f2b8094..3325d75 100644 (file)
@@ -65,6 +65,7 @@ extern "C"
 #include "scicurdir.h"
 #include "FileBrowserChDir.h"
 #include "InitializePreferences.h"
+
 #ifdef _MSC_VER
 #include "InitializeWindows_tools.h"
 #include "TerminateWindows_tools.h"
@@ -82,7 +83,7 @@ extern "C"
 #include "setPrecisionFPU.h"
 #endif
 
-#include "storeCommand.h"
+#include "InitializeTclTk.h"
 
     /* Defined without include to avoid useless header dependency */
     extern BOOL isItTheDisabledLib(void);
@@ -128,6 +129,7 @@ ScilabEngineInfo* InitScilabEngineInfo()
     pSEI->isPrioritary = 0;         // by default all thread are non-prioritary
     pSEI->iStartConsoleThread = 1;  // used in call_scilab to avoid "prompt" thread execution
     pSEI->iForceQuit = 0;           // management of -quit argument
+    pSEI->iCommandOrigin = NONE;
 
     return pSEI;
 }
@@ -230,12 +232,7 @@ int StartScilabEngine(ScilabEngineInfo* _pSEI)
 
     if (_pSEI->iNoJvm == 0) // With JVM
     {
-        /* bug 3702 */
-        /* tclsci creates a TK window on Windows */
-        /* it changes focus on previous windows */
-        /* we put InitializeTclTk before InitializeGUI */
-
-        //InitializeTclTk();
+        InitializeTclTk();
         InitializeJVM();
         InitializeGUI();
 
@@ -429,7 +426,6 @@ void StopScilabEngine(ScilabEngineInfo* _pSEI)
     // stop the JVM
     if (_pSEI->iNoJvm == 0)
     {
-        //dynamic_TerminateTclTk();
         TerminateGraphics();
         TerminateJVM();
     }
@@ -510,7 +506,7 @@ static void processCommand(ScilabEngineInfo* _pSEI)
         execAstTask((ast::Exp*)_pSEI->pExpTree, _pSEI->iSerialize != 0,
                     _pSEI->iTimed != 0, _pSEI->iAstTimed != 0,
                     _pSEI->iExecVerbose != 0, _pSEI->isInterruptible != 0,
-                    _pSEI->isPrioritary != 0, _pSEI->isConsoleCommand != 0);
+                    _pSEI->isPrioritary != 0, _pSEI->iCommandOrigin);
     }
 
     /*
@@ -525,18 +521,18 @@ static void processCommand(ScilabEngineInfo* _pSEI)
 // Thread used to parse and execute Scilab command setted in storeCommand
 void* scilabReadAndExecCommand(void* param)
 {
+    char* command           = NULL;
     int iInterruptibleCmd   = 0;
     int iPrioritaryCmd      = 0;
-    int iConsoleCmd         = 0;
-    char* command           = NULL;
+
+    command_origin_t iCmdOrigin = NONE;
 
     ScilabEngineInfo* _pSEI = (ScilabEngineInfo*)param;
 
     do
     {
-        if (GetCommand(&command, &iInterruptibleCmd, &iPrioritaryCmd, &iConsoleCmd) == 0)
+        if (GetCommand(&command, &iPrioritaryCmd, &iInterruptibleCmd, &iCmdOrigin) == 0)
         {
-            // command queue is empty
             ThreadManagement::WaitForCommandStoredSignal();
             continue;
         }
@@ -549,7 +545,7 @@ void* scilabReadAndExecCommand(void* param)
 
         _pSEI->isInterruptible = iInterruptibleCmd;
         _pSEI->isPrioritary = iPrioritaryCmd;
-        _pSEI->isConsoleCommand = iConsoleCmd;
+        _pSEI->iCommandOrigin = iCmdOrigin;
 
         ThreadManagement::LockParser();
         Parser parser;
@@ -830,12 +826,8 @@ static int interactiveMain(ScilabEngineInfo* _pSEI)
 
     do
     {
-        // Some times, the signal "SendRunMeSignal" can be sent before the main thread is waiting for.
-        // If a Runner is available do not perform this wait.
-        if (StaticRunner::isRunnerAvailable() == false)
-        {
-            ThreadManagement::WaitForRunMeSignal();
-        }
+        // wait for available runner
+        ThreadManagement::WaitForRunMeSignal();
 
         try
         {
index c0b623b..540f2bf 100644 (file)
@@ -27,6 +27,22 @@ extern "C"
 std::atomic<Runner*> StaticRunner::m_RunMe(nullptr);
 std::atomic<bool> StaticRunner::m_bInterruptibleCommand(true);
 
+static void sendExecDoneSignal(Runner* _pRunner)
+{
+    switch (_pRunner->getCommandOrigin())
+    {
+        case CONSOLE :
+        {
+            ThreadManagement::SendConsoleExecDoneSignal();
+            break;
+        }
+        case TCLSCI :
+        case NONE :
+        default :
+        {}
+    }
+}
+
 void StaticRunner::launch()
 {
     // get the runner to execute
@@ -36,10 +52,19 @@ void StaticRunner::launch()
     debugger::DebuggerMagager* manager = debugger::DebuggerMagager::getInstance();
 
     ConfigVariable::resetExecutionBreak();
+
     int oldMode = ConfigVariable::getPromptMode();
     symbol::Context* pCtx = symbol::Context::getInstance();
     int scope = pCtx->getScopeLevel();
 
+    // a TCL command display nothing
+    int iOldPromptMode = 0;
+    if (runMe->getCommandOrigin() == TCLSCI)
+    {
+        iOldPromptMode = ConfigVariable::getPromptMode();
+        ConfigVariable::setPromptMode(-1);
+    }
+
     try
     {
         int level = ConfigVariable::getRecursionLevel();
@@ -80,6 +105,11 @@ void StaticRunner::launch()
     }
     catch (const ast::InternalError& se)
     {
+        if (runMe->getCommandOrigin() == TCLSCI)
+        {
+            ConfigVariable::setPromptMode(iOldPromptMode);
+        }
+
         scilabErrorW(se.GetErrorMessage().c_str());
         scilabErrorW(L"\n");
         std::wostringstream ostr;
@@ -89,6 +119,11 @@ void StaticRunner::launch()
     }
     catch (const ast::InternalAbort& ia)
     {
+        if (runMe->getCommandOrigin() == TCLSCI)
+        {
+            ConfigVariable::setPromptMode(iOldPromptMode);
+        }
+
         // management of pause
         if (ConfigVariable::getPauseLevel())
         {
@@ -103,16 +138,19 @@ void StaticRunner::launch()
             pCtx->scope_end();
         }
 
-        if (runMe->isConsoleCommand())
-        {
-            ThreadManagement::SendConsoleExecDoneSignal();
-        }
+        // send the good signal about the end of execution
+        sendExecDoneSignal(runMe.get());
 
         //clean debugger step flag if debugger is not interrupted ( end of debug )
         manager->resetStep();
         throw ia;
     }
 
+    if (runMe->getCommandOrigin() == TCLSCI)
+    {
+        ConfigVariable::setPromptMode(iOldPromptMode);
+    }
+
     if (getScilabMode() != SCILAB_NWNI && getScilabMode() != SCILAB_API)
     {
         char *cwd = NULL;
@@ -130,10 +168,8 @@ void StaticRunner::launch()
     // reset error state when new prompt occurs
     ConfigVariable::resetError();
 
-    if (runMe->isConsoleCommand())
-    {
-        ThreadManagement::SendConsoleExecDoneSignal();
-    }
+    // send the good signal about the end of execution
+    sendExecDoneSignal(runMe.get());
 
     //clean debugger step flag if debugger is not interrupted ( end of debug )
     manager->resetStep();
@@ -167,8 +203,13 @@ bool StaticRunner::isInterruptibleCommand()
     return m_bInterruptibleCommand;
 }
 
+command_origin_t StaticRunner::getCommandOrigin()
+{
+    return m_RunMe.load()->getCommandOrigin();
+}
+
 void StaticRunner::execAndWait(ast::Exp* _theProgram, ast::RunVisitor *_visitor,
-                               bool _isPrioritaryThread, bool _isInterruptible, bool _isConsoleCommand)
+                               bool /*_isPrioritaryThread*/, bool _isInterruptible, command_origin_t _iCommandOrigin)
 {
     if (isRunnerAvailable())
     {
@@ -179,7 +220,7 @@ void StaticRunner::execAndWait(ast::Exp* _theProgram, ast::RunVisitor *_visitor,
     // lock runner to be sure we are waiting for
     // "AwakeRunner" signal before start execution
     ThreadManagement::LockRunner();
-    Runner *runMe = new Runner(_theProgram, _visitor, _isConsoleCommand, _isInterruptible);
+    Runner *runMe = new Runner(_theProgram, _visitor, _iCommandOrigin, _isInterruptible);
     setRunner(runMe);
 
     ThreadManagement::SendRunMeSignal();
@@ -212,3 +253,8 @@ void StaticRunner_setInterruptibleCommand(int val)
 {
     StaticRunner::setInterruptibleCommand(val == 1);
 }
+
+command_origin_t StaticRunner_getCommandOrigin(void)
+{
+    return StaticRunner::getCommandOrigin();
+}
index 4806c85..755f229 100644 (file)
@@ -40,20 +40,43 @@ struct CommandRec
     char*   m_command;              /* command info one string two integers */
     int     m_isInterruptible;      /* 1 if the command execution can be interrupted */
     int     m_isPrioritary;         /* 1 if the command is prioritary */
-    int     m_isConsole;            /* 1 if the command come from console */
-    CommandRec(char* command, int isInterruptible, int isPrioritary, int isConsole) : m_command(command), m_isInterruptible(isInterruptible), m_isPrioritary(isPrioritary), m_isConsole(isConsole) {}
+    command_origin_t     m_iCommandOrigin;       /* Indicate who have stored the command (ie: console, tcl) */
+    CommandRec(char* command, int isInterruptible, int isPrioritary, command_origin_t iCmdOrigin) :
+        m_command(command), m_isInterruptible(isInterruptible), m_isPrioritary(isPrioritary), m_iCommandOrigin(iCmdOrigin) {}
 };
 /*--------------------------------------------------------------------------*/
 static std::list<CommandRec> commandQueue;
 static std::list<CommandRec> commandQueuePrioritary;
 /*--------------------------------------------------------------------------*/
+int StoreCommandWithFlags(char* command, int iPrioritary, int iInterruptible, command_origin_t iCmdOrigin)
+{
+    ThreadManagement::LockStoreCommand();
+    if (iPrioritary)
+    {
+        commandQueuePrioritary.emplace_back(os_strdup(command), iPrioritary, iInterruptible, iCmdOrigin);
+
+        // Awake Runner to execute this prioritary command
+        ThreadManagement::SendAwakeRunnerSignal();
+    }
+    else
+    {
+        commandQueue.emplace_back(os_strdup(command), iPrioritary, iInterruptible, iCmdOrigin);
+    }
+
+    ThreadManagement::UnlockStoreCommand();
+    // Awake Scilab to execute a new command
+    ThreadManagement::SendCommandStoredSignal();
+
+    return 0;
+}
+
 int StoreCommand(char *command)
 {
     ThreadManagement::LockStoreCommand();
     commandQueue.emplace_back(os_strdup(command),
                               /*is prioritary*/ 0,
                               /* is interruptible*/ 1,
-                              /* from console */ 0);
+                              /* cmd origin */ NONE);
 
     ThreadManagement::UnlockStoreCommand();
     // Awake Scilab to execute a new command
@@ -68,7 +91,7 @@ int StoreConsoleCommand(char *command, int iWaitFor)
     commandQueuePrioritary.emplace_back(os_strdup(command),
                                         /*is prioritary*/ 1,
                                         /* is interruptible*/ 1,
-                                        /* from console */ 1);
+                                        /* cmd origin */ CONSOLE);
 
     // Awake Scilab to execute a new command
     ThreadManagement::SendCommandStoredSignal();
@@ -96,7 +119,7 @@ int StorePrioritaryCommand(char *command)
     commandQueuePrioritary.emplace_back(os_strdup(command),
                                         /*is prioritary*/ 1,
                                         /* is interruptible*/ 0,
-                                        /* from console */ 0);
+                                        /* cmd origin */ NONE);
 
     // Awake Scilab to execute a new command
     ThreadManagement::SendCommandStoredSignal();
@@ -117,7 +140,7 @@ int isEmptyCommandQueue(void)
  * Gets the next command to execute
  * and remove it from the queue
  */
-int GetCommand (char** cmd, int* piInterruptible, int* piPrioritary, int* piConsole)
+int GetCommand(char** cmd, int* piPrioritary, int* piInterruptible, command_origin_t* piCmdOrigin)
 {
     int iCommandReturned = 0;
 
@@ -127,7 +150,7 @@ int GetCommand (char** cmd, int* piInterruptible, int* piPrioritary, int* piCons
         *cmd = os_strdup(commandQueuePrioritary.front().m_command);
         *piInterruptible = commandQueuePrioritary.front().m_isInterruptible;
         *piPrioritary = commandQueuePrioritary.front().m_isPrioritary;
-        *piConsole = commandQueuePrioritary.front().m_isConsole;
+        *piCmdOrigin = commandQueuePrioritary.front().m_iCommandOrigin;
 
         FREE (commandQueuePrioritary.front().m_command);
         commandQueuePrioritary.pop_front();
@@ -139,7 +162,7 @@ int GetCommand (char** cmd, int* piInterruptible, int* piPrioritary, int* piCons
         *cmd = os_strdup(commandQueue.front().m_command);
         *piInterruptible = commandQueue.front().m_isInterruptible;
         *piPrioritary = commandQueue.front().m_isPrioritary;
-        *piConsole = commandQueue.front().m_isConsole;
+        *piCmdOrigin = commandQueue.front().m_iCommandOrigin;
 
         FREE (commandQueue.front().m_command);
         commandQueue.pop_front();
@@ -150,6 +173,7 @@ int GetCommand (char** cmd, int* piInterruptible, int* piPrioritary, int* piCons
 
     return iCommandReturned;
 }
+
 /*--------------------------------------------------------------------------*/
 int ismenu(void)
 {
@@ -158,11 +182,3 @@ int ismenu(void)
     return 0;
 }
 /*--------------------------------------------------------------------------*/
-/* menu/button info for Scilab */
-int C2F(getmen)(char * btn_cmd, int * lb, int * entry)
-{
-    //#pragma message("WARNING : C2F(getmen) is deprecated. It will be removed _BEFORE_ Scilab 6.0.")
-    // FIXME : Do not forget to remove me.
-    return 0;
-}
-/*--------------------------------------------------------------------------*/
index d1f11cd..91c8a67 100644 (file)
@@ -137,7 +137,7 @@ void printAstTask(ast::Exp *tree, bool timed)
 ** Execute the stored AST.
 */
 void execAstTask(ast::Exp* tree, bool serialize, bool timed, bool ASTtimed, bool execVerbose,
-                 bool isInterruptibleThread, bool isPrioritaryThread, bool isConsoleCommand)
+                 bool isInterruptibleThread, bool isPrioritaryThread, command_origin_t iCommandOrigin)
 {
     if (tree == NULL)
     {
@@ -191,7 +191,7 @@ void execAstTask(ast::Exp* tree, bool serialize, bool timed, bool ASTtimed, bool
         exec = (ast::RunVisitor*)ConfigVariable::getDefaultVisitor();
     }
 
-    StaticRunner::execAndWait(newTree, exec, isInterruptibleThread, isPrioritaryThread, isConsoleCommand);
+    StaticRunner::execAndWait(newTree, exec, isInterruptibleThread, isPrioritaryThread, iCommandOrigin);
     //DO NOT DELETE tree or newTree, they was deleted by Runner or previously;
 
     if (timed)
index efdb93b..dbac6d2 100644 (file)
@@ -77,6 +77,7 @@
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>includes;../../libs/libxml2;../../libs/intl;../core/includes;../fileio/includes;../localization/includes;../output_stream/includes;../string/includes;../api_scilab/includes;../threads/includes;../jvm/includes;../console/includes;../dynamic_link/includes;../xcos/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../ast/includes/parse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;../../libs/libxml2;../../libs/intl;../core/includes;../fileio/includes;../localization/includes;../output_stream/includes;../string/includes;../api_scilab/includes;../threads/includes;../jvm/includes;../console/includes;../dynamic_link/includes;../xcos/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../ast/includes/parse;../tclsci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FUNC_MAN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>includes;../../libs/libxml2;../../libs/intl;../core/includes;../fileio/includes;../localization/includes;../output_stream/includes;../string/includes;../api_scilab/includes;../threads/includes;../jvm/includes;../console/includes;../dynamic_link/includes;../xcos/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../ast/includes/parse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;../../libs/libxml2;../../libs/intl;../core/includes;../fileio/includes;../localization/includes;../output_stream/includes;../string/includes;../api_scilab/includes;../threads/includes;../jvm/includes;../console/includes;../dynamic_link/includes;../xcos/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../ast/includes/parse;../tclsci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FUNC_MAN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>includes;../../libs/libxml2;../../libs/intl;../core/includes;../fileio/includes;../localization/includes;../output_stream/includes;../string/includes;../api_scilab/includes;../threads/includes;../jvm/includes;../console/includes;../dynamic_link/includes;../xcos/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../ast/includes/parse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;../../libs/libxml2;../../libs/intl;../core/includes;../fileio/includes;../localization/includes;../output_stream/includes;../string/includes;../api_scilab/includes;../threads/includes;../jvm/includes;../console/includes;../dynamic_link/includes;../xcos/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../ast/includes/parse;../tclsci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FUNC_MAN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>includes;../../libs/libxml2;../../libs/intl;../core/includes;../fileio/includes;../localization/includes;../output_stream/includes;../string/includes;../api_scilab/includes;../threads/includes;../jvm/includes;../console/includes;../dynamic_link/includes;../xcos/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../ast/includes/parse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;../../libs/libxml2;../../libs/intl;../core/includes;../fileio/includes;../localization/includes;../output_stream/includes;../string/includes;../api_scilab/includes;../threads/includes;../jvm/includes;../console/includes;../dynamic_link/includes;../xcos/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../ast/includes/parse;../tclsci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FUNC_MAN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <Project>{aec1f7b5-28f2-4c1f-a436-98d0352fd3f5}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="..\tclsci\tclsci.vcxproj">
+      <Project>{c456d5b8-8a32-496a-a2ee-164b0d734126}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\threads\threads.vcxproj">
       <Project>{50a1ffc8-adc2-4d9e-a2d0-5dcd63188ae9}</Project>
     </ProjectReference>
index 147c290..44ca219 100644 (file)
@@ -54,4 +54,5 @@
 #include "../../fftw/includes/fftw_gw.hxx"
 #include "../../ui_data/includes/ui_data_gw.hxx"
 #include "../../preferences/includes/preferences_gw.hxx"
+#include "../../tclsci/includes/tclsci_gw.hxx"
 #endif /* !__MODULE_DECLARATION_HXX__ */
index ef3c760..e754a4b 100644 (file)
@@ -349,6 +349,7 @@ bool FuncManager::CreateModuleList(void)
 
     if (ConfigVariable::getScilabMode() != SCILAB_NWNI)
     {
+        m_ModuleMap[L"tclsci"] = std::pair<GW_MOD, GW_MOD>(&TclsciModule::Load, &TclsciModule::Unload);
         m_ModuleMap[L"jvm"] = std::pair<GW_MOD, GW_MOD>(&JvmModule::Load, &JvmModule::Unload);
         m_ModuleMap[L"ui_data"] = std::pair<GW_MOD, GW_MOD>(&UiDataModule::Load, &UiDataModule::Unload);
     }
index 1cc533f..6a16a2f 100644 (file)
@@ -158,2349 +158,3 @@ function ged(k,win)
     scf(ged_current_figure)
     format(initFormat(2), initFormat(1))
 endfunction
-
-
-function curgedindex_ = Get_handle_pos_in_list(h)
-    global ged_cur_fig_handle
-
-    curgedindex_ = [];
-
-    handles = Get_handles_list(ged_cur_fig_handle)
-    for i=1:size(handles,1)
-        if (h==handles(i))
-            curgedindex_ = i;
-        end
-    end
-
-    // Other case :
-    // a label has been selected (and for now they are included inside the Axes)
-    if (curgedindex_==[])
-        if h.type == "Label"
-            h = h.parent;
-            for i=1:size(handles,1)
-                if (h==handles(i))
-                    curgedindex_ = i;
-                end
-            end
-        end
-    end
-
-endfunction
-
-
-// Search the depth level for each handle
-// Usefull for new hierarchical graphic tree.
-function ged_levels = Get_levels(handles);
-
-    ged_levels = 1; // for Figure, always 1
-
-    f = handles(1);
-
-    for i=2:size(handles,1)
-        ged_levels(i) = Get_Depth(f,handles(i));
-    end
-
-    //disp("les levels sont:")xb
-
-    //disp(ged_levels);
-
-endfunction
-
-function depth = Get_Depth(f,h)
-
-    depth = 2;
-
-    while  h.parent <> f
-        h = h.parent;
-        depth = depth + 1;
-    end
-
-endfunction
-
-
-
-function TK_send_handles_list(h)
-    iFig = 0;
-    iUim = 0; // uimenu
-    iUic = 0; // uicontrol
-    iAxe = 0; // <=> subwindow in C code
-    iAgr = 0;
-    iPol = 0;
-    iPl3 = 0;
-    iFac = 0;
-    iRec = 0;
-    iTex = 0;
-    iLeg = 0;
-    iArc = 0;
-    iSeg = 0;
-    iCha = 0; // Champ
-    iFec = 0;
-    iGra = 0;
-    iMat = 0; // forgotten object F.Leray 22.10.04
-    iAxi = 0; // axis : entity created when using drawaxis method for example
-    iLab = 0;
-
-    f=getparfig(h);
-    handles = Get_handles_list(f)
-
-    ged_levels = Get_levels(handles);
-
-    TCL_SetVar("ged_handle_list_size",string(size(handles,1)));
-
-    for i=1:size(handles,1)
-        SelObject="LEVELS("+string(i)+")";
-        TCL_EvalStr("set "+SelObject+" "+string(ged_levels(i)));
-    end
-
-
-    for i=1:size(handles,1)
-        SelObject="SELOBJECT("+string(i)+")";
-        hand = handles(i);
-        select  hand.type
-        case "Figure"
-            iFig = iFig+1;
-            figname= "Figure("+string(iFig)+")";
-            TCL_EvalStr("set "+SelObject+" "+figname);
-        case "uimenu"
-            iUim = iUim+1;
-            uimname= "Uimenu("+string(iUim)+")";
-            TCL_EvalStr("set "+SelObject+" "+uimname);
-        case "uicontrol"
-            iUic = iUic+1;
-            uicname= "Uicontrol("+string(iUic)+")";
-            TCL_EvalStr("set "+SelObject+" "+uicname);
-        case "Axes"
-            iAxe = iAxe+1;
-            axename= "Axes("+string(iAxe)+")";
-            TCL_EvalStr("set "+SelObject+" "+axename);
-            //   case "Label"  // to see later: have labels at the same level than Axes (to have a better visibility)
-            //    iLab = iLab+1;
-            //    labname= "Label("+string(iLab)+")";
-            //    TCL_EvalStr('set '+SelObject+" "+labname);
-        case "Compound"
-            iAgr = iAgr+1;
-            agrname= "Compound("+string(iAgr)+")";
-            TCL_EvalStr("set "+SelObject+" "+agrname);
-        case "Polyline"
-            iPol = iPol+1;
-            polname= "Polyline("+string(iPol)+")";
-            TCL_EvalStr("set "+SelObject+" "+polname);
-        case "Plot3d"
-            iPl3 = iPl3+1;
-            pl3name= "Plot3d("+string(iPl3)+")";
-            TCL_EvalStr("set "+SelObject+" "+pl3name);
-        case "Fac3d"
-            iFac = iFac+1;
-            Facname= "Fac3d("+string(iFac)+")";
-            TCL_EvalStr("set "+SelObject+" "+Facname);
-        case "Rectangle"
-            iRec = iRec+1;
-            Recname= "Rectangle("+string(iRec)+")";
-            TCL_EvalStr("set "+SelObject+" "+Recname);
-        case "Text"
-            iTex = iTex+1;
-            Texname= "Text("+string(iTex)+")";
-            TCL_EvalStr("set "+SelObject+" "+Texname);
-        case "Legend"
-            iLeg = iLeg+1;
-            Legname= "Legend("+string(iLeg)+")";
-            TCL_EvalStr("set "+SelObject+" "+Legname);
-        case "Arc"
-            iArc = iArc+1;
-            Arcname= "Arc("+string(iArc)+")";
-            TCL_EvalStr("set "+SelObject+" "+Arcname);
-        case "Segs"
-            iSeg = iSeg+1;
-            Segname= "Segs("+string(iSeg)+")";
-            TCL_EvalStr("set "+SelObject+" "+Segname);
-        case "Champ"
-            iCha = iCha+1;
-            Chaname= "Champ("+string(iCha)+")";
-            TCL_EvalStr("set "+SelObject+" "+Chaname);
-        case "Fec"
-            iFec = iFec+1;
-            Fecname= "Fec("+string(iFec)+")";
-            TCL_EvalStr("set "+SelObject+" "+Fecname);
-        case "Grayplot"
-            iGra = iGra+1;
-            Graname= "Grayplot("+string(iGra)+")";
-            TCL_EvalStr("set "+SelObject+" "+Graname);
-        case "Matplot"
-            iMat = iMat+1;
-            Matname= "Matplot("+string(iMat)+")";
-            TCL_EvalStr("set "+SelObject+" "+Matname);
-        case "Axis"
-            iAxi = iAxi+1;
-            Axiname= "Axis("+string(iAxi)+")";
-            TCL_EvalStr("set "+SelObject+" "+Axiname);
-        else
-            error( hand.type + " not handled");
-        end
-    end
-endfunction
-
-
-//function h=Get_handle_from_index(index)
-function Get_handle_from_index(index)
-    global ged_handle;
-    global ged_cur_fig_handle
-
-    hl = Get_handles_list(ged_cur_fig_handle);
-
-    ged_handle = hl(index);
-    //   h=ged_handle;
-    tkged();
-
-endfunction
-
-
-////////////////////////////////////////////
-function  hfig= getparfig( h )
-
-    htmp = h;
-    hfig= []
-
-    while htmp.type<>"Figure" do
-        htmp=htmp.parent
-    end
-
-    hfig = htmp;
-endfunction
-
-
-function h_out_list=Get_handles_list(h);
-
-    global ged_handle_out;
-
-    f=getparfig(h);
-    ged_handle_out=[f];
-
-    List_handles(f);
-
-    //disp(ged_handle_out);
-
-    h_out_list=ged_handle_out;
-
-endfunction
-
-
-function List_handles(h)
-    global ged_handle_out;
-
-    i = 1;
-    //if h.type=="Axes" then
-    //   ged_handle_out = [ged_handle_out;h.x_label;h.y_label;h.z_label;h.title];
-    //end
-    psonstmp = h.children;
-    if psonstmp <> [] then
-        psonstmp = h.children(1);
-    end
-
-    while ((psonstmp <>[]) & ((i) <=size(psonstmp.parent.children,1)))
-        i = i+1;
-        ged_handle_out = [ged_handle_out;  psonstmp];
-        List_handles(psonstmp);
-
-        if ((i) <=size(psonstmp.parent.children,1)) then
-            psonstmp = psonstmp.parent.children(i);
-        else
-            psonstmp=[];
-        end
-
-    end
-
-endfunction
-
-
-
-function ged_Compound(h)
-    global ged_handle;ged_handle=h;
-    TCL_SetVar("curvis",h.visible)
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Compound.tcl")
-endfunction
-
-
-function ged_figure(h)
-    global ged_handle;ged_handle=h;
-    TCL_SetVar("background",string(h.background))
-    TCL_SetVar("rotation_style",h.rotation_style)
-    TCL_SetVar("figure_name",h.figure_name)
-    TCL_SetVar("figure_id",string(h.figure_id))
-    TCL_SetVar("figure_xposition",string(h.figure_position(1)))
-    TCL_SetVar("figure_yposition",string(h.figure_position(2)))
-    TCL_SetVar("figure_xsiz",string(h.figure_size(1)))
-    TCL_SetVar("figure_ysiz",string(h.figure_size(2)))
-    TCL_SetVar("figure_xaxesiz",string(h.axes_size(1)))
-    TCL_SetVar("figure_yaxesiz",string(h.axes_size(2)))
-    TCL_SetVar("bcolor",string(h.background))
-    TCL_SetVar("ncolors",string(size(h.color_map,1)))
-    TCL_SetVar("curvis",h.visible)
-    TCL_SetVar("curpdm",h.pixel_drawing_mode)
-    TCL_SetVar("curautoresize",h.auto_resize)
-    TCL_SetVar("currotation_style",h.rotation_style)
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Figure.tcl")
-endfunction
-
-
-function ged_axes(h)
-    global ged_handle;ged_handle=h;
-
-    LoadTicks2TCL(h);
-
-    TCL_SetVar("Xaxes_reverseToggle",h.axes_reverse(1))
-    TCL_SetVar("Yaxes_reverseToggle",h.axes_reverse(2))
-    TCL_SetVar("Zaxes_reverseToggle",h.axes_reverse(3))
-
-    // forgotten axes bounds info.
-    TCL_SetVar("axes_boundsL",string(h.axes_bounds(1,1)))
-    TCL_SetVar("axes_boundsU",string(h.axes_bounds(1,2)))
-    TCL_SetVar("axes_boundsW",string(h.axes_bounds(1,3)))
-    TCL_SetVar("axes_boundsH",string(h.axes_bounds(1,4)))
-
-    // forgotten visibility info.
-    TCL_SetVar("xlabel_visibility",string(h.x_label.visible))
-    TCL_SetVar("ylabel_visibility",string(h.y_label.visible))
-    TCL_SetVar("zlabel_visibility",string(h.z_label.visible))
-    TCL_SetVar("titlelabel_visibility",string(h.title.visible))
-
-    TCL_SetVar("Lmargins",string(h.margins(1)));
-    TCL_SetVar("Rmargins",string(h.margins(2)));
-    TCL_SetVar("Tmargins",string(h.margins(3)));
-    TCL_SetVar("Bmargins",string(h.margins(4)));
-    ged_linestylearray=["solid" "dash" "dash dot" "longdash dot" "bigdash dot" "bigdash longdash" "dot" "double dot"];
-    TCL_SetVar("curlinestyle",ged_linestylearray(max(h.line_style,1)))
-    if (h.clip_box==[])
-        TCL_SetVar("old_Xclipbox","")
-        TCL_SetVar("old_Yclipbox","")
-        TCL_SetVar("old_Wclipbox","")
-        TCL_SetVar("old_Hclipbox","")
-        TCL_SetVar("Xclipbox","")
-        TCL_SetVar("Yclipbox","")
-        TCL_SetVar("Wclipbox","")
-        TCL_SetVar("Hclipbox","")
-    else
-        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
-        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
-    end
-    TCL_SetVar("curclipstate",h.clip_state);
-    TCL_SetVar("curautoclear",h.auto_clear);
-    TCL_SetVar("curautoscale",h.auto_scale);
-    //TCL_SetVar("curfillmode",h.fill_mode);
-    TCL_SetVar("curalpharotation",string(h.rotation_angles(1)))
-    TCL_SetVar("curthetarotation",string(h.rotation_angles(2)))
-    ged_fontarray = ["Monospaced" "Symbol" "Serif",..
-    "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
-    "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
-    "SansSerif Bold Italic"];
-    TCL_SetVar("Xlabelpos",h.x_location)
-    TCL_SetVar("Ylabelpos",h.y_location)
-    TCL_SetVar("Xlabelfontstyle",ged_fontarray(h.x_label.font_style+1))
-    TCL_SetVar("Ylabelfontstyle",ged_fontarray(h.y_label.font_style+1))
-    TCL_SetVar("Zlabelfontstyle",ged_fontarray(h.z_label.font_style+1))
-    TCL_SetVar("TITLEfontstyle",ged_fontarray(h.title.font_style+1))
-    TCL_SetVar("fontstyle",ged_fontarray(h.font_style+1))
-
-    // label texts
-    if size(h.x_label.text,"*") == 1 then
-        txt = """" + h.x_label.text + """" ;
-    else
-        // an array of strings
-        txt = "["+strcat(string(size(h.x_label.text)),"x")+" string array]" ;
-    end
-    TCL_SetVar("xlabel", txt );
-
-    if size(h.y_label.text,"*") == 1 then
-        txt = """" + h.y_label.text + """" ;
-    else
-        // an array of strings
-        txt = "["+strcat(string(size(h.y_label.text)),"x")+" string array]" ;
-    end
-    TCL_SetVar("ylabel", txt );
-
-    if size(h.z_label.text,"*") == 1 then
-        txt = """" + h.z_label.text + """" ;
-    else
-        // an array of strings
-        txt = "["+strcat(string(size(h.z_label.text)),"x")+" string array]" ;
-    end
-    TCL_SetVar("zlabel", txt );
-
-    if size(h.title.text,"*") == 1 then
-        txt = """" + h.title.text + """" ;
-    else
-        // an array of strings
-        txt = "["+strcat(string(size(h.title.text)),"x")+" string array]" ;
-    end
-    TCL_SetVar("tlabel", txt );
-
-    TCL_SetVar("xlabel_fontforeground",string(h.x_label.font_foreground))
-    TCL_SetVar("ylabel_fontforeground",string(h.y_label.font_foreground))
-    TCL_SetVar("zlabel_fontforeground",string(h.z_label.font_foreground))
-    TCL_SetVar("titlelabel_fontforg",string(h.title.font_foreground))
-    TCL_SetVar("xlabel_foreground",string(h.x_label.foreground))
-    TCL_SetVar("ylabel_foreground",string(h.y_label.foreground))
-    TCL_SetVar("zlabel_foreground",string(h.z_label.foreground))
-    TCL_SetVar("titlelabel_foreground",string(h.title.foreground))
-    TCL_SetVar("xlabel_background",string(h.x_label.background))
-    TCL_SetVar("ylabel_background",string(h.y_label.background))
-    TCL_SetVar("zlabel_background",string(h.z_label.background))
-    TCL_SetVar("titlelabel_background",string(h.title.background))
-    TCL_SetVar("x_position",sci2exp(h.x_label.position,0))
-    TCL_SetVar("y_position",sci2exp(h.y_label.position,0))
-    TCL_SetVar("z_position",sci2exp(h.z_label.position,0))
-    TCL_SetVar("title_position",sci2exp(h.title.position,0))
-    TCL_SetVar("xauto_position",h.x_label.auto_position)
-    TCL_SetVar("yauto_position",h.y_label.auto_position)
-    TCL_SetVar("zauto_position",h.z_label.auto_position)
-    TCL_SetVar("titleauto_position",h.title.auto_position)
-    TCL_SetVar("xauto_rotation",h.x_label.auto_rotation)
-    TCL_SetVar("yauto_rotation",h.y_label.auto_rotation)
-    TCL_SetVar("zauto_rotation",h.z_label.auto_rotation)
-    TCL_SetVar("titleauto_rotation",h.title.auto_rotation)
-    TCL_SetVar("Xfillmode",h.x_label.fill_mode)
-    TCL_SetVar("Yfillmode",h.y_label.fill_mode)
-    TCL_SetVar("Zfillmode",h.z_label.fill_mode)
-    TCL_SetVar("Titlefillmode",h.title.fill_mode)
-    TCL_SetVar("xlabel_fontsize",string(h.x_label.font_size))
-    TCL_SetVar("ylabel_fontsize",string(h.y_label.font_size))
-    TCL_SetVar("zlabel_fontsize",string(h.z_label.font_size))
-    TCL_SetVar("titlelabel_fontsize",string(h.title.font_size))
-    TCL_SetVar("ncolors",string(size(f.color_map,1)))
-    TCL_SetVar("fcolor",string(h.foreground))
-    TCL_SetVar("bcolor",string(h.background))
-    TCL_SetVar("curthick",string(h.thickness))
-    TCL_SetVar("curvis",h.visible)
-    TCL_SetVar("curfontsize",string(h.font_size))
-    TCL_SetVar("curfontcolor",string(h.font_color))
-    TCL_SetVar("limToggle",h.tight_limits(1))
-    TCL_SetVar("isoToggle",h.isoview)
-    TCL_SetVar("cubToggle",h.cube_scaling)
-    TCL_SetVar("viewToggle",h.view)
-    TCL_SetVar("curBoxState",h.box)
-    TCL_SetVar("xToggle",part(h.log_flags,1))
-    TCL_SetVar("yToggle",part(h.log_flags,2))
-    TCL_SetVar("zToggle",part(h.log_flags,3))
-    TCL_SetVar("xGrid",string(h.grid(1)))
-    TCL_SetVar("yGrid",string(h.grid(2)))
-
-    TCL_SetVar("hiddenAxisColor",h.hidden_axis_color)
-    TCL_SetVar("curfontangle_x",string(h.x_label.font_angle))
-    TCL_SetVar("curfontangle_y",string(h.y_label.font_angle))
-    TCL_SetVar("curfontangle_z",string(h.z_label.font_angle))
-    TCL_SetVar("curfontangle_title",string(h.title.font_angle))
-
-
-    select h.view
-    case "2d"
-        drawlater();
-        h.view="3d"
-        TCL_SetVar("old_curalpharotation",string(h.rotation_angles(1)))
-        TCL_SetVar("old_curthetarotation",string(h.rotation_angles(2)))
-        TCL_SetVar("zGrid",string(h.grid(3)))
-        TCL_SetVar("zGrid_initial",string(h.grid(3))) //to avoid useless redraw (see Axes.tcl)
-        TCL_SetVar("dbxmin",string(h.data_bounds(1,1)))
-        TCL_SetVar("dbymin",string(h.data_bounds(1,2)))
-        TCL_SetVar("dbzmin",string(h.data_bounds(1,3)))
-        TCL_SetVar("dbxmax",string(h.data_bounds(2,1)))
-        TCL_SetVar("dbymax",string(h.data_bounds(2,2)))
-        TCL_SetVar("dbzmax",string(h.data_bounds(2,3)))
-        h.view="2d"
-        drawnow();
-    case "3d"
-        TCL_SetVar("zGrid",string(h.grid(3)))
-        TCL_SetVar("zGrid_initial",string(h.grid(3))) //to avoid useless redraw (see Axes.tcl)
-        TCL_SetVar("dbxmin",string(h.data_bounds(1,1)))
-        TCL_SetVar("dbymin",string(h.data_bounds(1,2)))
-        TCL_SetVar("dbzmin",string(h.data_bounds(1,3)))
-        TCL_SetVar("dbxmax",string(h.data_bounds(2,1)))
-        TCL_SetVar("dbymax",string(h.data_bounds(2,2)))
-        TCL_SetVar("dbzmax",string(h.data_bounds(2,3)))
-    end
-
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Axes.tcl")
-endfunction
-
-function ged_rectangle(h)
-    global ged_handle; ged_handle=h
-    if (h.clip_box==[])
-        TCL_SetVar("old_Xclipbox","")
-        TCL_SetVar("old_Yclipbox","")
-        TCL_SetVar("old_Wclipbox","")
-        TCL_SetVar("old_Hclipbox","")
-        TCL_SetVar("Xclipbox","")
-        TCL_SetVar("Yclipbox","")
-        TCL_SetVar("Wclipbox","")
-        TCL_SetVar("Hclipbox","")
-    else
-        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
-        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
-    end
-    TCL_SetVar("curclipstate",h.clip_state);
-
-    f=h;while stripblanks(f.type)<>"Figure" then f=f.parent,end
-    ax=h;while stripblanks(ax.type)<>"Axes" then ax=ax.parent,end
-    TCL_SetVar("ncolors",string(size(f.color_map,1)))
-    TCL_SetVar("curcolor",string(h.foreground))
-    TCL_SetVar("curback",string(h.background))
-    TCL_SetVar("curthick",string(h.thickness))
-    TCL_SetVar("curvis",h.visible)
-    ged_linestylearray=["solid" "dash" "dash dot" "longdash dot" "bigdash dot" "bigdash longdash" "dot" "double dot"];
-    TCL_SetVar("curlinestyle",ged_linestylearray(max(h.line_style,1)))
-    ged_markstylearray=["dot" "plus" "cross" "star" "filled diamond" ..
-    "diamond" "triangle up" "triangle down" "diamond plus" "circle" ..
-    "asterisk" "square" "triangle right" "triangle left" "pentagram"];
-    TCL_SetVar("curmarkstyle",ged_markstylearray(abs(h.mark_style)+1))
-    TCL_SetVar("curmarkmode",h.mark_mode)
-    TCL_SetVar("curmarksize",string(h.mark_size))
-    TCL_SetVar("curmarksizeunit",h.mark_size_unit);
-    TCL_SetVar("curmarkforeground",string(h.mark_foreground))
-    TCL_SetVar("curmarkbackground",string(h.mark_background))
-
-
-    TCL_SetVar("curlinemode",h.line_mode)
-    TCL_SetVar("curfillmode",h.fill_mode)
-    // Rectangle data
-    select ax.view
-    case "2d"
-        drawlater();
-        ax.view="3d"
-        TCL_SetVar("Xval",string(h.data(1)))
-        TCL_SetVar("Yval",string(h.data(2)))
-        TCL_SetVar("Zval",string(h.data(3)))
-        TCL_SetVar("Wval",string(h.data(4)))
-        TCL_SetVar("Hval",string(h.data(5)))
-        ax.view="2d"
-        drawnow();
-    case "3d"
-        TCL_SetVar("Xval",string(h.data(1)))
-        TCL_SetVar("Yval",string(h.data(2)))
-        TCL_SetVar("Zval",string(h.data(3)))
-        TCL_SetVar("Wval",string(h.data(4)))
-        TCL_SetVar("Hval",string(h.data(5)))
-    end
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Rectangle.tcl")
-endfunction
-
-function ged_polyline(h)
-    global ged_handle; ged_handle=h
-
-    if (h.clip_box==[])
-        TCL_SetVar("old_Xclipbox","")
-        TCL_SetVar("old_Yclipbox","")
-        TCL_SetVar("old_Wclipbox","")
-        TCL_SetVar("old_Hclipbox","")
-        TCL_SetVar("Xclipbox","")
-        TCL_SetVar("Yclipbox","")
-        TCL_SetVar("Wclipbox","")
-        TCL_SetVar("Hclipbox","")
-    else
-        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
-        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
-    end
-    TCL_SetVar("curclipstate",h.clip_state);
-
-    f=h;while stripblanks(f.type)<>"Figure" then f=f.parent,end
-    TCL_SetVar("ncolors",string(size(f.color_map,1)))
-    TCL_SetVar("curcolor",string(h.foreground))
-    TCL_SetVar("curback",string(h.background))
-    TCL_SetVar("curthick",string(h.thickness))
-    TCL_SetVar("curarrowsizefactor",string(h.arrow_size_factor))
-    TCL_SetVar("curvis",h.visible)
-
-    ged_polylinestylearray=["interpolated" "staircase" "barplot" "arrowed" "filled" "bar"];
-    TCL_SetVar("curpolylinestyle",ged_polylinestylearray(max(h.polyline_style,1)))
-    ged_linestylearray=["solid" "dash" "dash dot" "longdash dot" "bigdash dot" "bigdash longdash" "dot" "double dot"];
-    TCL_SetVar("curlinestyle",ged_linestylearray(max(h.line_style,1)))
-    ged_markstylearray=["dot" "plus" "cross" "star" "filled diamond" ..
-    "diamond" "triangle up" "triangle down" "diamond plus" "circle" ..
-    "asterisk" "square" "triangle right" "triangle left" "pentagram"];
-
-    TCL_SetVar("curmarkstyle",ged_markstylearray(abs(h.mark_style)+1))
-    TCL_SetVar("curmarkmode",h.mark_mode)
-    TCL_SetVar("curmarksize",string(h.mark_size))
-    TCL_SetVar("curmarksizeunit",h.mark_size_unit);
-    TCL_SetVar("curmarkforeground",string(h.mark_foreground))
-    TCL_SetVar("curmarkbackground",string(h.mark_background))
-
-    TCL_SetVar("curlinemode",h.line_mode)
-    TCL_SetVar("curclosedmode",h.closed)
-    TCL_SetVar("curfillmode",h.fill_mode)
-    TCL_SetVar("curinterpcolormode",h.interp_color_mode)
-    TCL_SetVar("curinterpcolorvector",sci2exp(h.interp_color_vector,0))
-
-    d="["+strcat(string(size(h.data)),"x")+" double array]"
-    TCL_SetVar("curdata",d);
-
-    select get(getparaxe(h),"view")
-    case "2d"
-        TCL_SetVar("nbcol",string(2));
-    case "3d"
-        TCL_SetVar("nbcol",string(3));
-    end
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Polyline.tcl")
-endfunction
-
-
-function ged_plot3d(h)
-    global ged_handle; ged_handle=h
-
-    //  if (h.clip_box==[])
-    //    TCL_SetVar("old_Xclipbox","")
-    //    TCL_SetVar("old_Yclipbox","")
-    //    TCL_SetVar("old_Wclipbox","")
-    //    TCL_SetVar("old_Hclipbox","")
-    //    TCL_SetVar("Xclipbox","")
-    //    TCL_SetVar("Yclipbox","")
-    //    TCL_SetVar("Wclipbox","")
-    //    TCL_SetVar("Hclipbox","")
-    //   else
-    //    TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
-    //    TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
-    //    TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
-    //    TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
-    //    TCL_SetVar("Xclipbox",string(h.clip_box(1)))
-    //    TCL_SetVar("Yclipbox",string(h.clip_box(2)))
-    //    TCL_SetVar("Wclipbox",string(h.clip_box(3)))
-    //    TCL_SetVar("Hclipbox",string(h.clip_box(4)))
-    //  end
-    //  TCL_SetVar("curclipstate",h.clip_state);
-
-    TCL_SetVar("curvis",h.visible)
-    TCL_SetVar("curcolormode",string(h.color_mode))
-    TCL_SetVar("colorflagToggle",string(h.color_flag))
-    TCL_SetVar("curforeground",string(h.foreground))
-    TCL_SetVar("curhiddencolor",string(h.hiddencolor))
-    TCL_SetVar("curthick",string(h.thickness))
-
-    ged_markstylearray=["dot" "plus" "cross" "star" "filled diamond" ..
-    "diamond" "triangle up" "triangle down" "diamond plus" "circle" ..
-    "asterisk" "square" "triangle right" "triangle left" "pentagram"];
-
-    TCL_SetVar("curmarkstyle",ged_markstylearray(abs(h.mark_style)+1))
-    TCL_SetVar("curmarkmode",h.mark_mode)
-    TCL_SetVar("curmarksize",string(h.mark_size))
-    TCL_SetVar("curmarksizeunit",h.mark_size_unit);
-    TCL_SetVar("curmarkforeground",string(h.mark_foreground))
-    TCL_SetVar("curmarkbackground",string(h.mark_background))
-    TCL_SetVar("curlinemode",h.surface_mode)
-
-
-    d="["+strcat(string(size(h.data.x)),"x")+" double array]"
-    TCL_SetVar("curdata_x",d);
-    d="["+strcat(string(size(h.data.y)),"x")+" double array]"
-    TCL_SetVar("curdata_y",d);
-    d="["+strcat(string(size(h.data.z)),"x")+" double array]"
-    TCL_SetVar("curdata_z",d);
-
-    TCL_EvalStr("set flagCOLOR 0")
-    if(h.data(1)==["3d" "x" "y" "z" "color"])
-        TCL_EvalStr("set flagCOLOR 1")
-        d="["+strcat(string(size(h.data.color)),"x")+" integer array]"
-        TCL_SetVar("curdata_color",d);
-    end
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Plot3d.tcl")
-endfunction
-
-
-function ged_fac3d(h)
-    global ged_handle; ged_handle=h
-
-    //  if (h.clip_box==[])
-    //    TCL_SetVar("old_Xclipbox","")
-    //    TCL_SetVar("old_Yclipbox","")
-    //    TCL_SetVar("old_Wclipbox","")
-    //    TCL_SetVar("old_Hclipbox","")
-    //    TCL_SetVar("Xclipbox","")
-    //    TCL_SetVar("Yclipbox","")
-    //    TCL_SetVar("Wclipbox","")
-    //    TCL_SetVar("Hclipbox","")
-    //   else
-    //    TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
-    //    TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
-    //    TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
-    //    TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
-    //    TCL_SetVar("Xclipbox",string(h.clip_box(1)))
-    //    TCL_SetVar("Yclipbox",string(h.clip_box(2)))
-    //    TCL_SetVar("Wclipbox",string(h.clip_box(3)))
-    //    TCL_SetVar("Hclipbox",string(h.clip_box(4)))
-    //  end
-    //  TCL_SetVar("curclipstate",h.clip_state);
-
-    TCL_SetVar("curvis",h.visible)
-    TCL_SetVar("curcolormode",string(h.color_mode))
-    TCL_SetVar("colorflagToggle",string(h.color_flag))
-    TCL_SetVar("curforeground",string(h.foreground))
-    TCL_SetVar("curhiddencolor",string(h.hiddencolor))
-    TCL_SetVar("curthick",string(h.thickness))
-
-    ged_markstylearray=["dot" "plus" "cross" "star" "filled diamond" ..
-    "diamond" "triangle up" "triangle down" "diamond plus" "circle" ..
-    "asterisk" "square" "triangle right" "triangle left" "pentagram"];
-
-    TCL_SetVar("curmarkstyle",ged_markstylearray(abs(h.mark_style)+1))
-    TCL_SetVar("curmarkmode",h.mark_mode)
-    TCL_SetVar("curmarksize",string(h.mark_size))
-    TCL_SetVar("curmarksizeunit",h.mark_size_unit);
-    TCL_SetVar("curmarkforeground",string(h.mark_foreground))
-    TCL_SetVar("curmarkbackground",string(h.mark_background))
-    TCL_SetVar("curlinemode",h.surface_mode)
-
-
-    d="["+strcat(string(size(h.data.x)),"x")+" double array]"
-    TCL_SetVar("curdata_x",d);
-    d="["+strcat(string(size(h.data.y)),"x")+" double array]"
-    TCL_SetVar("curdata_y",d);
-    d="["+strcat(string(size(h.data.z)),"x")+" double array]"
-    TCL_SetVar("curdata_z",d);
-
-    TCL_EvalStr("set flagCOLOR 0")
-    if(h.data(1)==["3d" "x" "y" "z" "color"])
-        TCL_EvalStr("set flagCOLOR 1")
-        d="["+strcat(string(size(h.data.color)),"x")+" integer array]"
-        TCL_SetVar("curdata_color",d);
-    end
-
-
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Fac3d.tcl")
-endfunction
-
-
-function ged_text(h)
-    global ged_handle; ged_handle=h
-    f=h;while stripblanks(f.type)<>"Figure" then f=f.parent,end
-    TCL_SetVar("curvis",h.visible)
-    TCL_SetVar("ncolors",string(size(f.color_map,1)))
-    TCL_SetVar("curfontforeground",string(h.font_foreground))
-    ged_fontarray = ["Monospaced" "Symbol" "Serif",..
-    "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
-    "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
-    "SansSerif Bold Italic"];
-    TCL_SetVar("curfontstyle",ged_fontarray(h.font_style+1))
-    TCL_SetVar("curfontsize",string(h.font_size))
-    TCL_SetVar("curfontangle",string(h.font_angle))
-    TCL_SetVar("curtextboxmode",h.text_box_mode)
-    TCL_SetVar("curtext",h.text)
-    TCL_SetVar("curforeground",string(h.foreground))
-    TCL_SetVar("curbackground",string(h.background))
-    TCL_SetVar("curboxmode",h.box)
-    TCL_SetVar("curlinemode",h.line_mode);
-    TCL_SetVar("curfillmode",h.fill_mode);
-    //TCL_SetVar("curPosition",h.data) ;
-
-    if (h.clip_box==[])
-        TCL_SetVar("old_Xclipbox","")
-        TCL_SetVar("old_Yclipbox","")
-        TCL_SetVar("old_Wclipbox","")
-        TCL_SetVar("old_Hclipbox","")
-        TCL_SetVar("Xclipbox","")
-        TCL_SetVar("Yclipbox","")
-        TCL_SetVar("Wclipbox","")
-        TCL_SetVar("Hclipbox","")
-    else
-        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
-        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
-    end
-    TCL_SetVar("curclipstate",h.clip_state);
-
-    if size(h.text,"*") == 1 then
-        txt =""""+ h.text +"""" ; // one double quote at each side
-    else
-        txt = "["+strcat(string(size(h.text)),"x")+" string array]"
-    end
-    TCL_SetVar("curtext", txt );
-    TCL_SetVar( "textBoxWidth", string( h.text_box(1) ) ) ;
-    TCL_SetVar("textBoxHeight", string( h.text_box(2) ) ) ;
-    TCL_SetVar("curAlignment",string(h.alignment) ) ;
-
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Text.tcl")
-endfunction
-
-
-function ged_legend(h)
-    global ged_handle; ged_handle=h
-    TCL_SetVar("curvis",h.visible)
-    TCL_SetVar("ncolors",string(size(f.color_map,1)))
-    TCL_SetVar("curforeground",string(h.foreground))
-    ged_fontarray = ["Monospaced" "Symbol" "Serif",..
-    "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
-    "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
-    "SansSerif Bold Italic"];
-    TCL_SetVar("curfontstyle",ged_fontarray(h.font_style+1))
-    TCL_SetVar("curfontsize",string(h.font_size))
-    TCL_SetVar("curtext",h.text)
-
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Legend.tcl")
-endfunction
-
-
-function ged_arc(h)
-    global ged_handle; ged_handle=h
-
-    if (h.clip_box==[])
-        TCL_SetVar("old_Xclipbox","")
-        TCL_SetVar("old_Yclipbox","")
-        TCL_SetVar("old_Wclipbox","")
-        TCL_SetVar("old_Hclipbox","")
-        TCL_SetVar("Xclipbox","")
-        TCL_SetVar("Yclipbox","")
-        TCL_SetVar("Wclipbox","")
-        TCL_SetVar("Hclipbox","")
-    else
-        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
-        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
-    end
-    TCL_SetVar("curclipstate",h.clip_state);
-    ged_linestylearray=["solid" "dash" "dash dot" "longdash dot" "bigdash dot" "bigdash longdash" "dot" "double dot"];
-    TCL_SetVar("curlinestyle",ged_linestylearray(max(h.line_style,1)))
-    TCL_SetVar("nbcol",string(size(h.data,2)))
-    for i=1:size(h.data,2)
-        val= "arcVAL("+string(i)+")";
-        TCL_EvalStr("set "+val+" "+string(h.data(2)));
-    end
-    f=h;while stripblanks(f.type)<>"Figure" then f=f.parent,end
-    TCL_SetVar("ncolors",string(size(f.color_map,1)))
-    TCL_SetVar("curcolor",string(h.foreground))
-    TCL_SetVar("curback",string(h.background))
-    TCL_SetVar("curvis",h.visible)
-    TCL_SetVar("curlinemode",h.line_mode)
-    TCL_SetVar("curfillmode",h.fill_mode)
-    TCL_SetVar("curthick",string(h.thickness))
-
-    ax=getparaxe(h);
-    // Arc data
-    select ax.view
-    case "2d"
-        drawlater();
-        ax.view="3d"  //strange behavior in 3D... seems to be bugged!!
-        TCL_SetVar("Xval",string(h.data(1)))
-        TCL_SetVar("Yval",string(h.data(2)))
-        TCL_SetVar("Zval",string(h.data(3)))
-        TCL_SetVar("Wval",string(h.data(4)))
-        TCL_SetVar("Hval",string(h.data(5)))
-        TCL_SetVar("A1val",string(h.data(6)))
-        TCL_SetVar("A2val",string(h.data(7)))
-        ax.view="2d"
-        drawnow();
-    case "3d"
-        TCL_SetVar("Xval",string(h.data(1)))
-        TCL_SetVar("Yval",string(h.data(2)))
-        TCL_SetVar("Zval",string(h.data(3)))
-        TCL_SetVar("Wval",string(h.data(4)))
-        TCL_SetVar("Hval",string(h.data(5)))
-        TCL_SetVar("A1val",string(h.data(6)))
-        TCL_SetVar("A2val",string(h.data(7)))
-    end
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Arc.tcl")
-endfunction
-
-
-function ged_segs(h)
-    global ged_handle; ged_handle=h
-    TCL_SetVar("curvis",h.visible)
-    TCL_SetVar("ncolors",string(size(f.color_map,1)))
-    TCL_SetVar("curarrowsize",string(h.arrow_size))
-    TCL_SetVar("curthick",string(h.thickness))
-    ged_linestylearray=["solid" "dash" "dash dot" "longdash dot" "bigdash dot" "bigdash longdash" "dot" "double dot"];
-    TCL_SetVar("curlinestyle",ged_linestylearray(max(h.line_style,1)))
-
-    ged_markstylearray=["dot" "plus" "cross" "star" "filled diamond" ..
-    "diamond" "triangle up" "triangle down" "diamond plus" "circle" ..
-    "asterisk" "square" "triangle right" "triangle left" "pentagram"];
-
-    TCL_SetVar("curmarkstyle",ged_markstylearray(abs(h.mark_style)+1))
-    TCL_SetVar("curmarkmode",h.mark_mode)
-    TCL_SetVar("curmarksize",string(h.mark_size))
-    TCL_SetVar("curmarksizeunit",h.mark_size_unit);
-    TCL_SetVar("curmarkforeground",string(h.mark_foreground))
-    TCL_SetVar("curmarkbackground",string(h.mark_background))
-    TCL_SetVar("curlinemode",h.line_mode)
-
-    TCL_SetVar("nbrow",string(size(h.data,1)))
-
-    d="["+strcat(string(size(h.data)),"x")+" double array]"
-    TCL_SetVar("curdata",d);
-
-    TCL_SetVar("nbcolsegscolor",string(size(h.segs_color,2)))
-    for i=1:size(h.segs_color,2)
-        val= "segscolorVAL("+string(i)+")";
-        TCL_EvalStr("set "+val+" "+string(h.segs_color(i)));
-    end
-
-    if (h.clip_box==[])
-        TCL_SetVar("old_Xclipbox","")
-        TCL_SetVar("old_Yclipbox","")
-        TCL_SetVar("old_Wclipbox","")
-        TCL_SetVar("old_Hclipbox","")
-        TCL_SetVar("Xclipbox","")
-        TCL_SetVar("Yclipbox","")
-        TCL_SetVar("Wclipbox","")
-        TCL_SetVar("Hclipbox","")
-    else
-        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
-        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
-    end
-    TCL_SetVar("curclipstate",h.clip_state);
-
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Segs.tcl")
-endfunction
-
-
-function ged_champ(h)
-    global ged_handle; ged_handle=h
-    TCL_SetVar("curvis",h.visible)
-    TCL_SetVar("curcolored",h.colored)
-    TCL_SetVar("ncolors",string(size(f.color_map,1)))
-    TCL_SetVar("curarrowsize",string(h.arrow_size))
-    TCL_SetVar("curthick",string(h.thickness))
-    ged_linestylearray=["solid" "dash" "dash dot" "longdash dot" "bigdash dot" "bigdash longdash" "dot" "double dot"];
-    TCL_SetVar("curlinestyle",ged_linestylearray(max(h.line_style,1)))
-
-    d="["+strcat(string(size(h.data.x)),"x")+" double array]"
-    TCL_SetVar("curdata_x",d);
-    d="["+strcat(string(size(h.data.y)),"x")+" double array]"
-    TCL_SetVar("curdata_y",d);
-    d="["+strcat(string(size(h.data.fx)),"x")+" double array]"
-    TCL_SetVar("curdata_fx",d);
-    d="["+strcat(string(size(h.data.fy)),"x")+" double array]"
-    TCL_SetVar("curdata_fy",d);
-
-    if (h.clip_box==[])
-        TCL_SetVar("old_Xclipbox","")
-        TCL_SetVar("old_Yclipbox","")
-        TCL_SetVar("old_Wclipbox","")
-        TCL_SetVar("old_Hclipbox","")
-        TCL_SetVar("Xclipbox","")
-        TCL_SetVar("Yclipbox","")
-        TCL_SetVar("Wclipbox","")
-        TCL_SetVar("Hclipbox","")
-    else
-        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
-        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
-    end
-    TCL_SetVar("curclipstate",h.clip_state);
-
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Champ.tcl")
-endfunction
-
-function ged_fec(h)
-    global ged_handle; ged_handle=h
-    TCL_SetVar("curvis",h.visible)
-    TCL_SetVar("zbmin",string(h.z_bounds(1)))
-    TCL_SetVar("zbmax",string(h.z_bounds(2)))
-    //  TCL_SetVar("nbrow",string(size(h.data,1)))
-    //  TCL_SetVar("nbcol",string(size(h.data,2)))
-    //  TCL_SetVar("nbrowTri",string(size(h.triangles,1)))
-    //  TCL_SetVar("nbcolTri",string(size(h.triangles,2)))
-
-    d="["+strcat(string(size(h.data)),"x")+" double array]"
-    TCL_SetVar("curdata_data",d);
-    d="["+strcat(string(size(h.triangles)),"x")+" double array]"
-    TCL_SetVar("curdata_triangles",d);
-
-    //  if (h.clip_box==[])
-    //    TCL_SetVar("old_Xclipbox","")
-    //    TCL_SetVar("old_Yclipbox","")
-    //    TCL_SetVar("old_Wclipbox","")
-    //    TCL_SetVar("old_Hclipbox","")
-    //    TCL_SetVar("Xclipbox","")
-    //    TCL_SetVar("Yclipbox","")
-    //    TCL_SetVar("Wclipbox","")
-    //    TCL_SetVar("Hclipbox","")
-    //   else
-    //    TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
-    //    TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
-    //    TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
-    //    TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
-    //    TCL_SetVar("Xclipbox",string(h.clip_box(1)))
-    //    TCL_SetVar("Yclipbox",string(h.clip_box(2)))
-    //    TCL_SetVar("Wclipbox",string(h.clip_box(3)))
-    //    TCL_SetVar("Hclipbox",string(h.clip_box(4)))
-    //  end
-    //  TCL_SetVar("curclipstate",h.clip_state);
-
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Fec.tcl")
-endfunction
-
-
-function ged_grayplot(h)
-    global ged_handle; ged_handle=h
-    TCL_SetVar("curvis",h.visible)
-    TCL_SetVar("curdatamapping",h.data_mapping)
-
-
-    d="["+strcat(string(size(h.data.x)),"x")+" double array]"
-    TCL_SetVar("curdata_x",d);
-    d="["+strcat(string(size(h.data.y)),"x")+" double array]"
-    TCL_SetVar("curdata_y",d);
-    d="["+strcat(string(size(h.data.z)),"x")+" double array]"
-    TCL_SetVar("curdata_z",d);
-
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Grayplot.tcl")
-
-endfunction
-
-function ged_matplot(h)
-    global ged_handle; ged_handle=h
-    TCL_SetVar("curvis",h.visible)
-
-    d="["+strcat(string(size(h.data)),"x")+" double array]"
-    TCL_SetVar("curdata",d);
-
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Matplot.tcl")
-
-endfunction
-
-
-function ged_axis(h)
-    global ged_handle; ged_handle=h
-    TCL_SetVar("curvis",h.visible)
-    TCL_SetVar("curseg",h.tics_segment)
-    TCL_SetVar("curcolor",string(h.tics_color))
-    TCL_SetVar("curticsstyle",h.tics_style)
-    TCL_SetVar("curfontcolor",string(h.labels_font_color))
-    TCL_SetVar("curfontsize",string(h.labels_font_size))
-    TCL_SetVar("nbcolX",string(size(h.xtics_coord,2)))
-    TCL_SetVar("nbcolY",string(size(h.ytics_coord,2)))
-    TCL_SetVar("xticscoord",sci2exp(h.xtics_coord,0))
-    TCL_SetVar("yticscoord",sci2exp(h.ytics_coord,0))
-    TCL_SetVar("cursubtics",string(h.sub_tics))
-    TCL_SetVar("curticslabel",sci2exp(h.tics_labels,0))
-    TCL_SetVar("curticsdir",string(h.tics_direction))
-
-    if (h.clip_box==[])
-        TCL_SetVar("old_Xclipbox","")
-        TCL_SetVar("old_Yclipbox","")
-        TCL_SetVar("old_Wclipbox","")
-        TCL_SetVar("old_Hclipbox","")
-        TCL_SetVar("Xclipbox","")
-        TCL_SetVar("Yclipbox","")
-        TCL_SetVar("Wclipbox","")
-        TCL_SetVar("Hclipbox","")
-    else
-        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
-        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
-        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
-        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
-        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
-    end
-    TCL_SetVar("curclipstate",h.clip_state);
-
-    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Axis.tcl")
-endfunction
-
-
-function [h,Axes]=ged_getobject(pt)
-    h=[];Axes=[];
-    f=get("current_figure");
-    aold=get("current_axes")
-    axes_array=f.children
-    //retains only the entities of type Axes (remove uimenus)
-    axes_array(axes_array.type<>"Axes")=[];
-    // assume that the lastly created objects
-    // are at the beginning of the arrays of children
-    // We can then select the last object
-    // first in the loop.
-    for k=1:size(axes_array,"*")
-        Axes=axes_array(k)
-        set("current_axes",Axes)
-        h=ged_loop(Axes,pt)
-        if h<>[] then break,end
-    end
-    set("current_axes",aold)
-endfunction
-
-function h=ged_loop(a,pt)
-
-    h=[]
-    minDist    = 0.01 ;
-    minPixDist = 3    ;
-
-    for ka=1:size(a,"*")
-        ck=a(ka) ;
-        select ck.type
-
-        case "Polyline"
-            xy=ck.data;
-            d=Dist2polyline((xy(:,1)-Xmin)/Dx,(xy(:,2)-Ymin)/Dy,pts)
-            if d < minDist then h=ck,return,end
-
-        case "Rectangle"
-            xy=ck.data;
-            x0=xy(1);y0=xy(2);W=xy(3);H=xy(4);
-            d=Dist2polyline((x0+[0,W,W,0]-Xmin)/Dx,(y0+[0,0,-H,-H]-Ymin)/Dy,pts)
-            if d < minDist then h=ck,return,end
-
-        case "Arc"
-            xy=ck.data;
-            [xp,yp]=xchange(pt(1),pt(2),"i2f")
-            //[dist, toto] = dist2Arc( [xp,yp] ./ [Dx,Dy], xy(1:2)./[Dx,Dy], xy(3)/Dx, xy(4)/Dy, xy(5) / 64., xy(6) / 64. ) ;
-            dist = pixDist2Arc( [xp,yp], xy(1:2), xy(3), xy(4), xy(5) / 64., xy(6) / 64. ) ;
-            if dist <= minPixDist then
-                h=ck;
-                return;
-            end
-
-        case "Segs"
-            xy=ck.data;
-            xv=(matrix(xy(:,1),2,-1)-Xmin)/Dx
-            yv=(matrix(xy(:,2),2,-1)-Ymin)/Dy
-            for ks=1:size(xv,2)
-                d=Dist2polyline(xv(:,ks),yv(:,ks),pts)
-                if d < minDist then h=ck,return,end
-            end
-        case "Compound"
-            h=ged_loop(ck.children,pt)
-            if h<>[] then return,end
-
-        case "Axes"
-            xy=ck.data_bounds;
-            [xp,yp]=xchange(pt(1),pt(2),"i2f")
-            Xmin=xy(1,1);Ymin=xy(1,2),Dx=xy(2,1)-xy(1,1);Dy=xy(2,2)-xy(1,2);
-            pts=[(xp-Xmin)/Dx (yp-Ymin)/Dy]
-            d=Dist2polyline([0,1,1,0],[0,0,1,1],pts)
-            if d < minDist then h=ck,return,end
-            h=ged_loop([a.children(:);ck.x_label;ck.y_label;ck.z_label;ck.title],pt)
-            if h<>[] then return,end
-
-        case "Text"
-            if is_in_text(ck,[xp;yp]) then
-                h=ck,
-                return,
-            end
-
-        case "Label"
-            if is_in_text(ck,[xp;yp]) then
-                h=ck
-                return,
-            end
-
-        end
-    end
-endfunction
-
-function r=is_in_text(h,xy)
-    if h.Type == "Text" & h.text_box_mode=="filled" then
-        r=(xy(1)>h.data(1)&xy(1)<h.data(1)+h.text_box(1))&(xy(2)>h.data(2)&xy(2)<h.data(2)+h.text_box(2))
-    else
-        r = stringbox(h);
-        r=[r r(:,1)];
-        r=and([xy(2) -xy(1)]*diff(r,1,2)+(r(1,1:$-1).*r(2,2:$)-r(1,2:$).*r(2,1:$-1))<0)
-    end
-endfunction
-
-// compute the square of distance between a point and the ellipse
-// in 2D included in an axis aligned rectangle whose upper left
-// corner is upperLeft and its wifth and heigth is defined.
-function [dist] = dist2Ellipse( point, upperLeft, width, heigth )
-    width2  = width  / 2. ;
-    heigth2 = heigth / 2. ;
-    centerC = [ upperLeft(1) + width2, upperLeft(2) - heigth2 ] ; // center of the ellipse
-
-    // clicked point in the circle frame
-    pointC  = [ (point(1) - centerC(1)) / width2, (point(2) - centerC(2)) / heigth2 ] ;
-
-    // get the vector between the point and the closest on the circle
-    diffclose = ( 1 - 1 / norm( pointC ) ) * pointC ;
-    //closest = pointC / sqrt( pointC(1) * pointC(1) + pointC(2) * pointC(2) ) ;
-
-    // get the difference between the two
-    //ffclose = pointC - closest ;
-
-    // bring it back to the current frame value
-    diffclose(1) = diffclose(1) * width2  ;
-    diffclose(2) = diffclose(2) * heigth2 ;
-
-    // get the distance with the closest point
-    dist = norm( diffclose ) ;
-
-endfunction
-
-// compute the distance between a point and the arc
-// in 2D included in an axis aligned rectangle whose upper left
-// corner is upperLeft and its wifth and heigth is defined.
-function [dist,diffClose] = dist2Arc( point, upperLeft, width, heigth, sector1, sector2 )
-
-
-    if ( width == 0 | heigth == 0 ) then
-        dist = %inf ;
-        diffClose = [%inf,%inf];
-        return ;
-    end
-
-    // convert the sector into radiant angle
-    angle1 =  sector1            * %pi / 180. ;
-    angle2 = (sector1 + sector2) * %pi / 180. ;
-
-    width2  = width  / 2. ;
-    heigth2 = heigth / 2. ;
-    centerC = [ upperLeft(1) + width2, upperLeft(2) - heigth2 ] ; // center of the ellipse
-
-    // clicked point in the circle frame
-    pointC  = [ (point(1) - centerC(1)) / width2, (point(2) - centerC(2)) / heigth2 ] ;
-
-    // get the projection of the clicked point on the circle
-    closest = pointC / norm( pointC ) ;
-
-    // now a quite tricky part. The aim is to find
-    // if the closest point is in the drawing sector
-    // ie if it is between bound1 and bound2 on the circle
-    // maybe a eayer solution exists.
-
-    // get the boundaries of the displayed angle
-    // the closest point is not on the arc it is one of the two
-    // boundaries
-    bound1 = [cos(angle1),sin(angle1)] ;
-    bound2 = [cos(angle2),sin(angle2)] ;
-
-    // now get the vector of bissecting line between the two bounds
-    // with the orientation toward the arc
-    b2b1       = bound1 -  bound2 ;
-    bissect(1) = -b2b1(2)         ;
-    bissect(2) =  b2b1(1)         ;
-
-    // get the position of the point along this axis
-    side = closest(1) * bissect(1) + closest(2) * bissect(2) ;
-
-    // get the position of one of the bound (same value for both)
-    boundPos = bound1(1) * bissect(1) + bound1(2) * bissect(2) ;
-
-    if side > boundPos  then
-        // the closest point is on the arc
-        diffClose = ( pointC - closest ) .* [width2,heigth2] ;
-        // bring it back to the current frame value
-        //diffclose = diffclose .* [width2,heigth2] ;
-
-        // get the distance with the closest point
-        dist = norm( diffClose ) ;
-
-    else
-        // the closest point is one of the bounds
-        // return back to the real coordinates
-        bound1 = centerC + bound1 .* [width2,heigth2];
-        bound2 = centerC + bound2 .* [width2,heigth2];
-
-        // get the minimum distance
-        dist  = norm( bound1 - point ) ;
-        dist2 = norm( bound2 - point ) ;
-        if dist > dist2 then
-            diffClose = bound1 - point ;
-        else
-            dist = dist2 ;
-            diffClose = bound2 - point ;
-        end
-        //dist = min( norm( bound1 - point ), norm( bound2 - point ) ) ;
-    end
-
-endfunction
-
-// same as before but return the value in pixels
-function dist = pixDist2Arc( point, upperLeft, width, heigth, sector1, sector2 )
-
-    [dist, difference] = dist2Arc( point, upperLeft, width, heigth, sector1, sector2 ) ;
-    // convert to pixels
-    // get the length of the difference vector
-    // we construct it by getting two points
-    [origin(1),origin(2)] = xchange(0,0,"f2i");
-    [extremity(1),extremity(2)] = xchange(difference(1),difference(2),"f2i");
-    dist = norm( extremity - origin ) ;
-
-endfunction
-
-function [d,pt,ind]=Dist2polyline(xp,yp,pt)
-    // computes minimum distance from a point to a polyline
-    //d    minimum distance to polyline
-    //pt   coordinate of the polyline closest point
-    //ind
-    //     if negative polyline closest point is a polyline corner:pt=[xp(-ind) yp(-ind)]
-    //     if positive pt lies on segment [ind ind+1]
-
-    // Copyright INRIA
-    x=pt(1)
-    y=pt(2)
-    xp=xp(:);yp=yp(:)
-    cr=4*sign((xp(1:$-1)-x).*(xp(1:$-1)-xp(2:$))+..
-    (yp(1:$-1)-y).*(yp(1:$-1)-yp(2:$)))+..
-    sign((xp(2:$)-x).*(xp(2:$)-xp(1:$-1))+..
-    (yp(2:$)-y).*(yp(2:$)-yp(1:$-1)))
-
-    ki=find(cr==5) // index of segments for which projection fall inside
-    np=size(xp,"*")
-    if ki<>[] then
-        //projection on segments
-        x=[xp(ki) xp(ki+1)]
-        y=[yp(ki) yp(ki+1)]
-        dx=x(:,2)-x(:,1)
-        dy=y(:,2)-y(:,1)
-        d_d=dx.^2+dy.^2
-        d_x=( dy.*(-x(:,2).*y(:,1)+x(:,1).*y(:,2))+dx.*(dx*pt(1)+dy*pt(2)))./d_d
-        d_y=(-dx.*(-x(:,2).*y(:,1)+x(:,1).*y(:,2))+dy.*(dx*pt(1)+dy*pt(2)))./d_d
-        xp=[xp;d_x]
-        yp=[yp;d_y]
-    end
-    [d,k]=min(((xp-pt(1))).^2+((yp-pt(2))).^2) //distance with all points
-    d=sqrt(d)
-    pt(1)=xp(k)
-    pt(2)=yp(k)
-    if k>np then ind=ki(k-np),else ind=-k,end
-endfunction
-
-function ged_eventhandler(win,x,y,ibut)
-    //Copyright INRIA
-    //Author : Serge Steer 2002
-    if ibut==-1 then return,end //ignore move
-    if and(win<>winsid())| ibut==-1000 then
-        //window has been deleted by the user
-        return
-    end
-    cur=gcf(); //preserve current figure
-    fig=scf(win) //make the window associated to the event active
-
-    //disable the event handler not to execute new event before finishing this one
-    fig.event_handler_enable = "off";
-
-
-    global ged_handle;ged_handle=[]
-    ged_handle=ged_getobject([x,y])
-
-    if ged_handle~=[] then
-        if  or(ibut==[0 3 10]) then //left button --> edit properties
-            tkged()
-        elseif or(ibut==[2 5 12]) then //right button -->move
-            [x,y]=xchange(x,y,"i2f")
-            pos=[x,y]
-            while %t then
-                rep=xgetmouse([%t %t])
-                if rep(3)>0 then break,end
-                move(ged_handle,rep(1:2)-pos)
-                pos=rep(1:2)
-            end
-        end
-    end
-    fig.event_handler_enable = "on";
-    scf(cur) //reset current window
-endfunction
-
-
-function [ini,typs]=build_args(labels)
-    n=size(labels,"*")
-    ini=[]
-    typs=list()
-    for k=1:n
-        typ=type(h(labels(k)))
-        execstr(["if typ==10 then"
-        "   w=h."+labels(k)
-        "else"
-        "   w=sci2exp(h."+labels(k)+",0)"
-        "end"])
-        ini=[ini;w]
-        if typ==10 then
-            typs($+1)="str";typs($+1)=-1
-        else
-            typs($+1)="vec";typs($+1)=1
-        end
-    end
-endfunction
-
-function GetSetValue(h)
-    n=size(labels,"*")
-    lhs="[ok,"+strcat("x"+string(1:n),",")+"]"
-    execstr(lhs+"=getvalue(t,labels,typs,ini)")
-    if ok then
-        for k=1:n
-            execstr("if x"+string(k)+"<>h."+labels(k)+" then h."+..
-            labels(k)+"=x"+string(k)+",end")
-        end
-    end
-endfunction
-
-
-
-function tkged()
-    global ged_handle
-    global ged_cur_fig_handle
-
-    h=ged_handle
-
-    // hierarchical viewer
-    TK_send_handles_list(ged_cur_fig_handle)
-    TCL_SetVar("curgedindex",string(Get_handle_pos_in_list(h)))
-
-    //color_map array for color sample display
-    f=getparfig(h);
-    for i=1:size(f.color_map,1)
-        redname= "RED("+string(i)+")";
-        TCL_EvalStr("set "+redname+" "+string(f.color_map(i,1)));
-        grename= "GREEN("+string(i)+")";
-        TCL_EvalStr("set "+grename+" "+string(f.color_map(i,2)));
-        bluname= "BLUE("+string(i)+")";
-        TCL_EvalStr("set "+bluname+" "+string(f.color_map(i,3)));
-    end
-
-    TCL_SetVar("msdos",string(getos() == "Windows")) // to know the OS
-
-    // get the number of the window associated with ged
-    TCL_SetVar("sciGedIsAlive",string(ged_cur_fig_handle.figure_id)) ;
-    TCL_SetVar("SCIHOME", SCIHOME) // to know the home directory to put temporary files
-
-    select h.type
-    case "Polyline"
-        ged_polyline(h)
-    case "Rectangle"
-        ged_rectangle(h)
-    case "Axes"
-        ged_axes(h)
-    case "Label" // for now the labels are inside the axes (F.Leray 06.12.05)
-        ged_axes(h.parent)
-        if (h == h.parent.x_label)
-            TCL_EvalStr("Notebook:raise $uf.n X");
-        elseif (h == h.parent.y_label)
-            TCL_EvalStr("Notebook:raise $uf.n Y");
-        elseif (h == h.parent.z_label)
-            TCL_EvalStr("Notebook:raise $uf.n Z");
-        elseif (h == h.parent.title)
-            TCL_EvalStr("Notebook:raise $uf.n Title");
-        end
-    case "Figure"
-        ged_figure(h)
-    case "Compound"
-        ged_Compound(h)
-
-    case "Plot3d"
-        ged_plot3d(h)
-    case "Fac3d"
-        ged_fac3d(h)
-    case "Text"
-        ged_text(h)
-    case "Legend"
-        ged_legend(h)
-    case "Arc"
-        ged_arc(h)
-    case "Segs"
-        ged_segs(h)
-    case "Champ"
-        ged_champ(h)
-    case "Fec"
-        ged_fec(h)
-    case "Grayplot"
-        ged_grayplot(h)
-    case "Matplot"
-        ged_matplot(h)
-    case "Axis"
-        ged_axis(h)
-    end
-endfunction
-
-function setStyle(sty)
-    global ged_handle; h=ged_handle
-    h.polyline_style=find(sty==["interpolated","staircase", ...
-    "barplot","arrowed","filled" "bar"])
-endfunction
-function setLineStyle(sty)
-    global ged_handle; h=ged_handle
-    h.line_style=find(sty==[ "solid" "dash" "dash dot" "longdash dot" ..
-    "bigdash dot" "bigdash longdash" "dot" "double dot"])
-
-endfunction
-function setMarkStyle(sty)
-    global ged_handle; h=ged_handle
-    h.mark_style=find(sty==["dot" "plus" "cross" "star" "filled diamond" ..
-    "diamond" "triangle up" "triangle down" "diamond plus" "circle" ..
-    "asterisk" "square" "triangle right" "triangle left" "pentagram"])-1
-endfunction
-function setFontStyle(ftn)
-    global ged_handle; h=ged_handle
-    h.font_style=find(ftn==["Monospaced" "Symbol" "Serif",..
-    "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
-    "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
-    "SansSerif Bold Italic"])-1;
-endfunction
-
-function setLabelsFontStyle(label,ftn)
-    global ged_handle; h=ged_handle
-    select label
-    case "t"
-        TCL_EvalStr("Notebook:raise $uf.n Z");
-        h.title.font_style=find(ftn==["Monospaced" "Symbol" "Serif",..
-        "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
-        "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
-        "SansSerif Bold Italic"])-1;
-    case "x"
-        h.x_label.font_style=find(ftn==["Monospaced" "Symbol" "Serif",..
-        "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
-        "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
-        "SansSerif Bold Italic"])-1;
-    case "y"
-        h.y_label.font_style=find(ftn==["Monospaced" "Symbol" "Serif",..
-        "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
-        "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
-        "SansSerif Bold Italic"])-1;
-    case "z"
-        h.z_label.font_style=find(ftn==["Monospaced" "Symbol" "Serif",..
-        "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
-        "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
-        "SansSerif Bold Italic"])-1;
-    end;
-endfunction
-
-
-// Axes data (data_bounds)
-function setXdb(xmin, xmax)
-    global ged_handle; h=ged_handle
-    tmp=h.data_bounds;
-    tmp(1,1)=xmin;
-    tmp(2,1)=xmax;
-    h.data_bounds=tmp;
-    //  tst=execstr('h.data_bounds=tmp','errcatch','n');
-    //  if tst<>0 then
-    //   disp 'Warning: X data_bounds must contain double'
-    //  end
-endfunction
-
-
-function setYdb(ymin, ymax)
-    global ged_handle; h=ged_handle
-    tmp=h.data_bounds;
-    tmp(1,2)=ymin;
-    tmp(2,2)=ymax;
-    h.data_bounds=tmp;
-    //  tst=execstr('h.data_bounds=tmp','errcatch','n');
-    //  if tst<>0 then
-    //   disp 'Warning: Y data_bounds must contain double'
-    //  end
-endfunction
-
-function setZdb(zmin, zmax)
-    global ged_handle; h=ged_handle
-    select h.view
-    case "2d"
-        drawlater();
-        h.view="3d";
-        tmp=h.data_bounds;
-        tmp(1,3)=zmin;
-        tmp(2,3)=zmax;
-        h.data_bounds=tmp;
-        h.view="2d";
-        drawnow();
-        //      tst=execstr('h.data_bounds=tmp','errcatch','n');
-        //      h.view='2d';
-        //      if tst<>0 then
-        //       disp 'Warning: Z data_bounds must contain double'
-        //      end
-    case "3d"
-        tmp=h.data_bounds;
-        tmp(1,3)=zmin;
-        tmp(2,3)=zmax;
-        h.data_bounds=tmp;
-        //      tst=execstr('h.data_bounds=tmp','errcatch','n');
-        //      if tst<>0 then
-        //        disp 'Warning: Z data_bounds must contain double'
-        //      end
-    end
-endfunction
-
-
-function LogtoggleX( tog)
-    global ged_handle; h=ged_handle
-
-    h.log_flags=tog+part(h.log_flags,2);
-
-
-    //tst=execstr("global h;h.log_flags=tog+part(h.log_flags,2)",'errcatch','n');
-
-    //if tst<>0 then
-    //   disp 'Warning: X bounds must be strictly positive'
-    //end
-endfunction
-
-function LogtoggleY( tog)
-    global ged_handle; h=ged_handle
-
-    h.log_flags=part(h.log_flags,1)+tog;
-
-
-    //tst=execstr("global h;h.log_flags=part(h.log_flags,1)+tog",'errcatch','n');
-
-    //if tst<>0 then
-    //   disp 'Warning: Y bounds must be strictly positive'
-    //end
-
-endfunction
-
-
-function LogtoggleZ( tog)
-    global ged_handle; h=ged_handle
-
-    h.log_flags=part(h.log_flags,1)+part(h.log_flags,2)+tog;
-
-
-    //tst=execstr("global h;h.log_flags=part(h.log_flags,1)+tog",'errcatch','n');
-
-    //if tst<>0 then
-    //   disp 'Warning: Z bounds must be strictly positive'
-    //end
-
-endfunction
-
-
-
-function [haxe] = getparaxe( h )
-
-    htmp = h;
-    haxe = [];
-    while htmp.type<>"Axes" do
-        htmp = htmp.parent
-    end
-
-    haxe = htmp;
-endfunction
-
-
-
-
-// Rectangle data
-function setXval(val)
-    global ged_handle; h=ged_handle
-    tmp=h.data;
-    tmp(1)=val;
-    tst=execstr("h.data=tmp","errcatch","n");
-    if tst<>0 then
-        disp "Warning: Y data must contain double"
-    end
-endfunction
-
-function setYval(val)
-    global ged_handle; h=ged_handle
-    tmp=h.data;
-    tmp(2)=val;
-    tst=execstr("h.data=tmp","errcatch","n");
-    if tst<>0 then
-        disp "Warning: Y data must contain double"
-    end
-endfunction
-
-function setZval(val)
-    global ged_handle; h=ged_handle
-    ax=getparaxe(h);
-    select ax.view
-    case "2d"
-        drawlater();
-        ax.view="3d";
-        tmp=h.data;
-        tmp(3)=val;
-        tst=execstr("h.data=tmp","errcatch","n");
-        ax.view="2d";
-        drawnow();
-        if tst<>0 then
-            disp "Warning: Z data must contain double"
-        end
-    case "3d"
-        tmp=h.data;
-        tmp(3)=val;
-        tst=execstr("h.data=tmp","errcatch","n");
-        if tst<>0 then
-            disp "Warning: Z data must contain double"
-        end
-    end
-endfunction
-
-
-function setWval(val)
-    global ged_handle; h=ged_handle
-    ax=getparaxe(h);
-    select ax.view
-    case "2d"
-        drawlater();
-        ax.view="3d";
-        tmp=h.data;
-        tmp(4)=val;
-        tst=execstr("h.data=tmp","errcatch","n");
-        ax.view="2d";
-        drawnow();
-        if tst<>0 then
-            disp "Warning: Width data must contain double"
-        end
-    case "3d"
-        tmp=h.data;
-        tmp(4)=val;
-        tst=execstr("h.data=tmp","errcatch","n");
-        if tst<>0 then
-            disp "Warning: Width data must contain double"
-        end
-    end
-endfunction
-
-
-function setHval(val)
-    global ged_handle; h=ged_handle
-    ax=getparaxe(h);
-    select ax.view
-    case "2d"
-        drawlater();
-        ax.view="3d";
-        tmp=h.data;
-        tmp(5)=val;
-        tst=execstr("h.data=tmp","errcatch","n");
-        ax.view="2d";
-        drawnow();
-        if tst<>0 then
-            disp "Warning: Height data must contain double"
-        end
-    case "3d"
-        tmp=h.data;
-        tmp(5)=val;
-        tst=execstr("h.data=tmp","errcatch","n");
-        if tst<>0 then
-            disp "Warning: Height data must contain double"
-        end
-    end
-endfunction
-
-
-// complement for Arc entity
-function setA1val(val)
-    global ged_handle; h=ged_handle
-    ax=getparaxe(h);
-    select ax.view
-    case "2d"
-        drawlater();
-        ax.view="3d";
-        tmp=h.data;
-        tmp(6)=val;
-        tst=execstr("h.data=tmp","errcatch","n");
-        ax.view="2d";
-        drawnow();
-        if tst<>0 then
-            disp "Warning: Width data must contain double"
-        end
-    case "3d"
-        tmp=h.data;
-        tmp(6)=val;
-        tst=execstr("h.data=tmp","errcatch","n");
-        if tst<>0 then
-            disp "Warning: a1 data must contain double"
-        end
-    end
-endfunction
-
-function setA2val(val)
-    global ged_handle; h=ged_handle
-    ax=getparaxe(h);
-    select ax.view
-    case "2d"
-        drawlater();
-        ax.view="3d";
-        tmp=h.data;
-        tmp(7)=val;
-        tst=execstr("h.data=tmp","errcatch","n");
-        ax.view="2d";
-        drawnow();
-        if tst<>0 then
-            disp "Warning: Width data must contain double"
-        end
-    case "3d"
-        tmp=h.data;
-        tmp(7)=val;
-        tst=execstr("h.data=tmp","errcatch","n");
-        if tst<>0 then
-            disp "Warning: a2 data must contain double"
-        end
-    end
-endfunction
-
-
-//Fec
-function setZb(min, max)
-    global ged_handle; h=ged_handle
-    tmp=h.z_bounds;
-    tmp(1,1)=min;
-    tmp(1,2)=max;
-    tst=execstr("h.z_bounds=tmp","errcatch","n");
-    if tst<>0 then
-        disp "Warning: X data_bounds must contain double"
-    end
-endfunction
-
-
-
-////////////////////////////////
-// Scilab Command Interface ////
-////////////////////////////////
-//Plot3d
-function set3dtlistXYZ (X,Y,Z)
-    global ged_handle; h=ged_handle
-    ged_tmp_tlist = tlist(["3d","x","y","z"],X,Y,Z)
-    h.data=ged_tmp_tlist;
-    clear ged_tmp_tlist;
-endfunction
-
-function set3dtlistXYZC (X,Y,Z,COLOR)
-    global ged_handle; h=ged_handle
-    ged_tmp_tlist = tlist(["3d","x","y","z","color"],X,Y,Z,COLOR)
-    h.data=ged_tmp_tlist;
-    clear ged_tmp_tlist;
-endfunction
-
-function setGrayplottlist(X,Y,Z)
-    global ged_handle; h=ged_handle
-    ged_tmp_tlist = tlist(["grayplotdata","x","y","z"],X,Y,Z)
-    h.data=ged_tmp_tlist;
-    clear ged_tmp_tlist;
-endfunction
-
-//Champ
-function setchamptlistXYFXFY (X,Y,FX,FY)
-    global ged_handle; h=ged_handle
-    ged_tmp_tlist = tlist(["champdata","x","y","fx","fy"],X,Y,FX,FY)
-    h.data=ged_tmp_tlist;
-    clear ged_tmp_tlist;
-endfunction
-
-
-///////////////////////////////
-// Edit Data using sciGUI /////
-///////////////////////////////
-
-function EditData(TheData,datastring)
-    // TheData must be a real scalar or matrix
-    global ged_handle; h=ged_handle
-
-    // I declare ged_tmp ged_tmp_string WINDOW as global
-    global ged_tmp;
-    global ged_tmp_string;
-    global WINDOW;
-
-    ged_tmp_string = datastring;
-
-    ged_tmp=TheData;
-
-    WINDOW = GEDeditvar("ged_tmp")
-
-endfunction
-
-
-function CloseEditorSaveData()
-    // Called when closing data editor
-
-    global ged_handle; // To leave here because used when doing execstr(ged_tmp_string...
-    global ged_tmp;
-    global ged_tmp_string;
-    global WINDOW;
-
-    Nan = %nan // to avoid error message because of special Nan display
-
-    ged_tmp=GEDeditvar_get(WINDOW);
-
-    execstr(ged_tmp_string+"= ged_tmp");
-
-    clearglobal ged_tmp ged_tmp_string WINDOW
-    clear ged_tmp ged_tmp_string WINDOW
-
-endfunction
-
-
-function outvar=GEDeditvar_get(winId)
-    // Simple variable editor - import data
-    // This file is part of sciGUI toolbox
-    // Copyright (C) 2004 Jaime Urzua Grez
-    // mailto:jaime_urzua@yahoo.com
-    // rev. 0.1
-    //
-    // This program is free software; you can redistribute it and/or modify
-    //it under the terms of the GNU General Public License as published by
-    //the Free Software Foundation; either version 2 of the License, or
-    //(at your option) any later version.
-
-    //disp("Please wait...");
-    outvar=[];
-    base="sciGUITable(win,"+string(winId)+",data";
-    varType=evstr(TCL_GetVar(base+",type)"));
-    varni=evstr(TCL_GetVar(base+",ni)"));
-    varnj=evstr(TCL_GetVar(base+",nj)"));
-    for j=1:varnj,
-        ww=[];
-        for i=1:varni,
-            q=TCL_GetVar(base+","+string(i)+","+string(j)+")");
-            if (varType~=10) then
-                if (varType==4) then
-                    if ((q=="T")|(q=="t")) then
-                        ww=[ww;%t];
-                    else
-                        ww=[ww;%f];
-                    end
-                else
-                    ww=[ww;evstr(q)];
-                end
-            else
-                ww=[ww;q];
-            end
-        end
-        outvar=[outvar ww];
-    end
-endfunction
-
-function [WINID] = GEDeditvar(varargin)
-    // Simple Variable Editor
-    // This file is part of sciGUI toolbox
-    // Copyright (C) 2004 Jaime Urzua Grez
-    // mailto:jaime_urzua@yahoo.com
-    // rev. 0.2 2004/06/24
-    //
-    // This program is free software; you can redistribute it and/or modify
-    //it under the terms of the GNU General Public License as published by
-    //the Free Software Foundation; either version 2 of the License, or
-    //(at your option) any later version.
-
-    sciGUI_init()
-
-    [%_nams]=who("get");
-    %_loc_type=type(varargin(1))
-    if (%_loc_type~=10) then error(42), end
-    %_in_list=find(%_nams==varargin(1));
-    if (%_in_list==[]) then error(42), end
-    execstr("%_loc_var="+varargin(1));
-    %_loc_type=type(%_loc_var);
-    %_allo=find([1;4;10]==%_loc_type);
-    if (%_allo==[]) then error(42), end
-
-    //disp("Please wait...");
-    %_loc_nam=varargin(1);
-    %_loc_ni=size(%_loc_var,1);
-    %_loc_nj=size(%_loc_var,2);
-    %_loc_type=string(%_loc_type);
-
-    TCL_EvalStr("set EdVarLoc [GEDsciGUIEditVar -1]");
-
-    %_winId=TCL_GetVar("EdVarLoc");
-
-    TCL_SetVar("sciGUITable(win,"+%_winId+",data,name)",%_loc_nam);
-    TCL_SetVar("sciGUITable(win,"+%_winId+",data,type)",string(%_loc_type));
-    TCL_SetVar("sciGUITable(win,"+%_winId+",data,ni)",string(%_loc_ni));
-    TCL_SetVar("sciGUITable(win,"+%_winId+",data,nj)",string(%_loc_nj));
-
-    //
-    // This is a slow manner to move the data ...
-    // Anyone have a faster method than TCL_SetVar
-    // I would like set some tcl variable like varname(pos_i,pos_j)
-    //
-    Nb_data=(%_loc_nj)*(%_loc_ni)
-    // disp("Nb_data=")
-    // disp(Nb_data);
-    // winWB=waitbar('Loading data...');
-    // tmp = 0;
-    // waitbar(tmp,winWB);
-
-
-    for %_j=1:%_loc_nj,
-        for %_i=1:%_loc_ni,
-            %_value=string(%_loc_var(%_i,%_j));
-            %_varname="sciGUITable(win,"+%_winId+",data,"+string(%_i)+","+string(%_j)+")";
-            TCL_SetVar(%_varname,%_value);
-        end
-
-        //tmp = ((%_j)*(%_loc_ni)) / Nb_data;
-        //tmp = tmp *100; tmp = int(tmp); tmp = tmp /100;
-        //disp("tmp dans for=")
-        //disp(tmp)
-        //waitbar(tmp,winWB);
-    end
-
-
-    // disp("%_winId=");
-    // disp(%_winId);
-    // disp("type(%_winId)=");
-    // disp(type(%_winId));
-    // disp("winWB=");
-    // disp(winWB);
-    // disp("type(winWB)=");
-    // disp(type(winWB));
-    // disp("AVANT DrawGrid");
-
-
-    TCL_EvalStr("GEDsciGUIEditVarDrawGrid "+%_winId)
-
-    WINID = %_winId;
-
-endfunction
-
-
-// for the ticks arrays Locations and Labels (inside TLIST)
-
-function ged_tablo=GetTab(val,index)
-    //disp("ICI")
-    ged_tablo(index) =val
-endfunction
-
-
-function ged_tablo=GetTab2(val,index,ged_tablo)
-    //disp("ICI")
-    ged_tablo(index) =val
-endfunction
-
-function setTicksTList(XYZ,locations,labels)
-    global ged_handle;h= ged_handle;
-
-    TL=tlist(["ticks","locations","labels"],locations,labels);
-
-    if XYZ=="X"
-        h.x_ticks=TL;
-    elseif XYZ=="Y"
-        h.y_ticks=TL;
-    elseif XYZ=="Z"
-        h.z_ticks=TL;
-    end
-
-endfunction
-
-
-// Is called by ged_axes
-
-function LoadTicks2TCL(h)
-    global ged_handle;ged_handle=h;
-
-    TCL_SetVar("Xaxes_visibleToggle",h.axes_visible(1))
-    TCL_SetVar("Yaxes_visibleToggle",h.axes_visible(2))
-    TCL_SetVar("Zaxes_visibleToggle",h.axes_visible(3))
-
-    TCL_SetVar("SubticksEntryX",string(h.sub_ticks(1)))
-    TCL_GetVar("SubticksEntryX")
-
-    // disp("h.sub_ticks(1) =")
-    // disp(h.sub_ticks(1));
-
-    TCL_SetVar("SubticksEntryY",string(h.sub_ticks(2)))
-
-    select h.view
-    case "2d"
-        drawlater(); // postpon the drawings due to switching from 2d to 3d mode (for example)
-        // in order to know the complete data set (z data for axes...)
-        h.view="3d"
-
-        TCL_SetVar("SubticksEntryZ",string(h.sub_ticks(3)))
-        h.view="2d"
-        drawnow();
-    case "3d"
-        TCL_SetVar("SubticksEntryZ",string(h.sub_ticks(3)))
-    end
-
-    TCL_SetVar("XautoticksToggle",h.auto_ticks(1))
-    TCL_SetVar("YautoticksToggle",h.auto_ticks(2))
-    TCL_SetVar("ZautoticksToggle",h.auto_ticks(3))
-
-    //ticks value: X axis
-    ticks = h.x_ticks;
-    sizeticks = size(ticks.locations,1);
-    TCL_SetVar("nbticks_x",string(sizeticks));
-    for i=1:sizeticks
-        val= "LOCATIONS_X("+string(i)+")";
-        TCL_EvalStr("set "+val+" "+string(ticks.locations(i)));
-        val= "LABELS_X("+string(i)+")";
-        TCL_EvalStr("set "+val+" {"+ticks.labels(i)+"}");
-    end
-
-    //ticks value: Y axis
-    ticks = h.y_ticks;
-    sizeticks = size(ticks.locations,1);
-    TCL_SetVar("nbticks_y",string(sizeticks));
-    for i=1:sizeticks
-        val= "LOCATIONS_Y("+string(i)+")";
-        TCL_EvalStr("set "+val+" "+string(ticks.locations(i)));
-        val= "LABELS_Y("+string(i)+")";
-        TCL_EvalStr("set "+val+" {"+ticks.labels(i)+"}");
-    end
-
-    //ticks value: Z axis
-    ticks = h.z_ticks;
-    sizeticks = size(ticks.locations,1);
-    TCL_SetVar("nbticks_z",string(sizeticks));
-    for i=1:sizeticks
-        val= "LOCATIONS_Z("+string(i)+")";
-        TCL_EvalStr("set "+val+" "+string(ticks.locations(i)));
-        val= "LABELS_Z("+string(i)+")";
-        TCL_EvalStr("set "+val+" {"+ticks.labels(i)+"}");
-    end
-
-endfunction
-
-
-
-function Subtickstoggle( tog, index)
-    global ged_handle; h=ged_handle
-
-    subticks=h.sub_ticks;
-    subticks(index)=tog;
-    //disp("subticks vaut:")
-    //disp(subticks)
-
-    h.sub_ticks = subticks;
-endfunction
-
-
-// when clicking on Ticks button : REload ticks is called
-
-function ReLoadTicks2TCL(h)
-    global ged_handle;ged_handle=h;
-
-    TCL_SetVar("Xaxes_visibleToggle",h.axes_visible(1))
-    TCL_SetVar("Yaxes_visibleToggle",h.axes_visible(2))
-    TCL_SetVar("Zaxes_visibleToggle",h.axes_visible(3))
-
-    ticks = h.x_ticks;
-    sizeticks = size(ticks.locations,1);
-    if (sizeticks <> 0)
-        TCL_EvalStr("unset LOCATIONS_X");
-        TCL_EvalStr("unset LABELS_X");
-    end
-
-    ticks = h.y_ticks;
-    sizeticks = size(ticks.locations,1);
-    if (sizeticks <> 0)
-        TCL_EvalStr("unset LOCATIONS_Y");
-        TCL_EvalStr("unset LABELS_Y");
-    end
-
-    ticks = h.z_ticks;
-    sizeticks = size(ticks.locations,1);
-    if (sizeticks <> 0)
-        TCL_EvalStr("unset LOCATIONS_Z");
-        TCL_EvalStr("unset LABELS_Z");
-    end
-
-    TCL_SetVar("SubticksEntryX",string(h.sub_ticks(1)))
-    //  TCL_GetVar("SubticksEntryX")
-
-    // disp("h.sub_ticks(1) =")
-    // disp(h.sub_ticks(1));
-
-    TCL_SetVar("SubticksEntryY",string(h.sub_ticks(2)))
-
-    select h.view
-    case "2d"
-        drawlater();
-        h.view="3d"
-        TCL_SetVar("SubticksEntryZ",string(h.sub_ticks(3)))
-        h.view="2d"
-        drawnow();
-    case "3d"
-        TCL_SetVar("SubticksEntryZ",string(h.sub_ticks(3)))
-    end
-
-    TCL_SetVar("XautoticksToggle",h.auto_ticks(1))
-    TCL_SetVar("YautoticksToggle",h.auto_ticks(2))
-    TCL_SetVar("ZautoticksToggle",h.auto_ticks(3))
-
-    //ticks value: X axis
-    ticks = h.x_ticks;
-
-    sizeticks = size(ticks.locations,1);
-    TCL_SetVar("nbticks_x",string(sizeticks));
-    for i=1:sizeticks
-        val= "LOCATIONS_X("+string(i)+")";
-        TCL_EvalStr("set "+val+" "+string(ticks.locations(i)));
-        //      disp("i vaut:");
-        //      disp(i);
-        val= "LABELS_X("+string(i)+")";
-        TCL_EvalStr("set "+val+" {"+ticks.labels(i)+"}");
-    end
-
-    //ticks value: Y axis
-    ticks = h.y_ticks;
-    sizeticks = size(ticks.locations,1);
-    TCL_SetVar("nbticks_y",string(sizeticks));
-    for i=1:sizeticks
-        val= "LOCATIONS_Y("+string(i)+")";
-        TCL_EvalStr("set "+val+" "+string(ticks.locations(i)));
-        val= "LABELS_Y("+string(i)+")";
-        TCL_EvalStr("set "+val+" {"+ticks.labels(i)+"}");
-    end
-
-    //ticks value: Z axis
-    ticks = h.z_ticks;
-    sizeticks = size(ticks.locations,1);
-    TCL_SetVar("nbticks_z",string(sizeticks));
-    for i=1:sizeticks
-        val= "LOCATIONS_Z("+string(i)+")";
-        TCL_EvalStr("set "+val+" "+string(ticks.locations(i)));
-        val= "LABELS_Z("+string(i)+")";
-        TCL_EvalStr("set "+val+" {"+ticks.labels(i)+"}");
-    end
-
-endfunction
-
-
-
-function DestroyGlobals()
-    global ged_current_figure
-
-    if ~isempty(winsid()) & ~isempty(find(ged_current_figure==winsid())) then
-        scf(ged_current_figure)
-    end
-
-    // ged is closed
-    TCL_UnsetVar("sciGedIsAlive");
-
-    clearglobal ged_current_figure
-    clear ged_current_figure
-
-    // disp("PASSE PAR DestroyGlobals Scilab");
-endfunction
-
-
-function ged_delete_entity()
-    [btn,xc,yc]=xclick()
-    [xc,yc]=xchange(xc,yc,"f2i")
-    h=ged_getobject([xc,yc])
-    if h<>[] then delete(h),end
-endfunction
-
-function ged_move_entity()
-    [btn,xc,yc]=xclick()
-    pos=[xc,yc]
-    [xc,yc]=xchange(xc,yc,"f2i")
-    [r,ax]=ged_getobject([xc,yc])
-    cur_ax=gca(),sca(ax)
-    [xc,yc]=xchange(xc,yc,"i2f");pos=[xc,yc]
-    if r==[] return,end
-    drawlater();
-    rep(3)=-1
-    select r.type
-    case "Rectangle" then
-        while rep(3)==-1 do
-            rep=xgetmouse([%t %t])
-            r.data(1:2)= r.data(1:2)+(rep(1:2)-pos)
-            pos=rep(1:2)
-            drawnow();
-        end
-    case "Segs" then //Segment
-        while rep(3)==-1 do
-            rep=xgetmouse([%t %t])
-            r.data=r.data+ones(2,1)*(rep(1:2)-pos)
-            pos=rep(1:2)
-            drawnow();
-        end
-    case "Polyline" then //Polyline
-        while rep(3)==-1 do
-            rep=xgetmouse([%t %t])
-            r.data(:,1:2)=r.data(:,1:2)+ones(r.data(:,1))*(rep(1:2)-pos)
-            pos=rep(1:2)
-            drawnow();
-        end
-    case "Arc" then //Circle
-        while rep(3)==-1 do
-            rep=xgetmouse([%t %t])
-            r.data(1:2)= r.data(1:2)+(rep(1:2)-pos)
-            pos=rep(1:2)
-            drawnow();
-        end
-    case "Text" then
-        while rep(3)==-1 do
-            rep=xgetmouse([%t %t])
-            r.data(1:2)= r.data(1:2)+(rep(1:2)-pos)
-            pos=rep(1:2)
-            drawnow();
-        end
-    case "Label" then
-        while rep(3)==-1 do
-            rep=xgetmouse([%t %t])
-            r.position= r.position+(rep(1:2)-pos)
-            r.auto_position = "off"
-            pos=rep(1:2)
-            drawnow();
-        end
-
-    end
-    sca(cur_ax)
-endfunction
-
-function ged_copy_entity()
-    [btn,xc,yc]=xclick()
-    [xc,yc]=xchange(xc,yc,"f2i")
-    r=ged_getobject([xc,yc])
-    if r==[] return,end
-    twinkle(r,1);
-    save(TMPDIR+"/G_Clipboard",r)
-    //make the axes containning the clicked point the current one
-    sca(ged_select_axes(xc,yc))
-endfunction
-
-
-function ged_paste_entity()
-
-    // check the file
-    [info,err] = fileinfo(TMPDIR + "/G_Clipboard" ) ;
-
-    if err <> 0 then
-        return ;
-    end
-
-    // create the saved object
-    load(TMPDIR+"/G_Clipboard") ;
-
-    //  a=gca();b=a.data_bounds;
-    //  move(r,[-1 1]*a.data_bounds/20)
-endfunction
-
-function axes =  ged_select_axes(x,y)
-    // x and y are pixel coord.
-    f=gcf()
-    nb_axes = size(f.children,"*") // for now Iconsider that children of a figure are of type Axes
-    axes_size = f.axes_size // given in pixels
-    axes_size = [axes_size axes_size];
-
-    for i=1:nb_axes
-        axes = f.children(i);
-        cur_axes_bounds = axes.axes_bounds;
-        rect = cur_axes_bounds.*axes_size; // rectangle in pixels (margins inside)
-
-        rect(3) = rect(3) + rect(1);
-        rect(4) = rect(4) + rect(2);
-        if (x>rect(1) & x<rect(3) & y>rect(2) & y<rect(4)) then
-            return
-        end
-    end
-    axes=[]
-endfunction
index d2c4b1d..5639aef 100644 (file)
@@ -60,6 +60,7 @@ libsciio_la_CPPFLAGS = \
     -I$(top_srcdir)/modules/dynamic_link/includes \
     -I$(top_srcdir)/modules/console/includes \
     -I$(top_srcdir)/modules/hdf5/includes \
+    -I$(top_srcdir)/modules/tclsci/includes \
     $(XML_FLAGS) \
     $(AM_CPPFLAGS)
 
index b7432f1..26aca8c 100644 (file)
@@ -633,6 +633,7 @@ libsciio_la_CPPFLAGS = \
     -I$(top_srcdir)/modules/dynamic_link/includes \
     -I$(top_srcdir)/modules/console/includes \
     -I$(top_srcdir)/modules/hdf5/includes \
+    -I$(top_srcdir)/modules/tclsci/includes \
     $(XML_FLAGS) \
     $(AM_CPPFLAGS)
 
index e00d6c7..1cd1d22 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../dynamic_link/includes;../../../ast/includes/operations;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../threads/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../dynamic_link/includes;../../../ast/includes/operations;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../threads/includes;../../../tclsci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;IO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -109,7 +109,7 @@ lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../dynamic_link/includes;../../../ast/includes/operations;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../threads/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../dynamic_link/includes;../../../ast/includes/operations;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../threads/includes;../../../tclsci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;IO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -136,7 +136,7 @@ lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../dynamic_link/includes;../../../ast/includes/operations;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../threads/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../dynamic_link/includes;../../../ast/includes/operations;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../threads/includes;../../../tclsci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;IO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -170,7 +170,7 @@ lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../dynamic_link/includes;../../../ast/includes/operations;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../threads/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../dynamic_link/includes;../../../ast/includes/operations;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../threads/includes;../../../tclsci/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;IO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -252,6 +252,9 @@ lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
       <Project>{a5911cd7-f8e8-440c-a23e-4843a0636f3a}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\tclsci\tclsci.vcxproj">
+      <Project>{c456d5b8-8a32-496a-a2ee-164b0d734126}</Project>
+    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
     <Library Include="..\..\..\..\bin\libxml2.lib" />
index e0968a2..ad48fa2 100644 (file)
 #include <stdio.h>
 #include <string.h>
 #include "setenvc.h"
-#include "../../../core/src/c/dynamic_tclsci.h"
 #include "sci_malloc.h" /* MALLOC */
 #include "charEncoding.h"
 #include "os_string.h"
+#include "setenvtcl.h"
+
 /*--------------------------------------------------------------------------*/
 BOOL setenvc(const char *stringIn, const char *valueIn)
 {
 #ifdef _MSC_VER
     wchar_t* wstringIn = to_wide_string(stringIn);
     wchar_t* wvalueIn = to_wide_string(valueIn);
-    BOOL ret = 0;
 
-    ret = setenvcW(wstringIn, wvalueIn);
+    if (setenvcW(wstringIn, wvalueIn) == 0)
+    {
+        FREE(wstringIn);
+        FREE(wvalueIn);
+        return FALSE;
+    }
+
     FREE(wstringIn);
     FREE(wvalueIn);
-    return ret;
 #else
     /* linux and Mac OS X */
     /* setenv() function is strongly preferred to putenv() */
@@ -49,16 +54,16 @@ BOOL setenvc(const char *stringIn, const char *valueIn)
         {
             return FALSE;
         }
-        else
-        {
-            return TRUE;
-        }
     }
     else
     {
         return FALSE;
     }
+
+    setenvtcl(stringIn, valueIn);
 #endif
+
+    return TRUE;
 }
 /*--------------------------------------------------------------------------*/
 BOOL setenvcW(const wchar_t *wstringIn, const wchar_t *wvalueIn)
@@ -66,15 +71,24 @@ BOOL setenvcW(const wchar_t *wstringIn, const wchar_t *wvalueIn)
     BOOL ret = TRUE;
     int len_env = 0;
 #ifdef _MSC_VER
-    return SetEnvironmentVariableW(wstringIn, wvalueIn);
+    if (SetEnvironmentVariableW(wstringIn, wvalueIn) == 0)
+    {
+        return FALSE;
+    }
+
+    char * stringIn = wide_string_to_UTF8(wstringIn);
+    char * valueIn = wide_string_to_UTF8(wvalueIn);
+    setenvtcl(stringIn, valueIn);
+    FREE(stringIn);
+    FREE(valueIn);
 #else
     char * stringIn = wide_string_to_UTF8(wstringIn);
     char * valueIn = wide_string_to_UTF8(wvalueIn);
     ret = setenvc(stringIn, valueIn);
     FREE(stringIn);
     FREE(valueIn);
+#endif
 
     return ret;
-#endif
 }
 /*--------------------------------------------------------------------------*/
index 0e47ca3..d5dd8fb 100644 (file)
@@ -1721,7 +1721,7 @@ static void cossim(double *told)
         {
             int ierr2 = 0;
             int iUnused;
-            GetCommand(&CommandToUnstack, &SeqSync, &iUnused, &iUnused); //** get to the action
+            GetCommand(&CommandToUnstack, &SeqSync, &iUnused, NONE); //** get to the action
             CommandLength = (int)strlen(CommandToUnstack);
             //syncexec(CommandToUnstack, &CommandLength, &ierr2, &one, CommandLength); //** execute it
             FREE(CommandToUnstack);
@@ -2903,7 +2903,7 @@ static void cossimdaskr(double *told)
         {
             int ierr2 = 0;
             int iUnused;
-            GetCommand(&CommandToUnstack, &SeqSync, &iUnused, &iUnused); //** get to the action
+            GetCommand(&CommandToUnstack, &SeqSync, &iUnused, NONE); //** get to the action
             CommandLength = (int)strlen(CommandToUnstack);
             //syncexec(CommandToUnstack, &CommandLength, &ierr2, &one, CommandLength); //** execute it
             FREE(CommandToUnstack);
@@ -3091,7 +3091,7 @@ L30:
                         {
                             int ierr2 = 0;
                             int iUnused;
-                            GetCommand(&CommandToUnstack, &SeqSync, &iUnused, &iUnused); //** get to the action
+                            GetCommand(&CommandToUnstack, &SeqSync, &iUnused, NONE); //** get to the action
                             CommandLength = (int)strlen(CommandToUnstack);
                             //syncexec(CommandToUnstack, &CommandLength, &ierr2, &one, CommandLength); //** execute it
                             FREE(CommandToUnstack);
@@ -3443,7 +3443,7 @@ L30:
                 {
                     int ierr2 = 0;
                     int iUnused;
-                    GetCommand(&CommandToUnstack, &SeqSync, &iUnused, &iUnused); //** get to the action
+                    GetCommand(&CommandToUnstack, &SeqSync, &iUnused, NONE); //** get to the action
                     CommandLength = (int)strlen(CommandToUnstack);
                     //syncexec(CommandToUnstack, &CommandLength, &ierr2, &one, CommandLength); //** execute it
                     FREE(CommandToUnstack);
@@ -7117,7 +7117,7 @@ static int CallKinsol(double *told)
             {
                 int ierr2 = 0;
                 int iUnused;
-                GetCommand(&CommandToUnstack, &SeqSync, &iUnused, &iUnused); //** get to the action
+                GetCommand(&CommandToUnstack, &SeqSync, &iUnused, NONE); //** get to the action
                 CommandLength = (int)strlen(CommandToUnstack);
                 //syncexec(CommandToUnstack, &CommandLength, &ierr2, &one, CommandLength); //** execute it
                 FREE(CommandToUnstack);
index f61ccc8..25da102 100644 (file)
@@ -9,7 +9,6 @@ if TCLTK
 TCLSCI_C_SOURCES = \
     src/c/TCL_Global.c \
     src/c/InitTclTk.c \
-    src/c/ScilabEval.c \
     src/c/setenvtcl.c \
     src/c/InitializeTclTk.c \
     src/c/TerminateTclTk.c \
@@ -20,7 +19,14 @@ TCLSCI_C_SOURCES = \
     src/c/TCL_ArraySize.c \
     src/c/TCL_Command.c \
     src/c/GlobalTclInterp.c \
-    src/c/TCL_getErrorLine.c
+    src/c/TCL_getErrorLine.c \
+    src/c/LoadUnloadTclsci.c
+
+TCLSCI_CPP_SOURCES = \
+    src/cpp/ScilabEval.cpp
+
+GATEWAY_CPP_SOURCES = \
+       sci_gateway/cpp/tclsci_gw.cpp
 
 GATEWAY_C_SOURCES = \
     sci_gateway/c/sci_opentk.c \
@@ -40,7 +46,8 @@ GATEWAY_C_SOURCES = \
 else
 
 TCLSCI_C_SOURCES = src/notclsci/notclsci.c
-
+TCLSCI_CPP_SOURCES =
+GATEWAY_CPP_SOURCES =
 GATEWAY_C_SOURCES =
 
 endif
@@ -72,10 +79,12 @@ libscitclsci_la_CPPFLAGS= \
     -I$(top_srcdir)/modules/api_scilab/includes/ \
     -I$(top_srcdir)/modules/threads/includes/ \
     -I$(top_srcdir)/modules/string/includes/ \
+    -I$(top_srcdir)/modules/dynamic_link/includes/ \
+    -I$(top_srcdir)/modules/console/includes/ \
     $(AM_CPPFLAGS)
 
-libscitclsci_algo_la_SOURCES = $(TCLSCI_C_SOURCES)
-libscitclsci_la_SOURCES = $(GATEWAY_C_SOURCES)
+libscitclsci_algo_la_SOURCES = $(TCLSCI_CPP_SOURCES) $(TCLSCI_C_SOURCES)
+libscitclsci_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_CPP_SOURCES)
 libscitclsci_algo_la_CPPFLAGS = $(libscitclsci_la_CPPFLAGS)
 
 # For the code check (splint)
index f8b2183..9d4ef46 100644 (file)
@@ -172,19 +172,21 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" \
        "$(DESTDIR)$(libscitclsci_la_tcldir)"
 LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkglib_LTLIBRARIES)
 libscitclsci_algo_la_LIBADD =
-am__libscitclsci_algo_la_SOURCES_DIST = src/notclsci/notclsci.c \
-       src/c/TCL_Global.c src/c/InitTclTk.c src/c/ScilabEval.c \
+am__libscitclsci_algo_la_SOURCES_DIST = src/cpp/ScilabEval.cpp \
+       src/notclsci/notclsci.c src/c/TCL_Global.c src/c/InitTclTk.c \
        src/c/setenvtcl.c src/c/InitializeTclTk.c \
        src/c/TerminateTclTk.c src/c/setvar.c src/c/TCL_ArrayDim.c \
        src/c/TCL_ArrayExist.c src/c/TCL_ArrayGetVar.c \
        src/c/TCL_ArraySize.c src/c/TCL_Command.c \
-       src/c/GlobalTclInterp.c src/c/TCL_getErrorLine.c
+       src/c/GlobalTclInterp.c src/c/TCL_getErrorLine.c \
+       src/c/LoadUnloadTclsci.c
 am__dirstamp = $(am__leading_dot)dirstamp
-@TCLTK_FALSE@am__objects_1 =  \
+@TCLTK_TRUE@am__objects_1 =  \
+@TCLTK_TRUE@   src/cpp/libscitclsci_algo_la-ScilabEval.lo
+@TCLTK_FALSE@am__objects_2 =  \
 @TCLTK_FALSE@  src/notclsci/libscitclsci_algo_la-notclsci.lo
-@TCLTK_TRUE@am__objects_1 = src/c/libscitclsci_algo_la-TCL_Global.lo \
+@TCLTK_TRUE@am__objects_2 = src/c/libscitclsci_algo_la-TCL_Global.lo \
 @TCLTK_TRUE@   src/c/libscitclsci_algo_la-InitTclTk.lo \
-@TCLTK_TRUE@   src/c/libscitclsci_algo_la-ScilabEval.lo \
 @TCLTK_TRUE@   src/c/libscitclsci_algo_la-setenvtcl.lo \
 @TCLTK_TRUE@   src/c/libscitclsci_algo_la-InitializeTclTk.lo \
 @TCLTK_TRUE@   src/c/libscitclsci_algo_la-TerminateTclTk.lo \
@@ -195,8 +197,9 @@ am__dirstamp = $(am__leading_dot)dirstamp
 @TCLTK_TRUE@   src/c/libscitclsci_algo_la-TCL_ArraySize.lo \
 @TCLTK_TRUE@   src/c/libscitclsci_algo_la-TCL_Command.lo \
 @TCLTK_TRUE@   src/c/libscitclsci_algo_la-GlobalTclInterp.lo \
-@TCLTK_TRUE@   src/c/libscitclsci_algo_la-TCL_getErrorLine.lo
-am_libscitclsci_algo_la_OBJECTS = $(am__objects_1)
+@TCLTK_TRUE@   src/c/libscitclsci_algo_la-TCL_getErrorLine.lo \
+@TCLTK_TRUE@   src/c/libscitclsci_algo_la-LoadUnloadTclsci.lo
+am_libscitclsci_algo_la_OBJECTS = $(am__objects_1) $(am__objects_2)
 libscitclsci_algo_la_OBJECTS = $(am_libscitclsci_algo_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -217,8 +220,8 @@ am__libscitclsci_la_SOURCES_DIST = sci_gateway/c/sci_opentk.c \
        sci_gateway/c/sci_TCL_EvalFile.c \
        sci_gateway/c/sci_TCL_GetVar.c \
        sci_gateway/c/sci_TCL_ExistArray.c \
-       sci_gateway/c/sci_TCL_UpVar.c
-@TCLTK_TRUE@am__objects_2 =  \
+       sci_gateway/c/sci_TCL_UpVar.c sci_gateway/cpp/tclsci_gw.cpp
+@TCLTK_TRUE@am__objects_3 =  \
 @TCLTK_TRUE@   sci_gateway/c/libscitclsci_la-sci_opentk.lo \
 @TCLTK_TRUE@   sci_gateway/c/libscitclsci_la-sci_TCL_SetVar.lo \
 @TCLTK_TRUE@   sci_gateway/c/libscitclsci_la-sci_TCL_ExistVar.lo \
@@ -232,12 +235,14 @@ am__libscitclsci_la_SOURCES_DIST = sci_gateway/c/sci_opentk.c \
 @TCLTK_TRUE@   sci_gateway/c/libscitclsci_la-sci_TCL_GetVar.lo \
 @TCLTK_TRUE@   sci_gateway/c/libscitclsci_la-sci_TCL_ExistArray.lo \
 @TCLTK_TRUE@   sci_gateway/c/libscitclsci_la-sci_TCL_UpVar.lo
-am_libscitclsci_la_OBJECTS = $(am__objects_2)
+@TCLTK_TRUE@am__objects_4 =  \
+@TCLTK_TRUE@   sci_gateway/cpp/libscitclsci_la-tclsci_gw.lo
+am_libscitclsci_la_OBJECTS = $(am__objects_3) $(am__objects_4)
 libscitclsci_la_OBJECTS = $(am_libscitclsci_la_OBJECTS)
-libscitclsci_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(AM_CFLAGS) $(CFLAGS) $(libscitclsci_la_LDFLAGS) $(LDFLAGS) \
-       -o $@
+libscitclsci_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+       $(AM_CXXFLAGS) $(CXXFLAGS) $(libscitclsci_la_LDFLAGS) \
+       $(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -272,6 +277,24 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX     " $@;
+am__v_CXX_1 = 
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+       $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD   " $@;
+am__v_CXXLD_1 = 
 SOURCES = $(libscitclsci_algo_la_SOURCES) $(libscitclsci_la_SOURCES)
 DIST_SOURCES = $(am__libscitclsci_algo_la_SOURCES_DIST) \
        $(am__libscitclsci_la_SOURCES_DIST)
@@ -596,7 +619,6 @@ yacc_present = @yacc_present@
 @TCLTK_TRUE@TCLSCI_C_SOURCES = \
 @TCLTK_TRUE@    src/c/TCL_Global.c \
 @TCLTK_TRUE@    src/c/InitTclTk.c \
-@TCLTK_TRUE@    src/c/ScilabEval.c \
 @TCLTK_TRUE@    src/c/setenvtcl.c \
 @TCLTK_TRUE@    src/c/InitializeTclTk.c \
 @TCLTK_TRUE@    src/c/TerminateTclTk.c \
@@ -607,7 +629,16 @@ yacc_present = @yacc_present@
 @TCLTK_TRUE@    src/c/TCL_ArraySize.c \
 @TCLTK_TRUE@    src/c/TCL_Command.c \
 @TCLTK_TRUE@    src/c/GlobalTclInterp.c \
-@TCLTK_TRUE@    src/c/TCL_getErrorLine.c
+@TCLTK_TRUE@    src/c/TCL_getErrorLine.c \
+@TCLTK_TRUE@    src/c/LoadUnloadTclsci.c
+
+@TCLTK_FALSE@TCLSCI_CPP_SOURCES = 
+@TCLTK_TRUE@TCLSCI_CPP_SOURCES = \
+@TCLTK_TRUE@    src/cpp/ScilabEval.cpp
+
+@TCLTK_FALSE@GATEWAY_CPP_SOURCES = 
+@TCLTK_TRUE@GATEWAY_CPP_SOURCES = \
+@TCLTK_TRUE@   sci_gateway/cpp/tclsci_gw.cpp
 
 @TCLTK_FALSE@GATEWAY_C_SOURCES = 
 @TCLTK_TRUE@GATEWAY_C_SOURCES = \
@@ -650,10 +681,12 @@ libscitclsci_la_CPPFLAGS = \
     -I$(top_srcdir)/modules/api_scilab/includes/ \
     -I$(top_srcdir)/modules/threads/includes/ \
     -I$(top_srcdir)/modules/string/includes/ \
+    -I$(top_srcdir)/modules/dynamic_link/includes/ \
+    -I$(top_srcdir)/modules/console/includes/ \
     $(AM_CPPFLAGS)
 
-libscitclsci_algo_la_SOURCES = $(TCLSCI_C_SOURCES)
-libscitclsci_la_SOURCES = $(GATEWAY_C_SOURCES)
+libscitclsci_algo_la_SOURCES = $(TCLSCI_CPP_SOURCES) $(TCLSCI_C_SOURCES)
+libscitclsci_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_CPP_SOURCES)
 libscitclsci_algo_la_CPPFLAGS = $(libscitclsci_la_CPPFLAGS)
 
 # For the code check (splint)
@@ -798,7 +831,7 @@ HELP_CHAPTERLANG = en_US fr_FR pt_BR
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .sci .bin .c .lo .o .obj
+.SUFFIXES: .sci .bin .c .cpp .lo .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.incl.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
@@ -875,6 +908,14 @@ clean-pkglibLTLIBRARIES:
          echo rm -f $${locs}; \
          rm -f $${locs}; \
        }
+src/cpp/$(am__dirstamp):
+       @$(MKDIR_P) src/cpp
+       @: > src/cpp/$(am__dirstamp)
+src/cpp/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) src/cpp/$(DEPDIR)
+       @: > src/cpp/$(DEPDIR)/$(am__dirstamp)
+src/cpp/libscitclsci_algo_la-ScilabEval.lo: src/cpp/$(am__dirstamp) \
+       src/cpp/$(DEPDIR)/$(am__dirstamp)
 src/notclsci/$(am__dirstamp):
        @$(MKDIR_P) src/notclsci
        @: > src/notclsci/$(am__dirstamp)
@@ -894,8 +935,6 @@ src/c/libscitclsci_algo_la-TCL_Global.lo: src/c/$(am__dirstamp) \
        src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libscitclsci_algo_la-InitTclTk.lo: src/c/$(am__dirstamp) \
        src/c/$(DEPDIR)/$(am__dirstamp)
-src/c/libscitclsci_algo_la-ScilabEval.lo: src/c/$(am__dirstamp) \
-       src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libscitclsci_algo_la-setenvtcl.lo: src/c/$(am__dirstamp) \
        src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libscitclsci_algo_la-InitializeTclTk.lo: src/c/$(am__dirstamp) \
@@ -918,9 +957,11 @@ src/c/libscitclsci_algo_la-GlobalTclInterp.lo: src/c/$(am__dirstamp) \
        src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libscitclsci_algo_la-TCL_getErrorLine.lo: src/c/$(am__dirstamp) \
        src/c/$(DEPDIR)/$(am__dirstamp)
+src/c/libscitclsci_algo_la-LoadUnloadTclsci.lo: src/c/$(am__dirstamp) \
+       src/c/$(DEPDIR)/$(am__dirstamp)
 
 libscitclsci-algo.la: $(libscitclsci_algo_la_OBJECTS) $(libscitclsci_algo_la_DEPENDENCIES) $(EXTRA_libscitclsci_algo_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(LINK)  $(libscitclsci_algo_la_OBJECTS) $(libscitclsci_algo_la_LIBADD) $(LIBS)
+       $(AM_V_CXXLD)$(CXXLINK)  $(libscitclsci_algo_la_OBJECTS) $(libscitclsci_algo_la_LIBADD) $(LIBS)
 sci_gateway/c/$(am__dirstamp):
        @$(MKDIR_P) sci_gateway/c
        @: > sci_gateway/c/$(am__dirstamp)
@@ -966,16 +1007,29 @@ sci_gateway/c/libscitclsci_la-sci_TCL_ExistArray.lo:  \
 sci_gateway/c/libscitclsci_la-sci_TCL_UpVar.lo:  \
        sci_gateway/c/$(am__dirstamp) \
        sci_gateway/c/$(DEPDIR)/$(am__dirstamp)
+sci_gateway/cpp/$(am__dirstamp):
+       @$(MKDIR_P) sci_gateway/cpp
+       @: > sci_gateway/cpp/$(am__dirstamp)
+sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) sci_gateway/cpp/$(DEPDIR)
+       @: > sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp)
+sci_gateway/cpp/libscitclsci_la-tclsci_gw.lo:  \
+       sci_gateway/cpp/$(am__dirstamp) \
+       sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp)
 
 libscitclsci.la: $(libscitclsci_la_OBJECTS) $(libscitclsci_la_DEPENDENCIES) $(EXTRA_libscitclsci_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libscitclsci_la_LINK) -rpath $(pkglibdir) $(libscitclsci_la_OBJECTS) $(libscitclsci_la_LIBADD) $(LIBS)
+       $(AM_V_CXXLD)$(libscitclsci_la_LINK) -rpath $(pkglibdir) $(libscitclsci_la_OBJECTS) $(libscitclsci_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)
        -rm -f sci_gateway/c/*.$(OBJEXT)
        -rm -f sci_gateway/c/*.lo
+       -rm -f sci_gateway/cpp/*.$(OBJEXT)
+       -rm -f sci_gateway/cpp/*.lo
        -rm -f src/c/*.$(OBJEXT)
        -rm -f src/c/*.lo
+       -rm -f src/cpp/*.$(OBJEXT)
+       -rm -f src/cpp/*.lo
        -rm -f src/notclsci/*.$(OBJEXT)
        -rm -f src/notclsci/*.lo
 
@@ -995,10 +1049,11 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/c/$(DEPDIR)/libscitclsci_la-sci_TCL_UnsetVar.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/c/$(DEPDIR)/libscitclsci_la-sci_TCL_UpVar.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/c/$(DEPDIR)/libscitclsci_la-sci_opentk.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscitclsci_la-tclsci_gw.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscitclsci_algo_la-GlobalTclInterp.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscitclsci_algo_la-InitTclTk.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscitclsci_algo_la-InitializeTclTk.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscitclsci_algo_la-ScilabEval.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscitclsci_algo_la-LoadUnloadTclsci.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscitclsci_algo_la-TCL_ArrayDim.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscitclsci_algo_la-TCL_ArrayExist.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscitclsci_algo_la-TCL_ArrayGetVar.Plo@am__quote@
@@ -1009,6 +1064,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscitclsci_algo_la-TerminateTclTk.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscitclsci_algo_la-setenvtcl.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscitclsci_algo_la-setvar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscitclsci_algo_la-ScilabEval.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/notclsci/$(DEPDIR)/libscitclsci_algo_la-notclsci.Plo@am__quote@
 
 .c.o:
@@ -1056,13 +1112,6 @@ src/c/libscitclsci_algo_la-InitTclTk.lo: src/c/InitTclTk.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitclsci_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libscitclsci_algo_la-InitTclTk.lo `test -f 'src/c/InitTclTk.c' || echo '$(srcdir)/'`src/c/InitTclTk.c
 
-src/c/libscitclsci_algo_la-ScilabEval.lo: src/c/ScilabEval.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitclsci_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libscitclsci_algo_la-ScilabEval.lo -MD -MP -MF src/c/$(DEPDIR)/libscitclsci_algo_la-ScilabEval.Tpo -c -o src/c/libscitclsci_algo_la-ScilabEval.lo `test -f 'src/c/ScilabEval.c' || echo '$(srcdir)/'`src/c/ScilabEval.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libscitclsci_algo_la-ScilabEval.Tpo src/c/$(DEPDIR)/libscitclsci_algo_la-ScilabEval.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='src/c/ScilabEval.c' object='src/c/libscitclsci_algo_la-ScilabEval.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitclsci_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libscitclsci_algo_la-ScilabEval.lo `test -f 'src/c/ScilabEval.c' || echo '$(srcdir)/'`src/c/ScilabEval.c
-
 src/c/libscitclsci_algo_la-setenvtcl.lo: src/c/setenvtcl.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitclsci_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libscitclsci_algo_la-setenvtcl.lo -MD -MP -MF src/c/$(DEPDIR)/libscitclsci_algo_la-setenvtcl.Tpo -c -o src/c/libscitclsci_algo_la-setenvtcl.lo `test -f 'src/c/setenvtcl.c' || echo '$(srcdir)/'`src/c/setenvtcl.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libscitclsci_algo_la-setenvtcl.Tpo src/c/$(DEPDIR)/libscitclsci_algo_la-setenvtcl.Plo
@@ -1140,6 +1189,13 @@ src/c/libscitclsci_algo_la-TCL_getErrorLine.lo: src/c/TCL_getErrorLine.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitclsci_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libscitclsci_algo_la-TCL_getErrorLine.lo `test -f 'src/c/TCL_getErrorLine.c' || echo '$(srcdir)/'`src/c/TCL_getErrorLine.c
 
+src/c/libscitclsci_algo_la-LoadUnloadTclsci.lo: src/c/LoadUnloadTclsci.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitclsci_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libscitclsci_algo_la-LoadUnloadTclsci.lo -MD -MP -MF src/c/$(DEPDIR)/libscitclsci_algo_la-LoadUnloadTclsci.Tpo -c -o src/c/libscitclsci_algo_la-LoadUnloadTclsci.lo `test -f 'src/c/LoadUnloadTclsci.c' || echo '$(srcdir)/'`src/c/LoadUnloadTclsci.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libscitclsci_algo_la-LoadUnloadTclsci.Tpo src/c/$(DEPDIR)/libscitclsci_algo_la-LoadUnloadTclsci.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='src/c/LoadUnloadTclsci.c' object='src/c/libscitclsci_algo_la-LoadUnloadTclsci.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitclsci_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libscitclsci_algo_la-LoadUnloadTclsci.lo `test -f 'src/c/LoadUnloadTclsci.c' || echo '$(srcdir)/'`src/c/LoadUnloadTclsci.c
+
 sci_gateway/c/libscitclsci_la-sci_opentk.lo: sci_gateway/c/sci_opentk.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitclsci_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sci_gateway/c/libscitclsci_la-sci_opentk.lo -MD -MP -MF sci_gateway/c/$(DEPDIR)/libscitclsci_la-sci_opentk.Tpo -c -o sci_gateway/c/libscitclsci_la-sci_opentk.lo `test -f 'sci_gateway/c/sci_opentk.c' || echo '$(srcdir)/'`sci_gateway/c/sci_opentk.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) sci_gateway/c/$(DEPDIR)/libscitclsci_la-sci_opentk.Tpo sci_gateway/c/$(DEPDIR)/libscitclsci_la-sci_opentk.Plo
@@ -1231,13 +1287,53 @@ sci_gateway/c/libscitclsci_la-sci_TCL_UpVar.lo: sci_gateway/c/sci_TCL_UpVar.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitclsci_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sci_gateway/c/libscitclsci_la-sci_TCL_UpVar.lo `test -f 'sci_gateway/c/sci_TCL_UpVar.c' || echo '$(srcdir)/'`sci_gateway/c/sci_TCL_UpVar.c
 
+.cpp.o:
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCXX_TRUE@  $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCXX_TRUE@  $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCXX_TRUE@  $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCXX_TRUE@  $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCXX_TRUE@  $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCXX_TRUE@  $(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
+
+src/cpp/libscitclsci_algo_la-ScilabEval.lo: src/cpp/ScilabEval.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitclsci_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libscitclsci_algo_la-ScilabEval.lo -MD -MP -MF src/cpp/$(DEPDIR)/libscitclsci_algo_la-ScilabEval.Tpo -c -o src/cpp/libscitclsci_algo_la-ScilabEval.lo `test -f 'src/cpp/ScilabEval.cpp' || echo '$(srcdir)/'`src/cpp/ScilabEval.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libscitclsci_algo_la-ScilabEval.Tpo src/cpp/$(DEPDIR)/libscitclsci_algo_la-ScilabEval.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='src/cpp/ScilabEval.cpp' object='src/cpp/libscitclsci_algo_la-ScilabEval.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitclsci_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libscitclsci_algo_la-ScilabEval.lo `test -f 'src/cpp/ScilabEval.cpp' || echo '$(srcdir)/'`src/cpp/ScilabEval.cpp
+
+sci_gateway/cpp/libscitclsci_la-tclsci_gw.lo: sci_gateway/cpp/tclsci_gw.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitclsci_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sci_gateway/cpp/libscitclsci_la-tclsci_gw.lo -MD -MP -MF sci_gateway/cpp/$(DEPDIR)/libscitclsci_la-tclsci_gw.Tpo -c -o sci_gateway/cpp/libscitclsci_la-tclsci_gw.lo `test -f 'sci_gateway/cpp/tclsci_gw.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/tclsci_gw.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) sci_gateway/cpp/$(DEPDIR)/libscitclsci_la-tclsci_gw.Tpo sci_gateway/cpp/$(DEPDIR)/libscitclsci_la-tclsci_gw.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='sci_gateway/cpp/tclsci_gw.cpp' object='sci_gateway/cpp/libscitclsci_la-tclsci_gw.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitclsci_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sci_gateway/cpp/libscitclsci_la-tclsci_gw.lo `test -f 'sci_gateway/cpp/tclsci_gw.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/tclsci_gw.cpp
+
 mostlyclean-libtool:
        -rm -f *.lo
 
 clean-libtool:
        -rm -rf .libs _libs
        -rm -rf sci_gateway/c/.libs sci_gateway/c/_libs
+       -rm -rf sci_gateway/cpp/.libs sci_gateway/cpp/_libs
        -rm -rf src/c/.libs src/c/_libs
+       -rm -rf src/cpp/.libs src/cpp/_libs
        -rm -rf src/notclsci/.libs src/notclsci/_libs
 install-libscitclsci_la_etcDATA: $(libscitclsci_la_etc_DATA)
        @$(NORMAL_INSTALL)
@@ -1445,8 +1541,12 @@ distclean-generic:
        -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
        -rm -f sci_gateway/c/$(DEPDIR)/$(am__dirstamp)
        -rm -f sci_gateway/c/$(am__dirstamp)
+       -rm -f sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp)
+       -rm -f sci_gateway/cpp/$(am__dirstamp)
        -rm -f src/c/$(DEPDIR)/$(am__dirstamp)
        -rm -f src/c/$(am__dirstamp)
+       -rm -f src/cpp/$(DEPDIR)/$(am__dirstamp)
+       -rm -f src/cpp/$(am__dirstamp)
        -rm -f src/notclsci/$(DEPDIR)/$(am__dirstamp)
        -rm -f src/notclsci/$(am__dirstamp)
 
@@ -1459,7 +1559,7 @@ clean-am: clean-generic clean-libtool clean-local \
        clean-noinstLTLIBRARIES clean-pkglibLTLIBRARIES mostlyclean-am
 
 distclean: distclean-am
-       -rm -rf sci_gateway/c/$(DEPDIR) src/c/$(DEPDIR) src/notclsci/$(DEPDIR)
+       -rm -rf sci_gateway/c/$(DEPDIR) sci_gateway/cpp/$(DEPDIR) src/c/$(DEPDIR) src/cpp/$(DEPDIR) src/notclsci/$(DEPDIR)
        -rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
        distclean-local distclean-tags
@@ -1508,7 +1608,7 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-       -rm -rf sci_gateway/c/$(DEPDIR) src/c/$(DEPDIR) src/notclsci/$(DEPDIR)
+       -rm -rf sci_gateway/c/$(DEPDIR) sci_gateway/cpp/$(DEPDIR) src/c/$(DEPDIR) src/cpp/$(DEPDIR) src/notclsci/$(DEPDIR)
        -rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
index 6c62e5f..769f92b 100644 (file)
@@ -3,13 +3,16 @@ LIBRARY    core.dll
 
 EXPORTS
 callFunctionFromGateway
-com_
-iop_
+StorePrioritaryCommand
+StoreConsoleCommand
+StoreCommandWithFlags
 StoreCommand
 GetCommand
+isEmptyCommandQueue
 ismenu
-StorePrioritaryCommand
 freeArrayOfString
 MyHeapAlloc
 MyHeapFree
 MyHeapRealloc
+StaticRunner_launch
+StaticRunner_getCommandOrigin
\ No newline at end of file
index 5f41dca..5f7db67 100644 (file)
@@ -26,4 +26,4 @@ function demo_tclsci_scale()
 endfunction
 
 demo_tclsci_scale();
-clear demo_tclsci_scale;
\ No newline at end of file
+clear demo_tclsci_scale;
index fd83021..a9b09b6 100644 (file)
@@ -41,7 +41,7 @@ proc setHeight {w height} {
     if {$y2 < 21} {
        set y2 21
     }
-    ScilabEval "if (isdef('handle_demo_scale') & is_handle_valid(handle_demo_scale)) then demredraw($y2),end"
+    ScilabEval "if (isdef('handle_demo_scale') & is_handle_valid(handle_demo_scale)) then demredraw($y2),end" sync seq
     $w coords poly 15 20 35 20 35 $y2 45 $y2 25 $height 5 $y2 15 $y2 15 20
     $w coords line 15 20 35 20 35 $y2 45 $y2 25 $height 5 $y2 15 $y2 15 20
 }
index 065051b..81a7c19 100644 (file)
@@ -13,6 +13,7 @@
 #ifndef __INITIALIZETCLTK_H__
 #define __INITIALIZETCLTK_H__
 
+#include "dynlib_tclsci.h"
 #include "BOOL.h"
 
 /**
@@ -20,7 +21,7 @@
  *
  * @return If the init went well (or not)
  */
-BOOL InitializeTclTk(void);
+TCLSCI_IMPEXP BOOL InitializeTclTk(void);
 
 #endif /* __INITIALIZETCLTK_H__ */
 /*--------------------------------------------------------------------------*/
index 7cf1fe7..2d4044b 100644 (file)
 #define __GW_TCLSCI__
 /*--------------------------------------------------------------------------*/
 #include "dynlib_tclsci.h"
+#include "c_gateway_prototype.h"
 /*--------------------------------------------------------------------------*/
-TCLSCI_IMPEXP int gw_tclsci(void);
-/*--------------------------------------------------------------------------*/
-int sci_TCL_DoOneEvent (char *fname, unsigned long fname_len);
-int sci_TCL_EvalFile(char *fname, unsigned long fname_len);
-int sci_TCL_EvalStr(char *fname, unsigned long fname_len);
-int sci_TCL_GetVar(char *fname, unsigned long fname_len);
-int sci_TCL_SetVar(char *fname, unsigned long fname_len);
-int sci_opentk(char *fname, unsigned long fname_len);
-int sci_TCL_GetVersion(char *fname, unsigned long fname_len);
-int sci_TCL_UnsetVar(char *fname, unsigned long fname_len);
-int sci_TCL_ExistVar(char *fname, unsigned long fname_len);
-int sci_TCL_UpVar(char *fname, unsigned long fname_len);
-int sci_TCL_DeleteInterp(char *fname, unsigned long fname_len);
-int sci_TCL_CreateSlave(char *fname, unsigned long fname_len);
-int sci_TCL_ExistInterp(char *fname, unsigned long fname_len);
-int sci_TCL_ExistArray(char *fname, unsigned long fname_len);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_TCL_EvalStr);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_TCL_ExistInterp);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_TCL_GetVar);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_TCL_DoOneEvent);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_TCL_EvalFile);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_TCL_SetVar);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_TCL_ExistVar);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_TCL_ExistArray);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_opentk);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_TCL_GetVersion);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_TCL_UnsetVar);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_TCL_UpVar);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_TCL_CreateSlave);
+TCLSCI_IMPEXP C_GATEWAY_PROTOTYPE(sci_TCL_DeleteInterp);
 /*--------------------------------------------------------------------------*/
 #endif /*  __GW_TCLSCI__ */
 /*--------------------------------------------------------------------------*/
-
diff --git a/scilab/modules/tclsci/includes/tclsci_gw.hxx b/scilab/modules/tclsci/includes/tclsci_gw.hxx
new file mode 100644 (file)
index 0000000..798aebd
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2015 - Scilab Enterprises - Cedric Delamarre
+*
+*  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 __TCLSCI_GW_HXX__
+#define __TCLSCI_GW_HXX__
+
+#include <string>
+
+extern "C"
+{
+#include "dynlib_tclsci.h"
+}
+
+class TclsciModule
+{
+private :
+    TclsciModule() {};
+    ~TclsciModule() {};
+    static int LoadDeps(const std::wstring& _functionName);
+
+public :
+    TCLSCI_IMPEXP static int Load();
+    TCLSCI_IMPEXP static int Unload()
+    {
+        return 1;
+    }
+};
+
+#endif /* __TCLSCI_GW_HXX__ */
diff --git a/scilab/modules/tclsci/macros/CloseEditorSaveData.sci b/scilab/modules/tclsci/macros/CloseEditorSaveData.sci
new file mode 100644 (file)
index 0000000..e727fdf
--- /dev/null
@@ -0,0 +1,27 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function CloseEditorSaveData()
+    // Called when closing data editor
+
+    global ged_handle; // To leave here because used when doing execstr(ged_tmp_string...
+    global ged_tmp;
+    global ged_tmp_string;
+    global WINDOW;
+
+    Nan = %nan // to avoid error message because of special Nan display
+
+    ged_tmp=GEDeditvar_get(WINDOW);
+
+    execstr(ged_tmp_string+"= ged_tmp");
+
+    clearglobal ged_tmp ged_tmp_string WINDOW
+    clear ged_tmp ged_tmp_string WINDOW
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/DestroyGlobals.sci b/scilab/modules/tclsci/macros/DestroyGlobals.sci
new file mode 100644 (file)
index 0000000..cb3639c
--- /dev/null
@@ -0,0 +1,24 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function DestroyGlobals()
+    global ged_current_figure
+
+    if ~isempty(winsid()) & ~isempty(find(ged_current_figure==winsid())) then
+        scf(ged_current_figure)
+    end
+
+    // ged is closed
+    TCL_UnsetVar("sciGedIsAlive");
+
+    clearglobal ged_current_figure
+    clear ged_current_figure
+
+    // disp("PASSE PAR DestroyGlobals Scilab");
+endfunction
diff --git a/scilab/modules/tclsci/macros/Dist2polyline.sci b/scilab/modules/tclsci/macros/Dist2polyline.sci
new file mode 100644 (file)
index 0000000..331b766
--- /dev/null
@@ -0,0 +1,45 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function [d,pt,ind]=Dist2polyline(xp,yp,pt)
+    // computes minimum distance from a point to a polyline
+    //d    minimum distance to polyline
+    //pt   coordinate of the polyline closest point
+    //ind
+    //     if negative polyline closest point is a polyline corner:pt=[xp(-ind) yp(-ind)]
+    //     if positive pt lies on segment [ind ind+1]
+
+    // Copyright INRIA
+    x=pt(1)
+    y=pt(2)
+    xp=xp(:);yp=yp(:)
+    cr=4*sign((xp(1:$-1)-x).*(xp(1:$-1)-xp(2:$))+..
+    (yp(1:$-1)-y).*(yp(1:$-1)-yp(2:$)))+..
+    sign((xp(2:$)-x).*(xp(2:$)-xp(1:$-1))+..
+    (yp(2:$)-y).*(yp(2:$)-yp(1:$-1)))
+
+    ki=find(cr==5) // index of segments for which projection fall inside
+    np=size(xp,"*")
+    if ki<>[] then
+        //projection on segments
+        x=[xp(ki) xp(ki+1)]
+        y=[yp(ki) yp(ki+1)]
+        dx=x(:,2)-x(:,1)
+        dy=y(:,2)-y(:,1)
+        d_d=dx.^2+dy.^2
+        d_x=( dy.*(-x(:,2).*y(:,1)+x(:,1).*y(:,2))+dx.*(dx*pt(1)+dy*pt(2)))./d_d
+        d_y=(-dx.*(-x(:,2).*y(:,1)+x(:,1).*y(:,2))+dy.*(dx*pt(1)+dy*pt(2)))./d_d
+        xp=[xp;d_x]
+        yp=[yp;d_y]
+    end
+    [d,k]=min(((xp-pt(1))).^2+((yp-pt(2))).^2) //distance with all points
+    d=sqrt(d)
+    pt(1)=xp(k)
+    pt(2)=yp(k)
+    if k>np then ind=ki(k-np),else ind=-k,end
+endfunction
diff --git a/scilab/modules/tclsci/macros/EditData.sci b/scilab/modules/tclsci/macros/EditData.sci
new file mode 100644 (file)
index 0000000..7ed5149
--- /dev/null
@@ -0,0 +1,25 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function EditData(TheData,datastring)
+    // TheData must be a real scalar or matrix
+    global ged_handle; h=ged_handle
+
+    // I declare ged_tmp ged_tmp_string WINDOW as global
+    global ged_tmp;
+    global ged_tmp_string;
+    global WINDOW;
+
+    ged_tmp_string = datastring;
+
+    ged_tmp=TheData;
+
+    WINDOW = GEDeditvar("ged_tmp")
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/GEDeditvar.sci b/scilab/modules/tclsci/macros/GEDeditvar.sci
new file mode 100644 (file)
index 0000000..8822beb
--- /dev/null
@@ -0,0 +1,92 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function [WINID] = GEDeditvar(varargin)
+    // Simple Variable Editor
+    // This file is part of sciGUI toolbox
+    // Copyright (C) 2004 Jaime Urzua Grez
+    // mailto:jaime_urzua@yahoo.com
+    // rev. 0.2 2004/06/24
+    //
+    // This program is free software; you can redistribute it and/or modify
+    //it under the terms of the GNU General Public License as published by
+    //the Free Software Foundation; either version 2 of the License, or
+    //(at your option) any later version.
+
+    sciGUI_init()
+
+    [%_nams]=who("get");
+    %_loc_type=type(varargin(1))
+    if (%_loc_type~=10) then error(42), end
+    %_in_list=find(%_nams==varargin(1));
+    if (%_in_list==[]) then error(42), end
+    execstr("%_loc_var="+varargin(1));
+    %_loc_type=type(%_loc_var);
+    %_allo=find([1;4;10]==%_loc_type);
+    if (%_allo==[]) then error(42), end
+
+    //disp("Please wait...");
+    %_loc_nam=varargin(1);
+    %_loc_ni=size(%_loc_var,1);
+    %_loc_nj=size(%_loc_var,2);
+    %_loc_type=string(%_loc_type);
+
+    TCL_EvalStr("set EdVarLoc [GEDsciGUIEditVar -1]");
+
+    %_winId=TCL_GetVar("EdVarLoc");
+
+    TCL_SetVar("sciGUITable(win,"+%_winId+",data,name)",%_loc_nam);
+    TCL_SetVar("sciGUITable(win,"+%_winId+",data,type)",string(%_loc_type));
+    TCL_SetVar("sciGUITable(win,"+%_winId+",data,ni)",string(%_loc_ni));
+    TCL_SetVar("sciGUITable(win,"+%_winId+",data,nj)",string(%_loc_nj));
+
+    //
+    // This is a slow manner to move the data ...
+    // Anyone have a faster method than TCL_SetVar
+    // I would like set some tcl variable like varname(pos_i,pos_j)
+    //
+    Nb_data=(%_loc_nj)*(%_loc_ni)
+    // disp("Nb_data=")
+    // disp(Nb_data);
+    // winWB=waitbar('Loading data...');
+    // tmp = 0;
+    // waitbar(tmp,winWB);
+
+
+    for %_j=1:%_loc_nj,
+        for %_i=1:%_loc_ni,
+            %_value=string(%_loc_var(%_i,%_j));
+            %_varname="sciGUITable(win,"+%_winId+",data,"+string(%_i)+","+string(%_j)+")";
+            TCL_SetVar(%_varname,%_value);
+        end
+
+        //tmp = ((%_j)*(%_loc_ni)) / Nb_data;
+        //tmp = tmp *100; tmp = int(tmp); tmp = tmp /100;
+        //disp("tmp dans for=")
+        //disp(tmp)
+        //waitbar(tmp,winWB);
+    end
+
+
+    // disp("%_winId=");
+    // disp(%_winId);
+    // disp("type(%_winId)=");
+    // disp(type(%_winId));
+    // disp("winWB=");
+    // disp(winWB);
+    // disp("type(winWB)=");
+    // disp(type(winWB));
+    // disp("AVANT DrawGrid");
+
+
+    TCL_EvalStr("GEDsciGUIEditVarDrawGrid "+%_winId)
+
+    WINID = %_winId;
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/GEDeditvar_get.sci b/scilab/modules/tclsci/macros/GEDeditvar_get.sci
new file mode 100644 (file)
index 0000000..04af3d7
--- /dev/null
@@ -0,0 +1,48 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function outvar=GEDeditvar_get(winId)
+    // Simple variable editor - import data
+    // This file is part of sciGUI toolbox
+    // Copyright (C) 2004 Jaime Urzua Grez
+    // mailto:jaime_urzua@yahoo.com
+    // rev. 0.1
+    //
+    // This program is free software; you can redistribute it and/or modify
+    //it under the terms of the GNU General Public License as published by
+    //the Free Software Foundation; either version 2 of the License, or
+    //(at your option) any later version.
+
+    //disp("Please wait...");
+    outvar=[];
+    base="sciGUITable(win,"+string(winId)+",data";
+    varType=evstr(TCL_GetVar(base+",type)"));
+    varni=evstr(TCL_GetVar(base+",ni)"));
+    varnj=evstr(TCL_GetVar(base+",nj)"));
+    for j=1:varnj,
+        ww=[];
+        for i=1:varni,
+            q=TCL_GetVar(base+","+string(i)+","+string(j)+")");
+            if (varType~=10) then
+                if (varType==4) then
+                    if ((q=="T")|(q=="t")) then
+                        ww=[ww;%t];
+                    else
+                        ww=[ww;%f];
+                    end
+                else
+                    ww=[ww;evstr(q)];
+                end
+            else
+                ww=[ww;q];
+            end
+        end
+        outvar=[outvar ww];
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/GetSetValue.sci b/scilab/modules/tclsci/macros/GetSetValue.sci
new file mode 100644 (file)
index 0000000..5092112
--- /dev/null
@@ -0,0 +1,11 @@
+function GetSetValue(h)
+    n=size(labels,"*")
+    lhs="[ok,"+strcat("x"+string(1:n),",")+"]"
+    execstr(lhs+"=getvalue(t,labels,typs,ini)")
+    if ok then
+        for k=1:n
+            execstr("if x"+string(k)+"<>h."+labels(k)+" then h."+..
+            labels(k)+"=x"+string(k)+",end")
+        end
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/GetTab.sci b/scilab/modules/tclsci/macros/GetTab.sci
new file mode 100644 (file)
index 0000000..6d8152e
--- /dev/null
@@ -0,0 +1,15 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+// for the ticks arrays Locations and Labels (inside TLIST)
+
+function ged_tablo=GetTab(val,index)
+    //disp("ICI")
+    ged_tablo(index) =val
+endfunction
diff --git a/scilab/modules/tclsci/macros/GetTab2.sci b/scilab/modules/tclsci/macros/GetTab2.sci
new file mode 100644 (file)
index 0000000..920bdf9
--- /dev/null
@@ -0,0 +1,13 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function ged_tablo=GetTab2(val,index,ged_tablo)
+    //disp("ICI")
+    ged_tablo(index) =val
+endfunction
diff --git a/scilab/modules/tclsci/macros/Get_Depth.sci b/scilab/modules/tclsci/macros/Get_Depth.sci
new file mode 100644 (file)
index 0000000..5b90013
--- /dev/null
@@ -0,0 +1,10 @@
+function depth = Get_Depth(f,h)
+
+    depth = 2;
+
+    while  h.parent <> f
+        h = h.parent;
+        depth = depth + 1;
+    end
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/Get_handle_from_index.sci b/scilab/modules/tclsci/macros/Get_handle_from_index.sci
new file mode 100644 (file)
index 0000000..5ef6317
--- /dev/null
@@ -0,0 +1,21 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution.  The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+//function h=Get_handle_from_index(index)
+function Get_handle_from_index(index)
+    global ged_handle;
+    global ged_cur_fig_handle
+
+    hl = Get_handles_list(ged_cur_fig_handle);
+
+    ged_handle = hl(index);
+    //   h=ged_handle;
+    tkged();
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/Get_handle_pos_in_list.sci b/scilab/modules/tclsci/macros/Get_handle_pos_in_list.sci
new file mode 100644 (file)
index 0000000..c57e008
--- /dev/null
@@ -0,0 +1,26 @@
+function curgedindex_ = Get_handle_pos_in_list(h)
+    global ged_cur_fig_handle
+
+    curgedindex_ = [];
+
+    handles = Get_handles_list(ged_cur_fig_handle)
+    for i=1:size(handles,1)
+        if (h==handles(i))
+            curgedindex_ = i;
+        end
+    end
+
+    // Other case :
+    // a label has been selected (and for now they are included inside the Axes)
+    if (curgedindex_==[])
+        if h.type == "Label"
+            h = h.parent;
+            for i=1:size(handles,1)
+                if (h==handles(i))
+                    curgedindex_ = i;
+                end
+            end
+        end
+    end
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/Get_handles_list.sci b/scilab/modules/tclsci/macros/Get_handles_list.sci
new file mode 100644 (file)
index 0000000..255730e
--- /dev/null
@@ -0,0 +1,23 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function h_out_list=Get_handles_list(h);
+
+    global ged_handle_out;
+
+    f=getparfig(h);
+    ged_handle_out=[f];
+
+    List_handles(f);
+
+    //disp(ged_handle_out);
+
+    h_out_list=ged_handle_out;
+
+endfunction
+
diff --git a/scilab/modules/tclsci/macros/Get_levels.sci b/scilab/modules/tclsci/macros/Get_levels.sci
new file mode 100644 (file)
index 0000000..8417076
--- /dev/null
@@ -0,0 +1,17 @@
+// Search the depth level for each handle
+// Usefull for new hierarchical graphic tree.
+function ged_levels = Get_levels(handles);
+
+    ged_levels = 1; // for Figure, always 1
+
+    f = handles(1);
+
+    for i=2:size(handles,1)
+        ged_levels(i) = Get_Depth(f,handles(i));
+    end
+
+    //disp("les levels sont:")xb
+
+    //disp(ged_levels);
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/List_handles.sci b/scilab/modules/tclsci/macros/List_handles.sci
new file mode 100644 (file)
index 0000000..d25f813
--- /dev/null
@@ -0,0 +1,35 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function List_handles(h)
+    global ged_handle_out;
+
+    i = 1;
+    //if h.type=="Axes" then
+    //   ged_handle_out = [ged_handle_out;h.x_label;h.y_label;h.z_label;h.title];
+    //end
+    psonstmp = h.children;
+    if psonstmp <> [] then
+        psonstmp = h.children(1);
+    end
+
+    while ((psonstmp <>[]) & ((i) <=size(psonstmp.parent.children,1)))
+        i = i+1;
+        ged_handle_out = [ged_handle_out;  psonstmp];
+        List_handles(psonstmp);
+
+        if ((i) <=size(psonstmp.parent.children,1)) then
+            psonstmp = psonstmp.parent.children(i);
+        else
+            psonstmp=[];
+        end
+
+    end
+
+endfunction
+
diff --git a/scilab/modules/tclsci/macros/LoadTicks2TCL.sci b/scilab/modules/tclsci/macros/LoadTicks2TCL.sci
new file mode 100644 (file)
index 0000000..22c5c99
--- /dev/null
@@ -0,0 +1,67 @@
+// Is called by ged_axes
+function LoadTicks2TCL(h)
+    global ged_handle;ged_handle=h;
+
+    TCL_SetVar("Xaxes_visibleToggle",h.axes_visible(1))
+    TCL_SetVar("Yaxes_visibleToggle",h.axes_visible(2))
+    TCL_SetVar("Zaxes_visibleToggle",h.axes_visible(3))
+
+    TCL_SetVar("SubticksEntryX",string(h.sub_ticks(1)))
+    TCL_GetVar("SubticksEntryX")
+
+    // disp("h.sub_ticks(1) =")
+    // disp(h.sub_ticks(1));
+
+    TCL_SetVar("SubticksEntryY",string(h.sub_ticks(2)))
+
+    select h.view
+    case "2d"
+        drawlater(); // postpon the drawings due to switching from 2d to 3d mode (for example)
+        // in order to know the complete data set (z data for axes...)
+        h.view="3d"
+
+        TCL_SetVar("SubticksEntryZ",string(h.sub_ticks(3)))
+        h.view="2d"
+        drawnow();
+    case "3d"
+        TCL_SetVar("SubticksEntryZ",string(h.sub_ticks(3)))
+    end
+
+    TCL_SetVar("XautoticksToggle",h.auto_ticks(1))
+    TCL_SetVar("YautoticksToggle",h.auto_ticks(2))
+    TCL_SetVar("ZautoticksToggle",h.auto_ticks(3))
+
+    //ticks value: X axis
+    ticks = h.x_ticks;
+    sizeticks = size(ticks.locations,1);
+    TCL_SetVar("nbticks_x",string(sizeticks));
+    for i=1:sizeticks
+        val= "LOCATIONS_X("+string(i)+")";
+        TCL_EvalStr("set "+val+" "+string(ticks.locations(i)));
+        val= "LABELS_X("+string(i)+")";
+        TCL_EvalStr("set "+val+" {"+ticks.labels(i)+"}");
+    end
+
+    //ticks value: Y axis
+    ticks = h.y_ticks;
+    sizeticks = size(ticks.locations,1);
+    TCL_SetVar("nbticks_y",string(sizeticks));
+    for i=1:sizeticks
+        val= "LOCATIONS_Y("+string(i)+")";
+        TCL_EvalStr("set "+val+" "+string(ticks.locations(i)));
+        val= "LABELS_Y("+string(i)+")";
+        TCL_EvalStr("set "+val+" {"+ticks.labels(i)+"}");
+    end
+
+    //ticks value: Z axis
+    ticks = h.z_ticks;
+    sizeticks = size(ticks.locations,1);
+    TCL_SetVar("nbticks_z",string(sizeticks));
+    for i=1:sizeticks
+        val= "LOCATIONS_Z("+string(i)+")";
+        TCL_EvalStr("set "+val+" "+string(ticks.locations(i)));
+        val= "LABELS_Z("+string(i)+")";
+        TCL_EvalStr("set "+val+" {"+ticks.labels(i)+"}");
+    end
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/LogtoggleX.sci b/scilab/modules/tclsci/macros/LogtoggleX.sci
new file mode 100644 (file)
index 0000000..512ebf2
--- /dev/null
@@ -0,0 +1,22 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function LogtoggleX( tog)
+    global ged_handle; h=ged_handle
+
+    h.log_flags=tog+part(h.log_flags,2);
+
+
+    //tst=execstr("global h;h.log_flags=tog+part(h.log_flags,2)",'errcatch','n');
+
+    //if tst<>0 then
+    //   disp 'Warning: X bounds must be strictly positive'
+    //end
+endfunction
+
diff --git a/scilab/modules/tclsci/macros/LogtoggleY.sci b/scilab/modules/tclsci/macros/LogtoggleY.sci
new file mode 100644 (file)
index 0000000..3a4323d
--- /dev/null
@@ -0,0 +1,21 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function LogtoggleY( tog)
+    global ged_handle; h=ged_handle
+
+    h.log_flags=part(h.log_flags,1)+tog;
+
+
+    //tst=execstr("global h;h.log_flags=part(h.log_flags,1)+tog",'errcatch','n');
+
+    //if tst<>0 then
+    //   disp 'Warning: Y bounds must be strictly positive'
+    //end
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/LogtoggleZ.sci b/scilab/modules/tclsci/macros/LogtoggleZ.sci
new file mode 100644 (file)
index 0000000..ed9062f
--- /dev/null
@@ -0,0 +1,22 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function LogtoggleZ( tog)
+    global ged_handle; h=ged_handle
+
+    h.log_flags=part(h.log_flags,1)+part(h.log_flags,2)+tog;
+
+
+    //tst=execstr("global h;h.log_flags=part(h.log_flags,1)+tog",'errcatch','n');
+
+    //if tst<>0 then
+    //   disp 'Warning: Z bounds must be strictly positive'
+    //end
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/ReLoadTicks2TCL.sci b/scilab/modules/tclsci/macros/ReLoadTicks2TCL.sci
new file mode 100644 (file)
index 0000000..03ab9b4
--- /dev/null
@@ -0,0 +1,99 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+// when clicking on Ticks button : REload ticks is called
+
+function ReLoadTicks2TCL(h)
+    global ged_handle;ged_handle=h;
+
+    TCL_SetVar("Xaxes_visibleToggle",h.axes_visible(1))
+    TCL_SetVar("Yaxes_visibleToggle",h.axes_visible(2))
+    TCL_SetVar("Zaxes_visibleToggle",h.axes_visible(3))
+
+    ticks = h.x_ticks;
+    sizeticks = size(ticks.locations,1);
+    if (sizeticks <> 0)
+        TCL_EvalStr("unset LOCATIONS_X");
+        TCL_EvalStr("unset LABELS_X");
+    end
+
+    ticks = h.y_ticks;
+    sizeticks = size(ticks.locations,1);
+    if (sizeticks <> 0)
+        TCL_EvalStr("unset LOCATIONS_Y");
+        TCL_EvalStr("unset LABELS_Y");
+    end
+
+    ticks = h.z_ticks;
+    sizeticks = size(ticks.locations,1);
+    if (sizeticks <> 0)
+        TCL_EvalStr("unset LOCATIONS_Z");
+        TCL_EvalStr("unset LABELS_Z");
+    end
+
+    TCL_SetVar("SubticksEntryX",string(h.sub_ticks(1)))
+    //  TCL_GetVar("SubticksEntryX")
+
+    // disp("h.sub_ticks(1) =")
+    // disp(h.sub_ticks(1));
+
+    TCL_SetVar("SubticksEntryY",string(h.sub_ticks(2)))
+
+    select h.view
+    case "2d"
+        drawlater();
+        h.view="3d"
+        TCL_SetVar("SubticksEntryZ",string(h.sub_ticks(3)))
+        h.view="2d"
+        drawnow();
+    case "3d"
+        TCL_SetVar("SubticksEntryZ",string(h.sub_ticks(3)))
+    end
+
+    TCL_SetVar("XautoticksToggle",h.auto_ticks(1))
+    TCL_SetVar("YautoticksToggle",h.auto_ticks(2))
+    TCL_SetVar("ZautoticksToggle",h.auto_ticks(3))
+
+    //ticks value: X axis
+    ticks = h.x_ticks;
+
+    sizeticks = size(ticks.locations,1);
+    TCL_SetVar("nbticks_x",string(sizeticks));
+    for i=1:sizeticks
+        val= "LOCATIONS_X("+string(i)+")";
+        TCL_EvalStr("set "+val+" "+string(ticks.locations(i)));
+        //      disp("i vaut:");
+        //      disp(i);
+        val= "LABELS_X("+string(i)+")";
+        TCL_EvalStr("set "+val+" {"+ticks.labels(i)+"}");
+    end
+
+    //ticks value: Y axis
+    ticks = h.y_ticks;
+    sizeticks = size(ticks.locations,1);
+    TCL_SetVar("nbticks_y",string(sizeticks));
+    for i=1:sizeticks
+        val= "LOCATIONS_Y("+string(i)+")";
+        TCL_EvalStr("set "+val+" "+string(ticks.locations(i)));
+        val= "LABELS_Y("+string(i)+")";
+        TCL_EvalStr("set "+val+" {"+ticks.labels(i)+"}");
+    end
+
+    //ticks value: Z axis
+    ticks = h.z_ticks;
+    sizeticks = size(ticks.locations,1);
+    TCL_SetVar("nbticks_z",string(sizeticks));
+    for i=1:sizeticks
+        val= "LOCATIONS_Z("+string(i)+")";
+        TCL_EvalStr("set "+val+" "+string(ticks.locations(i)));
+        val= "LABELS_Z("+string(i)+")";
+        TCL_EvalStr("set "+val+" {"+ticks.labels(i)+"}");
+    end
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/Subtickstoggle.sci b/scilab/modules/tclsci/macros/Subtickstoggle.sci
new file mode 100644 (file)
index 0000000..c53a49b
--- /dev/null
@@ -0,0 +1,19 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function Subtickstoggle( tog, index)
+    global ged_handle; h=ged_handle
+
+    subticks=h.sub_ticks;
+    subticks(index)=tog;
+    //disp("subticks vaut:")
+    //disp(subticks)
+
+    h.sub_ticks = subticks;
+endfunction
diff --git a/scilab/modules/tclsci/macros/TK_send_handles_list.sci b/scilab/modules/tclsci/macros/TK_send_handles_list.sci
new file mode 100644 (file)
index 0000000..66d7e05
--- /dev/null
@@ -0,0 +1,119 @@
+function TK_send_handles_list(h)
+    iFig = 0;
+    iUim = 0; // uimenu
+    iUic = 0; // uicontrol
+    iAxe = 0; // <=> subwindow in C code
+    iAgr = 0;
+    iPol = 0;
+    iPl3 = 0;
+    iFac = 0;
+    iRec = 0;
+    iTex = 0;
+    iLeg = 0;
+    iArc = 0;
+    iSeg = 0;
+    iCha = 0; // Champ
+    iFec = 0;
+    iGra = 0;
+    iMat = 0; // forgotten object F.Leray 22.10.04
+    iAxi = 0; // axis : entity created when using drawaxis method for example
+    iLab = 0;
+
+    f=getparfig(h);
+    handles = Get_handles_list(f)
+
+    ged_levels = Get_levels(handles);
+
+    TCL_SetVar("ged_handle_list_size",string(size(handles,1)));
+
+    for i=1:size(handles,1)
+        SelObject="LEVELS("+string(i)+")";
+        TCL_EvalStr("set "+SelObject+" "+string(ged_levels(i)));
+    end
+
+
+    for i=1:size(handles,1)
+        SelObject="SELOBJECT("+string(i)+")";
+        hand = handles(i);
+        select  hand.type
+        case "Figure"
+            iFig = iFig+1;
+            figname= "Figure("+string(iFig)+")";
+            TCL_EvalStr("set "+SelObject+" "+figname);
+        case "uimenu"
+            iUim = iUim+1;
+            uimname= "Uimenu("+string(iUim)+")";
+            TCL_EvalStr("set "+SelObject+" "+uimname);
+        case "uicontrol"
+            iUic = iUic+1;
+            uicname= "Uicontrol("+string(iUic)+")";
+            TCL_EvalStr("set "+SelObject+" "+uicname);
+        case "Axes"
+            iAxe = iAxe+1;
+            axename= "Axes("+string(iAxe)+")";
+            TCL_EvalStr("set "+SelObject+" "+axename);
+            //   case "Label"  // to see later: have labels at the same level than Axes (to have a better visibility)
+            //    iLab = iLab+1;
+            //    labname= "Label("+string(iLab)+")";
+            //    TCL_EvalStr('set '+SelObject+" "+labname);
+        case "Compound"
+            iAgr = iAgr+1;
+            agrname= "Compound("+string(iAgr)+")";
+            TCL_EvalStr("set "+SelObject+" "+agrname);
+        case "Polyline"
+            iPol = iPol+1;
+            polname= "Polyline("+string(iPol)+")";
+            TCL_EvalStr("set "+SelObject+" "+polname);
+        case "Plot3d"
+            iPl3 = iPl3+1;
+            pl3name= "Plot3d("+string(iPl3)+")";
+            TCL_EvalStr("set "+SelObject+" "+pl3name);
+        case "Fac3d"
+            iFac = iFac+1;
+            Facname= "Fac3d("+string(iFac)+")";
+            TCL_EvalStr("set "+SelObject+" "+Facname);
+        case "Rectangle"
+            iRec = iRec+1;
+            Recname= "Rectangle("+string(iRec)+")";
+            TCL_EvalStr("set "+SelObject+" "+Recname);
+        case "Text"
+            iTex = iTex+1;
+            Texname= "Text("+string(iTex)+")";
+            TCL_EvalStr("set "+SelObject+" "+Texname);
+        case "Legend"
+            iLeg = iLeg+1;
+            Legname= "Legend("+string(iLeg)+")";
+            TCL_EvalStr("set "+SelObject+" "+Legname);
+        case "Arc"
+            iArc = iArc+1;
+            Arcname= "Arc("+string(iArc)+")";
+            TCL_EvalStr("set "+SelObject+" "+Arcname);
+        case "Segs"
+            iSeg = iSeg+1;
+            Segname= "Segs("+string(iSeg)+")";
+            TCL_EvalStr("set "+SelObject+" "+Segname);
+        case "Champ"
+            iCha = iCha+1;
+            Chaname= "Champ("+string(iCha)+")";
+            TCL_EvalStr("set "+SelObject+" "+Chaname);
+        case "Fec"
+            iFec = iFec+1;
+            Fecname= "Fec("+string(iFec)+")";
+            TCL_EvalStr("set "+SelObject+" "+Fecname);
+        case "Grayplot"
+            iGra = iGra+1;
+            Graname= "Grayplot("+string(iGra)+")";
+            TCL_EvalStr("set "+SelObject+" "+Graname);
+        case "Matplot"
+            iMat = iMat+1;
+            Matname= "Matplot("+string(iMat)+")";
+            TCL_EvalStr("set "+SelObject+" "+Matname);
+        case "Axis"
+            iAxi = iAxi+1;
+            Axiname= "Axis("+string(iAxi)+")";
+            TCL_EvalStr("set "+SelObject+" "+Axiname);
+        else
+            error( hand.type + " not handled");
+        end
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/build_args.sci b/scilab/modules/tclsci/macros/build_args.sci
new file mode 100644 (file)
index 0000000..ed1a39b
--- /dev/null
@@ -0,0 +1,19 @@
+function [ini,typs]=build_args(labels)
+    n=size(labels,"*")
+    ini=[]
+    typs=list()
+    for k=1:n
+        typ=type(h(labels(k)))
+        execstr(["if typ==10 then"
+        "   w=h."+labels(k)
+        "else"
+        "   w=sci2exp(h."+labels(k)+",0)"
+        "end"])
+        ini=[ini;w]
+        if typ==10 then
+            typs($+1)="str";typs($+1)=-1
+        else
+            typs($+1)="vec";typs($+1)=1
+        end
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/dist2Arc.sci b/scilab/modules/tclsci/macros/dist2Arc.sci
new file mode 100644 (file)
index 0000000..26a0e01
--- /dev/null
@@ -0,0 +1,84 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+// compute the distance between a point and the arc
+// in 2D included in an axis aligned rectangle whose upper left
+// corner is upperLeft and its wifth and heigth is defined.
+function [dist,diffClose] = dist2Arc( point, upperLeft, width, heigth, sector1, sector2 )
+
+
+    if ( width == 0 | heigth == 0 ) then
+        dist = %inf ;
+        diffClose = [%inf,%inf];
+        return ;
+    end
+
+    // convert the sector into radiant angle
+    angle1 =  sector1            * %pi / 180. ;
+    angle2 = (sector1 + sector2) * %pi / 180. ;
+
+    width2  = width  / 2. ;
+    heigth2 = heigth / 2. ;
+    centerC = [ upperLeft(1) + width2, upperLeft(2) - heigth2 ] ; // center of the ellipse
+
+    // clicked point in the circle frame
+    pointC  = [ (point(1) - centerC(1)) / width2, (point(2) - centerC(2)) / heigth2 ] ;
+
+    // get the projection of the clicked point on the circle
+    closest = pointC / norm( pointC ) ;
+
+    // now a quite tricky part. The aim is to find
+    // if the closest point is in the drawing sector
+    // ie if it is between bound1 and bound2 on the circle
+    // maybe a eayer solution exists.
+
+    // get the boundaries of the displayed angle
+    // the closest point is not on the arc it is one of the two
+    // boundaries
+    bound1 = [cos(angle1),sin(angle1)] ;
+    bound2 = [cos(angle2),sin(angle2)] ;
+
+    // now get the vector of bissecting line between the two bounds
+    // with the orientation toward the arc
+    b2b1       = bound1 -  bound2 ;
+    bissect(1) = -b2b1(2)         ;
+    bissect(2) =  b2b1(1)         ;
+
+    // get the position of the point along this axis
+    side = closest(1) * bissect(1) + closest(2) * bissect(2) ;
+
+    // get the position of one of the bound (same value for both)
+    boundPos = bound1(1) * bissect(1) + bound1(2) * bissect(2) ;
+
+    if side > boundPos  then
+        // the closest point is on the arc
+        diffClose = ( pointC - closest ) .* [width2,heigth2] ;
+        // bring it back to the current frame value
+        //diffclose = diffclose .* [width2,heigth2] ;
+
+        // get the distance with the closest point
+        dist = norm( diffClose ) ;
+
+    else
+        // the closest point is one of the bounds
+        // return back to the real coordinates
+        bound1 = centerC + bound1 .* [width2,heigth2];
+        bound2 = centerC + bound2 .* [width2,heigth2];
+
+        // get the minimum distance
+        dist  = norm( bound1 - point ) ;
+        dist2 = norm( bound2 - point ) ;
+        if dist > dist2 then
+            diffClose = bound1 - point ;
+        else
+            dist = dist2 ;
+            diffClose = bound2 - point ;
+        end
+        //dist = min( norm( bound1 - point ), norm( bound2 - point ) ) ;
+    end
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/dist2Ellipse.sci b/scilab/modules/tclsci/macros/dist2Ellipse.sci
new file mode 100644 (file)
index 0000000..0163015
--- /dev/null
@@ -0,0 +1,26 @@
+// compute the square of distance between a point and the ellipse
+// in 2D included in an axis aligned rectangle whose upper left
+// corner is upperLeft and its wifth and heigth is defined.
+function [dist] = dist2Ellipse( point, upperLeft, width, heigth )
+    width2  = width  / 2. ;
+    heigth2 = heigth / 2. ;
+    centerC = [ upperLeft(1) + width2, upperLeft(2) - heigth2 ] ; // center of the ellipse
+
+    // clicked point in the circle frame
+    pointC  = [ (point(1) - centerC(1)) / width2, (point(2) - centerC(2)) / heigth2 ] ;
+
+    // get the vector between the point and the closest on the circle
+    diffclose = ( 1 - 1 / norm( pointC ) ) * pointC ;
+    //closest = pointC / sqrt( pointC(1) * pointC(1) + pointC(2) * pointC(2) ) ;
+
+    // get the difference between the two
+    //ffclose = pointC - closest ;
+
+    // bring it back to the current frame value
+    diffclose(1) = diffclose(1) * width2  ;
+    diffclose(2) = diffclose(2) * heigth2 ;
+
+    // get the distance with the closest point
+    dist = norm( diffclose ) ;
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_Compound.sci b/scilab/modules/tclsci/macros/ged_Compound.sci
new file mode 100644 (file)
index 0000000..3f8d238
--- /dev/null
@@ -0,0 +1,5 @@
+function ged_Compound(h)
+    global ged_handle;ged_handle=h;
+    TCL_SetVar("curvis",h.visible)
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Compound.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_arc.sci b/scilab/modules/tclsci/macros/ged_arc.sci
new file mode 100644 (file)
index 0000000..135187e
--- /dev/null
@@ -0,0 +1,65 @@
+function ged_arc(h)
+    global ged_handle; ged_handle=h
+
+    if (h.clip_box==[])
+        TCL_SetVar("old_Xclipbox","")
+        TCL_SetVar("old_Yclipbox","")
+        TCL_SetVar("old_Wclipbox","")
+        TCL_SetVar("old_Hclipbox","")
+        TCL_SetVar("Xclipbox","")
+        TCL_SetVar("Yclipbox","")
+        TCL_SetVar("Wclipbox","")
+        TCL_SetVar("Hclipbox","")
+    else
+        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
+        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
+    end
+    TCL_SetVar("curclipstate",h.clip_state);
+    ged_linestylearray=["solid" "dash" "dash dot" "longdash dot" "bigdash dot" "bigdash longdash" "dot" "double dot"];
+    TCL_SetVar("curlinestyle",ged_linestylearray(max(h.line_style,1)))
+    TCL_SetVar("nbcol",string(size(h.data,2)))
+    for i=1:size(h.data,2)
+        val= "arcVAL("+string(i)+")";
+        TCL_EvalStr("set "+val+" "+string(h.data(2)));
+    end
+    f=h;while stripblanks(f.type)<>"Figure" then f=f.parent,end
+    TCL_SetVar("ncolors",string(size(f.color_map,1)))
+    TCL_SetVar("curcolor",string(h.foreground))
+    TCL_SetVar("curback",string(h.background))
+    TCL_SetVar("curvis",h.visible)
+    TCL_SetVar("curlinemode",h.line_mode)
+    TCL_SetVar("curfillmode",h.fill_mode)
+    TCL_SetVar("curthick",string(h.thickness))
+
+    ax=getparaxe(h);
+    // Arc data
+    select ax.view
+    case "2d"
+        drawlater();
+        ax.view="3d"  //strange behavior in 3D... seems to be bugged!!
+        TCL_SetVar("Xval",string(h.data(1)))
+        TCL_SetVar("Yval",string(h.data(2)))
+        TCL_SetVar("Zval",string(h.data(3)))
+        TCL_SetVar("Wval",string(h.data(4)))
+        TCL_SetVar("Hval",string(h.data(5)))
+        TCL_SetVar("A1val",string(h.data(6)))
+        TCL_SetVar("A2val",string(h.data(7)))
+        ax.view="2d"
+        drawnow();
+    case "3d"
+        TCL_SetVar("Xval",string(h.data(1)))
+        TCL_SetVar("Yval",string(h.data(2)))
+        TCL_SetVar("Zval",string(h.data(3)))
+        TCL_SetVar("Wval",string(h.data(4)))
+        TCL_SetVar("Hval",string(h.data(5)))
+        TCL_SetVar("A1val",string(h.data(6)))
+        TCL_SetVar("A2val",string(h.data(7)))
+    end
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Arc.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_axes.sci b/scilab/modules/tclsci/macros/ged_axes.sci
new file mode 100644 (file)
index 0000000..500e86d
--- /dev/null
@@ -0,0 +1,183 @@
+function ged_axes(h)
+    global ged_handle;ged_handle=h;
+
+    LoadTicks2TCL(h);
+
+    TCL_SetVar("Xaxes_reverseToggle",h.axes_reverse(1))
+    TCL_SetVar("Yaxes_reverseToggle",h.axes_reverse(2))
+    TCL_SetVar("Zaxes_reverseToggle",h.axes_reverse(3))
+
+    // forgotten axes bounds info.
+    TCL_SetVar("axes_boundsL",string(h.axes_bounds(1,1)))
+    TCL_SetVar("axes_boundsU",string(h.axes_bounds(1,2)))
+    TCL_SetVar("axes_boundsW",string(h.axes_bounds(1,3)))
+    TCL_SetVar("axes_boundsH",string(h.axes_bounds(1,4)))
+
+    // forgotten visibility info.
+    TCL_SetVar("xlabel_visibility",string(h.x_label.visible))
+    TCL_SetVar("ylabel_visibility",string(h.y_label.visible))
+    TCL_SetVar("zlabel_visibility",string(h.z_label.visible))
+    TCL_SetVar("titlelabel_visibility",string(h.title.visible))
+
+    TCL_SetVar("Lmargins",string(h.margins(1)));
+    TCL_SetVar("Rmargins",string(h.margins(2)));
+    TCL_SetVar("Tmargins",string(h.margins(3)));
+    TCL_SetVar("Bmargins",string(h.margins(4)));
+    ged_linestylearray=["solid" "dash" "dash dot" "longdash dot" "bigdash dot" "bigdash longdash" "dot" "double dot"];
+    TCL_SetVar("curlinestyle",ged_linestylearray(max(h.line_style,1)))
+    if (h.clip_box==[])
+        TCL_SetVar("old_Xclipbox","")
+        TCL_SetVar("old_Yclipbox","")
+        TCL_SetVar("old_Wclipbox","")
+        TCL_SetVar("old_Hclipbox","")
+        TCL_SetVar("Xclipbox","")
+        TCL_SetVar("Yclipbox","")
+        TCL_SetVar("Wclipbox","")
+        TCL_SetVar("Hclipbox","")
+    else
+        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
+        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
+    end
+    TCL_SetVar("curclipstate",h.clip_state);
+    TCL_SetVar("curautoclear",h.auto_clear);
+    TCL_SetVar("curautoscale",h.auto_scale);
+    //TCL_SetVar("curfillmode",h.fill_mode);
+    TCL_SetVar("curalpharotation",string(h.rotation_angles(1)))
+    TCL_SetVar("curthetarotation",string(h.rotation_angles(2)))
+    ged_fontarray = ["Monospaced" "Symbol" "Serif",..
+    "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
+    "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
+    "SansSerif Bold Italic"];
+    TCL_SetVar("Xlabelpos",h.x_location)
+    TCL_SetVar("Ylabelpos",h.y_location)
+    TCL_SetVar("Xlabelfontstyle",ged_fontarray(h.x_label.font_style+1))
+    TCL_SetVar("Ylabelfontstyle",ged_fontarray(h.y_label.font_style+1))
+    TCL_SetVar("Zlabelfontstyle",ged_fontarray(h.z_label.font_style+1))
+    TCL_SetVar("TITLEfontstyle",ged_fontarray(h.title.font_style+1))
+    TCL_SetVar("fontstyle",ged_fontarray(h.font_style+1))
+
+    // label texts
+    if size(h.x_label.text,"*") == 1 then
+        txt = """" + h.x_label.text + """" ;
+    else
+        // an array of strings
+        txt = "["+strcat(string(size(h.x_label.text)),"x")+" string array]" ;
+    end
+    TCL_SetVar("xlabel", txt );
+
+    if size(h.y_label.text,"*") == 1 then
+        txt = """" + h.y_label.text + """" ;
+    else
+        // an array of strings
+        txt = "["+strcat(string(size(h.y_label.text)),"x")+" string array]" ;
+    end
+    TCL_SetVar("ylabel", txt );
+
+    if size(h.z_label.text,"*") == 1 then
+        txt = """" + h.z_label.text + """" ;
+    else
+        // an array of strings
+        txt = "["+strcat(string(size(h.z_label.text)),"x")+" string array]" ;
+    end
+    TCL_SetVar("zlabel", txt );
+
+    if size(h.title.text,"*") == 1 then
+        txt = """" + h.title.text + """" ;
+    else
+        // an array of strings
+        txt = "["+strcat(string(size(h.title.text)),"x")+" string array]" ;
+    end
+    TCL_SetVar("tlabel", txt );
+
+    TCL_SetVar("xlabel_fontforeground",string(h.x_label.font_foreground))
+    TCL_SetVar("ylabel_fontforeground",string(h.y_label.font_foreground))
+    TCL_SetVar("zlabel_fontforeground",string(h.z_label.font_foreground))
+    TCL_SetVar("titlelabel_fontforg",string(h.title.font_foreground))
+    TCL_SetVar("xlabel_foreground",string(h.x_label.foreground))
+    TCL_SetVar("ylabel_foreground",string(h.y_label.foreground))
+    TCL_SetVar("zlabel_foreground",string(h.z_label.foreground))
+    TCL_SetVar("titlelabel_foreground",string(h.title.foreground))
+    TCL_SetVar("xlabel_background",string(h.x_label.background))
+    TCL_SetVar("ylabel_background",string(h.y_label.background))
+    TCL_SetVar("zlabel_background",string(h.z_label.background))
+    TCL_SetVar("titlelabel_background",string(h.title.background))
+    TCL_SetVar("x_position",sci2exp(h.x_label.position,0))
+    TCL_SetVar("y_position",sci2exp(h.y_label.position,0))
+    TCL_SetVar("z_position",sci2exp(h.z_label.position,0))
+    TCL_SetVar("title_position",sci2exp(h.title.position,0))
+    TCL_SetVar("xauto_position",h.x_label.auto_position)
+    TCL_SetVar("yauto_position",h.y_label.auto_position)
+    TCL_SetVar("zauto_position",h.z_label.auto_position)
+    TCL_SetVar("titleauto_position",h.title.auto_position)
+    TCL_SetVar("xauto_rotation",h.x_label.auto_rotation)
+    TCL_SetVar("yauto_rotation",h.y_label.auto_rotation)
+    TCL_SetVar("zauto_rotation",h.z_label.auto_rotation)
+    TCL_SetVar("titleauto_rotation",h.title.auto_rotation)
+    TCL_SetVar("Xfillmode",h.x_label.fill_mode)
+    TCL_SetVar("Yfillmode",h.y_label.fill_mode)
+    TCL_SetVar("Zfillmode",h.z_label.fill_mode)
+    TCL_SetVar("Titlefillmode",h.title.fill_mode)
+    TCL_SetVar("xlabel_fontsize",string(h.x_label.font_size))
+    TCL_SetVar("ylabel_fontsize",string(h.y_label.font_size))
+    TCL_SetVar("zlabel_fontsize",string(h.z_label.font_size))
+    TCL_SetVar("titlelabel_fontsize",string(h.title.font_size))
+    TCL_SetVar("ncolors",string(size(f.color_map,1)))
+    TCL_SetVar("fcolor",string(h.foreground))
+    TCL_SetVar("bcolor",string(h.background))
+    TCL_SetVar("curthick",string(h.thickness))
+    TCL_SetVar("curvis",h.visible)
+    TCL_SetVar("curfontsize",string(h.font_size))
+    TCL_SetVar("curfontcolor",string(h.font_color))
+    TCL_SetVar("limToggle",h.tight_limits(1))
+    TCL_SetVar("isoToggle",h.isoview)
+    TCL_SetVar("cubToggle",h.cube_scaling)
+    TCL_SetVar("viewToggle",h.view)
+    TCL_SetVar("curBoxState",h.box)
+    TCL_SetVar("xToggle",part(h.log_flags,1))
+    TCL_SetVar("yToggle",part(h.log_flags,2))
+    TCL_SetVar("zToggle",part(h.log_flags,3))
+    TCL_SetVar("xGrid",string(h.grid(1)))
+    TCL_SetVar("yGrid",string(h.grid(2)))
+
+    TCL_SetVar("hiddenAxisColor",h.hidden_axis_color)
+    TCL_SetVar("curfontangle_x",string(h.x_label.font_angle))
+    TCL_SetVar("curfontangle_y",string(h.y_label.font_angle))
+    TCL_SetVar("curfontangle_z",string(h.z_label.font_angle))
+    TCL_SetVar("curfontangle_title",string(h.title.font_angle))
+
+
+    select h.view
+    case "2d"
+        drawlater();
+        h.view="3d"
+        TCL_SetVar("old_curalpharotation",string(h.rotation_angles(1)))
+        TCL_SetVar("old_curthetarotation",string(h.rotation_angles(2)))
+        TCL_SetVar("zGrid",string(h.grid(3)))
+        TCL_SetVar("zGrid_initial",string(h.grid(3))) //to avoid useless redraw (see Axes.tcl)
+        TCL_SetVar("dbxmin",string(h.data_bounds(1,1)))
+        TCL_SetVar("dbymin",string(h.data_bounds(1,2)))
+        TCL_SetVar("dbzmin",string(h.data_bounds(1,3)))
+        TCL_SetVar("dbxmax",string(h.data_bounds(2,1)))
+        TCL_SetVar("dbymax",string(h.data_bounds(2,2)))
+        TCL_SetVar("dbzmax",string(h.data_bounds(2,3)))
+        h.view="2d"
+        drawnow();
+    case "3d"
+        TCL_SetVar("zGrid",string(h.grid(3)))
+        TCL_SetVar("zGrid_initial",string(h.grid(3))) //to avoid useless redraw (see Axes.tcl)
+        TCL_SetVar("dbxmin",string(h.data_bounds(1,1)))
+        TCL_SetVar("dbymin",string(h.data_bounds(1,2)))
+        TCL_SetVar("dbzmin",string(h.data_bounds(1,3)))
+        TCL_SetVar("dbxmax",string(h.data_bounds(2,1)))
+        TCL_SetVar("dbymax",string(h.data_bounds(2,2)))
+        TCL_SetVar("dbzmax",string(h.data_bounds(2,3)))
+    end
+
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Axes.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_axis.sci b/scilab/modules/tclsci/macros/ged_axis.sci
new file mode 100644 (file)
index 0000000..cd97cd2
--- /dev/null
@@ -0,0 +1,39 @@
+function ged_axis(h)
+    global ged_handle; ged_handle=h
+    TCL_SetVar("curvis",h.visible)
+    TCL_SetVar("curseg",h.tics_segment)
+    TCL_SetVar("curcolor",string(h.tics_color))
+    TCL_SetVar("curticsstyle",h.tics_style)
+    TCL_SetVar("curfontcolor",string(h.labels_font_color))
+    TCL_SetVar("curfontsize",string(h.labels_font_size))
+    TCL_SetVar("nbcolX",string(size(h.xtics_coord,2)))
+    TCL_SetVar("nbcolY",string(size(h.ytics_coord,2)))
+    TCL_SetVar("xticscoord",sci2exp(h.xtics_coord,0))
+    TCL_SetVar("yticscoord",sci2exp(h.ytics_coord,0))
+    TCL_SetVar("cursubtics",string(h.sub_tics))
+    TCL_SetVar("curticslabel",sci2exp(h.tics_labels,0))
+    TCL_SetVar("curticsdir",string(h.tics_direction))
+
+    if (h.clip_box==[])
+        TCL_SetVar("old_Xclipbox","")
+        TCL_SetVar("old_Yclipbox","")
+        TCL_SetVar("old_Wclipbox","")
+        TCL_SetVar("old_Hclipbox","")
+        TCL_SetVar("Xclipbox","")
+        TCL_SetVar("Yclipbox","")
+        TCL_SetVar("Wclipbox","")
+        TCL_SetVar("Hclipbox","")
+    else
+        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
+        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
+    end
+    TCL_SetVar("curclipstate",h.clip_state);
+
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Axis.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_champ.sci b/scilab/modules/tclsci/macros/ged_champ.sci
new file mode 100644 (file)
index 0000000..34c30df
--- /dev/null
@@ -0,0 +1,42 @@
+function ged_champ(h)
+    global ged_handle; ged_handle=h
+    TCL_SetVar("curvis",h.visible)
+    TCL_SetVar("curcolored",h.colored)
+    TCL_SetVar("ncolors",string(size(f.color_map,1)))
+    TCL_SetVar("curarrowsize",string(h.arrow_size))
+    TCL_SetVar("curthick",string(h.thickness))
+    ged_linestylearray=["solid" "dash" "dash dot" "longdash dot" "bigdash dot" "bigdash longdash" "dot" "double dot"];
+    TCL_SetVar("curlinestyle",ged_linestylearray(max(h.line_style,1)))
+
+    d="["+strcat(string(size(h.data.x)),"x")+" double array]"
+    TCL_SetVar("curdata_x",d);
+    d="["+strcat(string(size(h.data.y)),"x")+" double array]"
+    TCL_SetVar("curdata_y",d);
+    d="["+strcat(string(size(h.data.fx)),"x")+" double array]"
+    TCL_SetVar("curdata_fx",d);
+    d="["+strcat(string(size(h.data.fy)),"x")+" double array]"
+    TCL_SetVar("curdata_fy",d);
+
+    if (h.clip_box==[])
+        TCL_SetVar("old_Xclipbox","")
+        TCL_SetVar("old_Yclipbox","")
+        TCL_SetVar("old_Wclipbox","")
+        TCL_SetVar("old_Hclipbox","")
+        TCL_SetVar("Xclipbox","")
+        TCL_SetVar("Yclipbox","")
+        TCL_SetVar("Wclipbox","")
+        TCL_SetVar("Hclipbox","")
+    else
+        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
+        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
+    end
+    TCL_SetVar("curclipstate",h.clip_state);
+
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Champ.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_copy_entity.sci b/scilab/modules/tclsci/macros/ged_copy_entity.sci
new file mode 100644 (file)
index 0000000..2fd0e41
--- /dev/null
@@ -0,0 +1,10 @@
+function ged_copy_entity()
+    [btn,xc,yc]=xclick()
+    [xc,yc]=xchange(xc,yc,"f2i")
+    r=ged_getobject([xc,yc])
+    if r==[] return,end
+    twinkle(r,1);
+    save(TMPDIR+"/G_Clipboard",r)
+    //make the axes containning the clicked point the current one
+    sca(ged_select_axes(xc,yc))
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_delete_entity.sci b/scilab/modules/tclsci/macros/ged_delete_entity.sci
new file mode 100644 (file)
index 0000000..479c001
--- /dev/null
@@ -0,0 +1,6 @@
+function ged_delete_entity()
+    [btn,xc,yc]=xclick()
+    [xc,yc]=xchange(xc,yc,"f2i")
+    h=ged_getobject([xc,yc])
+    if h<>[] then delete(h),end
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_eventhandler.sci b/scilab/modules/tclsci/macros/ged_eventhandler.sci
new file mode 100644 (file)
index 0000000..58427df
--- /dev/null
@@ -0,0 +1,43 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function ged_eventhandler(win,x,y,ibut)
+    //Copyright INRIA
+    //Author : Serge Steer 2002
+    if ibut==-1 then return,end //ignore move
+    if and(win<>winsid())| ibut==-1000 then
+        //window has been deleted by the user
+        return
+    end
+    cur=gcf(); //preserve current figure
+    fig=scf(win) //make the window associated to the event active
+
+    //disable the event handler not to execute new event before finishing this one
+    fig.event_handler_enable = "off";
+
+
+    global ged_handle;ged_handle=[]
+    ged_handle=ged_getobject([x,y])
+
+    if ged_handle~=[] then
+        if  or(ibut==[0 3 10]) then //left button --> edit properties
+            tkged()
+        elseif or(ibut==[2 5 12]) then //right button -->move
+            [x,y]=xchange(x,y,"i2f")
+            pos=[x,y]
+            while %t then
+                rep=xgetmouse([%t %t])
+                if rep(3)>0 then break,end
+                move(ged_handle,rep(1:2)-pos)
+                pos=rep(1:2)
+            end
+        end
+    end
+    fig.event_handler_enable = "on";
+    scf(cur) //reset current window
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_fac3d.sci b/scilab/modules/tclsci/macros/ged_fac3d.sci
new file mode 100644 (file)
index 0000000..0074259
--- /dev/null
@@ -0,0 +1,61 @@
+function ged_fac3d(h)
+    global ged_handle; ged_handle=h
+
+    //  if (h.clip_box==[])
+    //    TCL_SetVar("old_Xclipbox","")
+    //    TCL_SetVar("old_Yclipbox","")
+    //    TCL_SetVar("old_Wclipbox","")
+    //    TCL_SetVar("old_Hclipbox","")
+    //    TCL_SetVar("Xclipbox","")
+    //    TCL_SetVar("Yclipbox","")
+    //    TCL_SetVar("Wclipbox","")
+    //    TCL_SetVar("Hclipbox","")
+    //   else
+    //    TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
+    //    TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
+    //    TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
+    //    TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
+    //    TCL_SetVar("Xclipbox",string(h.clip_box(1)))
+    //    TCL_SetVar("Yclipbox",string(h.clip_box(2)))
+    //    TCL_SetVar("Wclipbox",string(h.clip_box(3)))
+    //    TCL_SetVar("Hclipbox",string(h.clip_box(4)))
+    //  end
+    //  TCL_SetVar("curclipstate",h.clip_state);
+
+    TCL_SetVar("curvis",h.visible)
+    TCL_SetVar("curcolormode",string(h.color_mode))
+    TCL_SetVar("colorflagToggle",string(h.color_flag))
+    TCL_SetVar("curforeground",string(h.foreground))
+    TCL_SetVar("curhiddencolor",string(h.hiddencolor))
+    TCL_SetVar("curthick",string(h.thickness))
+
+    ged_markstylearray=["dot" "plus" "cross" "star" "filled diamond" ..
+    "diamond" "triangle up" "triangle down" "diamond plus" "circle" ..
+    "asterisk" "square" "triangle right" "triangle left" "pentagram"];
+
+    TCL_SetVar("curmarkstyle",ged_markstylearray(abs(h.mark_style)+1))
+    TCL_SetVar("curmarkmode",h.mark_mode)
+    TCL_SetVar("curmarksize",string(h.mark_size))
+    TCL_SetVar("curmarksizeunit",h.mark_size_unit);
+    TCL_SetVar("curmarkforeground",string(h.mark_foreground))
+    TCL_SetVar("curmarkbackground",string(h.mark_background))
+    TCL_SetVar("curlinemode",h.surface_mode)
+
+
+    d="["+strcat(string(size(h.data.x)),"x")+" double array]"
+    TCL_SetVar("curdata_x",d);
+    d="["+strcat(string(size(h.data.y)),"x")+" double array]"
+    TCL_SetVar("curdata_y",d);
+    d="["+strcat(string(size(h.data.z)),"x")+" double array]"
+    TCL_SetVar("curdata_z",d);
+
+    TCL_EvalStr("set flagCOLOR 0")
+    if(h.data(1)==["3d" "x" "y" "z" "color"])
+        TCL_EvalStr("set flagCOLOR 1")
+        d="["+strcat(string(size(h.data.color)),"x")+" integer array]"
+        TCL_SetVar("curdata_color",d);
+    end
+
+
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Fac3d.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_fec.sci b/scilab/modules/tclsci/macros/ged_fec.sci
new file mode 100644 (file)
index 0000000..a5aa0bb
--- /dev/null
@@ -0,0 +1,38 @@
+function ged_fec(h)
+    global ged_handle; ged_handle=h
+    TCL_SetVar("curvis",h.visible)
+    TCL_SetVar("zbmin",string(h.z_bounds(1)))
+    TCL_SetVar("zbmax",string(h.z_bounds(2)))
+    //  TCL_SetVar("nbrow",string(size(h.data,1)))
+    //  TCL_SetVar("nbcol",string(size(h.data,2)))
+    //  TCL_SetVar("nbrowTri",string(size(h.triangles,1)))
+    //  TCL_SetVar("nbcolTri",string(size(h.triangles,2)))
+
+    d="["+strcat(string(size(h.data)),"x")+" double array]"
+    TCL_SetVar("curdata_data",d);
+    d="["+strcat(string(size(h.triangles)),"x")+" double array]"
+    TCL_SetVar("curdata_triangles",d);
+
+    //  if (h.clip_box==[])
+    //    TCL_SetVar("old_Xclipbox","")
+    //    TCL_SetVar("old_Yclipbox","")
+    //    TCL_SetVar("old_Wclipbox","")
+    //    TCL_SetVar("old_Hclipbox","")
+    //    TCL_SetVar("Xclipbox","")
+    //    TCL_SetVar("Yclipbox","")
+    //    TCL_SetVar("Wclipbox","")
+    //    TCL_SetVar("Hclipbox","")
+    //   else
+    //    TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
+    //    TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
+    //    TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
+    //    TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
+    //    TCL_SetVar("Xclipbox",string(h.clip_box(1)))
+    //    TCL_SetVar("Yclipbox",string(h.clip_box(2)))
+    //    TCL_SetVar("Wclipbox",string(h.clip_box(3)))
+    //    TCL_SetVar("Hclipbox",string(h.clip_box(4)))
+    //  end
+    //  TCL_SetVar("curclipstate",h.clip_state);
+
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Fec.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_figure.sci b/scilab/modules/tclsci/macros/ged_figure.sci
new file mode 100644 (file)
index 0000000..f87e72b
--- /dev/null
@@ -0,0 +1,20 @@
+function ged_figure(h)
+    global ged_handle;ged_handle=h;
+    TCL_SetVar("background",string(h.background))
+    TCL_SetVar("rotation_style",h.rotation_style)
+    TCL_SetVar("figure_name",h.figure_name)
+    TCL_SetVar("figure_id",string(h.figure_id))
+    TCL_SetVar("figure_xposition",string(h.figure_position(1)))
+    TCL_SetVar("figure_yposition",string(h.figure_position(2)))
+    TCL_SetVar("figure_xsiz",string(h.figure_size(1)))
+    TCL_SetVar("figure_ysiz",string(h.figure_size(2)))
+    TCL_SetVar("figure_xaxesiz",string(h.axes_size(1)))
+    TCL_SetVar("figure_yaxesiz",string(h.axes_size(2)))
+    TCL_SetVar("bcolor",string(h.background))
+    TCL_SetVar("ncolors",string(size(h.color_map,1)))
+    TCL_SetVar("curvis",h.visible)
+    TCL_SetVar("curpdm",h.pixel_drawing_mode)
+    TCL_SetVar("curautoresize",h.auto_resize)
+    TCL_SetVar("currotation_style",h.rotation_style)
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Figure.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_getobject.sci b/scilab/modules/tclsci/macros/ged_getobject.sci
new file mode 100644 (file)
index 0000000..f0061e0
--- /dev/null
@@ -0,0 +1,27 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function [h,Axes]=ged_getobject(pt)
+    h=[];Axes=[];
+    f=get("current_figure");
+    aold=get("current_axes")
+    axes_array=f.children
+    //retains only the entities of type Axes (remove uimenus)
+    axes_array(axes_array.type<>"Axes")=[];
+    // assume that the lastly created objects
+    // are at the beginning of the arrays of children
+    // We can then select the last object
+    // first in the loop.
+    for k=1:size(axes_array,"*")
+        Axes=axes_array(k)
+        set("current_axes",Axes)
+        h=ged_loop(Axes,pt)
+        if h<>[] then break,end
+    end
+    set("current_axes",aold)
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_grayplot.sci b/scilab/modules/tclsci/macros/ged_grayplot.sci
new file mode 100644 (file)
index 0000000..a2f4c27
--- /dev/null
@@ -0,0 +1,16 @@
+function ged_grayplot(h)
+    global ged_handle; ged_handle=h
+    TCL_SetVar("curvis",h.visible)
+    TCL_SetVar("curdatamapping",h.data_mapping)
+
+
+    d="["+strcat(string(size(h.data.x)),"x")+" double array]"
+    TCL_SetVar("curdata_x",d);
+    d="["+strcat(string(size(h.data.y)),"x")+" double array]"
+    TCL_SetVar("curdata_y",d);
+    d="["+strcat(string(size(h.data.z)),"x")+" double array]"
+    TCL_SetVar("curdata_z",d);
+
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Grayplot.tcl")
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_legend.sci b/scilab/modules/tclsci/macros/ged_legend.sci
new file mode 100644 (file)
index 0000000..610ebb5
--- /dev/null
@@ -0,0 +1,15 @@
+function ged_legend(h)
+    global ged_handle; ged_handle=h
+    TCL_SetVar("curvis",h.visible)
+    TCL_SetVar("ncolors",string(size(f.color_map,1)))
+    TCL_SetVar("curforeground",string(h.foreground))
+    ged_fontarray = ["Monospaced" "Symbol" "Serif",..
+    "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
+    "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
+    "SansSerif Bold Italic"];
+    TCL_SetVar("curfontstyle",ged_fontarray(h.font_style+1))
+    TCL_SetVar("curfontsize",string(h.font_size))
+    TCL_SetVar("curtext",h.text)
+
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Legend.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_loop.sci b/scilab/modules/tclsci/macros/ged_loop.sci
new file mode 100644 (file)
index 0000000..447a4d5
--- /dev/null
@@ -0,0 +1,76 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function h=ged_loop(a,pt)
+
+    h=[]
+    minDist    = 0.01 ;
+    minPixDist = 3    ;
+
+    for ka=1:size(a,"*")
+        ck=a(ka) ;
+        select ck.type
+
+        case "Polyline"
+            xy=ck.data;
+            d=Dist2polyline((xy(:,1)-Xmin)/Dx,(xy(:,2)-Ymin)/Dy,pts)
+            if d < minDist then h=ck,return,end
+
+        case "Rectangle"
+            xy=ck.data;
+            x0=xy(1);y0=xy(2);W=xy(3);H=xy(4);
+            d=Dist2polyline((x0+[0,W,W,0]-Xmin)/Dx,(y0+[0,0,-H,-H]-Ymin)/Dy,pts)
+            if d < minDist then h=ck,return,end
+
+        case "Arc"
+            xy=ck.data;
+            [xp,yp]=xchange(pt(1),pt(2),"i2f")
+            //[dist, toto] = dist2Arc( [xp,yp] ./ [Dx,Dy], xy(1:2)./[Dx,Dy], xy(3)/Dx, xy(4)/Dy, xy(5) / 64., xy(6) / 64. ) ;
+            dist = pixDist2Arc( [xp,yp], xy(1:2), xy(3), xy(4), xy(5) / 64., xy(6) / 64. ) ;
+            if dist <= minPixDist then
+                h=ck;
+                return;
+            end
+
+        case "Segs"
+            xy=ck.data;
+            xv=(matrix(xy(:,1),2,-1)-Xmin)/Dx
+            yv=(matrix(xy(:,2),2,-1)-Ymin)/Dy
+            for ks=1:size(xv,2)
+                d=Dist2polyline(xv(:,ks),yv(:,ks),pts)
+                if d < minDist then h=ck,return,end
+            end
+        case "Compound"
+            h=ged_loop(ck.children,pt)
+            if h<>[] then return,end
+
+        case "Axes"
+            xy=ck.data_bounds;
+            [xp,yp]=xchange(pt(1),pt(2),"i2f")
+            Xmin=xy(1,1);Ymin=xy(1,2),Dx=xy(2,1)-xy(1,1);Dy=xy(2,2)-xy(1,2);
+            pts=[(xp-Xmin)/Dx (yp-Ymin)/Dy]
+            d=Dist2polyline([0,1,1,0],[0,0,1,1],pts)
+            if d < minDist then h=ck,return,end
+            h=ged_loop([a.children(:);ck.x_label;ck.y_label;ck.z_label;ck.title],pt)
+            if h<>[] then return,end
+
+        case "Text"
+            if is_in_text(ck,[xp;yp]) then
+                h=ck,
+                return,
+            end
+
+        case "Label"
+            if is_in_text(ck,[xp;yp]) then
+                h=ck
+                return,
+            end
+
+        end
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_matplot.sci b/scilab/modules/tclsci/macros/ged_matplot.sci
new file mode 100644 (file)
index 0000000..febbd98
--- /dev/null
@@ -0,0 +1,10 @@
+function ged_matplot(h)
+    global ged_handle; ged_handle=h
+    TCL_SetVar("curvis",h.visible)
+
+    d="["+strcat(string(size(h.data)),"x")+" double array]"
+    TCL_SetVar("curdata",d);
+
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Matplot.tcl")
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_move_entity.sci b/scilab/modules/tclsci/macros/ged_move_entity.sci
new file mode 100644 (file)
index 0000000..dc67c94
--- /dev/null
@@ -0,0 +1,58 @@
+function ged_move_entity()
+    [btn,xc,yc]=xclick()
+    pos=[xc,yc]
+    [xc,yc]=xchange(xc,yc,"f2i")
+    [r,ax]=ged_getobject([xc,yc])
+    cur_ax=gca(),sca(ax)
+    [xc,yc]=xchange(xc,yc,"i2f");pos=[xc,yc]
+    if r==[] return,end
+    drawlater();
+    rep(3)=-1
+    select r.type
+    case "Rectangle" then
+        while rep(3)==-1 do
+            rep=xgetmouse([%t %t])
+            r.data(1:2)= r.data(1:2)+(rep(1:2)-pos)
+            pos=rep(1:2)
+            drawnow();
+        end
+    case "Segs" then //Segment
+        while rep(3)==-1 do
+            rep=xgetmouse([%t %t])
+            r.data=r.data+ones(2,1)*(rep(1:2)-pos)
+            pos=rep(1:2)
+            drawnow();
+        end
+    case "Polyline" then //Polyline
+        while rep(3)==-1 do
+            rep=xgetmouse([%t %t])
+            r.data(:,1:2)=r.data(:,1:2)+ones(r.data(:,1))*(rep(1:2)-pos)
+            pos=rep(1:2)
+            drawnow();
+        end
+    case "Arc" then //Circle
+        while rep(3)==-1 do
+            rep=xgetmouse([%t %t])
+            r.data(1:2)= r.data(1:2)+(rep(1:2)-pos)
+            pos=rep(1:2)
+            drawnow();
+        end
+    case "Text" then
+        while rep(3)==-1 do
+            rep=xgetmouse([%t %t])
+            r.data(1:2)= r.data(1:2)+(rep(1:2)-pos)
+            pos=rep(1:2)
+            drawnow();
+        end
+    case "Label" then
+        while rep(3)==-1 do
+            rep=xgetmouse([%t %t])
+            r.position= r.position+(rep(1:2)-pos)
+            r.auto_position = "off"
+            pos=rep(1:2)
+            drawnow();
+        end
+
+    end
+    sca(cur_ax)
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_paste_entity.sci b/scilab/modules/tclsci/macros/ged_paste_entity.sci
new file mode 100644 (file)
index 0000000..7dc47ae
--- /dev/null
@@ -0,0 +1,15 @@
+function ged_paste_entity()
+
+    // check the file
+    [info,err] = fileinfo(TMPDIR + "/G_Clipboard" ) ;
+
+    if err <> 0 then
+        return ;
+    end
+
+    // create the saved object
+    load(TMPDIR+"/G_Clipboard") ;
+
+    //  a=gca();b=a.data_bounds;
+    //  move(r,[-1 1]*a.data_bounds/20)
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_plot3d.sci b/scilab/modules/tclsci/macros/ged_plot3d.sci
new file mode 100644 (file)
index 0000000..f10b9bb
--- /dev/null
@@ -0,0 +1,59 @@
+function ged_plot3d(h)
+    global ged_handle; ged_handle=h
+
+    //  if (h.clip_box==[])
+    //    TCL_SetVar("old_Xclipbox","")
+    //    TCL_SetVar("old_Yclipbox","")
+    //    TCL_SetVar("old_Wclipbox","")
+    //    TCL_SetVar("old_Hclipbox","")
+    //    TCL_SetVar("Xclipbox","")
+    //    TCL_SetVar("Yclipbox","")
+    //    TCL_SetVar("Wclipbox","")
+    //    TCL_SetVar("Hclipbox","")
+    //   else
+    //    TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
+    //    TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
+    //    TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
+    //    TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
+    //    TCL_SetVar("Xclipbox",string(h.clip_box(1)))
+    //    TCL_SetVar("Yclipbox",string(h.clip_box(2)))
+    //    TCL_SetVar("Wclipbox",string(h.clip_box(3)))
+    //    TCL_SetVar("Hclipbox",string(h.clip_box(4)))
+    //  end
+    //  TCL_SetVar("curclipstate",h.clip_state);
+
+    TCL_SetVar("curvis",h.visible)
+    TCL_SetVar("curcolormode",string(h.color_mode))
+    TCL_SetVar("colorflagToggle",string(h.color_flag))
+    TCL_SetVar("curforeground",string(h.foreground))
+    TCL_SetVar("curhiddencolor",string(h.hiddencolor))
+    TCL_SetVar("curthick",string(h.thickness))
+
+    ged_markstylearray=["dot" "plus" "cross" "star" "filled diamond" ..
+    "diamond" "triangle up" "triangle down" "diamond plus" "circle" ..
+    "asterisk" "square" "triangle right" "triangle left" "pentagram"];
+
+    TCL_SetVar("curmarkstyle",ged_markstylearray(abs(h.mark_style)+1))
+    TCL_SetVar("curmarkmode",h.mark_mode)
+    TCL_SetVar("curmarksize",string(h.mark_size))
+    TCL_SetVar("curmarksizeunit",h.mark_size_unit);
+    TCL_SetVar("curmarkforeground",string(h.mark_foreground))
+    TCL_SetVar("curmarkbackground",string(h.mark_background))
+    TCL_SetVar("curlinemode",h.surface_mode)
+
+
+    d="["+strcat(string(size(h.data.x)),"x")+" double array]"
+    TCL_SetVar("curdata_x",d);
+    d="["+strcat(string(size(h.data.y)),"x")+" double array]"
+    TCL_SetVar("curdata_y",d);
+    d="["+strcat(string(size(h.data.z)),"x")+" double array]"
+    TCL_SetVar("curdata_z",d);
+
+    TCL_EvalStr("set flagCOLOR 0")
+    if(h.data(1)==["3d" "x" "y" "z" "color"])
+        TCL_EvalStr("set flagCOLOR 1")
+        d="["+strcat(string(size(h.data.color)),"x")+" integer array]"
+        TCL_SetVar("curdata_color",d);
+    end
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Plot3d.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_polyline.sci b/scilab/modules/tclsci/macros/ged_polyline.sci
new file mode 100644 (file)
index 0000000..3901ec3
--- /dev/null
@@ -0,0 +1,64 @@
+function ged_polyline(h)
+    global ged_handle; ged_handle=h
+
+    if (h.clip_box==[])
+        TCL_SetVar("old_Xclipbox","")
+        TCL_SetVar("old_Yclipbox","")
+        TCL_SetVar("old_Wclipbox","")
+        TCL_SetVar("old_Hclipbox","")
+        TCL_SetVar("Xclipbox","")
+        TCL_SetVar("Yclipbox","")
+        TCL_SetVar("Wclipbox","")
+        TCL_SetVar("Hclipbox","")
+    else
+        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
+        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
+    end
+    TCL_SetVar("curclipstate",h.clip_state);
+
+    f=h;while stripblanks(f.type)<>"Figure" then f=f.parent,end
+    TCL_SetVar("ncolors",string(size(f.color_map,1)))
+    TCL_SetVar("curcolor",string(h.foreground))
+    TCL_SetVar("curback",string(h.background))
+    TCL_SetVar("curthick",string(h.thickness))
+    TCL_SetVar("curarrowsizefactor",string(h.arrow_size_factor))
+    TCL_SetVar("curvis",h.visible)
+
+    ged_polylinestylearray=["interpolated" "staircase" "barplot" "arrowed" "filled" "bar"];
+    TCL_SetVar("curpolylinestyle",ged_polylinestylearray(max(h.polyline_style,1)))
+    ged_linestylearray=["solid" "dash" "dash dot" "longdash dot" "bigdash dot" "bigdash longdash" "dot" "double dot"];
+    TCL_SetVar("curlinestyle",ged_linestylearray(max(h.line_style,1)))
+    ged_markstylearray=["dot" "plus" "cross" "star" "filled diamond" ..
+    "diamond" "triangle up" "triangle down" "diamond plus" "circle" ..
+    "asterisk" "square" "triangle right" "triangle left" "pentagram"];
+
+    TCL_SetVar("curmarkstyle",ged_markstylearray(abs(h.mark_style)+1))
+    TCL_SetVar("curmarkmode",h.mark_mode)
+    TCL_SetVar("curmarksize",string(h.mark_size))
+    TCL_SetVar("curmarksizeunit",h.mark_size_unit);
+    TCL_SetVar("curmarkforeground",string(h.mark_foreground))
+    TCL_SetVar("curmarkbackground",string(h.mark_background))
+
+    TCL_SetVar("curlinemode",h.line_mode)
+    TCL_SetVar("curclosedmode",h.closed)
+    TCL_SetVar("curfillmode",h.fill_mode)
+    TCL_SetVar("curinterpcolormode",h.interp_color_mode)
+    TCL_SetVar("curinterpcolorvector",sci2exp(h.interp_color_vector,0))
+
+    d="["+strcat(string(size(h.data)),"x")+" double array]"
+    TCL_SetVar("curdata",d);
+
+    select get(getparaxe(h),"view")
+    case "2d"
+        TCL_SetVar("nbcol",string(2));
+    case "3d"
+        TCL_SetVar("nbcol",string(3));
+    end
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Polyline.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_rectangle.sci b/scilab/modules/tclsci/macros/ged_rectangle.sci
new file mode 100644 (file)
index 0000000..61d44e3
--- /dev/null
@@ -0,0 +1,66 @@
+function ged_rectangle(h)
+    global ged_handle; ged_handle=h
+    if (h.clip_box==[])
+        TCL_SetVar("old_Xclipbox","")
+        TCL_SetVar("old_Yclipbox","")
+        TCL_SetVar("old_Wclipbox","")
+        TCL_SetVar("old_Hclipbox","")
+        TCL_SetVar("Xclipbox","")
+        TCL_SetVar("Yclipbox","")
+        TCL_SetVar("Wclipbox","")
+        TCL_SetVar("Hclipbox","")
+    else
+        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
+        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
+    end
+    TCL_SetVar("curclipstate",h.clip_state);
+
+    f=h;while stripblanks(f.type)<>"Figure" then f=f.parent,end
+    ax=h;while stripblanks(ax.type)<>"Axes" then ax=ax.parent,end
+    TCL_SetVar("ncolors",string(size(f.color_map,1)))
+    TCL_SetVar("curcolor",string(h.foreground))
+    TCL_SetVar("curback",string(h.background))
+    TCL_SetVar("curthick",string(h.thickness))
+    TCL_SetVar("curvis",h.visible)
+    ged_linestylearray=["solid" "dash" "dash dot" "longdash dot" "bigdash dot" "bigdash longdash" "dot" "double dot"];
+    TCL_SetVar("curlinestyle",ged_linestylearray(max(h.line_style,1)))
+    ged_markstylearray=["dot" "plus" "cross" "star" "filled diamond" ..
+    "diamond" "triangle up" "triangle down" "diamond plus" "circle" ..
+    "asterisk" "square" "triangle right" "triangle left" "pentagram"];
+    TCL_SetVar("curmarkstyle",ged_markstylearray(abs(h.mark_style)+1))
+    TCL_SetVar("curmarkmode",h.mark_mode)
+    TCL_SetVar("curmarksize",string(h.mark_size))
+    TCL_SetVar("curmarksizeunit",h.mark_size_unit);
+    TCL_SetVar("curmarkforeground",string(h.mark_foreground))
+    TCL_SetVar("curmarkbackground",string(h.mark_background))
+
+
+    TCL_SetVar("curlinemode",h.line_mode)
+    TCL_SetVar("curfillmode",h.fill_mode)
+    // Rectangle data
+    select ax.view
+    case "2d"
+        drawlater();
+        ax.view="3d"
+        TCL_SetVar("Xval",string(h.data(1)))
+        TCL_SetVar("Yval",string(h.data(2)))
+        TCL_SetVar("Zval",string(h.data(3)))
+        TCL_SetVar("Wval",string(h.data(4)))
+        TCL_SetVar("Hval",string(h.data(5)))
+        ax.view="2d"
+        drawnow();
+    case "3d"
+        TCL_SetVar("Xval",string(h.data(1)))
+        TCL_SetVar("Yval",string(h.data(2)))
+        TCL_SetVar("Zval",string(h.data(3)))
+        TCL_SetVar("Wval",string(h.data(4)))
+        TCL_SetVar("Hval",string(h.data(5)))
+    end
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Rectangle.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_segs.sci b/scilab/modules/tclsci/macros/ged_segs.sci
new file mode 100644 (file)
index 0000000..3d6a6e6
--- /dev/null
@@ -0,0 +1,55 @@
+function ged_segs(h)
+    global ged_handle; ged_handle=h
+    TCL_SetVar("curvis",h.visible)
+    TCL_SetVar("ncolors",string(size(f.color_map,1)))
+    TCL_SetVar("curarrowsize",string(h.arrow_size))
+    TCL_SetVar("curthick",string(h.thickness))
+    ged_linestylearray=["solid" "dash" "dash dot" "longdash dot" "bigdash dot" "bigdash longdash" "dot" "double dot"];
+    TCL_SetVar("curlinestyle",ged_linestylearray(max(h.line_style,1)))
+
+    ged_markstylearray=["dot" "plus" "cross" "star" "filled diamond" ..
+    "diamond" "triangle up" "triangle down" "diamond plus" "circle" ..
+    "asterisk" "square" "triangle right" "triangle left" "pentagram"];
+
+    TCL_SetVar("curmarkstyle",ged_markstylearray(abs(h.mark_style)+1))
+    TCL_SetVar("curmarkmode",h.mark_mode)
+    TCL_SetVar("curmarksize",string(h.mark_size))
+    TCL_SetVar("curmarksizeunit",h.mark_size_unit);
+    TCL_SetVar("curmarkforeground",string(h.mark_foreground))
+    TCL_SetVar("curmarkbackground",string(h.mark_background))
+    TCL_SetVar("curlinemode",h.line_mode)
+
+    TCL_SetVar("nbrow",string(size(h.data,1)))
+
+    d="["+strcat(string(size(h.data)),"x")+" double array]"
+    TCL_SetVar("curdata",d);
+
+    TCL_SetVar("nbcolsegscolor",string(size(h.segs_color,2)))
+    for i=1:size(h.segs_color,2)
+        val= "segscolorVAL("+string(i)+")";
+        TCL_EvalStr("set "+val+" "+string(h.segs_color(i)));
+    end
+
+    if (h.clip_box==[])
+        TCL_SetVar("old_Xclipbox","")
+        TCL_SetVar("old_Yclipbox","")
+        TCL_SetVar("old_Wclipbox","")
+        TCL_SetVar("old_Hclipbox","")
+        TCL_SetVar("Xclipbox","")
+        TCL_SetVar("Yclipbox","")
+        TCL_SetVar("Wclipbox","")
+        TCL_SetVar("Hclipbox","")
+    else
+        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
+        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
+    end
+    TCL_SetVar("curclipstate",h.clip_state);
+
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Segs.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_select_axes.sci b/scilab/modules/tclsci/macros/ged_select_axes.sci
new file mode 100644 (file)
index 0000000..c846260
--- /dev/null
@@ -0,0 +1,20 @@
+function axes =  ged_select_axes(x,y)
+    // x and y are pixel coord.
+    f=gcf()
+    nb_axes = size(f.children,"*") // for now Iconsider that children of a figure are of type Axes
+    axes_size = f.axes_size // given in pixels
+    axes_size = [axes_size axes_size];
+
+    for i=1:nb_axes
+        axes = f.children(i);
+        cur_axes_bounds = axes.axes_bounds;
+        rect = cur_axes_bounds.*axes_size; // rectangle in pixels (margins inside)
+
+        rect(3) = rect(3) + rect(1);
+        rect(4) = rect(4) + rect(2);
+        if (x>rect(1) & x<rect(3) & y>rect(2) & y<rect(4)) then
+            return
+        end
+    end
+    axes=[]
+endfunction
diff --git a/scilab/modules/tclsci/macros/ged_text.sci b/scilab/modules/tclsci/macros/ged_text.sci
new file mode 100644 (file)
index 0000000..6715961
--- /dev/null
@@ -0,0 +1,55 @@
+function ged_text(h)
+    global ged_handle; ged_handle=h
+    f=h;while stripblanks(f.type)<>"Figure" then f=f.parent,end
+    TCL_SetVar("curvis",h.visible)
+    TCL_SetVar("ncolors",string(size(f.color_map,1)))
+    TCL_SetVar("curfontforeground",string(h.font_foreground))
+    ged_fontarray = ["Monospaced" "Symbol" "Serif",..
+    "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
+    "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
+    "SansSerif Bold Italic"];
+    TCL_SetVar("curfontstyle",ged_fontarray(h.font_style+1))
+    TCL_SetVar("curfontsize",string(h.font_size))
+    TCL_SetVar("curfontangle",string(h.font_angle))
+    TCL_SetVar("curtextboxmode",h.text_box_mode)
+    TCL_SetVar("curtext",h.text)
+    TCL_SetVar("curforeground",string(h.foreground))
+    TCL_SetVar("curbackground",string(h.background))
+    TCL_SetVar("curboxmode",h.box)
+    TCL_SetVar("curlinemode",h.line_mode);
+    TCL_SetVar("curfillmode",h.fill_mode);
+    //TCL_SetVar("curPosition",h.data) ;
+
+    if (h.clip_box==[])
+        TCL_SetVar("old_Xclipbox","")
+        TCL_SetVar("old_Yclipbox","")
+        TCL_SetVar("old_Wclipbox","")
+        TCL_SetVar("old_Hclipbox","")
+        TCL_SetVar("Xclipbox","")
+        TCL_SetVar("Yclipbox","")
+        TCL_SetVar("Wclipbox","")
+        TCL_SetVar("Hclipbox","")
+    else
+        TCL_SetVar("old_Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("old_Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("old_Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("old_Hclipbox",string(h.clip_box(4)))
+        TCL_SetVar("Xclipbox",string(h.clip_box(1)))
+        TCL_SetVar("Yclipbox",string(h.clip_box(2)))
+        TCL_SetVar("Wclipbox",string(h.clip_box(3)))
+        TCL_SetVar("Hclipbox",string(h.clip_box(4)))
+    end
+    TCL_SetVar("curclipstate",h.clip_state);
+
+    if size(h.text,"*") == 1 then
+        txt =""""+ h.text +"""" ; // one double quote at each side
+    else
+        txt = "["+strcat(string(size(h.text)),"x")+" string array]"
+    end
+    TCL_SetVar("curtext", txt );
+    TCL_SetVar( "textBoxWidth", string( h.text_box(1) ) ) ;
+    TCL_SetVar("textBoxHeight", string( h.text_box(2) ) ) ;
+    TCL_SetVar("curAlignment",string(h.alignment) ) ;
+
+    TCL_EvalFile(SCI+"/modules/graphics/tcl/ged/Text.tcl")
+endfunction
diff --git a/scilab/modules/tclsci/macros/getparaxe.sci b/scilab/modules/tclsci/macros/getparaxe.sci
new file mode 100644 (file)
index 0000000..d68ce59
--- /dev/null
@@ -0,0 +1,10 @@
+function [haxe] = getparaxe( h )
+
+    htmp = h;
+    haxe = [];
+    while htmp.type<>"Axes" do
+        htmp = htmp.parent
+    end
+
+    haxe = htmp;
+endfunction
diff --git a/scilab/modules/tclsci/macros/getparfig.sci b/scilab/modules/tclsci/macros/getparfig.sci
new file mode 100644 (file)
index 0000000..16f2dcc
--- /dev/null
@@ -0,0 +1,19 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution.  The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function  hfig= getparfig( h )
+
+    htmp = h;
+    hfig= []
+
+    while htmp.type<>"Figure" do
+        htmp=htmp.parent
+    end
+
+    hfig = htmp;
+endfunction
diff --git a/scilab/modules/tclsci/macros/is_in_text.sci b/scilab/modules/tclsci/macros/is_in_text.sci
new file mode 100644 (file)
index 0000000..1cc6b77
--- /dev/null
@@ -0,0 +1,17 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function r=is_in_text(h,xy)
+    if h.Type == "Text" & h.text_box_mode=="filled" then
+        r=(xy(1)>h.data(1)&xy(1)<h.data(1)+h.text_box(1))&(xy(2)>h.data(2)&xy(2)<h.data(2)+h.text_box(2))
+    else
+        r = stringbox(h);
+        r=[r r(:,1)];
+        r=and([xy(2) -xy(1)]*diff(r,1,2)+(r(1,1:$-1).*r(2,2:$)-r(1,2:$).*r(2,1:$-1))<0)
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/pixDist2Arc.sci b/scilab/modules/tclsci/macros/pixDist2Arc.sci
new file mode 100644 (file)
index 0000000..091d6f3
--- /dev/null
@@ -0,0 +1,20 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// same as before but return the value in pixels
+function dist = pixDist2Arc( point, upperLeft, width, heigth, sector1, sector2 )
+
+    [dist, difference] = dist2Arc( point, upperLeft, width, heigth, sector1, sector2 ) ;
+    // convert to pixels
+    // get the length of the difference vector
+    // we construct it by getting two points
+    [origin(1),origin(2)] = xchange(0,0,"f2i");
+    [extremity(1),extremity(2)] = xchange(difference(1),difference(2),"f2i");
+    dist = norm( extremity - origin ) ;
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/set3dtlistXYZ.sci b/scilab/modules/tclsci/macros/set3dtlistXYZ.sci
new file mode 100644 (file)
index 0000000..7c5a9b2
--- /dev/null
@@ -0,0 +1,15 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+//Plot3d
+function set3dtlistXYZ (X,Y,Z)
+    global ged_handle; h=ged_handle
+    ged_tmp_tlist = tlist(["3d","x","y","z"],X,Y,Z)
+    h.data=ged_tmp_tlist;
+    clear ged_tmp_tlist;
+endfunction
diff --git a/scilab/modules/tclsci/macros/set3dtlistXYZC.sci b/scilab/modules/tclsci/macros/set3dtlistXYZC.sci
new file mode 100644 (file)
index 0000000..0df8e08
--- /dev/null
@@ -0,0 +1,15 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function set3dtlistXYZC (X,Y,Z,COLOR)
+    global ged_handle; h=ged_handle
+    ged_tmp_tlist = tlist(["3d","x","y","z","color"],X,Y,Z,COLOR)
+    h.data=ged_tmp_tlist;
+    clear ged_tmp_tlist;
+endfunction
diff --git a/scilab/modules/tclsci/macros/setA1val.sci b/scilab/modules/tclsci/macros/setA1val.sci
new file mode 100644 (file)
index 0000000..c70f6de
--- /dev/null
@@ -0,0 +1,34 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+// complement for Arc entity
+function setA1val(val)
+    global ged_handle; h=ged_handle
+    ax=getparaxe(h);
+    select ax.view
+    case "2d"
+        drawlater();
+        ax.view="3d";
+        tmp=h.data;
+        tmp(6)=val;
+        tst=execstr("h.data=tmp","errcatch","n");
+        ax.view="2d";
+        drawnow();
+        if tst<>0 then
+            disp "Warning: Width data must contain double"
+        end
+    case "3d"
+        tmp=h.data;
+        tmp(6)=val;
+        tst=execstr("h.data=tmp","errcatch","n");
+        if tst<>0 then
+            disp "Warning: a1 data must contain double"
+        end
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/setA2val.sci b/scilab/modules/tclsci/macros/setA2val.sci
new file mode 100644 (file)
index 0000000..be59a52
--- /dev/null
@@ -0,0 +1,33 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function setA2val(val)
+    global ged_handle; h=ged_handle
+    ax=getparaxe(h);
+    select ax.view
+    case "2d"
+        drawlater();
+        ax.view="3d";
+        tmp=h.data;
+        tmp(7)=val;
+        tst=execstr("h.data=tmp","errcatch","n");
+        ax.view="2d";
+        drawnow();
+        if tst<>0 then
+            disp "Warning: Width data must contain double"
+        end
+    case "3d"
+        tmp=h.data;
+        tmp(7)=val;
+        tst=execstr("h.data=tmp","errcatch","n");
+        if tst<>0 then
+            disp "Warning: a2 data must contain double"
+        end
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/setFontStyle.sci b/scilab/modules/tclsci/macros/setFontStyle.sci
new file mode 100644 (file)
index 0000000..f4e4eab
--- /dev/null
@@ -0,0 +1,15 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function setFontStyle(ftn)
+    global ged_handle; h=ged_handle
+    h.font_style=find(ftn==["Monospaced" "Symbol" "Serif",..
+    "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
+    "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
+    "SansSerif Bold Italic"])-1;
+endfunction
diff --git a/scilab/modules/tclsci/macros/setGrayplottlist.sci b/scilab/modules/tclsci/macros/setGrayplottlist.sci
new file mode 100644 (file)
index 0000000..6759533
--- /dev/null
@@ -0,0 +1,15 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function setGrayplottlist(X,Y,Z)
+    global ged_handle; h=ged_handle
+    ged_tmp_tlist = tlist(["grayplotdata","x","y","z"],X,Y,Z)
+    h.data=ged_tmp_tlist;
+    clear ged_tmp_tlist;
+endfunction
diff --git a/scilab/modules/tclsci/macros/setHval.sci b/scilab/modules/tclsci/macros/setHval.sci
new file mode 100644 (file)
index 0000000..af1fcfc
--- /dev/null
@@ -0,0 +1,33 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function setHval(val)
+    global ged_handle; h=ged_handle
+    ax=getparaxe(h);
+    select ax.view
+    case "2d"
+        drawlater();
+        ax.view="3d";
+        tmp=h.data;
+        tmp(5)=val;
+        tst=execstr("h.data=tmp","errcatch","n");
+        ax.view="2d";
+        drawnow();
+        if tst<>0 then
+            disp "Warning: Height data must contain double"
+        end
+    case "3d"
+        tmp=h.data;
+        tmp(5)=val;
+        tst=execstr("h.data=tmp","errcatch","n");
+        if tst<>0 then
+            disp "Warning: Height data must contain double"
+        end
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/setLabelsFontStyle.sci b/scilab/modules/tclsci/macros/setLabelsFontStyle.sci
new file mode 100644 (file)
index 0000000..67549a1
--- /dev/null
@@ -0,0 +1,35 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function setLabelsFontStyle(label,ftn)
+    global ged_handle; h=ged_handle
+    select label
+    case "t"
+        TCL_EvalStr("Notebook:raise $uf.n Z");
+        h.title.font_style=find(ftn==["Monospaced" "Symbol" "Serif",..
+        "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
+        "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
+        "SansSerif Bold Italic"])-1;
+    case "x"
+        h.x_label.font_style=find(ftn==["Monospaced" "Symbol" "Serif",..
+        "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
+        "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
+        "SansSerif Bold Italic"])-1;
+    case "y"
+        h.y_label.font_style=find(ftn==["Monospaced" "Symbol" "Serif",..
+        "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
+        "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
+        "SansSerif Bold Italic"])-1;
+    case "z"
+        h.z_label.font_style=find(ftn==["Monospaced" "Symbol" "Serif",..
+        "Serif Italic" "Serif Bold" "Serif Bold Italic" ,..
+        "SansSerif"  "SansSerif Italic" "SansSerif Bold",..
+        "SansSerif Bold Italic"])-1;
+    end;
+endfunction
+
diff --git a/scilab/modules/tclsci/macros/setLineStyle.sci b/scilab/modules/tclsci/macros/setLineStyle.sci
new file mode 100644 (file)
index 0000000..888a4e4
--- /dev/null
@@ -0,0 +1,14 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function setLineStyle(sty)
+    global ged_handle; h=ged_handle
+    h.line_style=find(sty==[ "solid" "dash" "dash dot" "longdash dot" ..
+    "bigdash dot" "bigdash longdash" "dot" "double dot"])
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/setMarkStyle.sci b/scilab/modules/tclsci/macros/setMarkStyle.sci
new file mode 100644 (file)
index 0000000..4624cd7
--- /dev/null
@@ -0,0 +1,14 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function setMarkStyle(sty)
+    global ged_handle; h=ged_handle
+    h.mark_style=find(sty==["dot" "plus" "cross" "star" "filled diamond" ..
+    "diamond" "triangle up" "triangle down" "diamond plus" "circle" ..
+    "asterisk" "square" "triangle right" "triangle left" "pentagram"])-1
+endfunction
diff --git a/scilab/modules/tclsci/macros/setStyle.sci b/scilab/modules/tclsci/macros/setStyle.sci
new file mode 100644 (file)
index 0000000..0c19ae8
--- /dev/null
@@ -0,0 +1,13 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function setStyle(sty)
+    global ged_handle; h=ged_handle
+    h.polyline_style=find(sty==["interpolated","staircase", ...
+    "barplot","arrowed","filled" "bar"])
+endfunction
diff --git a/scilab/modules/tclsci/macros/setTicksTList.sci b/scilab/modules/tclsci/macros/setTicksTList.sci
new file mode 100644 (file)
index 0000000..09551ae
--- /dev/null
@@ -0,0 +1,23 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function setTicksTList(XYZ,locations,labels)
+    global ged_handle;h= ged_handle;
+
+    TL=tlist(["ticks","locations","labels"],locations,labels);
+
+    if XYZ=="X"
+        h.x_ticks=TL;
+    elseif XYZ=="Y"
+        h.y_ticks=TL;
+    elseif XYZ=="Z"
+        h.z_ticks=TL;
+    end
+
+endfunction
diff --git a/scilab/modules/tclsci/macros/setWval.sci b/scilab/modules/tclsci/macros/setWval.sci
new file mode 100644 (file)
index 0000000..54f955e
--- /dev/null
@@ -0,0 +1,32 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function setWval(val)
+    global ged_handle; h=ged_handle
+    ax=getparaxe(h);
+    select ax.view
+    case "2d"
+        drawlater();
+        ax.view="3d";
+        tmp=h.data;
+        tmp(4)=val;
+        tst=execstr("h.data=tmp","errcatch","n");
+        ax.view="2d";
+        drawnow();
+        if tst<>0 then
+            disp "Warning: Width data must contain double"
+        end
+    case "3d"
+        tmp=h.data;
+        tmp(4)=val;
+        tst=execstr("h.data=tmp","errcatch","n");
+        if tst<>0 then
+            disp "Warning: Width data must contain double"
+        end
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/setXdb.sci b/scilab/modules/tclsci/macros/setXdb.sci
new file mode 100644 (file)
index 0000000..99d6d08
--- /dev/null
@@ -0,0 +1,20 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Axes data (data_bounds)
+function setXdb(xmin, xmax)
+    global ged_handle; h=ged_handle
+    tmp=h.data_bounds;
+    tmp(1,1)=xmin;
+    tmp(2,1)=xmax;
+    h.data_bounds=tmp;
+    //  tst=execstr('h.data_bounds=tmp','errcatch','n');
+    //  if tst<>0 then
+    //   disp 'Warning: X data_bounds must contain double'
+    //  end
+endfunction
diff --git a/scilab/modules/tclsci/macros/setXval.sci b/scilab/modules/tclsci/macros/setXval.sci
new file mode 100644 (file)
index 0000000..62a551c
--- /dev/null
@@ -0,0 +1,18 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+// Rectangle data
+function setXval(val)
+    global ged_handle; h=ged_handle
+    tmp=h.data;
+    tmp(1)=val;
+    tst=execstr("h.data=tmp","errcatch","n");
+    if tst<>0 then
+        disp "Warning: Y data must contain double"
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/setYdb.sci b/scilab/modules/tclsci/macros/setYdb.sci
new file mode 100644 (file)
index 0000000..d18534a
--- /dev/null
@@ -0,0 +1,19 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function setYdb(ymin, ymax)
+    global ged_handle; h=ged_handle
+    tmp=h.data_bounds;
+    tmp(1,2)=ymin;
+    tmp(2,2)=ymax;
+    h.data_bounds=tmp;
+    //  tst=execstr('h.data_bounds=tmp','errcatch','n');
+    //  if tst<>0 then
+    //   disp 'Warning: Y data_bounds must contain double'
+    //  end
+endfunction
diff --git a/scilab/modules/tclsci/macros/setYval.sci b/scilab/modules/tclsci/macros/setYval.sci
new file mode 100644 (file)
index 0000000..331c50b
--- /dev/null
@@ -0,0 +1,18 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function setYval(val)
+    global ged_handle; h=ged_handle
+    tmp=h.data;
+    tmp(2)=val;
+    tst=execstr("h.data=tmp","errcatch","n");
+    if tst<>0 then
+        disp "Warning: Y data must contain double"
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/setZb.sci b/scilab/modules/tclsci/macros/setZb.sci
new file mode 100644 (file)
index 0000000..6b48386
--- /dev/null
@@ -0,0 +1,20 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+//Fec
+function setZb(min, max)
+    global ged_handle; h=ged_handle
+    tmp=h.z_bounds;
+    tmp(1,1)=min;
+    tmp(1,2)=max;
+    tst=execstr("h.z_bounds=tmp","errcatch","n");
+    if tst<>0 then
+        disp "Warning: X data_bounds must contain double"
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/setZdb.sci b/scilab/modules/tclsci/macros/setZdb.sci
new file mode 100644 (file)
index 0000000..2dcf8cb
--- /dev/null
@@ -0,0 +1,37 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function setZdb(zmin, zmax)
+    global ged_handle; h=ged_handle
+    select h.view
+    case "2d"
+        drawlater();
+        h.view="3d";
+        tmp=h.data_bounds;
+        tmp(1,3)=zmin;
+        tmp(2,3)=zmax;
+        h.data_bounds=tmp;
+        h.view="2d";
+        drawnow();
+        //      tst=execstr('h.data_bounds=tmp','errcatch','n');
+        //      h.view='2d';
+        //      if tst<>0 then
+        //       disp 'Warning: Z data_bounds must contain double'
+        //      end
+    case "3d"
+        tmp=h.data_bounds;
+        tmp(1,3)=zmin;
+        tmp(2,3)=zmax;
+        h.data_bounds=tmp;
+        //      tst=execstr('h.data_bounds=tmp','errcatch','n');
+        //      if tst<>0 then
+        //        disp 'Warning: Z data_bounds must contain double'
+        //      end
+    end
+endfunction
diff --git a/scilab/modules/tclsci/macros/setZval.sci b/scilab/modules/tclsci/macros/setZval.sci
new file mode 100644 (file)
index 0000000..1bab9e3
--- /dev/null
@@ -0,0 +1,34 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function setZval(val)
+    global ged_handle; h=ged_handle
+    ax=getparaxe(h);
+    select ax.view
+    case "2d"
+        drawlater();
+        ax.view="3d";
+        tmp=h.data;
+        tmp(3)=val;
+        tst=execstr("h.data=tmp","errcatch","n");
+        ax.view="2d";
+        drawnow();
+        if tst<>0 then
+            disp "Warning: Z data must contain double"
+        end
+    case "3d"
+        tmp=h.data;
+        tmp(3)=val;
+        tst=execstr("h.data=tmp","errcatch","n");
+        if tst<>0 then
+            disp "Warning: Z data must contain double"
+        end
+    end
+endfunction
+
diff --git a/scilab/modules/tclsci/macros/setchamptlistXYFXFY.sci b/scilab/modules/tclsci/macros/setchamptlistXYFXFY.sci
new file mode 100644 (file)
index 0000000..2744f84
--- /dev/null
@@ -0,0 +1,16 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+//Champ
+function setchamptlistXYFXFY (X,Y,FX,FY)
+    global ged_handle; h=ged_handle
+    ged_tmp_tlist = tlist(["champdata","x","y","fx","fy"],X,Y,FX,FY)
+    h.data=ged_tmp_tlist;
+    clear ged_tmp_tlist;
+endfunction
diff --git a/scilab/modules/tclsci/macros/tkged.sci b/scilab/modules/tclsci/macros/tkged.sci
new file mode 100644 (file)
index 0000000..42dc1c7
--- /dev/null
@@ -0,0 +1,83 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+function tkged()
+    global ged_handle
+    global ged_cur_fig_handle
+
+    h=ged_handle
+
+    // hierarchical viewer
+    TK_send_handles_list(ged_cur_fig_handle)
+    TCL_SetVar("curgedindex",string(Get_handle_pos_in_list(h)))
+
+    //color_map array for color sample display
+    f=getparfig(h);
+    for i=1:size(f.color_map,1)
+        redname= "RED("+string(i)+")";
+        TCL_EvalStr("set "+redname+" "+string(f.color_map(i,1)));
+        grename= "GREEN("+string(i)+")";
+        TCL_EvalStr("set "+grename+" "+string(f.color_map(i,2)));
+        bluname= "BLUE("+string(i)+")";
+        TCL_EvalStr("set "+bluname+" "+string(f.color_map(i,3)));
+    end
+
+    TCL_SetVar("msdos",string(getos() == "Windows")) // to know the OS
+
+    // get the number of the window associated with ged
+    TCL_SetVar("sciGedIsAlive",string(ged_cur_fig_handle.figure_id)) ;
+    TCL_SetVar("SCIHOME", SCIHOME) // to know the home directory to put temporary files
+
+    select h.type
+    case "Polyline"
+        ged_polyline(h)
+    case "Rectangle"
+        ged_rectangle(h)
+    case "Axes"
+        ged_axes(h)
+    case "Label" // for now the labels are inside the axes (F.Leray 06.12.05)
+        ged_axes(h.parent)
+        if (h == h.parent.x_label)
+            TCL_EvalStr("Notebook:raise $uf.n X");
+        elseif (h == h.parent.y_label)
+            TCL_EvalStr("Notebook:raise $uf.n Y");
+        elseif (h == h.parent.z_label)
+            TCL_EvalStr("Notebook:raise $uf.n Z");
+        elseif (h == h.parent.title)
+            TCL_EvalStr("Notebook:raise $uf.n Title");
+        end
+    case "Figure"
+        ged_figure(h)
+    case "Compound"
+        ged_Compound(h)
+
+    case "Plot3d"
+        ged_plot3d(h)
+    case "Fac3d"
+        ged_fac3d(h)
+    case "Text"
+        ged_text(h)
+    case "Legend"
+        ged_legend(h)
+    case "Arc"
+        ged_arc(h)
+    case "Segs"
+        ged_segs(h)
+    case "Champ"
+        ged_champ(h)
+    case "Fec"
+        ged_fec(h)
+    case "Grayplot"
+        ged_grayplot(h)
+    case "Matplot"
+        ged_matplot(h)
+    case "Axis"
+        ged_axis(h)
+    end
+endfunction
+
index 44fabf3..e77b0bb 100644 (file)
 #include "localization.h"
 #include "InitializeTclTk.h"
 #include "GlobalTclInterp.h"
+#include "api_scilab.h"
 /*--------------------------------------------------------------------------*/
-int sci_TCL_DeleteInterp(char *fname, unsigned long l)
+int sci_TCL_DeleteInterp(char *fname, void* pvApiCtx)
 {
-    /*    CheckRhs(0, 1);
-        CheckLhs(1, 1);
+    SciErr sciErr;
 
-        if (Rhs == 1)
+    int* piAddrl2 = NULL;
+    char* l2 = NULL;
+
+    CheckInputArgument(pvApiCtx, 0, 1);
+    CheckOutputArgument(pvApiCtx, 1, 1);
+
+    if (nbInputArgument(pvApiCtx) == 1)
+    {
+
+        if (!existsGlobalInterp())
         {
+            Scierror(999, _("%s: Error main TCL interpreter not initialized.\n"), fname);
+            return 0;
+        }
 
-            if (!existsGlobalInterp())
+        if (checkInputArgumentType(pvApiCtx, 1, sci_strings))
+        {
+            static int n2, m2;
+            Tcl_Interp *TCLinterpreter = NULL;
+
+            sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrl2);
+            if (sciErr.iErr)
             {
-                Scierror(999, _("%s: Error main TCL interpreter not initialized.\n"), fname);
-                return 0;
+                printError(&sciErr, 0);
+                return 1;
             }
 
-            if (GetType(1) == sci_strings)
+            // Retrieve a matrix of double at position 1.
+            if (getAllocatedSingleString(pvApiCtx, piAddrl2, &l2))
             {
-                static int l2, n2, m2;
-                Tcl_Interp *TCLinterpreter = NULL;
-
-                GetRhsVar(1, STRING_DATATYPE, &m2, &n2, &l2);
-                TCLinterpreter = Tcl_GetSlave(getTclInterp(), cstk(l2));
-                releaseTclInterp();
-                if (TCLinterpreter == NULL)
-                {
-                    Scierror(999, _("%s: No such slave interpreter.\n"), fname);
-                    return 0;
-                }
-                else
-                {
-                    Tcl_DeleteInterp(TCLinterpreter);
-                    TCLinterpreter = NULL;
-                }
+                Scierror(202, _("%s: Wrong type for argument #%d: A string expected.\n"), fname, 1);
+                return 1;
             }
-            else
+            TCLinterpreter = Tcl_GetSlave(getTclInterp(), (l2));
+            freeAllocatedSingleString(l2);
+            releaseTclInterp();
+            if (TCLinterpreter == NULL)
             {
-                Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 1);
+                Scierror(999, _("%s: No such slave interpreter.\n"), fname);
                 return 0;
             }
+            else
+            {
+                Tcl_DeleteInterp(TCLinterpreter);
+                TCLinterpreter = NULL;
+            }
         }
-        else // Rhs == 0
+        else
         {
-            releaseTclInterp();
-
-            CloseTCLsci();
-            InitializeTclTk();
+            Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 1);
+            return 0;
         }
+    }
+    else // nbInputArgument(pvApiCtx) == 0
+    {
+        releaseTclInterp();
+
+        CloseTCLsci();
+        InitializeTclTk();
+    }
+
+    AssignOutputVariable(pvApiCtx, 1) = 0;
+    ReturnArguments(pvApiCtx);
 
-        LhsVar(1) = 0;
-        PutLhsVar();
-    */
     return 0;
 }
 /*--------------------------------------------------------------------------*/
index a9487b6..45e121f 100644 (file)
 /*--------------------------------------------------------------------------*/
 #include "TCL_Global.h"
 #include "gw_tclsci.h"
+#include "api_scilab.h"
 /*--------------------------------------------------------------------------*/
-int sci_TCL_DoOneEvent (char *fname, unsigned long l)
+int sci_TCL_DoOneEvent (char *fname, void* pvApiCtx)
 {
-    /*    CheckRhs(0, 0);
-        CheckLhs(1, 1);
+    CheckInputArgument(pvApiCtx, 0, 0);
+    CheckOutputArgument(pvApiCtx, 1, 1);
 
-        // wait for events and invoke event handlers
-        Tcl_DoOneEvent(TCL_ALL_EVENTS | TCL_DONT_WAIT);
+    // wait for events and invoke event handlers
+    Tcl_DoOneEvent(TCL_ALL_EVENTS | TCL_DONT_WAIT);
 
-        LhsVar(1) = 0;
-        PutLhsVar();
-
-    */    return 0;
+    AssignOutputVariable(pvApiCtx, 1) = 0;
+    ReturnArguments(pvApiCtx);
+    return 0;
 }
 /*--------------------------------------------------------------------------*/
index d486348..8f9d743 100644 (file)
 #include "TCL_getErrorLine.h"
 #include "getshortpathname.h"
 
+#include "api_scilab.h"
 /*--------------------------------------------------------------------------*/
-int sci_TCL_EvalFile(char *fname, unsigned long l)
+int sci_TCL_EvalFile(char *fname, void* pvApiCtx)
 {
-    /*    execute Tcl scripts
-        int m1, n1, l1;
-        int m2, n2, l2;
-        int RET;
+    SciErr sciErr;
 
-        Tcl_Interp *TCLinterpreter = NULL;
+    int* piAddrl1 = NULL;
+    char* l1 = NULL;
+    int* piAddrl2 = NULL;
+    char* l2 = NULL;
 
-        CheckRhs(1, 2);
-        CheckLhs(1, 1);
+    int m1, n1;
+    int m2, n2;
+    int RET;
 
-        if (GetType(1) == sci_strings)
+    Tcl_Interp *TCLinterpreter = NULL;
+
+    CheckInputArgument(pvApiCtx, 1, 2);
+    CheckOutputArgument(pvApiCtx, 1, 1);
+
+    if (checkInputArgumentType(pvApiCtx, 1, sci_strings))
+    {
+        sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrl1);
+        if (sciErr.iErr)
         {
-            GetRhsVar(1, STRING_DATATYPE, &m1, &n1, &l1);
-            // Check if there is a global interpreter
-            TCLinterpreter = getTclInterp();
-            releaseTclInterp();
-            if (TCLinterpreter == NULL)
-            {
-                Scierror(999, _("%s: Error main TCL interpreter not initialized.\n"), fname);
-                return 0;
-            }
+            printError(&sciErr, 0);
+            return 1;
+        }
 
-            // Check if the file to load exists
-            if (!FileExist(cstk(l1)))
-            {
-                Scierror(999, _("%s: File %s not found.\n"), fname, cstk(l1));
-                return 0;
-            }
+        // Retrieve a matrix of double at position 1.
+        if (getAllocatedSingleString(pvApiCtx, piAddrl1, &l1))
+        {
+            Scierror(202, _("%s: Wrong type for argument #%d: A string expected.\n"), fname, 1);
+            return 1;
+        }
+
+        // Check if there is a global interpreter
+        TCLinterpreter = getTclInterp();
+        releaseTclInterp();
+        if (TCLinterpreter == NULL)
+        {
+            Scierror(999, _("%s: Error main TCL interpreter not initialized.\n"), fname);
+            freeAllocatedSingleString(l1);
+            return 0;
+        }
 
-            if (Rhs == 2)
+        // Check if the file to load exists
+        if (!FileExist((l1)))
+        {
+            Scierror(999, _("%s: File %s not found.\n"), fname, (l1));
+            freeAllocatedSingleString(l1);
+            return 0;
+        }
+
+        if (nbInputArgument(pvApiCtx) == 2)
+        {
+            // two arguments given - get a pointer on the slave interpreter
+            if (checkInputArgumentType(pvApiCtx, 2, sci_strings))
             {
-                // two arguments given - get a pointer on the slave interpreter
-                if (GetType(2) == sci_strings)
+                sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddrl2);
+                if (sciErr.iErr)
                 {
-                    GetRhsVar(2, STRING_DATATYPE, &m2, &n2, &l2);
-                    TCLinterpreter = Tcl_GetSlave(getTclInterp(), cstk(l2));
-                    releaseTclInterp();
-                    if (TCLinterpreter == NULL)
-                    {
-                        Scierror(999, _("%s: No such slave interpreter.\n"), fname);
-                        return 0;
-                    }
-
-                    {
-                        BOOL bOK = FALSE;
-                        char *sz = cstk(l1);
-                        char *szShort = getshortpathname(sz, &bOK);
-                        RET = sendTclFileToSlave(szShort, cstk(l2));
-                        FREE(szShort);
-                    }
+                    freeAllocatedSingleString(l1);
+                    printError(&sciErr, 0);
+                    return 1;
                 }
-                else
+
+                // Retrieve a matrix of double at position 2.
+                if (getAllocatedSingleString(pvApiCtx, piAddrl2, &l2))
                 {
-                    Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 2);
-                    return 0;
+                    freeAllocatedSingleString(l1);
+                    Scierror(202, _("%s: Wrong type for argument #%d: A string expected.\n"), fname, 2);
+                    return 1;
                 }
-            }
-            else
-            {
-                BOOL bOK = FALSE;
-                char *sz = cstk(l1);
-                char *szShort = getshortpathname(sz, &bOK);
-                RET = sendTclFile(szShort);
-                FREE(szShort);
-            }
 
-            if (RET == TCL_ERROR)
-            {
-                const char *trace = Tcl_GetVar(TCLinterpreter, "errorInfo", TCL_GLOBAL_ONLY);
-                if (Err > 0)
+                TCLinterpreter = Tcl_GetSlave(getTclInterp(), (l2));
+                releaseTclInterp();
+                if (TCLinterpreter == NULL)
                 {
-                    sciprint(_("%s, at line %i of file %s\n    %s.\n"), fname, TCL_getErrorLine(TCLinterpreter), cstk(l1), (char *)trace);
+                    freeAllocatedSingleString(l1);
+                    Scierror(999, _("%s: No such slave interpreter.\n"), fname);
+                    return 0;
                 }
-                else
+
                 {
-                    Scierror(999, _("%s, at line %i of file %s\n       %s.\n"), fname, TCL_getErrorLine(TCLinterpreter), cstk(l1), (char *)trace);
-                    return 0;
+                    BOOL bOK = FALSE;
+                    char *sz = (l1);
+                    char *szShort = getshortpathname(sz, &bOK);
+                    RET = sendTclFileToSlave(szShort, (l2));
+                    FREE(szShort);
                 }
+
+                freeAllocatedSingleString(l2);
+            }
+            else
+            {
+                freeAllocatedSingleString(l1);
+                Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 2);
+                return 0;
             }
         }
         else
         {
-            Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 2);
+            BOOL bOK = FALSE;
+            char *sz = (l1);
+            char *szShort = getshortpathname(sz, &bOK);
+            RET = sendTclFile(szShort);
+            FREE(szShort);
+        }
+
+        if (RET == TCL_ERROR)
+        {
+            const char *trace = Tcl_GetVar(TCLinterpreter, "errorInfo", TCL_GLOBAL_ONLY);
+            Scierror(999, _("%s, at line %i of file %s\n       %s.\n"), fname, TCL_getErrorLine(TCLinterpreter), (l1), (char *)trace);
+            freeAllocatedSingleString(l1);
             return 0;
         }
 
-        LhsVar(1) = 0;
-        PutLhsVar();
-    */    return 0;
+        freeAllocatedSingleString(l1);
+    }
+    else
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 2);
+        return 0;
+    }
+
+    AssignOutputVariable(pvApiCtx, 1) = 0;
+    ReturnArguments(pvApiCtx);
+    return 0;
 }
 /*--------------------------------------------------------------------------*/
index 743ce98..c6eecbd 100644 (file)
 /*--------------------------------------------------------------------------*/
 #include <stdio.h>
 #include <string.h>
+
 #include "gw_tclsci.h"
 #include "TCL_Command.h"
 #include "TCL_Global.h"
 #include "Scierror.h"
 #include "localization.h"
-#include "freeArrayOfString.h"
 #include "GlobalTclInterp.h"
 #include "os_string.h"
+#include "api_scilab.h"
+
 /*--------------------------------------------------------------------------*/
-int sci_TCL_EvalStr(char *fname, unsigned long l)
+int sci_TCL_EvalStr(char *fname, void* pvApiCtx)
 {
-    /*    CheckRhs(1, 2);
-        CheckLhs(1, 1);
+    SciErr sciErr;
+    int* piAddrStr = NULL;
+    int* piAddrl2 = NULL;
+    char* l2 = NULL;
+
+    CheckInputArgument(pvApiCtx, 1, 2);
+    CheckOutputArgument(pvApiCtx, 1, 1);
 
-        if (GetType(1) == sci_strings)
+    if (checkInputArgumentType(pvApiCtx, 1, sci_strings))
+    {
+        char *tclSlave = NULL;
+        char **Str = NULL;
+        int m1, n1, i;
+        int m2, n2;
+        char **ReturnArrayString = NULL;
+        int k = 0;
+        int tclInterpReturnValue;
+
+        sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrStr);
+        if (sciErr.iErr)
         {
-            char *tclSlave = NULL;
+            printError(&sciErr, 0);
+            return 1;
+        }
 
-            char **Str = NULL;
-            int m1, n1, i;
-            int m2, n2, l2;
-            char **ReturnArrayString = NULL;
-            int k = 0;
-            int tclInterpReturnValue;
+        // Retrieve a matrix of string at position 1.
+        if (getAllocatedMatrixOfString(pvApiCtx, piAddrStr, &m1, &n1, &Str))
+        {
+            Scierror(202, _("%s: Wrong type for argument #%d: String matrix expected.\n"), fname, 1);
+            return 1;
+        }
 
-            GetRhsVar(1, MATRIX_OF_STRING_DATATYPE, &m1, &n1, &Str);
+        if (!existsGlobalInterp())
+        {
+            freeAllocatedMatrixOfString(m1, n1, Str);
+            Scierror(999, _("%s: Error main TCL interpreter not initialized.\n"), fname);
+            return 0;
+        }
 
-            if (!existsGlobalInterp())
+        if (nbInputArgument(pvApiCtx) == 2)
+        {
+            // two arguments given - the slave interpreter name
+            if (checkInputArgumentType(pvApiCtx, 2, sci_strings))
             {
-                freeArrayOfString(Str, m1 * n1);
-                Scierror(999, _("%s: Error main TCL interpreter not initialized.\n"), fname);
-                return 0;
-            }
+                sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddrl2);
+                if (sciErr.iErr)
+                {
+                    printError(&sciErr, 0);
+                    return 1;
+                }
 
-            if (Rhs == 2)
-            {
-                // two arguments given - the slave interpreter name
-                if (GetType(2) == sci_strings)
+                // Retrieve a matrix of double at position 2.
+                if (getAllocatedSingleString(pvApiCtx, piAddrl2, &l2))
                 {
-                    GetRhsVar(2, STRING_DATATYPE, &m2, &n2, &l2);
-                    if (!existsSlaveInterp(cstk(l2)))
-                    {
-                        freeArrayOfString(Str, m1 * n1);
-                        Scierror(999, _("%s: No such slave interpreter.\n"), fname);
-                        return 0;
-                    }
-                    tclSlave =  os_strdup(cstk(l2));
+                    Scierror(202, _("%s: Wrong type for argument #%d: A string expected.\n"), fname, 2);
+                    return 1;
                 }
-                else
+
+                if (!existsSlaveInterp((l2)))
                 {
-                    freeArrayOfString(Str, m1 * n1);
-                    Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 2);
+                    freeAllocatedMatrixOfString(m1, n1, Str);
+                    Scierror(999, _("%s: No such slave interpreter.\n"), fname);
                     return 0;
                 }
+                tclSlave =  os_strdup((l2));
+                freeAllocatedSingleString(l2);
+            }
+            else
+            {
+                freeAllocatedMatrixOfString(m1, n1, Str);
+                Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 2);
+                return 0;
             }
+        }
+