comparison libinterp/octave.cc @ 15477:8b5fc510c6d6

don't use bind_internal_variable when handling -x option * octave.cc (echo_executing_commands): Delete static variable. (octave_process_command_line): Call Fecho_executing_commands directly here for -H option. (octave_initialize_interpreter): Don't call bind_internal_variable to set echo_executing_commands variable here. (octave_execute_interpreter): Call Fecho_executing_commands directly here instead of using bind_internal_variable.
author John W. Eaton <jwe@octave.org>
date Wed, 03 Oct 2012 02:43:32 -0400
parents 7760d5eff9b2
children b1ff8c83e232
comparison
equal deleted inserted replaced
15476:7760d5eff9b2 15477:8b5fc510c6d6
143 static bool read_history_file = true; 143 static bool read_history_file = true;
144 144
145 // The value of "path" specified on the command line. 145 // The value of "path" specified on the command line.
146 // (--path; -p) 146 // (--path; -p)
147 static std::list<std::string> command_line_path; 147 static std::list<std::string> command_line_path;
148
149 // Flags used to determine what commands should be echoed when they are
150 // parsed and executed.
151 // (--echo-commands; -x)
152 static int echo_executing_commands = 0;
153 148
154 // The file used for the doc string cache. 149 // The file used for the doc string cache.
155 // (--doc-cache-file) 150 // (--doc-cache-file)
156 static std::string doc_cache_file; 151 static std::string doc_cache_file;
157 152
759 case 'q': 754 case 'q':
760 inhibit_startup_message = true; 755 inhibit_startup_message = true;
761 break; 756 break;
762 757
763 case 'x': 758 case 'x':
764 echo_executing_commands 759 {
765 = (ECHO_SCRIPTS | ECHO_FUNCTIONS | ECHO_CMD_LINE); 760 int val = ECHO_SCRIPTS | ECHO_FUNCTIONS | ECHO_CMD_LINE;
761 Fecho_executing_commands (octave_value (val));
762 }
766 break; 763 break;
767 764
768 case 'v': 765 case 'v':
769 print_version_and_exit (); 766 print_version_and_exit ();
770 break; 767 break;
934 931
935 for (std::list<std::string>::const_iterator it = command_line_path.begin (); 932 for (std::list<std::string>::const_iterator it = command_line_path.begin ();
936 it != command_line_path.end (); it++) 933 it != command_line_path.end (); it++)
937 load_path::set_command_line_path (*it); 934 load_path::set_command_line_path (*it);
938 935
939 if (echo_executing_commands)
940 bind_internal_variable ("echo_executing_commands",
941 echo_executing_commands);
942
943 if (! doc_cache_file.empty ()) 936 if (! doc_cache_file.empty ())
944 bind_internal_variable ("doc_cache_file", doc_cache_file); 937 bind_internal_variable ("doc_cache_file", doc_cache_file);
945 938
946 if (! exec_path.empty ()) 939 if (! exec_path.empty ())
947 set_exec_path (exec_path); 940 set_exec_path (exec_path);
1065 { 1058 {
1066 command_editor::blink_matching_paren (false); 1059 command_editor::blink_matching_paren (false);
1067 1060
1068 // FIXME -- is this the right thing to do? 1061 // FIXME -- is this the right thing to do?
1069 1062
1070 bind_internal_variable ("echo_executing_commands", ECHO_CMD_LINE); 1063 Fecho_executing_commands (octave_value (ECHO_CMD_LINE));
1071 } 1064 }
1072 1065
1073 if (octave_embedded) 1066 if (octave_embedded)
1074 { 1067 {
1075 // FIXME -- do we need to do any cleanup here before 1068 // FIXME -- do we need to do any cleanup here before