home *** CD-ROM | disk | FTP | other *** search
- /*
- * dispatch.h - structures and values associated with routine dispatcher
- */
-
- #include <C_config.h>
-
- typedef short (*dispProcPtr)();
-
- struct frame
- {
- struct frame **link; /* link to (suspended) caller frame */
- dispProcPtr proc; /* routine */
- short state; /* routine state variable */
- /*
- * Each routine embeds this structure in a larger structure private
- * to itself
- */
- };
- typedef struct frame frame_t;
- typedef frame_t *framePtr;
- typedef framePtr *frameHdl;
-
- /*
- * Routine request options, which are also used as return values
- */
- enum
- {
- R_CONT /* continue per state variable */
- ,R_INIT /* initial call to routine at this stack
- * level */
- ,R_BACKOUT /* routine should do whatever is necessary
- * to cleanly abandon what it is doing */
- ,R_QUIT /* application is terminating. */
- };
- #define R_ERROR R_INIT /* when used as return value */
-
- /*
- * Macro to declare routines called via dispatch ()
- */
-
- #define DISPATCHED(func_name) \
- short func_name (fh, request, argv) \
- frameHdl fh; \
- short request; \
- Ptr *argv;
-
- #define DISPATCHPROTO(func_name) \
- extern short func_name (frameHdl, short, Ptr *)
-
- /*
- * prototypes for dispatcher related functions
- */
-
- extern void dispatch (void);
- extern Integer popCall (short, Ptr *);
- extern Integer pushCall (dispProcPtr, Ptr *);
- extern OSErr resizeFrame (frameHdl, Size);
-
- /*
- * prototypes for the dispatched routines
- */
- DISPATCHPROTO (cleanJunk);
- DISPATCHPROTO (copyFile);
- DISPATCHPROTO (emptyFolder);
- DISPATCHPROTO (idle);
- DISPATCHPROTO (matchFolder);
- DISPATCHPROTO (parseDistFile);