home *** CD-ROM | disk | FTP | other *** search
/ Mega A/V / mega_av.zip / mega_av / GRAPHUTL / FRPOR172.ZIP / LOADFILE.C < prev    next >
C/C++ Source or Header  |  1992-02-19  |  20KB  |  674 lines

  1. /*
  2.     loadfile.c - load an existing fractal image, control level
  3.     This module is linked as an overlay, use ENTER_OVLY and EXIT_OVLY.
  4. */
  5.  
  6. #include <stdlib.h>
  7. #include <stdio.h>
  8. #include <string.h>
  9. #ifdef XFRACT
  10. #include <unistd.h>
  11. #endif
  12. #include "fractint.h"
  13. #include "fractype.h"
  14. #include "targa_lc.h"
  15.  
  16. /* routines in this module    */
  17.  
  18. void loadfile_overlay(void);
  19. int  read_overlay(void);
  20.  
  21. static int  find_fractal_info(char *,struct fractal_info *);
  22. static void load_ext_blk(char far *loadptr,int loadlen);
  23. static void skip_ext_blk(int *,int *);
  24. static void backwardscompat();
  25.  
  26. int filetype;
  27. int loaded3d;
  28.  
  29. extern int    showfile;         /* has file been displayed yet? */
  30. extern char   readname[];        /* name of fractal input file */
  31. extern char   far *resume_info;     /* pointer to resume info if alloc'd */
  32. extern int    resume_len;        /* length of resume info */
  33. extern int    adapter;
  34. extern int    calc_status;
  35. extern int    initmode;         /* initial video mode        */
  36. extern long   calctime;
  37. extern int    initbatch;        /* 1 if batch run (no kbd)  */
  38. extern int    maxit;
  39. extern int    initincr;         /* maxiter incrmnt        */
  40. extern char   usr_stdcalcmode;        /* pass mode            */
  41. extern int    fractype;         /* fractal type         */
  42. extern double xxmin,xxmax;        /* corner values        */
  43. extern double yymin,yymax;        /* corner values        */
  44. extern double xx3rd,yy3rd;        /* corner values        */
  45. extern double param[4];         /* parameters            */
  46. extern int    fillcolor;        /* fill color: -1 = normal  */
  47. extern int    inside;            /* inside color: 1=blue     */
  48. extern int    outside;            /* outside color, if set    */
  49. extern int    finattract;        /* finite attractor option  */
  50. extern int    forcesymmetry;
  51. extern int    LogFlag;            /* non-zero if logarithmic palettes */
  52. extern int    rflag, rseed;
  53. extern int    usr_periodicitycheck;
  54. extern char   useinitorbit;
  55. extern struct complex initorbit;
  56. extern int    potflag;            /* continuous potential flag */
  57. extern int    pot16bit;
  58. extern double potparam[3];        /* three potential parameters*/
  59. extern double inversion[];
  60. extern int    decomp[];
  61. extern int    usr_distest;        /* non-zero if distance estimator   */
  62. extern int    distestwidth;
  63. extern int    init3d[20];        /* '3d=nn/nn/nn/...' values */
  64. extern char   usr_floatflag;        /* floating-point fractals? */
  65. extern char   floatflag;
  66. extern int    usr_biomorph;
  67. extern char   FormName[];
  68. extern char   LName[];
  69. extern char   IFSName[];
  70. extern int    bailout;            /* user input bailout value */
  71. extern int    previewfactor;
  72. extern int    xtrans;
  73. extern int    ytrans;
  74. extern int    red_crop_left;
  75. extern int    red_crop_right;
  76. extern int    blue_crop_left;
  77. extern int    blue_crop_right;
  78. extern int    red_bright;
  79. extern int    blue_bright;
  80. extern int    xadjust;
  81. extern int    eyeseparation;
  82. extern int    glassestype;
  83. extern int    display3d;        /* 3D display flag: 0 = OFF */
  84. extern int    overlay3d;        /* 3D overlay flag: 0 = OFF */
  85. extern int    viewwindow;        /* 0 for full screen, 1 for window */
  86. extern float  viewreduction;        /* window auto-sizing */
  87. extern float  finalaspectratio;     /* for view shape and rotation */
  88. extern int    xdots, ydots;        /* # of dots on the logical screen */
  89. extern int    viewxdots,viewydots;    /* explicit view sizing */
  90. extern int    save_system,save_release;
  91. extern int    Ambient;
  92. extern int    RANDOMIZE;
  93. extern int    haze;
  94. extern int    transparent[2];
  95. extern int    rotate_lo,rotate_hi;
  96. extern int far *ranges;
  97. extern int    rangeslen;
  98. extern int    invert;
  99.  
  100. static FILE *fp;
  101.  
  102. int fileydots, filexdots, filecolors;
  103. float fileaspectratio;
  104.  
  105. int skipxdots,skipydots;    /* for decoder, when reducing image */
  106.  
  107.  
  108. void loadfile_overlay() { }    /* for restore_active_ovly */
  109.  
  110.  
  111. int read_overlay()    /* read overlay/3D files, if reqr'd */
  112. {
  113.    struct fractal_info read_info;
  114.    char oldfloatflag;
  115.    char msg[110];
  116.  
  117.    ENTER_OVLY(OVLY_LOADFILE);
  118.  
  119.    showfile = 1;        /* for any abort exit, pretend done */
  120.    initmode = -1;        /* no viewing mode set yet */
  121.    oldfloatflag = usr_floatflag;
  122.    loaded3d = 0;
  123.  
  124.    if(strchr(readname,'.') == NULL)
  125.       strcat(readname,".gif");
  126.  
  127.    if(find_fractal_info(readname,&read_info)) { /* didn't find a useable file */
  128.       sprintf(msg,"Sorry, %s isn't a file I can decode.",readname);
  129.       stopmsg(0,msg);
  130.       EXIT_OVLY;
  131.       return(-1);
  132.       }
  133.  
  134.    maxit    = read_info.iterations;
  135.    fractype    = read_info.fractal_type;
  136.    curfractalspecific = &fractalspecific[fractype];
  137.    xxmin    = read_info.xmin;
  138.    xxmax    = read_info.xmax;
  139.    yymin    = read_info.ymin;
  140.    yymax    = read_info.ymax;
  141.    param[0]    = read_info.creal;
  142.    param[1]    = read_info.cimag;
  143.    save_release = 1100; /* unless we find out better later on */
  144.  
  145.    invert = 0;
  146.    if(read_info.version > 0) {
  147.       param[2]        = read_info.parm3;
  148.       roundfloatd(¶m[2]);
  149.       param[3]        = read_info.parm4;
  150.       roundfloatd(¶m[3]);
  151.       potparam[0]   = read_info.potential[0];
  152.       potparam[1]   = read_info.potential[1];
  153.       potparam[2]   = read_info.potential[2];
  154.       potflag        = (potparam[0] != 0.0);
  155.       rflag        = read_info.rflag;
  156.       rseed        = read_info.rseed;
  157.       inside        = read_info.inside;
  158.       LogFlag        = read_info.logmap;
  159.       inversion[0]  = read_info.invert[0];
  160.       inversion[1]  = read_info.invert[1];
  161.       inversion[2]  = read_info.invert[2];
  162.       if (inversion[0] != 0.0)
  163.      invert = 3;
  164.       decomp[0]     = read_info.decomp[0];
  165.       decomp[1]     = read_info.decomp[1];
  166.       usr_biomorph  = read_info.biomorph;
  167.       forcesymmetry = read_info.symmetry;
  168.       }
  169.  
  170.    if(read_info.version > 1) {
  171.       save_release  = 1200;
  172.       if (!display3d
  173.     && (read_info.version <= 4 || read_info.flag3d > 0
  174.         || (curfractalspecific->flags&PARMS3D) )) {
  175.      int i;
  176.      for (i = 0; i < 16; i++)
  177.         init3d[i] = read_info.init3d[i];
  178.      previewfactor     = read_info.previewfactor;
  179.      xtrans      = read_info.xtrans;
  180.      ytrans      = read_info.ytrans;
  181.      red_crop_left     = read_info.red_crop_left;
  182.      red_crop_right  = read_info.red_crop_right;
  183.      blue_crop_left  = read_info.blue_crop_left;
  184.      blue_crop_right = read_info.blue_crop_right;
  185.      red_bright     = read_info.red_bright;
  186.      blue_bright     = read_info.blue_bright;
  187.      xadjust     = read_info.xadjust;
  188.      eyeseparation     = read_info.eyeseparation;
  189.      glassestype     = read_info.glassestype;
  190.      }
  191.       }
  192.  
  193.    if(read_info.version > 2) {
  194.       save_release = 1300;
  195.       outside       = read_info.outside;
  196.       }
  197.  
  198.    calc_status = 0;      /* defaults if version < 4 */
  199.    xx3rd = xxmin;
  200.    yy3rd = yymin;
  201.    usr_distest = 0;
  202.    calctime = 0;
  203.    if(read_info.version > 3) {
  204.       save_release = 1400;
  205.       xx3rd      = read_info.x3rd;
  206.       yy3rd      = read_info.y3rd;
  207.       calc_status = read_info.calc_status;
  208.       usr_stdcalcmode = read_info.stdcalcmode;
  209.       usr_distest     = read_info.distest;
  210.       usr_floatflag   = read_info.floatflag;
  211.       bailout      = read_info.bailout;
  212.       calctime      = read_info.calctime;
  213.       trigndx[0]  = read_info.trigndx[0];
  214.       trigndx[1]  = read_info.trigndx[1];
  215.       trigndx[2]  = read_info.trigndx[2];
  216.       trigndx[3]  = read_info.trigndx[3];
  217.       finattract  = read_info.finattract;
  218.       initorbit.x = read_info.initorbit[0];
  219.       initorbit.y = read_info.initorbit[1];
  220.       useinitorbit = read_info.useinitorbit;
  221.       usr_periodicitycheck = read_info.periodicity;
  222.       }
  223.  
  224.    pot16bit = 0;
  225.    save_system = 0;
  226.    if(read_info.version > 4) {
  227.       pot16bit       = read_info.pot16bit;
  228.       if (pot16bit)
  229.      filexdots >>= 1;
  230.       fileaspectratio = read_info.faspectratio;
  231.       if (fileaspectratio < 0.01)    /* fix files produced in early v14.1 */
  232.      fileaspectratio = SCREENASPECT;
  233.       save_system  = read_info.system;
  234.       save_release = read_info.release; /* from fmt 5 on we know real number */
  235.       if (read_info.version == 5    /* except a few early fmt 5 cases: */
  236.       && (save_release <= 0 || save_release >= 2000)) {
  237.      save_release = 1410;
  238.      save_system = 0;
  239.      }
  240.       if (!display3d && read_info.flag3d > 0) {
  241.      loaded3d    = 1;
  242.      Ambient    = read_info.ambient;
  243.      RANDOMIZE    = read_info.randomize;
  244.      haze        = read_info.haze;
  245.      transparent[0] = read_info.transparent[0];
  246.      transparent[1] = read_info.transparent[1];
  247.      }
  248.       }
  249.  
  250.    rotate_lo = 1; rotate_hi = 255;
  251.    distestwidth = 71;
  252.    if(read_info.version > 5) {
  253.       rotate_lo     = read_info.rotate_lo;
  254.       rotate_hi     = read_info.rotate_hi;
  255.       distestwidth    = read_info.distestwidth;
  256.       }
  257.  
  258.    if(read_info.version > 6) {
  259.       param[2]        = read_info.dparm3;
  260.       param[3]        = read_info.dparm4;
  261.       }
  262.  
  263.    if(read_info.version > 7) {
  264.       fillcolor        = read_info.fillcolor;
  265.       }
  266.  
  267.    if(read_info.version < 4) { /* pre-version 14.0? */
  268.       backwardscompat(&read_info); /* translate obsolete types */
  269.       if(LogFlag)
  270.      LogFlag = 2;
  271.       usr_floatflag = (curfractalspecific->isinteger) ? 0 : 1;
  272.       }
  273.  
  274.    if (read_info.version < 5) { /* pre-version 15.0? */
  275.       if (LogFlag == 2) /* logmap=old changed again in format 5! */
  276.      LogFlag = -1;
  277.       if (decomp[0] > 0 && decomp[1] > 0)
  278.      bailout = decomp[1];
  279.       }
  280.    if(potflag) /* in version 15.x and 16.x logmap didn't work with pot */
  281.       if(read_info.version == 6 || read_info.version == 7)
  282.          LogFlag = 0;
  283.    set_trig_pointers(-1);
  284.  
  285.    if (display3d)            /* PB - a klooge till the meaning of */
  286.       usr_floatflag = oldfloatflag; /*    floatflag in line3d is clarified */
  287.  
  288.    if (overlay3d) {
  289.       initmode = adapter;       /* use previous adapter mode for overlays */
  290.       if (filexdots > xdots || fileydots > ydots) {
  291.      static char far msg[]={"Can't overlay with a larger image"};
  292.      stopmsg(0,msg);
  293.      EXIT_OVLY;
  294.      initmode = -1;
  295.      return(-1);
  296.      }
  297.       }
  298.    else {
  299.       int olddisplay3d,oldfloatflag,i;
  300.       olddisplay3d = display3d;
  301.       oldfloatflag = floatflag;
  302.       display3d = loaded3d;      /* for <tab> display during next */
  303.       floatflag = usr_floatflag; /* ditto */
  304.       i = get_video_mode(&read_info);
  305.       display3d = olddisplay3d;
  306.       floatflag = oldfloatflag;
  307.       if (i) {
  308.      EXIT_OVLY;
  309.      initmode = -1;
  310.      return(-1);
  311.      }
  312.       }
  313.  
  314.    if (display3d) {
  315.       calc_status = 0;
  316.       fractype = PLASMA;
  317.       curfractalspecific = &fractalspecific[PLASMA];
  318.       param[0] = 0;
  319.       if (!initbatch)
  320.      if (get_3d_params() < 0) {
  321.         EXIT_OVLY;
  322.         initmode = -1;
  323.         return(-1);
  324.         }
  325.       }
  326.  
  327.    showfile = 0;           /* trigger the file load */
  328.  
  329.    EXIT_OVLY;
  330.    return(0);
  331. }
  332.  
  333.  
  334. static int find_fractal_info(gif_file,info)
  335. char *gif_file;
  336. struct fractal_info *info;
  337. {
  338.    BYTE gifstart[18];
  339.    char temp1[81];
  340.    int scan_extend, block_type, block_len, data_len;
  341.    int fractinf_len;
  342.    int hdr_offset;
  343.  
  344.    if((fp = fopen(gif_file,"rb"))==NULL)
  345.       return(-1);
  346.  
  347.    fread(gifstart,18,1,fp);
  348. #ifndef XFRACT
  349.    if (strncmp(gifstart,"GIF",3)!=0) { /* not GIF, maybe old .tga? */
  350. #else
  351.    if (strncmp((char *)gifstart,"GIF",3)!=0) { /* not GIF, maybe old .tga? */
  352. #endif
  353.       if(fread(info,sizeof(struct fractal_info),1,fp)==1 &&
  354.          strncmp(info->info_id,"Fractal",8)==0) {
  355.      filetype = 1; /* Targa 16 */
  356.      fileydots = *(int *)&gifstart[O_VSIZE];
  357.      filexdots = *(int *)&gifstart[O_HSIZE];
  358.      filecolors = info->colors;
  359.      fileaspectratio = SCREENASPECT;
  360.      if(fileydots == info->ydots && filexdots == info->xdots) {
  361.         fclose(fp);
  362.         return(0);
  363.         }
  364.      }
  365.       fclose(fp);
  366.       return(-1);
  367.       }
  368.  
  369.    filetype = 0; /* GIF */
  370.    filexdots = gifstart[7]*256+gifstart[6];
  371.    fileydots = gifstart[9]*256+gifstart[8];
  372.    filecolors = 2 << (gifstart[10] & 7);
  373.    fileaspectratio = 0; /* unknown */
  374.    if (gifstart[12]) { /* calc reasonably close value from gif header */
  375.       fileaspectratio = (64.0 / ((double)(gifstart[12]) + 15.0))
  376.               * (double)fileydots / (double)filexdots;
  377.       if ( fileaspectratio > SCREENASPECT-0.03
  378.     && fileaspectratio < SCREENASPECT+0.03)
  379.      fileaspectratio = SCREENASPECT;
  380.       }
  381.    else
  382.       if (fileydots * 4 == filexdots * 3) /* assume the common square pixels */
  383.      fileaspectratio = SCREENASPECT;
  384.  
  385.    if (resume_info != NULL) { /* free the prior area if there is one */
  386.       farmemfree(resume_info);
  387.       resume_info = NULL;
  388.       }
  389.    if (rangeslen) { /* free prior ranges */
  390.       farmemfree((char far *)ranges);
  391.       rangeslen = 0;
  392.       }
  393.  
  394.    /* Format of .gif extension blocks is:
  395.       1 byte    '!', extension block identifier
  396.       1 byte    extension block number, 255
  397.       1 byte    length of id, 11
  398.      11 bytes   alpha id, "fractintnnn" with fractint, nnn is secondary id
  399.        n * {
  400.       1 byte    length of block info in bytes
  401.       x bytes   block info
  402.        }
  403.       1 byte    0, extension terminator
  404.       To scan extension blocks, we first look in file at length of fractal_info
  405.       (the main extension block) from end of file, looking for a literal known
  406.       to be at start of our block info.  Then we scan forward a bit, in case
  407.       the file is from an earlier fractint vsn with shorter fractal_info.
  408.       If fractal_info is found and is from vsn>=14, it includes the total length
  409.       of all extension blocks; we then scan them all first to last to load
  410.       any optional ones which are present.
  411.       Defined extension blocks:
  412.     fractint001    header, always present
  413.     fractint002    resume info for interrupted resumable image
  414.     fractint003    additional formula type info
  415.     fractint004    ranges info
  416.    */
  417.  
  418.    memset(info,0,sizeof(FRACTAL_INFO));
  419.    fractinf_len = sizeof(FRACTAL_INFO) + (sizeof(FRACTAL_INFO)+254)/255;
  420.    fseek(fp,(long)(-1-fractinf_len),SEEK_END);
  421.    fread(info,1,sizeof(FRACTAL_INFO),fp);
  422.    if (strcmp(INFO_ID,info->info_id) == 0)
  423.       hdr_offset = -1-fractinf_len;
  424.    else {
  425.       /* didn't work 1st try, maybe an older vsn, maybe junk at eof, scan: */
  426.       int offset,i;
  427.       char tmpbuf[110];
  428.       hdr_offset = 0;
  429.       offset = 80; /* don't even check last 80 bytes of file for id */
  430.       while (offset < fractinf_len+513) { /* allow 512 garbage at eof */
  431.      offset += 100; /* go back 100 bytes at a time */
  432.      fseek(fp,(long)(0-offset),SEEK_END);
  433.      fread(tmpbuf,1,110,fp); /* read 10 extra for string compare */
  434.      for (i = 0; i < 100; ++i)
  435.         if (!strcmp(INFO_ID,&tmpbuf[i])) { /* found header? */
  436.            strcpy(info->info_id,INFO_ID);
  437.            fseek(fp,(long)(hdr_offset=i-offset),SEEK_END);
  438.            fread(info,1,sizeof(FRACTAL_INFO),fp);
  439.            offset = 10000; /* force exit from outer loop */
  440.            break;
  441.            }
  442.      }
  443.       }
  444.  
  445.    if (hdr_offset) { /* we found INFO_ID */
  446.  
  447.       if (info->version >= 4) {
  448.      /* first reload main extension block, reasons:
  449.           might be over 255 chars, and thus earlier load might be bad
  450.           find exact endpoint, so scan back to start of ext blks works
  451.         */
  452.      fseek(fp,(long)(hdr_offset-15),SEEK_END);
  453.      scan_extend = 1;
  454.      while (scan_extend) {
  455.         if (fgetc(fp) != '!' /* if not what we expect just give up */
  456.           || fread(temp1,1,13,fp) != 13
  457.           || strncmp(&temp1[2],"fractint",8))
  458.            break;
  459.         temp1[13] = 0;
  460.         block_type = atoi(&temp1[10]); /* e.g. "fractint002" */
  461.         switch (block_type) {
  462.            case 1: /* "fractint001", the main extension block */
  463.           if (scan_extend == 2) { /* we've been here before, done now */
  464.              scan_extend = 0;
  465.              break;
  466.              }
  467.           load_ext_blk((char far *)info,sizeof(FRACTAL_INFO));
  468.           scan_extend = 2;
  469.           /* now we know total extension len, back up to first block */
  470.           fseek(fp,0L-info->tot_extend_len,SEEK_CUR);
  471.           break;
  472.            case 2: /* resume info */
  473.           skip_ext_blk(&block_len,&data_len); /* once to get lengths */
  474.           if ((resume_info = farmemalloc((long)data_len)) == NULL)
  475.              info->calc_status = 3; /* not resumable after all */
  476.           else {
  477.              fseek(fp,(long)(0-block_len),SEEK_CUR);
  478.              load_ext_blk(resume_info,data_len);
  479.              resume_len = data_len;
  480.              }
  481.           break;
  482.            case 3: /* formula info */
  483.           {
  484.           char *nameptr;
  485.           char tmpname[40];
  486.           load_ext_blk(tmpname,40);
  487.           switch (info->fractal_type) {
  488.              case LSYSTEM:
  489.             nameptr = LName;
  490.             break;
  491.              case IFS:
  492.              case IFS3D:
  493.             nameptr = IFSName;
  494.             break;
  495.              default:
  496.             nameptr = FormName;
  497.             break;
  498.              }
  499.           tmpname[ITEMNAMELEN] = 0;
  500.           strcpy(nameptr,tmpname);
  501.           /* perhaps in future add more here, check block_len for
  502.              backward compatibility */
  503.           }
  504.           break;
  505.            case 4: /* ranges info */
  506.           skip_ext_blk(&block_len,&data_len); /* once to get lengths */
  507.           if ((ranges = (int far *)farmemalloc((long)data_len))) {
  508.              fseek(fp,(long)(0-block_len),SEEK_CUR);
  509.              load_ext_blk((char far *)ranges,data_len);
  510.              rangeslen = data_len/2;
  511.              }
  512.           break;
  513.            default:
  514.           skip_ext_blk(&block_len,&data_len);
  515.            }
  516.         }
  517.      }
  518.  
  519.       fclose(fp);
  520.       fileaspectratio = SCREENASPECT; /* if not >= v15, this is correct */
  521.       return(0);
  522.       }
  523.  
  524.    strcpy(info->info_id, "GIFFILE");
  525.    info->iterations = 150;
  526.    info->fractal_type = PLASMA;
  527.    info->xmin = -1;
  528.    info->xmax = 1;
  529.    info->ymin = -1;
  530.    info->ymax = 1;
  531.    info->x3rd = -1;
  532.    info->y3rd = -1;
  533.    info->creal = 0;
  534.    info->cimag = 0;
  535.    info->videomodeax=255;
  536.    info->videomodebx=255;
  537.    info->videomodecx=255;
  538.    info->videomodedx=255;
  539.    info->dotmode = 0;
  540.    info->xdots = filexdots;
  541.    info->ydots = fileydots;
  542.    info->colors = filecolors;
  543.    info->version = 0; /* this forces lots more init at calling end too */
  544.  
  545.    /* zero means we won */
  546.    fclose(fp);
  547.    return(0);
  548. }
  549.  
  550. static void load_ext_blk(char far *loadptr,int loadlen)
  551. {
  552.    int len;
  553.    while ((len = fgetc(fp)) > 0) {
  554.       while (--len >= 0) {
  555.      if (--loadlen >= 0)
  556.         *(loadptr++) = fgetc(fp);
  557.      else
  558.         fgetc(fp); /* discard excess characters */
  559.      }
  560.       }
  561. }
  562.  
  563. static void skip_ext_blk(int *block_len, int *data_len)
  564. {
  565.    int len;
  566.    *data_len = 0;
  567.    *block_len = 1;
  568.    while ((len = fgetc(fp)) > 0) {
  569.       fseek(fp,(long)len,SEEK_CUR);
  570.       *data_len += len;
  571.       *block_len += len + 1;
  572.       }
  573. }
  574.  
  575.  
  576. /* switch obsolete fractal types to new generalizations */
  577. static void backwardscompat(struct fractal_info *info)
  578. {
  579.    switch(fractype) {
  580.       case LAMBDASINE:
  581.      fractype = LAMBDATRIGFP;
  582.      trigndx[0] = SIN;
  583.      break;
  584.       case LAMBDACOS    :
  585.      fractype = LAMBDATRIGFP;
  586.      trigndx[0] = COS;
  587.      break;
  588.       case LAMBDAEXP    :
  589.      fractype = LAMBDATRIGFP;
  590.      trigndx[0] = EXP;
  591.      break;
  592.       case MANDELSINE    :
  593.      fractype = MANDELTRIGFP;
  594.      trigndx[0] = SIN;
  595.      break;
  596.       case MANDELCOS    :
  597.      fractype = MANDELTRIGFP;
  598.      trigndx[0] = COS;
  599.      break;
  600.       case MANDELEXP    :
  601.      fractype = MANDELTRIGFP;
  602.      trigndx[0] = EXP;
  603.      break;
  604.       case MANDELSINH    :
  605.      fractype = MANDELTRIGFP;
  606.      trigndx[0] = SINH;
  607.      break;
  608.       case LAMBDASINH    :
  609.      fractype = LAMBDATRIGFP;
  610.      trigndx[0] = SINH;
  611.      break;
  612.       case MANDELCOSH    :
  613.      fractype = MANDELTRIGFP;
  614.      trigndx[0] = COSH;
  615.      break;
  616.       case LAMBDACOSH    :
  617.      fractype = LAMBDATRIGFP;
  618.      trigndx[0] = COSH;
  619.      break;
  620.       case LMANDELSINE    :
  621.      fractype = MANDELTRIG;
  622.      trigndx[0] = SIN;
  623.      break;
  624.       case LLAMBDASINE    :
  625.      fractype = LAMBDATRIG;
  626.      trigndx[0] = SIN;
  627.      break;
  628.       case LMANDELCOS    :
  629.      fractype = MANDELTRIG;
  630.      trigndx[0] = COS;
  631.      break;
  632.       case LLAMBDACOS    :
  633.      fractype = LAMBDATRIG;
  634.      trigndx[0] = COS;
  635.      break;
  636.       case LMANDELSINH    :
  637.      fractype = MANDELTRIG;
  638.      trigndx[0] = SINH;
  639.      break;
  640.       case LLAMBDASINH    :
  641.      fractype = LAMBDATRIG;
  642.      trigndx[0] = SINH;
  643.      break;
  644.       case LMANDELCOSH    :
  645.      fractype = MANDELTRIG;
  646.      trigndx[0] = COSH;
  647.      break;
  648.       case LLAMBDACOSH    :
  649.      fractype = LAMBDATRIG;
  650.      trigndx[0] = COSH;
  651.      break;
  652.       case LMANDELEXP    :
  653.      fractype = MANDELTRIG;
  654.      trigndx[0] = EXP;
  655.      break;
  656.       case LLAMBDAEXP    :
  657.      fractype = LAMBDATRIG;
  658.      trigndx[0] = EXP;
  659.      break;
  660.       case DEMM     :
  661.      fractype = MANDELFP;
  662.      usr_distest = (info->ydots - 1) * 2;
  663.      break;
  664.       case DEMJ     :
  665.      fractype = JULIAFP;
  666.      usr_distest = (info->ydots - 1) * 2;
  667.      break;
  668.       case MANDELLAMBDA :
  669.      useinitorbit = 2;
  670.      break;
  671.       }
  672.    curfractalspecific = &fractalspecific[fractype];
  673. }
  674.