Windowing

Reference Section

_draw_wborder
_get_backdrop
_get_backdropbuf
_get_whandle
_get_wlevel
_get_wpos
_get_wspec
_set_backdrop
_set_backdropbuf
_set_spos
_set_wborder
_set_wlevel
_set_wpos
_set_wshadow
_update_cursor
_update_off
_update_on
_update_rect
_update_screen
_update_window
_wborder_off
_wborder_on
_win_bufsize
_win_close
_win_create
_win_init
_win_move
_win_open
_win_remove
_win_resume
_win_select
_win_suspend

_draw_wborder


Descrip
Draws a border within the active window.

Syntax
#include <window.h>
void _draw_wborder(void);

Returns
None

Notes
This function draws the border of the active window using the window's current border definition. Drawing the border overwrites any characters in the outermost rows and columns of the window border region. The screen is only affected if auto update is on. The border definition may be set by calling _set_wborder.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = (char *)_rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = (char *)_rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   _wborder_off ();
	   ...
	   _wborder_on ();
	   _draw_wborder ();
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset of block */
	    jc wborder_030/* if unable to allocate */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc wborder_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc wborder_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc wborder_020/* if unable to create window */
	   wborder_on ();
	   ...
	   wborder_off ();
	   draw_wborder ();
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncwborder_020/* if successful */
	   ... 	 	/* if unable to remove window */
	wborder_020:
	   pop di	 	/* DI = offset of win workbuf */
	   rel_free ();
	wborder_030:
	   ...
	}

Source file WBDRAW.ASM ASM equiv DRAW_WBORDER
See also
_set_wborder

_get_backdrop


Descrip
Returns the windowing backdrop character and attribute.

Syntax
#include <window.h>
void _get_backdrop(char *chr, char *attr);

Returns
No return value.
chr backdrop character
attr backdrop attribute

Notes
This function retrieves the current windowing backdrop character and attribute. This is the character/attribute pair which is used to fill any screen area not covered by a window. If a backdrop buffer has been specified using _set_backdropbuf, the backdrop character and attribute are ignored.

_win_init be called before using this function.

This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   char chr, attr;
	   _get_backdrop (&chr, &attr);/* load vars w/backdrop info */
	}

Inline Assembly Example
	#include <inline.h>
	   ...
	   get_backdrop ();/* AL=character, AH=attribute */
	   ...

Source file _WGBDROP.ASM ASM equiv GET_BACKDROP
See also
_set_backdrop, _set_backdrop

_get_backdropbuf


Descrip
Returns the address of the current windowing backdrop buffer.

Syntax
#include <window.h>
void far *_get_backdropbuf(void);

Returns
A pointer to the current window backdrop buffer if one is installed.

NULL if a backdrop buffer is not installed.

Notes
This function returns the address of the current windowing backdrop buffer. The backdrop buffer defines the appearance of any screen area not covered by a window. NULL is returned if a backdrop buffer is not currently installed.

If a backdrop buffer is not installed, the backdrop character and attribute define the appearance of screen areas not covered by a window. A backdrop buffer may be installed using _set_backdropbuf. The backdrop character and attribute may be manipulated using _get_backdrop and _set_backdrop.

_win_init must be called before using this function.

This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   segaddr heapseg;
	   ...
	   buffer = _rel_malloc (heapseg, _screen_bufsize ());
	   if (buffer != NULL)
	   {
	      _save_screen (buffer);
	      _set_backdropbuf (buffer);
	   }
	   ...
	   _rel_free (_get_backdropbuf ());
	}

Inline Assembly Example
	#include <inline.h>
	{
	   segaddr heapseg;
	   unsigned int heapsize;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   screen_bufsize ();
	   rel_malloc ();	/* DI = offset allocated block */
	    jc g_bkdrpb_010/* if unable to allocate block */
	   set_backdropbuf ();
	   ...
	   get_backdropbuf ();/* ES:DI -> backdrop buffer */
	   rel_free ();
	    jncg_bkdrpb_010/* if successful */
	   ... 	 	/* if an error occurred */
	g_bkdrpb_010:
	   ...
	}

Source file _WGBDRPB.ASM ASM equiv GET_BACKDROPBUF
See also
_set_backdrop, _set_backdrop

_get_whandle


Descrip
Returns the handle of a window at a specified level.

Syntax
#include <window.h>
int _get_whandle(int num);

Returns
The handle of the window at level num if there is a window at level num.

0 if there is no window at level num.

Notes
This function returns the handle of the window which is currently at level num. The handle of the active window is returned if num is zero. 0 is returned if num is invalid.

Window levels may be positive or negative. Positive values identify window levels from the top down (the top window is at level one, the next window is at level two, etc.). Negative values identify window levels from the bottom up (the bottom window is at level -1, the next window higher is at level -2, etc.). Level zero refers to the active window.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if (_win_create (&win, buffer) == 0)
	   {
	      /* Handle the error */
	   }
	   ...
	   handle = _get_whandle (1);
	   if (handle == 0)
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc g_whandle_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size of required buf */
	    jc g_whandle_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc g_whandle_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc g_whandle_020/* if unable to create window */
	   ...
	   mov ax,1
	   get_whandle ();
	    jc g_whandle_020/* if an error occurred */
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncg_whandle_020/* if successful */
	   ... 	 	/* if unable to remove window */
	g_whandle_020:
	   pop di	 	/* DI = offset win work buffer */
	   rel_free ();
	g_whandle_030:
	   ...
	}

Source file _WGETHDL.ASM ASM equiv GET_WHANDLE
See also
_get_wlevel, _win_create

_get_wlevel


Descrip
Returns the level of a window.

Syntax
#include <window.h>
int _get_wlevel(int handle);

Returns
The level of the window associated with handle.

0 if handle is invalid.

