Scheme.h
/*
* $Id$
*
* Scheme interpeter
* Copyright (c) 2005-2012 edelib authors
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __EDELIB_SCHEME_H__
#define __EDELIB_SCHEME_H__
#ifndef SKIP_DOCS
# include "ts/scheme.h"
# include "ts/scheme-private.h"
#endif
typedef scheme edelib_scheme_t;
typedef pointer edelib_scheme_pointer_t;
scheme *edelib_scheme_init(void);
#define edelib_scheme_init_raw scheme_init_new
#define edelib_scheme_deinit scheme_deinit
#define edelib_scheme_load_file scheme_load_file
#define edelib_scheme_load_named_file scheme_load_named_file
#define edelib_scheme_load_string scheme_load_string
#define edelib_scheme_eval scheme_eval
#define edelib_scheme_apply0 scheme_apply0
#define edelib_scheme_set_external_data scheme_set_external_data
#define edelib_scheme_get_external_data(sc) (sc)->ext_data
#define edelib_scheme_define scheme_define
#define edelib_scheme_call scheme_call
#define edelib_scheme_set_input_port_file scheme_set_input_port_file
#define edelib_scheme_set_output_port_file scheme_set_output_port_file
#define edelib_scheme_set_input_port_string scheme_set_input_port_string
#define edelib_scheme_set_output_port_string scheme_set_output_port_string
#define edelib_scheme_gensym(sc) (sc)->vptr->gensym(sc)
#define edelib_scheme_cons(sc, a, b) _cons((sc), a, b, 0)
#define edelib_scheme_immutable_cons(sc, a, b) _cons((sc), a, b, 1)
#define edelib_scheme_reserve_cells(sc, n) (sc)->vptr->reserve_cells(sc, n)
#define edelib_scheme_mk_int(sc, num) (sc)->vptr->mk_integer(sc, num)
#define edelib_scheme_mk_double(sc, num) (sc)->vptr->mk_real(sc, num)
#define edelib_scheme_mk_symbol(sc, sym) (sc)->vptr->mk_symbol(sc, sym)
#define edelib_scheme_mk_string(sc, str) (sc)->vptr->mk_string(sc, str)
#define edelib_scheme_mk_string_counted(sc, str) (sc)->vptr->mk_counted_string(sc, str)
#define edelib_scheme_mk_character(sc, c) (sc)->vptr->mk_character(sc, c)
#define edelib_scheme_mk_vector(sc, len) (sc)->vptr->mk_vector(sc, len)
#define edelib_scheme_mk_foreign_func(sc, func) (sc)->vptr->mk_foreign_func(sc, func)
#define edelib_scheme_putstr(sc, str) (sc)->vptr->putstr(sc, str)
#define edelib_scheme_putcharacter(sc, c) (sc)->vptr->putcharacter(sc, c)
#define edelib_scheme_is_string(sc, p) (sc)->vptr->is_string(p)
#define edelib_scheme_string_value(sc, p) (sc)->vptr->string_value(p)
#define edelib_scheme_is_int(sc, p) (sc)->vptr->is_number(p)
#define edelib_scheme_int_value(sc, p) (int)((sc)->vptr->ivalue(p))
#define edelib_scheme_is_double(sc, p) (sc)->vptr->is_real(p)
#define edelib_scheme_double_value(sc, p) (sc)->vptr->rvalue(p)
#define edelib_scheme_is_char(sc, p) (sc)->vptr->is_character(p)
#define edelib_scheme_char_value(sc, p) (sc)->vptr->charvalue(p)
#define edelib_scheme_is_vector(sc, p) (sc)->vptr->is_vector(p)
#define edelib_scheme_vector_len(sc, p) (sc)->vptr->vector_length(p)
#define edelib_scheme_vector_fill(sc, vec, v) (sc)->vptr->fill_vector(vec, v)
#define edelib_scheme_vector_elem(sc, vec, i) (sc)->vptr->vector_elem(vec, i)
#define edelib_scheme_vector_elem_set(sc, vec, i, newel) (sc)->vptr->set_vector_elem(vec, i, newel)
#define edelib_scheme_is_port(sc, p) (sc)->vptr->is_port(p)
#define edelib_scheme_is_pair(sc, p) (sc)->vptr->is_pair(p)
#define edelib_scheme_pair_car(sc, p) (sc)->vptr->pair_car(p)
#define edelib_scheme_pair_cdr(sc, p) (sc)->vptr->pair_cdr(p)
#define edelib_scheme_car_set(sc, p, q) (sc)->vptr->set_car(p, q)
#define edelib_scheme_cdr_set(sc, p, q) (sc)->vptr->set_cdr(p, q)
#define edelib_scheme_is_symbol(sc, p) (sc)->vptr->is_symbol(p)
#define edelib_scheme_symname(sc, p) (sc)->vptr->symname(p)
#define edelib_scheme_is_syntax(sc, p) (sc)->vptr->is_syntax(p)
#define edelib_scheme_syntaxname(sc, p) (sc)->vptr->syntaxname(p)
#define edelib_scheme_is_proc(sc, p) (sc)->vptr->is_proc(p)
#define edelib_scheme_is_macro(sc, p) (sc)->vptr->is_macro(p)
#define edelib_scheme_is_foreign(sc, p) (sc)->vptr->is_foreign(p)
#define edelib_scheme_closure_code(sc, p) (sc)->vptr->closure_code(p)
#define edelib_scheme_closure_env(sc, p) (sc)->vptr->closure_env(p)
#define edelib_scheme_is_continuation(sc, p) (sc)->vptr->is_continuation(p)
#define edelib_scheme_is_promise(sc, p) (sc)->vptr->is_promise(p)
#define edelib_scheme_is_environment(sc, p) (sc)->vptr->is_environment(p)
#define edelib_scheme_is_immutable(sc, p) (sc)->vptr->is_immutable(p)
#define edelib_scheme_set_immutable(sc, p) (sc)->vptr->setimmutable(p)
#define EDELIB_SCHEME_DEFINE(sc, func_ptr, func_name) \
sc->vptr->scheme_define(sc, sc->global_env, \
sc->vptr->mk_symbol(sc, func_name), \
sc->vptr->mk_foreign_func(sc, func_ptr))
#define EDELIB_SCHEME_DEFINE2(sc, func_ptr, func_name, doc) \
do { \
scheme_load_string(sc, "(add-doc " #func_name " " #doc ")"); \
EDELIB_SCHEME_DEFINE(sc, func_ptr, func_name); \
} while(0)
#define EDELIB_SCHEME_OBJECT(sc) ((sc)->vptr)
#define EDELIB_SCHEME_GLOBAL_ENV(sc) ((sc)->global_env)
#define EDELIB_SCHEME_IS_NIL(sc, var) ((var) == sc->NIL)
#endif
edelib_scheme_init
scheme * edelib_scheme_init(void)
edelib_scheme_t
scheme edelib_scheme_t
Definition: Scheme.h:49
edelib_scheme_pointer_t
pointer edelib_scheme_pointer_t
Definition: Scheme.h:55