These routines enable you to make use of generic attributes -- screen attributes which are portable across different environments and different types of terminals.
Screens displayed from a program using generic attributes are the same or as close as possible whether running on an IBM PC under Windows or a serial terminal under UNIX.
A generic attribute is a single byte which is an index into the generic attribute table. This table contains information about character attributes (for example, bold or underline), foreground color and background color for each of the indexes used. The two color items are in turn indexes into the colormap -- a table of red, green and blue (RGB) values specific to the screen hardware in use.
Colormaps can be read-only or read-write. Read-only colormaps do not allow dynamic changes of RGB values from one color to another; only the colors in the system supplied colormap can be used. Even for read-write colormaps, there is no guarantee that a requested color can be exactly produced by the hardware.
For routines which use a table parameter, you can either pass the first element in the table, or build up the table in dynamically allocated memory and pass its address.
The routines set RETURN-CODE as follows:
0 | Operation successful |
1 | Named color not found in color database |
2 | Colormap index out of range |
3 | Attribute index out of range |
4 | No exact match found |
5 | Environment does not allow virtual colormap |
6 | Could not allocate virtual colormap |
7 | No virtual colormap in use |
The User attribute is initially off for each program. Once it is enabled, some of the various methods which you can use to display text upon the screen; for example, DISPLAY ... UPON CRT, screen I/O subprograms and the enhanced ACCEPT and DISPLAY syntax all use this attribute. The ANSI form of the DISPLAY and ACCEPT statements (using the UPON CONSOLE phrase) uses the User attribute only if one of the other DISPLAY or ACCEPT methods has been used previously.
The User attribute affects the results of enhanced DISPLAY and ACCEPT syntax operations only once Adis has been requested to set up the attribute. Such a request can be made by performing an enhanced ACCEPT or DISPLAY using an attribute. For example:
display spaces upon crt with highlight
The User attribute, if turned on, is used when displaying text upon the screen and supersedes any Screen attribute set for the character positions being used in the display.
Use of the X"A7" routine can result in code that is not portable to other environments. You can provide generic color support by using the generic attribute routines.
When using WRITE to CON:, the output always goes directly to the default window.
If the User attribute is not enabled, the Screen attribute currently set for that character position is unaltered.
DISPLAY ... UPON CRT-UNDER forces highlighting if the User attribute is set on. DISPLAY SPACE UPON CRT clears the screen to the User attribute for each screen position.