------------------------------------------------------------------------------
| 2241 | |
| 2242 | //------------------------------------------------------------------------------ |
| 2243 | int vtkFunctionParser::FindPositionInOriginalFunction(const int& pos) |
| 2244 | { |
| 2245 | // Copy the value. |
| 2246 | int origPos = pos; |
| 2247 | |
| 2248 | if (this->Function && this->FunctionWithSpaces) |
| 2249 | { |
| 2250 | size_t withSpacesLen = strlen(this->FunctionWithSpaces); |
| 2251 | size_t withoutSpacesLen = strlen(this->Function); |
| 2252 | |
| 2253 | int counter = 0; |
| 2254 | for (size_t i = 0; i < withSpacesLen; ++i) |
| 2255 | { |
| 2256 | // If we have covered all the characters excluding the spaces. |
| 2257 | if (counter == static_cast<int>(withoutSpacesLen) || counter == pos) |
| 2258 | { |
| 2259 | return origPos; |
| 2260 | } |
| 2261 | |
| 2262 | char currentChar = this->FunctionWithSpaces[i]; |
| 2263 | if (currentChar == ' ') |
| 2264 | { |
| 2265 | // Every time we hit a whitespace increment the origPos |
| 2266 | // as the pos is counted without spaces. |
| 2267 | ++origPos; |
| 2268 | continue; |
| 2269 | } |
| 2270 | |
| 2271 | // This needs to be incremented for all the characters except |
| 2272 | // spaces. |
| 2273 | ++counter; |
| 2274 | } |
| 2275 | } |
| 2276 | |
| 2277 | return origPos; |
| 2278 | } |
| 2279 | |
| 2280 | //------------------------------------------------------------------------------ |
| 2281 | void vtkFunctionParser::UpdateNeededVariables() |