diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-18 12:06:07 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-18 12:06:07 +0000 |
commit | dfc9c64ead7f24d51ed1a232e4b3ecafa8384f2e (patch) | |
tree | ab0d5b381eb01bec46a66174b3b09b60ea439bb7 /src/nix-instantiate | |
parent | b1117ef29d35822647bda32f8cd3887f4f6eaede (diff) | |
download | guix-dfc9c64ead7f24d51ed1a232e4b3ecafa8384f2e.tar.gz |
* "Fix expression" -> "Nix expression".
* More refactoring.
Diffstat (limited to 'src/nix-instantiate')
-rw-r--r-- | src/nix-instantiate/Makefile.am | 12 | ||||
-rw-r--r-- | src/nix-instantiate/bin2c.c | 23 | ||||
-rw-r--r-- | src/nix-instantiate/eval.hh | 2 | ||||
-rw-r--r-- | src/nix-instantiate/main.cc (renamed from src/nix-instantiate/fix.cc) | 4 | ||||
-rw-r--r-- | src/nix-instantiate/nix.sdf (renamed from src/nix-instantiate/fix.sdf) | 0 | ||||
-rw-r--r-- | src/nix-instantiate/nixexpr.cc (renamed from src/nix-instantiate/fixexpr.cc) | 2 | ||||
-rw-r--r-- | src/nix-instantiate/nixexpr.hh (renamed from src/nix-instantiate/fixexpr.hh) | 8 | ||||
-rw-r--r-- | src/nix-instantiate/parser.cc | 9 | ||||
-rw-r--r-- | src/nix-instantiate/parser.hh | 2 |
9 files changed, 17 insertions, 45 deletions
diff --git a/src/nix-instantiate/Makefile.am b/src/nix-instantiate/Makefile.am index cdaec1390d..3a09add0c6 100644 --- a/src/nix-instantiate/Makefile.am +++ b/src/nix-instantiate/Makefile.am @@ -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 diff --git a/src/nix-instantiate/bin2c.c b/src/nix-instantiate/bin2c.c deleted file mode 100644 index 18bf81d69e..0000000000 --- a/src/nix-instantiate/bin2c.c +++ /dev/null @@ -1,23 +0,0 @@ -#include <stdlib.h> -#include <stdio.h> -#include <stdarg.h> - -void print(const char *format, ...) -{ - va_list ap; - va_start(ap, format); - if (vprintf(format, ap) < 0) abort(); - va_end(ap); -} - -int main(int argc, char * * argv) -{ - int c; - if (argc != 2) abort(); - print("static unsigned char %s[] = {", argv[1]); - while ((c = getchar()) != EOF) { - print("0x%02x, ", (unsigned char) c); - } - print("};\n"); - return 0; -} diff --git a/src/nix-instantiate/eval.hh b/src/nix-instantiate/eval.hh index 061c840a75..0bc052676d 100644 --- a/src/nix-instantiate/eval.hh +++ b/src/nix-instantiate/eval.hh @@ -5,7 +5,7 @@ #include "aterm.hh" #include "hash.hh" -#include "fixexpr.hh" +#include "nixexpr.hh" typedef map<Path, PathSet> DrvPaths; diff --git a/src/nix-instantiate/fix.cc b/src/nix-instantiate/main.cc index e407aaf443..aa6883ff84 100644 --- a/src/nix-instantiate/fix.cc +++ b/src/nix-instantiate/main.cc @@ -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"; diff --git a/src/nix-instantiate/fix.sdf b/src/nix-instantiate/nix.sdf index 54f5d5266f..54f5d5266f 100644 --- a/src/nix-instantiate/fix.sdf +++ b/src/nix-instantiate/nix.sdf diff --git a/src/nix-instantiate/fixexpr.cc b/src/nix-instantiate/nixexpr.cc index 721fa8afa5..816b39dc1a 100644 --- a/src/nix-instantiate/fixexpr.cc +++ b/src/nix-instantiate/nixexpr.cc @@ -1,4 +1,4 @@ -#include "fixexpr.hh" +#include "nixexpr.hh" #include "storeexpr.hh" diff --git a/src/nix-instantiate/fixexpr.hh b/src/nix-instantiate/nixexpr.hh index 6c1e51d9cc..011c2900e1 100644 --- a/src/nix-instantiate/fixexpr.hh +++ b/src/nix-instantiate/nixexpr.hh @@ -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 */ diff --git a/src/nix-instantiate/parser.cc b/src/nix-instantiate/parser.cc index eaa41b3963..f950a51f69 100644 --- a/src/nix-instantiate/parser.cc +++ b/src/nix-instantiate/parser.cc @@ -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")); diff --git a/src/nix-instantiate/parser.hh b/src/nix-instantiate/parser.hh index e44987dd01..5983ec5629 100644 --- a/src/nix-instantiate/parser.hh +++ b/src/nix-instantiate/parser.hh @@ -1,7 +1,7 @@ #ifndef __PARSER_H #define __PARSER_H -#include "fixexpr.hh" +#include "nixexpr.hh" Expr parseExprFromFile(Path path); |