📄 cmdfiles.c
字号:
/*
Command-line / Command-File Parser Routines
This module is linked as an overlay, use ENTER_OVLY and EXIT_OVLY.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <float.h>
#include <ctype.h>
#include <time.h>
#ifndef XFRACT
#include <bios.h>
#endif
#include "fractint.h"
#include "fractype.h"
#ifdef __TURBOC__
#include <dir.h>
#endif
#include "prototyp.h"
#ifdef XFRACT
#define DEFAULT_PRINTER 5 /* Assume a Postscript printer */
#define PRT_RESOLUTION 100 /* Assume medium resolution */
#define INIT_GIF87 0 /* Turn on GIF 89a processing */
#else
#define DEFAULT_PRINTER 2 /* Assume an IBM/Epson printer */
#define PRT_RESOLUTION 60 /* Assume low resolution */
#define INIT_GIF87 0 /* Turn on GIF 89a processing */
#endif
static int cmdfile(FILE *,int);
static int next_command(char *,int,FILE *,char *,int *,int);
static int next_line(FILE *,char *,int);
int cmdarg(char *,int);
static void argerror(char *);
static void initvars_run(void);
static void initvars_restart(void);
static void initvars_fractal(void);
static void initvars_3d(void);
static void reset_ifs_defn(void);
static void parse_textcolors(char *value);
static int parse_colors(char *value);
static int parse_printer(char *value);
/* variables defined by the command line/files processor */
int showdot; /* color to show crawling graphics cursor */
char temp1[256]; /* temporary strings */
char readname[80]; /* name of fractal input file */
char gifmask[13] = {""};
char PrintName[80]={"fract001.prn"}; /* Name for print-to-file */
char savename[80]={"fract001"}; /* save files using this name */
char autoname[80]={"auto.key"}; /* record auto keystrokes here */
int potflag=0; /* continuous potential enabled? */
int pot16bit; /* store 16 bit continuous potential values */
int gif87a_flag; /* 1 if GIF87a format, 0 otherwise */
int dither_flag; /* 1 if want to dither GIFs */
int askvideo; /* flag for video prompting */
char floatflag;
int biomorph; /* flag for biomorph */
int usr_biomorph;
int forcesymmetry; /* force symmetry */
int showfile; /* zero if file display pending */
int rflag, rseed; /* Random number seeding flag and value */
int decomp[2]; /* Decomposition coloring */
int distest;
int distestwidth;
char overwrite = 0; /* 0 if file overwrite not allowed */
int soundflag; /* 0 if sound is off, 1 if on */
int basehertz; /* sound=x/y/x hertz value */
int debugflag; /* internal use only - you didn't see this */
int timerflag; /* you didn't see this, either */
int cyclelimit; /* color-rotator upper limit */
int inside; /* inside color: 1=blue */
int fillcolor; /* fillcolor: -1=normal */
int outside; /* outside color */
int finattract; /* finite attractor logic */
int display3d; /* 3D display flag: 0 = OFF */
int overlay3d; /* 3D overlay flag: 0 = OFF */
int init3d[20]; /* '3d=nn/nn/nn/...' values */
int initbatch; /* 1 if batch run (no kbd) */
unsigned initsavetime; /* autosave minutes */
double initorbit[2]; /* initial orbitvalue */
char useinitorbit; /* flag for initorbit */
int initmode; /* initial video mode */
int initcyclelimit; /* initial cycle limit */
BYTE usemag; /* use center-mag corners */
int bailout; /* user input bailout value */
double inversion[3]; /* radius, xcenter, ycenter */
int rotate_lo,rotate_hi; /* cycling color range */
int far *ranges; /* iter->color ranges mapping */
int rangeslen = 0; /* size of ranges array */
char far *mapdacbox = NULL; /* map= (default colors) */
int colorstate; /* 0, dacbox matches default (bios or map=) */
/* 1, dacbox matches no known defined map */
/* 2, dacbox matches the colorfile map */
int colorpreloaded; /* if dacbox preloaded for next mode select */
int save_release; /* release creating PAR file*/
extern int calc_status;
extern int Targa_Overlay;
int Targa_Out = 0;
char colorfile[80]; /* from last <l> <s> or colors=@filename */
int functionpreloaded; /* if function loaded for new bifs, JCO 7/5/92 */
float screenaspect = DEFAULTASPECT; /* aspect ratio of the screen */
/* TARGA+ variables */
int TPlusFlag; /* Use the TARGA+ if found */
int MaxColorRes; /* Default Color Resolution if available */
int PixelZoom; /* TPlus Zoom Level */
int NonInterlaced; /* Non-Interlaced video flag */
/* 3D Transparency Variables, MCP 5-30-91 */
double xcoord, ycoord, zcoord, tcoord;
double zzmin, zzmax; /* initial depth corner values */
double ttmin, ttmax; /* initial time coordinates */
int Transparent3D, SolidCore, MultiDrawing;
int tpdepth, tptime;
unsigned CoreRed, CoreGreen, CoreBlue, NumFrames;
/* AntiAliasing variables, MCP 6-6-91 */
int AntiAliasing, Shadowing;
/* Julibrot variables TIW 1/24/93 */
extern double mxmaxfp, mxminfp, mymaxfp, myminfp, originfp;
extern double depthfp, heightfp, widthfp, distfp, eyesfp;
extern int zdots;
extern int lastorbittype, neworbittype;
extern char *juli3Doptions[];
extern int juli3Dmode;
extern struct moreparams far moreparams[];
/* inverse julia methods. MVS 3/15/93 */
extern int major_method;
extern int minor_method;
int orbitsave = 0; /* for IFS and LORENZ to output acrospin file */
int orbit_delay; /* clock ticks delating orbit release */
extern int invert;
extern int fractype; /* fractal type */
extern double param[]; /* initial parameters */
extern double xxmin,xxmax; /* initial corner values */
extern double yymin,yymax; /* initial corner values */
extern double xx3rd,yy3rd; /* initial corner values */
extern char usr_stdcalcmode; /* '1', '2', 'g', 'b' */
extern int maxit; /* max iterations */
extern int usr_periodicitycheck; /* periodicity checking 1=on,0=off */
extern char usr_floatflag; /* flag for float calcs */
extern int usr_distest; /* nonzero if distance estimator option */
extern char color_lakes; /* finite attractor flag */
extern int haze;
extern int RANDOMIZE;
extern int Ambient;
extern char light_name[];
extern int BRIEF;
extern int RAY;
extern int release;
extern BYTE back_color[];
extern BYTE dacbox[256][3];
extern struct videoinfo far videotable[];
extern int fpu;
extern int iit;
extern double potparam[]; /* potential parameters */
extern int Printer_Resolution, LPTNumber,
Printer_Type, Printer_Titleblock,
Printer_ColorXlat, Printer_SetScreen,
Printer_SFrequency, Printer_SAngle, Printer_SStyle,
Printer_RFrequency, Printer_RAngle, Printer_RStyle,
Printer_GFrequency, Printer_GAngle, Printer_GStyle,
Printer_BFrequency, Printer_BAngle, Printer_BStyle,
Printer_Compress,
EPSFileType, ColorPS,
Print_To_File,Printer_CRLF; /* for printer functions */
int transparent[2]; /* transparency min/max values */
int LogFlag; /* Logarithmic palette flag: 0 = no */
BYTE exitmode = 3; /* video mode on exit */
extern int video_type;
extern int svga_type; /* for forcing a specific SVGA adapter */
extern int mode7text;
extern int textsafe;
extern int vesa_detect;
char ai_8514; /* Flag for using 8514a afi JCO 4/11/92 */
int bios_palette; /* set to 1 to force BIOS palette updates */
int escape_exit; /* set to 1 to avoid the "are you sure?" screen */
extern int viewwindow;
extern float viewreduction;
extern int viewcrop;
extern float finalaspectratio;
extern int viewxdots,viewydots;
extern char MAP_name[];
extern int mapset;
extern int eyeseparation; /* Occular Separation */
extern int glassestype;
extern int xadjust; /* Convergence */
extern int yadjust;
extern int xtrans, ytrans; /* X,Y shift with no perspective */
extern int red_crop_left, red_crop_right;
extern int blue_crop_left, blue_crop_right;
extern int red_bright, blue_bright;
extern char showbox; /* flag to show box and vector in preview */
extern char preview; /* 3D preview mode flag */
extern int previewfactor; /* Coarsness */
int first_init=1; /* first time into cmdfiles? */
static int init_rseed;
static char initcorners,initparams;
struct fractalspecificstuff far *curfractalspecific;
char FormFileName[80]; /* file to find (type=)formulas in */
char FormName[ITEMNAMELEN+1]; /* Name of the Formula (if not null) */
char LFileName[80]; /* file to find (type=)L-System's in */
char LName[ITEMNAMELEN+1]; /* Name of L-System */
char CommandFile[80]; /* file to find command sets in */
char CommandName[ITEMNAMELEN+1];/* Name of Command set */
char far CommandComment1[57]; /* comments for command set */
char far CommandComment2[57];
char far CommandComment3[57];
char far CommandComment4[57];
char IFSFileName[80]; /* file to find (type=)IFS in */
char IFSName[ITEMNAMELEN+1]; /* Name of the IFS def'n (if not null) */
float far *ifs_defn = NULL; /* ifs parameters */
int ifs_changed; /* nonzero if parameters have been edited */
int ifs_type; /* 0=2d, 1=3d */
int slides = 0; /* 1 autokey=play, 2 autokey=record */
BYTE txtcolor[]={
BLUE*16+L_WHITE, /* C_TITLE title background */
BLUE*16+L_GREEN, /* C_TITLE_DEV development vsn foreground */
GREEN*16+YELLOW, /* C_HELP_HDG help page title line */
WHITE*16+BLACK, /* C_HELP_BODY help page body */
GREEN*16+GRAY, /* C_HELP_INSTR help page instr at bottom */
WHITE*16+BLUE, /* C_HELP_LINK help page links */
CYAN*16+BLUE, /* C_HELP_CURLINK help page current link */
WHITE*16+GRAY, /* C_PROMPT_BKGRD prompt/choice background */
WHITE*16+BLACK, /* C_PROMPT_TEXT prompt/choice extra info */
BLUE*16+WHITE, /* C_PROMPT_LO prompt/choice text */
BLUE*16+L_WHITE, /* C_PROMPT_MED prompt/choice hdg2/... */
BLUE*16+YELLOW, /* C_PROMPT_HI prompt/choice hdg/cur/... */
GREEN*16+L_WHITE, /* C_PROMPT_INPUT fullscreen_prompt input */
CYAN*16+L_WHITE, /* C_PROMPT_CHOOSE fullscreen_prompt choice */
MAGENTA*16+L_WHITE, /* C_CHOICE_CURRENT fullscreen_choice input */
BLACK*16+WHITE, /* C_CHOICE_SP_INSTR speed key bar & instr */
BLACK*16+L_MAGENTA, /* C_CHOICE_SP_KEYIN speed key value */
WHITE*16+BLUE, /* C_GENERAL_HI tab, thinking, IFS */
WHITE*16+BLACK, /* C_GENERAL_MED */
WHITE*16+GRAY, /* C_GENERAL_LO */
BLACK*16+L_WHITE, /* C_GENERAL_INPUT */
WHITE*16+BLACK, /* C_DVID_BKGRD disk video */
BLACK*16+YELLOW, /* C_DVID_HI */
BLACK*16+L_WHITE, /* C_DVID_LO */
RED*16+L_WHITE, /* C_STOP_ERR stop message, error */
GREEN*16+BLACK, /* C_STOP_INFO stop message, info */
BLUE*16+WHITE, /* C_TITLE_LOW bottom lines of title screen */
GREEN*16+BLACK, /* C_AUTHDIV1 title screen dividers */
GREEN*16+GRAY, /* C_AUTHDIV2 title screen dividers */
BLACK*16+L_WHITE, /* C_PRIMARY primary authors */
BLACK*16+WHITE /* C_CONTRIB contributing authors */
};
extern int active_system;
/* start of string literals cleanup */
char s_iter[] = "iter";
char s_real[] = "real";
char s_mult[] = "mult";
char s_sum[] = "summ";
char s_imag[] = "imag";
char s_zmag[] = "zmag";
char s_bof60[] = "bof60";
char s_bof61[] = "bof61";
char s_maxiter[] = "maxiter";
char s_epscross[] = "epsiloncross";
char s_startrail[] = "startrail";
char s_normal[] = "normal";
char s_period[] = "period";
char *s_16bit= "16bit";
char *s_387= "387";
char *s_3d= "3d";
char *s_3dmode= "3dmode";
char *s_adapter= "adapter";
char *s_afi= "afi";
char *s_ambient= "ambient";
char *s_antialias= "antialias";
char *s_askvideo= "askvideo";
char *s_autokey= "autokey";
char *s_autokeyname= "autokeyname";
char *s_background= "background";
char *s_bailout= "bailout";
char *s_batch= "batch";
char *s_biomorph= "biomorph";
char *s_biospalette= "biospalette";
char *s_brief= "brief";
char *s_bright= "bright";
char *s_centermag= "center-mag";
char *s_cga= "cga";
char *s_coarse= "coarse";
char *s_colorps= "colorps";
char *s_colors= "colors";
char *s_comport= "comport";
char *s_converge= "converge";
char *s_corecolor= "corecolor";
char *s_corners= "corners";
char *s_cr= "cr";
char *s_crlf= "crlf";
char *s_crop= "crop";
char *s_cyclelimit= "cyclelimit";
char *s_cyclerange= "cyclerange";
char *s_debug= "debug";
char *s_debugflag= "debugflag";
char *s_decomp= "decomp";
char *s_distest= "distest";
char *s_dither= "dither";
char *s_ega= "ega";
char *s_egamono= "egamono";
char *s_epsf= "epsf";
char *s_exitmode= "exitmode";
char *s_exitnoask= "exitnoask";
char *s_filename= "filename";
char *s_fillcolor= "fillcolor";
char *s_filltype= "filltype";
char *s_finattract= "finattract";
char *s_float= "float";
char *s_formulafile= "formulafile";
char *s_formulaname= "formulaname";
char *s_fpu= "fpu";
char *s_fract001prn= "fract001.prn";
char *s_fullcolor= "fullcolor";
char *s_function= "function";
char *s_gif87a= "gif87a";
char *s_halftone= "halftone";
char *s_haze= "haze";
char *s_hertz= "hertz";
char *s_hgc= "hgc";
char *s_ifs= "ifs";
char *s_ifs3d= "ifs3d";
char *s_ifsfile= "ifsfile";
char *s_iit= "iit";
char *s_initorbit= "initorbit";
char *s_inside= "inside";
char *s_interocular= "interocular";
char *s_invert= "invert";
char *s_iterincr= "iterincr";
char *s_julibrot3d= "julibrot3d";
char *s_julibroteyes= "julibroteyes";
char *s_julibrotfromto= "julibrotfromto";
char *s_latitude= "latitude";
char *s_lf= "lf";
char *s_lfile= "lfile";
char *s_lightname= "lightname";
char *s_lightsource= "lightsource";
char *s_linefeed= "linefeed";
char *s_lname= "lname";
char *s_logmap= "logmap";
char *s_longitude= "longitude";
char *s_makedoc= "makedoc";
char *s_makemig= "makemig";
char *s_map= "map";
char *s_maxcolorres= "maxcolorres";
char *s_mcga= "mcga";
char *s_mdcorners= "mdcorners";
char *s_miim= "miim";
char *s_mono= "mono";
char *s_noiit= "noiit";
char *s_none= "none";
char *s_noninterlaced= "noninterlaced";
char *s_numframes= "numframes";
char *s_orbitdelay= "orbitdelay";
char *s_orbitname= "orbitname";
char *s_orbitsave= "orbitsave";
char *s_origin= "origin";
char *s_outside= "outside";
char *s_overlay= "overlay";
char *s_overwrite= "overwrite";
char *s_params= "params";
char *s_parmfile= "parmfile";
char *s_passes= "passes";
char *s_periodicity= "periodicity";
char *s_perspective= "perspective";
char *s_pi= "pi";
char *s_pixel= "pixel";
char *s_pixelzoom= "pixelzoom";
char *s_play= "play";
char *s_plotstyle= "plotstyle";
char *s_potential= "potential";
char *s_preview= "preview";
char *s_printer= "printer";
char *s_printfile= "printfile";
char *s_radius= "radius";
char *s_ramvideo= "ramvideo";
char *s_randomize= "randomize";
char *s_ranges= "ranges";
char *s_ray= "ray";
char *s_record= "record";
char *s_release= "release";
char *s_reset= "reset";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -