Consolidate (almost) all #include's into new "scheme.h"

This commit is contained in:
Lassi Kortela 2019-08-26 22:12:15 +03:00
parent 6da8d0a939
commit a02557230b
40 changed files with 90 additions and 340 deletions

View File

@ -1,6 +1 @@
static void argcount(const char *fname, uint32_t nargs, uint32_t c)
{
if (__unlikely(nargs != c))
lerrorf(ArgError, "%s: too %s arguments", fname,
nargs < c ? "few" : "many");
}
void argcount(const char *fname, uint32_t nargs, uint32_t c);

View File

@ -1,4 +1,9 @@
#include <sys/types.h>
#include <assert.h>
#include <math.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@ -7,8 +12,7 @@
#include <malloc.h>
#endif
#include "dtypes.h"
#include "bitvector.h"
#include "scheme.h"
#ifdef __INTEL_COMPILER
#define count_bits(b) _popcnt32(b)

View File

@ -29,7 +29,12 @@
and_to, or_to, and xor_to allow overlap.
*/
#include <sys/types.h>
#include <assert.h>
#include <math.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@ -38,8 +43,7 @@
#include <malloc.h>
#endif
#include "dtypes.h"
#include "bitvector.h"
#include "scheme.h"
uint32_t *bitvector_resize(uint32_t *b, uint64_t oldsz, uint64_t newsz,
int initzero)

View File

@ -4,16 +4,15 @@
#include <sys/types.h>
#include <inttypes.h>
#include <math.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dtypes.h"
#include "ios.h"
#include "buf.h"
#include "scheme.h"
struct buf *buf_new(void) { return calloc(1, sizeof(struct buf)); }

View File