Notes
This function returns the level of the window associated with handle. The returned level indicates the level of the specified window relative to the top window (the top window is at level one, the next window is at level two, etc.). 0 is returned if handle is invalid. STDWIN is considered an invalid handle since it does not occupy a level.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle, level;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == 0)
	   {
	      /* Handle the error */
	   }
	   ...
	   level = _get_wlevel (handle);
	   if (level == 0)
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc g_wlevel_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc g_wlevel_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc g_wlevel_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc g_wlevel_020/* if unable to create window */
	   ...
	   get_wlevel ();	/* AX = window level */
	    jc g_wlevel_020/* if an error occurred */
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncg_wlevel_020/* if successful */
	   ... 	 	/* if unable to remove window */
	g_wlevel_020:
	   pop di
	   rel_free ();
	g_wlevel_030:
	   ...
	}

Source file _WGETLVL.ASM ASM equiv GET_WLEVEL
See also
_get_whandle, _set_wlevel

_get_wpos


Descrip
Returns the position of a window.

Syntax
#include <window.h>
int _get_wpos(int handle, int *xpos, int *ypos);

Returns
0 if handle is a valid level or handle.
xpos signed horizontal window position
ypos signed vertical window position

-1 if handle is invalid.

Notes
This function indicates the X and Y coordinates of the upper left-hand corner of the window associated with handle. The indicated coordinates (which are returned in xpos and ypos) are signed numbers relative to the upper left-hand corner of the screen (0,0). -1 is returned if handle is invalid.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle, x, y;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   if (_get_wpos (handle, &x, &y))
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc get_wpos_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc get_wpos_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc get_wpos_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc get_wpos_020/* if unable to create window */
	   ...
	   get_wpos ();	/* AX = xpos, DX = ypos */
	    jc get_wpos_020
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncget_wpos_020/* if successful */
	   ... 	 	/* if unable to remove window */
	get_wpos_020:
	   pop di	 	/* DI = offset win work buffer */
	   rel_free ();
	get_wpos_030:
	   ...
	}

Source file _WGETPOS.ASM ASM equiv GET_WPOS
See also
_set_wpos

_get_wspec


Descrip
Returns the specifications of a window.

Syntax
#include <window.h>
int _get_wspec(int handle, void far *buffer);

Returns
0 if the function was successful.
buffer specifications of the window associated with handle

-1 if handle is invalid.

Notes
This function makes a copy of the current window specifications for the window associated with handle. handle may be a window handle or level. If the function was successful, the window specifications are placed in buffer in the form of a sawin definition structure and 0 is returned. -1 is returned if handle is invalid.

The sawin window definition structure is defined in WINDOW.H as follows:

typedef struct {
int left; /* left margin of window */
int top; /* top row of window */
unsigned char width; /* width of window (in columns) */
unsigned char height;/* height of widow (in rows) */
unsigned char dattr; /* window default attribute */
unsigned char tprows;/* number of top border rows */
unsigned char rtcols;/* number of right border columns */
unsigned char bmrows;/* number of bottom border rows */
unsigned char ltcols;/* number of left border columns */
void * border; /* pointer to the border descriptor */
unsigned char battr; /* border attribute */
char horz; /* shadow horizontal offset */
char vert; /* shadow vertical offset */
unsigned char stype; /* shadow type flags */
void * shadow; /* pointer to shadow descriptor */
unsigned char sattr; /* shadow attribute (shadowed area's color) */
void * attrtbl; /* pointer to the window attribute table */
unsigned char curstate;/* cursor on/off state */
unsigned int curshape;/* cursor shape */
}sawin;

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   if (_get_wspec (handle, &win))
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc g_wspec_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc g_wspec_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc g_wspec_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc g_wspec_020/* if unable to create window */
	   ...
	   get_wspec ();
	    jc g_wspec_020/* if an error occurred */
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncg_wspec_020/* if successful */
	   ... 	 	/* if unable to remove window */
	g_wspec_020:
	   pop di	 	/* DI = offset win work buffer */
	   rel_free ();
	g_wspec_030:
	   ...
	}

Source file _WGETSPC.ASM ASM equiv GET_WSPEC
See also
_win_create

_set_backdrop


Descrip
Sets the windowing backdrop character and attribute.

Syntax
#include <window.h>
void _set_backdrop(int chr, int attr);

Returns
None

Notes
This function sets the backdrop character and attribute to chr and attr. This is the character/attribute pair which is used to fill any screen area not covered by a window. The screen is updated immediately using chr and attr if auto update is on and no backdrop buffer has been specified. This function has no effect if a backdrop buffer has been specified using _set_backdropbuf.

attr is interpreted as an attribute table code if an attribute table has been installed for STDWIN; otherwise, attr is interpreted as an attribute.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	   _set_backdrop ('°', BLUE + (WHITE * 16));

Inline Assembly Example
	#include <inline.h>
	...
	mov al,177
	mov ah,(BLUE + (WHITE*16))
	set_backdrop ();
	...
	}

Source file _WSBDROP.ASM ASM equiv SET_BACKDROP
See also
_get_backdrop, _set_backdrop

_set_backdropbuf


Descrip
Installs a windowing backdrop buffer.

Syntax
#include <window.h>
void _set_backdropbuf(void far *bdropbuf);

Returns
None

Notes
This function assigns bdropbuf as the backdrop buffer for the windowing system. The backdrop buffer defines the appearance of any screen area not covered by a window. If auto update is on and a buffer address is specified, the screen is immediately updated using the backdrop buffer. If auto update is on and -1 is specified for bdropbuf, the screen is immediately updated with the backdrop character and attribute. The screen remains unchanged if auto update is off.

