2014-11-04 01:54 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* ChangeLog.txt
* doc/xhb-diff.txt
! typos
* doc/clipper.txt
! removed completely false information about 'LIST &cMacro'
* updated information about FOR EACH
; in general information in this file are outdated and does not
correctly describe current Harbour behavior. I strongly suggest
to not use it in any other documentation. In some spare time
I'll update this file or remove.
* doc/cmpopt.txt
+ added information about unsupported by Clipper syntax extension:
iif( <expr1>, <expr2>, <expr3> ) <op>= <expr4>
* include/hbrddnsx.h
* minor modification in comment
* src/macro/macrolex.c
* accept unconditionally hash 'key => value' operator
* src/rdd/dbfnsx/dbfnsx1.c
! fixed very bad bug in leaf key compression. This problem could be
exploited by keys containing containing CHR( 255 ) in encoded keys
just before trailing empty key characters.
This bug could cause index corruption.
* use hb_xgrabz()
* formatting
This commit is contained in:
@@ -30,23 +30,6 @@ Both these extra layers are activated by default.
|
||||
|
||||
* See also -k Compiler switch.
|
||||
|
||||
LIST Command
|
||||
------------
|
||||
|
||||
LIST &cMacro
|
||||
|
||||
LIST in CA-Cl*pper [superficially] supports macros of lists expressions.
|
||||
No error will be produced, and all expressions in the list will be
|
||||
evaluated, but *only* the *last* expression will be displayed. This is
|
||||
not documented in either the LIST Command or the Macro Operator
|
||||
descriptions, but is the de-facto behavior in all CA-Cl*pper 5.x versions.
|
||||
|
||||
Harbour instead will not only evaluate all of the expressions in
|
||||
such list macro, but will also display all such values. This default
|
||||
behavior may be disabled with hb_SetMacro( HB_SM_XBASE, .F. )*
|
||||
|
||||
* See also -k Compiler switch.
|
||||
|
||||
INIT/EXIT and startup procedures
|
||||
--------------------------------
|
||||
|
||||
@@ -67,17 +50,37 @@ Harbour has support enumeration loop with the following syntax:
|
||||
NEXT
|
||||
|
||||
Note:
|
||||
- expr can be a string or an array
|
||||
- expr can be a string, an array, an hash array or an object with
|
||||
custom FOR EACH action
|
||||
- enumerator variable 'var<n>' stores a reference to the element of
|
||||
an array or a string specified by 'expr<n>' thus assigments to the
|
||||
enumerator changes the value of given array element
|
||||
- after the loop the controlling variable(s) store the value which
|
||||
an hash, array or a string specified by 'expr<n>' thus assignments
|
||||
to the enumerator changes the value of given element of iterated
|
||||
item. If FOR EACH is used to iterate string items them assignment
|
||||
to enumerator item changes the original string only if it was passed
|
||||
to FOR EACH statement by reference, i.e.:
|
||||
FOR EACH c IN @string
|
||||
IF ! isAlpha( c )
|
||||
c := "*"
|
||||
ELSE
|
||||
c := upper( c )
|
||||
ENDIF
|
||||
NEXT
|
||||
- after the loop the controlling variable(s) restore the value which
|
||||
they had before entering the loop
|
||||
- the enumeraqtor variable supports the following properties
|
||||
:__enumindex - the loop counter for variable
|
||||
:__enumbase - the value that is being traversed
|
||||
:__enumvalue - the value of variable
|
||||
|
||||
- the enumerator variable supports the following properties
|
||||
:__enumIndex - the loop counter for variable
|
||||
:__enumKey - the hash key value of traversed hash item pair
|
||||
:__enumBase - the value that is being traversed
|
||||
:__enumValue - the value of variable
|
||||
:__enumIsFirst - is it the first enumerated item?
|
||||
:__enumIsLast - is it the last enumerated item?
|
||||
- defining new class or overloading existing one user can define
|
||||
his own behavior of FOR EACH iterating overloading chosen of above
|
||||
methods and/or the following ones:
|
||||
:__enumStart
|
||||
:__enumSkip
|
||||
:__enumStop
|
||||
By default FOR EACH iterate all object instance variables
|
||||
|
||||
for example:
|
||||
a := 'A'
|
||||
|
||||
@@ -146,6 +146,20 @@ arguments are well known and can be calculated at compile time:
|
||||
( <expr> ) => <expr> // it allows to optimize
|
||||
// expresions like: 1+(2)
|
||||
|
||||
- Harbour syntax extensions not supported by Clipper, enabled by -ko
|
||||
compiler switch:
|
||||
iif( <expr1>, <expr2>, <expr3> ) <op>= <expr4> => ;
|
||||
IF <expr1> ;
|
||||
<expr2> <op>= <expr4> ;
|
||||
ELSE ;
|
||||
<expr3> <op>= <expr4> ;
|
||||
ENDIF
|
||||
i.e.:
|
||||
iif( dData == NIL, dDate, aVal[ 1 ] ) := date()
|
||||
iif( empty( x ), aVal[ 2 ], nTmp ) += 10
|
||||
? iif( f1(), nVal1, nVal2 ) ++
|
||||
? -- iif( f2(), aVal[ 1 ], hVal[ "abc" ] )
|
||||
|
||||
- Harbour extensions which may disable RT errors in wrong expressions
|
||||
or can change used operators using basic math rules. Enabled by -ko
|
||||
compiler switch:
|
||||
|
||||
@@ -121,7 +121,7 @@ file system(s) and with different OS(s).
|
||||
"=>", x:__enumBase()[ x:__enumKey() ]
|
||||
NEXT
|
||||
f) it gives very flexible OOP mechanism to overload FOR EACH behavior
|
||||
for user define objects adding to above enumerator methods also
|
||||
for user defined classes adding to above enumerator methods also
|
||||
__enumStart(), __enumStop(), __enumSkip() methods what allows to
|
||||
implement many different enumeration algorithms depending on used
|
||||
data
|
||||
|
||||
Reference in New Issue
Block a user