From: vtailor AT gte DOT net Subject: Test program to validate the cygnus terminal emulation 9 May 1998 12:24:17 -0700 Message-ID: <199805091216.HAA12620.cygnus.gnu-win32@smtp1.mailsrvcs.net> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit To: gnu-win32 AT cygnus DOT com Cc: vtailor AT gte DOT net I recently resurrected a Dos window library that I used to port a Pascal interpreter to Windows 3x, and developed a small test program to help debug the code I added to bring it up to date. To my surprise, I discovered that the Windows 3-95-NT Dos box window has a flaw in its cursor movement logic in which the bottom line generated by the test program get shifte upward. The test program also shows a problem in cygwinb19x. For one thing, clearing the screen after setting color attributes still gives you a monochrome screen. And the bottom line generated is shifted up one line further than under vanilla Windows. You can compile the following test program under cygnus to show this. For comparison, you can also compile it under MingW32, and run it with ansi.sys loaded in your Dos window. There are options that show clear differences in display speed in the program. The fastest option under my Dos Window is selected. ======================================================================= #include #include #define MAIN_ main /* Linux console escape sequences: */ void SetColor (int colorref) { printf("\e[%d;%dm", (30 + ((colorref >> 4) % 8)), (40 + ((colorref & 0xf) % 8))); } void ClrScr () { printf("\e[2J"); } void GoToXY (int col, int row) { printf("\e[%d%;%dH", row, col); } int getch () { int ch; fscanf(stdin, "%c", &ch); return ch; } int MAIN_ (int argc, char **argv) { int index, nX, ch; char buf[82]; SetColor(0x77); ClrScr(); for (index=1; index <= 25; index++) { sleep(1); ch = (index <= 12 ? index % 14 : index % 15); SetColor((ch+1) + (ch << 4)); ClrScr(); SetColor(0x7); GoToXY(1, index); printf("Line %d, Column %d", index, 1); GoToXY(35, index); printf("Hello world"); SetColor((ch+1) + (ch << 4)); GoToXY(1, index+1); /* The following is faster than using printf("%d"): */ #if 1 for (nX = 0; nX < 80; nX++) buf[nX] = (((unsigned)'0') + (nX % 10)); buf[nX] = '\0'; fputs(buf, stdout); #elif 0 for (nX = 0; nX < 80; nX++) printf("%d", nX % 10); #elif 0 /* This version is pretty fast: */ for (nX = 0; nX < 80; nX++) {ch = 0; sprintf(&ch, "%d", nX % 10); buf[nX] = ch;}; for (nX = 0; nX < 80; nX++) putch(buf[nX]); #endif ch = getch(); if ((ch == 0) || (ch == 224)) break; }; SetColor(0x70); ClrScr(); return 0; } - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".