Lines Matching defs:opt

374 print_option (SANE_Device * device, int opt_num, const SANE_Option_Descriptor *opt)
380 if (opt->type == SANE_TYPE_GROUP){
381 printf (" %s:\n", opt->title);
386 if((opt->cap & SANE_CAP_SOFT_SELECT) && (opt->cap & SANE_CAP_HARD_SELECT)){
392 if((opt->cap & SANE_CAP_SOFT_SELECT) && !(opt->cap & SANE_CAP_SOFT_DETECT)){
397 if(opt->cap & SANE_CAP_HARD_SELECT && !(opt->cap & SANE_CAP_SOFT_DETECT)){
403 if(!(opt->cap &
410 if ( !strcmp (opt->name, "x")
411 || !strcmp (opt->name, "y")
412 || !strcmp (opt->name, "t")
413 || !strcmp (opt->name, "l"))
414 printf (" -%s", opt->name);
416 printf (" --%s", opt->name);
419 if (opt->type == SANE_TYPE_BOOL)
422 if (opt->cap & SANE_CAP_AUTOMATIC)
426 else if (opt->type != SANE_TYPE_BUTTON)
429 if (opt->cap & SANE_CAP_AUTOMATIC)
434 switch (opt->constraint_type)
437 switch (opt->type)
451 if (opt->type != SANE_TYPE_STRING
452 && opt->size > (SANE_Int) sizeof (SANE_Word))
458 if (!opt->constraint.range)
464 if (opt->type == SANE_TYPE_INT)
466 if (!strcmp (opt->name, "x"))
468 printf ("%d..%d", opt->constraint.range->min,
469 opt->constraint.range->max - tl_x);
471 else if (!strcmp (opt->name, "y"))
473 printf ("%d..%d", opt->constraint.range->min,
474 opt->constraint.range->max - tl_y);
478 printf ("%d..%d", opt->constraint.range->min,
479 opt->constraint.range->max);
481 print_unit (opt->unit);
482 if (opt->size > (SANE_Int) sizeof(SANE_Word))
484 if (opt->constraint.range->quant)
485 printf (" (in steps of %d)", opt->constraint.range->quant);
489 if (!strcmp (opt->name, "x"))
491 printf ("%g..%g", SANE_UNFIX(opt->constraint.range->min),
492 SANE_UNFIX(opt->constraint.range->max - tl_x));
494 else if (!strcmp (opt->name, "y"))
496 printf ("%g..%g", SANE_UNFIX(opt->constraint.range->min),
497 SANE_UNFIX(opt->constraint.range->max - tl_y));
501 printf ("%g..%g", SANE_UNFIX(opt->constraint.range->min),
502 SANE_UNFIX(opt->constraint.range->max));
504 print_unit (opt->unit);
505 if (opt->size > (SANE_Int) sizeof(SANE_Word))
507 if (opt->constraint.range->quant)
509 SANE_UNFIX(opt->constraint.range->quant));
517 if (!opt->constraint.word_list || (opt->constraint.word_list[0] < 1))
523 for (i = 0; i < opt->constraint.word_list[0]; ++i)
530 if (opt->type == SANE_TYPE_INT)
531 printf ("%d", opt->constraint.word_list[i + 1]);
533 printf ("%g", SANE_UNFIX(opt->constraint.word_list[i + 1]));
537 print_unit (opt->unit);
538 if (opt->size > (SANE_Int) sizeof (SANE_Word))
544 if (!opt->constraint.string_list || !opt->constraint.string_list[0])
550 for (i = 0; opt->constraint.string_list[i]; ++i)
555 fputs (opt->constraint.string_list[i], stdout);
563 if (opt->type == SANE_TYPE_STRING || opt->size == sizeof (SANE_Word))
565 if (SANE_OPTION_IS_ACTIVE (opt->cap))
567 void *val = alloca (opt->size);
571 switch (opt->type)
578 if (strcmp (opt->name, "l") == 0)
583 else if (strcmp (opt->name, "t") == 0)
588 else if (strcmp (opt->name, "x") == 0)
593 else if (strcmp (opt->name, "y") == 0)
604 if (strcmp (opt->name, "l") == 0)
609 else if (strcmp (opt->name, "t") == 0)
614 else if (strcmp (opt->name, "x") == 0)
619 else if (strcmp (opt->name, "y") == 0)
640 if (!SANE_OPTION_IS_ACTIVE (opt->cap))
643 else if(opt->cap & SANE_CAP_HARD_SELECT)
646 else if(!(opt->cap & SANE_CAP_SOFT_SELECT) && (opt->cap & SANE_CAP_SOFT_DETECT))
649 else if (opt->cap & SANE_CAP_ADVANCED)
656 start = opt->desc;
657 for (str = opt->desc; *str; ++str)
702 parse_scalar (const SANE_Option_Descriptor * opt, const char *str,
708 if (opt->type == SANE_TYPE_FIXED)
717 prog_name, opt->name, str);
722 switch (opt->unit)
756 prog_name, opt->name, str);
807 parse_vector (const SANE_Option_Descriptor * opt, const char *str,
826 "(rest of option: %s)\n", prog_name, opt->name, str);
838 prog_name, opt->name, index, (long) vector_length - 1);
843 str = parse_scalar (opt, str, &value);
851 prog_name, opt->name, str);
883 fprintf (stderr, "%s: value for --%s is: ", prog_name, opt->name);
885 if (opt->type == SANE_TYPE_FIXED)
896 const SANE_Option_Descriptor *opt;
901 opt = sane_get_option_descriptor (device, 0);
902 if (opt == NULL)
921 opt = sane_get_option_descriptor (device, i);
922 if (opt == NULL)
930 if ((opt->type == SANE_TYPE_GROUP) || (opt->name == NULL))
935 all_options[option_count].name = (const char *) opt->name;
939 if (opt->type == SANE_TYPE_BOOL)
941 else if (opt->type == SANE_TYPE_BUTTON)
947 if ((opt->type == SANE_TYPE_FIXED || opt->type == SANE_TYPE_INT)
948 && opt->size == sizeof (SANE_Int)
949 && (opt->unit == SANE_UNIT_DPI)
950 && (strcmp (opt->name, SANE_NAME_SCAN_RESOLUTION) == 0))
956 if ((opt->type == SANE_TYPE_FIXED || opt->type == SANE_TYPE_INT)
957 && opt->size == sizeof (SANE_Int)
958 && (opt->unit == SANE_UNIT_MM || opt->unit == SANE_UNIT_PIXEL))
960 if (strcmp (opt->name, SANE_NAME_SCAN_BR_X) == 0)
965 window_option[0] = *opt;
970 else if (strcmp (opt->name, SANE_NAME_SCAN_BR_Y) == 0)
975 window_option[1] = *opt;
980 else if (strcmp (opt->name, SANE_NAME_SCAN_TL_X) == 0)
984 window_option[2] = *opt;
987 else if (strcmp (opt->name, SANE_NAME_SCAN_TL_Y) == 0)
991 window_option[3] = *opt;
1022 const SANE_Option_Descriptor *opt;
1027 opt = sane_get_option_descriptor (device, optnum);
1028 if (!opt)
1036 if (!SANE_OPTION_IS_ACTIVE (opt->cap))
1040 prog_name, opt->name);
1044 if (opt->size == sizeof (SANE_Word) && opt->type != SANE_TYPE_STRING)
1052 prog_name, opt->name, sane_strstatus (status));
1056 if ((info & SANE_INFO_INEXACT) && opt->size == sizeof (SANE_Word))
1058 if (opt->type == SANE_TYPE_INT)
1060 prog_name, opt->name, orig, *(SANE_Word *) valuep);
1061 else if (opt->type == SANE_TYPE_FIXED)
1063 prog_name, opt->name,
1076 const SANE_Option_Descriptor *opt;
1082 opt = sane_get_option_descriptor (device, optnum);
1084 if (!SANE_OPTION_IS_SETTABLE (opt->cap))
1087 prog_name, opt->name);
1090 if (!SANE_OPTION_IS_ACTIVE (opt->cap))
1093 prog_name, opt->name);
1097 if ((opt->cap & SANE_CAP_AUTOMATIC) && optarg &&
1106 prog_name, opt->name, sane_strstatus (status));
1113 switch (opt->type)
1126 prog_name, opt->name, optarg);
1135 vector_length = opt->size / sizeof (SANE_Word);
1146 parse_vector (opt, optarg, vector, vector_length);
1151 valuep = malloc (opt->size);
1157 strncpy (valuep, optarg, opt->size);
1158 ((char *) valuep)[opt->size - 1] = 0;
1167 prog_name, opt->type);
1171 if (opt->type == SANE_TYPE_STRING && valuep)
2017 const SANE_Option_Descriptor *opt;
2021 opt = 0;
2026 opt = window_option + j;
2028 if (!opt)
2029 opt = sane_get_option_descriptor (device, i);
2032 if (opt->name == NULL)
2035 if (ro || SANE_OPTION_IS_SETTABLE (opt->cap)
2036 || opt->type == SANE_TYPE_GROUP)
2037 print_option (device, i, opt);