📄 window.doc
字号:
PROTOTYPE:
char *wopen(int x, int y, int width, int height, int attrs)
ARGUMENTS:
x - Absolute COLUMN of top left corner of window
y - Absolute ROW of top left corner of window
width - The width of the window in characters
height - The height of the window in characters
attrs - The window attributes, BIT definitions:
15 - Enable SAVE/RESTORE screen under window
* 14 - Enable SINGLE line BORDER
* 13 - Enable DOUBLE line BORDER
12 - Enable CLEAR on OPEN
** 11 - Enable CLEAR on CLOSE
*** 10 - Disable NEWLINE (LF only)
9 - Enable SCROLLING in window
8 - Enable LINE WRAP in window
7-0 - Video attributes for window
* When BORDER is selected, window will include an enclosing
BOX. In this case, the effective height and width of the
active region (where text data can be written) will be
reduced by 2.
** Has no visual effect when SAVE/RESTORE is enabled.
*** If this BIT is set, CTRL-J will behave as LINEFEED only,
and will not return the cursor to the left margin.
RETURN VALUE:
A pointer to the WCB for the newly opened window
0 if the window could not be opened
DESCRIPTION:
The "wopen" function creates a new window on the PC video screen.
This newly created window is also made the "active" window, which is
automatically accessed by many of the windowing functions.
If "wopen" is unable to allocate enough memory for the window
control block (WCB), it will fail and return a value of zero (0).
EXAMPLES:
/* Create a title window at top of screen */
titlewin = wopen(0, 0, 80, 3, 0x6047);
WPRINTF WPRINTF
W_PRINTF W_PRINTF
PROTOTYPE:
register wprintf(char *format, arg, ...)
register w_printf(char *window, char *format, arg, ...)
ARGUMENTS:
window - Pointer to WCB for an open window
format - Pointer to format string
arg - Argument as determined by format string
... - Additional arguments may be required
RETURN VALUE:
None
DESCRIPTION:
The "wprintf" function performs exactly as the "PRINTF" function
in the standard function library, except that it outputs directly to
the active window using the low level windowing library functions.
The "w_printf" function behaves similar to "wprintf", except that
the window to receive the output is specified as the first parameter.
These functions should be used in preference to "PRINTF" when
using the windowing function library since "PRINTF" will not move the
windowing librarys cursor, will not use the attributes from the WCB,
and will not respect the boundarys of the window.
NOTE: This function uses a variable number of arguments, and must
be declared as "register" (See "window.h").
EXAMPLES:
wgotoxy(0, 0);
wprintf("Window %u", screen);
WPUTC WPUTC
W_PUTC W_PUTC
PROTOTYPE:
wputc(int c)
wputc(int c, char *window)
ARGUMENTS:
c - Character to be written to window
RETURN VALUE:
None
DESCRIPTION:
This "wputc" function displays a character in the active window at
the current cursor position.
The "w_putc" functino displays a character in the specified window
at the current cursor position.
Characters are output in "tty" fashion, with proper handling of
control codes such as CARRIAGE-RETURN, LINE-FEED and BELL. The screen
will scroll upwards when a NEWLINE is printed on the bottom line of
the screen, or when the bottom line wraps around to the next
(Assuming those options are enabled in the window).
Although only the lower 8 bits of a passed value are used, "vputc"
will not perform ANY output translations if any of the upper 8 bits
are set. This provides a method of displaying the video characters
represented by control codes such as NEWLINE, and BACKSPACE.
The first byte of the window control block (WCB) for the window
contains the attributes which will be used to display the character.
This value is written to the attribute location associated with the
character on the video display hardware. Its effect is dependant on
the video adapter in use. The "window.h" header file contains
definitions of the attribute bits for use on "standard" monochrome
and color displays.
EXAMPLES:
w_putc(0x0A, window1); /* Line-feed, advance cursor */
wputc(0x0A | 0xff00); /* Display 0x0A character code */
WPUTF WPUTF
PROTOTYPE:
wputf(char *string, int width)
ARGUMENTS:
string - Pointer to character string
width - Width of output field
RETURN VALUE:
None
DESCRIPTION:
The "wputf" function outputs a character string to the active
window screen using the video library functions.
The string is left justified in a field of the specified width. If
the string is shorter than "width", the field is padded with blanks.
If the string is longer than "width", the output is truncated.
EXAMPLES:
wputf(message, 10);
WPUTS WPUTS
W_PUTS W_PUTS
PROTOTYPE:
wputs(char *string)
w_puts(char *string, char *window)
ARGUMENTS:
string - Pointer to character string
window - Pointer to WCB for an open window
RETURN VALUE:
None
DESCRIPTION:
The "wputs" function outputs a character string to the active
window.
The "w_puts" function output a character string to the specified
window.
EXAMPLES:
wputs(message);
w_puts(message, window1);
WTSTC WTSTC
W_TSTC W_TSTC
PROTOTYPE:
int wtstc()
int w_tstc(char *window)
ARGUMENTS:
window - Pointer to WCB for an open window
RETURN VALUE:
0 - No key pressed
1-127 - ASCII value of key pressed
< 0 - Special function key as defined in "window.h"
DESCRIPTION:
The "wtstc" function tests for a key pressed on the system
console, and returns its value. If a character is found, the cursor
is updated in the active window.
The "w_tstc" function tests for a key pressed on the system
console, and returns its value. If a character is found, the cursor
is updated in the specified window.
A returned value of zero (0) indicates that no key was found to be
pressed.
Note that due to the buffering of the IBM-PC keyboard, every
keypress will be reported, even if the WTSTC or W_TSTC function is
called after a key is pressed and released.
EXAMPLES:
if(wtstc() == 0x1B) /* exit loop on ESCAPE key */
break;
WUPDATEXY WUPDATEXY
W_UPDATEXY W_UPDATEXY
PROTOTYPE:
wupdatexy()
w_updatexy(char *window)
ARGUMENTS:
window - Pointer to WCB for an open window
RETURN VALUE:
None
DESCRIPTION:
The "wupdatexy" function updates the real X/Y cursor position on
the video screen to reflect the "logical" position where the next
character will be output in the active window.
The "w_updatexy" function updates the real X/Y cursor position on
the video screen to reflect the "logical" position where the next
character will be output in the specified window.
The MICRO-C Windowing library uses a BIOS interrupt (INT 10) to
position the cursor, which is quite slow, compared to the speed of
the library video routines. To prevent this from slowing down the
video output, the cursor is only physically re-positioned when a
"wgotoxy" or a "wgetc" is executed.
This allows the library routines to run at full speed, and still
put the cursor in the right place when output stops and an input
request is made.
A side effect of this is that the cursor on the screen will not
appear to move unless you call "wgotoxy" or "wgetc". This only
affects the physical cursor on the screen, MICRO-C maintains its own
internal cursor location which it uses to determine where on the
screen the next write will occur.
Some applications which run in real time (Such as a terminal
emulator) do not call "wgetc", but use "wtstc" to poll the keyboard
on a regular basis. In this case, the "wupdatexy" routine should be
called any time that the visual position of the cursor is important.
EXAMPLES:
wupdatexy(); /* position the cursor *
c = wtstc(); /* Test for a character */
DK86 WINDOWING LIBRARY
TABLE OF CONTENTS
Page
1. IBM-PC WINDOWING Library 1
1.1 Window Control Block 2
1.2 External Variables 3
1.3 Window Library Functions 3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -