FT_NWLSTAT

FT_NWLSTAT()
 Return the current Novell NetWare logical station number

 Syntax

      FT_NWLSTAT() -> nStatNum

 Arguments

     None

 Returns

     A numeric corresponding to the current logical station number
     assigned by NetWare.

 Description

     In order to find out information about a particular node logged
     in to a NetWare server, you will need the logical
     station number, also known as a "connection number."  This
     function will return that number.  This will be a number from 1 to 100
     under NetWare 286, or from 1 to 250 under NetWare 386.  This is *not*
     the same as a physical station number.

     This function requires FT_INT86().

     This function does NOT test for the existence of the NetWare shell.
     The behavior is undefined if no shell is loaded.

 Examples

     QOut( "Logical station: " + str( FT_NWLSTAT() ) )

 Source: NWLSTAT.PRG

 Author: Glenn Scott

 

FT DOS/BIOS

 FT_CHDIR()       Change the current directory
 FT_DEFAULT()     Retrieve and optionally change the current default drive
 FT_DOSVER()      Return the current DOS major and minor version as a string
 FT_DSKFREE()     Return the amount of available disk space
 FT_DSKSIZE()     Return the maximum capacity of a fixed disk
 FT_FLOPTST()     Test diskette drive status
 FT_HANDCNT()     Count number of available DOS (not network) file handles
 FT_INP()         Retrieve a byte from a specified I/O port
 FT_INT86()       Execute a software interrupt
 FT_ISPRINT()     Check printer status
 FT_ISSHARE()     Determine if DOS "Share" is installed
 FT_MKDIR()       Create a subdirectory
 FT_OUTP()        Write a byte to a specified I/O port
 FT_PEEK()        Retrieve a byte from a specified memory location.
 FT_POKE()        Write a byte to a specified memory location
 FT_REBOOT()      Force a warm or cold boot
 FT_RMDIR()       Delete a subdirectory
 FT_SETDATE()     Set the DOS system date
 FT_SETTIME()     Set the DOS system time
 FT_SYSMEM()      Determine the amount of conventional memory installed
 FT_TEMPFIL()     Create a file with a unique name

FT_TEMPFIL

