]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scripting/NasalSys.hxx
Vivian MEAZZA:
[flightgear.git] / src / Scripting / NasalSys.hxx
index 8e584f9ebfe471ca75d3de2e677902daad9b10b5..4d59b8b2c8aa2908813dcbf14c610719affdd7dc 100644 (file)
@@ -15,6 +15,10 @@ public:
     virtual void init();
     virtual void update(double dt) { /* noop */ }
 
+    // Loads a nasal script from an external file and inserts it as a
+    // global module of the specified name.
+    void loadModule(SGPath file, const char* moduleName);
+
     // Simple hook to run arbitrary source code.  Returns a bool to
     // indicate successful execution.  Does *not* return any Nasal
     // values, because handling garbage-collected objects from C space
@@ -30,7 +34,7 @@ public:
     FGNasalScript* parseScript(const char* src, const char* name=0);
 
     // Implementation of the settimer extension function
-    void setTimer(naRef args);
+    void setTimer(int argc, naRef* args);
 
     // Returns a ghost wrapper for the current _cmdArg
     naRef cmdArgGhost();
@@ -38,6 +42,9 @@ public:
     // Callbacks for command and timer bindings
     virtual bool handleCommand(const SGPropertyNode* arg);
 
+    void createModule(const char* moduleName, const char* fileName,
+                    const char* src, int len);
+
 private:
     friend class FGNasalScript;
 
@@ -54,12 +61,9 @@ private:
     };
 
     void loadPropertyScripts();
-    void initModule(const char* moduleName, const char* fileName,
-                    const char* src, int len);
-    void readScriptFile(SGPath file, const char* lib);
     void hashset(naRef hash, const char* key, naRef val);
     void logError();
-    naRef parse(const char* filename, const char* buf, int len=0);
+    naRef parse(const char* filename, const char* buf, int len);
     naRef genPropsModule();
     naRef propNodeGhost(SGPropertyNode* handle);
 
@@ -88,7 +92,7 @@ public:
     ~FGNasalScript() { _nas->gcRelease(_gcKey); }
 
     bool call() {
-        naCall(_nas->_context, _code, naNil(), naNil(), naNil());
+        naCall(_nas->_context, _code, 0, 0, naNil(), naNil());
         return naGetError(_nas->_context) == 0;
     }