MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / parse

Method parse

external/basisu/basisu_tool.cpp:299–782  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297 }
298
299 bool parse(int arg_c, const char **arg_v)
300 {
301 int arg_index = 1;
302 while (arg_index < arg_c)
303 {
304 const char *pArg = arg_v[arg_index];
305 const int num_remaining_args = arg_c - (arg_index + 1);
306 int arg_count = 1;
307
308#define REMAINING_ARGS_CHECK(n) if (num_remaining_args < (n)) { error_printf("Error: Expected %u values to follow %s!\n", n, pArg); return false; }
309
310 if (strcasecmp(pArg, "-ktx2") == 0)
311 {
312 m_ktx2_mode = true;
313 }
314 else if (strcasecmp(pArg, "-ktx2_no_zstandard") == 0)
315 {
316 m_ktx2_zstandard = false;
317 }
318 else if (strcasecmp(pArg, "-ktx2_zstandard_level") == 0)
319 {
320 REMAINING_ARGS_CHECK(1);
321 m_ktx2_zstandard_level = atoi(arg_v[arg_index + 1]);
322 arg_count++;
323 }
324 else if (strcasecmp(pArg, "-ktx2_animdata_duration") == 0)
325 {
326 REMAINING_ARGS_CHECK(1);
327 m_ktx2_animdata_duration = atoi(arg_v[arg_index + 1]);
328 arg_count++;
329 }
330 else if (strcasecmp(pArg, "-ktx2_animdata_timescale") == 0)
331 {
332 REMAINING_ARGS_CHECK(1);
333 m_ktx2_animdata_timescale = atoi(arg_v[arg_index + 1]);
334 arg_count++;
335 }
336 else if (strcasecmp(pArg, "-ktx2_animdata_loopcount") == 0)
337 {
338 REMAINING_ARGS_CHECK(1);
339 m_ktx2_animdata_loopcount = atoi(arg_v[arg_index + 1]);
340 arg_count++;
341 }
342 else if (strcasecmp(pArg, "-compress") == 0)
343 m_mode = cCompress;
344 else if (strcasecmp(pArg, "-compare") == 0)
345 m_mode = cCompare;
346 else if (strcasecmp(pArg, "-split") == 0)
347 m_mode = cSplitImage;
348 else if (strcasecmp(pArg, "-combine") == 0)
349 m_mode = cCombineImages;
350 else if (strcasecmp(pArg, "-unpack") == 0)
351 m_mode = cUnpack;
352 else if (strcasecmp(pArg, "-validate") == 0)
353 m_mode = cValidate;
354 else if (strcasecmp(pArg, "-info") == 0)
355 m_mode = cInfo;
356 else if (strcasecmp(pArg, "-version") == 0)

Callers 5

main_internalFunction · 0.45
three.min.jsFile · 0.45
RlFunction · 0.45
cFunction · 0.45
GLTFLoader.jsFile · 0.45

Calls 5

enable_debug_printfFunction · 0.85
error_printfFunction · 0.85
stringClass · 0.50
push_backMethod · 0.45
was_changedMethod · 0.45

Tested by

no test coverage detected