home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 1
/
FishNMoreVol1.bin
/
more
/
programming
/
arpprog
/
newdocs
/
newpro.arc
/
TRAK_ID
< prev
next >
Wrap
Text File
|
1988-02-27
|
4KB
|
133 lines
TRAK_IDS(33.4) ARP Programmers Manual TRAK_IDS(33.4)
NAME
TRAK_IDS - Discussion of items tracked by ID value.
IDS
The object tracked will be located in dt_Object.
TRAK_AAMEM - this is the default, and refers to the
allocation of the tracking node itself. You get
this by calling GetTracker().
TRAK_LOCK - obtained by calling ArpLock() or ArpDupLock()
TRAK_FILE - obtained by calling ArpOpen()
TRAK_WINDOW - place the window pointer in dt_Object. If this
window is sharing its IDCMP with another window,
place its address in dt_Extra, else place NULL in
dt_Extra. If dt_Extra is not NULL, then the IDCMP
ports for this window will not be freed.
TRAK_SCREEN - the screen pointer should be placed in
dt_Object.
TRAK_LIBRARY - the library pointer should be placed in
dt_Object.
TRAK_DAMEM - the DosAllocMem() block pointer should be
placed in dt_Object.
TRAK_MEMNODE - This frees one instance of a memnode as
allocated by AllocEntry(). The node, which should
be placed in dt_Object, should not be on a MemList,
since Remove() will not be called, and any other
nodes on such a list would not be freed, unless they
are also tracked by their own instances of
TRAK_MEMNODE.
TRAK_SEGLIST - A BPTR to the seglist should be placed in
dt_Object.
TRAK_RESLIST - A Pointer to an ARP reslist.
TRAK_MEM - Obtained for you by a call to ArpAllocMem(),
dt_Object is a pointer to the mem, and dt_Extra is
its size.
TRAK_DALIST - dt_Object is pointer to list node to start
freeing from.
TRAK_ANCHOR - dt_Object is pointer to an AnchorPath
structure chain.
Page 1 (printed 2/27/88)
TRAK_IDS(33.4) ARP Programmers Manual TRAK_IDS(33.4)
TRAK_GENERIC - This is the most flexible, but also somewhat
tricky to use. Essentially, at resource freeing
time, you get called to do the work. This allows
you to monitor many resources at once in complex
interactions, or track custom software structures
which have been allocated, almost anything at all.
Using this id, you can also have yourself called
when the system goes into a memory panic. When this
occurs, the amiga ROM kernal routines attempt to
free any objects not currently in use, such as
libraries, or devices. You can participate in this
if there are resources you can free to aid the user
during a heavy memory crunch by using this id.
To use, place a pointer to the function to call in
tr_Extra.tg_Function, and also place the actual
binary values of the code in the first long word of
your function in tr_Object.tg_Verify. arp.library
uses this value to determine whether or not you are
still in the system when it is time to call the
function. Should you have abandoned your resources,
ARP can use this value to tell if your function is
where it should be, if it isn't, you won't be
called. This of course means that the dt_Object
union does not carry the tracked object, either your
function must not what it is being called to do, or
you must extend the TrackedResource structure so it
has additional private data for your use.
When called, a copy of tg_Verify will be placed in
D1, and a pointer to the TrackedResource (note: not
a DefaultTracker, but the base of that structure)
will be in A2. In addition, your code will be
running in a Forbidden() section, so you need to be
quick. arp.library will have zeroed the value in
tg_Verify, if you want to be called again, you need
to restore the tg_Verify value to its former value
(stored in D1). If you leave tg_Verify zero, the
resource manager will free the tracker node, and you
will not be called again.
If you want to be called during a system wide memory
panic, you should use FreeAccess() on your track
generic node as soon as possible, this will cause
your code to run should a panic occur.
Finally, note that you must preserve the contents of
registers D2-D7 and A2-A6.
Page 2 (printed 2/27/88)