bdropbuf must contain screen information in the format returned by the _save_screen function. Using any other buffer format will produce undefined results. Note that a specific screen may be used as the windowing backdrop by saving it with _save_screen and then passing that buffer address to this function.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   segaddr heapseg;
	   ...
	   buffer = _rel_malloc (heapseg, _screen_bufsize ());
	   if (buffer != NULL)
	   {
	      _save_screen (buffer);
	      _set_backdropbuf (buffer);
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	segaddr heapseg;
	   ...
	   mov es,heapseg
	   screen_bufsize ();
	   rel_malloc ();	/* DI = offset allocated block */
	    jc s_bdropb_010/* if unable to allocate block */
	   save_screen ();
	   set_backdropbuf ();
	   ...
	s_bdropb_010:
	}

Source file _WSBDRPB.ASM ASM equiv SET_BACKDROPBUF
See also
_get_backdrop, _save_screen, _set_backdrop

_set_spos


Descrip
Sets a window shadow position.

Syntax
#include <window.h>
int _set_spos(int handle, int shorz, int svert);

Returns
0 if the shadow was successfully repositioned.

-1 if handle is invalid.

Notes
This function sets the shadow position for the window associated with handle. The shadow is repositioned relative to the position of the window, with shorz specifying the horizontal offset in columns and svert specifying the vertical offset in rows. Positive offsets specify right and downward displacements; negative offsets specify left and upward displacements. The shadow immediately appears in its new position on the screen if the window is open and auto update is enabled; otherwise, the screen is unaffected. If handle is invalid, -1 is returned and the screen remains unaffected. 0 is returned otherwise.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   if (_set_spos (handle, 3, 3))
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc set_spos_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc set_spos_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc set_spos_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc set_spos_020/* if unable to create window */
	   ...
	   mov al,3
	   mov ah,al
	   set_spos ();
	    jc set_spos_020/* if an error occurred */
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncset_spos_020/* if successful */
	   ... 	 	/* if unable to remove window */
	set_spos_020:
	   pop di	 	/* DI = offset of win workbuf */
	   rel_free ();
	set_spos_030:
	   ...
	   }

Source file _WSETSPS.ASM ASM equiv SET_SPOS
See also
_set_wshadow, _win_create

_set_wborder


Descrip
Defines the border attribute and characters for a window.

Syntax
#include <window.h>
int _set_wborder(int handle, int battr, void *descriptor);

Returns
0 if the function was successful.

-1 if handle is invalid.

Notes
This function sets the border attribute and border characters for the window associated with handle. If the window is open and auto update is on, the new border definition takes effect on the screen immediately; otherwise, the screen remains unaffected. 0 is returned if the function was successful. -1 is returned and the window remains unchanged if handle is invalid.

battr is the attribute used to display the border characters. battr is interpreted as an attribute table code if an attribute table has been installed for the specified window; otherwise, battr is interpreted as an attribute. The border attribute remains unchanged if -1 is specified for battr.

Border characters may be specified in one of two ways. The first method is to select a predefined border by specifying a border style in descriptor. The following symbolic constants (defined in WINDOW.H) represent the six predefined border styles:

BORDER_SINGLE(-2) Single line border
BORDER_DOUBLE(-3) Double line border
BORDER_SNGLDBL(-4) Single horizontal, double vertical line border
BORDER_DBLSNGL(-5) Single vertical, double horizontal line border
BORDER_FULLBLK(-6) Full block border
BORDER_HALFBLK(-7) Half block border

If -1 is specified for descriptor, the border characters remain unchanged.

The second method for specifying borders is to place the address of a custom border descriptor structure in descriptor. The border descriptor structure is defined in WINDOW.H as follows:

typedef struct {/* border descriptor */
char upper_left;/* upper left corner border character */
char top; /* top row border character */
char upper_right;/* upper right corner border character */
char right; /* right side border character */
char bottom_right;/* bottom right corner border character */
char bottom; /* bottom row border character */
char bottom_left;/* bottom left corner border character */
char left; /* left side border character */
} border;

See the Windowing technical notes for a complete discussion on defining custom window borders.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   if (_set_wborder (handle, -1, BORDER_SNGLDBL))
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   void *style = BORDER_SNGLDBL;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset of block */
	    jc s_wborder_030/* unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc s_wborder_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset of block */
	    jc s_wborder_020/* unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc s_wborder_020/* if unable to create window */
	   ...
	   mov ah,-1
	   mov si,style
	   set_wborder ();
	    jc s_wborder_020/* if an error occurred */
	   ...
	   win_remove ();	/* DI = offset of win buffer */
	    jncs_wborder_020/* if successful */
	   ... 	 	/* if unable to remove window */
	s_wborder_020:
	   pop di	 	/* DI = offset of win workbuf */
	   rel_free ();
	s_wborder_030:
	   ...
	}

Source file _WSBORDR.ASM ASM equiv SET_WBORDER
See also
_draw_wborder, _set_wshadow

_set_wlevel


Descrip
Sets the level of a window.

Syntax
#include <window.h>
int _set_wlevel(int handle, int num);

Returns
0 if the level was successfully set.

-1 if handle or num is invalid.

Notes
This function sets the level of the window associated with handle to the level specified by num. If another window already occupies the level specified by num, all windows at and below that level are moved down one level and the window associated with handle is placed at level num. If the top open window is the active window and its level is changed by this function so that it is no longer the top open window, the new top open window is automatically selected as the active window. 0 is returned if the window level was successfully set. -1 is returned if the window level could not be set.

Window levels may be positive or negative. Positive values identify window levels from the top down (the top window is at level one, the next window is at level two, etc.). Negative values identify window levels from the bottom up (the bottom window is at level -1, the next window higher is at level -2, etc.). Level zero refers to the active window and is not valid for num. STDWIN does not occupy a level.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   if (_set_wlevel (handle, 1))
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc s_wlevel_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc s_wlevel_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc s_wlevel_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc s_wlevel_020/* if unable to create window */
	   ...
	   mov ax,1
	   set_wlevel ();
	    jc s_wlevel_020
	   ... 	 	/* if an error occurred */
	   win_remove ();	/* DI = offset of buffer being 
	   	  	 	   used for window */
	    jncs_wlevel_020/* if successful */
	   ... 	 	/* if unable to remove window */
	s_wlevel_020:
	   pop di	 	/* DI = offset of win workbuf */
	   rel_free();
	s_wlevel_030:
	}

