Fold conv package into fmt

Both packages had nearly identical dependency requirements, so merging
them should help reduce the complexity of the build graph.
main
Justine Tunney 2020-12-09 15:04:54 -08:00
parent 978b7858f9
commit 1fc91f3580
203 changed files with 352 additions and 563 deletions

View File

@ -104,7 +104,6 @@ include ape/lib/apelib.mk # │
include ape/ape.mk #─┘
include libc/sysv/sysv.mk #─┐
include libc/nt/nt.mk # ├──system
include libc/conv/conv.mk # │
include libc/fmt/fmt.mk # │
include libc/rand/rand.mk #─┘
include libc/calls/calls.mk #─┐
@ -186,7 +185,6 @@ include test/libc/dns/test.mk
include test/libc/rand/test.mk
include test/libc/time/test.mk
include test/libc/stdio/test.mk
include test/libc/conv/test.mk
include test/libc/release/test.mk
include test/libc/test.mk
include test/ape/lib/test.mk
@ -251,7 +249,6 @@ COSMOPOLITAN_OBJECTS = \
LIBC_BITS \
LIBC_CALLS \
LIBC_CALLS_HEFTY \
LIBC_CONV \
LIBC_CRYPTO \
LIBC_DNS \
LIBC_ELF \
@ -286,7 +283,6 @@ COSMOPOLITAN_HEADERS = \
LIBC_ALG \
LIBC_BITS \
LIBC_CALLS \
LIBC_CONV \
LIBC_CRYPTO \
LIBC_DNS \
LIBC_ELF \

View File

@ -33,7 +33,7 @@
#include "dsp/mpeg/mpeg.h"
#include "dsp/mpeg/video.h"
#include "libc/bits/initializer.internal.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/log/log.h"
#include "libc/macros.h"
#include "libc/math.h"

View File

@ -9,8 +9,8 @@
#endif
#include "libc/calls/calls.h"
#include "libc/calls/hefty/copyfile.h"
#include "libc/conv/conv.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/runtime/gc.h"
#include "libc/runtime/runtime.h"

View File

@ -46,7 +46,6 @@ EXAMPLES_DIRECTDEPS = \
LIBC_BITS \
LIBC_CALLS \
LIBC_CALLS_HEFTY \
LIBC_CONV \
LIBC_FMT \
LIBC_LOG \
LIBC_LOG_ASAN \

View File

@ -10,7 +10,7 @@
#include "libc/bits/bits.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/itimerval.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/limits.h"
#include "libc/log/check.h"
#include "libc/log/color.internal.h"

View File

@ -12,7 +12,7 @@
#include "libc/alg/critbit0.h"
#include "libc/bits/bits.h"
#include "libc/calls/calls.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/macros.h"

View File

@ -18,8 +18,8 @@
#include "libc/calls/hefty/spawn.h"
#include "libc/calls/struct/itimerval.h"
#include "libc/calls/struct/winsize.h"
#include "libc/conv/conv.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/inttypes.h"
#include "libc/log/check.h"

View File

