Dec 122017
 
C window routines.
File WINDOW4C.ZIP from The Programmer’s Corner in
Category C Source Code
C window routines.
File Name File Size Zip Size Zip Type
DEMO.C 30464 6331 deflated
DEMO.EXE 46364 16577 deflated
WINDOWS.DOC 28672 4238 deflated
WINDOWS.LIB 12800 4692 deflated

Download File WINDOW4C.ZIP Here

Contents of the WINDOWS.DOC file








DATE:12-30-84
BY:BOYD
DOC #: 12.0000

FUNCTION NAME:minor_box(upper_row,upper_col,lower_row,lower_col)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

minor_box(upper_row,upper_col,lower_row,lower_col);

int upper_row,
upper_col,
lower_row,
lower_col;





DESCRIPTION:

This function works exactly like box() function except it draws a
box in the single line drawing characters. Like






RETURNS:

NOTHING



CAUTIONS:

All parameters which are passed to the function must ve valid.
Seee box() function for details


SAMPLE CALL:

main()

{


minor_box(10,10,20,70);/* This gives a box starting on row 10
column 10 as the upper left corner
and ends with row 20 column 70 as the
bottom right hand corner */

}








DATE:12-30-84
BY:BOYD
DOC #: 11.0000

FUNCTION NAME:box(upper_row,upper_col,lower_row,lower_col)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

box(upper_row,upper_col,lower_row,lower_col);

int upper_row, /* upper corner of box */
upper_col,
lower_row, /* lower corner of box */
lower_col;





DESCRIPTION:

This function draws a box using the double line drawing
characters. The smallest box which can be drawn can have the
arguments of
box(upper_row,upper_col,upper_row+1,upper_col+1);

This gives a box like


RETURNS:

NOTHING



CAUTIONS:

This function does no checking for valid parameters. All
parameters must be valid. The maximum size box can only be
box(1,1,25,80);

SAMPLE CALL:

main()

{


box(10,10,20,70); /* This gives a box starting on row 10
column 10 as the upper left corner
and ends with row 20 column 70 as the
bottom right hand corner */

}







DATE:12-30-84
BY:BOYD
DOC #: 13.0000

FUNCTION NAME:window(upper_row,upper_col,lower_row,lower_col)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

window(upper_row,upper_col,lower_row,lower_col)

int upper_row,
upper_col,
lower_row,
lower_col;





DESCRIPTION:

This function opens a window from the center point of the passed
arguments. It first starts by drawing a small box and then
expanding the box until the designated size has been met. This
function gives the effect that the box came from no where and is
exploding.



RETURNS:

NOTHING



CAUTIONS:

The smallest window which can be opened is:
window(upper_row,upper_col,upper_row+2,upper_col+2);
Arguments are not value checked for valid parameters.

SAMPLE CALL:

main()
{

window(10,10,20,70); /* This function will start by
drawing a small box and then
drawing a larger one, erasing
the smaller one, until the box
is the size of passed parameters
*/

}







DATE:12-30-84
BY:BOYD
DOC #: 14.0000

FUNCTION NAME:active(wind);

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

active(wind);

int wind; /* ID number passed from the opening of
a window */







DESCRIPTION:

This function will make the passed wind# active on the screen.
For instance, if there are multiple windows layered upon each
other then this function will take the specified window and make
it the active window. This will restore what was underneath the
specified window and make it the top window on the screen.



RETURNS:

RETURNS -1 if you try to activate a window when there are no open
windows. RETURNS a 0 if you try to activate the current window.


CAUTIONS:

This function does not check if the window number which is passed
is valid! You must supply a valid window number.


SAMPLE CALL:

main()
{
int wind,wind2;

wind=open_window(10,10,20,70);
wind2=open_window(15,40,18,70);
activate(wind);

close_window(wind2);
close_window(wind);

}







DATE:12-30-84
BY:BOYD
DOC #: 15.0000

FUNCTION NAME:open_window(upper_row,upper_col,lower_row,lower_col)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

open_window(upper_row,upper_col,lower_row,lower_col);

int upper_row,
upper_col,
lower_row,
lower_col;





DESCRIPTION:

This function saves what ever is on the screen in the area which
is passed in the arguments. It then calls window() which opens a
window to the size specified in the arguments. It will then clear
the window and locate the cursor in the virtual home position (ROW
= 1, COLUMN = 1). The window will have the color specied with the
last color() function call.


RETURNS:

RETURNS -1 if there isn't enough memory or you already have 255
windows open.
RETURNS a valid window ID which is used in other window calls

CAUTIONS:

The specified window must be closed after the window is opened.
See close_window() for details.


SAMPLE CALL:

main()
{

int wind;
wind=open_window(10,10,20,70);
close_window(wind);

}







DATE:12-30-84
BY:BOYD
DOC #: 16.0000

FUNCTION NAME:close_window(wind)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

close_window(wind);

int wind; /* This is a valid window ID */








DESCRIPTION:

This function will close this window restoring everything which
was underneath.






RETURNS:

RETURNS -1 if there are no open windows on the screen.



CAUTIONS:

You must supply a valid window ID. See open_window() for details.



