mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-06 20:56:38 +02:00
opcode types are now general sexps
This commit is contained in:
parent
8d1ed6da27
commit
fb8e1cf441
6 changed files with 206 additions and 143 deletions
4
eval.c
4
eval.c
|
@ -1317,8 +1317,8 @@ sexp sexp_make_opcode (sexp ctx, sexp self, sexp name, sexp op_class, sexp code,
|
|||
sexp_opcode_code(res) = sexp_unbox_fixnum(code);
|
||||
sexp_opcode_num_args(res) = sexp_unbox_fixnum(num_args);
|
||||
sexp_opcode_flags(res) = sexp_unbox_fixnum(flags);
|
||||
sexp_opcode_arg1_type(res) = sexp_unbox_fixnum(arg1t);
|
||||
sexp_opcode_arg2_type(res) = sexp_unbox_fixnum(arg2t);
|
||||
sexp_opcode_arg1_type(res) = arg1t;
|
||||
sexp_opcode_arg2_type(res) = arg2t;
|
||||
sexp_opcode_inverse(res) = sexp_unbox_fixnum(invp);
|
||||
sexp_opcode_data(res) = data;
|
||||
sexp_opcode_data2(res) = data2;
|
||||
|
|
|
@ -204,10 +204,9 @@ struct sexp_type_struct {
|
|||
};
|
||||
|
||||
struct sexp_opcode_struct {
|
||||
unsigned char op_class, code, num_args, flags,
|
||||
arg1_type, arg2_type, inverse;
|
||||
unsigned char op_class, code, num_args, flags, inverse;
|
||||
const char *name;
|
||||
sexp data, data2, proc;
|
||||
sexp data, data2, proc, ret_type, arg1_type, arg2_type, arg3_type;
|
||||
sexp_proc1 func;
|
||||
};
|
||||
|
||||
|
@ -683,13 +682,15 @@ SEXP_API sexp sexp_make_unsigned_integer(sexp ctx, sexp_luint_t x);
|
|||
#define sexp_opcode_code(x) ((x)->value.opcode.code)
|
||||
#define sexp_opcode_num_args(x) ((x)->value.opcode.num_args)
|
||||
#define sexp_opcode_flags(x) ((x)->value.opcode.flags)
|
||||
#define sexp_opcode_arg1_type(x) ((x)->value.opcode.arg1_type)
|
||||
#define sexp_opcode_arg2_type(x) ((x)->value.opcode.arg2_type)
|
||||
#define sexp_opcode_inverse(x) ((x)->value.opcode.inverse)
|
||||
#define sexp_opcode_name(x) ((x)->value.opcode.name)
|
||||
#define sexp_opcode_data(x) ((x)->value.opcode.data)
|
||||
#define sexp_opcode_data2(x) ((x)->value.opcode.data2)
|
||||
#define sexp_opcode_proc(x) ((x)->value.opcode.proc)
|
||||
#define sexp_opcode_return_type(x) ((x)->value.opcode.ret_type)
|
||||
#define sexp_opcode_arg1_type(x) ((x)->value.opcode.arg1_type)
|
||||
#define sexp_opcode_arg2_type(x) ((x)->value.opcode.arg2_type)
|
||||
#define sexp_opcode_arg3_type(x) ((x)->value.opcode.arg3_type)
|
||||
#define sexp_opcode_func(x) ((x)->value.opcode.func)
|
||||
|
||||
#define sexp_opcode_variadic_p(x) (sexp_opcode_flags(x) & 1)
|
||||
|
|
|
@ -45,6 +45,62 @@ static sexp sexp_get_opcode_name (sexp ctx sexp_api_params(self, n), sexp op) {
|
|||
return sexp_intern(ctx, sexp_opcode_name(op), -1);
|
||||
}
|
||||
|
||||
static sexp sexp_translate_opcode_type (sexp ctx, sexp type) {
|
||||
sexp_gc_var2(res, tmp);
|
||||
res = type;
|
||||
if (sexp_nullp(res)) { /* opcode list types */
|
||||
sexp_gc_preserve2(ctx, res, tmp);
|
||||
tmp = sexp_intern(ctx, "or", -1);
|
||||
res = sexp_cons(ctx, sexp_make_fixnum(SEXP_PAIR), SEXP_NULL);
|
||||
res = sexp_cons(ctx, SEXP_NULL, res);
|
||||
res = sexp_cons(ctx, tmp, res);
|
||||
sexp_gc_release2(ctx);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static sexp sexp_get_opcode_ret_type (sexp ctx sexp_api_params(self, n), sexp op) {
|
||||
sexp res;
|
||||
if (! sexp_opcodep(op))
|
||||
return sexp_type_exception(ctx, self, SEXP_OPCODE, op);
|
||||
res = sexp_opcode_return_type(op);
|
||||
if (sexp_fixnump(res))
|
||||
res = sexp_type_by_index(ctx, sexp_unbox_fixnum(res));
|
||||
return sexp_translate_opcode_type(ctx, res);
|
||||
}
|
||||
|
||||
static sexp sexp_get_opcode_param_type (sexp ctx sexp_api_params(self, n), sexp op, sexp k) {
|
||||
sexp res;
|
||||
if (! sexp_opcodep(op))
|
||||
return sexp_type_exception(ctx, self, SEXP_OPCODE, op);
|
||||
else if (! sexp_fixnump(k))
|
||||
return sexp_type_exception(ctx, self, SEXP_FIXNUM, k);
|
||||
switch (sexp_unbox_fixnum(k)) {
|
||||
case 0:
|
||||
res = sexp_opcode_arg1_type(op);
|
||||
break;
|
||||
case 1:
|
||||
res = sexp_opcode_arg2_type(op);
|
||||
break;
|
||||
default:
|
||||
res = sexp_opcode_arg3_type(op);
|
||||
if (sexp_vectorp(res)) {
|
||||
if (sexp_vector_length(res) > (sexp_unbox_fixnum(k)-2))
|
||||
res = sexp_vector_ref(res, sexp_fx_sub(k, SEXP_TWO));
|
||||
else
|
||||
res = sexp_type_by_index(ctx, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return sexp_translate_opcode_type(ctx, res);
|
||||
}
|
||||
|
||||
static sexp sexp_get_opcode_num_params (sexp ctx sexp_api_params(self, n), sexp op) {
|
||||
if (! sexp_opcodep(op))
|
||||
return sexp_type_exception(ctx, self, SEXP_OPCODE, op);
|
||||
return sexp_make_fixnum(sexp_opcode_num_args(op));
|
||||
}
|
||||
|
||||
static sexp sexp_analyze_op (sexp ctx sexp_api_params(self, n), sexp x, sexp e) {
|
||||
sexp ctx2 = ctx;
|
||||
if (sexp_envp(e)) {
|
||||
|
@ -116,6 +172,9 @@ sexp sexp_init_library (sexp ctx sexp_api_params(self, n), sexp env) {
|
|||
sexp_define_foreign(ctx, env, "extend-env", 2, sexp_extend_env);
|
||||
sexp_define_foreign(ctx, env, "env-cell", 2, sexp_get_env_cell);
|
||||
sexp_define_foreign(ctx, env, "opcode-name", 1, sexp_get_opcode_name);
|
||||
sexp_define_foreign(ctx, env, "opcode-num-params", 1, sexp_get_opcode_num_params);
|
||||
sexp_define_foreign(ctx, env, "opcode-return-type", 1, sexp_get_opcode_ret_type);
|
||||
sexp_define_foreign(ctx, env, "opcode-param-type", 1, sexp_get_opcode_param_type);
|
||||
sexp_define_foreign(ctx, env, "optimize", 1, sexp_optimize);
|
||||
return SEXP_VOID;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
(define-module (chibi ast)
|
||||
(export analyze optimize env-cell opcode-name ast->sexp macroexpand
|
||||
(export analyze optimize env-cell ast->sexp macroexpand
|
||||
lam cnd set ref seq lit
|
||||
pair-source pair-source-set!
|
||||
syntactic-closure? lambda? cnd? set? ref? seq? lit? opcode?
|
||||
syntactic-closure? lambda? cnd? set? ref? seq? lit? opcode? type?
|
||||
syntactic-closure-expr syntactic-closure-env syntactic-closure-vars
|
||||
lambda-name lambda-params lambda-body lambda-defs lambda-locals
|
||||
lambda-flags lambda-free-vars lambda-set-vars lambda-return-type
|
||||
|
@ -17,6 +17,7 @@
|
|||
set-var set-value set-var-set! set-value-set!
|
||||
ref-name ref-cell ref-name-set! ref-cell-set!
|
||||
seq-ls seq-ls-set! lit-value lit-value-set!
|
||||
opcode-name opcode-num-params opcode-return-type opcode-param-type
|
||||
procedure-code procedure-vars procedure-name bytecode-name)
|
||||
(import-immutable (scheme))
|
||||
(include-shared "ast")
|
||||
|
|
268
opcodes.c
268
opcodes.c
|
@ -1,5 +1,6 @@
|
|||
|
||||
#define _OP(c,o,n,m,t,u,i,s,d,f) {c, o, n, m, t, u, i, s, d, NULL, NULL, f}
|
||||
#define _I(n) sexp_make_fixnum(n)
|
||||
#define _OP(c,o,n,m,a1,a2,i,s,d,f) {c, o, n, m, i, s, d, NULL, NULL, _I(SEXP_OBJECT), a1, a2, SEXP_FALSE, f}
|
||||
#define _FN(o,n,m,t,u,s,d,f) _OP(SEXP_OPC_FOREIGN, o, n, m, t, u, 0, s, d, (sexp_proc1)f)
|
||||
#define _FN0(s, d, f) _FN(SEXP_OP_FCALL0, 0, 0, 0, 0, s, d, f)
|
||||
#define _FN1(t, s, d, f) _FN(SEXP_OP_FCALL1, 1, 0, t, 0, s, d, f)
|
||||
|
@ -13,164 +14,165 @@
|
|||
#define _PARAM(n, a, t) _OP(SEXP_OPC_PARAMETER, SEXP_OP_NOOP, 0, 3, t, 0, 0, n, a, 0)
|
||||
|
||||
static struct sexp_opcode_struct opcodes[] = {
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_CAR, 1, 0, SEXP_PAIR, 0, 0, "car", 0, NULL),
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_SET_CAR, 2, 0, SEXP_PAIR, 0, 0, "set-car!", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_CDR, 1, 0, SEXP_PAIR, 0, 0, "cdr", 0, NULL),
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_SET_CDR, 2, 0, SEXP_PAIR, 0, 0, "set-cdr!", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_VECTOR_REF,2,0, SEXP_VECTOR, SEXP_FIXNUM, 0,"vector-ref", 0, NULL),
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_VECTOR_SET,3,0, SEXP_VECTOR, SEXP_FIXNUM, 0,"vector-set!", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_VECTOR_LENGTH,1,0, SEXP_VECTOR, 0, 0,"vector-length", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_BYTES_REF,2,0, SEXP_BYTES, SEXP_FIXNUM, 0,"byte-vector-ref", 0, NULL),
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_BYTES_SET,3,0, SEXP_BYTES, SEXP_FIXNUM, 0,"byte-vector-set!", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_BYTES_LENGTH,1,0, SEXP_BYTES, 0, 0,"byte-vector-length", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_CAR, 1, 0, _I(SEXP_PAIR), SEXP_FALSE, 0, "car", 0, NULL),
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_SET_CAR, 2, 0, _I(SEXP_PAIR), _I(SEXP_OBJECT), 0, "set-car!", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_CDR, 1, 0, _I(SEXP_PAIR), SEXP_FALSE, 0, "cdr", 0, NULL),
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_SET_CDR, 2, 0, _I(SEXP_PAIR), _I(SEXP_OBJECT), 0, "set-cdr!", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_VECTOR_REF, 2, 0, _I(SEXP_VECTOR), _I(SEXP_FIXNUM), 0,"vector-ref", 0, NULL),
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_VECTOR_SET, 3, 0, _I(SEXP_VECTOR), _I(SEXP_FIXNUM), 0,"vector-set!", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_VECTOR_LENGTH, 1, 0, _I(SEXP_VECTOR), SEXP_FALSE, 0,"vector-length", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_BYTES_REF, 2, 0, _I(SEXP_BYTES), _I(SEXP_FIXNUM), 0,"byte-vector-ref", 0, NULL),
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_BYTES_SET, 3, 0, _I(SEXP_BYTES), _I(SEXP_FIXNUM), 0,"byte-vector-set!", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_BYTES_LENGTH, 1, 0, _I(SEXP_BYTES), SEXP_FALSE, 0,"byte-vector-length", 0, NULL),
|
||||
#if SEXP_USE_UTF8_STRINGS
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_STRING_REF,2,0, SEXP_STRING, SEXP_FIXNUM, 0,"string-cursor-ref", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_STRING_REF, 2, 0, _I(SEXP_STRING), _I(SEXP_FIXNUM), 0,"string-cursor-ref", 0, NULL),
|
||||
#else
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_STRING_REF,2,0, SEXP_STRING, SEXP_FIXNUM, 0,"string-ref", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_STRING_REF, 2, 0, _I(SEXP_STRING), _I(SEXP_FIXNUM), 0,"string-ref", 0, NULL),
|
||||
#endif
|
||||
#if SEXP_USE_MUTABLE_STRINGS
|
||||
#if SEXP_USE_UTF8_STRINGS
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_STRING_SET,3,0, SEXP_STRING, SEXP_FIXNUM, 0,"string-cursor-set!", 0, NULL),
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_STRING_SET, 3, 0, _I(SEXP_STRING), _I(SEXP_FIXNUM), 0,"string-cursor-set!", 0, NULL),
|
||||
#else
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_STRING_SET,3,0, SEXP_STRING, SEXP_FIXNUM, 0,"string-set!", 0, NULL),
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_STRING_SET, 3, 0, _I(SEXP_STRING), _I(SEXP_FIXNUM), 0,"string-set!", 0, NULL),
|
||||
#endif
|
||||
#endif
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_STRING_LENGTH,1,0, SEXP_STRING, 0, 0,"string-length", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_SLOTN_REF,3,0, 0, SEXP_FIXNUM, 0,"slot-ref", 0, NULL),
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_SLOTN_SET,4,0, 0, SEXP_FIXNUM, 0,"slot-set!", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_FIX2FLO, 1, 0, 0, 0, 0, "exact->inexact", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_FLO2FIX, 1, 0, 0, 0, 0, "inexact->exact", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_CHAR2INT, 1, 0, SEXP_CHAR, 0, 0, "char->integer", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_INT2CHAR, 1, 0, SEXP_FIXNUM, 0, 0, "integer->char", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_CHAR_UPCASE, 1, 0, SEXP_CHAR, 0, 0, "char-upcase", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_CHAR_DOWNCASE, 1, 0, SEXP_CHAR, 0, 0, "char-downcase", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC, SEXP_OP_ADD, 0, 1, SEXP_FIXNUM, 0, 0, "+", SEXP_ZERO, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC, SEXP_OP_MUL, 0, 1, SEXP_FIXNUM, 0, 0, "*", SEXP_ONE, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC, SEXP_OP_SUB, 1, 1, SEXP_FIXNUM, 0, 1, "-", SEXP_ZERO, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC, SEXP_OP_DIV, 1, 1, SEXP_FIXNUM, 0, 1, "/", SEXP_ONE, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC, SEXP_OP_QUOTIENT, 2, 0, SEXP_FIXNUM, SEXP_FIXNUM, 0, "quotient", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC, SEXP_OP_REMAINDER, 2, 0, SEXP_FIXNUM, SEXP_FIXNUM, 0, "remainder", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC_CMP, SEXP_OP_LT, 2, 1, SEXP_FIXNUM, 0, 0, "<", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC_CMP, SEXP_OP_LE, 2, 1, SEXP_FIXNUM, 0, 0, "<=", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC_CMP, SEXP_OP_LT, 2, 1, SEXP_FIXNUM, 0, 1, ">", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC_CMP, SEXP_OP_LE, 2, 1, SEXP_FIXNUM, 0, 1, ">=", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC_CMP, SEXP_OP_EQN, 2, 1, SEXP_FIXNUM, 0, 0, "=", 0, NULL),
|
||||
_OP(SEXP_OPC_PREDICATE, SEXP_OP_EQ, 2, 0, 0, 0, 0, "eq?", 0, NULL),
|
||||
_OP(SEXP_OPC_CONSTRUCTOR, SEXP_OP_CONS, 2, 0, 0, 0, 0, "cons", 0, NULL),
|
||||
_OP(SEXP_OPC_CONSTRUCTOR, SEXP_OP_MAKE_VECTOR, 1, 1, SEXP_FIXNUM, 0, 0, "make-vector", SEXP_VOID, NULL),
|
||||
_OP(SEXP_OPC_CONSTRUCTOR, SEXP_OP_MAKE_PROCEDURE, 4, 0, 0, 0, 0, "make-procedure", 0, NULL),
|
||||
_OP(SEXP_OPC_CONSTRUCTOR, SEXP_OP_MAKE_EXCEPTION, 5, 0, 0, 0, 0, "make-exception", 0, NULL),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_ISA, 2, 0, 0, 0, 0, "is-a?", NULL, 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_NULLP, 1, 0, 0, 0, 0, "null?", NULL, 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_EOFP, 1, 0, 0, 0, 0, "eof-object?", NULL, 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_SYMBOLP, 1, 0, 0, 0, 0, "symbol?", NULL, 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_CHARP, 1, 0, 0, 0, 0, "char?", NULL, 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_FIXNUMP, 1, 0, 0, 0, 0, "fixnum?", NULL, 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, 0, 0, 0, "pair?", sexp_make_fixnum(SEXP_PAIR), 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, 0, 0, 0, "string?", sexp_make_fixnum(SEXP_STRING), 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, 0, 0, 0, "vector?", sexp_make_fixnum(SEXP_VECTOR), 0),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_STRING_LENGTH, 1, 0, _I(SEXP_STRING), SEXP_FALSE, 0,"string-length", 0, NULL),
|
||||
_OP(SEXP_OPC_GETTER, SEXP_OP_SLOTN_REF, 3, 0, _I(SEXP_OBJECT), _I(SEXP_FIXNUM), 0, "slot-ref", 0, NULL),
|
||||
_OP(SEXP_OPC_SETTER, SEXP_OP_SLOTN_SET, 4, 0, _I(SEXP_OBJECT), _I(SEXP_FIXNUM), 0,"slot-set!", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_FIX2FLO, 1, 0, _I(SEXP_NUMBER), SEXP_FALSE, 0, "exact->inexact", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_FLO2FIX, 1, 0, _I(SEXP_NUMBER), SEXP_FALSE, 0, "inexact->exact", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_CHAR2INT, 1, 0, _I(SEXP_CHAR), SEXP_FALSE, 0, "char->integer", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_INT2CHAR, 1, 0, _I(SEXP_FIXNUM), SEXP_FALSE, 0, "integer->char", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_CHAR_UPCASE, 1, 0, _I(SEXP_CHAR), SEXP_FALSE, 0, "char-upcase", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_CHAR_DOWNCASE, 1, 0, _I(SEXP_CHAR), SEXP_FALSE, 0, "char-downcase", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC, SEXP_OP_ADD, 0, 1, _I(SEXP_NUMBER), _I(SEXP_NUMBER), 0, "+", SEXP_ZERO, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC, SEXP_OP_MUL, 0, 1, _I(SEXP_NUMBER), _I(SEXP_NUMBER), 0, "*", SEXP_ONE, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC, SEXP_OP_SUB, 1, 1, _I(SEXP_NUMBER), _I(SEXP_NUMBER), 1, "-", SEXP_ZERO, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC, SEXP_OP_DIV, 1, 1, _I(SEXP_NUMBER), _I(SEXP_NUMBER), 1, "/", SEXP_ONE, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC, SEXP_OP_QUOTIENT, 2, 0, _I(SEXP_FIXNUM), _I(SEXP_FIXNUM), 0, "quotient", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC, SEXP_OP_REMAINDER, 2, 0, _I(SEXP_FIXNUM), _I(SEXP_FIXNUM), 0, "remainder", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC_CMP, SEXP_OP_LT, 2, 1, _I(SEXP_NUMBER), _I(SEXP_NUMBER), 0, "<", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC_CMP, SEXP_OP_LE, 2, 1, _I(SEXP_NUMBER), _I(SEXP_NUMBER), 0, "<=", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC_CMP, SEXP_OP_LT, 2, 1, _I(SEXP_NUMBER), _I(SEXP_NUMBER), 1, ">", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC_CMP, SEXP_OP_LE, 2, 1, _I(SEXP_NUMBER), _I(SEXP_NUMBER), 1, ">=", 0, NULL),
|
||||
_OP(SEXP_OPC_ARITHMETIC_CMP, SEXP_OP_EQN, 2, 1, _I(SEXP_NUMBER), _I(SEXP_NUMBER), 0, "=", 0, NULL),
|
||||
_OP(SEXP_OPC_PREDICATE, SEXP_OP_EQ, 2, 0, _I(SEXP_OBJECT), _I(SEXP_OBJECT), 0, "eq?", 0, NULL),
|
||||
_OP(SEXP_OPC_CONSTRUCTOR, SEXP_OP_CONS, 2, 0, _I(SEXP_OBJECT), _I(SEXP_OBJECT), 0, "cons", 0, NULL),
|
||||
_OP(SEXP_OPC_CONSTRUCTOR, SEXP_OP_MAKE_VECTOR, 1, 1, _I(SEXP_FIXNUM), _I(SEXP_OBJECT), 0, "make-vector", SEXP_VOID, NULL),
|
||||
_OP(SEXP_OPC_CONSTRUCTOR, SEXP_OP_MAKE_PROCEDURE, 4, 0, _I(SEXP_FIXNUM), _I(SEXP_FIXNUM), 0, "make-procedure", 0, NULL),
|
||||
_OP(SEXP_OPC_CONSTRUCTOR, SEXP_OP_MAKE_EXCEPTION, 5, 0, _I(SEXP_OBJECT), _I(SEXP_OBJECT), 0, "make-exception", 0, NULL),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_ISA, 2, 0, _I(SEXP_OBJECT), _I(SEXP_OBJECT), 0, "is-a?", NULL, 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_NULLP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "null?", NULL, 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_EOFP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "eof-object?", NULL, 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_SYMBOLP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "symbol?", NULL, 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_CHARP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "char?", NULL, 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_FIXNUMP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "fixnum?", NULL, 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "pair?", _I(SEXP_PAIR), 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "string?", _I(SEXP_STRING), 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "vector?", _I(_I(SEXP_VECTOR)), 0),
|
||||
#if SEXP_USE_IMMEDIATE_FLONUMS
|
||||
_FN1(0, "flonum?", 0, sexp_flonump_op),
|
||||
_FN1(_I(SEXP_OBJECT), "flonum?", 0, sexp_flonump_op),
|
||||
#else
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, 0, 0, 0, "flonum?", sexp_make_fixnum(SEXP_FLONUM), 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "flonum?", _I(SEXP_FLONUM), 0),
|
||||
#endif
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, 0, 0, 0, "bignum?", sexp_make_fixnum(SEXP_BIGNUM), 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, 0, 0, 0, "closure?", sexp_make_fixnum(SEXP_PROCEDURE), 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, 0, 0, 0, "opcode?", sexp_make_fixnum(SEXP_OPCODE), 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, 0, 0, 0, "input-port?", sexp_make_fixnum(SEXP_IPORT), 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, 0, 0, 0, "output-port?", sexp_make_fixnum(SEXP_OPORT), 0),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_APPLY1, 2, 0, SEXP_PROCEDURE, SEXP_PAIR, 0, "apply1", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_CALLCC, 1, SEXP_PROCEDURE, 0, 0, 0, "%call/cc", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_RAISE, 1, SEXP_STRING, 0, 0, 0, "raise", 0, NULL),
|
||||
_OP(SEXP_OPC_IO, SEXP_OP_WRITE_CHAR, 1, 3, 0, SEXP_OPORT, 0, "write-char", (sexp)"*current-output-port*", NULL),
|
||||
_OP(SEXP_OPC_IO, SEXP_OP_NEWLINE, 0, 3, 0, SEXP_OPORT, 0, "newline", (sexp)"*current-output-port*", NULL),
|
||||
_OP(SEXP_OPC_IO, SEXP_OP_READ_CHAR, 0, 3, 0, SEXP_IPORT, 0, "read-char", (sexp)"*current-input-port*", NULL),
|
||||
_OP(SEXP_OPC_IO, SEXP_OP_PEEK_CHAR, 0, 3, 0, SEXP_IPORT, 0, "peek-char", (sexp)"*current-input-port*", NULL),
|
||||
_FN1OPTP(SEXP_IPORT, "read", (sexp)"*current-input-port*", sexp_read_op),
|
||||
_FN2OPTP(0, SEXP_OPORT, "write", (sexp)"*current-output-port*", sexp_write_op),
|
||||
_FN2OPTP(0, SEXP_OPORT, "display", (sexp)"*current-output-port*", sexp_display_op),
|
||||
_FN1OPTP(SEXP_OPORT, "flush-output", (sexp)"*current-output-port*", sexp_flush_output_op),
|
||||
_FN2(0, 0, "equal?", 0, sexp_equalp_op),
|
||||
_FN1(0, "list?", 0, sexp_listp_op),
|
||||
_FN1(0, "identifier?", 0, sexp_identifierp_op),
|
||||
_FN1(0, "identifier->symbol", 0, sexp_syntactic_closure_expr_op),
|
||||
_FN4(0, SEXP_ENV, "identifier=?", 0, sexp_identifier_eq_op),
|
||||
_FN1(SEXP_PAIR, "length", 0, sexp_length_op),
|
||||
_FN1(SEXP_PAIR, "reverse", 0, sexp_reverse_op),
|
||||
_FN1(SEXP_PAIR, "reverse!", 0, sexp_nreverse_op),
|
||||
_FN2(SEXP_PAIR, SEXP_PAIR, "append2", 0, sexp_append2_op),
|
||||
_FN1(SEXP_PAIR, "list->vector", 0, sexp_list_to_vector_op),
|
||||
_FN1(SEXP_STRING, "open-input-file", 0, sexp_open_input_file_op),
|
||||
_FN1(SEXP_STRING, "open-output-file", 0, sexp_open_output_file_op),
|
||||
_FN1(SEXP_IPORT, "close-input-port", 0, sexp_close_port_op),
|
||||
_FN1(SEXP_OPORT, "close-output-port", 0, sexp_close_port_op),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "bignum?", _I(SEXP_BIGNUM), 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "closure?", _I(SEXP_PROCEDURE), 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "opcode?", _I(SEXP_OPCODE), 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "input-port?", _I(SEXP_IPORT), 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_TYPEP, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "output-port?", _I(SEXP_OPORT), 0),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_APPLY1, 2, 0, _I(SEXP_PROCEDURE), SEXP_NULL, 0, "apply1", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_CALLCC, 1, 0, _I(SEXP_PROCEDURE), SEXP_FALSE, 0, "%call/cc", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_RAISE, 1, 0, _I(SEXP_OBJECT), SEXP_FALSE, 0, "raise", 0, NULL),
|
||||
_OP(SEXP_OPC_IO, SEXP_OP_WRITE_CHAR, 1, 3, _I(SEXP_CHAR), _I(SEXP_OPORT), 0, "write-char", (sexp)"*current-output-port*", NULL),
|
||||
_OP(SEXP_OPC_IO, SEXP_OP_NEWLINE, 0, 3, _I(SEXP_OPORT), SEXP_FALSE, 0, "newline", (sexp)"*current-output-port*", NULL),
|
||||
_OP(SEXP_OPC_IO, SEXP_OP_READ_CHAR, 0, 3, _I(SEXP_IPORT), SEXP_FALSE, 0, "read-char", (sexp)"*current-input-port*", NULL),
|
||||
_OP(SEXP_OPC_IO, SEXP_OP_PEEK_CHAR, 0, 3, _I(SEXP_IPORT), SEXP_FALSE, 0, "peek-char", (sexp)"*current-input-port*", NULL),
|
||||
_FN1OPTP(_I(SEXP_IPORT), "read", (sexp)"*current-input-port*", sexp_read_op),
|
||||
_FN2OPTP(_I(SEXP_OBJECT), _I(SEXP_OPORT), "write", (sexp)"*current-output-port*", sexp_write_op),
|
||||
_FN2OPTP(_I(SEXP_OBJECT), _I(SEXP_OPORT), "display", (sexp)"*current-output-port*", sexp_display_op),
|
||||
_FN1OPTP(_I(SEXP_OPORT), "flush-output", (sexp)"*current-output-port*", sexp_flush_output_op),
|
||||
_FN2(_I(SEXP_OBJECT), _I(SEXP_OBJECT), "equal?", 0, sexp_equalp_op),
|
||||
_FN1(_I(SEXP_OBJECT), "list?", 0, sexp_listp_op),
|
||||
_FN1(_I(SEXP_OBJECT), "identifier?", 0, sexp_identifierp_op),
|
||||
_FN1(_I(SEXP_OBJECT), "identifier->symbol", 0, sexp_syntactic_closure_expr_op),
|
||||
_FN4(_I(SEXP_OBJECT), _I(SEXP_ENV), "identifier=?", 0, sexp_identifier_eq_op),
|
||||
_FN1(SEXP_NULL, "length", 0, sexp_length_op),
|
||||
_FN1(SEXP_NULL, "reverse", 0, sexp_reverse_op),
|
||||
_FN1(SEXP_NULL, "reverse!", 0, sexp_nreverse_op),
|
||||
_FN2(SEXP_NULL, SEXP_NULL, "append2", 0, sexp_append2_op),
|
||||
_FN1(SEXP_NULL, "list->vector", 0, sexp_list_to_vector_op),
|
||||
_FN1(_I(SEXP_STRING), "open-input-file", 0, sexp_open_input_file_op),
|
||||
_FN1(_I(SEXP_STRING), "open-output-file", 0, sexp_open_output_file_op),
|
||||
_FN1(_I(SEXP_IPORT), "close-input-port", 0, sexp_close_port_op),
|
||||
_FN1(_I(SEXP_OPORT), "close-output-port", 0, sexp_close_port_op),
|
||||
_FN0("make-environment", 0, sexp_make_env_op),
|
||||
_FN1(SEXP_FIXNUM, "null-environment", 0, sexp_make_null_env_op),
|
||||
_FN1(SEXP_FIXNUM, "scheme-report-environment", 0, sexp_make_standard_env_op),
|
||||
_FN2OPTP(0, SEXP_ENV, "eval", (sexp)"*interaction-environment*", sexp_eval_op),
|
||||
_FN2OPTP(SEXP_STRING, SEXP_ENV, "load", (sexp)"*interaction-environment*", sexp_load_op),
|
||||
_FN4(SEXP_ENV, SEXP_ENV, "%env-copy!", 0, sexp_env_copy_op),
|
||||
_FN2(SEXP_EXCEPTION, SEXP_OPORT, "print-exception", 0, sexp_print_exception_op),
|
||||
_FN1(SEXP_EXCEPTION, "exception-type", 0, sexp_exception_type_op),
|
||||
_FN2OPT(SEXP_FIXNUM, SEXP_CHAR, "make-string", sexp_make_character(' '), sexp_make_string_op),
|
||||
_FN2OPT(SEXP_FIXNUM, SEXP_FIXNUM, "make-byte-vector", SEXP_ZERO, sexp_make_bytes_op),
|
||||
_FN2OPT(SEXP_FIXNUM, SEXP_FIXNUM, "string->number", SEXP_TEN, sexp_string_to_number_op),
|
||||
_FN3(SEXP_STRING, SEXP_STRING, "string-cmp", 0, sexp_string_cmp_op),
|
||||
_FN3(SEXP_STRING, SEXP_FIXNUM, "substring", 0, sexp_substring_op),
|
||||
_FN1(SEXP_STRING, "string->symbol", 0, sexp_string_to_symbol_op),
|
||||
_FN2OPT(SEXP_PAIR, SEXP_STRING, "string-concatenate", SEXP_FALSE, sexp_string_concatenate_op),
|
||||
_FN2(0, SEXP_PAIR, "memq", 0, sexp_memq_op),
|
||||
_FN2(0, SEXP_PAIR, "assq", 0, sexp_assq_op),
|
||||
_FN3(SEXP_ENV, SEXP_PAIR, "make-syntactic-closure", 0, sexp_make_synclo_op),
|
||||
_FN1(0, "strip-syntactic-closures", 0, sexp_strip_synclos),
|
||||
_PARAM("current-input-port", (sexp)"*current-input-port*", SEXP_IPORT),
|
||||
_PARAM("current-output-port", (sexp)"*current-output-port*", SEXP_OPORT),
|
||||
_PARAM("current-error-port", (sexp)"*current-error-port*", SEXP_OPORT),
|
||||
_PARAM("current-exception-handler", (sexp)"*current-exception-handler*", SEXP_PROCEDURE),
|
||||
_PARAM("interaction-environment", (sexp)"*interaction-environment*", SEXP_ENV),
|
||||
_FN1(_I(SEXP_FIXNUM), "null-environment", 0, sexp_make_null_env_op),
|
||||
_FN1(_I(SEXP_FIXNUM), "scheme-report-environment", 0, sexp_make_standard_env_op),
|
||||
_FN2OPTP(_I(SEXP_OBJECT), _I(SEXP_ENV), "eval", (sexp)"*interaction-environment*", sexp_eval_op),
|
||||
_FN2OPTP(_I(SEXP_STRING), _I(SEXP_ENV), "load", (sexp)"*interaction-environment*", sexp_load_op),
|
||||
_FN4(_I(SEXP_ENV), _I(SEXP_ENV), "%env-copy!", 0, sexp_env_copy_op),
|
||||
_FN2(_I(SEXP_EXCEPTION), _I(SEXP_OPORT), "print-exception", 0, sexp_print_exception_op),
|
||||
_FN1(_I(SEXP_EXCEPTION), "exception-type", 0, sexp_exception_type_op),
|
||||
_FN2OPT(_I(SEXP_FIXNUM), _I(SEXP_CHAR), "make-string", sexp_make_character(' '), sexp_make_string_op),
|
||||
_FN2OPT(_I(SEXP_FIXNUM), _I(SEXP_FIXNUM), "make-byte-vector", SEXP_ZERO, sexp_make_bytes_op),
|
||||
_FN2OPT(_I(SEXP_FIXNUM), _I(SEXP_FIXNUM), "string->number", SEXP_TEN, sexp_string_to_number_op),
|
||||
_FN3(_I(SEXP_STRING), _I(SEXP_STRING), "string-cmp", 0, sexp_string_cmp_op),
|
||||
_FN3(_I(SEXP_STRING), _I(SEXP_FIXNUM), "substring", 0, sexp_substring_op),
|
||||
_FN1(_I(SEXP_STRING), "string->symbol", 0, sexp_string_to_symbol_op),
|
||||
_FN2OPT(SEXP_NULL, _I(SEXP_STRING), "string-concatenate", SEXP_FALSE, sexp_string_concatenate_op),
|
||||
_FN2(_I(SEXP_OBJECT), SEXP_NULL, "memq", 0, sexp_memq_op),
|
||||
_FN2(_I(SEXP_OBJECT), SEXP_NULL, "assq", 0, sexp_assq_op),
|
||||
_FN3(_I(SEXP_ENV), SEXP_NULL, "make-syntactic-closure", 0, sexp_make_synclo_op),
|
||||
_FN1(_I(SEXP_OBJECT), "strip-syntactic-closures", 0, sexp_strip_synclos),
|
||||
_PARAM("current-input-port", (sexp)"*current-input-port*", _I(SEXP_IPORT)),
|
||||
_PARAM("current-output-port", (sexp)"*current-output-port*", _I(SEXP_OPORT)),
|
||||
_PARAM("current-error-port", (sexp)"*current-error-port*", _I(SEXP_OPORT)),
|
||||
_PARAM("current-exception-handler", (sexp)"*current-exception-handler*", _I(SEXP_PROCEDURE)),
|
||||
_PARAM("interaction-environment", (sexp)"*interaction-environment*", _I(SEXP_ENV)),
|
||||
_FN0("open-output-string", 0, sexp_make_output_string_port_op),
|
||||
_FN1(SEXP_STRING, "open-input-string", 0, sexp_make_input_string_port_op),
|
||||
_FN1(SEXP_OPORT, "get-output-string", 0, sexp_get_output_string_op),
|
||||
_FN1(_I(SEXP_STRING), "open-input-string", 0, sexp_make_input_string_port_op),
|
||||
_FN1(_I(SEXP_OPORT), "get-output-string", 0, sexp_get_output_string_op),
|
||||
#if SEXP_USE_MATH
|
||||
_FN1(0, "exp", 0, sexp_exp),
|
||||
_FN1(0, "log", 0, sexp_log),
|
||||
_FN1(0, "sin", 0, sexp_sin),
|
||||
_FN1(0, "cos", 0, sexp_cos),
|
||||
_FN1(0, "tan", 0, sexp_tan),
|
||||
_FN1(0, "asin", 0, sexp_asin),
|
||||
_FN1(0, "acos", 0, sexp_acos),
|
||||
_FN1(0, "atan1", 0, sexp_atan),
|
||||
_FN1(0, "sqrt", 0, sexp_sqrt),
|
||||
_FN1(0, "round", 0, sexp_round),
|
||||
_FN1(0, "truncate", 0, sexp_trunc),
|
||||
_FN1(0, "floor", 0, sexp_floor),
|
||||
_FN1(0, "ceiling", 0, sexp_ceiling),
|
||||
_FN1(_I(SEXP_NUMBER), "exp", 0, sexp_exp),
|
||||
_FN1(_I(SEXP_NUMBER), "log", 0, sexp_log),
|
||||
_FN1(_I(SEXP_NUMBER), "sin", 0, sexp_sin),
|
||||
_FN1(_I(SEXP_NUMBER), "cos", 0, sexp_cos),
|
||||
_FN1(_I(SEXP_NUMBER), "tan", 0, sexp_tan),
|
||||
_FN1(_I(SEXP_NUMBER), "asin", 0, sexp_asin),
|
||||
_FN1(_I(SEXP_NUMBER), "acos", 0, sexp_acos),
|
||||
_FN1(_I(SEXP_NUMBER), "atan1", 0, sexp_atan),
|
||||
_FN1(_I(SEXP_NUMBER), "sqrt", 0, sexp_sqrt),
|
||||
_FN1(_I(SEXP_NUMBER), "round", 0, sexp_round),
|
||||
_FN1(_I(SEXP_NUMBER), "truncate", 0, sexp_trunc),
|
||||
_FN1(_I(SEXP_NUMBER), "floor", 0, sexp_floor),
|
||||
_FN1(_I(SEXP_NUMBER), "ceiling", 0, sexp_ceiling),
|
||||
#endif
|
||||
_FN2(0, 0, "expt", 0, sexp_expt_op),
|
||||
_FN2(_I(SEXP_NUMBER), _I(SEXP_NUMBER), "expt", 0, sexp_expt_op),
|
||||
#if SEXP_USE_UTF8_STRINGS
|
||||
_FN2(SEXP_STRING, SEXP_FIXNUM, "string-index->offset", 0, sexp_string_index_to_offset),
|
||||
_FN2(SEXP_STRING, SEXP_FIXNUM, "string-ref", 0, sexp_string_utf8_index_ref),
|
||||
_FN3(SEXP_STRING, SEXP_FIXNUM, "string-set!", 0, sexp_string_utf8_index_set),
|
||||
_FN2(_I(SEXP_STRING), _I(SEXP_FIXNUM), "string-index->offset", 0, sexp_string_index_to_offset),
|
||||
_FN2(_I(SEXP_STRING), _I(SEXP_FIXNUM), "string-ref", 0, sexp_string_utf8_index_ref),
|
||||
_FN3(_I(SEXP_STRING), _I(SEXP_FIXNUM), "string-set!", 0, sexp_string_utf8_index_set),
|
||||
#endif
|
||||
#if SEXP_USE_TYPE_DEFS
|
||||
_FN2(SEXP_STRING, SEXP_FIXNUM, "register-simple-type", 0, sexp_register_simple_type_op),
|
||||
_FN2(SEXP_STRING, SEXP_FIXNUM, "make-type-predicate", 0, sexp_make_type_predicate_op),
|
||||
_FN2(SEXP_STRING, SEXP_FIXNUM, "make-constructor", 0, sexp_make_constructor_op),
|
||||
_FN3(SEXP_STRING, SEXP_FIXNUM, "make-getter", 0, sexp_make_getter_op),
|
||||
_FN3(SEXP_STRING, SEXP_FIXNUM, "make-setter", 0, sexp_make_setter_op),
|
||||
_FN2(_I(SEXP_STRING), _I(SEXP_FIXNUM), "register-simple-type", 0, sexp_register_simple_type_op),
|
||||
_FN2(_I(SEXP_STRING), _I(SEXP_FIXNUM), "make-type-predicate", 0, sexp_make_type_predicate_op),
|
||||
_FN2(_I(SEXP_STRING), _I(SEXP_FIXNUM), "make-constructor", 0, sexp_make_constructor_op),
|
||||
_FN3(_I(SEXP_STRING), _I(SEXP_FIXNUM), "make-getter", 0, sexp_make_getter_op),
|
||||
_FN3(_I(SEXP_STRING), _I(SEXP_FIXNUM), "make-setter", 0, sexp_make_setter_op),
|
||||
#endif
|
||||
#if PLAN9
|
||||
#include "opt/plan9-opcodes.c"
|
||||
#endif
|
||||
#if SEXP_USE_MODULES
|
||||
_FN0("current-environment", 0, sexp_current_environment),
|
||||
_FN1(SEXP_ENV, "env-exports", 0, sexp_env_exports_op),
|
||||
_FN1(SEXP_STRING, "find-module-file", 0, sexp_find_module_file_op),
|
||||
_FN2(SEXP_STRING, SEXP_ENV, "load-module-file", 0, sexp_load_module_file_op),
|
||||
_FN2(SEXP_STRING, SEXP_BOOLEAN, "add-module-directory", 0, sexp_add_module_directory_op),
|
||||
_FN1(_I(SEXP_ENV), "env-exports", 0, sexp_env_exports_op),
|
||||
_FN1(_I(SEXP_STRING), "find-module-file", 0, sexp_find_module_file_op),
|
||||
_FN2(_I(SEXP_STRING), _I(SEXP_ENV), "load-module-file", 0, sexp_load_module_file_op),
|
||||
_FN2(_I(SEXP_STRING), _I(SEXP_BOOLEAN), "add-module-directory", 0, sexp_add_module_directory_op),
|
||||
#endif
|
||||
#if SEXP_USE_GREEN_THREADS
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_YIELD, 0, 0, 0, 0, 0, "thread-yield!", 0, NULL),
|
||||
_OP(SEXP_OPC_GENERIC, SEXP_OP_YIELD, 0, 0, SEXP_FALSE, SEXP_FALSE, 0, "thread-yield!", 0, NULL),
|
||||
#endif
|
||||
};
|
||||
|
||||
#undef _I
|
||||
|
|
2
sexp.c
2
sexp.c
|
@ -106,7 +106,7 @@ static struct sexp_type_struct _sexp_type_specs[] = {
|
|||
_DEF_TYPE(SEXP_ENV, sexp_offsetof(env, parent), 3, 3, 0, 0, sexp_sizeof(env), 0, 0, "environment", NULL),
|
||||
_DEF_TYPE(SEXP_BYTECODE, sexp_offsetof(bytecode, name), 3, 3, 0, 0, sexp_sizeof(bytecode), offsetof(struct sexp_struct, value.bytecode.length), 1, "bytecode", NULL),
|
||||
_DEF_TYPE(SEXP_CORE, 0, 0, 0, 0, 0, sexp_sizeof(core), 0, 0, "core-form", NULL),
|
||||
_DEF_TYPE(SEXP_OPCODE, sexp_offsetof(opcode, data), 3, 3, 0, 0, sexp_sizeof(opcode), 0, 0, "opcode", NULL),
|
||||
_DEF_TYPE(SEXP_OPCODE, sexp_offsetof(opcode, data), 7, 7, 0, 0, sexp_sizeof(opcode), 0, 0, "opcode", NULL),
|
||||
_DEF_TYPE(SEXP_LAMBDA, sexp_offsetof(lambda, name), 11, 11, 0, 0, sexp_sizeof(lambda), 0, 0, "lambda", NULL),
|
||||
_DEF_TYPE(SEXP_CND, sexp_offsetof(cnd, test), 4, 4, 0, 0, sexp_sizeof(cnd), 0, 0, "conditional", NULL),
|
||||
_DEF_TYPE(SEXP_REF, sexp_offsetof(ref, name), 3, 3, 0, 0, sexp_sizeof(ref), 0, 0, "reference", NULL),
|
||||
|
|
Loading…
Add table
Reference in a new issue