MCPcopy Create free account
hub / github.com/OpenPrinting/cups / scan_file

Method scan_file

ppdc/ppdc-source.cxx:2375–3386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2373//
2374
2375void
2376ppdcSource::scan_file(ppdcFile *fp, // I - File to read
2377 ppdcDriver *td, // I - Driver template
2378 bool inc) // I - Including?
2379{
2380 ppdcDriver *d; // Current driver
2381 ppdcGroup *g, // Current group
2382 *mg, // Matching group
2383 *general, // General options group
2384 *install; // Installable options group
2385 ppdcOption *o; // Current option
2386 ppdcChoice *c; // Current choice
2387 char temp[256], // Token from file...
2388 *ptr; // Pointer into token
2389 int isdefault; // Default option?
2390
2391
2392 // Initialize things as needed...
2393 if (inc && td)
2394 {
2395 d = td;
2396 d->retain();
2397 }
2398 else
2399 d = new ppdcDriver(td);
2400
2401 if ((general = d->find_group("General")) == NULL)
2402 {
2403 general = new ppdcGroup("General", NULL);
2404 d->add_group(general);
2405 }
2406
2407 if ((install = d->find_group("InstallableOptions")) == NULL)
2408 {
2409 install = new ppdcGroup("InstallableOptions", "Installable Options");
2410 d->add_group(install);
2411 }
2412
2413 // Loop until EOF or }
2414 o = 0;
2415 g = general;
2416
2417 while (get_token(fp, temp, sizeof(temp)))
2418 {
2419 if (temp[0] == '*')
2420 {
2421 // Mark the next choice as the default
2422 isdefault = 1;
2423
2424 for (ptr = temp; ptr[1]; ptr ++)
2425 *ptr = ptr[1];
2426
2427 *ptr = '\0';
2428 }
2429 else
2430 {
2431 // Don't mark the next choice as the default
2432 isdefault = 0;

Callers

nothing calls this directly

Calls 15

_cups_strcasecmpFunction · 0.85
_cupsLangPrintfFunction · 0.85
retainMethod · 0.80
find_groupMethod · 0.80
add_groupMethod · 0.80
releaseMethod · 0.80
addMethod · 0.80
add_attrMethod · 0.80
add_choiceMethod · 0.80
set_defchoiceMethod · 0.80
add_optionMethod · 0.80
set_default_sizeMethod · 0.80

Tested by

no test coverage detected