Lines Matching +full:- +full:c
1 /* Copyright (c) 2002,2004,2005 Joerg Wunsch
2 Copyright (c) 2008 Dmitry Xmelkov
33 /* $Id: vfscanf.c 2191 2010-11-05 13:45:57Z arcanum $ */
51 /* Figure out which multi-byte char support we need */
54 /* need to convert wide chars to multi-byte chars */
57 /* need to convert multi-byte chars to wide chars */
68 # define UNGETC(c,s) ungetwc(c,s) argument
69 # define ISSPACE(c) iswspace(c) argument
72 # define IS_EOF(c) ((c) == WEOF) argument
74 # define IS_WEOF(c) ((c) == WEOF) argument
75 # define ISWSPACE(c) iswspace(c) argument
79 # define IS_EOF(c) ((c) < 0) argument
83 # define UNGETC(c,s) ungetc(c,s) argument
84 # define ISSPACE(c) isspace(c) argument
88 # define IS_WEOF(c) ((c) == WEOF) argument
89 # define ISWSPACE(c) iswspace(c) argument
92 # define IS_WEOF(c) IS_EOF(c) argument
94 # define ISWSPACE(c) ISSPACE(c) argument
104 #define scanf_len(context) ((context)->len)
114 INT c; in scanf_getc() local
116 c = context->unget; in scanf_getc()
117 context->unget = MY_EOF; in scanf_getc()
118 if (IS_EOF(c)) in scanf_getc()
120 c = GETC(stream); in scanf_getc()
121 if (!IS_EOF(c)) in scanf_getc()
123 return c; in scanf_getc()
127 scanf_ungetc(INT c, FILE *stream, scanf_context_t *context) in scanf_ungetc() argument
129 if (!IS_EOF(c)) in scanf_ungetc()
130 --scanf_len(context); in scanf_ungetc()
133 context->unget = c; in scanf_ungetc()
135 UNGETC(c, stream); in scanf_ungetc()
160 case (size_t) -1: in getmb()
162 case (size_t) -2: in getmb()
178 #define getmb(s,c,p,f) scanf_getc(s,c) argument
191 if (s == (size_t) -1) in _putmb()
261 case '-': in conv_int()
265 if (!--width || IS_EOF(i = scanf_getc(stream, context))) in conv_int()
271 /* Leading '0' digit -- check for base indication */ in conv_int()
273 if (!--width || IS_EOF(i = scanf_getc (stream, context))) in conv_int()
280 if (!--width || IS_EOF(i = scanf_getc (stream, context))) in conv_int()
285 if (!--width || IS_EOF(i = scanf_getc (stream, context))) in conv_int()
295 unsigned int c = digit_to_val(i); in conv_int() local
296 if (c >= base) { in conv_int()
301 val = val * base + c; in conv_int()
302 if (!--width) goto putval; in conv_int()
308 if (flags & FL_MINUS) val = -val; in conv_int()
342 * as we re-scan the format string for every input in conv_brk()
350 * bytes, not multi-byte characters. Hence all that we can in conv_brk()
354 * glibc appears to parse the format string as multi-byte in conv_brk()
364 if (f == '-' && !frange) { in conv_brk()
389 width--; in conv_brk()
400 #include "conv_flt.c"
430 (void) va_arg(ap->ap, void *); in skip_to_arg()
451 end-of-file condition on \a stream.
459 - a \c * indicating that the conversion should be performed but
461 be processed from \c ap,
462 - the character \c h indicating that the argument is a pointer
464 - the 2 characters \c hh indicating that the argument is a pointer
466 - the character \c l indicating that the argument is a pointer
468 type conversions), or a pointer to \c double (for floating
475 (except for the <tt>%c</tt> conversion that defaults to 1).
479 - \c % Matches a literal \c % character. This is not a conversion.
480 - \c d Matches an optionally signed decimal integer; the next
481 pointer must be a pointer to \c int.
482 - \c i Matches an optionally signed integer; the next pointer must
483 be a pointer to \c int. The integer is read in base 16 if it
487 - \c o Matches an octal integer; the next pointer must be a pointer to
489 - \c u Matches an optionally signed decimal integer; the next
491 - \c x Matches an optionally signed hexadecimal integer; the next
493 - \c f Matches an optionally signed floating-point number; the next
494 pointer must be a pointer to \c float.
495 - <tt>e, g, F, E, G</tt> Equivalent to \c f.
496 - \c s
497 Matches a sequence of non-white-space characters; the next pointer
498 must be a pointer to \c char, and the array must be large enough to
499 accept all the sequence and the terminating \c NUL character. The
502 - \c c
504 pointer must be a pointer to \c char, and there must be enough room
505 for all the characters (no terminating \c NUL is added). The usual
508 - \c [
510 of accepted characters; the next pointer must be a pointer to \c
512 string, plus a terminating \c NUL character. The usual skip of
515 by the characters between the open bracket \c [ character and a
516 close bracket \c ] character. The set excludes those characters
518 \c ^. To include a close bracket in the set, make it the first
520 position will end the set. The hyphen character \c - is also
524 <tt>[^]0-9-]</tt> means the set of <em>everything except close
529 - \c p
531 next pointer must be a pointer to \c void.
532 - \c n
535 must be a pointer to \c int. This is not a conversion, although it
536 can be suppressed with the \c * flag.
543 conversion. The value \c EOF is returned if an input failure occurs
544 before any conversion such as an end-of-file occurs. If an error or
545 end-of-file occurs after conversion has begun, the number of
549 the floating-point conversions and the width is limited to 255
550 characters. The float-point conversion will be available in the
551 extended version provided by the library \c libscanf_flt.a. Also in
557 -Wl,-u,vfscanf -lscanf_flt -lm
563 provided in the library \c libscanf_min.a, and can be requested using
567 -Wl,-u,vfscanf -lscanf_min -lm
573 UCHAR c; in vfscanf() local
590 allocation with GCC 3.3 - 4.2. Only the GCC 4.3 is good to move it in vfscanf()
592 while ((c = *fmt++) != 0) { in vfscanf()
594 if (ISSPACE (c)) { in vfscanf()
597 } else if (c != '%' in vfscanf()
598 || (c = *fmt++) == '%') in vfscanf()
603 if ((UCHAR)i != c) { in vfscanf()
611 if (c == '*') { in vfscanf()
613 c = *fmt++; in vfscanf()
618 while ((c -= '0') < 10) { in vfscanf()
620 width = width * 10 + c; in vfscanf()
621 c = *fmt++; in vfscanf()
623 c += '0'; in vfscanf()
626 if (c == '$') { in vfscanf()
631 c = *fmt++; in vfscanf()
644 switch (c) { in vfscanf()
647 c = *fmt++; in vfscanf()
648 if (c == 'h') { in vfscanf()
650 c = *fmt++; in vfscanf()
655 c = *fmt++; in vfscanf()
656 if (c == 'l') { in vfscanf()
658 c = *fmt++; in vfscanf()
663 c = *fmt++; in vfscanf()
683 c = *fmt++; \ in vfscanf()
709 if (!c || !strchr (CNV_LIST, c)) in vfscanf()
714 if (c == 'n') { in vfscanf()
719 if (c == 'c') { in vfscanf()
729 } while (--width); in vfscanf()
730 c = 1; /* no matter with smart GCC */ in vfscanf()
733 } else if (c == '[') { in vfscanf()
735 c = (fmt != 0); in vfscanf()
745 switch (c) { in vfscanf()
761 } while (--width); in vfscanf()
763 c = 1; /* no matter with smart GCC */ in vfscanf()
793 c = conv_int (stream, &context, width, addr, flags, base); in vfscanf()
797 c = conv_flt (stream, &context, width, addr, flags); in vfscanf()
823 c = conv_int (stream, &context, width, addr, flags, base); in vfscanf()
828 if (!c) { in vfscanf()
829 if (stream->flags & (__SERR | __SEOF)) in vfscanf()