* include/hbapi.h
* source/common/hbgete.c
+ Added hb_getenv_buffer(). Similar to hb_getenv() but
this one needs a buffer+size to be passed, so no memory
allocation is done by the function. It also return
a BOOL to signal success. It doesn't signal if passed
buffer was too small to store the value.
* harbour/include/hbstack.h
* harbour/source/vm/estack.c
* harbour/source/vm/hvm.c
* harbour/source/debug/dbgentry.c
* harbour/source/debug/debugger.prg
* moved debugRequest flag and debugger internal structure
pointer to HVM stack
* allocate debugger internal structure dynamically in thread
thread local area when PCODE with debug information is executed
* changed STATIC s_oDebugger to THREAD STATIC
* send HB_DBG_VMQUIT after each thread termination when
debugger is activated
Now debugger can be used in MT programs and each thread can be
debugged separately (each has its own debuger). Please only
remember that thread sharing console window can overwrite other
threads debugger screen. There is also one limitation which I'll
try to remove later: only main thread debugger keeps information
about file wide STATIC names and line numbers with possible break
point places. This data should be shared between debuggers.
* harbour/include/hbapi.h
* harbour/source/vm/hvm.c
* harbour/source/vm/estack.c
* disabled all debugger related bindings and variables when
HB_NO_DEBUG macro is set
% moved s_fDebuging to HVM function stack frame to eliminate
saving/restoring this variable in each function/message call
Note: if you think it's good to block linking .prg code compiled
with -b (debugger support) with HVM compiled with HB_NO_DEBUG
then it's enough to disable whole hb_dbg_SetEntry() function
in hvm.c when HB_NO_DEBUG macro is set.
* harbour/source/rdd/wacore.c
; updated comments about xbase++ behavior in dbRelease()
* harbour/include/hbvm.h
* harbour/source/vm/hvm.c
* harbour/source/vm/dynlibhb.c
* harbour/source/vm/runner.c
! added MT protection for HB_LIBLOAD()/HB_LIBFREE() and
HB_HRBLOAD()/HB_HRBUNLOAD(). Please remember that you should
not use any external LoadLibrary() functions because they are
not protected for clean PCODE modules loading/unloading even
in ST mode. Using them can cause HVM internal structure corruption.
If we have such functions in contrib then they should be redirected
to our HVM ones.
There is still one problem in MT mode which has to be resolved yet.
When dynamic library containing PCODE using static variables
is loaded 1-st time then it will force resizing of internal array
with static variables. If in exactly the same moment some other
thread operates on static variable then it may cause corruption.
To resolve this problem we will have to divide continuous memory
block common for all modules where we store all static variables
into separated blocks bound with each PCODE module (symbol table).
* harbour/source/vm/dynlibhb.c
+ added support for DLL loading/unloading in OS2 builds.
Based on xHarbour code by Maurilio Longo - please test.
* harbour/source/vm/thread.c
+ added small description for hb_threadOnce() .prg function
* harbour/include/hbthread.h
! do not set TLS in POCC and XCC builds when _MSC_VER macro is set
This compilers also have this macro but dllspec( thread) does
not work for them (at least in version 4.50.15)
* harbour/utils/hbtest/rt_hvm.prg
+ added few tests which exploit by DMC bug. Be careful with
this compiler. In some cases it gives buggy final code, f.e.
try this:
#include <stdio.h>
typedef struct
{
double dd;
long long int ll;
} UN;
const char * cmp( UN * pU )
{
return pU->dd >= pU->ll ? "OK" : "ERRROR";
}
int main( void )
{
UN u = { 10.50, 10 };
printf( "%s\n", cmp( &u ) );
return 0;
}
The same bug can be exploited also by final Harbour binaries
compiled by DMC in code like:
? iif( 10.50 >= 10, "OK", "ERROR" )
I used DMC 8.42n. As long as such things will not be fixed by
DMC developers this compiler is not supported by Harbour and
reported problems with DMC Harbour builds will have to be
ignored by us.
* harbour/include/hbclass.ch
* harbour/source/vm/classes.c
* harbour/source/rtl/tobject.prg
* harbour/source/rtl/tclass.prg
! fixed race condition when class function is called 1-st time
and new class is created. It was possible that more then one
thread execute this function simultaneously and two classes
identical classes but with different handles were created
and registered in HVM
* harbour/contrib/xhb/xhbcomp.prg
* updated hack with optional inheritance for new class code
* make_b32.mak
* make_vc.mak
* make_gcc.mak
! Minor formatting.
* include/hbapierr.h
! Fixed casting in macro HB_ERR_FUNCNAME, as it was
generating a new warning with MSVC in 64-bit mode.
'( ( char * ) 1 )' -> '( ( const char * ) NULL + 1 )'
('const' keyword was not enough to silence it)
* include/hbapierr.h
* source/rtl/errorapi.c
- Disabled (marked with HB_LEGACY_LEVEL) hb_errFuncName
symbol. No longer supported, pls use HB_ERR_FUNCNAME
instead.
* harbour/include/hbthread.h
* casting cleanup
* harbour/include/hbapigt.h
* harbour/source/rtl/gtapi.c
* harbour/source/rtl/scroll.c
* harbour/source/rtl/console.c
* harbour/source/rtl/box.c
* changed hb_gtDrawBox() and hb_gtPutText() to operate on color
number (index in some GTs) instead of color string
* use int as color number (index) in hb_gtScrollEx() hb_gtBoxEx()
* harbour/source/rtl/box.c
% changed DISPBOX() with color and frame string to work as one
GT atomic operation
* harbour/source/vm/classes.c
! fixed profiler usage
* include/hbextern.ch
+ New functions added.
* source/rtl/alert.prg
% Minor optimization.
; NOTE: Found yet another hidden extension in Alert() code :(
* source/rtl/radiobtn.prg
! Fix and optimization in recent modification.
* harbour/include/hbapigt.h
* harbour/source/rtl/gtapi.c
+ added C functions hb_gtLock() and hb_gtUnlock()
They block current GT for other threads
* harbour/source/rtl/gtfunc.c
+ added PRG functions hb_gtLock() and hb_gtUnlock()
They block current GT for other threads - be careful using them
and always unlock locked GT
* harbour/source/rtl/scroll.c
+ added HB_SCROLL() function - it works like SCROLL() but supports
2 additional parameters: color and erase char. It's stateless and
atomic in GT access
* harbour/source/rtl/tbrowse.prg
* use HB_SCROLL() instead of SCROLL(). Now whole TBROWSE class
does not depend on other thread screen output and does not
set any GT variables except of cursor positioning to active
cell when it's enabled
* harbour/source/rtl/memoedit.prg
* harbour/source/rtl/tgetlist.prg
* harbour/source/rtl/tlabel.prg
* harbour/source/rtl/listbox.prg
* harbour/source/rtl/tmenusys.prg
* harbour/source/rtl/achoice.prg
* harbour/source/rtl/profiler.prg
* harbour/source/rtl/teditor.prg
* use atomic stateless functions when possible - this code should
be checked and updated by some who know it.
* harbour/include/hbapigt.h
* harbour/source/rtl/gtapi.c
+ added hb_gtDrawBox() works like hb_gtBox() but does not change cursor
posiion and support colors
+ added support for color parameter to hb_gtPutText()
* harbour/source/rtl/console.c
* use new hb_gtPutText() format in HB_DISPOUTAT()
Now all screen operations inside this function is one atomic
operation for other threads
* harbour/source/rtl/box.c
+ added HB_DISPBOX() function - works like DISPBOX() bit does not
change cursor position and is atomic for other threads
* harbour/include/hbapigt.h
* harbour/include/hbgtcore.h
* harbour/source/rtl/hbgtcore.c
* harbour/source/rtl/gtclip.c
* harbour/source/rtl/gtdos/gtdos.c
* harbour/source/rtl/gtwin/gtwin.c
* harbour/source/rtl/gtxwc/gtxwc.c
* harbour/source/rtl/gtcrs/gtcrs.c
* harbour/source/rtl/gtstd/gtstd.c
* harbour/source/rtl/gtsln/gtsln.c
* harbour/source/rtl/gttrm/gttrm.c
* harbour/source/rtl/gtpca/gtpca.c
* harbour/source/rtl/gtcgi/gtcgi.c
* harbour/source/rtl/gtwvt/gtwvt.c
* harbour/contrib/gtalleg/gtalleg.c
* harbour/contrib/gtalleg/ssf.h
* harbour/contrib/gtalleg/ssf.c
* harbour/contrib/gtwvg/gtwvg.c
* cleanup char * casting
* harbour/source/rtl/filesys.c
! do not use pread()/pwrite() in OpenWatcom Linux builds
* harbour/include/hbvm.h
* harbour/source/vm/hvm.c
+ added hb_vmProcessDynLibSymbols() which works like
hb_vmProcessSymbolsEx() but always mark registered modules as
dynamic
* harbour/source/vm/maindllp.c
* redirect hb_vmProcessSymbolsEx() to hb_vmProcessDynLibSymbols()
* harbour/source/vm/thread.c
* disabled some low level locking code in non MT HVM mode
* harbour/include/hbgtcore.h
* harbour/source/rtl/hbgtcore.c
* harbour/source/rtl/gtapi.c
+ added new GT methods: LOCK() and UNLOCK()
* serialize GT access in MT mode - please remember that it's only
low level serialization to protect access to low GT resources.
It has nothing to application level screen output from different
threads which has to be serialized by programmer if necessary.
* harbour/source/rtl/tthreadx.prg
* use HB_THREAD_INHERIT_PUBLIC as thread attribute for thread
started by oThread:start() to emulate xbase++ PUBLIC variables
behavior
* harbour/include/hbapigt.h
* harbour/source/rtl/gtapi.c
+ added hb_gtPutText() C function
* harbour/source/rtl/console.c
+ added HB_DISPOUTAT() which works like DISPOUTAT but does not change
cursor position. xBase++ users can use
#xtranslate DispOutAt( <x,...> ) => hb_dispOutAt( <x> )
for xBase++ compatible code
* include/hbextern.ch
+ Added missing HB_DISABLEWAITLOCKS().
; NOTE: This looks like a hack to add FLX_WAIT flag
for locks app-wide, and on Windows systems only.
IMO we should not have such hacks in core, or if
this is really important it should support all
possible platforms.
It also has a low-level function equivalent,
which is missing from hbapifs.h. There is no
reference to these function in any Harbour or
xhb changelogs.
If there are no objections, I'd like remove
this functionality.
* source/rtl/hbrandom.c
* source/rtl/filesys.c
* Minor formatting.
* harbour/include/hbcompdf.h
* harbour/source/compiler/hbmain.c
% do not add dummy entries to symbol table for functions declared
as dynamic - it allows to include hbdynamic.ch with list of all
supported functions by application and/or harbour.dll to any .prg
file which will be used to create shared library (.dll, .so, ...)
without any memory overhead.
* harbour/source/compiler/genc.c
% do not generate unnecessary HB_FUNC_EXTERN() declarations for
function declared as DYNAMIC
* harbour/include/hbtypes.h
* harbour/source/vm/maindllp.c
! updated casting for current SVN code
[TOMERGE 1.0]
* harbour/include/hbthread.h
* harbour/source/vm/hvm.c
* harbour/source/vm/thread.c
+ added .prg function
hb_threadWait( <pThID> | <apThID>, [ <nTimeOut> ] [, <lAll> ] )
=> <nThInd> | <nThCount> | 0
This function wait for <nTimeOut> seconds (default infinite wait)
until one or all (controlled by <lAll> parameter) of given HVM threads
will have finished execution in HVM area. It does not join the threads.
It returns index to 1-st thread which has finished execution (default)
or number of threads which has finished in given time period when lAll
is .T.
* harbour/include/hbstack.h
* harbour/source/vm/estack.c
* harbour/source/vm/hvm.c
% moved static USHORT uiPolls to HVM stack to not reduce the HVM
performance in MT mode. In multi CPU environment if many threads
try to change the same memory variable in the same time the overall
performance is strongly reduced on most of tested hardware - probably
some random CPU delay used to resolve the conflict.
* include/hbapierr.h
* source/vm/extrap.c
* source/rtl/errorint.c
! Fixed recent modification on Windows platform, where
GPF would generate an internal error.
It didn't launch the OS error handler.
! Fixed hb_errInternal() being marked as HB_EXPORT
in the headers only.
* include/hbextern.ch
* source/rtl/inkey.c
+ Added HB_KEYCLEAR() a documented function equivalent
to "CLEAR TYPEAHEAD" command, or undocumented __KEYBOARD() function.
* contrib/rddads/rddads.h
* contrib/rddads/ads1.c
+ Added support for ADS_USE_OEM_TRANSLATION for old ads versions.
Borrowed from xhb/Pavel Tsarenko.
* harbour/include/Makefile
+ harbour/include/hbatomic.h
* harbour/include/hbthread.h
* harbour/source/vm/garbage.c
* harbour/source/vm/fm.c
* moved atomic and spinlock functions into hbatomic.h
* harbour/include/hbatomic.h
+ added atomic inc/dec for GCC and x86@64 and PPC@32
+ use OSAtomic*() and OSSpin*() functions for atomic inc/dec and
spinlocks in Darwin builds
+ added spinlocks to MS-Win builds
* harbour/source/vm/hvm.c
! fixed last commit typo in thread number allocating - all threads
where using 0 number
* harbour/source/vm/thread.c
! fixed return value in recursive call to hb_mutexLock() - was FALSE
! fixed typo in timeout parameter number
should be 2 instead of 1
* harbour/source/rtl/tobject.prg
! fixed init() return value - it should be ignored and current
object should be returned
* harbour/source/rtl/tthreadx.prg
! probably fixed timeout parameter use in signal:wait() method
I guess that like other xbase++ functions it's in 1/100th of
a second
* harbour/include/hboo.ch
* harbour/include/hbclass.ch
* harbour/source/vm/classes.c
* harbour/source/rtl/tclass.prg
+ added support for SYNC object and CLASS messages working like
in xBase++. Please remember that all locked by thread SYNC messages
objects and classes are unblocked automatically for the time which
thread spends in hb_subscribe[Now]() or signal:wait()
* include/hbapifs.h
* include/hbextern.ch
* source/common/hbfsapi.c
* source/rtl/hbfile.c
+ Added hb_fsNameExists() C level function.
+ Added hb_FNameExists() Harbour level function.
; Both will return true if any kind of directory entry
exists with the given name (IOW it doesn't matter
if it's a file or directory, or else).
* harbour/include/hbclass.ch
* harbour/include/hboo.ch
+ added SYNC attribute to accepted syntax in class declaration
it allows to compile code which uses this attribute but low
level implementation is not ready yet - work in progress
* harbour/source/vm/garbage.c
! added #define INCL_DOSPROCESS for OS2 builds. For some reasons
#define INCL_DOSDATETIME I've found in DosSleep() documentation
is note enough
* include/hbsetup.ch
! Removed some company names from comments.
* source/vm/extrap.c
+ Added //BATCH internal switch to indicate exception handler
to suppress the Windows exception dialog when an exception
occurs. Useful for programs running without user interaction.
NOTE: This may not be the ultimate method. If we can gather
more such situations where such "batch" mode might
be useful, we may as well implement it as a Set().
- Removed Harbour specific exception MessageBox(). Besides
having gotten rid of a MessageBox() call in core VM, Harbour now
got back the standard Windows error handling dialog, which is
more standard and easy to get by than the previous default
method, where several clicks were needed to pass through
the (sometimes hidden) popups. The details of all GPFs are
still logged into hb_out.log.
+ Removed size limit for the logged exception call stack.
* harbour/source/rdd/sdf1.c
! fixed stupid typo (missing !) in last modification which broke
SDF RDD read mode. Thanks to Marco for information and example.
* harbour/include/hbstack.h
* harbour/source/vm/estack.c
* small cleanup in used macros
* harbour/include/hbstack.h
% enable assembler inline function to access HVM thread stack pointer
without native compiler TLS support even if HB_STACK_PRELOAD is not
defined in MinGW builds. It gives some additional small speed
improvement in MT mode
* harbour/source/rtl/idle.c
* unlock HVM inside hb_releaseCPU() function
* harbour/contrib/hbwin/win_ole.c
! fixed casting and C++ compilation in some compilers
* harbour/include/Makefile
+ harbour/contrib/examples/rdddbt/hbrdddbt.h
- harbour/include/hbrdddbt.h
! moved hbrdddbt.h to correct location
* harbour/include/Makefile
! added missinf hbthread.h
* harbour/tests/rddtest/rddmktst.prg
* harbour/tests/rddtest/adscl52.prg
* harbour/tests/rddtest/adscl53.prg
* harbour/tests/rddtest/ntxcl52.prg
* harbour/tests/rddtest/ntxcl53.prg
* harbour/tests/rddtest/cdxcl52.prg
* harbour/tests/rddtest/rddtst.prg
* harbour/tests/rddtest/cdxcl53.prg
! fixed description in header I wrongly copied without updating
from other files
+ harbour/tests/hsxtest.prg
+ added test code for HiPer-SEEK indexes
* harbour/source/rtl/filesys.c
+ added new functions: hb_fsExtName(), hb_fsReadAt(), hb_fsWriteAt(),
hb_fsTruncAt() to use with shared file handles.
Please test it in other *nixes. I used pread[64]()/pwrite[64]()
POSIX functions but I do not know if they are available by default
in other supported platforms like MacOSX, BSD, HPUX, SunOS.
If not they I will have to implement some workaround.
* harbour/common.mak
* harbour/source/rtl/Makefile
* harbour/include/hbapifs.h
+ harbour/source/rtl/filebuf.c
+ added set of new file functions (hb_file*()) which are designed to
use with shared file handles and locks (buffers in the future):
hb_fileExtOpen(), hb_fileCreateTemp(), hb_fileClose(), hb_fileLock(),
hb_fileReadAt(), hb_fileWriteAt(), hb_fileTruncAt(), hb_fileSize(),
hb_fileCommit(), hb_fileHandle()
These functions operate on PHB_FILE structure instead of HB_FHANDLE.
Now in POSIX systems they share file handle between aliased or
simultaneously open by other thread work areas. It resolves the
problem with releasing all process FCNTL locks by any close()
operation even on duplicated or open() separately handle.
Now DOS deny flags emulation works in single process even if
BSD locks are disabled (non Linux *nixes).
They also keep internal file lock list what allows to synchronize
threads and aliases with file locks in POSIX systems. In the future
it will be used also for internal locking to synchronize threads
without OS level locks - pseudo exclusive mode in cloned WA.
Finally these structures will be used also for file buffers
which will be shared between aliased WA and threads.
* harbour/include/hbrdddbf.h
* harbour/include/hbrddcdx.h
* harbour/include/hbrddntx.h
* harbour/include/hbrdddel.h
* harbour/include/hbrddsdf.h
* harbour/source/rdd/dbf1.c
* harbour/source/rdd/delim1.c
* harbour/source/rdd/sdf1.c
* harbour/source/rdd/dbffpt/dbffpt1.c
* harbour/source/rdd/dbfntx/dbfntx1.c
* harbour/source/rdd/dbfcdx/dbfcdx1.c
* harbour/source/rdd/hsx/hsx.c
* harbour/contrib/hbbmcdx/bmdbfcdx.c
* harbour/contrib/hbbmcdx/hbbmcdx.h
* use PHB_FILE and hb_file*() functions instead of HB_FHANDLE (hb_fs*())
to access files.
+ harbour/tests/aliaslck.prg
+ added test code for file lock synchronization between aliased
work areas
* harbour/include/Makefile
+ harbour/include/hbvmint.h
+ added new header file which works like hbvmopt.h but does not enable
stack macros
* harbour/contrib/xhb/xhbenum.c
* harbour/contrib/xhb/xhbqself.c
* harbour/contrib/xhb/xhbwith.c
* harbour/contrib/xhb/cstructc.c
* harbour/contrib/hbwin/win_ole.c
! use hbvmint.h instead of hbvmopt.h to eliminate direct bindings to
HVM stack structure
* harbour/include/hbset.h
* harbour/source/vm/set.c
+ divided __SETCENTURY() PRG function into two functions:
__SETCENTURY() and public C function hb_setSetCentury()
to manipulate century setting from C code.
Modyfication by Francesco Saverio Giudice
* harbour/include/hbvm.h
* harbour/include/hbthread.h
* harbour/source/vm/hvm.c
* harbour/source/vm/thread.c
+ added hb_vmThreadRegister() funtion which allows to register new
thread in HVM without HVM stack allocation
+ added hb_vmThreadRelease() which removes registered thread which
does not have allocated HVM stack yet
+ added hb_threadStateNew() which returns new thread control state
which can be used as parameter to hb_vmThreadInit(),
hb_vmThreadRegister(), hb_vmThreadRelease()
* register thread control state also for main thread
Now hb_threadSelf() returns thread pointer also for main thread
! fixed possible race condition in hb_threadWaitForAll() and
hb_threadTerminateAll() by using hb_vmThreadRegister() before
starting thread.
* harbour/source/rtl/idle.c
* interrupt hb_idleSleep() on QUIT or BREAK requests
* harbour/tests/mt/mttest09.prg
* small cleanup
* include/hbthread.h
% Disabled HB_USE_TLS for __BORLAND__ and __MINGW32__ for
best performance.
* contrib/hbwhat/whtmmcap.c
! Fixed some warnings under certain MinGW 4.3.2
installations.
TODO: hbwhat users pls finish this fix.
* utils/hbmake/hbmake.prg
! Fixed hbw32 to hbwin.
* Win32 references changed to Windows.
* make_gcc.sh
* Not accepting CFLAGS anymore as custom C flags envvar.
Pls use C_USR instead.
* make_gcc.mak
+ Added wsock32 lib to Cygwin system liblist.
! Removed setting HB_OS_* macros explicitly.
* make_b32.mak
* make_vc.mak
* Minor formatting.
* harbour/include/hbstack.h
* harbour/source/vm/estack.c
+ added assembler inline macros for TLS access in BCC and MinGW32
They are enabled when Harbour is compiled with -DHB_NO_TLS.
Please check the speed difference. If it will be noticeable
then we keep them probably as default. Otherwise they will be
removed.