/* Header for module viewmod, generated by p2c */
#ifndef VIEWMOD_H
#define VIEWMOD_H


#ifndef NUMEX_H
#include <p2c/numex.h>
#endif

#ifndef NEWASM_H
#include <p2c/newasm.h>
#endif

#ifndef MATH_H
#include <p2c/math.h>
#endif

#ifndef SYSGLOBALS_H
#include <p2c/sysglobals.h>
#endif


#ifdef VIEWMOD_G
# define vextern
#else
# define vextern extern
#endif



#define v_libdir        "/lib/view"

#define v_blankline     '*'

#define v_maxstyle      9

#define v_badvalue      ne_badvalue

#define v_viewprompt    "view> "
#define v_scanprompt    "skip> "
#define v_initsuffix    "_VIEWINIT"
#define v_exitsuffix    "_EXIT"


typedef double v_vectorarray[1000000L];
typedef enum {
  v_clopt, v_clone, v_clsome
} v_clmode;

typedef struct v_baserec {
  struct v_baserec *next;
  long len;
  Char *units;
  double *vec;
  boolean sorted, flag;
} v_baserec;

typedef enum {
  v_ck_none, v_ck_num, v_ck_string, v_ck_curve
} v_curvekinds;

typedef struct v_curverec {
  struct v_curverec *next, *prev;
  Char *name, *units;
  v_curvekinds kind;
  v_baserec *base;
  double *vec;
  Char *expr;
  long exprtime, chgtime, checktime;
  ne_nexrec *nex;
  boolean used, usedy, flag, flag2;   /*these are for temporary use*/
  struct v_curverec *next2, *next3;
  Char *dest;
  long style, astyle;
  double xval, yval;
  Char *sval;
  struct v_curverec *lnext, *rnext;
  long savetime;
  na_strlist *symptr, *symptr_x, *symptr_y;
} v_curverec;


typedef enum {
  v_pk_other, v_pk_str, v_pk_real, v_pk_int
} v_paramkinds;

typedef struct v_paramkindrec {
  v_paramkinds kind;
  _PROCEDURE helpproc;
  _PROCEDURE copyproc, restproc;
  _PROCEDURE chproc, fmtproc;
  _PROCEDURE nchproc, nfmtproc;
  Char *helpstr;
} v_paramkindrec;

typedef struct v_paramrec {
  Char *name;
  v_paramkindrec *kind;
  na_strlist *owningtool;
  na_quadword val;
  struct v_paramrec *next;
} v_paramrec;

typedef struct v_interpolator {
  na_long user;
  Anyptr interp;   /*do not touch!*/
} v_interpolator;

typedef struct v_inputmarker {
  na_long where, stamp;
} v_inputmarker;

typedef struct v_controlrec {
  Anyptr kind;
  na_quadword info;
  _PROCEDURE aborthook, pophook, breakhook, continuehook, recoverhook;
  boolean canbreak, cancontinue, canrecover;
  v_inputmarker mark;
  struct v_controlrec *next;
} v_controlrec;



vextern boolean v_exitflag, v_initdone;
vextern v_baserec *v_basebase;
vextern v_curverec *v_curvebase;
vextern ne_desc v_nedesc;
vextern double *v_tempxvec, *v_tempyvec;
vextern na_strlist *v_unitbase, *v_unitalias;
vextern long v_unitcount;
vextern boolean v_alimited[3], v_alog[3];
vextern long v_anotation[3];
vextern double v_amin[3], v_amax[3];
vextern long v_lstyle[v_maxstyle + 1], v_pstyle[v_maxstyle + 1];
vextern long v_dummyint_1;
vextern na_strlist *v_interpolators;
vextern Char *v_rechars;
vextern long v_timestamp;
vextern boolean v_dummyflag_1;
vextern v_baserec *v_arithbase;
vextern long v_arithidx;
vextern v_controlrec *v_ctrlstack;
vextern Anyptr v_cmdid;
vextern Char *v_cmdname;
vextern v_curverec *v_curvetree['[' - '@'];
vextern na_strlist *v_history, *v_histlast;
vextern Char *v_lasterrormsg, *v_lasterrorstr;
vextern _PROCEDURE v_closefileshook;
vextern v_paramkindrec *v_paramstrkind, *v_paramrealkind, *v_paramintkind,
		       *v_paramboolkind, *v_parampboolkind, *v_paramfnkind,
		       *v_paramrostrkind;
