示例#1
0
文件: i.c 项目: shinpei/konoha-wand
static void ClassCONST_man(CTX ctx, knh_OutputStream_t *w, const knh_ClassTBL_t *ct, knh_NameSpace_t *ns)
{
	knh_DictMap_t *tcmap = ct->constDictCaseMapNULL;
	size_t i, size = knh_DictMap_size(tcmap);
	int hasCaption = 0;
	for(i = 0; i < size; i++) {
		if(!hasCaption) {
			knh_write_ctext(ctx, w, _("CONST"));
			hasCaption = 1;
		}
		knh_printf(ctx, w, "\t%s.%s: %O\n", S_tochar(ct->sname), S_tochar(knh_DictMap_keyAt(tcmap, i)), knh_DictMap_valueAt(tcmap, i));
	}
	if(hasCaption == 1) {
		knh_write_EOL(ctx, w);
	}
}
示例#2
0
文件: stmt.c 项目: matsuu/konoha
static
void knh_StmtMETA_dump(Ctx *ctx, Stmt *o, OutputStream *w, String *m)
{
    if(!IS_DictMap(DP(o)->metaDictMap)) return ;
    int i = 0, size = (DP(o)->metaDictMap)->size;
    for(i = 0; i < size; i++) {
        String *k = (String*)knh_DictMap_keyAt(DP(o)->metaDictMap, i);
        String *v = (String*)knh_DictMap_valueAt(DP(o)->metaDictMap, i);
        if(k == v) {
            knh_printf(ctx, w, "@%s ", knh_String_tochar(k));
        }
        else {
            knh_printf(ctx, w, "@%s(%O) ", knh_String_tochar(k), v);
        }
    }
    if(size > 0) {
        knh_println(ctx, w, STEXT(""));
    }
}