File: headers\lsys.h
1 /* lsys.h
2 * Header file for L-system code.
3 * Nicholas Wilt, 6/26/93.
4 */
5
6 #ifndef LSYS_H
7 #define LSYS_H
8
9
10 #define size ssize
11 /* Needed for use of asm -- helps decide which pointer to function
12 * to put into the struct lsys_cmds.
13 */
14
15 /* Macro to take an FP number and turn it into a
16 * 16/16-bit fixed-point number.
17 */
18 #define FIXEDMUL 524288L
19 #define FIXEDPT(x) ((long) (FIXEDMUL * (x)))
20
21 /* The number by which to multiply sines, cosines and other
22 * values with magnitudes less than or equal to 1.
23 * sins and coss are a 3/29 bit fixed-point scheme (so the
24 * range is +/- 2, with good accuracy. The range is to
25 * avoid overflowing when the aspect ratio is taken into
26 * account.
27 */
28 #define FIXEDLT1 536870912.0
29
30 #define ANGLE2DOUBLE (2.0*PI / 4294967296.0)
31
32 #define MAXRULES 27 /* this limits rules to 25 */
33 #define MAX_LSYS_LINE_LEN 255 /* this limits line length to 255 */
34
35 struct lsys_turtlestatei {
36 char counter, angle, reverse, stackoflow;
37 /* dmaxangle is maxangle - 1 */
38 char maxangle, dmaxangle, curcolor, dummy; /* dummy ensures longword alignment */
39 long size;
40 long realangle;
41 long xpos, ypos; /* xpos and ypos are long, not fixed point */
42 long xmin, ymin, xmax, ymax; /* as are these */
43 long aspect; /* aspect ratio of each pixel, ysize/xsize */
44 long num;
45 };
46
47 struct lsys_turtlestatef {
48 char counter, angle, reverse, stackoflow;
49 /* dmaxangle is maxangle - 1 */
50 char maxangle, dmaxangle, curcolor, dummy; /* dummy ensures longword alignment */
51 LDBL size;
52 LDBL realangle;
53 LDBL xpos, ypos;
54 LDBL xmin, ymin, xmax, ymax;
55 LDBL aspect; /* aspect ratio of each pixel, ysize/xsize */
56 union {
57 long n;
58 LDBL nf;
59 } parm;
60 };
61
62 extern char maxangle;
63
64 /* routines in lsysa.asm */
65
66 #ifdef XFRACT
70 #else
71 extern void lsysi_doat_386(struct lsys_turtlestatei *cmd);
72 extern void lsysi_dosizegf_386(struct lsys_turtlestatei *cmd);
73 extern void lsysi_dodrawg_386(struct lsys_turtlestatei *cmd);
74 #endif
75
76 /* routines in lsysaf.asm */
77
78 extern void lsys_prepfpu(struct lsys_turtlestatef *);
79 extern void lsys_donefpu(struct lsys_turtlestatef *);
80
81 /* routines in lsysf.c */
82
83 extern struct lsys_cmd far * _fastcall drawLSysF(struct lsys_cmd far *command,struct lsys_turtlestatef *ts, struct lsys_cmd far **rules,int depth);
84 extern int _fastcall lsysf_findscale(struct lsys_cmd far *command, struct lsys_turtlestatef *ts, struct lsys_cmd far **rules, int depth);
85 extern struct lsys_cmd far *LSysFSizeTransform(char far *s, struct lsys_turtlestatef *ts);
86 extern struct lsys_cmd far *LSysFDrawTransform(char far *s, struct lsys_turtlestatef *ts);
87 extern void _fastcall lsysf_dosincos(void);
88
89 #endif
90