From bug-octave-request at bevo dot che dot wisc dot edu Thu Nov 13 16:27:36 1997 Subject: Unidentified subject! From: "John W. Eaton" To: Vincent Cautaerts Cc: bug-octave at bevo dot che dot wisc dot edu Date: Thu, 13 Nov 1997 16:27:39 -0600 On 13-Nov-1997, Vincent Cautaerts wrote: | To: bug-octave at bevo dot che dot wisc dot edu | Subject: sourced scripts does not return | | Bug report for Octave 2.0.9 configured for i586-pc-linux-gnu | | Description: | ----------- | | When sourcing a script from another script, the control does not return | to the previous one. | | Repeat-By: | --------- | | Create file "file1.m" with: | #begin of file1.m | source("file2"); | printf("This is file 1\n"); | #end of file1 | | and file2 | #begin of file2 | printf("This is file 2\n"); | #end of file2 | | calling | > file1 | | does print "This is file 2" only, and not "This is file 1" | | If the file 2 was named "file2.m" and called by "file2" only, | it would return | | If it is a feature, it should be documented. Nope, it's a bug. Please try the following patch (your line numbers will probably be different). Thanks, jwe Thu Nov 13 16:21:06 1997 John W. Eaton * variables.cc (parse_fcn_file): No longer static. * variables.h: Provide declaration for parse_fcn_file. * toplev.cc (Fsource): Call parse_fcn_file, not parse_and_execute. *** src/variables.cc~ Mon May 19 20:13:50 1997 --- src/variables.cc Thu Nov 13 16:06:52 1997 *************** *** 597,603 **** fclose ((FILE *) f); } ! static int parse_fcn_file (int exec_script, const string& ff) { begin_unwind_frame ("parse_fcn_file"); --- 602,608 ---- fclose ((FILE *) f); } ! int parse_fcn_file (int exec_script, const string& ff) { begin_unwind_frame ("parse_fcn_file"); *** src/variables.h~ Wed Oct 30 13:32:14 1996 --- src/variables.h Thu Nov 13 16:07:44 1997 *************** *** 103,108 **** --- 103,110 ---- extern void initialize_symbol_tables (void); + extern int parse_fcn_file (int exec_script, const string& ff); + extern bool lookup (symbol_record *s, int exec_script = 1); extern symbol_record *lookup_by_name (const string& nm, int exec_script = 1); *** src/toplev.cc~ Mon Jun 23 14:04:32 1997 --- src/toplev.cc Thu Nov 13 16:04:50 1997 *************** *** 339,345 **** { file = oct_tilde_expand (file); ! parse_and_execute (file, 1, 0, "source"); if (error_state) error ("source: error sourcing file `%s'", file.c_str ()); --- 339,345 ---- { file = oct_tilde_expand (file); ! parse_fcn_file (1, file); if (error_state) error ("source: error sourcing file `%s'", file.c_str ());