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