SP Screen Functions

 SS_SLICE()     Restores screen in a slicing fashion. Alternative to
                restscreen()
 SS_SLIDELEFT() Restores screen in a slide left fashion. Alternative
                to restscreen()
 SS_SLIDERIGHT()Restores screen in a slide right fashion. Alternative
                to restscreen()
 SS_IMPLODE()   Restores screen in an imploding fashion. Alternative
                to restscreen()
 SS_RISE()      Restores screen in a rise from bottom fashion.
                Alternative to restscreen()
 SS_HBLINDS()   Restores screen in a horizontal blind fashion.
                Alternative to restscreen()
 STANDARD()     Returns color integer for standard setting
 SS_WIPEV()     Restores screen in a wipe from top fashion.
                Alternative to restscreen()
 SS_SPLIT()     Restores screen in a split from middle fashion.
                Alternative to restscreen()
 SS_VBLINDS()   Restores screen in a vertical blind fashion.
                Alternative to restscreen()
 SS_WIPEH()     Restores screen in a wipe from left fashion.
                Alternative to restscreen()
 COLPIK()       Allows selection of colors from a list
 ENHANCED()     Returns color integer for ENHANCED setting
 BXX()          Draws a box on the screen of a given color
 ATT()          Colors a section of the screen, leaving the text intact
 PRNT()         Writes a string of a given color at row, column
 CLS()          Clear the screen with optional color,character
 UNSELECTED()   Returns color integer for UNSELECTED setting
 SS_FOLD()      Restores screen in a fold to middle fashion.
                Alternative to restscreen()
 SS_FADE()      Restores screen in a fadeaway fashion. Alternative to
                restscreen()
 SS_CLOSEV()    Restores screen in a vertical close fashion.
                Alternative to restscreen()
 SS_FALL()      Restores screen in a fall from top fashion.
                Alternative to restscreen()
 XBXX()         Draws an exploding box on the screen of a given color
 FADEAWAY()     Fades screen away , alternative to restscreen()
 SS_CLOSEH()    Restores screen in a horizontal close fashion.
                Alternative to restscreen()

 

SP_MAKEBOX

MAKEBOX()

  Short:
  ------
  MAKEBOX() Draws a box on the screen and returns saved screen

  Returns:
  --------
  <cScreen> => string containing underlying screen &
  colors

  Syntax:
  -------
  MAKEBOX(nTop,nLeft,nbottom,nRight,[cColor],[nShadowPos])

  Description:
  ------------
  Draws a box at screen coordinates <nTop..nRight> and
  returns a string containing the underlying screen and previous color.
  Box will explode or not based on the setting of SLS_XPLODE().

  Default color is setcolor(). Default shadow position
  is the setting in SLS_SHADPOS(). These may be passed as
  options . Shadow position [nShadowPos] has allowable values of
  (1,3,7,9,0) to match the corner positions on the numeric keypad.
  0 is no shadow. [cColor] is a valid color string or variable.

  Examples:
  ---------

   cBox := MAKEBOX(5,5,10,10)
   //draws a box at 5,5,10,10. Color is SETCOLOR().
   //shadow position is based on SLS_SHADPOS().

   cBox: = MAKEBOX(5,5,10,10,SLS_POPCOL())
   //draws a box at 5,5,10,10. Color is SLS_POPCOL().
   //shadow position is based on SLS_SHADPOS().

   cBox: = MAKEBOX(5,5,10,10,SLS_POPCOL(),9)
   //draws a box at 5,5,10,10. Color is SLS_POPCOL().
   //shadow position is 9 (upper right hand corner)

  Warnings:
  ----------
  Use only UNBOX() to remove screens stored with
  MAKEBOX().

  Notes:
  -------
  UNBOX() removes the box and restores the underlying
  screen and prior colors.

  The shadow will not be drawn if it would go off the
  edge of the screen.

  Source:
  -------
  S_MAKEB.PRG

 

SP_LISTER

