2003-07-06 14:20:47 +00:00
|
|
|
#include <map>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "globals.hh"
|
2003-07-20 19:29:38 +00:00
|
|
|
#include "normalise.hh"
|
2003-07-06 14:20:47 +00:00
|
|
|
#include "shared.hh"
|
|
|
|
|
|
|
|
|
|
|
|
typedef ATerm Expr;
|
|
|
|
|
2003-07-21 08:55:49 +00:00
|
|
|
typedef map<ATerm, ATerm> NormalForms;
|
2003-08-05 12:29:47 +00:00
|
|
|
typedef map<FSId, Strings> PkgPaths;
|
2003-07-22 15:15:15 +00:00
|
|
|
typedef map<FSId, Hash> PkgHashes;
|
2003-07-06 14:20:47 +00:00
|
|
|
|
2003-07-21 08:55:49 +00:00
|
|
|
struct EvalState
|
|
|
|
{
|
|
|
|
Strings searchDirs;
|
|
|
|
NormalForms normalForms;
|
2003-08-05 12:29:47 +00:00
|
|
|
PkgPaths pkgPaths;
|
2003-07-22 15:15:15 +00:00
|
|
|
PkgHashes pkgHashes; /* normalised package hashes */
|
2003-08-14 12:37:31 +00:00
|
|
|
Expr blackHole;
|
|
|
|
|
|
|
|
EvalState()
|
|
|
|
{
|
|
|
|
blackHole = ATmake("BlackHole()");
|
|
|
|
if (!blackHole) throw Error("cannot build black hole");
|
|
|
|
}
|
2003-07-21 08:55:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static Expr evalFile(EvalState & state, string fileName);
|
|
|
|
static Expr evalExpr(EvalState & state, Expr e);
|
2003-07-10 09:21:40 +00:00
|
|
|
|
|
|
|
|
2003-07-21 08:55:49 +00:00
|
|
|
static string searchPath(const Strings & searchDirs, string relPath)
|
2003-07-10 09:21:40 +00:00
|
|
|
{
|
2003-07-10 13:41:28 +00:00
|
|
|
if (string(relPath, 0, 1) == "/") return relPath;
|
|
|
|
|
2003-07-21 08:55:49 +00:00
|
|
|
for (Strings::const_iterator i = searchDirs.begin();
|
2003-07-10 09:21:40 +00:00
|
|
|
i != searchDirs.end(); i++)
|
|
|
|
{
|
|
|
|
string path = *i + "/" + relPath;
|
|
|
|
if (pathExists(path)) return path;
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error(
|
|
|
|
format("path `%1%' not found in any of the search directories")
|
|
|
|
% relPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-06 14:20:47 +00:00
|
|
|
static Expr substExpr(string x, Expr rep, Expr e)
|
|
|
|
{
|
|
|
|
char * s;
|
|
|
|
Expr e2;
|
|
|
|
|
|
|
|
if (ATmatch(e, "Var(<str>)", &s))
|
|
|
|
if (x == s)
|
|
|
|
return rep;
|
|
|
|
else
|
|
|
|
return e;
|
|
|
|
|
2003-08-14 09:49:31 +00:00
|
|
|
ATermList formals;
|
|
|
|
if (ATmatch(e, "Function([<list>], <term>)", &formals, &e2)) {
|
|
|
|
while (!ATisEmpty(formals)) {
|
|
|
|
if (!ATmatch(ATgetFirst(formals), "<str>", &s))
|
|
|
|
throw badTerm("not a list of formals", (ATerm) formals);
|
|
|
|
if (x == (string) s)
|
|
|
|
return e;
|
|
|
|
formals = ATgetNext(formals);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-07-06 14:20:47 +00:00
|
|
|
/* Generically substitute in subterms. */
|
|
|
|
|
|
|
|
if (ATgetType(e) == AT_APPL) {
|
|
|
|
AFun fun = ATgetAFun(e);
|
|
|
|
int arity = ATgetArity(fun);
|
|
|
|
ATermList args = ATempty;
|
|
|
|
|
|
|
|
for (int i = arity - 1; i >= 0; i--)
|
|
|
|
args = ATinsert(args, substExpr(x, rep, ATgetArgument(e, i)));
|
|
|
|
|
|
|
|
return (ATerm) ATmakeApplList(fun, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ATgetType(e) == AT_LIST) {
|
|
|
|
ATermList in = (ATermList) e;
|
|
|
|
ATermList out = ATempty;
|
|
|
|
|
|
|
|
while (!ATisEmpty(in)) {
|
|
|
|
out = ATinsert(out, substExpr(x, rep, ATgetFirst(in)));
|
|
|
|
in = ATgetNext(in);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ATerm) ATreverse(out);
|
|
|
|
}
|
|
|
|
|
|
|
|
throw badTerm("do not know how to substitute", e);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static Expr substExprMany(ATermList formals, ATermList args, Expr body)
|
|
|
|
{
|
|
|
|
char * s;
|
|
|
|
Expr e;
|
|
|
|
|
|
|
|
/* !!! check args against formals */
|
|
|
|
|
|
|
|
while (!ATisEmpty(args)) {
|
|
|
|
ATerm tup = ATgetFirst(args);
|
|
|
|
if (!ATmatch(tup, "(<str>, <term>)", &s, &e))
|
|
|
|
throw badTerm("expected an argument tuple", tup);
|
|
|
|
|
|
|
|
body = substExpr(s, e, body);
|
|
|
|
|
|
|
|
args = ATgetNext(args);
|
|
|
|
}
|
|
|
|
|
|
|
|
return body;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-05 12:29:47 +00:00
|
|
|
static Strings fstatePathsCached(EvalState & state, const FSId & id)
|
|
|
|
{
|
|
|
|
PkgPaths::iterator i = state.pkgPaths.find(id);
|
|
|
|
if (i != state.pkgPaths.end())
|
|
|
|
return i->second;
|
|
|
|
else {
|
|
|
|
Strings paths = fstatePaths(id);
|
|
|
|
state.pkgPaths[id] = paths;
|
|
|
|
return paths;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static Hash hashPackage(EvalState & state, FState fs)
|
2003-07-22 15:15:15 +00:00
|
|
|
{
|
|
|
|
if (fs.type == FState::fsDerive) {
|
|
|
|
for (FSIds::iterator i = fs.derive.inputs.begin();
|
|
|
|
i != fs.derive.inputs.end(); i++)
|
|
|
|
{
|
|
|
|
PkgHashes::iterator j = state.pkgHashes.find(*i);
|
|
|
|
if (j == state.pkgHashes.end())
|
|
|
|
throw Error(format("unknown package id %1%") % (string) *i);
|
|
|
|
*i = j->second;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return hashTerm(unparseFState(fs));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-21 08:55:49 +00:00
|
|
|
static Expr evalExpr2(EvalState & state, Expr e)
|
2003-07-06 14:20:47 +00:00
|
|
|
{
|
|
|
|
char * s1;
|
|
|
|
Expr e1, e2, e3, e4;
|
|
|
|
ATermList bnds;
|
|
|
|
|
|
|
|
/* Normal forms. */
|
|
|
|
if (ATmatch(e, "<str>", &s1) ||
|
2003-08-05 11:13:38 +00:00
|
|
|
ATmatch(e, "[<list>]", &e1) ||
|
2003-08-05 13:05:30 +00:00
|
|
|
ATmatch(e, "True") ||
|
|
|
|
ATmatch(e, "False") ||
|
2003-07-15 22:28:27 +00:00
|
|
|
ATmatch(e, "Function([<list>], <term>)", &e1, &e2) ||
|
|
|
|
ATmatch(e, "FSId(<str>)", &s1))
|
2003-07-06 14:20:47 +00:00
|
|
|
return e;
|
|
|
|
|
2003-07-20 19:29:38 +00:00
|
|
|
try {
|
2003-07-22 15:15:15 +00:00
|
|
|
Hash pkgHash = hashPackage(state, parseFState(e));
|
|
|
|
FSId pkgId = writeTerm(e, "");
|
|
|
|
state.pkgHashes[pkgId] = pkgHash;
|
|
|
|
return ATmake("FSId(<str>)", ((string) pkgId).c_str());
|
2003-07-20 19:29:38 +00:00
|
|
|
} catch (...) { /* !!! catch parse errors only */
|
2003-07-16 20:00:51 +00:00
|
|
|
}
|
|
|
|
|
2003-07-06 14:20:47 +00:00
|
|
|
/* Application. */
|
2003-08-06 09:05:04 +00:00
|
|
|
if (ATmatch(e, "Call(<term>, [<list>])", &e1, &e2) ||
|
|
|
|
ATmatch(e, "App(<term>, [<list>])", &e1, &e2)) {
|
2003-07-21 08:55:49 +00:00
|
|
|
e1 = evalExpr(state, e1);
|
2003-07-06 14:20:47 +00:00
|
|
|
if (!ATmatch(e1, "Function([<list>], <term>)", &e3, &e4))
|
|
|
|
throw badTerm("expecting a function", e1);
|
2003-07-21 08:55:49 +00:00
|
|
|
return evalExpr(state,
|
|
|
|
substExprMany((ATermList) e3, (ATermList) e2, e4));
|
2003-07-06 14:20:47 +00:00
|
|
|
}
|
|
|
|
|
2003-08-05 13:05:30 +00:00
|
|
|
/* Conditional. */
|
|
|
|
if (ATmatch(e, "If(<term>, <term>, <term>)", &e1, &e2, &e3)) {
|
|
|
|
e1 = evalExpr(state, e1);
|
|
|
|
Expr x;
|
|
|
|
if (ATmatch(e1, "True")) x = e2;
|
|
|
|
else if (ATmatch(e1, "False")) x = e3;
|
|
|
|
else throw badTerm("expecting a boolean", e1);
|
|
|
|
return evalExpr(state, x);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ad-hoc function for string matching. */
|
|
|
|
if (ATmatch(e, "HasSubstr(<term>, <term>)", &e1, &e2)) {
|
|
|
|
e1 = evalExpr(state, e1);
|
|
|
|
e2 = evalExpr(state, e2);
|
|
|
|
|
|
|
|
char * s1, * s2;
|
|
|
|
if (!ATmatch(e1, "<str>", &s1))
|
|
|
|
throw badTerm("expecting a string", e1);
|
|
|
|
if (!ATmatch(e2, "<str>", &s2))
|
|
|
|
throw badTerm("expecting a string", e2);
|
|
|
|
|
|
|
|
return
|
|
|
|
string(s1).find(string(s2)) != string::npos ?
|
|
|
|
ATmake("True") : ATmake("False");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Platform constant. */
|
|
|
|
if (ATmatch(e, "Platform")) {
|
|
|
|
return ATmake("<str>", SYSTEM);
|
|
|
|
}
|
|
|
|
|
2003-07-06 14:20:47 +00:00
|
|
|
/* Fix inclusion. */
|
|
|
|
if (ATmatch(e, "IncludeFix(<str>)", &s1)) {
|
|
|
|
string fileName(s1);
|
2003-07-21 08:55:49 +00:00
|
|
|
return evalFile(state, s1);
|
2003-07-06 14:20:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Relative files. */
|
|
|
|
if (ATmatch(e, "Relative(<str>)", &s1)) {
|
2003-07-21 08:55:49 +00:00
|
|
|
string srcPath = searchPath(state.searchDirs, s1);
|
2003-07-06 14:20:47 +00:00
|
|
|
string dstPath;
|
2003-07-15 22:28:27 +00:00
|
|
|
FSId id;
|
|
|
|
addToStore(srcPath, dstPath, id, true);
|
2003-07-20 19:29:38 +00:00
|
|
|
|
|
|
|
SliceElem elem;
|
|
|
|
elem.path = dstPath;
|
|
|
|
elem.id = id;
|
|
|
|
FState fs;
|
|
|
|
fs.type = FState::fsSlice;
|
|
|
|
fs.slice.roots.push_back(id);
|
|
|
|
fs.slice.elems.push_back(elem);
|
|
|
|
|
2003-07-22 15:15:15 +00:00
|
|
|
Hash pkgHash = hashPackage(state, fs);
|
|
|
|
FSId pkgId = writeTerm(unparseFState(fs), "");
|
|
|
|
state.pkgHashes[pkgId] = pkgHash;
|
2003-07-24 13:43:16 +00:00
|
|
|
|
|
|
|
msg(lvlChatty, format("copied `%1%' -> %2%")
|
|
|
|
% srcPath % (string) pkgId);
|
|
|
|
|
2003-07-22 15:15:15 +00:00
|
|
|
return ATmake("FSId(<str>)", ((string) pkgId).c_str());
|
2003-07-06 14:20:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Packages are transformed into Derive fstate expressions. */
|
|
|
|
if (ATmatch(e, "Package([<list>])", &bnds)) {
|
|
|
|
|
|
|
|
/* Evaluate the bindings and put them in a map. */
|
|
|
|
map<string, ATerm> bndMap;
|
|
|
|
bndMap["platform"] = ATmake("<str>", SYSTEM);
|
|
|
|
while (!ATisEmpty(bnds)) {
|
|
|
|
ATerm bnd = ATgetFirst(bnds);
|
|
|
|
if (!ATmatch(bnd, "(<str>, <term>)", &s1, &e1))
|
|
|
|
throw badTerm("binding expected", bnd);
|
2003-07-21 08:55:49 +00:00
|
|
|
bndMap[s1] = evalExpr(state, e1);
|
2003-07-06 14:20:47 +00:00
|
|
|
bnds = ATgetNext(bnds);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Gather information for building the Derive expression. */
|
2003-07-20 19:29:38 +00:00
|
|
|
FState fs;
|
|
|
|
fs.type = FState::fsDerive;
|
|
|
|
fs.derive.platform = SYSTEM;
|
|
|
|
string name;
|
2003-07-21 20:07:12 +00:00
|
|
|
FSId outId;
|
2003-07-22 15:15:15 +00:00
|
|
|
bool outIdGiven = false;
|
2003-07-06 14:20:47 +00:00
|
|
|
bnds = ATempty;
|
|
|
|
|
|
|
|
for (map<string, ATerm>::iterator it = bndMap.begin();
|
|
|
|
it != bndMap.end(); it++)
|
|
|
|
{
|
|
|
|
string key = it->first;
|
|
|
|
ATerm value = it->second;
|
|
|
|
|
2003-07-20 19:29:38 +00:00
|
|
|
if (ATmatch(value, "FSId(<str>)", &s1)) {
|
|
|
|
FSId id = parseHash(s1);
|
2003-08-05 12:29:47 +00:00
|
|
|
Strings paths = fstatePathsCached(state, id);
|
2003-07-15 22:28:27 +00:00
|
|
|
if (paths.size() != 1) abort();
|
|
|
|
string path = *(paths.begin());
|
2003-07-20 19:29:38 +00:00
|
|
|
fs.derive.inputs.push_back(id);
|
|
|
|
fs.derive.env.push_back(StringPair(key, path));
|
|
|
|
if (key == "build") fs.derive.builder = path;
|
2003-07-06 14:20:47 +00:00
|
|
|
}
|
|
|
|
else if (ATmatch(value, "<str>", &s1)) {
|
2003-07-08 09:59:00 +00:00
|
|
|
if (key == "name") name = s1;
|
2003-07-22 15:15:15 +00:00
|
|
|
if (key == "id") {
|
|
|
|
outId = parseHash(s1);
|
|
|
|
outIdGiven = true;
|
|
|
|
}
|
2003-07-20 19:29:38 +00:00
|
|
|
fs.derive.env.push_back(StringPair(key, s1));
|
2003-07-06 14:20:47 +00:00
|
|
|
}
|
2003-08-06 09:05:04 +00:00
|
|
|
else if (ATmatch(value, "True")) {
|
|
|
|
fs.derive.env.push_back(StringPair(key, "1"));
|
|
|
|
}
|
|
|
|
else if (ATmatch(value, "False")) {
|
|
|
|
fs.derive.env.push_back(StringPair(key, ""));
|
|
|
|
}
|
2003-07-06 14:20:47 +00:00
|
|
|
else throw badTerm("invalid package argument", value);
|
|
|
|
|
|
|
|
bnds = ATinsert(bnds,
|
|
|
|
ATmake("(<str>, <term>)", key.c_str(), value));
|
|
|
|
}
|
|
|
|
|
2003-07-20 19:29:38 +00:00
|
|
|
if (fs.derive.builder == "")
|
|
|
|
throw badTerm("no builder specified", e);
|
2003-07-06 14:20:47 +00:00
|
|
|
|
2003-07-08 09:59:00 +00:00
|
|
|
if (name == "")
|
2003-07-20 19:29:38 +00:00
|
|
|
throw badTerm("no package name specified", e);
|
2003-07-06 14:20:47 +00:00
|
|
|
|
2003-07-20 19:29:38 +00:00
|
|
|
/* Hash the fstate-expression with no outputs to produce a
|
|
|
|
unique but deterministic path name for this package. */
|
2003-07-22 15:15:15 +00:00
|
|
|
if (!outIdGiven) outId = hashPackage(state, fs);
|
2003-07-15 22:28:27 +00:00
|
|
|
string outPath =
|
|
|
|
canonPath(nixStore + "/" + ((string) outId).c_str() + "-" + name);
|
2003-07-20 19:29:38 +00:00
|
|
|
fs.derive.env.push_back(StringPair("out", outPath));
|
|
|
|
fs.derive.outputs.push_back(DeriveOutput(outPath, outId));
|
2003-07-06 14:20:47 +00:00
|
|
|
|
|
|
|
/* Write the resulting term into the Nix store directory. */
|
2003-07-22 15:15:15 +00:00
|
|
|
Hash pkgHash = outIdGiven
|
|
|
|
? hashString((string) outId + outPath)
|
|
|
|
: hashPackage(state, fs);
|
|
|
|
FSId pkgId = writeTerm(unparseFState(fs), "-d-" + name);
|
|
|
|
state.pkgHashes[pkgId] = pkgHash;
|
2003-07-24 13:43:16 +00:00
|
|
|
|
|
|
|
msg(lvlChatty, format("instantiated `%1%' -> %2%")
|
|
|
|
% name % (string) pkgId);
|
|
|
|
|
2003-07-22 15:15:15 +00:00
|
|
|
return ATmake("FSId(<str>)", ((string) pkgId).c_str());
|
2003-07-06 14:20:47 +00:00
|
|
|
}
|
|
|
|
|
2003-07-08 09:53:46 +00:00
|
|
|
/* BaseName primitive function. */
|
|
|
|
if (ATmatch(e, "BaseName(<term>)", &e1)) {
|
2003-07-21 08:55:49 +00:00
|
|
|
e1 = evalExpr(state, e1);
|
2003-07-08 09:53:46 +00:00
|
|
|
if (!ATmatch(e1, "<str>", &s1))
|
|
|
|
throw badTerm("string expected", e1);
|
|
|
|
return ATmake("<str>", baseNameOf(s1).c_str());
|
|
|
|
}
|
|
|
|
|
2003-07-06 14:20:47 +00:00
|
|
|
/* Barf. */
|
|
|
|
throw badTerm("invalid expression", e);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-21 08:55:49 +00:00
|
|
|
static Expr evalExpr(EvalState & state, Expr e)
|
|
|
|
{
|
2003-08-14 09:49:31 +00:00
|
|
|
Nest nest(lvlVomit, format("evaluating expression: %1%") % printTerm(e));
|
|
|
|
|
2003-07-21 08:55:49 +00:00
|
|
|
/* Consult the memo table to quickly get the normal form of
|
|
|
|
previously evaluated expressions. */
|
|
|
|
NormalForms::iterator i = state.normalForms.find(e);
|
2003-08-14 12:37:31 +00:00
|
|
|
if (i != state.normalForms.end()) {
|
|
|
|
if (i->second == state.blackHole)
|
|
|
|
throw badTerm("infinite recursion", e);
|
|
|
|
return i->second;
|
|
|
|
}
|
2003-07-21 08:55:49 +00:00
|
|
|
|
|
|
|
/* Otherwise, evaluate and memoize. */
|
2003-08-14 12:37:31 +00:00
|
|
|
state.normalForms[e] = state.blackHole;
|
2003-07-21 08:55:49 +00:00
|
|
|
Expr nf = evalExpr2(state, e);
|
|
|
|
state.normalForms[e] = nf;
|
|
|
|
return nf;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static Expr evalFile(EvalState & state, string relPath)
|
2003-07-06 14:20:47 +00:00
|
|
|
{
|
2003-07-21 08:55:49 +00:00
|
|
|
string path = searchPath(state.searchDirs, relPath);
|
2003-07-24 13:43:16 +00:00
|
|
|
Nest nest(lvlTalkative, format("evaluating file `%1%'") % path);
|
2003-07-10 13:41:28 +00:00
|
|
|
Expr e = ATreadFromNamedFile(path.c_str());
|
|
|
|
if (!e)
|
|
|
|
throw Error(format("unable to read a term from `%1%'") % path);
|
2003-07-21 08:55:49 +00:00
|
|
|
return evalExpr(state, e);
|
2003-07-06 14:20:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-05 11:13:38 +00:00
|
|
|
static void printFSId(EvalState & state, Expr e)
|
|
|
|
{
|
|
|
|
ATermList es;
|
|
|
|
char * s;
|
|
|
|
if (ATmatch(e, "FSId(<str>)", &s)) {
|
|
|
|
cout << format("%1%\n") % s;
|
|
|
|
}
|
|
|
|
else if (ATmatch(e, "[<list>]", &es)) {
|
|
|
|
while (!ATisEmpty(es)) {
|
|
|
|
printFSId(state, evalExpr(state, ATgetFirst(es)));
|
|
|
|
es = ATgetNext(es);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else throw badTerm("top level does not evaluate to a (list of) Nix expression(s)", e);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-06 14:20:47 +00:00
|
|
|
void run(Strings args)
|
|
|
|
{
|
2003-07-31 13:47:13 +00:00
|
|
|
openDB();
|
|
|
|
|
2003-07-21 08:55:49 +00:00
|
|
|
EvalState state;
|
2003-07-06 14:20:47 +00:00
|
|
|
Strings files;
|
|
|
|
|
2003-07-21 08:55:49 +00:00
|
|
|
state.searchDirs.push_back(".");
|
|
|
|
state.searchDirs.push_back(nixDataDir + "/fix");
|
2003-07-06 14:20:47 +00:00
|
|
|
|
|
|
|
for (Strings::iterator it = args.begin();
|
|
|
|
it != args.end(); )
|
|
|
|
{
|
|
|
|
string arg = *it++;
|
|
|
|
|
|
|
|
if (arg == "--includedir" || arg == "-I") {
|
|
|
|
if (it == args.end())
|
|
|
|
throw UsageError(format("argument required in `%1%'") % arg);
|
2003-07-21 08:55:49 +00:00
|
|
|
state.searchDirs.push_back(*it++);
|
2003-07-06 14:20:47 +00:00
|
|
|
}
|
2003-07-24 13:43:16 +00:00
|
|
|
else if (arg == "--verbose" || arg == "-v")
|
|
|
|
verbosity = (Verbosity) ((int) verbosity + 1);
|
2003-07-06 14:20:47 +00:00
|
|
|
else if (arg[0] == '-')
|
|
|
|
throw UsageError(format("unknown flag `%1%`") % arg);
|
|
|
|
else
|
|
|
|
files.push_back(arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (files.empty()) throw UsageError("no files specified");
|
|
|
|
|
|
|
|
for (Strings::iterator it = files.begin();
|
|
|
|
it != files.end(); it++)
|
|
|
|
{
|
2003-07-21 08:55:49 +00:00
|
|
|
Expr e = evalFile(state, *it);
|
2003-08-05 11:13:38 +00:00
|
|
|
printFSId(state, e);
|
2003-07-06 14:20:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string programId = "fix";
|