FT_BYTEOR

FT_BYTEOR()
 Perform bit-wise OR on two ASCII characters (bytes)

 Syntax

      FT_BYTEOR( <cByte1>, <cByte2> ) -> cNewByte

 Arguments

     <cByte1> and <cByte2> are characters from CHR(0) TO CHR(255).
     May be passed in CHR() form, as character literals, or as
     expressions evaluating to CHR() values.

 Returns

     Returns resulting byte, in CHR() form.  If parameters are faulty,
     returns NIL.

 Description

     Can be used for bit-wise byte manipulation.  In effect, this is a
     bit-by-bit OR operation.  Equivalent to OR assembler instruction.

     This function is presented to illustrate that bit-wise operations
     are possible with Clipper code.  For greater speed, write .C or
     .ASM versions and use the Clipper Extend system.

 Examples

          This code performs a bit-wise OR on two bytes represented
          by CHR(20) and CHR(10):

          cNewByte := FT_BYTEOR( CHR(20), CHR(10) )
          ? ASC( cNewByte )  // result: 30
          ? cNewByte         // result: non-printable character

     For a demonstration of Clipper bit manipulations, compile and
     link the program BITTEST.PRG in the Nanforum Toolkit source code.

 Source: BYTEOR.PRG

 Author: Forest Belt, Computer Diagnostic Services, Inc.

See Also: FT_BYTEXOR() FT_BYTENOT() FT_BYTENEG() FT_BYTEAND()



FT_BYTENOT

FT_BYTENOT()
 Perform bit-wise NOT on an ASCII character (byte)
