home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************************/
- /* Header for main bstone operations */
- /***********************************************************************/
-
- /* Command line */
- typedef struct cmd_line {
- int n;
- char *s;
- } CMD_LINE;
-
- typedef struct pov_obj {
- char *s; /* name */
- char c; /* code */
- /* 0 norm, 1 union, 2 intersect, 3 diff */
- short cnt; /* number */
- /* number of parents, -1 tmp (made w add_obj) */
- double b[3]; /* basis */
- double u[3]; /* x coord */
- double v[3]; /* y_coord */
- double w[3]; /* z_coord */
- struct pov_obj *tex; /* texture */
- struct pov_obj *bound; /* bounded_by */
- } POV_OBJ;
-
- #define MAXDIM 10 /* max num of dim */
- typedef struct dim_h {
- int n; /* dimensions */
- long l; /* length */
- long d[MAXDIM];
- double *f; /* pointer to field */
- } DIM_H;
-
- /* FOR-TO-LOOP */
- typedef struct ft_loop {
- int n; /* line number */
- double start;
- double step;
- double end;
- } FT_LOOP;
-
- #define MAX_LINES 1024 /* max size of program */
- /* must be 2^n !! */
- #define BSIZE 256 /* buffer size */
- #define LSIZE 512 /* max size of line */
- #define PSIZE 4096 /* max size of obj str */
- #define SSIZE 24 /* mod-len of string */
- extern LEX *lex; /* lex structure */
- extern CMD_LINE program[MAX_LINES]; /* the program */
- extern int gosub_stack[MAX_LINES/10]; /* gosub stack */
- extern int gosub_ptr; /* gosub stack ptr */
- extern int program_ctr; /* program counter, -1: no program */
- extern int transl_flag; /* Flag: exec 0 */
- /* translate 1 */
- /* re-translate 2 */
- extern int load_flag; /* Flag: Load new file */
- extern int cont_line; /* Line number to continue */
- extern int cmdl,flev; /* cmd-line counter, file level */
- extern FILE *fp[10]; /* File stack */
- extern char cline[LSIZE]; /* translated cmd-line */
- extern int clinep; /* translation pointer */
- extern char *clines; /* execution pointer */
- extern char err_msg[BSIZE]; /* buffer for error strings */
- extern char tmp_line[LSIZE]; /* temp. charbuf */
- extern FILE *errlog; /* error logs */
- extern FILE *errlogz;
- extern int ybdebug; /* parser debug flag */
- extern int break_en; /* Break enabled */
- extern int break_req; /* Break requested */
- extern int fkt_id; /* Function index */
- extern POV_OBJ **obj_all; /* List of temp.objects [PSIZE] */
-
- #ifndef M_PI
- #define M_PI 3.14159265358979323846
- #endif
-
-
- /* Error messages etc. */
- /* err: Error number. */
- void basic_error(int err);
-
- /* Makro: get lexical object */
- #define GETLEX(p1) \
- if(((p1)=t_lex(NULL,NO_FORCE))==(LEX *)NULL) basic_error(5);
- /* Makro: get value for token */
- #define TOKENVAL(p1) (char)(t_tokenval(p1)+128)
- /* Makro: get token for value */
- #define VALTOKEN(p1) t_valtoken((unsigned char)(p1)-128)
- /* Makro: read 4 byte Hex value */
-
- /* get hex values from string */
- int get4hex(char *s);
- #define GET4HEX(s1) get4hex(s1)
-
-
- /* clear program pointer etc. */
- void clear_program(void);
-
- /* finds counter for line equal or greater n */
- int search_line(int n);
-
- /* inserts line s at n, allocates memory for s */
- /* if s==NULL, delete line n */
- int insert_line(int n, char *s);
-
- /* translates cmd-line into internal representation */
- /* returns NULL, if error */
- char *translate_line(void);
-
- /* re-translates cmd-line from internal representation */
- char *retransl_line(char *dline);
-
- /* Parsing */
- int yyparse(void);
- int yylex(void);
- int yyerror(char *s);
-
- /* executes command */
- void exec_line(char *dline);
-
- /* debugging function */
- int symdebug(T_NODE * tnode);
-
- /* delete vars */
- void del_vars(T_NODE * tnode);
-
- /* delete program and variables */
- void new(void);
-
- /* Create a new POV-object */
- int new_objz(void);
- POV_OBJ *new_obj(void);
-
- /* Copy POV-object */
- POV_OBJ *obj_asn(POV_OBJ *pv1, POV_OBJ *pv2);
-
- /* Copy string */
- char *cp_str(char *s);
-
- /* Print Object */
- void print_obj( FILE *fep, POV_OBJ *pv );
-
- /* save Program from line n1 to line n2 */
- FILE *save_program( int n1, int n2, char *str );
-
- /* makes object empty; free any pointer */
- void free_obj(POV_OBJ *pv);
- void del_obj(POV_OBJ *pv);
-
- /* increases number of parents */
- void add_objz(POV_OBJ *pv);
-
- /* adds object to union etc. */
- POV_OBJ *add_obj(POV_OBJ *pv1,POV_OBJ *pv2);
-
- /* object debugging function */
- void obj_deb(POV_OBJ *pv,int level,FILE *fep);
-
- /* Makes a copy of texture and bound, if more than 1 parent */
- POV_OBJ *cp_tbx(POV_OBJ *p);
-
- /* Translation, scaling, rotation */
- /* 1 standard space, 2 object space */
- POV_OBJ *yscale1(POV_OBJ *p,double v[]);
- POV_OBJ *yscale2(POV_OBJ *p,double v[]);
- POV_OBJ *yrot1(POV_OBJ *p,double v[]);
- POV_OBJ *yrot2(POV_OBJ *p,double v[]);
- POV_OBJ *ytransl1(POV_OBJ *p,double v[]);
- POV_OBJ *ytransl2(POV_OBJ *p,double v[]);
-
- /* makes an object fitting into it's bounds */
- POV_OBJ *fit_obj(POV_OBJ *pv);
-
- /* automatic bound */
- POV_OBJ *bound_obj(POV_OBJ *pv);
-
- /* Print Object */
- void print_obj( FILE *fep, POV_OBJ *pv );
-
- /* Copies p to temporary object */
- POV_OBJ *cp_tmp(POV_OBJ *p);
-
-
-
-