File: headers\fractint.h
1 /* FRACTINT.H - common structures and values for the FRACTINT routines */
2
3 #ifndef FRACTINT_H
4 #define FRACTINT_H
5
6 typedef BYTE BOOLEAN;
7
8 #ifndef C6
9 #ifndef _fastcall
10 #define _fastcall /* _fastcall is a Microsoft C6.00 extension */
11 #endif
12 #endif
13
14 #ifndef XFRACT
15 #define ftimex ftime
16 typedef int SEGTYPE;
17 typedef unsigned USEGTYPE;
18 #ifdef __TURBOC__
21 #else
22 #ifndef __WATCOMC__
23 #ifndef MK_FP
24 # define MK_FP(seg,off) (VOIDFARPTR )( (((long)(seg))<<16) | \
25 ((unsigned)(off)) )
26 #endif
27 #endif
28 #endif
34 #endif
35
36 #ifndef XFRACT
37 #define clock_ticks() clock()
38 #endif
39
40 #ifdef XFRACT
42 #endif
43
44 /* for gotos in former FRACTINT.C pieces */
45 #define RESTART 1
46 #define IMAGESTART 2
47 #define RESTORESTART 3
48 #define CONTINUE 4
49
50 /* these are used to declare arrays for file names */
51 #ifdef XFRACT
54 #else
55 #define FILE_MAX_PATH 80 /* max length of path+filename */
56 #define FILE_MAX_DIR 80 /* max length of directory name */
57 #endif
58 #define FILE_MAX_DRIVE 3 /* max length of drive letter */
59
60 #if 1
61 #define FILE_MAX_FNAME 9 /* max length of filename */
62 #define FILE_MAX_EXT 5 /* max length of extension */
63 #else
64 /*
65 The filename limits were increased in Xfract 3.02. But alas,
66 in this poor program that was originally developed on the
67 nearly-brain-dead DOS operating system, quite a few things
68 in the UI would break if file names were bigger than DOS 8-3
69 names. So for now humor us and let's keep the names short.
70 */
71 #define FILE_MAX_FNAME 64 /* max length of filename */
72 #define FILE_MAX_EXT 64 /* max length of extension */ 73 #endif
74
75 #define MAXMAXLINELENGTH 128 /* upper limit for maxlinelength for PARs */
76 #define MINMAXLINELENGTH 40 /* lower limit for maxlinelength for PARs */
77
78 #define MSGLEN 80 /* handy buffer size for messages */
79 #define MAXCMT 57 /* length of par comments */
80 #define MAXPARAMS 10 /* maximum number of parameters */
81 #define MAXPIXELS 32767 /* Maximum pixel count across/down the screen */
82 #define OLDMAXPIXELS 2048 /* Limit of some old fixed arrays */
83 #define MINPIXELS 10 /* Minimum pixel count across/down the screen */
84 #define DEFAULTASPECT ((float)0.75)/* Assumed overall screen dimensions, y/x */
85 #define DEFAULTASPECTDRIFT ((float)0.02) /* drift of < 2% is forced to 0% */
86
87 struct videoinfo { /* All we need to know about a Video Adapter */
88 char name[26]; /* Adapter name (IBM EGA, etc) */
89 char comment[26]; /* Comments (UNTESTED, etc) */
90 int keynum; /* key number used to invoked this mode */
91 /* 2-10 = F2-10, 11-40 = S,C,A{F1-F10} */
92 int videomodeax; /* begin with INT 10H, AX=(this) */
93 int videomodebx; /* ...and BX=(this) */
94 int videomodecx; /* ...and CX=(this) */
95 int videomodedx; /* ...and DX=(this) */
96 /* NOTE: IF AX==BX==CX==0, SEE BELOW */
97 int dotmode; /* video access method used by asm code */
98 /* 1 == BIOS 10H, AH=12,13 (SLOW) */
99 /* 2 == access like EGA/VGA */
100 /* 3 == access like MCGA */
101 /* 4 == Tseng-like SuperVGA*256 */
102 /* 5 == P'dise-like SuperVGA*256 */
103 /* 6 == Vega-like SuperVGA*256 */
104 /* 7 == "Tweaked" IBM-VGA ...*256 */
105 /* 8 == "Tweaked" SuperVGA ...*256 */
106 /* 9 == Targa Format */
107 /* 10 = Hercules */
108 /* 11 = "disk video" (no screen) */
109 /* 12 = 8514/A */
110 /* 13 = CGA 320x200x4, 640x200x2 */
111 /* 14 = Tandy 1000 */
112 /* 15 = TRIDENT SuperVGA*256 */
113 /* 16 = Chips&Tech SuperVGA*256 */
114 int xdots; /* number of dots across the screen */
115 int ydots; /* number of dots down the screen */
116 int colors; /* number of colors available */
117 };
118
119 typedef struct videoinfo far VIDEOINFO;
120 #define INFO_ID "Fractal"
121 typedef struct fractal_info FRACTAL_INFO;
122
123 /*
124 * Note: because non-MSDOS machines store structures differently, we have
125 * to do special processing of the fractal_info structure in loadfile.c.
126 * Make sure changes to the structure here get reflected there.
127 */
128 #ifndef XFRACT
129 #define FRACTAL_INFO_SIZE sizeof(FRACTAL_INFO)
133 #endif
134
135 #define VERSION 17 /* file version, independent of system */
136 /* increment this EVERY time the fractal_info structure changes */
137
138 struct fractal_info /* for saving data in GIF file */
139 {
140 char info_id[8]; /* Unique identifier for info block */
141 short iterationsold; /* Pre version 18.24 */
142 short fractal_type; /* 0=Mandelbrot 1=Julia 2= ... */
143 double xmin;
144 double xmax;
145 double ymin;
146 double ymax;
147 double creal;
148 double cimag;
149 short videomodeax;
150 short videomodebx;
151 short videomodecx;
152 short videomodedx;
153 short dotmode;
154 short xdots;
155 short ydots;
156 short colors;
157 short version; /* used to be 'future[0]' */
158 float parm3;
159 float parm4;
160 float potential[3];
161 short rseed;
162 short rflag;
163 short biomorph;
164 short inside;
165 short logmapold;
166 float invert[3];
167 short decomp[2];
168 short symmetry;
169 /* version 2 stuff */
170 short init3d[16];
171 short previewfactor;
172 short xtrans;
173 short ytrans;
174 short red_crop_left;
175 short red_crop_right;
176 short blue_crop_left;
177 short blue_crop_right;
178 short red_bright;
179 short blue_bright;
180 short xadjust;
181 short eyeseparation;
182 short glassestype;
183 /* version 3 stuff, release 13 */
184 short outside;
185 /* version 4 stuff, release 14 */
186 double x3rd; /* 3rd corner */
187 double y3rd;
188 char stdcalcmode; /* 1/2/g/b */
189 char useinitorbit; /* init Mandelbrot orbit flag */
190 short calc_status; /* resumable, finished, etc */
191 long tot_extend_len; /* total length of extension blocks in .gif file */
192 short distestold;
193 short floatflag;
194 short bailoutold;
195 long calctime;
196 BYTE trigndx[4]; /* which trig functions selected */
197 short finattract;
198 double initorbit[2]; /* init Mandelbrot orbit values */
199 short periodicity; /* periodicity checking */
200 /* version 5 stuff, release 15 */
201 short pot16bit; /* save 16 bit continuous potential info */
202 float faspectratio; /* finalaspectratio, y/x */
203 short system; /* 0 for dos, 1 for windows */
204 short release; /* release number, with 2 decimals implied */
205 short flag3d; /* stored only for now, for future use */
206 short transparent[2];
207 short ambient;
208 short haze;
209 short randomize;
210 /* version 6 stuff, release 15.x */
211 short rotate_lo;
212 short rotate_hi;
213 short distestwidth;
214 /* version 7 stuff, release 16 */
215 double dparm3;
216 double dparm4;
217 /* version 8 stuff, release 17 */
218 short fillcolor;
219 /* version 9 stuff, release 18 */
220 double mxmaxfp;
221 double mxminfp;
222 double mymaxfp;
223 double myminfp;
224 short zdots;
225 float originfp;
226 float depthfp;
227 float heightfp;
228 float widthfp;
229 float distfp;
230 float eyesfp;
231 short orbittype;
232 short juli3Dmode;
233 short maxfn;
234 short inversejulia;
235 double dparm5;
236 double dparm6;
237 double dparm7;
238 double dparm8;
239 double dparm9;
240 double dparm10;
241 /* version 10 stuff, release 19 */
242 long bailout;
243 short bailoutest;
244 long iterations;
245 short bf_math;
246 short bflength;
247 short yadjust; /* yikes! we left this out ages ago! */
248 short old_demm_colors;
249 long logmap;
250 long distest;
251 double dinvert[3];
252 short logcalc;
253 short stoppass;
254 short quick_calc;
255 double closeprox;
256 short nobof;
257 long orbit_interval;
258 short orbit_delay;
259 double math_tol[2];
260 short future[7]; /* for stuff we haven't thought of yet */
261 };
262
263 #define ITEMNAMELEN 18 /* max length of names in .frm/.l/.ifs/.fc */
264 struct history_info
265 {
266 short fractal_type;
267 double xmin;
268 double xmax;
269 double ymin;
270 double ymax;
271 double creal;
272 double cimag;
273 double potential[3];
274 short rseed;
275 short rflag;
276 short biomorph;
277 short inside;
278 long logmap;
279 double invert[3];
280 short decomp;
281 short symmetry;
282 short init3d[16];
283 short previewfactor;
284 short xtrans;
285 short ytrans;
286 short red_crop_left;
287 short red_crop_right;
288 short blue_crop_left;
289 short blue_crop_right;
290 short red_bright;
291 short blue_bright;
292 short xadjust;
293 short eyeseparation;
294 short glassestype;
295 short outside;
296 double x3rd;
297 double y3rd;
298 long distest;
299 short bailoutold;
300 BYTE trigndx[4];
301 short finattract;
302 double initorbit[2];
303 short periodicity;
304 short pot16bit;
305 short release;
306 short save_release;
307 short flag3d;
308 short transparent[2];
309 short ambient;
310 short haze;
311 short randomize;
312 short rotate_lo;
313 short rotate_hi;
314 short distestwidth;
315 double dparm3;
316 double dparm4;
317 short fillcolor;
318 double mxmaxfp;
319 double mxminfp;
320 double mymaxfp;
321 double myminfp;
322 short zdots;
323 float originfp;
324 float depthfp;
325 float heightfp;
326 float widthfp;
327 float distfp;
328 float eyesfp;
329 short orbittype;
330 short juli3Dmode;
331 short major_method;
332 short minor_method;
333 double dparm5;
334 double dparm6;
335 double dparm7;
336 double dparm8;
337 double dparm9;
338 double dparm10;
339 long bailout;
340 short bailoutest;
341 long iterations;
342 short bf_math;
343 short bflength;
344 short yadjust;
345 short old_demm_colors;
346 char filename[FILE_MAX_PATH];
347 char itemname[ITEMNAMELEN+1];
348 unsigned char dac[256][3];
349 char maxfn;
350 char stdcalcmode;
351 char three_pass;
352 char useinitorbit;
353 short logcalc;
354 short stoppass;
355 short ismand;
356 double closeprox;
357 short nobof;
358 double math_tol[2];
359 short orbit_delay;
360 long orbit_interval;
361 double oxmin;
362 double oxmax;
363 double oymin;
364 double oymax;
365 double ox3rd;
366 double oy3rd;
367 short keep_scrn_coords;
368 char drawmode;
369 };
370
371 typedef struct history_info HISTORY;
372
373 struct formula_info /* for saving formula data in GIF file */
374 {
375 char form_name[40];
376 short uses_p1;
377 short uses_p2;
378 short uses_p3;
379 short uses_ismand;
380 short ismand;
381 short uses_p4;
382 short uses_p5;
383 short future[6]; /* for stuff we haven't thought of, yet */
384 };
385
386 #ifndef XFRACT
387 enum stored_at_values
388 {
389 NOWHERE,
390 EXTRA,
391 FARMEM,
392 EXPANDED,
393 EXTENDED,
394 DISK
395 };
396 #endif
397
398 #ifdef XFRACT
405 #endif
406
407 #define NUMGENES 21
408
409 typedef struct evolution_info EVOLUTION_INFO;
410 /*
411 * Note: because non-MSDOS machines store structures differently, we have
412 * to do special processing of the evolution_info structure in loadfile.c and
413 * encoder.c. See decode_evolver_info() in general.c.
414 * Make sure changes to the structure here get reflected there.
415 */
416 #ifndef XFRACT
417 #define EVOLVER_INFO_SIZE sizeof(evolution_info)
421 #endif
422
423 struct evolution_info /* for saving evolution data in a GIF file */
424 {
425 short evolving;
426 short gridsz;
427 unsigned short this_gen_rseed;
428 double fiddlefactor;
429 double paramrangex;
430 double paramrangey;
431 double opx;
432 double opy;
433 short odpx;
434 short odpy;
435 short px;
436 short py;
437 short sxoffs;
438 short syoffs;
439 short xdots;
440 short ydots;
441 short mutate[NUMGENES];
442 short ecount; /* count of how many images have been calc'ed so far */
443 short future[68 - NUMGENES]; /* total of 200 bytes */
444 };
445
446
447 typedef struct orbits_info ORBITS_INFO;
448 /*
449 * Note: because non-MSDOS machines store structures differently, we have
450 * to do special processing of the orbits_info structure in loadfile.c and
451 * encoder.c. See decode_orbits_info() in general.c.
452 * Make sure changes to the structure here get reflected there.
453 */
454 #ifndef XFRACT
455 #define ORBITS_INFO_SIZE sizeof(orbits_info)
459 #endif
460
461 struct orbits_info /* for saving orbits data in a GIF file */
462 {
463 double oxmin;
464 double oxmax;
465 double oymin;
466 double oymax;
467 double ox3rd;
468 double oy3rd;
469 short keep_scrn_coords;
470 char drawmode;
471 char dummy; /* need an even number of bytes */
472 short future[74]; /* total of 200 bytes */
473 };
474
475 #define MAXVIDEOMODES 300 /* maximum entries in fractint.cfg */
476 #ifndef XFRACT
477 #define MAXVIDEOTABLE 40 /* size of the resident video modes table */
480 #endif
481
482 #define AUTOINVERT -123456.789
483 #define ENDVID 22400 /* video table uses extra seg up to here */
484
485 #define N_ATTR 8 /* max number of attractors */
486
487 extern long l_at_rad; /* finite attractor radius */
488 extern double f_at_rad; /* finite attractor radius */
489
490 #define NUMIFS 64 /* number of ifs functions in ifs array */
491 #define IFSPARM 7 /* number of ifs parameters */
492 #define IFS3DPARM 13 /* number of ifs 3D parameters */
493
494 struct moreparams
495 {
496 int type; /* index in fractalname of the fractal */
497 char far *param[MAXPARAMS-4]; /* name of the parameters */
498 double paramvalue[MAXPARAMS-4]; /* default parameter values */
499 };
500
501 typedef struct moreparams far MOREPARAMS;
502
503 struct fractalspecificstuff
504 {
505 char *name; /* name of the fractal */
506 /* (leading "*" supresses name display) */
507 char far *param[4]; /* name of the parameters */
508 double paramvalue[4]; /* default parameter values */
509 int helptext; /* helpdefs.h HT_xxxx, -1 for none */
510 int helpformula; /* helpdefs.h HF_xxxx, -1 for none */
511 unsigned flags; /* constraints, bits defined below */
512 float xmin; /* default XMIN corner */
513 float xmax; /* default XMAX corner */
514 float ymin; /* default YMIN corner */
515 float ymax; /* default YMAX corner */
516 int isinteger; /* 1 if integerfractal, 0 otherwise */
517 int tojulia; /* mandel-to-julia switch */
518 int tomandel; /* julia-to-mandel switch */
519 int tofloat; /* integer-to-floating switch */
520 int symmetry; /* applicable symmetry logic
521 0 = no symmetry
522 -1 = y-axis symmetry (If No Params)
523 1 = y-axis symmetry
524 -2 = x-axis symmetry (No Parms)
525 2 = x-axis symmetry
526 -3 = y-axis AND x-axis (No Parms)
527 3 = y-axis AND x-axis symmetry
528 -4 = polar symmetry (No Parms)
529 4 = polar symmetry
530 5 = PI (sin/cos) symmetry
531 6 = NEWTON (power) symmetry
532 */
533 #ifdef XFRACT
534 int (*orbitcalc)(); /* function that calculates one orbit */ 535 #else
536 int (*orbitcalc)(void); /* function that calculates one orbit */
537 #endif
538 int (*per_pixel)(void); /* once-per-pixel init */
539 int (*per_image)(void); /* once-per-image setup */
540 int (*calctype)(void); /* name of main fractal function */
541 int orbit_bailout; /* usual bailout value for orbit calc */
542 };
543
544 struct alternatemathstuff
545 {
546 int type; /* index in fractalname of the fractal */
547 int math; /* kind of math used */
548 #ifdef XFRACT
549 int (*orbitcalc)(); /* function that calculates one orbit */ 550 #else
551 int (*orbitcalc)(void); /* function that calculates one orbit */
552 #endif
553 int (*per_pixel)(void); /* once-per-pixel init */
554 int (*per_image)(void); /* once-per-image setup */
555 };
556
557 typedef struct alternatemathstuff ALTERNATE;
558
559 /* defines for symmetry */
560 #define NOSYM 0
561 #define XAXIS_NOPARM -1
562 #define XAXIS 1
563 #define YAXIS_NOPARM -2
564 #define YAXIS 2
565 #define XYAXIS_NOPARM -3
566 #define XYAXIS 3
567 #define ORIGIN_NOPARM -4
568 #define ORIGIN 4
569 #define PI_SYM_NOPARM -5
570 #define PI_SYM 5
571 #define XAXIS_NOIMAG -6
572 #define XAXIS_NOREAL 6
573 #define NOPLOT 99
574 #define SETUP_SYM 100
575
576 /* defines for inside/outside */
577 #define ITER -1
578 #define REAL -2
579 #define IMAG -3
580 #define MULT -4
581 #define SUM -5
582 #define ATAN -6
583 #define FMOD -7
584 #define TDIS -8
585 #define ZMAG -59
586 #define BOF60 -60
587 #define BOF61 -61
588 #define EPSCROSS -100
589 #define STARTRAIL -101
590 #define PERIOD -102
591 #define FMODI -103
592 #define ATANI -104
593
594 /* defines for bailoutest */
595 enum bailouts { Mod, Real, Imag, Or, And, Manh, Manr };
596 enum Major {breadth_first, depth_first, random_walk, random_run};
597 enum Minor {left_first, right_first};
598
599 /* bitmask defines for fractalspecific flags */
600 #define NOZOOM 1 /* zoombox not allowed at all */
601 #define NOGUESS 2 /* solid guessing not allowed */
602 #define NOTRACE 4 /* boundary tracing not allowed */
603 #define NOROTATE 8 /* zoombox rotate/stretch not allowed */
604 #define NORESUME 16 /* can't interrupt and resume */
605 #define INFCALC 32 /* this type calculates forever */
606 #define TRIG1 64 /* number of trig functions in formula */
607 #define TRIG2 128
608 #define TRIG3 192
609 #define TRIG4 256
610 #define WINFRAC 512 /* supported in WinFrac */
611 #define PARMS3D 1024 /* uses 3d parameters */
612 #define OKJB 2048 /* works with Julibrot */
613 #define MORE 4096 /* more than 4 parms */
614 #define BAILTEST 8192 /* can use different bailout tests */
615 #define BF_MATH 16384 /* supports arbitrary precision */
616 #define LD_MATH 32768 /* supports long double */
617
618
619 /* more bitmasks for evolution mode flag */
620 #define FIELDMAP 1 /*steady field varyiations across screen */
621 #define RANDWALK 2 /* newparm = lastparm +- rand() */
622 #define RANDPARAM 4 /* newparm = constant +- rand() */
623 #define NOGROUT 8 /* no gaps between images */
624
625
626 extern struct fractalspecificstuff far fractalspecific[];
627 extern struct fractalspecificstuff far *curfractalspecific;
628
629 #define DEFAULTFRACTALTYPE ".gif"
630 #define ALTERNATEFRACTALTYPE ".fra"
631
632
633 #ifndef sqr
634 #define sqr(x) ((x)*(x))
635 #endif
636
637 #ifndef lsqr
638 #define lsqr(x) (multiply((x),(x),bitshift))
639 #endif
640
641 #define CMPLXmod(z) (sqr((z).x)+sqr((z).y))
642 #define CMPLXconj(z) ((z).y = -((z).y))
643 #define LCMPLXmod(z) (lsqr((z).x)+lsqr((z).y))
644 #define LCMPLXconj(z) ((z).y = -((z).y))
645
646 #define PER_IMAGE (fractalspecific[fractype].per_image)
647 #define PER_PIXEL (fractalspecific[fractype].per_pixel)
648 #define ORBITCALC (fractalspecific[fractype].orbitcalc)
649
650 typedef _LCMPLX LCMPLX;
651
652 /* 3D stuff - formerly in 3d.h */
653 #ifndef dot_product
654 #define dot_product(v1,v2) ((v1)[0]*(v2)[0]+(v1)[1]*(v2)[1]+(v1)[2]*(v2)[2]) /* TW 7-09-89 */
655 #endif
656
657 #define CMAX 4 /* maximum column (4 x 4 matrix) */
658 #define RMAX 4 /* maximum row (4 x 4 matrix) */
659 #define DIM 3 /* number of dimensions */
660
661 typedef double MATRIX [RMAX] [CMAX]; /* matrix of doubles */
662 typedef int IMATRIX [RMAX] [CMAX]; /* matrix of ints */
663 typedef long LMATRIX [RMAX] [CMAX]; /* matrix of longs */
664
665 /* A MATRIX is used to describe a transformation from one coordinate
666 system to another. Multiple transformations may be concatenated by
667 multiplying their transformation matrices. */
668
669 typedef double VECTOR [DIM]; /* vector of doubles */
670 typedef int IVECTOR [DIM]; /* vector of ints */
671 typedef long LVECTOR [DIM]; /* vector of longs */
672
673 /* A VECTOR is an array of three coordinates [x,y,z] representing magnitude
674 and direction. A fourth dimension is assumed to always have the value 1, but
675 is not in the data structure */
676
677 #ifdef PI
679 #endif
680 #define PI 3.14159265358979323846
681 #define SPHERE init3d[0] /* sphere? 1 = yes, 0 = no */
682 #define ILLUMINE (FILLTYPE>4) /* illumination model */
683
684 /* regular 3D */
685 #define XROT init3d[1] /* rotate x-axis 60 degrees */
686 #define YROT init3d[2] /* rotate y-axis 90 degrees */
687 #define ZROT init3d[3] /* rotate x-axis 0 degrees */
688 #define XSCALE init3d[4] /* scale x-axis, 90 percent */
689 #define YSCALE init3d[5] /* scale y-axis, 90 percent */
690
691 /* sphere 3D */
692 #define PHI1 init3d[1] /* longitude start, 180 */
693 #define PHI2 init3d[2] /* longitude end , 0 */
694 #define THETA1 init3d[3] /* latitude start,-90 degrees */
695 #define THETA2 init3d[4] /* latitude stop, 90 degrees */
696 #define RADIUS init3d[5] /* should be user input */
697
698 /* common parameters */
699 #define ROUGH init3d[6] /* scale z-axis, 30 percent */
700 #define WATERLINE init3d[7] /* water level */
701 #define FILLTYPE init3d[8] /* fill type */
702 #define ZVIEWER init3d[9] /* perspective view point */
703 #define XSHIFT init3d[10] /* x shift */
704 #define YSHIFT init3d[11] /* y shift */
705 #define XLIGHT init3d[12] /* x light vector coordinate */
706 #define YLIGHT init3d[13] /* y light vector coordinate */
707 #define ZLIGHT init3d[14] /* z light vector coordinate */
708 #define LIGHTAVG init3d[15] /* number of points to average */
709
710 #ifndef TRUE
711 #define TRUE 1
712 #define FALSE 0
713 #endif
714
715 /* Math definitions (normally in float.h) that are missing on some systems. */
716 #ifndef FLT_MIN
718 #endif
719 #ifndef FLT_MAX
721 #endif
722 #ifndef DBL_EPSILON
724 #endif
725
726 #ifndef XFRACT
727 #define UPARR "\x18"
728 #define DNARR "\x19"
729 #define RTARR "\x1A"
730 #define LTARR "\x1B"
731 #define UPARR1 "\x18"
732 #define DNARR1 "\x19"
733 #define RTARR1 "\x1A"
734 #define LTARR1 "\x1B"
735 #define FK_F1 "F1"
736 #define FK_F2 "F2"
737 #define FK_F3 "F3"
738 #define FK_F4 "F4"
739 #define FK_F5 "F5"
740 #define FK_F6 "F6"
741 #define FK_F7 "F7"
742 #define FK_F8 "F8"
743 #define FK_F9 "F9"
762 #endif
763
764 #ifndef XFRACT
765 #define Fractint "Fractint"
766 #define FRACTINT "FRACTINT"
770 #endif
771
772 #define JIIM 0
773 #define ORBIT 1
774
775 struct workliststuff /* work list entry for std escape time engines */
776 {
777 int xxstart; /* screen window for this entry */
778 int xxstop;
779 int yystart;
780 int yystop;
781 int yybegin; /* start row within window, for 2pass/ssg resume */
782 int sym; /* if symmetry in window, prevents bad combines */
783 int pass; /* for 2pass and solid guessing */
784 int xxbegin; /* start col within window, =0 except on resume */
785 };
786
787 typedef struct workliststuff WORKLIST;
788
789
790 #define MAXCALCWORK 12
791
792 struct coords {
793 int x,y;
794 };
795
796 struct dblcoords {
797 double x,y;
798 };
799
800 extern BYTE trigndx[];
801 extern void (*ltrig0)(void), (*ltrig1)(void), (*ltrig2)(void), (*ltrig3)(void);
802 extern void (*dtrig0)(void), (*dtrig1)(void), (*dtrig2)(void), (*dtrig3)(void);
803
804 struct trig_funct_lst
805 {
806 char *name;
807 void (*lfunct)(void);
808 void (*dfunct)(void);
809 void (*mfunct)(void);
810 } ;
811 extern struct trig_funct_lst trigfn[];
812
813 /* function prototypes */
814
815 extern void (_fastcall *plot)(int, int, int);
816
817 /* for overlay return stack */
818
819 #define BIG 100000.0
820
821 #define CTL(x) ((x)&0x1f)
822
823 /* nonalpha tests if we have a control character */
824 #define nonalpha(c) ((c)<32 || (c)>127)
825
826 /* keys */
827 #define INSERT 1082
828 #define DELETE 1083
829 #define PAGE_UP 1073
830 #define PAGE_DOWN 1081
831 #define CTL_HOME 1119
832 #define CTL_END 1117
833 #define LEFT_ARROW 1075
834 #define RIGHT_ARROW 1077
835 #define UP_ARROW 1072
836 #define DOWN_ARROW 1080
837 #define LEFT_ARROW_2 1115
838 #define RIGHT_ARROW_2 1116
839 #define UP_ARROW_2 1141
840 #define DOWN_ARROW_2 1145
841 #define HOME 1071
842 #define END 1079
843 #define ENTER 13
844 #define ENTER_2 1013
845 #define CTL_ENTER 10
846 #define CTL_ENTER_2 1010
847 #define CTL_PAGE_UP 1132
848 #define CTL_PAGE_DOWN 1118
849 #define CTL_MINUS 1142
850 #define CTL_PLUS 1144
851 #define CTL_INSERT 1146
852 #define CTL_DEL 1147
853 #define CTL_BACKSLASH 28
854 #define F1 1059
855 #define F2 1060
856 #define F3 1061
857 #define F4 1062
858 #define F5 1063
859 #define F6 1064
860 #define F7 1065
861 #define F8 1066
862 #define F9 1067
863 #define F10 1068
864 #define BACKSPACE 8
865 #define TAB 9
866 #define CTL_TAB 1148
867 #define ALT_TAB 1165
868 #define BACK_TAB 1015 /* shift tab */
869 #define ESC 27
870 #define SPACE 32
871 #define SF1 1084
872 #define SF2 1085
873 #define SF3 1086
874 #define SF4 1087
875 #define SF5 1088
876 #define SF6 1089
877 #define SF7 1090
878 #define SF8 1091
879 #define SF9 1092
880 #define SF10 1093
881 /* text colors */
882 #define BLACK 0
883 #define BLUE 1
884 #define GREEN 2
885 #define CYAN 3
886 #define RED 4
887 #define MAGENTA 5
888 #define BROWN 6 /* dirty yellow on cga */
889 #define WHITE 7
890 /* use values below this for foreground only, they don't work background */
891 #define GRAY 8 /* don't use this much - is black on cga */
892 #define L_BLUE 9
893 #define L_GREEN 10
894 #define L_CYAN 11
895 #define L_RED 12
896 #define L_MAGENTA 13
897 #define YELLOW 14
898 #define L_WHITE 15
899 #define INVERSE 0x8000 /* when 640x200x2 text or mode 7, inverse */
900 #define BRIGHT 0x4000 /* when mode 7, bright */
901 /* and their use: */
902 extern BYTE txtcolor[];
903 #define C_TITLE txtcolor[0]+BRIGHT
904 #define C_TITLE_DEV txtcolor[1]
905 #define C_HELP_HDG txtcolor[2]+BRIGHT
906 #define C_HELP_BODY txtcolor[3]
907 #define C_HELP_INSTR txtcolor[4]
908 #define C_HELP_LINK txtcolor[5]+BRIGHT
909 #define C_HELP_CURLINK txtcolor[6]+INVERSE
910 #define C_PROMPT_BKGRD txtcolor[7]
911 #define C_PROMPT_TEXT txtcolor[8]
912 #define C_PROMPT_LO txtcolor[9]
913 #define C_PROMPT_MED txtcolor[10]
914 #ifndef XFRACT
915 #define C_PROMPT_HI txtcolor[11]+BRIGHT
918 #endif
919 #define C_PROMPT_INPUT txtcolor[12]+INVERSE
920 #define C_PROMPT_CHOOSE txtcolor[13]+INVERSE
921 #define C_CHOICE_CURRENT txtcolor[14]+INVERSE
922 #define C_CHOICE_SP_INSTR txtcolor[15]
923 #define C_CHOICE_SP_KEYIN txtcolor[16]+BRIGHT
924 #define C_GENERAL_HI txtcolor[17]+BRIGHT
925 #define C_GENERAL_MED txtcolor[18]
926 #define C_GENERAL_LO txtcolor[19]
927 #define C_GENERAL_INPUT txtcolor[20]+INVERSE
928 #define C_DVID_BKGRD txtcolor[21]
929 #define C_DVID_HI txtcolor[22]+BRIGHT
930 #define C_DVID_LO txtcolor[23]
931 #define C_STOP_ERR txtcolor[24]+BRIGHT
932 #define C_STOP_INFO txtcolor[25]+BRIGHT
933 #define C_TITLE_LOW txtcolor[26]
934 #define C_AUTHDIV1 txtcolor[27]+INVERSE
935 #define C_AUTHDIV2 txtcolor[28]+INVERSE
936 #define C_PRIMARY txtcolor[29]
937 #define C_CONTRIB txtcolor[30]
938
939 /* structure for xmmmoveextended parameter */
940 struct XMM_Move
941 {
942 unsigned long Length;
943 unsigned int SourceHandle;
944 unsigned long SourceOffset;
945 unsigned int DestHandle;
946 unsigned long DestOffset;
947 };
948
949 /* structure passed to fullscreen_prompts */
950 struct fullscreenvalues
951 {
952 int type; /* 'd' for double, 'f' for float, 's' for string, */
953 /* 'D' for integer in double, '*' for comment */
954 /* 'i' for integer, 'y' for yes=1 no=0 */
955 /* 0x100+n for string of length n */
956 /* 'l' for one of a list of strings */
957 /* 'L' for long */
958 union
959 {
960 double dval; /* when type 'd' or 'f' */
961 int ival; /* when type is 'i' */
962 long Lval; /* when type is 'L' */
963 char sval[16]; /* when type is 's' */
964 char far *sbuf; /* when type is 0x100+n */
965 struct { /* when type is 'l' */
966 int val; /* selected choice */
967 int vlen; /* char len per choice */
968 char **list; /* list of values */
969 int llen; /* number of values */
970 } ch;
971 } uval;
972 };
973
974 #define FILEATTR 0x37 /* File attributes; select all but volume labels */
975 #define HIDDEN 2
976 #define SYSTEM 4
977 #define SUBDIR 16
978
979 struct DIR_SEARCH /* Allocate DTA and define structure */
980 {
981 char path[21]; /* DOS path and filespec */
982 char attribute; /* File attributes wanted */
983 int ftime; /* File creation time */
984 int fdate; /* File creation date */
985 long size; /* File size in bytes */
986 char filename[13]; /* Filename and extension */
987 };
988
989 extern struct DIR_SEARCH DTA; /* Disk Transfer Area */
990
991 typedef struct palett
992 {
993 BYTE red;
994 BYTE green;
995 BYTE blue;
996 }
997 Palettetype;
998
999 #define MAX_JUMPS 200 /* size of JUMP_CONTROL array */
1000
1001 typedef struct frm_jmpptrs_st {
1002 int JumpOpPtr;
1003 int JumpLodPtr;
1004 int JumpStoPtr;
1005 } JUMP_PTRS_ST;
1006
1007
1008 typedef struct frm_jump_st {
1009 int type;
1010 JUMP_PTRS_ST ptrs;
1011 int DestJumpIndex;
1012 } JUMP_CONTROL_ST;
1013
1014
1015 struct ext_blk_2 {
1016 char got_data;
1017 int length;
1018 int resume_data;
1019 };
1020
1021 struct ext_blk_3 {
1022 char got_data;
1023 int length;
1024 char form_name[40];
1025 short uses_p1;
1026 short uses_p2;
1027 short uses_p3;
1028 short uses_ismand;
1029 short ismand;
1030 short uses_p4;
1031 short uses_p5;
1032 };
1033
1034 struct ext_blk_4 {
1035 char got_data;
1036 int length;
1037 int far *range_data;
1038 };
1039
1040 struct ext_blk_5 {
1041 char got_data;
1042 int length;
1043 char far *apm_data;
1044 };
1045
1046 /* parameter evolution stuff */
1047 struct ext_blk_6 {
1048 char got_data;
1049 int length;
1050 short evolving;
1051 short gridsz;
1052 unsigned short this_gen_rseed;
1053 double fiddlefactor;
1054 double paramrangex;
1055 double paramrangey;
1056 double opx;
1057 double opy;
1058 short odpx;
1059 short odpy;
1060 short px;
1061 short py;
1062 short sxoffs;
1063 short syoffs;
1064 short xdots;
1065 short ydots;
1066 short ecount;
1067 short mutate[NUMGENES];
1068 };
1069
1070 struct ext_blk_7 {
1071 char got_data;
1072 int length;
1073 double oxmin;
1074 double oxmax;
1075 double oymin;
1076 double oymax;
1077 double ox3rd;
1078 double oy3rd;
1079 short keep_scrn_coords;
1080 char drawmode;
1081 };
1082
1083 struct SearchPath {
1084 char par[FILE_MAX_PATH];
1085 char frm[FILE_MAX_PATH];
1086 char ifs[FILE_MAX_PATH];
1087 char lsys[FILE_MAX_PATH];
1088 } ;
1089
1090 struct affine
1091 {
1092 /* weird order so a,b,e and c,d,f are vectors */
1093 double a;
1094 double b;
1095 double e;
1096 double c;
1097 double d;
1098 double f;
1099 };
1100
1101 struct baseunit { /* smallest part of a fractint 'gene' */
1102 void *addr ; /* address of variable to be referenced */
1103 void (*varyfunc)(struct baseunit*,int,int); /* pointer to func used to vary it */
1104 /* takes random number and pointer to var*/
1105 int mutate ; /* flag to switch on variation of this variable */
1106 /* 0 for no mutation, 1 for x axis, 2 for y axis */
1107 /* in steady field maps, either x or y=yes in random modes*/
1108 char name[16]; /* name of variable (for menu ) */
1109 char level; /* mutation level at which this should become active */
1110 };
1111
1112 typedef struct baseunit GENEBASE;
1113
1114 #define sign(x) (((x) < 0) ? -1 : ((x) != 0) ? 1 : 0)
1115
1116 /*
1117 * The following typedefs allow declaring based data
1118 * types that are stored in the code segment under MSC,
1119 * and thus may be overlaid. Use only for constant data.
1120 * Be sure to use the data right away, since arrays thus
1121 * declared do not exist when the overlay they belong to
1122 * is swapped out.
1123 */
1124
1125 #if (_MSC_VER >= 700 && !defined(WINFRACT))
1126 typedef char __based(__segname("_CODE")) FCODE;
1129 #endif
1130
1131 /* pointer to FCODE */
1132 #if (_MSC_VER >= 700 && !defined(WINFRACT))
1133 typedef FCODE * __based(__segname("_CODE")) PFCODE;
1136 #endif
1137
1138 #if (_MSC_VER >= 700 && !defined(WINFRACT))
1139 typedef BYTE __based(__segname("_CODE")) BFCODE;
1142 #endif
1143
1144 #if (_MSC_VER >= 700 && !defined(WINFRACT))
1145 typedef short __based(__segname("_CODE")) SIFCODE;
1148 #endif
1149
1150 #if (_MSC_VER >= 700 && !defined(WINFRACT))
1151 typedef short __based(__segname("_CODE")) USFCODE;
1154 #endif
1155
1156 #if (_MSC_VER >= 700 && !defined(WINFRACT))
1157 typedef int __based(__segname("_CODE")) IFCODE;
1160 #endif
1161
1162 #if (_MSC_VER >= 700 && !defined(WINFRACT))
1163 typedef unsigned int __based(__segname("_CODE")) UIFCODE;
1166 #endif
1167
1168 #if (_MSC_VER >= 700 && !defined(WINFRACT))
1169 typedef long __based(__segname("_CODE")) LFCODE;
1172 #endif
1173
1174 #if (_MSC_VER >= 700 && !defined(WINFRACT))
1175 typedef unsigned long __based(__segname("_CODE")) ULFCODE;
1178 #endif
1179
1180 #if (_MSC_VER >= 700 && !defined(WINFRACT))
1181 typedef double __based(__segname("_CODE")) DFCODE;
1184 #endif
1185 #endif
1186
1187
1188 #if _MSC_VER == 800
1189 #ifndef FIXTAN_DEFINED
1190 /* !!!!! stupid MSVC tan(x) bug fix !!!!!!!! */
1191 /* tan(x) can return -tan(x) if -pi/2 < x < pi/2 */
1192 /* if tan(x) has been called before outside this range. */
1193 double fixtan( double x );
1194 #define tan fixtan
1195 #define FIXTAN_DEFINED
1196 #endif
1197 #endif
1198