* "Fix expression" -> "Nix expression".

* More refactoring.
This commit is contained in:
Eelco Dolstra 2003-11-18 12:06:07 +00:00
parent b1117ef29d
commit dfc9c64ead
14 changed files with 27 additions and 32 deletions

View file

@ -1 +1 @@
SUBDIRS = boost libutil libstore libmain nix-store nix-hash nix-instantiate
SUBDIRS = bin2c boost libutil libstore libmain nix-store nix-hash nix-instantiate

3
src/bin2c/Makefile.am Normal file
View file

@ -0,0 +1,3 @@
noinst_PROGRAMS = bin2c
bin2c_SOURCES = bin2c.c

View file

@ -1,6 +1,6 @@
bin_PROGRAMS = nix-instantiate
nix_instantiate_SOURCES = fixexpr.cc parser.cc eval.cc primops.cc fix.cc
nix_instantiate_SOURCES = nixexpr.cc parser.cc eval.cc primops.cc main.cc
nix_instantiate_LDADD = ../libmain/libmain.a ../libstore/libstore.a ../libutil/libutil.a \
../boost/format/libformat.a -L../../externals/inst/lib -ldb_cxx \
-lsglr -lATB -lconversion -lasfix2 -lmept -lATerm
@ -13,14 +13,10 @@ AM_CXXFLAGS = \
parser.o: parse-table.h
parse-table.h: fix.tbl bin2c
./bin2c fixParseTable < $< > $@ || (rm $@ && exit 1)
noinst_PROGRAMS = bin2c
bin2c_SOURCES = bin2c.c
parse-table.h: nix.tbl
../bin2c/bin2c nixParseTable < $< > $@ || (rm $@ && exit 1)
%.tbl: %.sdf
../../externals/inst/bin/sdf2table -i $< -o $@
CLEANFILES = parse-table.h fix.tbl
CLEANFILES = parse-table.h nix.tbl

View file

@ -5,7 +5,7 @@
#include "aterm.hh"
#include "hash.hh"
#include "fixexpr.hh"
#include "nixexpr.hh"
typedef map<Path, PathSet> DrvPaths;

View file

@ -70,7 +70,7 @@ void run(Strings args)
#if 0
state.searchDirs.push_back(".");
state.searchDirs.push_back(nixDataDir + "/fix");
state.searchDirs.push_back(nixDataDir + "/nix");
#endif
for (Strings::iterator it = args.begin();
@ -114,4 +114,4 @@ void run(Strings args)
}
string programId = "fix";
string programId = "nix-instantiate";

View file

@ -1,4 +1,4 @@
#include "fixexpr.hh"
#include "nixexpr.hh"
#include "storeexpr.hh"

View file

@ -1,5 +1,5 @@
#ifndef __FIXEXPR_H
#define __FIXEXPR_H
#ifndef __NIXEXPR_H
#define __NIXEXPR_H
#include <map>
@ -8,7 +8,7 @@
#include "util.hh"
/* Fix expressions are represented as ATerms. The maximal sharing
/* Nix expressions are represented as ATerms. The maximal sharing
property of the ATerm library allows us to implement caching of
normals forms efficiently. */
typedef ATerm Expr;
@ -72,4 +72,4 @@ Expr substitute(const ATermMap & subs, Expr e);
Expr makeBool(bool b);
#endif /* !__FIXEXPR_H */
#endif /* !__NIXEXPR_H */

View file

@ -13,7 +13,6 @@ extern "C" {
#include "aterm.hh"
#include "parser.hh"
#include "shared.hh"
#include "fixexpr.hh"
#include "parse-table.h"
@ -76,12 +75,12 @@ Expr parseExprFromFile(Path path)
if (e) return e;
#endif
/* If `path' refers to a directory, append `/default.fix'. */
/* If `path' refers to a directory, append `/default.nix'. */
struct stat st;
if (stat(path.c_str(), &st))
throw SysError(format("getting status of `%1%'") % path);
if (S_ISDIR(st.st_mode))
path = canonPath(path + "/default.fix");
path = canonPath(path + "/default.nix");
/* Initialise the SDF libraries. */
static bool initialised = false;
@ -95,12 +94,12 @@ Expr parseExprFromFile(Path path)
ATprotect(&parseTable);
parseTable = ATreadFromBinaryString(
(char *) fixParseTable, sizeof fixParseTable);
(char *) nixParseTable, sizeof nixParseTable);
if (!parseTable)
throw Error(format("cannot construct parse table term"));
ATprotect(&lang);
lang = ATmake("Fix");
lang = ATmake("Nix");
if (!SGopenLanguageFromTerm(
(char *) programId.c_str(), lang, parseTable))
throw Error(format("cannot open language"));

View file

@ -1,7 +1,7 @@
#ifndef __PARSER_H
#define __PARSER_H
#include "fixexpr.hh"
#include "nixexpr.hh"
Expr parseExprFromFile(Path path);

View file

@ -1,15 +1,13 @@
bin_PROGRAMS = nix-store
nix_store_SOURCES = nix.cc dotgraph.cc
nix_store_SOURCES = main.cc dotgraph.cc
nix_store_LDADD = ../libmain/libmain.a ../libstore/libstore.a ../libutil/libutil.a \
../boost/format/libformat.a -L../../externals/inst/lib -ldb_cxx -lATerm
nix.o: nix-help.txt.hh
main.o: help.txt.hh
%.hh: %
echo -n '"' > $@
sed 's|\(.*\)|\1\\n\\|' < $< >> $@
echo '"' >> $@
../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1)
AM_CXXFLAGS = \
-I.. -I../../externals/inst/include -I../libutil -I../libstore -I../libmain

View file

@ -6,6 +6,7 @@
#include "archive.hh"
#include "shared.hh"
#include "dotgraph.hh"
#include "help.txt.hh"
typedef void (* Operation) (Strings opFlags, Strings opArgs);
@ -13,9 +14,7 @@ typedef void (* Operation) (Strings opFlags, Strings opArgs);
static void printHelp()
{
cout <<
#include "nix-help.txt.hh"
;
cout << string((char *) helpText, sizeof helpText);
exit(0);
}
@ -301,4 +300,4 @@ void run(Strings args)
}
string programId = "nix";
string programId = "nix-store";