Mercurial > octave
comparison src/octave.cc @ 1651:e846e361a265
[project @ 1995-12-20 06:59:12 by jwe]
author | jwe |
---|---|
date | Wed, 20 Dec 1995 07:06:41 +0000 |
parents | f18871f4df2b |
children | e7b6c2cd9bac |
comparison
equal
deleted
inserted
replaced
1650:23aa282707e8 | 1651:e846e361a265 |
---|---|
150 int input_from_command_line_file = 1; | 150 int input_from_command_line_file = 1; |
151 | 151 |
152 // Top level context (?) | 152 // Top level context (?) |
153 jmp_buf toplevel; | 153 jmp_buf toplevel; |
154 | 154 |
155 // This is not really the right place to do this... | |
156 typedef void (*one_arg_error_handler_t) (const char*); | |
157 extern one_arg_error_handler_t set_Complex_error_handler | |
158 (one_arg_error_handler_t f); | |
159 | |
160 // This is from readline's paren.c: | 155 // This is from readline's paren.c: |
161 extern int rl_blink_matching_paren; | 156 extern int rl_blink_matching_paren; |
162 | |
163 static void | |
164 octave_Complex_error_handler (const char* msg) | |
165 { | |
166 warning (msg); | |
167 } | |
168 | 157 |
169 // Nonzero means we read ~/.octaverc and ./.octaverc. | 158 // Nonzero means we read ~/.octaverc and ./.octaverc. |
170 // (--norc; --ignore-init-file; -f) | 159 // (--norc; --ignore-init-file; -f) |
171 static int read_init_files = 1; | 160 static int read_init_files = 1; |
172 | 161 |
318 add_unwind_protect (delete_input_buffer, (void *) new_buf); | 307 add_unwind_protect (delete_input_buffer, (void *) new_buf); |
319 | 308 |
320 switch_to_buffer (new_buf); | 309 switch_to_buffer (new_buf); |
321 | 310 |
322 unwind_protect_int (using_readline); | 311 unwind_protect_int (using_readline); |
323 unwind_protect_int (saving_history); | |
324 unwind_protect_int (input_from_command_line_file); | 312 unwind_protect_int (input_from_command_line_file); |
325 | 313 |
326 using_readline = 0; | 314 using_readline = 0; |
327 saving_history = 0; | |
328 input_from_command_line_file = 0; | 315 input_from_command_line_file = 0; |
329 | 316 |
330 unwind_protect_ptr (curr_sym_tab); | 317 unwind_protect_ptr (curr_sym_tab); |
331 | 318 |
332 int retval; | 319 int retval; |
427 static void | 414 static void |
428 execute_startup_files (void) | 415 execute_startup_files (void) |
429 { | 416 { |
430 begin_unwind_frame ("execute_startup_files"); | 417 begin_unwind_frame ("execute_startup_files"); |
431 | 418 |
419 // XXX FIXME XXX -- need to make it possible to set this in startup | |
420 // files. | |
421 | |
422 unwind_protect_int (input_from_startup_file); | |
432 unwind_protect_int (user_pref.echo_executing_commands); | 423 unwind_protect_int (user_pref.echo_executing_commands); |
433 unwind_protect_int (input_from_startup_file); | 424 |
434 | 425 input_from_startup_file = 1; |
435 user_pref.echo_executing_commands = ECHO_OFF; | 426 user_pref.echo_executing_commands = ECHO_OFF; |
436 input_from_startup_file = 1; | |
437 | 427 |
438 int verbose = (verbose_flag && ! inhibit_startup_message); | 428 int verbose = (verbose_flag && ! inhibit_startup_message); |
439 | 429 |
440 // Execute commands from the site-wide configuration file. First | 430 // Execute commands from the site-wide configuration file. First |
441 // from the file $(prefix)/lib/octave/site/m/octaverc (if it exists), | 431 // from the file $(prefix)/lib/octave/site/m/octaverc (if it exists), |
551 } | 541 } |
552 | 542 |
553 static void | 543 static void |
554 initialize_error_handlers () | 544 initialize_error_handlers () |
555 { | 545 { |
556 set_Complex_error_handler (octave_Complex_error_handler); | |
557 | |
558 set_liboctave_error_handler (error); | 546 set_liboctave_error_handler (error); |
559 } | 547 } |
560 | 548 |
561 // What happens on --traditional. | 549 // What happens on --traditional. |
562 | 550 |
668 usage (); | 656 usage (); |
669 break; | 657 break; |
670 } | 658 } |
671 } | 659 } |
672 | 660 |
673 #if defined (HAVE_ATEXIT) || (HAVE_ON_EXIT) | 661 #if defined (HAVE_ATEXIT) || defined (HAVE_ON_EXIT) |
674 // Make sure we clean up when we exit. If we don't have atexit or | 662 // Make sure we clean up when we exit. If we don't have atexit or |
675 // on_exit, we're going to leave some junk files around if we exit | 663 // on_exit, we're going to leave some junk files around if we exit |
676 // abnormally. | 664 // abnormally. |
677 atexit (cleanup_tmp_files); | 665 atexit (cleanup_tmp_files); |
678 #endif | 666 #endif |
680 // These can come after command line args since none of them set any | 668 // These can come after command line args since none of them set any |
681 // defaults that might be changed by command line options. | 669 // defaults that might be changed by command line options. |
682 | 670 |
683 install_signal_handlers (); | 671 install_signal_handlers (); |
684 | 672 |
685 initialize_history (); | |
686 | |
687 initialize_file_io (); | 673 initialize_file_io (); |
688 | 674 |
689 initialize_symbol_tables (); | 675 initialize_symbol_tables (); |
690 | 676 |
691 install_builtins (); | 677 install_builtins (); |
702 | 688 |
703 bind_builtin_variable ("echo_executing_commands", | 689 bind_builtin_variable ("echo_executing_commands", |
704 (double) echo_commands); | 690 (double) echo_commands); |
705 | 691 |
706 if (read_init_files) | 692 if (read_init_files) |
707 { | 693 execute_startup_files (); |
708 saving_history = 0; | 694 |
709 execute_startup_files (); | 695 initialize_history (); |
710 saving_history = 1; | |
711 } | |
712 | 696 |
713 if (! inhibit_startup_message && reading_startup_message_printed) | 697 if (! inhibit_startup_message && reading_startup_message_printed) |
714 cout << endl; | 698 cout << endl; |
715 | 699 |
716 // Avoid counting commands executed from startup files. | 700 // Avoid counting commands executed from startup files. |
790 cout << "\n"; | 774 cout << "\n"; |
791 } | 775 } |
792 | 776 |
793 can_interrupt = 1; | 777 can_interrupt = 1; |
794 | 778 |
795 octave_set_signal_handler (SIGINT, saved_sigint_handler); | 779 catch_interrupts (); |
796 | 780 |
797 // The big loop. | 781 // The big loop. |
798 | 782 |
799 int retval; | 783 int retval; |
800 do | 784 do |