comparison src/variables.cc @ 11586:12df7854fa7c

strip trailing whitespace from source files
author John W. Eaton <jwe@octave.org>
date Thu, 20 Jan 2011 17:24:59 -0500
parents 1e4dfc7a9487
children 4ced6b90fffb
comparison
equal deleted inserted replaced
11585:1473d0cf86d2 11586:12df7854fa7c
162 eval_string (cmd, true, parse_status, 0); 162 eval_string (cmd, true, parse_status, 0);
163 163
164 if (parse_status == 0) 164 if (parse_status == 0)
165 { 165 {
166 retval = is_valid_function (fname, warn_for, 0); 166 retval = is_valid_function (fname, warn_for, 0);
167 167
168 if (! retval) 168 if (! retval)
169 { 169 {
170 error ("%s: `%s' is not valid as a function", 170 error ("%s: `%s' is not valid as a function",
171 warn_for.c_str (), fname.c_str ()); 171 warn_for.c_str (), fname.c_str ());
172 return retval; 172 return retval;
969 } 969 }
970 970
971 if (param.command == 's' && param.modifier == 'c') 971 if (param.command == 's' && param.modifier == 'c')
972 { 972 {
973 int a, b; 973 int a, b;
974 974
975 if (param.modifier == 'c') 975 if (param.modifier == 'c')
976 { 976 {
977 a = param.first_parameter_length - param.balance; 977 a = param.first_parameter_length - param.balance;
978 a = (a < 0 ? 0 : a); 978 a = (a < 0 ? 0 : a);
979 b = param.parameter_length - a - param.text . length (); 979 b = param.parameter_length - a - param.text . length ();
1150 break; 1150 break;
1151 1151
1152 case 't': 1152 case 't':
1153 os << varval.type_name (); 1153 os << varval.type_name ();
1154 break; 1154 break;
1155 1155
1156 default: 1156 default:
1157 error ("whos_line_format: command `%c' unknown", 1157 error ("whos_line_format: command `%c' unknown",
1158 param.command); 1158 param.command);
1159 } 1159 }
1160 1160
1537 int i; 1537 int i;
1538 for (i = 1; i < argc; i++) 1538 for (i = 1; i < argc; i++)
1539 { 1539 {
1540 if (argv[i] == "-file") 1540 if (argv[i] == "-file")
1541 { 1541 {
1542 // FIXME. This is an inefficient manner to implement this as the 1542 // FIXME. This is an inefficient manner to implement this as the
1543 // variables are loaded in to a temporary context and then treated. 1543 // variables are loaded in to a temporary context and then treated.
1544 // It would be better to refecat symbol_info_list to not store the 1544 // It would be better to refecat symbol_info_list to not store the
1545 // symbol records and then use it in load-save.cc (do_load) to 1545 // symbol records and then use it in load-save.cc (do_load) to
1546 // implement this option there so that the variables are never 1546 // implement this option there so that the variables are never
1547 // stored at all. 1547 // stored at all.
1548 if (i == argc - 1) 1548 if (i == argc - 1)
1549 error ("whos: -file argument must be followed by a file name"); 1549 error ("whos: -file argument must be followed by a file name");
1550 else 1550 else
1551 { 1551 {
1567 1567
1568 feval ("load", octave_value (nm), 0); 1568 feval ("load", octave_value (nm), 0);
1569 1569
1570 if (! error_state) 1570 if (! error_state)
1571 { 1571 {
1572 std::string newmsg = std::string ("Variables in the file ") + 1572 std::string newmsg = std::string ("Variables in the file ") +
1573 nm + ":\n\n"; 1573 nm + ":\n\n";
1574 1574
1575 retval = do_who (i, argv, return_list, verbose, newmsg); 1575 retval = do_who (i, argv, return_list, verbose, newmsg);
1576 } 1576 }
1577 } 1577 }
1600 else 1600 else
1601 { 1601 {
1602 pats.resize (++npats); 1602 pats.resize (++npats);
1603 pats[0] = "*"; 1603 pats[0] = "*";
1604 } 1604 }
1605 1605
1606 symbol_info_list symbol_stats; 1606 symbol_info_list symbol_stats;
1607 std::list<std::string> symbol_names; 1607 std::list<std::string> symbol_names;
1608 1608
1609 for (int j = 0; j < npats; j++) 1609 for (int j = 0; j < npats; j++)
1610 { 1610 {
1883 args(0) = val; 1883 args(0) = val;
1884 1884
1885 feval (fname, args, 0); 1885 feval (fname, args, 0);
1886 } 1886 }
1887 1887
1888 void 1888 void
1889 mlock (void) 1889 mlock (void)
1890 { 1890 {
1891 octave_function *fcn = octave_call_stack::current (); 1891 octave_function *fcn = octave_call_stack::current ();
1892 1892
1893 if (fcn) 1893 if (fcn)
1894 fcn->lock (); 1894 fcn->lock ();
1895 else 1895 else
1896 error ("mlock: invalid use outside a function"); 1896 error ("mlock: invalid use outside a function");
1897 } 1897 }
1898 1898
1899 void 1899 void
1900 munlock (const std::string& nm) 1900 munlock (const std::string& nm)
1901 { 1901 {
1902 octave_value val = symbol_table::find_function (nm); 1902 octave_value val = symbol_table::find_function (nm);
1903 1903
1904 if (val.is_defined ()) 1904 if (val.is_defined ())
2022 } 2022 }
2023 2023
2024 // Deleting names from the symbol tables. 2024 // Deleting names from the symbol tables.
2025 2025
2026 static inline bool 2026 static inline bool
2027 name_matches_any_pattern (const std::string& nm, const string_vector& argv, 2027 name_matches_any_pattern (const std::string& nm, const string_vector& argv,
2028 int argc, int idx, bool have_regexp = false) 2028 int argc, int idx, bool have_regexp = false)
2029 { 2029 {
2030 bool retval = false; 2030 bool retval = false;
2031 2031
2032 for (int k = idx; k < argc; k++) 2032 for (int k = idx; k < argc; k++)
2323 if (! error_state) 2323 if (! error_state)
2324 { 2324 {
2325 if (argc == 1) 2325 if (argc == 1)
2326 { 2326 {
2327 do_clear_globals (argv, argc, 1); 2327 do_clear_globals (argv, argc, 1);
2328 do_clear_variables (argv, argc, 1); 2328 do_clear_variables (argv, argc, 1);
2329 } 2329 }
2330 else 2330 else
2331 { 2331 {
2332 int idx = 0; 2332 int idx = 0;
2333 2333