home *** CD-ROM | disk | FTP | other *** search
- /*
- File: OSLPriv.h (Orignal name: OSLPrivate.h)
-
- Contains:
-
- Owned by: Nick Pilch
-
- Copyright: © 1992 - 1995 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <7> 8/29/95 jpa DescPtr --> AEDesc* for Univ Hdrs 2.1.
- [1279173]
- <6> 6/27/95 NP 1262792: new version of OSLObjectInit
- <5> 6/23/95 NP 1195474: Make Resolve reentrant.
- <4> 5/3/95 NP 1211084: Remove 5$
- <3> 4/24/95 eeh 1212343: include HshTbTyp.h; remove dups
- <2> 8/19/94 NP 1181622: Ownership fix.
- <12> 5/2/94 eeh bug #1160654: various PPC native changes
- <11> 2/9/94 NP Tiger Team cleanup.
- <10> 2/7/94 NP Tiger Team doings.
- <9> 10/22/93 NP Removed obsolete context parameter from
- some functions.
- <8> 10/18/93 NP Added/changed functional interfaces to
- correspond with code.
- <7> 10/11/93 NP Internal interface changes and additions.
- <6> 9/20/93 NP Removed GetCurrentContext and
- SetCurrentContext from here. Put them in
- CntxtOSL.h.
- <5> 8/18/93 NP Mods for new context scheme.
- <4> 8/16/93 NP Adjusted for latest OSL proposal.
- <3> 7/28/93 NP Mods for new token type, OSLToken.
- <2> 7/21/93 NP Fixed #includes.
- <1> 7/21/93 NP first checked in
-
- To Do:
-
- */
-
- #ifndef _OSLPRIV_
- #define _OSLPRIV_
-
- #ifndef __APPLEEVENTS__
- #include <AppleEvents.h>
- #endif
- #ifndef __AEOBJECTS__
- #include <AEObjects.h>
- #endif
- #ifndef __MIXEDMODE__
- #include <MixedMode.h>
- #endif
-
- #ifndef __OSLTempdefs__
- #include "OSLTmpdf.h"
- #endif
- #ifndef _CNTXTOSL_
- #include "CntxtOSL.h"
- #endif
-
- #ifndef _HSHTBTYP_
- #include "HshTbTyp.h"
- #endif
-
- #define kInitialHashTableSize 16
- #define typeWhoseRangeInternal 'ind*'
-
- #define typeWhoseRangeInternal 'ind*'
-
- #define kAEAppDoesNothing kAEIDoMinimum
- #define kAEAppDoesWhose kAEIDoWhose
- #define kAEAppDoesAnyForms kAEIDoWhose
-
-
- #define kInitialHashTableSize 16
-
- #define keyAEGetErrDescProc 'indc'
-
- #define FailErr( res, err, lable ) \
- if ( (err = (res)) != noErr ) \
- { \
- goto lable ; \
- }
-
- #define FAIL_ERR_PROC(err,lable) \
- return err ; \
- lable: \
- {
-
- #define END_FAIL_ERR_PROC(err) \
- return err ; \
- }
-
- #define SizeOf sizeof
-
- struct _TestTermRecord ;
- struct _ClassAndID ;
- struct _CompareEvtRecord ;
- struct _CompareRecord ;
- struct _LogicalRecord ;
- struct _IndexRecord ;
- struct _WhoseRecord ;
-
-
- struct _HashInfo {
- long usedEntries ;
- long collidedEntries ;
- long totalEntries ;
- long tableSize ;
- } ;
- typedef struct _HashInfo structHashInfo ;
-
- struct _ObjectAccessorKey {
- DescType firstKey ;
- DescType secondKey ;
- } ;
- typedef struct _ObjectAccessorKey ObjectAccessorKey ;
-
- struct _ObjectAccessorValue {
- OSLAccessorUPP handler ;
- long handlerRefcon ;
- } ;
- typedef struct _ObjectAccessorValue ObjectAccessorValue ;
-
-
- /* <eeh> Change to ObjRecord to accomodate new model: in certain cases that would
- ordinarily call for two object records, one the container of the other, it is
- possible to combine them. For instance, if an object's form is index and that
- of its container is test and both are of the same class, then the two may be
- combined into a single object. We need a doubly-linked list for this type
- of optimization. */
-
- typedef struct _ObjRecord {
- DescType objClass ; /*the desired class*/
- struct _ObjRecord **objContainer ; /*the container*/
- struct _ObjRecord **objContained ; /* makes it a doubly-linked list */
- AEDesc objSelectionData ; /*data to use in lookup*/
- struct WhoseRecord **objTheWhose ; /*if it was a whose, this is the query structure
- used only for nested whose clauses */
- OSLToken objValue ; /* result token */
- Boolean valIsExmn ; /* is same as another token; don't dispose */
- Boolean objRedo ; /* must be recalculated each time? */
- AEDesc theObjInput ;
- union {
- DescType objForm ; /*how to get it*/
- DescType tokenClass; /* could be union with objForm; we'll never use both */
- } u ;
- } ObjRecord, *ObjRecordPtr, **Object ;
-
- typedef enum testType {kCompare, kCompareEvt, kLogical} testType;
-
- struct _TestTermRecord {
- struct _TestTermRecord **next ;
- Boolean value ;
- Boolean redo ;
- AEDesc theTermInput ;
- testType ttype ;
- union {
- struct _LogicalRecord **log ;
- struct _CompareEvtRecord **cEvt ;
- struct _CompareRecord **compar; // changed from "comp" because
- // compiler didn't like "comp"
- } u ;
- } ;
- typedef struct _TestTermRecord TestTermRecord, *TestTermPtr, **Term ;
-
- struct _ClassAndID {
- DescType eventClass ;
- DescType eventID ;
- } ;
-
- // <eeh> added 3/15
- struct _CompareEvtRecord {
- AppleEvent eventWParams ;
- Boolean value ; /*result*/
- Boolean redo ; /*must be recalculated each time?*/
- AEDesc theCompEvtInput ;
- } ;
- typedef struct _CompareEvtRecord CompareEvtRecord, *CompareEvtPtr, **CompareEvent ;
-
- struct _CompareRecord {
- Object obj1 ; /*left hand operand*/
- Object obj2 ; /*right hand operand*/
- DescType oper ; /*> < <= etc.*/
-
- Boolean value ; /*result*/
- Boolean redo ; /*must be recalculated each time?*/
- AEDesc theCompInput ;
- } ;
- typedef struct _CompareRecord CompareRecord, *ComparePtr, **Comparison ;
-
- struct _LogicalRecord {
- DescType logicalOp ; // AND, OR, NAND
- Term firstTerm ; // start of linked list of terms
- Boolean value ; // result
- Boolean redo ; // must be recalculated each time?
- AEDesc theLogicalInput ;
- } ;
- typedef struct _LogicalRecord LogicalRecord, *LogicalPtr, **Logical ;
-
-
- struct _IndexRecord {
- DescType startCase ; // for relative values instead of integers
- long startValue ;
- DescType stopCase ; // for relative values instead of integers
- long stopValue ;
- } ;
- typedef struct _IndexRecord IndexRecord, *indexRecordPtr ;
-
-
- struct _WhoseRecord {
- IndexRecord index ; // which matching objects desired
- Term theTerm ; // test to match against
- OSLToken whoseValue ; // result token
- AEDesc theWhoseInput ;
- } ;
- typedef struct _WhoseRecord WhoseRecord, *WhoseRecordPtr, **Whose ;
-
- typedef DescType *DescTypePtr, **DescTypeHandle ;
- typedef long *LongPtr, **LongHandle ;
-
- struct _aeh {
- ProcPtr DerefProc ;
- ProcPtr NewProc ;
- ProcPtr GrowProc ;
- ProcPtr DisposeProc ;
- } ;
- typedef struct _MemProcBlock MemProcBlock ;
- //typedef MemProcBlock* OSLMemProcs ;
-
- struct _GlobalRec {
- HHand aeHashTable ;
- HHand coercionHashTable ;
- HHand accessorHashTable ;
- ProcPtr phacProcPtr ;
- ProcPtr selhProcPtr ;
- ProcPtr blockingPtr ;
- ProcPtr unblockingPtr ;
- OSLDisposeTokenUPP diposeTokenProcPtr ;
- OSLCompareUPP compareProcPtr ;
- OSLCountUPP countProcPtr ;
- OSLGetMarkTokenUPP getMarkIDProcPtr ;
- OSLMarkUPP MarkProcPtr ;
- OSLAdjustMarksUPP AdjustMarksProcPtr ;
- ProcPtr AENonAevtHandler ;
- OSLGetErrDescUPP TypeAsIndexProc ;
- } ;
- typedef struct _GlobalRec GlobalRec, *GlobalRecPointer, **GlobalRecHandle ;
-
- extern pascal OSErr SelectorDispatch(void) ;
-
-
- //pascal GlobalRecHandle GetGlobalRef(void) =
- // { 0x2078, 0x02B6, 0x2EA8, 0x0154} ;
- // movea.l expandMem,a0; move.l $154(a0),(a7)
-
- //pascal GlobalRecHandle GetSysGlobal(void) =
- // { 0x2078, 0x02B6, 0x2EA8, 0x017C } ;
- //movea.l expandMem,a0; move.l $17C(a0),(a7) }
-
- //0x2B6 is the old ExpandMem (not defined in the system headers anymore!)
- #define GetGlobalRef() (GlobalRecHandle)(*((long *)((*((char **)0x2B6)) + 0x154)))
- #define GetSysGlobal() (GlobalRecHandle)(*((long *)((*((char **)0x2B6)) + 0x17C)))
-
- #define IgnoreOSErr(x) x
-
-
- // a version for C OSErr functions: just drop it altogether.
- #define CIgnoreOSErr(call) call
-
- //==============================================================================
- // Functions
- //==============================================================================
-
- // Implemented in glue that calls through to Apple Event Mgr undocumented calls.
-
- extern OSErr CreateObject( const AEDesc *input, Object containedObj,
- Boolean expandWhoseData, Object *theObject ) ;
-
- extern OSErr CreateWhose( AEDesc input, Whose *theWhose ) ;
-
- extern OSErr CreateTerm( AEDesc *input, Term *theTerm ) ;
-
- extern OSErr CreateCompare( AEDesc input , Comparison *theComparison ) ;
-
- extern OSErr CreateLogical( const AEDesc *input , Logical *theLogical ) ;
-
- extern void DisposeObj( Object o ) ;
-
- extern void DisposeWhose( Whose w ) ;
-
- extern void DisposeTerm( Term t ) ;
-
- extern void DisposeLogical( Logical l ) ;
-
- extern void DisposeCompare( Comparison c ) ;
-
- extern void MakeNull(AEDesc *theDesc ) ;
- extern void MakeNullToken(OSLToken *theToken ) ;
- extern OSErr EvalObj( Object o , DescType exmnClass , OSLToken *objectBeingExmn,
- short appDoesFlags) ;
-
- extern OSErr CallCompareProc( DescType oper, OSLToken obj1 ,
- OSLToken obj2, Boolean *result ) ;
- OSErr NewCallCompareProc(DescType oper,
- OSLToken obj1,
- OSLToken obj2,
- Boolean* result);
- extern OSErr CallAdjustMarks( long newStart, long newStop,
- OSLToken markToken ) ;
- OSErr NewCallAdjustMarks( long newStart, long newStop,
- OSLToken markToken ) ;
- extern OSErr CallMark( OSLToken dToken, OSLToken markToken, long n ) ;
- OSErr NewCallMark( OSLToken dToken, OSLToken markToken, long n ) ;
- extern OSErr CallGetMarkToken( OSLToken dContainerToken,
- DescType containerClass, OSLToken *result ) ;
- OSErr NewCallGetMarkToken( OSLToken dContainerToken,
- DescType containerClass, OSLToken *result ) ;
- extern OSErr
- CallCountProc( DescType desiredType, DescType containerClass,
- OSLToken container, long *result ) ;
- OSErr NewCallCountProc(DescType desiredType,
- DescType containerClass,
- OSLToken container,
- long* result);
- extern pascal OSErr
- iCallAccessor( DescType wantType , OSLToken container ,
- DescType containerClass , DescType form,
- AEDesc selectionData , OSLToken *value ) ;
- extern OSErr CallGetErrDesc( AEDesc* *appDescPtr ) ;
- OSErr NewCallGetErrDesc( AEDesc* *appDescPtr ) ;
-
- extern pascal OSErr
- iAEDisposeToken( OSLToken *theDesc ) ;
- OSErr NewCallDisposeToken(OSLToken* theToken);
-
- extern pascal OSErr
- iAEObjectInit(OSLContext* context);
-
- static void
- zero( char *s, long bytes ) ;
-
- extern OSErr // EvalObj needs this guy
- InternalResolve ( Object thisObj ,
- DescType exmnClass ,
- OSLToken *dObjExamined ,
- Boolean *contIsExmn ,
- OSLToken *value ,
- Boolean *redo ) ;
-
- OSErr GetExmn( OSLToken *result ) ; // what effect does this have?
- OSErr SetExmn( OSLToken *newDesc ) ;
- // I'm not sure the OSL needs this next guy
- OSErr SwapExmn( AEDesc *oldAndNewDesc ) ;
-
- OSErr AddContextToTopOfStack(OSLContext* context);
- OSErr RemoveTopOfContextStack();
-
- Boolean SetErrDesc( AEDesc failedDesc );
- OSErr
- EvalWhose( Whose whoz , DescType wantClass , DescType containerClass ,
- OSLToken container , short appDoesFlags );
-
- pascal OSErr
- iAEGetObjectAccessor( DescType desiredClass,
- DescType containerType,
- OSLAccessorUPP *handler,
- long *handlerRefcon,
- Boolean isSysHandler);
-
- pascal OSErr
- iAEInstallObjectAccessor(DescType desiredClass ,
- DescType containerType ,
- OSLAccessorUPP handler ,
- long handlerRefcon ,
- Boolean isSysHandler);
-
- pascal OSErr
- InternalDisposeToken( OSLToken* token );
-
- pascal OSErr
- iAEDisposeToken( OSLToken *theDesc );
-
- pascal OSErr
- iAEResolve( AEDesc dObjectSpecifier, OSLToken *dTheToken, OSLContext* startingContext);
-
- OSErr GetAppDoesFlags(OSLContext* token, short* appDoesFlags);
-
- OSErr MakeExternalWhose( const AEDesc* desc, AEDesc *result ) ;
-
- // ISSUES
- // 1. Need to search all files for uses of IgnoreOSErr, and make sure it is
- // only used on functions of type pascal. A different one needs to be written
- // (for consistency's sake only, since C lets me ignore returned values)
- // for C functions.
-
- #endif // _OSLPRIV_
-
-