
/*
 * Windows Kermit header file
 */
     
#include <stdio.h>
     
 /* this trick allows externs to be put in one place */
#ifndef EXTERN
    #define EXTERN extern
#endif
     
/* Dialogue box constants */
#define ABOUTBOX 1
#define SENDBOX 2
#define SNDPROMPT 3
#define SNDFILENAME 4
     
/* String manifests */
#define APPNAME	100
#define APPABOUT 101
#define TITLE	102
#define COM1STR 103
#define COM2STR 104
#define STATESTRING 105
#define FILESTRING 106
#define PACKETSTRING 107
     
/* STATE MANIFESTS */
#define CONNECTSTATE 200
#define RECEIVESTATE 201
#define SENDSTATE 202
     
/* COMM PORT MANIFESTS */
#define COMMPORT1 300
#define COMMPORT2 301
#define RXBUFSIZE 1024
#define TXBUFSIZE 1024
#define MAXCOMMERR -100
     
/* BAUD RATE MANIFESTS */
#define BAUD300	400
#define BAUD1200 401
#define BAUD2400 402
     
/* MISCELLANEOUS */
#define RXSIZE 100
#define NAMESIZE 12
#define PATHSIZE 64
     
/* KERMIT PROTOCOL PARAMETERS */
#define MAXPACKSIZ 94
#define SOH 1
#define NL 10
#define CR 13
#define SP 32
#define DEL 127
     
#define MAXTRY 10
#define MYQUOTE '#'
#define MYPAD 0
#define MYPCHAR '\000'
#define MYEOL CR
#define MYTIME 10
     
/* MACROS */
#define tochar(ch) ((ch) + ' ')
#define unchar(ch) ((ch) - ' ')
#define ctl(ch) ((ch) ^ 64)
#define unpar(ch) ((ch) & 127)
     
/* Export function declarations */
BOOL FAR PASCAL About(HWND,unsigned, WORD, LONG);
LONG FAR PASCAL WinKermWndProc(HWND, unsigned, WORD, LONG);
BOOL FAR PASCAL GetSendFile(HWND, unsigned, WORD, LONG);
     
/* GLOBALS */
     
/* Window Management */
EXTERN HDC hKermDC;		/* main window device context */
EXTERN LOGFONT ScreenFont;	/* logical font structure */
EXTERN HANDLE hScreenFont;	/* handle to current font */
EXTERN HANDLE hOldScreenFont;	/* handle to old font */
EXTERN HWND hKermWnd;		/* handle to the main window */
EXTERN HANDLE hInst;		/* instance handle */
EXTERN FARPROC lpprocAbout;	/* lp to About procedure */
EXTERN FARPROC lpprocSendBox;	/* lp to send box procedure */
EXTERN int CharWidth;		/* character font width in device coor */
EXTERN int CharHeight;		/* character font height in device coor */
EXTERN int XClientSize;		/* window client horizontal size in dev coor */
EXTERN int YClientSize;		/* window client vertical size in dev coor */
EXTERN int Xpos;		/* current X position on screen in dev coor */
EXTERN int Ypos;		/* current Y position on screen in dev coor */
     
/* Communication stuff */
EXTERN int cid;			/* communications id */
EXTERN DCB ComDCB;		/* comm port data structure */
     
/* Menu Command items */
EXTERN WORD CurrentPort;	/* Current port indicator */
EXTERN WORD CurrentState;	/* current state indicator */
EXTERN WORD CurrentBaud;	/* current baud */
EXTERN WORD ThisState;		/* state one is in */
     
/* Screen buffer stuff */
EXTERN char *ScreenBuf;		/* Screen buffer pointer */
EXTERN int ScreenBufHead;	/* Location of scrren buffer */
EXTERN int ScreenLineLen;	/* line length of client area */
EXTERN int ScreenHeight;	/* client screen height */
EXTERN int LineIncrement;	/* size in chars of a line */
EXTERN int MaxLinesOnScreen;	/* current num of lines in client area */
     
EXTERN int MaxDevCoorLen;	/* max horizontal size of device in dev coor */
EXTERN int MaxCharLineLen;	/* maximum char line length */
EXTERN int MaxLines;		/* maximum number of lines on device */
EXTERN int MaxChars;		/* maximun number of chars on screen */
     
EXTERN int PosInLine;		/* offset into current line */
EXTERN int CurrentLine;		/* current line pointer */
EXTERN int FirstLine;		/* location of first line */
EXTERN int CurrentMaxLine;	/* current client area max lines in dev coor */
     
EXTERN char szAppName[10];	/* strings */
EXTERN char szAbout[10];	/* about string */
EXTERN char szWinTitle[10];	/* title bar */
EXTERN char szCom1[5];		/* com1 and com2 */
EXTERN char szCom2[5];
EXTERN char StateLabel[10];	/* labels for send and receive popup window */
EXTERN char PacketLabel[11];
EXTERN char FileLabel[9];
     
/* Kermit Protocol Globals */
EXTERN int size;		/* size of present data */
EXTERN int rpsiz;		/* max receive packet size */
EXTERN int spsiz;		/* maximum send packet size */
EXTERN int pad;			/* how much padding to send */
EXTERN int timint;		/* timeout for foreign hosts on sends */
EXTERN int n;			/* packet number */
EXTERN int numtry;		/* times this packet retried */
EXTERN int oldtry;
EXTERN int debug;		/* 0 means no debugging */
EXTERN int pktdeb;		/* save packets, too */
     
EXTERN char state;		/* present state of automaton */
EXTERN BYTE cchksum;		/* our computed checksum */
EXTERN char padchar;		/* padding character */
EXTERN char eol;		/* end of line char to send */
EXTERN char quote;		/* quote character in incoming data */
EXTERN char recpkt[MAXPACKSIZ]; /* receive packet buffer */
EXTERN char packet[MAXPACKSIZ];	/* packet buffer */
     
EXTERN FILE *fp;		/* pointer to file being received or sent */
EXTERN FILE *dpfp;		/* pointer to debug file */
     
EXTERN HANDLE hRXWnd;		/* handle to rec or send popup window */
EXTERN HDC hRXWndDC;		/* handle to its device context */
     
EXTERN char StateStr[2];	/* strings used by rec/send popup */
EXTERN char PacketStr[6];
EXTERN char filnam1[NAMESIZE + 1];
EXTERN unsigned PacketCount;	/* total packet number accmuulator */
