1
/* __gmp_sprintf_funs -- support for gmp_sprintf and gmp_vsprintf.
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 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 2.1 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; see the file COPYING.LIB. If not, write to
23
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
24
MA 02111-1307, USA. */
42
/* The data parameter "bufp" points to a "char *buf" which is the next
43
character to be written, having started as the destination from the
44
application. This is then increased each time output is produced. */
47
/* If vsprintf returns -1 then pass it upwards. It doesn't matter that
48
"*bufp" is ruined in this case, since gmp_doprint will bail out
49
immediately anyway. */
51
gmp_sprintf_format (char **bufp, const char *fmt, va_list ap)
55
vsprintf (buf, fmt, ap);
62
gmp_sprintf_memory (char **bufp, const char *str, size_t len)
66
memcpy (buf, str, len);
71
gmp_sprintf_reps (char **bufp, int c, int reps)
76
memset (buf, c, reps);
81
gmp_sprintf_final (char **bufp, int c, int reps)
88
const struct doprnt_funs_t __gmp_sprintf_funs = {
89
(doprnt_format_t) gmp_sprintf_format,
90
(doprnt_memory_t) gmp_sprintf_memory,
91
(doprnt_reps_t) gmp_sprintf_reps,
92
(doprnt_final_t) gmp_sprintf_final