20,741
edits
| Line 50: | Line 50: | ||
== Nasal memory pools == | == Nasal memory pools == | ||
For each of the 7 Nasal data types, there is a separate storage pool available (0..6). Each storage pool is addressed by its enum index: 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 (0..6). Each storage pool is addressed by its enum index: https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/data.h#line65 | ||
| Line 75: | Line 61: | ||
Globals->pools[T_VEC]; | Globals->pools[T_VEC]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
The 7 storage pools are declared in code.h as part of the "Globals" structure, line 39: https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/code.h#line39 | The 7 storage pools are declared in code.h as part of the "Globals" structure, line 39: https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/code.h#line39 | ||
| Line 117: | Line 102: | ||
struct Context* freeContexts; | struct Context* freeContexts; | ||
struct Context* allContexts; | struct Context* allContexts; | ||
}; | |||
</syntaxhighlight> | |||
The layout of the Nasal memory structure pool can be found in data.h, line 172: https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/data.h#line172 | |||
<syntaxhighlight lang="C"> | |||
struct naPool { | |||
int type; | |||
int elemsz; | |||
struct Block* blocks; | |||
void** free0; // pointer to the alloced buffer | |||
int freesz; // size of the alloced buffer | |||
void** free; // current "free frame" | |||
int nfree; // down-counting index within the free frame | |||
int freetop; // curr. top of the free list | |||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||