SAMPLE CALL:

main()
{

int wind;
wind=open_window(10,10,20,70);

close_window(wind);

}







DATE:12-30-84
BY:BOYD
DOC #: 17.0000

FUNCTION NAME:save_restore(u_row,u_col,l_row,l_col,address,flag)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

save_restore(u_row,u_col,l_row,l_col,address,flag);

int u_row,
u_col, /* upper row & col and */
l_row, /* lower row & col */
l_col,
flag; /* 0==save 1==restore */

char *address; /* char array address to save
screen at */

DESCRIPTION:

This function will save or restore the specified are to or from
the address which is passed to it.

This function automatically senses for graphics / monochrome
monitor.



RETURNS:

NOTHING



CAUTIONS:

This function must be passed valid arguments and addresses.



SAMPLE CALL:


main()

{

char array[4000];

save_restore(10,10,20,70,0,array); /* save screen part */
save_restore(10,10,20,70,1,array); /* restore screen part */

}







DATE:12-30-84
BY:BOYD
DOC #: 18.0000

FUNCTION NAME:scroll_window(wind,lines,direction)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

scroll_window(wind,lines,direction);

int wind, /* valid window ID number */
lines, /* count of lines, 0 == blank */
direction; /* 0 == up 1 == down */






DESCRIPTION:

This function will scroll inside the specified window. It will
scroll the specified amount of lines in the specified direction
using the color of the specific window, not the current color.





RETURNS:

NOTHING



CAUTIONS:

Must pass valid arguments.



SAMPLE CALL:

main()
{
int wind;
wind=open_window(10,10,20,70);
scroll_window(wind,3,0); /* scrolls the window 3
lines upward */
close_window(wind);

}








DATE:12-31-84
BY:BOYD
DOC #: 19.0000

FUNCTION NAME:locate_window(wind,row,col)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

locate_window(wind,row,col);

int wind, /* Valid window ID number */
row,
col; /* Row and column to place cursor

inside window */





DESCRIPTION:

This function will place the cursor to the specified row and
column in the window specified. The cursor position is relative
to the window. For example locate_window(wind,1,1) will locate in
the upper left corner of the window not the upper left corner of
the screen.



RETURNS:

NOTHING



CAUTIONS:

This function does no checking for bogus arguments.



SAMPLE CALL:

main()
{
int wind;
wind=open_window(10,10,20,70);
locate_window(wind,5,10);
close_window(wind);

}







DATE:12-30-84
BY:BOYD
DOC #: 20.0000

FUNCTION NAME:print_window(wind,string)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

print_window(wind,string);

int wind; /* Valid window ID number */
char *string; /* Address of string constant */







DESCRIPTION:

This function will print out the string constant with the current
color of the window, not the default color(). The function
supports the following imbedded command characters for output.
\n specifies a new line
\r specifies a return without linefeed
\t tabs over 10 spaces from cursor position
\f cause the window to be scrolled / cleared

RETURNS:

NOTHING



CAUTIONS:

This function can only print string constants or valid string that
are terminated with a '\0'.


SAMPLE CALL:

main()
{
int wind;
wind=open_window(10,10,20,70);
locate_window(wind,5,10);
print_window(wind,"This is a \n sample strng \n");
close_window(wind);
}








DATE:12-30-84
BY:BOYD
DOC #: 21.0000

FUNCTION NAME:cls_window(wind)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

cls_window(wind);

int wind; /* Valid window ID number */








DESCRIPTION:

This function will blank out the inside of the specified window.
It uses the current color of the window not the default color.






RETURNS:

NOTHING



CAUTIONS:

This function does not check for bogus arguments.



SAMPLE CALL:

main()
{
int wind;
wind=open_window(10,10,20,70);
print_window(wind,"This is a sample string ");
cls_window(wind);
close_window(wind);

}








DATE:12-30-84
BY:BOYD
DOC #: 22.0000

FUNCTION NAME:color_window(wind,foregroung,background)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

color_window(wind,foreground,background);

int wind, /* Valid window ID numer */
foreground,

background; /* fore & back ground colors */






DESCRIPTION:

This function will change the default colors for the specified
window. When a window is open it is give the current default
color which was specified with the last color() funtion. This
function will change what this default color is to the new
specified color.



RETURNS:

NOTHING



CAUTIONS:

This function does no checking for bogus data.



SAMPLE CALL:

main()
{
int wind;
wind=open_window(10,10,20,70);
print_window(wind,"This is in default color \n\n");
color_window(wind,2,0);
print_window(wind,"This is in the new color ");
close_window(wind);

}







DATE:12-30-84
BY:BOYD
DOC #: 22.0000

FUNCTION NAME:move_window(wind,direction)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

move_window(wind,direction);

int wind, /* Valid window ID number */
direction; /* 1 == upward
2 == to the right
3 == downward
4 == to the left */




DESCRIPTION:

This function will float the specified window around the screen in
the direction which is specified in the supplied argument. The
window will move 1 space at a time in the specified direction.





RETURNS:

NOTHING



CAUTIONS:

This function does no checking for bogus arguments.



SAMPLE CALL:

