// (term-prinl ['num 'num] 'any ..) -> any any plisp_term_prinl(any ex) { any x, y; long n1, n2; // if number of args > 1, we accept // a min of 3 args - x, y and the value // to print. if (plen(ex) > 1 && isNum(cadr(ex)) && isNum(caddr(ex))) { x = cdr(ex), y = EVAL(car(x)); NeedNum(ex, y); n1 = unBox(y); // we get x here. x = cdr(x), y = EVAL(car(x)); NeedNum(ex, y); n2 = unBox(y); // we get y here. term_gotoxy(n1, n2); // now, get the rest of the params // and prinl. while (isCell(x = cdr(x))) ptermh_prin(y = EVAL(car(x))); } else { // We don't have the coordinates. // we just print the first value // in the list (including NIL). x = cdr(ex), y = EVAL(car(x)); ptermh_prin(y); while (isCell(x = cdr(x))) ptermh_prin(y = EVAL(car(x))); } newline(); return y; }
// picoc: term_moveto(x y); static void pterm_moveto(pstate *p, val *r, val **param, int n) { unsigned x, y; x = param[0]->Val->UnsignedInteger; y = param[1]->Val->UnsignedInteger; term_gotoxy(x, y); }
/** * エラーチェックをする(表示もする) */ void Test_error_check() { int count = 0; int i; Examination * examination2; Test * test2 = Test_get_test(); err_start(); while(count <= test.y){ term_clear(); Test_disp_info(ERR_MESS_X+2, ERR_MESS_Y); term_gotoxy(ERR_MESS_X, ERR_MESS_Y+2); term_rev_disp(ref("errchk_message")); Intprt_disp_guide(&test.intprt); //エラー結果を表示する for (i=0; i < ref_i("err_correct_line") && count <= test.y; i++, count++){ term_gotoxy(ERR_DISP_X, ERR_DISP_Y+i*4); term_disp(test.text_buf[count % test.text_no]); term_gotoxy(ERR_DISP_X, ERR_DISP_Y+i*4+1); term_disp(test.typed[count]); term_gotoxy(ERR_DISP_X, ERR_DISP_Y+i*4+2); term_disp(err_check(test.text_buf[count % test.text_no], test.typed[count])); } //HIDE_MODEでなければ誤字結果の詳細を表示する examination2 = &(test2->examination); if(examination2->mode == EXAM_MODE){//本番モードの場合 if(HIDE_ERR_MODE_EX==0){//エラーチェック画面を表示する Intprt_long_pause_core(&test.intprt, ref("long_pause_message_test"), FALSE); } }else{//練習モードの場合 if(HIDE_ERR_MODE_PRA==0){//エラーチェック画面を表示する Intprt_long_pause_core(&test.intprt, ref("long_pause_message_test"), FALSE); } } if (!test.intprt.status){ return; } } }
// Lua: moveto( x, y ) static int luaterm_moveto( lua_State* L ) { unsigned x, y; x = ( unsigned )luaL_checkinteger( L, 1 ); y = ( unsigned )luaL_checkinteger( L, 2 ); term_gotoxy( x, y ); return 0; }
/** * エラー表示し 終了する */ void term_error( char* message){ term_gotoxy(0, 24); term_end(); term_disp(message); kanji_out(); exit(1); }
/** * タイピングの問題文を表示する */ void Test_disp_text() { int tmp; if (test.y < SCROLL_LINE){ tmp = TEST_Y + test.y * 2; } else { tmp = TEST_Y + SCROLL_LINE * 2 - 2; term_scroll_up(TEST_X, TEST_Y, TEST_WIDTH, TEST_HEIGHT); term_scroll_up(TEST_X, TEST_Y, TEST_WIDTH, TEST_HEIGHT); } term_gotoxy(TEST_X, tmp); term_disp(test.text_buf[test.y % test.text_no]); if (ref_i("cursor")){ term_gotoxy(TEST_X, tmp+1); } else { term_gotoxy(0,0); } }
/** * 試験開始前の画面を表示する. */ void Test_begin() { term_clear(); term_gotoxy(ref_i("begin_x"),ref_i("begin_y")); term_disp(ref("test_start_message")); Intprt_disp_guide(&test.intprt); Intprt_pause_core(&test.intprt, ref("test_pause_message"), FALSE); }
// (term-moveto 'num 'num) -> Nil any plisp_term_moveto(any ex) { any x, y; long n1, n2; x = cdr(ex), y = EVAL(car(x)); NeedNum(ex, y); n1 = unBox(y); x = cdr(x), y = EVAL(car(x)); NeedNum(ex, y); n2 = unBox(y); term_gotoxy(n1, n2); return Nil; }
// picoc: term_puts(x, y, string); static void pterm_puts(pstate *p, val *r, val **param, int n) { const char *buf = param[2]->Val->Identifier; size_t len = strlen(buf), i; term_gotoxy(param[0]->Val->UnsignedInteger, param[1]->Val->UnsignedInteger); for (i = 0; i < len; i++) term_putch(buf[i]); r->Val->UnsignedLongInteger = len; }
void term_scroll_up(int x, int y, int width, int height) /* x and width are ignored. */ /* scroll_up between line y to line y+height-1 */ { #ifdef CURSES term_gotoxy(0, y); deleteln(); term_gotoxy(0, y+height-1); insertln(); #else term_gotoxy(0, y); #ifdef FMR printf("\033R"); #else del_ln(1); #endif FMR term_gotoxy(0, y+height-1); #ifdef FMR printf("\033E"); #else ins_ln(1); #endif #endif }
void Test_disp_info(int x, int y) { term_gotoxy(x,y); /* sprintf(global_tmp, "《%s %d %s %d》 %d %s", ref("lesson_message"), lesson_no, ref("section_message"), section_no, test.times, ref("times_message") ); sprintf(global_tmp, "", ref("lesson_message"), "", ref("section_message"), "", test.times, ref("times_message") ); term_disp(tozenkaku(global_tmp)); */ // term_disp("ここに試験問題名が表示される"); }
// Lua: print( string1, string2, ... ) // or print( x, y, string1, string2, ... ) static int luaterm_print( lua_State *L ) { const char *buf; size_t len, i; int total = lua_gettop( L ), s = 1; int x = -1, y = -1; // Check if the function has integer arguments if( lua_isnumber( L, 1 ) && lua_isnumber( L, 2 ) ) { x = lua_tointeger( L, 1 ); y = lua_tointeger( L, 2 ); term_gotoxy( x, y ); s = 3; } for( ; s <= total; s ++ ) { luaL_checktype( L, s, LUA_TSTRING ); buf = lua_tolstring( L, s, &len ); for( i = 0; i < len; i ++ ) term_putch( buf[ i ] ); } return 0; }
int platform_init() { if( memory_start_address == NULL ) { hostif_putstr( "platform_init(): mmap failed\n" ); return PLATFORM_ERR; } // Set the std input/output functions // Set the send/recv functions std_set_send_func( scr_write ); std_set_get_func( kb_read ); // Set term functions #ifdef BUILD_TERM term_init( TERM_LINES, TERM_COLS, i386_term_out, i386_term_in, i386_term_translate ); #endif term_clrscr(); term_gotoxy( 1, 1 ); // All done return PLATFORM_OK; }
void term_center_disp(char *str, int y) { term_gotoxy((TERM_W-strlen(str))/2, y); term_disp(str); }
/** * タイピングの結果を表示する. */ void Test_result() { char buf[MAXSTRLEN]; int writeResult = TRUE; Examination * examination2; Test * test2 = Test_get_test(); //合格情報を記録する for typingtestex拡張 Examination_writePassInfoAndShowResult(&(test.examination), &(test.user)); term_clear(); Test_disp_info(RESULT_X+2, RESULT_Y); term_gotoxy(RESULT_X, RESULT_Y+1); term_rev_disp(ref("result_message")); //合否を表示 term_gotoxy(RESULT_X + 5, RESULT_Y + 3); term_disp(ref("exam_result")); if(exam_result(typing_second)==TRUE){ term_disp(ref("pass_message")); }else{ term_disp(ref("fail_message")); } //試験日を表示 term_gotoxy(RESULT_X + 5, RESULT_Y + 4); term_disp(ref("exam_date")); get_date(buf); term_disp(buf); //タイピング時間を表示 term_gotoxy(RESULT_X + 5, RESULT_Y + 5); term_disp(ref("typing_time")); sprintf(buf, "%d ", typing_second); term_disp(buf); term_disp(ref("second_message")); //端末名を表示 term_gotoxy(RESULT_X + 5, RESULT_Y + 6); term_disp(ref("machine_name")); get_hostname(buf); term_disp(buf); //正打鍵数を表示 term_gotoxy(RESULT_X + 5, RESULT_Y + 7); term_disp(ref("correct_type")); sprintf(buf, "%d ", err_correct_type()); term_disp(buf); term_disp(ref("word_message")); //ミスタッチ数を表示 term_gotoxy(RESULT_X + 5, RESULT_Y + 8); term_disp(ref("miss_count")); sprintf(buf, "%d ", err_error_type()); term_disp(buf); term_disp(ref("word_message")); //1分あたりの正しいタッチ数を表示 term_gotoxy(RESULT_X + 5, RESULT_Y + 9); term_disp(ref("correct_type_per_min")); sprintf(buf, "%d ", correct_type_per_min(typing_second)); term_disp(buf); term_disp(ref("per_min_message")); //テキスト情報のタイトル表示 term_gotoxy(RESULT_X, RESULT_Y + 11); term_rev_disp(ref("exam_info_message")); //問題名を表示 term_gotoxy(RESULT_X + 5, RESULT_Y + 13); term_disp(ref("exam_title")); term_disp(ref("title")); //最大誤字数 term_gotoxy(RESULT_X + 5, RESULT_Y + 14); term_disp(ref("max_error_type_msg")); term_disp(ref("max_error_type")); term_disp(ref("word_message")); //制限時間 term_gotoxy(RESULT_X + 5, RESULT_Y + 15); term_disp(ref("time_limit_msg")); term_disp(ref("time_limit")); term_disp(ref("second_message")); //テキスト総文字数 term_gotoxy(RESULT_X + 5, RESULT_Y + 16); term_disp(ref("text_length_msg")); term_disp(ref("total_text_length")); term_disp(ref("word_message")); Intprt_disp_guide(&test.intprt); //次の画面遷移のメッセージを表示する examination2 = &(test2->examination); if(examination2->mode == EXAM_MODE){//本番モードの場合 if(HIDE_ERR_MODE_EX){ Intprt_pause_core(&test.intprt, ref("result_end_message"), FALSE); }else{ Intprt_pause_core(&test.intprt, ref("go_error_check_message"), FALSE); } }else{//練習モードの場合 if(HIDE_ERR_MODE_PRA){ Intprt_pause_core(&test.intprt, ref("result_end_message"), FALSE); }else{ Intprt_pause_core(&test.intprt, ref("go_error_check_message"), FALSE); } } }