* BaseName() primitive for the generation of more sensible names

(especially in fetchurl.fix).
This commit is contained in:
Eelco Dolstra 2003-07-08 09:53:46 +00:00
parent a5a90f501e
commit ab644ad10b
1 changed files with 8 additions and 0 deletions

View File

@ -208,6 +208,14 @@ static Expr evalExpr(Expr e)
return ATmake("Include(<str>)", ((string) eHash).c_str());
}
/* BaseName primitive function. */
if (ATmatch(e, "BaseName(<term>)", &e1)) {
e1 = evalExpr(e1);
if (!ATmatch(e1, "<str>", &s1))
throw badTerm("string expected", e1);
return ATmake("<str>", baseNameOf(s1).c_str());
}
/* Barf. */
throw badTerm("invalid expression", e);
}