LISTER()

  Short:
  ------
  LISTER() Build, format,print SIMPLE lists to
  printer,screen,file

  Returns:
  --------
  Nothing

  Syntax:
  -------
  LISTER([aNames,aDesc])

  Description:
  ------------
  A menu driven utility for creation, printing and
  storage of list definitions.

  The user is asked to pick the fields to be included
  on the list. The selected fields, in the order in which
  they will be listed, are shown in the bottom information box.
  The user may select which records are to be included in the list -
  all records, query matches or tagged records.

  The user may select output as PRINTER, SCREEN or
  FILE, and choose the maximum line length to avoid printer
  wraparound.

  The user may save list definitions to PLIST.DBF and
  later restore them.

  Two arrays may be passed - fieldnames [aNames], and
  field descriptions [aDesc] Pass both or none. Normally, field
  names are used as the column headings for the list, but if
  [aDesc] is passed, these descriptions are used in the column
  headings of corresponding fields.

  By default, all fields are used, field names are used
  for descriptions.

  Examples:
  ---------
   USE CUSTOMER

   LISTER()

  Source:
  -------
  S_LIST.PRG

 


 

SP_FADEAWAY

FADEAWAY()

  Short:
  ------
  FADEAWAY() Fades screen away , alternative to restscreen()

  Returns:
  --------
  Nothing

  Syntax:
  -------
  FADEAWAY(cInScreen,nTop,nLeft,nBottom,nRight)

  Description:
  ------------
  Fades <cInscreen>, a screen stored with SAVESCREEN(),
  back onto the screen at <nTop>,<nLeft>,<nBottom>,<nRight>. Here
  for compatibility. See SS_FADE().

  Examples:
  ---------
   See SS_FADE()

  Source:
  -------
  S_SCREEN.PRG

 

Send to file

Write data to a file

Sending lines to a file is quite easy :

In addition of SET PRINTER on | OFF | <xlToggle> command, SET PRINTER, (like many other SET commands,) has a second form distinguished by TO keyword:

SET PRINTER TO [<xcDevice> | <xcFile> [ADDITIVE]]

The on|OFF form of SET PRINTER controls whether the output of console commands is echoed to the printer.

TO <xcDevice> identifies the name of the device where all subsequent printed output will be sent.

TO <xcFile> identifies the name of the output file. ( If a file extension is not specified, (.prn) is assumed.)

By using that last method we can send our lines to a file, instead of sending directly to printer:

 SET PRINTER TO Prnfile.txt
 SET DEVICE TO PRINTER
 SET PRINTER ON
 //
 @ 0, 0 SAY "This goes to Prnfile.txt"
 ? "So will this!"
 //
 SET DEVICE TO SCREEN
 SET PRINTER OFF
 SET PRINTER TO // Close the print file

Note that, though our target is not printer, we have use a SETting printer ON.

We have another method for sending someting to a file may be SET ALTERNATE command:

 SET ALTERNATE TO [<xcFile> [ADDITIVE]]
 SET ALTERNATE on | OFF | <xlToggle>

SET ALTERNATE is a console command that lets you write the output of console commands to a text file. Commands such as LIST, REPORT FORM, LABEL FORM, and ? that display to the screen without reference to row and column position are console commands. Most of these commands have a TO FILE clause that performs the same function as SET ALTERNATE. Full-screen commands such as @…SAY cannot be echoed to a disk file using SET ALTERNATE. Instead you can use SET PRINTER TO <xcFile> with SET DEVICE TO PRINTER to accomplish this.

SET ALTERNATE has two basic forms. The TO <xcFile> form creates a DOS text file with a default extension of (.txt) and overwrites any other file with the same name. Alternate files are not related to work areas with only one file open at a time. To close an alternate file, use CLOSE ALTERNATE, CLOSE ALL, or SET ALTERNATE TO with no argument.

The on|OFF form controls the writing of console output to the current alternate file. SET ALTERNATE ON begins the echoing of output to the alternate file. SET ALTERNATE OFF suppresses output to the alternate file but does not close it.

Examples :

