static StringList uclGetPostLinkOptions() { StringList res; Bool flg; res = listNil(String); flg = cfgLookupBoolean("expand-libs", uclOptions); if (flg) { String ext = cfgLookupString("lib-ext", uclOptions); res = uclExpandLibs(uclLibPath, uclLibraries, ext); } else { /* -L */ res = listNConcat(String)(res, uclConstructOptList("libpath", uclLibPath)); /* -l */ res = listNConcat(String)(res, uclConstructOptList("library", uclLibraries)); } if (uclFortran) { StringList lst = cfgLookupStringList("fortran-libraries", uclOptions); res = listNConcat(String)(res, lst); } return res; }
static void loadConfiguration() { String defSection; ConfigItemList lst, all; StringList sections, tmp; all = listNil(ConfigItem); sections = listSingleton(String)(uclSysName); while (sections) { /* Read the name of the next section */ defSection = car(sections); /* Remove it from the to-do list */ sections = cdr(sections); /* Get all the options in the section */ lst = cfgRead(uclOptFile, defSection); /* We ignore errors: could display if verbose */ cfgReadClearErrors(); /* Add them all to the result list */ all = listNConcat(ConfigItem)(all, lst); /* Get the list of inherited sections */ tmp = cfgLookupKeyNameList("inherit", lst); /* Place them at the front of our to-do list */ sections = listNConcat(String)(tmp, sections); /* Back to the start of the file */ rewind(uclOptFile); } /* Now add the default options */ all = listNConcat(ConfigItem)(all, cfgRead(uclOptFile, "default")); /* Finally the initial options */ all = listNConcat(ConfigItem)(all, uclInitialOptions()); uclOptions = all; }
static StringList uclGetGeneralCompileOptions() { StringList res; res = listNil(String); /* -I */ res = listNConcat(String)(res, uclConstructOptList("include", uclIncludePath)); /* -D */ res = listNConcat(String)(res, uclConstructOptList("define", uclDefines)); /* -U */ res = listNConcat(String)(res, uclConstructOptList("undefine", uclUnDefines)); if (uclDebug) res = listNConcat(String)(res, cfgLookupStringList(uclGetKeyName("debug"), uclOptions)); if (uclProfile) res = listNConcat(String)(res, cfgLookupStringList(uclGetKeyName("profile"), uclOptions)); if (uclOptimize) { if (!uclFloatNonStd) res = listNConcat(String)(res, cfgLookupStringList(uclGetKeyName("optimize"), uclOptions)); else res = listNConcat(String)(res, cfgLookupStringList(uclGetKeyName("non-std-float"), uclOptions)); } if (uclOutputFile) res = listNConcat(String)(res, uclConstructOptList("output-name", listSingleton(String)(uclOutputFile))); return res; }
/* * Conses (reversed) lines which arise from "including" this one line. * Returns true if there may be more. */ local Bool inclLine(SrcLineList *psll, InclIsContinuedFun isCont) { int indent; String s; SrcLine sl; SrcPos spos; SrcLineList d_sll; do { curLineString = inclGetLine(fileState.infile); if (!curLineString) { if (ifState != NoIf) *psll = listNConcat(SrcLine) (inclError(ALDOR_E_InclIfEof), *psll); return false; } fileState.lineNumber++; inclSerialLineNo++; if (inclIsDirective(curLineString)) { /*!! This may be too costly with deep nesting. */ d_sll = inclHandleDirective(); if (isThisEndifLine(d_sll)) { if (d_sll == EndifLine) return false; *psll = listNConcat(SrcLine)(d_sll, *psll); return false; } *psll = listNConcat(SrcLine)(d_sll, *psll); } else if (INCLUDING(ifState)) { s = inclCalcIndentLevel(curLineString, &indent); spos = sposNew(fileState.curFname, fileState.lineNumber, inclSerialLineNo, 1); sl = slineNew(spos, indent, s); *psll = listCons(SrcLine)(sl, *psll); } } while (isCont && (*isCont)(curLineString)); return true; }
static StringList uclFixOptionList(StringList opts0, String key) { StringList opts; if (opts0 && car(opts0)[0] == '\0') opts = cdr(opts0); else { opts = cfgLookupStringList(key, uclOptions); opts = listNConcat(String)(opts, opts0); } return opts; }
/* * This function cleans up the state so that we never * generate a bad sequence of options */ static Bool setupState() { String key; if (uclExtraKeys) { printf("Extra keys not supported yet\n"); return false; } uclReconcileDebug(uclOptions); if (uclIsCompileOnly && cdr(uclFileList)) { printf("More than one file specified for compilation only\n"); return false; } /* Should deal with '-L' and '-l' expansion here if necessary */ /* If we're not compiling, then we are linking */ if (!uclIsCompileOnly) uclIsLink = true; if (uclOutputDir) { printf("-R: Not supported\n"); return false; } /* Start Options */ key = uclGetKeyName("opts"); uclStartOptions = uclFixOptionList(uclStartOptions, key); /* Post Options */ key = uclGetKeyName("post"); uclPostOptions = uclFixOptionList(uclPostOptions, key); if (uclIsLink) { /* Extra libraries */ StringList libs = cfgLookupStringList("lib-extra", uclOptions); uclLibraries = listNConcat(String)(uclLibraries, libs); uclLibPath = uclFixOptionList(uclLibPath, "lib-default-path"); /* Twixt Options */ key = uclGetKeyName("twixt"); uclTwixtOptions = uclFixOptionList(uclTwixtOptions, key); } if (uclIsCompileOnly) { uclIncludePath = uclFixOptionList(uclIncludePath,"include-default-path"); } return true; }
static void uclAddSysArgs(StringList *plst, char *opts) { char **argv; int i, argc; if (opts[0] == '\0') { *plst = listSingleton(String)("\0"); return; } cstrParseCommaified(opts, &argc, &argv); for (i=0; i<argc; i++) *plst = listNConcat(String)(*plst, listCons(String)(argv[i], listNil(String))); stoFree(argv); }
void tcMove(TForm ntf, TForm otf) { TConstList tcl; tfFollow(ntf); for (tcl = tfConsts(otf); tcl; tcl = cdr(tcl)) tcOwner(car(tcl)) = ntf; tfConsts(ntf) = listNConcat(TConst)(tfConsts(ntf), tfConsts(otf)); tfConsts(otf) = listNil(TConst); if (tfIsMeaning(ntf)) tfCheckConsts(ntf); }
SymeList arGetSymes(Archive ar) { ArEntryList alist; SymeList symes; if (!ar) return 0; if (ar->symes) return ar->symes; arFilter(ar); for (alist = ar->members; alist; alist = cdr(alist)) { ArEntry arent = car(alist); if (!arent->mark) continue; symes = listReverse(Syme)(libGetSymes(arEntryLib(ar, arent))); ar->symes = listNConcat(Syme)(symes, ar->symes); } ar->symes = listNReverse(Syme)(ar->symes); return ar->symes; }