From 1bf965ceb66aa0ebc0404df306b6563253af9f1a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 30 May 2017 23:07:32 -0700 Subject: Refactoring hash bang support; hash bang null hack. The hash bang mechanism is handled in one place, and disentangled from all parsing logic. It is also endowed with special powers. * eval.c (load): Pass one less argument to read_eval_stream. * match.c (v_load): Likewise. * parser.c (read_eval_stream): hash_bang_support Boolean argument removed. Hash bang logic removed. (load_rcfile): Pass only two arguments to read_eval_stream. * parser.h (read_eval_stream): Declaration updated. * txr.c (remove_hash_bang_line): Function removed. (check_hash_bang): New static function. (txr_main): Recognize the script file name while still inside the argument processing loop. Open the file, and check for a hash bang line, doing the special processing which can generate more arguments from material after a null byte in the hash bang line. The parse_stream variable is now initialized to nil and doubles as a Boolean indicating whether a stream has been opened. After the loop, we remove the script file from the arguments, if we have an open stream and the spec_file_str matches. read_eval_stream is called only with two arguments. * txr.1: Revised existing documentation and described new features. --- parser.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'parser.h') diff --git a/parser.h b/parser.h index 41969c3f..aedec088 100644 --- a/parser.h +++ b/parser.h @@ -116,7 +116,7 @@ val lisp_parse(val source_in, val error_stream, val error_return_val, val name_in, val lineno); val iread(val source_in, val error_stream, val error_return_val, val name_in, val lineno); -val read_eval_stream(val stream, val error_stream, val hash_bang_support); +val read_eval_stream(val stream, val error_stream); #if HAVE_TERMIOS val repl(val bindings, val in_stream, val out_stream); #endif -- cgit v1.2.3