home *** CD-ROM | disk | FTP | other *** search
/ Mega A/V / mega_av.zip / mega_av / GRAPHUTL / FRPOR172.ZIP / FRACTINT.H < prev    next >
C/C++ Source or Header  |  1992-03-15  |  22KB  |  663 lines

  1. /* FRACTINT.H - common structures and values for the FRACTINT routines */
  2.  
  3. #include "port.h"
  4.  
  5. #ifndef C6
  6. #define _fastcall    /* _fastcall is a Microsoft C6.00 extension */
  7. #endif
  8.  
  9. #ifndef XFRACT
  10. #ifdef __TURBOC__
  11. #   define _bios_printer(a,b,c)   biosprint((a),(c),(b))
  12. #   define _bios_serialcom(a,b,c) bioscom((a),(c),(b))
  13. #else
  14. #   define MK_FP(seg,off) (VOIDFARPTR )( (((long)(seg))<<16) | \
  15.                                           ((unsigned)(off)) )
  16. #endif
  17. #else
  18. #   define MK_FP(seg,off) (VOIDFARPTR )(seg+off)
  19. #endif
  20.  
  21.  
  22. #define MAXPIXELS 2048        /* Maximum pixel count across/down the screen */
  23. #define SCREENASPECT 0.75    /* Assumed overall screen dimensions, y/x     */
  24.  
  25. struct videoinfo {        /* All we need to know about a Video Adapter */
  26.     char    name[26];    /* Adapter name (IBM EGA, etc)        */
  27.     char    comment[26];    /* Comments (UNTESTED, etc)        */
  28.     int    keynum;     /* key number used to invoked this mode */
  29.                 /* 2-10 = F2-10, 11-40 = S,C,A{F1-F10}    */
  30.     int    videomodeax;    /* begin with INT 10H, AX=(this)    */
  31.     int    videomodebx;    /*        ...and BX=(this)    */
  32.     int    videomodecx;    /*        ...and CX=(this)    */
  33.     int    videomodedx;    /*        ...and DX=(this)    */
  34.                 /* NOTE:  IF AX==BX==CX==0, SEE BELOW    */
  35.     int    dotmode;    /* video access method used by asm code */
  36.                 /*    1 == BIOS 10H, AH=12,13 (SLOW)    */
  37.                 /*    2 == access like EGA/VGA    */
  38.                 /*    3 == access like MCGA        */
  39.                 /*    4 == Tseng-like  SuperVGA*256    */
  40.                 /*    5 == P'dise-like SuperVGA*256   */
  41.                 /*    6 == Vega-like     SuperVGA*256    */
  42.                 /*    7 == "Tweaked" IBM-VGA ...*256  */
  43.                 /*    8 == "Tweaked" SuperVGA ...*256 */
  44.                 /*    9 == Targa Format        */
  45.                 /*    10 = Hercules            */
  46.                 /*    11 = "disk video" (no screen)   */
  47.                 /*    12 = 8514/A            */
  48.                 /*    13 = CGA 320x200x4, 640x200x2    */
  49.                 /*    14 = Tandy 1000         */
  50.                 /*    15 = TRIDENT  SuperVGA*256    */
  51.                 /*    16 = Chips&Tech SuperVGA*256    */
  52.     int    xdots;        /* number of dots across the screen    */
  53.     int    ydots;        /* number of dots down the screen    */
  54.     int    colors;     /* number of colors available        */
  55.     };
  56.  
  57.  
  58. #define INFO_ID     "Fractal"
  59. #define FRACTAL_INFO   struct fractal_info
  60.  
  61. struct fractal_info            /*  for saving data in GIF file     */
  62. {
  63.     char info_id[8];        /* Unique identifier for info block */
  64.     int iterations;
  65.     int fractal_type;        /* 0=Mandelbrot 1=Julia 2= ... */
  66.     double    xmin;
  67.     double    xmax;
  68.     double    ymin;
  69.     double    ymax;
  70.     double    creal;
  71.     double    cimag;
  72.     int    videomodeax;
  73.     int    videomodebx;
  74.     int    videomodecx;
  75.     int    videomodedx;
  76.     int    dotmode;
  77.     int    xdots;
  78.     int    ydots;
  79.     int colors;
  80.     int version;        /* used to be 'future[0]' */
  81.     float parm3;
  82.     float parm4;
  83.     float potential[3];
  84.     int rseed;
  85.     int rflag;
  86.     int biomorph;
  87.     int inside;
  88.     int logmap;
  89.     float invert[3];
  90.     int decomp[2];
  91.     int symmetry;
  92.     /* version 2 stuff */
  93.     int init3d[16];
  94.     int previewfactor;
  95.     int xtrans;
  96.     int ytrans;
  97.     int red_crop_left;
  98.     int red_crop_right;
  99.     int blue_crop_left;
  100.     int blue_crop_right;
  101.     int red_bright;
  102.     int blue_bright;
  103.     int xadjust;
  104.     int eyeseparation;
  105.     int glassestype;
  106.     /* version 3 stuff, release 13 */
  107.     int outside;
  108.     /* version 4 stuff, release 14 */
  109.     double x3rd;      /* 3rd corner */
  110.     double y3rd;
  111.     char stdcalcmode;      /* 1/2/g/b */
  112.     char useinitorbit;      /* init Mandelbrot orbit flag */
  113.     int calc_status;      /* resumable, finished, etc */
  114.     long tot_extend_len;  /* total length of extension blocks in .gif file */
  115.     int distest;
  116.     int floatflag;
  117.     int bailout;
  118.     long calctime;
  119.     BYTE trigndx[4]; /* which trig functions selected */
  120.     int finattract;
  121.     double initorbit[2];  /* init Mandelbrot orbit values */
  122.     int periodicity;      /* periodicity checking */
  123.     /* version 5 stuff, release 15 */
  124.     int pot16bit;      /* save 16 bit continuous potential info */
  125.     float faspectratio;   /* finalaspectratio, y/x */
  126.     int system;       /* 0 for dos, 1 for windows */
  127.     int release;      /* release number, with 2 decimals implied */
  128.     int flag3d;       /* stored only for now, for future use */
  129.     int transparent[2];
  130.     int ambient;
  131.     int haze;
  132.     int randomize;
  133.     /* version 6 stuff, release 15.x */
  134.     int rotate_lo;
  135.     int rotate_hi;
  136.     int distestwidth;
  137.     /* version 7 stuff, release 16 */
  138.     double dparm3;
  139.     double dparm4;
  140.     /* version 8 stuff, release 17 */
  141.     int fillcolor;
  142.     int future[31];      /* for stuff we haven't thought of yet */
  143. };
  144.  
  145. #define MAXVIDEOMODES 300    /* maximum entries in fractint.cfg      */
  146. #ifndef XFRACT
  147. #define MAXVIDEOTABLE 40        /* size of the resident video modes table */
  148. #else
  149. #define MAXVIDEOTABLE 2         /* size of the resident video modes table */
  150. #endif
  151.  
  152. #if defined(PUTTHEMHERE)    /* this MUST be defined ONLY in FRACTINT.C */
  153.  
  154. struct videoinfo videoentry;
  155.  
  156. #else
  157.  
  158. extern struct videoinfo videoentry;
  159.  
  160. #endif
  161.  
  162. #define NUMIFS      32     /* number of ifs functions in ifs array */
  163. #define IFSPARM    7     /* number of ifs parameters */
  164. #define IFS3DPARM 13     /* number of ifs 3D parameters */
  165.  
  166. #define ITEMNAMELEN 18     /* max length of names in .frm/.l/.ifs/.fc */
  167.  
  168. /* defines for symmetry */
  169. #define  NOSYM        0
  170. #define  XAXIS_NOPARM  -1
  171. #define  XAXIS        1
  172. #define  YAXIS_NOPARM  -2
  173. #define  YAXIS        2
  174. #define  XYAXIS_NOPARM -3
  175. #define  XYAXIS     3
  176. #define  ORIGIN_NOPARM -4
  177. #define  ORIGIN     4
  178. #define  PI_SYM_NOPARM -5
  179. #define  PI_SYM     5
  180. #define  XAXIS_NOIMAG  -6
  181. #define  XAXIS_NOREAL    6
  182. #define  NOPLOT        99
  183. #define  SETUP_SYM    100
  184.  
  185. /* bitmask defines for fractalspecific flags */
  186. #define  NOZOOM     1    /* zoombox not allowed at all       */
  187. #define  NOGUESS    2    /* solid guessing not allowed       */
  188. #define  NOTRACE    4    /* boundary tracing not allowed       */
  189. #define  NOROTATE    8    /* zoombox rotate/stretch not allowed */
  190. #define  NORESUME      16    /* can't interrupt and resume         */
  191. #define  INFCALC       32    /* this type calculates forever       */
  192. #define  TRIG1           64    /* number of trig functions in formula*/
  193. #define  TRIG2          128
  194. #define  TRIG3          192
  195. #define  TRIG4          256
  196. #define  WINFRAC      512    /* supported in WinFrac           */
  197. #define  PARMS3D     1024    /* uses 3d parameters           */
  198.  
  199. #define AUTOINVERT -123456.789
  200.  
  201. #define N_ATTR 8            /* max number of attractors    */
  202.  
  203. extern    long     l_at_rad;    /* finite attractor radius  */
  204. extern    double     f_at_rad;    /* finite attractor radius  */
  205.  
  206. struct fractalspecificstuff
  207. {
  208.    char  *name;             /* name of the fractal */
  209.    char  *param[4];            /* name of the parameters */
  210.    float paramvalue[4];         /* default parameter values */
  211.    int     helptext;            /* helpdefs.h HT_xxxx, -1 for none */
  212.    int     helpformula;            /* helpdefs.h HF_xxxx, -1 for none */
  213.    int     flags;             /* constraints, bits defined above */
  214.    float xmin;                /* default XMIN corner */
  215.    float xmax;                /* default XMAX corner */
  216.    float ymin;                /* default YMIN corner */
  217.    float ymax;                /* default YMAX corner */
  218.    int     isinteger;            /* 1 if integerfractal, 0 otherwise */
  219.    int     tojulia;            /* mandel-to-julia switch */
  220.    int     tomandel;            /* julia-to-mandel switch */
  221.    int     tofloat;            /* integer-to-floating switch */
  222.    int     symmetry;            /* applicable symmetry logic
  223.                        0 = no symmetry
  224.                       -1 = y-axis symmetry (If No Params)
  225.                        1 = y-axis symmetry
  226.                       -2 = x-axis symmetry (No Parms)
  227.                        2 = x-axis symmetry
  228.                       -3 = y-axis AND x-axis (No Parms)
  229.                        3 = y-axis AND x-axis symmetry
  230.                       -4 = polar symmetry (No Parms)
  231.                        4 = polar symmetry
  232.                        5 = PI (sin/cos) symmetry
  233.                        6 = NEWTON (power) symmetry
  234.                                 */
  235.    int (*orbitcalc)();        /* function that calculates one orbit */
  236.    int (*per_pixel)();        /* once-per-pixel init */
  237.    int (*per_image)();        /* once-per-image setup */
  238.    int (*calctype)();        /* name of main fractal function */
  239.    int orbit_bailout;        /* usual bailout value for orbit calc */
  240. };
  241.  
  242. extern struct fractalspecificstuff far fractalspecific[];
  243. extern struct fractalspecificstuff far *curfractalspecific;
  244.  
  245.  
  246. #if defined(PUTTHEMHERE)    /* this MUST be defined ONLY in FRACTINT.C */
  247.  
  248. int helpmode;
  249.  
  250. #else
  251.  
  252. extern int helpmode;
  253.  
  254. #endif
  255.  
  256. #define DEFAULTFRACTALTYPE    ".gif"
  257. #define ALTERNATEFRACTALTYPE    ".fra"
  258.  
  259. #include <math.h>
  260.  
  261. #ifndef _LCOMPLEX_DEFINED
  262. struct lcomplex {
  263.    long x, y;
  264. };
  265. #ifdef XFRACT
  266. struct complex {
  267.     double x,y;
  268. };
  269. #endif
  270. #define _LCOMPLEX_DEFINED
  271. #endif
  272.  
  273. #ifndef sqr
  274. #define sqr(x) ((x)*(x))
  275. #endif
  276.  
  277. #ifndef lsqr
  278. #define lsqr(x) (multiply((x),(x),bitshift))
  279. #endif
  280.  
  281. #define CMPLXmod(z)      (sqr((z).x)+sqr((z).y))
  282. #define CMPLXconj(z)    ((z).y =  -((z).y))
  283. #define LCMPLXmod(z)       (lsqr((z).x)+lsqr((z).y))
  284. #define LCMPLXconj(z)    ((z).y =  -((z).y))
  285.  
  286. typedef  struct complex CMPLX;
  287. typedef  struct lcomplex LCMPLX;
  288.  
  289. /* 3D stuff - formerly in 3d.h */
  290. #ifndef dot_product
  291. #define dot_product(v1,v2)  ((v1)[0]*(v2)[0]+(v1)[1]*(v2)[1]+(v1)[2]*(v2)[2])  /* TW 7-09-89 */
  292. #endif
  293.  
  294. #define    CMAX    4   /* maximum column (4 x 4 matrix) */
  295. #define    RMAX    4   /* maximum row     (4 x 4 matrix) */
  296. #define    DIM       3   /* number of dimensions */
  297.  
  298. typedef double MATRIX [RMAX] [CMAX];  /* matrix of doubles */
  299. typedef int   IMATRIX [RMAX] [CMAX];  /* matrix of ints    */
  300. typedef long  LMATRIX [RMAX] [CMAX];  /* matrix of longs   */
  301.  
  302. /* A MATRIX is used to describe a transformation from one coordinate
  303. system to another.  Multiple transformations may be concatenated by
  304. multiplying their transformation matrices. */
  305.  
  306. typedef double VECTOR [DIM];  /* vector of doubles */
  307. typedef int   IVECTOR [DIM];  /* vector of ints    */
  308. typedef long  LVECTOR [DIM];  /* vector of longs   */
  309.  
  310. /* A VECTOR is an array of three coordinates [x,y,z] representing magnitude
  311. and direction. A fourth dimension is assumed to always have the value 1, but
  312. is not in the data structure */
  313.  
  314.  
  315. #define PI 3.14159265358979323846
  316.  
  317. #define SPHERE      init3d[0]        /* sphere? 1 = yes, 0 = no  */
  318. #define ILLUMINE  (FILLTYPE>4)    /* illumination model        */
  319.  
  320. /* regular 3D */
  321. #define XROT      init3d[1]    /* rotate x-axis 60 degrees */
  322. #define YROT      init3d[2]    /* rotate y-axis 90 degrees */
  323. #define ZROT      init3d[3]    /* rotate x-axis  0 degrees */
  324. #define XSCALE      init3d[4]    /* scale x-axis, 90 percent */
  325. #define YSCALE      init3d[5]    /* scale y-axis, 90 percent */
  326.  
  327. /* sphere 3D */
  328. #define PHI1      init3d[1]    /* longitude start, 180     */
  329. #define PHI2      init3d[2]    /* longitude end ,   0        */
  330. #define THETA1      init3d[3]        /* latitude start,-90 degrees */
  331. #define THETA2      init3d[4]        /* latitude stop,  90 degrees */
  332. #define RADIUS      init3d[5]    /* should be user input */
  333.  
  334. /* common parameters */
  335. #define ROUGH      init3d[6]    /* scale z-axis, 30 percent */
  336. #define WATERLINE init3d[7]    /* water level            */
  337. #define FILLTYPE  init3d[8]    /* fill type            */
  338. #define ZVIEWER   init3d[9]    /* perspective view point   */
  339. #define XSHIFT      init3d[10]    /* x shift */
  340. #define YSHIFT      init3d[11]    /* y shift */
  341. #define XLIGHT      init3d[12]    /* x light vector coordinate */
  342. #define YLIGHT      init3d[13]    /* y light vector coordinate */
  343. #define ZLIGHT      init3d[14]    /* z light vector coordinate */
  344. #define LIGHTAVG  init3d[15]    /* number of points to average */
  345.  
  346. #ifndef TRUE
  347. #define TRUE 1
  348. #define FALSE 0
  349. #endif
  350.  
  351. #ifndef XFRACT
  352. #define UPARR "\x18"
  353. #define DNARR "\x19"
  354. #define RTARR "\x1A"
  355. #define LTARR "\x1B"
  356. #else
  357. #define UPARR "K"
  358. #define DNARR "J"
  359. #define RTARR "L"
  360. #define LTARR "H"
  361. #endif
  362.  
  363.  
  364. struct workliststuff    /* work list entry for std escape time engines */
  365. {
  366.     int xxstart;    /* screen window for this entry */
  367.     int xxstop;
  368.     int yystart;
  369.     int yystop;
  370.     int yybegin;    /* start row within window, for 2pass/ssg resume */
  371.     int sym;    /* if symmetry in window, prevents bad combines */
  372.     int pass;    /* for 2pass and solid guessing */
  373. };
  374. #define MAXCALCWORK 12
  375.  
  376. extern BYTE trigndx[];
  377. extern void (*ltrig0)(), (*ltrig1)(), (*ltrig2)(), (*ltrig3)();
  378. extern void (*dtrig0)(), (*dtrig1)(), (*dtrig2)(), (*dtrig3)();
  379.  
  380. struct trig_funct_lst
  381. {
  382.     char *name;
  383.     void (*lfunct)();
  384.     void (*dfunct)();
  385.     void (*mfunct)();
  386. } ;
  387. extern struct trig_funct_lst trigfn[];
  388.  
  389. /* function prototypes */
  390.  
  391. extern    void   buzzer(int);
  392. extern    int    calcfract(void);
  393. extern    int    calcmand(void);
  394. extern  int    calcmandfp(void);
  395. extern    int    check_key(void);
  396. extern    int    complex_mult(CMPLX, CMPLX, CMPLX *);
  397. extern    int    complex_div(CMPLX, CMPLX, CMPLX *);
  398. extern    int    complex_power(CMPLX, int, CMPLX *);
  399. extern    int    cross_product(double [], double [], double []);
  400. extern    void   drawbox(int);
  401. extern    unsigned int emmallocate(unsigned int);
  402. extern    void   emmclearpage(unsigned int, unsigned int);
  403. extern    void   emmdeallocate(unsigned int);
  404. extern    unsigned int emmgetfree(void);
  405. extern    void   emmgetpage(unsigned int, unsigned int);
  406. extern    BYTE far *emmquery(void);
  407. extern far_strlen( char far *);
  408. extern far_strcpy( char far *, char far *);
  409. extern far_strcmp( char far *, char far *);
  410. extern far_stricmp(char far *, char far *);
  411. extern far_strnicmp(char far *, char far *,int);
  412. extern far_strcat( char far *, char far *);
  413. extern far_memset( VOIDFARPTR , int      , int);
  414. extern far_memcpy( VOIDFARPTR , VOIDFARPTR , int);
  415. extern far_memcmp( VOIDFARPTR , VOIDFARPTR , int);
  416. extern far_memicmp(VOIDFARPTR , VOIDFARPTR , int);
  417. extern  VOIDFARPTR farmemalloc(long);
  418. extern  void   farmemfree(VOIDFARPTR );
  419. extern    int    getakey(void);
  420. extern    int    _fastcall getcolor(int, int);
  421. extern    void   _fastcall putcolor(int, int, int);
  422. extern    void   (_fastcall *plot)(int, int, int);
  423. extern    void   _fastcall symPIplot(int,int,int);
  424. extern    void   _fastcall symPIplot2J(int,int,int);
  425. extern    void   _fastcall symPIplot4J(int,int,int);
  426. extern    void   _fastcall symplot2(int,int,int);
  427. extern    void   _fastcall symplot2Y(int,int,int);
  428. extern    void   _fastcall symplot2J(int,int,int);
  429. extern    void   _fastcall symplot4(int,int,int);
  430. extern    void   _fastcall symplot2basin(int,int,int);
  431. extern    void   _fastcall symplot4basin(int,int,int);
  432. extern    void   _fastcall noplot(int,int,int);
  433. extern    void   _fastcall draw_line(int,int,int,int,int);
  434. extern    int    has_8087(void );
  435. extern    void   putstring(int,int,int,CHAR far *);
  436. extern    int    putstringcenter(int,int,int,int,char far *);
  437. extern    int    stopmsg(int,CHAR far *);
  438. extern    void   identity(MATRIX);
  439. extern    int    Juliafp(void);
  440. extern    int    longvmultpersp(LVECTOR, LMATRIX, LVECTOR, LVECTOR, LVECTOR, int);
  441. extern    int    longpersp(LVECTOR, LVECTOR,int);
  442. extern    int    Lambda(void);
  443. extern    int    Lambdasine(void);
  444. extern    void   mat_mul(MATRIX, MATRIX, MATRIX);
  445. extern    void   main(int, char *[]);
  446. extern    int    Mandelfp(void);
  447. extern    long   multiply(long, long, int);
  448. extern    long   divide(long, long, int);
  449. extern    int    Newton(void);
  450. extern  int    perspective(VECTOR v);
  451. extern    void   cdecl Print_Screen(void);
  452. extern    void   scale(double, double, double, MATRIX);
  453. extern    void   setvideomode(int, int, int, int);
  454. extern    int    Sierpinski(void);
  455. extern    void   spindac(int, int);
  456. extern    void   trans(double, double, double, MATRIX);
  457. extern    int    vmult(VECTOR,MATRIX,VECTOR);
  458. extern    void   xrot(double, MATRIX);
  459. extern    void   yrot(double, MATRIX);
  460. extern    void   zrot(double, MATRIX);
  461. extern    void   (_fastcall *standardplot)(int,int,int);
  462. extern    void   _fastcall plot3dsuperimpose16b(int,int,int);
  463. extern    void   _fastcall plot3dsuperimpose16(int,int,int);
  464. extern    void   _fastcall plot3dsuperimpose256(int,int,int);
  465. extern    void   _fastcall plotIFS3dsuperimpose256(int,int,int);
  466. extern    void   _fastcall plot3dalternate(int,int,int);
  467.  
  468. /* for overlay return stack */
  469.  
  470. #define ENTER_OVLY(ovlyid)\
  471.    extern int active_ovly;\
  472.    int prev_ovly;\
  473.    prev_ovly = active_ovly;\
  474.    active_ovly = ovlyid
  475. #define EXIT_OVLY active_ovly = prev_ovly
  476.  
  477. #define OVLY_MISCOVL   1
  478. #define OVLY_CMDFILES  2
  479. #define OVLY_HELP      3
  480. #define OVLY_PROMPTS   4
  481. #define OVLY_LOADFILE  5
  482. #define OVLY_ROTATE    6
  483. #define OVLY_PRINTER   7
  484. #define OVLY_LINE3D    8
  485. #define OVLY_ENCODER   9
  486. #define OVLY_CALCFRAC 10
  487. #define OVLY_INTRO    11
  488.  
  489.  
  490. #define CTL(x) ((x)&0x1f)
  491.  
  492. /* nonalpha tests if we have a control character */
  493. #ifndef XFRACT
  494. #define nonalpha(c) ((c)<32 || (c)>127)
  495. #else
  496. #define nonalpha(c) ((c)<32 || (c)>127 || ((c)>='!'&&(c)<='*') || \
  497.     ((c)>='A' && (c)<='Z') || (c)>127)
  498. #endif
  499. /* keys */
  500. #ifndef XFRACT
  501. #define   INSERT     1082
  502. #define   DELETE     1083
  503. #define   PAGE_UP     1073
  504. #define   PAGE_DOWN     1081
  505. #define   CTL_HOME     1119
  506. #define   CTL_END     1117
  507. #define   LEFT_ARROW     1075
  508. #define   RIGHT_ARROW     1077
  509. #define   UP_ARROW     1072
  510. #define   DOWN_ARROW     1080
  511. #define   LEFT_ARROW_2     1115
  512. #define   RIGHT_ARROW_2  1116
  513. #define   UP_ARROW_2     1141
  514. #define   DOWN_ARROW_2     1145
  515. #define   HOME         1071
  516. #define   END         1079
  517. #define   ENTER      13
  518. #define   ENTER_2     1013
  519. #define   CTL_ENTER      10
  520. #define   CTL_ENTER_2    1010
  521. #define   CTL_PAGE_UP    1132
  522. #define   CTL_PAGE_DOWN  1118
  523. #define   CTL_MINUS      1142
  524. #define   CTL_PLUS       1144
  525. #define   CTL_INSERT     1146
  526. #define   CTL_DEL        1147
  527. #define   F1         1059
  528. #define   F2         1060
  529. #define   F3         1061
  530. #define   F4         1062
  531. #define   F5         1063
  532. #define   F6         1064
  533. #define   F7         1065
  534. #define   F8         1066
  535. #define   F9         1067
  536. #define   F10         1068
  537. #else
  538. #define   INSERT         'I'
  539. #define   DELETE         'D'
  540. #define   PAGE_UP        'U'
  541. #define   PAGE_DOWN      'N'
  542. #define   CTL_HOME       CTL('O')
  543. #define   CTL_END        CTL('E')
  544. #define   LEFT_ARROW     'H'
  545. #define   RIGHT_ARROW    'L'
  546. #define   UP_ARROW       'K'
  547. #define   DOWN_ARROW     'J'
  548. #define   LEFT_ARROW_2   1115
  549. #define   RIGHT_ARROW_2  1116
  550. #define   UP_ARROW_2     1141
  551. #define   DOWN_ARROW_2   1145
  552. #define   HOME           'O'
  553. #define   END            'E'
  554. #define   ENTER          '\n'
  555. #define   ENTER_2        13
  556. #define   CTL_ENTER      -1
  557. #define   CTL_ENTER_2    -2
  558. #define   CTL_PAGE_UP    CTL('U')
  559. #define   CTL_PAGE_DOWN  CTL('N')
  560. #define   CTL_MINUS      '{'
  561. #define   CTL_PLUS       '}'
  562. #define   CTL_INSERT     CTL('I')
  563. #define   CTL_DEL        CTL('D')
  564. #define   F1             '!'
  565. #define   F2             '@'
  566. #define   F3             '#'
  567. #define   F4             '$'
  568. #define   F5             '%'
  569. #define   F6             '^'
  570. #define   F7             '&'
  571. #define   F8             '*'
  572. #define   F9             '('
  573. #define   F10            ')'
  574. #endif
  575. #define   TAB            9
  576. #define   ESC            27
  577. #define   SPACE          32
  578. #define   SF2            1085
  579. #define   SF3            1086
  580. #define   SF4            1087
  581. #define   SF5            1088
  582. #define   SF6            1089
  583. #define   SF7            1090
  584. #define   SF8            1091
  585. #define   SF9            1092
  586.  
  587. /* text colors */
  588. #define BLACK       0
  589. #define BLUE       1
  590. #define GREEN       2
  591. #define CYAN       3
  592. #define RED       4
  593. #define MAGENTA    5
  594. #define BROWN       6 /* dirty yellow on cga */
  595. #define WHITE       7
  596. /* use values below this for foreground only, they don't work background */
  597. #define GRAY       8 /* don't use this much - is black on cga */
  598. #define L_BLUE       9
  599. #define L_GREEN   10
  600. #define L_CYAN      11
  601. #define L_RED      12
  602. #define L_MAGENTA 13
  603. #define YELLOW      14
  604. #define L_WHITE   15
  605. #define INVERSE 0x8000 /* when 640x200x2 text or mode 7, inverse */
  606. #define BRIGHT    0x4000 /* when mode 7, bright */
  607. /* and their use: */
  608. extern BYTE txtcolor[];
  609. #define C_TITLE       txtcolor[0]+BRIGHT
  610. #define C_TITLE_DEV      txtcolor[1]
  611. #define C_HELP_HDG      txtcolor[2]+BRIGHT
  612. #define C_HELP_BODY      txtcolor[3]
  613. #define C_HELP_INSTR      txtcolor[4]
  614. #define C_HELP_LINK      txtcolor[5]+BRIGHT
  615. #define C_HELP_CURLINK      txtcolor[6]+INVERSE
  616. #define C_PROMPT_BKGRD      txtcolor[7]
  617. #define C_PROMPT_TEXT      txtcolor[8]
  618. #define C_PROMPT_LO      txtcolor[9]
  619. #define C_PROMPT_MED      txtcolor[10]
  620. #define C_PROMPT_HI      txtcolor[11]+BRIGHT
  621. #define C_PROMPT_INPUT      txtcolor[12]+INVERSE
  622. #define C_PROMPT_CHOOSE   txtcolor[13]+INVERSE
  623. #define C_CHOICE_CURRENT  txtcolor[14]+INVERSE
  624. #define C_CHOICE_SP_INSTR txtcolor[15]
  625. #define C_CHOICE_SP_KEYIN txtcolor[16]+BRIGHT
  626. #define C_GENERAL_HI      txtcolor[17]+BRIGHT
  627. #define C_GENERAL_MED      txtcolor[18]
  628. #define C_GENERAL_LO      txtcolor[19]
  629. #define C_GENERAL_INPUT   txtcolor[20]+INVERSE
  630. #define C_DVID_BKGRD      txtcolor[21]
  631. #define C_DVID_HI      txtcolor[22]+BRIGHT
  632. #define C_DVID_LO      txtcolor[23]
  633. #define C_STOP_ERR      txtcolor[24]+BRIGHT
  634. #define C_STOP_INFO      txtcolor[25]+BRIGHT
  635. #define C_TITLE_LOW      txtcolor[26]
  636. #define C_AUTHDIV1      txtcolor[27]+INVERSE
  637. #define C_AUTHDIV2      txtcolor[28]+INVERSE
  638. #define C_PRIMARY      txtcolor[29]
  639. #define C_CONTRIB      txtcolor[30]
  640.  
  641. /* structure passed to fullscreen_prompts */
  642. struct fullscreenvalues
  643. {
  644.    int type;   /* 'd' for decimal, 's' for string, '*' for comment */
  645.            /* 'i' for integer, 'y' for yes=1 no=0              */
  646.            /* 0x100+n for string of length n           */
  647.            /* 'l' for one of a list of strings                 */
  648.    union
  649.    {
  650.       double dval;    /* when type 'd' or 'f'  */
  651.       int    ival;    /* when type is 'i'      */
  652.       char   sval[16];    /* when type is 's'      */
  653.       char  *sbuf;    /* when type is 0x100+n  */
  654.       struct {        /* when type is 'l'      */
  655.      int  val;    /*   selected choice     */
  656.      int  vlen;    /*   char len per choice */
  657.      char **list;    /*   list of values     */
  658.      int  llen;    /*   number of values     */
  659.       } ch;
  660.    } uval;
  661. };
  662.  
  663.