# develop-24 9512 December 1995 — source transcripts, page 2

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-develop-24-9512-december-1995-6db47b/2)

## Transcribed source material

Machine transcriptions and image descriptions; uncertain copy may be marked [illegible]. Verify against the linked originals. Historical rights remain with the original owners.

These are transcribed excerpts, not the full publications. Open the originals for remaining pages.

### PDF page 12

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-develop-24-9512-december-1995-6db47b/2#scan-4be9aae6cb3af8e399c28da47ecd65236c4806976d33fc3ed25a00d0c15fb048)

Transcribed text:

•   Iterate over the elements of any token.
•   Determine class membership of any token.
•   Compare properties of the elements of any token.
•   Convert a   whose   clause into some internal representation usable by your
application.
The first two operations are required of any scriptable application, so yours probably
can already do them. Comparing properties is something your application probably
doesn’t do yet, but in the worst case you could always write a few lines of code that
call your property object accessor function, retrieve the data from the resulting
property token, and then compare the descriptor that was returned. Obviously you
can do better than this in terms of performance, and later on we’ll investigate how.
First, though, we’ll look at how to interpret the contents of a   whose   descriptor.
THE CONTENTS OF A WHOSE DESCRIPTOR
Earlier I claimed that a   whose   descriptor was an AERecord, but I lied. A   whose
descriptor is actually a descriptor of type typeWhoseDescriptor. Internally, a   whose
descriptor is stored just like an AERecord, but you can’t extract its parameters unless
you first coerce it to type typeAERecord. In Apple events parlance, this type of
descriptor is called a   coerced record ; its basic type is typeAERecord, and its coerced
type is typeWhoseDescriptor.
SPEEDING UP WHOSE CLAUSE RESOLUTION IN YOUR SCRIPTABLE APPLICATION   11
Listing 3.   Handling formWhose in the object accessor
pascal   OSErr   MyObjectAccessor(DescType   desiredClass,   AEDesc   container,
DescType   /*containerClass*/,   DescType   keyForm,   AEDesc   keyData,
AEDesc*   resultToken,   long   /*hRefCon*/)
{
switch   (keyForm)   {
//   case   formAbsolutePosition,   and   so   on
...
case   formWhose:
//   TWhoseDescriptor   is   a   class   that   knows   how   to   interpret
//   a   whose   descriptor   and   test   tokens   for   membership   in   the
//   search   set   defined   by   the   desired   class   and   the   whose
//   descriptor.
TWhoseDescriptor   whoseDesc(desiredClass,   keyData);
//   TTokenIterator   is   a   class   that   knows   how   to   iterate
//   over   the   elements   of   a   token.
TTokenIterator   iter(container);
for   (iter.Reset();   iter.More();   iter.Next())   {
AEDesc   token   =   iter.Current();
if   (whoseDesc.Compare(token)   ==   kTokenIsInSearchSet)   {
//   Add   token   to   the   collection   stored   in   resultToken.
AddTokenToResult(token,   resultToken);
}
}
break;
}
return   noErr;
}

Languages: English

[Original PDF page 12](https://www.vintageapple.net/files/99568bc007c41b179a001c1141767ff1fc6ae62a2d601adbbfeac963ad47da0d/develop-24_9512_December_1995.pdf#page=12)

[Previous transcribed scans](https://www.vintageapple.net/transcripts/media/va-develop-24-9512-december-1995-6db47b/1.md)
