From f83cdde7661383bc4cba44059f027253c5591aa7 Mon Sep 17 00:00:00 2001 From: Paulo Moura Date: Sat, 30 Apr 2011 18:12:56 +0200 Subject: [PATCH 1/4] Reapplied patch to support 0'\s and 0'\z. --- C/scanner.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/C/scanner.c b/C/scanner.c index aa564d0f3..af4756cb8 100755 --- a/C/scanner.c +++ b/C/scanner.c @@ -315,6 +315,8 @@ read_quoted_char(int *scan_nextp, IOSTREAM *inp_stream) return '\n'; case 'r': return '\r'; + case 's': /* space */ + return ' '; case 't': return '\t'; case 'u': @@ -357,6 +359,8 @@ read_quoted_char(int *scan_nextp, IOSTREAM *inp_stream) } case 'v': return '\v'; + case 'z': /* Prolog end-of-file */ + return -1; case '\\': return '\\'; case '\'': From 5c9d62e16edc64556faf954666c25b7298dd9a43 Mon Sep 17 00:00:00 2001 From: Paulo Moura Date: Sat, 30 Apr 2011 19:51:40 +0200 Subject: [PATCH 2/4] Make the support for 0'\s and 0'\z conditional on the ISO escape sequences flag. --- C/scanner.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/C/scanner.c b/C/scanner.c index af4756cb8..77cb8d6eb 100755 --- a/C/scanner.c +++ b/C/scanner.c @@ -316,7 +316,10 @@ read_quoted_char(int *scan_nextp, IOSTREAM *inp_stream) case 'r': return '\r'; case 's': /* space */ - return ' '; + if (yap_flags[CHARACTER_ESCAPE_FLAG] == ISO_CHARACTER_ESCAPES) { + return send_error_message("invalid escape sequence \\s"); + } else + return ' '; case 't': return '\t'; case 'u': @@ -360,7 +363,10 @@ read_quoted_char(int *scan_nextp, IOSTREAM *inp_stream) case 'v': return '\v'; case 'z': /* Prolog end-of-file */ - return -1; + if (yap_flags[CHARACTER_ESCAPE_FLAG] == ISO_CHARACTER_ESCAPES) { + return send_error_message("invalid escape sequence \\z"); + } else + return -1; case '\\': return '\\'; case '\'': From cfe65cea0ae345dfb4bf63748ed70aa882015407 Mon Sep 17 00:00:00 2001 From: Paulo Moura Date: Sat, 30 Apr 2011 20:22:20 +0200 Subject: [PATCH 3/4] Corrected a bug in the implementation of yap_flag/2 when returning the user_input, uer_error, and user_ouput flag values. --- pl/flags.yap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pl/flags.yap b/pl/flags.yap index 0982737e8..2b7fc457d 100644 --- a/pl/flags.yap +++ b/pl/flags.yap @@ -958,7 +958,7 @@ yap_flag(dialect,yap). '$yap_flag_show_gc_tracing'(_, _, _, off). '$flag_check_alias'(OUT, Alias) :- - stream_property(OUT,[alias(Alias)]), !. + stream_property(OUT,alias(Alias)), !. current_prolog_flag(V,Out) :- var(V), !, From fa5989587d088c45500a0ea367ae42550e2f41db Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Sun, 1 May 2011 22:43:54 +0100 Subject: [PATCH 4/4] fix |: prompt with readline. --- pl/boot.yap | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/pl/boot.yap b/pl/boot.yap index 28019513f..12423bb03 100755 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -144,18 +144,18 @@ true :- true. */ /* main execution loop */ -'$read_vars'(user_input, Goal, Mod, Pos, Bindings) :- +'$read_vars'(user_input, Goal, Mod, Pos, Bindings, Prompt) :- '$swi_current_prolog_flag'(readline, true), read_history(h, '!h', [trace, end_of_file], - ' ?- ', Goal, Bindings), !, + Prompt, Goal, Bindings), !, (nonvar(Err) -> print_message(error,Err), fail ; true ). -'$read_vars'(Stream,T,Mod,Pos,V) :- - '$read'(true,T,Mod,V,Pos,Err,Stream), +'$read_vars'(Stream, T, Mod, Pos, V, _Prompt) :- + '$read'(true, T, Mod, V, Pos, Err, Stream), (nonvar(Err) -> print_message(error,Err), fail ; @@ -195,13 +195,12 @@ true :- true. prompt(_,'| '), prompt1(' ?- '), '$run_toplevel_hooks', - '$read_vars'(user_input,Command,_,Pos,Varnames), + '$read_vars'(user_input,Command,_,Pos,Varnames, ' ?- '), nb_setval('$spy_gn',1), - % stop at spy-points if debugging is on. - + % stop at spy-points if debugging is on. nb_setval('$debug_run',off), nb_setval('$debug_jump',off), - prompt(_,'|: '), + prompt1('|: '), '$command'(Command,Varnames,Pos,top), '$sync_mmapped_arrays', set_value('$live','$false'). @@ -1141,7 +1140,7 @@ bootstrap(F) :- !. '$enter_command'(Stream,Status) :- - '$read_vars'(Stream,Command,_,Pos,Vars), + '$read_vars'(Stream,Command,_,Pos,Vars, '|: '), '$command'(Command,Vars,Pos,Status). '$abort_loop'(Stream) :-