very first server version, windows only 92/17792/1
Antoine ELIAS [Tue, 9 Feb 2016 22:09:37 +0000 (23:09 +0100)]
Change-Id: I4a491938f65f22a74f77085af89412efd935a136

38 files changed:
scilab/libs/sioclient/includes/sio_client.h [new file with mode: 0644]
scilab/libs/sioclient/includes/sio_message.h [new file with mode: 0644]
scilab/libs/sioclient/includes/sio_socket.h [new file with mode: 0644]
scilab/modules/ast/includes/system_env/configvariable.hxx
scilab/modules/ast/src/cpp/system_env/configvariable.cpp
scilab/modules/core/includes/version.h.in
scilab/modules/core/includes/version.h.vc
scilab/modules/core/src/c/core.vcxproj
scilab/modules/core/src/c/core.vcxproj.filters
scilab/modules/core/src/cpp/InitScilab.cpp
scilab/modules/core/src/cpp/webcommand.cpp [new file with mode: 0644]
scilab/modules/core/src/cpp/webcommand.hxx [new file with mode: 0644]
scilab/modules/graphic_objects/includes/FigureList.h
scilab/modules/graphic_objects/includes/ScilabWebView.hxx [new file with mode: 0644]
scilab/modules/graphic_objects/src/c/core_Import.def
scilab/modules/graphic_objects/src/c/graphic_objects.vcxproj
scilab/modules/graphic_objects/src/c/graphic_objects.vcxproj.filters
scilab/modules/graphic_objects/src/cpp/FigureList.cpp
scilab/modules/graphic_objects/src/cpp/ScilabWebView.cpp [new file with mode: 0644]
scilab/modules/graphic_objects/src/cpp/webutils.cpp [new file with mode: 0644]
scilab/modules/graphic_objects/src/cpp/webutils.hxx [new file with mode: 0644]
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/CallGraphicController.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/ScilabNativeWebView.java [new file with mode: 0644]
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/ScilabNativeWebViewJNI.java [new file with mode: 0644]
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicView/ScilabWebView.java [new file with mode: 0644]
scilab/modules/graphic_objects/src/jni/CallGraphicController.cpp
scilab/modules/graphic_objects/src/jni/CallGraphicController.hxx
scilab/modules/graphic_objects/src/jni/CallXmlLoader.cpp
scilab/modules/graphic_objects/src/jni/CallXmlLoader.hxx
scilab/modules/graphic_objects/src/jni/ScilabNativeWebView.i [new file with mode: 0644]
scilab/modules/graphic_objects/src/jni/ScilabNativeWebView_wrap.c [new file with mode: 0644]
scilab/modules/graphic_objects/src/jni/graphic_objects.giws.xml
scilab/modules/graphics/src/c/graphicModuleLoad.c
scilab/modules/startup/src/cpp/scilab.cpp
scilab/node/html/index.html [new file with mode: 0644]
scilab/node/scilab_process.js [new file with mode: 0644]
scilab/node/scilab_server.js [new file with mode: 0644]
scilab/node/windows-launcher.bat [new file with mode: 0644]

diff --git a/scilab/libs/sioclient/includes/sio_client.h b/scilab/libs/sioclient/includes/sio_client.h
new file mode 100644 (file)
index 0000000..1cf33ff
--- /dev/null
@@ -0,0 +1,89 @@
+//
+//  sio_client.h
+//
+//  Created by Melo Yao on 3/25/15.
+//
+
+#ifndef SIO_CLIENT_H
+#define SIO_CLIENT_H
+#include <string>
+#include <functional>
+#include "sio_message.h"
+#include "sio_socket.h"
+
+namespace sio
+{
+    class client_impl;
+    
+    class client {
+    public:
+        enum close_reason
+        {
+            close_reason_normal,
+            close_reason_drop
+        };
+        
+        typedef std::function<void(void)> con_listener;
+        
+        typedef std::function<void(close_reason const& reason)> close_listener;
+
+        typedef std::function<void(unsigned, unsigned)> reconnect_listener;
+        
+        typedef std::function<void(std::string const& nsp)> socket_listener;
+        
+        client();
+        ~client();
+        
+        //set listeners and event bindings.
+        void set_open_listener(con_listener const& l);
+        
+        void set_fail_listener(con_listener const& l);
+        
+        void set_reconnecting_listener(con_listener const& l);
+
+        void set_reconnect_listener(reconnect_listener const& l);
+
+        void set_close_listener(close_listener const& l);
+        
+        void set_socket_open_listener(socket_listener const& l);
+        
+        void set_socket_close_listener(socket_listener const& l);
+        
+        void clear_con_listeners();
+        
+        void clear_socket_listeners();
+        
+        // Client Functions - such as send, etc.
+        void connect(const std::string& uri);
+
+        void connect(const std::string& uri, const std::map<std::string,std::string>& query);
+
+        void set_reconnect_attempts(int attempts);
+
+        void set_reconnect_delay(unsigned millis);
+
+        void set_reconnect_delay_max(unsigned millis);
+        
+        sio::socket::ptr const& socket(const std::string& nsp = "");
+        
+        // Closes the connection
+        void close();
+        
+        void sync_close();
+        
+        bool opened() const;
+        
+        std::string const& get_sessionid() const;
+        
+    private:
+        //disable copy constructor and assign operator.
+        client(client const& cl){}
+        void operator=(client const& cl){}
+        
+        client_impl* m_impl;
+    };
+    
+}
+
+
+#endif // __SIO_CLIENT__H__
diff --git a/scilab/libs/sioclient/includes/sio_message.h b/scilab/libs/sioclient/includes/sio_message.h
new file mode 100644 (file)
index 0000000..17ba2ad
--- /dev/null
@@ -0,0 +1,406 @@
+//
+//  sio_message.h
+//
+//  Created by Melo Yao on 3/25/15.
+//
+
+#ifndef __SIO_MESSAGE_H__
+#define __SIO_MESSAGE_H__
+#include <string>
+#include <memory>
+#include <vector>
+#include <map>
+#include <cassert>
+#include <type_traits>
+namespace sio
+{
+    using namespace std;
+    
+    class message
+    {
+    public:
+        enum flag
+        {
+            flag_integer,
+            flag_double,
+            flag_string,
+            flag_binary,
+            flag_array,
+            flag_object,
+                       flag_boolean,
+                       flag_null
+        };
+
+               virtual ~message(){};
+        
+        class list;
+
+        flag get_flag() const
+        {
+            return _flag;
+        }
+        
+        typedef shared_ptr<message> ptr;
+
+               virtual bool get_bool() const
+               {
+                       assert(false);
+                       return false;
+               }
+        
+        virtual int64_t get_int() const
+        {
+            assert(false);
+            return 0;
+        }
+        
+        virtual double get_double() const
+        {
+            assert(false);
+            return 0;
+        }
+        
+        virtual string const& get_string() const
+        {
+            assert(false);
+            static string s_empty_string;
+            s_empty_string.clear();
+            return s_empty_string;
+        }
+        
+        virtual shared_ptr<const string> const& get_binary() const
+        {
+            assert(false);
+            static shared_ptr<const string> s_empty_binary;
+            s_empty_binary = nullptr;
+            return s_empty_binary;
+        }
+        
+        virtual const vector<ptr>& get_vector() const
+        {
+            assert(false);
+            static vector<ptr> s_empty_vector;
+            s_empty_vector.clear();
+            return s_empty_vector;
+        }
+
+        virtual vector<ptr>& get_vector()
+        {
+            assert(false);
+            static vector<ptr> s_empty_vector;
+            s_empty_vector.clear();
+            return s_empty_vector;
+        }
+        
+        virtual const map<string,message::ptr>& get_map() const
+        {
+            assert(false);
+            static map<string,message::ptr> s_empty_map;
+            s_empty_map.clear();
+            return s_empty_map;
+        }
+        
+        virtual map<string,message::ptr>& get_map()
+        {
+            assert(false);
+            static map<string,message::ptr> s_empty_map;
+            s_empty_map.clear();
+            return s_empty_map;
+        }
+    private:
+        flag _flag;
+        
+    protected:
+        message(flag f):_flag(f){}
+    };
+
+       class null_message : public message
+       {
+       protected:
+        null_message()
+                       :message(flag_null)
+        {
+        }
+
+       public:
+        static message::ptr create()
+        {
+            return ptr(new null_message());
+        }
+       };
+
+       class bool_message : public message
+       {
+               bool _v;
+
+       protected:
+        bool_message(bool v)
+            :message(flag_boolean),_v(v)
+        {
+        }
+        
+    public:
+        static message::ptr create(bool v)
+        {
+            return ptr(new bool_message(v));
+        }
+        
+        bool get_bool() const
+        {
+            return _v;
+        }
+       };
+    
+    class int_message : public message
+    {
+        int64_t _v;
+    protected:
+        int_message(int64_t v)
+            :message(flag_integer),_v(v)
+        {
+        }
+        
+    public:
+        static message::ptr create(int64_t v)
+        {
+            return ptr(new int_message(v));
+        }
+        
+        int64_t get_int() const
+        {
+            return _v;
+        }
+        
+        double get_double() const//add double accessor for integer.
+        {
+            return static_cast<double>(_v);
+        }
+    };
+    
+    class double_message : public message
+    {
+        double _v;
+        double_message(double v)
+            :message(flag_double),_v(v)
+        {
+        }
+        
+    public:
+        static message::ptr create(double v)
+        {
+            return ptr(new double_message(v));
+        }
+        
+        double get_double() const
+        {
+            return _v;
+        }
+    };
+    
+    class string_message : public message
+    {
+        string _v;
+        string_message(string const& v)
+            :message(flag_string),_v(v)
+        {
+        }
+
+        string_message(string&& v)
+            :message(flag_string),_v(move(v))
+        {
+        }
+    public:
+        static message::ptr create(string const& v)
+        {
+            return ptr(new string_message(v));
+        }
+
+        static message::ptr create(string&& v)
+        {
+            return ptr(new string_message(move(v)));
+        }
+        
+        string const& get_string() const
+        {
+            return _v;
+        }
+    };
+    
+    class binary_message : public message
+    {
+        shared_ptr<const string> _v;
+        binary_message(shared_ptr<const string> const& v)
+            :message(flag_binary),_v(v)
+        {
+        }
+    public:
+        static message::ptr create(shared_ptr<const string> const& v)
+        {
+            return ptr(new binary_message(v));
+        }
+        
+        shared_ptr<const string> const& get_binary() const
+        {
+            return _v;
+        }
+    };
+    
+    class array_message : public message
+    {
+        vector<message::ptr> _v;
+        array_message():message(flag_array)
+        {
+        }
+        
+    public:
+        static message::ptr create()
+        {
+            return ptr(new array_message());
+        }
+        
+        vector<ptr>& get_vector()
+        {
+            return _v;
+        }
+        
+        const vector<ptr>& get_vector() const
+        {
+            return _v;
+        }
+    };
+    
+    class object_message : public message
+    {
+        map<string,message::ptr> _v;
+        object_message() : message(flag_object)
+        {
+        }
+    public:
+        static message::ptr create()
+        {
+            return ptr(new object_message());
+        }
+        
+        map<string,message::ptr>& get_map()
+        {
+            return _v;
+        }
+        
+        const map<string,message::ptr>& get_map() const
+        {
+            return _v;
+        }
+    };
+
+    class message::list
+    {
+    public:
+        list()
+        {
+        }
+
+        list(nullptr_t)
+        {
+        }
+
+        list(message::list&& rhs):
+            m_vector(std::move(rhs.m_vector))
+        {
+
+        }
+
+        list & operator= (const message::list && rhs)
+        {
+            m_vector = std::move(rhs.m_vector);
+            return *this;
+        }
+
+               template <typename T>
+               list(T&& content,
+                       typename enable_if<is_same<vector<message::ptr>,typename remove_reference<T>::type>::value>::type* = 0):
+                       m_vector(std::forward<T>(content))
+        {
+        }
+
+        list(message::list const& rhs):
+            m_vector(rhs.m_vector)
+        {
+
+        }
+
+        list(message::ptr const& message)
+        {
+            if(message)
+                m_vector.push_back(message);
+        }
+
+        list(const string& text)
+        {
+            m_vector.push_back(string_message::create(text));
+        }
+
+        list(string&& text)
+        {
+            m_vector.push_back(string_message::create(move(text)));
+        }
+
+        list(shared_ptr<string> const& binary)
+        {
+            if(binary)
+                m_vector.push_back(binary_message::create(binary));
+        }
+
+        list(shared_ptr<const string> const& binary)
+        {
+            if(binary)
+                m_vector.push_back(binary_message::create(binary));
+        }
+
+        void push(message::ptr const& message)
+        {
+            if(message)
+                m_vector.push_back(message);
+
+        }
+
+        void insert(size_t pos,message::ptr const& message)
+        {
+            m_vector.insert(m_vector.begin()+pos, message);
+        }
+
+        size_t size() const
+        {
+            return m_vector.size();
+        }
+
+        const message::ptr& at(size_t i) const
+        {
+            return m_vector[i];
+        }
+
+        const message::ptr& operator[] (size_t i) const
+        {
+            return m_vector[i];
+        }
+
+        message::ptr to_array_message(string const& event_name) const
+        {
+            message::ptr arr = array_message::create();
+            arr->get_vector().push_back(string_message::create(event_name));
+            arr->get_vector().insert(arr->get_vector().end(),m_vector.begin(),m_vector.end());
+            return arr;
+        }
+
+        message::ptr to_array_message() const
+        {
+            message::ptr arr = array_message::create();
+            arr->get_vector().insert(arr->get_vector().end(),m_vector.begin(),m_vector.end());
+            return arr;
+        }
+
+    private:
+        vector<message::ptr> m_vector;
+    };
+}
+
+#endif
diff --git a/scilab/libs/sioclient/includes/sio_socket.h b/scilab/libs/sioclient/includes/sio_socket.h
new file mode 100644 (file)
index 0000000..53fa95a
--- /dev/null
@@ -0,0 +1,101 @@
+#ifndef SIO_SOCKET_H
+#define SIO_SOCKET_H
+#include "sio_message.h"
+#include <functional>
+namespace sio
+{
+    class event_adapter;
+    
+    class event
+    {
+    public:
+        const std::string& get_nsp() const;
+        
+        const std::string& get_name() const;
+        
+        const message::ptr& get_message() const;
+
+        const message::list& get_messages() const;
+        
+        bool need_ack() const;
+        
+        void put_ack_message(message::list const& ack_message);
+        
+        message::list const& get_ack_message() const;
+        
+    protected:
+        event(std::string const& nsp,std::string const& name,message::list const& messages,bool need_ack);
+        event(std::string const& nsp,std::string const& name,message::list&& messages,bool need_ack);
+
+        message::list& get_ack_message_impl();
+        
+    private:
+        const std::string m_nsp;
+        const std::string m_name;
+        const message::list m_messages;
+        const bool m_need_ack;
+        message::list m_ack_message;
+        
+        friend class event_adapter;
+    };
+    
+    class client_impl;
+    class packet;
+    
+    //The name 'socket' is taken from concept of official socket.io.
+    class socket
+    {
+    public:
+        typedef std::function<void(const std::string& name,message::ptr const& message,bool need_ack, message::list& ack_message)> event_listener_aux;
+        
+        typedef std::function<void(event& event)> event_listener;
+        
+        typedef std::function<void(message::ptr const& message)> error_listener;
+        
+        typedef std::shared_ptr<socket> ptr;
+        
+        ~socket();
+        
+        void on(std::string const& event_name,event_listener const& func);
+        
+        void on(std::string const& event_name,event_listener_aux const& func);
+        
+        void off(std::string const& event_name);
+        
+        void off_all();
+        
+        void close();
+        
+        void on_error(error_listener const& l);
+        
+        void off_error();
+
+        void emit(std::string const& name, message::list const& msglist = nullptr, std::function<void (message::list const&)> const& ack = nullptr);
+        
+        std::string const& get_namespace() const;
+        
+    protected:
+        socket(client_impl*,std::string const&);
+
+        void on_connected();
+        
+        void on_close();
+        
+        void on_open();
+        
+        void on_disconnect();
+        
+        void on_message_packet(packet const& p);
+        
+        friend class client_impl;
+        
+    private:
+        //disable copy constructor and assign operator.
+        socket(socket const& sock){}
+        void operator=(socket const& sock){}
+
+        class impl;
+        impl *m_impl;
+    };
+}
+#endif // SIO_SOCKET_H
index 97b50b6..bdd50b7 100644 (file)
@@ -537,6 +537,17 @@ public :
     static void resetRecursionLevel();
     static bool increaseRecursion();
     static void decreaseRecursion();
