rcx

library of miscellaneous bits of C code
git clone git://git.rr3.xyz/rcx
Log | Files | Refs | README | LICENSE

commit a7331ba4e37b47fd0a5edd663fee5e788332386a
parent e83affbfb44a6c9ac63fc5408cb647f90bb770d8
Author: robert <robertrussell.72001@gmail.com>
Date:   Mon, 11 Jul 2022 21:03:22 -0700

Reorganize

Diffstat:
MMakefile | 24+++++++++++++++---------
Mconfig.mk | 2+-
Rinclude/cext/all.h -> inc/cext/all.h | 0
Rinclude/cext/alloc.h -> inc/cext/alloc.h | 0
Rinclude/cext/cext.h -> inc/cext/cext.h | 0
Ainc/cext/def.h | 106+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rinclude/cext/log.h -> inc/cext/log.h | 0
Rinclude/cext/opt.h -> inc/cext/opt.h | 0
Rinclude/cext/utf8.h -> inc/cext/utf8.h | 0
Rinclude/cext/vec.h -> inc/cext/vec.h | 0
Dinclude/cext/def.h | 104-------------------------------------------------------------------------------
11 files changed, 122 insertions(+), 114 deletions(-)

diff --git a/Makefile b/Makefile @@ -8,17 +8,23 @@ SRC =\ src/opt.c\ src/utf8.c -all: libcext.a - -src/alloc.o: src/alloc.c include/cext/cext.h include/cext/alloc.h include/cext/log.h -src/log.o: src/log.c include/cext/cext.h include/cext/log.h -src/opt.o: src/opt.c include/cext/cext.h include/cext/opt.h -src/utf8.o: src/utf8.c include/cext/cext.h include/cext/utf8.h +libcext.a: $(SRC:.c=.o) + $(AR) -rcs $@ $(SRC:.c=.o) .c.o: $(CC) -c -o $@ $(CFLAGS) $< -libcext.a: $(SRC:.c=.o) - $(AR) -rcs $@ $^ +src/alloc.o: src/alloc.c inc/cext/cext.h inc/cext/alloc.h inc/cext/log.h config.mk +src/log.o: src/log.c inc/cext/cext.h inc/cext/log.h config.mk +src/opt.o: src/opt.c inc/cext/cext.h inc/cext/opt.h config.mk +src/utf8.o: src/utf8.c inc/cext/cext.h inc/cext/utf8.h config.mk + +inc/cext/alloc.h: inc/cext/def.h +inc/cext/cext.h: inc/cext/def.h +inc/cext/utf8.h: inc/cext/def.h +inc/cext/vec.h: inc/cext/alloc.h inc/cext/def.h + +clean: + rm -f libcext.a $(SRC:.c=.o) -.PHONY: all +.PHONY: clean diff --git a/config.mk b/config.mk @@ -1,3 +1,3 @@ CC = cc -CFLAGS = -std=c11 -Wall -Iinclude +CFLAGS = -std=c11 -Wall -pedantic -Iinc AR = ar diff --git a/include/cext/all.h b/inc/cext/all.h diff --git a/include/cext/alloc.h b/inc/cext/alloc.h diff --git a/include/cext/cext.h b/inc/cext/cext.h diff --git a/inc/cext/def.h b/inc/cext/def.h @@ -0,0 +1,106 @@ +#pragma once + +#include <stddef.h> +#include <stdint.h> + +#define JOIN_AUX(a,b) a##b +#define JOIN(a,b) JOIN_AUX(a,b) + +#define LEN(a) (sizeof (a) / sizeof (a)[0]) +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; +typedef long long llong; +typedef unsigned long long ullong; + +#define I8_MIN INT8_MIN +#define I8_MAX INT8_MAX +#define I8_C INT8_C +typedef int8_t i8; + +#define I16_MIN INT16_MIN +#define I16_MAX INT16_MAX +#define I16_C INT16_C +typedef int16_t i16; + +#define I32_MIN INT32_MIN +#define I32_MAX INT32_MAX +#define I32_C INT32_C +typedef int32_t i32; + +#define I64_MIN INT64_MIN +#define I64_MAX INT64_MAX +#define I64_C INT64_C +typedef int64_t i64; + +#define IMAX_MIN INTMAX_MIN +#define IMAX_MAX INTMAX_MAX +#define IMAX_C INTMAX_C +typedef intmax_t imax; + +#define IPTR_MIN INTPTR_MIN +#define IPTR_MAX INTPTR_MAX +typedef intptr_t iptr; + +/* typedef ssize_t isize; */ + +#define U8_MAX UINT8_MAX +#define U8_C UINT8_C +typedef uint8_t u8; + +#define U16_MAX UINT16_MAX +#define U16_C UINT16_C +typedef uint16_t u16; + +#define U32_MAX UINT32_MAX +#define U32_C UINT32_C +typedef uint32_t u32; + +#define U64_MAX UINT64_MAX +#define U64_C UINT64_C +typedef uint64_t u64; + +#define UMAX_MAX UINTMAX_MAX +#define UMAX_C UINTMAX_C +typedef uintmax_t umax; + +#define UPTR_MAX UINTPTR_MAX +typedef uintptr_t uptr; + +#define USIZE_MAX SIZE_MAX +typedef size_t usize; + +#ifndef __STRICT_ANSI__ +#ifdef __SIZEOF_INT128__ +#define CEXT_HAVE_128 1 + +#define I128_MIN ((i128)-1 - I128_MAX) +#define I128_MAX ((i128)(U128_MAX >> 1)) +typedef __int128 i128; + +#define U128_MAX (((u128)U64_MAX << 64) | U64_MAX) +typedef unsigned __int128 u128; + +#endif +#endif + +#define RUNE_BAD RUNE_C(0xFFFD) +#define RUNE_MAX RUNE_C(0x10FFFF) +#define RUNE_C U32_C +typedef u32 rune; + +#if __STDC_VERSION__ >= 201100L +typedef max_align_t maxalign; +#else +/* Fallback which is probably correct */ +typedef struct { + intmax_t i; /* biggest integer */ + long double d; /* biggest floating point */ + void *p; /* data pointer */ + void (*f)(void); /* function pointer */ +} maxalign; +#endif diff --git a/include/cext/log.h b/inc/cext/log.h diff --git a/include/cext/opt.h b/inc/cext/opt.h diff --git a/include/cext/utf8.h b/inc/cext/utf8.h diff --git a/include/cext/vec.h b/inc/cext/vec.h diff --git a/include/cext/def.h b/include/cext/def.h @@ -1,104 +0,0 @@ -#pragma once - -#include "stddef.h" -#include "stdint.h" - -#define JOIN_AUX(a,b) a##b -#define JOIN(a,b) JOIN_AUX(a,b) - -#define LEN(a) (sizeof (a) / sizeof (a)[0]) -#define MIN(a,b) ((a) < (b) ? (a) : (b)) -#define MAX(a,b) ((a) > (b) ? (a) : (b)) - -typedef unsigned char uchar; -typedef unsigned short ushort; -typedef unsigned int uint; -typedef unsigned long ulong; -typedef long long llong; -typedef unsigned long long ullong; - -#define I8_MIN INT8_MIN -#define I8_MAX INT8_MAX -#define I8_C INT8_C -typedef int8_t i8; - -#define I16_MIN INT16_MIN -#define I16_MAX INT16_MAX -#define I16_C INT16_C -typedef int16_t i16; - -#define I32_MIN INT32_MIN -#define I32_MAX INT32_MAX -#define I32_C INT32_C -typedef int32_t i32; - -#define I64_MIN INT64_MIN -#define I64_MAX INT64_MAX -#define I64_C INT64_C -typedef int64_t i64; - -#define IMAX_MIN INTMAX_MIN -#define IMAX_MAX INTMAX_MAX -#define IMAX_C INTMAX_C -typedef intmax_t imax; - -#define IPTR_MIN INTPTR_MIN -#define IPTR_MAX INTPTR_MAX -typedef intptr_t iptr; - -/* typedef ssize_t isize; */ - -#define U8_MAX UINT8_MAX -#define U8_C UINT8_C -typedef uint8_t u8; - -#define U16_MAX UINT16_MAX -#define U16_C UINT16_C -typedef uint16_t u16; - -#define U32_MAX UINT32_MAX -#define U32_C UINT32_C -typedef uint32_t u32; - -#define U64_MAX UINT64_MAX -#define U64_C UINT64_C -typedef uint64_t u64; - -#define UMAX_MAX UINTMAX_MAX -#define UMAX_C UINTMAX_C -typedef uintmax_t umax; - -#define UPTR_MAX UINTPTR_MAX -typedef uintptr_t uptr; - -#define USIZE_MAX SIZE_MAX -typedef size_t usize; - -#ifdef __SIZEOF_INT128__ -#define CEXT_HAVE_128 1 - -#define I128_MIN ((i128)-1 - I128_MAX) -#define I128_MAX ((i128)(U128_MAX >> 1)) -typedef __int128 i128; - -#define U128_MAX (((u128)U64_MAX << 64) | U64_MAX) -typedef unsigned __int128 u128; - -#endif - -#define RUNE_BAD RUNE_C(0xFFFD) -#define RUNE_MAX RUNE_C(0x10FFFF) -#define RUNE_C U32_C -typedef u32 rune; - -#if __STDC_VERSION__ >= 201100L -typedef max_align_t maxalign; -#else -/* Fallback which is probably correct */ -typedef struct { - intmax_t i; /* biggest integer */ - long double d; /* biggest floating point */ - void *p; /* data pointer */ - void (*f)(void); /* function pointer */ -} maxalign; -#endif