(PROCLAIM '(OPTIMIZE SPEED)) (IMPORT-MODULE "includer") (IN-PACKAGE "BOOTTRAN") (PROVIDE "ast") (DEFPARAMETER |$bfClamming| NIL) (DEFPARAMETER |$constantIdentifiers| NIL) (DEFPARAMETER |$activeNamespace| NIL) (DEFTYPE |%Thing| () 'T) (DEFTYPE |%Boolean| () 'BOOLEAN) (DEFTYPE |%String| () 'STRING) (DEFTYPE |%Symbol| () 'SYMBOL) (DEFTYPE |%Short| () 'FIXNUM) (DEFTYPE |%List| () 'LIST) (DEFTYPE |%Vector| () 'VECTOR) (DEFTYPE |%Sequence| () 'SEQUENCE) (DEFUN |%Name| #0=(|bfVar#1|) (CONS '|%Name| (LIST . #0#))) (DEFUN |%Command| #0=(|bfVar#2|) (CONS '|%Command| (LIST . #0#))) (DEFUN |%Lisp| #0=(|bfVar#3|) (CONS '|%Lisp| (LIST . #0#))) (DEFUN |%Module| #0=(|bfVar#4| |bfVar#5|) (CONS '|%Module| (LIST . #0#))) (DEFUN |%Namespace| #0=(|bfVar#6|) (CONS '|%Namespace| (LIST . #0#))) (DEFUN |%Import| #0=(|bfVar#7|) (CONS '|%Import| (LIST . #0#))) (DEFUN |%ImportSignature| #0=(|bfVar#8| |bfVar#9|) (CONS '|%ImportSignature| (LIST . #0#))) (DEFUN |%TypeAlias| #0=(|bfVar#10| |bfVar#11|) (CONS '|%TypeAlias| (LIST . #0#))) (DEFUN |%Signature| #0=(|bfVar#12| |bfVar#13|) (CONS '|%Signature| (LIST . #0#))) (DEFUN |%Mapping| #0=(|bfVar#14| |bfVar#15|) (CONS '|%Mapping| (LIST . #0#))) (DEFUN |%SuffixDot| #0=(|bfVar#16|) (CONS '|%SuffixDot| (LIST . #0#))) (DEFUN |%Quote| #0=(|bfVar#17|) (CONS '|%Quote| (LIST . #0#))) (DEFUN |%EqualName| #0=(|bfVar#18|) (CONS '|%EqualName| (LIST . #0#))) (DEFUN |%Colon| #0=(|bfVar#19|) (CONS '|%Colon| (LIST . #0#))) (DEFUN |%QualifiedName| #0=(|bfVar#20| |bfVar#21|) (CONS '|%QualifiedName| (LIST . #0#))) (DEFUN |%DefaultValue| #0=(|bfVar#22| |bfVar#23|) (CONS '|%DefaultValue| (LIST . #0#))) (DEFUN |%Bracket| #0=(|bfVar#24|) (CONS '|%Bracket| (LIST . #0#))) (DEFUN |%UnboundedSegment| #0=(|bfVar#25|) (CONS '|%UnboundedSegment| (LIST . #0#))) (DEFUN |%BoundedSgement| #0=(|bfVar#26| |bfVar#27|) (CONS '|%BoundedSgement| (LIST . #0#))) (DEFUN |%Tuple| #0=(|bfVar#28|) (CONS '|%Tuple| (LIST . #0#))) (DEFUN |%ColonAppend| #0=(|bfVar#29| |bfVar#30|) (CONS '|%ColonAppend| (LIST . #0#))) (DEFUN |%Is| #0=(|bfVar#31| |bfVar#32|) (CONS '|%Is| (LIST . #0#))) (DEFUN |%Isnt| #0=(|bfVar#33| |bfVar#34|) (CONS '|%Isnt| (LIST . #0#))) (DEFUN |%Reduce| #0=(|bfVar#35| |bfVar#36|) (CONS '|%Reduce| (LIST . #0#))) (DEFUN |%PrefixExpr| #0=(|bfVar#37| |bfVar#38|) (CONS '|%PrefixExpr| (LIST . #0#))) (DEFUN |%Call| #0=(|bfVar#39| |bfVar#40|) (CONS '|%Call| (LIST . #0#))) (DEFUN |%InfixExpr| #0=(|bfVar#41| |bfVar#42| |bfVar#43|) (CONS '|%InfixExpr| (LIST . #0#))) (DEFUN |%ConstantDefinition| #0=(|bfVar#44| |bfVar#45|) (CONS '|%ConstantDefinition| (LIST . #0#))) (DEFUN |%Definition| #0=(|bfVar#46| |bfVar#47| |bfVar#48|) (CONS '|%Definition| (LIST . #0#))) (DEFUN |%Macro| #0=(|bfVar#49| |bfVar#50| |bfVar#51|) (CONS '|%Macro| (LIST . #0#))) (DEFUN |%SuchThat| #0=(|bfVar#52|) (CONS '|%SuchThat| (LIST . #0#))) (DEFUN |%Assignment| #0=(|bfVar#53| |bfVar#54|) (CONS '|%Assignment| (LIST . #0#))) (DEFUN |%While| #0=(|bfVar#55|) (CONS '|%While| (LIST . #0#))) (DEFUN |%Until| #0=(|bfVar#56|) (CONS '|%Until| (LIST . #0#))) (DEFUN |%For| #0=(|bfVar#57| |bfVar#58| |bfVar#59|) (CONS '|%For| (LIST . #0#))) (DEFUN |%Implies| #0=(|bfVar#60| |bfVar#61|) (CONS '|%Implies| (LIST . #0#))) (DEFUN |%Iterators| #0=(|bfVar#62|) (CONS '|%Iterators| (LIST . #0#))) (DEFUN |%Cross| #0=(|bfVar#63|) (CONS '|%Cross| (LIST . #0#))) (DEFUN |%Repeat| #0=(|bfVar#64| |bfVar#65|) (CONS '|%Repeat| (LIST . #0#))) (DEFUN |%Pile| #0=(|bfVar#66|) (CONS '|%Pile| (LIST . #0#))) (DEFUN |%Append| #0=(|bfVar#67|) (CONS '|%Append| (LIST . #0#))) (DEFUN |%Case| #0=(|bfVar#68| |bfVar#69|) (CONS '|%Case| (LIST . #0#))) (DEFUN |%Return| #0=(|bfVar#70|) (CONS '|%Return| (LIST . #0#))) (DEFUN |%Throw| #0=(|bfVar#71|) (CONS '|%Throw| (LIST . #0#))) (DEFUN |%Catch| #0=(|bfVar#72|) (CONS '|%Catch| (LIST . #0#))) (DEFUN |%Try| #0=(|bfVar#73| |bfVar#74|) (CONS '|%Try| (LIST . #0#))) (DEFUN |%Where| #0=(|bfVar#75| |bfVar#76|) (CONS '|%Where| (LIST . #0#))) (DEFUN |%Structure| #0=(|bfVar#77| |bfVar#78|) (CONS '|%Structure| (LIST . #0#))) (DEFPARAMETER |$inDefIS| NIL) (DEFUN |quote| (|x|) (LIST 'QUOTE |x|)) (DECLAIM (FTYPE (FUNCTION NIL |%Symbol|) |bfGenSymbol|)) (DEFUN |bfGenSymbol| () (DECLARE (SPECIAL |$GenVarCounter|)) (PROGN (SETQ |$GenVarCounter| (+ |$GenVarCounter| 1)) (INTERN (CONCAT "bfVar#" (STRINGIMAGE |$GenVarCounter|))))) (DECLAIM (FTYPE (FUNCTION (|%Thing|) |%List|) |bfColon|)) (DEFUN |bfColon| (|x|) (LIST 'COLON |x|)) (DECLAIM (FTYPE (FUNCTION (|%Symbol| |%Symbol|) |%Symbol|) |bfColonColon|)) (DEFUN |bfColonColon| (|package| |name|) (COND ((AND (|%hasFeature| :CLISP) (MEMQ |package| '(EXT FFI))) (FIND-SYMBOL (SYMBOL-NAME |name|) |package|)) (T (INTERN (SYMBOL-NAME |name|) |package|)))) (DECLAIM (FTYPE (FUNCTION (|%Thing|) |%Thing|) |bfSymbol|)) (DEFUN |bfSymbol| (|x|) (COND ((STRINGP |x|) |x|) (T (LIST 'QUOTE |x|)))) (DECLAIM (FTYPE (FUNCTION NIL |%Symbol|) |bfDot|)) (DEFUN |bfDot| () 'DOT) (DECLAIM (FTYPE (FUNCTION (|%Thing|) |%List|) |bfSuffixDot|)) (DEFUN |bfSuffixDot| (|x|) (LIST |x| 'DOT)) (DECLAIM (FTYPE (FUNCTION (|%Thing|) |%List|) |bfEqual|)) (DEFUN |bfEqual| (|name|) (LIST 'EQUAL |name|)) (DECLAIM (FTYPE (FUNCTION (|%Thing|) |%Thing|) |bfBracket|)) (DEFUN |bfBracket| (|part|) |part|) (DECLAIM (FTYPE (FUNCTION (|%List|) |%List|) |bfPile|)) (DEFUN |bfPile| (|part|) |part|) (DECLAIM (FTYPE (FUNCTION (|%List|) |%List|) |bfAppend|)) (DEFUN |bfAppend| (|x|) (APPLY #'APPEND |x|)) (DECLAIM (FTYPE (FUNCTION (|%List| |%Thing|) |%List|) |bfColonAppend|)) (DEFUN |bfColonAppend| (|x| |y|) (PROG (|a|) (RETURN (COND ((NULL |x|) (COND ((AND (CONSP |y|) (EQ (CAR |y|) 'BVQUOTE)) (SETQ |a| (CDR |y|)) (LIST '&REST (CONS 'QUOTE |a|))) (T (LIST '&REST |y|)))) (T (CONS (CAR |x|) (|bfColonAppend| (CDR |x|) |y|))))))) (DECLAIM (FTYPE (FUNCTION (|%Thing|) |%Boolean|) |bfBeginsDollar|)) (DEFUN |bfBeginsDollar| (|x|) (EQL (ELT (PNAME |x|) 0) (|char| '$))) (DEFUN |compFluid| (|id|) (LIST 'FLUID |id|)) (DEFUN |compFluidize| (|x|) (COND ((AND (IDENTP |x|) (|bfBeginsDollar| |x|)) (|compFluid| |x|)) ((ATOM |x|) |x|) ((AND (CONSP |x|) (EQ (CAR |x|) 'QUOTE)) |x|) (T (CONS (|compFluidize| (CAR |x|)) (|compFluidize| (CDR |x|)))))) (DEFUN |bfTuple| (|x|) (CONS 'TUPLE |x|)) (DEFUN |bfTupleP| (|x|) (AND (CONSP |x|) (EQ (CAR |x|) 'TUPLE))) (DEFUN |bfUntuple| (|bf|) (COND ((|bfTupleP| |bf|) (CDR |bf|)) (T |bf|))) (DEFUN |bfTupleIf| (|x|) (COND ((|bfTupleP| |x|) |x|) (T (|bfTuple| |x|)))) (DEFUN |bfTupleConstruct| (|b|) (PROG (|ISTMP#1| |a|) (RETURN (PROGN (SETQ |a| (COND ((|bfTupleP| |b|) (CDR |b|)) (T (LIST |b|)))) (COND ((LET ((|bfVar#80| NIL) (|bfVar#79| |a|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#79|) (PROGN (SETQ |x| (CAR |bfVar#79|)) NIL)) (RETURN |bfVar#80|)) (T (PROGN (SETQ |bfVar#80| (AND (CONSP |x|) (EQ (CAR |x|) 'COLON) (PROGN (SETQ |ISTMP#1| (CDR |x|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)))))) (COND (|bfVar#80| (RETURN |bfVar#80|)))))) (SETQ |bfVar#79| (CDR |bfVar#79|)))) (|bfMakeCons| |a|)) (T (CONS 'LIST |a|))))))) (DEFUN |bfConstruct| (|b|) (PROG (|a|) (RETURN (PROGN (SETQ |a| (COND ((|bfTupleP| |b|) (CDR |b|)) (T (LIST |b|)))) (|bfMakeCons| |a|))))) (DEFUN |bfMakeCons| (|l|) (PROG (|l1| |a| |ISTMP#2| |ISTMP#1|) (RETURN (COND ((NULL |l|) NIL) ((AND (CONSP |l|) (PROGN (SETQ |ISTMP#1| (CAR |l|)) (AND (CONSP |ISTMP#1|) (EQ (CAR |ISTMP#1|) 'COLON) (PROGN (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (NULL (CDR |ISTMP#2|)) (PROGN (SETQ |a| (CAR |ISTMP#2|)) T)))))) (SETQ |l1| (CDR |l|)) (COND (|l1| (LIST 'APPEND |a| (|bfMakeCons| |l1|))) (T |a|))) (T (LIST 'CONS (CAR |l|) (|bfMakeCons| (CDR |l|)))))))) (DEFUN |bfFor| (|bflhs| U |step|) (COND ((AND (CONSP U) (EQ (CAR U) '|tails|)) (|bfForTree| 'ON |bflhs| (CADR U))) ((AND (CONSP U) (EQ (CAR U) 'SEGMENT)) (|bfSTEP| |bflhs| (CADR U) |step| (CADDR U))) (T (|bfForTree| 'IN |bflhs| U)))) (DEFUN |bfForTree| (OP |lhs| |whole|) (PROG (G) (RETURN (PROGN (SETQ |whole| (COND ((|bfTupleP| |whole|) (|bfMakeCons| (CDR |whole|))) (T |whole|))) (COND ((ATOM |lhs|) (|bfINON| (LIST OP |lhs| |whole|))) (T (SETQ |lhs| (COND ((|bfTupleP| |lhs|) (CADR |lhs|)) (T |lhs|))) (COND ((AND (CONSP |lhs|) (EQ (CAR |lhs|) 'L%T)) (SETQ G (CADR |lhs|)) (APPEND (|bfINON| (LIST OP G |whole|)) (|bfSuchthat| (|bfIS| G (CADDR |lhs|))))) (T (SETQ G (|bfGenSymbol|)) (APPEND (|bfINON| (LIST OP G |whole|)) (|bfSuchthat| (|bfIS| G |lhs|))))))))))) (DEFUN |bfSTEP| (|id| |fst| |step| |lst|) (PROG (|suc| |ex| |pred| |final| |g2| |inc| |g1| |initval| |initvar|) (RETURN (PROGN (SETQ |initvar| (LIST |id|)) (SETQ |initval| (LIST |fst|)) (SETQ |inc| (COND ((ATOM |step|) |step|) (T (SETQ |g1| (|bfGenSymbol|)) (SETQ |initvar| (CONS |g1| |initvar|)) (SETQ |initval| (CONS |step| |initval|)) |g1|))) (SETQ |final| (COND ((ATOM |lst|) |lst|) (T (SETQ |g2| (|bfGenSymbol|)) (SETQ |initvar| (CONS |g2| |initvar|)) (SETQ |initval| (CONS |lst| |initval|)) |g2|))) (SETQ |ex| (COND ((NULL |lst|) NIL) ((INTEGERP |inc|) (SETQ |pred| (COND ((MINUSP |inc|) '<) (T '>))) (LIST (LIST |pred| |id| |final|))) (T (LIST (LIST 'COND (LIST (LIST 'MINUSP |inc|) (LIST '< |id| |final|)) (LIST 'T (LIST '> |id| |final|))))))) (SETQ |suc| (LIST (LIST 'SETQ |id| (LIST '+ |id| |inc|)))) (LIST (LIST |initvar| |initval| |suc| NIL |ex| NIL)))))) (DEFUN |bfINON| (|x|) (PROG (|whole| |id| |op|) (RETURN (PROGN (SETQ |op| (CAR |x|)) (SETQ |id| (CADR . #0=(|x|))) (SETQ |whole| (CADDR . #0#)) (COND ((EQ |op| 'ON) (|bfON| |id| |whole|)) (T (|bfIN| |id| |whole|))))))) (DEFUN |bfIN| (|x| E) (PROG (|g|) (RETURN (PROGN (SETQ |g| (|bfGenSymbol|)) (LIST (LIST (LIST |g| |x|) (LIST E NIL) (LIST (LIST 'SETQ |g| (LIST 'CDR |g|))) NIL (LIST (LIST 'OR (LIST 'ATOM |g|) (LIST 'PROGN (LIST 'SETQ |x| (LIST 'CAR |g|)) 'NIL))) NIL)))))) (DEFUN |bfON| (|x| E) (LIST (LIST (LIST |x|) (LIST E) (LIST (LIST 'SETQ |x| (LIST 'CDR |x|))) NIL (LIST (LIST 'ATOM |x|)) NIL))) (DEFUN |bfSuchthat| (|p|) (LIST (LIST NIL NIL NIL (LIST |p|) NIL NIL))) (DEFUN |bfWhile| (|p|) (LIST (LIST NIL NIL NIL NIL (LIST (|bfNOT| |p|)) NIL))) (DEFUN |bfUntil| (|p|) (PROG (|g|) (RETURN (PROGN (SETQ |g| (|bfGenSymbol|)) (LIST (LIST (LIST |g|) (LIST NIL) (LIST (LIST 'SETQ |g| |p|)) NIL (LIST |g|) NIL)))))) (DEFUN |bfIterators| (|x|) (CONS 'ITERATORS |x|)) (DEFUN |bfCross| (|x|) (CONS 'CROSS |x|)) (DEFUN |bfLp| (|iters| |body|) (COND ((AND (CONSP |iters|) (EQ (CAR |iters|) 'ITERATORS)) (|bfLp1| (CDR |iters|) |body|)) (T (|bfLpCross| (CDR |iters|) |body|)))) (DEFUN |bfLpCross| (|iters| |body|) (COND ((NULL (CDR |iters|)) (|bfLp| (CAR |iters|) |body|)) (T (|bfLp| (CAR |iters|) (|bfLpCross| (CDR |iters|) |body|))))) (DEFUN |bfSep| (|iters|) (PROG (|r| |f|) (RETURN (COND ((NULL |iters|) (LIST NIL NIL NIL NIL NIL NIL)) (T (SETQ |f| (CAR |iters|)) (SETQ |r| (|bfSep| (CDR |iters|))) (LET ((|bfVar#83| NIL) (|bfVar#81| |f|) (|i| NIL) (|bfVar#82| |r|) (|j| NIL)) (LOOP (COND ((OR (ATOM |bfVar#81|) (PROGN (SETQ |i| (CAR |bfVar#81|)) NIL) (ATOM |bfVar#82|) (PROGN (SETQ |j| (CAR |bfVar#82|)) NIL)) (RETURN (NREVERSE |bfVar#83|))) (T (SETQ |bfVar#83| (CONS (APPEND |i| |j|) |bfVar#83|)))) (SETQ |bfVar#81| (CDR |bfVar#81|)) (SETQ |bfVar#82| (CDR |bfVar#82|))))))))) (DEFUN |bfReduce| (|op| |y|) (PROG (|it| |ny| |g2| |body| |g1| |g| |init| |a|) (RETURN (PROGN (SETQ |a| (COND ((AND (CONSP |op|) (EQ (CAR |op|) 'QUOTE)) (CADR |op|)) (T |op|))) (SETQ |op| (|bfReName| |a|)) (SETQ |init| (OR (GET |a| 'SHOETHETA) (GET |op| 'SHOETHETA))) (SETQ |g| (|bfGenSymbol|)) (SETQ |g1| (|bfGenSymbol|)) (SETQ |body| (LIST 'SETQ |g| (LIST |op| |g| |g1|))) (COND ((NULL |init|) (SETQ |g2| (|bfGenSymbol|)) (SETQ |init| (LIST 'CAR |g2|)) (SETQ |ny| (LIST 'CDR |g2|)) (SETQ |it| (CONS 'ITERATORS (LIST (LIST (LIST (LIST |g|) (LIST |init|) NIL NIL NIL (LIST |g|))) (|bfIN| |g1| |ny|)))) (|bfMKPROGN| (LIST (LIST 'L%T |g2| |y|) (|bfLp| |it| |body|)))) (T (SETQ |init| (CAR |init|)) (SETQ |it| (CONS 'ITERATORS (LIST (LIST (LIST (LIST |g|) (LIST |init|) NIL NIL NIL (LIST |g|))) (|bfIN| |g1| |y|)))) (|bfLp| |it| |body|))))))) (DEFUN |bfReduceCollect| (|op| |y|) (PROG (|init| |a| |itl| |body|) (RETURN (COND ((AND (CONSP |y|) (EQ (CAR |y|) 'COLLECT)) (SETQ |body| (ELT |y| 1)) (SETQ |itl| (ELT |y| 2)) (SETQ |a| (COND ((AND (CONSP |op|) (EQ (CAR |op|) 'QUOTE)) (CADR |op|)) (T |op|))) (SETQ |op| (|bfReName| |a|)) (SETQ |init| (OR (GET |a| 'SHOETHETA) (GET |op| 'SHOETHETA))) (|bfOpReduce| |op| |init| |body| |itl|)) (T (|bfReduce| |op| (|bfTupleConstruct| (ELT |y| 1)))))))) (DEFUN |bfDCollect| (|y| |itl|) (LIST 'COLLECT |y| |itl|)) (DEFUN |bfDTuple| (|x|) (LIST 'DTUPLE |x|)) (DEFUN |bfCollect| (|y| |itl|) (PROG (|newBody| |a| |ISTMP#1|) (RETURN (COND ((AND (CONSP |y|) (EQ (CAR |y|) 'COLON) (PROGN (SETQ |ISTMP#1| (CDR |y|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |a| (CAR |ISTMP#1|)) T)))) (|bf0APPEND| |a| |itl|)) ((AND (CONSP |y|) (EQ (CAR |y|) 'TUPLE)) (SETQ |newBody| (|bfConstruct| |y|)) (|bf0APPEND| |newBody| |itl|)) (T (|bf0COLLECT| |y| |itl|)))))) (DEFUN |bf0COLLECT| (|y| |itl|) (|bfListReduce| 'CONS |y| |itl|)) (DEFUN |bf0APPEND| (|y| |itl|) (PROG (|extrait| |body| |g|) (RETURN (PROGN (SETQ |g| (|bfGenSymbol|)) (SETQ |body| (LIST 'SETQ |g| (LIST 'APPEND (LIST 'REVERSE |y|) |g|))) (SETQ |extrait| (LIST (LIST (LIST |g|) (LIST NIL) NIL NIL NIL (LIST (LIST 'NREVERSE |g|))))) (|bfLp2| |extrait| |itl| |body|))))) (DEFUN |bfListReduce| (|op| |y| |itl|) (PROG (|extrait| |body| |g|) (RETURN (PROGN (SETQ |g| (|bfGenSymbol|)) (SETQ |body| (LIST 'SETQ |g| (LIST |op| |y| |g|))) (SETQ |extrait| (LIST (LIST (LIST |g|) (LIST NIL) NIL NIL NIL (LIST (LIST 'NREVERSE |g|))))) (|bfLp2| |extrait| |itl| |body|))))) (DEFUN |bfLp1| (|iters| |body|) (PROG (|loop| |nbody| |value| |exits| |filters| |sucs| |inits| |vars| |LETTMP#1|) (RETURN (PROGN (SETQ |LETTMP#1| (|bfSep| (|bfAppend| |iters|))) (SETQ |vars| (CAR |LETTMP#1|)) (SETQ |inits| (CADR . #0=(|LETTMP#1|))) (SETQ |sucs| (CADDR . #0#)) (SETQ |filters| (CADDDR . #0#)) (SETQ |exits| (CAR #1=(CDDDDR . #0#))) (SETQ |value| (CADR #1#)) (SETQ |nbody| (COND ((NULL |filters|) |body|) (T (|bfAND| (APPEND |filters| (CONS |body| NIL)))))) (SETQ |value| (COND ((NULL |value|) 'NIL) (T (CAR |value|)))) (SETQ |exits| (LIST 'COND (LIST (|bfOR| |exits|) (LIST 'RETURN |value|)) (LIST 'T |nbody|))) (SETQ |loop| (CONS 'LOOP (CONS |exits| |sucs|))) (COND (|vars| (SETQ |loop| (LIST 'LET (LET ((|bfVar#86| NIL) (|bfVar#84| |vars|) (|v| NIL) (|bfVar#85| |inits|) (|i| NIL)) (LOOP (COND ((OR (ATOM |bfVar#84|) (PROGN (SETQ |v| (CAR |bfVar#84|)) NIL) (ATOM |bfVar#85|) (PROGN (SETQ |i| (CAR |bfVar#85|)) NIL)) (RETURN (NREVERSE |bfVar#86|))) (T (SETQ |bfVar#86| (CONS (LIST |v| |i|) |bfVar#86|)))) (SETQ |bfVar#84| (CDR |bfVar#84|)) (SETQ |bfVar#85| (CDR |bfVar#85|)))) |loop|)))) |loop|)))) (DEFUN |bfLp2| (|extrait| |itl| |body|) (PROG (|iters|) (RETURN (COND ((AND (CONSP |itl|) (EQ (CAR |itl|) 'ITERATORS)) (|bfLp1| (CONS |extrait| (CDR |itl|)) |body|)) (T (SETQ |iters| (CDR |itl|)) (|bfLpCross| (CONS (CONS 'ITERATORS (CONS |extrait| (CDAR |iters|))) (CDR |iters|)) |body|)))))) (DEFUN |bfOpReduce| (|op| |init| |y| |itl|) (PROG (|extrait| |g1| |body| |g|) (RETURN (PROGN (SETQ |g| (|bfGenSymbol|)) (SETQ |body| (COND ((EQ |op| 'AND) (|bfMKPROGN| (LIST (LIST 'SETQ |g| |y|) (LIST 'COND (LIST (LIST 'NOT |g|) (LIST 'RETURN 'NIL)))))) ((EQ |op| 'OR) (|bfMKPROGN| (LIST (LIST 'SETQ |g| |y|) (LIST 'COND (LIST |g| (LIST 'RETURN |g|)))))) (T (LIST 'SETQ |g| (LIST |op| |g| |y|))))) (COND ((NULL |init|) (SETQ |g1| (|bfGenSymbol|)) (SETQ |init| (LIST 'CAR |g1|)) (SETQ |y| (LIST 'CDR |g1|)) (SETQ |extrait| (LIST (LIST (LIST |g|) (LIST |init|) NIL NIL NIL (LIST |g|)))) (|bfMKPROGN| (LIST (LIST 'L%T |g1| |y|) (|bfLp2| |extrait| |itl| |body|)))) (T (SETQ |init| (CAR |init|)) (SETQ |extrait| (LIST (LIST (LIST |g|) (LIST |init|) NIL NIL NIL (LIST |g|)))) (|bfLp2| |extrait| |itl| |body|))))))) (DEFUN |bfLoop1| (|body|) (|bfLp| (|bfIterators| NIL) |body|)) (DEFUN |bfSegment1| (|lo|) (LIST 'SEGMENT |lo| NIL)) (DEFUN |bfSegment2| (|lo| |hi|) (LIST 'SEGMENT |lo| |hi|)) (DEFUN |bfForInBy| (|variable| |collection| |step|) (|bfFor| |variable| |collection| |step|)) (DEFUN |bfForin| (|lhs| U) (|bfFor| |lhs| U 1)) (DEFUN |bfLocal| (|a| |b|) (COND ((EQ |b| 'FLUID) (|compFluid| |a|)) ((EQ |b| '|fluid|) (|compFluid| |a|)) ((EQ |b| '|local|) (|compFluid| |a|)) (T |a|))) (DEFUN |bfTake| (|n| |x|) (COND ((NULL |x|) |x|) ((EQL |n| 0) NIL) (T (CONS (CAR |x|) (|bfTake| (- |n| 1) (CDR |x|)))))) (DEFUN |bfDrop| (|n| |x|) (COND ((OR (NULL |x|) (EQL |n| 0)) |x|) (T (|bfDrop| (- |n| 1) (CDR |x|))))) (DEFUN |bfReturnNoName| (|a|) (LIST 'RETURN |a|)) (DEFUN |bfSUBLIS| (|p| |e|) (COND ((ATOM |e|) (|bfSUBLIS1| |p| |e|)) ((AND (CONSP |e|) (EQ (CAR |e|) 'QUOTE)) |e|) (T (CONS (|bfSUBLIS| |p| (CAR |e|)) (|bfSUBLIS| |p| (CDR |e|)))))) (DEFUN |bfSUBLIS1| (|p| |e|) (PROG (|f|) (RETURN (COND ((NULL |p|) |e|) (T (SETQ |f| (CAR |p|)) (COND ((EQ (CAR |f|) |e|) (|bfSUBLIS| |p| (CDR |f|))) (T (|bfSUBLIS1| (CDR |p|) |e|)))))))) (DEFUN |defSheepAndGoats| (|x|) (PROG (|defstack| |op1| |opassoc| |argl|) (DECLARE (SPECIAL |$op|)) (RETURN (CASE (CAR |x|) (|%Definition| (LET ((|op| (CADR |x|)) (|args| (CADDR |x|)) (|body| (CADDDR |x|))) (PROGN (SETQ |argl| (COND ((|bfTupleP| |args|) (CDR |args|)) (T (LIST |args|)))) (COND ((NULL |argl|) (SETQ |opassoc| (LIST (CONS |op| |body|))) (LIST |opassoc| NIL NIL)) (T (SETQ |op1| (INTERN (CONCAT (PNAME |$op|) "," (PNAME |op|)))) (SETQ |opassoc| (LIST (CONS |op| |op1|))) (SETQ |defstack| (LIST (LIST |op1| |args| |body|))) (LIST |opassoc| |defstack| NIL)))))) (|%Pile| (LET ((|defs| (CADR |x|))) (|defSheepAndGoatsList| |defs|))) (T (LIST NIL NIL (LIST |x|))))))) (DEFUN |defSheepAndGoatsList| (|x|) (PROG (|nondefs1| |defs1| |opassoc1| |nondefs| |defs| |opassoc| |LETTMP#1|) (RETURN (COND ((NULL |x|) (LIST NIL NIL NIL)) (T (SETQ |LETTMP#1| (|defSheepAndGoats| (CAR |x|))) (SETQ |opassoc| (CAR |LETTMP#1|)) (SETQ |defs| (CADR . #0=(|LETTMP#1|))) (SETQ |nondefs| (CADDR . #0#)) (SETQ |LETTMP#1| (|defSheepAndGoatsList| (CDR |x|))) (SETQ |opassoc1| (CAR |LETTMP#1|)) (SETQ |defs1| (CADR . #1=(|LETTMP#1|))) (SETQ |nondefs1| (CADDR . #1#)) (LIST (APPEND |opassoc| |opassoc1|) (APPEND |defs| |defs1|) (APPEND |nondefs| |nondefs1|))))))) (DEFUN |bfLetForm| (|lhs| |rhs|) (LIST 'L%T |lhs| |rhs|)) (DEFUN |bfLET1| (|lhs| |rhs|) (PROG (|let1| |g| |l2| |l1| |name| |rhs1| |ISTMP#1|) (DECLARE (SPECIAL |$letGenVarCounter|)) (RETURN (COND ((IDENTP |lhs|) (|bfLetForm| |lhs| |rhs|)) ((AND (CONSP |lhs|) (EQ (CAR |lhs|) 'FLUID) (PROGN (SETQ |ISTMP#1| (CDR |lhs|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|))))) (|bfLetForm| |lhs| |rhs|)) ((AND (IDENTP |rhs|) (NOT (|bfCONTAINED| |rhs| |lhs|))) (SETQ |rhs1| (|bfLET2| |lhs| |rhs|)) (COND ((AND (CONSP |rhs1|) (EQ (CAR |rhs1|) 'L%T)) (|bfMKPROGN| (LIST |rhs1| |rhs|))) ((AND (CONSP |rhs1|) (EQ (CAR |rhs1|) 'PROGN)) (APPEND |rhs1| (LIST |rhs|))) (T (COND ((IDENTP (CAR |rhs1|)) (SETQ |rhs1| (CONS |rhs1| NIL)))) (|bfMKPROGN| (APPEND |rhs1| (CONS |rhs| NIL)))))) ((AND (CONSP |rhs|) (EQ (CAR |rhs|) 'L%T) (IDENTP (SETQ |name| (CADR |rhs|)))) (SETQ |l1| (|bfLET1| |name| (CADDR |rhs|))) (SETQ |l2| (|bfLET1| |lhs| |name|)) (COND ((AND (CONSP |l2|) (EQ (CAR |l2|) 'PROGN)) (|bfMKPROGN| (CONS |l1| (CDR |l2|)))) (T (COND ((IDENTP (CAR |l2|)) (SETQ |l2| (CONS |l2| NIL)))) (|bfMKPROGN| (CONS |l1| (APPEND |l2| (CONS |name| NIL))))))) (T (SETQ |g| (INTERN (CONCAT "LETTMP#" (STRINGIMAGE |$letGenVarCounter|)))) (SETQ |$letGenVarCounter| (+ |$letGenVarCounter| 1)) (SETQ |rhs1| (LIST 'L%T |g| |rhs|)) (SETQ |let1| (|bfLET1| |lhs| |g|)) (COND ((AND (CONSP |let1|) (EQ (CAR |let1|) 'PROGN)) (|bfMKPROGN| (CONS |rhs1| (CDR |let1|)))) (T (COND ((IDENTP (CAR |let1|)) (SETQ |let1| (CONS |let1| NIL)))) (|bfMKPROGN| (CONS |rhs1| (APPEND |let1| (CONS |g| NIL))))))))))) (DEFUN |bfCONTAINED| (|x| |y|) (COND ((EQ |x| |y|) T) ((ATOM |y|) NIL) (T (OR (|bfCONTAINED| |x| (CAR |y|)) (|bfCONTAINED| |x| (CDR |y|)))))) (DEFUN |bfLET2| (|lhs| |rhs|) (PROG (|isPred| |val1| |ISTMP#3| |g| |rev| |patrev| |l2| |l1| |var2| |var1| |b| |ISTMP#2| |a| |ISTMP#1|) (DECLARE (SPECIAL |$inDefIS| |$letGenVarCounter|)) (RETURN (COND ((IDENTP |lhs|) (|bfLetForm| |lhs| |rhs|)) ((NULL |lhs|) NIL) ((AND (CONSP |lhs|) (EQ (CAR |lhs|) 'FLUID) (PROGN (SETQ |ISTMP#1| (CDR |lhs|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|))))) (|bfLetForm| |lhs| |rhs|)) ((AND (CONSP |lhs|) (EQ (CAR |lhs|) 'L%T) (PROGN (SETQ |ISTMP#1| (CDR |lhs|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |a| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (NULL (CDR |ISTMP#2|)) (PROGN (SETQ |b| (CAR |ISTMP#2|)) T)))))) (SETQ |a| (|bfLET2| |a| |rhs|)) (COND ((NULL (SETQ |b| (|bfLET2| |b| |rhs|))) |a|) ((ATOM |b|) (LIST |a| |b|)) ((CONSP (CAR |b|)) (CONS |a| |b|)) (T (LIST |a| |b|)))) ((AND (CONSP |lhs|) (EQ (CAR |lhs|) 'CONS) (PROGN (SETQ |ISTMP#1| (CDR |lhs|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |var1| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (NULL (CDR |ISTMP#2|)) (PROGN (SETQ |var2| (CAR |ISTMP#2|)) T)))))) (COND ((OR (EQ |var1| 'DOT) (AND (CONSP |var1|) (EQ (CAR |var1|) 'QUOTE))) (|bfLET2| |var2| (|addCARorCDR| 'CDR |rhs|))) (T (SETQ |l1| (|bfLET2| |var1| (|addCARorCDR| 'CAR |rhs|))) (COND ((OR (NULL |var2|) (EQ |var2| 'DOT)) |l1|) (T (COND ((AND (CONSP |l1|) (ATOM (CAR |l1|))) (SETQ |l1| (CONS |l1| NIL)))) (COND ((IDENTP |var2|) (APPEND |l1| (CONS (|bfLetForm| |var2| (|addCARorCDR| 'CDR |rhs|)) NIL))) (T (SETQ |l2| (|bfLET2| |var2| (|addCARorCDR| 'CDR |rhs|))) (COND ((AND (CONSP |l2|) (ATOM (CAR |l2|))) (SETQ |l2| (CONS |l2| NIL)))) (APPEND |l1| |l2|)))))))) ((AND (CONSP |lhs|) (EQ (CAR |lhs|) 'APPEND) (PROGN (SETQ |ISTMP#1| (CDR |lhs|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |var1| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (NULL (CDR |ISTMP#2|)) (PROGN (SETQ |var2| (CAR |ISTMP#2|)) T)))))) (SETQ |patrev| (|bfISReverse| |var2| |var1|)) (SETQ |rev| (LIST 'REVERSE |rhs|)) (SETQ |g| (INTERN (CONCAT "LETTMP#" (STRINGIMAGE |$letGenVarCounter|)))) (SETQ |$letGenVarCounter| (+ |$letGenVarCounter| 1)) (SETQ |l2| (|bfLET2| |patrev| |g|)) (COND ((AND (CONSP |l2|) (ATOM (CAR |l2|))) (SETQ |l2| (CONS |l2| NIL)))) (COND ((EQ |var1| 'DOT) (CONS (LIST 'L%T |g| |rev|) |l2|)) ((PROGN (SETQ |ISTMP#1| (|last| |l2|)) (AND (CONSP |ISTMP#1|) (EQ (CAR |ISTMP#1|) 'L%T) (PROGN (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (EQUAL (CAR |ISTMP#2|) |var1|) (PROGN (SETQ |ISTMP#3| (CDR |ISTMP#2|)) (AND (CONSP |ISTMP#3|) (NULL (CDR |ISTMP#3|)) (PROGN (SETQ |val1| (CAR |ISTMP#3|)) T))))))) (CONS (LIST 'L%T |g| |rev|) (APPEND (REVERSE (CDR (REVERSE |l2|))) (CONS (|bfLetForm| |var1| (LIST 'NREVERSE |val1|)) NIL)))) (T (CONS (LIST 'L%T |g| |rev|) (APPEND |l2| (CONS (|bfLetForm| |var1| (LIST 'NREVERSE |var1|)) NIL)))))) ((AND (CONSP |lhs|) (EQ (CAR |lhs|) 'EQUAL) (PROGN (SETQ |ISTMP#1| (CDR |lhs|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |var1| (CAR |ISTMP#1|)) T)))) (LIST 'COND (LIST (|bfQ| |var1| |rhs|) |var1|))) (T (SETQ |isPred| (COND (|$inDefIS| (|bfIS1| |rhs| |lhs|)) (T (|bfIS| |rhs| |lhs|)))) (LIST 'COND (LIST |isPred| |rhs|))))))) (DEFUN |bfLET| (|lhs| |rhs|) (PROG (|$letGenVarCounter|) (DECLARE (SPECIAL |$letGenVarCounter|)) (RETURN (PROGN (SETQ |$letGenVarCounter| 1) (|bfLET1| |lhs| |rhs|))))) (DEFUN |addCARorCDR| (|acc| |expr|) (PROG (|funsR| |funsA| |p| |funs|) (RETURN (COND ((NULL (CONSP |expr|)) (LIST |acc| |expr|)) ((AND (EQ |acc| 'CAR) (CONSP |expr|) (EQ (CAR |expr|) 'REVERSE)) (LIST 'CAR (CONS 'LAST (CDR |expr|)))) (T (SETQ |funs| '(CAR CDR CAAR CDAR CADR CDDR CAAAR CADAR CAADR CADDR CDAAR CDDAR CDADR CDDDR)) (SETQ |p| (|bfPosition| (CAR |expr|) |funs|)) (COND ((EQUAL |p| (- 1)) (LIST |acc| |expr|)) (T (SETQ |funsA| '(CAAR CADR CAAAR CADAR CAADR CADDR CAAAAR CAADAR CAAADR CAADDR CADAAR CADDAR CADADR CADDDR)) (SETQ |funsR| '(CDAR CDDR CDAAR CDDAR CDADR CDDDR CDAAAR CDADAR CDAADR CDADDR CDDAAR CDDDAR CDDADR CDDDDR)) (COND ((EQ |acc| 'CAR) (CONS (ELT |funsA| |p|) (CDR |expr|))) (T (CONS (ELT |funsR| |p|) (CDR |expr|))))))))))) (DEFUN |bfPosition| (|x| |l|) (|bfPosn| |x| |l| 0)) (DEFUN |bfPosn| (|x| |l| |n|) (COND ((NULL |l|) (- 1)) ((EQUAL |x| (CAR |l|)) |n|) (T (|bfPosn| |x| (CDR |l|) (+ |n| 1))))) (DEFUN |bfISApplication| (|op| |left| |right|) (COND ((EQ |op| 'IS) (|bfIS| |left| |right|)) ((EQ |op| 'ISNT) (|bfNOT| (|bfIS| |left| |right|))) (T (LIST |op| |left| |right|)))) (DEFUN |bfIS| (|left| |right|) (PROG (|$inDefIS| |$isGenVarCounter|) (DECLARE (SPECIAL |$inDefIS| |$isGenVarCounter|)) (RETURN (PROGN (SETQ |$isGenVarCounter| 1) (SETQ |$inDefIS| T) (|bfIS1| |left| |right|))))) (DEFUN |bfISReverse| (|x| |a|) (PROG (|y|) (RETURN (COND ((AND (CONSP |x|) (EQ (CAR |x|) 'CONS)) (COND ((NULL (CADDR |x|)) (LIST 'CONS (CADR |x|) |a|)) (T (SETQ |y| (|bfISReverse| (CADDR |x|) NIL)) (RPLACA (CDDR |y|) (LIST 'CONS (CADR |x|) |a|)) |y|))) (T (|bpSpecificErrorHere| "Error in bfISReverse") (|bpTrap|)))))) (DEFUN |bfIS1| (|lhs| |rhs|) (PROG (|l2| |rev| |patrev| |cls| |b1| |a1| |b| |g| |l| |d| |ISTMP#2| |c| |a| |ISTMP#1|) (DECLARE (SPECIAL |$isGenVarCounter|)) (RETURN (COND ((NULL |rhs|) (LIST 'NULL |lhs|)) ((STRINGP |rhs|) (LIST 'EQ |lhs| (LIST 'QUOTE (INTERN |rhs|)))) ((NUMBERP |rhs|) (LIST 'EQUAL |lhs| |rhs|)) ((ATOM |rhs|) (LIST 'PROGN (|bfLetForm| |rhs| |lhs|) 'T)) ((AND (CONSP |rhs|) (EQ (CAR |rhs|) 'QUOTE) (PROGN (SETQ |ISTMP#1| (CDR |rhs|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |a| (CAR |ISTMP#1|)) T)))) (COND ((IDENTP |a|) (LIST 'EQ |lhs| |rhs|)) (T (LIST 'EQUAL |lhs| |rhs|)))) ((AND (CONSP |rhs|) (EQ (CAR |rhs|) 'L%T) (PROGN (SETQ |ISTMP#1| (CDR |rhs|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |c| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (NULL (CDR |ISTMP#2|)) (PROGN (SETQ |d| (CAR |ISTMP#2|)) T)))))) (SETQ |l| (|bfLET| |c| |lhs|)) (|bfAND| (LIST (|bfIS1| |lhs| |d|) (|bfMKPROGN| (LIST |l| 'T))))) ((AND (CONSP |rhs|) (EQ (CAR |rhs|) 'EQUAL) (PROGN (SETQ |ISTMP#1| (CDR |rhs|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |a| (CAR |ISTMP#1|)) T)))) (|bfQ| |lhs| |a|)) ((CONSP |lhs|) (SETQ |g| (INTERN (CONCAT "ISTMP#" (STRINGIMAGE |$isGenVarCounter|)))) (SETQ |$isGenVarCounter| (+ |$isGenVarCounter| 1)) (|bfMKPROGN| (LIST (LIST 'L%T |g| |lhs|) (|bfIS1| |g| |rhs|)))) ((AND (CONSP |rhs|) (EQ (CAR |rhs|) 'CONS) (PROGN (SETQ |ISTMP#1| (CDR |rhs|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |a| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (NULL (CDR |ISTMP#2|)) (PROGN (SETQ |b| (CAR |ISTMP#2|)) T)))))) (COND ((EQ |a| 'DOT) (COND ((NULL |b|) (|bfAND| (LIST (LIST 'CONSP |lhs|) (LIST 'NULL (LIST 'CDR |lhs|))))) (T (|bfAND| (LIST (LIST 'CONSP |lhs|) (|bfIS1| (LIST 'CDR |lhs|) |b|)))))) ((NULL |b|) (|bfAND| (LIST (LIST 'CONSP |lhs|) (LIST 'NULL (LIST 'CDR |lhs|)) (|bfIS1| (LIST 'CAR |lhs|) |a|)))) ((EQ |b| 'DOT) (|bfAND| (LIST (LIST 'CONSP |lhs|) (|bfIS1| (LIST 'CAR |lhs|) |a|)))) (T (SETQ |a1| (|bfIS1| (LIST 'CAR |lhs|) |a|)) (SETQ |b1| (|bfIS1| (LIST 'CDR |lhs|) |b|)) (COND ((AND (CONSP |a1|) (EQ (CAR |a1|) 'PROGN) (PROGN (SETQ |ISTMP#1| (CDR |a1|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |c| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (NULL (CDR |ISTMP#2|)) (EQ (CAR |ISTMP#2|) 'T))))) (CONSP |b1|) (EQ (CAR |b1|) 'PROGN)) (SETQ |cls| (CDR |b1|)) (|bfAND| (LIST (LIST 'CONSP |lhs|) (|bfMKPROGN| (CONS |c| |cls|))))) (T (|bfAND| (LIST (LIST 'CONSP |lhs|) |a1| |b1|))))))) ((AND (CONSP |rhs|) (EQ (CAR |rhs|) 'APPEND) (PROGN (SETQ |ISTMP#1| (CDR |rhs|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |a| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (NULL (CDR |ISTMP#2|)) (PROGN (SETQ |b| (CAR |ISTMP#2|)) T)))))) (SETQ |patrev| (|bfISReverse| |b| |a|)) (SETQ |g| (INTERN (CONCAT "ISTMP#" (STRINGIMAGE |$isGenVarCounter|)))) (SETQ |$isGenVarCounter| (+ |$isGenVarCounter| 1)) (SETQ |rev| (|bfAND| (LIST (LIST 'CONSP |lhs|) (LIST 'PROGN (LIST 'L%T |g| (LIST 'REVERSE |lhs|)) 'T)))) (SETQ |l2| (|bfIS1| |g| |patrev|)) (COND ((AND (CONSP |l2|) (ATOM (CAR |l2|))) (SETQ |l2| (CONS |l2| NIL)))) (COND ((EQ |a| 'DOT) (|bfAND| (CONS |rev| |l2|))) (T (|bfAND| (CONS |rev| (APPEND |l2| (CONS (LIST 'PROGN (|bfLetForm| |a| (LIST 'NREVERSE |a|)) 'T) NIL))))))) (T (|bpSpecificErrorHere| "bad IS code is generated") (|bpTrap|)))))) (DEFUN |bfHas| (|expr| |prop|) (COND ((IDENTP |prop|) (LIST 'GET |expr| (LIST 'QUOTE |prop|))) (T (|bpSpecificErrorHere| "expected identifier as property name")))) (DEFUN |bfApplication| (|bfop| |bfarg|) (COND ((|bfTupleP| |bfarg|) (CONS |bfop| (CDR |bfarg|))) (T (LIST |bfop| |bfarg|)))) (DEFUN |bfReName| (|x|) (PROG (|a|) (RETURN (COND ((SETQ |a| (GET |x| 'SHOERENAME)) (CAR |a|)) (T |x|))))) (DEFUN |bfMember| (|var| |seq|) (PROG (|var'| |seq'| |ISTMP#1|) (RETURN (COND ((AND (CONSP |seq|) (EQ (CAR |seq|) 'QUOTE) (PROGN (SETQ |ISTMP#1| (CDR |seq|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |seq'| (CAR |ISTMP#1|)) T))) (LET ((|bfVar#88| T) (|bfVar#87| |seq'|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#87|) (PROGN (SETQ |x| (CAR |bfVar#87|)) NIL)) (RETURN |bfVar#88|)) (T (PROGN (SETQ |bfVar#88| (SYMBOLP |x|)) (COND ((NOT |bfVar#88|) (RETURN NIL)))))) (SETQ |bfVar#87| (CDR |bfVar#87|))))) (LIST 'MEMQ |var| |seq|)) ((AND (CONSP |var|) (EQ (CAR |var|) 'QUOTE) (PROGN (SETQ |ISTMP#1| (CDR |var|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |var'| (CAR |ISTMP#1|)) T))) (SYMBOLP |var'|)) (LIST 'MEMQ |var| |seq|)) ((AND (CONSP |var|) (EQ (CAR |var|) '|char|) (PROGN (SETQ |ISTMP#1| (CDR |var|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|))))) (LIST 'MEMBER |var| |seq| :TEST 'EQL)) (T (LIST 'MEMBER |var| |seq|)))))) (DEFUN |bfInfApplication| (|op| |left| |right|) (COND ((EQ |op| 'EQUAL) (|bfQ| |left| |right|)) ((EQ |op| '/=) (|bfNOT| (|bfQ| |left| |right|))) ((EQ |op| '>) (|bfLessp| |right| |left|)) ((EQ |op| '<) (|bfLessp| |left| |right|)) ((EQ |op| '<=) (|bfNOT| (|bfLessp| |right| |left|))) ((EQ |op| '>=) (|bfNOT| (|bfLessp| |left| |right|))) ((EQ |op| 'OR) (|bfOR| (LIST |left| |right|))) ((EQ |op| 'AND) (|bfAND| (LIST |left| |right|))) ((EQ |op| 'IN) (|bfMember| |left| |right|)) (T (LIST |op| |left| |right|)))) (DEFUN |bfNOT| (|x|) (PROG (|a| |ISTMP#1|) (RETURN (COND ((AND (CONSP |x|) (EQ (CAR |x|) 'NOT) (PROGN (SETQ |ISTMP#1| (CDR |x|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |a| (CAR |ISTMP#1|)) T)))) |a|) ((AND (CONSP |x|) (EQ (CAR |x|) 'NULL) (PROGN (SETQ |ISTMP#1| (CDR |x|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |a| (CAR |ISTMP#1|)) T)))) |a|) (T (LIST 'NOT |x|)))))) (DEFUN |bfFlatten| (|op| |x|) (COND ((AND (CONSP |x|) (EQUAL (CAR |x|) |op|)) (CDR |x|)) (T (LIST |x|)))) (DEFUN |bfOR| (|l|) (COND ((NULL |l|) NIL) ((NULL (CDR |l|)) (CAR |l|)) (T (CONS 'OR (LET ((|bfVar#90| NIL) (|bfVar#89| |l|) (|c| NIL)) (LOOP (COND ((OR (ATOM |bfVar#89|) (PROGN (SETQ |c| (CAR |bfVar#89|)) NIL)) (RETURN (NREVERSE |bfVar#90|))) (T (SETQ |bfVar#90| (APPEND (REVERSE (|bfFlatten| 'OR |c|)) |bfVar#90|)))) (SETQ |bfVar#89| (CDR |bfVar#89|)))))))) (DEFUN |bfAND| (|l|) (COND ((NULL |l|) 'T) ((NULL (CDR |l|)) (CAR |l|)) (T (CONS 'AND (LET ((|bfVar#92| NIL) (|bfVar#91| |l|) (|c| NIL)) (LOOP (COND ((OR (ATOM |bfVar#91|) (PROGN (SETQ |c| (CAR |bfVar#91|)) NIL)) (RETURN (NREVERSE |bfVar#92|))) (T (SETQ |bfVar#92| (APPEND (REVERSE (|bfFlatten| 'AND |c|)) |bfVar#92|)))) (SETQ |bfVar#91| (CDR |bfVar#91|)))))))) (DEFUN |defQuoteId| (|x|) (AND (CONSP |x|) (EQ (CAR |x|) 'QUOTE) (IDENTP (CADR |x|)))) (DEFUN |bfSmintable| (|x|) (OR (INTEGERP |x|) (AND (CONSP |x|) (MEMQ (CAR |x|) '(SIZE LENGTH |char|))))) (DEFUN |bfQ| (|l| |r|) (COND ((OR (|bfSmintable| |l|) (|bfSmintable| |r|)) (LIST 'EQL |l| |r|)) ((OR (|defQuoteId| |l|) (|defQuoteId| |r|)) (LIST 'EQ |l| |r|)) ((NULL |l|) (LIST 'NULL |r|)) ((NULL |r|) (LIST 'NULL |l|)) ((OR (EQ |l| T) (EQ |r| T)) (LIST 'EQ |l| |r|)) (T (LIST 'EQUAL |l| |r|)))) (DEFUN |bfLessp| (|l| |r|) (COND ((EQL |l| 0) (LIST 'PLUSP |r|)) ((EQL |r| 0) (LIST 'MINUSP |l|)) (T (LIST '< |l| |r|)))) (DEFUN |bfMDef| (|op| |args| |body|) (PROG (|def| |lamex| |sb2| |sb| |largl| |nargl| |sgargl| |gargl| |LETTMP#1| |argl|) (DECLARE (SPECIAL |$wheredefs|)) (RETURN (PROGN (SETQ |argl| (COND ((|bfTupleP| |args|) (CDR |args|)) (T (LIST |args|)))) (SETQ |LETTMP#1| (|bfGargl| |argl|)) (SETQ |gargl| (CAR |LETTMP#1|)) (SETQ |sgargl| (CADR . #0=(|LETTMP#1|))) (SETQ |nargl| (CADDR . #0#)) (SETQ |largl| (CADDDR . #0#)) (SETQ |sb| (LET ((|bfVar#95| NIL) (|bfVar#93| |nargl|) (|i| NIL) (|bfVar#94| |sgargl|) (|j| NIL)) (LOOP (COND ((OR (ATOM |bfVar#93|) (PROGN (SETQ |i| (CAR |bfVar#93|)) NIL) (ATOM |bfVar#94|) (PROGN (SETQ |j| (CAR |bfVar#94|)) NIL)) (RETURN (NREVERSE |bfVar#95|))) (T (SETQ |bfVar#95| (CONS (CONS |i| |j|) |bfVar#95|)))) (SETQ |bfVar#93| (CDR |bfVar#93|)) (SETQ |bfVar#94| (CDR |bfVar#94|))))) (SETQ |body| (SUBLIS |sb| |body|)) (SETQ |sb2| (LET ((|bfVar#98| NIL) (|bfVar#96| |sgargl|) (|i| NIL) (|bfVar#97| |largl|) (|j| NIL)) (LOOP (COND ((OR (ATOM |bfVar#96|) (PROGN (SETQ |i| (CAR |bfVar#96|)) NIL) (ATOM |bfVar#97|) (PROGN (SETQ |j| (CAR |bfVar#97|)) NIL)) (RETURN (NREVERSE |bfVar#98|))) (T (SETQ |bfVar#98| (CONS (LIST 'CONS (LIST 'QUOTE |i|) |j|) |bfVar#98|)))) (SETQ |bfVar#96| (CDR |bfVar#96|)) (SETQ |bfVar#97| (CDR |bfVar#97|))))) (SETQ |body| (LIST 'SUBLIS (CONS 'LIST |sb2|) (LIST 'QUOTE |body|))) (SETQ |lamex| (LIST 'MLAMBDA |gargl| |body|)) (SETQ |def| (LIST |op| |lamex|)) (CONS (|shoeComp| |def|) (LET ((|bfVar#100| NIL) (|bfVar#99| |$wheredefs|) (|d| NIL)) (LOOP (COND ((OR (ATOM |bfVar#99|) (PROGN (SETQ |d| (CAR |bfVar#99|)) NIL)) (RETURN (NREVERSE |bfVar#100|))) (T (SETQ |bfVar#100| (APPEND (REVERSE (|shoeComps| (|bfDef1| |d|))) |bfVar#100|)))) (SETQ |bfVar#99| (CDR |bfVar#99|))))))))) (DEFUN |bfGargl| (|argl|) (PROG (|f| |d| |c| |b| |a| |LETTMP#1|) (RETURN (COND ((NULL |argl|) (LIST NIL NIL NIL NIL)) (T (SETQ |LETTMP#1| (|bfGargl| (CDR |argl|))) (SETQ |a| (CAR |LETTMP#1|)) (SETQ |b| (CADR . #0=(|LETTMP#1|))) (SETQ |c| (CADDR . #0#)) (SETQ |d| (CADDDR . #0#)) (COND ((EQ (CAR |argl|) '&REST) (LIST (CONS (CAR |argl|) |b|) |b| |c| (CONS (LIST 'CONS (LIST 'QUOTE 'LIST) (CAR |d|)) (CDR |d|)))) (T (SETQ |f| (|bfGenSymbol|)) (LIST (CONS |f| |a|) (CONS |f| |b|) (CONS (CAR |argl|) |c|) (CONS |f| |d|))))))))) (DEFUN |bfDef1| (|bfVar#101|) (PROG (|arglp| |control| |quotes| |LETTMP#1| |argl| |body| |args| |op|) (RETURN (PROGN (SETQ |op| (CAR |bfVar#101|)) (SETQ |args| (CADR . #0=(|bfVar#101|))) (SETQ |body| (CADDR . #0#)) (SETQ |argl| (COND ((|bfTupleP| |args|) (CDR |args|)) (T (LIST |args|)))) (SETQ |LETTMP#1| (|bfInsertLet| |argl| |body|)) (SETQ |quotes| (CAR |LETTMP#1|)) (SETQ |control| (CADR . #1=(|LETTMP#1|))) (SETQ |arglp| (CADDR . #1#)) (SETQ |body| (CADDDR . #1#)) (COND (|quotes| (|shoeLAM| |op| |arglp| |control| |body|)) (T (LIST (LIST |op| (LIST 'LAMBDA |arglp| |body|))))))))) (DEFUN |shoeLAM| (|op| |args| |control| |body|) (PROG (|innerfunc| |margs|) (RETURN (PROGN (SETQ |margs| (|bfGenSymbol|)) (SETQ |innerfunc| (INTERN (CONCAT (PNAME |op|) '|,LAM|))) (LIST (LIST |innerfunc| (LIST 'LAMBDA |args| |body|)) (LIST |op| (LIST 'MLAMBDA (LIST '&REST |margs|) (LIST 'CONS (LIST 'QUOTE |innerfunc|) (LIST 'WRAP |margs| (LIST 'QUOTE |control|)))))))))) (DEFUN |bfDef| (|op| |args| |body|) (PROG (|body1| |arg1| |op1| |LETTMP#1|) (DECLARE (SPECIAL |$wheredefs| |$bfClamming|)) (RETURN (COND (|$bfClamming| (SETQ |LETTMP#1| (|shoeComp| (CAR (|bfDef1| (LIST |op| |args| |body|))))) (SETQ |op1| (CADR . #0=(|LETTMP#1|))) (SETQ |arg1| (CADDR . #0#)) (SETQ |body1| (CDDDR . #0#)) (|bfCompHash| |op1| |arg1| |body1|)) (T (|bfTuple| (LET ((|bfVar#103| NIL) (|bfVar#102| (CONS (LIST |op| |args| |body|) |$wheredefs|)) (|d| NIL)) (LOOP (COND ((OR (ATOM |bfVar#102|) (PROGN (SETQ |d| (CAR |bfVar#102|)) NIL)) (RETURN (NREVERSE |bfVar#103|))) (T (SETQ |bfVar#103| (APPEND (REVERSE (|shoeComps| (|bfDef1| |d|))) |bfVar#103|)))) (SETQ |bfVar#102| (CDR |bfVar#102|)))))))))) (DEFUN |shoeComps| (|x|) (LET ((|bfVar#105| NIL) (|bfVar#104| |x|) (|def| NIL)) (LOOP (COND ((OR (ATOM |bfVar#104|) (PROGN (SETQ |def| (CAR |bfVar#104|)) NIL)) (RETURN (NREVERSE |bfVar#105|))) (T (SETQ |bfVar#105| (CONS (|shoeComp| |def|) |bfVar#105|)))) (SETQ |bfVar#104| (CDR |bfVar#104|))))) (DEFUN |shoeComp| (|x|) (PROG (|a|) (RETURN (PROGN (SETQ |a| (|shoeCompTran| (CADR |x|))) (COND ((AND (CONSP |a|) (EQ (CAR |a|) 'LAMBDA)) (CONS 'DEFUN (CONS (CAR |x|) (CONS (CADR |a|) (CDDR |a|))))) (T (CONS 'DEFMACRO (CONS (CAR |x|) (CONS (CADR |a|) (CDDR |a|)))))))))) (DEFUN |bfParameterList| (|p1| |p2|) (COND ((AND (NULL |p2|) (NOT (ATOM |p1|))) |p1|) ((AND (CONSP |p1|) (EQ (CAR |p1|) '&OPTIONAL)) (COND ((NOT (AND (CONSP |p2|) (EQ (CAR |p2|) '&OPTIONAL))) (|bpSpecificErrorHere| "default value required")) (T (CONS (CAR |p1|) (APPEND (CDR |p1|) (CDR |p2|)))))) ((AND (CONSP |p2|) (EQ (CAR |p2|) '&OPTIONAL)) (CONS |p1| (CONS (CAR |p2|) (CDR |p2|)))) (T (CONS |p1| |p2|)))) (DEFUN |bfInsertLet| (|x| |body|) (PROG (|body2| |name2| |norq1| |b1| |body1| |name1| |norq| |LETTMP#1| |b| |a| |ISTMP#1|) (RETURN (COND ((NULL |x|) (LIST NIL NIL |x| |body|)) ((AND (CONSP |x|) (EQ (CAR |x|) '&REST) (PROGN (SETQ |ISTMP#1| (CDR |x|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |a| (CAR |ISTMP#1|)) T)))) (COND ((AND (CONSP |a|) (EQ (CAR |a|) 'QUOTE) (PROGN (SETQ |ISTMP#1| (CDR |a|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |b| (CAR |ISTMP#1|)) T)))) (LIST T 'QUOTE (LIST '&REST |b|) |body|)) (T (LIST NIL NIL |x| |body|)))) (T (SETQ |LETTMP#1| (|bfInsertLet1| (CAR |x|) |body|)) (SETQ |b| (CAR |LETTMP#1|)) (SETQ |norq| (CADR . #0=(|LETTMP#1|))) (SETQ |name1| (CADDR . #0#)) (SETQ |body1| (CADDDR . #0#)) (SETQ |LETTMP#1| (|bfInsertLet| (CDR |x|) |body1|)) (SETQ |b1| (CAR |LETTMP#1|)) (SETQ |norq1| (CADR . #1=(|LETTMP#1|))) (SETQ |name2| (CADDR . #1#)) (SETQ |body2| (CADDDR . #1#)) (LIST (OR |b| |b1|) (CONS |norq| |norq1|) (|bfParameterList| |name1| |name2|) |body2|)))))) (DEFUN |bfInsertLet1| (|y| |body|) (PROG (|g| |b| |r| |ISTMP#2| |l| |ISTMP#1|) (RETURN (COND ((AND (CONSP |y|) (EQ (CAR |y|) 'L%T) (PROGN (SETQ |ISTMP#1| (CDR |y|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |l| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (NULL (CDR |ISTMP#2|)) (PROGN (SETQ |r| (CAR |ISTMP#2|)) T)))))) (LIST NIL NIL |l| (|bfMKPROGN| (LIST (|bfLET| |r| |l|) |body|)))) ((IDENTP |y|) (LIST NIL NIL |y| |body|)) ((AND (CONSP |y|) (EQ (CAR |y|) 'BVQUOTE) (PROGN (SETQ |ISTMP#1| (CDR |y|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |b| (CAR |ISTMP#1|)) T)))) (LIST T 'QUOTE |b| |body|)) (T (SETQ |g| (|bfGenSymbol|)) (COND ((ATOM |y|) (LIST NIL NIL |g| |body|)) (T (CASE (CAR |y|) (|%DefaultValue| (LET ((|p| (CADR |y|)) (|v| (CADDR |y|))) (LIST NIL NIL (LIST '&OPTIONAL (LIST |p| |v|)) |body|))) (T (LIST NIL NIL |g| (|bfMKPROGN| (LIST (|bfLET| (|compFluidize| |y|) |g|) |body|)))))))))))) (DEFUN |shoeCompTran| (|x|) (PROG (|$dollarVars| |$locVars| |$fluidVars| |fvs| |fl| |fvars| |body'| |lvars| |body| |args| |lamtype|) (DECLARE (SPECIAL |$typings| |$dollarVars| |$fluidVars| |$locVars|)) (RETURN (PROGN (SETQ |lamtype| (CAR |x|)) (SETQ |args| (CADR |x|)) (SETQ |body| (CDDR |x|)) (SETQ |$fluidVars| NIL) (SETQ |$locVars| NIL) (SETQ |$dollarVars| NIL) (|shoeCompTran1| |body|) (SETQ |$locVars| (SETDIFFERENCE (SETDIFFERENCE |$locVars| |$fluidVars|) (|shoeATOMs| |args|))) (SETQ |body| (PROGN (SETQ |lvars| (APPEND |$fluidVars| |$locVars|)) (SETQ |$fluidVars| (UNION |$fluidVars| |$dollarVars|)) (SETQ |body'| |body|) (COND (|$typings| (SETQ |body'| (CONS (CONS 'DECLARE |$typings|) |body'|)))) (COND (|$fluidVars| (SETQ |fvars| (LIST 'DECLARE (CONS 'SPECIAL |$fluidVars|))) (SETQ |body'| (CONS |fvars| |body'|)))) (COND ((OR |lvars| (|needsPROG| |body|)) (|shoePROG| |lvars| |body'|)) (T |body'|)))) (SETQ |fl| (|shoeFluids| |args|)) (SETQ |body| (COND (|fl| (SETQ |fvs| (LIST 'DECLARE (CONS 'SPECIAL |fl|))) (CONS |fvs| |body|)) (T |body|))) (CONS |lamtype| (CONS |args| |body|)))))) (DEFUN |needsPROG| (|body|) (PROG (|args| |op|) (RETURN (COND ((ATOM |body|) NIL) (T (SETQ |op| (CAR |body|)) (SETQ |args| (CDR |body|)) (COND ((MEMQ |op| '(RETURN RETURN-FROM)) T) ((MEMQ |op| '(LET PROG LOOP BLOCK DECLARE LAMBDA)) NIL) ((LET ((|bfVar#107| NIL) (|bfVar#106| |body|) (|t| NIL)) (LOOP (COND ((OR (ATOM |bfVar#106|) (PROGN (SETQ |t| (CAR |bfVar#106|)) NIL)) (RETURN |bfVar#107|)) (T (PROGN (SETQ |bfVar#107| (|needsPROG| |t|)) (COND (|bfVar#107| (RETURN |bfVar#107|)))))) (SETQ |bfVar#106| (CDR |bfVar#106|)))) T) (T NIL))))))) (DEFUN |shoePROG| (|v| |b|) (PROG (|blist| |blast| |LETTMP#1|) (RETURN (COND ((NULL |b|) (LIST (LIST 'PROG |v|))) (T (SETQ |LETTMP#1| (REVERSE |b|)) (SETQ |blast| (CAR |LETTMP#1|)) (SETQ |blist| (NREVERSE (CDR |LETTMP#1|))) (LIST (CONS 'PROG (CONS |v| (APPEND |blist| (CONS (LIST 'RETURN |blast|) NIL)))))))))) (DEFUN |shoeFluids| (|x|) (COND ((NULL |x|) NIL) ((AND (IDENTP |x|) (|bfBeginsDollar| |x|)) (LIST |x|)) ((ATOM |x|) NIL) ((AND (CONSP |x|) (EQ (CAR |x|) 'QUOTE)) NIL) (T (APPEND (|shoeFluids| (CAR |x|)) (|shoeFluids| (CDR |x|)))))) (DEFUN |shoeATOMs| (|x|) (COND ((NULL |x|) NIL) ((ATOM |x|) (LIST |x|)) (T (APPEND (|shoeATOMs| (CAR |x|)) (|shoeATOMs| (CDR |x|)))))) (DEFUN |isDynamicVariable| (|x|) (PROG (|y|) (DECLARE (SPECIAL |$activeNamespace| |$constantIdentifiers|)) (RETURN (COND ((AND (IDENTP |x|) (|bfBeginsDollar| |x|)) (COND ((MEMQ |x| |$constantIdentifiers|) NIL) ((CONSTANTP |x|) NIL) ((OR (BOUNDP |x|) (NULL |$activeNamespace|)) T) ((SETQ |y| (FIND-SYMBOL (STRING |x|) |$activeNamespace|)) (NOT (CONSTANTP |y|))) (T T))) (T NIL))))) (DEFUN |shoeCompTran1| (|x|) (PROG (|res| |newbindings| |r| |ISTMP#2| |l| |ISTMP#1| U) (DECLARE (SPECIAL |$fluidVars| |$locVars| |$dollarVars|)) (RETURN (COND ((ATOM |x|) (COND ((|isDynamicVariable| |x|) (SETQ |$dollarVars| (COND ((MEMQ |x| |$dollarVars|) |$dollarVars|) (T (CONS |x| |$dollarVars|))))) (T NIL))) (T (SETQ U (CAR |x|)) (COND ((EQ U 'QUOTE) NIL) ((AND (CONSP |x|) (EQ (CAR |x|) 'L%T) (PROGN (SETQ |ISTMP#1| (CDR |x|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |l| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (NULL (CDR |ISTMP#2|)) (PROGN (SETQ |r| (CAR |ISTMP#2|)) T)))))) (RPLACA |x| 'SETQ) (|shoeCompTran1| |r|) (COND ((IDENTP |l|) (COND ((NOT (|bfBeginsDollar| |l|)) (SETQ |$locVars| (COND ((MEMQ |l| |$locVars|) |$locVars|) (T (CONS |l| |$locVars|))))) (T (SETQ |$dollarVars| (COND ((MEMQ |l| |$dollarVars|) |$dollarVars|) (T (CONS |l| |$dollarVars|))))))) ((AND (CONSP |l|) (EQ (CAR |l|) 'FLUID)) (SETQ |$fluidVars| (COND ((MEMQ (CADR |l|) |$fluidVars|) |$fluidVars|) (T (CONS (CADR |l|) |$fluidVars|)))) (RPLACA (CDR |x|) (CADR |l|))))) ((MEMQ U '(PROG LAMBDA)) (SETQ |newbindings| NIL) (LET ((|bfVar#108| (CADR |x|)) (|y| NIL)) (LOOP (COND ((OR (ATOM |bfVar#108|) (PROGN (SETQ |y| (CAR |bfVar#108|)) NIL)) (RETURN NIL)) (T (COND ((NOT (MEMQ |y| |$locVars|)) (IDENTITY (PROGN (SETQ |$locVars| (CONS |y| |$locVars|)) (SETQ |newbindings| (CONS |y| |newbindings|)))))))) (SETQ |bfVar#108| (CDR |bfVar#108|)))) (SETQ |res| (|shoeCompTran1| (CDDR |x|))) (SETQ |$locVars| (LET ((|bfVar#110| NIL) (|bfVar#109| |$locVars|) (|y| NIL)) (LOOP (COND ((OR (ATOM |bfVar#109|) (PROGN (SETQ |y| (CAR |bfVar#109|)) NIL)) (RETURN (NREVERSE |bfVar#110|))) (T (AND (NOT (MEMQ |y| |newbindings|)) (SETQ |bfVar#110| (CONS |y| |bfVar#110|))))) (SETQ |bfVar#109| (CDR |bfVar#109|)))))) (T (|shoeCompTran1| (CAR |x|)) (|shoeCompTran1| (CDR |x|))))))))) (DEFUN |bfTagged| (|a| |b|) (DECLARE (SPECIAL |$typings| |$op|)) (COND ((NULL |$op|) (|%Signature| |a| |b|)) ((IDENTP |a|) (COND ((EQ |b| 'FLUID) (|bfLET| (|compFluid| |a|) NIL)) ((EQ |b| '|fluid|) (|bfLET| (|compFluid| |a|) NIL)) ((EQ |b| '|local|) (|bfLET| (|compFluid| |a|) NIL)) (T (SETQ |$typings| (CONS (LIST 'TYPE |b| |a|) |$typings|)) |a|))) (T (LIST 'THE |b| |a|)))) (DEFUN |bfAssign| (|l| |r|) (COND ((|bfTupleP| |l|) (|bfSetelt| (CADR |l|) (CDDR |l|) |r|)) (T (|bfLET| |l| |r|)))) (DEFUN |bfSetelt| (|e| |l| |r|) (COND ((NULL (CDR |l|)) (|defSETELT| |e| (CAR |l|) |r|)) (T (|bfSetelt| (|bfElt| |e| (CAR |l|)) (CDR |l|) |r|)))) (DEFUN |bfElt| (|expr| |sel|) (PROG (|y|) (RETURN (PROGN (SETQ |y| (AND (SYMBOLP |sel|) (GET |sel| 'SHOESELFUNCTION))) (COND (|y| (COND ((INTEGERP |y|) (LIST 'ELT |expr| |y|)) (T (LIST |y| |expr|)))) (T (LIST 'ELT |expr| |sel|))))))) (DEFUN |defSETELT| (|var| |sel| |expr|) (PROG (|y|) (RETURN (PROGN (SETQ |y| (AND (SYMBOLP |sel|) (GET |sel| 'SHOESELFUNCTION))) (COND (|y| (COND ((INTEGERP |y|) (LIST 'SETF (LIST 'ELT |var| |y|) |expr|)) (T (LIST 'SETF (LIST |y| |var|) |expr|)))) (T (LIST 'SETF (LIST 'ELT |var| |sel|) |expr|))))))) (DEFUN |bfIfThenOnly| (|a| |b|) (PROG (|b1|) (RETURN (PROGN (SETQ |b1| (COND ((AND (CONSP |b|) (EQ (CAR |b|) 'PROGN)) (CDR |b|)) (T (LIST |b|)))) (LIST 'COND (CONS |a| |b1|)))))) (DEFUN |bfIf| (|a| |b| |c|) (PROG (|c1| |b1|) (RETURN (PROGN (SETQ |b1| (COND ((AND (CONSP |b|) (EQ (CAR |b|) 'PROGN)) (CDR |b|)) (T (LIST |b|)))) (COND ((AND (CONSP |c|) (EQ (CAR |c|) 'COND)) (CONS 'COND (CONS (CONS |a| |b1|) (CDR |c|)))) (T (SETQ |c1| (COND ((AND (CONSP |c|) (EQ (CAR |c|) 'PROGN)) (CDR |c|)) (T (LIST |c|)))) (LIST 'COND (CONS |a| |b1|) (CONS 'T |c1|)))))))) (DEFUN |bfExit| (|a| |b|) (LIST 'COND (LIST |a| (LIST 'IDENTITY |b|)))) (DEFUN |bfMKPROGN| (|l|) (PROG (|a|) (RETURN (PROGN (SETQ |a| (LET ((|bfVar#111| NIL) (|c| |l|)) (LOOP (COND ((ATOM |c|) (RETURN (NREVERSE |bfVar#111|))) (T (SETQ |bfVar#111| (APPEND (REVERSE (|bfFlattenSeq| |c|)) |bfVar#111|)))) (SETQ |c| (CDR |c|))))) (COND ((NULL |a|) NIL) ((NULL (CDR |a|)) (CAR |a|)) (T (CONS 'PROGN |a|))))))) (DEFUN |bfFlattenSeq| (|x|) (PROG (|f|) (RETURN (COND ((NULL |x|) NIL) (T (SETQ |f| (CAR |x|)) (COND ((ATOM |f|) (COND ((CDR |x|) NIL) (T (LIST |f|)))) ((AND (CONSP |f|) (EQ (CAR |f|) 'PROGN)) (COND ((CDR |x|) (LET ((|bfVar#113| NIL) (|bfVar#112| (CDR |f|)) (|i| NIL)) (LOOP (COND ((OR (ATOM |bfVar#112|) (PROGN (SETQ |i| (CAR |bfVar#112|)) NIL)) (RETURN (NREVERSE |bfVar#113|))) (T (AND (NOT (ATOM |i|)) (SETQ |bfVar#113| (CONS |i| |bfVar#113|))))) (SETQ |bfVar#112| (CDR |bfVar#112|))))) (T (CDR |f|)))) (T (LIST |f|)))))))) (DEFUN |bfWashCONDBranchBody| (|x|) (PROG (|y|) (RETURN (COND ((AND (CONSP |x|) (EQ (CAR |x|) 'PROGN)) (SETQ |y| (CDR |x|)) |y|) (T (LIST |x|)))))) (DEFUN |bfAlternative| (|a| |b|) (PROG (|conds| |ISTMP#5| |stmt| |ISTMP#4| |ISTMP#3| |ISTMP#2| |ISTMP#1|) (RETURN (COND ((AND (CONSP |a|) (EQ (CAR |a|) 'AND) (PROGN (SETQ |ISTMP#1| (CDR |a|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |ISTMP#2| (REVERSE |ISTMP#1|)) T) (CONSP |ISTMP#2|) (PROGN (SETQ |ISTMP#3| (CAR |ISTMP#2|)) (AND (CONSP |ISTMP#3|) (EQ (CAR |ISTMP#3|) 'PROGN) (PROGN (SETQ |ISTMP#4| (CDR |ISTMP#3|)) (AND (CONSP |ISTMP#4|) (PROGN (SETQ |stmt| (CAR |ISTMP#4|)) (SETQ |ISTMP#5| (CDR |ISTMP#4|)) (AND (CONSP |ISTMP#5|) (NULL (CDR |ISTMP#5|)) (EQ (CAR |ISTMP#5|) 'T))))))) (PROGN (SETQ |conds| (CDR |ISTMP#2|)) T) (PROGN (SETQ |conds| (NREVERSE |conds|)) T)))) (CONS (CONS 'AND |conds|) (|bfWashCONDBranchBody| (|bfMKPROGN| (LIST |stmt| |b|))))) (T (CONS |a| (|bfWashCONDBranchBody| |b|))))))) (DEFUN |bfSequence| (|l|) (PROG (|f| |aft| |before| |no| |transform| |b| |ISTMP#5| |ISTMP#4| |ISTMP#3| |a| |ISTMP#2| |ISTMP#1|) (RETURN (COND ((NULL |l|) NIL) (T (SETQ |transform| (LET ((|bfVar#115| NIL) (|bfVar#114| |l|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#114|) (PROGN (SETQ |x| (CAR |bfVar#114|)) NIL) (NOT (AND (CONSP |x|) (EQ (CAR |x|) 'COND) (PROGN (SETQ |ISTMP#1| (CDR |x|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |ISTMP#2| (CAR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (PROGN (SETQ |a| (CAR |ISTMP#2|)) (SETQ |ISTMP#3| (CDR |ISTMP#2|)) (AND (CONSP |ISTMP#3|) (NULL (CDR |ISTMP#3|)) (PROGN (SETQ |ISTMP#4| (CAR |ISTMP#3|)) (AND (CONSP |ISTMP#4|) (EQ (CAR |ISTMP#4|) 'IDENTITY) (PROGN (SETQ |ISTMP#5| (CDR |ISTMP#4|)) (AND (CONSP |ISTMP#5|) (NULL (CDR |ISTMP#5|)) (PROGN (SETQ |b| (CAR |ISTMP#5|)) T)))))))))))))) (RETURN (NREVERSE |bfVar#115|))) (T (SETQ |bfVar#115| (CONS (|bfAlternative| |a| |b|) |bfVar#115|)))) (SETQ |bfVar#114| (CDR |bfVar#114|))))) (SETQ |no| (LENGTH |transform|)) (SETQ |before| (|bfTake| |no| |l|)) (SETQ |aft| (|bfDrop| |no| |l|)) (COND ((NULL |before|) (COND ((AND (CONSP |l|) (NULL (CDR |l|))) (SETQ |f| (CAR |l|)) (COND ((AND (CONSP |f|) (EQ (CAR |f|) 'PROGN)) (|bfSequence| (CDR |f|))) (T |f|))) (T (|bfMKPROGN| (LIST (CAR |l|) (|bfSequence| (CDR |l|))))))) ((NULL |aft|) (CONS 'COND |transform|)) (T (CONS 'COND (APPEND |transform| (CONS (|bfAlternative| 'T (|bfSequence| |aft|)) NIL)))))))))) (DEFUN |bfWhere| (|context| |expr|) (PROG (|a| |nondefs| |defs| |opassoc| |LETTMP#1|) (DECLARE (SPECIAL |$wheredefs|)) (RETURN (PROGN (SETQ |LETTMP#1| (|defSheepAndGoats| |context|)) (SETQ |opassoc| (CAR |LETTMP#1|)) (SETQ |defs| (CADR . #0=(|LETTMP#1|))) (SETQ |nondefs| (CADDR . #0#)) (SETQ |a| (LET ((|bfVar#117| NIL) (|bfVar#116| |defs|) (|d| NIL)) (LOOP (COND ((OR (ATOM |bfVar#116|) (PROGN (SETQ |d| (CAR |bfVar#116|)) NIL)) (RETURN (NREVERSE |bfVar#117|))) (T (SETQ |bfVar#117| (CONS (LIST (CAR |d|) (CADR |d|) (|bfSUBLIS| |opassoc| (CADDR |d|))) |bfVar#117|)))) (SETQ |bfVar#116| (CDR |bfVar#116|))))) (SETQ |$wheredefs| (APPEND |a| |$wheredefs|)) (|bfMKPROGN| (|bfSUBLIS| |opassoc| (NCONC |nondefs| (LIST |expr|)))))))) (DEFUN |bfCompHash| (|op| |argl| |body|) (PROG (|computeFunction| |auxfn|) (RETURN (PROGN (SETQ |auxfn| (INTERN (CONCAT (PNAME |op|) ";"))) (SETQ |computeFunction| (CONS 'DEFUN (CONS |auxfn| (CONS |argl| |body|)))) (|bfTuple| (CONS |computeFunction| (|bfMain| |auxfn| |op|))))))) (DEFUN |shoeCompileTimeEvaluation| (|x|) (LIST 'EVAL-WHEN (LIST :COMPILE-TOPLEVEL) |x|)) (DEFUN |shoeEVALANDFILEACTQ| (|x|) (LIST 'EVAL-WHEN (LIST :EXECUTE :LOAD-TOPLEVEL) |x|)) (DEFUN |bfMain| (|auxfn| |op|) (PROG (|defCode| |cacheVector| |cacheCountCode| |cacheResetCode| |cacheType| |mainFunction| |codeBody| |thirdPredPair| |putCode| |secondPredPair| |getCode| |g2| |cacheName| |computeValue| |arg| |g1|) (RETURN (PROGN (SETQ |g1| (|bfGenSymbol|)) (SETQ |arg| (LIST '&REST |g1|)) (SETQ |computeValue| (LIST 'APPLY (LIST 'FUNCTION |auxfn|) |g1|)) (SETQ |cacheName| (INTERN (CONCAT (PNAME |op|) ";AL"))) (SETQ |g2| (|bfGenSymbol|)) (SETQ |getCode| (LIST 'GETHASH |g1| |cacheName|)) (SETQ |secondPredPair| (LIST (LIST 'SETQ |g2| |getCode|) |g2|)) (SETQ |putCode| (LIST 'SETF |getCode| |computeValue|)) (SETQ |thirdPredPair| (LIST 'T |putCode|)) (SETQ |codeBody| (LIST 'PROG (LIST |g2|) (LIST 'RETURN (LIST 'COND |secondPredPair| |thirdPredPair|)))) (SETQ |mainFunction| (LIST 'DEFUN |op| |arg| |codeBody|)) (SETQ |cacheType| '|hash-table|) (SETQ |cacheResetCode| (LIST 'SETQ |cacheName| (LIST 'MAKE-HASHTABLE (LIST 'QUOTE 'UEQUAL)))) (SETQ |cacheCountCode| (LIST '|hashCount| |cacheName|)) (SETQ |cacheVector| (LIST |op| |cacheName| |cacheType| |cacheResetCode| |cacheCountCode|)) (SETQ |defCode| (LIST 'DEFPARAMETER |cacheName| (LIST 'MAKE-HASHTABLE (LIST 'QUOTE 'UEQUAL)))) (LIST |defCode| |mainFunction| (|shoeEVALANDFILEACTQ| (LIST 'SETF (LIST 'GET (LIST 'QUOTE |op|) (LIST 'QUOTE '|cacheInfo|)) (LIST 'QUOTE |cacheVector|)))))))) (DECLAIM (FTYPE (FUNCTION (|%Thing|) |%List|) |bfNameOnly|)) (DEFUN |bfNameOnly| (|x|) (COND ((EQ |x| '|t|) (LIST 'T)) (T (LIST |x|)))) (DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing|) |%List|) |bfNameArgs|)) (DEFUN |bfNameArgs| (|x| |y|) (PROGN (SETQ |y| (COND ((AND (CONSP |y|) (EQ (CAR |y|) 'TUPLE)) (CDR |y|)) (T (LIST |y|)))) (CONS |x| |y|))) (DECLAIM (FTYPE (FUNCTION (|%Thing|) |%List|) |bfCreateDef|)) (DEFUN |bfCreateDef| (|x|) (PROG (|a| |f|) (RETURN (COND ((AND (CONSP |x|) (NULL (CDR |x|))) (SETQ |f| (CAR |x|)) (LIST 'DEFCONSTANT |f| (LIST 'LIST (LIST 'QUOTE |f|)))) (T (SETQ |a| (LET ((|bfVar#119| NIL) (|bfVar#118| (CDR |x|)) (|i| NIL)) (LOOP (COND ((OR (ATOM |bfVar#118|) (PROGN (SETQ |i| (CAR |bfVar#118|)) NIL)) (RETURN (NREVERSE |bfVar#119|))) (T (SETQ |bfVar#119| (CONS (|bfGenSymbol|) |bfVar#119|)))) (SETQ |bfVar#118| (CDR |bfVar#118|))))) (LIST 'DEFUN (CAR |x|) |a| (LIST 'CONS (LIST 'QUOTE (CAR |x|)) (CONS 'LIST |a|)))))))) (DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing|) |%List|) |bfCaseItem|)) (DEFUN |bfCaseItem| (|x| |y|) (LIST |x| |y|)) (DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing|) |%List|) |bfCase|)) (DEFUN |bfCase| (|x| |y|) (PROG (|body| |g|) (RETURN (PROGN (SETQ |g| (COND ((ATOM |x|) |x|) (T (|bfGenSymbol|)))) (SETQ |body| (CONS 'CASE (CONS (LIST 'CAR |g|) (|bfCaseItems| |g| |y|)))) (COND ((EQ |g| |x|) |body|) (T (LIST 'LET (LIST (LIST |g| |x|)) |body|))))))) (DECLAIM (FTYPE (FUNCTION (|%Thing| |%List|) |%List|) |bfCaseItems|)) (DEFUN |bfCaseItems| (|g| |x|) (PROG (|j| |ISTMP#1| |i|) (RETURN (LET ((|bfVar#122| NIL) (|bfVar#121| |x|) (|bfVar#120| NIL)) (LOOP (COND ((OR (ATOM |bfVar#121|) (PROGN (SETQ |bfVar#120| (CAR |bfVar#121|)) NIL)) (RETURN (NREVERSE |bfVar#122|))) (T (AND (CONSP |bfVar#120|) (PROGN (SETQ |i| (CAR |bfVar#120|)) (SETQ |ISTMP#1| (CDR |bfVar#120|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |j| (CAR |ISTMP#1|)) T))) (SETQ |bfVar#122| (CONS (|bfCI| |g| |i| |j|) |bfVar#122|))))) (SETQ |bfVar#121| (CDR |bfVar#121|))))))) (DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Thing|) |%List|) |bfCI|)) (DEFUN |bfCI| (|g| |x| |y|) (PROG (|b| |a|) (RETURN (PROGN (SETQ |a| (CDR |x|)) (COND ((NULL |a|) (LIST (CAR |x|) |y|)) (T (SETQ |b| (LET ((|bfVar#124| NIL) (|bfVar#123| |a|) (|i| NIL) (|j| 1)) (LOOP (COND ((OR (ATOM |bfVar#123|) (PROGN (SETQ |i| (CAR |bfVar#123|)) NIL)) (RETURN (NREVERSE |bfVar#124|))) (T (AND (NOT (EQ |i| 'DOT)) (SETQ |bfVar#124| (CONS (LIST |i| (|bfCARCDR| |j| |g|)) |bfVar#124|))))) (SETQ |bfVar#123| (CDR |bfVar#123|)) (SETQ |j| (+ |j| 1))))) (COND ((NULL |b|) (LIST (CAR |x|) |y|)) (T (LIST (CAR |x|) (LIST 'LET |b| |y|)))))))))) (DECLAIM (FTYPE (FUNCTION (|%Short| |%Thing|) |%List|) |bfCARCDR|)) (DEFUN |bfCARCDR| (|n| |g|) (LIST (INTERN (CONCAT "CA" (|bfDs| |n|) "R")) |g|)) (DECLAIM (FTYPE (FUNCTION (|%Short|) |%String|) |bfDs|)) (DEFUN |bfDs| (|n|) (COND ((EQL |n| 0) "") (T (CONCAT "D" (|bfDs| (- |n| 1)))))) (DECLAIM (FTYPE (FUNCTION (|%Thing| |%List|) |%Thing|) |bfTry|)) (DEFUN |bfTry| (|e| |cs|) (COND ((NULL |cs|) |e|) (T (LET ((|bfVar#125| (CAR |cs|))) (CASE (CAR |bfVar#125|) (|%Catch| (LET ((|tag| (CADR |bfVar#125|))) (COND ((ATOM |tag|) (|bfTry| (LIST 'CATCH (LIST 'QUOTE |tag|) |e|) (CDR |cs|))) (T (|bpTrap|))))) (T (|bpTrap|))))))) (DEFUN |bfThrow| (|e|) (COND ((ATOM |e|) (LIST 'THROW (LIST 'QUOTE |e|) NIL)) ((NOT (ATOM (CAR |e|))) (|bpTrap|)) (T (CONS 'THROW (CONS (LIST 'QUOTE (CAR |e|)) (CDR |e|)))))) (DEFUN |backquote| (|form| |params|) (COND ((NULL |params|) (|quote| |form|)) ((ATOM |form|) (COND ((MEMBER |form| |params|) |form|) (T (|quote| |form|)))) (T (CONS 'LIST (LET ((|bfVar#127| NIL) (|bfVar#126| |form|) (|t| NIL)) (LOOP (COND ((OR (ATOM |bfVar#126|) (PROGN (SETQ |t| (CAR |bfVar#126|)) NIL)) (RETURN (NREVERSE |bfVar#127|))) (T (SETQ |bfVar#127| (CONS (|backquote| |t| |params|) |bfVar#127|)))) (SETQ |bfVar#126| (CDR |bfVar#126|)))))))) (DEFUN |genTypeAlias| (|head| |body|) (PROG (|args| |op|) (RETURN (PROGN (SETQ |op| (CAR |head|)) (SETQ |args| (CDR |head|)) (LIST 'DEFTYPE |op| |args| (|backquote| |body| |args|)))))) (DEFCONSTANT |$NativeSimpleDataTypes| '(|char| |byte| |int| |pointer| |int8| |uint8| |int16| |uint16| |int32| |uint32| |int64| |uint64| |float| |float32| |double| |float64|)) (DEFCONSTANT |$NativeSimpleReturnTypes| (APPEND |$NativeSimpleDataTypes| '(|void| |string|))) (DEFUN |isSimpleNativeType| (|t|) (MEMBER |t| |$NativeSimpleReturnTypes|)) (DECLAIM (FTYPE (FUNCTION (|%Symbol|) |%Symbol|) |coreSymbol|)) (DEFUN |coreSymbol| (|s|) (INTERN (SYMBOL-NAME |s|) '|AxiomCore|)) (DECLAIM (FTYPE (FUNCTION (|%Symbol|) |%Symbol|) |bootSymbol|)) (DEFUN |bootSymbol| (|s|) (INTERN (SYMBOL-NAME |s|))) (DEFUN |unknownNativeTypeError| (|t|) (|fatalError| (CONCAT "unsupported native type: " (SYMBOL-NAME |t|)))) (DEFUN |nativeType| (|t|) (PROG (|t'|) (RETURN (COND ((NULL |t|) |t|) ((ATOM |t|) (COND ((SETQ |t'| (CDR (ASSOC (|coreSymbol| |t|) |$NativeTypeTable|))) (SETQ |t'| (COND ((|%hasFeature| :SBCL) (|bfColonColon| 'SB-ALIEN |t'|)) ((|%hasFeature| :CLISP) (|bfColonColon| 'FFI |t'|)) (T |t'|))) (COND ((AND (EQ |t| '|string|) (|%hasFeature| :SBCL)) (LIST |t'| :EXTERNAL-FORMAT :ASCII :ELEMENT-TYPE 'BASE-CHAR)) (T |t'|))) ((MEMQ |t| '(|byte| |uint8|)) (COND ((|%hasFeature| :SBCL) (LIST (|bfColonColon| 'SB-ALIEN 'UNSIGNED) 8)) ((|%hasFeature| :CLISP) (|bfColonColon| 'FFI 'UINT8)) ((OR (|%hasFeature| :ECL) (|%hasFeature| :CLOZURE)) :UNSIGNED-BYTE) (T (|nativeType| '|char|)))) ((EQ |t| '|int16|) (COND ((|%hasFeature| :SBCL) (LIST (|bfColonColon| 'SB-ALIEN 'SIGNED) 16)) ((|%hasFeature| :CLISP) (|bfColonColon| 'FFI 'INT16)) ((AND (|%hasFeature| :ECL) (|%hasFeature| :UINT16-T)) :INT16-T) ((|%hasFeature| :CLOZURE) :SIGNED-HALFWORD) (T (|unknownNativeTypeError| |t|)))) ((EQ |t| '|uint16|) (COND ((|%hasFeature| :SBCL) (LIST (|bfColonColon| 'SB-ALIEN 'UNSIGNED) 16)) ((|%hasFeature| :CLISP) (|bfColonColon| 'FFI 'UINT16)) ((AND (|%hasFeature| :ECL) (|%hasFeature| :UINT16-T)) :UINT16-T) ((|%hasFeature| :CLOZURE) :UNSIGNED-HALFWORD) (T (|unknownNativeTypeError| |t|)))) ((EQ |t| '|int32|) (COND ((|%hasFeature| :SBCL) (LIST (|bfColonColon| 'SB-ALIEN 'SIGNED) 32)) ((|%hasFeature| :CLISP) (|bfColonColon| 'FFI 'INT32)) ((AND (|%hasFeature| :ECL) (|%hasFeature| :UINT32-T)) :INT32-T) ((|%hasFeature| :CLOZURE) :SIGNED-FULLWORD) (T (|unknownNativeTypeError| |t|)))) ((EQ |t| '|uint32|) (COND ((|%hasFeature| :SBCL) (LIST (|bfColonColon| 'SB-ALIEN 'UNSIGNED) 32)) ((|%hasFeature| :CLISP) (|bfColonColon| 'FFI 'INT32)) ((AND (|%hasFeature| :ECL) (|%hasFeature| :UINT32-T)) :UINT32-T) ((|%hasFeature| :CLOZURE) :UNSIGNED-FULLWORD) (T (|unknownNativeTypeError| |t|)))) ((EQ |t| '|int64|) (COND ((|%hasFeature| :SBCL) (LIST (|bfColonColon| 'SB-ALIEN 'SIGNED) 64)) ((|%hasFeature| :CLISP) (|bfColonColon| 'FFI 'INT64)) ((AND (|%hasFeature| :ECL) (|%hasFeature| :UINT64-T)) :INT64-T) ((|%hasFeature| :CLOZURE) :SIGNED-DOUBLEWORD) (T (|unknownNativeTypeError| |t|)))) ((EQ |t| '|uint64|) (COND ((|%hasFeature| :SBCL) (LIST (|bfColonColon| 'SB-ALIEN 'UNSIGNED) 64)) ((|%hasFeature| :CLISP) (|bfColonColon| 'FFI 'UINT64)) ((AND (|%hasFeature| :ECL) (|%hasFeature| :UINT64-T)) :UINT64-T) ((|%hasFeature| :CLOZURE) :UNSIGNED-DOUBLEWORD) (T (|unknownNativeTypeError| |t|)))) ((EQ |t| '|float32|) (|nativeType| '|float|)) ((EQ |t| '|float64|) (|nativeType| '|double|)) ((EQ |t| '|pointer|) (COND ((|%hasFeature| :GCL) '|fixnum|) ((|%hasFeature| :ECL) :POINTER-VOID) ((|%hasFeature| :SBCL) (LIST '* (|bfColonColon| 'SB-ALIEN 'VOID))) ((|%hasFeature| :CLISP) (|bfColonColon| 'FFI 'C-POINTER)) ((|%hasFeature| :CLOZURE) :ADDRESS) (T (|unknownNativeTypeError| |t|)))) (T (|unknownNativeTypeError| |t|)))) ((EQ (CAR |t|) '|buffer|) (COND ((|%hasFeature| :GCL) 'OBJECT) ((|%hasFeature| :ECL) :OBJECT) ((|%hasFeature| :SBCL) (LIST '* (|nativeType| (CADR |t|)))) ((|%hasFeature| :CLISP) (|bfColonColon| 'FFI 'C-POINTER)) ((|%hasFeature| :CLOZURE) (LIST :* (|nativeType| (CADR |t|)))) (T (|unknownNativeTypeError| |t|)))) ((EQ (CAR |t|) '|pointer|) (|nativeType| '|pointer|)) (T (|unknownNativeTypeError| |t|)))))) (DEFUN |nativeReturnType| (|t|) (COND ((MEMBER |t| |$NativeSimpleReturnTypes|) (|nativeType| |t|)) (T (|coreError| (CONCAT "invalid return type for native function: " (SYMBOL-NAME |t|)))))) (DEFUN |nativeArgumentType| (|t|) (PROG (|t'| |c| |m|) (RETURN (COND ((MEMBER |t| |$NativeSimpleDataTypes|) (|nativeType| |t|)) ((EQ |t| '|string|) (|nativeType| |t|)) ((OR (ATOM |t|) (NOT (EQL (LENGTH |t|) 2))) (|coreError| "invalid argument type for a native function")) (T (SETQ |m| (CAR |t|)) (SETQ |c| (CAADR . #0=(|t|))) (SETQ |t'| (CADADR . #0#)) (COND ((NOT (MEMQ |m| '(|readonly| |writeonly| |readwrite|))) (|coreError| "missing modifier for argument type for a native function")) ((NOT (MEMQ |c| '(|buffer| |pointer|))) (|coreError| "expected 'buffer' or 'pointer' type instance")) ((NOT (MEMBER |t'| |$NativeSimpleDataTypes|)) (|coreError| "expected simple native data type")) (T (|nativeType| (CADR |t|))))))))) (DEFUN |needsStableReference?| (|t|) (PROG (|m|) (RETURN (AND (CONSP |t|) (PROGN (SETQ |m| (CAR |t|)) T) (MEMQ |m| '(|readonly| |writeonly| |readwrite|)))))) (DEFUN |coerceToNativeType| (|a| |t|) (PROG (|y| |c|) (RETURN (COND ((OR (|%hasFeature| :GCL) (|%hasFeature| :ECL) (|%hasFeature| :CLISP) (|%hasFeature| :CLOZURE)) |a|) ((|%hasFeature| :SBCL) (COND ((NOT (|needsStableReference?| |t|)) |a|) (T (SETQ |c| (CAADR . #0=(|t|))) (SETQ |y| (CADADR . #0#)) (COND ((EQ |c| '|buffer|) (LIST (|bfColonColon| 'SB-SYS 'VECTOR-SAP) |a|)) ((EQ |c| '|pointer|) (LIST (|bfColonColon| 'SB-SYS 'ALIEN-SAP) |a|)) ((|needsStableReference?| |t|) (|fatalError| (CONCAT "don't know how to coerce argument for native type" (SYMBOL-NAME |c|)))))))) (T (|fatalError| "don't know how to coerce argument for native type")))))) (DEFUN |genGCLnativeTranslation| (|op| |s| |t| |op'|) (PROG (|ccode| |cargs| |cop| |rettype| |argtypes|) (RETURN (PROGN (SETQ |argtypes| (LET ((|bfVar#129| NIL) (|bfVar#128| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#128|) (PROGN (SETQ |x| (CAR |bfVar#128|)) NIL)) (RETURN (NREVERSE |bfVar#129|))) (T (SETQ |bfVar#129| (CONS (|nativeArgumentType| |x|) |bfVar#129|)))) (SETQ |bfVar#128| (CDR |bfVar#128|))))) (SETQ |rettype| (|nativeReturnType| |t|)) (COND ((LET ((|bfVar#131| T) (|bfVar#130| (CONS |t| |s|)) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#130|) (PROGN (SETQ |x| (CAR |bfVar#130|)) NIL)) (RETURN |bfVar#131|)) (T (PROGN (SETQ |bfVar#131| (|isSimpleNativeType| |x|)) (COND ((NOT |bfVar#131|) (RETURN NIL)))))) (SETQ |bfVar#130| (CDR |bfVar#130|)))) (LIST (LIST 'DEFENTRY |op| |argtypes| (LIST |rettype| (SYMBOL-NAME |op'|))))) (T (SETQ |cop| (CONCAT (SYMBOL-NAME |op'|) "_stub")) (SETQ |cargs| (LET ((|bfVar#138| NIL) (|bfVar#137| (- (LENGTH |s|) 1)) (|i| 0)) (LOOP (COND ((> |i| |bfVar#137|) (RETURN (NREVERSE |bfVar#138|))) (T (SETQ |bfVar#138| (CONS (|genGCLnativeTranslation,mkCArgName| |i|) |bfVar#138|)))) (SETQ |i| (+ |i| 1))))) (SETQ |ccode| (LET ((|bfVar#134| "") (|bfVar#136| (CONS (|genGCLnativeTranslation,gclTypeInC| |t|) (CONS " " (CONS |cop| (CONS "(" (APPEND (LET ((|bfVar#132| NIL) (|x| |s|) (|a| |cargs|)) (LOOP (COND ((OR (ATOM |x|) (ATOM |a|)) (RETURN (NREVERSE |bfVar#132|))) (T (SETQ |bfVar#132| (CONS (|genGCLnativeTranslation,cparm| |x| |a|) |bfVar#132|)))) (SETQ |x| (CDR |x|)) (SETQ |a| (CDR |a|)))) (CONS ") { " (CONS (COND ((NOT (EQ |t| '|void|)) "return ") (T '||)) (CONS (SYMBOL-NAME |op'|) (CONS "(" (APPEND (LET ((|bfVar#133| NIL) (|x| |s|) (|a| |cargs|)) (LOOP (COND ((OR (ATOM |x|) (ATOM |a|)) (RETURN (NREVERSE |bfVar#133|))) (T (SETQ |bfVar#133| (CONS (|genGCLnativeTranslation,gclArgsInC| |x| |a|) |bfVar#133|)))) (SETQ |x| (CDR |x|)) (SETQ |a| (CDR |a|)))) (CONS "); }" NIL)))))))))))) (|bfVar#135| NIL)) (LOOP (COND ((OR (ATOM |bfVar#136|) (PROGN (SETQ |bfVar#135| (CAR |bfVar#136|)) NIL)) (RETURN |bfVar#134|)) (T (SETQ |bfVar#134| (CONCAT |bfVar#134| |bfVar#135|)))) (SETQ |bfVar#136| (CDR |bfVar#136|))))) (LIST (LIST 'CLINES |ccode|) (LIST 'DEFENTRY |op| |argtypes| (LIST |rettype| |cop|))))))))) (DEFUN |genGCLnativeTranslation,mkCArgName| (|i|) (CONCAT "x" (STRINGIMAGE |i|))) (DEFUN |genGCLnativeTranslation,cparm| (|x| |a|) (CONCAT (|genGCLnativeTranslation,gclTypeInC| (CAR |x|)) " " (CAR |a|) (COND ((CDR |x|) ", ") (T "")))) (DEFUN |genGCLnativeTranslation,gclTypeInC| (|x|) (PROG (|ISTMP#3| |ISTMP#2| |ISTMP#1|) (RETURN (COND ((MEMBER |x| |$NativeSimpleDataTypes|) (SYMBOL-NAME |x|)) ((EQ |x| '|void|) "void") ((EQ |x| '|string|) "char*") ((AND (CONSP |x|) (PROGN (SETQ |ISTMP#1| (CDR |x|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |ISTMP#2| (CAR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (EQ (CAR |ISTMP#2|) '|pointer|) (PROGN (SETQ |ISTMP#3| (CDR |ISTMP#2|)) (AND (CONSP |ISTMP#3|) (NULL (CDR |ISTMP#3|))))))))) '|fixnum|) (T "object"))))) (DEFUN |genGCLnativeTranslation,gclArgInC| (|x| |a|) (PROG (|y| |c|) (RETURN (COND ((MEMBER |x| |$NativeSimpleDataTypes|) |a|) ((EQ |x| '|string|) |a|) (T (SETQ |c| (CAADR |x|)) (SETQ |y| (CADADR |x|)) (COND ((EQ |c| '|pointer|) |a|) ((EQ |y| '|char|) (CONCAT |a| "->st.st_self")) ((EQ |y| '|byte|) (CONCAT |a| "->ust.ust_self")) ((EQ |y| '|int|) (CONCAT |a| "->fixa.fixa_self")) ((EQ |y| '|float|) (CONCAT |a| "->sfa.sfa_self")) ((EQ |y| '|double|) (CONCAT |a| "->lfa.lfa_self")) (T (|coreError| "unknown argument type")))))))) (DEFUN |genGCLnativeTranslation,gclArgsInC| (|x| |a|) (CONCAT (|genGCLnativeTranslation,gclArgInC| (CAR |x|) (CAR |a|)) (COND ((CDR |x|) ", ") (T "")))) (DEFUN |genECLnativeTranslation| (|op| |s| |t| |op'|) (PROG (|rettype| |argtypes| |args|) (RETURN (PROGN (SETQ |args| NIL) (SETQ |argtypes| NIL) (LET ((|bfVar#139| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#139|) (PROGN (SETQ |x| (CAR |bfVar#139|)) NIL)) (RETURN NIL)) (T (PROGN (SETQ |argtypes| (CONS (|nativeArgumentType| |x|) |argtypes|)) (SETQ |args| (CONS (GENSYM) |args|))))) (SETQ |bfVar#139| (CDR |bfVar#139|)))) (SETQ |args| (REVERSE |args|)) (SETQ |rettype| (|nativeReturnType| |t|)) (LIST (LIST 'DEFUN |op| |args| (LIST (|bfColonColon| 'FFI 'C-INLINE) |args| (NREVERSE |argtypes|) |rettype| (|genECLnativeTranslation,callTemplate| |op'| (LENGTH |args|) |s|) :ONE-LINER T))))))) (DEFUN |genECLnativeTranslation,callTemplate| (|op| |n| |s|) (LET ((|bfVar#143| "") (|bfVar#145| (CONS (SYMBOL-NAME |op|) (CONS "(" (APPEND (LET ((|bfVar#142| NIL) (|bfVar#140| (- |n| 1)) (|i| 0) (|bfVar#141| |s|) (|x| NIL)) (LOOP (COND ((OR (> |i| |bfVar#140|) (ATOM |bfVar#141|) (PROGN (SETQ |x| (CAR |bfVar#141|)) NIL)) (RETURN (NREVERSE |bfVar#142|))) (T (SETQ |bfVar#142| (CONS (|genECLnativeTranslation,sharpArg| |i| |x|) |bfVar#142|)))) (SETQ |i| (+ |i| 1)) (SETQ |bfVar#141| (CDR |bfVar#141|)))) (CONS ")" NIL))))) (|bfVar#144| NIL)) (LOOP (COND ((OR (ATOM |bfVar#145|) (PROGN (SETQ |bfVar#144| (CAR |bfVar#145|)) NIL)) (RETURN |bfVar#143|)) (T (SETQ |bfVar#143| (CONCAT |bfVar#143| |bfVar#144|)))) (SETQ |bfVar#145| (CDR |bfVar#145|))))) (DEFUN |genECLnativeTranslation,sharpArg| (|i| |x|) (COND ((EQL |i| 0) (CONCAT "(#0)" (|genECLnativeTranslation,selectDatum| |x|))) (T (CONCAT "," "(#" (STRINGIMAGE |i|) ")" (|genECLnativeTranslation,selectDatum| |x|))))) (DEFUN |genECLnativeTranslation,selectDatum| (|x|) (PROG (|y| |c|) (RETURN (COND ((|isSimpleNativeType| |x|) "") (T (SETQ |c| (CAADR |x|)) (SETQ |y| (CADADR |x|)) (COND ((EQ |c| '|buffer|) (COND ((OR (EQ |y| '|char|) (EQ |y| '|byte|)) (COND ((< |$ECLVersionNumber| 90100) "->vector.self.ch") ((EQ |y| '|char|) "->vector.self.i8") (T "->vector.self.b8"))) ((EQ |y| '|int|) "->vector.self.fix") ((EQ |y| '|float|) "->vector.self.sf") ((EQ |y| '|double|) "->vector.self.df") (T (|coreError| "unknown argument to buffer type constructor")))) ((EQ |c| '|pointer|) "") (T (|coreError| "unknown type constructor")))))))) (DEFUN |genCLISPnativeTranslation| (|op| |s| |t| |op'|) (PROG (|forwardingFun| |ISTMP#2| |p| |fixups| |q| |call| |localPairs| |y| |x| |ISTMP#1| |a| |foreignDecl| |unstableArgs| |parms| |n| |argtypes| |rettype|) (DECLARE (SPECIAL |$foreignsDefsForCLisp|)) (RETURN (PROGN (SETQ |rettype| (|nativeReturnType| |t|)) (SETQ |argtypes| (LET ((|bfVar#147| NIL) (|bfVar#146| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#146|) (PROGN (SETQ |x| (CAR |bfVar#146|)) NIL)) (RETURN (NREVERSE |bfVar#147|))) (T (SETQ |bfVar#147| (CONS (|nativeArgumentType| |x|) |bfVar#147|)))) (SETQ |bfVar#146| (CDR |bfVar#146|))))) (SETQ |n| (INTERN (CONCAT (SYMBOL-NAME |op|) "%clisp-hack"))) (SETQ |parms| (LET ((|bfVar#149| NIL) (|bfVar#148| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#148|) (PROGN (SETQ |x| (CAR |bfVar#148|)) NIL)) (RETURN (NREVERSE |bfVar#149|))) (T (SETQ |bfVar#149| (CONS (GENSYM "parm") |bfVar#149|)))) (SETQ |bfVar#148| (CDR |bfVar#148|))))) (SETQ |unstableArgs| NIL) (LET ((|bfVar#150| |parms|) (|p| NIL) (|bfVar#151| |s|) (|x| NIL) (|bfVar#152| |argtypes|) (|y| NIL)) (LOOP (COND ((OR (ATOM |bfVar#150|) (PROGN (SETQ |p| (CAR |bfVar#150|)) NIL) (ATOM |bfVar#151|) (PROGN (SETQ |x| (CAR |bfVar#151|)) NIL) (ATOM |bfVar#152|) (PROGN (SETQ |y| (CAR |bfVar#152|)) NIL)) (RETURN NIL)) (T (COND ((|needsStableReference?| |x|) (IDENTITY (SETQ |unstableArgs| (CONS (CONS |p| (CONS |x| |y|)) |unstableArgs|))))))) (SETQ |bfVar#150| (CDR |bfVar#150|)) (SETQ |bfVar#151| (CDR |bfVar#151|)) (SETQ |bfVar#152| (CDR |bfVar#152|)))) (SETQ |foreignDecl| (LIST (|bfColonColon| 'FFI 'DEF-CALL-OUT) |n| (LIST :NAME (SYMBOL-NAME |op'|)) (CONS :ARGUMENTS (LET ((|bfVar#155| NIL) (|bfVar#153| |argtypes|) (|x| NIL) (|bfVar#154| |parms|) (|a| NIL)) (LOOP (COND ((OR (ATOM |bfVar#153|) (PROGN (SETQ |x| (CAR |bfVar#153|)) NIL) (ATOM |bfVar#154|) (PROGN (SETQ |a| (CAR |bfVar#154|)) NIL)) (RETURN (NREVERSE |bfVar#155|))) (T (SETQ |bfVar#155| (CONS (LIST |a| |x|) |bfVar#155|)))) (SETQ |bfVar#153| (CDR |bfVar#153|)) (SETQ |bfVar#154| (CDR |bfVar#154|))))) (LIST :RETURN-TYPE |rettype|) (LIST :LANGUAGE :STDC))) (SETQ |forwardingFun| (COND ((NULL |unstableArgs|) (LIST 'DEFUN |op| |parms| (CONS |n| |parms|))) (T (SETQ |localPairs| (LET ((|bfVar#158| NIL) (|bfVar#157| |unstableArgs|) (|bfVar#156| NIL)) (LOOP (COND ((OR (ATOM |bfVar#157|) (PROGN (SETQ |bfVar#156| (CAR |bfVar#157|)) NIL)) (RETURN (NREVERSE |bfVar#158|))) (T (AND (CONSP |bfVar#156|) (PROGN (SETQ |a| (CAR |bfVar#156|)) (SETQ |ISTMP#1| (CDR |bfVar#156|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |x| (CAR |ISTMP#1|)) (SETQ |y| (CDR |ISTMP#1|)) T))) (SETQ |bfVar#158| (CONS (CONS |a| (CONS |x| (CONS |y| (GENSYM "loc")))) |bfVar#158|))))) (SETQ |bfVar#157| (CDR |bfVar#157|))))) (SETQ |call| (CONS |n| (LET ((|bfVar#160| NIL) (|bfVar#159| |parms|) (|p| NIL)) (LOOP (COND ((OR (ATOM |bfVar#159|) (PROGN (SETQ |p| (CAR |bfVar#159|)) NIL)) (RETURN (NREVERSE |bfVar#160|))) (T (SETQ |bfVar#160| (CONS (|genCLISPnativeTranslation,actualArg| |p| |localPairs|) |bfVar#160|)))) (SETQ |bfVar#159| (CDR |bfVar#159|)))))) (SETQ |call| (PROGN (SETQ |fixups| (LET ((|bfVar#162| NIL) (|bfVar#161| |localPairs|) (|p| NIL)) (LOOP (COND ((OR (ATOM |bfVar#161|) (PROGN (SETQ |p| (CAR |bfVar#161|)) NIL)) (RETURN (NREVERSE |bfVar#162|))) (T (AND (NOT (NULL (SETQ |q| (|genCLISPnativeTranslation,copyBack| |p|)))) (SETQ |bfVar#162| (CONS |q| |bfVar#162|))))) (SETQ |bfVar#161| (CDR |bfVar#161|))))) (COND ((NULL |fixups|) (LIST |call|)) (T (LIST (CONS 'PROG1 (CONS |call| |fixups|))))))) (LET ((|bfVar#164| |localPairs|) (|bfVar#163| NIL)) (LOOP (COND ((OR (ATOM |bfVar#164|) (PROGN (SETQ |bfVar#163| (CAR |bfVar#164|)) NIL)) (RETURN NIL)) (T (AND (CONSP |bfVar#163|) (PROGN (SETQ |p| (CAR |bfVar#163|)) (SETQ |ISTMP#1| (CDR |bfVar#163|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |x| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (PROGN (SETQ |y| (CAR |ISTMP#2|)) (SETQ |a| (CDR |ISTMP#2|)) T))))) (SETQ |call| (LIST (CONS (|bfColonColon| 'FFI 'WITH-FOREIGN-OBJECT) (CONS (LIST |a| (LIST 'FUNCALL (LIST 'INTERN "getCLISPType" "BOOTTRAN") |p|) |p|) |call|))))))) (SETQ |bfVar#164| (CDR |bfVar#164|)))) (CONS 'DEFUN (CONS |op| (CONS |parms| |call|)))))) (SETQ |$foreignsDefsForCLisp| (CONS |foreignDecl| |$foreignsDefsForCLisp|)) (LIST |forwardingFun|))))) (DEFUN |genCLISPnativeTranslation,copyBack| (|bfVar#165|) (PROG (|a| |y| |x| |p|) (RETURN (PROGN (SETQ |p| (CAR |bfVar#165|)) (SETQ |x| (CADR . #0=(|bfVar#165|))) (SETQ |y| (CADDR . #0#)) (SETQ |a| (CDDDR . #0#)) (COND ((AND (CONSP |x|) (EQ (CAR |x|) '|readonly|)) NIL) (T (LIST 'SETF |p| (LIST (|bfColonColon| 'FFI 'FOREIGN-VALUE) |a|)))))))) (DEFUN |genCLISPnativeTranslation,actualArg| (|p| |pairs|) (PROG (|a'|) (RETURN (COND ((SETQ |a'| (CDR (ASSOC |p| |pairs|))) (CDR (CDR |a'|))) (T |p|))))) (DEFUN |getCLISPType| (|a|) (LIST (|bfColonColon| 'FFI 'C-ARRAY) (LENGTH |a|))) (DEFUN |genSBCLnativeTranslation| (|op| |s| |t| |op'|) (PROG (|newArgs| |unstableArgs| |args| |argtypes| |rettype|) (RETURN (PROGN (SETQ |rettype| (|nativeReturnType| |t|)) (SETQ |argtypes| (LET ((|bfVar#167| NIL) (|bfVar#166| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#166|) (PROGN (SETQ |x| (CAR |bfVar#166|)) NIL)) (RETURN (NREVERSE |bfVar#167|))) (T (SETQ |bfVar#167| (CONS (|nativeArgumentType| |x|) |bfVar#167|)))) (SETQ |bfVar#166| (CDR |bfVar#166|))))) (SETQ |args| (LET ((|bfVar#169| NIL) (|bfVar#168| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#168|) (PROGN (SETQ |x| (CAR |bfVar#168|)) NIL)) (RETURN (NREVERSE |bfVar#169|))) (T (SETQ |bfVar#169| (CONS (GENSYM) |bfVar#169|)))) (SETQ |bfVar#168| (CDR |bfVar#168|))))) (SETQ |unstableArgs| NIL) (SETQ |newArgs| NIL) (LET ((|bfVar#170| |args|) (|a| NIL) (|bfVar#171| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#170|) (PROGN (SETQ |a| (CAR |bfVar#170|)) NIL) (ATOM |bfVar#171|) (PROGN (SETQ |x| (CAR |bfVar#171|)) NIL)) (RETURN NIL)) (T (PROGN (SETQ |newArgs| (CONS (|coerceToNativeType| |a| |x|) |newArgs|)) (COND ((|needsStableReference?| |x|) (SETQ |unstableArgs| (CONS |a| |unstableArgs|))))))) (SETQ |bfVar#170| (CDR |bfVar#170|)) (SETQ |bfVar#171| (CDR |bfVar#171|)))) (SETQ |op'| (COND ((|%hasFeature| :WIN32) (CONCAT "_" (SYMBOL-NAME |op'|))) (T (SYMBOL-NAME |op'|)))) (COND ((NULL |unstableArgs|) (LIST (LIST 'DEFUN |op| |args| (CONS (INTERN "ALIEN-FUNCALL" "SB-ALIEN") (CONS (LIST (INTERN "EXTERN-ALIEN" "SB-ALIEN") |op'| (CONS 'FUNCTION (CONS |rettype| |argtypes|))) |args|))))) (T (LIST (LIST 'DEFUN |op| |args| (LIST (|bfColonColon| 'SB-SYS 'WITH-PINNED-OBJECTS) (NREVERSE |unstableArgs|) (CONS (INTERN "ALIEN-FUNCALL" "SB-ALIEN") (CONS (LIST (INTERN "EXTERN-ALIEN" "SB-ALIEN") |op'| (CONS 'FUNCTION (CONS |rettype| |argtypes|))) (NREVERSE |newArgs|)))))))))))) (DEFUN |genCLOZUREnativeTranslation| (|op| |s| |t| |op'|) (PROG (|call| |p'| |ISTMP#3| |ISTMP#2| |ISTMP#1| |aryPairs| |strPairs| |parms| |argtypes| |rettype|) (RETURN (PROGN (SETQ |rettype| (|nativeReturnType| |t|)) (SETQ |argtypes| (LET ((|bfVar#173| NIL) (|bfVar#172| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#172|) (PROGN (SETQ |x| (CAR |bfVar#172|)) NIL)) (RETURN (NREVERSE |bfVar#173|))) (T (SETQ |bfVar#173| (CONS (|nativeArgumentType| |x|) |bfVar#173|)))) (SETQ |bfVar#172| (CDR |bfVar#172|))))) (SETQ |parms| (LET ((|bfVar#175| NIL) (|bfVar#174| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#174|) (PROGN (SETQ |x| (CAR |bfVar#174|)) NIL)) (RETURN (NREVERSE |bfVar#175|))) (T (SETQ |bfVar#175| (CONS (GENSYM "parm") |bfVar#175|)))) (SETQ |bfVar#174| (CDR |bfVar#174|))))) (SETQ |strPairs| NIL) (SETQ |aryPairs| NIL) (LET ((|bfVar#176| |parms|) (|p| NIL) (|bfVar#177| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#176|) (PROGN (SETQ |p| (CAR |bfVar#176|)) NIL) (ATOM |bfVar#177|) (PROGN (SETQ |x| (CAR |bfVar#177|)) NIL)) (RETURN NIL)) (T (COND ((EQ |x| '|string|) (SETQ |strPairs| (CONS (CONS |p| (GENSYM "loc")) |strPairs|))) ((AND (CONSP |x|) (PROGN (SETQ |ISTMP#1| (CDR |x|)) (AND (CONSP |ISTMP#1|) (NULL (CDR |ISTMP#1|)) (PROGN (SETQ |ISTMP#2| (CAR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (EQ (CAR |ISTMP#2|) '|buffer|) (PROGN (SETQ |ISTMP#3| (CDR |ISTMP#2|)) (AND (CONSP |ISTMP#3|) (NULL (CDR |ISTMP#3|))))))))) (SETQ |aryPairs| (CONS (CONS |p| (GENSYM "loc")) |aryPairs|)))))) (SETQ |bfVar#176| (CDR |bfVar#176|)) (SETQ |bfVar#177| (CDR |bfVar#177|)))) (COND ((|%hasFeature| :DARWIN) (SETQ |op'| (CONCAT '_ |op'|)))) (SETQ |call| (CONS (|bfColonColon| 'CCL 'EXTERNAL-CALL) (CONS (STRING |op'|) (APPEND (LET ((|bfVar#180| NIL) (|bfVar#178| |argtypes|) (|x| NIL) (|bfVar#179| |parms|) (|p| NIL)) (LOOP (COND ((OR (ATOM |bfVar#178|) (PROGN (SETQ |x| (CAR |bfVar#178|)) NIL) (ATOM |bfVar#179|) (PROGN (SETQ |p| (CAR |bfVar#179|)) NIL)) (RETURN (NREVERSE |bfVar#180|))) (T (SETQ |bfVar#180| (APPEND (REVERSE (LIST |x| (COND ((SETQ |p'| (ASSOC |p| |strPairs|)) (CDR |p'|)) ((SETQ |p'| (ASSOC |p| |aryPairs|)) (CDR |p'|)) (T |p|)))) |bfVar#180|)))) (SETQ |bfVar#178| (CDR |bfVar#178|)) (SETQ |bfVar#179| (CDR |bfVar#179|)))) (CONS |rettype| NIL))))) (COND ((EQ |t| '|string|) (SETQ |call| (LIST (|bfColonColon| 'CCL 'GET-CSTRING) |call|)))) (LET ((|bfVar#181| |aryPairs|) (|arg| NIL)) (LOOP (COND ((OR (ATOM |bfVar#181|) (PROGN (SETQ |arg| (CAR |bfVar#181|)) NIL)) (RETURN NIL)) (T (SETQ |call| (LIST (|bfColonColon| 'CCL 'WITH-POINTER-TO-IVECTOR) (LIST (CDR |arg|) (CAR |arg|)) |call|)))) (SETQ |bfVar#181| (CDR |bfVar#181|)))) (COND (|strPairs| (SETQ |call| (LIST (|bfColonColon| 'CCL 'WITH-CSTRS) (LET ((|bfVar#183| NIL) (|bfVar#182| |strPairs|) (|arg| NIL)) (LOOP (COND ((OR (ATOM |bfVar#182|) (PROGN (SETQ |arg| (CAR |bfVar#182|)) NIL)) (RETURN (NREVERSE |bfVar#183|))) (T (SETQ |bfVar#183| (CONS (LIST (CDR |arg|) (CAR |arg|)) |bfVar#183|)))) (SETQ |bfVar#182| (CDR |bfVar#182|)))) |call|)))) (LIST (LIST 'DEFUN |op| |parms| |call|)))))) (DEFUN |genImportDeclaration| (|op| |sig|) (PROG (|s| |t| |m| |ISTMP#2| |op'| |ISTMP#1|) (RETURN (COND ((NOT (AND (CONSP |sig|) (EQ (CAR |sig|) '|%Signature|) (PROGN (SETQ |ISTMP#1| (CDR |sig|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |op'| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (NULL (CDR |ISTMP#2|)) (PROGN (SETQ |m| (CAR |ISTMP#2|)) T))))))) (|coreError| "invalid signature")) ((NOT (AND (CONSP |m|) (EQ (CAR |m|) '|%Mapping|) (PROGN (SETQ |ISTMP#1| (CDR |m|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |t| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (NULL (CDR |ISTMP#2|)) (PROGN (SETQ |s| (CAR |ISTMP#2|)) T))))))) (|coreError| "invalid function type")) (T (COND ((AND (NOT (NULL |s|)) (SYMBOLP |s|)) (SETQ |s| (LIST |s|)))) (COND ((|%hasFeature| :GCL) (|genGCLnativeTranslation| |op| |s| |t| |op'|)) ((|%hasFeature| :SBCL) (|genSBCLnativeTranslation| |op| |s| |t| |op'|)) ((|%hasFeature| :CLISP) (|genCLISPnativeTranslation| |op| |s| |t| |op'|)) ((|%hasFeature| :ECL) (|genECLnativeTranslation| |op| |s| |t| |op'|)) ((|%hasFeature| :CLOZURE) (|genCLOZUREnativeTranslation| |op| |s| |t| |op'|)) (T (|fatalError| "import declaration not implemented for this Lisp"))))))))