Source file _WSETLVL.ASM ASM equiv SET_WLEVEL
See also
_get_wlevel, _win_select

_set_wpos


Descrip
Sets the position of a window.

Syntax
#include <window.h>
int _set_wpos(int handle, int xpos, int ypos);

Returns
0 if the window position was successfully set.

-1 if handle is invalid.
Notes
This function moves the window associated with handle to the X,Y coordinate position specified by xpos and ypos. These coordinates specify the position of the upper left-hand corner of the window and are interpreted as signed numbers relative to the upper left-hand corner of the screen (0,0). The new position is reflected immediately on the screen if auto update is on. The screen remains unchanged if auto update is off. 0 is returned if the window position was successfully set. -1 is returned and the screen is unchanged if the window position could not be set.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   if (_set_wpos (handle, 1, 1))
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc set_wpos_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc set_wpos_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc set_wpos_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc set_wpos_020/* if unable to create window */
	   ...
	   mov ax,1
	   mov dx,ax
	   set_wpos ();
	    jc set_wpos_020/* if an error occurred */
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncset_wpos_020/* if successful */
	   ... 	 	/* if unable to remove window */
	set_wpos_020:
	   pop di	 	/* DI = offset of win workbuf */
	   rel_free ();
	set_wpos_030:
	   ...
	}

Source file _WSETWPS.ASM ASM equiv SET_WPOS
See also
_get_wpos, _win_move

_set_wshadow


Descrip
Sets the shadow characters and attributes of a window.

Syntax
#include <window.h>
int _set_wshadow(int handle, int stype, int sattr, void *descriptor);

Returns
0 if the shadow characteristics were successfully changed.

-1 if handle is invalid.

Notes
This function sets the shadow attribute and shadow characters for the window associated with handle. If the window is open and auto update is on, 0 is returned and the new shadow definition takes effect on the screen immediately; otherwise, -1 is returned and the screen remains unaffected.

sattr is the attribute used to display the shadow characters. sattr is interpreted as an attribute table code if an attribute table has been installed for the specified window; otherwise, sattr is interpreted as an attribute. If the background color of the specified attribute is BK_TRNSPRNT (all four high bits set in the attribute), the background color of the shadow is transparent. If the specified attribute is S_TRNSPRNT (-2), the entire attribute is transparent. If -1 is specified for sattr, the shadow attribute remains unchanged.

Shadow characters may be specified in one of two ways. A predefined shadow may be selected by specifying a shadow style in descriptor. The following symbolic constants represent the predefined shadow styles:

SHADOW_TRNSPRNT(-2) Transparent shadow
SHADOW_HALFHGHT(-3) Half-height shadow

If -1 is specified for descriptor, the shadow characters remain unchanged.

Alternatively, a custom shadow may be specified by using a shadow descriptor in descriptor and indicating the shadow type in stype. Shadow descriptor structures are defined in WINDOW.H as follows:

typedef struct {/* shadow descriptor */
char upper_left;/* upper left corner shadow character */
char top; /* top row shadow character */
char upper_right;/* upper right corner shadow character */
char right; /* right side shadow character */
char bottom_right;/* bottom right corner shadow character */
char bottom; /* bottom row shadow character */
char bottom_left;/* bottom left corner shadow character */
char left; /* left side shadow character */
char fill; /* shadow fill character */
} shadow;

If S_TRNSPRNT (-2) is specified as a shadow character, the character is transparent.

stype specifies the shadow type and state. It may be used to disable the shadow or to indicate the characteristics of a custom shadow. The following symbolic constants (defined in WINDOW.H) may be used to specify the shadow type and state:

S_NORMAL (0x00) Normal size shadow characters
S_HALFHGHT (0x01) Half-height shadow characters
S_HALFWIDTH (0x02) Half-width shadow characters
S_HALFHW (0x03) Half-height and width shadow characters
S_OFF (0x80) Shadow not displayed

If a stype of -1 is specified, the shadow type and state remains unchanged. See the technical notes for a detailed explanation of shadow types.

All of the symbolic constants shown above are defined in WINDOW.H. See the Windowing technical notes for a complete discussion on defining custom window shadows.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   if (_set_wshadow (handle, S_HALFHGHT, BK_TRNSPRNT,
	      SHADOW_HALFHGHT))
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   void *style = SHADOW_HALFHGHT;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc s_wshadow_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc s_wshadow_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc s_wshadow_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc s_wshadow_020/* if unable to create window */
	   ...
	   mov al,S_HALFHGHT
	   mov ah,BK_TRNSPRNT
	   mov si,style
	   set_wshadow ();
	    jc s_wshadow_020/* if an error occurred */
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncs_wshadow_020/* if successful */
	   ... 	 	/* if unable to remove window */
	s_wshadow_020:
	   pop di	 	/* DI = offset of win workbuf */
	   rel_free ();
	s_wshadow_030:
	   ...
	}

Source file _WSSHADO.ASM ASM equiv SET_WSHADOW
See also
_set_spos, _set_wborder

_update_cursor


Descrip
Updates the hardware cursor position within the windowing system.

Syntax
#include <window.h>
void _update_cursor(void);

Returns
None

Notes
This function forces the hardware cursor to the position and shape specified in the top open window. If this cursor position lies off the edge of the screen, the cursor is disabled. This function updates the cursor whether or not auto update is on.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	   _update_cursor ()

Inline Assembly Example
	#include <inline.h>
	   update_cursor ();

