///****************************************************************************
// * KONOHA COPYRIGHT, LICENSE NOTICE, AND DISCRIMER  
// * 
// * Copyright (c) 2005-2008, Kimio Kuramitsu <kimio at ynu.ac.jp>
// *           (c) 2008-      Konoha Software Foundation  
// * All rights reserved.
// * 
// * You may choose one of the following two licenses when you use konoha. 
// * See www.konohaware.org/license.html for further information.
// * 
// * (1) GNU General Public License 2.0      (with    KONOHA_UNDER_GPL2)
// * (2) Konoha Software Foundation License 1.0
// * 
// * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 
// * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// *  
// ****************************************************************************/
//
///* ************************************************************************ */
//
//#include"commons.h"
//
///* ************************************************************************ */
//
//#ifdef __cplusplus 
//extern "C" {
//#endif
//
#ifdef KNH_DBGMODE
	#define DEBUG_STMT(ctx, stmt)
	#define DEBUG_STMT0(ctx, stmt) \
		DEBUG("on stack"); \
		knh_Stmt__dump(ctx, stmt, KNH_STDOUT, knh_String_EMPTY()); \
		knh_flush(ctx, KNH_STDOUT); \

#else
	#define DEBUG_STMT(ctx, stmt)
#endif
//
///* ------------------------------------------------------------------------ */
///* [Term] */
//
//knh_bool_t knh_Term_isStaticValue(Term *b)
//{
//	if(IS_Stmt(b)) {
//		return 0;
//	}
//	Token *tk = (Token*)b;
//	KNH_ASSERT(IS_Token(tk));
//	return (tk->tt == TT_RAW);
//}
//
//
///* ------------------------------------------------------------------------ */
//
//Object *knh_Term_value_ifStaticValue(Term *b)
//{
//	if(knh_Term_isStaticValue(b)) {
//		return ((Token*)b)->data;
//	}
//	return KNH_NULL;
//}
//
///* ------------------------------------------------------------------------ */
//
//String *knh_Term_getString(Term *b)
//{
//	if(IS_Token(b)) {
//		String *s = ((Token*)b)->data;
//		if(STRUCT_IS_String(s)) return s;
//	}
//	DEBUG("not string");
//	return knh_String_EMPTY();
//}
//
///* ------------------------------------------------------------------------ */
//
//knh_type_t knh_Stmt_reqtype(Stmt *stmt, knh_type_t req, knh_index_t n)
//{
//    KNH_ASSERT(IS_Stmt(stmt));
//
//    switch(stmt->stt) {
//    case STT_DONE: 
//    case STT_NAMESPACE: /* ['namespace', 'NAME'] */
//    case STT_UIMPORT: /* ['CURN'] */
//    case STT_UVOCAB: /* ['CLASSQN', 'CURN'] */
//    case STT_UINT: /* ['CLASSQN', 'CURN'] */
//    case STT_UINT64: /* ['CLASSQN', 'CURN'] */
//    case STT_UFLOAT: /* ['CLASSQN', 'CURN'] */
//    case STT_CLASS: /* ['class', 'CLASSN', 'CLASSN', 'implements', '{'] */
//    case STT_IMPLEMENTS: /* ['implements', '+CLASSN'] */
//    case STT_METHOD: /* ['TYPEN', 'METHODFN', 'decl', '?{'] */
//    case STT_DECL: /* ['TYPEN', 'FIELDN', 'expr'] */
//    case STT_IF: /* ['if', 'expr', '{', '{'] */
//    case STT_TRY: /* ['try', '{', '__catch', '{'] */
//    case STT_CATCH: /* ['catch', 'EXPTN', 'FIELDN', '{'] */
//    case STT_DO: /* ['do', '{', 'while', 'exprdeclv+'] */
//    case STT_WHILE: /* ['while', 'expr', '{'] */
//    case STT_FOR: /* ['for', 'expr', 'expr', 'expr', '{'] */
//    case STT_FOREACH: /* ['foreach', 'TYPEN', 'FIELDN', 'from', 'expr', 'where', 'expr', '{'] */
//    case STT_CONTINUE: /* ['continue', '?LABEL'] */
//    case STT_BREAK: /* ['break', '?LABEL'] */
//    case STT_GOTO: /* ['goto', 'LABEL'] */
////		return CLASS_any;
//    case STT_THROW: /* ['throw', 'expr'] */
////    	return CLASS_Exception;
//    case STT_RETURN: /* ['return', '?expr'] */
//    case STT_PRINT: /* ['print', '+expr'] */
//    case STT_ASSERT: /* ['assert', 'expr'] */
//
//    case STT_NEW: /* ['NEW', 'CLASSN', '+expr'] */
//    case STT_MAP: /* ['CLASSN', 'expr', '?expr'] */
//    case STT_LET: /* ['FIELDN', 'expr'] */
//    case STT_CALL: /* ['METHODN', '+expr'] */
//    case STT_MOVTEXT: /* ['MOVTEXT', 'expr'] */
//    case STT_TRINARY: /* ['expr', 'expr', 'expr'] */
//    case STT_OP: /* ['OP', 'expr', '+expr'] */
//    case STT_ALT: /* ['expr', '+expr'] */
//    case STT_AND: /* ['expr', '+expr'] */
//    case STT_OR:  /* ['expr', '+expr'] */
//    case STT_META: /* ['+META'] */
//    case STT_ERR: /* ['ERRasm'] */
//    	return CLASS_any;
//    }
//    return CLASS_any;
//}
//
///* ------------------------------------------------------------------------ */
//
//knh_bool_t
//knh_Stmt_terms_seval(Ctx *ctx, Stmt *b, size_t n, knh_class_t reqc, NameSpace *ns)
//{
//	Term *v = knh_Term_seval(ctx, b->terms[n], reqc, ns);
//	KNH_ASSERT(v != NULL && IS_NOTNULL(v));
//	if(b->terms[n] != v) {
//		Object *avoid_gc = NULL;
//		KNH_INITv(avoid_gc, v);
//		KNH_SETv(ctx, b->terms[n], avoid_gc);
//		KNH_FINALv(ctx, avoid_gc);
//	}
//	return knh_Term_isStaticValue(v);
//}
//
//
///* ------------------------------------------------------------------------ */
///* [Stmt] */
//
//Term *knh_Stmt_seval__new(Ctx *ctx, Stmt *b, knh_class_t req)
//{
//	/* THIS FUNCTION SHOULD BE CALLED BY knh_Term_seval() */
//	/* ['NEW', 'CLASSN', '+expr'] */
//	KNH_ASSERT(IS_Stmt(b));
//	DEBUG_STMT(ctx, b);
//	
//	return b;
//}
//
///* ------------------------------------------------------------------------ */
//
//Term *knh_Stmt_seval__map(Ctx *ctx, Stmt *b, knh_class_t req)
//{
//	/* THIS FUNCTION SHOULD BE CALLED BY knh_Term_seval() */
//	/* ['CLASSN', 'expr', '?expr'] */
//	DEBUG_STMT(ctx, b);
//	return b;
//}
//
///* ------------------------------------------------------------------------ */
//
//Term *knh_Stmt_seval__call(Ctx *ctx, Stmt *b, knh_class_t req)
//{
//	/* THIS FUNCTION SHOULD BE CALLED BY knh_Term_seval() */
//	/* ['METHODN', '+expr'] */
//	DEBUG_STMT(ctx, b);
//	return b;
//}
///* ------------------------------------------------------------------------ */
//
//Term *knh_Stmt_seval__movtext(Ctx *ctx, Stmt *b, knh_class_t req)
//{
//	/* THIS FUNCTION SHOULD BE CALLED BY knh_Term_seval() */
//	/* ['MOVTEXT', 'expr'] */
//	DEBUG_STMT(ctx, b);
//	return b;
//}
//
///* ------------------------------------------------------------------------ */
//
//Term *knh_Stmt_seval__op(Ctx *ctx, Stmt *b, knh_class_t req)
//{
//	/* THIS FUNCTION SHOULD BE CALLED BY knh_Term_seval() */
//	/* ['OP', 'expr', '+expr'] */
//	DEBUG_STMT(ctx, b);
//	return b;
//}
//
///* ------------------------------------------------------------------------ */
//
//Term *knh_Stmt_seval__alt(Ctx *ctx, Stmt *b, knh_class_t req)
//{
//	/* THIS FUNCTION SHOULD BE CALLED BY knh_Term_seval() */
//	/* ['expr', '+expr'] */
//	DEBUG_STMT(ctx, b);
//	return b;
//}
//
///* ------------------------------------------------------------------------ */
//
//Term *knh_Stmt_seval__and(Ctx *ctx, Stmt *b, knh_class_t req)
//{
//	/* THIS FUNCTION SHOULD BE CALLED BY knh_Term_seval() */
//	/* ['expr', 'expr', '+expr'] */
//	DEBUG_STMT(ctx, b);
//	return b;
//}
//
///* ------------------------------------------------------------------------ */
//
//Term *knh_Stmt_seval__or(Ctx *ctx, Stmt *b, knh_class_t req)
//{
//	/* THIS FUNCTION SHOULD BE CALLED BY knh_Term_seval() */
//	/* ['expr', 'expr', '+expr'] */
//	DEBUG_STMT(ctx, b);
//	return b;
//}
//
///* ------------------------------------------------------------------------ */
//
//Term *knh_Stmt_seval__next(Ctx *ctx, Stmt *b, knh_class_t req)
//{
//	/* THIS FUNCTION SHOULD BE CALLED BY knh_Term_seval() */
//	/* ['expr', 'expr', '+expr'] */
//	DEBUG_STMT(ctx, b);
//	return b;
//}
//
///* ------------------------------------------------------------------------ */
//
//#ifdef __cplusplus
//}
//#endif