+
+    //websocket information
+private:
+    static std::string commandaddr;
+    static std::string graphicaddr;
+public:
+    static void setCommandAddress(const std::string&);
+    static std::string& getCommandAddress();
+    static void setGraphicAddress(const std::string&);
+    static std::string& getGraphicAddress();
+
 };
 
 #endif /* !__CONFIGVARIABLE_HXX__ */
index bd213c7..fc3009f 100644 (file)
@@ -1701,3 +1701,28 @@ void ConfigVariable::resetRecursionLevel()
 {
     recursionLevel = 0;
 }
+
+//websocket information
+std::string ConfigVariable::commandaddr;
+std::string ConfigVariable::graphicaddr;
+
+void ConfigVariable::setCommandAddress(const std::string& addr)
+{
+    commandaddr = addr;
+}
+
+std::string& ConfigVariable::getCommandAddress()
+{
+    return commandaddr;
+}
+
+void ConfigVariable::setGraphicAddress(const std::string& addr)
+{
+    graphicaddr = addr;
+}
+
+std::string& ConfigVariable::getGraphicAddress()
+{
+    return graphicaddr;
+}
+
index 81b3192..77b4bd5 100644 (file)
@@ -18,8 +18,8 @@
 #define SCI_VERSION_MAJOR @SCILAB_VERSION_MAJOR@
 #define SCI_VERSION_MINOR @SCILAB_VERSION_MINOR@
 #define SCI_VERSION_MAINTENANCE @SCILAB_VERSION_MAINTENANCE@
-#define SCI_VERSION_STRING "scilab-branch-master"
-#define SCI_VERSION_WIDE_STRING L"scilab-branch-master"
+#define SCI_VERSION_STRING "scilab-branch-uicontrol"
+#define SCI_VERSION_WIDE_STRING L"scilab-branch-uicontrol"
 /* SCI_VERSION_REVISION --> hash key commit */
 #define SCI_VERSION_REVISION 0
 #define SCI_VERSION_TIMESTAMP 0
@@ -29,7 +29,7 @@ void disp_scilab_version(void);
 /* for compatibility */
 /* Deprecated */
 #define SCI_VERSION SCI_VERSION_STRING
-#define DEFAULT_SCI_VERSION_MESSAGE L"scilab-branch-master"
+#define DEFAULT_SCI_VERSION_MESSAGE L"scilab-branch-uicontrol"
 
 #endif
 /*--------------------------------------------------------------------------*/
index f916a8f..baa893e 100644 (file)
@@ -18,8 +18,8 @@
 #define SCI_VERSION_MAJOR 6
 #define SCI_VERSION_MINOR 0
 #define SCI_VERSION_MAINTENANCE 0
-#define SCI_VERSION_STRING "scilab-branch-master"
-#define SCI_VERSION_WIDE_STRING L"scilab-branch-master"
+#define SCI_VERSION_STRING "scilab-branch-uicontrol"
+#define SCI_VERSION_WIDE_STRING L"scilab-branch-uicontrol"
 /* SCI_VERSION_REVISION --> hash key commit */
 #define SCI_VERSION_REVISION 0
 #define SCI_VERSION_TIMESTAMP 0
@@ -29,7 +29,7 @@ void disp_scilab_version(void);
 /* for compatibility */
 /* Deprecated */
 #define SCI_VERSION SCI_VERSION_STRING
-#define DEFAULT_SCI_VERSION_MESSAGE L"scilab-branch-master"
+#define DEFAULT_SCI_VERSION_MESSAGE L"scilab-branch-uicontrol"
 
 #endif
 /*--------------------------------------------------------------------------*/
index 76ccfed..1ab65c1 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/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;../../../hdf5/includes;../../../fftw/includes;../../../ui_data/includes</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/sioclient/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/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;../../../hdf5/includes;../../../fftw/includes;../../../ui_data/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -108,6 +108,7 @@ cd ..
       <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
       <RandomizedBaseAddress>false</RandomizedBaseAddress>
       <ModuleDefinitionFile>core.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)\libs\sioclient\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Link>
     <PreBuildEvent>
       <Command>lib /DEF:"$(ProjectDir)functions_manager_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)functions_manager.lib" 1&gt;NUL 2&gt;NUL
@@ -120,7 +121,7 @@ cd ..
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/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;../../../hdf5/includes;../../../fftw/includes;../../../ui_data/includes</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/sioclient/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/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;../../../hdf5/includes;../../../fftw/includes;../../../ui_data/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -148,6 +149,7 @@ cd ..
       <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
       <RandomizedBaseAddress>false</RandomizedBaseAddress>
       <ModuleDefinitionFile>core.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)\libs\sioclient\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Link>
     <PreBuildEvent>
       <Command>lib /DEF:"$(ProjectDir)functions_manager_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)functions_manager.lib" 1&gt;NUL 2&gt;NUL
@@ -158,7 +160,7 @@ cd ..
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/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;../../../hdf5/includes;../../../fftw/includes;../../../ui_data/includes</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/sioclient/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/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;../../../hdf5/includes;../../../fftw/includes;../../../ui_data/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;NDEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -190,6 +192,7 @@ cd ..
       <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
       <RandomizedBaseAddress>false</RandomizedBaseAddress>
       <ModuleDefinitionFile>core.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)\libs\sioclient\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Link>
     <PreBuildEvent>
       <Command>lib /DEF:"$(ProjectDir)functions_manager_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)functions_manager.lib" 1&gt;NUL 2&gt;NUL
