OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | 5 |
6 /* | 6 /* |
7 * Scan functions for NSPR types | 7 * Scan functions for NSPR types |
8 * | 8 * |
9 * Author: Wan-Teh Chang | 9 * Author: Wan-Teh Chang |
10 * | 10 * |
11 * Acknowledgment: The implementation is inspired by the source code | 11 * Acknowledgment: The implementation is inspired by the source code |
12 * in P.J. Plauger's "The Standard C Library," Prentice-Hall, 1992. | 12 * in P.J. Plauger's "The Standard C Library," Prentice-Hall, 1992. |
13 */ | 13 */ |
14 | 14 |
15 #include <limits.h> | 15 #include <limits.h> |
16 #include <ctype.h> | 16 #include <ctype.h> |
17 #include <string.h> | 17 #include <string.h> |
18 #include <stdlib.h> | 18 #include <stdlib.h> |
19 #ifdef SUNOS4 | |
20 #include "md/sunos4.h" /* for strtoul */ | |
21 #endif | |
22 #include "prprf.h" | 19 #include "prprf.h" |
23 #include "prdtoa.h" | 20 #include "prdtoa.h" |
24 #include "prlog.h" | 21 #include "prlog.h" |
25 #include "prerror.h" | 22 #include "prerror.h" |
26 | 23 |
27 /* | 24 /* |
28 * A function that reads a character from 'stream'. | 25 * A function that reads a character from 'stream'. |
29 * Returns the character read, or EOF if end of stream is reached. | 26 * Returns the character read, or EOF if end of stream is reached. |
30 */ | 27 */ |
31 typedef int (*_PRGetCharFN)(void *stream); | 28 typedef int (*_PRGetCharFN)(void *stream); |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 ScanfState state; | 625 ScanfState state; |
629 | 626 |
630 state.get = &StringGetChar; | 627 state.get = &StringGetChar; |
631 state.unget = &StringUngetChar; | 628 state.unget = &StringUngetChar; |
632 state.stream = (void *) &buf; | 629 state.stream = (void *) &buf; |
633 va_start(state.ap, fmt); | 630 va_start(state.ap, fmt); |
634 rv = DoScanf(&state, fmt); | 631 rv = DoScanf(&state, fmt); |
635 va_end(state.ap); | 632 va_end(state.ap); |
636 return rv; | 633 return rv; |
637 } | 634 } |
OLD | NEW |