I spent this morning researching JK's Heap verbs. Here's what I found:
The Heap verbs are used to create an array of storage slots in memory to hold variable values. The important thing is that the amount of storage is dynamic - meaning that you don't have to know in advance how much storage you'll need. A description of each verb:
HeapNew() creates numbered memory slots beginning at start_num and ending and end_num. The last slot in the array cannot be used. start_pointer will have the same value as start_num.
HeapSet() gives a flex value to one of the storage slots created by HeapNew().
HeapGet() returns the value given to the storage slot by HeapSet(). If the slot does not have a value, HeapGet() will crash. If there is no heap, HeapGet() will return 0.
HeapFree() removes a cog's heap. Because each cog has its own heap, HeapFree() does not need parameters.
I have already updated the verb info in the DataMaster, and when Geocities finishes its "maintenance," I'll upload the new version.
So what do you think?![http://forums.massassi.net/html/smile.gif [http://forums.massassi.net/html/smile.gif]](http://forums.massassi.net/html/smile.gif)
------------------
Author of the Jedi Knight DataMaster.
Visit Saber's Domain.
The Heap verbs are used to create an array of storage slots in memory to hold variable values. The important thing is that the amount of storage is dynamic - meaning that you don't have to know in advance how much storage you'll need. A description of each verb:
Code:
start_pointer=HeapNew(start_num, end_num);
HeapNew() creates numbered memory slots beginning at start_num and ending and end_num. The last slot in the array cannot be used. start_pointer will have the same value as start_num.
Code:
HeapSet(pointer, value);
HeapSet() gives a flex value to one of the storage slots created by HeapNew().
Code:
HeapGet(pointer);
HeapGet() returns the value given to the storage slot by HeapSet(). If the slot does not have a value, HeapGet() will crash. If there is no heap, HeapGet() will return 0.
Code:
HeapFree();
HeapFree() removes a cog's heap. Because each cog has its own heap, HeapFree() does not need parameters.
I have already updated the verb info in the DataMaster, and when Geocities finishes its "maintenance," I'll upload the new version.
So what do you think?
![http://forums.massassi.net/html/smile.gif [http://forums.massassi.net/html/smile.gif]](http://forums.massassi.net/html/smile.gif)
------------------
Author of the Jedi Knight DataMaster.
Visit Saber's Domain.