vextern v_paramrec *v_parambase, *v_p_seed, *v_p_epsilon, *v_p_logfile,
		   *v_p_ram, *v_p_debug, *v_p_trace, *v_p_quiet, *v_p_novice,
		   *v_p_errormsg, *v_p_errorstr;
vextern _PROCEDURE v_preshellescape, v_postshellescape, v_takeoveraction;
vextern v_curverec *v_curvelast;
vextern Anyptr v_randseed;
vextern na_strlist *v_argsymtab;


extern Void v_initialize PP((Char *logfname, int quiet));
/* extern Void v_inittools PP((Char *suffix)); */

extern Void v_inittools (void (**list)());

extern Void v_cleanup PV();

extern boolean isequal PP((double r1, double r2));
extern Void v_pushcontrol PP((v_controlrec **p));
extern Anyptr v_topcontrolkind PV();

extern Void v_popcontrol PV();
extern long v_memavail PV();

extern Void v_checkmemavail PV();
extern Void v_fixstdin PV();
extern boolean v_eof PV();
extern Void v_readln PP((Char *prompt, Char *buf));
extern long v_inputlnum PV();
extern v_inputmarker v_markinput PV();
extern Void v_gotoinput PP((v_inputmarker mark));
extern Void v_gotoinputfile PP((v_inputmarker mark));
extern Void v_scanword PP((Char *wrd, long nest));
extern Void v_skipln PV();
extern boolean v_readkbd PP((Char *buf, Char *prompt, Char *fvar));
extern boolean v_readkbddef PP((Char *buf, Char *prompt, Char *def,
				Char *fvar));
extern Void v_setup_stdin PV();
extern Void v_pushinput_stdin PV();
extern na_strlist *v_getfile PP((Char *fn, int trylib));
extern boolean v_pushinput_file PP((Char *fn, int trylib));
extern Void v_poptostdin PV();
extern long v_holdinput PV();
extern Void v_unholdinput PP((long handle));
extern Void v_poptopcontrols PV();
extern Void v_popinput PV();
extern Void v_popinput_kbd PV();
extern Void v_popinput_file PV();
extern Void v_popinput_proc PV();
extern Void v_takeover PV();
extern boolean v_checktakeover PV();

extern boolean v_peektakeover PV();
extern Void v_exstrword PP((Char *buf, Char *wrd));

extern Void v_strword PP((Char *buf, Char *wrd));
extern Void v_logwrite PP((Char *msg));
extern Void v_logwriteln PP((Char *msg));
extern Void v_loginput PP((Char *msg));
extern Void v_logreadln PP((Char *prompt, Char *buf));
extern Void v_closelog PV();
extern Void v_halt PV();
extern Void v_fail PV();
extern Void v_clearerror PV();
extern Void v_errormsg PP((Char *msg, int outer));
extern Void v_writeerrmsg PP((Char *msg));
extern Void v_writeerror PV();
extern Void v_failmsg PP((Char *msg));
extern Void v_failneerr PP((ne_errorkind err));
extern Void v_needcurvename PV();
extern Void v_nosuchcurve PP((Char *name));
extern Void v_cantcombine PV();
extern Void v_notvector PV();
extern Void v_badunits PV();
extern Void v_nosuchparam PV();
extern Void v_misplacedcmd PV();
extern Void v_unrecognizedoption PV();
extern Void v_needsep PP((Char *buf, int ch));

extern Void v_checktoomany PP((Char *buf));
extern Char *v_neerrmsg PP((Char *Result, ne_errorkind err));
extern Void v_definefunc PP((Char *name, Char *args, Char *expr));
extern Void v_listfuncs PP((Char *buf));
/*obsolete*/
extern Void v_scrapsymtab PV();
extern Void v_fixcurvesym PP((v_curverec *cp));
extern Void v_setcurvekind PP((v_curverec *cp, v_curvekinds kind));
extern Void v_unassigncurve PP((v_curverec *cp));
/*obsolete*/

extern Void v_buildsymtab PP((long t));
extern boolean v_parseexpr PP((Char *wrd, ne_nexrec *nexr));
extern boolean v_parsestr PP((Char *wrd, Char *buf));
extern Void v_formatstr PP((ne_nexrec nexr, Char *buf, long fmt1, long fmt2));
extern boolean v_parsefmtstr PP((Char *wrd, Char *buf, long fmt1, long fmt2));
extern boolean v_parsereal PP((Char *wrd, double *r));
extern boolean v_parseinteger PP((Char *wrd, long *i));
extern boolean v_parsecondition PP((Char *wrd, boolean *b));
extern boolean v_parseuexpr PP((Char *wrd, ne_nexrec *nexr, Char *units));
extern boolean v_parseustr PP((Char *wrd, Char *buf, Char *units));
extern boolean v_parseufmtstr PP((Char *wrd, Char *buf, Char *units,
				  long fmt1, long fmt2));
