home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckc095.zip / ckmdef.h < prev    next >
C/C++ Source or Header  |  1989-08-22  |  9KB  |  268 lines

  1. /* Version 0.8(35) - Jim Noble at Planning Research Corporation, June 1987. */
  2. /* Ported to Megamax native Macintosh C compiler. */
  3.  
  4. /* Symbol Definitions */
  5.  
  6. #define TRUE      1        /* Boolean constants */
  7. #define FALSE     0
  8. #define NIL                0
  9. #define NULL            0
  10. #define NILPTR        (Ptr) NIL
  11. #define NILPROC        (ProcPtr) NIL
  12. #define ALLTYPES -1        /* All types for SFGetFile */
  13.  
  14. #define MYBUFSIZE   2048    /* Serial driver replacement buffer */
  15.  
  16. #define OKBtn    ok        /* OK and Cancel constants */
  17. #define QuitBtn    cancel        /* Defined by Dialog Mgr */
  18.  
  19. #define btnOff    0
  20. #define btnOn    1
  21.  
  22. #define getctlhdl(item,dp) (ControlHandle) gethdl(item,dp)
  23.  
  24. #define ApplCreator 'KR09'
  25.  
  26. /* settings for parity */
  27.  
  28. #define MPARITY_ODD (oddParity+stop10+data7)
  29. #define MPARITY_EVEN (evenParity+stop10+data7)
  30. #define MPARITY_MARK (noParity+stop20+data7)
  31. #define MPARITY_SPACE (noParity+stop10+data8)
  32. #define MPARITY_NONE (noParity+stop10+data8)
  33.  
  34. #define KPARITY_ODD 'o'
  35. #define KPARITY_EVEN 'e'
  36. #define KPARITY_MARK 'm'
  37. #define KPARITY_SPACE 's'
  38. #define KPARITY_NONE 0
  39.  
  40. typedef struct {        /* file arguments since Kermit */
  41.     char fillcl[64], filrem[64];/* doesn't pass all the info */
  42.     int filflg;            /* we need... */
  43.     int fildflg;        /* default flags */
  44.     short filvol;        /* file volume */
  45.     int filfldr;        /* file folder for new files */
  46.     long filsiz;        /* size of file after open */
  47.     long rsrcsiz;        /* size of resource fork (for MacBinary fmt) */
  48. }   FILINF;
  49.  
  50.  
  51. /* Flags in filflg, fildflg */
  52.  
  53. #define FIL_BINA     1
  54. #define FIL_TEXT     2
  55. #define FIL_RSRC     4
  56. #define FIL_DATA     8
  57. #define FIL_OKILL 16        /* same as kermit's !warn */
  58. #define FIL_DODLG 32        /* show dialogs on recv */
  59. #define FIL_ALLFL 64        /* send all files from the curr folder */
  60.  
  61. #define FIL_RBDT (FIL_RSRC | FIL_BINA | FIL_DATA | FIL_TEXT)
  62.  
  63. /* (PWP) MacBinary is selected when both FIL_RSRC and FIL_DATA are selected */
  64.  
  65. /* MacBinary format is the following header, the data fork (padded to 128),
  66.    and the resource fork (padded to 128) */
  67. /* MacBinary header structure (lifted from NCSA Telnet 2.2) */
  68. typedef struct MBHead {        /* MacBinary Header */
  69.     char zero1;
  70.     char name[64];
  71.     char type[4];
  72.     char creator[4];
  73.     char flags;
  74.     char zero2;
  75.     char location[6];
  76.     char protected;
  77.     char zero3;
  78.     char dflen[4];
  79.     char rflen[4];
  80.     char cdate[4];
  81.     char mdate[4];
  82.     char filler[27];
  83.     char typeid[2];
  84. } MBHead;
  85.  
  86.  
  87. /* type definitions for keyboard macro structures */
  88. typedef struct {
  89.     short code;            /* key and modification code for this
  90.                  * keymacro */
  91.     char flags;            /* flags for this key macro definition */
  92.     char len;            /* length of the macro string in bytes */
  93.     long macro;            /* if len <=4 contains the macrostring else */
  94. }   macrorec;            /* it contains a pointer to the macrostring */
  95.  
  96. #define shortBreak    1    /* flag for short break */
  97. #define longBreak    2    /* flag for long break */
  98.  
  99. #define leftArrowKey    3    /* send left arrow */
  100. #define rightArrowKey    4    /* send right arrow */
  101. #define upArrowKey    5
  102. #define downArrowKey    6
  103.  
  104. #define keypf1        7
  105. #define keypf2        8
  106. #define keypf3        9
  107. #define keypf4        10
  108.  
  109. #define keycomma    11
  110. #define keyminus    12
  111. #define keyperiod    13
  112.           /* there is no keyslash */
  113. #define key0        15
  114. #define key1        16
  115. #define key2        17
  116. #define key3        18
  117. #define key4        19
  118. #define key5        20
  119. #define key6        21
  120. #define key7        22
  121. #define key8        23
  122. #define key9        24
  123.  
  124. #define keyenter    25
  125.  
  126. #define NUMOFMODS 4
  127. typedef struct {
  128.     short modbits;        /* modifier combination */
  129.     char prefix[20];        /* prefix string */
  130. }   modrec;
  131.  
  132. /* the following type is used as an overlay for a memory     */
  133. /* block which contains the macros. It is !not! used for a */
  134. /* static variable. So don't worry about its size                  */
  135. typedef struct {
  136.     modrec modtab[NUMOFMODS];    /* modifier table */
  137.     short numOfMacros;        /* number of macros the table contains */
  138.     macrorec mcr[1024];        /* array of macro definitions */
  139. }   macrodefs;
  140.  
  141. typedef struct {        /* dummy struct definiton to get the size of */
  142.     /* the base fields in macrodefs easily */
  143.     modrec modtab[NUMOFMODS];    /* modifier table */
  144.     short numOfMacros;        /* number of macros the table contains */
  145. }   macrodefsize;
  146.  
  147. #define MacroBaseSize sizeof(macrodefsize)
  148.  
  149. typedef macrodefs **hmacrodefs;    /* handle to a macrodefs structure */
  150.  
  151. /* Globals Kermit variables */
  152.  
  153. extern char *cmarg,        /* pointer to cmd argument (file) */
  154.    *cmarg2,            /* pointer to second cmd argument */
  155.     mypadc,            /* padding char to ask for */
  156.     padch, eol,            /* end of line char to send */
  157.     seol, mystch,        /* outbound packet start character */
  158.     stchr, sstate;        /* kermit protocol state */
  159.  
  160. extern long ffc,        /* file character count  */
  161.     fsize;            /* size of current file */
  162.  
  163. extern int speed,        /* speed of port */
  164.     parity,            /* current parity setting */
  165.     flow,            /* TRUE if using flow control */
  166.     duplex,            /* TRUE if full duplex */
  167.     binary,            /* TRUE if file mode is binary */
  168.     displa,            /* TRUE for calls to screen() */
  169.     seslog,            /* TRUE if writing session log */
  170.     tralog,            /* TRUE if writing transaction log */
  171.     bctr,            /* block check type (1, 2, or 3) */
  172.     delay,            /* initial delay before sending */
  173.     mypadn,            /* something to do with padding */
  174.     npad, timint,        /* timeout interval in seconds */
  175.     rtimo, spsiz,        /* max packet size we send */
  176.     rpsiz, urpsiz,        /* user requested packet size */
  177.     turnch,            /* line "turnaround" character */
  178.     turn,            /* if TRUE "turnaround" enabled */
  179.     quiet,            /* if TRUE screen() should be quiet */
  180.     nfils,            /* */
  181.     warn,            /* TRUE does name conversion, else */
  182.                 /* deletes duplicate names on recv */
  183.     server,            /* TRUE if we are in server mode */
  184.     cxseen,            /* if TRUE abort file */
  185.     czseen,            /* if TRUE abort group */
  186.     keep,            /* Keep incomplete files */
  187.     tlevel,            /* > -1 if take file is running */
  188.     newline,            /* TRUE if linefeed after carriage return */
  189.     autowrap,            /* TRUE if autowrap is on */
  190.     screeninvert,        /* TRUE if inverted screen */
  191.     autorepeat,            /* TRUE if auto repeat is on */
  192.     smoothscroll,        /* TRUE if smooth scrolling is on */
  193.     transparent,        /* TRUE if control characters are not shown */
  194.     blockcursor,        /* TRUE if block cursor is used */
  195.     mouse_arrows,        /* TRUE if we send arrow keys on mouse downs */
  196.     visible_bell,        /* true if we do blink instead of bell */
  197.     eightbit_disp,        /* do 8 bit wide to the screen */
  198.     screensize,            /* number of lines on the screen */
  199.     graphicsinset[4],        /* (UoR) current character sets */
  200.     blinkcursor,        /* TRUE if we make the cursor blink */
  201.     sendusercvdef;        /* use rec. file mode defaults as send defaults */
  202.  
  203. extern Boolean mcmdactive,    /* TRUE if menu command keys are active */
  204.     fkeysactive;        /* TRUE if FKEYs are enabled */
  205.  
  206. #define ASCII_SET    0    /* (UoR) VT100 character set numbers */
  207.  
  208. #define GRAF_SET    2    /* (PWP) Note: these refer to the 7 bit      */
  209. #define TECH_SET    3    /*  character set part.  Eg. full ISO 8859/1 */
  210. #define DECINTL_SET    4    /*  is formed by USA_SET in GL and LAT1_SET  */
  211. #define LAT1_SET    5    /*  in GR.  Read ISO 2022 about 4 times and  */
  212. #define LAT2_SET    6    /*  you will understand what is going on     */
  213. #define LAT3_SET    7
  214. #define LAT4_SET    8
  215. #define LATCYR_SET    9
  216. #define LATARAB_SET    10
  217. #define LATGREEK_SET    11
  218. #define LATHEBREW_SET    12
  219. #define LAT5_SET    13
  220.  
  221. /* the order of these must match that of ckmres.h */
  222. #define USA_NAT        0    /* (PWP) "national" character set numbers */
  223. #define UK_NAT        1
  224. #define DUTCH_NAT    2
  225. #define FINNISH_NAT    3
  226. #define FRENCH_NAT    4
  227. #define FRENCHCAN_NAT    5
  228. #define GERMAN_NAT    6
  229. #define ITALIAN_NAT    7
  230. #define NORWEGIAN_NAT    8
  231. #define PORTUGUESE_NAT    9
  232. #define SPANISH_NAT    10
  233. #define SWEDISH_NAT    11
  234. #define SWISS_NAT    12
  235.  
  236.  
  237. /* Mac global variables */
  238.  
  239. extern short innum,        /* serial line input number */
  240.     outnum;            /* serial line output number */
  241.  
  242. extern int protocmd;        /* current cmd that made us enter */
  243.  /* protocol or 0 if protocol is */
  244.  /* not running, or -1 if remote cmd */
  245. extern FILINF filargs;        /* file information flags */
  246.  
  247. /*
  248.  * ScrDmpEnb is a flag byte used by the toolbox event manager to say
  249.  * whether command-shift-1 through command-shift-9 do anything special
  250.  * like dump the screen, eject the diskettes, etc.  This byte is used in
  251.  * INIT0, the keyboard mapping routine (see IM index under scrdmpenb).
  252.  *
  253.  * N.B: The location of this value may change if MAC comes out with a
  254.  * new SYSTEM.
  255.  *
  256.  */
  257.  
  258. #define ScrDmpEnb (*(unsigned char *) 0x2f8)
  259. #define scrdmpenabled ((unsigned char) 0xff)
  260. #define scrdmpdisabled ((unsigned char) 0x00)
  261.  
  262.  
  263. /****************************************************************************/
  264. pascal void
  265. Debugger ()
  266. /****************************************************************************/
  267. extern 0xA9FF;            /* invoke MacsBug */
  268.