/*  tdm.h  --  header file for tdm.c        */
#define TDM_H
#include "exec/types.h"
#include "exec/nodes.h"
#include "exec/memory.h"
#include "libraries/dosextens.h"
#include "intuition/intuitionbase.h"
#include "stdio.h"
#define NULB  ((UBYTE)0)
#define ONEB  ((UBYTE)1)
#define JAMX  JAM1
#define CTRL_C  3
#define ERRSTRLN  127
#define MAXSTRLN  255
#define HSL  7
#define LINETOOBIG  0x7FFFFFFL
struct LinePart
   {
   ULONG lp_Address;
   UBYTE lp_Length;
   BYTE lp_Move;
   UBYTE lp_FontStyle;         /*  c.f. "style" arg of SetSoftStyle  */
   BYTE lp_DrawStyle;          /*  c.f. "mode" arg of SetDrMd        */
   struct LinePart *lp_Next;
   struct LinePart *lp_Prev;
   LONG lp_Trans;
   };
#define LPSZ  ((ULONG)sizeof(struct LinePart))
#define MAX(a,b)  ((a)>(b)?(a):(b))
#define MIN(a,b)  ((a)<(b)?(a):(b))
#define ABS(x)  ((x<0)?(-(x)):(x))
/*****  GLOBALS  *****/
struct GfxBase *GfxBase;
struct IntuitionBase *IntuitionBase;
LONG txtline;         /*  line number of line waiting for screen          */
LONG golinem;         /*  line number passed back to main by txttw        */
LONG golinet;         /*  line number decided by main, passed to txttw    */
UWORD screenline;     /*  current screen line number                      */
SHORT maxrowpix;      /*  last printable y arg. in pixels for RastPort    */
SHORT delta;          /*  size in pixels of partial line move             */
WORD maxline;         /*  number of screen lines for text                 */
ULONG linesize;       /*  number of lines in stream                       */
ULONG enable;         /*  alg. font styling mask from AskSoftStyle        */
ULONG style;          /*  the last request to SetSoftStyle                */  
ULONG savestyle;      /*  the last return from SetSoftStyle               */
LONG drawmode;        /*  current drawmode in the document                */
struct Window *mw;    /*  the Window we open                              */
struct RastPort *rp;  /*  -- and its RastPort                             */
FILE *stream;         /*  either file argument or stdin                   */
FILE *filearg;        /*  the file being read, if it's not stdin          */
UBYTE *instr;         /*  buffer for the last string taken in             */
UBYTE *pvstr;         /*  buffer for the previous string                  */
UBYTE gflag;          /*  user wants to start at line no. found in stdin  */
UBYTE tflag;          /*  user wants screen to scroll without pause       */
UBYTE *errsp[10];     /*  pointers for errstr assembly                    */
UBYTE errstr[ERRSTRLN+1];    /*  buffer for messages to user              */
/*********************/
UBYTE             *bfgets();
UBYTE              getdirs();
struct Window     *makewindow();
SHORT              ltoa();
LONG               numget();
struct LinePart   *parseline();
LONG               tnump();
SHORT              txttw();
SHORT              writeline();
/***********************************/
FILE              *fopen();
UBYTE             *strcat();
UBYTE             *strcpy();
/***********************************/
void              *AllocMem();
ULONG              AskSoftStyle();
void               ClearScreen();
void               Close();
void               CloseLibrary();
void               CloseWindow();
void               Delay();
void               DisplayBeep();
void               Exit();
void               FreeMem();
struct Message    *GetMsg();
struct FileHandle *Input();
SHORT              IsInteractive();
ULONG              LockIBase();
void               ModifyIDCMP();
void               Move();
struct FileHandle *Open();
struct Library    *OpenLibrary();
struct Window     *OpenWindow();
struct FileHandle *Output();
LONG               Read();
void               ReplyMsg();
void               ScrollRaster();
LONG               Seek();
void               SetAPen();
void               SetBPen();
void               SetDrMd();
ULONG              SetSoftStyle();
LONG               Text();
LONG               TextLength();
void               UnlockIBase();
LONG               Wait();
SHORT              WaitForChar();
LONG               Write();
