#if (HOST_ENVIRONMENT == PC_COMPATIBLE_HOST)
#define MAXLONLAT   2000	/* lon, lat array elements */
#define MAXNUMFILES 100
#else
#define MAXLONLAT   4000	/* lon, lat array elements */
#define MAXNUMFILES 200
#endif

#define BADVALUE    10000.0	/* bad degree coordinates */
#define COMMON 1
#define LOCAL 0
#define llx   0
#define lly   1
#define urx   2
#define ury   3
/* The following are array indices; don't change them. */
#define J_RIGHT  2
#define J_LEFT   1
#define J_CENTER 0

#define MAIN_TITLE 	1
#define SUBTITLE   	2
#define PLOT_TITLE	3

#define SCALE           1
#define COORDINATE      2

/* LSD is 1 for filled symbols: */
#define NONE      0
#define FILLED    1
#define CIRCLE    2
#define DELTA     4
#define DEL       6
#define SQUARE    8
#define DIAMOND  10
#define PLUS     12
#define XMARK    14

#define larger(x,y)  ( (x) > (y) ? (x) : (y) )
#define smaller(x,y) ( (x) < (y) ? (x) : (y) )
#define LonToIn(xx) ( ((xx)-LonRange.min) / DegPerInch.x)
#define LatToIn(yy) ( ((yy)-LatRange.min) / DegPerInch.y)
#define too_sparse(x) ((x) >= 0.25)  /* distance between ticks in inches */
#define too_dense(x)  ((x) < 0.09)

#define DPI 72
#define LONGITUDE -1
#define LATITUDE   1
#define MAX_FACE 40
#define MAX_TEXT 80

typedef struct
{
   double min, max, step, span;
} RANGE_INTERVAL;
/* span is just max-min, stored to avoid multiple recalculations. */

typedef struct
{
   int m, n, current;
} PLOT_ARRAY;

typedef struct
{
   double top, bottom, left, right;
} MARGIN;

typedef struct
{
   char face[20];
   double size_p, size_i;
} FONT;

typedef struct 
{
   char type[80];
   char text[80];
   FONT font;
   XY_TYPE pos;
   double length;
   double linewidth_p;
} LEGEND_TYPE;

typedef struct
{
   char text[80];
   FONT font;
} TITLE;

typedef struct label
{
   char text[80];
   FONT font;
   int just;
   int symbol;
   double symbol_size;
   XY_TYPE position;
   struct label *next;
} LABEL_TYPE;

typedef struct
{
   FONT    font;
   XY_TYPE label_interval,
	   decimal_place,
	   origin_i,
	   deg_per_inch;
   double  linewidth_p;
} AXIS_TYPE;

typedef struct
{
   double cms_per_inch,
	  headlength_i, min_headlength_i,
          linewidth_p;
} ARROW_TYPE;

#if 0

typedef struct
{
   char text[MAX_TEXT];
   FONT font;
   FONT def_font;
   XY_TYPE pos_i;
   XY_TYPE pos_d;
   int just;
}      STRING;			/* May be adequate for titles, too. */

typedef struct
{
   STRING label;
   int type;
   XY_TYPE pos_i, def_pos_i;
   XY_TYPE pos_d
           def_pos_d;
   double length;
} LEGEND_TYPE;

typedef struct
{
   int symbol;
   double size_i, size_p;
   XY_TYPE pos_i, pos_d;
}      SYMBOL;


typedef struct label
{
   STRING string;
   SYMBOL symbol;
   struct label *next;
}     LABEL_TYPE;

#endif


#if PROTOTYPE_ALLOWED
int make_plot(FILE * fpcnt, char *dummy, int append_flag);
int subplot(FILE * fp, char *arg, int code);
int read_xy(FILE * fpcnt, XY_TYPE * xy, int code);
int read_range(FILE * fpcnt, RANGE_INTERVAL * range, int code);
int read_files(FILE * fpcnt, char vecfiles[MAXNUMFILES][80], int code);
int read_label(FILE * fpcnt, LABEL_TYPE *arg, int code);
int read_quotation(FILE * fp, char *arg, int code);
int clear_labels(FILE * fp, LABEL_TYPE **arg, int code);
double frem(double num, double den);
int get_decimal_length(double length);

void initps(FILE * fpps, char *title, char *timestamp);
void plot_legend(void);
void plot_axes(void);
void plot_labels(LABEL_TYPE * labelhead);
int plot_vectors(void);
void print_heading(TITLE * title, double y_ptr);
int showpage(FILE * fp, char *arg, int code);
void set_defaults(void);
int partition(double legend_length, double legend_width);
#else
void initps();
int make_plot();
int read_xy();
int read_range();
int read_files();
int read_label();
int read_quotation();
int subplot();
int clear_labels();
double frem();
int get_decimal_length();
void plot_legend();
void plot_axes();
void plot_labels();
int showpage();
int plot_vectors();
void print_heading();
void set_defaults();
int partition();
#endif


