From 5e7f0caab592c636f827d2c7814bc33eb96382d1 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 26 May 2017 19:49:43 -0700 Subject: 3878 --- html/080display.cc.html | 213 ++++++++++++++++++++++++------------------------ 1 file changed, 108 insertions(+), 105 deletions(-) (limited to 'html') diff --git a/html/080display.cc.html b/html/080display.cc.html index 0b7b9bad..556b88dd 100644 --- a/html/080display.cc.html +++ b/html/080display.cc.html @@ -421,112 +421,115 @@ if ('onhashchange' in window) { 359 if (event_type == TB_EVENT_KEY && event.key < 0xff) { 360 ¦ products.at(0).push_back(/*text event*/0); 361 ¦ if (event.key == TB_KEY_CTRL_C) { -362 ¦ ¦ tb_shutdown(); -363 ¦ ¦ exit(1); -364 ¦ } -365 ¦ if (event.key == TB_KEY_BACKSPACE2) event.key = TB_KEY_BACKSPACE; -366 ¦ if (event.key == TB_KEY_CARRIAGE_RETURN) event.key = TB_KEY_NEWLINE; -367 ¦ products.at(0).push_back(event.key); -368 ¦ products.at(0).push_back(0); -369 ¦ products.at(0).push_back(0); -370 ¦ products.at(1).push_back(/*found*/true); -371 ¦ break; -372 } -373 // keys outside ascii aren't unicode characters but arbitrary termbox inventions -374 if (event_type == TB_EVENT_KEY) { -375 ¦ products.at(0).push_back(/*keycode event*/1); -376 ¦ products.at(0).push_back(event.key); -377 ¦ products.at(0).push_back(0); -378 ¦ products.at(0).push_back(0); -379 ¦ products.at(1).push_back(/*found*/true); -380 ¦ break; -381 } -382 if (event_type == TB_EVENT_MOUSE) { -383 ¦ products.at(0).push_back(/*touch event*/2); -384 ¦ products.at(0).push_back(event.key); // which button, etc. -385 ¦ products.at(0).push_back(event.y); // row -386 ¦ products.at(0).push_back(event.x); // column -387 ¦ products.at(1).push_back(/*found*/true); -388 ¦ break; -389 } -390 if (event_type == TB_EVENT_RESIZE) { -391 ¦ products.at(0).push_back(/*resize event*/3); -392 ¦ products.at(0).push_back(event.w); // width -393 ¦ products.at(0).push_back(event.h); // height -394 ¦ products.at(0).push_back(0); -395 ¦ products.at(1).push_back(/*found*/true); -396 ¦ break; -397 } -398 assert(event_type == 0); -399 products.at(0).push_back(0); -400 products.at(0).push_back(0); -401 products.at(0).push_back(0); +362 ¦ ¦ // leave the screen in a relatively clean state +363 ¦ ¦ tb_set_cursor(tb_width()-1, tb_height()-1); +364 ¦ ¦ cout << "\r\n"; +365 ¦ ¦ tb_shutdown(); +366 ¦ ¦ exit(1); +367 ¦ } +368 ¦ if (event.key == TB_KEY_BACKSPACE2) event.key = TB_KEY_BACKSPACE; +369 ¦ if (event.key == TB_KEY_CARRIAGE_RETURN) event.key = TB_KEY_NEWLINE; +370 ¦ products.at(0).push_back(event.key); +371 ¦ products.at(0).push_back(0); +372 ¦ products.at(0).push_back(0); +373 ¦ products.at(1).push_back(/*found*/true); +374 ¦ break; +375 } +376 // keys outside ascii aren't unicode characters but arbitrary termbox inventions +377 if (event_type == TB_EVENT_KEY) { +378 ¦ products.at(0).push_back(/*keycode event*/1); +379 ¦ products.at(0).push_back(event.key); +380 ¦ products.at(0).push_back(0); +381 ¦ products.at(0).push_back(0); +382 ¦ products.at(1).push_back(/*found*/true); +383 ¦ break; +384 } +385 if (event_type == TB_EVENT_MOUSE) { +386 ¦ products.at(0).push_back(/*touch event*/2); +387 ¦ products.at(0).push_back(event.key); // which button, etc. +388 ¦ products.at(0).push_back(event.y); // row +389 ¦ products.at(0).push_back(event.x); // column +390 ¦ products.at(1).push_back(/*found*/true); +391 ¦ break; +392 } +393 if (event_type == TB_EVENT_RESIZE) { +394 ¦ products.at(0).push_back(/*resize event*/3); +395 ¦ products.at(0).push_back(event.w); // width +396 ¦ products.at(0).push_back(event.h); // height +397 ¦ products.at(0).push_back(0); +398 ¦ products.at(1).push_back(/*found*/true); +399 ¦ break; +400 } +401 assert(event_type == 0); 402 products.at(0).push_back(0); -403 products.at(1).push_back(/*found*/false); -404 break; -405 } -406 -407 :(before "End Primitive Recipe Declarations") -408 INTERACTIONS_LEFT, -409 :(before "End Primitive Recipe Numbers") -410 put(Recipe_ordinal, "interactions-left?", INTERACTIONS_LEFT); -411 :(before "End Primitive Recipe Checks") -412 case INTERACTIONS_LEFT: { -413 break; -414 } -415 :(before "End Primitive Recipe Implementations") -416 case INTERACTIONS_LEFT: { -417 CHECK_CONSOLE; -418 products.resize(1); -419 products.at(0).push_back(tb_event_ready()); -420 break; -421 } -422 -423 //: hacks to make text-mode apps more responsive under Unix -424 -425 :(before "End Primitive Recipe Declarations") -426 CLEAR_LINE_ON_DISPLAY, -427 :(before "End Primitive Recipe Numbers") -428 put(Recipe_ordinal, "clear-line-on-display", CLEAR_LINE_ON_DISPLAY); -429 :(before "End Primitive Recipe Checks") -430 case CLEAR_LINE_ON_DISPLAY: { -431 break; -432 } -433 :(before "End Primitive Recipe Implementations") -434 case CLEAR_LINE_ON_DISPLAY: { -435 CHECK_SCREEN; -436 int width = tb_width(); -437 for (int x = Display_column; x < width; ++x) -438 ¦ tb_print(' ', TB_WHITE, TB_BLACK); -439 tb_set_cursor(Display_column, Display_row); -440 break; -441 } -442 -443 :(before "End Primitive Recipe Declarations") -444 CLEAR_DISPLAY_FROM, -445 :(before "End Primitive Recipe Numbers") -446 put(Recipe_ordinal, "clear-display-from", CLEAR_DISPLAY_FROM); -447 :(before "End Primitive Recipe Checks") -448 case CLEAR_DISPLAY_FROM: { -449 break; -450 } -451 :(before "End Primitive Recipe Implementations") -452 case CLEAR_DISPLAY_FROM: { -453 CHECK_SCREEN; -454 // todo: error checking -455 int row = ingredients.at(0).at(0); -456 int column = ingredients.at(1).at(0); -457 int left = ingredients.at(2).at(0); -458 int right = ingredients.at(3).at(0); -459 int height=tb_height(); -460 for (/*nada*/; row < height; ++row, column=left) { // start column from left in every inner loop except first -461 ¦ tb_set_cursor(column, row); -462 ¦ for (/*nada*/; column <= right; ++column) -463 ¦ ¦ tb_print(' ', TB_WHITE, TB_BLACK); -464 } -465 tb_set_cursor(Display_column, Display_row); -466 break; -467 } +403 products.at(0).push_back(0); +404 products.at(0).push_back(0); +405 products.at(0).push_back(0); +406 products.at(1).push_back(/*found*/false); +407 break; +408 } +409 +410 :(before "End Primitive Recipe Declarations") +411 INTERACTIONS_LEFT, +412 :(before "End Primitive Recipe Numbers") +413 put(Recipe_ordinal, "interactions-left?", INTERACTIONS_LEFT); +414 :(before "End Primitive Recipe Checks") +415 case INTERACTIONS_LEFT: { +416 break; +417 } +418 :(before "End Primitive Recipe Implementations") +419 case INTERACTIONS_LEFT: { +420 CHECK_CONSOLE; +421 products.resize(1); +422 products.at(0).push_back(tb_event_ready()); +423 break; +424 } +425 +426 //: hacks to make text-mode apps more responsive under Unix +427 +428 :(before "End Primitive Recipe Declarations") +429 CLEAR_LINE_ON_DISPLAY, +430 :(before "End Primitive Recipe Numbers") +431 put(Recipe_ordinal, "clear-line-on-display", CLEAR_LINE_ON_DISPLAY); +432 :(before "End Primitive Recipe Checks") +433 case CLEAR_LINE_ON_DISPLAY: { +434 break; +435 } +436 :(before "End Primitive Recipe Implementations") +437 case CLEAR_LINE_ON_DISPLAY: { +438 CHECK_SCREEN; +439 int width = tb_width(); +440 for (int x = Display_column; x < width; ++x) +441 ¦ tb_print(' ', TB_WHITE, TB_BLACK); +442 tb_set_cursor(Display_column, Display_row); +443 break; +444 } +445 +446 :(before "End Primitive Recipe Declarations") +447 CLEAR_DISPLAY_FROM, +448 :(before "End Primitive Recipe Numbers") +449 put(Recipe_ordinal, "clear-display-from", CLEAR_DISPLAY_FROM); +450 :(before "End Primitive Recipe Checks") +451 case CLEAR_DISPLAY_FROM: { +452 break; +453 } +454 :(before "End Primitive Recipe Implementations") +455 case CLEAR_DISPLAY_FROM: { +456 CHECK_SCREEN; +457 // todo: error checking +458 int row = ingredients.at(0).at(0); +459 int column = ingredients.at(1).at(0); +460 int left = ingredients.at(2).at(0); +461 int right = ingredients.at(3).at(0); +462 int height=tb_height(); +463 for (/*nada*/; row < height; ++row, column=left) { // start column from left in every inner loop except first +464 ¦ tb_set_cursor(column, row); +465 ¦ for (/*nada*/; column <= right; ++column) +466 ¦ ¦ tb_print(' ', TB_WHITE, TB_BLACK); +467 } +468 tb_set_cursor(Display_column, Display_row); +469 break; +470 } -- cgit 1.4.1-2-gfad0