diff --git a/c/builtins.c b/c/builtins.c index 4fdc3a2..c21b93b 100644 --- a/c/builtins.c +++ b/c/builtins.c @@ -2,21 +2,36 @@ Extra femtoLisp builtin functions */ -#include -#include -#include -#include -#include +#include +#include +#include + #include #include -#include -#include -#include #include #include -#include "llt.h" -#include "flisp.h" +#include +#include +#include +#include +#include +#include + +#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 "dirpath.h" #include "random.h" +#include "llt.h" + +#include "flisp.h" size_t llength(value_t v) { diff --git a/c/cvalues.h b/c/cvalues.h index 7bfc5ff..92fed2a 100644 --- a/c/cvalues.h +++ b/c/cvalues.h @@ -1,5 +1,3 @@ -#include "operators.h" - #ifdef BITS64 #define NWORDS(sz) (((sz) + 7) >> 3) #else diff --git a/c/dump.c b/c/dump.c index b6056b8..860ac7f 100644 --- a/c/dump.c +++ b/c/dump.c @@ -1,4 +1,6 @@ +#include #include + #include "dtypes.h" #include "ios.h" #include "utils.h" diff --git a/c/equalhash.c b/c/equalhash.c index 41353b5..ae3e387 100644 --- a/c/equalhash.c +++ b/c/equalhash.c @@ -5,7 +5,20 @@ #include #include +#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 "dirpath.h" +#include "random.h" #include "llt.h" + #include "flisp.h" #include "equalhash.h" diff --git a/c/equalhash.h b/c/equalhash.h index 2e0e9e9..14bc95f 100644 --- a/c/equalhash.h +++ b/c/equalhash.h @@ -1,8 +1 @@ -#ifndef EQUALHASH_H -#define EQUALHASH_H - -#include "htableh_inc.h" - HTPROT(equalhash) - -#endif diff --git a/c/flisp.c b/c/flisp.c index 7a2b37e..5d724f2 100644 --- a/c/flisp.c +++ b/c/flisp.c @@ -29,21 +29,40 @@ Distributed under the BSD License */ -#include -#include -#include -#include -#include -#include +#include + #include #include -#include -#include -#include -#include #include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include + +#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 "dirpath.h" +#include "random.h" #include "llt.h" + +#include "utils.h" + +#include "ieee754.h" + #include "flisp.h" #include "opcodes.h" @@ -394,7 +413,12 @@ value_t alloc_vector(size_t n, int init) // cvalues // -------------------------------------------------------------------- +#include "htable.h" +#include "htableh_inc.h" +#include "ptrhash.h" +#include "operators.h" #include "cvalues.h" +#include "equalhash.h" #include "types.h" // print diff --git a/c/flisp.h b/c/flisp.h index 52ddbf9..f183757 100644 --- a/c/flisp.h +++ b/c/flisp.h @@ -1,9 +1,6 @@ #ifndef FLISP_H #define FLISP_H -#include -#include - typedef uptrint_t value_t; typedef int_t fixnum_t; typedef uint_t ufixnum_t; @@ -122,8 +119,6 @@ typedef struct { void fl_gc_handle(value_t *pv); void fl_free_gc_handles(uint32_t n); -#include "opcodes.h" - // utility for iterating over all arguments in a builtin // i=index, i0=start index, arg = var for each arg, args = arg array // assumes "nargs" is the argument count diff --git a/c/flmain.c b/c/flmain.c index 4bd8f2a..aa98993 100644 --- a/c/flmain.c +++ b/c/flmain.c @@ -1,7 +1,23 @@ +#include +#include +#include #include #include -#include + +#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 "dirpath.h" +#include "random.h" #include "llt.h" + #include "flisp.h" static value_t argv_list(int argc, char *argv[]) diff --git a/c/hashing.c b/c/hashing.c index 719b93a..c67545c 100644 --- a/c/hashing.c +++ b/c/hashing.c @@ -1,9 +1,25 @@ /* Hashing */ -#include -#include + +#ifndef WIN32 +#include /* attempt to define endianness */ +#else +typedef unsigned int uint32_t; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +#endif + +#ifdef LINUX +#include /* attempt to define endianness */ +#endif + #include +#include +#include +#include +#include + #include "dtypes.h" #include "utils.h" #include "hashing.h" diff --git a/c/htable.c b/c/htable.c index b13010f..59996c8 100644 --- a/c/htable.c +++ b/c/htable.c @@ -2,11 +2,11 @@ functions common to all hash table instantiations */ -#include -#include -#include #include #include +#include +#include +#include #include "dtypes.h" #include "htable.h" diff --git a/c/htableh_inc.h b/c/htableh_inc.h index cf0ba88..425328f 100644 --- a/c/htableh_inc.h +++ b/c/htableh_inc.h @@ -1,7 +1,5 @@ //-*- mode:c -*- -#include "htable.h" - #define HTPROT(HTNAME) \ void *HTNAME##_get(htable_t *h, void *key); \ void HTNAME##_put(htable_t *h, void *key, void *val); \ diff --git a/c/ios.h b/c/ios.h index 74a9517..1774c01 100644 --- a/c/ios.h +++ b/c/ios.h @@ -1,8 +1,6 @@ #ifndef __IOS_H_ #define __IOS_H_ -#include - // this flag controls when data actually moves out to the underlying I/O // channel. memory streams are a special case of this where the data // never moves out. diff --git a/c/iostream.c b/c/iostream.c index ce4846f..e137b6b 100644 --- a/c/iostream.c +++ b/c/iostream.c @@ -1,11 +1,26 @@ -#include -#include -#include -#include -#include #include + +#include #include +#include +#include +#include +#include + +#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 "dirpath.h" +#include "random.h" #include "llt.h" + #include "flisp.h" static value_t iostreamsym, rdsym, wrsym, apsym, crsym, truncsym; diff --git a/c/llt.h b/c/llt.h index dbc83a7..1060970 100644 --- a/c/llt.h +++ b/c/llt.h @@ -1,19 +1,6 @@ #ifndef __LLT_H_ #define __LLT_H_ -#include -#include "dtypes.h" -#include "utils.h" -#include "utf8.h" -#include "ios.h" -#include "socket.h" -#include "timefuncs.h" -#include "hashing.h" -#include "ptrhash.h" -#include "bitvector.h" -#include "dirpath.h" -#include "random.h" - void llt_init(); #endif diff --git a/c/lltinit.c b/c/lltinit.c index c623f49..135dd7b 100644 --- a/c/lltinit.c +++ b/c/lltinit.c @@ -1,8 +1,10 @@ -#include -#include -#include -#include #include +#include +#include +#include +#include +#include + #include "dtypes.h" #include "timefuncs.h" #include "ios.h" diff --git a/c/lookup3.h b/c/lookup3.h index 66ddd82..3f3eb44 100644 --- a/c/lookup3.h +++ b/c/lookup3.h @@ -35,20 +35,6 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. */ //#define SELF_TEST 1 -#include /* defines printf for tests */ -#include /* defines time_t for timings in the test */ -#ifndef WIN32 -#include /* defines uint32_t etc */ -#include /* attempt to define endianness */ -#else -typedef unsigned int uint32_t; -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -#endif -#ifdef LINUX -#include /* attempt to define endianness */ -#endif - /* * My best guess at if you are big-endian or little-endian. This may * need adjustment. diff --git a/c/mt19937ar.h b/c/mt19937ar.h index 553599d..23b618b 100644 --- a/c/mt19937ar.h +++ b/c/mt19937ar.h @@ -41,8 +41,6 @@ email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space) */ -#include - /* Period parameters */ #define mtN 624 #define mtM 397 diff --git a/c/opcodes.h b/c/opcodes.h index 0fb716e..1a7c125 100644 --- a/c/opcodes.h +++ b/c/opcodes.h @@ -1,6 +1,3 @@ -#ifndef OPCODES_H -#define OPCODES_H - enum { OP_NOP = 0, OP_DUP, @@ -167,5 +164,3 @@ enum { #define VM_LABELS #define VM_APPLY_LABELS #endif - -#endif diff --git a/c/operators.h b/c/operators.h index 334387b..34072c1 100644 --- a/c/operators.h +++ b/c/operators.h @@ -1,9 +1,3 @@ -#include -#include -#include "dtypes.h" -#include "utils.h" -#include "ieee754.h" - extern double trunc(double x); STATIC_INLINE double fpart(double arg) { return arg - trunc(arg); } diff --git a/c/print.h b/c/print.h index 0e34601..c2dc945 100644 --- a/c/print.h +++ b/c/print.h @@ -1,5 +1,3 @@ -#include "ieee754.h" - extern void *memrchr(const void *s, int c, size_t n); static htable_t printconses; diff --git a/c/ptrhash.c b/c/ptrhash.c index a82aa29..86d3d5d 100644 --- a/c/ptrhash.c +++ b/c/ptrhash.c @@ -3,14 +3,15 @@ optimized for storing info about particular values */ -#include -#include -#include #include #include +#include +#include +#include #include "dtypes.h" -#include "ptrhash.h" +#include "htable.h" +#include "htableh_inc.h" #define OP_EQ(x, y) ((x) == (y)) diff --git a/c/ptrhash.h b/c/ptrhash.h index d7fc531..890aa81 100644 --- a/c/ptrhash.h +++ b/c/ptrhash.h @@ -1,8 +1,6 @@ #ifndef __PTRHASH_H_ #define __PTRHASH_H_ -#include "htableh_inc.h" - HTPROT(ptrhash) #endif diff --git a/c/random.c b/c/random.c index 187d6e8..ac6d344 100644 --- a/c/random.c +++ b/c/random.c @@ -1,9 +1,11 @@ /* random numbers */ -#include -#include + #include +#include +#include + #include "dtypes.h" #include "ieee754.h" #include "utils.h" diff --git a/c/string.c b/c/string.c index 248656e..3ed171a 100644 --- a/c/string.c +++ b/c/string.c @@ -1,19 +1,35 @@ /* string functions */ -#include -#include -#include -#include -#include -#include -#include -#include -#include + #include #include + +#include +#include #include +#include +#include +#include +#include +#include +#include +#include + +#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 "dirpath.h" +#include "random.h" #include "llt.h" + #include "flisp.h" value_t fl_stringp(value_t *args, u_int32_t nargs) diff --git a/c/table.c b/c/table.c index ed4710e..b3f23c9 100644 --- a/c/table.c +++ b/c/table.c @@ -1,11 +1,26 @@ -#include -#include -#include -#include -#include #include + +#include #include +#include +#include +#include +#include + +#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 "dirpath.h" +#include "random.h" #include "llt.h" + #include "flisp.h" #include "equalhash.h" diff --git a/c/types.h b/c/types.h index e1fffe1..754a982 100644 --- a/c/types.h +++ b/c/types.h @@ -1,5 +1,3 @@ -#include "equalhash.h" - fltype_t *get_type(value_t t) { fltype_t *ft; diff --git a/c/utf8.c b/c/utf8.c index ae87353..123ca39 100644 --- a/c/utf8.c +++ b/c/utf8.c @@ -12,11 +12,16 @@ valid. A UTF-8 validation routine is included. */ + #define _XOPEN_SOURCE 700 -#include -#include -#include + +#include #include +#include +#include +#include +#include +#include #include #include @@ -30,7 +35,6 @@ #include #endif /* __FreeBSD__ && __OpenBSD__ */ #endif -#include #include "utf8.h" diff --git a/c/wcwidth.h b/c/wcwidth.h index 3a3a371..cf8d4d2 100644 --- a/c/wcwidth.h +++ b/c/wcwidth.h @@ -1,4 +1,3 @@ -#include "dtypes.h" //for DLLEXPORT /* * This is an implementation of wcwidth() and wcswidth() (defined in * IEEE Std 1002.1-2001) for Unicode. @@ -62,8 +61,6 @@ * MODIFIED TO USE uint32_t */ -#include - struct interval { int first; int last; @@ -122,9 +119,6 @@ static int bisearch(uint32_t ucs, const struct interval *table, int max) * in ISO 10646. */ -#include -#include - DLLEXPORT int wcwidth(uint32_t ucs) { /* sorted list of non-overlapping intervals of non-spacing characters */