Source file WUPDATEC.ASM ASM equiv UPDATE_CURSOR
See also
_cursor_off, _cursor_on, _set_cursor

_update_off


Descrip
Turns auto update off.

Syntax
#include <window.h>
void _update_off(void);

Returns
None

Notes
This function disables the auto update feature of the windowing system. When auto update is off, windowing functions and Console I/O character output functions do not immediately affect the appearance of the screen. Changes only become visible when auto update is enabled using _update_on or when _update_screen, _update_rect, or _update_window is called.

_win_init must be called before using this function. Auto update is automatically enabled when _win_init is called.

This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   _update_off ();
	   if (_win_move (handle, 1, 1))
	   {
	      /* Handle the error */
	   }
	   _update_on ();
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	      _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset memory block */
	    jc win_move_030/* error allocating memory */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc win_move_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset memory block */
	    jc win_move_020/* if unable to allocate */
	   win_create ();	/* BX = window handle */
	    jc win_move_020/* if unable to create */
	      ...
	   _update_off ();
	   mov ax,1
	   mov dx,ax
	   win_move ();
	    jc win_move_020/* if an error occurred */
	   _update_on ();
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncwin_move_020/* if successful */
	   ... 	 	/* if unable to remove window */
	win_move_020:
	   pop di	 	/* DI = offset win work buffer */
	   rel_free ();
	win_move_030:
	   ...
	}

Source file WUPOFF.ASM ASM equiv UPDATE_OFF
See also
_update_on

_update_on


Descrip
Turns auto update on.

Syntax
#include <window.h>
void _update_on(void);

Returns
None

Notes
This function enables the auto update feature of the windowing system. When auto update is on, windowing functions and Console I/O output functions immediately affect the appearance of the screen.

_win_init must be called before using this function. Auto update is automatically enabled when _win_init is called.

This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   _update_off ();
	   if (_win_move (handle, 1, 1))
	   {
	      /* Handle the error */
	   }
	   _update_on ();
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	      _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc win_move_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size of required buf */
	    jc win_move_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc win_move_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc win_move_020/* if unable to create window */
	   ...
	   _update_off ();
	   mov ax,1
	   mov dx,ax
	   win_move ();
	    jc win_move_020/* if an error occurred */
	   _update_on ();
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncwin_move_020/* if successful */
	   ... 	 	/* if unable to remove window */
	win_move_020:
	   pop di	 	/* DI = offset of win workbuf */
	   rel_free ();
	win_move_030:
	   ...
	}

Source file WUPON.ASM ASM equiv UPDATE_ON
See also
_update_off

_update_rect


Descrip
Updates a rectangular region of the screen.

Syntax
#include <window.h>
void _update_rect(int top, int left, int hght, int wdth);

Returns
None

Notes
This function redisplays the windowing backdrop and open windows as needed to fully update a specified rectangular region of the screen. left and top specify the X and Y coordinates of the upper left corner of the region. The region is hght rows in height and wdth columns in width.

Only the specified portion of the screen is updated. The specified coordinates are unsigned numbers and are relative to the upper left-hand corner of the screen (0,0). The update is performed whether or not auto update is on.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   _update_off ();
	   ...
	   _update_rect (1, 1, 10, 10);
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	      _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc upd_rect_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size of required buf */
	    jc upd_rect_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc upd_rect_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc upd_rect_020/* if unable to create window */
	   update_off ();
	   ...
	   mov dh,1
	   mov dl,1
	   mov ah,10
	   mov al,10
	   update_rect ();
	   ...
	   update_on ();
	   win_remove ();	/* DI = offset window buffer */
	    jncupd_rect_020/* if successful */
	   	  ... 	/* if unable to remove window */
	upd_rect_020:
	   pop di	 	/* DI = offset of win workbuf */
	   rel_free ();
	upd_rect_030:
	   ...
	}

Source file _WUPDATR.ASM ASM equiv UPDATE_RECT
See also
_update_screen, _update_window

_update_screen


Descrip
Updates the entire screen.

Syntax
#include <window.h>
void _update_screen(void);

Returns
None

Notes
This function redisplays the windowing backdrop and all open windows as needed to fully update the entire screen. The update is performed whether or not auto update is on.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   _update_off ();
	   ...
	   if (_update_window (handle))
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	      _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc upd_win_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc upd_win_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc upd_win_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc upd_win_020/* if unable to create window */
	   update_off ();
	   ...
	   update_window ();
	   ...
	   update_on ();
	   win_remove ();	/* DI = offset window buffer */
	    jncupd_win_020/* if successful */
	   ... 	 	/* if unable to remove window */
	upd_win_020:
	   pop di	 	/* DI = offset of win workbuf */
	   rel_free ();
	upd_win_030:
	   ...
	}

Source file WUPDATES.ASM ASM equiv UPDATE_SCREEN
See also
_update_rect, _update_window

_update_window


Descrip
Updates a window.

Syntax
#include <window.h>
int _update_window(int handle);

Returns
0 if the window was successfully updated.

-1 if handle is invalid.

Notes
This function redisplays the window associated with handle. If the window is open, the window and shadow are completely redisplayed. If the window is closed, the region beneath the window and shadow is redisplayed. Thiseffectively erases the window from the screen if it was previously visible. If the window is positioned completely off the screen, this function has no effect. -1 is returned if handle is invalid. STDWIN is considered invalid.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   _update_off ();
	   ...
	   _update_screen ();
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc upd_scrn_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc upd_scrn_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc upd_scrn_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc upd_scrn_020/* if unable to create window */
	   update_off ();
	   ...
	   update_screen ();
	   ...
	   update_on ();
	   win_remove ();	/* DI = offset window buffer */
	    jncupd_scrn_020/* if successful */
	   ... 	 	/* if unable to remove window */
	upd_scrn_020:
	   pop di	 	/* DI = offset of win workbuf */
	   rel_free ();
	upd_scrn_030:
	   ...
	}

