From 567d3bbfc92aad2305987e3d6adedcb92615d5d5 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sat, 11 Oct 2008 02:11:33 +0000 Subject: * interp/c-util.boot (backendFluidize): New. * interp/comp.lisp (COMP-TRAN): Use it. (COMP-FLUIDIZE): Remove. --- src/ChangeLog | 6 ++++++ src/interp/c-util.boot | 21 +++++++++++++++++---- src/interp/comp.lisp | 15 +-------------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 193b0adb..5d76ada0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2008-10-10 Gabriel Dos Reis + + * interp/c-util.boot (backendFluidize): New. + * interp/comp.lisp (COMP-TRAN): Use it. + (COMP-FLUIDIZE): Remove. + 2008-10-10 Gabriel Dos Reis * interp/c-util.boot (backendCompile2): Bootified from COMP-2. diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index c26887c2..d2bd035a 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -1122,10 +1122,10 @@ backendCompileSPADSLAM(name,args,body) == COMP370 [u] name - -backendCompile2 form == - form isnt [name,[type,args,:body],:junk] or junk ^= nil => - MOAN FORMAT(nil,'"******* parenthesis error in (~S (~S ...) ...)",name,type) +backendCompile2: %Code -> %Symbol +backendCompile2 code == + code isnt [name,[type,args,:body],:junk] or junk ^= nil => + systemError ['"parenthesis error in: ", code] type = "SLAM" => backendCompileSLAM(name,args,body) LASSQ(name,$clamList) => compClam(name,args,body,$clamList) type = "SPADSLAM" => backendCompileSPADSLAM(name,args,body) @@ -1136,3 +1136,16 @@ backendCompile2 form == else COMP370 [body] name + +++ returns all fuild variables contained in `x'. Fuild variables are +++ identifiers starting with '$', except domain variable names. +backendFluidize x == + IDENTP x and x ^= "$" and x ^= "$$" and + (PNAME x).0 = char "$" and not DIGITP((PNAME x).1) => x + isAtomicForm x => nil + first x = "FLUID" => second x + a := backendFluidize first x + b := backendFluidize rest x + a = nil => b + [a,:b] + diff --git a/src/interp/comp.lisp b/src/interp/comp.lisp index 871cbe4c..46499b85 100644 --- a/src/interp/comp.lisp +++ b/src/interp/comp.lisp @@ -127,26 +127,13 @@ (if (or lvars (contained 'RETURN (third x))) `(prog ,lvars (return ,(third x))) (third x)) ))))) - (let ((fluids (S+ (comp-fluidize (second x)) SpecialVars))) + (let ((fluids (S+ (|backendFluidize| (second x)) SpecialVars))) (if fluids `(,(first x) ,(second x) (declare (special . ,fluids)) . ,(cddr x)) `(,(first x) ,(second x) . ,(cddr x)))))) ; Fluidize: Returns a list of fluid variables in X -(DEFUN COMP-FLUIDIZE (X) - (COND ((AND (symbolp X) - (NE X '$) - (NE X '$$) - (char= #\$ (ELT (PNAME X) 0)) - (NOT (DIGITP (ELT (PNAME X) 1)))) - x) - ((atom x) nil) - ((eq (first X) 'FLUID) (second X)) - ((let ((a (comp-fluidize (first x))) - (b (comp-fluidize (rest x)))) - (if a (cons a b) b))))) - (DEFUN COMP\,FLUIDIZE (X) (COND ((AND (IDENTP X) (NE X '$) -- cgit v1.2.3