home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 552.lha / KeyMacro_v1.2 / PreInclude.c < prev    next >
C/C++ Source or Header  |  1991-09-08  |  5KB  |  189 lines

  1. /****************************************************************************
  2. *
  3. *    KeyMacro.h ------------    KeyMacro main include file.
  4. *
  5. *    Author ----------------    Olaf Barthel, MXM
  6. *                Brabeckstrasse 35
  7. *                D-3000 Hannover 71
  8. *
  9. *    KeyMacro  ©  Copyright  1990  by  MXM;  Executable  program,
  10. *    documentation  and  source  code are shareware.  If you like
  11. *    this  program  a  small donation will entitle you to receive
  12. *    updates and new programs from MXM.
  13. *
  14. ****************************************************************************/
  15.  
  16. #ifndef KEYMACRO_H
  17. #define KEYMACRO_H 1
  18.  
  19. #define __NO_PRAGMAS 1
  20.  
  21.     /* Standard include files. */
  22.  
  23. #include <intuition/intuitionbase.h>
  24. #include <libraries/dosextens.h>
  25. #include <workbench/workbench.h>
  26. #include <devices/inputevent.h>
  27. #include <workbench/startup.h>
  28. #include <graphics/gfxbase.h>
  29. #include <exec/interrupts.h>
  30. #include <devices/console.h>
  31. #include <devices/conunit.h>
  32. #include <devices/keymap.h>
  33. #include <devices/timer.h>
  34. #include <exec/execbase.h>
  35. #include <devices/input.h>
  36. #include <exec/memory.h>
  37. #include <clib/macros.h>
  38.  
  39. #define FPrintf        foo1
  40. #define Printf        foo2
  41. #define CreatePort    foo3
  42.  
  43. #include <clib/intuition_protos.h>
  44. #include <clib/graphics_protos.h>
  45. #include <clib/console_protos.h>
  46. #include <clib/exec_protos.h>
  47. #include <clib/alib_protos.h>
  48. #include <clib/dos_protos.h>
  49.  
  50. #undef FPrintf
  51. #undef Printf
  52. #undef CreatePort
  53.  
  54. #include <libraries/arpbase.h>
  55.  
  56. #include <stdlib.h>
  57. #include <string.h>
  58. #include <stdio.h>
  59. #include <ctype.h>
  60.  
  61.     /* Name of global MsgPort and program revision. */
  62.  
  63. #define PORTNAME    "KeyMacro"
  64. #define REVISION    12
  65.  
  66.     /* Signal flag names. */
  67.  
  68. #define SIG_CLOSE    SIGBREAKF_CTRL_C
  69. #define SIG_PORT    (1 << SigBit)
  70. #define SIG_SHAKE    SIGBREAKF_CTRL_F
  71.  
  72.     /* MacroKey tag IDs */
  73.  
  74. #define MK_WORD        1
  75. #define MK_COMMAND    2
  76.  
  77.     /* MacroMessage tag IDs */
  78.  
  79. #define MM_INPUT    0
  80. #define MM_EXECUTE    2
  81.  
  82.     /* KeyMacro InputEvent subclass. */
  83.  
  84. #define KM_SUBCLASS    97
  85.  
  86.     /* Values for non-ASCII key codes. */
  87.  
  88. #define KC_CURSORUP    140
  89. #define KC_CURSORDOWN    141
  90. #define KC_CURSORRIGHT    142
  91. #define KC_CURSORLEFT    143
  92.  
  93. #define KC_FKEY1    129
  94. #define KC_FKEY2    130
  95. #define KC_FKEY3    131
  96. #define KC_FKEY4    132
  97. #define KC_FKEY5    133
  98. #define KC_FKEY6    134
  99. #define KC_FKEY7    135
  100. #define KC_FKEY8    136
  101. #define KC_FKEY9    137
  102. #define KC_FKEY10    138
  103.  
  104. #define KC_HELP        139
  105.  
  106.     /* ToUpper macro, will also handle international characters. */
  107.  
  108. #define ToUpper(c)    (((c >= 224 && c <= 254) || (c >= 'a' && c <= 'z')) ? c - 32 : c)
  109.  
  110.     /* Allocate public memory. */
  111.  
  112. #define AllocPub(Size)    AllocRem(Size,MEMF_PUBLIC | MEMF_CLEAR)
  113.  
  114.     /* Qualifier flags to hide before comparing macros and inputevents. */
  115.  
  116. #define HIDEFLAGS    (IEQUALIFIER_REPEAT|IEQUALIFIER_INTERRUPT|IEQUALIFIER_MULTIBROADCAST|IEQUALIFIER_MIDBUTTON|IEQUALIFIER_RBUTTON|IEQUALIFIER_LEFTBUTTON|IEQUALIFIER_RELATIVEMOUSE)
  117.  
  118.     /* A keyboard alias, includes a name string and a value
  119.      * to be used as an equivalent.
  120.      */
  121.  
  122. struct KeyAlias
  123. {
  124.     UBYTE    *ka_Name;
  125.     UWORD     ka_Key;
  126. };
  127.  
  128.     /* A MacroKey structure. */
  129.  
  130. struct MacroKey
  131. {
  132.     UBYTE     mk_Type;        /* Type of macro key. */
  133.  
  134.     UBYTE     mk_CommandKey;        /* Key to call this macro. */
  135.     UWORD     mk_CommandQualifier;    /* Qualifier needed to hold while pressing the key. */
  136.  
  137.     UBYTE    *mk_String;        /* String to be entered/Name of command to be executed. */
  138.     UBYTE    *mk_Window;        /* Name of window to look for. */
  139. };
  140.  
  141.     /* A MacroMessage structure. */
  142.  
  143. struct MacroMessage
  144. {
  145.     struct Message     mm_Message;    /* Standard Exec message. */
  146.  
  147.     UBYTE         mm_Type;    /* Message type. */
  148.  
  149.     struct MacroKey    *mm_MacroKey;    /* A list of macro keys. */
  150.  
  151.     LONG         mm_NumMacros;    /* Number of macros to follow. */
  152.     struct MacroKey    *mm_MacroList;    /* A list of macros to add to the list. */
  153.  
  154.     UBYTE        *mm_FileName;    /* A file to execute. */
  155.     UBYTE        *mm_WindowName;    /* A window title to look for. */
  156. };
  157.  
  158.     /* A MSeg structure, basically an extended MsgPort. */
  159.  
  160. struct MSeg
  161. {
  162.     struct MsgPort         Port;        /* Standard Exec MsgPort. */
  163.  
  164.     BPTR             Segment;    /* Pointer to handler segment. */
  165.     LONG             SegSize;    /* Length of MSeg structure. */
  166.  
  167.     UBYTE             Revision;    /* Handler revision. */
  168.  
  169.     struct Task        *Father;    /* Calling task. */
  170.     struct Task        *Child;        /* Waiting task. */
  171.  
  172.     ULONG             RingBack;    /* Global wait signal. */
  173.  
  174.     struct SignalSemaphore     MacroSemaphore;/* Macro list access protection. */
  175.  
  176.     LONG             NumMacros;    /* Number of macros in list. */
  177.     LONG             MaxMacros;    /* Maximum number of macros in list. */
  178.     struct MacroKey        **MacroList;    /* A list of macro keys. */
  179.  
  180.     struct KeyMap        *DefaultKeyMap;    /* Default keymap used for key translation. */
  181.     LONG             Delay;        /* Key event delay in microseconds. */
  182.  
  183.     BYTE             Pri;        /* Input handler priority. */
  184.     BYTE             Pad1;
  185.     UWORD             Pad2;
  186. };
  187.  
  188. #endif    /* KEYMACRO_H */
  189.