How the Nasal GC works: Difference between revisions

Jump to navigation Jump to search
m
Line 83: Line 83:


For each of the 7 Nasal data types, there is a separate storage pool available, declared as part of the "Globals" structure.
For each of the 7 Nasal data types, there is a separate storage pool available, declared as part of the "Globals" structure.
As can be seen, each storage pool is addressed by its enum index (0..6): https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/data.h#line65
<syntaxhighlight lang="C">
enum { T_STR, T_VEC, T_HASH, T_CODE, T_FUNC, T_CCODE, T_GHOST, NUM_NASAL_TYPES }; // V. important that this come last!
</syntaxhighlight>


For example, '''globals->pools[T_VEC]''' refers to the storage pools  for vectors:
For example, '''globals->pools[T_VEC]''' refers to the storage pools  for vectors:
Line 88: Line 93:
<syntaxhighlight lang="C">
<syntaxhighlight lang="C">
globals->pools[T_VEC];
globals->pools[T_VEC];
</syntaxhighlight>
As can be seen, each storage pool is addressed by its enum index (0..6): https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/data.h#line65
<syntaxhighlight lang="C">
enum { T_STR, T_VEC, T_HASH, T_CODE, T_FUNC, T_CCODE, T_GHOST, NUM_NASAL_TYPES }; // V. important that this come last!
</syntaxhighlight>
</syntaxhighlight>


Navigation menu