EO: add evoid to workaround bugs with Scilab parser 55/11255/4
Calixte DENIZET [Wed, 10 Apr 2013 15:09:33 +0000 (17:09 +0200)]
Change-Id: Ib1fc8cd0e37063ac79a408c598ab4fc278e9a304

scilab/modules/external_objects/etc/external_objects.start
scilab/modules/external_objects/src/cpp/ScilabObjects.cpp
scilab/modules/external_objects/src/cpp/invoke.cpp

index 9bd2787..2d7bb0e 100644 (file)
@@ -9,4 +9,5 @@
 
 // TODO : make this '71' more dynamic (with a funptr)
 intppty(71);
+evoid = mlist(["_EVoid", "_EnvId", "_id"], int32(0), int32(0));
 load("SCI/modules/external_objects/macros/lib");
\ No newline at end of file
index 7ed9596..994d2f1 100644 (file)
@@ -32,7 +32,7 @@ void ScilabObjects::initialization(ScilabAbstractEnvironment & env, void * pvApi
     if (!isInit)
     {
         isInit = true;
-        //createNamedEnvironmentObject(EXTERNAL_OBJECT, "enull", 0, 0, pvApiCtx);
+        //createNamedEnvironmentObject(EXTERNAL_VOID, "evoid", 0, 0, pvApiCtx);
     }
 }
 
@@ -673,6 +673,10 @@ int ScilabObjects::getArgumentId(int * addr, int * tmpvars, const bool isRef, co
                 }
                 return *id;
             }
+            else if (type == EXTERNAL_VOID)
+            {
+                return -1;
+            }
             else
             {
                 removeTemporaryVars(envId, tmpvars);
@@ -755,7 +759,7 @@ int ScilabObjects::getMListType(int * mlist, void * pvApiCtx)
 bool ScilabObjects::isValidExternal(int * mlist, void * pvApiCtx)
 {
     int type = getMListType(mlist, pvApiCtx);
-    return type == EXTERNAL_OBJECT || type == EXTERNAL_CLASS || type == EXTERNAL_VOID;
+    return type == EXTERNAL_OBJECT || type == EXTERNAL_CLASS;
 }
 
 bool ScilabObjects::isExternalObj(int * mlist, void * pvApiCtx)
index dab6fae..1e84c47 100644 (file)
@@ -82,6 +82,7 @@ int ScilabGateway::invoke(char * fname, const int envId, void * pvApiCtx)
         catch (ScilabAbstractEnvironmentException & e)
         {
             delete[] args;
+            ScilabObjects::removeTemporaryVars(envId, tmpvar);
             delete[] tmpvar;
             throw;
         }