Commit Graph

226 Commits

Author SHA1 Message Date
Lassi Kortela f408a0bbcd Use proper variable-length vector for spawn args 2019-10-13 22:58:36 +03:00
Lassi Kortela 34be865a86 Note memory leak 2019-10-13 22:57:27 +03:00
Lassi Kortela 5e9bb704c8 Add string-vector accumulator utility for C 2019-10-13 22:56:45 +03:00
Lassi Kortela 3e3ea1ca53 Extend runtime option parsing 2019-10-13 20:37:53 +03:00
Lassi Kortela 150d6ff855 Fix bugs in ASCII routines
- Segfault due to wrong return type in map_char_int().
- Treat int value -1 as #f instead of a character.
2019-10-10 02:42:16 +03:00
Lassi Kortela d906dc586c Fix compiler warning 2019-10-02 21:41:51 +03:00
Lassi Kortela 51c543b8fe Implement command line help and version flags 2019-09-30 17:08:51 +03:00
Lassi Kortela 59ab5ae4e5 Fix compiler warning 2019-09-29 12:40:57 +03:00
Lassi Kortela 6c27f65e21 Fix compiler warning 2019-09-29 12:36:27 +03:00
Lassi Kortela 0d315e320e Add most SRFI 175 ASCII character procedures 2019-09-29 12:32:57 +03:00
Lassi Kortela 573d02ac64 Remove vestigial os.getenv procedure 2019-09-02 19:48:17 +03:00
Lassi Kortela fabd2503fa Remove vestigial path.exist? procedure 2019-09-02 19:47:19 +03:00
Lassi Kortela 5f53326df8 Replace path.exists? with file-exists? in C 2019-09-02 19:46:27 +03:00
Lassi Kortela e2af92b934 Fix bug where path.exists? would always return #t 2019-09-02 19:37:46 +03:00
Lassi Kortela b7db5bb755 Rename string.split into string-split
By analogy to SRFI 140. TODO: Think about character delimiter.
2019-08-28 16:18:37 +03:00
Lassi Kortela 78b663d41d Add help and colored banner
- (help ...) is a macro that quotes everything to be user-friendly
- (help* ...) is the equivalent procedure
- When the user types just `help` or `exit`, the REPL shows a hint
  that they are probably looking for `(help)` or `(exit)`.