This example creates an alternate file and writes the results of the ? command to the file for each record in the Customer database file:

 SET ALTERNATE TO Listfile
 SET ALTERNATE ON
 USE Customer NEW
 DO WHILE !EOF()
 ? Customer->Lastname, Customer->City
 SKIP
 ENDDO
 SET ALTERNATE OFF
 CLOSE ALTERNATE
 CLOSE Customer

A single difficulty may be making choose the best between possible methods

You can download a working example prg with a sample .dbf from here :

C5DG-9 Terminal Drivers

Clipper 5.x – Drivers Guide

Chapter 9

Alternate Terminal Drivers

Clipper supports a driver architecture that allows Clipper- compiled applications to use alternate terminal drivers. This architecture provides support for nonstandard video hardware and ANSI output devices, allowing your applications to run in a wider variety of environments.

The following terminal drivers are supplied as part of the Clipper Development System and are discussed in this chapter:

. The ANSITERM driver provides ANSI terminal support for systems that require it

. The NOVTERM driver causes Clipper applications to execute faster when run on some nondedicated network server software

. The PCBIOS driver provides direct BIOS calls rather than direct screen writes for systems requiring this form of I/O

In This Chapter

This chapter discusses how Alternate Terminal Drivers fit into the overall Clipper architecture as well as how to install and use each of the supplied terminal drivers. The following major topics are discussed:

. The Alternate Terminal Driver Architecture

. The ANSITERM Alternate Terminal Driver

. The NOVTERM Alternate Terminal Driver

. The PCBIOS Alternate Terminal Driver

The Alternate Terminal Driver Architecture

In Clipper, communication with I/O devices is controlled by a multilayered terminal system. At the lowest level is the terminal driver which controls screen and keyboard activity. It consists of a screen and keyboard driver that communicates directly with the I/O device (operating system or hardware). It is the device specific part of the Clipper terminal system.

There is, then, a higher level system that communicates with terminal drivers. This system is known as the General Terminal (GT) system and provides general services that create Clipper screen and keyboard commands and functions. The following figure demonstrates:

                   +—————————————–+

                   | CA-Clipper screen and keyboard commands |
                   |              and functions              |
                   |-----------------------------------------|
                   |        General Terminal (GT.OBJ)        |
                   ------------------------------------------|
                   |             Terminal Driver             |
                   |-----------------------------------------|
                   |          Screen   |   Keyboard          |
                   +-----------------------------------------+

The default terminal driver, designed for IBM PC and 100% compatibles, is supplied as a library file (TERMINAL.LIB) installed into your \CLIPPER5\LIB directory. This driver links into each program automatically if you specify no alternative terminal driver provided that you do not use the /R option when you compile. An alternate terminal driver is supplied as a separate library (.LIB) file that links into an application program in place of the default terminal driver if you specify it on the link line.

All alternate terminal drivers work through the General Terminal layer as supplied in the file GT.OBJ. The Clipper installation program installs this file in the \CLIPPER5\OBJ subdirectory on the drive that you specify, so you need not install the driver manually.

The ANSITERM Alternate Terminal Driver

The ANSITERM terminal driver supports the ANSI screen mode for all screen display from Clipper programs.

This screen mode is installed by specifying ANSI.SYS in the user’s CONFIG.SYS. ANSI.SYS replaces the default DOS CON device driver for video display and keyboard input. Once installed it supports ANSI escape sequences to erase the screen, set the screen mode, and control the cursor in a hardware-independent way. Most modern DOS programs, however, do not use it and write either directly to the video hardware or use BIOS routines for enhanced screen performance.

Use the ANSI screen mode for Clipper programs that run on hardware that does not support either writing to video hardware or BIOS calls for screen display. This is the case when using alternative display hardware to support the blind.

Note: The ANSITERM terminal driver fully supports all screen and keyboard functionality of the default terminal driver. This includes the ability to save and restore screens and support for all keys on the standard 101-key keyboard.

Installing ANSITERM Terminal Files

The ANSITERM terminal driver is supplied as the file ANSITERM.LIB. The Clipper installation program installs this file in the \CLIPPER5\LIB subdirectory on the drive that you specify, so you need not install it manually.

Linking the ANSITERM Terminal Driver

