home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
flash-c1.zip
/
CH2_1.DOC
< prev
next >
Wrap
Text File
|
1990-02-11
|
30KB
|
1,133 lines
..pgno01
..foot63A2-##
..head02L──────────────────────────────────────────────────────────────────────
..head04L──────────────────────────────────────────────────────────────────────
..head03LDeclarations
#define FPENTRY pascal far
#define PTR far *
typedef char CHAR;
typedef unsigned char BYTE;
typedef signed int INT;
typedef unsigned int UINT;
typedef signed short int INT2;
typedef unsigned short int UINT2;
typedef long INT4;
typedef unsigned long UINT4;
typedef float REAL4;
typedef double REAL8;
typedef unsigned int WORD;
BYTE CheckSnow enables or disables snow-checking when reading or
writing data directly to video memory.
BYTE TextAttr global variable that contains the currently
selected video attribute.
INT2 InsMode global variable used by EditSt to indicate if the
cursor is in insert or overwrite mode.
INT2 VioBaseSeg contains the base segment address of the current
video page.
INT2 VioCols contains the screen width which is the total number
of characters per line.
INT2 VioCursor contains the size of the cursor with the starting
scan line in the high byte and the ending scan line
in the low byte.
INT2 VioPage contains the active video page in use. The value
should always be zero for a monochrome adapter.
INT2 WindMax defines the lower right corner of the window that
is currenlty defined thru the use of the Window
function.
INT2 WindMin defines the upper left corner of the window that is
currently defined thru the use of the Window
function.
..page
..head03ABorderColor
■ Description
Sets the color for the border screen.
■ Summary
void FPENTRY BorderColor( INT Color );
Color defines the color of the border screen.
■ Remarks
The following colors are allowed for the border color if you have a
Color/Graphics Monitor Adapter. BorderColor does not have any
effect on a monochrome display.
0 Black 8 Gray
1 Blue 9 Light Blue
2 Green 10 Light Green
3 Cyan 11 Light Cyan
4 Red 12 Light Red
5 Magenta 13 Light Magenta
6 Brown 14 Yellow
7 White 15 High-intensity White
■ Example
#include <fpclib.h>
main()
{
int i;
VioInit();
for ( i = 0; i < 16; i++ ) {
BorderColor( i );
GetKey();
}
}
In this example the sixteen available colors for the border will be
displayed. A new color will be displayed each time a key is pressed.
..page
..head03AClrWin
■ Description
Clear window area with the specified color.
■ Summary
void FPENTRY ClrWin( INT x1, INT y1, INT x2, INT y2, INT Attr );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Attr integer in the range 0-255 defining the foreground and
background byte combination for the color of the window.
■ Remarks
This procedure will blank the window area for the window coordinates
that are passed. ClrWin does not move the cursor from its current
position.
■ Example
#include <fpclib.h>
main()
{
VioInit();
ClrWin( 5, 5, 40, 20, 7 );
}
When ClrWin is called in this example the window area (5,5,40,20)
will be cleared with the attribute value of 7.
..page
..head03AColorMsg
■ Description
Display string on the screen using the color attribute specified.
■ Summary
void FPENTRY ColorMsg( INT x, INT y, INT Attr, CHAR PTR Message );
x column to begin display of message.
y row to begin display of message.
Attr integer in the range 0-255. It is the color to use for
displaying the message.
Message string message to be displayed.
■ Remarks
ColorMsg is NOT sensitive to Turbo's currently defined window and
will wrap around to column one on the next line of the screen when
necessary. ColorMsg will not scroll the screen if the data to be
displayed is to extend beyond the last row of the screen.
■ See Also
DspMsg, WriteSt, WriteStln
..page
■ Example
#include <fpclib.h>
#include <stdlib.h>
#include <string.h>
main()
{
CHAR *p,st[30];
INT i;
VioInit();
ClrWin( 1, 1, 80, 25, 7 );
strcpy( st, "Color-line " );
for ( i = 0; i <= 8; i++ ) {
st1[11] = '\0'
p = itoa( i, &st[11], 10 );
ColorMsg( 1, i+1, 1+i, st );
ColorMsg( 1, i+10, 48+i, st );
}
}
This program example will display nine lines on the upper and lower
half of the screen. The upper half of the screen will display black
as the background color. The lower half will use cyan as the
background color.
..page
..head03ADspMsg
■ Description
Display string on the screen without changing the color attribute
that is currently on the display screen.
■ Summary
void FPENTRY DspMsg( INT x, INT y, CHAR PTR Message );
x column to begin display of message.
y row to begin display of message.
Message string message to display.
■ Remarks
DspMsg is NOT sensitive to Turbo's currently defined window and will
wrap around to column one on the next line of the screen when
necessary. DspMsg will not scroll the screen if the data to be
displayed is to extend beyond the last row of the screen.
■ See Also
ColorMsg, WriteSt, WriteStln
■ Example
#include <fpclib.h>
main()
{
INT i;
VioInit();
ClrWin( 1, 1, 80, 25, 7 );
for ( i = 1; i <= 25; i++ )
FillRowAttr( 1, i, 80, i );
for ( i = 1; i <= 25; i++ )
DspMsg( 1, i, "This is a test message" );
}
This program example will display a different attribute color to
each row of the display, then a message will be displayed on each
line without changing the attribute bytes that already exist on the
screen.
..page
..head03AEditSt
■ Description
Edit an existing or null string from the keyboard.
■ Summary
void FPENTRY EditSt( INT Row,
INT StCol,
INT SpCol,
INT Len,
INT CharCase,
INT FillCh,
INT AutoSkip,
UINT ErrTone,
UINT ErrDur,
CHAR PTR VCSet,
CHAR PTR TCSet,
INT PTR ChOfs,
INT PTR TE,
CHAR PTR St );
Row defines row to edit string on.
StCol defines left or start column of field to edit. This
value must be less than or equal to SpCol.
SpCol defines right or stop column of the field to edit. This
value must be greater than or equal to StCol.
Len integer in the range of 1-255. It is the maximum length
of the string to be edited.
CharCase integer in the range 1-3. The Case Mode indicator
defines how a character is displayed on the screen and
stored in the string variable being edited.
1 = Do nothing to character
2 = Convert all characters to upper case
3 = Convert all characters to lower case
FillCh integer in the range of 0-255. This defines the ascii
character that is displayed in the field for undefined
character positions in the field being edited.
AutoSkip integer indicating if an auto exit is desired when the
last character in the field has been typed.
0 - No auto exit
1 - Auto exit after last character in field is
entered.
..page
ErrTone integer in units giving the frequency for beeping the
speaker.
ErrDur integer in units giving the length of time the speaker
is to beep.
VCSet set of valid characters, [0..255], that will be accepted
for data entry.
TCSet set of extended keyboard characters, [0..255], that are
allowed to terminate this procedure. (Refer to appendix
C for a listing of these codes.)
CharOfs an integer that indicates the beginning cursor position
within the string. If CharOfs is a 1 then editing will
begin in the first column of the field input area. If
CharOfs is 256 or greater than the length of the string
to be edited, the cursor will be positioned after the
last character in the string. On exit from EditSt
CharOfs will contain the cursor position within the
string.
TE is the terminating element number that terminated the
string input procedure. TE will be in the range of 0-255
which corresponds to the element number in appendix C.
St string buffer area to receive the input data.
■ Remarks
The maximum length of the string to edit is 255 characters. The
data will be entered on one line. If the maximum length of the
string exceeds the number of display columns, SpCol - StCol + 1, the
string will scroll horizontally on the screen within the StCol and
SpCol columns.
..page
Editing Keys:
The following gives an explanation of the editing keys that may be
used with EditSt, provided the key pressed is not defined in the
terminating character set. EditSt calls the function GetKey, in
the unit SSGetKey, which returns an integer. This integer is a
value from 0-384 which corresponds to an element number that is
defined in Appendix C. The function GetKey is provided with a
table that maps the key element numbers to the index number.
Example, If the cursor is to move right one character position
using the Ctrl-D key combination the value for Ctrl-D index key
(element number 136) must map to the right arrow key (element
number 77). The initialization of the Ctrl-D key for KeyTable[136]
would be 77.
LeftArr will move the cursor left one character position on
the screen until the StCol is reached. If the
beginning of the string has not been reached the
string will be scrolled on the screen within the
StCol and SpCol boundaries.
RightArr will move the cursor right one character position on
the screen until the end of the string is reached.
If the cursor is in the SpCol and there is still
more in the string that can be displayed the string
will then be scrolled within the StCol and SpCol
boundaries.
Home will place the cursor in the StCol on the screen and
positioned under the first character in the edit
string.
End will position the cursor after the last character in
the edit string.
BackSpace If the StCol is displaying the first character in
the string being edited the cursor will move to the
left one column and delete the character in that
column. If the character being displayed in the
StCol is not the first character in the string being
edited the cursor will remain in the same column
position and delete the character to the left of the
cursor and pull the string towards the cursor.
Esc will blank the string currently in the field. If
the field is already blank the procedure will
restore the string that was passed to this
procedure.
Tab will move the cursor to the right five column
positions if the SpCol has not been reached. If the
StCol has been reached then the string display will
be shifted right.
..page
^LeftArrow will move the cursor to the left five column
positions if the StCol has not been reached. If the
cursor is in the StCol then only the display string
will be adjusted to reflect the movement of the
cursor.
Del removes the character the cursor is under and
decrements the string length by one. All the
characters to the right of the cursor position are
moved left one position within the string and
display area.
Ctrl-X will delete all characters from the current string
position to the end of the string. All deleted
characters will be replaced with the FillCh that was
specified when calling this procedure.
■ Example
#include <fpclib.h>
TCSet[32] = { 64, 4, 0, 0, 0, 0, 0, 0,
0,128,128, 0, 0 , 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 };
VCSet[32] = { 0, 0, 0, 0,255,255,255,255,
255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255 };
main()
{
char St[256];
int te,ChOfs = 1;
VioInit();
EditSt(5,10,20,30,2,7,0,5000,5000,VCSet,TCSet,ChOfs,TE,St);
}
This example will edit a string of up to thirty characters into St.
The screen will display each character as entered starting in column
ten on row five. The display area of the screen goes from columns
ten to twenty and will do a horizontal scroll in that area when the
eleventh character is entered.
All alphabetic characters, ['a'..'z'], will automatically be
converted to upper case.
The keys that will terminate this procedure are the Esc, Enter, Up
and Down Arrow keys. TE will return the proper terminating element
number as given in appendix C.
..page
..head03AFillColAttr
■ Description
Display a column of attribute bytes on the screen.
■ Summary
void FPENTRY FillColAttr( INT x, INT y, INT NRows, INT Attr );
x defines column to begin display of attribute.
y defines row to begin display of attribute.
NRows integer in the range 1-25 for the number of rows to
display the attribute byte on.
Attr integer in the range 0-255. It is the attribute byte to
be displayed on the screen.
■ Remarks
FillColAttr always acts on the entire screen and is NOT sensitive to
Turbo's currently defined window.
■ See Also
FillColCell, FillColChar
■ Example
#include <fpclib.h>
main();
{
int i;
VioInit();
ClrWin( 1, 1, 80, 25, 7 );
for ( i = 1; i <= 80; i++ )
FillColAttr( i, 1, 20, 48+i );
GetKey();
}
In this example the attribute 48+i will be displayed twenty times in
each column of the display starting on row one of the screen.
..page
..head03AFillColCell
■ Description
Fill a column on the screen with a character.
■ Summary
void FPENTRY FillColCell( INT x, INT y, INT NRows, INT Cell );
x defines column to begin display of data.
y defines row to begin display of data.
NRows integer in the range 1-25 for the number of rows to
display the character and attribute bytes on the screen.
Cell integer in the range 0-0xffff. This is the character
and attribute word combination where the high order byte
is the character and the low order byte is the attribute
to be displayed.
■ Remarks
FillColCell always acts on the entire screen and is NOT sensitive to
Turbo's currently defined window.
■ See Also
FillColAttr, FillColChar
■ Example
#include <fpclib.h>
main()
{
int i;
VioInit();
for ( i = 1; i <= 80; i++ )
FillColCell( i, 1, 20, ( (65+i) << 8 ) + 48+i );
}
In this example the character is ordinal value of 'A' plus i and
attribute value is 48+i. The character attribute cell combination
will be displayed twenty times in each column of the display
starting on row one of the screen.
..page
..head03AFillColChar
■ Description
Fill a column on the screen with a character.
■ Summary
void FPENTRY FillColChar( INT x, INT y, INT NRows, CHAR Ch );
x defines column to begin display of character.
y defines row to begin display of character.
NRows integer in the range 1-25 for the number of rows to
display the character on.
Ch char in the range 0-255. It is the character to be
displayed on the screen.
■ Remarks
FillColChar always acts on the entire screen and is NOT sensitive to
Turbo's currently defined window.
■ See Also
FillColAttr, FillColCell
■ Example
#include <fpclib.h>
main()
{
int i;
VioInit();
for ( i = 1; i <= 80; i++ )
FillColChar( i, 1, 20, 64+i );
}
In this example the character '@'+i will be displayed twenty times
in each column of the display starting on row one of the screen.
..page
..head03AFillFrameAttr
■ Description
Fill the frame area defined by x1,y1,x2,y2 coordinates with the
attribute byte defined.
■ Summary
void FPENTRY FillFrameAttr( INT x1, INT y1,
INT x2, INT y2, INT Attr );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Attr integer in the range 0-255. It is the attribute to be
displayed on the screen in the specified frame area.
■ See Also
FillFrameCell, FillFrameChar
■ Example
#include <fpclib.h>
main()
{
VioInit();
FillFrameAttr( 1, 1, 80, 25, 48 );
}
FillFrameAttr in this example will, on a color display, make the
background color cyan and all display characters black for the
foreground color.
..page
..head03AFillFrameCell
■ Description
Fill the frame area defined by x1,y1,x2,y2 coordinates with the cell
defined.
■ Summary
void FPENTRY FillFrameCell( INT x1, INT y1,
INT x2, INT y2, INT2 Cell );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Cell integer in the range 0-255. This is the character and
attribute word combination where the high byte is the
character and the low byte is the attribute for the cell
to be displayed on the screen in the specified frame
area.
■ See Also
FillFrameAttr, FillFrameChar
■ Example
#include <fpclib.h>
main()
{
VioInit();
FillFrameCell( 1, 1, 80, 25, 0x2007 );
}
FillFrameCell in this example will move spaces to every character
byte on the screen and the attribute byte will get the decimal
character 07. This call will have the same effect as a cls from DOS.
..page
..head03AFillFrameChar
■ Description
Fill the frame area defined by x1,y1,x2,y2 coordinates with the
character byte defined.
■ Summary
void FPENTRY FillFrameChar( INT x1, INT y1,
INT x2, INT y2, CHAR Ch );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Ch character that will be displayed on the screen in the
specified frame area.
■ See Also
FillFrameAttr, FillFrameCell
■ Example
#include <fpclib.h>
main()
{
VioInit();
FillFrameChar( 1, 1, 80, 25, ' ' );
}
FillFrameChar in this example will move spaces to every character
byte on the screen. It will have almost the same effect as a ClrScr
call.
..page
..head03AFillRowAttr
■ Description
Write N copies of the attribute byte on the screen starting at the
specified x,y coordinates.
■ Summary
void FPENTRY FillRowAttr( INT x, INT y, INT NBytes, INT Attr );
x defines column to begin display of attribute byte.
y defines row to begin display of attribute byte.
NBytes gives number of times to display the attribute byte on
the screen.
Attr integer in the range 0-255. It is the attribute byte to
be displayed on the screen.
■ Remarks
FillRowAttr always acts on the entire screen and is NOT sensitive to
Turbo's currently defined window.
■ See Also
FillRowCell, FillFrameChar
■ Example
#include <fpclib.h>
main()
{
VioInit();
FillRowAttr( 1, 1, 80, 48 );
}
In this example, starting at row one, column one of the screen, the
color attribute byte 48 will be used.
..page
..head03AFillRowCell
■ Description
Write N copies of the character and attribute byte on the screen
starting at the specified x,y coordinates.
■ Summary
void FPENTRY FillRowCell( INT x, INT y, INT NWords, INT2 Cell );
x defines column to begin display of cell word.
y defines row to begin display of cell word.
NWords gives the number times to display the character and
attribute bytes on the screen.
Cell character and attribute bytes to be displayed on the
screen.
■ Remarks
FillRowCell always acts on the entire screen and is NOT sensitive to
Turbo's currently defined window.
■ See Also
FillRowAttr, FillFrameChar
■ Example
#include <fpclib.h>
main()
{
VioInit();
FillRowCell( 1, 1, 80, ('-' << 8) + 7 );
}
In this example eighty minus sign characters will be displayed
starting on row one, column one of the screen. The attribute value
is 7.
..page
..head03AFillRowChar
■ Description
Write N copies of the character byte on the screen starting at the
specified x,y coordinates.
■ Summary
void FPENTRY FillRowChar( INT x, INT y, INT NBytes, CHAR Ch );
x defines column to begin display of character.
y defines row to begin display of character.
NBytes gives number of times to display the character on the
screen.
Ch integer in the range 0-255. It is the character to be
displayed on the screen.
■ Remarks
FillRowChar always acts on the entire screen and is NOT sensitive to
Turbo's currently defined window.
■ See Also
FillRowAttr, FillFrameCell
■ Example
#include <fpclib.h>
main()
{
VioInit();
FillRowChar( 1, 1, 80, '-' );
}
In this example eighty minus sign characters will be displayed
starting on row one, column one of the screen.
..page
..head03AFrameWin
■ Description
Frames the window currently defined by the global variables WindMax
and WindMin with the specified characters.
■ Summary
void FPENTRY FrameWin( CHAR UL, CHAR UR,
CHAR LL, CHAR LR,
CHAR Hor, CHAR Ver, INT Attr );
UL character in upper left corner of the window.
UR character in upper right corner of the window.
LL character in lower left corner of the window.
LR character in lower right corner of the window.
Hor horizontal character for top and bottom rows of the
window.
Ver vertical character for the left and right columns of the
window.
Attr attribute color to use for the window frame display.
■ Remarks
FrameWin will outline the window that is currently defined by the
global variables WindMin and WindMax with the characters passed.
The coordinates given by WindMin and WindMax are used to frame the
window area.
Once the window frame has been displayed WindMin and WindMax will be
adjusted so the window will fit within the framed area. (e.g. if if
the current window is defined as 1,1,80,25 then after FrameWin the
current window will be 2,2,79,24).
..page
■ Example
#include <fpclib.h>
main()
{
VioInit();
WindowFP( 1, 1, 80, 25 );
FrameWin('-','-','-','-','-','|',7);
}
The above statement will use minus signs for the top and bottom
lines and the single bar for the two sides. The frame will be normal
color.
■ Example
#include <fpclib.h>
main()
{
VioInit();
WindowFP( 1, 1, 80, 25 );
FrameWin('L','R','l','r','H','V',48);
}
The frame this statement will draw is shown below; the color for the
frame of the window is attribute value 48.
LHHHHHHHHHHHHHHHHHHHHHHHHHHR
V V
V V
V V
V V
V V
V V
V V
lHHHHHHHHHHHHHHHHHHHHHHHHHHr
..page
..head03AGetCursorSize
■ Description
Reports the starting and ending scan lines of the current cursor.
■ Summary
INT2 FPENTRY GetCursorSize( void );
■ Remarks
Gets the cursor size by reporting the starting scan line in the high
byte and the ending scan line in the low byte of the word.
High byte -- starting scan line
Low byte -- ending scan line
■ Example
#include <fpclib.h>
main()
{
VioInit();
printf("%u %u\n",GetCursorSize() >> 8,GetCursorSize() & 0x00ff );
}
This example will print on one line the current starting scan line
and ending scan line respectively.
■ See Also
SetCursorSize
■ Example
j = GetCursorSize();
In this example j will receive the starting and ending scan line of
the cursor where:
hi byte - starting scan line
lo byte - ending scan line
..page
..head03AGetFrameAttr
■ Description
Read the attribute bytes for the specified area on the screen into
the buffer area.
■ Summary
void FPENTRY GetFrameAttr( INT x1, INT y1,
INT x2, INT y2, CHAR PTR Buffer );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Buffer data area where data from screen will be placed.
■ See Also
GetFrameCell, GetFrameChar
■ Example
#include <fpclib.h>
main()
{
char buffer[2000];
int i;
VioInit();
GetFrameAttr( 1, 1, 80, 25, Buffer );
}
This example will read the 2000 attribute bytes from the screen and
place every byte that is read into its corresponding byte position
in the buffer array.
..page
..head03AGetFrameCell
■ Description
Read the character and attributes bytes for the specified area on
the screen into the buffer area.
■ Summary
void FPENTRY GetFrameCell( INT x1, INT y1,
INT x2, INT y2, CHAR PTR Buffer );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Buffer data area where data from screen will be placed.
■ See Also
GetFrameAttr, GetFrameChar
■ Example
#include <fpclib.h>
main()
{
char buffer[4000];
int i;
VioInit();
GetFrameCell( 1, 1, 80, 25, Buffer );
}
This example will read the 4000 character and attribute bytes from
the screen and place every byte that is read into its corresponding
character attribute byte position in the buffer array.
..page
..head03AGetFrameChar
■ Description
Read the character bytes for the specified area on the screen into
the buffer area.
■ Summary
void FPENTRY GetFrameChar( INT x1, INT y1,
INT x2, INT y2, CHAR PTR Buffer );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Buffer data area where data from screen will be placed.
■ See Also
GetFrameAttr, GetFrameCell
■ Example
#include <fpclib.h>
main()
{
char buffer[2000];
int i;
VioInit();
GetFrameChar( 1, 1, 80, 25, Buffer );
}
This example will read the 2000 characters from the screen and place
every character that is read into its corresponding character
position in the buffer array.
..page