@@ -203,7 +206,7 @@ cd ..
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/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;../../../hdf5/includes;../../../fftw/includes;../../../ui_data/includes</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/sioclient/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/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;../../../hdf5/includes;../../../fftw/includes;../../../ui_data/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;NDEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -235,6 +238,7 @@ cd ..
       <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
       <RandomizedBaseAddress>false</RandomizedBaseAddress>
       <ModuleDefinitionFile>core.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)\libs\sioclient\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Link>
     <PreBuildEvent>
       <Command>lib /DEF:"$(ProjectDir)functions_manager_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)functions_manager.lib" 1&gt;NUL 2&gt;NUL
@@ -252,6 +256,7 @@ cd ..
     <ClCompile Include="..\cpp\setlines.cpp" />
     <ClCompile Include="..\cpp\storeCommand.cpp" />
     <ClCompile Include="..\cpp\tasks.cpp" />
+    <ClCompile Include="..\cpp\webcommand.cpp" />
     <ClCompile Include="..\cpp\with_module.cpp" />
     <ClCompile Include="..\cpp\backtrace_print.cpp" />
     <ClCompile Include="backtrace.c" />
@@ -365,6 +370,7 @@ cd ..
     <ClInclude Include="..\..\includes\with_module.h" />
     <ClInclude Include="..\cpp\partition.hxx" />
     <ClInclude Include="..\cpp\unrolled_algorithms.hxx" />
+    <ClInclude Include="..\cpp\webcommand.hxx" />
     <ClInclude Include="backtrace.h" />
     <ClInclude Include="dynamic_gateways.h" />
     <ClInclude Include="getdebuginfo.h" />
index e1e189e..6d679b1 100644 (file)
     <ClCompile Include="..\cpp\setlines.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\cpp\webcommand.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\core.iss" />
     <ClInclude Include="..\..\includes\md5.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\cpp\webcommand.hxx">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\core.iss" />
index c151e42..06be550 100644 (file)
@@ -38,6 +38,7 @@
 #include "execvisitor.hxx"
 #include "debugmanager.hxx"
 #include "consoledebugger.hxx"
