Annotation of OpenXM_contrib/gmp/printf/obprntffuns.c, Revision 1.1
1.1 ! ohara 1: /* __gmp_obstack_printf_funs -- support for gmp_obstack_printf and
! 2: gmp_obstack_vprintf.
! 3:
! 4: THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST
! 5: CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
! 6: FUTURE GNU MP RELEASES.
! 7:
! 8: Copyright 2001 Free Software Foundation, Inc.
! 9:
! 10: This file is part of the GNU MP Library.
! 11:
! 12: The GNU MP Library is free software; you can redistribute it and/or modify
! 13: it under the terms of the GNU Lesser General Public License as published by
! 14: the Free Software Foundation; either version 2.1 of the License, or (at your
! 15: option) any later version.
! 16:
! 17: The GNU MP Library is distributed in the hope that it will be useful, but
! 18: WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
! 19: or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
! 20: License for more details.
! 21:
! 22: You should have received a copy of the GNU Lesser General Public License
! 23: along with the GNU MP Library; see the file COPYING.LIB. If not, write to
! 24: the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
! 25: MA 02111-1307, USA. */
! 26:
! 27: #include "config.h"
! 28:
! 29: #if HAVE_OBSTACK_VPRINTF
! 30:
! 31: #define _GNU_SOURCE /* ask glibc <stdio.h> for obstack_vprintf */
! 32:
! 33: #if HAVE_STDARG
! 34: #include <stdarg.h>
! 35: #else
! 36: #include <varargs.h>
! 37: #endif
! 38:
! 39: #include <stdio.h> /* for obstack_vprintf */
! 40: #include <string.h>
! 41: #include <obstack.h>
! 42:
! 43: #include "gmp.h"
! 44: #include "gmp-impl.h"
! 45:
! 46:
! 47: static int
! 48: gmp_obstack_memory (struct obstack *ob, const char *ptr, size_t len)
! 49: {
! 50: obstack_grow (ob, ptr, len);
! 51: return len;
! 52: }
! 53:
! 54: static int
! 55: gmp_obstack_reps (struct obstack *ob, int c, int reps)
! 56: {
! 57: obstack_blank (ob, reps);
! 58: memset ((char *) obstack_next_free(ob) - reps, c, reps);
! 59: return reps;
! 60: }
! 61:
! 62: const struct doprnt_funs_t __gmp_obstack_printf_funs = {
! 63: (doprnt_format_t) obstack_vprintf,
! 64: (doprnt_memory_t) gmp_obstack_memory,
! 65: (doprnt_reps_t) gmp_obstack_reps
! 66: };
! 67:
! 68: #endif /* HAVE_OBSTACK_VPRINTF */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>