/****************************************************************************/
/*   Program: Graph It II	(The C Program)									*/
/*   SubModule:	graph.h  1-20-87											*/
/*   CopyRight By Flynn D. Fishman  January 1987							*/
/*	Feel Free to copy and alter this source									*/
/****************************************************************************/
/* This is the include file for graph it.  It includes all the needed 
	constants																*/

#include <stdio.h>
#include <math.h>
#include <functions.h>
#include <exec/types.h>

#include <exec/exec.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <graphics/gfx.h>
#include <graphics/gfxmacros.h>
#include <graphics/regions.h>
#include <graphics/copper.h>
#include <graphics/gels.h>
#include <graphics/gfxbase.h>
#include <graphics/text.h>
#include <devices/keymap.h>
#include <hardware/blit.h>

/* this is close enough	*/
#define INFINITY   932768;

/* number of elements to allocate for formula */
#define PARAMETERS 90
#define FSIZE      50
#define CONSTANTS  50

/* types of characters	*/
#define ALPHA 		1
#define NUMERIC 	2
#define OTHER		3
#define END         4	/* i.e. \r, \n or a semicolon	*/

#define BITMASK     0xff 
#define HIGHBIT	    0x80	
#define LOWMASK     0x7f

/* types of formula errors	*/
#define UNKNOWN	2
#define INVALID	3
#define WINDOW	4

#define ever (;;)

struct Formula_Master 
	{
	char	*equation;
	double	*constants;
	int		 position;
	int		 error;
	};

struct Graph_Parameters
	{
	struct Formula_Master   *x1;
	struct Formula_Master	*y1;
	struct Formula_Master	*z1;
	int						yon;
	int						xon;
	int						zon;
	int						end;
	int						hidden;
	double					xstart;
	double					ystart;
	double					zstart;
	double					tstart;
	double					xend;
	double					yend;
	double					zend;
	double					tend;
	double					xlabels;
	double					ylabels;
	double					zlabels;
	double					detail;
	int						error;
	};

double x, y, t, z;
double Value(), Solve(), GetNum();
char *AllocateFunction();

#define INTUITION_REV 1l
#define GRAPHICS_REV  1l

#define XSIZE       640l
#define YSIZE       200l

#define min(x,y)	(x<y)?x:y
#define max(x,y)	(x<y)?y:x
#define abs(x)		(x<0)?-x:x

/* Icon placement constants */
#define XBORDER		28	/* pixels on right side of graph area	*/
#define YBORDER     16	/* pixels below graoh area				*/
#define XEXPANDX	56  /* Number of pixels for xstart = 		*/
#define XEXPANDY	8	/* The hieght of the xexpand area		*/
#define YEXPANDX	9	/* the width of the yexpand area		*/
#define YEXPANDY	17	/* pixels for ystart = 					*/
#define ICONX		16	/* The width of the icon				*/
#define ICONY		15	/* The hieght of the command icons		*/
#define BALLHEIGHT  5
#define BALLWIDTH	6

/* modes for graph	*/
#define ZOOM	1
#define MOVE	2
#define TOTALAREA 4.0

/* Help menu stuff	*/
#define		FORWARD		1
#define		BACKWARD	2
#define		QUIT		3

#define		FIRSTPAGE	1
#define		LASTPAGE	5

#ifndef PI
#define PI	3.14159265358979	/* From memory, may not be correct */
#endif
