MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / parse_commandline_options

Function parse_commandline_options

Source/astcenccli_toplevel.cpp:464–493  ·  view source on GitHub ↗

* @brief Parse the command line. * * @param argc Command line argument count. * @param[in] argv Command line argument vector. * @param[out] operation Codec operation mode. * @param[out] profile Codec color profile. * * @return 0 if everything is okay, 1 if there is some error */

Source from the content-addressed store, hash-verified

462 * @return 0 if everything is okay, 1 if there is some error
463 */
464static int parse_commandline_options(
465 int argc,
466 char **argv,
467 astcenc_operation& operation,
468 astcenc_profile& profile
469) {
470 assert(argc >= 2); (void)argc;
471
472 profile = ASTCENC_PRF_LDR;
473 operation = ASTCENC_OP_UNKNOWN;
474
475 int modes_count = sizeof(modes) / sizeof(modes[0]);
476 for (int i = 0; i < modes_count; i++)
477 {
478 if (!strcmp(modes[i].opt, argv[1]))
479 {
480 operation = modes[i].operation;
481 profile = modes[i].decode_mode;
482 break;
483 }
484 }
485
486 if (operation == ASTCENC_OP_UNKNOWN)
487 {
488 print_error("ERROR: Unrecognized operation '%s'\n", argv[1]);
489 return 1;
490 }
491
492 return 0;
493}
494
495/**
496 * @brief Initialize the astcenc_config

Callers 1

astcenc_mainFunction · 0.85

Calls 1

print_errorFunction · 0.70

Tested by

no test coverage detected