How the Nasal GC works: Difference between revisions

Jump to navigation Jump to search
m
Line 58: Line 58:
== Nasal memory pools ==
== Nasal memory pools ==


For each of the 7 Nasal data types, there is a separate storage pool available. Each storage pool is addressed by its enum index (0..6): https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/data.h#line65
For each of the 7 Nasal data types, there is a separate storage pool available, declared as part of the "Globals" structure.
 
For example, '''globals->pools[T_VEC]''' refers to the storage pools  for vectors:
 
<syntaxhighlight lang="C">
<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!
globals->pools[T_VEC];
</syntaxhighlight>
</syntaxhighlight>


For example, Globals->pools[T_VEC] refers to the storage pools  for vectors:
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">
<syntaxhighlight lang="C">
Globals->pools[T_VEC];
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>


Line 72: Line 74:


The relevant part is:
The relevant part is:


<syntaxhighlight lang="C">
<syntaxhighlight lang="C">

Navigation menu