Use the libreadline in Winedbg, if available

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Mon Jun 18 09:10:14 CDT 2001


Hallo,

at present, wine uses unconditionally a self supplied readline
function. Appended patch tries to find out if libreadline is available 
and uses libreadline if available. I configured with and without
libreadline and successfully compiled winedbg on my system.
libreadline is a static library on my system and winedbg grew 90 kByte
stripped and 110 kByte compiled with -g.

Alexandre: make include/config.h.in and autoconf is needed.
Without intervention, this will result in a complete recompile as
include config.h as changed.

Patrick: Can you check if my approach to recognize libreadline is portable?

Changelog:
	configure.in, include/acconfig.h:
	Look for libreadline
	debugger/dbg.y,debugger/editline.c,debugger/debug.l:
	Use libreadline, if available

Bye

(Resent patch: Original message dated 000910, rejected without notice or
forgotten) 

Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Free Software: If you contribute nothing, expect nothing
--
Index: wine/configure.in
===================================================================
RCS file: /home/wine/wine/configure.in,v
retrieving revision 1.152
diff -u -r1.152 configure.in
--- wine/configure.in	2000/09/06 19:46:59	1.152
+++ wine/configure.in	2000/09/10 14:37:22
@@ -13,6 +13,7 @@
 TRACE_MSGS=yes	# the TRACE() macro
 DEBUG_MSGS=yes	# the TRACE(), WARN(), and FIXME() macros.
 CURSES=yes
+READLINE=yes
 OPENGL=normal
 
 AC_ARG_ENABLE(dll,
@@ -35,6 +36,10 @@
 [  --without-curses        do not use curses],
 [if test "$withval" = "no"; then CURSES="no"; fi])
 
+AC_ARG_WITH(readline,
+[  --without-readline        do not use readline],
+[if test "$withval" = "no"; then READLINE="no"; fi])
+
 AC_ARG_WITH(reentrant-x,
 [  --without-reentrant-x   compile for use with non-reentrant X libraries])
 
@@ -348,6 +353,21 @@
     fi
 fi
 
+dnl *** Check for readline ncurses is needed ***
+if test "$ac_cv_lib_ncurses_waddch" = "yes"
+then
+   if test "$READLINE" = "yes"
+   then
+      AC_CHECK_HEADERS(readline/readline.h readline/history.h)
+   fi
+   if test "$ac_cv_header_readline_history_h"  = "yes" -a "$ac_cv_header_readline_readline_h"  = "yes"
+      then
+      AC_CHECK_LIB(readline,readline)
+   fi
+else
+  echo "No check for readline because lack of ncurses"
+fi
+
 dnl **** Check for IPX (currently Linux only) ****
 AC_CACHE_CHECK("for GNU style IPX support", ac_cv_c_ipx_gnu,
  AC_TRY_COMPILE(
Index: wine/include/acconfig.h
===================================================================
RCS file: /home/wine/wine/include/acconfig.h,v
retrieving revision 1.27
diff -u -r1.27 acconfig.h
--- wine/include/acconfig.h	2000/09/06 19:46:59	1.27
+++ wine/include/acconfig.h	2000/09/10 14:37:22
@@ -84,6 +84,9 @@
 /* Define if we can use curses (if no ncurses) for full-screen access */
 #undef HAVE_LIBCURSES
 
+/* Define if we can use readline for editing the debug cmdline */
+#undef HAVE_LIBREADLINE
+
 /* Define if ncurses have the new resizeterm function */
 #undef HAVE_RESIZETERM
 
Index: wine/debugger/dbg.y
===================================================================
RCS file: /home/wine/wine/debugger/dbg.y,v
retrieving revision 1.39
diff -u -r1.39 dbg.y
--- wine/debugger/dbg.y	2000/06/25 12:49:13	1.39
+++ wine/debugger/dbg.y	2000/09/10 14:37:22
@@ -339,7 +339,7 @@
 
 static void issue_prompt(void)
 {
-#ifdef DONT_USE_READLINE
+#ifndef HAVE_LIBREADLINE
    DEBUG_Printf(DBG_CHN_MESG, "Wine-dbg>");
 #endif
 }
Index: wine/debugger/editline.c
===================================================================
RCS file: /home/wine/wine/debugger/editline.c,v
retrieving revision 1.10
diff -u -r1.10 editline.c
--- wine/debugger/editline.c	2000/05/03 17:48:21	1.10
+++ wine/debugger/editline.c	2000/09/10 14:37:23
@@ -892,7 +892,7 @@
     }
     H.Pos = H.Size - 1;
 }
-
+#ifndef HAVE_LIBREADLINE
 char *
 readline(const char *prompt)
 {
@@ -934,6 +934,7 @@
 #endif	/* defined(UNIQUE_HISTORY) */
     hist_add((CHAR *)p);
 }
+#endif
 
 
 static STATUS
Index: wine/debugger/debug.l
===================================================================
RCS file: /home/wine/wine/debugger/debug.l,v
retrieving revision 1.16
diff -u -r1.16 debug.l
--- wine/debugger/debug.l	2000/06/18 19:30:24	1.16
+++ wine/debugger/debug.l	2000/09/10 14:37:23
@@ -8,19 +8,24 @@
 %{
 #include <stdlib.h>
 #include <string.h>
+#ifdef HAVE_LIBREADLINE
+#include <readline/readline.h>
+#include <readline/history.h>
+#endif  /* HAVE_LIBREADLINE */
 #include "debugger.h"
 #include "y.tab.h"
 
-#ifndef DONT_USE_READLINE
+#ifdef HAVE_LIBREADLINE 
 #undef YY_INPUT
 #define YY_INPUT(buf,result,max_size) \
 	if ( (result = dbg_read((char *) buf, max_size )) < 0 ) \
 	    YY_FATAL_ERROR( "read() in flex scanner failed" );
 
+#endif  /* HAVE_LIBREADLINE */
+
 static int dbg_read(char * buf, int size);
 static char * DEBUG_MakeSymbol(char *);
 
-#endif  /* DONT_USE_READLINE */
 
 #define YY_NO_UNPUT
 
@@ -168,7 +173,7 @@
 int yywrap(void) { return 1; }
 #endif
 
-#ifndef DONT_USE_READLINE
+#ifdef HAVE_LIBREADLINE
 
 #ifndef whitespace
 #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
@@ -242,6 +247,7 @@
     }
 }
 
+#endif  /* HAVE_LIBREADLINE */
 static char *local_symbols[30];
 static int next_symbol;
 
@@ -257,4 +263,3 @@
 	next_symbol = 0;
 }
 
-#endif  /* DONT_USE_READLINE */




More information about the wine-patches mailing list