From 780df6275b3f9d08292be3b337ce3e3e7d79598e Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Mon, 15 Feb 2016 00:06:12 +0900 Subject: [PATCH] move more decls to picrin.h --- extlib/benz/include/picrin.h | 87 ++++++++++++++++++++++ extlib/benz/include/picrin/blob.h | 1 - extlib/benz/include/picrin/data.h | 1 - extlib/benz/include/picrin/dict.h | 9 --- extlib/benz/include/picrin/pair.h | 9 --- extlib/benz/include/picrin/proc.h | 1 - extlib/benz/include/picrin/string.h | 7 -- extlib/benz/include/picrin/symbol.h | 7 -- extlib/benz/include/picrin/type.h | 108 ++++++++-------------------- extlib/benz/include/picrin/vector.h | 3 - extlib/benz/include/picrin/weak.h | 8 --- extlib/benz/number.c | 53 ++++++++++++++ 12 files changed, 171 insertions(+), 123 deletions(-) diff --git a/extlib/benz/include/picrin.h b/extlib/benz/include/picrin.h index 20016a46..8d6f035c 100644 --- a/extlib/benz/include/picrin.h +++ b/extlib/benz/include/picrin.h @@ -156,6 +156,7 @@ void pic_closure_set(pic_state *, int, pic_value); pic_value pic_funcall(pic_state *pic, struct pic_lib *, const char *, int, ...); struct pic_lib *pic_make_library(pic_state *, pic_value); +void pic_in_library(pic_state *, pic_value); struct pic_lib *pic_find_library(pic_state *, pic_value); void pic_import(pic_state *, struct pic_lib *); void pic_export(pic_state *, pic_sym *); @@ -170,10 +171,96 @@ pic_value pic_vcall(pic_state *, struct pic_proc *, int, va_list); pic_value pic_apply(pic_state *, struct pic_proc *, int, pic_value *); pic_value pic_applyk(pic_state *, struct pic_proc *, int, pic_value *); +int pic_int(pic_value); +double pic_float(pic_value); +char pic_char(pic_value); +bool pic_bool(pic_value); +/* const char *pic_str(pic_state *, pic_value, int *len); */ +/* unsigned char *pic_blob(pic_state *, pic_value, int *len); */ +void *pic_data(pic_state *, pic_value); + +pic_value pic_undef_value(); +pic_value pic_int_value(int); +pic_value pic_float_value(double); +pic_value pic_char_value(char c); +pic_value pic_true_value(); +pic_value pic_false_value(); +pic_value pic_bool_value(bool); + +#define pic_int_p(v) (pic_vtype(v) == PIC_VTYPE_INT) +#define pic_float_p(v) (pic_vtype(v) == PIC_VTYPE_FLOAT) +#define pic_char_p(v) (pic_vtype(v) == PIC_VTYPE_CHAR) +#define pic_true_p(v) (pic_vtype(v) == PIC_VTYPE_TRUE) +#define pic_false_p(v) (pic_vtype(v) == PIC_VTYPE_FALSE) +#define pic_str_p(v) (pic_type(v) == PIC_TT_STRING) +#define pic_blob_p(v) (pic_type(v) == PIC_TT_BLOB) +#define pic_proc_p(o) (pic_type(o) == PIC_TT_PROC) +#define pic_data_p(o) (pic_type(o) == PIC_TT_DATA) +#define pic_nil_p(v) (pic_vtype(v) == PIC_VTYPE_NIL) +#define pic_pair_p(v) (pic_type(v) == PIC_TT_PAIR) +#define pic_vec_p(v) (pic_type(v) == PIC_TT_VECTOR) +#define pic_dict_p(v) (pic_type(v) == PIC_TT_DICT) +#define pic_weak_p(v) (pic_type(v) == PIC_TT_WEAK) +#define pic_sym_p(v) (pic_type(v) == PIC_TT_SYMBOL) +#define pic_undef_p(v) (pic_vtype(v) == PIC_VTYPE_UNDEF) + +enum pic_tt pic_type(pic_value); +const char *pic_type_repr(enum pic_tt); + bool pic_eq_p(pic_value, pic_value); bool pic_eqv_p(pic_value, pic_value); bool pic_equal_p(pic_state *, pic_value, pic_value); +/* list */ +pic_value pic_nil_value(); +pic_value pic_cons(pic_state *, pic_value, pic_value); +PIC_INLINE pic_value pic_car(pic_state *, pic_value); +PIC_INLINE pic_value pic_cdr(pic_state *, pic_value); +void pic_set_car(pic_state *, pic_value, pic_value); +void pic_set_cdr(pic_state *, pic_value, pic_value); +bool pic_list_p(pic_value); +pic_value pic_list(pic_state *, int n, ...); +pic_value pic_vlist(pic_state *, int n, va_list); +pic_value pic_list_ref(pic_state *, pic_value, int); +void pic_list_set(pic_state *, pic_value, int, pic_value); +int pic_length(pic_state *, pic_value); + +/* vector */ +pic_vec *pic_make_vec(pic_state *, int); +pic_value pic_vec_ref(pic_state *, pic_vec *, int); +void pic_vec_set(pic_state *, pic_vec *, int, pic_value); +int pic_vec_len(pic_state *, pic_vec *); + +/* dictionary */ +struct pic_dict *pic_make_dict(pic_state *); +pic_value pic_dict_ref(pic_state *, struct pic_dict *, pic_sym *); +void pic_dict_set(pic_state *, struct pic_dict *, pic_sym *, pic_value); +void pic_dict_del(pic_state *, struct pic_dict *, pic_sym *); +bool pic_dict_has(pic_state *, struct pic_dict *, pic_sym *); +int pic_dict_size(pic_state *, struct pic_dict *); + +/* ephemeron */ +struct pic_weak *pic_make_weak(pic_state *); +pic_value pic_weak_ref(pic_state *, struct pic_weak *, void *); +void pic_weak_set(pic_state *, struct pic_weak *, void *, pic_value); +void pic_weak_del(pic_state *, struct pic_weak *, void *); +bool pic_weak_has(pic_state *, struct pic_weak *, void *); + +/* symbol */ +pic_sym *pic_intern(pic_state *, pic_str *); +#define pic_intern_str(pic,s,i) pic_intern(pic, pic_make_str(pic, (s), (i))) +#define pic_intern_cstr(pic,s) pic_intern(pic, pic_make_cstr(pic, (s))) +#define pic_intern_lit(pic,lit) pic_intern(pic, pic_make_lit(pic, lit)) +const char *pic_symbol_name(pic_state *, pic_sym *); + +/* string */ +int pic_str_len(pic_str *); +char pic_str_ref(pic_state *, pic_str *, int); +pic_str *pic_str_cat(pic_state *, pic_str *, pic_str *); +pic_str *pic_str_sub(pic_state *, pic_str *, int, int); +int pic_str_cmp(pic_state *, pic_str *, pic_str *); +int pic_str_hash(pic_state *, pic_str *); + #include "picrin/blob.h" #include "picrin/cont.h" #include "picrin/data.h" diff --git a/extlib/benz/include/picrin/blob.h b/extlib/benz/include/picrin/blob.h index 6e6b5532..2440c27f 100644 --- a/extlib/benz/include/picrin/blob.h +++ b/extlib/benz/include/picrin/blob.h @@ -15,7 +15,6 @@ struct pic_blob { int len; }; -#define pic_blob_p(v) (pic_type(v) == PIC_TT_BLOB) #define pic_blob_ptr(v) ((struct pic_blob *)pic_ptr(v)) struct pic_blob *pic_make_blob(pic_state *, int); diff --git a/extlib/benz/include/picrin/data.h b/extlib/benz/include/picrin/data.h index 4b9b27d1..a7f03580 100644 --- a/extlib/benz/include/picrin/data.h +++ b/extlib/benz/include/picrin/data.h @@ -21,7 +21,6 @@ struct pic_data { void *data; }; -#define pic_data_p(o) (pic_type(o) == PIC_TT_DATA) #define pic_data_ptr(o) ((struct pic_data *)pic_ptr(o)) PIC_INLINE bool pic_data_type_p(const pic_value obj, const pic_data_type *type) { diff --git a/extlib/benz/include/picrin/dict.h b/extlib/benz/include/picrin/dict.h index be7c675e..0aaa11aa 100644 --- a/extlib/benz/include/picrin/dict.h +++ b/extlib/benz/include/picrin/dict.h @@ -16,23 +16,14 @@ struct pic_dict { khash_t(dict) hash; }; -#define pic_dict_p(v) (pic_type(v) == PIC_TT_DICT) #define pic_dict_ptr(v) ((struct pic_dict *)pic_ptr(v)) -struct pic_dict *pic_make_dict(pic_state *); - #define pic_dict_for_each(sym, dict, it) \ pic_dict_for_each_help(sym, (&(dict)->hash), it) #define pic_dict_for_each_help(sym, h, it) \ for (it = kh_begin(h); it != kh_end(h); ++it) \ if ((sym = kh_key(h, it)), kh_exist(h, it)) -pic_value pic_dict_ref(pic_state *, struct pic_dict *, pic_sym *); -void pic_dict_set(pic_state *, struct pic_dict *, pic_sym *, pic_value); -void pic_dict_del(pic_state *, struct pic_dict *, pic_sym *); -int pic_dict_size(pic_state *, struct pic_dict *); -bool pic_dict_has(pic_state *, struct pic_dict *, pic_sym *); - #if defined(__cplusplus) } #endif diff --git a/extlib/benz/include/picrin/pair.h b/extlib/benz/include/picrin/pair.h index d8f7a675..3cbf428f 100644 --- a/extlib/benz/include/picrin/pair.h +++ b/extlib/benz/include/picrin/pair.h @@ -15,7 +15,6 @@ struct pic_pair { pic_value cdr; }; -#define pic_pair_p(v) (pic_type(v) == PIC_TT_PAIR) #define pic_pair_ptr(o) ((struct pic_pair *)pic_ptr(o)) PIC_INLINE pic_value @@ -44,11 +43,6 @@ pic_cdr(pic_state *pic, pic_value obj) return pair->cdr; } -pic_value pic_cons(pic_state *, pic_value, pic_value); -void pic_set_car(pic_state *, pic_value, pic_value); -void pic_set_cdr(pic_state *, pic_value, pic_value); - -bool pic_list_p(pic_value); pic_value pic_list1(pic_state *, pic_value); pic_value pic_list2(pic_state *, pic_value, pic_value); pic_value pic_list3(pic_state *, pic_value, pic_value, pic_value); @@ -66,7 +60,6 @@ pic_value pic_make_list(pic_state *, int, pic_value); #define pic_push(pic, item, place) (place = pic_cons(pic, item, place)) #define pic_pop(pic, place) (place = pic_cdr(pic, place)) -int pic_length(pic_state *, pic_value); pic_value pic_reverse(pic_state *, pic_value); pic_value pic_append(pic_state *, pic_value, pic_value); @@ -86,8 +79,6 @@ pic_value pic_cdar(pic_state *, pic_value); pic_value pic_cddr(pic_state *, pic_value); pic_value pic_list_tail(pic_state *, pic_value, int); -pic_value pic_list_ref(pic_state *, pic_value, int); -void pic_list_set(pic_state *, pic_value, int, pic_value); pic_value pic_list_copy(pic_state *, pic_value); #if defined(__cplusplus) diff --git a/extlib/benz/include/picrin/proc.h b/extlib/benz/include/picrin/proc.h index b11f543d..36baeba1 100644 --- a/extlib/benz/include/picrin/proc.h +++ b/extlib/benz/include/picrin/proc.h @@ -39,7 +39,6 @@ struct pic_proc { #define pic_proc_func_p(proc) ((proc)->tag == PIC_PROC_TAG_FUNC) #define pic_proc_irep_p(proc) ((proc)->tag == PIC_PROC_TAG_IREP) -#define pic_proc_p(o) (pic_type(o) == PIC_TT_PROC) #define pic_proc_ptr(o) ((struct pic_proc *)pic_ptr(o)) #define pic_context_p(o) (pic_type(o) == PIC_TT_CXT) diff --git a/extlib/benz/include/picrin/string.h b/extlib/benz/include/picrin/string.h index f3343e2d..f5c32314 100644 --- a/extlib/benz/include/picrin/string.h +++ b/extlib/benz/include/picrin/string.h @@ -17,19 +17,12 @@ struct pic_string { void pic_rope_incref(pic_state *, struct pic_rope *); void pic_rope_decref(pic_state *, struct pic_rope *); -#define pic_str_p(v) (pic_type(v) == PIC_TT_STRING) #define pic_str_ptr(o) ((struct pic_string *)pic_ptr(o)) pic_str *pic_make_str(pic_state *, const char *, int); #define pic_make_cstr(pic, cstr) pic_make_str(pic, (cstr), strlen(cstr)) #define pic_make_lit(pic, lit) pic_make_str(pic, "" lit, -((int)sizeof lit - 1)) -char pic_str_ref(pic_state *, pic_str *, int); -int pic_str_len(pic_str *); -pic_str *pic_str_cat(pic_state *, pic_str *, pic_str *); -pic_str *pic_str_sub(pic_state *, pic_str *, int, int); -int pic_str_cmp(pic_state *, pic_str *, pic_str *); -int pic_str_hash(pic_state *, pic_str *); const char *pic_str_cstr(pic_state *, pic_str *); pic_str *pic_format(pic_state *, const char *, ...); diff --git a/extlib/benz/include/picrin/symbol.h b/extlib/benz/include/picrin/symbol.h index 6581bbd5..b390a7cc 100644 --- a/extlib/benz/include/picrin/symbol.h +++ b/extlib/benz/include/picrin/symbol.h @@ -23,20 +23,13 @@ struct pic_id { } u; }; -#define pic_sym_p(v) (pic_type(v) == PIC_TT_SYMBOL) #define pic_sym_ptr(v) ((pic_sym *)pic_ptr(v)) #define pic_id_p(v) (pic_type(v) == PIC_TT_ID || pic_type(v) == PIC_TT_SYMBOL) #define pic_id_ptr(v) ((pic_id *)pic_ptr(v)) -pic_sym *pic_intern(pic_state *, pic_str *); -#define pic_intern_str(pic,s,i) pic_intern(pic, pic_make_str(pic, (s), (i))) -#define pic_intern_cstr(pic,s) pic_intern(pic, pic_make_cstr(pic, (s))) -#define pic_intern_lit(pic,lit) pic_intern(pic, pic_make_lit(pic, lit)) - pic_id *pic_make_identifier(pic_state *, pic_id *, struct pic_env *); -const char *pic_symbol_name(pic_state *, pic_sym *); const char *pic_identifier_name(pic_state *, pic_id *); #if defined(__cplusplus) diff --git a/extlib/benz/include/picrin/type.h b/extlib/benz/include/picrin/type.h index fb99fc86..a3e9ed78 100644 --- a/extlib/benz/include/picrin/type.h +++ b/extlib/benz/include/picrin/type.h @@ -66,7 +66,11 @@ pic_int(pic_value v) return u.i; } -#define pic_char(v) ((v) & 0xfffffffful) +static inline char +pic_char(pic_value v) +{ + return v & 0xfffffffful; +} #elif PIC_WORD_BOXING @@ -124,9 +128,23 @@ typedef struct { #define pic_vtype(v) ((v).type) #define pic_init_value(v,vtype) ((v).type = (vtype), (v).u.data = NULL) -#define pic_float(v) ((v).u.f) -#define pic_int(v) ((v).u.i) -#define pic_char(v) ((v).u.c) +PIC_INLINE double +pic_float(pic_value v) +{ + return v.u.f; +} + +PIC_INLINE int +pic_int(pic_value v) +{ + return v.u.i; +} + +PIC_INLINE char +pic_char(pic_value v) +{ + return v.u.c; +} #endif @@ -191,21 +209,11 @@ typedef struct pic_blob pic_blob; #define pic_obj_p(v) (pic_vtype(v) == PIC_VTYPE_HEAP) #define pic_obj_ptr(v) ((struct pic_object *)pic_ptr(v)) -#define pic_nil_p(v) (pic_vtype(v) == PIC_VTYPE_NIL) -#define pic_true_p(v) (pic_vtype(v) == PIC_VTYPE_TRUE) -#define pic_false_p(v) (pic_vtype(v) == PIC_VTYPE_FALSE) -#define pic_undef_p(v) (pic_vtype(v) == PIC_VTYPE_UNDEF) #define pic_invalid_p(v) (pic_vtype(v) == PIC_VTYPE_INVALID) -#define pic_float_p(v) (pic_vtype(v) == PIC_VTYPE_FLOAT) -#define pic_int_p(v) (pic_vtype(v) == PIC_VTYPE_INT) -#define pic_char_p(v) (pic_vtype(v) == PIC_VTYPE_CHAR) #define pic_eof_p(v) (pic_vtype(v) == PIC_VTYPE_EOF) #define pic_test(v) (! pic_false_p(v)) -PIC_INLINE enum pic_tt pic_type(pic_value); -PIC_INLINE const char *pic_type_repr(enum pic_tt); - #define pic_assert_type(pic, v, type) \ if (! pic_##type##_p(v)) { \ pic_errorf(pic, "expected " #type ", but got ~s", v); \ @@ -217,19 +225,8 @@ pic_valid_int(double v) return INT_MIN <= v && v <= INT_MAX; } -PIC_INLINE pic_value pic_nil_value(); -PIC_INLINE pic_value pic_true_value(); -PIC_INLINE pic_value pic_false_value(); -PIC_INLINE pic_value pic_bool_value(bool); -PIC_INLINE pic_value pic_undef_value(); PIC_INLINE pic_value pic_invalid_value(); PIC_INLINE pic_value pic_obj_value(void *); -PIC_INLINE pic_value pic_float_value(double); -PIC_INLINE pic_value pic_int_value(int); -PIC_INLINE pic_value pic_char_value(char c); - -PIC_INLINE bool pic_eq_p(pic_value, pic_value); -PIC_INLINE bool pic_eqv_p(pic_value, pic_value); PIC_INLINE enum pic_tt pic_type(pic_value v) @@ -538,58 +535,15 @@ pic_eqv_p(pic_value x, pic_value y) #endif -#define pic_define_aop(name, op, guard) \ - PIC_INLINE pic_value \ - name(pic_state *pic, pic_value a, pic_value b) \ - { \ - PIC_NORETURN void pic_errorf(pic_state *, const char *, ...); \ - double f; \ - if (pic_int_p(a) && pic_int_p(b)) { \ - f = (double)pic_int(a) op (double)pic_int(b); \ - return (INT_MIN <= f && f <= INT_MAX && guard) \ - ? pic_int_value((int)f) \ - : pic_float_value(f); \ - } else if (pic_float_p(a) && pic_float_p(b)) { \ - return pic_float_value(pic_float(a) op pic_float(b)); \ - } else if (pic_int_p(a) && pic_float_p(b)) { \ - return pic_float_value(pic_int(a) op pic_float(b)); \ - } else if (pic_float_p(a) && pic_int_p(b)) { \ - return pic_float_value(pic_float(a) op pic_int(b)); \ - } else { \ - pic_errorf(pic, #name ": non-number operand given"); \ - } \ - PIC_UNREACHABLE(); \ - } - -pic_define_aop(pic_add, +, true) -pic_define_aop(pic_sub, -, true) -pic_define_aop(pic_mul, *, true) -pic_define_aop(pic_div, /, f == (int)f) - -#define pic_define_cmp(name, op) \ - PIC_INLINE bool \ - name(pic_state *pic, pic_value a, pic_value b) \ - { \ - PIC_NORETURN void pic_errorf(pic_state *, const char *, ...); \ - if (pic_int_p(a) && pic_int_p(b)) { \ - return pic_int(a) op pic_int(b); \ - } else if (pic_float_p(a) && pic_float_p(b)) { \ - return pic_float(a) op pic_float(b); \ - } else if (pic_int_p(a) && pic_float_p(b)) { \ - return pic_int(a) op pic_float(b); \ - } else if (pic_float_p(a) && pic_int_p(b)) { \ - return pic_float(a) op pic_int(b); \ - } else { \ - pic_errorf(pic, #name ": non-number operand given"); \ - } \ - PIC_UNREACHABLE(); \ - } - -pic_define_cmp(pic_eq, ==) -pic_define_cmp(pic_lt, <) -pic_define_cmp(pic_le, <=) -pic_define_cmp(pic_gt, >) -pic_define_cmp(pic_ge, >=) +pic_value pic_add(pic_state *, pic_value, pic_value); +pic_value pic_sub(pic_state *, pic_value, pic_value); +pic_value pic_mul(pic_state *, pic_value, pic_value); +pic_value pic_div(pic_state *, pic_value, pic_value); +bool pic_eq(pic_state *, pic_value, pic_value); +bool pic_lt(pic_state *, pic_value, pic_value); +bool pic_le(pic_state *, pic_value, pic_value); +bool pic_gt(pic_state *, pic_value, pic_value); +bool pic_ge(pic_state *, pic_value, pic_value); #if defined(__cplusplus) } diff --git a/extlib/benz/include/picrin/vector.h b/extlib/benz/include/picrin/vector.h index d18f16e2..e3ac6fd0 100644 --- a/extlib/benz/include/picrin/vector.h +++ b/extlib/benz/include/picrin/vector.h @@ -15,11 +15,8 @@ struct pic_vector { int len; }; -#define pic_vec_p(v) (pic_type(v) == PIC_TT_VECTOR) #define pic_vec_ptr(o) ((struct pic_vector *)pic_ptr(o)) -pic_vec *pic_make_vec(pic_state *, int); - #if defined(__cplusplus) } #endif diff --git a/extlib/benz/include/picrin/weak.h b/extlib/benz/include/picrin/weak.h index ac938c88..1b502365 100644 --- a/extlib/benz/include/picrin/weak.h +++ b/extlib/benz/include/picrin/weak.h @@ -17,16 +17,8 @@ struct pic_weak { struct pic_weak *prev; /* for GC */ }; -#define pic_weak_p(v) (pic_type(v) == PIC_TT_WEAK) #define pic_weak_ptr(v) ((struct pic_weak *)pic_ptr(v)) -struct pic_weak *pic_make_weak(pic_state *); - -pic_value pic_weak_ref(pic_state *, struct pic_weak *, void *); -void pic_weak_set(pic_state *, struct pic_weak *, void *, pic_value); -void pic_weak_del(pic_state *, struct pic_weak *, void *); -bool pic_weak_has(pic_state *, struct pic_weak *, void *); - #if defined(__cplusplus) } #endif diff --git a/extlib/benz/number.c b/extlib/benz/number.c index 4f60a7ca..035528b3 100644 --- a/extlib/benz/number.c +++ b/extlib/benz/number.c @@ -54,6 +54,59 @@ pic_number_exact(pic_state *pic) return pic_int_value((int)f); } +#define pic_define_aop(name, op, guard) \ + pic_value \ + name(pic_state *pic, pic_value a, pic_value b) \ + { \ + PIC_NORETURN void pic_errorf(pic_state *, const char *, ...); \ + double f; \ + if (pic_int_p(a) && pic_int_p(b)) { \ + f = (double)pic_int(a) op (double)pic_int(b); \ + return (INT_MIN <= f && f <= INT_MAX && guard) \ + ? pic_int_value((int)f) \ + : pic_float_value(f); \ + } else if (pic_float_p(a) && pic_float_p(b)) { \ + return pic_float_value(pic_float(a) op pic_float(b)); \ + } else if (pic_int_p(a) && pic_float_p(b)) { \ + return pic_float_value(pic_int(a) op pic_float(b)); \ + } else if (pic_float_p(a) && pic_int_p(b)) { \ + return pic_float_value(pic_float(a) op pic_int(b)); \ + } else { \ + pic_errorf(pic, #name ": non-number operand given"); \ + } \ + PIC_UNREACHABLE(); \ + } + +pic_define_aop(pic_add, +, true) +pic_define_aop(pic_sub, -, true) +pic_define_aop(pic_mul, *, true) +pic_define_aop(pic_div, /, f == (int)f) + +#define pic_define_cmp(name, op) \ + bool \ + name(pic_state *pic, pic_value a, pic_value b) \ + { \ + PIC_NORETURN void pic_errorf(pic_state *, const char *, ...); \ + if (pic_int_p(a) && pic_int_p(b)) { \ + return pic_int(a) op pic_int(b); \ + } else if (pic_float_p(a) && pic_float_p(b)) { \ + return pic_float(a) op pic_float(b); \ + } else if (pic_int_p(a) && pic_float_p(b)) { \ + return pic_int(a) op pic_float(b); \ + } else if (pic_float_p(a) && pic_int_p(b)) { \ + return pic_float(a) op pic_int(b); \ + } else { \ + pic_errorf(pic, #name ": non-number operand given"); \ + } \ + PIC_UNREACHABLE(); \ + } + +pic_define_cmp(pic_eq, ==) +pic_define_cmp(pic_lt, <) +pic_define_cmp(pic_le, <=) +pic_define_cmp(pic_gt, >) +pic_define_cmp(pic_ge, >=) + #define DEFINE_CMP(op) \ static pic_value \ pic_number_##op(pic_state *pic) \