diff --git a/.gitattributes b/.gitattributes index 5bd3ff54cffa2a644ddc01c397d76f394ab67679..600f4456c4d9397e11fb365ead1fdc0e5eb0f694 100644 --- a/.gitattributes +++ b/.gitattributes @@ -357,10 +357,6 @@ testfont binary /src/modules/math/math.c foreign_ident /src/modules/module_configure.in foreign_ident /src/modules/module_makefile foreign_ident -/src/modules/readline/Makefile.in foreign_ident -/src/modules/readline/acconfig.h foreign_ident -/src/modules/readline/configure.in foreign_ident -/src/modules/readline/readlinemod.c foreign_ident /src/modules/spider/Makefile.in foreign_ident /src/modules/spider/accesseddb.c foreign_ident /src/modules/spider/accesseddb.h foreign_ident diff --git a/src/modules/readline/.cvsignore b/src/modules/readline/.cvsignore deleted file mode 100644 index 3bd0261926f398802de307677deff1c59cfa9bab..0000000000000000000000000000000000000000 --- a/src/modules/readline/.cvsignore +++ /dev/null @@ -1,15 +0,0 @@ -.pure -Makefile -config.log -config.status -configure -dependencies -lib_dirs -linker_options -modlist_headers -modlist_segment -module_testsuite -readline_machine.h -readline_machine.h.in -stamp-h -stamp-h.in diff --git a/src/modules/readline/.gitignore b/src/modules/readline/.gitignore deleted file mode 100644 index c1df15f88531a56d1ec0db585a880f3177f160d5..0000000000000000000000000000000000000000 --- a/src/modules/readline/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -/.pure -/Makefile -/config.log -/config.status -/configure -/dependencies -/lib_dirs -/linker_options -/modlist_headers -/modlist_segment -/module_testsuite -/readline_machine.h -/readline_machine.h.in -/stamp-h -/stamp-h.in diff --git a/src/modules/readline/Makefile.in b/src/modules/readline/Makefile.in deleted file mode 100644 index 866445a47d980e498ddedbdf7b654a698ab7a277..0000000000000000000000000000000000000000 --- a/src/modules/readline/Makefile.in +++ /dev/null @@ -1,9 +0,0 @@ -# $Id: Makefile.in,v 1.2 1998/03/28 13:56:02 grubba Exp $ -SRCDIR=@srcdir@ -VPATH=@srcdir@:@srcdir@/../..:../.. -MODULE_CPPFLAGS=@CPPFLAGS@ -MODULE_LDFLAGS=@LDFLAGS@ @LIBS@ -OBJS=readlinemod.o - -@dynamic_module_makefile@ -@dependencies@ diff --git a/src/modules/readline/acconfig.h b/src/modules/readline/acconfig.h deleted file mode 100644 index e4a37f8b3a9b6e632412b838f45fcc7ce0ff947d..0000000000000000000000000000000000000000 --- a/src/modules/readline/acconfig.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * $Id: acconfig.h,v 1.1 1997/05/22 16:20:25 grubba Exp $ - */ - -#ifndef READLINE_MACHINE_H -#define READLINE_MACHINE_H - -@TOP@ -@BOTTOM@ - -#endif diff --git a/src/modules/readline/configure.in b/src/modules/readline/configure.in deleted file mode 100644 index e1570857789bc9939753391500d3aa22f7c6f69a..0000000000000000000000000000000000000000 --- a/src/modules/readline/configure.in +++ /dev/null @@ -1,53 +0,0 @@ -# $Id: configure.in,v 1.5 1999/02/08 04:57:27 mast Exp $ -AC_INIT(readlinemod.c) -AC_CONFIG_HEADER(readline_machine.h) -AC_ARG_WITH(readline,[ --with(out)-readline support command line editing],[],[with_readline=yes]) - -AC_MODULE_INIT() - -if test x$with_readline = xyes ; then - AC_MSG_CHECKING(Checking for GNU directory) - - AC_CACHE_VAL(pike_cv_gnu_dir, [ - for pike_cv_gnu_dir in /usr/gnu /opt/gnu /usr/local/gnu /sw/gnu no; do - if test -d $pike_cv_gnu_dir/. ; then - break - else - : - fi - done - ]) - AC_MSG_RESULT($pike_cv_gnu_dir) - - if test x$pike_cv_gnu_dir != xno; then - if test -d $pike_cv_gnu_dir/include/. ; then - echo Adding $pike_cv_gnu_dir/include to the include path - CPPFLAGS="$CPPFLAGS -I$pike_cv_gnu_dir/include" - else - : - fi - else - : - fi - - AC_CHECK_HEADERS(readline.h history.h readline/readline.h history/history.h readline/history.h) - - if test $ac_cv_header_readline_h = yes -o $ac_cv_header_readline_readline_h = yes ; then - if test $ac_cv_header_history_h = yes -o $ac_cv_header_history_history_h = yes -o $ac_cv_header_readline_history_h = yes ; then - AC_CHECK_LIB(readline, tputs, : , : ) - if test $ac_cv_lib_readline_tputs = no ; then - AC_CHECK_LIB(termcap, tputs) - if test $ac_cv_lib_termcap_tputs = no ; then - AC_CHECK_LIB(ncurses, tputs) - fi - fi - if test $ac_cv_lib_readline_tputs = yes -o x$ac_cv_lib_termcap_tputs = xyes -o x$ac_cv_lib_ncurses_tputs = xyes ; then - AC_CHECK_LIB(readline, readline) - fi - fi - fi -fi - -AC_OUTPUT(Makefile,echo FOO >stamp-h ) - - diff --git a/src/modules/readline/doc/readline b/src/modules/readline/doc/readline deleted file mode 100644 index 01f3204c02d443f207edaa5b1348f320f1031c28..0000000000000000000000000000000000000000 --- a/src/modules/readline/doc/readline +++ /dev/null @@ -1,14 +0,0 @@ -NAME - readline - read a line from stdin - -SYNTAX - string readline(string prompt); - -DESCRIPTION - This function writes the string 'prompt' and then waits until the - user has entered a line from the keyboard. If the readline library - was available when Pike was compiled the user will have history and - line edithing at his/her disposal when entering the line. - -SEE ALSO - files/file diff --git a/src/modules/readline/readlinemod.c b/src/modules/readline/readlinemod.c deleted file mode 100644 index 8dc9b6ab7579f28698ce4df4d59f4715463ea26f..0000000000000000000000000000000000000000 --- a/src/modules/readline/readlinemod.c +++ /dev/null @@ -1,219 +0,0 @@ -/*\ -||| This file a part of Pike, and is copyright by Fredrik Hubinette -||| Pike is distributed as GPL (General Public License) -||| See the files COPYING and DISCLAIMER for more information. - */ -#include "global.h" -#include "readline_machine.h" -#include "interpret.h" -#include "svalue.h" -#include "stralloc.h" -#include "array.h" -#include "object.h" -#include "pike_macros.h" -#include "threads.h" - -RCSID("$Id: readlinemod.c,v 1.11 1999/02/08 04:57:28 mast Exp $"); - -#include <errno.h> - -#if !defined(HAVE_READLINE_H) && !defined(HAVE_READLINE_READLINE_H) -#undef HAVE_LIBREADLINE -#endif - -#if !defined(HAVE_HISTORY_H) && !defined(HAVE_READLINE_HISTORY_H) && !defined(HAVE_HISTORY_HISTORY_H) -#undef HAVE_LIBREADLINE -#endif - -#ifdef HAVE_LIBREADLINE - -#ifdef HAVE_READLINE_READLINE_H -#include <readline/readline.h> -#else -#ifdef HAVE_READLINE_H -#include <readline.h> -#endif -#endif - -#ifdef HAVE_READLINE_HISTORY_H -#include <readline/history.h> -#else -#ifdef HAVE_HISTORY_HISTORY_H -#include <history/history.h> -#else -#ifdef HAVE_HISTORY_H -#include <history.h> -#endif -#endif -#endif - -struct svalue *complete_callback = NULL; - -char *my_copy_string(struct pike_string *s) -{ - char *res = malloc(s->len+1); - MEMCPY(res,s->str,s->len+1); - return res; -} - -char *low_do_rl_complete(char *string, int state) -{ - JMP_BUF tmp; - rl_completer_quote_characters = "`'\""; - if(complete_callback) - { - push_text(string); - push_int(state); - push_string(make_shared_binary_string(rl_line_buffer, rl_end)); - push_int(rl_point); - if(SETJMP(tmp)) - { - fprintf(stderr, "error in completion function"); - return 0; - } - else - apply_svalue(complete_callback, 4); - UNSETJMP(tmp); - - if(sp[-1].type == T_STRING) - return my_copy_string(sp[-1].u.string); - /* Note that we do _not_ pop the stack here... - * All strings will be pop()ed when f_readline returns. - * DO NOT USE // as comments!!! // Hubbe - */ - } - return 0; -} - -char *my_rl_complete(char *text, int status) -{ -#ifdef _REENTRANT - struct thread_state *state; - char *res; - if((state = thread_state_for_id(th_self()))!=NULL) - { - /* This is a pike thread. Do we have the interpreter lock? */ - if(!state->swapped) { - /* Yes. Go for it... */ - res=low_do_rl_complete(text,status); - } else { - /* Nope, let's get it... */ - mt_lock(&interpreter_lock); - SWAP_IN_THREAD(state); - res=low_do_rl_complete(text,status); - /* Restore */ - SWAP_OUT_THREAD(state); - mt_unlock(&interpreter_lock); - } - } else - fatal("Bad idea!\n"); - return res; -#else - return low_do_rl_complete(text,status); -#endif -} - -static void f_readline(INT32 args) -{ - char *r; - struct pike_string *str; - struct svalue *osp = sp; - if(args < 1) - error("Too few arguments to readline().\n"); - if(args > 1) - complete_callback = sp-args+1; - if(sp[-args].type != T_STRING) - error("Bad argument 1 to readline()\n"); - - str=sp[-args].u.string; -retry: - THREADS_ALLOW(); - r=readline(str->str); - THREADS_DISALLOW(); - -#ifdef _REENTRANT - /* Kluge! /Hubbe */ - if(!r && errno==EINTR) - { - check_threads_etc(); - goto retry; - } -#endif - complete_callback = 0; - pop_n_elems(args+(sp-osp)); - if(r) - { - if(*r) add_history(r); - push_string(make_shared_string(r)); - free(r); - } else { - push_int(0); - } -} - -void pike_module_init(void) -{ - rl_completion_entry_function = (int (*)())my_rl_complete; - add_function_constant("_module_value",f_readline, - "function(string,void|function:string)", - OPT_SIDE_EFFECT); -} - -#else - -#include <stdio.h> - -#define BLOCK 16384 - -static void f_readline(INT32 args) -{ - char *prompt; - int plen; - char line[BLOCK]; - char *r; - int tmp; - - if(args < 1) - error("Too few arguments to readline().\n"); - - if(sp[-args].type != T_STRING) - error("Bad argument 1 to readline()\n"); - - prompt = sp[-args].u.string->str; - plen = sp[-args].u.string->len; - - THREADS_ALLOW(); - - write(1, prompt, plen); - r=fgets(line,BLOCK-1,stdin); /* Should probably get rid of this one */ - line[BLOCK-1] = '\0'; /* Always NUL-terminated */ - - THREADS_DISALLOW(); - - pop_n_elems(args); - - if (r) - { - INT32 len; - if ((len=strlen(line))) - { - if (line[len-1]=='\n') - { - push_string(make_shared_binary_string(line,len-1)); - return; - } - } - } - push_int(0); -} - -void pike_module_init(void) -{ - add_function_constant("_module_value",f_readline,"function(string,function|void:string)",OPT_SIDE_EFFECT); -} - -#endif - -void pike_module_exit(void) {} - - diff --git a/src/modules/readline/testsuite.in b/src/modules/readline/testsuite.in deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000