1
0
Fork 0
Commit graph

25 commits

Author SHA1 Message Date
mfranz
e48967cb1d fix another crash on exit by finally converting the rest of unguarded
SGPropertyNode to guarded ones. This is also done for JSBSim/JSBSim.hxx,
for which JSB had given explicit permission a while ago. I postponed that
back then, but now is the time.
2006-06-11 10:21:10 +00:00
mfranz
52306b9093 add optional SGPropertyNode* argument to NasalSys::createModule. This is
used in dialog.cxx to allow XML dialogs access to their own prop tree via
Nasal's cmdarg(). That way dialogs can generate dynamic content, such as
list entries.
2006-04-27 15:56:51 +00:00
mfranz
7845f33c74 a bool isn't safe enough here, but a mutex shouldn't be necessary 2006-03-20 11:01:16 +00:00
mfranz
4c5e96f730 - disallow listener re-entry to prevent crash/runaway process
- move FGNasalListener function bodies to NasalSys.cxx (has become too big)
2006-03-20 07:13:10 +00:00
mfranz
83b64b0140 remove leftover #include; changed comment 2006-03-09 11:05:32 +00:00
mfranz
2796f3f4a5 NasalSys.[ch]xx:
implement FGNasalModelData class for execution of XML <load> and <unload>
  scripts. modelLoaded() is called by the model loader, and the destructor
  on branch removal.

modelmgr.cxx:
tilemgr.cxx:
tileentry.[ch]xx:
  make scenery and custom objects run their Nasal scripts on loading
  and unloading. Let OBJECT_STATIC object not be cached.
2006-03-09 09:04:03 +00:00
mfranz
77de0c8e09 add deleteModule() method 2006-03-08 10:35:20 +00:00
mfranz
55cde5f160 - assign unique id to listeners
- let setlistener return id
- add removelistener(id) command
2006-02-28 14:55:37 +00:00
mfranz
034e39dba5 screenPrint() is obsolete. Use screen.log.write() for the same purpose,
or write to the color properties in /sim/screen/. If this Nasal/GUI
implementation turns out to be too slow, we'll write a generic OpenGL/plib
version simliar to the ATCdisplay code.  (OK'ed by Andy and Stuart)
2006-02-13 20:08:04 +00:00
mfranz
d1fa3f9c7e store garbage collector id (again) in the listener class, and free the
handler on destruction. There's no explicit Nasal command for removing
a listener, but deleting the node should fully remove them.
2006-02-04 16:37:25 +00:00
mfranz
f9bf9fd073 fix for deadlock problem (as suggested by Andy) 2006-02-02 18:03:07 +00:00
mfranz
0d48631e3a cosmetics: subc isn't really a sub-context here (it was where I copied it
from)  -->  s/subc/c/
2006-01-27 19:59:25 +00:00
mfranz
32968d81f3 we need a way to specify other contexts than _context; idea & OK by Andy 2006-01-27 19:51:25 +00:00
mfranz
f0996fa47d create a new context for listener functions to avoid context corruption
(caused a crash when a timer triggered a listener) ... Idea and OK by Andy
2006-01-26 00:18:27 +00:00
ehofman
0e16419f0d Stuart Buchanan:
- Provide a Nasal interface to display simple text messages on the screen
  like the ATC display. In fact, I copied the code from the ATCDisplay.cxx
  and simply shifted it further down the screen.


Erik:

TODO: Integrate the two pieces of code.
2006-01-06 09:50:58 +00:00
mfranz
96c0a7bbc1 add _setlistener() function, so that slow property polling loops can be
replaced with efficient listener callbacks. One use is the new FPS display.
This is reviewed and OK'ed by Andy, relatively trivial and separated from
the rest of Nasal, so problems are quite unlikely and confined to users of
this function.

The callback is executed whenever the property is written to -- even if
the value didn't change. The triggering Node is available via cmdarg().

Examples:  _setlistener("/sim/crashed", func {print("haha!")});
           _setlistener("/foo/bar", func { print(cmdarg().getPath() ~ " changed")})
2005-12-16 19:11:03 +00:00
andy
0f704b0a6e Changes to support the new naCall API in SimGear. NOTE: these changes
are *not* backwards compatible, and require current SimGear to
compile.
2005-09-20 21:09:52 +00:00
mfranz
ece07db538 - rename initModule() to createModule() (as suggested by Andy)
- make it public
- enable handleCommand() to execute a binding (or other nasal code defined
  in a property system subtree) in a particular namespace (-> "module" child)
2005-06-19 17:09:03 +00:00
andy
568d53875e Make readScriptFile() public, and rename it to loadModule(), so that external
code can have access to the facility for loading modules from files.

Also includes a cast-int-to-pointer fix that causes a warning on 64 bit
systems.
2005-06-14 19:57:24 +00:00
andy
3a6bc316ed Same bug, different place. Don't treat a length of zero as "please
strlen() it", because real files and properties can have lengths of
zero.
2005-04-26 20:57:06 +00:00
andy
142854d3d1 Upgrade to Nasal 1.0 test candidate 2005-04-18 19:49:13 +00:00
andy
eb3f52c340 Turn the __timers garbage collector cache into a more generic "gcsave"
interface, and use it to cache FGNasalScript objects returned from
a new parseScript() method.

Added a rand() function.

Added an interpolate() function interface to the new SGInterpolator
subsystem.
2003-12-05 01:54:39 +00:00
ehofman
79e48829da Add Nasal Vs. 1.5 2003-12-01 14:35:49 +00:00
ehofman
2be85c1b1b gcc 2.95 and 3.0 requite handleTimer to be public 2003-11-27 14:34:37 +00:00
curt
d3181fb437 Andy Ross:
A set of changes to impliment Nasal support in FlightGear.  The nasal
interpreter is now part of SimGear.
2003-11-25 21:08:36 +00:00