From: Matt Birkholz Date: Wed, 29 May 2013 22:50:34 +0000 (-0700) Subject: Add configure option `--without-termcap'. X-Git-Tag: release-9.2.0~178 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=b39a01fbef8e57250372cfeda96ca04f0b7f51d1;p=mit-scheme.git Add configure option `--without-termcap'. Punt the termcap primitives (all of microcode/tterm.c!) if configured --with-termpcap=no. The console port ops like clear and x-size were already equipped with useful(?) defaults. In fact Edwin (on X11) still works! --- diff --git a/src/microcode/configure.ac b/src/microcode/configure.ac index 86d2f632c..5a0d65ab2 100644 --- a/src/microcode/configure.ac +++ b/src/microcode/configure.ac @@ -164,11 +164,6 @@ AC_ARG_WITH([termcap], AS_HELP_STRING([--with-termcap], [Use a termcap library if available [[yes]]])) : ${with_termcap='yes'} -if test "x${with_termcap}" = xno; then - dnl On Unix (in uxtty.c) primitives like tty-command-clear require - dnl some kind of termcap. A build without-termcap is not possible. - AC_MSG_ERROR([--without-termcap is not supported on Unix systems]) -fi dnl For reasons I don't understand, it is necessary to use dnl quadigraphs here instead of [[ ... ]]. @@ -561,11 +556,10 @@ dnl database, we can emulate `tparam' -- either in terms of `tparm' or dnl by pretending we know the format -- without bringing in the local dnl termcap reimplementation. -dnl Go for whatever header files we can. -AC_CHECK_HEADERS([ncurses.h curses.h term.h termcap.h]) - if test "x${with_termcap}" = xyes; then + AC_DEFINE([USE_TERMCAP], [1], [Define if termcap should be used.]) + AC_CHECK_HEADERS([ncurses.h curses.h term.h termcap.h]) AC_CHECK_LIB([ncurses], [tgetent], [have_ncurses=yes]) AC_CHECK_LIB([ncurses], [tparm], [have_ncurses_tparm=yes]) AC_CHECK_LIB([ncurses], [tparam], [have_ncurses_tparam=yes]) @@ -596,6 +590,8 @@ if test "x${with_termcap}" = xyes; then elif test "x${with_termcap}" != xno; then + AC_DEFINE([USE_TERMCAP], [1], [Define if termcap should be used.]) + AC_CHECK_HEADERS([ncurses.h curses.h term.h termcap.h]) lib=${with_termcap} AC_CHECK_LIB([${lib}], [tgetent], [eval have_${lib}=yes]) AC_CHECK_LIB([${lib}], [tparm], [eval have_${lib}_tparm=yes]) @@ -610,9 +606,11 @@ fi case "${with_termcap}" in yes) AC_MSG_WARN([No termcap library found; will emulate it]) - OPTIONAL_BASES="${OPTIONAL_BASES} termcap tparam" + OPTIONAL_BASES="${OPTIONAL_BASES} termcap tparam tterm" + ;; +no) + AC_MSG_NOTICE([Termcap disabled.]) ;; -no) ;; *) LIBS="-l${with_termcap} ${LIBS}" eval have_tparam=\$have_${with_termcap}_tparam @@ -620,10 +618,10 @@ no) ;; eval have_tparm=\$have_${with_termcap}_tparm if test "x${have_tparm}" = xyes; then AC_MSG_WARN([No tparam found; will emulate it from terminfo tparm]) - OPTIONAL_BASES="${OPTIONAL_BASES} terminfo" + OPTIONAL_BASES="${OPTIONAL_BASES} terminfo tterm" else AC_MSG_WARN([No tparam found; will emulate it]) - OPTIONAL_BASES="${OPTIONAL_BASES} tparam" + OPTIONAL_BASES="${OPTIONAL_BASES} tparam tterm" fi fi ;; diff --git a/src/microcode/makegen/files-core.scm b/src/microcode/makegen/files-core.scm index c8bd36d12..e9f3a58c2 100644 --- a/src/microcode/makegen/files-core.scm +++ b/src/microcode/makegen/files-core.scm @@ -76,7 +76,6 @@ USA. "sysprim" "term" "transact" -"tterm" "utabmd" "utils" "vector" diff --git a/src/microcode/makegen/files-optional.scm b/src/microcode/makegen/files-optional.scm index 0f16baff9..76e73e132 100644 --- a/src/microcode/makegen/files-optional.scm +++ b/src/microcode/makegen/files-optional.scm @@ -38,6 +38,7 @@ USA. "pruxffi" "prx11" "svm1-interp" +"tterm" "termcap" "terminfo" "tparam" diff --git a/src/microcode/tterm.c b/src/microcode/tterm.c index c9d969c96..e6527faff 100644 --- a/src/microcode/tterm.c +++ b/src/microcode/tterm.c @@ -102,15 +102,23 @@ DEFINE_PRIMITIVE ("TERMCAP-GET-NUMBER", Prim_termcap_get_number, 1, 1, 0) { PRIMITIVE_HEADER (1); { +#ifdef USE_TERMCAP int result = (tgetnum (STRING_ARG (1))); PRIMITIVE_RETURN ((result < 0) ? SHARP_F : (long_to_integer (result))); +#else + PRIMITIVE_RETURN (SHARP_F); +#endif } } DEFINE_PRIMITIVE ("TERMCAP-GET-FLAG", Prim_termcap_get_flag, 1, 1, 0) { PRIMITIVE_HEADER (1); +#ifdef USE_TERMCAP PRIMITIVE_RETURN (BOOLEAN_TO_OBJECT ((tgetflag (STRING_ARG (1))) != 0)); +#else + PRIMITIVE_RETURN (SHARP_F); +#endif } DEFINE_PRIMITIVE ("TERMCAP-GET-STRING", Prim_termcap_get_string, 1, 1, 0) diff --git a/src/microcode/uxtty.c b/src/microcode/uxtty.c index 0bc9e5022..90a088d1d 100644 --- a/src/microcode/uxtty.c +++ b/src/microcode/uxtty.c @@ -33,10 +33,12 @@ USA. #include "uxterm.h" extern Tchannel OS_open_fd (int fd); +#ifdef USE_TERMCAP extern int tgetent (void *, const char *); extern int tgetnum (const char *); extern const char * tgetstr (const char *, char **); extern void tputs (const char *, int, void (*) (char)); +#endif /* Standard Input and Output */ @@ -112,6 +114,7 @@ OS_tty_command_clear (void) #endif /* not TIOCGWINSZ */ #endif /* TIOCGSIZE */ +#ifdef USE_TERMCAP static char tputs_output [TERMCAP_BUFFER_SIZE]; static char * tputs_output_scan; @@ -142,6 +145,7 @@ UX_synchronize_tty_size_with_termcap (void) tty_x_size = (tgetnum ("co")); tty_y_size = (tgetnum ("li")); } +#endif /* USE_TERMCAP */ static void UX_synchronize_tty_size (void) @@ -183,8 +187,10 @@ UX_synchronize_tty_size (void) } } +#ifdef USE_TERMCAP if ((tty_x_size <= 0) || (tty_y_size <= 0)) UX_tty_with_termcap (&UX_synchronize_tty_size_with_termcap); +#endif if ((tty_x_size <= 0) || (tty_y_size <= 0)) { @@ -195,6 +201,7 @@ UX_synchronize_tty_size (void) tty_size_synchronized_p = true; } +#ifdef USE_TERMCAP static void UX_initialize_tty_with_termcap (void) { @@ -202,6 +209,7 @@ UX_initialize_tty_with_termcap (void) char *tbp = tgetstr_buffer; tty_command_clear = (tgetstr ("cl", (&tbp))); } +#endif void UX_initialize_tty (void) @@ -213,6 +221,9 @@ UX_initialize_tty (void) tty_size_synchronized_p = false; UX_synchronize_tty_size (); tty_command_beep = ALERT_STRING; +#ifndef USE_TERMCAP + tty_command_clear = "\f"; +#else tty_command_clear = 0; UX_tty_with_termcap (&UX_initialize_tty_with_termcap); if (tty_command_clear == 0) @@ -224,6 +235,7 @@ UX_initialize_tty (void) (*tputs_output_scan++) = '\0'; tty_command_clear = command; } +#endif } void