From a8716de1c3778c147f62d18f1648d8b23163fccf Mon Sep 17 00:00:00 2001 From: dos-reis Date: Tue, 9 Jun 2009 07:08:27 +0000 Subject: * interp/compiler.boot (compLogicalNot): Tidy. * interp/define.boot (doIt): Tidy conditional case. * boot/tokens.boot: 'fourth' is a now a builtin function. --- src/ChangeLog | 6 ++++++ src/boot/tokens.boot | 3 ++- src/interp/compiler.boot | 3 ++- src/interp/define.boot | 8 +++++++- 4 files changed, 17 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 70174393..0d54fe8f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-06-09 Gabriel Dos Reis + + * interp/compiler.boot (compLogicalNot): Tidy. + * interp/define.boot (doIt): Tidy conditional case. + * boot/tokens.boot: 'fourth' is a now a builtin function. + 2009-06-07 Gabriel Dos Reis * algebra/kl.spad.pamphlet (Kernel): Tidy. diff --git a/src/boot/tokens.boot b/src/boot/tokens.boot index 6a98317a..a51fe58b 100644 --- a/src/boot/tokens.boot +++ b/src/boot/tokens.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2008, Gabriel Dos Reis. +-- Copyright (C) 2007-2009, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -242,6 +242,7 @@ for i in [ _ ["exit", "EXIT"] , _ ["false", 'NIL] , _ ["first", "CAR"] , _ + ["fourth", "CADDDR"] , _ ["function","FUNCTION"] , _ ["genvar", "GENVAR"] , _ ["IN", "MEMBER"] , _ diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 817517ef..357e8564 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -1438,7 +1438,8 @@ compLogicalNot(x,m,e) == $normalizeTree and resolve(m,$Boolean) = $Boolean => $Boolean $EmptyMode yT := comp(y,yTarget,e) or return nil - yTarget = $Boolean => (rplac(first yT, ["NOT",yT.expr]); yT) + yT.mode = $Boolean and yTarget = $Boolean => + [["NOT",yT.expr],yT.mode,yT.env] compResolveCall("not",[yT],m,yT.env) diff --git a/src/interp/define.boot b/src/interp/define.boot index 8cbc7ce9..543450d9 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -1482,7 +1482,13 @@ doIt(item,$predl) == item is ["%SignatureImport",:.] => [.,.,$e] := compSignatureImport(item,$EmptyMode,$e) mutateToNothing item - item is ["IF",:.] => doItIf(item,$predl,$e) + item is ["IF",p,x,y] => + p is ["not",p'] => + rplac(second item,p') + rplac(third item,y) + rplac(fourth item,x) + doIt(item,$predl) + doItIf(item,$predl,$e) item is ["where",b,:l] => compOrCroak(item,$EmptyMode,$e) item is ["MDEF",:.] => [.,.,$e]:= compOrCroak(item,$EmptyMode,$e) item is ['DEF,[op,:.],:.] => -- cgit v1.2.3