Commit Graph

590 Commits

Author SHA1 Message Date
Lassi Kortela d781c65862 Fix oversight in the bootstrap procedure
Stage 0 is supposed to emit compiled versions of system.scm and
compiler.scm. The compiler.scm bytecode wasn't emitted properly
because the emitter put the two files' bytecode in two separate C
variables instead of concatenating them into the same variable as they
should be.
2019-08-14 00:44:24 +03:00
Lassi Kortela cccbe54bb5 Finally fix the default cflags for real 2019-08-14 00:05:10 +03:00
Lassi Kortela bf11066313 Add stubs for Haiku, Minix and Solaris 2019-08-14 00:01:26 +03:00
Lassi Kortela d69ad59126 Expand here-document
Debian /bin/sh cannot handle it.
2019-08-13 23:47:43 +03:00
Lassi Kortela c14c723859 Update temp boot image paths 2019-08-13 23:20:47 +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 2e8153019c Add read-u8 built-in (R7RS)
io.getc gets UTF-8 characters
2019-08-13 22:53:37 +03:00
Lassi Kortela c2da0753af Fix some more "long double" nonsense 2019-08-13 18:51:43 +03:00
Lassi Kortela 1f3a4798e1 Expand some cflag definitions in build.sh and add Minix 2019-08-13 18:30:27 +03:00
Lassi Kortela 71098dd01b Fix some "long double" nonsense
Apparently in addition to "float", "double" and "long double" there
are now standard types in <math.h> called "float_t" and "double_t".
Those types don't need to be equivalent to "float" and "double". Gah!
2019-08-13 18:28:19 +03:00
Lassi Kortela 4a89521493 Use 'int' instead of 'char' for character variables
MINIX libc headers define the ctype.h toupper() etc. functions as
preprocessor macros that don't cast their argument to int! So a char
argument causes clang to say "warning: array subscript is of type
'char'".
2019-08-13 17:53:17 +03:00
Lassi Kortela 10eb936836 Start file system support for NetBSD 2019-08-13 15:53:37 +03:00
Lassi Kortela 9b737144ea Fix portability bugs uncovered by Alpine Linux/musl libc 2019-08-13 14:19:38 +03:00
Lassi Kortela 277abddaa8 Turn (import ...) into a macro to match Scheme syntax 2019-08-12 18:18:46 +03:00
Lassi Kortela 5012977d32 Start environment-stack implementation 2019-08-11 23:27:38 +03:00
Lassi Kortela f2068b5783 Add missing const qualifiers 2019-08-11 23:27:12 +03:00
Lassi Kortela 3b13e81eae Add concept of built-in libraries and (import) statement
R7RS syntax is: (import (library name here))

We translate this into the internal path "library/name/here". This will allow
us to easily load libraries from files later on by appending the ".sld" file
name extension.
2019-08-11 22:32:55 +03:00
Lassi Kortela c704079cae Add string buffer
TODO: Consider merging with 'struct ios'
2019-08-11 22:31:54 +03:00
Lassi Kortela b441573bde Enable #x-1_2_3 syntax and get rid of -0x123 2019-08-10 16:13:26 +03:00
Lassi Kortela d5bb6b3116 Start changing all instances of 0x to #x
After this commit -0x123 is still supported, but 0x123 is not.
2019-08-10 15:51:43 +03:00
Lassi Kortela 003068f575 Add first stab at SRFI 169 underscores support 2019-08-10 15:41:05 +03:00
Lassi Kortela 55c6328241 Link to FemtoLisp from readme 2019-08-10 12:32:04 +03:00
Lassi Kortela 4c391d6d68 Brand as Up Scheme 2019-08-10 12:26:51 +03:00
Lassi Kortela 93813a9eb1 Remove unneeded numerical constants
To the extent we need these, we can get them from the stdlib.
2019-08-10 02:12:54 +03:00
Lassi Kortela 10660ac8ed Start fs implementation for DragonFly BSD 2019-08-10 02:04:11 +03:00
Lassi Kortela fe01d2faa1 Simplify FreeBSD get_exename() 2019-08-10 02:02:41 +03:00
Lassi Kortela c2a63dd28f Revert "Add -pedantic compiler flag"
Wow, that's a lot of GNU/C11 extensions! We're not ready to tackle all this
stuff just yet.

This reverts commit b027e7d2e5.
2019-08-10 01:55:55 +03:00
Lassi Kortela b027e7d2e5 Add -pedantic compiler flag 2019-08-10 01:53:31 +03:00
Lassi Kortela acc5c4c5e2 Switch to _GNU_SOURCE on Linux
No reason to care about Posix in particular, and it causes problems.
2019-08-10 01:50:04 +03:00
Lassi Kortela 2950e6ae5b Set _X_OPEN_SOURCE and default compiler in build script 2019-08-10 01:43:47 +03:00
Lassi Kortela 86ebfb7a12 Regenerate boot image due to earlier *os-name* changes 2019-08-10 01:07:08 +03:00
Lassi Kortela 0e75fcb197 Fix regression in u8_vprintf()
My fault
2019-08-10 01:05:41 +03:00
Lassi Kortela be3c93e2b8 Define _XOPEN_SOURCE to access some libc functions on Linux 2019-08-10 01:02:59 +03:00
Lassi Kortela 08027cac9b Add some missing system includes
Uncovered by Linux build
2019-08-10 01:02:27 +03:00
Lassi Kortela 10763df501 Add fallthrough comments to switch cases
Some versions of GCC warn otherwise, which is good.
2019-08-10 01:01:40 +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 3751d83390 Remove unneeded prototypes using sockaddr_in 2019-08-10 00:16:30 +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 267cd00146 Remove unnecessary ifdef about unsetenv() return value
Posix now mandates that unsetenv() must return -1 and set errno on error.
2019-08-10 00:05:31 +03:00
Lassi Kortela 95a1c1032c Remove ifdef about memrchr() on MacOS
MacOS doesn't have memrchr() so there was an ifdef with a custom
implementation for it. Get rid of the ifdef by always using the custom
implementation.
2019-08-10 00:02:14 +03:00
Lassi Kortela daaa5aaed0 Break down timefuncs.c to unix and windows 2019-08-09 23:56:18 +03:00
Lassi Kortela 8a7ce61575 Replace uses of alloca() with malloc()
Gets rid of more #ifdef magic.
2019-08-09 23:45:10 +03:00
Lassi Kortela 41f6dbc1a2 Assume 64-bit pointers for now
To get rid of ifdef complexity. Put 32-bit support back in later.
2019-08-09 23:35:50 +03:00
Lassi Kortela d95a4660ad Fix missing NULL definition on FreeBSD 2019-08-09 23:31:27 +03:00
Lassi Kortela b0203bb89e Add more missing stdint.h includes 2019-08-09 23:31:21 +03:00
Lassi Kortela a28aff6892 Add missing stdint.h includes 2019-08-09 23:25:20 +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