SaberMaster
05-18-2002, 10:22 AM
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:
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.
HeapSet(pointer, value);
HeapSet() gives a flex value to one of the storage slots created by HeapNew().
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.
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
------------------
Author of the Jedi Knight DataMaster (http://www.geocities.com/sabersdomain/fileframe.html).
Visit Saber's Domain (http://www.geocities.com/sabersdomain).
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:
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.
HeapSet(pointer, value);
HeapSet() gives a flex value to one of the storage slots created by HeapNew().
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.
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
------------------
Author of the Jedi Knight DataMaster (http://www.geocities.com/sabersdomain/fileframe.html).
Visit Saber's Domain (http://www.geocities.com/sabersdomain).