@ -17,14 +17,16 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/runtime/interruptiblecall.h"
#include "libc/stdio/stdio.h"
#include "libc/sysv/consts/sig.h"
struct InterruptibleCall icall;
static intptr_t peek(intptr_t *addr) { return *addr; }
static intptr_t peek(intptr_t *addr) {
return *addr;
}
int main(int argc, char *argv[]) {
int i;

View File

@ -7,7 +7,7 @@
http://creativecommons.org/publicdomain/zero/1.0/ │
*/
#endif
#include "libc/conv/itoa.h"
#include "libc/fmt/itoa.h"
#include "libc/math.h"
#include "libc/stdio/stdio.h"

View File

@ -10,7 +10,7 @@
#include "libc/alg/alg.h"
#include "libc/calls/calls.h"
#include "libc/calls/hefty/spawn.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/limits.h"
#include "libc/log/check.h"
#include "libc/runtime/gc.h"

View File

@ -120,9 +120,9 @@
#include "libc/calls/struct/stat.h"
#include "libc/calls/struct/tms.h"
#include "libc/calls/termios.h"
#include "libc/conv/conv.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/limits.h"
#include "libc/log/log.h"

View File

@ -17,7 +17,9 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/macros.h"
int(abs)(int x) { return ABS(x); }
int(abs)(int x) {
return ABS(x);
}

View File

@ -39,15 +39,14 @@ LIBC_CALLS_A_CHECKS = \
LIBC_CALLS_A_DIRECTDEPS = \
LIBC_FMT \
LIBC_STR \
LIBC_RAND \
LIBC_CONV \
LIBC_STUBS \
LIBC_NEXGEN32E \
LIBC_NT_NTDLL \
LIBC_NT_ADVAPI32 \
LIBC_NT_KERNEL32 \
LIBC_NT_KERNELBASE \
LIBC_NT_NTDLL \
LIBC_RAND \
LIBC_STR \
LIBC_STUBS \
LIBC_SYSV_CALLS \
LIBC_SYSV

View File

@ -23,8 +23,8 @@
#include "libc/calls/internal.h"
#include "libc/calls/struct/timespec.h"
#include "libc/calls/struct/timeval.h"
#include "libc/conv/conv.h"
#include "libc/dce.h"
#include "libc/fmt/conv.h"
#include "libc/mach.h"
#include "libc/nt/struct/filetime.h"
#include "libc/nt/struct/systemtime.h"

View File

@ -20,9 +20,9 @@
#include "libc/bits/progn.internal.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/conv/conv.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/nt/ntdll.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"

View File

@ -20,7 +20,7 @@
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/internal.h"
#include "libc/calls/struct/stat.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/nt/enum/fileflagandattributes.h"
#include "libc/nt/enum/fileinfobyhandleclass.h"
#include "libc/nt/enum/filetype.h"

View File

@ -21,7 +21,7 @@
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/calls/kntprioritycombos.internal.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/nexgen32e/ffs.h"
#include "libc/nt/enum/processcreationflags.h"
#include "libc/nt/enum/threadpriority.h"

View File

@ -20,7 +20,7 @@
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/calls/struct/rusage.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/nt/accounting.h"
#include "libc/nt/runtime.h"
#include "libc/nt/thread.h"

View File

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "libc/calls/calls.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/sysv/consts/prio.h"
#include "libc/sysv/errfuns.h"

View File

@ -19,7 +19,7 @@
*/
#include "libc/calls/internal.h"
#include "libc/calls/struct/timeval.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/nt/struct/filetime.h"
#include "libc/nt/struct/systemtime.h"
#include "libc/nt/synchronization.h"

View File

@ -22,7 +22,7 @@
#include "libc/calls/hefty/ntspawn.h"
#include "libc/calls/hefty/spawn.h"
#include "libc/calls/internal.h"
#include "libc/conv/itoa.h"
#include "libc/fmt/itoa.h"
#include "libc/nt/enum/filemapflags.h"
#include "libc/nt/enum/pageflags.h"
#include "libc/nt/enum/startf.h"

View File

@ -37,7 +37,6 @@ LIBC_CALLS_HEFTY_A_CHECKS = \
LIBC_CALLS_HEFTY_A_DIRECTDEPS = \
LIBC_ALG \
LIBC_CALLS \
LIBC_CONV \
LIBC_FMT \
LIBC_MEM \
LIBC_NEXGEN32E \

View File

@ -20,7 +20,7 @@
#include "libc/alg/arraylist2.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/hefty/ntspawn.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/macros.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/hascharacter.internal.h"

View File

@ -19,7 +19,7 @@
*/
#include "libc/alg/arraylist2.internal.h"
#include "libc/calls/hefty/ntspawn.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/macros.h"
#include "libc/mem/mem.h"
#include "libc/str/oldutf16.internal.h"

View File

@ -24,7 +24,7 @@
#include "libc/calls/calls.h"
#include "libc/calls/hefty/ntspawn.h"
#include "libc/calls/internal.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/nt/enum/processcreationflags.h"
#include "libc/nt/process.h"
#include "libc/nt/runtime.h"

View File

@ -22,8 +22,8 @@
#include "libc/calls/hefty/internal.h"
#include "libc/calls/hefty/spawn.h"
#include "libc/calls/internal.h"
#include "libc/conv/conv.h"
#include "libc/dce.h"
#include "libc/fmt/conv.h"
#include "libc/mem/mem.h"
#include "libc/paths.h"
#include "libc/runtime/runtime.h"

View File

@ -21,8 +21,8 @@
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/conv/conv.h"
#include "libc/dce.h"
#include "libc/fmt/conv.h"
#include "libc/log/log.h"
#include "libc/nexgen32e/vendor.internal.h"
#include "libc/nt/struct/teb.h"

View File

@ -19,7 +19,7 @@
*/
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/sysv/consts/prio.h"
static int clamp(int p) {

View File

@ -20,10 +20,10 @@
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/conv/conv.h"
#include "libc/conv/isslash.internal.h"
#include "libc/conv/itoa.h"
#include "libc/dce.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/isslash.internal.h"
#include "libc/fmt/itoa.h"
#include "libc/nt/createfile.h"
#include "libc/nt/enum/accessmask.h"
#include "libc/nt/enum/creationdisposition.h"

View File

@ -20,8 +20,8 @@
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/calls/struct/itimerval.h"
#include "libc/conv/conv.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/log/check.h"
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/nt/files.h"

View File

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "libc/calls/internal.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/nt/createfile.h"
#include "libc/nt/enum/accessmask.h"
#include "libc/nt/enum/creationdisposition.h"

View File

@ -20,7 +20,7 @@
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/calls/struct/rusage.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/macros.h"
#include "libc/nt/accounting.h"
#include "libc/nt/enum/status.h"

View File

@ -1,85 +0,0 @@
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
#
# SYNOPSIS
#
# Cosmopolitan Data Conversions
#
# DESCRIPTION
#
# This package provides functions that convert between data types.
# It's intended to be lower level than the memory and formatting
# libraries.
PKGS += LIBC_CONV
LIBC_CONV_ARTIFACTS += LIBC_CONV_A
LIBC_CONV = $(LIBC_CONV_A_DEPS) $(LIBC_CONV_A)
LIBC_CONV_A = o/$(MODE)/libc/conv/conv.a
LIBC_CONV_A_FILES := $(wildcard libc/conv/*)
LIBC_CONV_A_HDRS = $(filter %.h,$(LIBC_CONV_A_FILES))
LIBC_CONV_A_SRCS_S = $(filter %.S,$(LIBC_CONV_A_FILES))
LIBC_CONV_A_SRCS_C = $(filter %.c,$(LIBC_CONV_A_FILES))
LIBC_CONV_A_SRCS = \
$(LIBC_CONV_A_SRCS_S) \
$(LIBC_CONV_A_SRCS_C)
LIBC_CONV_A_OBJS = \
$(LIBC_CONV_A_SRCS:%=o/$(MODE)/%.zip.o) \
$(LIBC_CONV_A_SRCS_S:%.S=o/$(MODE)/%.o) \
$(LIBC_CONV_A_SRCS_C:%.c=o/$(MODE)/%.o)
LIBC_CONV_A_CHECKS = \
$(LIBC_CONV_A).pkg \
$(LIBC_CONV_A_HDRS:%=o/$(MODE)/%.ok)
LIBC_CONV_A_DIRECTDEPS = \
LIBC_NEXGEN32E \
LIBC_STUBS \
LIBC_STR \
LIBC_TINYMATH \
LIBC_SYSV \
THIRD_PARTY_COMPILER_RT
LIBC_CONV_A_DEPS := \
$(call uniq,$(foreach x,$(LIBC_CONV_A_DIRECTDEPS),$($(x))))
$(LIBC_CONV_A): libc/conv/ \
$(LIBC_CONV_A).pkg \
$(LIBC_CONV_A_OBJS)
$(LIBC_CONV_A).pkg: \
$(LIBC_CONV_A_OBJS) \
$(foreach x,$(LIBC_CONV_A_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/libc/conv/dosdatetimetounix.o \
o/$(MODE)/libc/conv/itoa64radix10.greg.o \
o/$(MODE)/libc/conv/timetofiletime.o \
o/$(MODE)/libc/conv/filetimetotime.o \
o/$(MODE)/libc/conv/timespectofiletime.o \
o/$(MODE)/libc/conv/filetimetotimespec.o \
o/$(MODE)/libc/conv/filetimetotimeval.o: \
OVERRIDE_CFLAGS += \
-O3
o/$(MODE)/libc/conv/itoa64radix10.greg.o \
o/$(MODE)/libc/conv/itoa128radix10.greg.o: \
OVERRIDE_CFLAGS += \
-fwrapv
$(LIBC_CONV_A_OBJS): \
OVERRIDE_CFLAGS += \
$(NO_MAGIC)
LIBC_CONV_LIBS = $(foreach x,$(LIBC_CONV_ARTIFACTS),$($(x)))
LIBC_CONV_SRCS = $(foreach x,$(LIBC_CONV_ARTIFACTS),$($(x)_SRCS))
LIBC_CONV_HDRS = $(foreach x,$(LIBC_CONV_ARTIFACTS),$($(x)_HDRS))
LIBC_CONV_BINS = $(foreach x,$(LIBC_CONV_ARTIFACTS),$($(x)_BINS))
LIBC_CONV_CHECKS = $(foreach x,$(LIBC_CONV_ARTIFACTS),$($(x)_CHECKS))
LIBC_CONV_OBJS = $(foreach x,$(LIBC_CONV_ARTIFACTS),$($(x)_OBJS))
LIBC_CONV_TESTS = $(foreach x,$(LIBC_CONV_ARTIFACTS),$($(x)_TESTS))
$(LIBC_CONV_OBJS): $(BUILD_FILES) libc/conv/conv.mk
.PHONY: o/$(MODE)/libc/conv
o/$(MODE)/libc/conv: $(LIBC_CONV_CHECKS)

View File

@ -1,8 +0,0 @@
#ifndef COSMOPOLITAN_LIBC_CONV_ISSLASH_H_
#define COSMOPOLITAN_LIBC_CONV_ISSLASH_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
forceinline bool isslash(int c) { return c == '/' || c == '\\'; }
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CONV_ISSLASH_H_ */

View File

@ -19,10 +19,10 @@
*/
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/conv/conv.h"
#include "libc/dns/dns.h"
#include "libc/dns/hoststxt.h"
#include "libc/dns/resolvconf.h"
#include "libc/fmt/conv.h"
#include "libc/mem/mem.h"
#include "libc/sock/sock.h"
#include "libc/str/str.h"

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
int(abs)(int x) {
return 0 < x ? x : -x;

View File

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/conv/strlol.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/strlol.internal.h"
#include "libc/limits.h"
/**

View File

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/conv/strlol.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/strlol.internal.h"
#include "libc/limits.h"
long atol(const char *s) {

View File

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/conv/strlol.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/strlol.internal.h"
#include "libc/limits.h"
long long atoll(const char *s) {

View File

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/conv/isslash.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/isslash.internal.h"
#include "libc/str/str.h"
/**

View File

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/conv/isslash.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/isslash.internal.h"
/**
* Returns pointer to last filename component in path.

View File

@ -1,5 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_CONV_CONV_H_
#define COSMOPOLITAN_LIBC_CONV_CONV_H_
#ifndef COSMOPOLITAN_LIBC_FMT_CONV_H_
#define COSMOPOLITAN_LIBC_FMT_CONV_H_
#include "libc/calls/struct/timespec.h"
#include "libc/calls/struct/timeval.h"
#include "libc/nt/struct/filetime.h"
@ -103,4 +103,4 @@ intmax_t __imaxabs(intmax_t) libcesque pureconst;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CONV_CONV_H_ */
#endif /* COSMOPOLITAN_LIBC_FMT_CONV_H_ */

View File

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "libc/calls/struct/timeval.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/time/time.h"
long convertmicros(const struct timeval *tv, long tick) {

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/str/str.h"
#define ISDELIM(c) (c == '/' || c == '\\' || c == '.')

View File

@ -17,6 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
div_t(div)(int num, int den) { return div(num, den); }
div_t(div)(int num, int den) {
return div(num, den);
}

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/macros.h"
#include "libc/time/time.h"

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/nt/struct/filetime.h"
int64_t filetimetotime(struct NtFileTime ft) {

View File

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "libc/calls/calls.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/nt/struct/filetime.h"
/**

View File

@ -19,7 +19,7 @@
*/
#include "libc/calls/calls.h"
#include "libc/calls/struct/timeval.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/nt/struct/filetime.h"
void FileTimeToTimeVal(struct timeval *tv, struct NtFileTime ft) {

View File

@ -34,12 +34,12 @@ LIBC_FMT_A_CHECKS = \
$(LIBC_FMT_A_HDRS:%=o/$(MODE)/%.ok)
LIBC_FMT_A_DIRECTDEPS = \
LIBC_STUBS \
LIBC_STR \
LIBC_TINYMATH \
LIBC_NEXGEN32E \
LIBC_NT_KERNELBASE \
LIBC_STR \
LIBC_STUBS \
LIBC_SYSV \
LIBC_TINYMATH \
THIRD_PARTY_COMPILER_RT
LIBC_FMT_A_DEPS := \
@ -57,6 +57,21 @@ $(LIBC_FMT_A_OBJS): \
OVERRIDE_CFLAGS += \
-fno-jump-tables
o/$(MODE)/libc/fmt/dosdatetimetounix.o \
o/$(MODE)/libc/fmt/itoa64radix10.greg.o \
o/$(MODE)/libc/fmt/timetofiletime.o \
o/$(MODE)/libc/fmt/filetimetotime.o \
o/$(MODE)/libc/fmt/timespectofiletime.o \
o/$(MODE)/libc/fmt/filetimetotimespec.o \
o/$(MODE)/libc/fmt/filetimetotimeval.o: \
OVERRIDE_CFLAGS += \
-O3
o/$(MODE)/libc/fmt/itoa64radix10.greg.o \
o/$(MODE)/libc/fmt/itoa128radix10.greg.o: \
OVERRIDE_CFLAGS += \
-fwrapv
LIBC_FMT_LIBS = $(foreach x,$(LIBC_FMT_ARTIFACTS),$($(x)))
LIBC_FMT_SRCS = $(foreach x,$(LIBC_FMT_ARTIFACTS),$($(x)_SRCS))
LIBC_FMT_HDRS = $(foreach x,$(LIBC_FMT_ARTIFACTS),$($(x)_HDRS))

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/macros.h"
intmax_t(imaxabs)(intmax_t x) {

View File

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/conv/isslash.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/isslash.internal.h"
/**
* Returns true if pathname could be absolute on any known platform.

View File

@ -0,0 +1,10 @@
#ifndef COSMOPOLITAN_LIBC_FMT_ISSLASH_H_
#define COSMOPOLITAN_LIBC_FMT_ISSLASH_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
forceinline bool isslash(int c) {
return c == '/' || c == '\\';
}
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_FMT_ISSLASH_H_ */

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
STATIC_YOINK("ntoa");

View File

@ -1,5 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_CONV_ITOA_H_
#define COSMOPOLITAN_LIBC_CONV_ITOA_H_
#ifndef COSMOPOLITAN_LIBC_FMT_ITOA_H_
#define COSMOPOLITAN_LIBC_FMT_ITOA_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/*───────────────────────────────────────────────────────────────────────────│─╗
@ -29,4 +29,4 @@ size_t uint128toarray_radix10(uint128_t, char *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CONV_ITOA_H_ */
#endif /* COSMOPOLITAN_LIBC_FMT_ITOA_H_ */

View File

@ -18,8 +18,8 @@
02110-1301 USA
*/
#include "libc/alg/reverse.h"
#include "libc/conv/conv.h"
#include "libc/conv/itoa.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/itoa.h"
#include "libc/limits.h"
uint128_t __udivmodti4(uint128_t, uint128_t, uint128_t *);

View File

@ -18,8 +18,8 @@
02110-1301 USA
*/
#include "libc/alg/reverse.h"
#include "libc/conv/conv.h"
#include "libc/conv/itoa.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/itoa.h"
noinline size_t uint64toarray(uint64_t i, char *a, int r) {
size_t j;

View File

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "libc/assert.h"
#include "libc/conv/itoa.h"
#include "libc/fmt/itoa.h"
size_t uint64toarray_fixed16(uint64_t x, char b[hasatleast 17], uint8_t k) {
int i;

View File

@ -18,8 +18,8 @@
02110-1301 USA
*/
#include "libc/alg/reverse.h"
#include "libc/conv/conv.h"
#include "libc/conv/itoa.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/itoa.h"
#include "libc/limits.h"
/**

View File

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/conv/itoa.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/itoa.h"
#include "libc/macros.h"
#include "libc/nexgen32e/bsr.h"

View File

@ -18,8 +18,8 @@
02110-1301 USA
*/
#include "libc/alg/reverse.h"
#include "libc/conv/conv.h"
#include "libc/conv/itoa.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/itoa.h"
#include "libc/limits.h"
/**

View File

@ -17,7 +17,9 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/macros.h"
long(labs)(long x) { return ABS(x); }
long(labs)(long x) {
return ABS(x);
}

View File

@ -17,6 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
ldiv_t(ldiv)(long num, long den) { return ldiv(num, den); }
ldiv_t(ldiv)(long num, long den) {
return ldiv(num, den);
}

View File

@ -17,7 +17,9 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/macros.h"
long long(llabs)(long long x) { return ABS(x); }
long long(llabs)(long long x) {
return ABS(x);
}

View File

@ -17,6 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
lldiv_t(lldiv)(long long num, long long den) { return lldiv(num, den); }
lldiv_t(lldiv)(long long num, long long den) {
return lldiv(num, den);
}

View File

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "libc/bits/bits.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
char *ltpcpy(char *dst, long x) {
unsigned len = llog10(abs(x)) + 1;

View File

@ -25,7 +25,7 @@
THE SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/paland.inc"
#include "libc/fmt/palandprintf.internal.h"

View File

@ -38,7 +38,7 @@
#include "libc/assert.h"
#include "libc/bits/bits.h"
#include "libc/bits/weaken.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/paland.inc"
#include "libc/fmt/palandprintf.internal.h"

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/math.h"
double RoundDecimalPlaces(double f, double digs, double rounder(double)) {

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/limits.h"
#include "libc/nexgen32e/bsr.h"
#include "libc/str/str.h"

View File

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/conv/strlol.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/strlol.internal.h"
#include "libc/limits.h"
/**

View File

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/conv/strlol.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/strlol.internal.h"
#include "libc/limits.h"
long long strtoll(const char *s, char **endptr, int optional_base) {

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/str/str.h"
#include "libc/sysv/errfuns.h"

View File

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/conv/strlol.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/strlol.internal.h"
#include "libc/limits.h"
unsigned long strtoul(const char *s, char **endptr, int optional_base) {

View File

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/conv/strlol.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/strlol.internal.h"
#include "libc/limits.h"
unsigned long long strtoull(const char *s, char **endptr, int optional_base) {

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/str/str.h"
/**

View File

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "libc/calls/calls.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/nt/struct/filetime.h"

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/nt/struct/filetime.h"
struct NtFileTime TimeToFileTime(int64_t t) {

View File

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "libc/calls/struct/timeval.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/nt/struct/filetime.h"
#include "libc/time/time.h"

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
/**
* Decodes a GNU-style varint from a buffer.

View File

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "libc/bits/weaken.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"

View File

@ -1,5 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_CONV_WCSLOL_H_
#define COSMOPOLITAN_LIBC_CONV_WCSLOL_H_
#ifndef COSMOPOLITAN_LIBC_FMT_WCSLOL_H_
#define COSMOPOLITAN_LIBC_FMT_WCSLOL_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
@ -13,4 +13,4 @@ COSMOPOLITAN_C_START_
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CONV_WCSLOL_H_ */
#endif /* COSMOPOLITAN_LIBC_FMT_WCSLOL_H_ */

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/str/str.h"
intmax_t wcstoimax(const wchar_t *s, wchar_t **endptr, int base) {

View File

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/conv/wcslol.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/wcslol.internal.h"
#include "libc/limits.h"
#include "libc/str/str.h"

View File

@ -1,4 +1,4 @@
#ifndef LIBC_ISYSTEM_ENDIAN_H_
#define LIBC_ISYSTEM_ENDIAN_H_
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#endif

View File

@ -1,6 +1,6 @@
#ifndef LIBC_ISYSTEM_STDLIB_H_
#define LIBC_ISYSTEM_STDLIB_H_
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/mem/mem.h"
#include "libc/rand/rand.h"
#include "libc/runtime/runtime.h"

View File

@ -11,7 +11,6 @@ LIBC_CHECKS = $(LIBC_HDRS:%=o/$(MODE)/%.ok)
o/$(MODE)/libc: o/$(MODE)/libc/alg \
o/$(MODE)/libc/bits \
o/$(MODE)/libc/calls \
o/$(MODE)/libc/conv \
o/$(MODE)/libc/crt \
o/$(MODE)/libc/dns \
o/$(MODE)/libc/elf \

View File

@ -20,7 +20,7 @@
#include "libc/bits/safemacros.internal.h"
#include "libc/bits/weaken.h"
#include "libc/calls/calls.h"
#include "libc/conv/itoa.h"
#include "libc/fmt/itoa.h"
#include "libc/log/asan.internal.h"
#include "libc/log/backtrace.internal.h"
#include "libc/log/log.h"

View File

@ -23,8 +23,8 @@
#include "libc/bits/weaken.h"
#include "libc/calls/calls.h"
#include "libc/calls/hefty/spawn.h"
#include "libc/conv/conv.h"
#include "libc/dce.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/log/backtrace.internal.h"
#include "libc/log/log.h"

View File

@ -21,8 +21,8 @@
#include "libc/assert.h"
#include "libc/bits/weaken.h"
#include "libc/calls/calls.h"
#include "libc/conv/itoa.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
#include "libc/log/backtrace.internal.h"
#include "libc/macros.h"
#include "libc/nexgen32e/gc.internal.h"

View File

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/itoa.h"
#include "libc/errno.h"
#include "libc/fmt/itoa.h"
#include "libc/log/internal.h"
#include "libc/log/log.h"
#include "libc/runtime/runtime.h"

View File

@ -20,7 +20,7 @@
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/termios.h"
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/log/log.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/consts/termios.h"

View File

@ -30,22 +30,21 @@ LIBC_LOG_A_DIRECTDEPS = \
LIBC_ALG \
LIBC_CALLS \
LIBC_CALLS_HEFTY \
LIBC_CONV \
LIBC_ELF \
LIBC_FMT \
LIBC_TINYMATH \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_NT_KERNELBASE \
LIBC_MEM \
LIBC_NT_NTDLL \
LIBC_RAND \
LIBC_RUNTIME \
LIBC_STDIO \
LIBC_STR \
LIBC_STUBS \
LIBC_NT_NTDLL \
LIBC_UNICODE \
LIBC_SYSV \
LIBC_TIME \
LIBC_TINYMATH \
LIBC_UNICODE \
THIRD_PARTY_DLMALLOC
LIBC_LOG_A_DEPS := \

View File

@ -21,9 +21,9 @@
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
#include "libc/calls/struct/timeval.h"
#include "libc/conv/conv.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/log/internal.h"
#include "libc/log/log.h"

View File

@ -29,14 +29,13 @@ LIBC_MEM_A_CHECKS = \
$(LIBC_MEM_A_HDRS:%=o/$(MODE)/%.ok)
LIBC_MEM_A_DIRECTDEPS = \
LIBC_CONV \
LIBC_STR \
LIBC_FMT \
LIBC_RAND \
LIBC_STUBS \
LIBC_CALLS \
LIBC_RUNTIME \
LIBC_FMT \
LIBC_NEXGEN32E \
LIBC_RAND \
LIBC_RUNTIME \
LIBC_STR \
LIBC_STUBS \
LIBC_SYSV \
THIRD_PARTY_DLMALLOC

View File

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/conv.h"
#include "libc/fmt/conv.h"
#include "libc/mem/mem.h"
/**

View File

@ -1,55 +0,0 @@
/*-*- 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 2020 Justine Alexandra Roberts Tunney
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/conv/itoa.h"
#include "libc/runtime/runtime.h"
/**
* Debugs super low-level stuff, e.g.
*
* void GOT_HERE(int);
* INITIALIZER(100, _init_got_here_100, GOT_HERE(100));
* INITIALIZER(200, _init_got_here_200, GOT_HERE(200));
* INITIALIZER(300, _init_got_here_300, GOT_HERE(300));
* INITIALIZER(400, _init_got_here_400, GOT_HERE(400));
* INITIALIZER(500, _init_got_here_500, GOT_HERE(500));
* INITIALIZER(600, _init_got_here_600, GOT_HERE(600));
* INITIALIZER(700, _init_got_here_700, GOT_HERE(700));
* INITIALIZER(800, _init_got_here_800, GOT_HERE(800));
*
*/
privileged interruptfn void GOT_HERE(long num) {
size_t len;
char msg[48];
len = 0;
msg[len++] = 'g';
msg[len++] = 'o';
msg[len++] = 't';
msg[len++] = ' ';
msg[len++] = 'h';
msg[len++] = 'e';
msg[len++] = 'r';
msg[len++] = 'e';
msg[len++] = ' ';
len += int64toarray_radix10(num, &msg[len]);
msg[len++] = '\r';
msg[len++] = '\n';
msg[len] = '\0';
__print(msg, len);
}

Some files were not shown because too many files have changed in this diff Show More