Mercurial > hg > octave-nkf
comparison src/toplev.cc @ 2806:187d5321cfa3
[project @ 1997-03-11 05:13:15 by jwe]
author | jwe |
---|---|
date | Tue, 11 Mar 1997 05:13:25 +0000 |
parents | bca5fbab2e52 |
children | 78b7b5b73215 |
comparison
equal
deleted
inserted
replaced
2805:68e6d0c93fc8 | 2806:187d5321cfa3 |
---|---|
90 string Vhost_name; | 90 string Vhost_name; |
91 | 91 |
92 // User's home directory. | 92 // User's home directory. |
93 string Vhome_directory; | 93 string Vhome_directory; |
94 | 94 |
95 // Nonzero means we print | |
96 static bool Vdefault_eval_print_flag = true; | |
97 | |
95 // Nonzero means we're breaking out of a loop or function body. | 98 // Nonzero means we're breaking out of a loop or function body. |
96 extern int breaking; | 99 extern int breaking; |
97 | 100 |
98 // Nonzero means we're returning from a function. | 101 // Nonzero means we're returning from a function. |
99 extern int returning; | 102 extern int returning; |
582 | 585 |
583 return retval; | 586 return retval; |
584 } | 587 } |
585 | 588 |
586 static octave_value_list | 589 static octave_value_list |
587 eval_string (const octave_value& arg, int& parse_status, int nargout) | 590 eval_string (const octave_value& arg, int print, int& parse_status, |
591 int nargout) | |
588 { | 592 { |
589 string s = arg.string_value (); | 593 string s = arg.string_value (); |
590 | 594 |
591 if (error_state) | 595 if (error_state) |
592 { | 596 { |
593 error ("eval: expecting string argument"); | 597 error ("eval: expecting string argument"); |
594 return -1.0; | 598 return -1.0; |
595 } | 599 } |
596 | 600 |
597 // Yes Virginia, we always print here... | 601 return eval_string (s, print, parse_status, nargout); |
598 | |
599 return eval_string (s, 1, parse_status, nargout); | |
600 } | 602 } |
601 | 603 |
602 DEFUN (eval, args, nargout, | 604 DEFUN (eval, args, nargout, |
603 "eval (TRY, CATCH)\n\ | 605 "eval (TRY, CATCH)\n\ |
604 \n\ | 606 \n\ |
619 buffer_error_messages = 1; | 621 buffer_error_messages = 1; |
620 } | 622 } |
621 | 623 |
622 int parse_status = 0; | 624 int parse_status = 0; |
623 | 625 |
624 retval = eval_string (args(0), parse_status, nargout); | 626 retval = eval_string (args(0), 0, parse_status, nargout); |
625 | 627 |
626 if (nargin > 1 && (parse_status != 0 || error_state)) | 628 if (nargin > 1 && (parse_status != 0 || error_state)) |
627 { | 629 { |
628 error_state = 0; | 630 error_state = 0; |
629 | 631 |
632 | 634 |
633 buffer_error_messages = 0; | 635 buffer_error_messages = 0; |
634 bind_global_error_variable (); | 636 bind_global_error_variable (); |
635 add_unwind_protect (clear_global_error_variable, 0); | 637 add_unwind_protect (clear_global_error_variable, 0); |
636 | 638 |
637 eval_string (args(1), parse_status, nargout); | 639 eval_string (args(1), Vdefault_eval_print_flag, |
640 parse_status, nargout); | |
638 | 641 |
639 retval = octave_value_list (); | 642 retval = octave_value_list (); |
640 } | 643 } |
641 | 644 |
642 run_unwind_frame ("Feval"); | 645 run_unwind_frame ("Feval"); |
927 | 930 |
928 return retval; | 931 return retval; |
929 } | 932 } |
930 | 933 |
931 #if defined (__GNUG__) && defined (DEBUG_NEW_DELETE) | 934 #if defined (__GNUG__) && defined (DEBUG_NEW_DELETE) |
935 | |
932 int debug_new_delete = 0; | 936 int debug_new_delete = 0; |
933 | 937 |
934 typedef void (*vfp)(void); | 938 typedef void (*vfp)(void); |
935 extern vfp __new_handler; | 939 extern vfp __new_handler; |
936 | 940 |
962 cout << "__builtin_delete: " << ptr << endl; | 966 cout << "__builtin_delete: " << ptr << endl; |
963 | 967 |
964 if (ptr) | 968 if (ptr) |
965 free (ptr); | 969 free (ptr); |
966 } | 970 } |
971 | |
967 #endif | 972 #endif |
973 | |
974 static int | |
975 default_eval_print_flag (void) | |
976 { | |
977 Vdefault_eval_print_flag = check_preference ("default_eval_print_flag"); | |
978 | |
979 return 0; | |
980 } | |
981 | |
982 void | |
983 symbols_of_toplev (void) | |
984 { | |
985 DEFVAR (default_eval_print_flag, 1.0, 0, default_eval_print_flag, | |
986 "If the value of this variable is nonzero, Octave will print the\n\ | |
987 results of commands executed by eval() that do not end with semicolons."); | |
988 | |
989 } | |
968 | 990 |
969 /* | 991 /* |
970 ;;; Local Variables: *** | 992 ;;; Local Variables: *** |
971 ;;; mode: C++ *** | 993 ;;; mode: C++ *** |
972 ;;; End: *** | 994 ;;; End: *** |