klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

commit f9e1d37095dedd8c30b373555813ec904f0129c2
parent 43c8008d8ebda38c9c9e8ad2fe5ab3e0790a9ddb
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Fri, 15 Jul 2011 23:48:55 -0300

Added system module (for time, env variables, cmd arguments and some file operations).

Diffstat:
Msrc/Makefile | 26+++++++++++++++-----------
Msrc/kgports.c | 2+-
Asrc/kgsystem.c | 37+++++++++++++++++++++++++++++++++++++
Asrc/kgsystem.h | 26++++++++++++++++++++++++++
4 files changed, 79 insertions(+), 12 deletions(-)

diff --git a/src/Makefile b/src/Makefile @@ -34,7 +34,7 @@ CORE_O= kobject.o ktoken.o kpair.o kstring.o ksymbol.o kread.o \ kgsymbols.o kgcontrol.o kgpairs_lists.o kgpair_mut.o kgenvironments.o \ kgenv_mut.o kgcombiners.o kgcontinuations.o kgencapsulations.o \ kgpromises.o kgkd_vars.o kgks_vars.o kgports.o kgchars.o kgnumbers.o \ - kgstrings.o kgblobs.o + kgstrings.o kgblobs.o kgsystem.o # TEMP: in klisp there is no distinction between core & lib LIB_O= @@ -101,6 +101,8 @@ kapplicative.o: kapplicative.c kobject.h klimits.h klisp.h klispconf.h \ kstate.h ktoken.h kmem.h kapplicative.h koperative.h kgc.h kauxlib.o: kauxlib.c klisp.h kobject.h klimits.h klispconf.h kstate.h \ ktoken.h kmem.h +kblob.o: kblob.c kblob.h kobject.h klimits.h klisp.h klispconf.h kstate.h \ + ktoken.h kmem.h kgc.h kcontinuation.o: kcontinuation.c kcontinuation.h kobject.h klimits.h \ klisp.h klispconf.h kstate.h ktoken.h kmem.h kgc.h kencapsulation.o: kencapsulation.c kobject.h klimits.h klisp.h \ @@ -112,13 +114,17 @@ kerror.o: kerror.c klisp.h kobject.h klimits.h klispconf.h kpair.h \ kstate.h ktoken.h kmem.h kgc.h kstring.h keval.o: keval.c klisp.h kobject.h klimits.h klispconf.h kstate.h \ ktoken.h kmem.h kpair.h kgc.h kenvironment.h kcontinuation.h kerror.h +kgblobs.o: kgblobs.c kstate.h klimits.h klisp.h kobject.h klispconf.h \ + ktoken.h kmem.h kapplicative.h koperative.h kcontinuation.h kerror.h \ + kblob.h kghelpers.h kpair.h kgc.h kenvironment.h ksymbol.h kstring.h \ + kgblobs.h kgnumbers.h kgbooleans.o: kgbooleans.c kobject.h klimits.h klisp.h klispconf.h \ kstate.h ktoken.h kmem.h kpair.h kgc.h ksymbol.h kstring.h \ kcontinuation.h kerror.h kghelpers.h kapplicative.h koperative.h \ kenvironment.h kgc.o: kgc.c kgc.h kobject.h klimits.h klisp.h klispconf.h kstate.h \ - ktoken.h kmem.h kport.h imath.h imrat.h ktable.h kstring.h kerror.h \ - kblob.h + ktoken.h kmem.h kport.h imath.h imrat.h ktable.h kstring.h kblob.h \ + kerror.h kgchars.o: kgchars.c kstate.h klimits.h klisp.h kobject.h klispconf.h \ ktoken.h kmem.h kapplicative.h koperative.h kcontinuation.h kerror.h \ kghelpers.h kpair.h kgc.h kenvironment.h ksymbol.h kstring.h kgchars.h @@ -193,7 +199,7 @@ kground.o: kground.c kstate.h klimits.h klisp.h kobject.h klispconf.h \ kgequalp.h kgsymbols.h kgcontrol.h kgpairs_lists.h kgpair_mut.h \ kgenvironments.h kgenv_mut.h kgcombiners.h kgcontinuations.h \ kgencapsulations.h kgpromises.h kgkd_vars.h kgks_vars.h kgnumbers.h \ - kgstrings.h kgchars.h kgports.h ktable.h keval.h krepl.h + kgstrings.h kgchars.h kgports.h kgblobs.h ktable.h keval.h krepl.h kgstrings.o: kgstrings.c kstate.h klimits.h klisp.h kobject.h klispconf.h \ ktoken.h kmem.h kapplicative.h koperative.h kcontinuation.h kerror.h \ ksymbol.h kstring.h kghelpers.h kpair.h kgc.h kenvironment.h kgchars.h \ @@ -202,6 +208,10 @@ kgsymbols.o: kgsymbols.c kstate.h klimits.h klisp.h kobject.h klispconf.h \ ktoken.h kmem.h kcontinuation.h kpair.h kgc.h kstring.h ksymbol.h \ kerror.h kghelpers.h kapplicative.h koperative.h kenvironment.h \ kgsymbols.h +kgsystem.o: kgsystem.c kstate.h klimits.h klisp.h kobject.h klispconf.h \ + ktoken.h kmem.h kpair.h kgc.h kerror.h kghelpers.h kapplicative.h \ + koperative.h kcontinuation.h kenvironment.h ksymbol.h kstring.h \ + kgsystem.h kinteger.o: kinteger.c kinteger.h kobject.h klimits.h klisp.h klispconf.h \ kstate.h ktoken.h kmem.h imath.h kgc.h klisp.o: klisp.c klimits.h klisp.h kobject.h klispconf.h kstate.h \ @@ -230,7 +240,7 @@ krepl.o: krepl.c klisp.h kobject.h klimits.h klispconf.h kstate.h \ kstate.o: kstate.c klisp.h kobject.h klimits.h klispconf.h kstate.h \ ktoken.h kmem.h kstring.h kpair.h kgc.h keval.h koperative.h \ kapplicative.h kcontinuation.h kenvironment.h kground.h krepl.h \ - ksymbol.h kport.h ktable.h kgpairs_lists.h kghelpers.h kerror.h kblob.h + ksymbol.h kport.h ktable.h kblob.h kgpairs_lists.h kghelpers.h kerror.h kstring.o: kstring.c kstring.h kobject.h klimits.h klisp.h klispconf.h \ kstate.h ktoken.h kmem.h kgc.h ksymbol.o: ksymbol.c ksymbol.h kobject.h klimits.h klisp.h klispconf.h \ @@ -250,9 +260,3 @@ imath.o: imath.c imath.h kobject.h klimits.h klisp.h klispconf.h kstate.h \ ktoken.h kmem.h kerror.h imrat.o: imrat.c imrat.h imath.h kobject.h klimits.h klisp.h klispconf.h \ kstate.h ktoken.h kmem.h kerror.h -kblob.o: kblob.c kblob.h kobject.h klimits.h klisp.h klispconf.h \ - kstate.h ktoken.h kmem.h kgc.h -kgblobs.o: kgblobs.c kstate.h klimits.h klisp.h kobject.h klispconf.h \ - ktoken.h kmem.h kapplicative.h koperative.h kcontinuation.h kerror.h \ - ksymbol.h kstring.h kghelpers.h kpair.h kgc.h kenvironment.h \ - kgblobs.h kgnumbers.h diff --git a/src/kgports.c b/src/kgports.c @@ -1,5 +1,5 @@ /* -** kgports.h +** kgports.c ** Ports features for the ground environment ** See Copyright Notice in klisp.h */ diff --git a/src/kgsystem.c b/src/kgsystem.c @@ -0,0 +1,37 @@ +/* +** kgsystem.c +** Ports features for the ground environment +** See Copyright Notice in klisp.h +*/ + +#include <assert.h> +#include <stdlib.h> +#include <stdbool.h> +#include <stdint.h> + +#include "kstate.h" +#include "kobject.h" +#include "kpair.h" +#include "kerror.h" + +#include "kghelpers.h" +#include "kgsystem.h" + +/* ??.?.? */ + +/* init ground */ +void kinit_system_ground_env(klisp_State *K) +{ + TValue ground_env = K->ground_env; + TValue symbol, value; + +/* TODO */ +#if 0 + /* 15.2.2 load */ + add_applicative(K, ground_env, "load", load, 0); + /* 15.2.3 get-module */ + add_applicative(K, ground_env, "get-module", get_module, 0); + /* 15.2.? display */ + add_applicative(K, ground_env, "display", display, 0); +#endif +} diff --git a/src/kgsystem.h b/src/kgsystem.h @@ -0,0 +1,26 @@ +/* +** kgsystem.h +** System features for the ground environment +** See Copyright Notice in klisp.h +*/ + +#ifndef kgsystem_h +#define kgsystem_h + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <stdint.h> + +#include "kobject.h" +#include "klisp.h" +#include "kstate.h" +#include "kghelpers.h" + +/* ??.?.? */ + +/* init ground */ +void kinit_system_ground_env(klisp_State *K); + +#endif