Commit graph

45 commits

Author SHA1 Message Date
Alex Shinn
77f2990f28 factoring (chibi posix) into filesystem, process and time modules.
the time module is garbage, because libc time handling is garbage.
the signal handling is still experimental, use at your own risk.
still need a host module for user/group and other host information.
2009-12-25 21:11:56 +09:00
Alex Shinn
bfbc9313ed fixing import bug (was ignoring exports list except when using
only/except/rename/prefix modifiers)
2009-12-24 14:53:30 +09:00
Alex Shinn
6da435d21c at great pains, the stubber can generate (ugly) code for getcwd 2009-12-22 22:33:53 +09:00
Alex Shinn
ffdce3639b adding import-immutable to minimize heap usage 2009-12-20 16:08:19 +09:00
Alex Shinn
828c6cc35a adding support for module search paths
You want to use the CHIBI_MODULE_PATH environment variable now,
not CHIBI_MODULE_DIR, and can use : separators as expected.
The default main now also accepts -I<dir> and -A<dir> to prepend
or append module directories.

The default path is ".:./lib:$PREFIX/share/chibi".  The first
two may be removed in a future version.
2009-12-18 21:26:59 +09:00
Alex Shinn
d978e750aa moving library initialization logic from main.c to eval.c.
main is just minimal option parsing plus a simple repl now.
still need to switch to using a module path instead of a
single module dir.
2009-12-18 17:31:10 +09:00
Alex Shinn
6fe11ffcd1 Renaming all USE_ settings and all OP_, OPC_ and CORE_ enums
to have an SEXP_ prefix.  Now all values from the headers
are prefixed with either sexp_ or SEXP_, important for ease
of embedding.  "make USE_BOEHM=1" still works as an alias
for "make SEXP_USE_BOEHM=1".