+#include "webcommand.hxx"
 
 extern "C"
 {
@@ -359,6 +360,11 @@ int StartScilabEngine(ScilabEngineInfo* _pSEI)
 
     InitializePreferences(iScript);
 
+    if (ConfigVariable::getCommandAddress() != "")
+    {
+        //we have to connect scilab command client to server
+        WebCommand::create(ConfigVariable::getCommandAddress());
+    }
 
     //register console debugger as debugger
     debugger::DebuggerMagager::getInstance()->addDebugger(new debugger::ConsoleDebugger());
diff --git a/scilab/modules/core/src/cpp/webcommand.cpp b/scilab/modules/core/src/cpp/webcommand.cpp
new file mode 100644 (file)
index 0000000..f3401a9
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2016 - Scilab Enterprises - Antoine ELIAS
+*
+* Copyright (C) 2012 - 2016 - Scilab Enterprises
+*
+* This file is hereby licensed under the terms of the GNU GPL v2.0,
+* pursuant to article 5.3.4 of the CeCILL v.2.1.
+* This file was originally licensed under the terms of the CeCILL v2.1,
+* and continues to be available under such terms.
+* For more information, see the COPYING file which you should have received
+* along with this program.
+*
+*/
+
+#include "webcommand.hxx"
+
+extern "C"
+{
+#include "storeCommand.h"
+}
+
+#ifdef _MSC_VER
+#ifdef _DEBUG
+#pragma comment(lib,"sioclientd.lib")
+#pragma comment(lib,"libboost_system-vc120-mt-gd-1_60.lib")
+#pragma comment(lib,"libboost_random-vc120-mt-gd-1_60.lib")
+#else //RELEASE
+#pragma comment(lib,"sioclient.lib")
+#pragma comment(lib,"libboost_system-vc120-mt-1_60.lib")
+#pragma comment(lib,"libboost_random-vc120-mt-1_60.lib")
+#endif
+#endif
+
+
+WebCommand* WebCommand::me = nullptr;
+
+void WebCommand::create(const std::string& addr)
+{
+    if (me == nullptr)
+    {
+        me = new WebCommand(addr);
+    }
+}
+
+WebCommand::WebCommand(const std::string& addr)
+{
+    //set and start sioclient
+    //bind main event on socket
+    client.set_open_listener(std::bind(&command_listener::on_connected, &l));
+    client.set_close_listener(std::bind(&command_listener::on_close, &l, std::placeholders::_1));
+    client.set_fail_listener(std::bind(&command_listener::on_fail, &l));
+
+    //connect it
+    client.connect(addr);
+
+    //wait connection OK
+    l.lock.lock();
+    if (!l.connect_finish)
+    {
+        l.cond.wait(l.lock);
+    }
+
+    l.lock.unlock();
+
+    //get connected socket
+    s = client.socket();
+
+    s->on("command", sio::socket::event_listener_aux([&](std::string const& name, sio::message::ptr const& data, bool isAck, sio::message::list &ack_resp)
+    {
+        //lock socket
+        l.lock.lock();
+
+        //get command from message
+        std::string cmd = data->get_map()["data"]->get_string();
+
+        //put command on storecommand with wait flag
+        StoreConsoleCommand((char*)(cmd + ";").data(), 1);
+
+        l.lock.unlock();
+
+        s->emit("command_end");
+    }));
+}
diff --git a/scilab/modules/core/src/cpp/webcommand.hxx b/scilab/modules/core/src/cpp/webcommand.hxx
new file mode 100644 (file)
index 0000000..80776d8
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2016 - Scilab Enterprises - Antoine ELIAS
+*
+* Copyright (C) 2012 - 2016 - Scilab Enterprises
+*
+* This file is hereby licensed under the terms of the GNU GPL v2.0,
+* pursuant to article 5.3.4 of the CeCILL v.2.1.
+* This file was originally licensed under the terms of the CeCILL v2.1,
+* and continues to be available under such terms.
+* For more information, see the COPYING file which you should have received
+* along with this program.
+*
+*/
+
+#ifndef __WEBCOMMAND_HXX__
+#define __WEBCOMMAND_HXX__
+
+#include <iostream>
+#include <string>
+#include <condition_variable>
+
+#include "sio_client.h"
+
+class command_listener
+{
+public:
+
+    command_listener() : connect_finish(false) {}
+
+    void on_connected()
+    {
+        std::cout << "command.on_connected" << std::endl;
+        lock.lock();
+        cond.notify_all();
+        connect_finish = true;
+        lock.unlock();
+    }
+
+    void on_close(sio::client::close_reason const& reason)
+    {
+        std::cout << "command.on_close" << std::endl;
+    }
+
+    void on_fail()
+    {
+        std::cout << "command.on_fail" << std::endl;
+    }
+
+    std::condition_variable_any cond;
+    bool connect_finish;
+    std::mutex lock;
+};
+
+
+class WebCommand
+{
+private :
+    WebCommand(const std::string& addr);
+    ~WebCommand() {}
+
+    static WebCommand* me;
+
+public :
+    static void create(const std::string& addr);
+    static void destroy() {}
+
+private:
+    std::string addr;
+    sio::socket::ptr s;
+    sio::client client;
+    command_listener l;
+
+};
+
+#endif /* !__WEBCOMMAND_HXX__ */
\ No newline at end of file
index 4069896..70c1374 100644 (file)
@@ -44,11 +44,13 @@ GRAPHIC_OBJECTS_IMPEXP BOOL sciIsExistingFigure(int figNum);
  * Register Scilab View to Graphic Controller
  */
 GRAPHIC_OBJECTS_IMPEXP void registerToController(void);
+GRAPHIC_OBJECTS_IMPEXP void registerWebToController(void);
 
 /**
  * Unregister Scilab View to Graphic Controller
  */
 GRAPHIC_OBJECTS_IMPEXP void unregisterToController(void);
+GRAPHIC_OBJECTS_IMPEXP void unregisterWebToController(void);
 
 /**
  * to know if there are some opened graphic windows
diff --git a/scilab/modules/graphic_objects/includes/ScilabWebView.hxx b/scilab/modules/graphic_objects/includes/ScilabWebView.hxx
new file mode 100644 (file)
index 0000000..d5b41ef
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2016 - Scilab Enterprises - Antoine ELIAS
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ */
+
+#ifndef __SCILAB_WEB_VIEW_HXX__
+#define __SCILAB_WEB_VIEW_HXX__
+
+#include <iostream>
+#include <string>
+#include <condition_variable>
+
+#include "sio_client.h"
+
+#include "dynlib_graphic_objects.h"
+
+//disable warnings about exports STL items
+#pragma warning (disable : 4251)
+
+extern "C"
+{
+    void ScilabNativeWebView__createObject(int id);
+    void ScilabNativeWebView__deleteObject(int id);
+    void ScilabNativeWebView__updateObject(int id, int prop);
+}
+
+class graphic_listener
+{
+public:
+
+    graphic_listener() : connect_finish(false) {}
+
+    void on_connected()
+    {
+        std::cout << "graphic.on_connected" << std::endl;
+        lock.lock();
+        cond.notify_all();
+        connect_finish = true;
+        lock.unlock();
+    }
+
+    void on_close(sio::client::close_reason const& reason)
+    {
+        std::cout << "graphic.on_close" << std::endl;
+    }
+
+    void on_fail()
+    {
+        std::cout << "graphic.on_fail" << std::endl;
+    }
+
+    std::condition_variable_any cond;
+    bool connect_finish;
+    std::mutex lock;
+};
+
+class GRAPHIC_OBJECTS_IMPEXP ScilabWebView
+{
+private :
+    ScilabWebView() {}
+    ~ScilabWebView() {}
+
+    static ScilabWebView* me;
+    // Define type for easy manipulation.
+public :
+
+    static ScilabWebView* getInstance() 
+    {
+        if (me == nullptr)
+        {
+            me = new ScilabWebView();
+        }
+
+        return me;
+    }
+
+    void createObject(int uid);
+    void deleteObject(int uid);
+    void updateObject(int uid, int prop);
+
+    void registerToController(void);
+    void unregisterToController(void);
+
+private:
+    std::string addr;
+    sio::socket::ptr s;
+    sio::client client;
+    graphic_listener l;
+};
+
+#endif /* !__SCILAB_WEB_VIEW_HXX__ */
+
index fd60e89..c5585c7 100644 (file)
@@ -85,7 +85,7 @@
     <ClCompile>
       <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../libs/intl;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../libs/intl;../../../../libs/sioclient/includes;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;GRAPHIC_OBJECTS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>Default</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../libs/intl;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../libs/intl;../../../../libs/sioclient/includes;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;GRAPHIC_OBJECTS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>Default</BasicRuntimeChecks>
       <ImportLibrary>../../../../bin/sci$(ProjectName).lib</ImportLibrary>
       <TargetMachine>MachineX64</TargetMachine>
       <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+      <AdditionalLibraryDirectories>$(SolutionDir)\libs\sioclient\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../libs/intl;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../libs/intl;../../../../libs/sioclient/includes;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;GRAPHIC_OBJECTS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../libs/intl;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../libs/intl;../../../../libs/sioclient/includes;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;GRAPHIC_OBJECTS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <ImportLibrary>../../../../bin/sci$(ProjectName).lib</ImportLibrary>
       <TargetMachine>MachineX64</TargetMachine>
       <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+      <AdditionalLibraryDirectories>$(SolutionDir)\libs\sioclient\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="..\cpp\NgonGridMatplotDataDecomposer.cpp" />
     <ClCompile Include="..\cpp\NormalGenerator.cpp" />
     <ClCompile Include="..\cpp\ScilabView.cpp" />
+    <ClCompile Include="..\cpp\ScilabWebView.cpp" />
     <ClCompile Include="..\cpp\Texture.cpp" />
     <ClCompile Include="..\cpp\Triangulator.cpp" />
+    <ClCompile Include="..\cpp\webutils.cpp" />
     <ClCompile Include="..\jni\Builder.cpp" />
     <ClCompile Include="..\jni\CallGraphicController.cpp" />
     <ClCompile Include="..\cpp\ColorComputer.cpp" />
     <ClCompile Include="..\cpp\Plot3DDecomposer.cpp" />
     <ClCompile Include="..\cpp\PolylineDecomposer.cpp" />
     <ClCompile Include="..\cpp\setGraphicObjectProperty.cpp" />
+    <ClCompile Include="..\jni\ScilabNativeWebView_wrap.c" />
     <ClCompile Include="..\jni\SurfaceData_wrap.c" />
     <ClCompile Include="..\cpp\createObjectData.cpp" />
     <ClCompile Include="..\cpp\pickSurface.cpp" />
     <ClInclude Include="..\..\includes\NgonGridMatplotDataDecomposer.hxx" />
     <ClInclude Include="..\..\includes\returnType.h" />
     <ClInclude Include="..\..\includes\ScilabView.hxx" />
+    <ClInclude Include="..\..\includes\ScilabWebView.hxx" />
     <ClInclude Include="..\..\includes\setGraphicObjectProperty.h" />
     <ClInclude Include="..\..\includes\Texture.hxx" />
     <ClInclude Include="..\..\includes\Triangulator.hxx" />
+    <ClInclude Include="..\cpp\webutils.hxx" />
     <ClInclude Include="..\jni\Builder.hxx" />
     <ClInclude Include="..\jni\CallGraphicController.hxx" />
     <ClInclude Include="..\..\includes\createGraphicObject.h" />
index 80d2d8c..5745e3a 100644 (file)
     <ClCompile Include="..\cpp\DllmainGraphic_objects.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\cpp\ScilabWebView.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\jni\ScilabNativeWebView_wrap.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\cpp\webutils.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\jni\CallGraphicController.hxx">
     <ClInclude Include="..\jni\CallXmlLoader.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\includes\ScilabWebView.hxx">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\cpp\webutils.hxx">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="core_import.def">
index 129bdcc..3d264bc 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include "ScilabView.hxx"
+#include "ScilabWebView.hxx"
 
 extern "C"
 {
@@ -61,6 +62,15 @@ void unregisterToController()
     ScilabView::unregisterToController();
 }
 
+void registerWebToController()
+{
+    ScilabWebView::getInstance()->registerToController();
+}
+void unregisterWebToController()
+{
+    ScilabWebView::getInstance()->unregisterToController();
+}
+
 int search_path(char* _pstPath)
 {
     return ScilabView::search_path(_pstPath);
diff --git a/scilab/modules/graphic_objects/src/cpp/ScilabWebView.cpp b/scilab/modules/graphic_objects/src/cpp/ScilabWebView.cpp
new file mode 100644 (file)
index 0000000..e139f1f
--- /dev/null
@@ -0,0 +1,207 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2016 - Scilab Enterprises - Antoine ELIAS
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ */
+
+#include "ScilabWebView.hxx"
+#include "CallGraphicController.hxx"
+#include "configvariable.hxx"
+#include "webutils.hxx"
+
+extern "C"
+{
+#include "getScilabJavaVM.h"
+#include "getGraphicObjectProperty.h"
+#include "graphicObjectProperties.h"
+#include "storeCommand.h"
+}
+
+#ifdef _MSC_VER
+#ifdef _DEBUG
+#pragma comment(lib,"sioclientd.lib")
+#pragma comment(lib,"libboost_system-vc120-mt-gd-1_60.lib")
+#pragma comment(lib,"libboost_random-vc120-mt-gd-1_60.lib")
+#else //RELEASE
+#pragma comment(lib,"sioclient.lib")
+#pragma comment(lib,"libboost_system-vc120-mt-1_60.lib")
+#pragma comment(lib,"libboost_random-vc120-mt-1_60.lib")
+#endif
+#endif
+
+ScilabWebView* ScilabWebView::me = nullptr;
+
+void ScilabNativeWebView__createObject(int uid)
+{
+    ScilabWebView::getInstance()->createObject(uid);
+}
+
+void ScilabNativeWebView__deleteObject(int uid)
+{
+    ScilabWebView::getInstance()->deleteObject(uid);
+}
+
+void ScilabNativeWebView__updateObject(int uid, int prop)
+{
+    ScilabWebView::getInstance()->updateObject(uid, prop);
+}
+
+void ScilabWebView::registerToController(void)
+{
+    if (ConfigVariable::getGraphicAddress().empty())
+    {
+        return;
+    }
+
+    //register view in graphic MVC
+    org_scilab_modules_graphic_objects::CallGraphicController::registerScilabWebView(getScilabJavaVM());
+
+    //set and start sioclient
+    //bind main event on socket
+    client.set_open_listener(std::bind(&graphic_listener::on_connected, &l));
+    client.set_close_listener(std::bind(&graphic_listener::on_close, &l, std::placeholders::_1));
+    client.set_fail_listener(std::bind(&graphic_listener::on_fail, &l));
+
+    //connect it
+    client.connect(ConfigVariable::getGraphicAddress());
+
+    //wait connection OK
+    l.lock.lock();
+    if (!l.connect_finish)
+    {
+        l.cond.wait(l.lock);
+    }
+
+    l.lock.unlock();
+
+    //get connected socket
+    s = client.socket();
+
+    s->on("callback", sio::socket::event_listener_aux([&](std::string const& name, sio::message::ptr const& data, bool isAck, sio::message::list &ack_resp){
+        l.lock.lock();
+        int uid = data->get_map()["uid"]->get_int();
+        //get calltype type and callback instruction from MVC
+        int cbtype = WebUtils::getIntProperty(uid, __GO_CALLBACKTYPE__);
+        std::string cb = WebUtils::getStringProperty(uid, __GO_CALLBACK__);
+
+        std::string str = "if exists(\"gcbo\") then %oldgcbo = gcbo; end;";
+        str += "gcbo = getcallbackobject(" + std::to_string(uid) + ");";
+        str += cb;
+        str += ";if exists(\"%oldgcbo\") then gcbo = %oldgcbo; else clear gcbo; end;";
+
+        if (cbtype == 10 || cbtype == 12)
+        {
+            StorePrioritaryCommand((char*)str.data());
+        }
+        else
+        {
+            StoreCommand((char*)str.data());
+        }
+        l.cond.notify_all();
+        l.lock.unlock();
+    }));
+}
+
+void ScilabWebView::unregisterToController(void)
+{
+    org_scilab_modules_graphic_objects::CallGraphicController::unregisterScilabWebView(getScilabJavaVM());
+}
+
+
+void ScilabWebView::createObject(int uid)
+{
+    if (WebUtils::isManaged(uid) == false)
+    {
+        return;
+    }
+
+    if (WebUtils::isFigure(uid))
+    {
+        std::string str;
+        WebUtils::createFigure(uid, str);
+        std::cout << "createFigure" << str << std::endl;
+        s->emit("graphic_create", str);
+        return;
+    }
+
+    if (WebUtils::isUIcontrol(uid))
+    {
+        std::string str;
+        WebUtils::createUIControl(uid, str);
+        s->emit("graphic_create", str);
+        return;
+    }
+}
+
+void ScilabWebView::deleteObject(int uid)
+{
+    //if (WebUtils::isManaged(uid) == false)
+    //{
+    //    return;
+    //}
+
+    //sio::message::ptr obj = sio::object_message::create();
+    //auto& m = obj->get_map();
+
+    //m["uid"] = sio::int_message::create(uid);
+    //s->emit("graphic_delete", obj);
+}
+
+void ScilabWebView::updateObject(int uid, int prop)
+{
+    if (WebUtils::isManaged(uid) == false)
+    {
+        return;
+    }
+
+    if (WebUtils::isFigure(uid))
+    {
+        switch (prop)
+        {
+            case __GO_SIZE__:
+            {
+                std::string str;
+                WebUtils::setFigureSize(uid, str);
+                s->emit("graphic_update", str);
+                return;
+            }
+        }
+    }
+
+    if (WebUtils::isUIcontrol(uid))
+    {
+        switch (prop)
+        {
+            case __GO_PARENT__:
+            {
+                std::string str;
+                WebUtils::setParent(uid, str);
+                s->emit("graphic_update", str);
+                return;
+            }
+            case __GO_POSITION__:
+            {
+                std::string str;
+                WebUtils::setUIPosition(uid, str);
+                s->emit("graphic_update", str);
+                return;
+            }
+            case __GO_UI_STRING__:
+            {
+                std::string str;
+                WebUtils::setUIString(uid, str);
+                s->emit("graphic_update", str);
+                return;
+            }
+        }
+    }
+}
diff --git a/scilab/modules/graphic_objects/src/cpp/webutils.cpp b/scilab/modules/graphic_objects/src/cpp/webutils.cpp
new file mode 100644 (file)
index 0000000..acfab15
--- /dev/null
@@ -0,0 +1,267 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2016 - Scilab Enterprises - Antoine ELIAS
+*
+* Copyright (C) 2012 - 2016 - Scilab Enterprises
+*
+* This file is hereby licensed under the terms of the GNU GPL v2.0,
+* pursuant to article 5.3.4 of the CeCILL v.2.1.
+* This file was originally licensed under the terms of the CeCILL v2.1,
+* and continues to be available under such terms.
+* For more information, see the COPYING file which you should have received
+* along with this program.
+*
+*/
+
+#include "webutils.hxx"
+
+extern "C"
+{
+#include "getGraphicObjectProperty.h"
+#include "graphicObjectProperties.h"
+}
+
+int WebUtils::getIntProperty(int uid, int prop)
+{
+    int val = 0;
+    int* pVal = &val;
+    getGraphicObjectProperty(uid, prop, jni_int, (void **)&pVal);
+    return val;
+}
+
+double WebUtils::getDoubleProperty(int uid, int prop)
+{
+    double val = 0;
+    double* pVal = &val;
+    getGraphicObjectProperty(uid, prop, jni_double, (void **)&pVal);
+    return val;
+}
+
+void WebUtils::getDoubleVectorProterty(int uid, int prop, std::vector<double>& vect)
+{
+    double* values = NULL;
+    getGraphicObjectProperty(uid, prop, jni_double_vector, (void**)&values);
+
+    int size = (int)vect.size();
+    memcpy(vect.data(), values, size * sizeof(double));
+    releaseGraphicObjectProperty(prop, values, jni_double_vector, size);
+}
+
+void WebUtils::getIntVectorProterty(int uid, int prop, std::vector<int>& vect)
+{
+    int* values = NULL;
+    getGraphicObjectProperty(uid, prop, jni_int_vector, (void**)&values);
+
+    int size = (int)vect.size();
+    memcpy(vect.data(), values, size * sizeof(int));
+    releaseGraphicObjectProperty(prop, values, jni_int_vector, size);
+}
+
+std::string WebUtils::getStringProperty(int uid, int prop)
+{
+    std::string str;
+    char* val = NULL;
+    getGraphicObjectProperty(uid, prop, jni_string, (void**)&val);
+    str = val;
+    releaseGraphicObjectProperty(prop, val, jni_string, 1);
+    return str;
+}
+
+void WebUtils::getStringVectorProperty(int uid, int prop, std::vector<std::string>& vect)
+{
+    char **pstString = NULL;
+    getGraphicObjectProperty(uid, prop, jni_string_vector, (void **)&pstString);
+
+    int size = (int)vect.size();
+    for (int i = 0; i < size; ++i)
+    {
+        vect[i] = pstString[i];
+    }
+
+    releaseGraphicObjectProperty(prop, pstString, jni_string_vector, size);
+}
+
+std::string WebUtils::getIdString(int uid)
+{
+    return "'uid" + std::to_string(uid) + "'";
+}
+
+std::string WebUtils::getElementById(int uid)
+{
+    return "document.getElementById(" + getIdString(uid) + ");";
+}
+
+std::string WebUtils::createElement(const std::string& type)
+{
+    return "document.createElement('" + type + "');";
+}
+
+bool WebUtils::isManaged(int uid)
+{
+    int type = getType(uid);
+    switch (type)
+    {
+        case __GO_FIGURE__:
+            return true;
+        case __GO_UICONTROL__:
+        {
+            int style = getStyle(uid);
+            switch (style)
+            {
+                case __GO_UI_PUSHBUTTON__:
+                {
+                    return true;
+                }
+                default:
+                    return false;
+            }
+            break;
+        }
+        default:
+            return false;
+    }
+}
+
+//commons
+int WebUtils::getType(int uid)
+{
+    return getIntProperty(uid, __GO_TYPE__);
+}
+
+int WebUtils::getStyle(int uid)
+{
+    return getIntProperty(uid, __GO_STYLE__);
+}
+
+int WebUtils::getParent(int uid)
+{
+    return getIntProperty(uid, __GO_PARENT__);
+}
+
+void WebUtils::setParent(int uid, std::string& str)
+{
+    int parent = getParent(uid);
+    str = "__parent__ = " + getElementById(parent);
+    str += "__child__ = " + getElementById(uid);
+    str += "__parent__.appendChild(__child__);";
+}
+
+void WebUtils::getFigureSize(int uid, std::vector<int>& vect)
+{
+    vect.resize(2, 0);
+    getIntVectorProterty(uid, __GO_SIZE__, vect);
+}
+
+void WebUtils::setFigureSize(int uid, std::string& str)
+{
+    std::vector<int> size;
+    getFigureSize(uid, size);
+
+    str = "__child__ = " + getElementById(uid);
+    str += "__child__.style.width = '" + std::to_string(size[0]) + "px';";
+    str += "__child__.style.height = '" + std::to_string(size[1]) + "px';";
+}
+
+void WebUtils::getUIPosition(int uid, std::vector<double>& vect)
+{
+    vect.resize(4, 0.);
+    getDoubleVectorProterty(uid, __GO_POSITION__, vect);
+}
+
+void WebUtils::getUIString(int uid, std::vector<std::string> & vect)
+{
+    int size = getIntProperty(uid, __GO_UI_STRING_SIZE__);
+    //int col = getIntProperty(uid, __GO_UI_STRING_COLNB__);
+    vect.resize(size, "");
+    getStringVectorProperty(uid, __GO_UI_STRING__, vect);
+}
+
+
+void WebUtils::setUIPosition(int uid, std::string& str)
+{
+    std::vector<int> size;
+    getFigureSize(getParent(uid), size);
+    std::vector<double> pos;
+    getUIPosition(uid, pos);
+
+    str = "__child__ = " + getElementById(uid);
+    str += "__child__.style.left = '" + std::to_string((int)pos[0]) + "px';";
+    str += "__child__.style.top = '" + std::to_string(size[1] - (int)pos[1] - (int)pos[3]) + "px';";
+    str += "__child__.style.width = '" + std::to_string((int)pos[2]) + "px';";
+    str += "__child__.style.height = '" + std::to_string((int)pos[3]) + "px';";
+}
+
+void WebUtils::setUIString(int uid, std::string& str)
+{
+    std::vector<std::string> s;
+    getUIString(uid, s);
+
+    str = "__child__ = " + getElementById(uid);
+    str += "__child__.innerHTML = '" + s[0] + "';";
+}
+
+//is
+bool WebUtils::hasStyle(int uid, int style)
+{
+    if (isUIcontrol(uid))
+    {
+        return getStyle(uid) == style;
+    }
+
+    return false;
+}
+
+bool WebUtils::isFigure(int uid)
+{
+    return getType(uid) == __GO_FIGURE__;
+}
+
+bool WebUtils::isUIcontrol(int uid)
+{
+    return getType(uid) == __GO_UICONTROL__;
+}
+
+bool WebUtils::isButton(int uid)
+{
+    return hasStyle(uid, __GO_UI_PUSHBUTTON__);
+}
+
+
+//create
+bool WebUtils::createFigure(int uid, std::string& str)
+{
+    //for the moment figure is a div hardcoded in html page ( .GO_FIGURE )
+    //this function just set figure uid to help children to find it
+    str = "var __temp__ = " + createElement("DIV");
+    str += "__temp__.id = " + getIdString(uid) + ";";
+    str += "__temp__.className = 'GO_FIGURE';";
+    str += "document.body.appendChild(__temp__);";
+    return true;
+}
+
+bool WebUtils::createUIControl(int uid, std::string& str)
+{
+    int style = getStyle(uid);
+    switch (style)
+    {
+        case __GO_UI_PUSHBUTTON__:
+        {
+            return createPushButton(uid, str);
+        }
+        default :
+            return false;
+    }
+}
+
+bool WebUtils::createPushButton(int uid, std::string& str)
+{
+    //create a button, with no parent, wait update with _GO_PARENT to update it
+    str += "var __temp__ = " + createElement("BUTTON");
+    str += "__temp__.id = " + getIdString(uid) + ";";
+    str += "__temp__.className = 'GO_PUSHBUTTON';";
+    str += "document.body.appendChild(__temp__);";
+    str += "__temp__.onclick = function (){OnUIClick(this)};";
+
+
+    return true;
+}
diff --git a/scilab/modules/graphic_objects/src/cpp/webutils.hxx b/scilab/modules/graphic_objects/src/cpp/webutils.hxx
new file mode 100644 (file)
index 0000000..3fa7123
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2016 - Scilab Enterprises - Antoine ELIAS
+*
+* Copyright (C) 2012 - 2016 - Scilab Enterprises
+*
+* This file is hereby licensed under the terms of the GNU GPL v2.0,
+* pursuant to article 5.3.4 of the CeCILL v.2.1.
+* This file was originally licensed under the terms of the CeCILL v2.1,
+* and continues to be available under such terms.
+* For more information, see the COPYING file which you should have received
+* along with this program.
+*
+*/
+
+#ifndef __WEB_UTILS_HXX__
+#define __WEB_UTILS_HXX__
+
+#include <string>
+#include <vector>
+
+class WebUtils
+{
+    WebUtils() {}
+    ~WebUtils() {}
+
+private:
+
+    static bool hasStyle(int uid, int style);
+
+    static std::string getIdString(int uid);
+    static std::string getElementById(int uid);
+    static std::string createElement(const std::string& type);
+
+public:
+
+    static int getIntProperty(int uid, int prop);
+    static double getDoubleProperty(int uid, int prop);
+    static std::string getStringProperty(int uid, int prop);
+
+    static void getIntVectorProterty(int uid, int prop, std::vector<int>& vect);
+    static void getDoubleVectorProterty(int uid, int prop, std::vector<double>& vect);
+    static void  getStringVectorProperty(int uid, int prop, std::vector<std::string>& vect);
+
+
+    //commoms
+    static int getType(int uid);
+    static int getStyle(int uid);
+    static int getParent(int uid);
+    static void setParent(int uid, std::string& str);
+    static void getUIPosition(int uid, std::vector<double>& vect);
+    static void setUIPosition(int uid, std::string& str);
+
+    static void getFigureSize(int uid, std::vector<int>& vect);
+    static void setFigureSize(int uid, std::string& str);
+
+    static void getUIString(int uid, std::vector<std::string>& vect);
+    static void setUIString(int uid, std::string& str);
+
+    //is
+    static bool isManaged(int uid);
+    static bool isFigure(int uid);
+    static bool isUIcontrol(int uid);
+    static bool isButton(int uid);
+    
+    //create
+    static bool createFigure(int uid, std::string& str);
+    static bool createUIControl(int uid, std::string& str);
+    static bool createPushButton(int uid, std::string& str);
+
+    //delete
+
+
+    //cupdate
+};
+#endif /* !__WEB_UTILS_HXX__ */
+
index d5058d2..0cbb5de 100644 (file)
@@ -19,6 +19,7 @@ import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.graphic_objects.graphicObject.GraphicObject;
 import org.scilab.modules.graphic_objects.graphicView.ScilabView;
+import org.scilab.modules.graphic_objects.graphicView.ScilabWebView;
 import org.scilab.modules.graphic_objects.utils.MenuBarBuilder;
 
 /**
@@ -188,6 +189,14 @@ public final class CallGraphicController {
         GraphicController.getController().unregister(ScilabView.getScilabView());
     }
 
+    public static void registerScilabWebView() {
+        GraphicController.getController().register(ScilabWebView.getScilabWebView());
+    }
+
+    public static void unregisterScilabWebView() {
+        GraphicController.getController().unregister(ScilabWebView.getScilabWebView());
+    }
+
     public static int getConsoleIdentifier() {
         return Console.getConsole().getIdentifier();
     }
diff --git a/scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/ScilabNativeWebView.java b/scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/ScilabNativeWebView.java
new file mode 100644 (file)
index 0000000..642fcb8
--- /dev/null
@@ -0,0 +1,24 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 3.0.8
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.scilab.modules.graphic_objects;
+
+public class ScilabNativeWebView {
+  public static void ScilabNativeWebView__createObject(int id) {
+    ScilabNativeWebViewJNI.ScilabNativeWebView__createObject(id);
+  }
+
+  public static void ScilabNativeWebView__deleteObject(int id) {
+    ScilabNativeWebViewJNI.ScilabNativeWebView__deleteObject(id);
+  }
+
+  public static void ScilabNativeWebView__updateObject(int id, int iProperty) {
+    ScilabNativeWebViewJNI.ScilabNativeWebView__updateObject(id, iProperty);
+  }
+
+}
diff --git a/scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/ScilabNativeWebViewJNI.java b/scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/ScilabNativeWebViewJNI.java
new file mode 100644 (file)
index 0000000..ac5281e
--- /dev/null
@@ -0,0 +1,25 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 3.0.8
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.scilab.modules.graphic_objects;
+
+public class ScilabNativeWebViewJNI {
+
+  static {
+    try {
+        System.loadLibrary("scigraphic_objects");
+    } catch (UnsatisfiedLinkError e) {
+      System.err.println("Native library failed to load. \n" + e);
+      System.exit(1);
+    }
+  }
+
+  public final static native void ScilabNativeWebView__createObject(int jarg1);
+  public final static native void ScilabNativeWebView__deleteObject(int jarg1);
+  public final static native void ScilabNativeWebView__updateObject(int jarg1, int jarg2);
+}
diff --git a/scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicView/ScilabWebView.java b/scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicView/ScilabWebView.java
new file mode 100644 (file)
index 0000000..a6a2daa
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2016 - Scilab Enterprises - Antoine ELIAS
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ */
+package org.scilab.modules.graphic_objects.graphicView;
+
+import org.scilab.modules.graphic_objects.ScilabNativeWebView;
+
+public class ScilabWebView extends ScilabNativeWebView implements GraphicView {
+
+    private static ScilabWebView me;
+
+    public ScilabWebView() {
+    }
+
+    public static ScilabWebView getScilabWebView() {
+        if (me == null) {
+            me = new ScilabWebView();
+        }
+        return me;
+    }
+
+    public void createObject(Integer id) {
+        ScilabNativeWebView__createObject(id);
+    }
+
+    public void deleteObject(Integer id) {
+        ScilabNativeWebView__deleteObject(id);
+    }
+
+    public void updateObject(Integer id, int property) {
+        ScilabNativeWebView__updateObject(id, property);
+    }
+}
index 84cfeb9..7171184 100644 (file)
@@ -1,6 +1,6 @@
 #include "CallGraphicController.hxx"
 /* Generated by GIWS (version 2.0.2) with command:
-giws --disable-return-size-array --output-dir src/jni/ --throws-exception-on-error --description-file src/jni/graphic_objects.giws.xml
+giws --disable-return-size-array --output-dir . --throws-exception-on-error --description-file graphic_objects.giws.xml
 */
 /*
 
@@ -9,14 +9,31 @@ This is generated code.
 This software is a computer program whose purpose is to hide the complexity
 of accessing Java objects/methods from C++ code.
 
-Copyright (C) 2012 - 2016 - Scilab Enterprises
-
-This file is hereby licensed under the terms of the GNU GPL v2.0,
-pursuant to article 5.3.4 of the CeCILL v.2.1.
-This file was originally licensed under the terms of the CeCILL v2.1,
-and continues to be available under such terms.
-For more information, see the COPYING file which you should have received
-along with this program.
+This software is governed by the CeCILL-B license under French law and
+abiding by the rules of distribution of free software.  You can  use,
+modify and/ or redistribute the software under the terms of the CeCILL-B
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info".
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability.
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or
+data to be ensured and,  more generally, to use and operate it in the
+same conditions as regards security.
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL-B license and that you accept its terms.
 */
 
 namespace org_scilab_modules_graphic_objects {
@@ -77,7 +94,7 @@ localInstance = curEnv->NewObject( this->instanceClass, constructObject ) ;
 if(localInstance == NULL){
 throw GiwsException::JniObjectCreationException(curEnv, this->className());
 }
+
 this->instance = curEnv->NewGlobalRef(localInstance) ;
 if(this->instance == NULL){
 throw GiwsException::JniObjectCreationException(curEnv, this->className());
@@ -106,6 +123,8 @@ jintArray_getGraphicObjectPropertyAsBooleanVectorjintintjintintID=NULL;
 jbooleansetGraphicObjectPropertyjintintjintintjbooleanArray_booleanbooleanID=NULL;
 voidregisterScilabViewID=NULL;
 voidunregisterScilabViewID=NULL;
+voidregisterScilabWebViewID=NULL;
+voidunregisterScilabWebViewID=NULL;
 jintgetConsoleIdentifierID=NULL;
 voidbuildFigureMenuBarjintintID=NULL;
 
@@ -150,6 +169,8 @@ jintArray_getGraphicObjectPropertyAsBooleanVectorjintintjintintID=NULL;
 jbooleansetGraphicObjectPropertyjintintjintintjbooleanArray_booleanbooleanID=NULL;
 voidregisterScilabViewID=NULL;
 voidunregisterScilabViewID=NULL;
+voidregisterScilabWebViewID=NULL;
+voidunregisterScilabWebViewID=NULL;
 jintgetConsoleIdentifierID=NULL;
 voidbuildFigureMenuBarjintintID=NULL;
 
@@ -304,7 +325,7 @@ delete[] myStringBuffer;
                                 throw GiwsException::JniCallMethodException(curEnv);
 }
 return myStringBuffer;
- } else { 
+ } else {
 curEnv->DeleteLocalRef(res);
 return NULL;
 }
@@ -377,7 +398,7 @@ delete[] arrayOfString;
 }
 curEnv->DeleteLocalRef(res);
 return arrayOfString;
- } else { 
+ } else {
 curEnv->DeleteLocalRef(res);
 return NULL;
 }
