5
edits
Philosopher (talk | contribs) m (use Template:Git file) |
(→Intro: updated) |
||
Line 52: | Line 52: | ||
= Intro = | = Intro = | ||
In FlightGear, the simplest way to add new extension functions is to look at the existing functions in {{Git file|gitorious|fg/flightgear|next|src/Scripting/NasalSys.cxx| | In FlightGear, the simplest way to add new extension functions is to look at the existing functions in {{Git file|gitorious|fg/flightgear|next|src/Scripting/NasalSys.cxx|747|pre=$FG_SRC/}}. | ||
There is a static table of function pointers (named funcs[]) referencing extension functions, along with their corresponding names in Nasal: {{Git file|gitorious|fg/flightgear|next|src/Scripting/NasalSys.cxx|482|pre=$FG_SRC/}} | There is a static table of function pointers (named funcs[]) referencing extension functions, along with their corresponding names in Nasal: {{Git file|gitorious|fg/flightgear|next|src/Scripting/NasalSys.cxx|482|pre=$FG_SRC/}} | ||
The following is a copy of the extension function list, taken in | The following is a copy of the extension function list, taken in 12/2014: | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
// Table of extension functions. | // Table of extension functions. Terminate with zeros. | ||
static struct { const char* name; naCFunction func; } funcs[] = { | |||
{ "getprop", f_getprop }, | |||
{ "setprop", f_setprop }, | |||
{ "print", f_print }, | |||
{ "logprint", f_logprint }, | |||
{ "_fgcommand", f_fgcommand }, | |||
{ "settimer", f_settimer }, | |||
{ "maketimer", f_makeTimer }, | |||
{ "_setlistener", f_setlistener }, | |||
{ "removelistener", f_removelistener }, | |||
{ "addcommand", f_addCommand }, | |||
{ "removecommand", f_removeCommand }, | |||
{ "_cmdarg", f_cmdarg }, | |||
{ "_interpolate", f_interpolate }, | |||
{ "rand", f_rand }, | |||
{ "srand", f_srand }, | |||
{ "abort", f_abort }, | |||
{ "directory", f_directory }, | |||
{ "resolvepath", f_resolveDataPath }, | |||
{ "finddata", f_findDataDir }, | |||
{ "parsexml", f_parsexml }, | |||
{ "parse_markdown", f_parse_markdown }, | |||
{ "md5", f_md5 }, | |||
{ "systime", f_systime }, | |||
{ 0, 0 } | |||
}; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
edits