Mercurial > octave-nkf
comparison src/variables.cc @ 3355:c4983fc7318f
[project @ 1999-11-18 05:20:50 by jwe]
author | jwe |
---|---|
date | Thu, 18 Nov 1999 05:20:52 +0000 |
parents | 2efa28a91e7a |
children | 4f40efa995c1 |
comparison
equal
deleted
inserted
replaced
3354:87721841efd7 | 3355:c4983fc7318f |
---|---|
101 { | 101 { |
102 symbol_record *sr = global_sym_tab->lookup (s); | 102 symbol_record *sr = global_sym_tab->lookup (s); |
103 return (sr && sr->is_text_function ()); | 103 return (sr && sr->is_text_function ()); |
104 } | 104 } |
105 | 105 |
106 // Is this a mapper function? | 106 // Is this a built-in function? |
107 | 107 |
108 bool | 108 bool |
109 is_builtin_function_name (const string& s) | 109 is_builtin_function_name (const string& s) |
110 { | 110 { |
111 symbol_record *sr = global_sym_tab->lookup (s); | 111 symbol_record *sr = global_sym_tab->lookup (s); |
1073 idx++; | 1073 idx++; |
1074 exclusive = 1; | 1074 exclusive = 1; |
1075 } | 1075 } |
1076 } | 1076 } |
1077 | 1077 |
1078 int lcount = 0; | |
1079 int gcount = 0; | |
1080 int fcount = 0; | |
1081 | |
1082 string_vector lvars; | 1078 string_vector lvars; |
1083 string_vector gvars; | 1079 string_vector gvars; |
1084 string_vector fcns; | 1080 string_vector fcns; |
1085 | 1081 |
1086 if (argc > 0) | 1082 if (argc > 0) |
1087 { | 1083 { |
1088 string_vector tmp; | 1084 string_vector tmp; |
1089 | 1085 |
1090 lvars = curr_sym_tab->name_list | 1086 lvars = curr_sym_tab->name_list |
1091 (lcount, tmp, false, SYMTAB_VARIABLES, SYMTAB_LOCAL_SCOPE); | 1087 (tmp, false, SYMTAB_VARIABLES, SYMTAB_LOCAL_SCOPE); |
1092 | 1088 |
1093 gvars = curr_sym_tab->name_list | 1089 gvars = curr_sym_tab->name_list |
1094 (gcount, tmp, false, SYMTAB_VARIABLES, SYMTAB_GLOBAL_SCOPE); | 1090 (tmp, false, SYMTAB_VARIABLES, SYMTAB_GLOBAL_SCOPE); |
1095 | 1091 |
1096 fcns = global_sym_tab->name_list | 1092 fcns = global_sym_tab->name_list |
1097 (fcount, tmp, false, | 1093 (tmp, false, |
1098 symbol_record::USER_FUNCTION|symbol_record::DLD_FUNCTION, | 1094 symbol_record::USER_FUNCTION|symbol_record::DLD_FUNCTION, |
1099 SYMTAB_ALL_SCOPES); | 1095 SYMTAB_ALL_SCOPES); |
1100 } | 1096 } |
1101 | 1097 |
1102 // XXX FIXME XXX -- this needs to be optimized to avoid the | 1098 // XXX FIXME XXX -- this needs to be optimized to avoid the |
1109 | 1105 |
1110 if (! patstr.empty ()) | 1106 if (! patstr.empty ()) |
1111 { | 1107 { |
1112 glob_match pattern (patstr); | 1108 glob_match pattern (patstr); |
1113 | 1109 |
1114 int i; | 1110 int lcount = lvars.length (); |
1115 for (i = 0; i < lcount; i++) | 1111 |
1112 for (int i = 0; i < lcount; i++) | |
1116 { | 1113 { |
1117 string nm = lvars[i]; | 1114 string nm = lvars[i]; |
1118 int match = pattern.match (nm); | 1115 int match = pattern.match (nm); |
1119 if ((exclusive && ! match) || (! exclusive && match)) | 1116 if ((exclusive && ! match) || (! exclusive && match)) |
1120 curr_sym_tab->clear (nm); | 1117 curr_sym_tab->clear (nm); |
1121 } | 1118 } |
1122 | 1119 |
1123 int count; | 1120 int gcount = gvars.length (); |
1124 for (i = 0; i < gcount; i++) | 1121 for (int i = 0; i < gcount; i++) |
1125 { | 1122 { |
1126 string nm = gvars[i]; | 1123 string nm = gvars[i]; |
1127 int match = pattern.match (nm); | 1124 int match = pattern.match (nm); |
1128 if ((exclusive && ! match) || (! exclusive && match)) | 1125 if ((exclusive && ! match) || (! exclusive && match)) |
1129 { | 1126 { |
1130 count = curr_sym_tab->clear (nm); | 1127 int count = curr_sym_tab->clear (nm); |
1131 if (count > 0) | 1128 if (count > 0) |
1132 global_sym_tab->clear (nm, clear_user_functions); | 1129 global_sym_tab->clear (nm, clear_user_functions); |
1133 } | 1130 } |
1134 } | 1131 } |
1135 | 1132 |
1136 for (i = 0; i < fcount; i++) | 1133 int fcount = fcns.length (); |
1134 for (int i = 0; i < fcount; i++) | |
1137 { | 1135 { |
1138 string nm = fcns[i]; | 1136 string nm = fcns[i]; |
1139 int match = pattern.match (nm); | 1137 int match = pattern.match (nm); |
1140 if ((exclusive && ! match) || (! exclusive && match)) | 1138 if ((exclusive && ! match) || (! exclusive && match)) |
1141 { | 1139 { |
1142 count = curr_sym_tab->clear (nm); | 1140 curr_sym_tab->clear (nm); |
1143 global_sym_tab->clear (nm, clear_user_functions); | 1141 global_sym_tab->clear (nm, clear_user_functions); |
1144 } | 1142 } |
1145 } | 1143 } |
1146 } | 1144 } |
1147 } | 1145 } |