home *** CD-ROM | disk | FTP | other *** search
- /*
- ** global.h: hterm global variables and function prototypes
- *
- * Author: HIRANO Satoshi
- *
- * (C) 1986 Halca Computer Science Laboratory UEC TM
- * University of Electro Communications
- * University of Tokyo
- *
- *
- * Edition history:
- * 1.1 90/03/28 Halca.Hirano derived from hterm.h
- *
- * $Header: global.hv 1.3 90/07/04 18:37:10 hirano Exp $
- */
-
- /*
- *
- * external variables
- *
- */
- #ifdef MAIN
- # define EXT /* remove extern */
- #else
- # define EXT extern
- #endif
-
-
- /*
- * general
- */
- EXT int mode; /* hterm operation mode; M_XXX */
- EXT int hemacs; /* hemacs mode or not */
- EXT long starTime; /* hterm start time */
- EXT char tmpBuf[100]; /* general purpose temporary buffer */
- EXT char setFileName[MAX_FILE_NAME]; /* hterm.set file name */
- EXT char helpFileName[MAX_FILE_NAME]; /* hterm.db help database file name*/
- EXT char defaultCommandLine[MAX_FILE_NAME]; /* default call OS command line */
-
-
- /*
- * ansi escape sequence mode
- */
- EXT int originMode; /* origin mode flag */
- EXT u_short saveX; /* save cursor ESC seq. */
- EXT u_short saveY; /* save cursor ESC seq. */
- EXT u_short saveAttr; /* save cursor ESC seq. */
- #if defined IBMPC | defined J3100
- EXT u_short ansiVramSave[MAX_CHAR];
- #endif /* IBMPC | J3100 */
- #ifdef PC98
- EXT u_short ansiVramSave[MAX_CHAR*2];
- #endif /* PC98*/
-
- /*
- * hterm command line options
- */
- EXT long optBaudrate; /* buad rate */
- EXT int optAsckey; /* ascii keyboard mode */
- EXT int optRedial; /* redial */
- EXT int optPortNo; /* port number */
- EXT int optNoSetup; /* do not load setup */
- EXT char *setFile; /* setup file name */
- EXT int setupSpecified; /* setup file is specified */
-
- /*
- * display mode
- */
- EXT int funKeyDisplayed; /* flat, at startup, funkey is displaed */
- EXT u_short maxLine; /* lines usable form the host */
- EXT u_short realMaxLine; /* physical lines on the screen */
- EXT u_short bottomLine; /* lowest line for the host */
- EXT u_short realBottomLine; /* physical lowest line */
- EXT u_short vramSegment; /* VRAM segment */
- EXT u_short gvramSegment; /* GVRAM segment */
- EXT int lineMode; /* line mode LINE_MODE_20/24/25 */
- EXT u_short cursorX; /* cursor X position */
- EXT u_short cursorY; /* cursor Y position */
- EXT u_short attrib; /* attribute */
- EXT u_short eraseAttr; /* erase attribute */
- EXT u_char border; /* border color */
- EXT int cursor; /* cursor display flag */
- EXT int formfeed; /* foomfeed mode (FF/LF) */
- EXT int blinkCursor; /* blinking = YES, static = NO */
- EXT volatile short blinkTimer; /* soft cursor blink timer */
- EXT int blockCursor; /* block = YES, underLine = NO */
- EXT int autoWrap; /* auto wrap mode */
- EXT u_short upScrRegion; /* upper scroll region */
- EXT u_short lowScrRegion; /* lower scroll region */
- EXT int intControl; /* interpret control flag */
- EXT int echoMode; /* echo back flag */
- EXT int backQuote; /* can display back quote/slash */
- EXT int kanjiCode; /* kanji code */
- EXT int kfirst; /* first byte of kanji */
- EXT int kstate; /* roman/kana/kanji state */
- EXT char tabTable[MAX_COLUMN]; /* tab stop table */
- EXT int spaceTab; /* number of tabs in the table */
- EXT int visibleBell; /* use visible bell */
- EXT bool wrapPending; /* wrap aound is being pending flag (VT wrap) */
- EXT int softFont; /* soft font mode flag */
- EXT int fontCacheSize; /* font cache size in chars */
- EXT int fontFileLoaded; /* font file loaded flag */
- EXT char fontName[MAX_FILE_NAME] /* soft font filename */
- #ifdef MAIN
- = DEFAULT_FONT_NAME
- #endif
- ;
-
- #if defined IBMPC | defined J3100
- EXT u_short page0Save[MAX_CHAR]; /* page0 save area */
- #endif /* IBMPC | J3100 */
- #ifdef PC98
- EXT u_short page0Save[MAX_CHAR*2];
- #endif /* PC98 */
-
-
- /*
- * keyboard
- */
- EXT int clickFlag; /* key click flag(1=click) */
- EXT int newline; /* newline flag(1=newline) */
- EXT int asckey; /* ascii keyboard mode for PC98(1=ascii)*/
- EXT int applCursor; /* application cursor flag (1=appl) */
- EXT int applKeypad; /* application keypad flag (1=appl) */
- EXT int fepInvoke; /* fep invoke sequence */
- EXT int bsDel; /* if 0 BS->BS, else BS->DEL key */
- EXT int shiftLock; /* shift/ctrl lock (1=lock) */
- EXT int mouseSpeed; /* mouse speed */
-
- /*
- * printer
- */
- EXT int printMode; /* auto print flag (1=print) */
- EXT int spacing; /* spacing for kanji */
-
- /*
- * serial port
- */
- EXT int portNo; /* port number com1, com2, .... */
- EXT int online; /* on/off line flag (1=online) */
- EXT u_char cMask; /* character mask */
- EXT char xonXoff; /* 1= XON/XOFF, 0 = no XON/XOFF */
- EXT char maskFlag; /* XOFFed flag (1=XOFFed) */
- EXT char downLoading; /* down loading flag (must be char) */
- EXT u_short baudrate; /* baud rate (external form) */
- EXT char baud; /* baud rate (internal form) */
- EXT char parity; /* paritybit (external form) */
- EXT u_char paritybit; /* parity bit (internal form) */
- EXT u_char stopbit; /* stop bit (internal form) */
- EXT volatile short portTimer; /* 1 sec decriment timer value */
- EXT int dropER; /* 1= drop ER at exit */
-
- /*
- * file xfer
- */
- EXT int logging; /* logging (1=logging) */
- EXT int loggingType; /* logging type (1=binary) */
- EXT int upLoading; /* uploading (1=uploading) */
- EXT int upLoadType; /* upload type (1=binary) */
- EXT int upLoadDelay; /* upload delay */
- EXT int xmodemMode; /* xmodem/ymodem */
- EXT int xmodemType; /* xmodem binary or text */
- EXT int xmodemLongP; /* xmodem use longPacket */
- EXT char logFileName[MAX_FILE_NAME]; /* logging file name */
- EXT char upFileName[MAX_FILE_NAME]; /* up load file name */
- EXT char phone[MAX_PHONE]; /* dialing sequence */
- EXT int dialStartup; /* dial at start up (1=dial) */
- EXT int redial; /* redial (1=redial) */
- EXT volatile short kermitTimer; /* timer for kermit */
- EXT char XFerBuffer[MAX_XFER_BUF]; /* common file transfer buffer */
- /* used by kermit and xmodem */
-
- /*
- * CRT Saver and timer
- */
- EXT int saver; /* CRT saver code (off, 3min, 10min) */
- EXT int saverType; /* using saver type (blank,ico,...) */
- EXT int maxSaverType; /* number of installed saver type - 1 */
- EXT short timerLoadValue; /* timer preload value */
- EXT volatile short timerValue; /* 1 sec decriment timer value */
- EXT int bsKeyRatio; /* BS Key watcher threshhold */
- EXT int bsKeyWatcherTimer; /* BS Key watcher timer */
- EXT int keyCount; /* key board hit counter */
- EXT int bsKeyCount; /* BS/DEL Key hit counter */
-
- /*
- * setup
- */
- EXT int showHelp; /* help msg is showing flag (1=showing) */
- EXT int curXSave, curYSave, printMSave, intConSave;
- EXT int lowScrRgSave, attrSave;
- EXT int kfirstSave, kstateSave;
- EXT int lineModeSave, cursorSave;
- EXT int loggingSave, upLoadSave;
- EXT int kanjiSave;
- EXT int wrapPendingSave;
-
- /*
- * history editor
- */
- EXT u_short copyBufferSize; /* copy buffer size */
-
- #ifdef MSDOS
- /*
- * dos interface
- */
- EXT union REGS rg; /* dos interface registers */
- #endif /* MSDOS */
-
- /*
- * hterm CTRL-key function binding
- */
- EXT char *bindName[]
- #ifdef MAIN
- = {
- "Up",
- "Down",
- "Right",
- "Left",
- "Next-Pg",
- "Prev-Pg",
- "Top-Line",
- "End-Line",
- "Kill-End",
- "Kill-Top",
- "GoTo",
- "Top-Hist",
- "End-Hist",
- "Search-F",
- "Search-B",
- "Mark",
- "Clr-Buf",
- "Copy",
- "Xng",
- "Write",
- "Redraw",
- "ESC",
- "Quote",
- "Del",
- "Back-Del",
- "Abort"}
- #endif /* MAIN */
- ;
-
- EXT char bindTab[NUM_BIND]
- #ifdef MAIN
- = {
- CTRL('P'), /* "Up" */
- CTRL('N'), /* "Down" */
- CTRL('F'), /* "Right", */
- CTRL('B'), /* "Left", */
- CTRL('V'), /* "Next Pg", */
- CTRL('Z'), /* "Prev Pg", */
- CTRL('A'), /* "Top-Line" */
- CTRL('E'), /* "End-Line" */
- CTRL('K'), /* "Kill-End" */
- CTRL('U'), /* "Kill-Top" */
- CTRL('G'), /* "Go-To" */
- CTRL('T'), /* "Top-Hist" */
- CTRL('U'), /* "End-Hist" */
- CTRL('S'), /* "Search-F" */
- CTRL('R'), /* "Search-B", */
- 0, /* "Mark", */
- CTRL('\\'), /* "Clr-Buf", */
- CTRL('W'), /* "Copy", */
- CTRL('C'), /* "Xng", */
- CTRL('O'), /* "Write" */
- CTRL('L'), /* "Redraw" */
- 0x1b, /* "ESC" */
- CTRL('Q'), /* "Quote" */
- CTRL('D'), /* "Del", */
- CTRL('H'), /* "Back-Del", */
- CTRL('G'), /* "Abort" */
- }
- #endif /* MAIN */
- ;
-
- /*
- * messages
- */
- EXT char msg_null[]
- #ifdef MAIN
- = ""
- #endif
- ;
- EXT char msg_cantOpen[]
- #ifdef MAIN
- = "can't open file '%s'"
- #endif
- ;
- EXT char msg_close[]
- #ifdef MAIN
- = "close '%s'"
- #endif
- ;
- EXT char msg_baudrate[]
- #ifdef MAIN
- = "funny baudrate %ld\n\r"
- #endif
- ;
- EXT char msg_setupID[]
- #ifdef MAIN
- = "wet semaphore"
- #endif
- ;
- #ifdef PC98
- EXT char msg_pc98baud[]
- #ifdef MAIN
- = "(up to 9600 baud on 8/16Mhz PC9801)\n\r"
- #endif
- ;
- #endif /* PC98 */
- EXT char msg_newString[]
- #ifdef MAIN
- = "New string (ESC for abort): "
- #endif
- ;
-
- EXT char msg_alloc[]
- #ifdef MAIN
- = "Can't allocate memory for %s"
- #endif
- ;
-
- /*
- * function prototypes
- */
-
- /*
- * ansi.c
- */
- void ansiInit(void);
- void ansiSetup(void);
- void conPrint(char *p);
- void decodeAnsi(u_short c);
- void normalMode(void );
- void reverseMode(void );
-
- /*
- * console.c
- */
- void consoleInit(void );
- void consoleSetup(void );
- void consoleEnd(void );
- void initPage(void );
- void setLineMode(int mode);
- void conWrite(unsigned short c);
- void scrlUp(void );
- void clearLine(unsigned short from,unsigned short to);
- void awMode(int mode);
- void moveCursor(int action,int num);
-
- /*
- * edit.c
- */
- void editInit(void );
- void editEnd(void );
- void historyEditor(void );
- void saveHist(int, int);
- void paste(void );
- unsigned short getCopyBuffer(void );
- void loadFile(FILE *fp);
-
- /*
- * file.c
- */
- void fileInit(void );
- void fileSetup(void );
- void fileEnd(void );
- int setLogging(void );
- int setUpLoad(void );
- int logStart(char *fileName);
- void logStop(void );
- void logPut(unsigned short c);
- int upStart(char *fileName);
- void upStop(void );
- short upGet(void );
- void xferPanel(char *name);
- void xprintMsg(int to,char *s,long n);
- char *searchPath(char *file);
-
- /*
- * font.c
- */
- void fontInit(void );
- void fontEnd(void );
- void softFontLocate(short x,short y);
- void softCursorOnOff(int onOff);
- void blinkSoftCursor(void );
- void softFontPutChar(unsigned short c);
- void softFontInsertLine(int num);
- void softFontDeleteLine(int num);
- void softFontInsertChar(int at,int n);
- void softFontDeleteChar(int at,int n);
- void softFontClearColumn(unsigned short from,unsigned short to);
- void softFontClearLine(int y);
- void softFontReverseScreen(void );
- char *fontLoad(char *fontName);
-
- /*
- * hterm.c
- */
- void termination(void );
- void resetTerminal(void );
- void endAll(void );
- void printCompileOptions(void);
-
- /*
- * j3100.c pc98.c ibmpc.c
- */
- void CRTInit(void );
- void CRTEnd(void );
- void setCRTMode(void );
- void restoreCRTMode(void );
- void locate(int x,int y);
- int isKanjiOnVRAM(int x,int y);
- void cursorOnOff(int onOff);
- void putChar(unsigned short c);
- void insertLine(int num);
- void deleteLine(int num);
- void clearColumn(unsigned short from,unsigned short to);
- void clearCurrentPage(void );
- void insertChar(int at,int n);
- void deleteChar(int at,int n);
- void saveLine(int y,unsigned char FAR *buf);
- void savePage(unsigned short *buf);
- void restorePage(unsigned short *buf);
- void clearSavedPage(unsigned short *buf);
- void click(void );
- void bell(void );
- void textCRTOnOff(int onOff);
- void setBorder(int col);
- void graphicCRTOnOff(int onOff);
- void setCRTLineMode(int mode25);
-
- /*
- * indexlib.c
- */
- int openIndex(char *file);
- int closeIndex(void );
- int getKey(char *key,char *nextKey);
- int getRecord(char *line,int n);
-
- /*
- * kermit.c
- */
- int kbegin(char *msg);
- void kend(char *msg,int status);
- void krec(void );
- void ksend(void );
- void kfinish(void );
- void kget(void );
-
- /*
- * key98.c keypc.c
- */
- void keyInit(void );
- void keyReInit(void );
- void keySetup(void );
- void keyEnd(void );
- void keyMode(void );
- void setBSDel(int bsDelFlag);
- short keyin(void );
- int checkKey(void );
- void editNormalKeys(void );
- void editShiftKeys(void );
- void editCtrlKeys(void );
- void editKanaKeys(void );
- void editShKanaKeys(void );
- void editPFKey(void );
- void editSPFKey(void );
- void editCursorKey(void );
- void editAppCursorKey(void );
- void editAppKeyPad(void );
- void editBinding(void );
- void editKeySwapTable(void );
- void saveKey(int fd);
- void loadKey(int fd);
- void mouseInit(void);
- void mouseEnd(void);
-
- /*
- * msdos.c
- */
- void FAR *allocMem(long size);
- void freeMem(void FAR *ptr);
- void moveData(void FAR *to,void FAR *from,short size);
- int getNextFileName(int first,char * *fileList,char * *fileName,int dirFlag);
- void changeDirectory(void );
- void setCritHandler(void );
- void restoreCritHandler(void );
-
- /*
- * port.c
- */
- void portInit(void );
- void portReInit(void );
- void portSetup(void );
- void portEnd(void );
- void outPort(unsigned short c);
- void setPort(int num);
- void rowOutPort(unsigned char c);
- void outString(char *s);
- void rowOutPortBuffer(char *buf,int len);
- void outESC(char *s);
- int baudNum(unsigned short baudrate);
- unsigned short numBaud(unsigned int num);
- void flushInputBuffer(void );
- void shortWait(void );
- void nullFunction(void );
- int inpWait(unsigned short addr);
- void outpWait(unsigned short addr,int value);
- unsigned short SJIStoJIS(unsigned short byte_1,unsigned short byte_2);
- unsigned short JIStoSJIS(unsigned char h,unsigned char l);
- unsigned char parcalc(unsigned char paritybit,unsigned char stopbit);
- void initPortDevice(unsigned char baud,unsigned char parity);
- void sendBreak(int shortLong);
- void ER_RS_On(void );
- void ER_RS_Off(void );
-
- /*
- * printer.c
- */
- void printInit(void );
- void printSetup(void );
- void printEnd(void );
- void printOn(void );
- void outPrinter(unsigned short c);
- int checkPrinterReady(void );
-
- /*
- * saver98.c saverpc.c
- */
- void saverInit(void );
- void saverReInit(void );
- void saverSetup(void );
- void saverEnd(void );
- char *saverName(int n);
- void setTimerValue(void );
- void CRTSaver(void );
-
- /*
- * setup.c
- */
- void setup(void );
-
- /*
- * utils.c
- */
- void putStatus(char *s);
- void clearStatus(void );
- void clearCopyright(void );
- void flushComment(char *s);
- void putComment(char *msg,char *msg2);
- char *versionString(void );
- int checkEvent(void );
- void showPage1(void );
- void showPage0(void );
- void callOS(void );
- char *helpSystem(char *key);
- int emacs(char *prompt,char *buf,int limit,int help);
- int charSize(unsigned char FAR *buf,int at);
- void editKeyTable(char * *name,u_char (*table)[17],int num,int keyLen,int nameLen);
- void showKeyTable(char * *name,u_char (*table)[17],int num,int keyLen,int nameLen);
- char *loadSetup(char *path,int *flag);
- char *saveSetup(char *path);
- void clearAllTabs(void );
- void setTabs(int n);
- void editTabs(void );
- void dispTabs(void );
- void toSlash(char *p);
-
- /*
- * xmodem.c
- */
- void xinit(void );
- void xrec(void );
- void xsend(void );
-
- /*
- * all of functions in assembly should be FAR functions
- */
- /*
- * serdrvxx.asm
- */
- void (INTERRUPT FAR * FAR getPortInterruptHandlerAddress(void))(void);
- void FAR initPortBuffer(void);
- short FAR getSerial(void);
- int FAR checkSerial(void);
- void FAR pokeMemory(short seg, short addr, u_char data);
- u_short FAR peekMemory(short seg, short addr);
- #ifdef PC98
- void FAR timerInit(void (INTERRUPT FAR *)());
- void INTERRUPT FAR timerHandler(void);
- short FAR directConsoleIO(void);
- #endif /* PC98 */
-
- /*
- * keydrvpc.asm
- */
- #if defined(IBMPC) || defined(J3100)
- short FAR inputKey(void);
- int FAR checkBIOSKey(void);
- void FAR strPut(int page, int chars, int x, int y, char FAR *str);
- #endif /* IBMPC || J3100 */
-
- /*
- * vramxx.asm
- */
- unsigned FAR getDSeg(void);
- void FAR fillVRAM(u_short *to, u_short num, u_short data, u_short attrib);
- void FAR moveForward(u_short *to, u_short *from, u_short num, int attribFlag);
- void FAR moveBackward(u_short *to, u_short *from, u_short num, int attribFlag);
- void FAR moveMemory(u_short *to, u_short toSeg, u_short *from, u_short fromSeg, u_short num);
- void FAR moveForByte(u_short *to, u_short *from, u_short num);
- void FAR moveBackByte(u_short *to, u_short *from, u_short num);
- void FAR splx(void);
- void FAR spl7(void);
-
- #ifdef J3100
- extern void FAR saveVRAM();
- extern void FAR loadVRAM();
- extern void FAR swapVRAM();
- extern u_short FAR b_getCursor();
- extern void FAR b_setCursor();
- extern u_short FAR b_readChar();
- extern u_short FAR b_readCharAt();
- extern void FAR b_writeChar();
- extern void FAR b_writeCharAt();
- extern void FAR b_reverseChar();
- extern void FAR b_reverseCharAt();
- extern void FAR v_reverseScreen();
- #endif /* J3100 */
-
- #ifdef MOUSE
- void (FAR * FAR getMouseIntAddress(void))(void);
- #endif /* MOUSE */
-