Commit Graph

33 Commits

Author SHA1 Message Date
Lassi Kortela 4550e1ba79 Rename SCR_WIDTH to print_width 2019-08-25 12:45:48 +03:00
Lassi Kortela 60ff06fb6d Reorganize error functions and includes
These functions are complicated because they need to be marked
"noreturn" for the compiler. There are several fundamentally
incompatible ways of doing that. Since we have only a few "noreturn"
functions, let's just list all of those in one header file of which
there is a completely different version for each compiler.
2019-08-21 22:06:13 +03:00
Lassi Kortela 35acc782d9 Remove asm byteswap implementations 2019-08-19 01:17:54 +03:00
Lassi Kortela 023937e5ea Use backward compatible variable initializers 2019-08-19 01:14:09 +03:00
Lassi Kortela a6ecac95e1 Rename fs*.c -> os*.c
I planned to put just the file system routines into these files, but
there are starting to be so many of them that I don't want to
duplicate the same set for networking, subprocesses etc.
2019-08-14 01:15:29 +03:00
Lassi Kortela 5ced8d91f6 Store boot image inside main executable
Previously the boot image was kept in the separate file "flisp.boot".
This caused all kinds of problems, as bootstrapping is wont to do. The
biggest problem was finding a portable and convenient pathname for it.

Instead of dealing with all that stuff about how to find the file,
just store the image in a huge C string constant that goes into the
main executable. This necessitates adding a C-string hex dumper into
the Lisp system, and making build.sh slightly more complicated, but
that's a small price to pay for not having to carry a separate file
everywhere we go. Also, flmain.c is a lot simpler now and we don't
have to play around with symlinks.
2019-08-13 23:07:44 +03:00
Lassi Kortela 2ec07684d2 Get OS name from uname()
This implies that OS names have changed. Unix-like OS names are now
capitalized. "macos" is now "Darwin". Windows is now all-lowecase "windows".
"win32" is gone. "win64" was not used in the original code despite a reference
to it.
2019-08-10 00:35:16 +03:00
Lassi Kortela be6a18175f Add const qualifier to some symbol/keyword functions 2019-08-10 00:30:20 +03:00
Lassi Kortela e9d6ca265c Unify preprocessor checks for win32
<https://sourceforge.net/p/predef/wiki/OperatingSystems/> says that _WIN32 is
always defined for both 32-bit and 64-bit versions of Windows.
2019-08-10 00:12:33 +03:00
Lassi Kortela 1d96278313 Break down dirpath.c into fs_*.c by OS
I much prefer this to using ifdefs. Requires a little help from the build
system but I find it worth it.
2019-08-09 23:12:19 +03:00
Lassi Kortela 99feb308bd Hoist argcount() into its own header file
Muffles compiler warnings about unused function.
2019-08-09 22:08:44 +03:00
Lassi Kortela 2610213b42 Do not include bswap* all over the place 2019-08-09 22:04:55 +03:00
Lassi Kortela c84c71adcc Get rid of INLINE and STATIC_INLINE
Nowadays compilers have good optimizers that know when to inline static
functions depending on the user's chosen optimization level (and speed vs size
optimization). We don't need to annotate functions manually.
2019-08-09 21:35:20 +03:00
Lassi Kortela 12fb30462b Simplify endian (byte order) detection
The following:

    #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
    #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__

are apparently semi-standard nowadays.
2019-08-09 21:30:30 +03:00
Lassi Kortela 36fd757689 Replace ptrint_t with standard intptr_t 2019-08-09 21:07:16 +03:00
Lassi Kortela d6a4029dde Replace idiosyncratic C types with standard ones
For number types, we rely on classic C types (char, short, int, long) to be
the correct sizes. For precise bit widths, use standard intN_t and uintN_t.
For size_t, just use system size_t.
2019-08-09 21:00:03 +03:00
Lassi Kortela d5d7406276 Remove unused Boehm GC hooks 2019-08-09 20:37:42 +03:00
Lassi Kortela b7b4269455 Replace strcpy() and strcat() with safer functions 2019-08-09 20:14:42 +03:00
Lassi Kortela bb78dc0634 Fix compiler warnings (clang -Wextra) 2019-08-09 19:53:35 +03:00
Lassi Kortela 45a7ec7bc4 Remove include protections
Since we no longer have recursive includes, we don't need them. Removing the
protections uncovered a couple of accidental double-includes: good.
2019-08-09 19:47:22 +03:00
Lassi Kortela fe4550dad7 Replace cvalue_t with struct 2019-08-09 19:36:20 +03:00
Lassi Kortela c9f5e4faeb Replace symbol_t with struct 2019-08-09 19:30:15 +03:00
Lassi Kortela 193ced5e73 Replace cons_t with struct 2019-08-09 19:28:14 +03:00
Lassi Kortela d6f1579e17 Replace cprim_t with struct 2019-08-09 19:26:48 +03:00
Lassi Kortela fdcdd865b4 Replace function_t with struct 2019-08-09 19:26:48 +03:00
Lassi Kortela 428e7a3825 Replace builtinspec_t with struct 2019-08-09 19:26:48 +03:00
Lassi Kortela e54797e4eb Replace fl_exception_context_t with struct 2019-08-09 19:26:48 +03:00
Lassi Kortela 262ace1efd Replace fl_readstate_t with struct 2019-08-09 19:26:42 +03:00
Lassi Kortela b561f9d4b0 Replace gensym_t with struct 2019-08-09 19:26:33 +03:00
Lassi Kortela f2fb37e520 Replace ios_t with struct 2019-08-09 19:26:20 +03:00
Lassi Kortela 79d44c0780 Get rid of almost all recursive includes
Simple rule: include files should never include include files.

"Notes on Programming in C", Rob Pike, February 21, 1989
<https://www.lysator.liu.se/c/pikestyle.html>
2019-08-09 19:00:17 +03:00
Lassi Kortela 0701b22d29 Rename #include'd C files from .c to .h 2019-08-09 18:30:02 +03:00
Lassi Kortela d6f54bc13c Consolidate all C files into a "c" subdirectory 2019-08-09 15:02:58 +03:00