📄 nldbl-compat.c
字号:
/* *printf* family compatibility routines for IEEE double as long double Copyright (C) 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@cygnus.com>, 2006. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */#include <stdarg.h>#include <stdio.h>#include <libioP.h>#include <wchar.h>#include <printf.h>#include <monetary.h>#include <locale/localeinfo.h>#include <sys/syslog.h>#include <bits/libc-lock.h>#include "nldbl-compat.h"libc_hidden_proto (__nldbl_vfprintf)libc_hidden_proto (__nldbl_vsscanf)libc_hidden_proto (__nldbl_vsprintf)libc_hidden_proto (__nldbl_vfscanf)libc_hidden_proto (__nldbl_vfwscanf)libc_hidden_proto (__nldbl_vdprintf)libc_hidden_proto (__nldbl_vswscanf)libc_hidden_proto (__nldbl_vfwprintf)libc_hidden_proto (__nldbl_vswprintf)libc_hidden_proto (__nldbl_vsnprintf)libc_hidden_proto (__nldbl_vasprintf)libc_hidden_proto (__nldbl_obstack_vprintf)libc_hidden_proto (__nldbl___vfwprintf_chk)libc_hidden_proto (__nldbl___vsnprintf_chk)libc_hidden_proto (__nldbl___vfprintf_chk)libc_hidden_proto (__nldbl___vsyslog_chk)libc_hidden_proto (__nldbl___vsprintf_chk)libc_hidden_proto (__nldbl___vswprintf_chk)libc_hidden_proto (__nldbl___vstrfmon)libc_hidden_proto (__nldbl___vstrfmon_l)static void__nldbl_cleanup (void *arg){ __no_long_double = 0;}#define set_no_long_double() \ __libc_cleanup_push (__nldbl_cleanup, NULL); __no_long_double = 1#define clear_no_long_double() \ __no_long_double = 0; __libc_cleanup_pop (0)/* Compatibility with IEEE double as long double. IEEE quad long double is used by default for most programs, so we don't need to split this into one file per function for the sake of statically linked programs. */intattribute_compat_text_section__nldbl___asprintf (char **string_ptr, const char *fmt, ...){ va_list arg; int done; va_start (arg, fmt); done = __nldbl_vasprintf (string_ptr, fmt, arg); va_end (arg); return done;}weak_alias (__nldbl___asprintf, __nldbl_asprintf)intattribute_compat_text_section__nldbl_dprintf (int d, const char *fmt, ...){ va_list arg; int done; va_start (arg, fmt); done = __nldbl_vdprintf (d, fmt, arg); va_end (arg); return done;}intattribute_compat_text_section__nldbl_fprintf (FILE *stream, const char *fmt, ...){ va_list arg; int done; va_start (arg, fmt); done = __nldbl_vfprintf (stream, fmt, arg); va_end (arg); return done;}weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)intattribute_compat_text_section weak_function__nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...){ va_list arg; int done; va_start (arg, fmt); done = __nldbl_vfwprintf (stream, fmt, arg); va_end (arg); return done;}intattribute_compat_text_section__nldbl_printf (const char *fmt, ...){ va_list arg; int done; va_start (arg, fmt); done = __nldbl_vfprintf (stdout, fmt, arg); va_end (arg); return done;}strong_alias (__nldbl_printf, __nldbl__IO_printf)intattribute_compat_text_section__nldbl_sprintf (char *s, const char *fmt, ...){ va_list arg; int done; va_start (arg, fmt); done = __nldbl_vsprintf (s, fmt, arg); va_end (arg); return done;}strong_alias (__nldbl_sprintf, __nldbl__IO_sprintf)intattribute_compat_text_section__nldbl_vfprintf (FILE *s, const char *fmt, va_list ap){ int done; set_no_long_double (); done = INTUSE(_IO_vfprintf) (s, fmt, ap); clear_no_long_double (); return done;}libc_hidden_def (__nldbl_vfprintf)strong_alias (__nldbl_vfprintf, __nldbl__IO_vfprintf)intattribute_compat_text_section__nldbl__IO_vsprintf (char *string, const char *fmt, va_list ap){ int done; __no_long_double = 1; done = INTUSE(_IO_vsprintf) (string, fmt, ap); __no_long_double = 0; return done;}weak_alias (__nldbl__IO_vsprintf, __nldbl_vsprintf)libc_hidden_def (__nldbl_vsprintf)intattribute_compat_text_section__nldbl_obstack_vprintf (struct obstack *obstack, const char *fmt, va_list ap){ int done; __no_long_double = 1; done = _IO_obstack_vprintf (obstack, fmt, ap); __no_long_double = 0; return done;}libc_hidden_def (__nldbl_obstack_vprintf)intattribute_compat_text_section__nldbl_obstack_printf (struct obstack *obstack, const char *fmt, ...){ int result; va_list ap; va_start (ap, fmt); result = __nldbl_obstack_vprintf (obstack, fmt, ap); va_end (ap); return result;}intattribute_compat_text_section weak_function__nldbl_snprintf (char *s, size_t maxlen, const char *fmt, ...){ va_list arg; int done; va_start (arg, fmt); done = __nldbl_vsnprintf (s, maxlen, fmt, arg); va_end (arg); return done;}intattribute_compat_text_section__nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...){ va_list arg; int done; va_start (arg, fmt); done = __nldbl_vswprintf (s, n, fmt, arg); va_end (arg); return done;}intattribute_compat_text_section weak_function__nldbl_vasprintf (char **result_ptr, const char *fmt, va_list ap){ int res; __no_long_double = 1; res = _IO_vasprintf (result_ptr, fmt, ap); __no_long_double = 0; return res;}libc_hidden_def (__nldbl_vasprintf)intattribute_compat_text_section__nldbl_vdprintf (int d, const char *fmt, va_list arg){ int res; set_no_long_double (); res = _IO_vdprintf (d, fmt, arg); clear_no_long_double (); return res;}libc_hidden_def (__nldbl_vdprintf)intattribute_compat_text_section weak_function__nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap){ int res; set_no_long_double (); res = _IO_vfwprintf (s, fmt, ap); clear_no_long_double (); return res;}libc_hidden_def (__nldbl_vfwprintf)intattribute_compat_text_section__nldbl_vprintf (const char *fmt, va_list ap){ return __nldbl_vfprintf (stdout, fmt, ap);}intattribute_compat_text_section__nldbl_vsnprintf (char *string, size_t maxlen, const char *fmt, va_list ap){ int res; __no_long_double = 1; res = _IO_vsnprintf (string, maxlen, fmt, ap); __no_long_double = 0; return res;}libc_hidden_def (__nldbl_vsnprintf)weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)intattribute_compat_text_section weak_function__nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt, va_list ap){ int res; __no_long_double = 1; res = _IO_vswprintf (string, maxlen, fmt, ap); __no_long_double = 0; return res;}libc_hidden_def (__nldbl_vswprintf)intattribute_compat_text_section__nldbl_vwprintf (const wchar_t *fmt, va_list ap){ return __nldbl_vfwprintf (stdout, fmt, ap);}intattribute_compat_text_section__nldbl_wprintf (const wchar_t *fmt, ...){ va_list arg; int done; va_start (arg, fmt); done = __nldbl_vfwprintf (stdout, fmt, arg); va_end (arg); return done;}intattribute_compat_text_section__nldbl__IO_vfscanf (FILE *s, const char *fmt, _IO_va_list ap, int *errp){ int res; set_no_long_double (); res = INTUSE(_IO_vfscanf) (s, fmt, ap, errp); clear_no_long_double (); return res;}intattribute_compat_text_section__nldbl___vfscanf (FILE *s, const char *fmt, va_list ap){ int res; set_no_long_double (); res = INTUSE(_IO_vfscanf) (s, fmt, ap, NULL); clear_no_long_double (); return res;}weak_alias (__nldbl___vfscanf, __nldbl_vfscanf)libc_hidden_def (__nldbl_vfscanf)intattribute_compat_text_section__nldbl_sscanf (const char *s, const char *fmt, ...){ va_list arg; int done; va_start (arg, fmt); done = __nldbl_vsscanf (s, fmt, arg); va_end (arg); return done;}strong_alias (__nldbl_sscanf, __nldbl__IO_sscanf)intattribute_compat_text_section__nldbl___vsscanf (const char *string, const char *fmt, va_list ap){ int res; __no_long_double = 1; res = _IO_vsscanf (string, fmt, ap); __no_long_double = 0; return res;}weak_alias (__nldbl___vsscanf, __nldbl_vsscanf)libc_hidden_def (__nldbl_vsscanf)intattribute_compat_text_section weak_function__nldbl_vscanf (const char *fmt, va_list ap){ return __nldbl_vfscanf (stdin, fmt, ap);}intattribute_compat_text_section__nldbl_fscanf (FILE *stream, const char *fmt, ...){ va_list arg; int done; va_start (arg, fmt); done = __nldbl_vfscanf (stream, fmt, arg); va_end (arg); return done;}intattribute_compat_text_section__nldbl_scanf (const char *fmt, ...){ va_list arg; int done; va_start (arg, fmt); done = __nldbl_vfscanf (stdin, fmt, arg); va_end (arg); return done;}intattribute_compat_text_section__nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap){ int res; set_no_long_double (); res = _IO_vfwscanf (s, fmt, ap, NULL); clear_no_long_double (); return res;}libc_hidden_def (__nldbl_vfwscanf)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -