#include <exec/types.h>                    /*to make sense of the structures*/
#include <graphics/gfxbase.h>
#include <graphics/gfxmacros.h>
#include <intuition/intuitionbase.h>    
#include <intuition/intuition.h>
#include <libraries/dos.h>
#include <libraries/dosextens.h>
#include <stdio.h>
#include <math.h>

            /* these values are defined as MACROS so that they can
               be altered without disturbing any serious code in sums.c*/

#define POUNDKILO .454
#define MILEKILO  1.6

struct RastPort *rp;
APTR *savewindow;                          /*defined in the main program*/
struct GfxBase *GfxBase = NULL;
struct IntuitionBase *IntuitionBase = NULL;
struct Screen *CustomScreen = NULL;
struct Window *MainWindow = NULL;
struct IntuiMessage *message;
struct Process *mproc;
struct BitMap ScreenBitMap;
char buffer1[10];                          /*key buffer for escape sequences*/
char buff[10];
char array[200];                           /*array for text*/
char arrayout[400];
char col1[20];
char col2[20];
double fl,fl2;
struct MsgPort *readport;                  /*message port for console port*/
struct IOStdReq *readrequest;              /*IO block for console*/
struct Device *ConsoleDevice;              /*software routines*/
struct MsgPort *CreatePort();              /*used when port is opened*/ 
struct IOStdReq *CreateStdIO();

int x,y,i,j,class,code,quit_flag,error;      /*global variables*/   
 char *buffer;       /*pointer to string returned from ftoa()*/
 int decx,sign;      /*storage for decimal point place and sign*/
 int *d,*s;          /*pointers to the above*/
 char buffer2[31];

 /*prototypes */

char *ftoa();
void main(),Handle_IDCMP(),cleanup(),aligntext(),display();
int InitConsole(),KeyConvert(),fnkey(); 


/*raw key input event*/
static struct InputEvent ievent={
NULL,                               /*next event*/
IECLASS_RAWKEY,                     /*class*/ 
0,                                  
0,
0
};

 /*standard full size lo-res screen*/
struct NewScreen NewScreenStructure =
{
  0,0,
  320,
  256,
  5,
  1,8,
  SPRITES,
  CUSTOMSCREEN|CUSTOMBITMAP,
  NULL,
  NULL,
  NULL,
  &ScreenBitMap,
};

 /*full size window for screen*/
struct NewWindow NewWindowStructure =
{
  0,0,
  320,
  256,
  1,8,
  CLOSEWINDOW|RAWKEY|MOUSEBUTTONS,
  SUPER_BITMAP|WINDOWCLOSE|ACTIVATE,
  NULL,
  NULL,
  NULL,
  NULL,
  &ScreenBitMap,
  0,0,
  0,0,
  CUSTOMSCREEN
};


