diff options
author | dos-reis <gdr@axiomatics.org> | 2011-08-24 03:17:31 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-08-24 03:17:31 +0000 |
commit | ffbca7d35e4541017c1e1d736dacbe27e0de2c21 (patch) | |
tree | 6472437711d170ee121540af466b96ed57caab53 | |
parent | d7d39823cf29e2b981e20fee3b0454624897371d (diff) | |
download | open-axiom-ffbca7d35e4541017c1e1d736dacbe27e0de2c21.tar.gz |
* algebra/Makefile.in: Support construction initial DB profile.
* interp/database.boot (printInitdbInfo): New.
(printAllInitdbInfo): Likewise.
* interp/sys-driver.boot (initializeDatabases): Exit early if
constructing initial DB profile.
(buildInitdbHandler): New. Handle --build-initdb.
* utils/command.cc (driver_table): Add map for --build-initdb.
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | Makefile.in | 5 | ||||
-rw-r--r-- | src/ChangeLog | 10 | ||||
-rw-r--r-- | src/Makefile.am | 12 | ||||
-rw-r--r-- | src/Makefile.in | 12 | ||||
-rw-r--r-- | src/algebra/Makefile.in | 26 | ||||
-rw-r--r-- | src/interp/database.boot | 24 | ||||
-rw-r--r-- | src/interp/sys-driver.boot | 15 | ||||
-rw-r--r-- | src/utils/command.cc | 1 |
9 files changed, 91 insertions, 19 deletions
diff --git a/Makefile.am b/Makefile.am index d20715f3..6c1a79cf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,6 +56,7 @@ OA_SRC_TARGETS = \ all-src \ all-algebra \ all-algstrap \ + all-initdb \ all-asq \ all-axiomsys \ all-boot \ @@ -85,10 +86,6 @@ all: all-local $(OA_SRC_TARGETS): cd src && $(MAKE) $@ -.PHONY: all-algstrap -all-algstrap: all-interpsys - cd src/algebra && $(MAKE) $@ - .PHONY: all-gcl all-gcl: $(oa_builddir)/bin/gcl$(EXEEXT) diff --git a/Makefile.in b/Makefile.in index 4a9dbc40..728200ef 100644 --- a/Makefile.in +++ b/Makefile.in @@ -361,6 +361,7 @@ OA_SRC_TARGETS = \ all-src \ all-algebra \ all-algstrap \ + all-initdb \ all-asq \ all-axiomsys \ all-boot \ @@ -922,10 +923,6 @@ all: all-local $(OA_SRC_TARGETS): cd src && $(MAKE) $@ -.PHONY: all-algstrap -all-algstrap: all-interpsys - cd src/algebra && $(MAKE) $@ - .PHONY: all-gcl all-gcl: $(oa_builddir)/bin/gcl$(EXEEXT) diff --git a/src/ChangeLog b/src/ChangeLog index ac934e10..64270250 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,15 @@ 2011-08-23 Gabriel Dos Reis <gdr@cs.tamu.edu> + * algebra/Makefile.in: Support construction initial DB profile. + * interp/database.boot (printInitdbInfo): New. + (printAllInitdbInfo): Likewise. + * interp/sys-driver.boot (initializeDatabases): Exit early if + constructing initial DB profile. + (buildInitdbHandler): New. Handle --build-initdb. + * utils/command.cc (driver_table): Add map for --build-initdb. + +2011-08-23 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/sys-driver.boot (initializeDatabases): New. (initializeGlobalState): Use it. * interp/spad-parser.boot (parseSpadFile): Tidy. diff --git a/src/Makefile.am b/src/Makefile.am index 85f3aac0..a3ea1870 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -72,7 +72,7 @@ stamp-subdirs: $(MKDIR_P) $(oa_targetdir)/share $(MKDIR_P) $(oa_targetdir)/doc $(MKDIR_P) $(oa_targetdir)/doc/help - $(MKDIR_P) algebra/strap + $(MKDIR_P) $(oa_targetdir)/src/algebra touch stamp-subdirs .PHONY: $(oa_all_targets) @@ -117,7 +117,15 @@ all-interpsys: all-boot all-hyper-pre all-utils all-axiomsys: all-asq cd interp && $(MAKE) $(AM_MAKEFLAGS) all-axiomsys -all-algebra: all-interpsys all-share all-hyper-pre +all-algebra: all-driver all-interpsys all-share all-hyper-pre + cd algebra && $(MAKE) $(AM_MAKEFLAGS) $@ + +.PHONY: all-algstrap +all-algstrap: all-driver all-interpsys + cd algebra && $(MAKE) $(AM_MAKEFLAGS) $@ + +.PHONY: all-initdb +all-initdb: all-driver all-interpsys cd algebra && $(MAKE) $(AM_MAKEFLAGS) $@ .PHONY: all-hyper-pre diff --git a/src/Makefile.in b/src/Makefile.in index 04e11dec..d95411d1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -669,7 +669,7 @@ stamp-subdirs: $(MKDIR_P) $(oa_targetdir)/share $(MKDIR_P) $(oa_targetdir)/doc $(MKDIR_P) $(oa_targetdir)/doc/help - $(MKDIR_P) algebra/strap + $(MKDIR_P) $(oa_targetdir)/src/algebra touch stamp-subdirs .PHONY: $(oa_all_targets) @@ -714,7 +714,15 @@ all-interpsys: all-boot all-hyper-pre all-utils all-axiomsys: all-asq cd interp && $(MAKE) $(AM_MAKEFLAGS) all-axiomsys -all-algebra: all-interpsys all-share all-hyper-pre +all-algebra: all-driver all-interpsys all-share all-hyper-pre + cd algebra && $(MAKE) $(AM_MAKEFLAGS) $@ + +.PHONY: all-algstrap +all-algstrap: all-driver all-interpsys + cd algebra && $(MAKE) $(AM_MAKEFLAGS) $@ + +.PHONY: all-initdb +all-initdb: all-driver all-interpsys cd algebra && $(MAKE) $(AM_MAKEFLAGS) $@ .PHONY: all-hyper-pre diff --git a/src/algebra/Makefile.in b/src/algebra/Makefile.in index 15966c3f..e4d99011 100644 --- a/src/algebra/Makefile.in +++ b/src/algebra/Makefile.in @@ -1598,15 +1598,9 @@ ${OUT}/%.$(FASLEXT): %.NRLIB/code.$(FASLEXT) %.NRLIB/code.$(FASLEXT): %.spad $(COMPILE_SPAD) -$(OUTSRC)/%.spad: mk-target-src-algabra-dir - ${OUTSRC}/%.spad: $(srcdir)/%.spad.pamphlet $(oa_hammer) --tangle --output=$@ $< -.PHONY: mk-target-src-algabra-dir -mk-target-src-algabra-dir: - @ [ -d $(OUTSRC) ] || $(mkdir_p) $(OUTSRC) - .PRECIOUS: $(builddir)/%.tex .PRECIOUS: $(builddir)/%.dvi @@ -1868,12 +1862,30 @@ user-stamp: $(axiom_algebra_layer_user_objects) @ $(STAMP) user-stamp +.PHONY: spad-files-stamp +spad-files-stamp: $(SPADFILES) + @ rm -f spad-files-stamp + @ $(STAMP) spad-files-stamp + +.PHONY: all-initdb +all-initdb: initdb-stamp + +.PHONY: initdb-stamp +initdb-stamp: initdb.daase + @ rm -f initdb-stamp + @ $(STAMP) initdb-stamp + +initdb.daase: spad-files-stamp + $(DRIVER) --execpath=$(INTERPSYS) --system="$(AXIOM)" \ + --spad-srcdir=$(OUTSRC) \ + --output=initdb.$$$$ --build-initdb && \ + $(top_confdir)/move-if-change initdb.$$$$ $@ mostlyclean-local: @rm -f $(OUT)/*.$(FASLEXT) $(OUT)/*.daase @rm -rf *.NRLIB - @rm -rf *.DAASE *.daase libdb.text + @rm -rf *.DAASE *.daase libdb.text initdb.* @rm -rf strap* @rm -f *stamp diff --git a/src/interp/database.boot b/src/interp/database.boot index 7f6849a3..c6f9c50a 100644 --- a/src/interp/database.boot +++ b/src/interp/database.boot @@ -797,3 +797,27 @@ populateDBFromFile path == while (entry := readExpr dbfile) ~= %nothing repeat makeInitialDB entry finally closeStream dbfile + +printInitdbInfo(path,dbfile) == main(path,dbfile) where + main(path,dbfile) == + for x in parseSpadFile path repeat + x is ['DEF,lhs,:.] => fn(lhs,path,dbfile) + x is ["where",['DEF,lhs,:.],:.] => fn(lhs,path,dbfile) + fn(lhs,path,dbfile) == + if lhs isnt [.,:.] then lhs := [lhs] + db := constructorDB lhs.op + db = nil => nil + form := [id for x in lhs.args] + where id() == (x is [":",x',:.] => x'; x) + form := [lhs.op,:form] + prettyPrint([form,dbConstructorKind db,dbAbbreviation db,path],dbfile) + writeNewline dbfile + +printAllInitdbInfo(srcdir,dbfile) == + paths := DIRECTORY strconc(ensureTrailingSlash srcdir,'"*.spad") + or coreError strconc('"no .spad file in directory ",srcdir) + try + out := outputTextFile dbfile + for path in paths repeat + printInitdbInfo(NAMESTRING path,out) + finally closeStream out diff --git a/src/interp/sys-driver.boot b/src/interp/sys-driver.boot index e2116f08..1a097549 100644 --- a/src/interp/sys-driver.boot +++ b/src/interp/sys-driver.boot @@ -175,6 +175,7 @@ restart() == --% initializeDatabases firstTime? == + getOptionValue "build-initdb" => nil initdb := getOptionValue "initial-db" => populateDBFromFile initdb not firstTime? => openDatabases() fillDatabasesInCore() @@ -306,6 +307,20 @@ buildDatabasesHandler(prog,options,args) == installDriver(Option '"build-databases",function buildDatabasesHandler) + +buildInitdbHandler(prog,options,args) == + $displayStartMsgs := false + initializeGlobalState() + srcdir := getOptionValue "spad-srcdir" or + coreError '"missing --spad-srcdir=<dir> argument" + not string? srcdir => coreError '"invalid value for --spad-srcdir" + dbfile := getOptionValue "output" or '"initdb.daase" + not string? dbfile => coreError '"invalid value for --output" + printAllInitdbInfo(srcdir,dbfile) + coreQuit(errorCount() > 0 => 1; 0) + +installDriver(Option '"build-initdb",function buildInitdbHandler) + --% ++ Main entry point to the interactive system. diff --git a/src/utils/command.cc b/src/utils/command.cc index 0784f14c..cd9017c3 100644 --- a/src/utils/command.cc +++ b/src/utils/command.cc @@ -319,6 +319,7 @@ static void print_usage(void) { { "--compile", compiler_driver }, { "--translate", compiler_driver }, { "--build-databases", compiler_driver }, + { "--build-initdb", core_driver }, { "--make", linker_driver }, }; |