* *
* partial sync with the 3.4 fork codebase. These are the things
synces for the most part:
- copyright headers
- grammar/typos in comments and some readmes
- comment/whitespace/decorations
- variable scoping in C files
- DO CASE/SWITCH and some other alternate syntax usage
- minimal amount of human readable text in strings
- minor code updates
- HB_TRACE() void * casts for pointers and few other changes to
avoid C compiler warnings
- various other, minor code cleanups
- only Harbour/C code/headers were touched in src, utils, contrib,
include. No 3rd party code, no make files, and with just a few
exceptions, no 'tests' code was touched.
- certain components were not touched were 3.4 diverged too much
already, like f.e. hbmk2, hbssl, hbcurl, hbexpat
- the goal was that no actual program logic should be altered by
these changes. Except some possible minor exceptions, any such
change is probably a bug in this patch.
It's a massive patch, if you find anything broken after it, please
open an Issue with the details. Build test was done on macOS.
The goal is make it easier to see what actual code/logic was changed
in 3.4 compared to 3.2 and to make patches easier to apply in both
ways.
* src/harbour.def
! add hb_rand*() functions, fixing hbtip regression (#154) after
1938dd0a70
; import of 2014-12-10 14:38 UTC+0100 functions from Viktor's 3.4 fork
* src/rtl/hbrand.c
! hb_randStr(): fixed possible GPF and other errors when passing
negative size
* include/harbour.hbx
* include/hbapi.h
* src/rtl/hbrandom.c
+ added C level hb_random_num_secure() which works like hb_random_num()
but uses arc4 internally
+ added hb_randInt() which works the same as hb_RandomInt() but uses
arc4 internally
+ added hb_randNum() which works the same as hb_Random() but uses
arc4 internally
* include/hbapi.h
* include/hbvmpub.h
* removed casting C style casting from commonly used macros
* contrib/gtqtc/gtqtc1.cpp
* use C++ casting instead of C casting
* contrib/rddads/ads1.c
* contrib/rddads/adsx.c
* contrib/rddsql/sqlmix.c
* src/rdd/dbfcdx/dbfcdx1.c
* src/rdd/dbfnsx/dbfnsx1.c
* src/rdd/dbfntx/dbfntx1.c
* src/rdd/dbsql.c
* src/rdd/workarea.c
* cleaned HB_IT_* usage
* contrib/rddads/ads1.c
! fixed typo in low level code of ordDescend() / DBOI_ISDESC,
now ordDescend() should work with ADS* RDDs just like with
native RDDs
* contrib/hbfoxpro/relfunc.c
! fixed typo in Between() function - thanks to Petr Chorney
* src/rtl/gtwvt/gtwvt.c
! added workaround for keyboard drivers which sets CTRL key modifier
flag when only ALTGR is pressed - thanks to Maurizio la Cecilia
* doc/cmpopt.txt
* enumeration
! typos
* src/codepage/uckam.c
+ added info about Kamenicky codepage number: CP895
* include/hbapi.h
* src/common/hbstr.c
+ added new C function:
char * hb_dblToStr( char * szBuf, HB_SIZE nSize,
double dNumber, int iMaxDec );
it converts numeric value to string trying to keep all significant
digits in double numbers
* include/harbour.hbx
* src/rtl/hbntos.c
+ added new PRG function:
hb_ntoc( <nValue> ) -> cValue
it converts numeric value to string trying to keep all significant
digits in double numbers
* src/rtl/hbsocket.c
+ added support for error codes returned by
getaddrinfo() / getnameinfo() and gethostbyname() / gethostbyaddr()
* src/rtl/hbinet.c
+ set HB_SOCKET_ERR_WRONGADDR error code if hb_socketResolveAddr()
returns NULL without setting error code
* src/vm/arrays.c
* src/vm/hashfunc.c
! fix hb_HScan(), AScan(), hb_AScan() and hb_RAScan() for very large
integers with more then 53 significant bits. Such bits were lost
after conversion to double value used in scan process
* src/vm/itemapi.c
* formatting
* src/rtl/gtwvt/gtwvt.c
! do not convert characters received with ALTGR or ALT+CTRL flags to
extended keycodes - some national keyboards may use such combination
for national characters and even pure ASCII ones
* *
% remove brandings and homepage [1] from copyright header. Pass 1 - using script.
[1] nobody has access to it anymore AFAIK - and it's also just
a redirect since long
! update url in copyright header
; this should make the diff between 3.4 and 3.2 easier to manage
* include/hbapi.h
* src/vm/garbage.c
+ added hb_gcDummyClear() function
* include/hbapirdd.h
* include/hbusrrdd.ch
+ added DBTF_CPYCTR constant value - when set in dbTransInfo.uiFlags
then after record transfer field counters should to be copied from
source to destination area
* include/hbapirdd.h
* src/rdd/wafunc.c
+ added new C functions hb_dbTransInfoPut() and hb_dbTransInfoGet()
which allow to store and retrieve pointer to DBTRANSINFO structure
into/from HB_ITEM with strict type verification.
* src/rdd/wafunc.c
* pass pointer to DBTRANSINFO structure as argument of DBI_TRANSREC
action. It allows RDD serving destination area to decide which
fields and how should be transferred updating uiFlags, uiItemCount
and lpTransItems members of DBTRANSINFO.
If RDD removes all fields from DBTRANSINFO structure (uiItemCount==0)
or does not return HB_SUCCESS for DBI_TRANSREC action (default WA
implementation returns HB_SUCCESS so it's not necessary to overload
it if RDD does not make any additional operations) then record
transfer is interrupted.
* copy field counters only when destination area asked about it setting
DBTF_CPYCTR in dbTransInfo.uiFlags in DBI_TRANSREC action.
* src/rdd/dbf1.c
* do not copy automatically updated fields when destination area
is not empty
* set DBTF_CPYCTR to indicate that counters should be copied from
source to destination area when original value of automatically
updated fields are transferred
; Now DBF* RDDs in Harbour respects the following rules for record
transfer operations (COPY TO / APPEND FROM) with automatically
updated fields:
- COPY TO transfers original values to destination table and
finally copy counters from the source table to destination one
so autoincrement fields in both tables after next append will be
initialized with the same values regardless of number of copied
records - even if only single record is copied then counters in
destination table will inherit next values for new record from
the source table. Also values of RowVer and ModTime fields are
copied from source to destination table and not updated during
transfer operation.
- APPEND FROM works like COPY TO (original field values and then
counters are copied to destination table) if the source table
supports counters and destination table is empty and FLocked()
or opened in exclusive mode.
If source table does not support counters for given fields, i.e.
it is processed by transfer RDD like DELIM or SDF (RDT_TRANSFER)
or destination table is not empty or opened in shared mode and
FLock is not set when APPEND FROM is executed then automatically
updated fields (counters, RowVer, ModTime) are not copied and
initialized with new values like for each new record added to
destination table.
* ChangeLog.txt
! typo in last ChangeLog entry
* include/hbapi.h
! fixed HB_ISMEMO() macro, original version was accepting the same
items as HB_ISCHAR() so it was not compatible with ISMEMO() macro
in Cl*pper.
* src/rtl/valtype.c
* use HB_ISMEMO() macro
* include/hbapi.h
* src/common/hbstr.c
+ added new function hb_strAtI() - it works like hb_strAt() but it
ignores the case of the ASCII characters
* src/rtl/ati.c
* renamed local static function hb_strAtI() to s_strAtI() to avoid
conflict with new public hb_strAtI() function.
* contrib/xhb/xhbat.c
- removed local static function hb_strAtI() - current public hb_strAtI()
is compatible with it.
* contrib/sddsqlt3/core.c
+ added new code to set column type giving the highest priority SQLITE3
declared column types.
Please test - I haven't made any.
! do not cast floating point values to integer
* contrib/hbwin/hbwin.hbx
* contrib/hbwin/win_prn2.c
! fixed win_printerGetDefault() in Win9x builds - fix and some
formatting and casting borrowed from Viktor's fork.
+ added new PRG function:
win_PrintDataRaw( <cPrinter>, <cData> [, <cDocName>] )
-> <nBytesPrinted>
It's similar to win_PrintFileRaw() but sends to given printer passed
in 2-nd parameter <cData> instead of file body.
On error it returns negative value.
* cleaned casting and minor formatting
* src/rtl/gtxwc/gtxwc.c
+ added support for HB_GTI_DISPIMAGE. It's slightly modified code sent
by Rolf to Harbour devel list. In comparison to original version it
supports <nDepth> as 4-th item of array with bitmap description to use
with some other GTs which can support different color depths or can
make conversion. It also supports bitmaps passed as strings.
% slightly improved HB_GFX_GETPIXEL
* include/hbserial.ch
* src/rtl/itemseri.c
+ added HB_SERIALIZE_IGNOREREF flag.
This flag fully disables logic used to detect multireferences to the
same complex (sub)items like arrays or hashes. It increses the speed
of serialization but serialized data does not contain any information
about refences, i.e. aVal[ 1 ] and aVal[ 2 ] in code below:
aSub := { 1, 2, 3 }
aVal := { aSub, aSub }
are serialized as separated arrays. Additionally items with cyclic
references like:
aSub[ 2 ] := aSub
cannot be serialized at all with HB_SERIALIZE_IGNOREREF flag because
it will create infinite serialization loop and crash with out of
memory message.
* src/rtl/itemseri.c
% rewritten algorithm used to detect cyclic and multi references in
serialized items. The original algorithm has very high overhead when
huge arrays were serialized, i.e. serialization of array with 1'000'000
of subarrays needed about 30 minutes on my i5@3.30GHz. Now it needs
less then a second and this time is only a little bit bigger then
used by serialization with HB_SERIALIZE_IGNOREREF flag.
This modification improve performance also in other code using Harbour
serialization mechanism like I18N files, HBNETIO, GTNET, ... when large
arrays or hashes are saved or transmitted.
* include/hbapi.h
* include/hbapicls.h
* src/vm/arrays.c
* src/vm/classes.c
* src/vm/hashes.c
* src/vm/itemapi.c
* replaced algorithm used to detect cyclic and multi references in
array and hash clone operations with new one similar to current
item serial code. The speed improvement for very large arrays is
the same as in case of serialization code.
* src/rtl/gtsln/mousesln.c
! typo in while loop - synced with Viktor's branch
* src/rtl/filebuf.c
! unlock HVM stack before locking local mutex and calling hb_fs*()
functions which also unlocks HVM. It fixes possible deadlock condition
when hb_gcAll( .T. ) is executed.
* include/hbapi.h
* src/vm/garbage.c
! changed mark function semantic.
Adding support for user defined mark function I created race condition
in MT GC code. It happens because blocks marked as deleted were not
scanned by GC mark code so their subitems where not accessible.
To fix it we have to change mark function semantic. Now mark function
can be executed also for blocks currently deleted. It means that GC
block destructor should clean references to just removed items and
subblocks. The best place to make it is clearing pointers to GC blocks
just after hb_itemRelease() or hb_gcRefFree().
It is save to clean the reference just before hb_itemRelease() or
hb_gcRefFree() but only for the single block passed to these functions.
It is not save to clear reference to more then one block and then
execute above functions.
+ check reference count after destructor execution for all blocks
not only arrays - warning it may exploit some wrong C code.
- removed not longer used hb_gcRefCheck() function.
* include/hbvm.h
* src/vm/hvm.c
+ added new internal function hb_vmLockForce()
! fixed to mark GC blocks with active threads
* src/vm/thread.c
* include/hbthread.h
% modified sync mutexes used by xBase++ signal class emulation
to not use item array internally
* updated mutex destructor to new GC mark semantic
! mark GT items if GT is bound with thread item
! fixed mutex notify/subscribe code to not change GC items
when HVM stack is unlocked
! use hb_vmLockForce() to eliminate potential deadlock
+ added new C function hb_threadEnterCriticalSectionGC().
It should be used instead of hb_threadEnterCriticalSection()
in code which manipulates GC items inside critical section.
It's slower but eliminates possible deadlock condition.
Please remember that remember that both functions cannot
be used for the same mutex. So if it's necessary to use
hb_threadEnterCriticalSectionGC() in one place then it
has to be used in all others when the same mutex is locked.
* src/vm/arrays.c
* src/vm/codebloc.c
* src/vm/hashes.c
* src/rtl/hbgtcore.c
* contrib/hbcurl/core.c
* contrib/hbexpat/core.c
* updated destructors to new GC mark semantic
* contrib/hbxpp/dllx.c
! fixed destructor for pointer item created by DllPrepareCall()
Now it respects reference counter.
; added note about real behavior of library handle destructor,
I haven't changed existing code behavior but maybe it should
be done.
* contrib/xhb/hbserv.c
* src/debug/dbgentry.c
* src/rdd/wacore.c
! fixed possible deadlocks by using hb_threadEnterCriticalSectionGC()
instead of hb_threadEnterCriticalSection().
* contrib/hbmemio/memio.c
! slightly modified hb_memfsDirectory() code to avoid race condition
without using hb_threadEnterCriticalSectionGC()
* src/vm/fm.c
% reduce the lock range in HB_FM_STAT builds
* src/rtl/hbsocket.c
! added missing HVM stack unlocking in hb_socketSelect() function
* src/rtl/gtxwc/gtxwc.c
! added few missing locks for version compiled with HB_XWC_XLIB_NEEDLOCKS
* src/rdd/dbtotal.prg
* allow to use symbols instead of codeblocks
* modified Harbour extension which uses ordKey() as default group
signature to work also without index. In such case all records
are summarized into single one.
; Most of above modifications were critical for stability of MT programs.
They should allow to activate GC in any place.
* include/hbapi.h
* include/hbapigt.h
* include/hbvm.h
* src/rtl/inkeyapi.c
* src/vm/cmdarg.c
* src/vm/hvm.c
* replaced hb_cmdargProcessVM() with hb_cmdargProcess() and removed
unused for long time custom user cancel key functionality.
- removed dummy hb_inkeySetCancelKeys() C function.
- removed not used for long time HVM C functions and macros:
hb_vmFlagEnabled(), hb_vmFlagSet(), hb_vmFlagClear(),
HB_VMFLAG_HARBOUR, HB_VMFLAG_ARRSTR
* include/hbgtinfo.ch
+ added new HB_GTI_* actions:
HB_GTI_WINHANDLE - Get console window low level handle
HB_GTI_MOUSEPOS_XY - Get mouse position in pixels
HB_GTI_DISPIMAGE - Display image with given name
* include/hbapigt.h
* src/rtl/inkeyapi.c
+ added new C function: int hb_inkeyKeyMod( int iKey )
+ added code for translation from extended key codes to
standard Clipper ones
* include/harbour.hbx
* src/rtl/inkey.c
+ added new PRG function hb_keyMod( <nExtKey> ) -> <nModifiers>
It extract keyboard modifiers (HB_KF_*) from extended key code.
* include/hbgtcore.h
* src/rtl/hbgtcore.c
+ added new macros for generating extended key codes with keyboard
modifiers for ASCII and UNICODE characters
% strip repeated extended key codes for mouse move
! use standard key codes in extended ALERT() GT method
* include/inkey.ch
+ added key modifiers/flags for extended key codes: HB_KF_*
+ added extended key codes: HB_KX_*
- removed unused HB_K_MULTICODE macro
* src/rtl/gttrm/gttrm.c
* replaced old keyboard and mouse code with new one using
extended key codes for keyboard and mouse
+ added support for keyboard modifiers in GPM events
+ added support for keyboard modifiers in terminal mouse events
* src/rtl/gtwvt/gtwvt.h
* src/rtl/gtwvt/gtwvt.c
! invert selection region in WinCE builds
! fixed selection in fullscreen or maximized modes with margins
* do not add EOL to one line selections
+ added support for painting box drawing characters.
This mode can be enabled by:
hb_gtInfo( HB_GTI_FONTATTRIBUTE, HB_GTI_FONTA_DRAWBOX )
and it causes that GTWVT draws all box characters as pixmap
regardles of used font.
So far this functionality existed only in GTXWC.
+ added support for HB_GTI_FONTA_FIXMETRIC and HB_GTI_FONTA_CLRBKG
So far this functionality existed only in GTXWC.
+ added support for HB_GTI_WINHANDLE
! do not add EOL at the end of one line selection
* src/rtl/gtxwc/gtxwc.h
* src/rtl/gtxwc/gtxwc.c
* replaced old keyboard and mouse code with new one using
extended key codes for keyboard and mouse
* renamed HB_GTXWC_* box drawing macros to HB_BOXCH_* ones
* do not add EOL to one line selections
! fixed few keypad keycodes
* use cursor blinking rate HB_GTI_CURSORBLINKRATE for whole
show/hide period not only half of them. If someone use this
GTI action in his code then now he should double passed
value. [incompatible]
! fixed return value for HB_GTI_SETPOS_ROWCOL
* few minor cleanups
* tests/gtkeys.prg
* replaced old keyboard and mouse code with new one using
extended key codes for keyboard and mouse
+ added description for some key codes
+ added some initial HB_GTI_* actions
+ change cursor size by K_INS
+ display terminal size after HB_K_RESIZE
+ display mouse position after mouse key codes
! display all characters created by hb_keyChar()
! fixed formatting
* src/rdd/dbf1.c
* added more general protection against GPF in not fully
initialized workarea
* (all files)
* stripped svn header
* minor cleanups
; use following command to find out the history of files:
git log
git log --follow
git blame
git annotate