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.

 

Advertisements

How I can check validity of a macro ?

PROC MAIN()

    nResult   := NIL
    nDivident := 1
    nDivisor  := 0
    cMacro    := " nResult := nDivident / nDivisor "  
    QOutResult( nDivident, nDivisor, cMacro ) // 1  0  UE macro is inValid

    nDivisor  := 2
    QOutResult( nDivident, nDivisor, cMacro ) // 1  2  N  Result is :  0.50

    cMacro    := "AT( 'OK', MyUDF() ) > 0"              
    QOutResult( 'AT( OK', 'MyUDF()', cMacro ) // AT( OK ... U macro is inValid

    cMacro    :=  "{ 1, 2 }[ 2 ]"                       
    QOutResult( '{ 1, 2 }', '[2]', cMacro ) // { 1, 2 } [2]   N Result is : 2

    cMacro    :=  "{ 1, 2 }[ 5 ]"  
    QOutResult( '{ 1, 2 }', '[5]', cMacro ) // { 1, 2 } [5] UE macro is inValid

    lCond := 0
    cMacro    :=  "if( lCond, 'true', MyUDF() )"
    QOutResult( lCond, '', cMacro )           // 0        U macro is inValid   
    ?
    WAIT

RETU // Main()

*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.

PROC QOutResult( xVal1, xVal2, cMacro )

	LOCAL cType := TYPE( cMacro )

	? PAD( xVal1, 10 ), PAD( xVal2, 10 ),  PAD( cType, 3 )

    IF ( cType # "U") 
       ?? "Result is :", &cMacro
    ELSE
       ?? "macro is inValid"
    ENDIF

RETU // QOutResult()

*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._

See Also:

& (macro evaluation unary) Operator 

Macro Compiler

HB_SetMacro()

ValType()

TYPE()

C5_TYPE()

hb_SetMacro()

hb_SetMacro()

Enable/disable the macro compiler runtime features.

Syntax

      hb_SetMacro( <nOption>,  [<lOnOff>] ) --> <lOldSetting>

Arguments

<nOption> One of the HB_SM_* constants defined in set.ch.

<lOnOff> .T. to enable or .F. to disable a feature

Returns

hb_SetMacro() return the old state of requested feature.

Description

This function enables or disables some features of the macro compiler. The Harbour is extending the macro features compared to an original set available in CA-Cl*pper. Enabling/disabling some of them allows to keep strict CA-Cl*pper compatibility.

Available features are:

HB_SM_HARBOUR – enables harbour extensions: operators: ++, –, +=, -=, *=, /=, ˆ= objects: assigments to an instance variable

HB_SM_XBASE – enables other Xbase++ dialects extensions: expanding of expresions lists

HB_SM_SHORTCUTS – enables optimized evaluation of logical operators (.and., .or.)

HB_SM_PREPROC – enables preprocessing of commands This is meaningfull if Harbour is compiled with HB_MACRO_STATEMENTS flag

Examples

      INIT PROCEDURE IWANTCLIPPER()
         hb_SetMacro( HB_SM_HARBOUR,  .F. )
         hb_SetMacro( HB_SM_XBASE,  .F. )
         RETURN

Compliance

Harbour

Platforms

All

Files

Header file is set.ch
Library is core

Seealso

Macro compiler

SP_QUERY

QUERY()

  Short:
  ------
  QUERY() Popup Interactive query by example condition
  builder

  Returns:
  --------
  <cQuery> => macro expandable logical condition
  expression

  Syntax:
  -------
  QUERY([aFields,aDesc,aTypes],[cQuitTo],[lUseBuildex])

  Description:
  ------------
  A point and shoot condition builder. Complex
  conditions are allowed with multiple .and./.or. Called without
  parameters, all fields in the current dbf are presented for condition
  building.

  [aFields,aDesc,aTypes] give field array, field
  description and field types.These, if passed will be used in
  place of the default of all dbf fields. (pass all or none)

  [cQuitTo] is a 'quit to' phrase. Default exit option
  is 'Quit'. 'Quit to' phrase will be tacked to the end of this .
  i.e. "Quit"+quit_to  [ Quit to Report Writer ]

  [lUseBuildex] determines whether BUILDEX() expression
  builder will be available from QUERY(). Default is not.

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

   aFields := {"fname", "lname",  "mi" }
   aFdesc  := {"First", "Last",  "Middle" }
   aTypes  := {"C","C","C"}
   cFilt   := QUERY(aFields,aFdesc,aTypes,nil,.t.)

   count for &cFilt  to nCount

   // or (preferably)
   count for eval( sls_bquery() ) to nCount

  Notes:
  -------
  Query always stores the current query with the
  function SLS_QUERY(). Calling SLS_QUERY() will return the
  currently stored query string. SLS_BQUERY() returns the query as
  a codeblock. Remember to clear sls_query()/sls_bquery() when
  changing DBFs.

  Source:
  -------
  S_QUERY.PRG

See also : SLS_BQUERY(), SLS_QUERY()

 

 

SP_EVALQ

EVALQ()

  Short:
  ------
  EVALQ() Evaluates a logical condition in a string

  Returns:
  --------
  <lTrue> => result of evaluating condition

  Syntax:
  -------
  EVALQ(cCondition)

  Description:
  ------------
  Macro expands <cCondition> and returns logical result

  Examples:
  ---------
   locate for evalq( sls_query() )

  Notes:
  -------
  In Clipper 5.01, you're better off doing
       bQueryblock := &("{||"+sls_query()+"}")
       locate for eval(bQueryblock)

  You'll get close to a 100% speed improvement.

  Source:
  -------
  S_EVALQ.PRG

 

Using code blocks, again

Using code blocks again (.pdf)