about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-11-18T12·06+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-11-18T12·06+0000
commitdfc9c64ead7f24d51ed1a232e4b3ecafa8384f2e (patch)
treeab0d5b381eb01bec46a66174b3b09b60ea439bb7
parentb1117ef29d35822647bda32f8cd3887f4f6eaede (diff)
* "Fix expression" -> "Nix expression".
* More refactoring.

-rw-r--r--src/Makefile.am2
-rw-r--r--src/bin2c/Makefile.am3
-rw-r--r--src/bin2c/bin2c.c (renamed from src/nix-instantiate/bin2c.c)0
-rw-r--r--src/nix-instantiate/Makefile.am12
-rw-r--r--src/nix-instantiate/eval.hh2
-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.cc9
-rw-r--r--src/nix-instantiate/parser.hh2
-rw-r--r--src/nix-store/Makefile.am8
-rw-r--r--src/nix-store/help.txt (renamed from src/nix-store/nix-help.txt)0
-rw-r--r--src/nix-store/main.cc (renamed from src/nix-store/nix.cc)7
14 files changed, 27 insertions, 32 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index e35b82a889f0..1f2aafcdba6d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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
diff --git a/src/bin2c/Makefile.am b/src/bin2c/Makefile.am
new file mode 100644
index 000000000000..bdd58808a159
--- /dev/null
+++ b/src/bin2c/Makefile.am
@@ -0,0 +1,3 @@
+noinst_PROGRAMS = bin2c
+
+bin2c_SOURCES = bin2c.c
diff --git a/src/nix-instantiate/bin2c.c b/src/bin2c/bin2c.c
index 18bf81d69e25..18bf81d69e25 100644
--- a/src/nix-instantiate/bin2c.c
+++ b/src/bin2c/bin2c.c
diff --git a/src/nix-instantiate/Makefile.am b/src/nix-instantiate/Makefile.am
index cdaec1390d9e..3a09add0c645 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/eval.hh b/src/nix-instantiate/eval.hh
index 061c840a7576..0bc052676deb 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 e407aaf44346..aa6883ff84b8 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 54f5d5266f79..54f5d5266f79 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 721fa8afa5f2..816b39dc1ae3 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 6c1e51d9ccd6..011c2900e12a 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 eaa41b3963ef..f950a51f69ce 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 e44987dd014b..5983ec5629e4 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);
diff --git a/src/nix-store/Makefile.am b/src/nix-store/Makefile.am
index a39d1e2ad985..516d78efc5c2 100644
--- a/src/nix-store/Makefile.am
+++ b/src/nix-store/Makefile.am
@@ -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
diff --git a/src/nix-store/nix-help.txt b/src/nix-store/help.txt
index d7f977025440..d7f977025440 100644
--- a/src/nix-store/nix-help.txt
+++ b/src/nix-store/help.txt
diff --git a/src/nix-store/nix.cc b/src/nix-store/main.cc
index d1766de39b7e..0d87db9dfbb9 100644
--- a/src/nix-store/nix.cc
+++ b/src/nix-store/main.cc
@@ -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";