1 /* __gmp_sscanf_funs -- support for formatted input from a string.
3 THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST
4 CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
5 FUTURE GNU MP RELEASES.
7 Copyright 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
9 This file is part of the GNU MP Library.
11 The GNU MP Library is free software; you can redistribute it and/or modify
12 it under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 3 of the License, or (at your
14 option) any later version.
16 The GNU MP Library is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
19 License for more details.
21 You should have received a copy of the GNU Lesser General Public License
22 along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
32 scan (const char **sp, const char *fmt, ...)
38 ret = vsscanf(*sp, fmt, ap);
45 scan (const char **sp, const char *fmt, ...)
52 p1 = va_arg (ap, void *);
53 p2 = va_arg (ap, void *);
55 ret = sscanf (*sp, fmt, p1, p2);
64 step (const char **sp, int n)
68 /* shouldn't push us past the end of the string */
72 for (i = 0; i < n; i++)
73 ASSERT ((*sp)[i] != '\0');
86 c = (unsigned char) *s++;
94 unget (int c, const char **sp)
104 ASSERT ((unsigned char) *s == c);
108 const struct gmp_doscan_funs_t __gmp_sscanf_funs = {
109 (gmp_doscan_scan_t) scan,
110 (gmp_doscan_step_t) step,
111 (gmp_doscan_get_t) get,
112 (gmp_doscan_unget_t) unget,