Harbour Differences

Differences between Harbour and other compatible compilers ( xHarbour, Clipper, xBase++, CLIP, FlagShip )

 

Compile time support for merging multiple .prg modules
New language statements
FOR EACH
WITH OBJECT / END[WITH]
SWITCH / [ CASE / [EXIT] / … ] OTHERWISE / END[SWITCH]
BEGIN SEQUENCE [ WITH <ERRBLOCK> ] … END SEQUENCE
Extended codeblocks
Hash arrays
References to variables stored in arrays
Passing array and hash items by reference
Passing object variables by reference
Detached locals and references
Declaration and initialization of variables
Functions with variable number of parameters
Hb_ArrayToParams() function
Macros with declared symbols
Macro messages
Multivalue macros
Using [] operator for string items
Negative indexes in [] operator used to access items from tail
Using one character length string as numeric value
New bit operators
IN, HAS, LIKE operators
Pre/post incrementation/decrementation and <op>= operators
Global / global external (global_extern)
DATETIME/TIMESTAMP values
Literal date and TIMESTAMP values
Extended literal string in compiler and macrocompiler
Symbol items and function references
OOP scopes
OOP and multiinheritance
OOP and private/hidden datas
OOP and class object/class messages
Typed object variables
Object destructors
Scalar classes
Runtime class modification
Array and string preallocation
DIVERT statement
Namespaces
Multi window GTs and runtime GT switching
Multi thread support
Thread local work areas and concurrent work area access
Harbour tasks and MT support in DOS
Background task
Codeblock serialization / deserialization
Native RDDs
Regular expressions
INET sockets
I18N (internationalization) support
ZLIB (compression/decompression)
Serial port support
Macro compiler
Compiler library
PP library
Lexer
Contrib libraries
Portability
C level compatibility
HBRUN / XBSCRIPT
HBMK2
Performance and resource usage

This list borrowed from Harbour github documentation; please look at there for details.

 

SP_FILLARR

FILLARR()

  Short:
  ------
  FILLARR() Fill type, length, decimal arrays

  Returns:
  --------
  Nothing - works on arrays passed

  Syntax:
  -------
  FILLARR(aNames,aTypes,[aLens],[aDeci])

  Description:
  ------------
  Fills in TYPE <aTypes> , LENGTH [aLens] and DECIMAL
  [aDeci] arrays given a FIELDNAME array <aNames>.

  Arrays (3 and 4) are optional.

  Examples:
  ---------
   nFields   :=LEN(aFieldNames)
   aFldtypes     := array(nFields)
   aFldLens      := array(nFields)
   aFldDeci      := array(nFields)
   FILLAR(aFieldNames,aFldTypes,aFldLens,aFldDeci)

  Warnings:
  ----------
  Macro expands an expression to obtain type-could
  crash if expression passed is invalid. Not really meant for
  expressions, but people will pass them from time to time.

  Notes:
  -------
  In most circumstances you would fill all of these
  arrays with one call to AFIELDS(), but there are exceptions.

  Source:
  -------
  S_FILLAR.PRG

 

SP_BUILDEX

BUILDEX()

  Short:
  ------
  BUILDEX() Interactively builds and returns an expression string

  Returns:
  --------
  <cExpression> => An expandable expression string

  Syntax:
  -------
  BUILDEX(cDescript,cStart,lTypeChange,[aFields,aDesc])

  Description:
  ------------
  Interactively builds and returns an expression string.

  Pass parameters of <cDescript> - a descriptive name
  for the expression, <cStart> an existing expression
  (field,etc.),

  <lTypeChange> allow TYPE change by BUILDEX()

  Pass all or none of the following arrays

  [aFields]   An array of field names

  [aDesc]     An array of field descriptions

  Examples:
  ---------
   cExpress :=buildex("Index Expression",COMPANY,.F.)

  Notes:
  ------
  Release 3.5 adds the ability to directly edit the expression.

  Source:
  -------
  S_BUILD.PRG

 

SP_AASKIP

