From a90e0b91cdd543cc28abf425355c801279482ad6 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Tue, 8 Jan 2008 14:23:30 +0000 Subject: * 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. --- configure | 18 +++++++++--------- configure.ac | 2 +- configure.ac.pamphlet | 2 +- src/ChangeLog | 9 +++++++++ src/boot/Makefile.in | 2 +- src/boot/Makefile.pamphlet | 10 ++++------ src/interp/msgdb.boot | 6 ++++-- src/interp/sys-driver.boot | 9 +++++++++ src/lib/cfuns-c.c | 36 +++++++++++++++++++++++++++++++++--- 9 files changed, 71 insertions(+), 23 deletions(-) diff --git a/configure b/configure index 0c4ca8f8..a6a195c5 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for OpenAxiom 1.1.0-2008-01-06. +# Generated by GNU Autoconf 2.60 for OpenAxiom 1.1.0-2008-01-08. # # Report bugs to . # @@ -713,8 +713,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='OpenAxiom' PACKAGE_TARNAME='openaxiom' -PACKAGE_VERSION='1.1.0-2008-01-06' -PACKAGE_STRING='OpenAxiom 1.1.0-2008-01-06' +PACKAGE_VERSION='1.1.0-2008-01-08' +PACKAGE_STRING='OpenAxiom 1.1.0-2008-01-08' PACKAGE_BUGREPORT='open-axiom-bugs@lists.sf.net' ac_unique_file="src/Makefile.pamphlet" @@ -1387,7 +1387,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures OpenAxiom 1.1.0-2008-01-06 to adapt to many kinds of systems. +\`configure' configures OpenAxiom 1.1.0-2008-01-08 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1457,7 +1457,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of OpenAxiom 1.1.0-2008-01-06:";; + short | recursive ) echo "Configuration of OpenAxiom 1.1.0-2008-01-08:";; esac cat <<\_ACEOF @@ -1561,7 +1561,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -OpenAxiom configure 1.1.0-2008-01-06 +OpenAxiom configure 1.1.0-2008-01-08 generated by GNU Autoconf 2.60 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1575,7 +1575,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by OpenAxiom $as_me 1.1.0-2008-01-06, which was +It was created by OpenAxiom $as_me 1.1.0-2008-01-08, which was generated by GNU Autoconf 2.60. Invocation command line was $ $0 $@ @@ -25225,7 +25225,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by OpenAxiom $as_me 1.1.0-2008-01-06, which was +This file was extended by OpenAxiom $as_me 1.1.0-2008-01-08, which was generated by GNU Autoconf 2.60. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -25274,7 +25274,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -OpenAxiom config.status 1.1.0-2008-01-06 +OpenAxiom config.status 1.1.0-2008-01-08 configured by $0, generated by GNU Autoconf 2.60, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 67b05dff..bbf0814e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ sinclude(config/open-axiom.m4) sinclude(config/aclocal.m4) -AC_INIT([OpenAxiom], [1.1.0-2008-01-06], +AC_INIT([OpenAxiom], [1.1.0-2008-01-08], [open-axiom-bugs@lists.sf.net]) AC_CONFIG_AUX_DIR(config) diff --git a/configure.ac.pamphlet b/configure.ac.pamphlet index 486b3eed..af508ad3 100644 --- a/configure.ac.pamphlet +++ b/configure.ac.pamphlet @@ -1019,7 +1019,7 @@ information: <>= sinclude(config/open-axiom.m4) sinclude(config/aclocal.m4) -AC_INIT([OpenAxiom], [1.1.0-2008-01-06], +AC_INIT([OpenAxiom], [1.1.0-2008-01-08], [open-axiom-bugs@lists.sf.net]) @ 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 + + * 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 * 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. <>= 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 #include #include #include #include #include -#include "axiom-c-macros.h" +#include + +#ifdef __WIN32__ +# include +#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 +} -- cgit v1.2.3