FT_TEMPFIL()
 Create a file with a unique name

 Syntax

      FT_TEMPFIL( [ <cPath> ] [, <lHide> ] ) -> cFileSpec

 Arguments

     <cPath> is the directory where you want to create the temporary
     file.  If you omit this argument, the root of the current drive
     is assumed ("\").

     If <lHide> is .T., then the file will be created with the hidden
     attribute set.  The default is .F.

 Returns

     <cFileSpec> should be your path, including the name of the newly
     created unique file.  Use this with FOPEN(), etc.

     If a DOS error occurred when trying to create the file, a
     null string will be returned.

 Description

     This function uses DOS Interrupt 21, service 5Ah (Create temporary
     file) to create a unique filename in a directory you specify.
     There will be no extension.  After the file is created, you may
     then fopen() it and do any i/o you need (see the test driver
     in the source code).

     This function requires FT_INT86().

 Examples

     Create a unique file in the root of the current drive:

            myFile := FT_TEMPFIL()

     Create a unique file in the current directory and hide it:

            myFile := FT_TEMPFIL(".\", .t.)

     Create a unique file on another drive, but do not hide it:

            myFile := FT_TEMPFIL("e:\nanfor\src\")

 Source: TEMPFILE.PRG

 Author: Glenn Scott

 

FT_SETTIME

FT_SETTIME()
 Set the DOS system time
------------------------------------------------------------------------------

 Syntax

      FT_SETTIME( <cTime> ) -> <lResult>

 Arguments

     <cTime> is a string in the form <hh:mm:ss> that you want to set
     the current DOS system time to.

     Use 24-hour time.  It is up to you to send in a valid time.  If
     DOS doesn't think it is valid, it won't reset the time anyway.

 Returns

     <lResult> is simply the result of FT_INT86(), passed back
     to your program.

 Description

     FT_SETTIME() uses NANFOR.LIB's FT_INT86() function to invoke
     the DOS Set Time service (Interrupt 33, service 45).

 Examples

  The following program takes a time string from the command line and sets
  the DOS system time:

   FUNCTION main( cTime )

      cTime := iif( cTime == nil, time(), cTime )
      QOut( "Setting time to: " + cTime  + "... " )
      FT_SETTIME( cTime )
      Qout( "Time is now: " + time() )

   RETURN ( nil )

 Source: SETTIME.PRG

 Author: Glenn Scott

 

FT_SETDATE

FT_SETDATE()
 Set the DOS system date

 Syntax

      FT_SETDATE( <dDate> ) -> <lResult>

 Arguments

     <dDate> is a Clipper date variable that you want to set the current
     DOS system date to.

     It is up to you to send in a valid date.  The
     year must be within the range 1980 through 2099.  If DOS
     thinks the date is not valid, it won't change the date.

 Returns

     <lResult> is simply the result of FT_INT86(), passed back
     to your program.

 Description

     FT_SETDATE() uses NANFOR.LIB's FT_INT86() function to invoke
     the DOS Set Date service (Interrupt 33, service 43).

 Examples

  The following program takes a date from the command line and sets
  the DOS system date:

   FUNCTION main( cDate )

      cDate := iif( cDate == nil, dtoc( date() ), cDate )
      QOut( "Setting date to: " + cDate  + "... " )
      FT_SETDATE( ctod( cDate ) )
      Qout( "Today is now: " + dtoc( date() ) )

   RETURN ( nil )

 Source: SETDATE.PRG

 Author: Glenn Scott

 

FT_INT86

FT_INT86()
 Execute a software interrupt
------------------------------------------------------------------------------

 Syntax

       FT_INT86( <nInterruptNumber>, <aRegisterValues> ) -> lResult

 Arguments

      <nInterruptNumber> is the interrupt to execute.

      <aRegisterValues> is an array that contains values to be loaded
      into the various CPU registers.  The correspondence between
      registers and array elements is as follows:

               aElement[1]  ==  AX register
               aElement[2]  ==  BX register
               aElement[3]  ==  CX register
               aElement[4]  ==  DX register
               aElement[5]  ==  SI register
               aElement[6]  ==  DI register
               aElement[7]  ==  BP register
               aElement[8]  ==  DS register
               aElement[9]  ==  ES register
               aElement[10] ==  Flags register

 Returns

      .T. if all parameters valid and the function was able
          to execute the desired interrupt.
      .F. if invalid parameters passed.

     In addition, the array elements will contain whatever values were in
     the CPU registers immediately after the interrupt was executed.  If
     either of the string parameters were altered by the interrupt, these
     changes will be reflected as well.

 Description

     It is occasionally useful to be able to call interrupts directly from
     Clipper, without having to write a separate routine in C or ASM.  This
     function allows you that capability.

     Given Clipper's high-level orientation, this function is necessarily
     somewhat messy to use.  First, declare an array of ten elements to
     hold the eight values for the CPU registers and two string parameters.
     Then initialize the array elements with the values that you want the
     CPU registers to contain when the interrupt is executed.  You need not
     initialize all the elements.  For example, if the interrupt requires
     you to specify values for AX, DX, and DS, you would only need to
     initialize elements 1, 4, and 8.

     Once you have done the required register setup, call FT_INT86(),
     passing the interrupt number and the register array as parameters.
     The function will load the CPU with your specified values, execute the
     interrupt, and then store the contents of the CPU registers back into
     your array.  This will allow you to evaluate the results of the
     interrupt.

     Some interrupt services require you to pass the address of a string in
     a pair of registers.  This function is capable of handling these sorts
     of situations, but it will take a little work on your part.  If you need
     to pass a string that uses the DS register, store the string in element
     8;  if you need to pass a string that uses the ES register, store the
     string in element 9.  FT_INT86() will detect that you've supplied a
     string instead of a numeric value and will behave accordingly.

     That takes care of obtaining the segment portion of the pointer.  To
     specify which register is to contain the offset, use the values REG_DS
     and REG_ES which are defined in the FTINT86.CH file.  When one of these
     values is found in an array element, it alerts FT_Int86() to use the
     offset portion of a pointer instead of a numeric value.  REG_DS tells
     FT_Int86() to use the offset of the string in element 8, while REG_ES
     tells FT_Int86() to use the offset of the string in element 9.

     All the CPU registers are sixteen bits in size.  Some, however, are
     also split into two 8-bit registers.  This function is only capable of
     receiving and returning registers that are 16 bits in size.  To split
     a 16-bit register into two 8-bit values, you can use the
     pseudo-functions HighByte() and LowByte(), contained in the .CH file.

     To alter an 8-bit number so it will appear in the high-order byte of a
     register when passed to the FT_INT86() function, use the MakeHI()
     pseudo-function contained in the .CH file.

     This function is a shell for __ftint86(), which is written in assembler
     and does the actual work of executing the interrupt.  __ftint86() is
     callable from C, so feel free to incorporate it into any C routines
     for which it might be useful.  The source for __ftint86() can be found
     in the file AINT86.ASM.

 Examples

     * This example shows how to call the DOS "create file" service.  Take
     * special note of how to set up string parameters.

     #include "FTINT86.CH"

     local aRegs[10]              && Declare the register array
     aRegs[ AX ] := makehi(60)    && DOS service, create file
     aRegs[ CX ] := 0             && Specify file attribute

     * Pay attention here, this is crucial.  Note how to set up the string
     * so it appears in DS:DX.

     aRegs[ DS ] := "C:\MISC\MYFILE.XXX"
     aRegs[ DX ] := REG_DS
     FT_INT86( 33, aRegs)         && Make the call to the DOS interrupt

     * This example shows how to call the DOS "get current directory"
     * service.  This one also uses a string parameter, but note that it
     * uses a different offset register.

     #include "FTINT86.CH"

     local aRegs[10]
     aRegs[ AX ] := makehi(71)
     aRegs[ DX ] := 0           // Choose default drive

     * This service requires a 64-byte buffer whose address is in DS:SI.  DOS
     * will fill the buffer with the current directory.

     aRegs[ DS ] := space(64)
     aRegs[ SI ] := REG_DS
     FT_INT86( 33, aRegs)

     ? aRegs[ DS ]       // Display the directory name

     * For the sake of completeness, here's an example that doesn't use a
     * string.  This one changes the video mode.

     #include "FTINT86.CH"

     local aRegs[10]

     aRegs[ AX ] := 16          && Choose hi-res graphics
     FT_INT86( 16, aRegs)

 Header File: FTINT86.CH

 Source: CINT86.C

 Author: Ted Means

FT_DSKSIZE

FT_DSKSIZE()
 Return the maximum capacity of a fixed disk
------------------------------------------------------------------------------

 Syntax

      FT_DSKSIZE( [ <cDrive> ] ) -> nMaxCapacity

 Arguments

     <cDrive> is the fixed disk to query. If no drive is sent, the
     operation will be performed on the default drive. Send without
     the ":".

 Returns

     An integer representing the maximum disk capacity in bytes.

 Description

     Function utilizing FT_INT86() to return Maximum Disk Size.
     Uses FT_INT86() through the internal function _ftDiskInfo().

 Examples

     ? FT_DSKSIZE()      // Maximum capacity for default drive
     ? FT_DSKSIZE( "D" ) // Maximum capacity for Drive D:

 Source: DISKFUNC.PRG

 Author: Robert A. DiFalco

FT_DSKFREE

FT_DSKFREE()
 Return the amount of available disk space

 Syntax

      FT_DSKFREE( [ <cDrive> ] ) -> nSpaceAvail

 Arguments

     <cDrive> is the fixed disk to query. If no parameter is passed
     the operation will be performed on the default drive.  Do not
     include the ":".

 Returns

     Integer representing the available disk space in bytes.

 Description

     Function to return the available space on the passed
     drive letter or the default drive if no drive is passed.

     Uses FT_INT86() through the internal function _ftDiskInfo().

 Examples

     ? FT_DSKFREE()  // Returns free space on default drive.

 Source: DISKFUNC.PRG

 Author: Robert A. DiFalco

 

FT_DOSVER

FT_DOSVER
 Return the current DOS major and minor version as a string
------------------------------------------------------------------------------

 Syntax

      FT_DOSVER() -> <cVersion>

 Arguments

     None

 Returns

     A character string with the major version number first, a
     period ("."), then the minor version number (e.g., "3.30")

 Description

     FT_DOSVER() invokes DOS interrupt 21h, service 30 in order to
     return the current DOS version.  It does this by setting up
     an array corresponding to machine registers and then calling
     the toolkit function FT_INT86().

     It returns a character string corresponding to the DOS
     version, as follows:  The major version, a period ("."), then
     the minor version.

 Examples

      FUNCTION main()
      RETURN QOut( "Dos version: " + FT_DOSVER() )

 Source: DOSVER.PRG

 Author: Glenn Scott

FT_HEX2DEC

FT_HEX2DEC()
 Convert a hex number to decimal

 Syntax

     FT_HEX2DEC( <cHexNum> ) -> nDecNum

 Arguments

    <cHexNum> is a character string representing a hex number.

 Returns

    A decimal number.

 Description

    Converts a hexadecimal number to a BASE 10 decimal number.
    Useful for using FT_INT86().

 Examples

    FT_INT86( HEX2DEC( "21" ), aRegs )

    Converts 21h, the Dos Interrupt, to its decimal equivalent,
    33, for use by FT_INT86().

 Source: HEX2DEC.PRG

 Author: Robert A. DiFalco