Boolean ObjDoRelocation( /* returns true if error */
ObjRelocationType type, /* type of relocation */
MemHandle block, /* handle of info block */
void * sourceData, /* source of relocation */
void * destData); /* relocated value */
This routine relocates a given word or dword argument and is used for resolving handles and pointers to movable objects. Most often, relocation and unrelocation occur when resources are loaded, swapped, or saved, and this is in most cases taken care of by the kernel.
ObjDoRelocation()
takes four parameters:
type
RelocationType
). This can be one of the three values shown below.
block
sourceData
destData
sourceData
and
type
, above.
The type of relocation to be done affects the type of data passed in
sourceData
and
destData
. The relocation type is passed in the type parameter and must be one of the following enumerations of
RelocationType
:
sourceData
pointer should be cast to type word, and the
destData
pointer should be cast to type Handle.
sourceData
pointer should be cast to type word, and the
destData
pointer should be cast to type Segment.
sourceData
pointer and the
destData
pointer should be cast to type dword.
ObjDoRelocation()
returns an error flag that will be
true
if an error occurs,
false
otherwise.
The relocation done by this routine can be undone with
ObjDoUnRelocation()
.
Include: object.h
Boolean ObjDoUnRelocation( /* returns true if error */
ObjRelocationType type, /* type of relocation */
MemHandle block, /* handle of info block */
void * sourceData, /* source of relocation */
void * destData); /* relocated value */
This routine unrelocates a given word or dword. It translates a handle, a segment address, or an entry point back into a resource ID. The translation done is the exact reverse of that done by
ObjDoRelocation()
. See that routine (above) for more information.
ObjDoUnRelocation()
returns an error flag that will be
true
if an error occurs and
false
if the unrelocation is successful. The unrelocated resource ID will be returned pointed to by the
destData
pointer.
Include: object.h
See Also: ObjDoRelocation().
EventHandle ObjDuplicateMessage(
EventHandle msg); /* event to duplicate */
This routine duplicates a prerecorded event, returning the event handle of the new event. Pass the handle of the event to be duplicated. You can then change information about the event with
MessageSetDestination()
.
Include: object.h
MemHandle ObjDuplicateResource(
MemHandle blockToDup, /* handle of resource; must
* not be loaded */
GeodeHandle owner, /* owner of duplicate */
ThreadHandle burdenThread); /* burden thread of duplicate */
This routine duplicates an entire object resource block. The new block will be put on the "saved blocks" list so it gets saved to the geode's state file. Usually this is used by the UI to make editable copies of an application's UI resources to ensure the proper state information gets saved. This routine takes three parameters:
blockToDup
ObjDuplicateResource()
is called. Also, it can only be a "template" resource--a resource that does not get used by the UI or the application directly, but only gets copied via this routine.
owner
owner
of -1, the new block will be owned by the same geode that owns the original.
burdenThread
burdenThread
of -1 makes the new resource have the same burden thread as the original.
ObjDuplicateResource()
returns the handle of the newly created block, which will be unlocked and may or may not be resident in memory.
Include: object.h
See Also: ObjFreeDuplicate(),
MSG_META_BLOCK_FREE,
ObjLockObjBlock().
void ObjEnableDetach(
optr obj); /* object calling this routine */
This routine acts as an object's handler for
MSG_META_ACK
. This handler decrements the acknowledgment count (incremented with
ObjIncDetach()
) and, if the count is zero, enables the detach mechanism so the object can be fully detached. Because the detach mechanism is implemented in
MetaClass
, it is highly unlikely you will ever call this routine.
The lone parameter of this routine is the optr of the calling object (or, in the case of
MSG_META_ACK
, the object sending acknowledgment).
Warnings: This routine may resize and/or move chunks and object blocks, thereby invalidating all pointers and segment addresses.
Include: metaC.goh
See Also: MSG_META_DETACH,
ObjInitDetach(),
ObjIncDetach(),
MSG_META_ACK.
GEOS SDK TechDocs
|
|
ObjDeref() ...
|
ObjFreeChunk() ...