Пример #1
0
static void UI_ReportCaughtException(KonohaContext *kctx, kException *e, KonohaStack *bottomStack, KonohaStack *topStack)
{
	const char *exceptionName;
	const char *optionalMessage;
	int fault;
	KonohaStack *sfp;
	KBuffer wb;

	DBG_ASSERT(IS_Exception(e));
	exceptionName = KSymbol_text(e->symbol);
	optionalMessage = kString_text(e->Message);
	fault = e->fault;

	PLATAPI printf_i("%s", BeginTag(kctx, ErrTag));
	if(optionalMessage != NULL && optionalMessage[0] != 0) {
		PLATAPI printf_i("%s: SoftwareFault %s", exceptionName, optionalMessage);
	}
	else {
		PLATAPI printf_i("%s:", exceptionName);
		if(KFlag_Is(int, fault, SoftwareFault)) {
			PLATAPI printf_i(" SoftwareFault");
		}
		if(KFlag_Is(int, fault, UserFault)) {
			PLATAPI printf_i(" UserFault");
		}
Пример #2
0
static void UI_ReportUserMessage(KonohaContext *kctx, kinfotag_t level, kfileline_t pline, const char *msg, int isNewLine)
{
	const char *beginTag = BeginTag(kctx, level);
	const char *endTag = EndTag(kctx, level);
	const char *kLF = isNewLine ? "\n" : "";
	if(pline > 0) {
		const char *file = KFileLine_textFileName(pline);
		PLATAPI printf_i("%s - (%s:%d) %s%s%s" , beginTag, PLATAPI shortFilePath(file), (kushort_t)pline, msg, kLF, endTag);
	}
	else {
		PLATAPI printf_i("%s%s%s%s", beginTag,  msg, kLF, endTag);
	}
}
Пример #3
0
static void TEST_ReportCompilerMessage(KonohaContext *kctx, kinfotag_t taglevel, kfileline_t pline, const char *msg)
{
	if(taglevel < DebugTag) {
		PLATAPI printf_i("LINE%d: %s\n", (int)(kushort_t)pline, TAG_t(taglevel));
		fprintf(stdout, "LINE %d: %s\n", (int)(kushort_t)pline, msg);
	}
}
Пример #4
0
static void TEST_reportCaughtException(KonohaContext *kctx, kException *e, struct KonohaValueVar *bottomStack, struct KonohaValueVar *topStack)
{
    int line = (topStack != NULL) ? (kuhalfword_t)topStack[K_RTNIDX].calledFileLine : 0;
    const char *exceptionName = KSymbol_text(e->symbol);
    PLATAPI printf_i("LINE%d: %s\n", line, exceptionName);
    fprintf(stdout, "LINE %d: %s %s\n", line, exceptionName, kString_text(e->Message));
}
Пример #5
0
static void dumpMethod(KonohaContext *kctx, KonohaStack *sfp, kMethod *mtd)
{
    KGrowingBuffer wb;
    KLIB Kwb_Init(&(kctx->stack->cwb), &wb);
    kMethod_WriteToBuffer(kctx, mtd, &wb);
    PLATAPI printf_i("%s\n", KLIB Kwb_top(kctx, &wb, 1));
    KLIB Kwb_Free(&wb);
    return;
}
Пример #6
0
static void dumpMethod(KonohaContext *kctx, KonohaStack *sfp, kMethod *mtd)
{
	KBuffer wb;
	KLIB KBuffer_Init(&(kctx->stack->cwb), &wb);
	kMethod_WriteToBuffer(kctx, mtd, &wb);
	PLATAPI printf_i("%s\n", KLIB KBuffer_text(kctx, &wb, EnsureZero));
	KLIB KBuffer_Free(&wb);
	return;
}
Пример #7
0
static void dumpMethod(CTX, ksfp_t *sfp, kMethod *mtd)
{
	kwb_t wb;
	kwb_init(&(_ctx->stack->cwb), &wb);
	KSETv(sfp[2].mtd, mtd);
	O_ct(mtd)->p(_ctx, sfp, 2, &wb, 1);
	PLAT printf_i("%s\n", kwb_top(&wb, 1));
	kwb_free(&wb);
	return;
}
Пример #8
0
static v8::Handle<v8::Value> JSLog(const v8::Arguments& args)
{
	if(args.Length() < 1) {
		return v8::Undefined();
	}

	v8::HandleScope scope;
	v8::Handle<v8::Value> arg = args[0];
	v8::String::Utf8Value value(arg);
	PLATAPI printf_i("%s\n", *value);

	return v8::Undefined();
}
Пример #9
0
static void UI_ReportCompilerMessage(KonohaContext *kctx, kinfotag_t taglevel, kfileline_t pline, const char *msg)
{
	const char *beginTag = BeginTag(kctx, taglevel);
	const char *endTag = EndTag(kctx, taglevel);
	PLATAPI printf_i("%s - %s%s\n", beginTag, msg, endTag);
}
Пример #10
0
static void TEST_reportCaughtException(KonohaContext *kctx, const char *exceptionName, int fault, const char *optionalMessage, KonohaStack *bottom, KonohaStack *sfp)
{
	int line = (sfp != NULL) ? (kushort_t)sfp[K_RTNIDX].calledFileLine : 0;
	PLATAPI printf_i("LINE%d: %s\n", line, exceptionName);
	fprintf(stdout, "LINE %d: %s %s\n", line, exceptionName, optionalMessage);
}
Пример #11
0
static void TEST_ReportUserMessage(KonohaContext *kctx, kinfotag_t level, kfileline_t pline, const char *msg, int isNewLine)
{
	const char *kLF = isNewLine ? "\n" : "";
	PLATAPI printf_i("LINE%d: '%s'%s" ,(int)(kushort_t)pline, msg, kLF);
	fprintf(stdout, "LINE %d: '%s'%s", (int)(kushort_t)pline, msg, kLF);
}