home *** CD-ROM | disk | FTP | other *** search
- /* mod.h
- * Copyright (C) 1990 Commodore-Amiga, Inc.
- * written by David N. Junod
- *
- * header file for modengine1
- * event processing engine structures & definitions
- *
- */
-
- #include <intuition/intuition.h>
- #include <rexx/storage.h> /* off of ARexx disk */
- #include <rexx/rxslib.h> /* off of ARexx disk */
- #include <exec/ports.h>
- #include <exec/memory.h>
- #include <libraries/dos.h>
- #include <libraries/dosextens.h>
- #include <devices/inputevent.h>
- #include <proto/all.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-
- /* mod_funcs.c: application functions */
- VOID NewFunc (struct AppInfo *, struct Message *, UBYTE *args );
- VOID OpenFunc (struct AppInfo *, struct Message *, UBYTE *args );
- VOID SaveFunc (struct AppInfo *, struct Message *, UBYTE *args );
- VOID SaveAsFunc (struct AppInfo *, struct Message *, UBYTE *args );
- VOID AboutFunc (struct AppInfo *, struct Message *, UBYTE *args );
- VOID QuitFunc (struct AppInfo *, struct Message *, UBYTE *args );
- VOID ChooseFunc (struct AppInfo *, struct Message *, UBYTE *args );
- VOID DefineFunc (struct AppInfo *, struct Message *, UBYTE *args );
- VOID UndoFunc (struct AppInfo *, struct Message *, UBYTE *args );
- VOID HelpFunc (struct AppInfo *, struct Message *, UBYTE *args );
- VOID ArrowFunc (struct AppInfo *, struct Message *, UBYTE *args );
- VOID ShellFunc (struct AppInfo *, struct Message *, UBYTE *args );
- VOID WindowFunc (struct AppInfo *, struct Message *, UBYTE *args );
- VOID AbortFunc (struct AppInfo *, struct Message *, UBYTE *args );
-
- #define APPNAME "Our Application"
-
- /* modengine1.c: initialization & dispatching routines */
- VOID main ( void );
- struct AppInfo *OpenAll ( void );
- VOID CloseAll (struct AppInfo *, int value , UBYTE *fmsg );
- BOOL HandlerFunc (struct AppInfo *, UBYTE * name, WORD function);
- struct MsgHandler * HandlerData (struct AppInfo *, UBYTE * name);
- BOOL AddMsgHandler (struct AppInfo *, struct MsgHandler *, BOOL);
- BOOL PerfFunc (struct AppInfo *, struct Message *, UBYTE *);
-
- /* mod_misc.c: misc. functions */
- BOOL NotifyUser (struct Window *, UBYTE *);
- BOOL CheckForChanges (struct AppInfo * ai);
-
- /* message handler node */
- struct MsgHandler
- {
- struct Node mh_Node;
- ULONG mh_SigBits; /* signal bits to watch for */
- WORD mh_Status; /* current status */
-
- /* interface functions */
- BOOL (*mh_Func[4])(struct AppInfo *, struct MsgHandler *);
- VOID *mh_Data; /* handler context data */
- };
-
- /*--- interface function array pointers ---*/
- /* make a handler active */
- #define MH_OPEN 0
- /* handle messages */
- #define MH_HANDLE 1
- /* make a handler inactive */
- #define MH_CLOSE 2
- /* free resources and delete handler */
- #define MH_SHUTDOWN 3
-
- /*--- node types ---*/
- /* message handler node */
- #define MH_HANDLER_T 100
- /* data node */
- #define MH_DATA_T 101
-
- /*--- node priorities ---*/
- /* message handler node default priority */
- #define MH_HANDLER_P 10
- /* data node default priority */
- #define MH_DATA_P -10
-
- /* component for our function table */
- struct Funcs
- {
- UBYTE *name;
- VOID (*func)(struct AppInfo *, struct Message *, UBYTE *);
- };
-
- /* no internal function defined for event */
- #define NO_FUNCTION NULL
-
- /* make active when opened? */
- #define ACTIVE TRUE
- #define INACTIVE FALSE
-
- /* required for application to run? */
- #define REQUIRED TRUE
- #define OPTIONAL FALSE
-
- /*--- AREXX RELATED ITEMS -------------------------------------------------*/
- /* mod_arexx.c: AREXX message handling routines */
- struct MsgHandler *setup_arexx (struct AppInfo *, UBYTE *, UBYTE *, BOOL);
-
- /* ARexx status definitions */
- #define AR_EXECUTE 0
- #define AR_SUSPEND 1
-
- /*--- DOS SHELL RELATED ITEMS ---------------------------------------------*/
- /* mod_dos.c: DOS message handling routines */
- struct MsgHandler *setup_dos (struct AppInfo *,UBYTE *,UBYTE *,UBYTE *, BOOL);
-
- /* DOS shell status definitions */
- #define AS_CLOSED 0
- #define AS_CLOSING 1
- #define AS_GOING 2
- #define AS_OPEN 3
-
- #define BUFFLEN 100
-
- /*--- IDCMP RELATED ITEMS -------------------------------------------------*/
- /* mod_idcmp.c: IDCMP message handling routines */
- struct MsgHandler * setup_idcmp ( struct AppInfo *,
- struct NewWindow *,struct KeyboardCMD *,struct Menu *,BOOL);
-
- /* qualifiers to watch for in gadget related functions */
- #define SHIFTED (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)
-
- /*--- MENU RELATED ITEMS ---*/
-
- /* Extended MenuItem structure */
- struct EMenuItem
- {
- struct MenuItem emi_Item; /* embedded MenuItem structure */
- UWORD emi_MenuID; /* ID used for function number to perform */
- VOID *emi_UserData; /* UserData (like other Intuition structs) */
- };
-
- /*--- GADGET RELATED ITEMS ---*/
-
- /* Extended Gadget structure */
- struct EGadget
- {
- struct Gadget eg_Gadget; /* embedded Gadget structure */
- WORD eg_Funcs[5]; /* Function array */
- };
-
- /* Extended Gadget function array pointers */
- #define EG_DOWNPRESS 0
- #define EG_HOLD 1
- #define EG_RELEASE 2
- #define EG_DBLCLICK 3
- #define EG_ABORT 4
-
- /*--- KEYBOARD RELATED ITEMS ---*/
- #define MAXKEYS 512
- #define SPECIAL 255
-
- /* some useful defines */
- #define ESC 27
- #define DELETE 127
- #define HELP (SPECIAL + '?')
- #define FUNC1 (SPECIAL + '0')
- #define FUNC2 (SPECIAL + '1')
- #define FUNC3 (SPECIAL + '2')
- #define FUNC4 (SPECIAL + '3')
- #define FUNC5 (SPECIAL + '4')
- #define FUNC6 (SPECIAL + '5')
- #define FUNC7 (SPECIAL + '6')
- #define FUNC8 (SPECIAL + '7')
- #define FUNC9 (SPECIAL + '8')
- #define FUNC10 (SPECIAL + '9')
- #define UP (SPECIAL + 'A')
- #define DOWN (SPECIAL + 'B')
- #define RIGHT (SPECIAL + 'C')
- #define LEFT (SPECIAL + 'D')
-
- /* component for our keyboard command array */
- struct KeyboardCMD
- {
- WORD key;
- WORD funcID;
- };
-
- /*--- GLOBAL DATA -----------------------------------------------------------*/
- /* AppInfo structure that contains our global variables */
- struct AppInfo
- {
- struct List MsgList; /* List of message handlers */
- ULONG sigbits; /* Sum of all signals */
- struct Funcs *FuncTable; /* Pointer to the function table */
- BOOL Done; /* Done with main loop? */
- WORD numcmds; /* Outstanding commands */
- LONG pri_ret; /* Primary error return value */
- LONG sec_ret; /* Secondary error return value */
- UBYTE *textrtn; /* Text return string */
-
- /* Project information */
- UBYTE ProjPath[255]; /* Path of project */
- UBYTE ProjName[31]; /* Name of project */
- BOOL Changed; /* Changes made to project? */
- };
-