home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
-
-
-
-
-
- DVAWARE TC++ Library
-
- Release 1.0
-
- August, 1990
-
-
-
-
-
-
-
-
-
-
-
-
-
- _______________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
- Copyright 1990
-
- Mark Potter
-
- Purpose: A library to be used in TC++ v1.0 in order to
- write C or C++ programs which are DESQview
- aware. This library includes the ability of
- making the TC conio routines DESQview screen
- aware.
-
- File List: BUILDALL BAT 123 Used to (re)build all the
- library files.
- BUILDLIB BAT 1203 Used to (re)build one of the
- library files based on a
- given memory model letter.
- DVAWARE DOC 20363 This Documentation file.
- DVAWARE H 6450 Header file for DVAWARE
- Library.
- DVAWAREC LIB 2560 DVAWARE Libraries. Each for
- DVAWAREH LIB 2560 one of the six different
- DVAWAREL LIB 2560 memory model.
- DVAWAREM LIB 2560
- DVAWARES LIB 2560
- DVAWARET LIB 2560
- DVA_TEST C 8093 A sample program in C.
- DVA_TEST CPP 7981 A sample program in C++.
- DVCONIO C 1949 Source files for the DVAWARE
- DVCRIT C 3139 Libraries.
- DVGETVER C 1861
- DVGETVID C 3470
- DVPAUSE C 1412
- INDV C 1342
-
- Description: Routines found in the DVAWARE library are found
- on the following pages. To use the libraries
- one should only have to include the DVAWARE.H
- file in your program, and the appropriate
- DVAWAREx.LIB file in the project or make file.
- One can then call the DVAWARE routines freely.
-
- Note: The inDV variable is set by dv_get_version() and
- only by dv_get_version(). Therefore if you
- wish to use the inDV variable in your program,
- make sure you call dv_get_version() near the
- beginning of the program.
-
- Inline: If you are using the DVAWARE library in a C++
- program you may opt to have the DVAWARE routines
- inline. One might have the routines inline for
- possible speed and size advantages, depending on
- how the DVAWARE routines are call.
-
- To make the DVAWARE routine inline, simply
- define the macro DVAWARE_INLINE before you
- include the DVAWARE.H file.
- #define DVAWARE_INLINE
- #include "DVAWARE.H"
- This will make all the function in DVAWARE
- inline. This will also make the need for the
- DVAWAREx.LIB file unnecessary in the project
- file, except for the possible need of the inDV
- variable. This can be overcome by including the
- library anyway, or by defining the inDV variable
- in one of your own modules. One will need the
- inDV variable if the dv_get_version() function
- is called.
-
- dv_beginc
- ________________________________________________________________
-
- Function: Begin critical Region.
-
- Syntax: #include "dvaware.h"
- void dv_beginc( void );
-
- Prototype in: dvaware.h
-
- Remarks: The dv_beginc() call causes the current task to
- enter a critical region during which all
- multitasking is suspended. The calling task is
- allowed to continue execution until it calls
- dv_endc() or voluntarily gives up control. If
- it voluntarily gives up control (by waiting for
- keyboard input for instance) multitasking is
- allowed to resume until the task regains
- control, at which time multitasking is again
- suspended. This facility can be useful for
- executing time critical sections of code and for
- controlling access to common resources. It
- should be used sparingly to avoid degrading
- overall system performance.
-
- If another task is using DOS when the
- dv_beginc() call is made, the caller will be
- suspended until DOS is free. This means that you
- are free to call DOS from inside a critical
- region. (From Quarterdeck's DESQview API
- manual)
-
- Return value: None.
-
- Portability: dv_beginc is unique to the dvaware or similar
- libraries.
-
- See also: dv_endc, dv_pause
-
- Example: #include <conio.h>
- #include "dvaware.h"
-
- int main( void )
- {
- long i=0;
- dv_conio();
- dv_beginc();
- while( !kbhit() )
- i++;
- getch();
- dv_endc();
- cprintf( "%ul\r\n", i );
- return 0;
- }
-
-
-
- dv_conio
- ________________________________________________________________
-
- Function: Sets up the TC conio system to be DESQview
- screen aware.
-
- Syntax: #include "dvaware.h"
- void dv_conio( void );
-
- Prototype in: dvaware.h
-
- Remarks: It has been noted that during the TC++ start up
- code a program identifies the screen type of
- screen it is running on, and places the segment
- address of the screen display in the word
- directly before the directvideo. Therefore,
- using this as the input to dv_get_video_buffer()
- and placing the return value in the same
- location this should make all the later conio
- calls use the DESQview video buffer. This
- function should be called as close to the begin
- of the program's executions as possible. It
- will no longer be required to set directvideo to
- 0 for the program to be DESQview screen nice.
-
- Return value: None.
-
- Portability: dv_conio is unique to the dvaware or similar
- libraries.
-
- See also: dv_get_video_buffer
-
- Example: #include <conio.h>
- #include "dvaware.h"
- int main( void )
- {
- dv_conio();
- cputs( "Hello World\r\n" );
- return 0;
- }
-
- dv_endc
- ________________________________________________________________
-
- Function: End critical region.
-
- Syntax: #include "dvaware.h"
- void dv_endc( void );
-
- Prototype in: dvaware.h
-
- Remarks: The dv_endc() call defines the end of a critical
- region of code. Critical regions are entered
- via the dv_beginc() call. Calls to dv_beginc()
- and dv_endc() may be nested. Multitasking does
- not resume until an dv_endc() call has been
- executed for every dv_beginc() call that has been
- made. (From Quarterdeck's DESQview API manual)
-
- Return value: None.
-
- Portability: dv_endc is unique to the dvaware or similar
- libraries.
-
- See also: dv_beginc, dv_pause.
-
- Example: #include <conio.h>
- #include <stdlib.h>
-
- #include "dvaware.h"
-
- int main( void )
- {
- long i=0;
- dv_conio();
- dv_beginc();
- while( !kbhit() )
- i++;
- getch();
- dv_endc();
- cprintf( "%ul\r\n", i );
- return 0;
- }
-
-
- dv_get_version
- ________________________________________________________________
-
- Function: Get the version of DESQview that is running.
-
- Syntax: #include "dvaware.h"
- unsigned int dv_get_version( void );
-
- Prototype in: dvaware.h
-
- Remarks: dv_get_version() can be used to test for the
- existence of DESQview such as in:
- if ( dv_get_version() )
- ...
-
- dv_get_version() also sets the inDV flag, so
- that the version of DESQview running can be
- tested at a latter time.
-
- Return value: Returns the version of DESQview running, or 0 if
- DESQview is not running. The value returned is
- encoded as follows: The high byte of the return
- value is the major version number; The low byte
- is the minor.
-
- Portability: dv_get_version is unique to the dvaware or
- similar libraries.
-
- See also: inDV
-
- Example: #include <conio.h>
- #include "dvaware.h"
- int main( void )
- {
- unsigned int ver = dv_get_version();
- dv_conio();
- if ( ver )
- cprintf( "The version of DESQview running"
- " is %u.%02u.\r\n",
- ver >> 8, ver & 0xFF );
- else
- cprintf( "DESQview is not running.\r\n" );
- }
-
-
- dv_get_video_buffer
- ________________________________________________________________
-
- Function: Get the video buffer segment.
-
- Syntax: #include "dvaware.h"
- char _seg* dv_get_video_buffer(
- char _seg* assumed );
-
- Prototype in: dvaware.h
-
- Remarks: Return the address of the Logic Window buffer
- for the current task and begins "shadowing"
- changes to the buffer. Programs that have been
- written to place text directly into the display
- memory can be easily converted to run in a small
- window by making this call and writing into the
- Logical Window Buffer instead. DESQview checks
- periodically to see if the contents of the
- buffer have changed and, if so, updates the
- display accordingly. The assumed value on entry
- should contain the address of display memory
- that the program would write into if running
- outside DESQview. If this routine is called
- outside DESQview it does nothing but return with
- the assumed value. You can, therefore, make this
- call and trust the results either inside of
- outside DESQview.
-
- There is no need to synchronize with video
- retrace when writing into the Logical Window
- Buffer. (From Quarterdeck's DESQview API
- manual)
-
- Return value: Segment of the video display buffer.
-
- Portability: dv_get_video_buffer is unique to the dvaware or
- similar libraries.
-
- See also: dv_conio()
-
- Example: #include "dvaware.h"
- int main( void )
- {
- char *msg = "This is a test";
- char _seg* video = (char _seg*)0xB800;
- // B000 for mono
- unsigned offset = 0;
- video = dv_get_video_buffer( video );
- while ( *msg ) {
- *(video+offset) = *msg;
- offset+=2;
- msg++;
- }
- return 0;
- }
-
-
- dv_pause
- ________________________________________________________________
-
- Function: Give up the rest of time slice.
-
- Syntax: #include "dvaware.h"
- void dv_pause( void );
-
- Prototype in: dvaware.h
-
- Remarks: The dv_pause call gives up control to the
- dispatcher so that other tasks can be run. The
- calling task will regain control when its normal
- turn occurs. Applications should make this call
- within all busy-wait loops, that is, loops that
- are doing nothing useful but looking for
- something to do. (From Quarterdeck's DESQview
- API manual)
-
- Return value: None.
-
- Portability: dv_pause is unique to the dvaware or similar
- libraries.
-
- See also: dv_beginc, dv_endc
-
- Example: #include <conio.h>
- #include "dvaware.h"
- int main( void )
- {
- dv_conio();
- cputs( "Press a key to continue..." );
- while (!kbhit())
- dv_pause();
- getch();
- return 0;
- }
-
-
- inDV
- ________________________________________________________________
-
- Function: Holds the version of DESQview running, or 0 if
- not in DESQview.
-
- Syntax: extern unsigned int inDV;
-
- Declared in: dvaware.h
-
- Remarks: Set to 0 if DESQview is not running. Set to the
- version of the DV API active if DESQview is
- running. The high byte of inDV is the major
- version number, the low byte is the minor. The
- value of inDV is set by the dv_get_version
- function.
-
- Example: #include <conio.h>
- #include <stdlib.h>
-
- #include "dvaware.h"
-
- int main( void )
- {
- long i=0;
- dv_get_version();
- dv_conio();
- if (inDV) dv_beginc();
- while( !kbhit() )
- i++;
- getch();
- if (inDV) dv_endc();
- cprintf( "%ul\r\n", i );
- return 0;
- }
-
-
- Restrictions: Copyright 1987, Mark Potter. All rights
- reserved by the author, except for those
- specifically granted as follows.
-
- The author grants the right to copy and
- distribute this package providing no fee
- greater than $5.00 US (or equivalent) is
- charged for this package.
-
- This package may be placed on public or private
- computer systems for distribution, providing
- that the $5.00 fee is not exceeded and that no
- extra copyright is proclaimed on this work.
-
- Any other distribution of this package requires
- permission from the author.
-
- Programmers may use this library with there own
- code without any worry of royalty requirements.
- See shareware notice below.
-
- Users of this package may freely modify the
- program for personal use. Such modified
- libraries may be distributed to close associates
- but not to the general public. Such
- distributions must include the complete
- original package.
-
- Shareware: This library is not shareware, nor is it public
- domain, this is a copyrighted package. To call
- it freeware would be correct, it is a
- copyrighted package which I ask no monetary
- return for its use. However freeware is a
- trademarked term, so I can't actually call it
- that. I do ask that if you find this package
- of use, that you drop me a postcard saying so.
- That way I will know my work wasn't for not,
- and thus may come out with other libraries or
- programs. Thank you.
-
- Author: Suggestions and comments about this and other
- programs can be sent to:
- Mark Potter
- 1407 Hillcrest Dr.
- Blacksburg, VA 24060-5523
- Or electronically on the following BBSs:
- MBT (703)552-8767
- VTBBS (703)231-7498
-
- Note that the Author is a presently a MS
- student in CS at Virginia Tech and due to
- finish soon. The electronic mail may have
- delayed response after this date. Physical
- mail should be forwarded for may years to come.
-
-