home *** CD-ROM | disk | FTP | other *** search
- /*
- This function replaces the similar function of the same name in the
- file TWINDOW.C, function name wputchar() in the book Memory Resident
- Utilities, Screen I/O, and Programming Techniques by Al Stevens for
- TURBO C by Borland. This fixes a problem where a TAB (0x09) character
- will corrupt the screen memory contents if it positions the cursor
- outside of the specified window. On occasions, this has caused by
- PC to completely hang, requiring a HARD RESET to recover ! The
- problem was due to the TAB character ALWAYS being sent to the screen,
- irrespective as to whether or not, it was outside the windows
- dimensions.
-
- Uploaded by Chris Cox G4JEC-W0.
-
- NOTE. It seems impossible to define FASTWINDOWS in TWINDOW.H.
- This is because two functions/macros ? are missing from the book.
- These are vins & vget. Does anybody have the source for these two
- functions, or a definition of what they are supposed to do ?
- Please leave me a message on The C Station, Terrapin Station, or
- CompuServe (73027,1576) re above. Alternatively, give me a call
- at (612) 727-1971.
- */
-
- /* ----- write a character to the window ----- */
- void wputchar(WINDOW *wnd, int c)
- {
- if(!verify_wnd(&wnd))
- return;
- switch(c){
- case '\n':
- if(SCROLL == HEIGHT-3)
- scroll(wnd, UP);
- else
- SCROLL++;
- WCURS = 0;
- break;
- case '\t':
- if ((WCURS+1+TABS) <= (WIDTH - 1 - TABS)){
- do displ(wnd, (WCURS++)+3, SCROLL+1, ' ', WNORMAL);
- while((WCURS%TABS) && (WCURS+1) < WIDTH-1);
- }
- break;
- default:
- if((WCURS+1) < WIDTH-1){
- displ(wnd, WCURS+1, SCROLL+1, c, WNORMAL);
- WCURS++;
- }
- break;
- }
- }