📄 parserfp.c
字号:
&& ftst != dStkGT
&& ftst != dStkGTE
&& ftst != dStkNE
&& ftst != dStkEQ
&& ftst != dStkAND
&& ftst != dStkOR ){
stopmsg(0, "Fast failure, using old code" );
return 1; /* Use old code */
}
}
#ifdef TESTFP
if (lastsqrused) {
stopmsg(0, "LastSqr used" );
}
else {
stopmsg(0, "LastSqr not used" );
}
#endif
if (f[LastOp-1] != StkClr ){ /* some formulas don't clear at the end! */
#ifdef TESTFP
stopmsg (0, "clr added at end" );
#endif
f[LastOp++] = StkClr;
}
prevfptr = (void (near *)(void))0;
prevstkcnt = 999; /* there was not previous stk cnt */
stkcnt = cvtptrx = 0;
for (OpPtr = LodPtr = StoPtr = 0; OpPtr < LastOp; OpPtr++) {
ftst = f[OpPtr];
if (ftst == StkLod ) {
#ifdef TESTFP
stopmsg(0, "lod,0,TWO_FREE,2" );
#endif
CvtFptr(fStkLod, 0, TWO_FREE, 2 );
continue;
}
if (ftst == StkClr ) {
if (OpPtr == LastOp - 1 ){
#ifdef TESTFP
stopmsg(0, "clr2,0,MAX_STACK,999" );
#endif
CvtFptr(fStkClr2, 0, MAX_STACK, 999 );
} else {
#ifdef TESTFP
stopmsg(0, "clr1,0,MAX_STACK,999" );
#endif
CvtFptr(fStkClr1, 0, MAX_STACK, 999 );
}
continue;
}
if (ftst == dStkAdd ) {
#ifdef TESTFP
stopmsg(0, "add,4,MAX_STACK,-2" );
#endif
CvtFptr(fStkAdd, 4, MAX_STACK, -2 );
continue;
}
if (ftst == dStkSub ) {
#ifdef TESTFP
stopmsg(0, "sub,4,MAX_STACK,-2" );
#endif
CvtFptr(fStkSub, 4, MAX_STACK, -2 );
continue;
}
if (ftst == dStkDiv ) {
#ifdef TESTFP
stopmsg(0, "div,4,TWO_FREE,-2" );
#endif
CvtFptr(fStkDiv, 4, TWO_FREE, -2 );
continue;
}
if (ftst == dStkMul ) {
#ifdef TESTFP
stopmsg(0, "mul,4,TWO_FREE,-2" );
#endif
CvtFptr(fStkMul, 4, TWO_FREE, -2 );
continue;
}
if (ftst == StkSto ) {
#ifdef TESTFP
stopmsg(0, "sto,2,MAX_STACK,0" );
#endif
CvtFptr(fStkSto, 2, MAX_STACK, 0 );
continue;
}
if (ftst == dStkSqr ) {
#ifdef TESTFP
stopmsg(0, "sqr,2,TWO_FREE,0" );
#endif
CvtFptr(fStkSqr, 2, TWO_FREE, 0 );
continue;
}
if (ftst == EndInit) {
#ifdef TESTFP
stopmsg(0, "endinit,0,MAX_STACK,999" );
#endif
CvtFptr(fStkEndInit, 0, MAX_STACK, 999 );
continue;
}
if (ftst == dStkMod ) {
#ifdef TESTFP
stopmsg(0, "mod,2,MAX_STACK,0" );
#endif
CvtFptr(fStkMod, 2, MAX_STACK, 0 );
continue;
}
if (ftst == dStkLTE ) {
#ifdef TESTFP
stopmsg(0, "LTE,4,MAX_STACK,-2" );
#endif
CvtFptr(fStkLTE, 4, MAX_STACK, -2 );
continue;
}
if (ftst == dStkSin ) {
#ifdef TESTFP
stopmsg(0, "sin,2,TWO_FREE,0" );
#endif
CvtFptr(fStkSin, 2, TWO_FREE, 0 );
continue;
}
if (ftst == dStkCos ) {
#ifdef TESTFP
stopmsg(0, "cos,2,TWO_FREE,0" );
#endif
CvtFptr(fStkCos, 2, TWO_FREE, 0 );
continue;
}
if (ftst == dStkSinh ) {
#ifdef TESTFP
stopmsg(0, "sinh,2,TWO_FREE,0" );
#endif
CvtFptr(fStkSinh, 2, TWO_FREE, 0 );
continue;
}
if (ftst == dStkCosh ) {
#ifdef TESTFP
stopmsg(0, "cosh,2,TWO_FREE,0" );
#endif
CvtFptr(fStkCosh, 2, TWO_FREE, 0 );
continue;
}
if (ftst == dStkCosXX ) {
#ifdef TESTFP
stopmsg(0, "cosxx,2,TWO_FREE,0" );
#endif
CvtFptr(fStkCosXX, 2, TWO_FREE, 0 );
continue;
}
if (ftst == dStkTan ) {
#ifdef TESTFP
stopmsg(0, "tan,2,TWO_FREE,0" );
#endif
CvtFptr(fStkTan, 2, TWO_FREE, 0 );
continue;
}
if (ftst == dStkTanh ) {
#ifdef TESTFP
stopmsg(0, "tanh,2,TWO_FREE,0" );
#endif
CvtFptr(fStkTanh, 2, TWO_FREE, 0 );
continue;
}
if (ftst == dStkCoTan ) {
#ifdef TESTFP
stopmsg(0, "cotan,2,TWO_FREE,0" );
#endif
CvtFptr(fStkCoTan, 2, TWO_FREE, 0 );
continue;
}
if (ftst == dStkCoTanh ) {
#ifdef TESTFP
stopmsg(0, "cotanh,2,TWO_FREE,0" );
#endif
CvtFptr(fStkCoTanh, 2, TWO_FREE, 0 );
continue;
}
if (ftst == dStkExp ) {
#ifdef TESTFP
stopmsg(0, "exp,2,TWO_FREE,0" );
#endif
CvtFptr(fStkExp, 2, TWO_FREE, 0 );
continue;
}
if (ftst == dStkLog ) {
#ifdef TESTFP
stopmsg(0, "log,2,TWO_FREE,0" );
#endif
CvtFptr(fStkLog, 2, TWO_FREE, 0 );
continue;
}
if (ftst == dStkPwr ) {
#ifdef TESTFP
stopmsg(0, "pwr,4,TWO_FREE,-2" );
#endif
CvtFptr(fStkPwr, 4, TWO_FREE, -2 );
continue;
}
if (ftst == dStkLT ) {
#ifdef TESTFP
stopmsg(0, "LT,4,MAX_STACK,-2" );
#endif
CvtFptr(fStkLT, 4, MAX_STACK, -2 );
continue;
}
if (ftst == dStkFlip ) {
#ifdef TESTFP
stopmsg(0, "flip,2,MAX_STACK,0" );
#endif
CvtFptr(fStkFlip, 2, MAX_STACK, 0 );
continue;
}
if (ftst == dStkReal ) {
#ifdef TESTFP
stopmsg(0, "real,2,MAX_STACK,0" );
#endif
CvtFptr(fStkReal, 2, MAX_STACK, 0 );
continue;
}
if (ftst == dStkImag ) {
#ifdef TESTFP
stopmsg(0, "imag,2,MAX_STACK,0" );
#endif
CvtFptr(fStkImag, 2, MAX_STACK, 0 );
continue;
}
if (ftst == dStkConj ) {
#ifdef TESTFP
stopmsg(0, "conj,2,MAX_STACK,0" );
#endif
CvtFptr(fStkConj, 2, MAX_STACK, 0 );
continue;
}
if (ftst == dStkNeg ) {
#ifdef TESTFP
stopmsg(0, "neg,2,MAX_STACK,0" );
#endif
CvtFptr(fStkNeg, 2, MAX_STACK, 0 );
continue;
}
if (ftst == dStkAbs ) {
#ifdef TESTFP
stopmsg(0, "abs,2,MAX_STACK,0" );
#endif
CvtFptr(fStkAbs, 2, MAX_STACK, 0 );
continue;
}
if (ftst == dStkRecip ) {
#ifdef TESTFP
stopmsg(0, "recip,2,TWO_FREE,0" );
#endif
CvtFptr(fStkRecip, 2, TWO_FREE, 0 );
continue;
}
if (ftst == StkIdent ) {
#ifdef TESTFP
stopmsg(0, "ident skipped" );
#endif
/* don't bother converting this one */
continue;
}
if (ftst == dStkGT ) {
#ifdef TESTFP
stopmsg(0, "GT,4,MAX_STACK,-2" );
#endif
CvtFptr(fStkGT, 4, MAX_STACK, -2 );
continue;
}
if (ftst == dStkGTE ) {
#ifdef TESTFP
stopmsg(0, "GTE,4,MAX_STACK,-2" );
#endif
CvtFptr(fStkGTE, 4, MAX_STACK, -2 );
continue;
}
if (ftst == dStkEQ ) {
#ifdef TESTFP
stopmsg(0, "EQ,4,MAX_STACK,-2" );
#endif
CvtFptr(fStkEQ, 4, MAX_STACK, -2 );
continue;
}
if (ftst == dStkNE ) {
#ifdef TESTFP
stopmsg(0, "NE,4,MAX_STACK,-2" );
#endif
CvtFptr(fStkNE, 4, MAX_STACK, -2 );
continue;
}
if (ftst == dStkOR ) {
#ifdef TESTFP
stopmsg(0, "OR,4,MAX_STACK,-2" );
#endif
CvtFptr(fStkOR, 4, MAX_STACK, -2 );
continue;
}
if (ftst == dStkAND ) {
#ifdef TESTFP
stopmsg(0, "AND,4,MAX_STACK,-2" );
#endif
CvtFptr(fStkAND, 4, MAX_STACK, -2 );
continue;
}
stopmsg(0, "Fast failure, using old code." );
return 1; /* this should never happen but is not fatal now */
}
if (debugflag == 322 ){
/* skip these optimizations too */
goto skipfinalopt;
} /* ---------------------------------- final optimizations ---- */
ntst = fgf(cvtptrx-2 ); /* cvtptrx -> one past last operator (clr2) */
if (ntst == fStkLT ){
#ifdef TESTFP
stopmsg (0, "LT Clr2 -> LT2" );
#endif
--cvtptrx;
fgf(cvtptrx-1) = fStkLT2;
}
else if (ntst == fStkLodLT ){
#ifdef TESTFP
stopmsg (0, "LodLT Clr2 -> LodLT2" );
#endif
--cvtptrx;
fgf(cvtptrx-1) = fStkLodLT2;
}
else if (ntst == fStkLTE ){
#ifdef TESTFP
stopmsg (0, "LTE Clr2 -> LTE2" );
#endif
--cvtptrx;
fgf(cvtptrx-1) = fStkLTE2;
}
else if (ntst == fStkLodLTE ){
#ifdef TESTFP
stopmsg (0, "LodLTE Clr2 -> LodLTE2" );
#endif
--cvtptrx;
fgf(cvtptrx-1) = fStkLodLTE2;
}
else if (ntst == fStkGT ){
#ifdef TESTFP
stopmsg (0, "GT Clr2 -> GT2" );
#endif
--cvtptrx;
fgf(cvtptrx-1) = fStkGT2;
}
else if (ntst == fStkLodGT ){
#ifdef TESTFP
stopmsg (0, "LodGT Clr2 -> LodGT2" );
#endif
--cvtptrx;
fgf(cvtptrx-1) = fStkLodGT2;
}
else if (ntst == fStkLodGTE ){
#ifdef TESTFP
stopmsg (0, "LodGTE Clr2 -> LodGTE2" );
#endif
--cvtptrx;
fgf(cvtptrx-1) = fStkLodGTE2;
}
else if (fgf(cvtptrx-2 ) == fStkAND ){
#ifdef TESTFP
stopmsg (0, "AND Clr2 -> ANDClr2" );
#endif
--cvtptrx;
fgf(cvtptrx-1) = fStkANDClr2;
ntst = fgf(cvtptrx-2);
if (ntst == fStkLodLTE ){
#ifdef TESTFP
stopmsg (0, "LodLTE ANDClr2 -> LodLTEAnd2" );
#endif
--cvtptrx;
fgf(cvtptrx-1) = fStkLodLTEAnd2;
}
}
skipfinalopt: /* ---------------- end of final optimizations ----- */
LastOp = cvtptrx; /* save the new operator count */
LastSqr.d.y = 0.0; /* do this once per image */
/* now change the pointers */
if (FormName[0] != 0 ){ /* but only if parse succeeded */
curfractalspecific->per_pixel = fform_per_pixel;
curfractalspecific->orbitcalc = fFormula;
}
else {
curfractalspecific->per_pixel = BadFormula;
curfractalspecific->orbitcalc = BadFormula;
}
Img_Setup(); /* call assembler setup code */
return 1;
}
#endif /* XFRACT */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -