home *** CD-ROM | disk | FTP | other *** search
- /*
- * hterm.h: hterm constant definition
- *
- * Author: HIRANO Satoshi
- * (C) 1989 Halca Computer Science Laboratory TM
- * University of Tokyo
- *
- * Edition history:
- * 3.1 87/06/17 Halca.Hirano conbine hterm/pc and hterm/98 into
- * a set of source file
- * 3.2 89/05/16 Halca.Hirano V2.2 distribution
- * 3.3 89/06/16 Halca.Hirano move machine dependent part to config.h
- * 3.4 89/07/27 Halca.Hirano make assembly functions far
- * ---- V2.3.-1.1 distritution ----
- * 3.5 89/09/10 Halca.Hirano
- * ---- V2.3.0.0 distribution
- * 3.5 89/09/21 Halca.Hirano add xmodem
- * ---- V2.4.0.0 distribution
- * 3.6 89/12/03 Halca.Hirano
- * add BS key watcher varables
- * 3.7 89/12/06 Halca.Hirano dropER flag (flag for dropping ER/RS at exit)
- * 3.8 90/03/28 Halca.Hirano move global variables to global.h
- *
- * $Header: hterm.hv 1.13 90/07/05 01:23:58 hirano Exp $
- */
-
- #ifdef MSDOS
- #include <dos.h>
- #ifdef COMP_TURBOC
- #undef FP_SEG
- #undef FP_OFF /* FP_??? must be able to use as lvalue */
- #define FP_SEG(fp) (*((unsigned *)&(fp) + 1))
- #define FP_OFF(fp) (*((unsigned *)&(fp)))
- #endif /* COMP_TURBOC */
- #endif
-
- #ifdef PC98
- #include "pc98.h"
- #endif
- #if defined(IBMPC) || defined(J3100)
- #include "ibmpc.h"
- #endif
- #ifdef X68000
- #include "x68000.h"
- #endif
-
- /*
- * basic type definitions
- */
- typedef unsigned short u_short;
- typedef unsigned long u_long;
- typedef unsigned char u_char;
- typedef unsigned char bool;
-
-
- /*
- * hterm internal character code definition
- *
- * Character code definition between modules (C source files) is here.
- *
- * 00xx if bit 7 of xx is 0, it's ASCII code.
- * 00xx if bit 7 of xx is 1, it's kana code.
- * xx00 hterm special control code (such as CTRL-PF key, curosr key)
- * xxyy JIS kanji code without preamble
- */
-
- /*
- * colums and lines
- */
- #define MAX_COLUMN 80
- #define LAST_COLUMN (MAX_COLUMN-1)
- #define MAX_LINE_19_MODE 19 /* use with FEP */
- #define MAX_LINE_20_MODE 20 /* may not with status line */
- #define MAX_LINE_24_MODE 24 /* 25mode with FEP */
- #define MAX_LINE_25_MODE 25 /* may not with status line */
- #define BOTTOM_LINE_19_MODE (MAX_LINE_19_MODE-1)
- #define BOTTOM_LINE_20_MODE (MAX_LINE_20_MODE-1)
- #define BOTTOM_LINE_24_MODE (MAX_LINE_24_MODE-1)
- #define BOTTOM_LINE_25_MODE (MAX_LINE_25_MODE-1)
- #define SETUP_LINE 16
- #define MAX_CHAR (MAX_COLUMN * MAX_LINE_25_MODE)
-
- /*
- * other maximums
- */
- #define MAX_FILE_NAME 60 /* file name length */
- #define MAX_XFER_BUF (1024+10) /* file xfer buffer size */
-
- /*
- * characters
- */
- #define NUL 0x00
- #define SOH 0x01
- #define ENQ 0x05
- #define BEL 0x07
- #define BS 0x08
- #define HT 0x09
- #define TAB 0x09
- #define LF 0x0a
- #define VT 0x0b
- #define FF 0x0c
- #define CR 0x0d
- #define SO 0x0e
- #define SI 0x0f
- #define DC1 0x11
- #define DC3 0x13
- #define CAN 0x18
- #define SUB 0x1a
- #define ESC 0x1b
- #define SPACE 0x20
- #define DEL 0x7f
- #define SS2 0x8e
- #define SS3 0x8f
- #define CSI 0x9b
-
- #define isSJIS1(c) ((0x81 <= (c) && (c) <= 0x9f) || (0xe0 <= (c) && (c) <=0xfc))
- #define isSJIS2(c) ((0x40 <= (c) && (c) <= 0x7e) || (0x80 <= (c)))
- #define isEUC(x) ((x) & 0x80)
- #define isKana(c) (0xa0 <= (c) && (c) <= 0xdf)
- #define isHtermCtrl(c) (((c) & 0x80) && !isKana(c))
- #define isAscii(c) ((c) >= 0x20 && (c) <= 0x7e)
- #define isUpper(c) ('A' <= (c) && (c) <= 'Z')
- #define isLower(c) ('a' <= (c) && (c) <= 'z')
- #define toUpper(c) ((c)-0x20)
- #define toLower(c) ((c)+0x20)
- #define CTRL(c) ((c)-0x40)
-
- /*
- * flags
- */
- #define YES 1
- #define NO 0
- #define OK 0
- #define ERR (-1)
- #define UP 1
- #define DOWN 2
- #define RIGHT 3
- #define LEFT 4
-
- /*
- * hterm mode flags
- */
- #define M_COMM 1 /* communication mode */
- #define M_SETUP 2 /* setup mode */
- #define M_HISTORY 4 /* history editor mode */
- #define M_OS 8 /* os mode */
-
- /*
- * file transfer panel tags
- */
- #define X_FILENAME (0)
- #define X_PROTOCOL (1)
- #define X_PERCENT (2)
- #define X_KBYTES (3)
- #define X_PSENT (4)
- #define X_PRECV (5)
- #define X_RATE (6)
- #define X_RETRY (7)
- #define X_PSIZE (8)
- #define X_STATUS (9)
- #define X_ERROR (10)
-
- /*
- * mini mini emacs help flag bits; use ORed flag
- */
- #define E_HELP 1 /* with help */
- #define E_NO_HELP 0 /* without help */
- #define E_FILE 2 /* with filename completion */
- #define E_NO_FILE 0 /* without filename completion */
-
- /*
- * hterm CTRL-key binding table index
- */
- #define C_UP 0
- #define C_DOWN 1
- #define C_RIGHT 2
- #define C_LEFT 3
- #define C_NP 4
- #define C_PP 5
- #define C_TOL 6
- #define C_EOL 7
- #define C_KILLEND 8
- #define C_KILLTOP 9
- #define C_GOTO 10
- #define C_TOP 11
- #define C_HOME 12
- #define C_SEARCHF 13
- #define C_SEARCHB 14
- #define C_MARK 15
- #define C_CBUF 16
- #define C_COPY 17
- #define C_XNG 18
- #define C_WRITE 19
- #define C_REDRAW 20
- #define C_ESC 21
- #define C_QUOTE 22
- #define C_DEL 23
- #define C_BDEL 24
- #define C_ABORT 25
- #define NUM_BIND 26
- #define BIND_NAME_LEN 8
-
- /*
- * key table magics
- */
- #define NA (0xff) /* not available */
- #define NG (0xff) /* not generated */
-
- /*
- * auto dialing
- */
- #define MAX_PHONE 65 /* dialing sequence length */
- #define DIAL_STATE_NONE 0 /* state machine tag */
- #define DIAL_STATE_START 1
- #define DIAL_STATE_PUT 2
- #define DIAL_STATE_WAIT 3
-
- /*
- * setup menu system tags
- */
- #define M_NEXT 1
- #define M_DIRECTORY 2
- #define M_NOCHANGE 3
- #define END_SETUP (-1)
-
- /*
- * setup file structure
- */
- #define NUM_VALUE 60
- struct setups {
- char hello[40];
- int version;
- int revision;
- int edition;
- char ids[20];
- char phone[MAX_PHONE];
- char tab[MAX_COLUMN];
- char defaultCommandLine[MAX_FILE_NAME];
- char fontName[MAX_FILE_NAME];
- int val[NUM_VALUE];
- /*
- * key tables here
- */
- };
-
-