extern boolean v_parseureal PP((Char *wrd, double *r, Char *units));
extern Void v_addfuncname PP((Char *name, na_strlist **symp));
extern Void v_realfunc PP((Char *name, _PROCEDURE proc));
extern Void v_realfunco2 PP((Char *name, _PROCEDURE proc));
extern Void v_realfunc2 PP((Char *name, _PROCEDURE proc));
extern Void v_realfuncgen PP((Char *name, ne_datatype t1, ne_datatype t2,
			      _PROCEDURE proc));
extern Void v_realfuncgen3 PP((Char *name, ne_datatype t1, ne_datatype t2,
			       ne_datatype t3, _PROCEDURE proc));
extern Void v_strfuncgen PP((Char *name, ne_datatype t1, ne_datatype t2,
			     _PROCEDURE proc));
extern Void v_strfuncgen3 PP((Char *name, ne_datatype t1, ne_datatype t2,
			      ne_datatype t3, _PROCEDURE proc));
extern Void v_addfuncs PP((_PROCEDURE proc));
extern Void v_staticfunc PV();
extern Void v_setminargs PP((long minargs));

extern Void v_setmaxargs PP((long maxargs));
extern Void v_addparamkind PP((v_paramkindrec **pk, v_paramkinds kind));
extern Void v_deriveparamkind PP((v_paramkindrec **pk, v_paramkindrec *pk2));
extern Void v_addparam PP((Char *name, v_paramrec **pp, v_paramkindrec *pk));
extern v_paramrec *v_findparam PP((Char *name));
extern Void v_addstrparam PP((Char *name, v_paramrec **pp, Char *val));
extern Void v_addrostrparam PP((Char *name, v_paramrec **pp, Char *val));
extern Void v_setstrparam PP((v_paramrec *pp, Char *val));
extern Char *v_getstrparam PP((Char *Result, v_paramrec *pp));
extern Void v_addrealparam PP((Char *name, v_paramrec **pp, double r));
extern Void v_setrealparam PP((v_paramrec *pp, double r));
extern double v_getrealparam PP((v_paramrec *pp));
extern Void v_addintparam PP((Char *name, v_paramrec **pp, long i));
extern Void v_setintparam PP((v_paramrec *pp, long i));
extern long v_getintparam PP((v_paramrec *pp));
extern Void v_addboolparam PP((Char *name, v_paramrec **pp, int b));
extern Void v_setboolparam PP((v_paramrec *pp, int b));

extern boolean v_getboolparam PP((v_paramrec *pp));
extern Void v_newvector PP((double **vec, long len));
extern Void v_disposevector PP((double **vec, long len));
extern Void v_makecurve PP((v_curverec **cp, v_baserec *bp, double *vec,
			    Char *units, Char *name));
extern Void v_addcurve PP((long len, double *xvec, double *yvec, Char *xunit,
			   Char *yunit, Char *name));
extern Void v_sortcurve PP((v_curverec *cp));
extern Void v_checksorted PP((v_baserec *bp));
extern Void v_addcurveexpr PP((Char *expr, Char *name));
extern Void v_addcurveconst PP((double val, Char *yunit, Char *name));
extern Void v_assigncurveconst PP((double val, Char *name));
extern Void v_addcurvestr PP((Char *val, Char *name));
extern Void v_assigncurvestr PP((Char *val, Char *name));
extern Void v_deletecurve PP((v_curverec **cp));
extern Void v_addlocalcurve PP((Char *name));
extern Void v_addlocalparam PP((Char *name));
extern Void v_addlocaldef PP((Char *name));

extern Void v_change PP((v_curverec *cp));
extern v_curverec *v_findcurve PP((Char *name));
extern Void v_needcurve PP((v_curverec *cp));
extern Void v_ncurvelist PP((Char *buf, v_curverec **cbase, v_clmode mode));
extern Void v_curvelist PP((Char *buf, v_curverec **cbase, v_clmode mode));
extern Void v_desteqsrc PP((Char *buf, v_curverec **cbase, v_clmode mode));
extern Void v_desteqsrc2 PP((Char *dest, Char *src, v_curverec **cbase));

extern Void v_stretchtempvecs PP((long len));
extern Void v_measurevec PP((double *vec, long len, long minwid, long *wid,
			     long *prec));

