• Home
  • Raw
  • Download

Lines Matching +full:diff +full:- +full:sequences

4  * Copyright 2007-2017 by Apple Inc.
5 * Copyright 1997-2007 by Easy Software Products.
14 #include "cups-private.h"
15 #include "debug-internal.h"
28 * 'cupsAddIntegerOption()' - Add an integer option to an option array.
36 int /* O - Number of options */
38 const char *name, /* I - Name of option */ in cupsAddIntegerOption()
39 int value, /* I - Value of option */ in cupsAddIntegerOption()
40 int num_options, /* I - Number of options */ in cupsAddIntegerOption()
41 cups_option_t **options) /* IO - Pointer to options */ in cupsAddIntegerOption()
53 * 'cupsAddOption()' - Add an option to an option array.
59 int /* O - Number of options */
60 cupsAddOption(const char *name, /* I - Name of option */ in cupsAddOption()
61 const char *value, /* I - Value of option */ in cupsAddOption()
62 int num_options,/* I - Number of options */ in cupsAddOption()
63 cups_option_t **options) /* IO - Pointer to options */ in cupsAddOption()
67 diff; /* Result of search */ in cupsAddOption() local
79 num_options = cupsRemoveOption("print-quality", num_options, options); in cupsAddOption()
80 else if (!_cups_strcasecmp(name, "print-quality")) in cupsAddOption()
90 diff = 1; in cupsAddOption()
94 insert = cups_find_option(name, num_options, *options, num_options - 1, in cupsAddOption()
95 &diff); in cupsAddOption()
97 if (diff > 0) in cupsAddOption()
101 if (diff) in cupsAddOption()
126 (int)(num_options - insert))); in cupsAddOption()
127 … memmove(temp + insert + 1, temp + insert, (size_t)(num_options - insert) * sizeof(cups_option_t)); in cupsAddOption()
131 temp->name = _cupsStrAlloc(name); in cupsAddOption()
144 _cupsStrFree(temp->value); in cupsAddOption()
147 temp->value = _cupsStrAlloc(value); in cupsAddOption()
156 * 'cupsFreeOptions()' - Free all memory used by options.
161 int num_options, /* I - Number of options */ in cupsFreeOptions()
162 cups_option_t *options) /* I - Pointer to options */ in cupsFreeOptions()
183 * 'cupsGetIntegerOption()' - Get an integer option value.
191 int /* O - Option value or @code INT_MIN@ */
193 const char *name, /* I - Name of option */ in cupsGetIntegerOption()
194 int num_options, /* I - Number of options */ in cupsGetIntegerOption()
195 cups_option_t *options) /* I - Options */ in cupsGetIntegerOption()
215 * 'cupsGetOption()' - Get an option value.
218 const char * /* O - Option value or @code NULL@ */
219 cupsGetOption(const char *name, /* I - Name of option */ in cupsGetOption()
220 int num_options,/* I - Number of options */ in cupsGetOption()
221 cups_option_t *options) /* I - Options */ in cupsGetOption()
223 int diff, /* Result of comparison */ in cupsGetOption() local
235 match = cups_find_option(name, num_options, options, -1, &diff); in cupsGetOption()
237 if (!diff) in cupsGetOption()
249 * 'cupsParseOptions()' - Parse options from a command-line argument.
251 * This function converts space-delimited name/value pairs according
254 * intact - use @code cupsParseOptions@ on the value to extract the
258 int /* O - Number of options found */
260 const char *arg, /* I - Argument to parse */ in cupsParseOptions()
261 int num_options, /* I - Number of options */ in cupsParseOptions()
262 cups_option_t **options) /* O - Options found */ in cupsParseOptions()
307 if ((ptr = copyarg + strlen(copyarg) - 1) > copyarg && *ptr == '}') in cupsParseOptions()
332 * Get the name up to a SPACE, =, or end-of-string... in cupsParseOptions()
417 depth --; in cupsParseOptions()
431 * Normal space-delimited string... in cupsParseOptions()
477 * 'cupsRemoveOption()' - Remove an option from an option array.
482 int /* O - New number of options */
484 const char *name, /* I - Option name */ in cupsRemoveOption()
485 int num_options, /* I - Current number of options */ in cupsRemoveOption()
486 cups_option_t **options) /* IO - Options */ in cupsRemoveOption()
508 for (i = num_options, option = *options; i > 0; i --, option ++) in cupsRemoveOption()
509 if (!_cups_strcasecmp(name, option->name)) in cupsRemoveOption()
520 num_options --; in cupsRemoveOption()
521 i --; in cupsRemoveOption()
523 _cupsStrFree(option->name); in cupsRemoveOption()
524 _cupsStrFree(option->value); in cupsRemoveOption()
540 * '_cupsGet1284Values()' - Get 1284 device ID keys and values.
546 int /* O - Number of key/value pairs */
548 const char *device_id, /* I - IEEE-1284 device ID string */ in _cupsGet1284Values()
549 cups_option_t **values) /* O - Array of key/value pairs */ in _cupsGet1284Values()
569 * repeating sequences of: in _cupsGet1284Values()
584 if (ptr < (key + sizeof(key) - 1)) in _cupsGet1284Values()
590 while (ptr > key && _cups_isspace(ptr[-1])) in _cupsGet1284Values()
591 ptr --; in _cupsGet1284Values()
603 if (ptr < (value + sizeof(value) - 1)) in _cupsGet1284Values()
606 while (ptr > value && _cups_isspace(ptr[-1])) in _cupsGet1284Values()
607 ptr --; in _cupsGet1284Values()
622 * 'cups_compare_options()' - Compare two options.
625 static int /* O - Result of comparison */
626 cups_compare_options(cups_option_t *a, /* I - First option */ in cups_compare_options()
627 cups_option_t *b) /* I - Second option */ in cups_compare_options()
629 return (_cups_strcasecmp(a->name, b->name)); in cups_compare_options()
634 * 'cups_find_option()' - Find an option using a binary search.
637 static int /* O - Index of match */
639 const char *name, /* I - Option name */ in cups_find_option()
640 int num_options, /* I - Number of options */ in cups_find_option()
641 cups_option_t *options, /* I - Options */ in cups_find_option()
642 int prev, /* I - Previous index */ in cups_find_option()
643 int *rdiff) /* O - Difference of match */ in cups_find_option()
648 diff; /* Result of comparison */ in cups_find_option() local
668 if ((diff = cups_compare_options(&key, options + prev)) == 0 || in cups_find_option()
669 (diff < 0 && prev == 0) || in cups_find_option()
670 (diff > 0 && prev == (num_options - 1))) in cups_find_option()
672 *rdiff = diff; in cups_find_option()
675 else if (diff < 0) in cups_find_option()
691 right = num_options - 1; in cups_find_option()
701 right = num_options - 1; in cups_find_option()
707 diff = cups_compare_options(&key, options + current); in cups_find_option()
709 if (diff == 0) in cups_find_option()
711 else if (diff < 0) in cups_find_option()
716 while ((right - left) > 1); in cups_find_option()
718 if (diff != 0) in cups_find_option()
724 if ((diff = cups_compare_options(&key, options + left)) <= 0) in cups_find_option()
728 diff = cups_compare_options(&key, options + right); in cups_find_option()
737 *rdiff = diff; in cups_find_option()