2019-08-28 14:07:50 +03:00
Lassi Kortela 4fef0b89b9 Add const 2019-08-28 13:30:07 +03:00
Lassi Kortela 40ba694ea6 Make environment variable procedures match R7RS 2019-08-28 12:49:10 +03:00
Lassi Kortela 0ad800ea06 Add C file forgotten from last commit 2019-08-28 12:47:01 +03:00
Lassi Kortela b33f6c9d76 Add a proper list accumulator utility in C 2019-08-28 12:45:21 +03:00
Lassi Kortela a489bf5784 Reformat 2019-08-28 12:00:07 +03:00
Lassi Kortela e5813fe5c9 Add directory listing primitives from SRFI 170 draft
TODO: 'dotfiles?' flag and 'directory-files' procedure
2019-08-28 11:11:55 +03:00
Lassi Kortela ca3ab55a5c Satisfy compiler warning about unchecked getcwd() return
TODO: raise an error
2019-08-28 00:27:28 +03:00
Lassi Kortela c0ca8c8611 Add missing includes to socket.h 2019-08-27 15:52:03 +03:00
Lassi Kortela 1f55ef2a3b Record compiler name and version at build time 2019-08-27 15:21:00 +03:00
Lassi Kortela c72f12b85c Add missing headers to OS files 2019-08-27 11:13:50 +03:00
Lassi Kortela 59e76275ba Unify variable names in hash functions 2019-08-27 10:39:39 +03:00
Lassi Kortela 847eb585ae Reorganize boot image inclusion on C
Cuts the build time in half that flisp.c is no longer re-compiled
unnecessarily.
2019-08-27 10:31:31 +03:00
Lassi Kortela 297e6fa13d Reorganize headers some more 2019-08-27 10:20:30 +03:00
Lassi Kortela 43b41bc8a6 Remove unused T_LONG and T_ULONG defines 2019-08-27 01:33:43 +03:00
Lassi Kortela 248840df1f Get rid of LLT malloc wrappers 2019-08-27 01:25:11 +03:00
Lassi Kortela 934bf9d859 Replace typedef bool_t with int 2019-08-27 01:17:52 +03:00
Lassi Kortela f72c3e9f02 Move more things into compiler-specific headers
This commit has probably broken all compilers except GCC/Clang.
2019-08-27 01:14:59 +03:00
Lassi Kortela 9409096c0a Rename error_*.h -> scheme_compiler_*.h 2019-08-27 00:46:45 +03:00
Lassi Kortela b989d60bcd Start rearranging things within scheme.h 2019-08-27 00:42:13 +03:00
Lassi Kortela 8c006ac672 Remove redundant Emacs -*- comments from C files 2019-08-27 00:38:56 +03:00
Lassi Kortela c24161d584 Streamline comments in scheme.h 2019-08-27 00:37:20 +03:00
Lassi Kortela b8ae211127 Consolidate the code itself from .h files to scheme.h 2019-08-27 00:24:58 +03:00
Lassi Kortela 2c7fe440e9 Add changes from missed in last commit 2019-08-27 00:24:54 +03:00
Lassi Kortela a02557230b Consolidate (almost) all #include's into new "scheme.h" 2019-08-26 22:12:15 +03:00
Lassi Kortela 83e64da945 Add term-init, term-exit builtins 2019-08-26 16:52:42 +03:00
Lassi Kortela 16d409c382 Add string-upcase, string-downcase builtins
Simple ASCII for now. Add some Unicode smarts later.
2019-08-26 11:47:56 +03:00
Lassi Kortela 41eb286f90 Remove vestigial char.* builtins 2019-08-26 11:15:38 +03:00
Lassi Kortela 464dac0e6c Rename builtin char procedures to match R7RS 2019-08-26 11:12:50 +03:00
Lassi Kortela d38d99dd87 Remove comments about proposed 'struct ios' features
We don't need anything as fancy as these.
2019-08-26 00:20:50 +03:00
Lassi Kortela 219578cff9 Remove temp xwrite/x... and old princ/print 2019-08-25 23:27:59 +03:00
Lassi Kortela 924a45b7bd Implement Scheme printer procedures in C 2019-08-25 22:39:35 +03:00
Lassi Kortela e3d60bb776 Add const to many utility functions 2019-08-25 22:12:34 +03:00
Lassi Kortela 8fb0cbf472 Finish re-arranging printer options 2019-08-25 17:32:14 +03:00
Lassi Kortela 844b2e219c Rename pr.opts.pretty into pr.opts.indent 2019-08-25 17:29:18 +03:00
Lassi Kortela fe4b63b9a3 Turn pr.opts.readably into pr.opts.display 2019-08-25 17:27:16 +03:00
Lassi Kortela 726b7cad29 Decode printer options into a printer_options struct 2019-08-25 17:19:47 +03:00
Lassi Kortela 49e0a3ad1f Put all printer state into a global struct 2019-08-25 16:56:02 +03:00
Lassi Kortela 6defff3696 Refactor print_width and enforce minimum value 20 2019-08-25 13:42:26 +03:00
Lassi Kortela 96962da3d3 Rename print_circle_prefix -> write_cycle_prefix 2019-08-25 13:20:30 +03:00
Lassi Kortela 84c10258b3 Rename printer vars that track cyclic structures 2019-08-25 13:15:27 +03:00
Lassi Kortela dd3cc748ec Rename Lisp printer state variables 2019-08-25 12:58:40 +03:00
Lassi Kortela 098a991ed8 Turn print_princ into print_readably 2019-08-25 12:49:56 +03:00
Lassi Kortela 4550e1ba79 Rename SCR_WIDTH to print_width 2019-08-25 12:45:48 +03:00
Lassi Kortela 8b6b2d96e4 Comment variables used by Lisp printer 2019-08-25 12:41:24 +03:00
Lassi Kortela 2b9e15920b Fix off-by-one error 2019-08-23 00:40:41 +03:00
Lassi Kortela 9d4bf19367 Fix regression in ios_printf implementation
There was some problem with the way the varargs are handled. We had to
need to make (at least one) copy of them with va_copy(). The code is
brittle and I don't understand it, so just rip it all out and replace
with a fixed-size static buffer. It's a hack but we'll soon get rid of
printf completely so this will get us through the day until then.
2019-08-23 00:38:10 +03:00
Lassi Kortela da02e9e554 Add missing sys/stat.h
Fixes failed OpenBSD build. How did it work before?
2019-08-22 00:05:57 +03:00
Lassi Kortela 34d417b4fc Change library name to (upscheme 2019 unstable)
The "unstable" is a new addition.
2019-08-21 22:18:53 +03:00
Lassi Kortela 682cbf2400 Add builtin_spawn stub for Windows 2019-08-21 22:18:20 +03:00
Lassi Kortela 2ff16a0182 Add Windows ID functions
Mostly of them are dummy placeholders that return false
2019-08-21 22:17:06 +03:00
Lassi Kortela b2027fe023 Split setenv/unsetenv by platform
Windows apparently doesn't have unsetenv() at all, so use the WinAPI
native envar functions instead of the usual C ones.
2019-08-21 22:16:07 +03:00
Lassi Kortela 5caf337589 Stub builtin_environment_stack for Windows 2019-08-21 22:15:19 +03:00
Lassi Kortela 0d95c386ac Fix socket includes 2019-08-21 22:14:04 +03:00
Lassi Kortela ebefb2a519 Stub time functions for Windows
Need to rethink all time stuff and read the relevant SRFIs.
2019-08-21 22:12:19 +03:00
Lassi Kortela 6ffe6bf174 Add truly sinful float hacks for Watcom 2019-08-21 22:11:05 +03:00
Lassi Kortela 439eeb2b06 Use vsnprintf() instead of vasprintf()
Windows doesn't reliably offer *asprintf() (sprintf functions that
automatically malloc as much memory as they need) so hand-roll the
equivalent on all platforms.
2019-08-21 22:10:13 +03:00
Lassi Kortela c76379e6f5 Brace try/except in main() for Watcom 2019-08-21 22:08:21 +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 debbcdf857 Add missing #endif 2019-08-19 09:49:14 +03:00
Lassi Kortela ddb6116df9 Add bits and endian for Watcom compiler 2019-08-19 01:20:40 +03:00
Lassi Kortela a6fd653000 Add missing includes for Windows 2019-08-19 01:20:02 +03:00
Lassi Kortela 69f46bd4c2 Do not use special _fileno for windows 2019-08-19 01:19:03 +03:00
Lassi Kortela d12fd5cea7 Split _enonfatal() for Windows 2019-08-19 01:18:36 +03:00
Lassi Kortela 35acc782d9 Remove asm byteswap implementations 2019-08-19 01:17:54 +03:00
Lassi Kortela e2dffd97fe Remove time.now and parsetime functions 2019-08-19 01:15:28 +03:00
Lassi Kortela 023937e5ea Use backward compatible variable initializers 2019-08-19 01:14:09 +03:00
Lassi Kortela 486ec48a76 Remove spurious time includes 2019-08-18 13:44:06 +03:00
Lassi Kortela d065a0039d Define float_t and double_t for Watcom C 2019-08-18 13:40:25 +03:00
Lassi Kortela 9571262535 Use backward compatible variable initializers 2019-08-18 13:40:04 +03:00
Lassi Kortela 7025b8cd32 Split fl_path_exists() into Unix and Windows 2019-08-18 13:39:08 +03:00
Lassi Kortela 3448e8f150 Include missing <stdarg.h> 2019-08-18 13:36:43 +03:00
Lassi Kortela 3dc58baa4a Include <sys/types.h> to get off_t
This header is even shipped by Windows compilers. The iostream stuff
uses off_t.
2019-08-18 00:09:43 +03:00
Lassi Kortela baea23ab29 Switch to portable noreturn attributes 2019-08-18 00:07:46 +03:00
Lassi Kortela edf7c991f4 Remove unneeded DLLEXPORT and STDCALL macros 2019-08-17 22:55:25 +03:00
Lassi Kortela b60d330df1 Add hacky subprocess spawn procedure 2019-08-14 20:31:39 +03:00
Lassi Kortela 2d0add09d5 Add color-name->rgb24 procedure 2019-08-14 20:02:48 +03:00
Lassi Kortela cfdb8f2928 Add get-ID procedures from draft SRFI 170 2019-08-14 17:48:13 +03:00
Lassi Kortela ca8e23c079 Add builtins.h file missing from last commit 2019-08-14 13:54:50 +03:00
Lassi Kortela 78a04430ce Add read-ini-file procedure
Reads a .ini file into an association list. No [section] parsing yet.
2019-08-14 13:49:56 +03:00
Lassi Kortela 7ac23c6f0b Add scanner interface to "struct buf"
Can be used to easily write simple parsers in C.
2019-08-14 13:46:50 +03:00
Lassi Kortela 44a8208d38 Add buf_put_ios() utility function
Fills a "struct buf" with the entire remainder of a stream.
2019-08-14 13:39:11 +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 bf11066313 Add stubs for Haiku, Minix and Solaris 2019-08-14 00:01:26 +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