Example #1
0
	static void show_version(CTX ctx)
	{
		int i;
		FileWriter fw = new FileWriter(stdout);
		fw.write("Konoha 2.0-alpha (Miyajima) (" + K_REVISION + "," + __DATE__ + ")\n");
		fw.write("[gcc " + __VERSxION__ + "]\n");
		fw.write("options:");
		for(i = 0; i < MOD_MAX; i++) {
			if(ctx.modshare[i] != null) {
				fw.write(ctx.modshare[i].name);
			}
		}
		fw.write("\n");
		fw.close();
	}
Example #2
0
	static void shell(CTX ctx)
	{
		kwb_t wb;
		kwb_init((ctx.stack.cwb), wb);
		kline_t uline/* = FILEID_("(shell)") | 1*/;
		while(true) {
			kline_t inc = 0;
			kstatus_t status = readstmt(ctx, wb, inc);
			if(status == K_CONTINUE && kwb_bytesize(wb) > 0) {
				status = konoha_eval(ctx, kwb_top(wb, 1), uline);
				uline += inc;
				kwb_free(wb);
				if(status != K_FAILED) {
					dumpEval(ctx, wb);
					kwb_free(wb);
				}
			}
			if(status == K_BREAK) {
				break;
			}
		}
		kwb_free(wb);
		FileWriter fw = new FileWriter(stdout);
		fw.write(stdout + "\n");
		return;
	}
Example #3
0
	public static int builtinTest(String name) {//TODO How to do #ifdef, #else, #endif
	/*
	#ifdef USE_BUILTINTEST
		Ftest f = lookupTestFunc(KonohaTestSet, name);
		if(f != NULL) {
			konoha_t konoha = konoha_open();
			int ret = f((CTX_t)konoha);
			konoha_close(konoha);
			return ret;
		}
		fprintf(stderr, "Built-in test is not found: '%s'\n", name);
	#else
		fprintf(stderr, "Built-in tests are not built; rebuild with -DUSE_BUILTINTEST\n");
	#endif
		return 1;
	*/
		try {
		FileWriter stderr = new FileWriter("./stderr");
		stderr.write("Built-in tests are not built; rebuild with -DUSE_BUILTINTEST" + name);
		} catch (IOException e) {
			System.out.println(e + "Exception occured");
		}
		return 1;
	}