Source file _WUPDATW.ASM ASM equiv UPDATE_WINDOW
See also
_update_rect, _update_screen

_wborder_off


Descrip
Disables border access within the active window.

Syntax
#include <window.h>
void _wborder_off(void);

Returns
None

Notes
This function prevents the console I/O functions from accessing the border region of the active window. This is the default state for each window. The border region remains inaccessible until _wborder_on is called. When border access is disabled, the window's active region is limited to the region which lies entirely within the window borders, and console I/O is relative to the upper left-hand corner of this region (0,0). If _wborder_on was called previously, this function restores the cursor position and clipping region which were in effect before border access was enabled.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   _wborder_off ();
	   ...
	   _wborder_on ();
	   _draw_wborder ();
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc wborder_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc wborder_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc wborder_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc wborder_020/* if unable to create window */
	   wborder_on ();
	   ...
	   wborder_off ();
	   draw_wborder ();
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncwborder_020/* if successful */
	   ... 	 	/* if unable to remove window */
	wborder_020:
	   pop di	 	/* DI = offset win work buffer */
	   rel_free ();
	wborder_030:
	   ...
	}

Source file WBONOFF.ASM ASM equiv WBORDER_OFF
See also
_wborder_on

_wborder_on


Descrip
Enables border access within the active window.

Syntax
#include <window.h>
void _wborder_on(void);

Returns
None

Notes
This function allows the console I/O functions to access the border region of the active window. The border region remains accessible until _wborder_off is called. When border access is enabled, the window's active region is extended to fill the entire window, and console I/O is relative to the upper left-hand corner of the window (0,0). If a clipping region is enabled when border access is enabled, the clipping region is temporarily inactivated.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   _wborder_off ();
	   ...
	   _wborder_on ();
	   _draw_wborder ();
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc wborder_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc wborder_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc wborder_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc wborder_010/* if unable to create window */
	   wborder_on ();
	   ...
	   wborder_off ();
	   draw_wborder ();
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncwborder_010/* if successful */
	   ... 	 	/* if unable to remove window */
	wborder_020:
	   pop di	 	/* DI = offset of win work buf */
	   rel_free ();
	wborder_030:
	   ...
	}

Source file WBONOFF.ASM ASM equiv WBORDER_ON
See also
_set_wborder, _wborder_off

_win_bufsize


Descrip
Returns the size of the buffer required by a window.

Syntax
#include <window.h>
int _win_bufsize(const sawin far *winspec);

Returns
The required buffer size, in bytes, if the buffer size was successfully determined.

0 if a buffer larger than 64K would be required.

Notes
This function determines the size of the buffer required for the window defined by winspec. The required buffer size is returned in bytes. This size may used to allocate a buffer for the _win_create function. 0 is returned if the required buffer size would exceed 64K.

winspec must be a structure of type sawin, which is defined in WINDOW.H as follows:

typedef struct {
int left; /* left margin of window */
int top; /* top row of window */
unsigned char width; /* width of window (in columns) */
unsigned char height;/* height of widow (in rows) */
unsigned char dattr; /* window default attribute */
unsigned char tprows;/* number of top border rows */
unsigned char rtcols;/* number of right border columns */
unsigned char bmrows;/* number of bottom border rows */
unsigned char ltcols;/* number of left border columns */
void * border; /* pointer to the border descriptor */
unsigned char battr; /* border attribute */
char horz; /* shadow horizontal offset */
char vert; /* shadow vertical offset */
unsigned char stype; /* shadow type flags */
void * shadow; /* pointer to shadow descriptor */
unsigned char sattr; /* shadow attribute (the shadowed area's color) */
void * attrtbl; /* pointer to the window attribute table */
unsigned char curstate; /* cursor on/off state */
unsigned int curshape; /* cursor shape */
} sawin;

Symbolic constants are defined in WINDOW.H for use with the window structure. See the technical notes for detailed instructions on defining windows with this structure.

This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   ...
	   _rel_malloc (heapseg, _win_bufsize (&win));
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   ...
	   lea si,win
	   win_bufsize ();    /* AX = buffer size */
	    jc w_bufsize_010/* if buffer would be > 64k */
	   mov es,heapseg
	   rel_malloc ();	/* DI = offset allocated block */
	    jc w_bufsize_010/* if unable to allocate block */
	   ...
	w_bufsize_010:
	   ...
	}

Source file _WBUFSIZ.ASM ASM equiv WIN_BUFSIZE
See also
_win_create

_win_close


Descrip
Closes a window.

Syntax
#include <window.h>
int _win_close(int handle);

Returns
0 if the window was successfully closed.

-1 if handle is invalid.

Notes
This function closes the window associated with handle. This makes the window invisible. The screen is immediately updated to reflect the change if auto update is on. The screen remains unchanged if auto update is off. If the window associated with handle is the top open window and the active window, the new top open window is automatically selected as the active window.

handle must be any valid window level or handle (except STDWIN). If level 0 is used, the top open window is closed. A closed window may be reopened by calling _win_open.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   if (_win_close (handle))
	   {
	      /* Handle the error */
	   }
	   ...
	   if (_win_open (handle))
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc win_close_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc win_close_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc win_close_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc win_close_020/* if unable to create window */
	   win_close ();
	    jc win_close_020/* if an error occurred */
	   ...
	   win_open ();
	    jc win_close_020/* if an error occurred */
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncwin_close_020/* if successful */
	   ... 	 	/* if unable to remove window */
	win_close_020:
	   pop di	 	/* DI = offset of win work buf */
	   rel_free ();
	win_close_030:
	   ...
	}

Source file _WCLOSE.ASM ASM equiv WIN_CLOSE
See also
_win_open, _win_remove

_win_create


Descrip
Creates a window.

Syntax
#include <window.h>
int _win_create(const sawin *winspec, void far *winbuf);

