aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2012-02-07 02:46:44 +0000
committerdos-reis <gdr@axiomatics.org>2012-02-07 02:46:44 +0000
commit4df41da361c522b107d73ef57d938e4da17fe169 (patch)
treeacfea7904877024c284d1380d1c7d4b361111725 /src/interp
parentbcb6177bcdd58160ef84e3563189f01c0cf3a1ea (diff)
downloadopen-axiom-4df41da361c522b107d73ef57d938e4da17fe169.tar.gz
* interp/lisplib.boot (dbLocateModule): New.
(findModule): Use it. Simplify. (loadLib): Tidy. (genericLoadDB): New. (loadDB): Use it. (loadDBIfCan): New. * interp/c-util.boot (lookupDefiningFunction): Give up gracefully if the domain of computation is not compiled yet. * algebra/Makefile.in ($(OUT)/SPADAST.$(FASLEXT)): Require $(OUT)/SUCHTAST.$(FASLEXT).
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/c-util.boot4
-rw-r--r--src/interp/lisplib.boot44
2 files changed, 30 insertions, 18 deletions
diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot
index a032f0a8..a395241a 100644
--- a/src/interp/c-util.boot
+++ b/src/interp/c-util.boot
@@ -1,6 +1,6 @@
-- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd.
-- All rights reserved.
--- Copyright (C) 2007-2011, Gabriel Dos Reis.
+-- Copyright (C) 2007-2012, Gabriel Dos Reis.
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
@@ -1908,7 +1908,7 @@ lookupDefiningFunction(op,sig,dc) ==
-- the constructor is just not there
[ctor,:args] := dc
db := constructorDB ctor or return nil -- we only deal with instantiations
- loadDBIfNecessary db
+ loadDBIfCan db
dbTemplate db = nil => nil -- incomplete functor
-- 1.1. Niladic constructors don't need approximation.
-- FIXME: However, there may be cylic dependencies
diff --git a/src/interp/lisplib.boot b/src/interp/lisplib.boot
index e49d3c27..a22c7f05 100644
--- a/src/interp/lisplib.boot
+++ b/src/interp/lisplib.boot
@@ -1,6 +1,6 @@
-- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd.
-- All rights reserved.
--- Copyright (C) 2007-2011, Gabriel Dos Reis.
+-- Copyright (C) 2007-2012, Gabriel Dos Reis.
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
@@ -229,22 +229,26 @@ rwriteLispForm(key,form) ==
--% Loading
-++ Return a path to the loadable module that contains the
-++ definition of the constructor indicated by `cname'.
-++ Error if the file container of the module does not exist.
-findModule: %Symbol -> %Maybe %String
-findModule cname ==
- db := constructorDB cname or return nil
+++ Return a path to the loadable module that contains the definition
+++ of the constructor indicated by `db' if it exists. Otherwise return nil.
+dbLocateModule db ==
m :=
$buildingSystemAlgebra =>
getSystemModulePath symbolName dbAbbreviation db
- getConstructorModuleFromDB cname
+ getConstructorModuleFromDB dbConstructor db
existingFile? m => m
strap := algebraBootstrapDir() =>
m := strconc(strap,PATHNAME_-NAME m,'".",$faslType)
existingFile? m => m
- systemError ['"missing module for ",:bright cname]
- systemError ['"missing module for ",:bright cname]
+ nil
+ nil
+
+++ Return a path to the loadable module that contains the
+++ definition of the constructor indicated by `cname'.
+++ Error if the file container of the module does not exist.
+findModule db ==
+ dbLocateModule db
+ or systemError ['"missing module for ",:bright dbConstructor db]
loadLibIfNotLoaded libName ==
-- loads is library is not already loaded
@@ -256,12 +260,13 @@ loadLibIfNotLoaded libName ==
loadLib cname ==
builtinConstructor? cname => nil -- these don't have nrlib yet.
startTimingProcess 'load
- fullLibName := findModule cname or return nil
+ db := constructorDB cname or return nil
+ fullLibName := findModule db
systemdir? := isSystemDirectory(pathnameDirectory fullLibName)
update? := $forceDatabaseUpdate or not systemdir?
not update? =>
loadLibNoUpdate(cname, cname, fullLibName)
- kind := getConstructorKindFromDB cname
+ kind := dbConstructorKind db
if $printLoadMsgs then
sayKeyedMsg("S2IL0002",[namestring fullLibName,kind,cname])
loadModule(fullLibName,cname)
@@ -269,7 +274,7 @@ loadLib cname ==
updateDatabase(cname,cname,systemdir?)
installConstructor(cname,kind)
updateCategoryTable(cname,kind)
- dbLoadPath(constructorDB cname) := fullLibName
+ dbLoadPath(db) := fullLibName
if $InteractiveMode then $CategoryFrame := $EmptyEnvironment
stopTimingProcess 'load
'T
@@ -302,19 +307,26 @@ loadIfNecessary u ==
throwKeyedMsg("S2IL0005",[u])
value
-++ Load the module associated with `db' and return the module's path.
-loadDB db ==
+genericLoadDB(db,f) ==
try
startTimingProcess 'load
dbBeingDefined? db => nil
dbLoaded? db => db
ctor := dbConstructor db
builtinConstructor? ctor => nil
- lib := findModule ctor or return nil
+ lib := apply(f,db,nil) or return nil
loadModule(lib,ctor)
dbLoadPath(db) := lib
db
finally stopTimingProcess 'load
+
+++ Load the module associated with `db' and return the module's path.
+loadDB db ==
+ genericLoadDB(db,function findModule)
+
+loadDBIfCan db ==
+ dbLoaded? db => db
+ genericLoadDB(db,function dbLocateModule)
convertOpAlist2compilerInfo(opalist) ==
"append"/[[formatSig(op,sig) for sig in siglist]