aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-01-08 14:23:30 +0000
committerdos-reis <gdr@axiomatics.org>2008-01-08 14:23:30 +0000
commita90e0b91cdd543cc28abf425355c801279482ad6 (patch)
tree3f322cc2a533a443fe31463392dd0ff2ba10b0cb /src
parent8d42d860e9f2fa6b71cfc1840134ad3b2a0a5dc9 (diff)
downloadopen-axiom-a90e0b91cdd543cc28abf425355c801279482ad6.tar.gz
* boot/Makefile.pamphlet (AXIOM_LOCAL_LISP): Use Lisp image with C
bindings. * interp/msgdb.boot (brightPrint0): Don't highlight if the standard output is not attached to a terminal. * interp/sys-driver.boot (stdStreamIsTerminal): New. * lib/cfuns-c.c (std_stream_is_terminal): New.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/boot/Makefile.in2
-rw-r--r--src/boot/Makefile.pamphlet10
-rw-r--r--src/interp/msgdb.boot6
-rw-r--r--src/interp/sys-driver.boot9
-rw-r--r--src/lib/cfuns-c.c36
6 files changed, 60 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5de92eec..f1f66376 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
+2008-01-08 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ * boot/Makefile.pamphlet (AXIOM_LOCAL_LISP): Use Lisp image with C
+ bindings.
+ * interp/msgdb.boot (brightPrint0): Don't highlight if the
+ standard output is not attached to a terminal.
+ * interp/sys-driver.boot (stdStreamIsTerminal): New.
+ * lib/cfuns-c.c (std_stream_is_terminal): New.
+
2008-01-07 Gabriel Dos Reis <gdr@cs.tamu.edu>
* boot/ast.boot.pamphlet (Ast): Add ImportSignature, Signature,
diff --git a/src/boot/Makefile.in b/src/boot/Makefile.in
index 013cf2bf..94d98c33 100644
--- a/src/boot/Makefile.in
+++ b/src/boot/Makefile.in
@@ -1,5 +1,5 @@
AXIOM_LOCAL_LISP_sources = initial-env.lisp
-AXIOM_LOCAL_LISP = ../lisp/base-lisp$(EXEEXT)
+AXIOM_LOCAL_LISP = ../lisp/lisp$(EXEEXT)
PROCLAIMS=(load "$(srcdir)/boot-proclaims.lisp")
boot_objects = initial-env.$(FASLEXT) $(boot_sources:.boot=.$(FASLEXT))
diff --git a/src/boot/Makefile.pamphlet b/src/boot/Makefile.pamphlet
index c29602f8..6ce07945 100644
--- a/src/boot/Makefile.pamphlet
+++ b/src/boot/Makefile.pamphlet
@@ -1128,14 +1128,12 @@ workspace (\verb$|shoeOpenInputFile| |shoeOpenOutputFile| memq$).
We will use create and use several lisp images during the build
process. We name them here for convenience.
-\paragraph{[[AXIOM_LOCAL_LISP]].} First we create a Lisp image
-that contains at least three macros for translating
-Boot source files. We do this by loading \File{initial-env.lisp}
-in [[AXIOM_LISP]], and saving the resulting image. That image is then
-used to build the bootstrapping Boot translator.
+\paragraph{[[AXIOM_LOCAL_LISP]].} We start with a Lisp image
+created in a previous build step (src/lisp). That image is used
+to build Boot translator executable through the entire bootstrap process.
<<environment>>=
AXIOM_LOCAL_LISP_sources = initial-env.lisp
-AXIOM_LOCAL_LISP = ../lisp/base-lisp$(EXEEXT)
+AXIOM_LOCAL_LISP = ../lisp/lisp$(EXEEXT)
@
diff --git a/src/interp/msgdb.boot b/src/interp/msgdb.boot
index 3b72b074..bfd8e1ff 100644
--- a/src/interp/msgdb.boot
+++ b/src/interp/msgdb.boot
@@ -654,12 +654,14 @@ brightPrint0 x ==
x = '"%%" =>
sayString '"%"
x = '"%b" =>
- NULL IS_-CONSOLE CUROUTSTREAM => sayString '" "
+ NULL IS_-CONSOLE CUROUTSTREAM
+ or stdStreamIsTerminal(1) = 0 => sayString '" "
NULL $highlightAllowed => sayString '" "
sayString $highlightFontOn
k := blankIndicator x => BLANKS k
x = '"%d" =>
- NULL IS_-CONSOLE CUROUTSTREAM => sayString '" "
+ NULL IS_-CONSOLE CUROUTSTREAM
+ or stdStreamIsTerminal(1) = 0 => sayString '" "
NULL $highlightAllowed => sayString '" "
sayString $highlightFontOff
STRINGP x => sayString x
diff --git a/src/interp/sys-driver.boot b/src/interp/sys-driver.boot
index 2bd991fa..8cc54fad 100644
--- a/src/interp/sys-driver.boot
+++ b/src/interp/sys-driver.boot
@@ -64,4 +64,13 @@ systemAlgebraDirectory() ==
ensureTrailingSlash cdr dir
nil
+++ stdStreamIsTerminal:
+++ returns 1 if the standard stream is attached to a terminal;
+++ otherwise 0.
+)if %hasFeature KEYWORD::GCL
+import stdStreamIsTerminal for std__stream__is__terminal: INT -> INT
+)else
+stdStreamIsTerminal fd ==
+ 0
+)endif
diff --git a/src/lib/cfuns-c.c b/src/lib/cfuns-c.c
index de00deee..f588beab 100644
--- a/src/lib/cfuns-c.c
+++ b/src/lib/cfuns-c.c
@@ -2,6 +2,9 @@
Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
All rights reserved.
+ Copyright (C) 2007, 2008, Gabriel Dos Reis
+ All rights reserved.
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
@@ -29,17 +32,21 @@
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Copyright (C) 2007, Gabriel Dos Reis
*/
+#include "axiom-c-macros.h"
+
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include "axiom-c-macros.h"
+#include <assert.h>
+
+#ifdef __WIN32__
+# include <windows.h>
+#endif
#include "cfuns-c.H1"
@@ -263,3 +270,26 @@ copyEnvValue(char *varName, char *buffer)
return strlen(s);
}
+/* Return 1 if the file descriptor FD, as viewed by the Core Executable,
+ is attached to a terminal. */
+int
+std_stream_is_terminal(int fd)
+{
+ assert(fd > -1 && fd < 3);
+#ifdef __WIN32__
+ HANDLE handle;
+ switch (fd) {
+ case 0: handle = STD_INPUT_HANDLE; break;
+ case 1: handle = STD_OUTPUT_HANDLE; break;
+ case 2: handle = STD_ERROR_HANDLE; break;
+
+ }
+ /* VerifyConsoleIoHandle appears to be an undocumented function.
+ MS documentation suggests `GetFileType', but then the return
+ value is still insufficient for determining whether the
+ output stream is attached to a terminal or not. */
+ return VerifyConsoleIoHandle(GetStdHandle(handle));
+#else
+ return isatty(fd);
+#endif
+}