⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 miscovl.c

📁 frasr200的win 版本源码(18.21),使用make文件,使用的vc版本较低,在我的环境下编译有问题! 很不错的分形程序代码!
💻 C
📖 第 1 页 / 共 5 页
字号:
            colorspec[0] = '@';
            sptr = MAP_name;
         }
      }
      else
      if (colorstate == 2)
      {                         /* colors match colorfile */
         colorspec[0] = '@';
         sptr = colorfile;
      }
      else                      /* colors match no .map that we know of */
         colorspec[0] = 'y';
      if (colorspec[0] == '@')
      {
         if ((sptr2 = strrchr(sptr, SLASHC)))
            sptr = sptr2 + 1;
         if ((sptr2 = strrchr(sptr, ':')))
            sptr = sptr2 + 1;
         strncpy(&colorspec[1], sptr, 12);
         colorspec[13] = 0;
      }
   }
   strcpy(inpcommandfile, CommandFile);
   strcpy(inpcommandname, CommandName);
   far_strcpy(inpcomment1, CommandComment1);
   far_strcpy(inpcomment2, CommandComment2);
   far_strcpy(inpcomment3, CommandComment3);
   far_strcpy(inpcomment4, CommandComment4);
   if (CommandName[0] == 0)
      strcpy(inpcommandname, "test");
      /* TW added these  - and Bert moved them */
      pxdots = xdots;
      pydots = ydots;
      vidmode_keyname(videoentry.keynum, vidmde);

      xm = ym = 1;

   while (1)
   {
prompt_user:
      promptnum = 0;
      {
         static char far tmp[] = {"Parameter file"};
         choices[promptnum] = tmp;
      }
      paramvalues[promptnum].type = 0x100 + 56;
      paramvalues[promptnum++].uval.sbuf = inpcommandfile;
      {
         static char far tmp[] = {"Name"};
         choices[promptnum] = tmp;
      }
      paramvalues[promptnum].type = 0x100 + ITEMNAMELEN;
      paramvalues[promptnum++].uval.sbuf = inpcommandname;
      {
         static char far tmp[] = {"Main comment"};
         choices[promptnum] = tmp;
      }
      paramvalues[promptnum].type = 0x100 + 56;
      paramvalues[promptnum++].uval.sbuf = inpcomment1;
      {
         static char far tmp[] = {"Second comment"};
         choices[promptnum] = tmp;
      }
      paramvalues[promptnum].type = 0x100 + 56;;
      paramvalues[promptnum++].uval.sbuf = inpcomment2;
      {
         static char far tmp[] = {"Third comment"};
         choices[promptnum] = tmp;
      }
      paramvalues[promptnum].type = 0x100 + 56;;
      paramvalues[promptnum++].uval.sbuf = inpcomment3;
      {
         static char far tmp[] = {"Fourth comment"};
         choices[promptnum] = tmp;
      }
      paramvalues[promptnum].type = 0x100 + 56;;
      paramvalues[promptnum++].uval.sbuf = inpcomment4;
      if (gotrealdac && !reallyega)
      {
         {
            static char far tmp[] = {"Record colors?"};
            choices[promptnum] = tmp;
         }
         paramvalues[promptnum].type = 0x100 + 13;
         paramvalues[promptnum++].uval.sbuf = colorspec;
         {
            static char far tmp[] = {"    (no | yes for full info | @filename to point to a map file)"};
            choices[promptnum] = tmp;
         }
         paramvalues[promptnum++].type = '*';
         {
            static char far tmp[] = {"# of colors"};
            choices[promptnum] = tmp;
         }
         maxcolorindex = promptnum;
         paramvalues[promptnum].type = 'i';
         paramvalues[promptnum++].uval.ival = maxcolor;
         {
            static char far tmp[] = {"    (if recording full color info)"};
            choices[promptnum] = tmp;
         }
         paramvalues[promptnum++].type = '*';
      }
      {
         static char tmp[] = {""};
         choices[promptnum] = tmp;
      }
      paramvalues[promptnum++].type = '*';

      {
         static char far tmp[] = {"    **** The following is for generating images in pieces ****"};
         choices[promptnum] = tmp;
      }
      paramvalues[promptnum++].type = '*';
      {
         static char far tmp[] = {"X Multiples"};
         choices[promptnum] = tmp;
      }
      piecespromts = promptnum;
      paramvalues[promptnum].type = 'i';
      paramvalues[promptnum++].uval.ival = xm;

      {
         static char far tmp[] = {"Y Multiples"};
         choices[promptnum] = tmp;
      }
      paramvalues[promptnum].type = 'i';
      paramvalues[promptnum++].uval.ival = ym;

#ifndef XFRACT
      {
         static char far tmp[] = {"Video mode"};
         choices[promptnum] = tmp;
      }
      paramvalues[promptnum].type = 0x100 + 4;
      paramvalues[promptnum++].uval.sbuf = vidmde;
#endif

      if (fullscreen_prompt(hdg,promptnum, choices, paramvalues, 0, 0, NULL) < 0)
         break;

      strcpy(CommandFile, inpcommandfile);
      if (strchr(CommandFile, '.') == NULL)
         strcat(CommandFile, ".par");   /* default extension .par */
      strcpy(CommandName, inpcommandname);
      far_strcpy(CommandComment1, inpcomment1);
      far_strcpy(CommandComment2, inpcomment2);
      far_strcpy(CommandComment3, inpcomment3);
      far_strcpy(CommandComment4, inpcomment4);
      if (gotrealdac && !reallyega)
         if (paramvalues[maxcolorindex].uval.ival > 0 &&
             paramvalues[maxcolorindex].uval.ival <= 256)
            maxcolor = paramvalues[maxcolorindex].uval.ival;

      promptnum = piecespromts;
      xm = paramvalues[promptnum++].uval.ival;

      ym = paramvalues[promptnum++].uval.ival;

      /* sanity checks */
      {
      int i;
      long xtotal, ytotal;

      /* get resolution from the video name (which must be valid) */
#ifndef XFRACT
      pxdots = pydots = 0;
      if ((i = check_vidmode_keyname(vidmde)) > 0)
          if ((i = check_vidmode_key(0, i)) >= 0) {
              /* get the resolution of this video mode */
              pxdots = videotable[i].xdots;
              pydots = videotable[i].ydots;
              }
      if (pxdots == 0 ) {
          /* no corresponding video mode! */
          static char far msg[] = {"Invalid video mode entry!"};
          stopmsg(0,msg);
          goto prompt_user;
          }
#endif

      /* bounds range on xm, ym */
      if (xm < 1 || xm > 36 || ym < 1 || ym > 36) {
          static char far msg[] = {"X and Y components must be 1 to 36"};
          stopmsg(0,msg);
          goto prompt_user;
          }

      /* another sanity check: total resolution cannot exceed 65535 */
      xtotal = xm;  ytotal = ym;
      xtotal *= pxdots;  ytotal *= pydots;
      if (xtotal > 65535L || ytotal > 65535L) {
      static char far msg[] = {"Total resolution (X or Y) cannot exceed 65535"};
          stopmsg(0,msg);
          goto prompt_user;
          }
      }

      strcpy(outname, CommandFile);
      gotinfile = 0;
      if (access(CommandFile, 0) == 0)
      {                         /* file exists */
         gotinfile = 1;
         if (access(CommandFile, 6))
         {
            sprintf(buf, s_cantwrite, CommandFile);
            stopmsg(0, buf);
            continue;
         }
         i = strlen(outname);
         while (--i >= 0 && outname[i] != SLASHC)
            outname[i] = 0;
         strcat(outname, "fractint.tmp");
         infile = fopen(CommandFile, "rt");
#ifndef XFRACT
         setvbuf(infile, suffix, _IOFBF, 4096); /* improves speed */
#endif
      }
      if ((parmfile = fopen(outname, "wt")) == NULL)
      {
         sprintf(buf, s_cantcreate, outname);
         stopmsg(0, buf);
         if (gotinfile)
            fclose(infile);
         continue;
      }

      if (gotinfile)
      {
         while (file_gets(buf, 255, infile) >= 0)
         {
            if (strchr(buf, '{')/* entry heading? */
                && sscanf(buf, " %40[^ \t({]", buf2)
                && stricmp(buf2, CommandName) == 0)
            {                   /* entry with same name */
               sprintf(buf2, "File already has an entry named %s\n\
Continue to replace it, Cancel to back out", CommandName);
               if (stopmsg(18, buf2) < 0)
               {                /* cancel */
                  fclose(infile);
                  fclose(parmfile);
                  unlink(outname);
                  goto prompt_user;
               }
               while (strchr(buf, '}') == NULL
                      && file_gets(buf, 255, infile) > 0)
               {
               }                /* skip to end of set */
               break;
            }
            fputs(buf, parmfile);
            fputc('\n', parmfile);
         }
      }
/***** start here*/
      if (xm > 1 || ym > 1)
      {
         if (xxmin != xx3rd || yymin != yy3rd)
            have3rd = 1;
         else
            have3rd = 0;
         if ((fpbat = fopen("makemig.bat", "w")) == NULL)
            xm = ym = 0;
         pdelx  = (xxmax - xx3rd) / (xm * pxdots - 1);   /* calculate stepsizes */
         pdely  = (yymax - yy3rd) / (ym * pydots - 1);
         pdelx2 = (xx3rd - xxmin) / (ym * pydots - 1);
         pdely2 = (yy3rd - yymin) / (xm * pxdots - 1);

         /* save corners */
         pxxmin = xxmin;
         pxxmax = xxmax;
         pyymin = yymin;
         pyymax = yymax;
      }
      for (i = 0; i < xm; i++)  /* columns */
      for (j = 0; j < ym; j++)  /* rows    */
      {
         if (xm > 1 || ym > 1)
         {
            int w;
            char c;
            char PCommandName[80];
            w=0;
            while(w < strlen(CommandName))
            {
               c = CommandName[w];
               if(isspace(c) || c == 0)
                  break;
               PCommandName[w] = c;
               w++;
            }
            PCommandName[w] = 0;
            {
               char buf[20];
               sprintf(buf,"_%c%c",PAR_KEY(i),PAR_KEY(j));
               strcat(PCommandName,buf);
            }
            fprintf(parmfile, "%-19s{",PCommandName);
            xxmin = pxxmin + pdelx*(i*pxdots) + pdelx2*(j*pydots);
            xxmax = pxxmin + pdelx*((i+1)*pxdots - 1) + pdelx2*((j+1)*pydots - 1);
            yymin = pyymax - pdely*((j+1)*pydots - 1) - pdely2*((i+1)*pxdots - 1);
            yymax = pyymax - pdely*(j*pydots) - pdely2*(i*pxdots);
            if (have3rd)
            {
               xx3rd = pxxmin + pdelx*(i*pxdots) + pdelx2*((j+1)*pydots - 1);
               yy3rd = pyymax - pdely*((j+1)*pydots - 1) - pdely2*(i*pxdots);
            }
            else
            {
               xx3rd = xxmin;
               yy3rd = yymin;
            }
            fprintf(fpbat,"Fractint batch=yes overwrite=yes @%s/%s\n",CommandFile,PCommandName);
            fprintf(fpbat,"If Errorlevel 2 goto oops\n");
         }
         else
            fprintf(parmfile, "%-19s{", CommandName);
         if (CommandComment1[0])
            fprintf(parmfile, " ; %Fs", CommandComment1);
         fputc('\n', parmfile);
         {
            char buf[25];
            memset(buf, ' ', 23);
            buf[23] = 0;
            buf[21] = ';';
            if (CommandComment2[0])
               fprintf(parmfile, "%s%Fs\n", buf, CommandComment2);
            if (CommandComment3[0])
               fprintf(parmfile, "%s%Fs\n", buf, CommandComment3);
            if (CommandComment4[0])
               fprintf(parmfile, "%s%Fs\n", buf, CommandComment4);
         }
         write_batch_parms(parmfile, colorspec, maxcolor);   /* write the parameters */
         if(xm > 1 || ym > 1)
         {
            fprintf(parmfile,"  video=%s", vidmde);
            fprintf(parmfile," savename=frmig_%c%c\n", PAR_KEY(i), PAR_KEY(j));
         }
         fprintf(parmfile, "  }\n\n");
      }
      if(xm > 1 || ym > 1)
         {
         fprintf(fpbat,"Fractint makemig=%d/%d\n",xm,ym);
         fprintf(fpbat,"Rem Simplgif fractmig.gif simplgif.gif  in case you need it\n");
         fprintf(fpbat,":oops\n");
         fclose(fpbat);
         }
/*******end here */

      if (gotinfile)
      {                         /* copy the rest of the file */
         while ((i = file_gets(buf, 255, infile)) == 0)
         {
         }                      /* skip blanks */
         while (i >= 0)
         {
            fputs(buf, parmfile);
            fputc('\n', parmfile);
            i = file_gets(buf, 255, infile);
         }
         fclose(infile);
      }
      fclose(parmfile);
      if (gotinfile)
      {                         /* replace the original file with the new */
         unlink(CommandFile);   /* success assumed on these lines       */
         rename(outname, CommandFile);  /* since we checked earlier with
                                         * access */
      }
      break;
   }
   helpmode = oldhelpmode;
   unstackscreen();
   EXIT_OVLY;
}
#ifdef C6
#pragma optimize("e",on)  /* back to normal */
#endif

static struct write_batch_data { /* buffer for parms to break lines nicely */
   int len;
   char buf[513];
   } *wbdata;

void write_batch_parms(FILE *batch,char *colorinf,int maxcolor)
{
   int i,j,k;
   double Xctr, Yctr, Magnification;
   struct write_batch_data wb_data;
   char *sptr;
   char buf[81];

   wbdata = &wb_data;
   wb_data.len = 0; /* force first parm to start on new line */

   if (display3d <= 0) { /* a fractal was generated */

      /****** fractal only parameters in this section *******/
      put_parm(" reset");
      if (save_release!=0) put_parm("=%d",save_release);

      if (*(sptr = curfractalspecific->name) == '*') ++sptr;
      put_parm( s_seqs,s_type,sptr);

      if (fractype == JULIBROT || fractype == JULIBROTFP)
      {
      	 put_parm(" %s=%.15g/%.15g/%.15g/%.15g",
      	     s_julibrotfromto,mxmaxfp,mxminfp,mymaxfp,myminfp);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -