home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff398.lzh / KeyMacro / PreInclude.c < prev    next >
C/C++ Source or Header  |  1990-11-01  |  4KB  |  169 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 <libraries/arpbase.h>
  28. #include <workbench/startup.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.  
  38. #include <functions.h>
  39.  
  40. #include <stdlib.h>
  41. #include <string.h>
  42. #include <stdio.h>
  43. #include <ctype.h>
  44.  
  45.     /* Name of global MsgPort and program revision. */
  46.  
  47. #define PORTNAME    "KeyMacro"
  48. #define REVISION    6
  49.  
  50.     /* Signal flag names. */
  51.  
  52. #define SIG_CLOSE    SIGBREAKF_CTRL_C
  53. #define SIG_PORT    (1 << SigBit)
  54. #define SIG_SHAKE    SIGBREAKF_CTRL_F
  55.  
  56.     /* MacroKey tag IDs */
  57.  
  58. #define MK_UNUSED    0
  59. #define MK_WORD        1
  60. #define MK_COMMAND    2
  61.  
  62.     /* MacroMessage tad IDs */
  63.  
  64. #define MM_INPUT    0
  65. #define MM_UPDATE    1
  66. #define MM_EXECUTE    2
  67.  
  68.     /* Maximum number of key macros. Change this if you prefer
  69.      * more of less macros.
  70.      */
  71.  
  72. #define MAXMACROS    30
  73.  
  74.     /* KeyMacro InputEvent subclass. */
  75.  
  76. #define KM_SUBCLASS    97
  77.  
  78.     /* Values for non-ASCII key codes. */
  79.  
  80. #define KC_CURSORUP    140
  81. #define KC_CURSORDOWN    141
  82. #define KC_CURSORRIGHT    142
  83. #define KC_CURSORLEFT    143
  84.  
  85. #define KC_FKEY1    129
  86. #define KC_FKEY2    130
  87. #define KC_FKEY3    131
  88. #define KC_FKEY4    132
  89. #define KC_FKEY5    133
  90. #define KC_FKEY6    134
  91. #define KC_FKEY7    135
  92. #define KC_FKEY8    136
  93. #define KC_FKEY9    137
  94. #define KC_FKEY10    138
  95.  
  96. #define KC_HELP        139
  97.  
  98.     /* ToUpper macro, will also handle international characters. */
  99.  
  100. #define ToUpper(c)    (((c >= 224 && c <= 254) || (c >= 'a' && c <= 'z')) ? c - 32 : c)
  101.  
  102.     /* Allocate public memory. */
  103.  
  104. #define AllocPub(Size)    AllocRem(Size,MEMF_PUBLIC | MEMF_CLEAR)
  105.  
  106.     /* A keyboard alias, includes a name string and a value
  107.      * to be used as an equivalent.
  108.      */
  109.  
  110. struct KeyAlias
  111. {
  112.     char    *ka_Name;
  113.     UWORD     ka_Key;
  114. };
  115.  
  116.     /* A MacroKey structure. */
  117.  
  118. struct MacroKey
  119. {
  120.     UBYTE     mk_Type;        /* Type of macro key. */
  121.  
  122.     UBYTE     mk_CommandKey;        /* Key to call this macro. */
  123.     UWORD     mk_CommandQualifier;    /* Qualifier needed to hold while pressing the key. */
  124.  
  125.     UBYTE    *mk_String;        /* String to be entered/Name of command to be executed. */
  126.     UBYTE    *mk_Window;        /* Name of window to look for. */
  127. };
  128.  
  129.     /* A MacroMessage structure. */
  130.  
  131. struct MacroMessage
  132. {
  133.     struct Message     mm_Message;    /* Standard Exec message. */
  134.  
  135.     UBYTE         mm_Type;    /* Message type. */
  136.  
  137.     struct MacroKey    *mm_MacroKey;    /* A list of macro keys. */
  138.  
  139.     LONG         mm_NumMacros;    /* Number of macros to follow. */
  140.     struct MacroKey    *mm_MacroList;    /* A list of macros to add to the list. */
  141.  
  142.     UBYTE        *mm_FileName;    /* A file to execute. */
  143.     UBYTE        *mm_WindowName;    /* A window title to look for. */
  144. };
  145.  
  146.     /* A MSeg structure, basically an extended MsgPort. */
  147.  
  148. struct MSeg
  149. {
  150.     struct MsgPort     Port;        /* Standard Exec MsgPort. */
  151.  
  152.     BPTR         Segment;    /* Pointer to handler segment. */
  153.     LONG         SegSize;    /* Length of MSeg structure. */
  154.  
  155.     UBYTE         Revision;    /* Handler revision. */
  156.  
  157.     struct Task    *Father;    /* Calling task. */
  158.     struct Task    *Child;        /* Waiting task. */
  159.  
  160.     ULONG         RingBack;    /* Global wait signal. */
  161.  
  162.     LONG         NumMacros;    /* Number of macros in list. */
  163.     struct MacroKey    *MacroList;    /* A list of macro keys. */
  164.  
  165.     struct KeyMap    *DefaultKeyMap;    /* Default keymap used for key translation. */
  166. };
  167.  
  168. #endif    /* KEYMACRO_H */
  169.