Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Changes

Jump to: navigation, search

Howto:Extend Nasal

1,052 bytes added, 18:08, 5 November 2013
m
Status (cppbind): forum2wiki http://forum.flightgear.org/viewtopic.php?f=66&t=21217&p=193362&hilit=cppbind#p193362
The cppbind framework is much more generic and high level than the bare APIs documented here, it includes unit testing support and makes use of modern C++ features like templates and STL support, including SimGear specific types like SGPath/SGGeod etc, its overhead is fairly small (not just performance, but also LoC to create new bindings).
The cppbind framework is already extensively used by the [[Canvas]] system and the NasalPositioned bindings, both of which are a good place to look for code examples.
 
You will find that most of the "old" code in $FG_SRC/Scripting still uses those C-APIs for interacting with the Nasal engine. Only the new code, #include'ing <simgear/nasal/cppbind>, uses boost templates to hide the low level details.
 
Most of the code in the Nasal subsystem itself (FGNasalSys) also still uses the legacy C APIs - this is just to explain the two approaches, to avoid unnecessary confusion.
Overall, it's a good idea to favor cppbind over the low-level approach documented here, it isn't only much more elegant, but also saves you tons of typing, too
 
Some of the more straightforward things to play with would be exposing useful SG/FG classes to Nasal space, such as the SGSubsystem interface to register scripted SGSubsystems, or the autopilot system.
 
For more technical Nasal questions (C API, internals etc), you'll probably want to refer to the forum, in particular: Philosopher, TheTom, Zakalawe or Hooray - TheTom and Zakalawe can also provide help on using cppbind, having both used it extensively during the last months.
== Scope ==
18,295
edits

Navigation menu