Mercurial > hg > octave-nkf
comparison src/toplev.cc @ 1750:fd0d12493223
[project @ 1996-01-13 09:31:07 by jwe]
author | jwe |
---|---|
date | Sat, 13 Jan 1996 09:31:07 +0000 |
parents | a02f140ed897 |
children | fc59af7ea536 |
comparison
equal
deleted
inserted
replaced
1749:c7f5599eb177 | 1750:fd0d12493223 |
---|---|
53 #include "file-io.h" | 53 #include "file-io.h" |
54 #include "help.h" | 54 #include "help.h" |
55 #include "input.h" | 55 #include "input.h" |
56 #include "lex.h" | 56 #include "lex.h" |
57 #include "oct-hist.h" | 57 #include "oct-hist.h" |
58 #include "toplev.h" | |
59 #include "pager.h" | 58 #include "pager.h" |
60 #include "parse.h" | 59 #include "parse.h" |
61 #include "pathsearch.h" | 60 #include "pathsearch.h" |
62 #include "procstream.h" | 61 #include "procstream.h" |
62 #include "pt-const.h" | |
63 #include "pt-misc.h" | |
64 #include "pt-plot.h" | |
63 #include "sighandlers.h" | 65 #include "sighandlers.h" |
64 #include "statdefs.h" | 66 #include "statdefs.h" |
65 #include "sysdep.h" | 67 #include "sysdep.h" |
66 #include "pt-const.h" | 68 #include "toplev.h" |
67 #include "pt-misc.h" | |
68 #include "pt-plot.h" | |
69 #include "unwind-prot.h" | 69 #include "unwind-prot.h" |
70 #include "user-prefs.h" | 70 #include "user-prefs.h" |
71 #include "utils.h" | 71 #include "utils.h" |
72 #include "variables.h" | 72 #include "variables.h" |
73 #include "version.h" | 73 #include "version.h" |
179 | 179 |
180 run_unwind_frame ("parse_and_execute"); | 180 run_unwind_frame ("parse_and_execute"); |
181 } | 181 } |
182 | 182 |
183 void | 183 void |
184 parse_and_execute (const char *s, int print, int verbose, | 184 parse_and_execute (const string& s, int print, int verbose, |
185 const char *warn_for) | 185 const char *warn_for) |
186 { | 186 { |
187 begin_unwind_frame ("parse_and_execute_2"); | 187 begin_unwind_frame ("parse_and_execute_2"); |
188 | 188 |
189 unwind_protect_int (reading_script_file); | 189 unwind_protect_int (reading_script_file); |
190 unwind_protect_ptr (curr_fcn_file_full_name); | 190 unwind_protect_ptr (curr_fcn_file_full_name); |
191 | 191 |
192 reading_script_file = 1; | 192 reading_script_file = 1; |
193 curr_fcn_file_full_name = s; | 193 curr_fcn_file_full_name = s.c_str (); |
194 | 194 |
195 FILE *f = get_input_from_file (s, 0); | 195 FILE *f = get_input_from_file (s, 0); |
196 | |
196 if (f) | 197 if (f) |
197 { | 198 { |
198 unwind_protect_int (input_line_number); | 199 unwind_protect_int (input_line_number); |
199 unwind_protect_int (current_input_column); | 200 unwind_protect_int (current_input_column); |
200 | 201 |
214 | 215 |
215 if (verbose) | 216 if (verbose) |
216 cout << "done." << endl; | 217 cout << "done." << endl; |
217 } | 218 } |
218 else if (warn_for) | 219 else if (warn_for) |
219 error ("%s: unable to open file `%s'", warn_for, s); | 220 error ("%s: unable to open file `%s'", warn_for, s.c_str ()); |
220 | 221 |
221 run_unwind_frame ("parse_and_execute_2"); | 222 run_unwind_frame ("parse_and_execute_2"); |
222 } | 223 } |
223 | 224 |
224 DEFUN ("source", Fsource, Ssource, 10, | 225 DEFUN ("source", Fsource, Ssource, 10, |
231 | 232 |
232 int nargin = args.length (); | 233 int nargin = args.length (); |
233 | 234 |
234 if (nargin == 1) | 235 if (nargin == 1) |
235 { | 236 { |
236 string tstr = args(0).string_value (); | 237 string file = args(0).string_value (); |
237 const char *file = tstr.c_str (); | |
238 | 238 |
239 if (! error_state) | 239 if (! error_state) |
240 { | 240 { |
241 file = tilde_expand (file); | 241 file = oct_tilde_expand (file); |
242 | 242 |
243 parse_and_execute (file, 1, 0, "source"); | 243 parse_and_execute (file, 1, 0, "source"); |
244 | 244 |
245 if (error_state) | 245 if (error_state) |
246 error ("source: error sourcing file `%s'", file); | 246 error ("source: error sourcing file `%s'", file); |
247 | |
248 delete [] file; | |
249 } | 247 } |
250 else | 248 else |
251 error ("source: expecting file name as argument"); | 249 error ("source: expecting file name as argument"); |
252 } | 250 } |
253 else | 251 else |