summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fscanf.c
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabrielftg@linux.ibm.com>2019-07-11 11:47:16 -0300
committerGabriel F. T. Gomes <gabrielftg@linux.ibm.com>2019-11-22 18:13:01 -0300
commita5b15bdec8015bac998f727d97667acfb17e90c0 (patch)
treef95bcaf33cefad9142b66552e73b135b545cb018 /sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fscanf.c
parentc2f959ed5f244dd4130bcbaab53e0f3ffc49831e (diff)
downloadglibc-a5b15bdec8015bac998f727d97667acfb17e90c0.tar.gz
ldbl-128ibm-compat: Add regular character scanning functions
The 'mode' argument to __vfscanf_internal allows the selection of the long double format for all long double arguments requested by the format string. Currently, there are two possibilities: long double with the same format as double or long double as something else. The 'something else' format varies between architectures, and on powerpc64le, it means IBM Extended Precision format. In preparation for the third option of long double format on powerpc64le, this patch uses the new mode mask, SCANF_LDBL_USES_FLOAT128, which tells __vfscanf_internal to call __strtof128_internal, instead of __strtold_internal, and save the output into a _Float128 variable. Tested for powerpc64le. Reviewed-By: Paul E. Murphy <murphyp@linux.ibm.com>
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fscanf.c')
-rw-r--r--sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fscanf.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fscanf.c
new file mode 100644
index 0000000000..f9de397c1d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fscanf.c
@@ -0,0 +1,34 @@
+/* Wrapper for fscanf. IEEE128 version.
+ Copyright (C) 2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include <libio/libioP.h>
+
+extern int
+___ieee128_fscanf (FILE *fp, const char *format, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, format);
+ done = __vfscanf_internal (fp, format, arg, SCANF_LDBL_USES_FLOAT128);
+ va_end (arg);
+
+ return done;
+}
+strong_alias (___ieee128_fscanf, __fscanfieee128)