]> git.mxchange.org Git - flightgear.git/commitdiff
Nasal: update for simgear changes.
authorThomas Geymayer <tomgey@gmail.com>
Sun, 20 Jul 2014 22:26:54 +0000 (00:26 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Sun, 20 Jul 2014 22:26:54 +0000 (00:26 +0200)
src/GUI/FileDialog.cxx
src/Scripting/NasalCanvas.cxx
src/Scripting/NasalString.cxx
src/Scripting/NasalSys.cxx

index 46ba317c80cd98f4eea8d92a5f4637ba1797fdf8..ec7769ad430664deb3d1edac134aa261c21a137d 100644 (file)
@@ -140,9 +140,8 @@ typedef nasal::Ghost<FileDialogPtr> NasalFileDialog;
 /**
  * Create new FGFileDialog and get ghost for it.
  */
-static naRef f_createFileDialog(naContext c, naRef me, int argc, naRef* args)
+static naRef f_createFileDialog(const nasal::CallContext& ctx)
 {
-    nasal::CallContext ctx(c, argc, args);
     FGFileDialog::Usage usage = (FGFileDialog::Usage) ctx.requireArg<int>(0);
   
 #if defined(SG_MAC)
@@ -153,7 +152,7 @@ static naRef f_createFileDialog(naContext c, naRef me, int argc, naRef* args)
     FileDialogPtr fd(new PUIFileDialog(usage));
 #endif
     
-    return nasal::to_nasal(c, fd);
+    return ctx.to_nasal(fd);
 }
 
 void postinitNasalGUI(naRef globals, naContext c)
index c449f2c037500a2e65d8bd0bb6db67511c08b761..36a5c5234fd71dc782b590e334a329ff0d094a8c 100644 (file)
@@ -139,11 +139,10 @@ static naRef f_createWindow(const nasal::CallContext& ctx)
 /**
  * Get ghost for existing Canvas.
  */
-static naRef f_getCanvas(naContext c, naRef me, int argc, naRef* args)
+static naRef f_getCanvas(const nasal::CallContext& ctx)
 {
-  nasal::CallContext ctx(c, argc, args);
   SGPropertyNode& props = *ctx.requireArg<SGPropertyNode*>(0);
-  CanvasMgr& canvas_mgr = requireCanvasMgr(c);
+  CanvasMgr& canvas_mgr = requireCanvasMgr(ctx.c);
 
   sc::CanvasPtr canvas;
   if( canvas_mgr.getPropertyRoot() == props.getParent() )
@@ -162,7 +161,7 @@ static naRef f_getCanvas(naContext c, naRef me, int argc, naRef* args)
       canvas = canvas_mgr.getCanvas( props.getIntValue("index") );
   }
 
-  return nasal::to_nasal(c, canvas);
+  return ctx.to_nasal(canvas);
 }
 
 naRef f_canvasCreateGroup(sc::Canvas& canvas, const nasal::CallContext& ctx)
index 331c75ffb6ab53a7b1d1fc6ae69c306148f159a7..fe937a0aa0a96bc680352a381b8dc1785d3e449b 100644 (file)
  *  compare(s)
  *  compare(pos, len, s)
  */
-static naRef f_compare(naContext c, naRef me, int argc, naRef* args)
+static naRef f_compare(const nasal::CallContext& ctx)
 {
-  nasal::CallContext ctx(c, argc, args);
-  nasal::String str = nasal::from_nasal<nasal::String>(c, me),
-                rhs = ctx.requireArg<nasal::String>(argc > 1 ? 2 : 0);
-  size_t pos = argc > 1 ? ctx.requireArg<int>(1) : 0;
-  size_t len = argc > 1 ? ctx.requireArg<int>(2) : 0;
+  nasal::String str = ctx.from_nasal<nasal::String>(ctx.me),
+                rhs = ctx.requireArg<nasal::String>(ctx.argc > 1 ? 2 : 0);
+  size_t pos = ctx.argc > 1 ? ctx.requireArg<int>(1) : 0;
+  size_t len = ctx.argc > 1 ? ctx.requireArg<int>(2) : 0;
 
   if( len == 0 )
     len = nasal::String::npos;
@@ -50,10 +49,9 @@ static naRef f_compare(naContext c, naRef me, int argc, naRef* args)
 /**
  *  Check whether string starts with other string
  */
-static naRef f_starts_with(naContext c, naRef me, int argc, naRef* args)
+static naRef f_starts_with(const nasal::CallContext& ctx)
 {
-  nasal::CallContext ctx(c, argc, args);
-  nasal::String str = nasal::from_nasal<nasal::String>(c, me),
+  nasal::String str = ctx.from_nasal<nasal::String>(ctx.me),
                 rhs = ctx.requireArg<nasal::String>(0);
 
   return naNum( str.starts_with(rhs) );
@@ -62,10 +60,9 @@ static naRef f_starts_with(naContext c, naRef me, int argc, naRef* args)
 /**
  *  Check whether string ends with other string
  */
-static naRef f_ends_with(naContext c, naRef me, int argc, naRef* args)
+static naRef f_ends_with(const nasal::CallContext& ctx)
 {
-  nasal::CallContext ctx(c, argc, args);
-  nasal::String str = nasal::from_nasal<nasal::String>(c, me),
+  nasal::String str = ctx.from_nasal<nasal::String>(ctx.me),
                 rhs = ctx.requireArg<nasal::String>(0);
 
   return naNum( str.ends_with(rhs) );
@@ -87,15 +84,14 @@ naRef pos_to_nasal(size_t pos)
  *
  *  find(c, pos = 0)
  */
-static naRef f_find(naContext c, naRef me, int argc, naRef* args)
+static naRef f_find(const nasal::CallContext& ctx)
 {
-  nasal::CallContext ctx(c, argc, args);
-  nasal::String str = nasal::from_nasal<nasal::String>(c, me),
+  nasal::String str = ctx.from_nasal<nasal::String>(ctx.me),
                 find = ctx.requireArg<nasal::String>(0);
   size_t pos = ctx.getArg<int>(1, 0);
 
   if( find.size() != 1 )
-    naRuntimeError(c, "string::find: single character expected");
+    naRuntimeError(ctx.c, "string::find: single character expected");
 
   return pos_to_nasal( str.find(*find.c_str(), pos) );
 }
@@ -105,10 +101,9 @@ static naRef f_find(naContext c, naRef me, int argc, naRef* args)
  *
  * find_first_of(search, pos = 0)
  */
-static naRef f_find_first_of(naContext c, naRef me, int argc, naRef* args)
+static naRef f_find_first_of(const nasal::CallContext& ctx)
 {
-  nasal::CallContext ctx(c, argc, args);
-  nasal::String str = nasal::from_nasal<nasal::String>(c, me),
+  nasal::String str = ctx.from_nasal<nasal::String>(ctx.me),
                 find = ctx.requireArg<nasal::String>(0);
   size_t pos = ctx.getArg<int>(1, 0);
 
@@ -120,10 +115,9 @@ static naRef f_find_first_of(naContext c, naRef me, int argc, naRef* args)
  *
  * find_first_not_of(search, pos = 0)
  */
-static naRef f_find_first_not_of(naContext c, naRef me, int argc, naRef* args)
+static naRef f_find_first_not_of(const nasal::CallContext& ctx)
 {
-  nasal::CallContext ctx(c, argc, args);
-  nasal::String str = nasal::from_nasal<nasal::String>(c, me),
+  nasal::String str = ctx.from_nasal<nasal::String>(ctx.me),
                 find = ctx.requireArg<nasal::String>(0);
   size_t pos = ctx.getArg<int>(1, 0);
 
index fde6319dbd3949b97ef1383ebc39dc16a21d76c1..f70aa3c619ca859f8f2d7850d0e29e46bec77823 100644 (file)
@@ -705,7 +705,7 @@ static naRef f_parsexml(naContext c, naRef me, int argc, naRef* args)
  */
 static naRef f_parse_markdown(naContext c, naRef me, int argc, naRef* args)
 {
-  nasal::CallContext ctx(c, argc, args);
+  nasal::CallContext ctx(c, me, argc, args);
   return ctx.to_nasal(
     simgear::SimpleMarkdown::parse(ctx.requireArg<std::string>(0))
   );