extern Char *v_fmtreal PP((Char *Result, double val, long wid, long prec));
extern long v_vloadfile PP((Char *fn));
extern long v_aloadfile PP((Char *fn));
extern long v_loadfile PP((Char *fn));
extern Void v_savecurves PP((Char *fn, Char *buf));
extern Void v_appendcurves PP((Char *fn, Char *buf));

extern boolean v_checkneedsave PV();
extern boolean v_isvalid PP((v_curverec *cp, long n));

extern Void v_checkcurve PP((v_curverec *cp));
extern Void v_addinterp PP((Char *name, _PROCEDURE proc, Char *help));
extern Void v_addintparse PP((_PROCEDURE pproc, _PROCEDURE dproc));
extern Void v_listinterps PV();
extern v_interpolator v_parseinterp PP((Char *buf));
extern Void v_disposeinterp PP((v_interpolator *int_));

extern double v_interp PP((v_interpolator *int_, v_curverec *cp, double x));
extern Void v_checkcurvename PP((Char *name, v_curverec **cp, Char *mode));
extern Void v_checkneeds PP((ne_nexrec *nex));
extern Void v_initcheckbase PP((v_baserec **bp));
extern boolean v_checkbase PP((v_baserec **bp, ne_nexrec *nex));
extern Void v_aftercheckbase PP((v_curverec **cbase));
extern boolean v_checkunits PP((ne_nexrec *nex, Char *units));
extern Void v_curveexpr PP((Char *wrd, ne_nexrec **nex, v_baserec **bp,
			    v_curverec **cbase, Char *units));
extern Void v_evaluate PP((ne_nexrec *nex, v_baserec *bp, v_curverec *cbase,
			   double *vec));

extern Void v_assignment PP((Char *wrd, Char *buf));
extern long v_use PP((Char *fname, Char *tname));
extern boolean v_sourcefile PP((Char *fn, int trylib));
extern boolean v_doinputstream PP((Char *prompt));
extern Void v_doinputsession PP((Char *prompt));
extern Void v_doexpansions PP((Char *buf, long level));
extern boolean v_docommand PP((Char *buf));
extern Void v_shellescape PP((Char *buf, Char *opts));
extern Void v_addcmd PP((Char *name, _PROCEDURE proc, Char *shorthelp,
			 Char *shorthelp2));
extern Void v_isctrl PV();
extern Void v_addhelpline PP((Char *left, Char *right));
extern Void v_addhelp PP((Char *msg));
extern Void v_samehelp PV();
extern Void v_addalias PP((Char *nname, Char *oname));

extern Void v_givehelp PP((Char *wrd));
extern Void v_definebefore PP((Char *name, Char *args, na_strlist *body));
extern Void v_defineafter PP((Char *name, Char *args, na_strlist *body));
extern Void v_scanbody PP((na_strlist **body, Char *opening, Char *closing));
extern Void v_isblockcmd PP((Char *endcmd));
extern Void v_savecmds PP((Char *fn, Char *buf));

extern Void (*curves_tool_list[])();
extern Void (*(tool_list_1[]))();
extern Void (*(tool_list_2[]))();
extern Void (*(tool_list_3[]))();
extern Void (*(tool_list_4[]))();
extern Void (*(tool_list_5[]))();
extern Void (*(tool_list_6[]))();
extern Void (*(tool_list_7[]))();
extern Void (*(tool_list_8[]))();
extern Void (*(tool_list_9[]))();
extern Void (*(tool_list_10[]))();
extern Void (*(tool_list_11[]))();
extern Void (*(tool_list_12[]))();
extern Void (*(tool_list_13[]))();
extern Void (*(tool_list_14[]))();
extern Void (*(tool_list_15[]))();
extern Void (*(tool_list_16[]))();
extern Void (*(tool_list_17[]))();
extern Void (*(tool_list_18[]))();
extern Void (*(tool_list_19[]))();
extern Void (*(tool_list_20[]))();

extern Void viewcmds_viewbuiltin PV();
extern Void viewctrl_viewbuiltin PV();
extern Void viewfuncs_viewbuiltin PV();


vextern Void (*(builtin_tool_list[4]))()
#ifdef VIEWMOD_G
  = {
  viewcmds_viewbuiltin, viewctrl_viewbuiltin, viewfuncs_viewbuiltin,
  NULL
}
#endif VIEWMOD_G
  ;


extern Void v_undefine PP((Char *name));


#undef vextern

#endif /*VIEWMOD_H*/

/* End. */