Sorry if this patch breaks your code, it had to be done
sooner or later.
2009-12-18 15:58:23 +09:00
Alex Shinn
3861a5b599 adding optimization plugin infrastructure 2009-12-17 16:27:55 +09:00
Alex Shinn
9d44cbd99a adding SRFI-0 cond-expand 2009-12-16 20:15:45 +09:00
Alex Shinn
e0c4d1d5bf fixing define splicing for let-syntax (issue #13) 2009-12-16 18:39:11 +09:00
Alex Shinn
c6b0c2319c adding srfi-27 2009-12-16 17:43:56 +09:00
Alex Shinn
99d8c585f9 adding srfi-33 support (needs testing) 2009-12-14 13:46:04 +09:00
Alex Shinn
2ddafc2239 recovering gracefully from out-of-stack-space errors 2009-12-12 17:29:54 +09:00
Alex Shinn
2a424658b0 adding extra lambda accessors to ast lib 2009-12-12 16:30:06 +09:00
Alex Shinn
0efd491c24 fixing nested let-syntax hygiene, simplifying error handling
also providing better errors in some cases, and exiting with
a non-zero status on script errors
2009-12-06 17:40:50 +09:00
Alex Shinn
d67e8b46aa makefile fixes from derick eddington 2009-12-05 18:54:04 +09:00
Alex Shinn
035aa7005c no longer exit(2)ing on OOM, pre-allocating a global OOM exception 2009-12-05 17:34:27 +09:00
Alex Shinn
5d2f5912ce adding parent links to cpointers to prevent freeing shared structures 2009-12-05 17:17:55 +09:00
Alex Shinn
b49153dfdf adding time_t type handling to stubber, with 2010 "chibi" epoch 2009-12-02 03:13:04 +09:00
Alex Shinn
ce9bc2edeb minor bignum bugfixes 2009-11-30 01:10:15 +09:00
Alex Shinn
d0aa8de1e6 adding basic finalizer functionality 2009-11-28 18:27:42 +09:00
Alex Shinn
353594a028 fixing some 64-bit bignum arithmetic cases 2009-11-28 16:05:59 +09:00
Alex Shinn
671b983214 adding (chibi match) module 2009-11-23 02:07:05 +09:00
Alex Shinn
8481f543a9 cleanup, making infinities optional, fixing build for plan9 2009-11-23 01:54:22 +09:00
Alex Shinn
66bd9a52bb no more globals!
Each contexts keep a link to the heap which it is a part
of (when using the native GC), as well as a vector of
special globals that it needs quick access to (e.g. the
`quote' and `quasiquote', etc. symbols.  You can use this
to manage multiple completely unrelated VMs in the same
application, and everything will be thread-safe.

The old behavior is still available by editing config.h,
which now includes somewhat better descriptions of all
the settings.
2009-11-23 01:13:42 +09:00
Alex Shinn
3ecea4d666 adding define_foreign_opt to bind C functions with optional parameters
moving several opcodes to normal FFI functions, considering
doing the same for all I/O opcodes.
2009-11-16 04:04:23 +09:00
Alex Shinn
0581b41b1e adding hash-tables and a more friendly FFI 2009-11-16 00:52:16 +09:00
Alex Shinn
311c567c06 making EQUAL? comparison data-driven
all native types, present and future, now supported.
allows for distinguishing which slots should be used
for comparison (e.g. source info of pairs isn't compared).
2009-11-15 18:45:08 +09:00
Alex Shinn
f53e4df208 adding support for runtime definition of new types 2009-11-10 21:50:59 +09:00
Alex Shinn
f9b50ba909 renaming env_define to sexp_env_define since it's a public API 2009-11-05 20:51:35 +09:00
Alex Shinn
1cdd7edfa5 adding support for dynamic loading shared libraries
load now recognizes ".so" files and loads them with dlopen,
then calls sexp_init_library(ctx, env) from that library.
2009-11-05 20:41:01 +09:00
Alex Shinn
c4625e1c86 fixnum/integer naming cleanup
Replacing sexp_make_integer, sexp_integerp, etc. with sexp_make_fixnum,
sexp_fixnump, etc.  Defining the old names as variants handling either
fixnums or bignums, or just as aliases for the new terms when compiled
without bignum support.  sexp_make_integer needs to take a context now
in case it generates a bignum.
2009-11-02 23:39:42 +09:00
Alex Shinn
576a20b3bc simplifying gc variable preservation
Adding sexp_gc_var1..6 and corresponding _preserve/release1..6
referring to fixed preservation variable names, to substantially
reduce the boilerplate on C functions which produce temporary sexp
values.  The fixed variable names are safe because we never nest
them within the same C function.  The original macros are still
available for manual naming, block local variables and cases of
more than 6 gc vars.

Consider combining var+preserve into a single macro, since splitting
them is rare.
2009-11-01 19:48:30 +09:00
Alex Shinn
445f8e9fa4 adding bignum support for 64-bit machines
using gcc 128-bit register extensions to hold the result of
multpliying two 64-bit integers.
2009-11-01 18:53:32 +09:00
Alex Shinn
91efc04852 fixes for 64-bit machines 2009-11-01 17:17:06 +09:00
Alex Shinn
e50950316f commenting out name used for debugging stack references into the heap 2009-10-14 10:42:10 +09:00
Alex Shinn
62c390d68e initial module system 2009-10-13 18:29:18 +09:00
Alex Shinn
8ba102c5c4 adding initial untyped "cpointer" data type 2009-08-11 01:14:39 +09:00
Alex Shinn
9951c8e921 adding extended numeric tests and fixes for the bignum bugs it turned up 2009-07-15 23:56:51 +09:00
Alex Shinn
4ba0705f05 fixing trunc for real now
(hopefully... getting sleepy)
2009-07-14 01:45:16 +09:00
Alex Shinn
e780c122c0 fixing definition of trunc for plan9 2009-07-14 01:36:37 +09:00
Alex Shinn
5d94079e4a more cleanup and portability fixes
Using <u.h> and <libc.h> for plan9, no need for separate .i file
construction.  Also mkfile now simplified and using /sys/src/cmd/mkone
(thanks to Charles Forsyth).
2009-07-14 00:34:23 +09:00
Alex Shinn
6d709264bd Cleanup for more pedantic C.
Notably no longer converting from function pointers <-> void*.

Remaining --pedantic warnings:

  * ISO C90 does not support 'long long'
  * ISO C90 does not support the 'z' printf length modifier
  * ISO C90 does not support flexible array members
  * ISO C90 forbids mixed declarations and code
  * ISO C90 forbids specifying subobject to initialize
  * anonymous variadic macros were introduced in C99
  * invalid use of structure with flexible array member

The first one is only used when optional bignums are enabled,
and I have no intention of supporting bignums on systems w/o
long long (although it's not guaranteed two words fit in a
long long - I need to fix this).

The 'z' modifier is necessary for long types (you'd get
warnings the other way without it).

The next 4 are intentional - they make the code cleaner,
and all of these extensions are supported by Plan 9.

The last one is tricky.  I think it refers to the fact
that not only am I using flexible array members, but I'm
using them as non-final alternates in a union.  I'll have
to double check the semantics of this.
2009-07-12 23:46:27 +09:00
Alex Shinn
41f54a7f41 initial windows mingw support patch from felix winkelmann 2009-07-07 19:58:28 +09:00
Alex Shinn
b1c0ea895b committing initial bignum support, still needs more thorough testing.
can disable with USE_BIGNUMS=0 - the interactions between this and
USE_FLONUMS are messy, so they will likely be merged into a single
option in the near future (i.e. you either have only fixnums, or a
full range of numeric types).
adding rationals based on this would be easy and is a likely future
feature.  adding native support for complex numbers is unlikely.
2009-07-07 19:16:23 +09:00