@@ -751,6 +772,46 @@ throw GiwsException::JniCallMethodException(curEnv);
 }
 }
 
+void CallGraphicController::registerScilabWebView (JavaVM * jvm_){
+
+JNIEnv * curEnv = NULL;
+jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
+jclass cls = initClass(curEnv);
+if ( cls == NULL) {
+throw GiwsException::JniCallMethodException(curEnv);
+}
+
+static jmethodID voidregisterScilabWebViewID = curEnv->GetStaticMethodID(cls, "registerScilabWebView", "()V" ) ;
+if (voidregisterScilabWebViewID == NULL) {
+throw GiwsException::JniMethodNotFoundException(curEnv, "registerScilabWebView");
+}
+
+                         curEnv->CallStaticVoidMethod(cls, voidregisterScilabWebViewID );
+                        if (curEnv->ExceptionCheck()) {
+throw GiwsException::JniCallMethodException(curEnv);
+}
+}
+
+void CallGraphicController::unregisterScilabWebView (JavaVM * jvm_){
+
+JNIEnv * curEnv = NULL;
+jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
+jclass cls = initClass(curEnv);
+if ( cls == NULL) {
+throw GiwsException::JniCallMethodException(curEnv);
+}
+
+static jmethodID voidunregisterScilabWebViewID = curEnv->GetStaticMethodID(cls, "unregisterScilabWebView", "()V" ) ;
+if (voidunregisterScilabWebViewID == NULL) {
+throw GiwsException::JniMethodNotFoundException(curEnv, "unregisterScilabWebView");
+}
+
+                         curEnv->CallStaticVoidMethod(cls, voidunregisterScilabWebViewID );
+                        if (curEnv->ExceptionCheck()) {
+throw GiwsException::JniCallMethodException(curEnv);
+}
+}
+
 int CallGraphicController::getConsoleIdentifier (JavaVM * jvm_){
 
 JNIEnv * curEnv = NULL;
index a921a2f..c5b6291 100644 (file)
@@ -1,5 +1,5 @@
 /* Generated by GIWS (version 2.0.2) with command:
-giws --disable-return-size-array --output-dir src/jni/ --throws-exception-on-error --description-file src/jni/graphic_objects.giws.xml
+giws --disable-return-size-array --output-dir . --throws-exception-on-error --description-file graphic_objects.giws.xml
 */
 /*
 
@@ -8,14 +8,31 @@ This is generated code.
 This software is a computer program whose purpose is to hide the complexity
 of accessing Java objects/methods from C++ code.
 
-Copyright (C) 2012 - 2016 - Scilab Enterprises
-
-This file is hereby licensed under the terms of the GNU GPL v2.0,
-pursuant to article 5.3.4 of the CeCILL v.2.1.
-This file was originally licensed under the terms of the CeCILL v2.1,
-and continues to be available under such terms.
-For more information, see the COPYING file which you should have received
-along with this program.
+This software is governed by the CeCILL-B license under French law and
+abiding by the rules of distribution of free software.  You can  use,
+modify and/ or redistribute the software under the terms of the CeCILL-B
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info".
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability.
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or
+data to be ensured and,  more generally, to use and operate it in the
+same conditions as regards security.
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL-B license and that you accept its terms.
 */
 
 
@@ -80,6 +97,8 @@ jmethodID jintArray_getGraphicObjectPropertyAsBooleanVectorjintintjintintID; //
 jmethodID jbooleansetGraphicObjectPropertyjintintjintintjbooleanArray_booleanbooleanID; // cache method id
 jmethodID voidregisterScilabViewID; // cache method id
 jmethodID voidunregisterScilabViewID; // cache method id
+jmethodID voidregisterScilabWebViewID; // cache method id
+jmethodID voidunregisterScilabWebViewID; // cache method id
 jmethodID jintgetConsoleIdentifierID; // cache method id
 jmethodID voidbuildFigureMenuBarjintintID; // cache method id
 
@@ -88,7 +107,7 @@ jmethodID voidbuildFigureMenuBarjintintID; // cache method id
 jobject instance;
 jclass instanceClass; // cache class
 
-                       
+
 // Caching (if any)
 
 
@@ -115,9 +134,9 @@ CallGraphicController(JavaVM * jvm_);
 CallGraphicController(JavaVM * jvm_, jobject JObj);
 
 
-/** 
+/**
 * This is a fake constructor to avoid the constructor
-* chaining when dealing with extended giws classes 
+* chaining when dealing with extended giws classes
 */
 #ifdef FAKEGIWSDATATYPE
 CallGraphicController(fakeGiwsDataType::fakeGiwsDataType /* unused */) {}
@@ -181,6 +200,10 @@ static void registerScilabView(JavaVM * jvm_);
 
 static void unregisterScilabView(JavaVM * jvm_);
 
+static void registerScilabWebView(JavaVM * jvm_);
+
+static void unregisterScilabWebView(JavaVM * jvm_);
+
 static int getConsoleIdentifier(JavaVM * jvm_);
 
 static void buildFigureMenuBar(JavaVM * jvm_, int figureId);
index fa618bf..0b42324 100644 (file)
@@ -1,6 +1,6 @@
 #include "CallXmlLoader.hxx"
 /* Generated by GIWS (version 2.0.2) with command:
-giws --disable-return-size-array --output-dir src/jni/ --throws-exception-on-error --description-file src/jni/graphic_objects.giws.xml
+giws --disable-return-size-array --output-dir . --throws-exception-on-error --description-file graphic_objects.giws.xml
 */
 /*
 
@@ -9,14 +9,31 @@ This is generated code.
 This software is a computer program whose purpose is to hide the complexity
 of accessing Java objects/methods from C++ code.
 
-Copyright (C) 2012 - 2016 - Scilab Enterprises
-
-This file is hereby licensed under the terms of the GNU GPL v2.0,
-pursuant to article 5.3.4 of the CeCILL v.2.1.
-This file was originally licensed under the terms of the CeCILL v2.1,
-and continues to be available under such terms.
-For more information, see the COPYING file which you should have received
-along with this program.
+This software is governed by the CeCILL-B license under French law and
+abiding by the rules of distribution of free software.  You can  use,
+modify and/ or redistribute the software under the terms of the CeCILL-B
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info".
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability.
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or
+data to be ensured and,  more generally, to use and operate it in the
+same conditions as regards security.
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL-B license and that you accept its terms.
 */
 
 namespace org_scilab_modules_graphic_objects {
@@ -77,7 +94,7 @@ localInstance = curEnv->NewObject( this->instanceClass, constructObject ) ;
 if(localInstance == NULL){
 throw GiwsException::JniObjectCreationException(curEnv, this->className());
 }
+
 this->instance = curEnv->NewGlobalRef(localInstance) ;
 if(this->instance == NULL){
 throw GiwsException::JniObjectCreationException(curEnv, this->className());
@@ -202,7 +219,7 @@ delete[] myStringBuffer;
                                 throw GiwsException::JniCallMethodException(curEnv);
 }
 return myStringBuffer;
- } else { 
+ } else {
 curEnv->DeleteLocalRef(res);
 return NULL;
 }
index a77016d..c0d1118 100644 (file)
@@ -1,5 +1,5 @@
 /* Generated by GIWS (version 2.0.2) with command:
-giws --disable-return-size-array --output-dir src/jni/ --throws-exception-on-error --description-file src/jni/graphic_objects.giws.xml
+giws --disable-return-size-array --output-dir . --throws-exception-on-error --description-file graphic_objects.giws.xml
 */
 /*
 
@@ -8,14 +8,31 @@ This is generated code.
 This software is a computer program whose purpose is to hide the complexity
 of accessing Java objects/methods from C++ code.
 
-Copyright (C) 2012 - 2016 - Scilab Enterprises
-
-This file is hereby licensed under the terms of the GNU GPL v2.0,
-pursuant to article 5.3.4 of the CeCILL v.2.1.
-This file was originally licensed under the terms of the CeCILL v2.1,
-and continues to be available under such terms.
-For more information, see the COPYING file which you should have received
-along with this program.
+This software is governed by the CeCILL-B license under French law and
+abiding by the rules of distribution of free software.  You can  use,
+modify and/ or redistribute the software under the terms of the CeCILL-B
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info".
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability.
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or
+data to be ensured and,  more generally, to use and operate it in the
+same conditions as regards security.
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL-B license and that you accept its terms.
 */
 
 
@@ -68,7 +85,7 @@ jmethodID jintDomLoadjstringjava_lang_StringID; // cache method id
 jobject instance;
 jclass instanceClass; // cache class
 
-                       
+
 // Caching (if any)
 
 
@@ -95,9 +112,9 @@ CallXmlLoader(JavaVM * jvm_);
 CallXmlLoader(JavaVM * jvm_, jobject JObj);
 
 
-/** 
+/**
 * This is a fake constructor to avoid the constructor
-* chaining when dealing with extended giws classes 
+* chaining when dealing with extended giws classes
 */
 #ifdef FAKEGIWSDATATYPE
 CallXmlLoader(fakeGiwsDataType::fakeGiwsDataType /* unused */) {}
diff --git a/scilab/modules/graphic_objects/src/jni/ScilabNativeWebView.i b/scilab/modules/graphic_objects/src/jni/ScilabNativeWebView.i
new file mode 100644 (file)
index 0000000..f1c3fdf
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2016 - Scilab Enterprises - Antoine ELIAS
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ */
+
+/**
+ * Windows: swig -java -package org.scilab.modules.graphic_objects -outdir ../java/org/scilab/modules/graphic_objects/ ScilabNativeWebView.i
+ * Other: Use the option --enable-build-swig to the configure
+*/
+
+%module ScilabNativeWebView
+
+%pragma(java) jniclasscode=%{
+  static {
+    try {
+        System.loadLibrary("scigraphic_objects");
+    } catch (UnsatisfiedLinkError e) {
+      System.err.println("Native library failed to load. \n" + e);
+      System.exit(1);
+    }
+  }
+%}
+
+%inline %{
+    extern void ScilabNativeWebView__createObject(int id);
+    extern void ScilabNativeWebView__deleteObject(int id);
+    extern void ScilabNativeWebView__updateObject(int id, int iProperty);
+    %}
diff --git a/scilab/modules/graphic_objects/src/jni/ScilabNativeWebView_wrap.c b/scilab/modules/graphic_objects/src/jni/ScilabNativeWebView_wrap.c
new file mode 100644 (file)
index 0000000..5409a68
--- /dev/null
@@ -0,0 +1,251 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 3.0.8
+ *
+ * This file is not intended to be easily readable and contains a number of
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+
+#ifndef SWIGJAVA
+#define SWIGJAVA
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__))
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__))
+# else
+#   define SWIGUNUSED
+# endif
+#endif
+
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
+#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
+# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
+#endif
+
+/* Intel's compiler complains if a variable which was never initialised is
+ * cast to void, which is a common idiom which we use to indicate that we
+ * are aware a variable isn't used.  So we just silence that warning.
+ * See: https://github.com/swig/swig/issues/192 for more discussion.
+ */
+#ifdef __INTEL_COMPILER
+# pragma warning disable 592
+#endif
+
+
+/* Fix for jlong on some versions of gcc on Windows */
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+  typedef long long __int64;
+#endif
+
+/* Fix for jlong on 64-bit x86 Solaris */
+#if defined(__x86_64)
+# ifdef _LP64
+#   undef _LP64
+# endif
+#endif
+
+#include <jni.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+/* Support for throwing Java exceptions */
+typedef enum {
+  SWIG_JavaOutOfMemoryError = 1, 
+  SWIG_JavaIOException, 
+  SWIG_JavaRuntimeException, 
+  SWIG_JavaIndexOutOfBoundsException,
+  SWIG_JavaArithmeticException,
+  SWIG_JavaIllegalArgumentException,
+  SWIG_JavaNullPointerException,
+  SWIG_JavaDirectorPureVirtual,
+  SWIG_JavaUnknownError
+} SWIG_JavaExceptionCodes;
+
+typedef struct {
+  SWIG_JavaExceptionCodes code;
+  const char *java_exception;
+} SWIG_JavaExceptions_t;
+
+
+static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
+  jclass excep;
+  static const SWIG_JavaExceptions_t java_exceptions[] = {
+    { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
+    { SWIG_JavaIOException, "java/io/IOException" },
+    { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
+    { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
+    { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
+    { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
+    { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
+    { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
+    { SWIG_JavaUnknownError,  "java/lang/UnknownError" },
+    { (SWIG_JavaExceptionCodes)0,  "java/lang/UnknownError" }
+  };
+  const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
+
+  while (except_ptr->code != code && except_ptr->code)
+    except_ptr++;
+
+  (*jenv)->ExceptionClear(jenv);
+  excep = (*jenv)->FindClass(jenv, except_ptr->java_exception);
+  if (excep)
+    (*jenv)->ThrowNew(jenv, excep, msg);
+}
+
+
+/* Contract support */
+
+#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else
+
+
+    extern void ScilabNativeWebView__createObject(int id);
+    extern void ScilabNativeWebView__deleteObject(int id);
+    extern void ScilabNativeWebView__updateObject(int id, int iProperty);
+    
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeWebViewJNI_ScilabNativeWebView_1_1createObject(JNIEnv *jenv, jclass jcls, jint jarg1) {
+  int arg1 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = (int)jarg1; 
+  ScilabNativeWebView__createObject(arg1);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeWebViewJNI_ScilabNativeWebView_1_1deleteObject(JNIEnv *jenv, jclass jcls, jint jarg1) {
+  int arg1 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = (int)jarg1; 
+  ScilabNativeWebView__deleteObject(arg1);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeWebViewJNI_ScilabNativeWebView_1_1updateObject(JNIEnv *jenv, jclass jcls, jint jarg1, jint jarg2) {
+  int arg1 ;
+  int arg2 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = (int)jarg1; 
+  arg2 = (int)jarg2; 
+  ScilabNativeWebView__updateObject(arg1,arg2);
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
index c8430f1..2d60872 100644 (file)
         </method>
         <method name="unregisterScilabView" returnType="void" modifier="static">
         </method>
+        <method name="registerScilabWebView" returnType="void" modifier="static">
+        </method>
+        <method name="unregisterScilabWebView" returnType="void" modifier="static">
+        </method>
         <method name="getConsoleIdentifier" returnType="int" modifier="static">
         </method>
         <method name="buildFigureMenuBar" returnType="void" modifier="static">
index 316c70a..b37aef4 100644 (file)
@@ -49,6 +49,7 @@ void loadGraphicModule(void)
 
     /* Register Scilab as a dedicated View */
     registerToController();
+    registerWebToController();
 
     isGraphicModuleLoaded = TRUE;
 }
@@ -65,6 +66,7 @@ void closeGraphicModule(void)
 
     /* Unegister Scilab as a dedicated View */
     unregisterToController();
+    unregisterWebToController();
 
     isGraphicModuleLoaded = FALSE;
 
index 2fbabcf..75e7702 100644 (file)
@@ -242,6 +242,22 @@ static int get_option(const int argc, char *argv[], ScilabEngineInfo* _pSEI)
         {
             _pSEI->iKeepConsole = 1;
         }
+        else if (!strcmp("-commandaddr", argv[i]))
+        {
+            i++;
+            if (argc >= i)
+            {
+                ConfigVariable::setCommandAddress(argv[i]);
+            }
+        }
+        else if (!strcmp("-graphicaddr", argv[i]))
+        {
+            i++;
+            if (argc >= i)
+            {
+                ConfigVariable::setGraphicAddress(argv[i]);
+            }
+        }
     }
 
     ConfigVariable::setCommandLineArgs(argc, argv);
diff --git a/scilab/node/html/index.html b/scilab/node/html/index.html
new file mode 100644 (file)
index 0000000..bd1f279
--- /dev/null
@@ -0,0 +1,170 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset='UTF-8' />
+    <title>Scilab via Socket.IO v0.3</title>
+    <script type='text/javascript' src='/socket.io/socket.io.js'></script>
+    <style type='text/css'>
+    
+    body {
+        background-color : rgb(192,192,192);
+        color : black;
+        text-align : center;
+    }
+    
+    .log {
+        background-color : white;
+        opacity : 1;
+        width : 500px;
+        height : 100px;
+        margin : auto;
+        text-align:left;
+        border : 2px rgb(0,0,0) solid;
+        overflow : auto;
+        font-family: 'Lucida Console', Monaco, monospace;
+        font-size:10pt;
+    }
+    .GO_FIGURE {
+        /*
+            must be relative or absolute 
+            to allow absolue positioning of children
+        */
+        position: relative;
+        background-color : white;
+        width : 600px;
+        height : 600px;
+        margin : auto;
+        border : 2px rgb(0,0,0) solid;
+        overflow : auto;
+        text-align: left;
+    }
+
+    .GO_PUSHBUTTON {
+        position: absolute;
+        left: 20px;
+        top: 440px;
+        width : 40px;
+        height : 20px;
+        text-align:center;
+        overflow : hidden;
+        font-family: Tahoma;
+        font-size:11pt;
+    }
+
+    #infobar {
+        background-color : rgb(192,192,192);
+        opacity : 1;
+        width : 500px;
+        height : 20px;
+        margin : auto;
+        border : 1px rgb(0,0,0) solid;
+        font-weight: bold;
+    }
+    
+    #command {
+        background-color : white;
+        opacity : 1;
+        width : 500px;
+        height : 100px;
+        margin : auto;
+        border : 2px rgb(0,0,0) solid;
+        overflow : auto;
+        font-family: 'Lucida Console', Monaco, monospace;
+        font-size:10pt;
+    }
+
+    </style>
+</head>
+    <body>
+        <h1>Scilab WebView</h1>
+        <div id='infobar'></div>
+        </br>
+            <textarea id='command'>
+f = createWindow();
+uicontrol("position", [50 50 100 40], "string", "+ 1", "callback", "v = eval(get(''num'', ''string''));set(''num'', ''string'', string(v + 1));");
+uicontrol("position", [170 50 100 40], "string", "0", "tag", "num");
+uicontrol("position", [290 50 100 40], "string", "- 1", "callback", "v = eval(get(''num'', ''string''));set(''num'', ''string'', string(v - 1));");
+
+//f = createWindow();
+//f.position(3:4) = [500, 500];
+//for i=1:100
+//    x = floor((i-1) / 10);
+//    y = modulo((i-1), 10);
+   
+//    uicontrol("position", [50*x, 50*y,50,50],"string", string(x) + string(y), "callback", "set(gcbo, ''string'', ''clicked'')");
+//end
+            </textarea>
+            </br>
+            <button id="cmdbtn" onClick="execute()">Execute</button>
+        <h3>Logger:</h3>
+        <div class='log' id='logger'></div>
+        <script type='text/javascript'>
+            var command;
+            // connect to server
+            var socket = io();
+
+            resetLogger('');
+            setInfo('');
+            
+            //callback
+            function execute() {
+                resetLogger();
+                data = document.getElementById('command').value;
+                socket.emit('command', data);
+                var objCmd = document.getElementById('cmdbtn');
+                objCmd.disabled  = true;
+                return false;
+            }
+            
+            //callback click
+            function OnUIClick(elem) {
+                var id = elem.id;
+                id = parseInt(id.substring(3)); //ignore "uid"
+                socket.emit("callback", {uid:id});
+            }
+             //tools
+            function setInfo(data) {
+                document.getElementById('infobar').innerHTML = data;
+            }
+            
+           function resetLogger(data) {
+                var objDiv = document.getElementById('logger');
+                objDiv.innerHTML = '';
+            }
+            
+           function setLogger(data) {
+                var objDiv = document.getElementById('logger');
+                objDiv.innerHTML += data + '</br>';
+                objDiv.scrollTop = objDiv.scrollHeight;
+            }
+            
+            //socket events management
+            socket.on('status', function (msg) {
+                setInfo(msg);
+            });
+
+            socket.on('command_end', function () {
+                var objCmd = document.getElementById('cmdbtn');
+                objCmd.disabled  = false;
+            });
+
+            socket.on('disconnect', function () {
+                setInfo('Connection lost');
+            });
+            
+            socket.on('graphic_create', function (msg) {
+                //setLogger('<font color="green">' +  msg.data + '</font>');
+                eval(msg.data);
+            });
+            
+            socket.on('graphic_delete', function (msg) {
+                //setLogger('<font color="red">' + 'graphic_delete(' + msg.uid + ')' + '</font>');
+            });
+            
+            socket.on('graphic_update', function (msg) {
+                //setLogger('<font color="orange">' +  msg.data + '</font>');
+                eval(msg.data);
+            });
+        </script>
+    </body>
+</html>
diff --git a/scilab/node/scilab_process.js b/scilab/node/scilab_process.js
new file mode 100644 (file)
index 0000000..d705161
--- /dev/null
@@ -0,0 +1,102 @@
+var spawn = require('child_process').spawn;
+
+var L = console.log;
+var id = -1;
+var io = [];
+
+var debug = false;
+
+process.on('message', function(msg){
+    switch(msg.msgtype.toLowerCase()) {
+        case 'initialization' :
+            L('initialization ' + '(' + process.pid + ')');
+            id = msg.id;
+            
+            //start command server to chat with Scilab
+            var port = 10000+id;
+            commandio = require('socket.io')(port);
+            var commandaddr = 'http://127.0.0.1:' + port;
+            
+            commandio.on('connection', function (socket) {
+                L("Scilab command connected");
+
+                socket.on('command_end', function () {
+                    L('command_end');
+                    process.send({msgtype:'command_end'});
+                });
+
+                socket.on('disconnect', function () {
+                    L('scilab disconnected');
+                });
+            });
+
+            //start graphic server to chat with graphic
+            port += 1;
+            graphicio = require('socket.io')(port);
+            var graphicaddr = 'http://127.0.0.1:' + port;
+
+            graphicio.on('connection', function (socket) {
+                L("Scilab graphic connected");
+
+                socket.on('graphic_create', function (msg) {
+                    process.send({msgtype:'graphic_create', data:msg});
+                });
+
+                socket.on('graphic_delete', function (msg) {
+                    process.send({msgtype:'graphic_delete', data:msg});
+                });
+
+                socket.on('graphic_update', function (msg) {
+                    process.send({msgtype:'graphic_update', data:msg});
+                });
+
+                socket.on('disconnect', function () {
+                    L('scilab disconnected');
+                });
+            });
+
+
+            //launch scilab with init command
+            var app = process.env.SCI + "/bin/wscilex.exe";
+
+            var scilabApp = spawn(app, ["-nw", "-commandaddr", commandaddr, "-graphicaddr", graphicaddr]);
+            
+            //to debug
+            if(debug) {
+                scilabApp.stdout.on('data', function(data) {
+                    L("scilab out :" + data.toString());
+                });
+                
+                scilabApp.stderr.on('data', function(data) {
+                    L("scilab err :" + data.toString());
+                });
+            }
+            
+           commandio.on('disconnect', function (socket) {
+                L('scilab command disconnected 2');
+            });  
+
+            graphicio.on('disconnect', function (socket) {
+                L('scilab graphic disconnected 2');
+            });   
+            
+            break;
+        case 'command' : 
+            L('command (' + process.pid + ') : ' + msg.data);
+            commandio.emit("command", {data:msg.data});
+            break;
+        case 'callback' : 
+            L('callback (' + process.pid + ') : ' + msg.data.uid);
+            graphicio.emit("callback", {uid:msg.data.uid});
+            break;
+        case 'restart' :
+            L('restart' + '(' + process.pid + ')');
+            break;
+        case 'quit' :
+            L('quit' + '(' + process.pid + ')');
+            break;
+        default :
+            L('unknow message : ' + msg.msgtype);
+        break;
+    }
+});
diff --git a/scilab/node/scilab_server.js b/scilab/node/scilab_server.js
new file mode 100644 (file)
index 0000000..c8c58bc
--- /dev/null
@@ -0,0 +1,116 @@
+var L = console.log;
+
+var app = require('express')();
+var server = require('http').Server(app);
+var io = require('socket.io')(server);
+
+var fork = require('child_process').fork;
+
+server.listen(1337);
+
+app.get('/', function(req, res){
+    L("req : " + req.toString());
+
+    res.sendFile(__dirname + '/html/index.html');
+    //messaging with web client
+});
+
+
+io.on('connection', function (socket) {
+    L('connection');
+    
+    //start process
+    var child = fork('./scilab_process.js');
+    //messaging with scilab js
+    child.on('message', function(msg){
+        switch(msg.msgtype.toLowerCase()) {
+            case 'command_end':
+                socket.emit(msg.msgtype);
+                break;
+            case 'graphic_create':
+            case 'graphic_delete':
+            case 'graphic_update':
+                //forward message
+                socket.emit(msg.msgtype, msg);
+                break;
+            default:
+                L('not manage : ' + msg.msgtype);
+                break;
+        }
+    });
+
+    child.send({msgtype:'initialization', id:child.pid});
+
+    // send connection status to client
+    socket.emit('status', 'Client connected');
+    
+    //receive command from client
+    socket.on('command', function (data) {
+        child.send({msgtype:'command', data:data});
+    });
+    
+    socket.on('callback', function (data) {
+        child.send({msgtype:'callback', data:data});
+    });
+    
+    socket.on('disconnect', function () {
+        L("disconnect");
+        child.send({msgtype:'quit'});
+    });
+
+});
+
+
+/*
+
+
+var server = http.createServer(function (req, res) {
+    //create scilab child
+    L("req : " + req.toString());
+    var socket;
+    var child = fork('./scilab_process.js');
+    //messaging with scilab js
+    child.on('message', function(msg){
+        switch(msg.msgtype.toLowerCase()) {
+            case 'command_end':
+                socket.emit(msg.msgtype);
+                break;
+            case 'graphic_create':
+            case 'graphic_delete':
+            case 'graphic_update':
+                //forward message
+                socket.emit(msg.msgtype, msg);
+                break;
+            default:
+                L('not manage : ' + msg.msgtype);
+                break;
+        }
+    });
+
+    child.send({msgtype:'initialization', id:child.pid});
+    fs.readFile('./html/index.html', 'utf-8', function(error, content) {
+        res.writeHead(200, {'Content-Type' : 'text/html'});
+        res.end(content);
+    })
+
+  
+
+    //messaging with web client
+    io.sockets.on('connection', function (s) {
+        socket = s;
+        // send connection status to client
+        socket.emit('status', 'Client connected');
+        
+        //receive command from client
+        socket.on('command', function (data) {
+            child.send({msgtype:'command', data:data});
+        });
+    });
+}).listen(1337, function(){
+    L("gné");
+});
+
+
+*/
+
+L('Server running at http://127.0.0.1:1337/');
diff --git a/scilab/node/windows-launcher.bat b/scilab/node/windows-launcher.bat
new file mode 100644 (file)
index 0000000..a4bd5e1
--- /dev/null
@@ -0,0 +1,5 @@
+@echo off
+setlocal
+set SCI=%~dp0\..
+set PATH=%SCI%\bin;%PATH%
+node scilab_server.js