|
|
1.1 ! root 1: .TH LPUTCHAR 3L "630 MTG" ! 2: .SH NAME ! 3: lputchar \- 630 MTG local putchar function ! 4: .SH SYNOPSIS ! 5: .ft B ! 6: void lputchar (c) ! 7: .br ! 8: \f3char c; \f1 ! 9: .ft R ! 10: .SH DESCRIPTION ! 11: \fILputchar\fR is ! 12: syntactically equivalent to the UNIX standard I/O putchar function. ! 13: It can be called by downloaded application programs who ! 14: want to display characters within their window on the 630 MTG screen. ! 15: Where (within the applications window) characters are displayed can be ! 16: affected with the \fImoveto\fR(3L) function. ! 17: .I Lputchar ! 18: calls the ! 19: .I moveto ! 20: routine to update the \fIcurrent screen point \fR after it ! 21: displays the charcter \fIc\fR. ! 22: .PP ! 23: ! 24: How characters are eventually ! 25: displayed on a user's terminal when using the UNIX putchar function ! 26: is affected by the UNIX host \fIstty\fR(1) settings ! 27: and the user's terminal characteristics. ! 28: Since \fIlputchar\fR displays directly onto the 630 MTG ! 29: screen, assumptions were made about desired \fIstty\fR ! 30: settings. In general, \fIlputchar\fR does as little processing on ! 31: the output stream as practical. ! 32: If more extensive processing of control characters is needed, it can ! 33: be accomplished as shown in the example program below. ! 34: .P ! 35: The following are the only control characters processed by \fIlputchar\fR. ! 36: All other characters will be displayed as \fBASCII\fR characters: ! 37: .TP ! 38: .B \er ! 39: Carriage Return. Move the current point to the left edge of the window. ! 40: .TP ! 41: .B \en ! 42: Newline. Move the current point down one line and to the left edge of the ! 43: window. Scroll the window if necessary. ! 44: .TP ! 45: .B \et ! 46: Horizontal tab. Tab characters are expanded to spaces with tab stops at every ! 47: eighth space. ! 48: .SH EXAMPLE ! 49: .LP ! 50: If an application program wanted to, for example, process bells and ! 51: backspaces rather than display the \fBASCII\fR bell and backspace ! 52: characters, it could define a function \fImylputchar\fR as follows: ! 53: .PP ! 54: .RS 3 ! 55: .ft CM ! 56: .S -2 ! 57: .nf ! 58: #include <dmd.h> ! 59: #include <font.h> ! 60: ! 61: void lputchar(); ! 62: void moveto(); ! 63: void ringbell(); ! 64: Point sPtCurrent(); ! 65: ! 66: mylputchar(c) ! 67: char c; ! 68: { ! 69: Point curpos; ! 70: ! 71: switch( c ) { ! 72: case '\e007': ! 73: ringbell(); ! 74: break; ! 75: case '\eb': ! 76: /* get the current position ! 77: ** if( not already at the left edge of the ! 78: ** window ) { ! 79: ** move back one character position ! 80: ** lputchar a space to erase the last ! 81: ** character and move back again ! 82: ** } ! 83: */ ! 84: curpos = sPtCurrent(); ! 85: if(curpos.x - FONTWIDTH(largefont) ! 86: >= Drect.origin.x) { ! 87: curpos.x -= FONTWIDTH(largefont); ! 88: moveto(curpos); ! 89: lputchar(' '); ! 90: moveto(curpos); ! 91: } ! 92: break; ! 93: default: ! 94: lputchar(c); ! 95: break; ! 96: } ! 97: } ! 98: .fi ! 99: .ft R ! 100: .RE ! 101: .S +2 ! 102: .SH SEE ALSO ! 103: bputchar(3L), moveto(3L), printf(3L), structures(3R). ! 104: .br ! 105: stty(1) in the \fIUNIX System V User's Reference Manual\fR. ! 106: .br ! 107: putc(3S) in the \fIUNIX System V Programmer's Reference Manual\fR.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.