home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / COMM / MISC / SRC26_2.ZIP / SRC / HTERM.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-05  |  5.7 KB  |  246 lines

  1. /* 
  2.  * hterm.h: hterm constant definition
  3.  *
  4.  * Author: HIRANO Satoshi
  5.  * (C) 1989  Halca Computer Science Laboratory TM
  6.  *           University of Tokyo
  7.  *
  8.  * Edition history:
  9.  * 3.1 87/06/17 Halca.Hirano conbine hterm/pc and hterm/98 into 
  10.  *                 a set of source file
  11.  * 3.2 89/05/16 Halca.Hirano V2.2 distribution
  12.  * 3.3 89/06/16 Halca.Hirano move machine dependent part to config.h
  13.  * 3.4 89/07/27 Halca.Hirano make assembly functions far
  14.  * ---- V2.3.-1.1 distritution ----
  15.  * 3.5 89/09/10 Halca.Hirano
  16.  * ---- V2.3.0.0 distribution
  17.  * 3.5 89/09/21 Halca.Hirano add xmodem
  18.  * ---- V2.4.0.0 distribution
  19.  * 3.6 89/12/03 Halca.Hirano
  20.  *    add BS key watcher varables
  21.  * 3.7 89/12/06 Halca.Hirano dropER flag (flag for dropping ER/RS at exit)
  22.  * 3.8 90/03/28 Halca.Hirano move global variables to global.h
  23.  *
  24.  * $Header: hterm.hv  1.13  90/07/05 01:23:58  hirano  Exp $
  25.  */
  26.  
  27. #ifdef MSDOS
  28. #include <dos.h>
  29. #ifdef COMP_TURBOC
  30. #undef    FP_SEG
  31. #undef    FP_OFF            /* FP_??? must be able to use as lvalue */
  32. #define FP_SEG(fp)         (*((unsigned *)&(fp) + 1))
  33. #define FP_OFF(fp)         (*((unsigned *)&(fp)))
  34. #endif /* COMP_TURBOC */
  35. #endif
  36.  
  37. #ifdef PC98
  38. #include "pc98.h"
  39. #endif
  40. #if defined(IBMPC) || defined(J3100)
  41. #include "ibmpc.h"
  42. #endif
  43. #ifdef X68000
  44. #include "x68000.h"
  45. #endif
  46.  
  47. /*
  48.  * basic type definitions
  49.  */
  50. typedef unsigned short u_short;
  51. typedef unsigned long u_long;
  52. typedef unsigned char u_char;
  53. typedef unsigned char bool;
  54.  
  55.  
  56. /*
  57.  * hterm internal character code definition
  58.  *
  59.  * Character code definition between modules (C source files) is here.
  60.  * 
  61.  * 00xx        if bit 7 of xx is 0, it's ASCII code.
  62.  * 00xx        if bit 7 of xx is 1, it's kana code.
  63.  * xx00        hterm special control code (such as CTRL-PF key, curosr key)
  64.  * xxyy        JIS kanji code without preamble
  65.  */
  66.  
  67. /* 
  68.  * colums and lines 
  69.  */
  70. #define MAX_COLUMN 80
  71. #define LAST_COLUMN (MAX_COLUMN-1)
  72. #define MAX_LINE_19_MODE 19    /* use with FEP            */
  73. #define MAX_LINE_20_MODE 20    /* may not with status line    */
  74. #define MAX_LINE_24_MODE 24    /* 25mode with FEP        */
  75. #define MAX_LINE_25_MODE 25    /* may not with status line    */
  76. #define BOTTOM_LINE_19_MODE (MAX_LINE_19_MODE-1)
  77. #define BOTTOM_LINE_20_MODE (MAX_LINE_20_MODE-1)
  78. #define BOTTOM_LINE_24_MODE (MAX_LINE_24_MODE-1)
  79. #define BOTTOM_LINE_25_MODE (MAX_LINE_25_MODE-1)
  80. #define SETUP_LINE 16
  81. #define MAX_CHAR (MAX_COLUMN * MAX_LINE_25_MODE)
  82.  
  83. /*
  84.  * other maximums
  85.  */
  86. #define MAX_FILE_NAME    60            /* file name length            */
  87. #define MAX_XFER_BUF    (1024+10)    /* file xfer buffer size    */
  88.  
  89. /* 
  90.  * characters 
  91.  */
  92. #define NUL    0x00
  93. #define SOH    0x01
  94. #define ENQ    0x05
  95. #define BEL    0x07
  96. #define BS    0x08
  97. #define HT    0x09
  98. #define TAB    0x09
  99. #define LF    0x0a
  100. #define VT    0x0b
  101. #define FF    0x0c
  102. #define CR    0x0d
  103. #define SO    0x0e
  104. #define SI    0x0f
  105. #define DC1    0x11
  106. #define DC3    0x13
  107. #define CAN    0x18
  108. #define SUB    0x1a
  109. #define ESC    0x1b
  110. #define SPACE    0x20
  111. #define    DEL    0x7f
  112. #define    SS2    0x8e
  113. #define    SS3    0x8f
  114. #define CSI    0x9b
  115.  
  116. #define    isSJIS1(c)    ((0x81 <= (c) && (c) <= 0x9f) || (0xe0 <= (c) && (c) <=0xfc))
  117. #define    isSJIS2(c)    ((0x40 <= (c) && (c) <= 0x7e) || (0x80 <= (c)))
  118. #define isEUC(x)     ((x) & 0x80)
  119. #define    isKana(c)    (0xa0 <= (c) && (c) <= 0xdf)
  120. #define isHtermCtrl(c)    (((c) & 0x80) && !isKana(c))
  121. #define isAscii(c)    ((c) >= 0x20 && (c) <= 0x7e)
  122. #define isUpper(c)    ('A' <= (c) && (c) <= 'Z')
  123. #define isLower(c)    ('a' <= (c) && (c) <= 'z')
  124. #define toUpper(c)    ((c)-0x20)
  125. #define toLower(c)    ((c)+0x20)
  126. #define CTRL(c)        ((c)-0x40)
  127.  
  128. /*
  129.  * flags 
  130.  */
  131. #define YES    1
  132. #define    NO    0
  133. #define OK    0
  134. #define ERR    (-1)
  135. #define UP 1
  136. #define DOWN 2
  137. #define RIGHT    3
  138. #define LEFT    4
  139.  
  140. /*
  141.  * hterm mode flags
  142.  */
  143. #define M_COMM        1                /* communication mode        */
  144. #define M_SETUP        2                /* setup mode                */
  145. #define M_HISTORY    4                /* history editor mode        */
  146. #define M_OS        8                /* os mode                    */
  147.  
  148. /*
  149.  * file transfer panel tags
  150.  */
  151. #define    X_FILENAME    (0)
  152. #define    X_PROTOCOL    (1)
  153. #define    X_PERCENT    (2)
  154. #define    X_KBYTES    (3)
  155. #define    X_PSENT        (4)
  156. #define    X_PRECV        (5)
  157. #define    X_RATE        (6)
  158. #define    X_RETRY        (7)
  159. #define    X_PSIZE        (8)
  160. #define    X_STATUS    (9)
  161. #define    X_ERROR        (10)
  162.  
  163. /*
  164.  * mini mini emacs help flag bits; use ORed flag
  165.  */
  166. #define E_HELP        1        /* with help                    */
  167. #define E_NO_HELP    0        /* without help                    */
  168. #define E_FILE        2        /* with filename completion        */
  169. #define E_NO_FILE    0        /* without filename completion    */
  170.  
  171. /*
  172.  * hterm CTRL-key binding table index
  173.  */
  174. #define C_UP    0
  175. #define C_DOWN    1
  176. #define C_RIGHT    2
  177. #define C_LEFT    3
  178. #define C_NP    4
  179. #define C_PP    5
  180. #define C_TOL    6
  181. #define C_EOL    7
  182. #define C_KILLEND    8
  183. #define C_KILLTOP    9
  184. #define C_GOTO        10
  185. #define C_TOP        11
  186. #define C_HOME        12
  187. #define C_SEARCHF    13
  188. #define C_SEARCHB    14
  189. #define C_MARK        15
  190. #define C_CBUF        16
  191. #define C_COPY        17
  192. #define C_XNG        18
  193. #define C_WRITE        19
  194. #define C_REDRAW    20
  195. #define C_ESC        21
  196. #define C_QUOTE        22
  197. #define C_DEL        23
  198. #define C_BDEL        24
  199. #define C_ABORT        25
  200. #define NUM_BIND    26
  201. #define BIND_NAME_LEN 8
  202.  
  203. /*
  204.  * key table magics 
  205.  */
  206. #define NA    (0xff)        /* not available        */
  207. #define NG    (0xff)        /* not generated          */
  208.  
  209. /*
  210.  * auto dialing
  211.  */
  212. #define MAX_PHONE        65    /* dialing sequence length    */
  213. #define DIAL_STATE_NONE        0    /* state machine tag        */
  214. #define DIAL_STATE_START    1
  215. #define DIAL_STATE_PUT        2
  216. #define DIAL_STATE_WAIT        3
  217.  
  218. /*
  219.  * setup menu system tags
  220.  */
  221. #define M_NEXT 1
  222. #define M_DIRECTORY 2
  223. #define M_NOCHANGE 3
  224. #define END_SETUP (-1)
  225.  
  226. /*
  227.  * setup file structure
  228.  */
  229. #define NUM_VALUE 60
  230. struct setups {
  231.     char hello[40];
  232.     int version;
  233.     int revision;
  234.     int edition;
  235.     char ids[20];
  236.     char phone[MAX_PHONE];
  237.     char tab[MAX_COLUMN];
  238.     char defaultCommandLine[MAX_FILE_NAME];
  239.     char fontName[MAX_FILE_NAME];
  240.     int val[NUM_VALUE];
  241.     /* 
  242.      * key tables here 
  243.      */
  244. };
  245.  
  246.