(IMPORT-MODULE "includer") (IMPORT-MODULE "scanner") (IMPORT-MODULE "pile") (IMPORT-MODULE "parser") (IMPORT-MODULE "ast") (IN-PACKAGE "BOOTTRAN") (PROVIDE "translator") (DEFPARAMETER |$currentModuleName| NIL) (DEFPARAMETER |$foreignsDefsForCLisp| NIL) (DEFUN |genModuleFinalization| (|stream|) (PROG (|init|) (DECLARE (SPECIAL |$currentModuleName| |$foreignsDefsForCLisp|)) (RETURN (COND ((|%hasFeature| :CLISP) (COND ((NULL |$foreignsDefsForCLisp|) NIL) ((NULL |$currentModuleName|) (|coreError| "current module has no name")) (#0='T (PROGN (SETQ |init| (CONS 'DEFUN (CONS (INTERN (CONCAT |$currentModuleName| '|InitCLispFFI|)) (CONS NIL (CONS (LIST 'MAPC (LIST 'FUNCTION 'FMAKUNBOUND) (LIST 'QUOTE (LET ((|bfVar#2| NIL) (|bfVar#1| |$foreignsDefsForCLisp|) (|d| NIL)) (LOOP (COND ((OR (ATOM |bfVar#1|) (PROGN (SETQ |d| (CAR |bfVar#1|)) NIL)) (RETURN (NREVERSE |bfVar#2|))) (#1='T (SETQ |bfVar#2| (CONS (CADR |d|) |bfVar#2|)))) (SETQ |bfVar#1| (CDR |bfVar#1|)))))) (LET ((|bfVar#4| NIL) (|bfVar#3| |$foreignsDefsForCLisp|) (|d| NIL)) (LOOP (COND ((OR (ATOM |bfVar#3|) (PROGN (SETQ |d| (CAR |bfVar#3|)) NIL)) (RETURN (NREVERSE |bfVar#4|))) (#1# (SETQ |bfVar#4| (CONS (LIST 'EVAL (LIST 'QUOTE |d|)) |bfVar#4|)))) (SETQ |bfVar#3| (CDR |bfVar#3|))))))))) (REALLYPRETTYPRINT |init| |stream|))))) (#0# NIL))))) (DEFUN |genOptimizeOptions| (|stream|) (DECLARE (SPECIAL |$LispOptimizeOptions|)) (REALLYPRETTYPRINT (LIST 'PROCLAIM (LIST 'QUOTE (CONS 'OPTIMIZE |$LispOptimizeOptions|))) |stream|)) (DEFPARAMETER |$translatingOldBoot| NIL) (DEFUN |AxiomCore|::|%sysInit| () (DECLARE (SPECIAL |$translatingOldBoot|)) (PROGN (SETQ *LOAD-VERBOSE* NIL) (COND ((|%hasFeature| :GCL) (SETF (SYMBOL-VALUE (|bfColonColon| 'COMPILER '*COMPILE-VERBOSE*)) NIL) (SETF (SYMBOL-VALUE (|bfColonColon| 'COMPILER 'SUPPRESS-COMPILER-WARNINGS*)) NIL) (SETF (SYMBOL-VALUE (|bfColonColon| 'COMPILER 'SUPPRESS-COMPILER-NOTES*)) T))) (COND ((EQUAL (CDR (ASSOC (|Option| "boot") (|%systemOptions|))) "old") (SETQ |$translatingOldBoot| T))))) (DECLAIM (FTYPE (FUNCTION (|%Thing|) |%Thing|) |setCurrentPackage|)) (DEFUN |setCurrentPackage| (|x|) (SETQ *PACKAGE* |x|)) (DECLAIM (FTYPE (FUNCTION (|%String|) |%Thing|) |shoeCOMPILE-FILE|)) (DEFUN |shoeCOMPILE-FILE| (|lspFileName|) (COMPILE-FILE |lspFileName|)) (DEFUN BOOTTOCL (|fn| |out|) (PROG (|result| |callingPackage|) (RETURN (PROGN (SETQ |callingPackage| *PACKAGE*) (IN-PACKAGE "BOOTTRAN") (SETQ |result| (BOOTTOCLLINES NIL |fn| |out|)) (|setCurrentPackage| |callingPackage|) |result|)))) (DEFUN BOOTCLAM (|fn| |out|) (DECLARE (SPECIAL |$bfClamming|)) (PROGN (SETQ |$bfClamming| T) (BOOTCLAMLINES NIL |fn| |out|))) (DEFUN BOOTCLAMLINES (|lines| |fn| |out|) (BOOTTOCLLINES |lines| |fn| |out|)) (DEFUN BOOTTOCLLINES (|lines| |fn| |outfn|) (PROG (|infn|) (RETURN (PROGN (SETQ *READ-DEFAULT-FLOAT-FORMAT* 'DOUBLE-FLOAT) (SETQ |infn| (|shoeAddbootIfNec| |fn|)) (|shoeOpenInputFile| |a| |infn| (|shoeClLines| |a| |fn| |lines| |outfn|)))))) (DEFUN |shoeClLines| (|a| |fn| |lines| |outfn|) (DECLARE (SPECIAL |$GenVarCounter|)) (COND ((NULL |a|) (|shoeNotFound| |fn|)) ('T (PROGN (SETQ |$GenVarCounter| 0) (|shoeOpenOutputFile| |stream| |outfn| (PROGN (|genOptimizeOptions| |stream|) (LET ((|bfVar#5| |lines|) (|line| NIL)) (LOOP (COND ((OR (ATOM |bfVar#5|) (PROGN (SETQ |line| (CAR |bfVar#5|)) NIL)) (RETURN NIL)) ('T (|shoeFileLine| |line| |stream|))) (SETQ |bfVar#5| (CDR |bfVar#5|)))) (|shoeFileTrees| (|shoeTransformStream| |a|) |stream|) (|genModuleFinalization| |stream|))) |outfn|)))) (DEFUN BOOTTOCLC (|fn| |out|) (PROG (|result| |callingPackage|) (RETURN (PROGN (SETQ |callingPackage| *PACKAGE*) (IN-PACKAGE "BOOTTRAN") (SETQ |result| (BOOTTOCLCLINES NIL |fn| |out|)) (|setCurrentPackage| |callingPackage|) |result|)))) (DEFUN BOOTTOCLCLINES (|lines| |fn| |outfn|) (PROG (|infn|) (RETURN (PROGN (SETQ |infn| (|shoeAddbootIfNec| |fn|)) (|shoeOpenInputFile| |a| |infn| (|shoeClCLines| |a| |fn| |lines| |outfn|)))))) (DEFUN |shoeClCLines| (|a| |fn| |lines| |outfn|) (DECLARE (SPECIAL |$GenVarCounter|)) (COND ((NULL |a|) (|shoeNotFound| |fn|)) ('T (PROGN (SETQ |$GenVarCounter| 0) (|shoeOpenOutputFile| |stream| |outfn| (PROGN (|genOptimizeOptions| |stream|) (LET ((|bfVar#6| |lines|) (|line| NIL)) (LOOP (COND ((OR (ATOM |bfVar#6|) (PROGN (SETQ |line| (CAR |bfVar#6|)) NIL)) (RETURN NIL)) ('T (|shoeFileLine| |line| |stream|))) (SETQ |bfVar#6| (CDR |bfVar#6|)))) (|shoeFileTrees| (|shoeTransformToFile| |stream| (|shoeInclude| (|bAddLineNumber| (|bRgen| |a|) (|bIgen| 0)))) |stream|) (|genModuleFinalization| |stream|))) |outfn|)))) (DECLAIM (FTYPE (FUNCTION (|%String|) |%Thing|) BOOTTOMC)) (DEFUN BOOTTOMC (|fn|) (PROG (|result| |infn| |callingPackage|) (DECLARE (SPECIAL |$GenVarCounter|)) (RETURN (PROGN (SETQ |callingPackage| *PACKAGE*) (IN-PACKAGE "BOOTTRAN") (SETQ |$GenVarCounter| 0) (SETQ |infn| (|shoeAddbootIfNec| |fn|)) (SETQ |result| (|shoeOpenInputFile| |a| |infn| (|shoeMc| |a| |fn|))) (|setCurrentPackage| |callingPackage|) |result|)))) (DEFUN |shoeMc| (|a| |fn|) (COND ((NULL |a|) (|shoeNotFound| |fn|)) ('T (PROGN (|shoePCompileTrees| (|shoeTransformStream| |a|)) (|shoeConsole| (CONCAT |fn| " COMPILED AND LOADED")))))) (DEFUN EVAL-BOOT-FILE (|fn|) (PROG (|outfn| |infn| |b|) (RETURN (PROGN (SETQ |b| *PACKAGE*) (IN-PACKAGE "BOOTTRAN") (SETQ |infn| (|shoeAddbootIfNec| |fn|)) (SETQ |outfn| (CONCAT (|shoeRemovebootIfNec| |fn|) "." *LISP-SOURCE-FILETYPE*)) (|shoeOpenInputFile| |a| |infn| (|shoeClLines| |a| |infn| NIL |outfn|)) (|setCurrentPackage| |b|) (LOAD |outfn|))))) (DECLAIM (FTYPE (FUNCTION (|%String|) |%Thing|) BO)) (DEFUN BO (|fn|) (PROG (|infn| |b|) (DECLARE (SPECIAL |$GenVarCounter|)) (RETURN (PROGN (SETQ |b| *PACKAGE*) (IN-PACKAGE "BOOTTRAN") (SETQ |$GenVarCounter| 0) (SETQ |infn| (|shoeAddbootIfNec| |fn|)) (|shoeOpenInputFile| |a| |infn| (|shoeToConsole| |a| |fn|)) (|setCurrentPackage| |b|))))) (DEFUN BOCLAM (|fn|) (PROG (|result| |infn| |callingPackage|) (DECLARE (SPECIAL |$bfClamming| |$GenVarCounter|)) (RETURN (PROGN (SETQ |callingPackage| *PACKAGE*) (IN-PACKAGE "BOOTTRAN") (SETQ |$GenVarCounter| 0) (SETQ |$bfClamming| T) (SETQ |infn| (|shoeAddbootIfNec| |fn|)) (SETQ |result| (|shoeOpenInputFile| |a| |infn| (|shoeToConsole| |a| |fn|))) (|setCurrentPackage| |callingPackage|) |result|)))) (DEFUN |shoeToConsole| (|a| |fn|) (COND ((NULL |a|) (|shoeNotFound| |fn|)) ('T (|shoeConsoleTrees| (|shoeTransformToConsole| (|shoeInclude| (|bAddLineNumber| (|bRgen| |a|) (|bIgen| 0)))))))) (DEFUN STOUT (|string|) (PSTOUT (LIST |string|))) (DEFUN |string2BootTree| (|string|) (PROG (|result| |a| |callingPackage|) (DECLARE (SPECIAL |$GenVarCounter|)) (RETURN (PROGN (SETQ |callingPackage| *PACKAGE*) (IN-PACKAGE "BOOTTRAN") (SETQ |$GenVarCounter| 0) (SETQ |a| (|shoeTransformString| (LIST |string|))) (SETQ |result| (COND ((|bStreamNull| |a|) NIL) ('T (|stripm| (CAR |a|) |callingPackage| (FIND-PACKAGE "BOOTTRAN"))))) (|setCurrentPackage| |callingPackage|) |result|)))) (DEFUN STEVAL (|string|) (PROG (|result| |fn| |a| |callingPackage|) (DECLARE (SPECIAL |$GenVarCounter|)) (RETURN (PROGN (SETQ |callingPackage| *PACKAGE*) (IN-PACKAGE "BOOTTRAN") (SETQ |$GenVarCounter| 0) (SETQ |a| (|shoeTransformString| (LIST |string|))) (SETQ |result| (COND ((|bStreamNull| |a|) NIL) ('T (PROGN (SETQ |fn| (|stripm| (CAR |a|) *PACKAGE* (FIND-PACKAGE "BOOTTRAN"))) (EVAL |fn|))))) (|setCurrentPackage| |callingPackage|) |result|)))) (DEFUN STTOMC (|string|) (PROG (|result| |a| |callingPackage|) (DECLARE (SPECIAL |$GenVarCounter|)) (RETURN (PROGN (SETQ |callingPackage| *PACKAGE*) (IN-PACKAGE "BOOTTRAN") (SETQ |$GenVarCounter| 0) (SETQ |a| (|shoeTransformString| (LIST |string|))) (SETQ |result| (COND ((|bStreamNull| |a|) NIL) ('T (|shoePCompile| (CAR |a|))))) (|setCurrentPackage| |callingPackage|) |result|)))) (DEFUN |shoeCompileTrees| (|s|) (LOOP (COND ((|bStreamNull| |s|) (RETURN NIL)) ('T (PROGN (|shoeCompile| (CAR |s|)) (SETQ |s| (CDR |s|))))))) (DECLAIM (FTYPE (FUNCTION (|%Ast|) |%Thing|) |shoeCompile|)) (DEFUN |shoeCompile| (|fn|) (PROG (|body| |bv| |ISTMP#2| |name| |ISTMP#1|) (RETURN (COND ((AND (CONSP |fn|) (EQ (CAR |fn|) 'DEFUN) (PROGN (SETQ |ISTMP#1| (CDR |fn|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |name| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (PROGN (SETQ |bv| (CAR |ISTMP#2|)) (SETQ |body| (CDR |ISTMP#2|)) 'T)))))) (COMPILE |name| (CONS 'LAMBDA (CONS |bv| |body|)))) ('T (EVAL |fn|)))))) (DEFUN |shoeTransform| (|str|) (|bNext| #'|shoeTreeConstruct| (|bNext| #'|shoePileInsert| (|bNext| #'|shoeLineToks| |str|)))) (DEFUN |shoeTransformString| (|s|) (|shoeTransform| (|shoeInclude| (|bAddLineNumber| |s| (|bIgen| 0))))) (DEFUN |shoeTransformStream| (|s|) (|shoeTransformString| (|bRgen| |s|))) (DEFUN |shoeTransformToConsole| (|str|) (|bNext| #'|shoeConsoleItem| (|bNext| #'|shoePileInsert| (|bNext| #'|shoeLineToks| |str|)))) (DEFUN |shoeTransformToFile| (|fn| |str|) (|bFileNext| |fn| (|bNext| #'|shoePileInsert| (|bNext| #'|shoeLineToks| |str|)))) (DEFUN |shoeConsoleItem| (|str|) (PROG (|dq|) (RETURN (PROGN (SETQ |dq| (CAR |str|)) (|shoeConsoleLines| (|shoeDQlines| |dq|)) (CONS (|shoeParseTrees| |dq|) (CDR |str|)))))) (DEFUN |bFileNext| (|fn| |s|) (|bDelay| #'|bFileNext1| (LIST |fn| |s|))) (DEFUN |bFileNext1| (|fn| |s|) (PROG (|dq|) (RETURN (COND ((|bStreamNull| |s|) (LIST '|nullstream|)) ('T (PROGN (SETQ |dq| (CAR |s|)) (|shoeFileLines| (|shoeDQlines| |dq|) |fn|) (|bAppend| (|shoeParseTrees| |dq|) (|bFileNext| |fn| (CDR |s|))))))))) (DEFUN |shoeParseTrees| (|dq|) (PROG (|toklist|) (RETURN (PROGN (SETQ |toklist| (|dqToList| |dq|)) (COND ((NULL |toklist|) NIL) ('T (|shoeOutParse| |toklist|))))))) (DEFUN |shoeTreeConstruct| (|str|) (CONS (|shoeParseTrees| (CAR |str|)) (CDR |str|))) (DEFUN |shoeDQlines| (|dq|) (PROG (|b| |a|) (RETURN (PROGN (SETQ |a| (CDAAR (|shoeLastTokPosn| |dq|))) (SETQ |b| (CDAAR (|shoeFirstTokPosn| |dq|))) (|streamTake| (+ (- |a| |b|) 1) (CAR (|shoeFirstTokPosn| |dq|))))))) (DEFUN |streamTake| (|n| |s|) (COND ((|bStreamNull| |s|) NIL) ((EQL |n| 0) NIL) ('T (CONS (CAR |s|) (|streamTake| (- |n| 1) (CDR |s|)))))) (DEFUN |shoeFileLines| (|lines| |fn|) (PROGN (|shoeFileLine| " " |fn|) (LET ((|bfVar#7| |lines|) (|line| NIL)) (LOOP (COND ((OR (ATOM |bfVar#7|) (PROGN (SETQ |line| (CAR |bfVar#7|)) NIL)) (RETURN NIL)) ('T (|shoeFileLine| (|shoeAddComment| |line|) |fn|))) (SETQ |bfVar#7| (CDR |bfVar#7|)))) (|shoeFileLine| " " |fn|))) (DEFUN |shoeConsoleLines| (|lines|) (PROGN (|shoeConsole| " ") (LET ((|bfVar#8| |lines|) (|line| NIL)) (LOOP (COND ((OR (ATOM |bfVar#8|) (PROGN (SETQ |line| (CAR |bfVar#8|)) NIL)) (RETURN NIL)) ('T (|shoeConsole| (|shoeAddComment| |line|)))) (SETQ |bfVar#8| (CDR |bfVar#8|)))) (|shoeConsole| " "))) (DEFUN |shoeFileLine| (|x| |stream|) (PROGN (WRITE-LINE |x| |stream|) |x|)) (DEFUN |shoeFileTrees| (|s| |st|) (PROG (|a|) (RETURN (LOOP (COND ((|bStreamNull| |s|) (RETURN NIL)) ('T (PROGN (SETQ |a| (CAR |s|)) (COND ((EQCAR |a| '+LINE) (|shoeFileLine| (CADR |a|) |st|)) ('T (REALLYPRETTYPRINT |a| |st|) (TERPRI |st|))) (SETQ |s| (CDR |s|))))))))) (DEFUN |shoePPtoFile| (|x| |stream|) (PROGN (SHOENOTPRETTYPRINT |x| |stream|) |x|)) (DEFUN |shoeConsoleTrees| (|s|) (PROG (|fn|) (RETURN (LOOP (COND ((|bStreamPackageNull| |s|) (RETURN NIL)) ('T (PROGN (SETQ |fn| (|stripm| (CAR |s|) *PACKAGE* (FIND-PACKAGE "BOOTTRAN"))) (REALLYPRETTYPRINT |fn|) (SETQ |s| (CDR |s|))))))))) (DEFUN |shoeAddComment| (|l|) (CONCAT "; " (CAR |l|))) (DEFUN |needsStableReference?| (|t|) (COND ((|%hasFeature| :GCL) NIL) ((OR (|%hasFeature| :SBCL) (|%hasFeature| :CLISP) (|%hasFeature| :ECL)) (OR (EQ |t| '|pointer|) (EQ |t| '|buffer|))) ('T T))) (DEFUN |coerceToNativeType| (|a| |t|) (COND ((|%hasFeature| :GCL) |a|) ((|%hasFeature| :SBCL) (COND ((EQ |t| '|buffer|) (LIST (|bfColonColon| 'SB-SYS 'VECTOR-SAP) |a|)) ((EQ |t| '|string|) |a|) ((|needsStableReference?| |t|) (|fatalError| "don't know how to coerce argument for native type")) (#0='T |a|))) ((OR (|%hasFeature| :CLISP) (|%hasFeature| :ECL)) (COND ((|needsStableReference?| |t|) (|fatalError| "don't know how to coerce argument for native type")) (#0# |a|))) (#0# (|fatalError| "don't know how to coerce argument for native type")))) (DEFUN |prepareArgumentsForNativeCall| (|args| |types|) (PROG (|preparedArgs| |unstableArgs|) (RETURN (PROGN (SETQ |unstableArgs| (LET ((|bfVar#11| NIL) (|bfVar#9| |args|) (|a| NIL) (|bfVar#10| |types|) (|t| NIL)) (LOOP (COND ((OR (ATOM |bfVar#9|) (PROGN (SETQ |a| (CAR |bfVar#9|)) NIL) (ATOM |bfVar#10|) (PROGN (SETQ |t| (CAR |bfVar#10|)) NIL)) (RETURN (NREVERSE |bfVar#11|))) (#0='T (AND (|needsStableReference?| |t|) (SETQ |bfVar#11| (CONS |a| |bfVar#11|))))) (SETQ |bfVar#9| (CDR |bfVar#9|)) (SETQ |bfVar#10| (CDR |bfVar#10|))))) (SETQ |preparedArgs| (LET ((|bfVar#14| NIL) (|bfVar#12| |args|) (|a| NIL) (|bfVar#13| |types|) (|t| NIL)) (LOOP (COND ((OR (ATOM |bfVar#12|) (PROGN (SETQ |a| (CAR |bfVar#12|)) NIL) (ATOM |bfVar#13|) (PROGN (SETQ |t| (CAR |bfVar#13|)) NIL)) (RETURN (NREVERSE |bfVar#14|))) (#0# (SETQ |bfVar#14| (CONS (|coerceToNativeType| |a| |t|) |bfVar#14|)))) (SETQ |bfVar#12| (CDR |bfVar#12|)) (SETQ |bfVar#13| (CDR |bfVar#13|))))) (LIST |unstableArgs| |preparedArgs|))))) (DEFUN |genImportDeclaration| (|op| |sig|) (PROG (|bfVar#33| |forwardingFun| |foreignDecl| |n| |newArgs| |unstableArgs| |LETTMP#1| |args| |s| |t| |m| |ISTMP#2| |op'| |ISTMP#1|) (DECLARE (SPECIAL |$foreignsDefsForCLisp|)) (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|) (EQ (CDR |ISTMP#2|) NIL) (PROGN (SETQ |m| (CAR |ISTMP#2|)) #0='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|) (EQ (CDR |ISTMP#2|) NIL) (PROGN (SETQ |s| (CAR |ISTMP#2|)) #0#))))))) (|coreError| "invalid function type")) (#1='T (PROGN (COND ((AND (NOT (NULL |s|)) (SYMBOLP |s|)) (SETQ |s| (LIST |s|)))) (COND ((|needsStableReference?| |t|) (|fatalError| "non trivial return type for native function")) ((|%hasFeature| :GCL) (LIST (LIST 'DEFENTRY |op| (LET ((|bfVar#16| NIL) (|bfVar#15| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#15|) (PROGN (SETQ |x| (CAR |bfVar#15|)) NIL)) (RETURN (NREVERSE |bfVar#16|))) (#2='T (SETQ |bfVar#16| (CONS (|nativeType| |x|) |bfVar#16|)))) (SETQ |bfVar#15| (CDR |bfVar#15|)))) (LIST (|nativeType| |t|) (SYMBOL-NAME |op'|))))) (#1# (PROGN (SETQ |args| (LET ((|bfVar#18| NIL) (|bfVar#17| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#17|) (PROGN (SETQ |x| (CAR |bfVar#17|)) NIL)) (RETURN (NREVERSE |bfVar#18|))) (#2# (SETQ |bfVar#18| (CONS (GENSYM) |bfVar#18|)))) (SETQ |bfVar#17| (CDR |bfVar#17|))))) (COND ((|%hasFeature| :SBCL) (PROGN (SETQ |LETTMP#1| (|prepareArgumentsForNativeCall| |args| |s|)) (SETQ |unstableArgs| (CAR |LETTMP#1|)) (SETQ |newArgs| (CADR |LETTMP#1|)) (COND ((NULL |unstableArgs|) (LIST (LIST 'DEFUN |op| |args| (CONS (INTERN "ALIEN-FUNCALL" "SB-ALIEN") (CONS (LIST (INTERN "EXTERN-ALIEN" "SB-ALIEN") (SYMBOL-NAME |op'|) (CONS 'FUNCTION (CONS (|nativeType| |t|) (LET ((|bfVar#20| NIL) (|bfVar#19| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#19|) (PROGN (SETQ |x| (CAR |bfVar#19|)) NIL)) (RETURN (NREVERSE |bfVar#20|))) (#2# (SETQ |bfVar#20| (CONS (|nativeType| |x|) |bfVar#20|)))) (SETQ |bfVar#19| (CDR |bfVar#19|))))))) |args|))))) (#1# (LIST (LIST 'DEFUN |op| |args| (LIST (|bfColonColon| 'SB-SYS 'WITH-PINNED-OBJECTS) |unstableArgs| (CONS (INTERN "ALIEN-FUNCALL" "SB-ALIEN") (CONS (LIST (INTERN "EXTERN-ALIEN" "SB-ALIEN") (SYMBOL-NAME |op'|) (CONS 'FUNCTION (CONS (|nativeType| |t|) (LET ((|bfVar#22| NIL) (|bfVar#21| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#21|) (PROGN (SETQ |x| (CAR |bfVar#21|)) NIL)) (RETURN (NREVERSE |bfVar#22|))) (#2# (SETQ |bfVar#22| (CONS (|nativeType| |x|) |bfVar#22|)))) (SETQ |bfVar#21| (CDR |bfVar#21|))))))) |newArgs|))))))))) ((|%hasFeature| :CLISP) (PROGN (SETQ |foreignDecl| (PROGN (SETQ |n| (INTERN (CONCAT (SYMBOL-NAME |op|) "%clisp-hack"))) (LIST (|bfColonColon| 'FFI 'DEF-CALL-OUT) |n| (LIST :NAME (SYMBOL-NAME |op'|)) (CONS :ARGUMENTS (LET ((|bfVar#25| NIL) (|bfVar#23| |s|) (|x| NIL) (|bfVar#24| |args|) (|a| NIL)) (LOOP (COND ((OR (ATOM |bfVar#23|) (PROGN (SETQ |x| (CAR |bfVar#23|)) NIL) (ATOM |bfVar#24|) (PROGN (SETQ |a| (CAR |bfVar#24|)) NIL)) (RETURN (NREVERSE |bfVar#25|))) (#2# (SETQ |bfVar#25| (CONS (LIST |a| (|nativeType| |x|)) |bfVar#25|)))) (SETQ |bfVar#23| (CDR |bfVar#23|)) (SETQ |bfVar#24| (CDR |bfVar#24|))))) (LIST :RETURN-TYPE (|nativeType| |t|)) (LIST :LANGUAGE :STDC)))) (SETQ |forwardingFun| (LIST 'DEFUN |op| |args| (CONS |n| (LET ((|bfVar#28| NIL) (|bfVar#26| |args|) (|a| NIL) (|bfVar#27| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#26|) (PROGN (SETQ |a| (CAR |bfVar#26|)) NIL) (ATOM |bfVar#27|) (PROGN (SETQ |x| (CAR |bfVar#27|)) NIL)) (RETURN (NREVERSE |bfVar#28|))) (#2# (SETQ |bfVar#28| (CONS (|coerceToNativeType| |a| |t|) |bfVar#28|)))) (SETQ |bfVar#26| (CDR |bfVar#26|)) (SETQ |bfVar#27| (CDR |bfVar#27|))))))) (SETQ |$foreignsDefsForCLisp| (CONS |foreignDecl| |$foreignsDefsForCLisp|)) (LIST |forwardingFun|))) ((|%hasFeature| :ECL) (LIST (LIST 'DEFUN |op| |args| (LIST (|bfColonColon| 'FFI 'C-INLINE) |args| (LET ((|bfVar#30| NIL) (|bfVar#29| |s|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#29|) (PROGN (SETQ |x| (CAR |bfVar#29|)) NIL)) (RETURN (NREVERSE |bfVar#30|))) (#2# (SETQ |bfVar#30| (CONS (|nativeType| |x|) |bfVar#30|)))) (SETQ |bfVar#29| (CDR |bfVar#29|)))) (|nativeType| |t|) (PROGN (SETQ |bfVar#33| (|genImportDeclaration,callTemplate| |op'| (LENGTH |args|))) (LET ((|bfVar#31| (CAR |bfVar#33|)) (|bfVar#34| (CDR |bfVar#33|)) (|bfVar#32| NIL)) (LOOP (COND ((OR (ATOM |bfVar#34|) (PROGN (SETQ |bfVar#32| (CAR |bfVar#34|)) NIL)) (RETURN |bfVar#31|)) (#2# (SETQ |bfVar#31| (CONCAT |bfVar#31| |bfVar#32|)))) (SETQ |bfVar#34| (CDR |bfVar#34|))))) :ONE-LINER T)))) (#1# (|fatalError| "import declaration not implemented for this Lisp")))))))))))) (DEFUN |genImportDeclaration,callTemplate| (|op| |n|) (CONS (SYMBOL-NAME |op|) (CONS "(" (APPEND (LET ((|bfVar#36| NIL) (|bfVar#35| (- |n| 1)) (|i| 0)) (LOOP (COND ((> |i| |bfVar#35|) (RETURN (NREVERSE |bfVar#36|))) ('T (SETQ |bfVar#36| (APPEND (REVERSE (|genImportDeclaration,sharpArg| |i|)) |bfVar#36|)))) (SETQ |i| (+ |i| 1)))) (CONS ")" NIL))))) (DEFUN |genImportDeclaration,sharpArg| (|i|) (COND ((EQL |i| 0) (LIST "#0")) ('T (LIST "," "#" (STRINGIMAGE |i|))))) (DEFUN |shoeOutParse| (|stream|) (PROG (|found|) (DECLARE (SPECIAL |$bpParenCount| |$bpCount| |$returns| |$typings| |$wheredefs| |$op| |$ttok| |$stok| |$stack| |$inputStream|)) (RETURN (PROGN (SETQ |$inputStream| |stream|) (SETQ |$stack| NIL) (SETQ |$stok| NIL) (SETQ |$ttok| NIL) (SETQ |$op| NIL) (SETQ |$wheredefs| NIL) (SETQ |$typings| NIL) (SETQ |$returns| NIL) (SETQ |$bpCount| 0) (SETQ |$bpParenCount| 0) (|bpFirstTok|) (SETQ |found| (CATCH 'TRAPPOINT (|bpOutItem|))) (COND ((EQ |found| 'TRAPPED) NIL) ((NOT (|bStreamNull| |$inputStream|)) (PROGN (|bpGeneralErrorHere|) NIL)) ((NULL |$stack|) (PROGN (|bpGeneralErrorHere|) NIL)) ('T (CAR |$stack|))))))) (DEFUN |genDeclaration| (|n| |t|) (PROG (|argTypes| |ISTMP#2| |valType| |ISTMP#1|) (RETURN (COND ((AND (CONSP |t|) (EQ (CAR |t|) '|Mapping|) (PROGN (SETQ |ISTMP#1| (CDR |t|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |valType| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (EQ (CDR |ISTMP#2|) NIL) (PROGN (SETQ |argTypes| (CAR |ISTMP#2|)) 'T)))))) (PROGN (COND ((|bfTupleP| |argTypes|) (SETQ |argTypes| (CDR |argTypes|)))) (COND ((AND (NOT (NULL |argTypes|)) (SYMBOLP |argTypes|)) (SETQ |argTypes| (LIST |argTypes|)))) (LIST 'DECLAIM (LIST 'FTYPE (LIST 'FUNCTION |argTypes| |valType|) |n|)))) ('T (LIST 'DECLAIM (LIST 'TYPE |t| |n|))))))) (DEFUN |translateSignatureDeclaration| (|d|) (PROG (|bfVar#38| |bfVar#37|) (RETURN (PROGN (SETQ |bfVar#37| |d|) (SETQ |bfVar#38| (CDR |bfVar#37|)) (CASE (CAR |bfVar#37|) (|Signature| (LET ((|n| (CAR |bfVar#38|)) (|t| (CADR |bfVar#38|))) (|genDeclaration| |n| |t|))) (T (|coreError| "signature expected"))))))) (DEFUN |translateToplevelExpression| (|expr|) (PROG (|expr'|) (DECLARE (SPECIAL |$InteractiveMode|)) (RETURN (PROGN (SETQ |expr'| (CDR (CDR (|shoeCompTran| (LIST 'LAMBDA (LIST '|x|) |expr|))))) (LET ((|bfVar#39| |expr'|) (|t| NIL)) (LOOP (COND ((OR (ATOM |bfVar#39|) (PROGN (SETQ |t| (CAR |bfVar#39|)) NIL)) (RETURN NIL)) ('T (COND ((AND (CONSP |t|) (EQ (CAR |t|) 'DECLARE)) (IDENTITY (RPLACA |t| 'DECLAIM)))))) (SETQ |bfVar#39| (CDR |bfVar#39|)))) (SETQ |expr'| (COND ((< 1 (LENGTH |expr'|)) (CONS 'PROGN |expr'|)) (#0='T (CAR |expr'|)))) (COND (|$InteractiveMode| |expr'|) (#0# (|shoeEVALANDFILEACTQ| |expr'|))))))) (DEFUN |maybeExportDecl| (|d| |export?|) (COND (|export?| |d|) ('T |d|))) (DEFUN |translateToplevel| (|b| |export?|) (PROG (|lhs| |t| |ISTMP#2| |n| |ISTMP#1| |sig| |bfVar#45| |bfVar#44| |xs|) (DECLARE (SPECIAL |$InteractiveMode| |$foreignsDefsForCLisp| |$currentModuleName|)) (RETURN (COND ((ATOM |b|) (LIST |b|)) ((AND (CONSP |b|) (EQ (CAR |b|) 'TUPLE) (PROGN (SETQ |xs| (CDR |b|)) #0='T)) (LET ((|bfVar#41| NIL) (|bfVar#40| |xs|) (|x| NIL)) (LOOP (COND ((OR (ATOM |bfVar#40|) (PROGN (SETQ |x| (CAR |bfVar#40|)) NIL)) (RETURN (NREVERSE |bfVar#41|))) (#1='T (SETQ |bfVar#41| (CONS (|maybeExportDecl| |x| |export?|) |bfVar#41|)))) (SETQ |bfVar#40| (CDR |bfVar#40|))))) (#2='T (PROGN (SETQ |bfVar#44| |b|) (SETQ |bfVar#45| (CDR |bfVar#44|)) (CASE (CAR |bfVar#44|) (|Signature| (LET ((|op| (CAR |bfVar#45|)) (|t| (CADR |bfVar#45|))) (LIST (|maybeExportDecl| (|genDeclaration| |op| |t|) |export?|)))) (|%Module| (LET ((|m| (CAR |bfVar#45|)) (|ds| (CADR |bfVar#45|))) (PROGN (SETQ |$currentModuleName| |m|) (SETQ |$foreignsDefsForCLisp| NIL) (CONS (LIST 'PROVIDE (STRING |m|)) (LET ((|bfVar#43| NIL) (|bfVar#42| |ds|) (|d| NIL)) (LOOP (COND ((OR (ATOM |bfVar#42|) (PROGN (SETQ |d| (CAR |bfVar#42|)) NIL)) (RETURN (NREVERSE |bfVar#43|))) (#1# (SETQ |bfVar#43| (CONS (CAR (|translateToplevel| |d| T)) |bfVar#43|)))) (SETQ |bfVar#42| (CDR |bfVar#42|)))))))) (|Import| (LET ((|m| (CAR |bfVar#45|))) (LIST (LIST 'IMPORT-MODULE (STRING |m|))))) (|ImportSignature| (LET ((|x| (CAR |bfVar#45|)) (|sig| (CADR |bfVar#45|))) (|genImportDeclaration| |x| |sig|))) (|%TypeAlias| (LET ((|lhs| (CAR |bfVar#45|)) (|rhs| (CADR |bfVar#45|))) (LIST (|maybeExportDecl| (|genTypeAlias| |lhs| |rhs|) |export?|)))) (|ConstantDefinition| (LET ((|lhs| (CAR |bfVar#45|)) (|rhs| (CADR |bfVar#45|))) (PROGN (SETQ |sig| NIL) (COND ((AND (CONSP |lhs|) (EQ (CAR |lhs|) '|%Signature|) (PROGN (SETQ |ISTMP#1| (CDR |lhs|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |n| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (EQ (CDR |ISTMP#2|) NIL) (PROGN (SETQ |t| (CAR |ISTMP#2|)) #0#)))))) (SETQ |sig| (|maybeExportDecl| (|genDeclaration| |n| |t|) |export?|)) (SETQ |lhs| |n|))) (LIST (|maybeExportDecl| (LIST 'DEFCONSTANT |lhs| |rhs|) |export?|))))) (|%Assignment| (LET ((|lhs| (CAR |bfVar#45|)) (|rhs| (CADR |bfVar#45|))) (PROGN (SETQ |sig| NIL) (COND ((AND (CONSP |lhs|) (EQ (CAR |lhs|) '|%Signature|) (PROGN (SETQ |ISTMP#1| (CDR |lhs|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |n| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (EQ (CDR |ISTMP#2|) NIL) (PROGN (SETQ |t| (CAR |ISTMP#2|)) #0#)))))) (SETQ |sig| (|maybeExportDecl| (|genDeclaration| |n| |t|) |export?|)) (SETQ |lhs| |n|))) (COND (|$InteractiveMode| (LIST (LIST 'SETF |lhs| |rhs|))) (#2# (LIST (|maybeExportDecl| (LIST 'DEFPARAMETER |lhs| |rhs|) |export?|))))))) (|namespace| (LET ((|n| (CAR |bfVar#45|))) (LIST (LIST 'IN-PACKAGE (STRING |n|))))) (T (LIST (|translateToplevelExpression| |b|)))))))))) (DEFUN |bpOutItem| () (PROG (|r| |ISTMP#2| |l| |ISTMP#1| |b|) (DECLARE (SPECIAL |$InteractiveMode| |$op|)) (RETURN (PROGN (SETQ |$op| NIL) (OR (|bpComma|) (|bpTrap|)) (SETQ |b| (|bpPop1|)) (|bpPush| (COND ((EQCAR |b| '+LINE) (LIST |b|)) ((AND (CONSP |b|) (EQ (CAR |b|) 'L%T) (PROGN (SETQ |ISTMP#1| (CDR |b|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |l| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (EQ (CDR |ISTMP#2|) NIL) (PROGN (SETQ |r| (CAR |ISTMP#2|)) 'T))))) (IDENTP |l|)) (COND (|$InteractiveMode| (LIST (LIST 'SETQ |l| |r|))) (#0='T (LIST (LIST 'DEFPARAMETER |l| |r|))))) (#0# (|translateToplevel| |b| NIL)))))))) (DEFUN |shoeAddbootIfNec| (|s|) (|shoeAddStringIfNec| ".boot" |s|)) (DEFUN |shoeRemovebootIfNec| (|s|) (|shoeRemoveStringIfNec| ".boot" |s|)) (DEFUN |shoeAddStringIfNec| (|str| |s|) (PROG (|a|) (RETURN (PROGN (SETQ |a| (STRPOS |str| |s| 0 NIL)) (COND ((NULL |a|) (CONCAT |s| |str|)) ('T |s|)))))) (DEFUN |shoeRemoveStringIfNec| (|str| |s|) (PROG (|n|) (RETURN (PROGN (SETQ |n| (SEARCH |str| |s| :FROM-END T)) (COND ((NULL |n|) |s|) ('T (SUBSTRING |s| 0 |n|))))))) (DEFUN DEFUSE (|fn|) (PROG (|infn|) (RETURN (PROGN (SETQ |infn| (CONCAT |fn| ".boot")) (|shoeOpenInputFile| |a| |infn| (|shoeDfu| |a| |fn|)))))) (DEFPARAMETER |$bootDefined| NIL) (DEFPARAMETER |$bootDefinedTwice| NIL) (DEFPARAMETER |$bootUsed| NIL) (DEFPARAMETER |$lispWordTable| NIL) (DEFUN |shoeDfu| (|a| |fn|) (PROG (|out|) (DECLARE (SPECIAL |$bfClamming| |$GenVarCounter| |$bootDefinedTwice| |$bootUsed| |$bootDefined| |$lispWordTable|)) (RETURN (COND ((NULL |a|) (|shoeNotFound| |fn|)) ('T (PROGN (SETQ |$lispWordTable| (MAKE-HASHTABLE 'EQ)) (DO-SYMBOLS (|i| (FIND-PACKAGE 'LISP)) (HPUT |$lispWordTable| |i| T)) (SETQ |$bootDefined| (MAKE-HASHTABLE 'EQ)) (SETQ |$bootUsed| (MAKE-HASHTABLE 'EQ)) (SETQ |$bootDefinedTwice| NIL) (SETQ |$GenVarCounter| 0) (SETQ |$bfClamming| NIL) (|shoeDefUse| (|shoeTransformStream| |a|)) (SETQ |out| (CONCAT |fn| ".defuse")) (|shoeOpenOutputFile| |stream| |out| (|shoeReport| |stream|)) |out|)))))) (DEFUN |shoeReport| (|stream|) (PROG (|b| |a|) (DECLARE (SPECIAL |$bootDefinedTwice| |$bootUsed| |$bootDefined|)) (RETURN (PROGN (|shoeFileLine| "DEFINED and not USED" |stream|) (SETQ |a| (LET ((|bfVar#47| NIL) (|bfVar#46| (HKEYS |$bootDefined|)) (|i| NIL)) (LOOP (COND ((OR (ATOM |bfVar#46|) (PROGN (SETQ |i| (CAR |bfVar#46|)) NIL)) (RETURN (NREVERSE |bfVar#47|))) (#0='T (AND (NOT (GETHASH |i| |$bootUsed|)) (SETQ |bfVar#47| (CONS |i| |bfVar#47|))))) (SETQ |bfVar#46| (CDR |bfVar#46|))))) (|bootOut| (SSORT |a|) |stream|) (|shoeFileLine| " " |stream|) (|shoeFileLine| "DEFINED TWICE" |stream|) (|bootOut| (SSORT |$bootDefinedTwice|) |stream|) (|shoeFileLine| " " |stream|) (|shoeFileLine| "USED and not DEFINED" |stream|) (SETQ |a| (LET ((|bfVar#49| NIL) (|bfVar#48| (HKEYS |$bootUsed|)) (|i| NIL)) (LOOP (COND ((OR (ATOM |bfVar#48|) (PROGN (SETQ |i| (CAR |bfVar#48|)) NIL)) (RETURN (NREVERSE |bfVar#49|))) (#0# (AND (NOT (GETHASH |i| |$bootDefined|)) (SETQ |bfVar#49| (CONS |i| |bfVar#49|))))) (SETQ |bfVar#48| (CDR |bfVar#48|))))) (LET ((|bfVar#50| (SSORT |a|)) (|i| NIL)) (LOOP (COND ((OR (ATOM |bfVar#50|) (PROGN (SETQ |i| (CAR |bfVar#50|)) NIL)) (RETURN NIL)) (#0# (PROGN (SETQ |b| (CONCAT (PNAME |i|) " is used in ")) (|bootOutLines| (SSORT (GETHASH |i| |$bootUsed|)) |stream| |b|)))) (SETQ |bfVar#50| (CDR |bfVar#50|)))))))) (DEFUN |shoeDefUse| (|s|) (LOOP (COND ((|bStreamPackageNull| |s|) (RETURN NIL)) ('T (PROGN (|defuse| NIL (CAR |s|)) (SETQ |s| (CDR |s|))))))) (DEFUN |defuse| (|e| |x|) (PROG (|niens| |nee| |LETTMP#1| |exp| |ISTMP#5| |id| |ISTMP#4| |ISTMP#3| |body| |bv| |ISTMP#2| |name| |ISTMP#1|) (DECLARE (SPECIAL |$bootUsed| |$bootDefinedTwice| |$bootDefined| |$used|)) (RETURN (PROGN (SETQ |x| (|stripm| |x| *PACKAGE* (FIND-PACKAGE "BOOTTRAN"))) (SETQ |$used| NIL) (SETQ |LETTMP#1| (COND ((AND (CONSP |x|) (EQ (CAR |x|) 'DEFUN) (PROGN (SETQ |ISTMP#1| (CDR |x|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |name| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (PROGN (SETQ |bv| (CAR |ISTMP#2|)) (SETQ |body| (CDR |ISTMP#2|)) #0='T)))))) (LIST |name| (CONS 'LAMBDA (CONS |bv| |body|)))) ((AND (CONSP |x|) (EQ (CAR |x|) 'DEFMACRO) (PROGN (SETQ |ISTMP#1| (CDR |x|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |name| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (PROGN (SETQ |bv| (CAR |ISTMP#2|)) (SETQ |body| (CDR |ISTMP#2|)) #0#)))))) (LIST |name| (CONS 'LAMBDA (CONS |bv| |body|)))) ((AND (CONSP |x|) (EQ (CAR |x|) 'EVAL-WHEN) (PROGN (SETQ |ISTMP#1| (CDR |x|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (EQ (CDR |ISTMP#2|) NIL) (PROGN (SETQ |ISTMP#3| (CAR |ISTMP#2|)) (AND (CONSP |ISTMP#3|) (EQ (CAR |ISTMP#3|) 'SETQ) (PROGN (SETQ |ISTMP#4| (CDR |ISTMP#3|)) (AND (CONSP |ISTMP#4|) (PROGN (SETQ |id| (CAR |ISTMP#4|)) (SETQ |ISTMP#5| (CDR |ISTMP#4|)) (AND (CONSP |ISTMP#5|) (EQ (CDR |ISTMP#5|) NIL) (PROGN (SETQ |exp| (CAR |ISTMP#5|)) #0#)))))))))))) (LIST |id| |exp|)) ((AND (CONSP |x|) (EQ (CAR |x|) 'SETQ) (PROGN (SETQ |ISTMP#1| (CDR |x|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |id| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (EQ (CDR |ISTMP#2|) NIL) (PROGN (SETQ |exp| (CAR |ISTMP#2|)) #0#)))))) (LIST |id| |exp|)) (#1='T (LIST 'TOP-LEVEL |x|)))) (SETQ |nee| (CAR |LETTMP#1|)) (SETQ |niens| (CADR |LETTMP#1|)) (COND ((GETHASH |nee| |$bootDefined|) (SETQ |$bootDefinedTwice| (COND ((EQ |nee| 'TOP-LEVEL) |$bootDefinedTwice|) (#1# (CONS |nee| |$bootDefinedTwice|))))) ('T (HPUT |$bootDefined| |nee| T))) (|defuse1| |e| |niens|) (LET ((|bfVar#51| |$used|) (|i| NIL)) (LOOP (COND ((OR (ATOM |bfVar#51|) (PROGN (SETQ |i| (CAR |bfVar#51|)) NIL)) (RETURN NIL)) ('T (HPUT |$bootUsed| |i| (CONS |nee| (GETHASH |i| |$bootUsed|))))) (SETQ |bfVar#51| (CDR |bfVar#51|)))))))) (DEFUN |defuse1| (|e| |y|) (PROG (|ndol| |dol| |LETTMP#1| |b| |a| |ISTMP#1|) (DECLARE (SPECIAL |$bootDefined| |$used|)) (RETURN (COND ((ATOM |y|) (COND ((IDENTP |y|) (SETQ |$used| (COND ((MEMQ |y| |e|) |$used|) ((MEMQ |y| |$used|) |$used|) ((|defusebuiltin| |y|) |$used|) (#0='T (UNION (LIST |y|) |$used|))))) (#0# NIL))) ((AND (CONSP |y|) (EQ (CAR |y|) 'LAMBDA) (PROGN (SETQ |ISTMP#1| (CDR |y|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |a| (CAR |ISTMP#1|)) (SETQ |b| (CDR |ISTMP#1|)) #1='T)))) (|defuse1| (APPEND (|unfluidlist| |a|) |e|) |b|)) ((AND (CONSP |y|) (EQ (CAR |y|) 'PROG) (PROGN (SETQ |ISTMP#1| (CDR |y|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |a| (CAR |ISTMP#1|)) (SETQ |b| (CDR |ISTMP#1|)) #1#)))) (PROGN (SETQ |LETTMP#1| (|defSeparate| |a|)) (SETQ |dol| (CAR |LETTMP#1|)) (SETQ |ndol| (CADR |LETTMP#1|)) (LET ((|bfVar#52| |dol|) (|i| NIL)) (LOOP (COND ((OR (ATOM |bfVar#52|) (PROGN (SETQ |i| (CAR |bfVar#52|)) NIL)) (RETURN NIL)) (#2='T (HPUT |$bootDefined| |i| T))) (SETQ |bfVar#52| (CDR |bfVar#52|)))) (|defuse1| (APPEND |ndol| |e|) |b|))) ((AND (CONSP |y|) (EQ (CAR |y|) 'QUOTE) (PROGN (SETQ |a| (CDR |y|)) #1#)) NIL) ((AND (CONSP |y|) (EQ (CAR |y|) '+LINE) (PROGN (SETQ |a| (CDR |y|)) #1#)) NIL) (#0# (LET ((|bfVar#53| |y|) (|i| NIL)) (LOOP (COND ((OR (ATOM |bfVar#53|) (PROGN (SETQ |i| (CAR |bfVar#53|)) NIL)) (RETURN NIL)) (#2# (|defuse1| |e| |i|))) (SETQ |bfVar#53| (CDR |bfVar#53|))))))))) (DEFUN |defSeparate| (|x|) (PROG (|x2| |x1| |LETTMP#1| |f|) (RETURN (COND ((NULL |x|) (LIST NIL NIL)) (#0='T (PROGN (SETQ |f| (CAR |x|)) (SETQ |LETTMP#1| (|defSeparate| (CDR |x|))) (SETQ |x1| (CAR |LETTMP#1|)) (SETQ |x2| (CADR |LETTMP#1|)) (COND ((|bfBeginsDollar| |f|) (LIST (CONS |f| |x1|) |x2|)) (#0# (LIST |x1| (CONS |f| |x2|)))))))))) (DEFUN |unfluidlist| (|x|) (PROG (|y| |ISTMP#1|) (RETURN (COND ((NULL |x|) NIL) ((ATOM |x|) (LIST |x|)) ((AND (CONSP |x|) (EQ (CAR |x|) '&REST) (PROGN (SETQ |ISTMP#1| (CDR |x|)) (AND (CONSP |ISTMP#1|) (EQ (CDR |ISTMP#1|) NIL) (PROGN (SETQ |y| (CAR |ISTMP#1|)) 'T)))) (LIST |y|)) ('T (CONS (CAR |x|) (|unfluidlist| (CDR |x|)))))))) (DEFUN |defusebuiltin| (|x|) (DECLARE (SPECIAL |$lispWordTable|)) (GETHASH |x| |$lispWordTable|)) (DEFUN |bootOut| (|l| |outfn|) (LET ((|bfVar#54| |l|) (|i| NIL)) (LOOP (COND ((OR (ATOM |bfVar#54|) (PROGN (SETQ |i| (CAR |bfVar#54|)) NIL)) (RETURN NIL)) ('T (|shoeFileLine| (CONCAT " " (PNAME |i|)) |outfn|))) (SETQ |bfVar#54| (CDR |bfVar#54|))))) (DEFUN CLESSP (|s1| |s2|) (NOT (SHOEGREATERP |s1| |s2|))) (DEFUN SSORT (|l|) (SORT |l| #'CLESSP)) (DEFUN |bootOutLines| (|l| |outfn| |s|) (PROG (|a|) (RETURN (COND ((NULL |l|) (|shoeFileLine| |s| |outfn|)) (#0='T (SETQ |a| (PNAME (CAR |l|))) (COND ((< 70 (+ (LENGTH |s|) (LENGTH |a|))) (|shoeFileLine| |s| |outfn|) (|bootOutLines| |l| |outfn| " ")) (#0# (|bootOutLines| (CDR |l|) |outfn| (CONCAT |s| " " |a|))))))))) (DEFUN XREF (|fn|) (PROG (|infn|) (RETURN (PROGN (SETQ |infn| (CONCAT |fn| ".boot")) (|shoeOpenInputFile| |a| |infn| (|shoeXref| |a| |fn|)))))) (DEFUN |shoeXref| (|a| |fn|) (PROG (|out|) (DECLARE (SPECIAL |$bfClamming| |$GenVarCounter| |$bootUsed| |$bootDefined| |$lispWordTable|)) (RETURN (COND ((NULL |a|) (|shoeNotFound| |fn|)) ('T (SETQ |$lispWordTable| (MAKE-HASHTABLE 'EQ)) (DO-SYMBOLS (|i| (FIND-PACKAGE 'LISP)) (HPUT |$lispWordTable| |i| T)) (SETQ |$bootDefined| (MAKE-HASHTABLE 'EQ)) (SETQ |$bootUsed| (MAKE-HASHTABLE 'EQ)) (SETQ |$GenVarCounter| 0) (SETQ |$bfClamming| NIL) (|shoeDefUse| (|shoeTransformStream| |a|)) (SETQ |out| (CONCAT |fn| ".xref")) (|shoeOpenOutputFile| |stream| |out| (|shoeXReport| |stream|)) |out|))))) (DEFUN |shoeXReport| (|stream|) (PROG (|a| |c|) (DECLARE (SPECIAL |$bootUsed|)) (RETURN (PROGN (|shoeFileLine| "USED and where DEFINED" |stream|) (SETQ |c| (SSORT (HKEYS |$bootUsed|))) (LET ((|bfVar#55| |c|) (|i| NIL)) (LOOP (COND ((OR (ATOM |bfVar#55|) (PROGN (SETQ |i| (CAR |bfVar#55|)) NIL)) (RETURN NIL)) ('T (PROGN (SETQ |a| (CONCAT (PNAME |i|) " is used in ")) (|bootOutLines| (SSORT (GETHASH |i| |$bootUsed|)) |stream| |a|)))) (SETQ |bfVar#55| (CDR |bfVar#55|)))))))) (DEFUN FBO (|name| |fn|) (|shoeGeneralFC| #'BO |name| |fn|)) (DEFUN FEV (|name| |fn|) (|shoeGeneralFC| #'EVAL-BOOT-FILE |name| |fn|)) (DEFUN |shoeGeneralFC| (|f| |name| |fn|) (PROG (|filename| |a| |infn|) (DECLARE (SPECIAL |$GenVarCounter| |$bfClamming|)) (RETURN (PROGN (SETQ |$bfClamming| NIL) (SETQ |$GenVarCounter| 0) (SETQ |infn| (|shoeAddbootIfNec| |fn|)) (SETQ |a| (|shoeOpenInputFile| |a| |infn| (|shoeFindName2| |fn| |name| |a|))) (SETQ |filename| (COND ((< 8 (LENGTH |name|)) (SUBSTRING |name| 0 8)) ('T |name|))) (COND (|a| (FUNCALL |f| (CONCAT "/tmp/" |filename|))) ('T NIL)))))) (DEFUN |shoeFindName2| (|fn| |name| |a|) (PROG (|filename| |lines|) (RETURN (PROGN (SETQ |lines| (|shoeFindLines| |fn| |name| |a|)) (COND (|lines| (PROGN (SETQ |filename| (COND ((< 8 (LENGTH |name|)) (SUBSTRING |name| 0 8)) ('T |name|))) (SETQ |filename| (CONCAT "/tmp/" |filename| ".boot")) (|shoeOpenOutputFile| |stream| |filename| (LET ((|bfVar#56| |lines|) (|line| NIL)) (LOOP (COND ((OR (ATOM |bfVar#56|) (PROGN (SETQ |line| (CAR |bfVar#56|)) NIL)) (RETURN NIL)) ('T (|shoeFileLine| |line| |stream|))) (SETQ |bfVar#56| (CDR |bfVar#56|))))) T)) ('T NIL)))))) (DEFUN |shoeTransform2| (|str|) (|bNext| #'|shoeItem| (|streamTake| 1 (|bNext| #'|shoePileInsert| (|bNext| #'|shoeLineToks| |str|))))) (DEFUN |shoeItem| (|str|) (PROG (|dq|) (RETURN (PROGN (SETQ |dq| (CAR |str|)) (CONS (LIST (LET ((|bfVar#58| NIL) (|bfVar#57| (|shoeDQlines| |dq|)) (|line| NIL)) (LOOP (COND ((OR (ATOM |bfVar#57|) (PROGN (SETQ |line| (CAR |bfVar#57|)) NIL)) (RETURN (NREVERSE |bfVar#58|))) ('T (SETQ |bfVar#58| (CONS (CAR |line|) |bfVar#58|)))) (SETQ |bfVar#57| (CDR |bfVar#57|))))) (CDR |str|)))))) (DEFUN |stripm| (|x| |pk| |bt|) (COND ((ATOM |x|) (COND ((IDENTP |x|) (COND ((EQUAL (SYMBOL-PACKAGE |x|) |bt|) (INTERN (PNAME |x|) |pk|)) (#0='T |x|))) (#0# |x|))) (#0# (CONS (|stripm| (CAR |x|) |pk| |bt|) (|stripm| (CDR |x|) |pk| |bt|))))) (DEFUN |shoePCompile| (|fn|) (PROG (|body| |bv| |ISTMP#2| |name| |ISTMP#1|) (RETURN (PROGN (SETQ |fn| (|stripm| |fn| *PACKAGE* (FIND-PACKAGE "BOOTTRAN"))) (COND ((AND (CONSP |fn|) (EQ (CAR |fn|) 'DEFUN) (PROGN (SETQ |ISTMP#1| (CDR |fn|)) (AND (CONSP |ISTMP#1|) (PROGN (SETQ |name| (CAR |ISTMP#1|)) (SETQ |ISTMP#2| (CDR |ISTMP#1|)) (AND (CONSP |ISTMP#2|) (PROGN (SETQ |bv| (CAR |ISTMP#2|)) (SETQ |body| (CDR |ISTMP#2|)) 'T)))))) (COMPILE |name| (CONS 'LAMBDA (CONS |bv| |body|)))) ('T (EVAL |fn|))))))) (DEFUN FC (|name| |fn|) (PROG (|infn|) (DECLARE (SPECIAL |$GenVarCounter|)) (RETURN (PROGN (SETQ |$GenVarCounter| 0) (SETQ |infn| (|shoeAddbootIfNec| |fn|)) (|shoeOpenInputFile| |a| |infn| (|shoeFindName| |fn| |name| |a|)))))) (DEFUN |shoeFindName| (|fn| |name| |a|) (PROG (|lines|) (RETURN (PROGN (SETQ |lines| (|shoeFindLines| |fn| |name| |a|)) (|shoePCompileTrees| (|shoeTransformString| |lines|)))))) (DEFUN |shoePCompileTrees| (|s|) (LOOP (COND ((|bStreamNull| |s|) (RETURN NIL)) ('T (PROGN (REALLYPRETTYPRINT (|shoePCompile| (CAR |s|))) (SETQ |s| (CDR |s|))))))) (DEFUN |bStreamPackageNull| (|s|) (PROG (|b| |a|) (RETURN (PROGN (SETQ |a| *PACKAGE*) (IN-PACKAGE "BOOTTRAN") (SETQ |b| (|bStreamNull| |s|)) (|setCurrentPackage| |a|) |b|)))) (DEFUN PSTTOMC (|string|) (DECLARE (SPECIAL |$GenVarCounter|)) (PROGN (SETQ |$GenVarCounter| 0) (|shoePCompileTrees| (|shoeTransformString| |string|)))) (DEFUN BOOTLOOP () (PROG (|stream| |b| |a|) (RETURN (PROGN (SETQ |a| (READ-LINE)) (COND ((EQL (LENGTH |a|) 0) (PROGN (WRITE-LINE "Boot Loop; to exit type ] ") (BOOTLOOP))) (#0='T (PROGN (SETQ |b| (|shoePrefix?| ")console" |a|)) (COND (|b| (PROGN (SETQ |stream| *TERMINAL-IO*) (PSTTOMC (|bRgen| |stream|)) (BOOTLOOP))) ((EQUAL (ELT |a| 0) (ELT "]" 0)) NIL) (#0# (PROGN (PSTTOMC (LIST |a|)) (BOOTLOOP))))))))))) (DEFUN BOOTPO () (PROG (|stream| |b| |a|) (RETURN (PROGN (SETQ |a| (READ-LINE)) (COND ((EQL (LENGTH |a|) 0) (PROGN (WRITE-LINE "Boot Loop; to exit type ] ") (BOOTPO))) (#0='T (PROGN (SETQ |b| (|shoePrefix?| ")console" |a|)) (COND (|b| (PROGN (SETQ |stream| *TERMINAL-IO*) (PSTOUT (|bRgen| |stream|)) (BOOTPO))) ((EQUAL (ELT |a| 0) (ELT "]" 0)) NIL) (#0# (PROGN (PSTOUT (LIST |a|)) (BOOTPO))))))))))) (DEFUN PSTOUT (|string|) (PROG (|result| |callingPackage|) (DECLARE (SPECIAL |$GenVarCounter|)) (RETURN (PROGN (SETQ |callingPackage| *PACKAGE*) (IN-PACKAGE "BOOTTRAN") (SETQ |$GenVarCounter| 0) (SETQ |result| (|shoeConsoleTrees| (|shoeTransformString| |string|))) (|setCurrentPackage| |callingPackage|) |result|)))) (DEFUN |defaultBootToLispFile| (|file|) (CONCAT (|pathBasename| |file|) ".clisp")) (DEFUN |getIntermediateLispFile| (|file| |options|) (PROG (|out|) (DECLARE (SPECIAL |$effectiveFaslType|)) (RETURN (PROGN (SETQ |out| (NAMESTRING (|getOutputPathname| |options|))) (COND (|out| (CONCAT (|shoeRemoveStringIfNec| (CONCAT "." |$effectiveFaslType|) |out|) ".clisp")) ('T (|defaultBootToLispFile| |file|))))))) (DEFUN |translateBootFile| (|progname| |options| |file|) (PROG (|outFile|) (RETURN (PROGN (SETQ |outFile| (OR (|getOutputPathname| |options|) (|defaultBootToLispFile| |file|))) (BOOTTOCL |file| (ENOUGH-NAMESTRING |outFile|)))))) (DEFUN |compileBootHandler| (|progname| |options| |file|) (PROG (|objFile| |intFile|) (RETURN (PROGN (SETQ |intFile| (BOOTTOCL |file| (|getIntermediateLispFile| |file| |options|))) (COND ((NOT (EQL (|errorCount|) 0)) NIL) (|intFile| (PROGN (SETQ |objFile| (|compileLispHandler| |progname| |options| |intFile|)) (DELETE-FILE |intFile|) |objFile|)) ('T NIL)))))) (EVAL-WHEN (:EXECUTE :LOAD-TOPLEVEL) (|associateRequestWithFileType| (|Option| "translate") "boot" #'|translateBootFile|)) (EVAL-WHEN (:EXECUTE :LOAD-TOPLEVEL) (|associateRequestWithFileType| (|Option| "compile") "boot" #'|compileBootHandler|)) (DEFUN |loadNativeModule| (|m|) (COND ((|%hasFeature| :SBCL) (FUNCALL (|bfColonColon| 'SB-ALIEN 'LOAD-SHARED-OBJECT) |m|)) ((|%hasFeature| :CLISP) (EVAL (LIST (|bfColonColon| 'FFI 'DEFAULT-FOREIGN-LIBRARY) |m|))) ((|%hasFeature| :ECL) (EVAL (LIST (|bfColonColon| 'FFI 'LOAD-FOREIGN-LIBRARY) |m|))) ('T (|coreError| "don't know how to load a dynamically linked module")))) (DEFUN |loadSystemRuntimeCore| () (DECLARE (SPECIAL |$NativeModuleExt|)) (COND ((OR (|%hasFeature| :ECL) (|%hasFeature| :GCL)) NIL) ('T (|loadNativeModule| (CONCAT (|systemLibraryDirectory|) "libopen-axiom-core" |$NativeModuleExt|)))))