* harbour/include/hbexprb.c
! modified := optimization to keep alive original LValue name
used in the assign expression. It fixes FOR / NEXT loops which
in which such optimized expression were used, f.e.:
FOR n := n + 1 TO 10; ? n; next
In fact it's only workaround for potentially bigger problem with
multiple references to single expression which we probably have to
resolve if we extend the compiler to not generate PCODE online
for each compiled statement but only after preprocessing and
optimizing at least whole function or procedure.
* harbour/include/hbexpra.c
! verify all expression POP operation for usage as LValue
* harbour/include/hbexprb.c
! fixed possible GPF in unverified send context
+ added support for IIF() usage as LValue even if it cannot be
reduced during [macro]compilation
* harbour/source/macro/macro.yyc
* harbour/source/macro/macro.y
* harbour/source/macro/macrolex.c
* removed support for some characters unsupported by Clipper in
macro expressions like chr(10) as trailing expression character, f.e.:
? &("DATE()"+chr(10))
* harbour/source/compiler/complex.c
* formatting
* harbour/bin/hb-func.sh
! restored default optimization flag (-O3) in hb* scripts
* harbour/harbour.spec
! fixed recent modification
* harbour/contrib/rddads/ads1.c
* harbour/contrib/rddads/adsfunc.c
* harbour/contrib/hbmisc/strfmt.c
* harbour/contrib/hbcrypt/sha1.c
! fixed wrongly used C reference operator
* harbour/contrib/hbwin/win_prn2.c
* harbour/contrib/hbwin/wapi_commctrl.c
* harbour/source/vm/maindllp.c
! fixes for unicode builds
* harbour/include/std.ch
+ added SET TIME FORMAT [TO] <f>
* harbour/include/set.ch
* harbour/include/hbset.h
* harbour/source/vm/set.c
+ added _SET_TIMEFORMAT
The folowing modifiers are supported:
hh - hours
mm - minutes
ss - seconds
fff - fraction part of seconds
p - 1-st letter from PM / AM signature. When used time is shown
in 12 hour format otherwise 24 hour format is used
ex: Set( __SET_TIMEFORMAT, "hh:mm pm" )
default _SET_TIMEFORMAT value is "hh:mm:ss:fff"
+ added C function: char * hb_setGetTimeFormat( void );
* harbour/include/hbpp.h
* harbour/source/pp/ppcore.c
+ added support for timestamp constant values in the form:
t"YYYY-MM-DD HH:MM:SS.fff"
The exact accepted timestamp pattern is is:
YYYY-MM-DD [H[H][:M[M][:S[S][.f[f[f[f]]]]]]] [PM|AM]
i.e.:
tValue := t"2009-03-21 5:31:45.437 PM"
or:
YYYY-MM-DDT[H[H][:M[M][:S[S][.f[f[f[f]]]]]]] [PM|AM]
with literal "T" as date and time part delimiters (XML timestamp
format), i.e.:
tValue := t"2009-03-21T17:31:45.437"
The folowing characters can be used as date delimiters: "-", "/", "."
if PM or AM is used HH is in range < 1 : 12 > otherwise
in range < 0 : 23 >
* harbour/source/compiler/complex.c
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
* harbour/source/compiler/harbour.yyh
+ added support for t"YYYY-MM-DD HH:MM:SS.fff" time stamp constant
to compiler
+ added support for VFP datetime constant values:
{ ^ [ YYYY-MM-DD [,] ] [ HH[:MM[:SS][.FFF]] [AM|PM] ] }
The following characters can be used as date delimiters: "-", "/".
Dot "." as date delimiter is not supported.
There is no limit on number of characters in YYYY, MM, DD, HH, MM,
SS, FFF parts. Important is only their value. This is the format
in semi PP notation:
{ ^ <YEAR> <sep:/-> <MONTH> <sep:/-> <DAY> [[<sep2:,>]
[ <HOUR> [ : <MIN> [ : <SEC> [ . <FRAQ> ] ] ] [AM|PP] ] }
In practice it allows to also parse xHarbour datetime constant
values with compatible conditions though xHarbour support onlu "/"
as date delimiter.
NOTE: there is one important difference to VFP and xHarbour in
decoding above format. In VFP and xHarbour when date part is
missing then it's set by default to: 1899-12-30 so this code:
{ ^ 12:00 }
gived the same results as:
{ ^ 1899/12/30 12:00 }
Harbour does not set any default date value when timestamp
constant value contains only time part.
If you want we can change it for strict VFP compatiblity.
Now this extension is enabled by default for testing. In the future
it will be probably covered by HB_COMPAT_FOXPRO macro.
* harbour/source/macro/macro.yyc
* harbour/source/macro/macro.y
* harbour/source/macro/macro.yyh
* harbour/source/macro/macrolex.c
+ added support for t"YYYY-MM-DD HH:MM:SS.fff" time stamp constant
to macro compiler
* harbour/include/hbmacro.h
* harbour/source/vm/macro.c
+ added new function:
void hb_macroGenPushTimeStamp( LONG lDate, LONG lTime, HB_COMP_DECL );
* harbour/include/hberrors.h
* harbour/source/compiler/hbgenerr.c
+ added new compile time error: "Invalid timestamp constant '%s'"
* harbour/source/compiler/cmdcheck.c
* use Harbour API timestamp functions instead of calling system
functions
* harbour/include/hbpcode.h
* harbour/source/compiler/hbfix.c
* harbour/source/compiler/hbpcode.c
* harbour/source/compiler/hbdead.c
* harbour/source/compiler/genc.c
* harbour/source/compiler/gencc.c
* harbour/source/compiler/hblbl.c
* harbour/source/compiler/hbstripl.c
* harbour/source/compiler/hbopt.c
+ added new PCODE HB_P_PUSHTIMESTAMP (replaced one unused PCODE value)
to store timestamp constant values in the PCODE
* harbour/include/hbcomp.h
* harbour/source/compiler/hbmain.c
+ added new function:
void hb_compGenPushTimeStamp( LONG lDate, LONG lTime, HB_COMP_DECL );
* harbour/include/hbexprop.h
* harbour/source/common/expropt1.c
+ added new C functions:
HB_EXPR_PTR hb_compExprNewTimeStamp( LONG, LONG, HB_COMP_DECL );
* harbour/include/hbexprb.c
* harbour/include/hbcompdf.h
* harbour/source/common/expropt2.c
+ added timestamp expressions support
+ added compile time optimization for timestamp expressions
* updated function optimization for timestamp expressions
* harbour/include/hbdate.h
* harbour/source/common/hbdate.c
* changed hb_dateMilliSeconds() to return UTC julian timestamp in
milliseconds
* changed existing seconds, time and timestamp functions to operate
on common OS specific functions to eliminate possible problems
with different OS time counters
+ added new functions to operates on time and timestamp values.
See source code for details.
+ harbour/source/rtl/cputime.c
* moved double hb_secondsCPU( int n ) function to separate file
* harbour/source/rtl/seconds.c
- removed old version of date/seconds functions
* harbour/source/vm/hashes.c
* harbour/source/vm/arrays.c
+ added support for timestamp values as hash item indexes
* harbour/source/vm/hashfunc.c
+ added support for find timestamp values in hash and array items
by simple date value in AScan(), hb_HScan(), hb_AScan() and hb_RAScan()
functions when exact comparison is not used.
* harbour/source/vm/asort.c
+ added support for sorting timestamp values
* harbour/source/vm/classes.c
+ added support for timestamp scallar classes
+ added support for timestamp typed instance variables
* harbour/source/vm/memvars.c
+ added support for timestamp values in .mem files
* harbour/source/vm/estack.c
+ show timestamp values in stack dump
* harbour/include/hbapi.h
* harbour/source/vm/arrays.c
+ added new C functions:
double hb_arrayGetTD( PHB_ITEM pArray, ULONG ulIndex );
BOOL hb_arraySetTD( PHB_ITEM pArray, ULONG ulIndex, double dTimeStamp )
BOOL hb_arrayGetTDT( PHB_ITEM pArray, ULONG ulIndex,
LONG * plJulian, LONG * plMilliSec );
BOOL hb_arraySetTDT( PHB_ITEM pArray, ULONG ulIndex,
LONG lJulian, LONG lMilliSec );
* harbour/include/hbapi.h
* harbour/source/vm/extend.c
+ accept timestamp items in date functions - use only date part of
timestamp value
+ added new C functions:
double hb_partd( int iParam, ... );
BOOL hb_partdt( LONG * plJulian, LONG * plMilliSec , int iParam, ... );
void hb_rettd( double dTimeStamp );
void hb_rettdt( LONG lJulian, LONG lMilliSec );
int hb_stortd( double dTimeStamp, int iParam, ... );
int hb_stortdt( LONG lJulian, LONG lMilliSec, int iParam, ... );
* harbour/include/hbapiitm.h
* harbour/source/vm/itemapi.c
+ accept timestamp items in date functions - use only date part of
timestamp value
+ added new C functions:
char * hb_itemGetTS( PHB_ITEM pItem, char * szDateTime );
PHB_ITEM hb_itemPutTS( PHB_ITEM pItem, const char * szDateTime );
double hb_itemGetTD( PHB_ITEM pItem );
PHB_ITEM hb_itemPutTD( PHB_ITEM pItem, double dTimeStamp )
BOOL hb_itemGetTDT( PHB_ITEM pItem, LONG * plJulian, LONG * plMilliSec );
PHB_ITEM hb_itemPutTDT( PHB_ITEM pItem, LONG lJulian, LONG lMilliSec );
+ support for timestamp items in hb_itemString(), hb_itemPadConv() and
hb_itemTypeStr() functions
* harbour/include/hbvm.h
* harbour/include/hbxvm.h
* harbour/include/hbapi.h
* harbour/source/vm/hvm.c
+ added HB_IT_TIMESTAMP items
* modified HB_IT_DATE internal item structure to use common structure
with HB_IT_TIMESTAMP - it simplifies HVM code and eliminates additional
RT conditions.
+ added HB_IS_TIMESTAMP() and ISTIMESTAMP() macros
+ added HB_IS_DATETIME() and ISDATETIME() macros - they return true
if item/parameter is DATE or TIMESTAMP type.
+ added void hb_vmPushTimeStamp( long lJulian, long lMilliSec );
and xhb_vmPushTimeStamp()
+ added support for timestamp values in relational operators:
<, <=, >, >=, =, ==
When two timestamp values are compared then VM compares date and
time parts in both values.
When date and timestamp values are used in <, <=, >, >=, = operations
then VM compares only date part in both values.
When date and timestamp values are used in == operation then VM
compares date part in both values and then check if time part
of timestamp value is 0.
+ added support for timestamp values in + and - math operations.
The following rules are used in timestamp arithmetic:
<t> + <t> => <t>
<t> - <t> => <n>
<t> + <n> => <t>
<n> + <t> => <t>
<t> - <n> => <t>
<d> + <t> => <t>
<t> + <d> => <t>
<d> - <t> => <n>
<t> - <d> => <n>
When number is result or argument of timestamp operation then the
its integer part is a number of day and fractional part is the time.
* harbour/source/rtl/dateshb.c
+ added new .prg functions to mange date and timestamp values:
HB_DATETIME() -> <tTimeStamp>
HB_CTOD( <cDate> [, <cDateFormat> ] ) -> <dDate>
HB_DTOC( <dDate> [, <cDateFormat> ] ) -> <cDate>
HB_NTOT( <nValue> ) -> <tTimeStamp>
HB_TTON( <tTimeStamp> ) -> <nValue>
HB_TTOC( <tTimeStamp>, [ <cDateFormat> ] [, <cTimeFormat> ] ) ->
<cTimeStamp>
HB_CTOT( <cTimeStamp>, [ <cDateFormat> ] [, <cTimeFormat> ] ) ->
<tTimeStamp>
HB_TTOS( <tTimeStamp> ) -> <cYYYYMMDDHHMMSSFFF>
HB_STOT( <cDateTime> ) -> <tTimeStamp>
<cDateTime> should be in one of the above form:
- "YYYYMMDDHHMMSSFFF"
- "YYYYMMDDHHMMSSFF"
- "YYYYMMDDHHMMSSF"
- "YYYYMMDDHHMMSS"
- "YYYYMMDDHHMM"
- "YYYYMMDDHH"
- "YYYYMMDD"
- "HHMMSSFFF"
- "HHMMSSF"
- "HHMMSS"
- "HHMM"
- "HH"
Important is number of digits.
HB_TSTOSTR( <tTimeStamp> ) -> <cTimeStamp> // YYYY-MM-DD HH:MM:SS.fff
HB_STRTOTS( <cTimeStamp> ) -> <tTimeStamp>
<cTimeStamp> should be in one of the above form:
YYYY-MM-DD [H[H][:M[M][:S[S][.f[f[f[f]]]]]]] [PM|AM]
YYYY-MM-DDT[H[H][:M[M][:S[S][.f[f[f[f]]]]]]] [PM|AM]
The folowing characters can be used as date delimiters: "-", "/", "."
T - is literal "T" - it's for XML timestamp format
if PM or AM is used HH is in range < 1 : 12 > otherwise
in range < 0 : 23 >
HB_HOUR( <tTimeStamp> ) -> <nHour>
HB_MINUTE( <tTimeStamp> ) -> <nMinute>
HB_SEC( <tTimeStamp> ) -> <nSeconds> // with milliseconds
* harbour/source/rtl/datec.c
+ accept timestamp parameters in CMONTH() and CDOW() functions
* harbour/source/rtl/empty.c
+ added support for timestamp items
* harbour/source/rtl/itemseri.c
+ added support for timestamp items serialization
* harbour/source/rtl/minmax.c
+ added support for timestamp values to MIN() and MAX() functions.
when only one of given parameters is timestamp value and other
is date value and date parts are equal then always date item
is returned as both MIN() or MAX() value.
* harbour/source/rtl/dates.c
+ added new C functions: hb_timeFormat(), hb_timeUnformat(),
hb_timeStampFormat(), hb_timeStampUnformat()
* harbour/source/rtl/valtype.c
+ added .prg functions: HB_ISDATETIME(), HB_ISTIMESTAMP()
* harbour/source/rtl/transfrm.c
+ added support for timestamp items formatting.
+ added new function modifier @T.
When @T is used without @D then only time part of timestamp value
is formatted and return.
When @D is used without @T then only date part of timestamp value
is formatted and return.
* harbour/source/rtl/tbrowse.prg
+ display timestamp values
* harbour/source/rtl/philes.c
+ accept timestamp value as second parameter of HB_FSETDATETIME()
function
+ store file data and time in second parameter of HB_FGETDATETIME()
as timestamp value.
Old parameters (2-dDate, 3-cTime) are still supported but please think
about removing them - they are redundant.
* harbour/source/rtl/filesys.c
* updated function names
* harbour/source/rdd/dbf1.c
+ added native support for time and timestamp fields
* harbour/include/hbrddcdx.h
* harbour/include/hbrddnsx.h
* harbour/source/rdd/dbfntx/dbfntx1.c
* harbour/source/rdd/dbfcdx/dbfcdx1.c
* harbour/source/rdd/dbfnsx/dbfnsx1.c
* harbour/source/rdd/dbffpt/dbffpt1.c
+ added support for indexing timestamp fields
+ added support for using DATE values with timestamp fields
which replicate HVM behavior.
SEEK and SEEKLAST with date value when active index is on
timestamp positions to 1-st or last record where date part
of indexed timesamp value is equal.
Settings scopes to date values when active index is on timestamp
value reduce the visible record range to these ones which have
date part of timestamp value in the range of dates values used
for scopes. It possible to mix date and timestamp values in scope
and set one scope to date value and the second to timesamp.
* harbour/source/rdd/sdf1.c
* harbour/source/rdd/delim1.c
+ added support for exporting timestamp fields
* harbour/source/rdd/dbsql.c
! fixed typo in logical value export
+ export timestamp fields.
Please update the format to given SQL syntax.
* harbour/contrib/hbct/files.c
+ changed SETFDATI() to optionally accept timestamp parameter
instead of two parameters dDate and cTime
* harbour/contrib/hbct/misc1.c
+ added timestamp support to XTOC() function
* harbour/contrib/hbct/misc2.c
+ added timestamp support to COMPLEMENT() function
* harbour/contrib/hbct/dattime2.c
+ accept timestamp values in ADDMONTH(), DOY(), ISLEAP(), QUARTER()
LASTDAYOM(), WEEK() functions
* harbour/contrib/hbmzip/hbmzip.c
+ updated HB_ZipFileCreate( hZip, cZipName, tDateTime, cTime, ... )
functions to optionaly accept timestamp value in 3-rd parameter
instead od dDate, and cTime in 3-rd and 4-th parameters.
+ updated HB_UnzipFileInfo( hUnzip, @cZipName, @tDateTime, @cTime, ... )
to return timestamp value in 3-rd parameter instead of date value.
TODO: Please think about removing 4-th parameter from:
HB_ZipFileCreate( hZip, cZipName, tDateTime, cTime, ... )
HB_UnzipFileInfo( hUnzip, @cZipName, @tDateTime, @cTime, ... )
Now it's redundant.
* harbour/contrib/hbmzip/readme.txt
* updated parameters description for above functions
* harbour/contrib/hbnf/descendn.c
+ added timestamp support to FT_DESCEND() function
* harbour/contrib/hbclipsm/date.c
+ accept timestamp values in DATEASAGE(), DATEASARRAY() and DATEISLEAP()
functions
* harbour/contrib/hbmisc/dates2.c
+ accept timestamp values in ISLEAPYEAR(), DAYSINMONTH(), EOM(), BOM(),
WOM(), WOY(), EOY() and BOY() functions
The following contrib files should be updated but I'm leaving it to
other developers who want to keep this code alive:
contrib/hbtip/utils.c
contrib/hbvpdf/hbvpdf.prg
contrib/hbvpdf/hbvpdft.prg
contrib/hbwin/win_dll.c
some minor cleanups if necessary and authors will find
timestamp values usable
contrib/hbole/ole2.c
contrib/hbwin/win_ole.c
add support for timestamp values in OLE
contrib/rddado/adordd.prg
contrib/rddads/ads1.c
contrib/rddads/adsx.c
contrib/rddsql/...
add support for timestamp values in RDDs
Warning: this implementation is not xHarbour compatible. There are many
important differences. Mostly on C level and used API. Please be careful
in porting xHarbour source code to Harbour.
* harbour/include/hbexprb.c
+ added optimizations for var := var <op> <exp> => var <op>= <exp>
when <op> is +, -, *, / %, ^ operator
% cleanup up checking if message can be used as LValue
* harbour/include/hbcomp.h
* harbour/include/hbmacro.ch
* harbour/source/compiler/ppcomp.c
* harbour/source/compiler/hbusage.c
* harbour/source/compiler/cmdcheck.c
+ added -ko (allow operator optimizations) compiler switch
It's disabled by default.
* harbour/include/hbexprb.c
* removed HB_ADD_SUB_ONE_OPT macro and enable optimizations covered
by it when -ko switch is used.
* harbour/source/common/expropt2.c
* disabled <exp> + 0 => <exp>, <exp> + "" => <exp>, - - <exp> => <exp>
optimizations for default compiler settings. They can be enabled by
-ko compiler switch
+ added optimizations for numeric values and + operator which uses
standard mathematical + behavior for real numbers:
a + b + c == a + ( b + c )
a + b == b + a
It's disabled by default and can be enabled by -ko compiler switch.
There are also other similar optimizations which can be added in
this way.
* harbour/include/hbapi.h
* harbour/source/vm/itemapi.c
* harbour/source/vm/fm.c
! fixed redundant call to hb_xrealloc() in string resize operation.
Thanks to Mindaugas for locating it.
* harbour/include/hbthread.h
* harbour/source/vm/thread.c
+ added hb_atomic_set(), hb_atomic_get(), hb_atomic_inc() and
hb_atomic_dec() functions which operates on HB_COUNTER or smaller
type if it's necessary for some platforms which can be access/assign
increment/decrement in MT safe atom operations.
hb_atomic_dec() returns true if counter is 0 after decrementation
* harbour/include/hbatomic.h
! fixed compilation in Linux and OpenWatcom
* harbour/include/hbapiitm.h
* harbour/source/rtl/itemseri.c
+ make hb_itemSerialize() and hb_itemDeserialize() public functions
! fixed serialization items with internal item references
* harbour/source/vm/hvm.c
* release memvars after closing RDDs
* harbour/source/debug/dbgentry.c
! fixed buffer overflow reported by Rodrigo
* harbour/source/vm/macro.c
* harbour/source/compiler/hbmain.c
* formatting
* harbour/include/hbexprb.c
! fixed wrongly recognized functions with HB_I18N_ prefix as
HB_I18N_GETTEXT()
* harbour/include/hbapi.h
* harbour/include/hbstack.h
* harbour/include/hbthread.h
* harbour/source/vm/estack.c
* harbour/source/vm/thread.c
* harbour/source/vm/hvm.c
+ added support for I18N in HVM.
Each thread can have it's own i18n set.
When new thread is created then it inherits i18n set from parent
thread and both uses the same set (please remember about it if you
will want to make some direct modifications on active i18n set
internals).
When thread change active i18n set then it effects only this thread
and new threads which will be create later. It does not change i18n
in other existing threads.
+ added functions to set/get pointer to active i18n set in HVM
void * hb_vmI18N( void )
void hb_vmSetI18N( void * )
* harbour/include/hbapi.h
* harbour/source/rtl/hbi18n.c
+ added i18n module. Now only for internal Harbour usage without support
for optional switching to alternative implementations.
I'll add such functionality later when I will work on native gettext
support.
The following public .prg functions has been added:
HB_I18N_GETTEXT[_STRICT]( <cMsgID> [, <cContext> ] )
-> <cTranslatedMsgID> | <cMsgID>
HB_I18N_NGETTEXT[_STRICT]( <nValue>, <cMsgID> | <acMsgID> ;
[, <cContext> ] )
-> <cTranslatedMsgID> | <cMsgID> | <acMsgID>[ <nIndex> ]
This is minimal support necessary for .prg code which has to exists
in each i18n module working with Harbour.
The following functions had been added as public C API:
PHB_ITEM hb_i18n_gettext( PHB_ITEM pMsgID, PHB_ITEM pContext )
PHB_ITEM hb_i18n_ngettext( PHB_ITEM pNum,
PHB_ITEM pMsgID, PHB_ITEM pContext )
The following functions had been added as private HVM C API:
void hb_i18n_init( void )
void hb_i18n_exit( void )
void hb_i18n_release( void * cargo )
void * hb_i18n_alloc( void * cargo )
They have to be supported by alternative i18n modules
The following functions has been added to manage Harbour i18n
translations sets:
HB_I18N_CREATE()
-> <pI18N>
Creates new empty I18N translation set
HB_I18N_CODEPAGE( [<pI18N>,] [<cNewCP>], [<lBase>], [<lTranslate>] )
-> <cOldCP>
Gets or sets Harbour codepage used by translation set
<pI18N> - I18N translation set,
if it's not given then currently active I18N set is used
<cNewCP> - new CP ID. Must be linked with application
<lBase> - when it's .T. then get/set base massages CP instead of
translated massages CP
<lTranslate> - if it's .T. then translate base (<lBase>==.T.) or
final messages in I18N set from previous CP to
given one. Base messages translation in synced
with context ID translation.
HB_I18N_PLURALFORM( [<pI18N>,] [<cNewForm>|<bNewForm>], [<lBase>] )
-> <cOldForm>|<bOldForm>
Gets or sets plural form used for final or base messages
<pI18N> - I18N translation set,
if it's not given then currently active I18N set is used
<cNewForm> - language ID of plural form, f.e.: "EN", "PL", "LT".
Now only three above are supported. Please add rules
for other languages to source/rtl/hbi18n.c.
<bNewForm> - codeblock used to calculate plural form indexes.
can be used instead of character representation but
it's not storred in serialized I18N set
<lBase> - when it's .T. then get/set base massages plural form
instead of translated massages one.
HB_I18N_DESCRIPTION( [<pI18N>,] [<cNewDescription>] )
-> <cOldDescription>
Gets or sets translation set description. After serialization
up to 32 bytes is stored in header which can be easy used to
determinate type of translation file.
<pI18N> - I18N translation set,
if it's not given then currently active I18N set is used
<cNewDescription> - new description
HB_I18N_ADDTEXT( <pI18N>, <cMsgID>, <cTrans> | <acTrans> [, <cContext> ] )
-> NIL
Adds new message with translation to i18n translation set
<pI18N> - I18N translation set
<cMsgID> - original message
<cTrans> - translated message
<acTrans> - array with translated messages used for plural forms
<cContext> - message context
HB_I18N_SET( [ <pI18N> | NIL ] )
-> <lActive>
Sets given I18N translation set as default one used by
HB_I18N_[N]GETTEXT[_STRICT]() functions or remove translation
set for calling thread when passed parameter is NIL
<pI18N> - I18N translation set
Returns logical value which is .T. when i18n set is active
HB_I18N_SAVETABLE( [<pI18N>] )
-> <cTable>
Returns I18N translation as string item which can be stored
in file or database
<pI18N> - I18N translation set, if it's not given then currently
active I18N set is used
HB_I18N_RESTORETABLE( <cTable> )
-> <pI18N> | NIL
Restores I18N translation set from strin item.
<cTable> - I18N translation set in string representation
On success it returns new <pI18N> set otherwise NIL if <cTable>
is not valid item created by HB_I18N_SAVETABLE() or it's corrupted.
HB_I18N_HEADERSIZE()
-> <nHeaderSize>
Returns size of header used by i18n serialized version
HB_I18N_CHEK( <cTable> | <cHeader> [, @<cDescription> ] )
-> <lValid>
<cTable> - i18n translation set serialized by HB_I18N_SAVETABLE
<cHeader> - header of i18n translation set
( LEFT( <cTable>, HB_I18N_HEADERSIZE() )
<cDescription> - optional parameter passed by reference where
will be sored i18n translation set description
extracted from valid header
Returns logical value indicating if given table or header is
valid serialized by HB_I18N_SAVETABLE() data. It does not
decode the table though it validates size and control sums.
These functions are optional and some future alternative implementations
may not support all of them and/or may provide some other functions.
+ added unofficial .prg function __I18N_HASHTABLE() which allows to
access hash table used by i18n translation set or create new translation
set with given hash table. It's helper functions for developers which
will work on Harbour i18n tools and should not be used by Harbour users.
Unlike original gettext Harbour allows to use language with many
plural forms as base one. In such case programmer should activate
at application startup default i18n translation set with base plural
form valid for base application language, f.e. by:
pI18N := hb_i18n_create()
hb_i18n_pluralForm( pI18N, <cLangID> | <bForm>, .t. )
hb_i18n_set( pI18N )
.prg code example:
#xtranslate _( <x,...> ) => hb_i18n_gettext_strict( <x> )
#xtranslate _N( <x,...> ) => hb_i18n_ngettext_strict( <x> )
proc main()
local pI18N, i
pI18N := hb_i18n_create()
hb_i18n_pluralForm( pI18N, "PL", .t. )
hb_i18n_set( pI18N )
for i := 0 to 30
? i, _N( i, {"grosz", "grosze", "groszy"} )
if i > 0 .and. i % 10 == 0
wait
endif
next
return
In .pot files created during compilation by Harbour with -j option
for above code we have the following entries for message with plural
forms:
msgid "grosz"
msgid_plural "grosze"
msgid_plural2 "groszy"
msgstr[0] ""
The msgid_plural2 (and others if language has more plural forms)
is Harbour extension which is not gettext compatible.
The above implementation is base version but should be fully functional.
Now we will need functions to safe/read i18n files and tools to mange
.pot files: merge them, edit translations, create final binary i18n
translation sets. Because we are using gettext compatible .pot files
then for some of such jobs we can use original gettext tools but we
need at least function which will create translation set from one or
more .pot files.
We should also agree some default localization(s) for files containing
translated data, their name convention and environment variable(s)
to set default language. It's not strictly necessary and each user
can have his own implementation but it would help in adding new
translations by final users to any Harbour application which will
respect them. We can use LANG envvar to extract preferred language
and use the same path as executed application looking for files
<appname>-<lang>.hil files though it may create some problems for
OSes which support only 8.3 file names so we can also define that
HB_I18N envvar has higher priority and points to expected translation
file.
* harbour/include/hbextern.ch
- removed old __i18n_*() functions
+ added current i18n functions
* harbour/contrib/xhb/Makefile
* harbour/contrib/xhb/common.mak
+ harbour/contrib/xhb/xhbarr.c
+ added aSplice(), aRemove() and aMerge() functions - code borrowed
from xHarbour by Ron Pinkas.
! fixed GPF trap in these functions
* harbour/contrib/xhb/xhbfunc.c
+ added CSTR()
* harbour/contrib/xhb/hbcompat.ch
! changed name of xHarbour include files - they where changed few
months ago and now they are the same as in Harbour.
To xHarbour users: please update hbcompat.ch in xHarbour CVS
* harbour/contrib/xhb/filestat.c
! fixed UNICODE compilation
* harbour/contrib/xhb/hblognet.prg
* harbour/contrib/xhb/hblog.prg
* formatting
* harbour/contrib/hbnf/tempfile.prg
! do not use HB_ISBYREF() .prg function - this function does not
exist in Harbour and does not work correctly in xHarbour
* harbour/include/hbapiitm.h
* harbour/source/vm/macro.c
* harbour/source/vm/codebloc.c
* harbour/source/vm/hashes.c
* harbour/source/vm/garbage.c
* harbour/source/vm/itemapi.c
* harbour/source/vm/memvars.c
* cleanup
* harbour/contrib/gtwvg/Makefile
! fixed typo
* harbour/contrib/gtwvg/hbgtwvg.ch
* added new line at the end of file and changed non ANSI C // comments
to /* */ - this file is included by C code too.
* harbour/contrib/gtwvg/wvgwin.c
* harbour/contrib/gtwvg/wincallb.c
* pacified some warnings and fixed possible access to uninitialized data
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
! fixed possible double freeing of memory blocks in #line directives
TOMERGE[1.0]
* harbour/common.mak
* harbour/source/compiler/hbmain.c
+ harbour/source/compiler/compi18n.c
* moved hb_compI18n*() functions to separate file covered by GPL with
Harbour exception - Thank to Mindaugas
* harbour/include/hbcomp.h
* harbour/include/hbcompdf.h
* harbour/include/hbexpra.c
* harbour/include/hbexprop.h
* harbour/include/hbexprb.c
* harbour/source/common/expropt1.c
* harbour/source/compiler/Makefile
* harbour/source/compiler/ppcomp.c
* added support for plural forms:
hb_i18n_ngettext[_noop|_strict]( <nExp>, <cText> | <acText> ;
[, <cContext> )
<acText> is accepted only as array of literal strings even if
_strict suffix is missing - if it's a problem then we can change it.
hb_i18n_ngettext_noop() is reduced only when it has valid parameters
The default plural index expression used for reduction at compile
time is: iif( <nExp> == 1, 1, 2 )
If second parameter of hb_i18n_ngettext_noop() is <cText> or <acText>
length is 1 then it's reduced to <cText> or acText[1] else if second
parameter is <acText> with more then 1 item then it's reduced to
<acText>[ iif( <nExp> == 1, 1, 2 ) ]
and if <nExp> is literal numeric expression is farther reduced to
given array item. Otherwise is not reduced and warning is generated.
The plural forms in .pot files are generated as:
msgid ""
msgid_plural ""
msgid_plural2 ""
[...]
msgid_pluralN ""
msgstr[0] ""
Then real message ID is only msgid (with context if any) and
msgid_plural* is used only for information. When the same msgid
is used more then once in different hb_i18n_ngettext*() calls then
plural messages are merged.
Please remember that for strict gettext compatibility only two plural
forms are allowed.
* extended i18n warnings for simple types validation, f.e.:
hb_i18n_gettext( .t. )
* do not generate empty .pot file when source code does not contain any
hb_i18n_*() functions
* store in .pot files references to real source file names with paths
respecting #include directives
* use hb_compIdentifierNew() to hash i18n messages at compile time
! fixed possible bad escape encoding of i18n strings
+ added support to control -j[01] flag using #pragma directive
Before I'll begin to work on runtime support please test these
modifications and inform me about problems you can see with the
above version and missing functionality.
* harbour/include/hbexprb.c
! fixed possible GPF/internal memory corruption in code like:
? HB_I18N_GETTEXT_NOOP( "Ala ma kota" + " !!!" )
Mindaugas, the fix is also the answer for the question you left
in TODO.
* harbour/contrib/hbw32/dllcall.c
* minor cleanup in return values
* harbour/contrib/hbole/ole2.c
* cleaned casting in UNICODE conversions
* harbour/source/common/expropt2.c
* replicate CA-Cl*pper compile time optimization bugs:
"" $ <literString> => .T.
AT( "", <literString> ) => 1
CHR( 256 ) => ""
only when Harbour extensions (-kh) are not enabled, f.e.
in strict Clipper compatibility mode (-kc)
* harbour/utils/hbtest/rt_hvma.prg
* harbour/utils/hbtest/rt_str.prg
* updated to test Clipper and Harbour compile time modes in
the above situations
* harbour/common.mak
* harbour/source/rtl/Makefile
- harbour/source/rtl/strings.c
* harbour/source/common/hbstr.c
* moved hb_strEmpty() from RTL to COMMON library
* harbour/include/hbexprb.c
* harbour/include/hbexprop.h
* harbour/source/common/expropt2.c
+ added compile time optimization for EMPTY() function
; removed 'TODO: empty optimization' note
* harbour/source/rtl/itemseri.c
% compress trailing spaces during string item serialization
* harbour/include/hbapi.h
* harbour/source/vm/hashes.c
+ added hb_hashAddNew() - works like hb_hashAdd() but it adds item
only if new key is used
* harbour/source/vm/hvm.c
* use hb_hashAddNew() instead of hb_hashAdd() for HB_P_HASHGEN
I cannot revert the order of hash item during compilation because
it will also change the order of user expression evaluation.
* harbour/source/common/hbwince.c
! fixed typo in GetDriveTypeA()
* temporary disabled GetDriveTypeW() call because not all CRTLs for
WinCE support it
* harbour/include/hbexpra.c
* harbour/include/hbexprb.c
* harbour/source/common/expropt2.c
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
* added full expression list stripping - it enables optimizations
in few additional places
! fixed code to always refresh expression address after direct or
indirect reduction - seems that we have some memory leaks and
possible GPFs not located so far
Please make tests with your code.
* harbour/include/hbexprb.c
! do not optimize HB_BIAND(), HB_BITOR() and HB_BITXOR() when only
one parameter is passed to keep RT error compatibility
* use hb_compExprListStrip() to optimize function calls also when
parameters are passed in parenthesis, f.e.:
? CHR(65), CHR((65))
It's not Clipper compatible and disabled by -kc switch.
Viktor it will interact with some hbtest tests when compile time
optimization used by Clipper gives different results then RT function
f.e. CHR( ( 256 ) ). Please think if we should keep it.
It's important optimization if someone uses constant values or
expressions defined in parentheses.
* harbour/include/hbexprop.h
* harbour/include/hbexprb.c
* harbour/source/common/expropt2.c
+ added hb_compExprReducePower() and compile time optimization for:
<NumConst1> ^ <NumConst2>
+ added compile time optimization for:
<NumConst1> % <NumConst2>
when <NumConst1> or <NumConst2> is not integer value
NOTE: both optimizations are not Clipper compatible and disabled
when -kc compiler switch is used
* harbour/include/hbclass.ch
! removed:
MESSAGE <msgName> IS <mthName>
used as synonym of:
MESSAGE <msgName> METHOD <mthName>
If someone was using the removed version then please update the
code to MESSAGE ... METHOD ...
The removed command has special meaning in Class(y) and it allow
to define alternate names for existing messages. I'll add support
for them in the future.
* harbour/contrib/hbct/ctwin.c
* added disabled code which is a workaround for some possible
bad side effect caused by online shadow showing by CTWIN.
* harbour/source/rtl/errorint.c
! fixed displaying internal error message
* harbour/source/common/hbver.c
* added "Rev." prefix to shown revision number
* harbour/include/hbexprop.h
* harbour/include/hbexprb.c
* harbour/source/common/expropt1.c
* harbour/source/common/expropt2.c
+ added hb_compExprReduceNegate()
! fixed wrong negate optimizations for platforms where HB_LONG_MAX
is smaller then -HB_LONG_MIN, f.e. all x86 based CPUs.
! fixed setting the size in optimized negative numbers
! fixed some math optimizations to not use casting to double value
when it's not necessary - when double precision is smaller then HB_LONG
(f.e. on x86 it's 53 bits and HB_LONG has 64bit) such casting can damage
up to 11 less significant bits in big 64 bit numbers.
* harbour/source/rtl/hbinet.c
* replaced MAKEWORD() macro with HB_MKWORD() to pacify BCC58 warnings
* harbour/include/hbdefs.h
+ added #include <limits.h>
It should hide some warnings related to redefined integer size constants
Viktor if it will not help for BCC58 warnings then you will have to add
#include <stdint.h>
few lines below but please remember that older BCC version does not
have it so check for the exact compiler version.
! changed macros which setting default numeric item size for more strict
Clipper compatible mode. I'm not a fun of some Clipper behavior in
calculating number size and I left some notes about it in hbdefs.h
Anyhow this and some other modifications below should cover the
differences you've found recently. Some things are not addressed by
me intentionally, f.e. _itemPutNL() in Clipper always set size to 10
without checking the maximum size so it's too small for values less
then -999999999. Harbour compiler makes more compile time optimizations
then Clipper. The formatting rules used by compiler are a little bit
different then by VM so this can be source of some other differences
to Clipper. I can easy create some examples. Harbour supports 64bit
signed integers and Clipper doesn't. This is yet another situation
when we may have different results then Clipper. Most of them can
be hidden if we add new PCODE(s) for integer number with explicit
size but I do not think it's such important to increase PCODE list.
In few cases it will be necessary to disable some optimizations at
all and I do not like it. In the future when I will be adding some
new optimizations I also add compiler switch to disable/enable
optimizations which can have such side effects for people who need
strict formatting.
* harbour/include/hbvmpub.h
* harbour/source/common/hbstr.c
* harbour/source/vm/hvm.c
* harbour/source/vm/itemapi.c
* harbour/source/rtl/round.c
* updated for more Clipper compatible number formating using new macros
* harbour/include/hbcomp.h
* harbour/include/hbmacro.h
* harbour/include/hbexprb.c
* harbour/source/vm/macro.c
* harbour/source/compiler/hbmain.c
! fixed name conflict in privates/publics declaration.
Harbour allows to declare memvars with the same name as file
wide statics or fields but this extensions was not working well
in some cases and can cause unexpected results in variable
declaration, f.e. try this code:
static v:="static"
proc main()
public v:="public"
? v, M->v
return
compiled with -n -w switches and also with -n -w -a before
this fix.
! fixed some compile time warnings in memvars declaration to be
more Clipper compatible
! fixed compiling external modules (DO <procname> [WITH <params,...>])
when function <procname> is already declared but with different
letter case. Harbour does not convert <procname> in DO statement
to upper case to play well with case sensitive file systems and
it could cause confusing warning message:
Cannot open <procname>.prg, assumed external
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
! added protection against bug in bison destructors which might cause
multiple free the same memory block on syntax error due to
* harbour/source/rdd/dbf1.c
! added missing binary flag for daytime fields
* harbour/source/rdd/dbfntx/dbfntx1.c
! fixed possible memory leak during accessing corrupted NTX files
! fixed possible GPF during accessing corrupted NTX files
* harbour/source/compiler/genc.c
* minor cleanup
* harbour/config/os2/global.cf
! use FOR command to delete group of files
* harbour/harbour.spec
* harbour/harbour-ce-spec
* harbour/harbour-w32-spec
* updated for new library names
* harbour/ChangeLog
* harbour/include/hbexprb.c
* formatting
* harbour/source/rtl/net.c
! fixed casting
* harbour/harbour.spec
* harbour/harbour-ce-spec
* harbour/harbour-w32-spec
* harbour/contrib/Makefile
* removed hbzlib - it cannot be longer part of default build
because Viktor removed zlib header files. Viktor sorry but
IMHO you should revert it and also restore ace.h - it creates
serious problems without any valuable addition. Now we will
have to rebuild Harbour on many different platforms and often
it will not be possible to install some libraries. We cannot
force installing additional libs by people who will create
binaries for incoming releases so it's important to revert
it. Please do it.
* harbour/config/bsd/install.cf
* harbour/config/darwin/install.cf
* harbour/config/hpux/install.cf
* harbour/config/linux/install.cf
* harbour/config/sunos/install.cf
* harbour/config/dos/install.cf
* harbour/config/os2/install.cf
* harbour/config/w32/install.cf
* redirected echo error messages to stderr when *sh shell is used
* harbour/config/lib.cf
* harbour/config/bin.cf
* harbour/config/global.cf
* harbour/config/hpux/gcc.cf
* harbour/config/hpux/global.cf
* harbour/config/darwin/gcc.cf
* harbour/config/darwin/global.cf
* harbour/config/dos/owatcom.cf
* harbour/config/dos/global.cf
* harbour/config/dos/rsx32.cf
* harbour/config/global.cf
* harbour/config/linux/owatcom.cf
* harbour/config/linux/global.cf
* harbour/config/os2/gcc.cf
* harbour/config/os2/global.cf
* harbour/config/sunos/gcc.cf
* harbour/config/sunos/global.cf
* harbour/config/bsd/global.cf
* harbour/config/w32/owatcom.cf
* harbour/config/w32/bcc32.cf
* harbour/config/w32/gcc.cf
* harbour/config/w32/rsxnt.cf
* harbour/config/w32/global.cf
! fixed build process. DOS and WINDOWS users should make tests for
different compilers. I tested only DOS-OpenWatcom, DOS-DJGPP,
W32-BCC32, W32-OpenWatcom, W32-POCC, W32-XCC and corss builds
W32-MinGW, W32-MinGW-CE. OS2 version not testes at all - I hope
it will work. LINUX-GCC, LINUX-G++, LINUX-OpenWatcom, BSD-GCC,
HPUX-GCC tested and they are working. I hope that SunOS version
also works though I do not have any solaris installation where
I can make real tests.
* harbour/include/hbapiitm.h
* harbour/source/vm/itemapi.c
+ added new functions:
BOOL hb_itemParamStore( USHORT uiParam, PHB_ITEM pItem )
BOOL hb_itemParamStoreForward( USHORT uiParam, PHB_ITEM pItem )
They copy/move pItem body to parameter passed by reference and
return TRUE when operation was done successfully (uiParam was passed
by reference)
+ added new functions for string manipulation:
char * hb_itemLockReadCPtr( PHB_ITEM pItem, ULONG * pulLen );
char * hb_itemLockWriteCPtr( PHB_ITEM pItem, ULONG * pulLen );
void hb_itemUnLockCPtr( char * pszString );
It's recommended to use them instead of hb_itemGetCPtr().
Pointer to string buffer returned by hb_itemLockReadCPtr() will
be always valid even if source item will be cleared, destroyed or
overwritten until hb_itemUnLockCPtr() is called. Each locked string
has to be unlocked to avoid memory leaks. After unlocking the string
pointer cannot be longer used.
hb_itemLockWriteCPtr() works like hb_itemLockReadCPtr() but string
pointer returned by this function is writable so user can change
the body of string item. It's the _ONLY_ one way when it's possible.
Modifying string items using pointers returned by hb_parc() or
hb_itemGetCPtr() or extracted directly from HB_ITEM body is _FORBIDDEN_
and can cause unpredictable results (GPF when constant/readonly memory
pages are changed, changing many different items which share the same
memory buffer, etc.).
This is code illustrates how to use hb_itemLockReadCPtr()/
hb_itemUnLockCPtr() and it's also good example why hb_itemGetCPtr()
is very danger function and cannot be used in such case - if you
replace hb_itemLockReadCPtr() with hb_itemGetCPtr() and remove
hb_itemUnLockCPtr() then you will have buggy code.
HB_FUNC( MYFUNC )
{
PHB_ITEM pObject = hb_param( 1, HB_IT_OBJECT )
if( pObject )
{
char * pszName1, * pszName2;
PHB_ITEM pResult;
pResult = hb_objSendMsg( pObject, "POP", 0 );
pszName1 = hb_itemLockReadCPtr( pResult, NULL );
pResult = hb_objSendMsg( pObject, "POP", 0 );
pszName2 = hb_itemLockReadCPtr( pResult, NULL );
if( pszName1 && pszName2 )
hb_retc_buffer( hb_xstrcpy( NULL,
"[", pszName1, "]-[", pszName2, "]", NULL ) );
hb_itemUnLockCPtr( pszName1 );
hb_itemUnLockCPtr( pszName2 );
}
}
This code shows how to use hb_itemLockWriteCPtr():
proc main()
local cVal, cVal2
cVal := cVal2 := "ABC"
STRPUT( @cVal2, 2, 42 )
? cVal, cVal2
return
#pragma begindump
#include "hbapiitm.h"
HB_FUNC( STRPUT )
{
PHB_ITEM pString = hb_param( 1, HB_IT_STRING );
ULONG ulAt = hb_parnl( 2 );
if( pString && ulAt && ISNUM( 3 ) )
{
ULONG ulLen;
char * pszValue;
pszValue = hb_itemLockWriteCPtr( pString, &ulLen );
if( pszValue )
{
if( ulAt <= ulLen )
pszValue[ ulAt - 1 ] = ( char ) hb_parni( 3 );
hb_itemUnLockCPtr( pszValue );
}
}
}
#pragma enddump
* harbour/include/hbcompdf.h
* harbour/include/hbexprop.h
* harbour/include/hbexprb.c
* harbour/source/compiler/hbmain.c
* harbour/source/compiler/cmdcheck.c
* harbour/source/compiler/hbusage.c
* removed HB_I18N_SUPPORT macro and enabled I18N code in default build
* harbour/include/hbexprb.c
* harbour/source/compiler/hbmain.c
! added string escaping before to i18n .pot files
+ added hb_i18n_gettext_strict() support for compiler. This function
generates warning if argument is not literal string. See discussion
on mailing list from 2007-11-23 to 2007-11-29, for details.
* harbour/doc/man/harbour.1
* harbour/source/compiler/hbusage.c
+ added description for -j switch
* harbour/include/hbexprb.c
* replaced // comments by /* */
* accept <cContext> (domain) parameters of HB_i18nGettext() when
number of parameters is two or more
Should we generate compile time warning when wrong number of
parameters is passed to this function or they are not literal
strings? Maybe only after -j+ or sth like that?
* harbour/include/hbclass.ch
* harbour/include/tbrowse.ch
* harbour/include/hbpers.ch
* harbour/include/getexit.ch
* replaced // comments by /* */
* harbour/source/include/hbcompdf.h
* harbour/source/include/hbexprop.h
* harbour/source/include/hbexprb.c
* harbour/source/compiler/cmdcheck.c
* harbour/source/compiler/hbmain.c
+ added i18n support
Implemented -j[filename] switch to indicate output filename. Default
filename is <sourcefilename>.pot. If switch -o is used, this file
is created in speficied output path.
Output file format is compatible with 'gettext' utils, but not all
available features are implemented.
Harbour level function HB_i18nGettext( cText [, cContext ] ) sould be
used to indicate translatable strings.
All this commit is commented using #ifdef HB_I18N_SUPPORT and is in
development stage. Please, do not use it yet.
* harbour/include/hbwince.h
* put functions declarations inside HB_EXTERN_BEGIN / HB_EXTERN_END
+ harbour/include/hbwmain.c
+ added WinMain() to main() wrapper
* harbour/include/hbexprb.c
* harbour/source/common/expropt1.c
! fixed typo reported by Chen
* harbour/source/pp/hbppgen.c
* harbour/source/main/harbour.c
* harbour/utils/hbpp/hbpp.c
* use hbwmain.c when main() is not supported by C compiler/platform
* harbour/source/rtl/gtwin/gtwin.c
* include wincon.h in all builds except LCC
* harbour/source/rtl/fserror.c
* harbour/source/rtl/fstemp.c
* harbour/source/rtl/filesys.c
* use HB_OS_WIN_32_USED as in other files (still on TOFIX list)
* harbour/source/rtl/seconds.c
+ added HB_OS_WIN_32_USED
* harbour/source/compiler/hbcomp.c
! fixed typo: stderr was used instead of stdout
* harbour/doc/destruct.txt
* update description for multiple inherited destructors
* harbour/source/compiler/complex.c
* _HB_CLASS and _HB_MEMBER are not longer reserved words
* harbour/include/hbclass.ch
* harbour/include/hbexprop.h
* harbour/include/hbexprb.c
* harbour/source/macro/macro.y
* harbour/source/compiler/harbour.y
* formatting and minor code cleanup
* harbour/source/compiler/hbusage.c
* added missing information about -undef:<id> switch to usage
description
* harbour/source/compiler/gencc.c
! fixed bug reported by Teo in code generated for SWITCH statement
* harbour/source/rtl/errorapi.c
+ added protection against possible GPF when some assign methods
were called without parameters
* harbour/source/rdd/workarea.c
* initialize uiFalgs also when DBS_FLAGS is not set
* harbour/contrib/bmdbfcdx/bmdbfcdx1.c
* fixed hb_cdxSkipFilter() declaration - it should be 'static' function
* harbour/source/pp/ppcore.c
* harbour/source/compiler/ppcomp.c
+ added support for changing all -k? switches by #pragma, f.e.;
#pragma -ks+
#pragma -kM-
#pragma -kx1
#pragma -kJ0
* harbour/source/compiler/hbusage.c
* changed -ks description
* harbour/include/hbexpra.c
* harbour/include/hbexprb.c
* do not generate error message for negative indexes and
[] operators are used for simple types when -ks option
is used
* harbour/include/hbvmpub.h
* harbour/include/hbapi.h
* harbour/source/vm/hvm.c
* harbour/source/vm/extend.c
* harbour/source/vm/itemapi.c
* harbour/source/vm/memvars.c
+ added HB_IT_DEFAULT flags - it allows to check if item was changed
* harbour/source/vm/memvars.c
* harbour/include/hbvm.h
! fixed HB_IT_MEMOFLAG updating to be Clipper compatible. Here we are
not Clipper compatible in one place: in clodeblock local parameters
with memo values are marked as MEMO but if you leave function where
codeblock were created then Clipper during detaching removes MEMO
flag. In Harbour memo flag is kept.
* harbour/include/hbvm.h
* harbour/source/vm/classes.c
* harbour/source/vm/hvm.c
% improved speed of extended references used for SETGET methods
and overloaded [] operators
* harbour/include/hbapi.h
* harbour/include/hbsetup.ch
* harbour/source/compiler/hbcomp.c
* harbour/source/vm/hvm.c
* harbour/source/vm/macro.c
* harbour/source/vm/cmdarg.c
* removed HB_COMPAT_XHB flags - only one HB_COMPAT_XHB still exist
in HVM in hashes.c - it will be removed soon.
* harbour/source/common/hbverdsp.c
* removed information about xHarbour compatibility mode - it's not
longer used. We are emulating xHarbour behavior using external
XHB library and standard compiler/HVM features
* harbour/contrib/xhb/xhb.ch
* harbour/contrib/xhb/xhbfunc.c
* harbour/source/vm/arrayshb.c
* moved XHB_AINS(), XHB_ADEL() from XHB lib to HVM as HB_AINS(), HB_ADEL()
* harbour/contrib/xhb/xhb.ch
+ added #pragma -ks+
+ added transaltion for hb_enumindex( <enumvar> )
+ harbour/contrib/xhb/xhbenum.c
+ added emulation for HB_EUMMINDEX()
* harbour/contrib/xhb/xhbfunc.c
* do not add INET*() function wrappers for DOS builds or when
HB_NO_DEFAULT_INET macro is set
* harbour/contrib/xhb/xhbmsgs.c
* added comment
* harbour/contrib/Makefile
+ added TIP and XHB
* harbour/make_rpm.sh
* harbour/harbour.spec
* removed HB_COMPAT_XHB, --with tip, --with xhb
they are not longer necessary
* harbour/include/hbexprb.c
* respect -ks in macrovars and array item references
* harbour/source/vm/memvars.c
* do not detach array items during detaching enumerator variable
also in standard (without HB_COMPAT_XHB) build
* harbour/include/hbapi.h
* harbour/source/vm/itemapi.c
* harbour/source/vm/garbage.c
+ added extended item references - it's universal reference which
can be used by HVM for many different things without introducing
new item types
* harbour/include/hbexprb.c
* respect -ks compiler also with <op>=, --, ++ operators
* harbour/include/hbvm.h
* harbour/source/vm/hvm.c
* harbour/source/vm/classes.c
+ added extended references for SETGET methods used as object
item references
* use extended references to respect overloaded [] operator in
object item references
+ added support for passing indexes to string item characters
( @cValue[n] ) by reference using extended references - extension
enabled by -ks compiler switch and //flags:s RT switch.
+ added hb_vmPushItemRef()
* harbour/source/rdd/dbf1.c
* harbour/source/rdd/usrrdd/usrrdd.c
* use hb_vmPushItemRef()
* harbour/contrib/xhb/xhbcomp.prg
* harbour/contrib/xhb/xhbmsgs.c
* overload +, -, *, %, ^, ++, -- in string and numeric scalar
classes to emulated xHarbour behavior when 1 byte string is
used as numeric value.
Note: <nun> + <char1> in XHB lib gives numeric value when in
xHarbour character. But because <nun> <anyOtherOper> <char1>
in xHarbour gives numeric value then I guess that it's
xHarbour bug and I should not replicate it, f.e.:
proc main()
? 1+"A", 131-"A", 33 * 2, 132 / chr(2), 133 % "C"
return
* overload +, - in hash scalar class to emulated xHarbour behavior
for <hash> + <hash> and <hash> - <hash>
Seems that now we can remove HB_COMPAT_XHB flag from HVM and keep
Harbour compatibility only with -ks compile time switch and XHB
library. Please make some tests with Harbour compiled without
HB_COMPAT_XHB and xHarbour code using REQUEST XHB_LIB. It's possible
that I missed sth but some basic test shows that our emulation is
better then original and addresses places where xHarbour does not
work at all or gives strange results, f.e.:
#ifndef __XHARBOUR__
request XHB_LIB
#endif
proc main()
local h:={"ABC"=>123.45}
? h:abc
h:abc+=1000 ; ? h:abc
h["ABC"]+=1000; ? h:abc
p(@h:abc) ; ? h:abc
p(@h["ABC"]) ; ? h:abc
return
proc p(x)
x+=1000
return
or:
#ifndef __XHARBOUR__
request XHB_LIB
#endif
#include "hbclass.ch"
proc main()
local o:=myClass():new()
o:setget:="ABC"; ? o:setget
o:setget[2]:=42; ? o:setget
o:setget[2]+=42; ? o:setget
? o:setget[2]+=42; ? o:setget
?
o:var:="ABC"; ? o:var
o:var[2]:=42; ? o:var
o:var[2]+=42; ? o:var
? o:var[2]+=42; ? o:var
return
CREATE CLASS myClass
VAR var
METHOD setget SETGET
END CLASS
METHOD setget( xNewVal ) CLASS myClass
IF pcount() > 0
::var := xNewVal
ENDIF
RETURN ::var
* harbour/include/hbapirdd.h
* harbour/source/rdd/dbcmd.c
* harbour/source/rdd/workarea.c
* harbour/source/rdd/dbf1.c
* harbour/source/rdd/dbffpt/dbffpt1.c
* harbour/source/rdd/dbfcdx/dbfcdx1.c
* harbour/source/rdd/dbfdbt/dbfdbt1.c
* harbour/source/rdd/usrrdd/usrrdd.c
* harbour/contrib/rdd_ads/ads1.c
* changed second parameter in RELTEXT() method to PHB_ITEM
Now RELTEXT() works like FILTERTEXT() and the size of
expression is not limited. It's a modification I wanted
to make for a long time and I think that now is a good
moment to make it together with HB_FT_* modifications
- rmoved not longer necessary HARBOUR_MAX_RDD_RELTEXT_LENGTH
* harbour/source/rtl/gttrm/gttrm.c
* small cleanup
* harbour/include/hbexprb.c
* do not generate error for QSELF()[...] - Clipper allows such
operation and because some valid Clipper code needs it then
I disabled error message.
* harbour/common.mak
* harbour/source/rtl/Makefile
+ harbour/source/rtl/einstvar.prg
+ added undocumented CA-Cl*pper function _eInstVar() used to validate
variable type in assign messages.
* harbour/include/hbapi.h
* harbour/source/vm/arrays.c
* changed 'char *' to 'const char *' in hb_arraySetC() and hb_arraySetCL()
* harbour/source/rdd/dbcmd.c
* cleaned DBSKIPPER() code
* harbour/source/rtl/browdb.prg
* use written in C DBSKIPPER() function instead of static .prg Skipped()
when HB_COMPAT_XPP macro is enabled
* harbour/source/rtl/browse.prg
! fixes in BROWSE() function:
! displaying box characters
+ added CL53 compatible mouse actions
+ added mouse wheel actions
+ added support for deleting records (K_DEL)
+ added support for edit mode
+ added support for append mode
* harbour/include/hbexprb.c
* disable CTOD("") optimization when -kc switch is used
* harbour/source/macro/macro.yyc
* harbour/source/macro/macro.y
* fixed typo reported by Mindaugas
* harbour/source/vm/classes.c
* fixed typo reported by Lost
* harbour/contrib/hbzlib/include/stdafx.h
* harbour/contrib/hbzlib/include/ziparchive.h
* cleaned some warnings
* harbour/include/hbexprb.c
* harbour/include/hbexprop.h
* harbour/source/common/expropt2.c
* restored Mindaugas code for UPPER optimization and added logic to
optimize UPPER for strings with only Latin letters, digit and spaces
just like in Clipper. Now code like:
? Upper( chr(65)+chr(66)+chr(67)+"0123 QWE asd " ) + "ZXC"
is fully optimized at compile time to single string expression.
% optimized hb_compExprReduceCHR() by eliminating memory allocation
for new string
! fixed typo in my previous commit
* harbour/include/hbexprop.h
* harbour/include/hbexprb.c
* harbour/source/common/expropt2.c
* added UPPER("") optimisation. The side effect of this modification
is that Harbour becomes Clipper bug compatible in calculation of
AT(UPPER(""), "test"). Though this optimisation does not introduce
any buggy behaviour itself.
* harbour/include/hbcompdf.h
* harbour/include/hbexprb.c
* harbour/source/common/expropt1.c
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
* harbour/source/macro/macro.y
* harbour/source/macro/macro.yyc
! fixed bug in operator precedence - seems that it existed from
beginning and partially were fixed in xHarbour. This code exploits
the problem:
#define EOL chr(13)+chr(10)
#command ? [<x,...>] => [outstd( <x> );]outstd(EOL)
#command TEST <exp> => BEGIN SEQUENCE ;
; ? <exp> ;
; RECOVER USING oErr ;
; ? "Error:", oErr:subCode, ;
oErr:description, oErr:operation ;
; END
proc main()
local oErr, s1:="X", s2:="Y", t:=.T.
errorBlock({|oErr|break(oErr)})
TEST t != s1 $ s2
TEST t == s1 $ s2
TEST t = s1 $ s2
TEST t < s1 $ s2
TEST t <= s1 $ s2
TEST t > s1 $ s2
TEST t >= s1 $ s2
TEST s1 $ s2 != t
TEST s1 $ s2 == t
TEST s1 $ s2 = t
TEST s1 $ s2 > t
TEST s1 $ s2 < t
TEST s1 $ s2 >= t
TEST s1 $ s2 <= t
return
* harbour/include/hbcomp.h
* harbour/include/hbexpra.c
* harbour/include/hbexprb.c
* harbour/include/hbexprop.h
* harbour/include/hbpp.h
* harbour/source/compiler/complex.c
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
* harbour/source/compiler/harbour.yyh
* harbour/source/compiler/hbmain.c
* harbour/source/pp/ppcore.c
+ added support for extended multiline codeblocks:
{ |<params,...>| <EOL>
<statement1>
...
<statementN>
return <val>
}
Such codeblocks allow nested definitions. They can also have their
own variable declarations (local, static, field, memvar, parameters,
private, public) and visibility of declared variables is similar to
nested function in Pascal but please note that there is one limitation
which exists also for normal codeblocks (Clipper compatible behavior):
internal codeblock local parameters and local variables cannot be
used in nested codeblocks, f.e. such code:
eval( { |p| eval( {|| qout( p + 1 ) } ) } )
is illegal in Clipper and Harbour. This limitation also can be
eliminated but but it will be necessary to make deeper modifications
in code for local detaching changing the method of generating
codeblocks local variables in nested blocks so unlike the above
also some modifications in HVM will be necessary.
Please test.
* harbour/include/hbcomp.h
* harbour/include/hbcompdf.h
* harbour/include/hbexpra.c
* harbour/include/hbexprb.c
* harbour/source/compiler/complex.c
* harbour/source/compiler/genc.c
* harbour/source/compiler/gencli.c
* harbour/source/compiler/genobj32.c
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
* harbour/source/compiler/harbour.yyh
* harbour/source/compiler/hbmain.c
* changed code used for variable scoping - now it's much more
simple (only one function) and allows to use declarations in
nested functions/codeblocks with visibility similar to Pascal
! fixed parsing FILED <fields,...> IN <alias>
we were accepting code like:
FIELD f1, f2 IN db1, f3 IN db2 IN db3
and for all fields the last alias (db2 in this example) was used
! fixed calculating number of static variables with -b (debugger)
compilation (number of file wide statics were doubled)
! fixed generation of static variable names for debugger when declared
with array dimensions, f.e.:
static sVar[3]
* harbour/source/rtl/hbffind.c
* minor cleanup *nix version
* harbour/contrib/bmdbfcdx/bmdbfcdx1.c
! fixed casting for C++ compilation
* harbour/source/rdd/dbfdbt/dbfdbt1.c
* updated for some old API modifications (this library is not used now
but if we keep it in CVS then I think it should be updated)