| 180 | } |
| 181 | |
| 182 | static int userfunc_getindex(const string &fname) |
| 183 | { |
| 184 | if (fname.length() == 0) |
| 185 | return -1; |
| 186 | |
| 187 | userfunc_collectgarbage(); |
| 188 | |
| 189 | // Pass 1 to see if we have this string already |
| 190 | for (int i = 0, count = userfunctions.size(); i < count; ++i) |
| 191 | { |
| 192 | if (userfunctions[i] == fname) |
| 193 | return i; |
| 194 | } |
| 195 | |
| 196 | // Pass 2 to hunt for gaps. |
| 197 | for (int i = 0, count = userfunctions.size(); i < count; ++i) |
| 198 | { |
| 199 | if (userfunctions[i].empty()) |
| 200 | { |
| 201 | userfunctions[i] = fname; |
| 202 | return i; |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | userfunctions.push_back(fname); |
| 207 | return userfunctions.size() - 1; |
| 208 | } |
| 209 | |
| 210 | // Returns the name of the file that contains macros. |
| 211 | static string get_macro_file() |
no test coverage detected