comparison src/octave.cc @ 7202:ffdbdf53665c

[project @ 2007-11-27 20:14:41 by jwe]
author jwe
date Tue, 27 Nov 2007 20:16:19 +0000
parents a1dbe9d80eee
children 745a8299c2b5 e76649d19a1a
comparison
equal deleted inserted replaced
7201:76341ffda11e 7202:ffdbdf53665c
364 static int 364 static int
365 execute_eval_option_code (const std::string& code) 365 execute_eval_option_code (const std::string& code)
366 { 366 {
367 unwind_protect::begin_frame ("execute_eval_option_code"); 367 unwind_protect::begin_frame ("execute_eval_option_code");
368 368
369 octave_save_signal_mask ();
370
371 can_interrupt = true;
372
373 octave_signal_hook = octave_signal_handler;
374 octave_interrupt_hook = unwind_protect::run_all;
375 octave_bad_alloc_hook = unwind_protect::run_all;
376
377 octave_catch_interrupts ();
378
379 octave_initialized = true;
380
369 unwind_protect_bool (interactive); 381 unwind_protect_bool (interactive);
370 382
371 interactive = false; 383 interactive = false;
372 384
373 int parse_status = 0; 385 int parse_status = 0;
374 386
375 try 387 try
376 { 388 {
377 eval_string (code, false, parse_status, 0); 389 eval_string (code, false, parse_status, 0);
390 }
391 catch (octave_interrupt_exception)
392 {
393 recover_from_exception ();
394 octave_stdout << "\n";
378 } 395 }
379 catch (std::bad_alloc) 396 catch (std::bad_alloc)
380 { 397 {
381 std::cerr << "error: memory exhausted or requested size too large for range of Octave's index type -- eval failed" 398 std::cerr << "error: memory exhausted or requested size too large for range of Octave's index type -- eval failed"
382 << std::endl; 399 << std::endl;
389 406
390 static void 407 static void
391 execute_command_line_file (const std::string& fname) 408 execute_command_line_file (const std::string& fname)
392 { 409 {
393 unwind_protect::begin_frame ("execute_command_line_file"); 410 unwind_protect::begin_frame ("execute_command_line_file");
411
412 octave_save_signal_mask ();
413
414 can_interrupt = true;
415
416 octave_signal_hook = octave_signal_handler;
417 octave_interrupt_hook = unwind_protect::run_all;
418 octave_bad_alloc_hook = unwind_protect::run_all;
419
420 octave_catch_interrupts ();
421
422 octave_initialized = true;
394 423
395 unwind_protect_bool (interactive); 424 unwind_protect_bool (interactive);
396 unwind_protect_bool (reading_script_file); 425 unwind_protect_bool (reading_script_file);
397 unwind_protect_bool (input_from_command_line_file); 426 unwind_protect_bool (input_from_command_line_file);
398 427
419 octave_program_name = tmp; 448 octave_program_name = tmp;
420 449
421 try 450 try
422 { 451 {
423 parse_and_execute (fname, false, "octave"); 452 parse_and_execute (fname, false, "octave");
453 }
454 catch (octave_interrupt_exception)
455 {
456 recover_from_exception ();
457 octave_stdout << "\n";
424 } 458 }
425 catch (std::bad_alloc) 459 catch (std::bad_alloc)
426 { 460 {
427 std::cerr << "error: memory exhausted or requested size too large for range of Octave's index type -- execution of " 461 std::cerr << "error: memory exhausted or requested size too large for range of Octave's index type -- execution of "
428 << fname << " failed" << std::endl; 462 << fname << " failed" << std::endl;