struct op_key { char *name; int typ; int pos; int32 idx; } ;
typedef struct op_key (*OPKEY)[];
typedef char (*(*TOKENS)[]);
typedef unsigned char uchar;
typedef double dbl;

double myatan2(double y, double x);

int w_message(char *s);

int char_bbox(int ff,int cc,double *xx1, double *yy1, double *xx2, double *yy2);

int df_circle_fill(dbl r);
int df_circle_stroke(dbl r);
int df_box_fill(dbl x1, dbl y1, dbl x2, dbl y2);
int df_box_stroke(dbl x1, dbl y1, dbl x2, dbl y2);
int df_arc(dbl r,dbl t1,dbl t2,dbl cx,dbl cy);
int df_narc(dbl r,dbl t1,dbl t2,dbl cx,dbl cy);
int df_arcto(dbl x1, dbl y1, dbl x2, dbl y2, dbl r);

int g_defmarker(char *mname,char *font, int ccc, double dx, double dy, double sz, int autodx);
int var_getstr(int v, char *s);
int sub_clear(void);
int freeavec(void);
int freeafont(void);
double tex_xend(void);
double tex_yend(void);
int setdstr(char **s, char *in);
int alloc_temp(int n);
int gle_abort(char *s);
int d_tidyup(void);
int text_inkey(void);
char *gle_top(void);
char *gledir(char *filename);
int ncpy(char *d, char *s, int n);
int pass_font(char *s);
int pass_justify(char *s);
uint32 coreleft(void);
uint32 farcoreleft(void);

int32 mem_total(void);
int32 mem_worst(void);
int token_space(void);
int var_set_global(void);
int var_free_local(void);
int pass_marker(char *s);
#ifdef unix
#else
void wprintf(va_list arg_list, ...);
void gprint(va_list arg_list, ...);
#endif
char *sdup(char *s);
void myfree(void *p);
void myfrees(void *p, char *s);
void *myallocn(int32 nitems,int32 size);
void *myalloc(int32 size);
void *myallocz(int32 size);

double graph_xgraph(double v);
double graph_ygraph(double v);
int showpcode(int32 *p);
int do_pcode(int *srclin, int32 *pcode, int plen, int *pend);
int g_close(void);
int axis_type(char *s);
int g_set_hei(double h);
int g_get_hei(double *h);
int g_marker(int i, double sz);
int g_marker2(int i, double sz, double dval);
int draw_markers(void);
int box_clip(double *x1, double *y1, double xmin, double ymin, double xmax, double ymax);
int gr_nomiss(int i);
int draw_vec(double x1, double y1, double x2, double y2);
int draw_mark(double x1, double y1, int i, double sz, double dval);
int gclip(double *x1,double *y1, double *x2, double *y2
	,double xmin, double ymin, double xmax, double ymax, int *invis);
int g_hint(char *s);
int g_gsave(void);

int add_f(char *pcode,int *plen,double f);
int add_fn(char *pcode, int *plen, int i);
int add_i(char *pcode,int *plen,int32 i);
int add_pcode(char *pcode,int *plen,char *fcode,int *flen);
int add_string(char *pcode, int *plen, char *s);
int add_var(char *pcode,int *plen,int i);
char *eval_str(int32 *pcode,int *plen);
char *find_non_space(char *cp);
char *find_term(char *cp);
char *un_quote(char *ct);
int char_kern(int cf,int c1, int c2, float *w);
int char_lig(int cf,uchar *c1, int c2);
int cmd_name(int idx, char **cp);
int32 pass_color(char *s);
int debug_polish(int32 *pcode,int *zcp);
int eval(int32 *pcode,int *cp,double *oval,char *ostr,int *otyp);
int find_mkey(char *cp, int *idx);
int find_un(char *cp, int *idx,int *ret,int *np,int **plist);
int font_get_lineskip(double *ls,double *gap);
int font_get_parskip(double *ls,double *gap);
int font_init();
int font_load();
int font_load_metric(int ff);
int font_set(char *s);
int get_color(TOKENS tk,int *ntok,int *curtok,int32 *pcode,int *plen);
int get_fill(TOKENS tk,int *ntok,int *curtok,int32 *pcode,int *plen);
int get_font(char (*(*tk)[500]),int *ntok,int *curtok,int32 *pcode,int *plen);
int get_justify(TOKENS tk,int *ntok,int *curtok,int32 *pcode,int *plen);
int get_marker(TOKENS tk,int *ntok,int *curtok,int32 *pcode,int *plen);
int get_str(char **s,int l,FILE *fmt);
int gle_include(char *s);
int32 gt_first(OPKEY lkey, int *curtok, TOKENS tk, int *ntok, int32 *pcode, int *plen);
int32 gt_firstval(OPKEY lkey,char *s);
int gt_optional(OPKEY lkey, int *curtok, TOKENS tk, int *ntok, int32 *pcode, int *plen);
int gt_xy(int *curtok, char (*(*tk)[500]), int *ntok,	int32 *pcode, int *plen);
int isnumber(char *s);
int lastchar(char *s, char c);
int sub_def(char *s);
int mystrcpy(char **d,char *s);
int name_get(char *n,double *x1,double *y1,double *x2,double *y2);
int name_set(char *n,double x1,double y1,double x2,double y2);
int passt(int srclin,char *source,TOKENS tk,int *ntok,int32 *pcode,int *plen);
int polar_xy(double r, double angle, double *dx, double *dy);
int zpolish(TOKENS tk,int *ntok,int *curtok,char *pcode,int *plen,int *rtype);
int polish(char *expr,char *pcode,int *plen,int *rtype);
int scheck(int v);
int set_glue(int32 *in,int ilen,double actual,double width,double stretch,double shrink,double *setlen);
int spop(int v);
int spush(int v);
int stack_op(char *pcode, int *plen, int stk[] , int stkp[], int *nstk,  int i, int p);
int sub_call(int idx,double *pval,char **pstr,int *npm);
int sub_find(char *s,int *idx,int *zret, int *np, int **plist);
int sub_get_startend(int idx, int *ss, int *ee);
int sub_param(int idx,char *s);
int sub_set_return(double d);
int sub_set_startend(int idx, int ss, int ee);
int subscript();
int subscript();
int testfree(int i);
int text_block(uchar *s,double width,int justify);
int text_draw(int32 *in,int ilen);
int text_printf(int32 *in,int ilen);
int text_tomacro(uchar *in, uchar *out);
int text_topcode(uchar *in, int32 *out, int *lout)      /*  passed a paragraph  */;
int text_wrapcode(int32 *in,int ilen,double width);
int token(char *lin,TOKENS tok,int *ntok,char *outbuff);
int token_data(char *lin,char *tk[],int *ntok,char *outbuff);
int var_add(char *name,int *idx,int *type)	/* Add a variable to the list */;
int var_alloc_local(void);
int var_clear_global(void);
int var_set_local(void);
int var_find(char *name,int *idx,int *type)	/* Find a variable in the list */;
int var_findadd(char *name,int *idx,int *type)	/* Add a variable to the list */;
int var_free_local();
int var_get(int jj, double *v);
int var_nlocal(int *l);
int var_set(int jj, double v);
int var_set_global();
int var_set_local();
int var_setstr(int jj, char *s);
int xy_polar(double dx,double dy,double *radius,double *angle);
