Applications and Geodes: 1.7 Geodes: Working with Geodes

Up: GEOS SDK TechDocs | Up | Prev: 1.6 Writing Your Own Libraries | Next: 1.8 Geode Protocols and Release Levels

The system provides a number of utility routines for getting information and setting attributes of geodes. These are loosely organized throughout the following sections.

Accessing the Application Object

GeodeGetAppObject()

GEOS offers a routine for retrieving the optr of an application's GenApplication object. GeodeGetAppObject() takes the process handle of the Process object of the application. It returns the optr of the application's GenApplication object.

General Geode Information

GeodeFind(), GeodeFindResource(), GeodeDuplicateResource(), GeodeGetInfo(), GeodeGetProcessHandle(), GeodeGetCodeProcessHandle(), ProcInfo()

GeodeFind() returns a geode's handle when given a permanent name and attributes to search on. GEOS will search the active geode list for any geode with the given name and the proper attributes set or clear.

GeodeFindResource() locates a given resource within a geode's file. It must be passed the file handle of the geode, the number of the resource in the file, and an offset within the resource at which the file read/write position should be placed. This routine may only be used on open geode files, and it returns the base offset and size of the resource. You will probably not need to use this routine. To load a resource into a new block of memory, you can call GeodeDuplicateResource() .

GeodeGetInfo() takes a geode handle, a GeodeGetInfoType parameter, and a buffer appropriate for the return information. It returns the appropriate values as specified in the GeodeGetInfoType parameter. (This parameter specifies what type of information is sought about the geode; the routine can return the geode's attributes, geode type, release level, protocol, token ID, or permanent name.) The possible values of GeodeGetInfoType are shown below:

GGIT_ATTRIBUTES
This indicates the geode's attributes should be returned.
GGIT_TYPE
This indicates the geode's type should be returned (type GeodeType ).
GGIT_GEODE_RELEASE
This indicates the geode's release numbers should be returned.
GGIT_GEODE_PROTOCOL
This indicates the geode's protocol numbers should be returned.
GGIT_TOKEN_ID
This indicates the geode's token information should be returned.
GGIT_PERM_NAME_AND_EXT
This indicates the geode's permanent name and extender should be returned.
GGIT_PERM_NAME_ONLY
This indicates the eight characters of the geode's permanent name only should be returned, without the extender characters.

GeodeGetProcessHandle() returns the geode handle of the current process (the owner of the current thread). Another routine, GeodeGetCodeProcessHandle() , returns the handle of the geode that owns the code block from which it was called.

ProcInfo() returns the thread handle of the first thread of a given process.

Managing Geode Event Queues

GeodeAllocQueue(), GeodeFreeQueue(), GeodeInfoQueue(), GeodeFlushQueue(), ObjDispatchMessage(), QueueGetMessage(), QueuePostMessage(), GeodeDispatchFromQueue()

The following routines allocate and manage event queues. These routines are rarely called by applications as event queues are automatically managed for each thread and application.

GeodeAllocQueue() allocates an event queue and returns its handle. GeodeInfoQueue() returns the number of events in a given event queue. GeodeFreeQueue() frees an event queue allocated with the routine GeodeAllocQueue() . It must be passed the handle of the queue to be freed (unhandled events still in the queue will be discarded).

GeodeFlushQueue() flushes all events from one queue and synchronously places them all in another queue (events may not simply be tossed out).

QueueGetMessage() combined with ObjDispatchMessage() removes the first event from the given event queue and handles it via a callback routine. A far pointer to the callback routine in memory must be passed. Typically these will be used only by the assembly ObjMessage() routine used by the kernel; some other applications of this routine may be used, though. For example, the sound driver uses a note queue unassociated with objects and messages. The callback routine therefore gets the "event" (note) and pretends it's handling a message.

QueuePostMessage() adds an event to the specified queue.


Up: GEOS SDK TechDocs | Up | Prev: 1.6 Writing Your Own Libraries | Next: 1.8 Geode Protocols and Release Levels