| 286 | } |
| 287 | |
| 288 | bool HandleStringsCommand(std::vector<std::string> const& args, |
| 289 | cmExecutionStatus& status) |
| 290 | { |
| 291 | if (args.size() < 3) { |
| 292 | status.SetError("STRINGS requires a file name and output variable"); |
| 293 | return false; |
| 294 | } |
| 295 | |
| 296 | // Get the file to read. |
| 297 | std::string fileName = args[1]; |
| 298 | if (!cmsys::SystemTools::FileIsFullPath(fileName)) { |
| 299 | fileName = |
| 300 | cmStrCat(status.GetMakefile().GetCurrentSourceDirectory(), '/', args[1]); |
| 301 | } |
| 302 | |
| 303 | // Get the variable in which to store the results. |
| 304 | std::string const& outVar = args[2]; |
| 305 | |
| 306 | // Parse the options. |
| 307 | enum |
| 308 | { |
| 309 | arg_none, |
| 310 | arg_limit_input, |
| 311 | arg_limit_output, |
| 312 | arg_limit_count, |
| 313 | arg_length_minimum, |
| 314 | arg_length_maximum, |
| 315 | arg_maximum, |
| 316 | arg_regex, |
| 317 | arg_encoding |
| 318 | }; |
| 319 | unsigned int minlen = 0; |
| 320 | unsigned int maxlen = 0; |
| 321 | int limit_input = -1; |
| 322 | int limit_output = -1; |
| 323 | unsigned int limit_count = 0; |
| 324 | cmsys::RegularExpression regex; |
| 325 | bool have_regex = false; |
| 326 | bool store_regex = true; |
| 327 | bool newline_consume = false; |
| 328 | bool hex_conversion_enabled = true; |
| 329 | enum |
| 330 | { |
| 331 | encoding_none = cmsys::FStream::BOM_None, |
| 332 | encoding_utf8 = cmsys::FStream::BOM_UTF8, |
| 333 | encoding_utf16le = cmsys::FStream::BOM_UTF16LE, |
| 334 | encoding_utf16be = cmsys::FStream::BOM_UTF16BE, |
| 335 | encoding_utf32le = cmsys::FStream::BOM_UTF32LE, |
| 336 | encoding_utf32be = cmsys::FStream::BOM_UTF32BE |
| 337 | }; |
| 338 | int encoding = encoding_none; |
| 339 | int arg_mode = arg_none; |
| 340 | for (unsigned int i = 3; i < args.size(); ++i) { |
| 341 | if (args[i] == "LIMIT_INPUT") { |
| 342 | arg_mode = arg_limit_input; |
| 343 | } else if (args[i] == "LIMIT_OUTPUT") { |
| 344 | arg_mode = arg_limit_output; |
| 345 | } else if (args[i] == "LIMIT_COUNT") { |
nothing calls this directly
no test coverage detected
searching dependent graphs…