Descriptor Lists
Descriptor Lists
When extracting data from an Apple event, you use Apple Event Manager
functions to return data in a buffer specified by a pointer, or to return
descriptor records containing the data, or to return lists of
descriptor records (called descriptor lists) containing the data. As previously
noted, the descriptor record (of data type AEDesc) is the fundamental structure
in Apple events, and it contains a handle to data. A descriptor list is a data
structure of type AEDescList defined by the data type AEDesc-that is, a
descriptor list is a descriptor record that contains a list of other
descriptor records.
An example of a descriptor list that you will be using is the direct parameter
for the Open Documents event. As illustrated in the next figure, this
descriptor list is a list of descriptor records that contain alias records to
filenames. (The Alias Manager describes alias records in detail.)
A descriptor list for a list of aliases
Closely related to a descriptor list is a structure of data type AERecord; in
fact, it is defined by the data type AEDescList.
While a descriptor list is a descriptor record that contains a list of other
descriptor records, an AE record of data type AERecord contains a list of
keyword-specified descriptor records describing parameters. A descriptor list
of data type AERecord contains no attributes, only parameters.
There is one final data structure to consider: the Apple event record. An
Apple event record is a structure of data type AppleEvent defined as an
AE record. It is used for describing a full-fledged Apple event.
An Apple event record is basically a descriptor record (of descriptor type
typeAppleEvent) with a handle to a list of keyword-specified descriptor
records. These descriptor records describe the attributes and parameters for
an Apple event. When you use the AECreateAppleEvent function, the
Apple Event Manager creates an Apple event record containing the
attributes for an Apple event's event class, event ID, target address, return ID,
and transaction ID. You then use Apple Event Manager functions such as
AEPutParamDesc to add parameters to the Apple event.
The internal structure of an Apple event record is nearly identical to an
AE record. They differ in the content referred to by the data handles that they
contain: the former has a list of attributes and, possibly, parameters referred
by its handle; the latter contains only parameters. However, you can pass an
Apple event record to any Apple Event Manager function that expects an
AE record. Since both are structures of data type AEDescList, which is derived
from the data type AEDesc, you can pass Apple event records, AE records,
descriptor lists, and descriptor records to any
Apple Event Manager functions that expect records of data type AEDesc.
The data in Apple event records, AE records, and descriptor lists-all of which
are descriptor records-is private to the Apple Event Manager.
The Apple Event Manager maintains these different data structures
because it stores different kinds of information in their handles. Although all
the information you need is available by calling the appropriate
Apple Event Manager functions, the Apple Event Manager needs a way
to tell these different descriptor records apart. It does this by looking at their
data types.