diff options
author | Keith Packard <keithp@keithp.com> | 2016-11-09 16:22:43 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-02-20 11:16:50 -0800 |
commit | 417161dbb36323b5a6572859dedad02ca92fc65c (patch) | |
tree | e8d8476ec82339bb655dbd0c9d1f95cba90caadc /src/lisp/ao_lisp.h | |
parent | 0ee44c8e4bf5dabe6a97bf76b366c8b767c387f8 (diff) |
altos/lisp: Clean up OS integration bits, add defun
Provide an abstraction for the OS interface so that it
can build more cleanly on Linux and AltOS. Add defun macro.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lisp/ao_lisp.h')
-rw-r--r-- | src/lisp/ao_lisp.h | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/lisp/ao_lisp.h b/src/lisp/ao_lisp.h index 82ba5a20..de55b307 100644 --- a/src/lisp/ao_lisp.h +++ b/src/lisp/ao_lisp.h @@ -15,17 +15,10 @@ #ifndef _AO_LISP_H_ #define _AO_LISP_H_ -#include <stdlib.h> - -#if !defined(AO_LISP_TEST) && !defined(AO_LISP_MAKE_CONST) -#include <ao.h> -#define AO_LISP_ALTOS 1 -#define abort() ao_panic(1) -#endif - #include <stdint.h> #include <string.h> -#include <stdio.h> +//#include <stdio.h> +#include <ao_lisp_os.h> #ifdef AO_LISP_MAKE_CONST #define AO_LISP_POOL_CONST 16384 @@ -45,6 +38,8 @@ extern uint8_t ao_lisp_const[AO_LISP_POOL_CONST]; #define _ao_lisp_atom_last _atom("last") #define _ao_lisp_atom_cond _atom("cond") #define _ao_lisp_atom_lambda _atom("lambda") +#define _ao_lisp_atom_led _atom("led") +#define _ao_lisp_atom_delay _atom("delay") #else #include "ao_lisp_const.h" #ifndef AO_LISP_POOL @@ -99,7 +94,7 @@ ao_lisp_is_const(ao_poly poly) { static inline void * ao_lisp_ref(ao_poly poly) { if (poly == 0xBEEF) - abort(); + ao_lisp_abort(); if (poly == AO_LISP_NIL) return NULL; if (poly & AO_LISP_CONST) @@ -227,12 +222,14 @@ enum ao_lisp_builtin_id { builtin_greater, builtin_less_equal, builtin_greater_equal, + builtin_delay, + builtin_led, _builtin_last }; typedef ao_poly (*ao_lisp_func_t)(struct ao_lisp_cons *cons); -extern ao_lisp_func_t ao_lisp_builtins[]; +extern const ao_lisp_func_t ao_lisp_builtins[]; static inline ao_lisp_func_t ao_lisp_func(struct ao_lisp_builtin *b) |