int dooptions(struct Global *global, struct fppTag *tags) { /* * dooptions is called to process command line arguments (-Detc). * It is called only at cpp startup. */ DEFBUF *dp; char end=FALSE; /* end of taglist */ while(tags && !end) { switch(tags->tag) { case FPPTAG_END: end=TRUE; break; case FPPTAG_INITFUNC: global->initialfunc = (char *) tags->data; break; case FPPTAG_DISPLAYFUNCTIONS: global->outputfunctions = TRUEFALSE(tags->data); break; case FPPTAG_RIGHTCONCAT: global->rightconcat = TRUEFALSE(tags->data); break; case FPPTAG_OUTPUTMAIN: global->outputfile = TRUEFALSE(tags->data); break; case FPPTAG_NESTED_COMMENTS: global->nestcomments = TRUEFALSE(tags->data); break; case FPPTAG_WARNMISSINCLUDE: global->warnnoinclude = TRUEFALSE(tags->data); break; case FPPTAG_WARN_NESTED_COMMENTS: global->warnnestcomments = TRUEFALSE(tags->data); break; case FPPTAG_OUTPUTSPACE: global->showspace = TRUEFALSE(tags->data); break; case FPPTAG_OUTPUTBALANCE: global->showbalance = TRUEFALSE(tags->data); break; case FPPTAG_OUTPUTINCLUDES: global->showincluded = TRUEFALSE(tags->data); break; case FPPTAG_IGNOREVERSION: global->showversion = TRUEFALSE(tags->data); break; case FPPTAG_WARNILLEGALCPP: global->warnillegalcpp=TRUEFALSE(tags->data); break; case FPPTAG_OUTPUTLINE: global->outputLINE= TRUEFALSE(tags->data); break; case FPPTAG_KEEPCOMMENTS: if(tags->data) { global->cflag = TRUE; global->keepcomments = TRUE; } break; case FPPTAG_DEFINE: /* * If the option is just "-Dfoo", make it -Dfoo=1 */ { char *symbol=(char *)tags->data; char *text=symbol; while (*text != EOS && *text != '=') text++; if (*text == EOS) text = "1"; else *text++ = EOS; /* * Now, save the word and its definition. */ dp = defendel(global, symbol, FALSE); if(!dp) return(FPP_OUT_OF_MEMORY); dp->repl = savestring(global, text); dp->nargs = DEF_NOARGS; } break; case FPPTAG_IGNORE_NONFATAL: global->eflag = TRUE; break; case FPPTAG_INCLUDE_DIR: if (global->incend >= &global->incdir[NINCLUDE]) { cfatal(global, FATAL_TOO_MANY_INCLUDE_DIRS); return(FPP_TOO_MANY_INCLUDE_DIRS); } *global->incend++ = (char *)tags->data; break; case FPPTAG_INCLUDE_FILE: case FPPTAG_INCLUDE_MACRO_FILE: if (global->included >= NINCLUDE) { cfatal(global, FATAL_TOO_MANY_INCLUDE_FILES); return(FPP_TOO_MANY_INCLUDE_FILES); } global->include[global->included] = (char *)tags->data; global->includeshow[global->included] = (tags->tag == FPPTAG_INCLUDE_FILE); global->included++; break; case FPPTAG_BUILTINS: global->nflag|=(tags->data?NFLAG_BUILTIN:0); break; case FPPTAG_PREDEFINES: global->nflag|=(tags->data?NFLAG_PREDEFINE:0); break; case FPPTAG_IGNORE_CPLUSPLUS: global->cplusplus=!tags->data; break; case FPPTAG_SIZEOF_TABLE: { SIZES *sizp; /* For -S */ int size; /* For -S */ int isdatum; /* FALSE for -S* */ int endtest; /* For -S */ char *text=(char *)tags->data; sizp = size_table; if (isdatum = (*text != '*')) /* If it's just -S, */ endtest = T_FPTR; /* Stop here */ else { /* But if it's -S* */ text++; /* Step over '*' */ endtest = 0; /* Stop at end marker */ } while (sizp->bits != endtest && *text != EOS) { if (!isdigit(*text)) { /* Skip to next digit */ text++; continue; } size = 0; /* Compile the value */ while (isdigit(*text)) { size *= 10; size += (*text++ - '0'); } if (isdatum) sizp->size = size; /* Datum size */ else sizp->psize = size; /* Pointer size */ sizp++; } if (sizp->bits != endtest) cwarn(global, WARN_TOO_FEW_VALUES_TO_SIZEOF, NULL); else if (*text != EOS) cwarn(global, WARN_TOO_MANY_VALUES_TO_SIZEOF, NULL); } break; case FPPTAG_UNDEFINE: if (defendel(global, (char *)tags->data, TRUE) == NULL) cwarn(global, WARN_NOT_DEFINED, tags->data); break; case FPPTAG_OUTPUT_DEFINES: global->wflag++; break; case FPPTAG_INPUT_NAME: strcpy(global->work, tags->data); /* Remember input filename */ global->first_file=tags->data; break; case FPPTAG_INPUT: global->input=(char *(*)(char *, int, void *))tags->data; break; case FPPTAG_OUTPUT: global->output=(void (*)(int, void *))tags->data; break; case FPPTAG_ERROR: global->error=(void (*)(void *, char *, va_list))tags->data; break; case FPPTAG_USERDATA: global->userdata=tags->data; break; case FPPTAG_LINE: global->linelines= TRUEFALSE(tags->data); break; case FPPTAG_EXCLFUNC: global->excludedinit[ global->excluded++ ] = (char *)tags->data; break; default: cwarn(global, WARN_INTERNAL_ERROR, NULL); break; } tags++; } return(0); }
nglString nuiMetaPainter::GetOperationDescription(int32 OperationIndex) const { nglString str = _T("???"); mOperationPos = GetOffsetFromOperationIndex(OperationIndex); OpCode code = FetchOpCode(); switch (code) { case eSetSize: { int32 w = FetchInt(); int32 h = FetchInt(); str.CFormat(_T("SetSize(%d, %d)"), w, h); } break; case eStartRendering: { nuiSize x, y; FetchFloat(x); FetchFloat(y); str.CFormat(_T("StartRendering(%f, %f)"), x, y); } break; case eSetState: { //FetchPointer(); FetchInt(); bool force = FetchInt(); str.CFormat(_T("SetState(%s)"), TRUEFALSE(force)); } break; case eDrawArray: { //nuiRenderArray* pArray = (nuiRenderArray*)FetchPointer(); int32 index = FetchInt(); nuiRenderArray* pArray = mRenderArrays[index]; const nglChar* pMode = GetGLMode(pArray->GetMode()); float bounds[6]; pArray->GetBounds(bounds); str.CFormat(_T("DrawArray 0x%x (size %d mode:%s) (%f , %f)->(%f, %f)"), pArray, pArray->GetVertices().size(), pMode, bounds[0], bounds[1], bounds[3], bounds[4]); } break; case eClear: { int32 v = FetchInt(); bool color = v & 1; bool depth = v & 2; bool stencil = v & 4; str.CFormat("Clear(color = %s, depth = %s, stencil = %s)", TRUEFALSE(color), TRUEFALSE(depth), TRUEFALSE(stencil)); } break; case eBeginSession: str = _T("BeginSession"); break; case eEndSession: str = _T("EndSession"); break; case eDrawChild: { nuiWidget* pS = (nuiWidget*)FetchPointer(); nglString clss(pS->GetObjectClass()); nglString name(pS->GetObjectName()); str.CFormat(_T("DrawChild 0x%x / '%s - %s'"), pS, clss.GetChars(), name.GetChars()); } break; case eLoadMatrix: { nuiMatrix m; FetchBuffer(m.Array, sizeof(nuiSize), 16); nglString v; m.GetValue(v); str = _T("LoadMatrix") + v; } break; case eMultMatrix: { nuiMatrix m; FetchBuffer(m.Array, sizeof(nuiSize), 16); nglString v; m.GetValue(v); str = _T("MultMatrix") + v; } break; case ePopMatrix: str = _T("PopMatrix"); break; case ePushMatrix: str = _T("PushMatrix"); break; case eLoadProjectionMatrix: { nuiMatrix m; nuiSize a, b, c, d; FetchFloat(a); FetchFloat(b); FetchFloat(c); FetchFloat(d); FetchBuffer(m.Array, sizeof(nuiSize), 16); nglString v; m.GetValue(v); str.CFormat(_T("LoadProjectionMatrix(%f, %f, %f, %f) / %s"), a, b, c, d, v.GetChars()); } break; case eMultProjectionMatrix: { nuiMatrix m; FetchBuffer(m.Array, sizeof(nuiSize), 16); nglString v; m.GetValue(v); str = _T("MultProjectionMatrix") + v; } break; case ePopProjectionMatrix: str = _T("PopProjectionMatrix"); break; case ePushProjectionMatrix: str = _T("PushProjectionMatrix"); break; case ePushClipping: str = _T("PushClipping"); break; case ePopClipping: str = _T("PopClipping"); break; case eClip: { nuiSize a, b, c, d; FetchFloat(a); FetchFloat(b); FetchFloat(c); FetchFloat(d); str.CFormat(_T("Clip(%f, %f, %f, %f)"), a, b, c, d); } break; case eResetClipRect: str = _T("ResetClipRect"); break; case eEnableClipping: str.CFormat(_T("EnableClipping(%s)"), TRUEFALSE(FetchInt())); break; case eBreak: str = _T("Break"); break; default: str.CFormat(_T("Unknown operation %d"), code); break; } return nglString().Add(OperationIndex).Add(_T(": ")).Add(str); }