void restoreAllPhaseSymbolData(PhaseSymbolDataList psdl) { while (psdl) { Symbol sym = car(psdl)->sym; symCoInfo(sym)->phaseVal.generic = car(psdl)->data; psdl = listFreeCons(PhaseSymbolData)(psdl); } }
AbSynList abqParseLines(StringList lines) { AbSynList result = listNil(AbSyn); while (lines != listNil(String)) { result = listCons(AbSyn)(abqParse(car(lines)), result); lines = listFreeCons(String)(lines); } return listNReverse(AbSyn)(result); }
/* * Open a file, looking first in the current directory, then * in the list of include directories. */ local FileName inclFind(String fname, String curdir) { StringList dl; FileName fn; dl = listCons(String)(curdir, incSearchPath()); fn = fileRdFind(dl, fname, FTYPE_SRC); listFreeCons(String)(dl); return fn; }
/* NOTE: the macro vpNewVar(pool, type) can be used if fmtSlot not needed */ int vpNewVar0(VarPool pool, FoamTag type, int fmtSlot) { int var; if (pool->vars[type] != listNil(AInt)) { AIntList l = pool->vars[type]; var = car(l); pool->vars[type] = cdr(l); listFreeCons(AInt)(l); } else { String name = strCopy(""); Foam decl = foamNewDecl(type, name, fmtSlot); var = fboxAdd(pool->fbox, decl); } return var; }
/* * tl is one element of the cross product get(v,k)...get(v,n-1) */ local void tposs0Multi(TPoss tp,Length k,TFormList tl,Length n,Pointer v,TPossGetter get) { if (k == 0) tpossCons(tp, tfMultiFrList(tl)); else { TPoss tpk = get(v, k-1); TPossIterator tpi; tl = listCons(TForm)(NULL, tl); for (tpossITER(tpi,tpk); tpossMORE(tpi); tpossSTEP(tpi)) { TForm t = tpossELT(tpi); t = tfFollowOnly(t); setcar(tl, t); tposs0Multi(tp, k-1, tl, n, v, get); } listFreeCons(TForm)(tl); tpossFree(tpk); } }
local SrcLineList inclFile(String fname, Bool reincluding, Bool top, long *pnlines) { Scope("inclFile"); SrcLineList sll; Hash fhash; FileName fn; FileState o_fileState; IfState fluid(ifState); String curdir; o_fileState = fileState; /* no fluid(struct) */ ifState = NoIf; fileState.lineNumber = 0; fn = inclFind(fname, fileState.curDir); if (fn != 0) { fileState.curDir = strCopy(fnameDir(fn)); fileState.curFile = strCopy(fnameUnparseStatic(fn)); fileState.curFname = fn; } curdir = fileState.curDir; if (fn == 0) { fileState = o_fileState; if (top) { comsgFatal(NULL, ALDOR_F_CantOpen, fname); NotReached(sll = 0); } else sll = inclError(ALDOR_F_CantOpen, fname); } else { fhash = fileHash(fn); fname = strCopy (fnameUnparseStatic(fn)); if (!reincluding && listMemq(Hash)(includedFileCodes, fhash)) { sll = listNil(SrcLine); } else if (listMemq(Hash)(fileState.fileCodes, fhash)) { String s = inclActiveFileChain (fileState.fileNames, "->"); fileState = o_fileState; sll = inclError(ALDOR_E_InclInfinite, s); strFree(s); } else { includedFileCodes = listCons(Hash) (fhash,includedFileCodes); fileState.fileCodes = listCons(Hash) (fhash,fileState.fileCodes); fileState.fileNames = listCons(String)(fname,fileState.fileNames); fileState.infile = fileRdOpen(fn); sll = inclFileContents(); listFreeCons(Hash) (fileState.fileCodes); listFreeCons(String)(fileState.fileNames); fclose(fileState.infile); } fnameFree(fn); strFree(curdir); /*!! curFile is used in src lines */ strFree(fname); } if (pnlines) *pnlines = fileState.lineNumber; fileState = o_fileState; Return(sll); }
void tcSatPop(void) { tcParents = listFreeCons(TConst)(tcParents); }