* "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 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 \ nix_instantiate_LDADD = ../libmain/libmain.a ../libstore/libstore.a ../libutil/libutil.a \
../boost/format/libformat.a -L../../externals/inst/lib -ldb_cxx \ ../boost/format/libformat.a -L../../externals/inst/lib -ldb_cxx \
-lsglr -lATB -lconversion -lasfix2 -lmept -lATerm -lsglr -lATB -lconversion -lasfix2 -lmept -lATerm
@ -13,14 +13,10 @@ AM_CXXFLAGS = \
parser.o: parse-table.h parser.o: parse-table.h
parse-table.h: fix.tbl bin2c parse-table.h: nix.tbl
./bin2c fixParseTable < $< > $@ || (rm $@ && exit 1) ../bin2c/bin2c nixParseTable < $< > $@ || (rm $@ && exit 1)
noinst_PROGRAMS = bin2c
bin2c_SOURCES = bin2c.c
%.tbl: %.sdf %.tbl: %.sdf
../../externals/inst/bin/sdf2table -i $< -o $@ ../../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 "aterm.hh"
#include "hash.hh" #include "hash.hh"
#include "fixexpr.hh" #include "nixexpr.hh"
typedef map<Path, PathSet> DrvPaths; typedef map<Path, PathSet> DrvPaths;

View file

@ -70,7 +70,7 @@ void run(Strings args)
#if 0 #if 0
state.searchDirs.push_back("."); state.searchDirs.push_back(".");
state.searchDirs.push_back(nixDataDir + "/fix"); state.searchDirs.push_back(nixDataDir + "/nix");
#endif #endif
for (Strings::iterator it = args.begin(); 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" #include "storeexpr.hh"

View file

@ -1,5 +1,5 @@
#ifndef __FIXEXPR_H #ifndef __NIXEXPR_H
#define __FIXEXPR_H #define __NIXEXPR_H
#include <map> #include <map>
@ -8,7 +8,7 @@
#include "util.hh" #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 property of the ATerm library allows us to implement caching of
normals forms efficiently. */ normals forms efficiently. */
typedef ATerm Expr; typedef ATerm Expr;
@ -72,4 +72,4 @@ Expr substitute(const ATermMap & subs, Expr e);
Expr makeBool(bool b); Expr makeBool(bool b);
#endif /* !__FIXEXPR_H */ #endif /* !__NIXEXPR_H */

View file

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

View file

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

View file

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

View file

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