aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@axiomatics.org>2016-02-01 01:55:33 -0800
committerGabriel Dos Reis <gdr@axiomatics.org>2016-02-01 01:55:33 -0800
commit04be6d65c9bae10780f463c23a14922249c187de (patch)
treefaf083f47c06759bf0cec6d6cced146ae435fd24 /src
parenta41b74b5a5981d91c4e196cbcb5daa96e4123d36 (diff)
downloadopen-axiom-04be6d65c9bae10780f463c23a14922249c187de.tar.gz
Support ')read' of Boot file
Allow the system command to ')read' a Boot source file: the involves (1) compiling Boot to machine code (2) loading the resulting FASL in the current system Note that if the boot file has any dependency in terms of 'import', one needs to set up the $LoadDirectories appropriately, or else the system will crash. In particular, if you're modifying OpenAxiom source files you need to include the appropriate directories containing OpenAxiom fasl files.
Diffstat (limited to 'src')
-rw-r--r--src/boot/translator.boot11
-rw-r--r--src/interp/cparse.boot12
2 files changed, 13 insertions, 10 deletions
diff --git a/src/boot/translator.boot b/src/boot/translator.boot
index b98f3b30..f44fee4c 100644
--- a/src/boot/translator.boot
+++ b/src/boot/translator.boot
@@ -1,6 +1,6 @@
-- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd.
-- All rights reserved.
--- Copyright (C) 2007-2015, Gabriel Dos Reis.
+-- Copyright (C) 2007-2016, Gabriel Dos Reis.
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ import parser
import ast
namespace BOOTTRAN
module translator (evalBootFile, loadNativeModule, loadSystemRuntimeCore,
- string2BootTree, genImportDeclaration, retainFile?)
+ compileBootHandler, string2BootTree, genImportDeclaration, retainFile?)
++ If non nil, holds the name of the current module being translated.
$currentModuleName := nil
@@ -569,10 +569,9 @@ defaultBootToLispFile file ==
strconc(pathBasename file, '".clisp")
getIntermediateLispFile(file,options) ==
- out := NAMESTRING getOutputPathname(options)
- out ~= nil =>
- strconc(shoeRemoveStringIfNec(strconc('".",$faslType),out),'".clisp")
- defaultBootToLispFile file
+ out := getOutputPathname options or return defaultBootToLispFile file
+ strconc(shoeRemoveStringIfNec(strconc('".",$faslType),filePathString out),'".clisp")
+
translateBootFile(progname, options, file) ==
outFile := getOutputPathname options or defaultBootToLispFile file
diff --git a/src/interp/cparse.boot b/src/interp/cparse.boot
index 9e28504d..a98b2ea1 100644
--- a/src/interp/cparse.boot
+++ b/src/interp/cparse.boot
@@ -1102,15 +1102,19 @@ _/RQ_,LIB(:x) ==
$Echo: local := false
_/RF_-1 nil
+readBootFile file ==
+ try
+ fasl := compileBootHandler(nil,nil,file) or return nil
+ LOAD fasl
+ finally
+ fasl = nil => nil
+ removeFile filePathString fasl
_/RF_-1 x ==
ifile := makeInputFilename $editFile
lfile := nil
type := filePathType ifile
- type = '"boot" =>
- lfile := makeFilePath(type <- '"lisp",defaults <- ifile)
- BOOT(ifile,lfile)
- LOAD lfile
+ type = '"boot" => readBootFile ifile
type = '"lisp" => LOAD ifile
type = '"input" => ncINTERPFILE(ifile,$Echo)
SPAD ifile