Fixed some bad behavior when many symbols with same names where found.

Removed external readline support.
This commit is contained in:
Eric Pouech 2002-02-04 18:40:40 +00:00 committed by Alexandre Julliard
parent 9d366f1f40
commit d727a9bcf4
5 changed files with 10 additions and 25 deletions

View File

@ -21,7 +21,6 @@
extern FILE * yyin;
static void issue_prompt(void);
static void mode_command(int);
int yylex(void);
int yyerror(char *);
@ -81,8 +80,8 @@ int yyerror(char *);
%%
input: line { issue_prompt(); }
| input line { issue_prompt(); }
input: line
| input line
line: command
| tEOL
@ -344,13 +343,6 @@ identifier:
%%
static void issue_prompt(void)
{
#ifdef DONT_USE_READLINE
DEBUG_Printf(DBG_CHN_MESG, "Wine-dbg>");
#endif
}
static void mode_command(int newmode)
{
switch(newmode)
@ -410,7 +402,6 @@ BOOL DEBUG_Parser(void)
ret_ok = FALSE;
do {
__TRY {
issue_prompt();
ret_ok = TRUE;
if ((ret = yyparse())) {
DEBUG_FlushSymbols();

View File

@ -13,13 +13,11 @@
#include "debugger.h"
#include "y.tab.h"
#ifndef DONT_USE_READLINE
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
if ( (result = DEBUG_ReadLine("Wine-dbg>", (char *) buf, max_size, TRUE )) < 0 ) \
if ( (result = DEBUG_ReadLine("Wine-dbg>", (char *) buf, max_size, TRUE, TRUE )) < 0 ) \
YY_FATAL_ERROR( "read() in flex scanner failed" );
#endif /* DONT_USE_READLINE */
#define YY_NO_UNPUT
@ -169,8 +167,6 @@ enum { return tENUM; }
int yywrap(void) { return 1; }
#endif
#ifndef DONT_USE_READLINE
#ifndef whitespace
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
#endif
@ -195,7 +191,7 @@ static void stripwhite (char *string)
string[++i] = '\0';
}
int DEBUG_ReadLine(const char* pfx, char * buf, int size, int remind)
int DEBUG_ReadLine(const char* pfx, char * buf, int size, int flush_sym, int keep_hist)
{
char buf_line[256];
char* ptr;
@ -204,7 +200,7 @@ int DEBUG_ReadLine(const char* pfx, char * buf, int size, int remind)
for (;;)
{
DEBUG_FlushSymbols();
if (flush_sym) DEBUG_FlushSymbols();
/* as of today, console handles can be file handles... so better use file APIs rather than
* consoles
*/
@ -219,7 +215,7 @@ int DEBUG_ReadLine(const char* pfx, char * buf, int size, int remind)
/* Remove leading and trailing whitespace from the line */
stripwhite (buf_line);
if (remind)
if (keep_hist)
{
static char last_line[256] = "";
/* If there is anything left, add it to the history list
@ -234,7 +230,7 @@ int DEBUG_ReadLine(const char* pfx, char * buf, int size, int remind)
}
else
{
/* I could also tweak with the undoc functions to remove this line from the console
/* I should also tweak with the undoc functions to remove this line from the console
* history... */
ptr = buf_line;
}
@ -269,5 +265,3 @@ void DEBUG_FlushSymbols(void)
while(--next_symbol >= 0) DBG_free(local_symbols[next_symbol]);
next_symbol = 0;
}
#endif /* DONT_USE_READLINE */

View File

@ -293,7 +293,7 @@ extern void DEBUG_Exit( DWORD );
/* debugger/debug.l */
extern void DEBUG_FlushSymbols(void);
extern char*DEBUG_MakeSymbol(const char*);
extern int DEBUG_ReadLine(const char* pfx, char* buffer, int size, int remind);
extern int DEBUG_ReadLine(const char* pfx, char* buffer, int size, int flush_sym, int keep_hist);
/* debugger/display.c */
extern int DEBUG_DoDisplay(void);

View File

@ -413,7 +413,7 @@ BOOL DEBUG_GetSymbolValue( const char * name, const int lineno,
}
do {
i = 0;
if (DEBUG_ReadLine("=> ", buffer, sizeof(buffer), FALSE))
if (DEBUG_ReadLine("=> ", buffer, sizeof(buffer), FALSE, FALSE))
{
i = atoi(buffer);
if (i < 1 || i > num)

View File

@ -188,7 +188,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
* Still couldn't find it. Ask user for path to add.
*/
sprintf(zbuf, "Enter path to file '%s': ", sourcefile);
DEBUG_ReadLine(zbuf, tmppath, sizeof(tmppath), FALSE);
DEBUG_ReadLine(zbuf, tmppath, sizeof(tmppath), FALSE, FALSE);
if( tmppath[strlen(tmppath)-1] == '\n' )
{