diff --git a/Makefile b/Makefile index e1e8b215..fb8145c0 100644 --- a/Makefile +++ b/Makefile @@ -86,9 +86,9 @@ sexp-ulimit.o: sexp.c $(BASE_INCLUDES) main.o: main.c $(INCLUDES) $(CC) -c $(XCPPFLAGS) $(XCFLAGS) -o $@ $< -SEXP_OBJS = gc.o sexp.o opt/bignum.o -SEXP_ULIMIT_OBJS = gc.o sexp-ulimit.o opt/bignum.o -EVAL_OBJS = opcodes.o vm.o eval.o opt/simplify.o +SEXP_OBJS = gc.o sexp.o bignum.o +SEXP_ULIMIT_OBJS = gc.o sexp-ulimit.o bignum.o +EVAL_OBJS = opcodes.o vm.o eval.o simplify.o libchibi-sexp$(SO): $(SEXP_OBJS) $(CC) $(CLIBFLAGS) -o $@ $^ $(XLDFLAGS) diff --git a/opt/bignum.c b/bignum.c similarity index 100% rename from opt/bignum.c rename to bignum.c diff --git a/eval.c b/eval.c index 1bf2d333..62bf6348 100644 --- a/eval.c +++ b/eval.c @@ -1583,10 +1583,6 @@ sexp sexp_make_promise (sexp ctx, sexp self, sexp_sint_t n, sexp done, sexp val) } #endif -#ifdef PLAN9 -#include "opt/plan9.c" -#endif - /***************************** opcodes ********************************/ #if SEXP_USE_TYPE_DEFS diff --git a/include/chibi/eval.h b/include/chibi/eval.h index 03236f03..9c0c6da1 100644 --- a/include/chibi/eval.h +++ b/include/chibi/eval.h @@ -193,6 +193,34 @@ SEXP_API sexp sexp_make_setter_op (sexp ctx, sexp self, sexp_sint_t n, sexp name SEXP_API sexp sexp_type_slot_offset_op (sexp ctx, sexp self, sexp_sint_t n, sexp type, sexp index); #endif +#ifdef PLAN9 +SEXP_API sexp sexp_rand (sexp ctx, sexp self, sexp_sint_t n); +SEXP_API sexp sexp_srand (sexp ctx, sexp self, sexp_sint_t n, sexp seed); +SEXP_API sexp sexp_file_exists_p (sexp ctx, sexp self, sexp_sint_t n, sexp path); +SEXP_API sexp sexp_fdopen (sexp ctx, sexp self, sexp_sint_t n, sexp fd, sexp mode); +SEXP_API sexp sexp_fileno (sexp ctx, sexp self, sexp_sint_t n, sexp port); +SEXP_API sexp sexp_fork (sexp ctx, sexp self, sexp_sint_t n); +SEXP_API sexp sexp_exec (sexp ctx, sexp self, sexp_sint_t n, sexp name, sexp args); +SEXP_API void sexp_exits (sexp ctx, sexp self, sexp_sint_t n, sexp msg); +SEXP_API sexp sexp_dup (sexp ctx, sexp self, sexp_sint_t n, sexp oldfd, sexp newfd); +SEXP_API sexp sexp_pipe (sexp ctx, sexp self, sexp_sint_t n); +SEXP_API sexp sexp_sleep (sexp ctx, sexp self, sexp_sint_t n, sexp msecs); +SEXP_API sexp sexp_getenv (sexp ctx, sexp self, sexp_sint_t n, sexp name); +SEXP_API sexp sexp_getwd (sexp ctx, sexp self, sexp_sint_t n); +SEXP_API sexp sexp_chdir (sexp ctx, sexp self, sexp_sint_t n, sexp path); +SEXP_API sexp sexp_getuser (sexp ctx, sexp self, sexp_sint_t n); +SEXP_API sexp sexp_sysname (sexp ctx, sexp self, sexp_sint_t n); +SEXP_API sexp sexp_wait (sexp ctx, sexp self, sexp_sint_t n); +SEXP_API sexp sexp_postnote (sexp ctx, sexp self, sexp_sint_t n, sexp pid, sexp note); +SEXP_API sexp sexp_postmountsrv (sexp ctx, sexp self, sexp_sint_t n, sexp ls, sexp name, sexp mtpt, sexp flags); +SEXP_API sexp sexp_9p_req_offset (sexp ctx, sexp self, sexp_sint_t n, sexp req); +SEXP_API sexp sexp_9p_req_count (sexp ctx, sexp self, sexp_sint_t n, sexp req); +SEXP_API sexp sexp_9p_req_fid (sexp ctx, sexp self, sexp_sint_t n, sexp req); +SEXP_API sexp sexp_9p_req_newfid (sexp ctx, sexp self, sexp_sint_t n, sexp req); +SEXP_API sexp sexp_9p_respond (sexp ctx, sexp self, sexp_sint_t n, sexp req, sexp err); +SEXP_API sexp sexp_9p_responderror (sexp ctx, sexp self, sexp_sint_t n, sexp req); +#endif + #if SEXP_USE_SIMPLIFY SEXP_API int sexp_rest_unused_p (sexp lambda); #else diff --git a/include/chibi/sexp.h b/include/chibi/sexp.h index 5c20fa76..87513549 100755 --- a/include/chibi/sexp.h +++ b/include/chibi/sexp.h @@ -25,8 +25,10 @@ extern "C" { #if SEXP_USE_DL #include #endif +#ifndef PLAN9 #include #include +#endif #if SEXP_USE_GREEN_THREADS #include #include diff --git a/mkfile b/mkfile index 0cabf51c..791f949b 100644 --- a/mkfile +++ b/mkfile @@ -11,7 +11,7 @@ CPPFLAGS= -Iinclude -DPLAN9 -DSEXP_USE_GREEN_THREADS=0 CFLAGS= -p $CPPFLAGS CFLAGS_STATIC=$CFLAGS -DSEXP_USE_STATIC_LIBS -OFILES=sexp.$O eval.$O main.$O $STATIC +OFILES=gc.$O sexp.$O bignum.$O opcodes.$O plan9.$O vm.$O simplify.$O eval.$O main.$O $STATIC HFILES=include/chibi/sexp.h include/chibi/eval.h include/chibi/features.h include/chibi/install.h CLEANFILES=tests/basic/*.out tests/basic/*.err @@ -107,5 +107,3 @@ test-unicode: test-libs: ./$O.out -xscheme tests/lib-tests.scm - -sexp.c:N: gc.c opt/bignum.c diff --git a/opt/plan9.c b/plan9.c similarity index 99% rename from opt/plan9.c rename to plan9.c index 23ff33ce..5022acad 100644 --- a/opt/plan9.c +++ b/plan9.c @@ -1,7 +1,9 @@ /* plan9.c -- extended Plan 9 system utils */ -/* Copyright (c) 2009-2010 Alex Shinn. All rights reserved. */ +/* Copyright (c) 2009-2012 Alex Shinn. All rights reserved. */ /* BSD-style license: http://synthcode.com/license.txt */ +#include "chibi/eval.h" + sexp sexp_rand (sexp ctx, sexp self, sexp_sint_t n) { return sexp_make_fixnum(rand()); } diff --git a/opt/simplify.c b/simplify.c similarity index 100% rename from opt/simplify.c rename to simplify.c