To link the ANSITERM alternate terminal driver into an application program, you must specify both GT.OBJ and ANSITERM.LIB to the linker along with your application object (.OBJ) modules.

1. To link with .RTLink using positional syntax:

C>RTLINK <appObjectList> GT,,, ANSITERM

2. To link with .RTLink using freeformat syntax:

C>RTLINK FI <appObjectList>, GT LIB ANSITERM

3. To link with .RTLink using ANSITERM.PLL and freeformat syntax:

C>RTLINK FI <appObjectList> /PLL:ANSITERM

Note: These link commands assume you have set the LIB, OBJ, and PLL environment variables to the standard locations. They also assume that the Clipper programs were compiled without the /R option.

Important! You cannot link the ANSITERM driver with BASE52.PLL. An application linked with both ANSITERM.LIB and BASE52.PLL may cause the computer to freeze upon execution.

The Runtime Environment

Using ANSITERM.LIB requires that ANSI.SYS be installed on the user’s computer. To accomplish this, include the following statement in the user’s CONFIG.SYS:

DEVICE=ANSI.SYS

Performance Concerns

Because the ANSITERM terminal driver uses buffered screen writes for all screen painting, some operations, especially those that scroll the screen, are slow. These include:

1. All box drawing commands and functions

2. All console commands and functions when scrolling

3. All clear screen commands and functions

4. All restore screen commands and functions

5. Standard out functions (OUTSTD() and OUTERR()) whether the screen is scrolling or not

Note: Overall performance of Clipper programs is slower since the ANSITERM terminal driver must spend more time polling for user events than the standard Clipper terminal driver.

Screen Output from C and Assembly Language

The ANSITERM terminal driver overwrites all output from C and Assembly Language when it refreshes the screen from the screen buffer. As a consequence, you should perform all screen output from Clipper.

The ANSITERM terminal driver also virtualizes the cursor. This means that BIOS functions that report the location of the hardware cursor will not always return the correct value. To obtain the cursor position, use Clipper’s ROW() and COL() functions instead.

Other Incompatibilities

1. ISCOLOR() always returns false (.F.).

2. When you load DBU, the default color mode is monochrome unless you specify DBU with the /C command line option.

3. The first time you invoke the Debugger, the default color mode is also monochrome unless you set the Options:Mono display off.

4. When an application linked with the ANSITERM terminal driver terminates, the last color set in the application becomes the DOS color. This happens since colors set with ANSITERM are global to DOS and Clipper cannot query DOS for the current screen colors as the application loads.

5. Nondisplaying ASCII characters are presented as a space by the ANSITERM terminal driver. These include BELL (CHR(7)), BS (CHR(8)), TAB (CHR(9)), LF (CHR(10)), CR (CHR(13)), and ESC (CHR(27)).

The NOVTERM Alternate Terminal Driver

The NOVTERM terminal driver is a special-purpose driver that circumvents an incompatibility between some nondedicated network server software and Clipper. This incompatibility causes printers connected to the server to slow to an unusable rate.

Clipper applications and nondedicated servers compete for resources. Clipper applications make use of the time between keystrokes to perform various system tasks. This greatly improves the application’s overall performance by limiting its idle time. Certain nondedicated servers only attempt to print within an application’s idle time. Since a Clipper application is seldom idle, this greatly slows printing.

Important! The NOVTERM terminal driver corrects the incompatibility by preventing the Clipper application from using idle time. Because this can severely hamper performance, you should only use the NOVTERM terminal driver when necessary, and then you should link it only into those applications that are physically running the nondedicated server.

Note: The NOVTERM terminal driver fully supports all screen and keyboard functionality of the default terminal driver. This includes the ability to save and restore screens and support for all keys on the standard 101-key keyboard.

Installing NOVTERM Terminal Files

The NOVTERM terminal driver is supplied as the file NOVTERM.LIB. The Clipper installation program installs the driver file in the \CLIPPER5\LIB subdirectory on the drive that you specify, so you need not install it manually.

Linking the NOVTERM Terminal Driver