Returns
The handle associated with the new window if the window defined by winspec was successfully created.

-1 if an error occurred.

Notes
This function creates a window which matches the definition in winspec. The window is created in the open state on top of all other windows. The created window is also auto-selected as the active window. The screen is immediately updated to reflect the change if auto update is on. If no window handles are available, -1 is returned and the window is not created. A total of 4095 window handles may be in use at one time.

winbuf is used by the windowing system to maintain the window contents and information. The required size of winbuf is approximately:

2 * (height + width) + 150 bytes

where height and width are the height and width of the window in rows and columns. The exact buffer size should be determined by calling _win_bufsize prior to allocating the buffer.

winspec must be a structure of type sawin, which is defined in WINDOW.H as follows:

typedef struct {
int left; /* left margin of window */
int top; /* top row of window */
unsigned char width; /* width of window (in columns) */
unsigned char height;/* height of widow (in rows) */
unsigned char dattr; /* window default attribute */
unsigned char tprows;/* number of top border rows */
unsigned char rtcols;/* number of right border columns */
unsigned char bmrows;/* number of bottom border rows */
unsigned char ltcols;/* number of left border columns */
void * border; /* pointer to the border descriptor */
unsigned char battr; /* border attribute */
char horz; /* shadow horizontal offset */
char vert; /* shadow vertical offset */
unsigned char stype; /* shadow type flags */
void * shadow; /* pointer to shadow descriptor */
unsigned char sattr; /* shadow attribute (the shadowed area's color) */
void * attrtbl; /* pointer to the window attribute table */
unsigned char curstate; /* cursor on/off state */
unsigned int curshape; /* cursor shape */
} sawin;

Symbolic constants are defined in WINDOW.H for use with the window structure. See the technical notes for detailed instructions on defining windows with this structure.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc w_create_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc w_create_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc w_create_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc w_create_020/* if unable to create window */
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncw_create_020/* if successful */
	   ... 	 	/* if unable to remove window */
	w_create_020:
	   pop di	 	/* DI = offset of win work buf */
	   rel_free ();
	w_create_030:
	   ...
	}

Source file _WCREATE.ASM ASM equiv WIN_CREATE
See also
_win_close, _win_init, _win_move, _win_open, _win_remove

_win_init


Descrip
Initializes the windowing system.

Syntax
#include <window.h>
void _win_init(void far *workbuf);

Returns
None

Notes
This function initializes the windowing system. STDWIN (full screen mode) is selected as the default active window, auto update is enabled, and workbuf is designated as the windowing system work buffer. This function does not affect the screen in any way. workbuf must be at least WWORKBUF_SIZE bytes in size. WWORKBUF_SIZE is a symbolic constant defined in WINDOW.H.

_console_init must be called before using this function.

_win_init only needs to be called once. Whenever this function is called, the windowing system is re-initialized and internal windowing variables are reset.

This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   segaddr heapseg;
	   unsigned int heapsize;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc win_init_010/* if unable to allocate block */
	   win_init ();
	   ...
	win_init_010:
	   ...
	}

Source file _WINIT.ASM ASM equiv WIN_INIT
See also
_console_init

_win_move


Descrip
Moves a window.

Syntax
#include <window.h>
int _win_move(int handle, int relx, int rely);

Returns
0 if the window was successfully moved.

-1 if handle is invalid.

Notes
This function moves the window associated with handle to the position which lies relx columns and rely rows from the current window position. relx and rely are signed values, with positive values denoting right and downward motion and negative values denoting left and upward motion. The move is reflected immediately on the screen if the window is currently open and auto update is on. 0 is returned if the function was successful. -1 is returned if handle is invalid.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   _update_off ();
	   if (_win_move (handle, 1, 1))
	   {
	      /* Handle the error */
	   }
	   _update_on ();
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc win_move_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc win_move_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc win_move_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc win_move_020/* if unable to create window */
	   ...
	   _update_off ();
	   mov ax,1
	   mov dx,ax
	   win_move ();
	    jc win_move_020/* if an error occurred */
	   _update_on ();
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncwin_move_020/* if successful */
	   ... 	 	/* if unable to remove window */
	win_move_020:
	   pop di	 	/* DI = offset of win work buf */
	   rel_free ();
	win_move_030:
	   ...
	}

Source file _WMOVE.ASM ASM equiv WIN_MOVE
See also
_set_wpos

_win_open


Descrip
Opens a window.

Syntax
#include <window.h>
int _win_open(int handle);

Returns
0 if the window was successfully opened.

-1 if handle is invalid.

Notes
This function opens the window associated with handle. This makes the window visible. The screen is immediately updated to reflect the change if auto update is on. The screen remains unchanged if auto update is off. If the window associated with handle is the new top open window, and if the previous top open window was also the active window, the new top open window is automatically selected as the active window. 0 is returned if the function was successful. -1 is returned if handle is invalid.

A window must be created using _win_create before it may be opened.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   if (_win_close (handle))
	   {
	      /* Handle the error */
	   }
	   ...
	   if (_win_open (handle))
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc win_close_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc win_close_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc win_close_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc win_close_020/* if unable to create window */
	   win_close ();
	    jc win_close_020/* if an error occurred */
	   ...
	   win_open ();
	    jc win_close_020/* if an error occurred */
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncwin_close_020/* if successful */
	   ... 	 	/* if unable to remove window */
	fwin_close_020:
	   pop di	 	/* DI = offset of win work buf */
	   rel_free ();
	win_close_030:
	   ...
	}

Source file _WOPEN.ASM ASM equiv WIN_OPEN
See also
_win_close

_win_remove


Descrip
Removes a window.

Syntax
#include <window.h>
void far *_win_remove(int handle);

Returns
A pointer to the window buffer if the window was successfully removed.

NULL if handle is invalid.