------------------------------------------------------------------------------

 Syntax

      FT_BYTENOT( <cByte> ) -> cNewByte

 Arguments

     <cByte> is a character from CHR(0) to CHR(255).
     May be passed in CHR() form, as character literal, or
     as expression evaluating to CHR() value.

 Returns

     Returns resulting byte, in CHR() form.  If parameters are faulty,
     returns NIL.

 Description

     Can be used for bitwise byte manipulation.  In effect, this is a
     bit-by-bit NOT (one's complement) operation.  Equivalent to the
     NOT assembler instruction.

     This function is presented to illustrate that bit-wise operations
     are possible with Clipper code.  For greater speed, write .C or
     .ASM versions and use the Clipper Extend system.

 Examples

     This code performs a bitwise NOT on byte represented by CHR(32):

          cNewByte := FT_BYTENOT( CHR(32) )
          ? ASC( cNewByte )     // result: 223

     For a demonstration of Clipper bit manipulations, compile and
     link the program BITTEST.PRG in the Nanforum Toolkit source code.

 Source: BYTENOT.PRG

 Author: Forest Belt, Computer Diagnostic Services, Inc.

See Also: FT_BYTEOR() FT_BYTEXOR() FT_BYTENEG() FT_BYTEAND()

FT_BYTENEG

FT_BYTENEG()
 Perform bit-wise negation on an ASCII character

 Syntax

      FT_BYTENEG( <cByte> ) -> cNewByte

 Arguments

     <cByte> is a character from CHR(0) to CHR(255).
     May be passed in CHR() form, as character literal, or
     as expression evaluating to CHR() value.

 Returns

     Returns resulting byte, in CHR() form.  If parameters are faulty,
     returns NIL.

 Description

     Can be used for bit-wise byte manipulation.  In effect, this is a
     bit-by-bit NEG (two's complement) operation.  Equivalent to NEG
     assembler instruction.

     This function is presented to illustrate that bit-wise operations
     are possible with Clipper code.  For greater speed, write .C or
     .ASM versions and use the Clipper Extend system.

 Examples

     This code performs a bit-wise NEG on byte represented by CHR(32):

          cNewByte := FT_BYTENOT(CHR(32))
          ? asc(cNewByte)                  // result: 224

     For a demonstration of Clipper bit manipulations, compile and
     link the program BITTEST.PRG in the Nanforum Toolkit source code.

 Source: BYTENEG.PRG

 Author: Forest Belt, Computer Diagnostic Services, Inc.

See Also: FT_BYTEOR() FT_BYTEXOR() FT_BYTENOT() FT_BYTEAND()

FT_BYTEAND

FT_BYTEAND()
 Perform bit-wise AND on two ASCII characters (bytes)

 Syntax

      FT_BYTEAND( <cByte1>, <cByte2> ) -> cByte

 Arguments

     <cByte1> and <cByte2> are characters from CHR(0) TO CHR(255).
     May be passed in CHR() form, as character literals, or as expressions
     evaluating to CHR() values.

 Returns

     Returns resulting byte, in CHR() form.  If parameters are faulty,
     returns NIL.

 Description

     Can be used for any bit-wise masking operation.  In effect, this is a
     bit-by-bit AND operation.  Equivalent to AND assembler instruction.

     This function is presented to illustrate that bit-wise operations
     are possible with Clipper code.  For greater speed, write .C or
     .ASM versions and use the Clipper Extend system.

 Examples

     This code would mask out the high nibble (four most significant bits)
     of the byte represented by chr(123) and leave the low nibble bits as in
     the parameter byte.

          cNewbyte := FT_BYTEAND( CHR(123), CHR(15) )
          ? asc(cNewByte)  // result: 11
          ? cNewByte       // result: non-printable character

     For a demonstration of Clipper bit manipulations, compile and
     link the program BITTEST.PRG in the Nanforum Toolkit source code.

 Source: BYTEAND.PRG

 Author: Forest Belt, Computer Diagnostic Services, Inc.

See Also: FT_BYTEOR() FT_BYTEXOR() FT_BYTENOT() FT_BYTENEG()

 

FT_BITSET

FT_BITSET()
 Set selected bit in a byte

 Syntax

      FT_BITSET( <cByte>, <nBitPos> ) -> cByte

 Arguments

     <cByte> is a character from CHR(0) to CHR(255).

     <nBitPos> is a number from 0 to 7 conforming to standard right-to-left
     bit numbering convention and representing the position of the bit
     within the byte.

 Returns

     Returns new byte, with designated bit set.  If parameters are faulty,
     returns NIL.

 Description

     In effect, ORs argument byte with a byte that has only the target bit
     set.  If bit is already set, it remains set.
     Note: Calls FT_ISBIT() which is also in this Library.

     This function is presented to illustrate that bit-wise operations
     are possible with Clipper code.  For greater speed, write .C or
     .ASM versions and use the Clipper Extend system.

 Examples

     This code would set bit 4 in a byte represented by CHR(107):

          cNewbyte := FT_BITSET( CHR(107), 4 )
          ? ASC( cNewbyte )             // result: 123
          ? cNewbyte                    // result: '{'

     This code would set bit 5 in the byte represented by the letter 'A'.

          ? FT_BITSET( 'A', 5 )         // result: 'a'
                                        // bit 5 set

     For a demonstration of Clipper bit manipulations, compile and
     link the program BITTEST.PRG in the Nanforum Toolkit source code.

 Source: BITSET.PRG

 Author: Forest Belt, Computer Diagnostic Services, Inc.

See Also: FT_BITCLR() FT_ISBIT()

 

FT_BITCLR

FT_BITCLR()
 Clear (reset) selected bit in a byte

 Syntax

      FT_BITCLR( <cByte>, <nBitPos> ) -> cByte

 Arguments

     <cByte> is a character from CHR(0) to CHR(255).

     <nBitPos> is a number from 0 to 7 conforming to standard
     right-to-left bit numbering convention and representing the
     position of the bit within the byte.

 Returns

     Returns new byte, with designated bit cleared (reset).
     If parameters are faulty, returns NIL.

 Description

     In effect, ANDs argument byte with a byte that has all bits set except
     the target bit.  If bit is already clear (0), it remains clear.
     Note: Calls FT_ISBIT() which is also in this Library.

     This function is presented to illustrate that bit-wise operations
     are possible with Clipper code.  For greater speed, write .C or
     .ASM versions and use the Clipper Extend system.

 Examples

     This code would clear bit 4 in a byte represented by CHR(115):

       cNewByte := FT_BITCLR( CHR(115), 4 )
       ? ASC( cNewbyte )         // result: 99
       ? cNewByte                // result: 'c'

     This code would clear bit 5 in the byte represented by letter 'A':

       FT_BITCLR( 'A', 5 )       // result: 'A', since
                                 // bit 5 already clear

     For a demonstration of Clipper bit manipulations, compile and
     link the program BITTEST.PRG in the Nanforum Toolkit source code.

 Source: BITCLR.PRG

 Author: Forest Belt, Computer Diagnostic Services, Inc.

See Also: FT_BITSET() FT_ISBIT()

FT_AT2

FT_AT2()
 Find position of the nth occurrence of a substring

 Syntax

      FT_AT2( <cSearch>, <cTarget> [, <nOccurs> [, <lCaseSens> ] ] ) -> nPos

 Arguments

     <cSearch> is the character substring to search for.

     <cTarget> is the character string to search.

     <nOccurs> is the occurrence of cSearch to look for,
                defaults to 1.

     <lCaseSens> is a logical value denoting case sensitivity.
                If .F., then search is NOT sensitive to case,
                defaults to .T.

 Returns

     The position of the nth occurrence of a substring

 Description

     This function will find the nth occurrence of a substring
     within a string.

 Examples

     cSearch := "t"
     cTarget := "This is the day that the Lord has made."

     FT_AT2( cSearch, cTarget )            // Returns ( 9 )

     FT_AT2( cSearch, cTarget, 2 )         // Returns ( 17 )

     FT_AT2( cSearch, cTarget, 2, .F. )    // Returns ( 9 )

 Source: AT2.PRG

 Author: Ralph Oliver,  TRANSCOM SYSTEMS

See Also: FT_FINDITH()