[net.sources.mac] toolvars.h: C interface to toolbox globals

kdmoen@watcgl.UUCP (Doug Moen) (06/22/85)

This is a C header file which provides definitions for all
of the toolbox global variables (memory locations 0x980 - 0xAFF).
It is intended to be used with Sumacc, but others may also find it useful.

With this file, you can use all of those nifty global variables
documented by the Window Manager, etc, under 'Assembly Language Information'.
There are also some interesting looking undocumented variables.

There is a distinct possibility that I got the capitalization of
some of the names wrong.  Please send comments and corrections to
	Doug Moen (watmath!watcgl!kdmoen)
	University of Waterloo Computer Graphics Lab

PS:
If anybody knows what the 'Mr. Macintosh Hook' (mrMacHook) does,
drop me a line.

PPS:
In the process of testing toolvars.h with Sumacc release 2,
I made 2 changes to toolintf.h:
	Removed 'DlgFont', since it is now in toolvars.h
	Changed FMOutPut to FMOutput to conform with spelling in I.M.

--------- toolvars.h ---------
/*
 *  C definitions for *all* of the toolbox global variables.
 *  Variables are listed in the order in which they occur in memory.
 *
 *  Adapted from toolequ.text, the user interface toolbox equate file by
 *    Doug Moen (watmath!watcgl!kdmoen)
 *    University of Waterloo Computer Graphics Lab
 *    June 1985
 */


#define toolVars ((Ptr)0x980)		/* base address of toolbox globals */
#define toolEnd ((Ptr)0xAFC)	/* address of first byte past end */


/*
 *
 * font manager globals
 *
 */

#define romFont0 (*(FontRec** *)0x980)	/* handle to rom-based system font */
#define apFontID (*(short *)0x984)	/* family id of standard application font */
#define gotStrike (*(char *)0x986)	/* boolean indicating if we've got the strike */
#define fmDefaultSize (*(char *)0x987)	/* byte holding default size */
#define curFMInput (*(FMInput *)0x988)	/* quickdraw fminput record */
#define fMgrOutRec (*(FMOutput *)0x998)	/* quickdraw fontoutput record */
/*
 * The next 2 variables constitute the 28 byte
 * font characterization table for the current device.
 */
#define fmDotsPerInch (*(Point *)0x9B2)	/* v,h dotsperinch of current device */
#define fmStyleTab ((char *)0x9B6)	/* 24 byte style heuristic table */
#define toolScratch ((char *)0x9CE)	/* 8 byte scratch area */


/*
 *
 * window manager globals
 *
 */

#define windowList (*(WindowPeek *)0x9D6) /* z-ordered list of windows (nearest first) */
#define saveUpdate (*(short *)0x9DA)	/* boolean enabling update accumulation */
#define paintWhite (*(short *)0x9DC)	/* boolean enabling erasing newly drawn windows */
#define wMgrPort (*(GrafPtr *)0x9DE)	/* grafport used by window manager */
#define deskPort (*(GrafPtr *)0x9E2)	/* wide open port for use by applications */
#define oldStructure (*(RgnHandle *)0x9E6) /* handle to saved structure region */
#define oldContent (*(RgnHandle *)0x9EA) /* handle to saved content region */
#define grayRgn (*(RgnHandle *)0x9EE)	/* handle of rounded gray desk region */
#define saveVisRgn (*(RgnHandle *)0x9F2) /* handle of temporarily saved vis region */
#define dragHook (*(ProcPtr *)0x9F6)	/* proc ptr to allow user control during dragging */
#define tempRect (*(Rect *)0x9FA)	/* rectangle used as scratch by toolbox */
#define oneOne (*(long *)0xA02)	/* long constant /00010001 */
#define minusOne (*(long *)0xA06)	/* long constant /ffffffff */


/*
 * general purpose bitmap for plotting bitmaps
 */

#define iconBitMap (*(BitMap *)0xA0E)	/* bitmap used for plotting things */


/*
 *
 * menu manager globals
 *
 */

