comparison src/toplev.cc @ 2517:0c5e671499ed

[project @ 1996-11-14 20:24:02 by jwe]
author jwe
date Thu, 14 Nov 1996 20:24:03 +0000
parents 06595bc7f2d0
children b9f178af9281
comparison
equal deleted inserted replaced
2516:70cad7ffd946 2517:0c5e671499ed
161 while (retval == 0); 161 while (retval == 0);
162 162
163 run_unwind_frame ("parse_and_execute"); 163 run_unwind_frame ("parse_and_execute");
164 } 164 }
165 165
166 static void
167 safe_fclose (void *f)
168 {
169 if (f)
170 fclose ((FILE *) f);
171 }
172
166 void 173 void
167 parse_and_execute (const string& s, int print, int verbose, 174 parse_and_execute (const string& s, int print, int verbose,
168 const char *warn_for) 175 const char *warn_for)
169 { 176 {
170 begin_unwind_frame ("parse_and_execute_2"); 177 begin_unwind_frame ("parse_and_execute_2");
177 184
178 FILE *f = get_input_from_file (s, 0); 185 FILE *f = get_input_from_file (s, 0);
179 186
180 if (f) 187 if (f)
181 { 188 {
189 add_unwind_protect (safe_fclose, (void *) f);
190
182 unwind_protect_int (input_line_number); 191 unwind_protect_int (input_line_number);
183 unwind_protect_int (current_input_column); 192 unwind_protect_int (current_input_column);
184 193
185 input_line_number = 0; 194 input_line_number = 0;
186 current_input_column = 1; 195 current_input_column = 1;
191 reading_startup_message_printed = 1; 200 reading_startup_message_printed = 1;
192 cout.flush (); 201 cout.flush ();
193 } 202 }
194 203
195 parse_and_execute (f, print); 204 parse_and_execute (f, print);
196
197 fclose (f);
198 205
199 if (verbose) 206 if (verbose)
200 cout << "done." << endl; 207 cout << "done." << endl;
201 } 208 }
202 else if (warn_for) 209 else if (warn_for)