diff options
author | dos-reis <gdr@axiomatics.org> | 2011-10-02 03:35:59 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-10-02 03:35:59 +0000 |
commit | 8640c7b9aa33084d77770f435814d1d8558c8e2e (patch) | |
tree | 968ff56d45b80dcc8ad3002703025cf27995e155 /src/boot | |
parent | 496ca25659180bb29cc5fea2f3c0337695d742d3 (diff) | |
download | open-axiom-8640c7b9aa33084d77770f435814d1d8558c8e2e.tar.gz |
* boot/utility.boot (objectAssoc): New. Export.
* boot/ast.boot: Use it. instead of ASSOC.
* boot/translator.boot (packageBody): Tidy.
* interp/astr.boot: Use objectAssoc instead of ASSQ.
* interp/br-con.boot: Likewise.
* interp/br-op1.boot: Likewise.
* interp/br-saturn.boot: Likewise.
* interp/buildom.boot: Likewise.
* interp/c-util.boot: Likewise.
* interp/category.boot: Likewise.
* interp/clam.boot: Likewise.
* interp/compiler.boot: Likewise.
* interp/define.boot: Likewise.
* interp/functor.boot: Likewise.
* interp/g-util.boot: Likewise.
* interp/i-coerce.boot: Likewise.
* interp/i-coerfn.boot: Likewise.
* interp/i-funsel.boot: Likewise.
* interp/i-object.boot: Likewise.
* interp/i-output.boot: Likewise.
* interp/i-resolv.boot: Likewise.
* interp/i-special.boot: Likewise.
* interp/i-syscmd.boot: Likewise.
* interp/i-util.boot: Likewise.
* interp/int-top.boot: Likewise.
* interp/lisplib.boot: Likewise.
* interp/msg.boot: Likewise.
* interp/posit.boot: Likewise.
* interp/termrw.boot: Likewise.
* interp/trace.boot: Likewise.
* interp/sys-utility.boot (upwardCut): New.
* interp/spad.lisp: Use it.
* interp/util.lisp: Likewise.
* interp/spaderror.lisp: Likewise.
* interp/vmlisp.lisp (ASSEMBLE): Remove.
(ASSQ): Likewise.
(MEMQ): Likewise.
(NAMEDERRSET): Likewise.
(ORADDTEMPDEFS): Likewise.
* interp/macros.lisp (QLASSQ): Move to vmlisp.lisp.
(LASSQ): Remove.
Diffstat (limited to 'src/boot')
-rw-r--r-- | src/boot/ast.boot | 8 | ||||
-rw-r--r-- | src/boot/strap/ast.clisp | 13 | ||||
-rw-r--r-- | src/boot/strap/translator.clisp | 8 | ||||
-rw-r--r-- | src/boot/strap/utility.clisp | 17 | ||||
-rw-r--r-- | src/boot/translator.boot | 6 | ||||
-rw-r--r-- | src/boot/utility.boot | 9 |
6 files changed, 43 insertions, 18 deletions
diff --git a/src/boot/ast.boot b/src/boot/ast.boot index 25c1b01e..082ca6e2 100644 --- a/src/boot/ast.boot +++ b/src/boot/ast.boot @@ -1457,7 +1457,7 @@ unknownNativeTypeError t == nativeType t == t = nil => t t isnt [.,:.] => - t' := rest ASSOC(coreSymbol t,$NativeTypeTable) => + t' := rest objectAssoc(coreSymbol t,$NativeTypeTable) => t' := %hasFeature KEYWORD::SBCL => bfColonColon("SB-ALIEN", t') %hasFeature KEYWORD::CLISP => bfColonColon("FFI",t') @@ -1710,7 +1710,7 @@ genCLISPnativeTranslation(op,s,t,op') == call := [n,:[actualArg(p,localPairs) for p in parms]] where actualArg(p,pairs) == - a' := rest ASSOC(p,pairs) => rest rest a' + a' := rest objectAssoc(p,pairs) => rest rest a' p -- Fix up the call if there is any `write' parameter. call := @@ -1792,8 +1792,8 @@ genCLOZUREnativeTranslation(op,s,t,op') == where args() == [:[x, parm] for x in argtypes for p in parms] parm() == - p' := ASSOC(p, strPairs) => rest p' - p' := ASSOC(p, aryPairs) => rest p' + p' := objectAssoc(p, strPairs) => rest p' + p' := objectAssoc(p, aryPairs) => rest p' p -- If the foreign call returns a C-string, turn it into a Lisp string. diff --git a/src/boot/strap/ast.clisp b/src/boot/strap/ast.clisp index 6f4c96da..6a92bd8d 100644 --- a/src/boot/strap/ast.clisp +++ b/src/boot/strap/ast.clisp @@ -2448,7 +2448,9 @@ (COND ((NULL |t|) |t|) ((NOT (CONSP |t|)) (COND - ((SETQ |t'| (CDR (ASSOC (|coreSymbol| |t|) |$NativeTypeTable|))) + ((SETQ |t'| + (CDR + (|objectAssoc| (|coreSymbol| |t|) |$NativeTypeTable|))) (SETQ |t'| (COND ((|%hasFeature| :SBCL) (|bfColonColon| 'SB-ALIEN |t'|)) @@ -3109,7 +3111,8 @@ (DEFUN |genCLISPnativeTranslation,actualArg| (|p| |pairs|) (PROG (|a'|) (RETURN - (COND ((SETQ |a'| (CDR (ASSOC |p| |pairs|))) (CDR (CDR |a'|))) (T |p|))))) + (COND ((SETQ |a'| (CDR (|objectAssoc| |p| |pairs|))) (CDR (CDR |a'|))) + (T |p|))))) (DEFUN |getCLISPType| (|a|) (LIST (|bfColonColon| 'FFI 'C-ARRAY) (LENGTH |a|))) @@ -3255,10 +3258,12 @@ (LIST |x| (COND ((SETQ |p'| - (ASSOC |p| |strPairs|)) + (|objectAssoc| |p| + |strPairs|)) (CDR |p'|)) ((SETQ |p'| - (ASSOC |p| |aryPairs|)) + (|objectAssoc| |p| + |aryPairs|)) (CDR |p'|)) (T |p|))))) (COND ((NULL |bfVar#13|) NIL) diff --git a/src/boot/strap/translator.clisp b/src/boot/strap/translator.clisp index 7ce79ebe..c39dcf5b 100644 --- a/src/boot/strap/translator.clisp +++ b/src/boot/strap/translator.clisp @@ -601,11 +601,9 @@ (COND ((|%hasFeature| :SBCL) 'SB-ALIEN) ((|%hasFeature| :CLISP) 'FFI) ((|%hasFeature| :CLOZURE) 'CCL) - ((|%hasFeature| :ECL) 'EXT) ((|%hasFeature| :GCL) 'SI) - (T NIL))) - ((|ident?| |ns|) |ns|) (T NIL))) - (COND ((NULL |z|) (|bpTrap|)) - (T (CONS 'USE-PACKAGE (CONS (SYMBOL-NAME |z|) |user|))))))) + ((|%hasFeature| :ECL) 'FFI) (T (RETURN NIL)))) + ((|ident?| |ns|) |ns|) (T (|bpTrap|)))) + (CONS 'USE-PACKAGE (CONS (SYMBOL-NAME |z|) |user|))))) ((AND (CONSP |x|) (EQ (CAR |x|) 'PROGN)) (CONS (CAR |x|) (LET ((|bfVar#2| NIL) diff --git a/src/boot/strap/utility.clisp b/src/boot/strap/utility.clisp index 8a06ff0c..7125bd09 100644 --- a/src/boot/strap/utility.clisp +++ b/src/boot/strap/utility.clisp @@ -48,6 +48,12 @@ (FTYPE (FUNCTION ((|%List| |%Thing|) |%Thing|) (|%List| |%Thing|)) |remove|)) (DECLAIM + (FTYPE + (FUNCTION (|%Thing| (|%List| (|%Pair| |%Thing| |%Thing|))) + (|%Maybe| (|%Pair| |%Thing| |%Thing|))) + |objectAssoc|)) + +(DECLAIM (FTYPE (FUNCTION ((|%List| |%Thing|) (|%List| |%Thing|)) (|%List| |%Thing|)) |setDifference|)) @@ -329,6 +335,17 @@ ((OR (CHARACTERP |x|) (INTEGERP |x|)) (|removeScalar| |l| |x|)) (T (|removeValue| |l| |x|)))) +(DEFUN |objectAssoc| (|x| |l|) + (PROG (|a| |p|) + (RETURN + (LOOP + (COND + ((NOT + (AND (CONSP |l|) (PROGN (SETQ |p| (CAR |l|)) (SETQ |l| (CDR |l|)) T))) + (RETURN NIL)) + ((AND (CONSP |p|) (PROGN (SETQ |a| (CAR |p|)) T) (EQ |a| |x|)) + (RETURN |p|))))))) + (DEFUN |charPosition| (|c| |s| |k|) (PROG (|n|) (RETURN diff --git a/src/boot/translator.boot b/src/boot/translator.boot index f7a6fc36..36f61662 100644 --- a/src/boot/translator.boot +++ b/src/boot/translator.boot @@ -434,11 +434,9 @@ packageBody(x,p) == %hasFeature KEYWORD::CLISP => 'FFI %hasFeature KEYWORD::CLOZURE => 'CCL %hasFeature KEYWORD::ECL => 'FFI - %hasFeature KEYWORD::GCL => 'SI - nil + return nil ident? ns => ns - nil - z = nil => bpTrap() + bpTrap() ['USE_-PACKAGE,symbolName z,:user] x is ['PROGN,:.] => [x.op,:[packageBody(y,p) for y in x.args]] x diff --git a/src/boot/utility.boot b/src/boot/utility.boot index 4d4d5961..44c20d2c 100644 --- a/src/boot/utility.boot +++ b/src/boot/utility.boot @@ -47,7 +47,7 @@ module utility (objectMember?, symbolMember?, stringMember?, charMember?, scalarMember?, listMember?, reverse, reverse!, lastNode, append, append!, copyList, substitute, substitute!, setDifference, setUnion, setIntersection, - applySubst, applySubst!, applySubstNQ, + applySubst, applySubst!, applySubstNQ, objectAssoc, remove,removeSymbol,atomic?,finishLine) where substitute: (%Thing,%Thing,%Thing) -> %Thing substitute!: (%Thing,%Thing,%Thing) -> %Thing @@ -57,6 +57,8 @@ module utility (objectMember?, symbolMember?, stringMember?, lastNode: %List %Thing -> %Maybe %Node %Thing removeSymbol: (%List %Thing, %Symbol) -> %List %Thing remove: (%List %Thing, %Thing) -> %List %Thing + objectAssoc: (%Thing, %List %Pair(%Thing,%Thing)) -> + %Maybe %Pair(%Thing,%Thing) setDifference: (%List %Thing,%List %Thing) -> %List %Thing setUnion: (%List %Thing,%List %Thing) -> %List %Thing setIntersection: (%List %Thing,%List %Thing) -> %List %Thing @@ -291,6 +293,11 @@ remove(l,x) == --% search +objectAssoc(x,l) == + repeat + l isnt [p,:l] => return nil + p is [a,:.] and sameObject?(a,x) => return p + ++ Return the index of the character `c' in the string `s', if present. ++ Otherwise, return nil. charPosition(c,s,k) == |