#define MenuList (*(Handle *)0xA1C)	/* pointer to current menubar list structure */
#define MBarEnable (*(short *)0xA20)	/* word for enabling menubar for deskorns */
#define curDeKind (*(short *)0xA22)	/* kind of deactivated window */
#define MenuFlash (*(short *)0xA24)	/* integer holding flash feedback count */
#define TheMenu (*(short *)0xA26)	/* integer holding id of hilited menu */
#define savedHandle (*(Handle *)0xA28)	/* handle of saved menubits */
#define mrMacHook (*(ProcPtr *)0xA2C)	/* hook for mr. macintosh */
#define MenuHook (*(ProcPtr *)0xA30)	/* hook for user control during menuselect */


/*
 *  control manager globals
 */

#define dragPattern (*(Pattern *)0xA34)	/* pattern dragthergn uses */
#define deskPattern (*(Pattern *)0xA3C)	/* pattern to paint the desk with */
#define dragFlag (*(short *)0xA44)	/* implicit parameter to dragcontrol, 1 word */
#define curDragAction (*(long *)0xA46)	/* implicit actionproc parameter */


/*
 *  floating point package globals
 *  first 2 bytes: mode and flag bits
 *  next 4 bytes: user trap address
 */

#define fpState ((Ptr)0xA4A)	/* 6 bytes of floating point state */
#define fpFlags (*(short *)0xA4A)
#define fpTrap (*(ProcPtr *)0xA4C)


/*
 *
 * resource manager globals
 *
 */

#define TopMapHndl (*(Handle *)0xA50)	/* handle to topmost map of list */
#define SysMapHndl (*(Handle *)0xA54)	/* handle to system map */
#define SysMap (*(short *)0xA58)	/* reference number of system map */
#define CurMap (*(short *)0xA5A)	/* reference number of current map */
#define ResReadOnly (*(short *)0xA5C)	/* readonly flag */
#define ResLoad (*(short *)0xA5E)	/* auto-load feature */
#define ResErr (*(short *)0xA60)	/* resource error code */


/*
 *
 *  misc toolbox globals
 *
 */

#define taskLock (*(char *)0xA62)	/* flag to prevent re-entering systemtask */
#define fScaleDisable (*(char *)0xA63)	/* flag to disable font scaling */
#define curActivate (*(WindowPtr *)0xA64) /* window to receive activate event */
#define curDeactive (*(WindowPtr *)0xA68) /* window to receive deactivate event */
#define deskHook (*(ProcPtr *)0xA6C)	/* hook for painting the desk */

#define teDoText (*(ProcPtr *)0xA70)	/* text edit private hook */
#define teRecal (*(ProcPtr *)0xA74)	/*  "" */

#define microSoft ((Ptr)0xA78)		/* 12 bytes for our friends in seattle */
#define ghostWindow (*(WindowPtr *)0xA84) /* window that frontwindow ignores */
#define closeOrnHook (*(ProcPtr *)0xA88) /* hook for closing desk ornaments */


/*
 *
 * alert/dialog manager globals
 *
 */

#define RestProc (*(ProcPtr *)0xA8C)	/* address of restart failsafe procedure */
#define saveProc (*(ProcPtr *)0xA90)	/* address of save failsafe procedure */
#define saveSP (*(ProcPtr *)0xA94)	/* safe sp for restart or save */
#define ANumber (*(short *)0xA98)	/* which alert is active? */
#define ACount (*(short *)0xA9A)	/* how many times this alert called? */
#define DABeeper (*(ProcPtr *)0xA9C)	/* beep routine */
#define DAStrings ((Handle *)0xAA0)	/* array of 4 handles to ParamText strings */


/*
 *
 * textedit globals
 *
 */

#define teScrpLength (*(long *)0xAB0)
#define teScrpHandle (*(Handle *)0xAB4)


/*
 * application package dispatch table -- 8 longwords
 */

#define appPacks ((Handle *)0xAB8)	/* handle to math code */


/*
 * misc stuff (last minute additions)
 */

#define SysResName ((char *)0xAD8)	/* name of system file (20 bytes) */
#define appParmHandle (*(Handle *)0xAEC) /* handle to hold application parameters */
#define DSErrCode (*(short *)0xAF0)	/* last deep shit alert id */
#define ResErrProc (*(ProcPtr *)0xAF2)	/* resource error proc. */
#define teWdBreak (*(ProcPtr *)0xAF6)	/* default word break routine */
#define DlgFont (*(short *)0xAFA)	/* default dialog font */