To link the NOVTERM alternate terminal driver into an application, you must specify both GT.OBJ and NOVTERM.LIB to the linker with your application object (.OBJ) modules.

1. To link with .RTLink using positional syntax:

C>RTLINK <appObjectList> GT,,, NOVTERM

2. To link with .RTLink using freeformat syntax:

C>RTLINK FI <appObjectList>, GT LIB NOVTERM

3. To link with .RTLink using NOVTERM.PLL and freeformat syntax:

C>RTLINK FI <appObjectList> /PLL:NOVTERM

Note: These link commands assume you have set the LIB, OBJ, and PLL environment variables to the standard locations. They also assume that the Clipper programs were compiled without the /R option.

Important! You cannot link the NOVTERM driver with BASE52.PLL. An application linked with both NOVTERM.LIB and BASE52.PLL may cause the computer to freeze upon execution.

Performance Concerns

Overall performance of Clipper programs is slower since the NOVTERM terminal driver must spend more time polling for user events than the standard Clipper terminal driver and since the program will not use its idle time for other tasks.

Screen Output from C and Assembly Language

The NOVTERM terminal driver overwrites all output from C and Assembly Language when it refreshes the screen from the screen buffer. Therefore, you should perform all screen output from Clipper.

The NOVTERM terminal driver also virtualizes the cursor. This means that BIOS functions that report the location of the hardware cursor will not always return the correct value. To obtain the cursor position, use Clipper’s ROW() and COL() functions.

The PCBIOS Alternate Terminal Driver

The PCBIOS terminal driver uses BIOS calls instead of direct screen writes. It is designedd for applications that trap BIOS calls to redirect output over telecommunication lines or to convert output to a form compatible with two-byte character sets.

Note: The PCBIOS terminal driver fully supports all screen and keyboard functionality of the default terminal driver. This includes the ability to save and restore screens and support for all keys on the standard 101-key keyboard.

Installing PCBIOS Terminal Files

The PCBIOS terminal driver is supplied as the file, PCBIOS.LIB. The Clipper installation program installs the driver file in the \CLIPPER5\LIB subdirectory on the drive that you specify, so you need not install it manually.

Linking the PCBIOS Terminal Driver

To link the PCBIOS alternate terminal driver into an application program, you must specify both GT.OBJ and PCBIOS.LIB to the linker in addition to your application object (.OBJ) modules.

1. To link with .RTLink using positional syntax:

   C>RTLINK <appObjectList> GT,,, PCBIOS;

2. To link with .RTLink using freeformat syntax:

   C>RTLINK FI <appObjectList>, GT LIB PCBIOS

3. To link with .RTLink using PCBIOS.PLL and freeformat syntax:

   C>RTLINK FI <appObjectList> /PLL:PCBIOS

Note: These link commands assume you have set the LIB, OBJ, and PLL environment variables to the standard locations. They also assume that the Clipper programs were compiled without the /R option.

Important! You cannot link the PCBIOS driver with BASE52.PLL. An application linked with both PCBIOS.LIB and BASE52.PLL may cause the user’s computer to freeze when the user executes it.

Performance Concerns

Because the PCBIOS terminal driver uses buffered screen writes for all screen painting, some operations, especially those that scroll the screen, are slow. These include:

1. All box drawing commands and functions

2. All console commands and functions when scrolling

3. All clear screen commands and functions

4. All restore screen commands and functions

5. Standard out functions (OUTSTD() and OUTERR()) whether the screen is scrolling or not

Screen Output from C and Assembly Language

The PCBIOS terminal driver also overwrites all output from C and Assembly Language when it refreshes the screen from the screen buffer. Therefore, you should perform all screen output from Clipper.

The PCBIOS terminal driver also virtualizes the cursor. This means that BIOS functions that report the location of the hardware cursor do not always return the correct value. To obtain the cursor position, use Clipper’s ROW() and COL() functions.

Summary

This chapter has introduced you to the Alternate Terminal Driver concept, giving you specific information on the architecture used to implement them in Clipper. Each of the alternate terminal drivers supplied with Clipper was discussed, including how to link and use it into your application and the implications of doing so.