@ -15,24 +15,7 @@
#include <stdlib.h>
#include <string.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "flisp.h"
#include "error.h"
#include "argcount.h"
#include "libraries.h"
#include "scheme.h"
size_t llength(value_t v)
{

View File

@ -1,12 +1,12 @@
#include <sys/types.h>
#include <math.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include "dtypes.h"
#include "ios.h"
#include "utils.h"
#include "scheme.h"
static char hexdig[] = "0123456789abcdef";

View File

@ -16,25 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "socket.h"
#include "timefuncs.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "flisp.h"
#include "error.h"
#include "argcount.h"
#include "scheme.h"
static const struct utsname *get_global_uname(void)
{

View File

@ -12,25 +12,7 @@
#include <stdlib.h>
#include <string.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "socket.h"
#include "timefuncs.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "flisp.h"
#include "error.h"
#include "argcount.h"
#include "scheme.h"
const char *env_get_os_name(void) { return "windows"; }

View File

@ -10,21 +10,8 @@
#include <stdlib.h>
#include <string.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "socket.h"
#include "timefuncs.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "scheme.h"
#include "flisp.h"
#include "equalhash.h"
#include "htable_inc.h"

View File

@ -45,29 +45,7 @@
#include <string.h>
#include <wctype.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "socket.h"
#include "timefuncs.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "ieee754.h"
#include "flisp.h"
#include "error.h"
#include "argcount.h"
#include "env.h"
#include "opcodes.h"
#include "scheme.h"
#include "../scheme-boot/boot_image.h"

View File

@ -9,21 +9,7 @@
#include <stdlib.h>
#include <string.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "socket.h"
#include "timefuncs.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "flisp.h"
#include "scheme.h"
extern void write_defaults_indent(struct ios *f, value_t v);

View File

@ -5,17 +5,14 @@
#include <sys/types.h>
#include <math.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include "dtypes.h"
#include "utils.h"
#include "hashing.h"
#include "timefuncs.h"
#include "ios.h"
#include "random.h"
#include "scheme.h"
uintptr_t nextipow2(uintptr_t i)
{

View File

@ -4,14 +4,14 @@
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <setjmp.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dtypes.h"
#include "htable.h"
#include "hashing.h"
#include "scheme.h"
struct htable *htable_new(struct htable *h, size_t size)
{

View File

@ -1,8 +1,12 @@
#include <sys/types.h>
#include <math.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include "dtypes.h"
#include "utils.h"
#include "scheme.h"
char *uint2str(char *dest, size_t len, uint64_t num, uint32_t base)
{

13
c/ios.c
View File

@ -12,8 +12,6 @@
#include <string.h>
#include <wchar.h>
#include "dtypes.h"
#ifdef _WIN32
#include <malloc.h>
#include <io.h>
@ -26,16 +24,7 @@
#include <fcntl.h>
#endif
#include "htable.h"
#include "htableh_inc.h"
#include "ios.h"
#include "flisp.h"
#include "error.h"
#include "timefuncs.h"
#include "utf8.h"
#include "utils.h"
#include "scheme.h"
#define MOST_OF(x) ((x) - ((x) >> 4))

View File

@ -9,25 +9,7 @@
#include <stdlib.h>
#include <string.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "socket.h"
#include "timefuncs.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "flisp.h"
#include "error.h"
#include "argcount.h"
#include "scheme.h"
static value_t iostreamsym, rdsym, wrsym, apsym, crsym, truncsym;
value_t instrsym, outstrsym;

View File

@ -17,32 +17,7 @@
#include <string.h>
#include <wctype.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "socket.h"
#include "timefuncs.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "ieee754.h"
#include "flisp.h"
#include "buf.h"
#include "env.h"
#include "error.h"
#include "opcodes.h"
#include "builtins.h"
#include "libraries.h"
#include "stringfuncs.h"
#include "scheme.h"
struct builtin_procedure {
char *name;

View File

@ -2,16 +2,13 @@
#include <locale.h>
#include <math.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "dtypes.h"
#include "timefuncs.h"
#include "ios.h"
#include "random.h"
#include "utf8.h"
#include "scheme.h"
double D_PNAN;
double D_NNAN;

View File

@ -1,6 +1,16 @@
#include <sys/types.h>
#include <mach-o/dyld.h>
#include "os.h"
#include <locale.h>
#include <math.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "scheme.h"
char *get_exename(char *buf, size_t size)
{

View File

@ -2,7 +2,7 @@
#include <sys/sysctl.h>
#include "os.h"
#include "scheme.h"
char *get_exename(char *buf, size_t size)
{

View File

@ -2,7 +2,7 @@
#include <sys/sysctl.h>
#include "os.h"
#include "scheme.h"
char *get_exename(char *buf, size_t size)
{

View File

@ -1,6 +1,6 @@
#include <unistd.h>
#include "os.h"
#include "scheme.h"
char *get_exename(char *buf, size_t size)
{

View File

@ -2,7 +2,7 @@
#include <string.h>
#include <unistd.h>
#include "os.h"
#include "scheme.h"
char *get_exename(char *buf, size_t size)
{

View File

@ -1,6 +1,6 @@
#include <unistd.h>
#include "os.h"
#include "scheme.h"
char *get_exename(char *buf, size_t size)
{

View File

@ -2,7 +2,7 @@
#include <sys/sysctl.h>
#include "os.h"
#include "scheme.h"
char *get_exename(char *buf, size_t size)
{

View File

@ -10,7 +10,7 @@
#include <string.h>
#include <unistd.h>
#include "os.h"
#include "scheme.h"
char *get_exename(char *buf, size_t size)
{

View File

@ -1,6 +1,6 @@
#include <unistd.h>
#include "os.h"
#include "scheme.h"
char *get_exename(char *buf, size_t size)
{

View File

@ -16,26 +16,7 @@
#include <termios.h>
#include <unistd.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "socket.h"
#include "timefuncs.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "flisp.h"
#include "error.h"
#include "argcount.h"
#include "os.h"
#include "scheme.h"
void path_to_dirname(char *path)
{

View File

@ -16,26 +16,7 @@
#include <string.h>
#include <unistd.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "socket.h"
#include "timefuncs.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "flisp.h"
#include "error.h"
#include "argcount.h"
#include "os.h"
#include "scheme.h"
static void warn(const char *msg) { fprintf(stderr, "%s\n", msg); }

View File

@ -16,25 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "timefuncs.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "flisp.h"
#include "error.h"
#include "argcount.h"
#include "os.h"
#include "scheme.h"
void path_to_dirname(char *path)
{

View File

@ -7,14 +7,19 @@
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dtypes.h"
#include "htable.h"
#include "htableh_inc.h"
#include "scheme.h"
#include "equalhash.h"
#include "htable_inc.h"
#define OP_EQ(x, y) ((x) == (y))
@ -43,6 +48,4 @@ static uint32_t _pinthash(uint32_t a)
}
#endif
#include "htable_inc.h"
HTIMPL(ptrhash, _pinthash, OP_EQ)

View File

@ -3,15 +3,12 @@
*/
#include <math.h>
#include <setjmp.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "dtypes.h"
#include "ieee754.h"
#include "utils.h"
#include "random.h"
#include "timefuncs.h"
#include "scheme.h"
#include "mt19937ar.h"

View File

@ -9,15 +9,15 @@
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <netdb.h>
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "dtypes.h"
#include "socket.h"
#include "scheme.h"
int mysocket(int domain, int type, int protocol)
{

View File

@ -17,24 +17,7 @@
#include <wchar.h>
#include <wctype.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "socket.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "flisp.h"
#include "error.h"
#include "argcount.h"
#include "scheme.h"
extern void display_defaults(struct ios *f, value_t v);

View File

@ -9,25 +9,8 @@
#include <stdlib.h>
#include <string.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "socket.h"
#include "timefuncs.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "scheme.h"
#include "flisp.h"
#include "error.h"
#include "argcount.h"
#include "equalhash.h"
static value_t tablesym;

View File

@ -12,26 +12,7 @@
#include <stdlib.h>
#include <string.h>
#include "dtypes.h"
#include "utils.h"
#include "utf8.h"
#include "ios.h"
#include "socket.h"
#include "timefuncs.h"
#include "hashing.h"
#include "htable.h"
#include "htableh_inc.h"
#include "bitvector.h"
#include "os.h"
#include "random.h"
#include "llt.h"
#include "flisp.h"
#include "error.h"
#include "argcount.h"
#include "buf.h"
#include "scheme.h"
static void push(value_t *tailp, value_t elt)
{

View File

@ -1,12 +1,15 @@
#include <sys/time.h>
#include <math.h>
#include <poll.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "timefuncs.h"
#include "scheme.h"
double tv2float(struct timeval *tv)
{

View File

@ -3,7 +3,7 @@
#include <stdint.h>
#include <time.h>
#include "timefuncs.h"
#include "scheme.h"
#if 0
double tvals2float(struct tm *t, struct timeb *tstruct)

View File

@ -14,6 +14,8 @@
*/
#include <assert.h>
#include <math.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
@ -28,9 +30,7 @@
#define snprintf _snprintf
#endif
#include "dtypes.h"
#include "utf8.h"
#include "scheme.h"
static const uint32_t offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL,
0x000E2080UL, 0x03C82080UL,

View File

@ -3,6 +3,7 @@ set -eu
os="$(uname | tr A-Z- a-z_)"
o_files=""
o_files="$o_files algo_color.o"
o_files="$o_files argcount.o"
o_files="$o_files bitvector-ops.o"
o_files="$o_files bitvector.o"
o_files="$o_files buf.o"
@ -85,6 +86,7 @@ echo "Entering directory '$PWD'"
set -x
$CC $CFLAGS -c ../c/algo_color.c
$CC $CFLAGS -c ../c/argcount.c
$CC $CFLAGS -c ../c/bitvector-ops.c
$CC $CFLAGS -c ../c/bitvector.c
$CC $CFLAGS -c ../c/buf.c