main()
{
int wind;
wind=open_window(10,10,20,70);
move_window(wind,3);
close_window(wind);

}








DATE:12-30-84
BY:BOYD
DOC #: 23.0000

FUNCTION NAME:cls()

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

cls();

/* No arguments */








DESCRIPTION:

This function will blank the screen using the color which was last
specified with a color() function call. If no color has been
specified then it will take the default color of white on black.
This function works independent of the window utilities and will
blank the whole screen even if there are windows on the screen.



RETURNS:

NOTHING



CAUTIONS:

Will blank the screen no matter what is on it.



SAMPLE CALL:

main()
{
color(3,0);
cls();

}








DATE:12-30-84
BY:BOYD
DOC #: 24.0000

FUNCTION NAME:color(foreground,background)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

color(foreground,background);

int foreground,
background; /* Fore & back ground colors
to make the default colors */






DESCRIPTION:

This function will set the default color for the screen managemnet
functions. Any printing with printf() or any scrolling, or
windows which are opened will be set to the last default color
which was specified with this function. If no default color is
set then white on black is assumed.



RETURNS:

NOTHING



CAUTIONS:





SAMPLE CALL:

main()

{
color(3,0);
cls();
printf("This is in the new color \n\n");
color(7,0);
printf("This is in the specified color of white on black");
}








DATE:12-30-84
BY:BOYD
DOC #: 24.0000

FUNCTION NAME:h_bar(length,character)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

h_bar(length,character);

int length, /* # of characters to print */
character; /* ASCII # of character to print */







DESCRIPTION:

This function will print the specified character the specified
number of times starting at the current cursor location and ending
up where it stops.





RETURNS:

NOTHING



CAUTIONS:

This function does not check for right margin overflow, do not
print more characters than are columns left on the screen.


SAMPLE CALL:

main()
{
color(2,0); /* specify the color for H_bar */
h_bar(25,65); /* This will print 25 'A's */

}







DATE:12-30-84
BY:BOYD
DOC #: 25.0000

FUNCTION NAME:v_bar(height,character)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

v_bar(height,character);

int height, /* Number of characters to print */
character; /* ASCII # of character */







DESCRIPTION:

This funtion will print a vertical bar specified with the
specified height. This funtion will start printing at the current
cursor location and print downwards to form a vertical bar of the
specified character.




RETURNS:

NOTHING



CAUTIONS:

This function does not check for end of screen. Do not pass a
height which is greater than the number of rows left on the
screen.

SAMPLE CALL:

main()
{

color(4,0);
v_bar(10,65); /* Prints a bar of 'A's with a
height of 10 */

}







DATE:12-30-84
BY:BOYD
DOC #: 26.0000

FUNCTION NAME:place(character)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

place(character);

int character; /* ASCII # of character to print */








DESCRIPTION:

This function will place the specified character at the current
cursor location. It will use the default color which was
specified in the last call to color().





RETURNS:

NOTHING



CAUTIONS:





SAMPLE CALL:

main()
{

place(65); /* places a 'A' at the
current cursor location
*/

}







DATE:12-30-84
BY:BOYD
DOC #: 27.0000

FUNCTION NAME:locate(row,col)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

locate(row,col);

int row,
col; /* row and column to place the
cursor at */






DESCRIPTION:

This function will locate the cursor at the specified row and
column positions. This function is independent of the window
functions and will place the cursor at the physical row and column
which is passed to it.




RETURNS:

NOTHING



CAUTIONS:





SAMPLE CALL:

main()
{
locate(10,10);
printf("This will print a column 10 row 10 ");
}








DATE:12-30-84
BY:BOYD
DOC #: 28.0000

FUNCTION NAME:printf(args);

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

printf(args);

char *args; /* Optional arguments */








DESCRIPTION:

This function is identical to the standard printf except this
function is written entirely in ASSEMBLY for speed. This function
will print in the default color which was last specifed in a call
to color().




RETURNS:

NOTHING



CAUTIONS:

This function does not support the DOS redirection capabilities.
This function is Aproximately 50 X's faster than the old printf();


SAMPLE CALL:

main()
{
locate(10,10);
color(5,0);
printf("This is a example of printf ");
}







DATE:12-30-84
BY:BOYD
DOC #: 29.0000

FUNCTION NAME:scroll(u_row,u_col,l_row,l_col,lines,direction)

SYNOPSIS:
ARGUMENT(S): ARGUMENT DESC:

scroll(u_row,u_col,l_row,l_col,lines,direction);

int u_row, /* upper left corner of window */
u_col,
l_row, /* lower right corner of window */
l_col,
lines, /* # of lines to scroll */
direction; /* 0 == up 1 == down */



DESCRIPTION:

This function will scroll the specified area on the screen up or
down or will blank it if 0 lines are passed. This function is
indenpendent of the window functions and will scroll whatever is
on the screen in the specified positions. The color which is used
in the scroll is the default color which was specified in the last
color() function call.


RETURNS:

NOTHING



CAUTIONS:





SAMPLE CALL:

main()
{

scroll(10,10,20,70,4,0); /* scrolls the specified
window up 4 lines */
}



 December 12, 2017  Add comments

Leave a Reply