From 05f893bbe7e8a839c26cc951fafb166c25d0a6ee Mon Sep 17 00:00:00 2001 From: Teddy Date: Sun, 11 Aug 2013 09:58:22 +0800 Subject: `apply` and `or` support --- builtin.h | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'builtin.h') diff --git a/builtin.h b/builtin.h index 3285db7..7a34315 100644 --- a/builtin.h +++ b/builtin.h @@ -249,8 +249,6 @@ class SpecialOptEval: public SpecialOptObj { * The implementation of `and` operator */ class SpecialOptAnd: public SpecialOptObj { - private: - unsigned char state; /**< 0 for prepared, 1 for pre_called */ public: SpecialOptAnd(); void prepare(Pair *pc); @@ -260,6 +258,34 @@ class SpecialOptAnd: public SpecialOptObj { ReprCons *get_repr_cons(); }; +/** @class SpecialOptOr + * The implementation of `and` operator + */ +class SpecialOptOr: public SpecialOptObj { + public: + SpecialOptOr(); + void prepare(Pair *pc); + Pair *call(ArgList *args, Environment * &envt, + Continuation * &cont, FrameObj ** &top_ptr); + + ReprCons *get_repr_cons(); +}; + +/** @class SpecialOptApply + * The implementation of `apply` operator + */ +class SpecialOptApply: public SpecialOptObj { + public: + SpecialOptApply(); + void prepare(Pair *pc); + Pair *call(ArgList *args, Environment * &envt, + Continuation * &cont, FrameObj ** &top_ptr); + + ReprCons *get_repr_cons(); +}; + + + #define BUILTIN_PROC_DEF(func)\ EvalObj *(func)(ArgList *args, const string &name) @@ -311,6 +337,11 @@ BUILTIN_PROC_DEF(is_equal); BUILTIN_PROC_DEF(display); BUILTIN_PROC_DEF(is_string); BUILTIN_PROC_DEF(is_symbol); +BUILTIN_PROC_DEF(string_lt); +BUILTIN_PROC_DEF(string_le); +BUILTIN_PROC_DEF(string_gt); +BUILTIN_PROC_DEF(string_ge); +BUILTIN_PROC_DEF(string_eq); #endif -- cgit v1.2.3