Exemple #1
0
static void Method_p(CTX, ksfp_t *sfp, int pos, kwb_t *wb, int level)
{
	kMethod *mtd = sfp[pos].mtd;
	kParam *pa = kMethod_param(mtd);
	DBG_ASSERT(IS_Method(mtd));
	if(level != 0) {
		MethodAttribute_p(_ctx, mtd, wb);
	}
	kwb_printf(wb, "%s %s.%s%s", TY_t(pa->rtype), TY_t(mtd->cid), T_mn(mtd->mn));
	if(level != 0) {
		size_t i;
		kwb_putc(wb, '(');
		for(i = 0; i < pa->psize; i++) {
			if(i > 0) {
				kwb_putc(wb, ',', ' ');
			}
			if(FN_isCOERCION(pa->p[i].fn)) {
				kwb_printf(wb, "@Coercion ");
			}
			kwb_printf(wb, "%s %s", TY_t(pa->p[i].ty), SYM_t(pa->p[i].fn));
		}
//		if(Param_isVARGs(DP(mtd)->mp)) {
//			knh_write_delimdots(_ctx, w);
//		}
		kwb_putc(wb, ')');
	}
}
Exemple #2
0
static kstatus_t readstmt(CTX, kwb_t *wb, kline_t *uline)
{
	int line = 1;
	kstatus_t status = K_CONTINUE;
//	fputs(TERM_BBOLD(_ctx), stdout);
	while(1) {
		int check;
		char *ln = kreadline(line == 1 ? ">>> " : "    ");
		if(ln == NULL) {
			kwb_free(wb);
			status = K_BREAK;
			break;
		}
		if(line > 1) kwb_putc(wb, '\n');
		kwb_write(wb, ln, strlen(ln));
		free(ln);
		if((check = checkstmt(kwb_top(wb, 0), kwb_bytesize(wb))) > 0) {
			uline[0]++;
			line++;
			continue;
		}
		if(check < 0) {
			fputs("(Cancelled)...\n", stdout);
			kwb_free(wb);
		}
		break;
	}
	if(kwb_bytesize(wb) > 0) {
		kadd_history(kwb_top(wb, 1));
	}
//	fputs(TERM_EBOLD(_ctx), stdout);
	fflush(stdout);
	uline[0]++;
	return status;
}
Exemple #3
0
static void CWB_nzenvkey(CTX, CWB_t *cwb, kbytes_t t)
{
	size_t i;
	for(i = 0; i < t.len; i++) {
		kwb_putc((cwb->ba), toupper(t.utext[i]));
	}
}