AASKIP()

  Short:
  ------
  AASKIP() Use for skipblock for arrays in Tbrowse

  Returns:
  --------
  <nSkipcount> => number skipped, forward or backward

  Syntax:
  -------
  AASKIP(nSkip,@nElement,nMaxRows)

  Description:
  ------------
  Use this to create the SKIPBLOCK for a tbrowse that browses
  an array, as in :

    aTbrowseObject:SKIPBLOCK := {|n|aaskip(n,@nElement,len(aArray)}

  <nSkip>      is passed in by Tbrowse as a +- value, or
               as zero.

  <nElement>   is the current array element number.
               PASSED IN BY REFERENCE!

  <nMaxrows>   refers to the length of the array being
               browsed

  Examples:
  ---------
  // this example browses the fields in a database

   local nLastKey,  nElement    := 1
   local aArray := dbstruct()
   local oTb        := tBrowseNew(2,2,20,78)
   oTb:addcolumn(tbcolumnew("Name",{||aArray[nElement,1]}))
   oTb:addcolumn(tbcolumnew("Type", {||aArray[nElement,2]}))
   oTb:addcolumn(tbcolumnew("Len " , {||aArray[nElement,3]}))
   oTb:addcolumn(tbcolumnew("Deci",  {||aArray[nElement,4]}))
   oTb:Skipblock        := {|n|aaskip(n,@nElement,len(aArray)}
   oTb:goTopBlock       := {||nElement := 1}
   oTb:goBottomBlock    := {||nElement := len(aArray)}

   while .t.
     while !oTb:stabilize()
     end
     nLastKey := inkey(0)
     do case
        /// various actions.....
     endcase
   end

  Notes:
  -------
  Aaskip() is used by a lot of SuperLib functions, but
  is very useful by itself for creating array tbrowses.

  Source:
  -------
  S_AASKIP.PRG

 

 

SP_A2TOSING

 A2TOSING()

  Short:
  ------
  A2TOSING() Copies a given element from an array of arrays

  Returns:
  --------
  <aSingle> => a single dimensioned array

  Syntax:
  -------
  A2TOSING(a2Dim,nElement)

  Description:
  ------------
  Copies a given element position from a 2 dimensioned
  array of arrays into a single dimensioned array. <a2dim> is the
  source 2 dimensioned array. <nElement> is the element position
  within each sub-array to copy.

  Examples:
  ---------
  Both DBSTRUCT() and DIRECTORY() are good examples.
  Each return an array of arrays. DBSTRUCT() for instance, returns
  the structure of the current database file in an array whose
  length is equal to the number of fields in the database file.
  Each element of the array is a subarray containing information
  for one field.  The subarrays have the following format:

        { fieldname, fieldtype, fieldlength,fielddecimals}

  To extract a single dimensioned array of, say, the
  field names, you could use A2TOSING() with
  A2TOSING(DBSTRUCT(),1). For the field types you would use
  A2TOSING(DBSTRUCT(),2), etc.

  Here is an example with DIRECTORY()

   aDir         := DIRECTORY()
   aNames       := A2TOSING(adir,1)
   nWhichFile   := mchoice(aNames,10,10,20,20,"Which File?")

  Source:
  -------
  S_AFTYPE.PRG

FT_SAVEARR

 FT_SAVEARR()
 Save Clipper array to a disc file.

 Syntax

      FT_SAVEARR( <aArray>, <cFileName>, <nErrorCode> ) -> lRet

 Arguments

     <aArray> is any Clipper array except those containing
     compiled code blocks.

     <cFileName> is a DOS file name.

     <nErrorCode> will return any DOS file error.

     All arguments are required.

 Returns

     .F. if there was a DOS file error or the array contained
     code blocks, otherwise returns .T.

 Description

     FT_SAVEARR() saves any Clipper array, except those
     containing compiled code blocks, to a disc file.  The
     array can be restored from the disc file using
     FT_RESTARR().

     [10/1/92 Librarian note:

     This function does not appear to work with multi-dimensional
     arrays.  If you'd care to modify it to support this feature,
     please do and send it to Glenn Scott 71620,1521.]

 Examples

    aArray := { {'Invoice 1',CTOD('04/15/91'),1234.32,.T.},;
                {'Invoice 2',DATE(),234.98,.F.},;
                {'Invoice 3',DATE() + 1,0,.T.}  }
    nErrorCode := 0
    FT_SAVEARR(aArray,'INVOICE.DAT',@nErrorCode)
    IF nErrorCode = 0
      aSave := FT_RESTARR('INVOICE.DAT',@nErrorCode)
      IF nErrorCode # 0
         ? 'Error restoring array'
      ENDIF
    ELSE
      ? 'Error writing array'
    ENDIF

 Source: SAVEARR.PRG

 Author: David Barrett

See Also: FT_RESTARR()


			

FT_RESTARR

FT_RESTARR()
 Restore a Clipper array from a disc file

 Syntax

      FT_RESTARR( <cFileName>, <nErrorCode> ) -> aArray

 Arguments

     <cFileName> is a DOS file name.

     <nErrorCode> will return any DOS file error.

     All arguments are required.

 Returns

     Return an array variable.

 Description

     FT_RESTARR() restores an array which was saved to
     a disc file using FT_SAVEARR().

     [10/1/92 Librarian note:

     This function does not appear to work with multi-dimensional
     arrays.  If you'd care to modify it to support this feature,
     please do and send it to Glenn Scott 71620,1521.]

 Examples

    aArray := { {'Invoice 1',CTOD('04/15/91'),1234.32,.T.},;
                {'Invoice 2',DATE(),234.98,.F.},;
                {'Invoice 3',DATE() + 1,0,.T.}  }
    nErrorCode := 0
    FT_SAVEARR(aArray,'INVOICE.DAT',@nErrorCode)
    IF nErrorCode = 0
      aSave := FT_RESTARR('INVOICE.DAT',@nErrorCode)
      IF nErrorCode # 0
         ? 'Error restoring array'
      ENDIF
    ELSE
      ? 'Error writing array'
    ENDIF

 Source: SAVEARR.PRG

 Author: David Barrett

See Also: FT_SAVEARR()