Notes
This function removes the window associated with handle. The window is closed and deleted from the windowing system. If auto update is on, the window is removed from the screen immediately; otherwise, the screen remains unchanged. If the window associated with handle is the top open window and the active window, the new top open window is automatically selected as the active window. If the function was successful, a pointer is returned to the window buffer associated with handle. -1 is returned if handle is invalid.

It is the programmer's responsibility to properly dispose of the window buffer. Typically, the buffer is freed immediately after this function is called to make the buffer memory available for other purposes. The window buffer address is returned to simplify this task.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc w_remove_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc w_remove_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc w_remove_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc w_remove_020/* if unable to create window */
	   ...
	   win_remove ();	/* DI = offset window buffer */
	    jncw_remove_020/* if successful */
	   ... 	 	/* if unable to remove window */
	w_remove_020:
	   pop di	 	/* DI = offset of win work buf */
	   rel_free ();
	w_remove_030:
	   ...
	}

Source file _WREMOVE.ASM ASM equiv WIN_REMOVE
See also
_win_create

_win_resume


Descrip
Resumes windowing.

Syntax
#include <window.h>
void _win_resume(void);

Returns
None

Notes
This function resumes windowing after it has been suspended using the _win_suspend function. This function has no affect if _win_suspend was not previously called. This function does not affect the screen.
WARNING! This function only restores the state of the windowing system. It does not restore the video mode, screen state, or screen contents. It is the programmer's responsibility to restore the video mode to its original state before calling this function. _restore_vstate may be used for this purpose. After this function has been called, the appearance of the screen may be restored by calling _update_screen.

C/C++ Example
	   _win_resume ()

Inline Assembly Example
	#include <inline.h>
	   win_resume ();

Source file WSUSPEND.ASM ASM equiv WIN_RESUME
See also
_update_screen, _win_suspend

_win_select


Descrip
Selects the active window.

Syntax
#include <window.h>
int _win_select(int handle);

Returns
0 if the window associated with handle was successfully selected.

-1 if handle is invalid.

Notes
This function selects the window associated with handle as the active window. The active window is the window to which all console I/O output is directed. The screen is not affected by this function. 0 is returned if the function was successful. -1 is returned if handle is invalid.

Output may be directed to the entire screen by selecting STDWIN as the active window. The STDWIN symbolic constant is defined in WINDOW.H.

_win_init must be called before using this function. This function is for use with the Spontaneous Assembly windowing system.

C/C++ Example
	{
	   void far *buffer;
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize, bufsize;
	   int handle;
	   ...
	   _rel_init (heapseg, heapsize);
	   buffer = _rel_malloc (heapseg, WWORKBUF_SIZE);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   _win_init (buffer);
	   bufsize = _win_bufsize (&win);
	   buffer = _rel_malloc (heapseg, bufsize);
	   if (buffer == NULL)
	   {
	      /* Handle the error */
	   }
	   if ((handle = _win_create (&win, buffer)) == -1)
	   {
	      /* Handle the error */
	   }
	   ...
	   _win_select (STDWIN);
	   ...
	   if (_win_select (handle))
	   {
	      /* Handle the error */
	   }
	   buffer = _win_remove (handle);
	   if (buffer != NULL)
	   _rel_free (buffer);
	}

Inline Assembly Example
	#include <inline.h>
	{
	   sawin win = WIN_DEFAULT;
	   segaddr heapseg;
	   unsigned int heapsize;
	   int size = WWORKBUF_SIZE;
	   ...
	   mov es,heapseg
	   mov ax,heapsize
	   rel_init ();
	   mov ax,size
	   rel_malloc ();	/* DI = offset allocated block */
	    jc w_select_030/* if unable to allocate block */
	   pushdi
	   win_init ();
	   lea si,win
	   win_bufsize ();    /* AX = size required buffer */
	    jc w_select_020/* if buffer would be > 64k */
	   rel_malloc ();	/* DI = offset allocated block */
	    jc w_select_020/* if unable to allocate block */
	   win_create ();	/* BX = window handle */
	    jc w_select_020/* if unable to create window */
	   win_close ();
	    jc w_select_020/* if an error occurred */
	   ...
	   win_open ();
	    jc w_select_020/* if an error occurred */
	   ...
	   mov ax,bx
	   mov bx,STDWIN
	   win_select ();
	    jc w_select_020/* if an error occurred */
	   ...
	   mov bx,ax
	   win_select ();
	    jc w_select_020/* if an error occurred */
	   win_remove ();	/* DI = offset window buffer */
	    jncw_select_020/* if successful */
	   ... 	 	/* if unable to remove window */
	w_select_020:
	   pop di	 	/* DI = offset win workbuf */
	   rel_free ();
	w_select_030:
	   ...
	}

Source file _WSLCT.ASM ASM equiv WIN_SELECT
See also
_win_create

_win_suspend


Descrip
Temporarily suspends windowing.

Syntax
#include <window.h>
void _win_suspend(void);

Returns
None

Notes
This function temporarily suspends windowing. It should be called any time the state of the windowing system needs to be preserved before changing video modes or performing any operation which re-initializes the console I/O system. Windowing may be resumed by calling the _win_resume function.

This function does not affect the screen.

WARNING! This function only preserves the state of the windowing system. It does not save the state of the video system. It is the programmer's responsibility to save this information and to restore it prior to calling _win_resume. _save_vstate or _save_screen may be used for this purpose.

WARNING! After calling this function, the windowing functions should not be used until _win_resume has been called. Failure to adhere to this rule will produce undefined results.

C/C++ Example
	   ...
	   _win_suspend();/* suspend windowing */
	   ...

Inline Assembly Example
	#include <inline.h>
	   ...
	   win_suspend();/* suspend windowing */
	   ...

Source file WSUSPEND.ASM ASM equiv WIN_SUSPEND
See also
_save_screen, _save_vstate, _win_resume