mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 11:18:30 +00:00
parent
e26bdbec52
commit
f064183646
48 changed files with 1034 additions and 921 deletions
25
libc/stdio/dtoa.c
Normal file
25
libc/stdio/dtoa.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/fmts.h"
|
||||
#include "third_party/gdtoa/gdtoa.h"
|
||||
|
||||
char *__fmt_dtoa(double d0, int mode, int ndigits, int *decpt, int *sign,
|
||||
char **rve) {
|
||||
return dtoa(d0, mode, ndigits, decpt, sign, rve);
|
||||
}
|
|
@ -58,7 +58,7 @@
|
|||
* This means it implies the quoting modifier, wraps the value with
|
||||
* {,u,L}['"] quotes, displays NULL as "NULL" rather than "(null)".
|
||||
*
|
||||
* @see palandprintf() for intuitive reference documentation
|
||||
* @see __fmt() for intuitive reference documentation
|
||||
* @see {,v}{,s{,n},{,{,x}as},f,d}printf
|
||||
*/
|
||||
int(printf)(const char* fmt, ...) {
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
int Printf(const char *, ...);
|
||||
int Sprintf(char *, const char *, ...);
|
||||
|
||||
/*───────────────────────────────────────────────────────────────────────────│─╗
|
||||
│ cosmopolitan § standard i/o ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||
|
|
|
@ -37,7 +37,8 @@ LIBC_STDIO_A_DIRECTDEPS = \
|
|||
LIBC_STR \
|
||||
LIBC_STUBS \
|
||||
LIBC_SYSV \
|
||||
LIBC_SYSV_CALLS
|
||||
LIBC_SYSV_CALLS \
|
||||
THIRD_PARTY_GDTOA
|
||||
|
||||
LIBC_STDIO_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_STDIO_A_DIRECTDEPS),$($(x))))
|
||||
|
|
|
@ -33,7 +33,7 @@ static noinstrument int vfprintfputchar(int c, struct state *st) {
|
|||
|
||||
int(vfprintf)(FILE *f, const char *fmt, va_list va) {
|
||||
struct state st[1] = {{f, 0}};
|
||||
if (palandprintf(vfprintfputchar, st, fmt, va) != -1) {
|
||||
if (__fmt(vfprintfputchar, st, fmt, va) != -1) {
|
||||
return st->n;
|
||||
} else {
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue