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