* include/hb_io.h
* include/hbthread.h
* include/hbsetup.h
* src/vm/thread.c
* src/vm/dynlibhb.c
* src/common/hbgete.c
* src/common/hbprintf.c
* src/rtl/gttrm/Makefile
* src/rtl/hbsocket.c
* src/rtl/filesys.c
* src/rtl/hbcom.c
* config/global.mk
- config/win/cygwin.mk
+ config/cygwin
+ config/cygwin/libs.mk
+ config/cygwin/gcc.mk
+ config/cygwin/global.mk
+ Applied cygwin patch from Tamas Tevesz.
The goal is to migrate win/cygwin to cygwin/gcc, IOW to make cygwin
a distinct platform (which is primarily unixy with option to access
winapi) as it should be.
Changes made by me compared to original patch:
- Fixed to HB_HOST_PLAT stay 'win'. Cygwin is not a host platform.
- Fixed to set HB_COMPILER to gcc and HB_PLATFORM to cygwin when cygwin
is detected on win platform.
- Consequently some changes in global.mk could be dropped.
- Deleted hbcom patches not related to cygwin.
- Removed hbmk2 patch until we solve the 'plat $ 'cygwin' problem.
* include/hbdefs.h
* src/rtl/hbsocket.c
* include/hbthread.h
* Moved header collision avoidance hack to the root of
the problem, right after '#include <stdint.h>'.
This way it's done centrally.
* config/vxworks/diab.mk
- Deleted fixed TOFIX.
* src/rtl/hbsocket.c
+ Enabled ioctl() calls for VxWorks.
! Worked around 'socklen_t' vs 'int' warnings with VxWorks.
(still remains some 'const char *' and 'caddr_t' vs 'char *
warnings, nothing serious though)
* include/hbthread.h
! Enabled HB_CRITICAL_NEED_INIT for VxWorks. Avoids the compiler
warnings caused by PTHREAD_COND_INITIALIZER having one less
structure member than initialized structure.
MT mode still doesn't work though.
* contrib/hbodbc/odbc.c
+ Added HB_ODBCVER() function to return build-time ODBC version
reported by ODBCVER macro.
* contrib/hbodbc/tests/testodbc.prg
+ Show ODBC version number.
- contrib/hbqt/doc/html
- Deleted. doc dirs now have to abide by the HBDOC rules posted
on the dev list, which means doc may contain (non-empty) language
dirs only. html should be generated by client app or by install
process.
* contrib/hbwin/hbwinole.h
! Patch by Tamas Tevesz, fixing NONAMELESSUNION issue for watcom.
* utils/hbtest/hbtest.prg
* utils/hbtest/rt_hvm.prg
* utils/hbtest/rt_hvma.prg
* utils/hbtest/rt_stra.prg
* utils/hbtest/rt_vars.ch
+ Enabled GTCGI for Harbour builds. This makes it independent
for GTs, to there is better chance to run it. Now it also
works on VxWorks.
+ Will now detect .dbf creation failure and continue gracefully
with a message and skipping all related tests.
* src/rtl/hbsocket.c
* external/minizip/ioapi.h
* include/hbthread.h
+ Added/cleaned hacks to avoid collision between VxWorks's own
system types.
* external/minizip/ioapi.h
! Disabled 64-bit FSIO for whole VxWorks.
* config/vxworks/gcc.mk
* config/vxworks/diab.mk
* config/vxworks/global.mk
+ _VX_CPU is now defined in vxworks/global.mk.
* src/common/hbarch.c
! Fixed hb_put_le_uint64() definition to match declaration.
* include/hbdefs.h
! Fixed compatibility type definitions in HB_LONG_LONG_OFF mode.
* include/hbsetup.h
+ Added bzero() declaration hack for vxworks.
* include/hbinit.h
+ Added support for diag compiler init function.
It requires the constructor to have public visibility.
* src/common/hbver.c
+ Changed to always display x.x.x.x format verison no for diab.
(in generic way).
* INSTALL
* Updated list of CPUs supported by vxworks.
* include/hbthread.h
! Hacked around collision between vxWorks headers.
* ChangeLog
! Fixed casing of vxWorks.
* utils/hbmk2/hbmk2.prg
+ Added vxworks/gcc libpaths.
! Fixed vxworks/gcc system lib list.
! Fixed ar to have postfix.
; All these are syncs with GNU Make.
* src/rtl/hbsocket.c
! Typos in previous vxworks patchs.
* config/global.mk
! Fixed forming automatic HB_INSTALL_PREFIX value in *nix cross-build
situations. (it's still wrong as it assumes nix->win cross-builds)
; Now vxworks/gcc/x86 build is clean.
There are iTODOs left, and
- this particular class of warnings, which seems
to be a bug down the <pthread.h> system header:
hbnetio\netiocli.c:155: warning: missing initializer
hbnetio\netiocli.c:155: warning: (near initialization for 's_netioMtx.mutexAttr.mutexAttrType')
- also this, each time FD_ZERO() and friends are used:
warning: implicit declaration of function 'bzero'
- "argument n of 'x' differ in signedness" and "discards qualifiers from pointer target type"
warnings in hbsocket.c code.
; TOFIX:
- Unrecoverable error 9998: Harbour terminal (GT) initialization failure
when running hbtest.
- GPF when running hbmk2 and hbrun. (hbformat, hbi18 startup fine)
* INSTALL
+ config/vxworks
+ config/vxworks/libs.mk
+ config/vxworks/gcc.mk
+ config/vxworks/diab.mk
+ config/vxworks/global.mk
+ Started experimental VxWorks port.
; NOTE: VxWorks port was made possible by Wind River Systems Inc.,
who were so kind to mail me a full VxWorks development
environment, for the purpose of porting Harbour to this
platform. Thank you very much guys.
[ The free license is valid for one month, so if anyone
is interested in helping in this project, I can help with
real tests, builds and information. BTW, the devenv is
Eclipse based plus cmdline, running on Windows (available
for Linux and Solaris, too) and the target VxWorks exes
run in a virtual environment. ]
* config/global.mk
+ Added autodetection of VxWorks platform.
* utils/hbmk2/hbmk2.prg
+ Added VxWorks support. It's incomplete yet.
! Fixed to quote *nix/gcc compiler family in
Windows-host cross-platform situations.
* src/vm/thread.c
* src/common/hbgete.c
* src/common/hbffind.c
* src/common/hbtrace.c
* src/common/hbdate.c
* src/rtl/gtstd/gtstd.c
* src/rtl/gttrm/Makefile
* src/rtl/hbsocket.c
* src/rtl/filesys.c
* src/rtl/diskspac.c
* src/rtl/cputime.c
* src/rtl/disksphb.c
* src/rtl/gtpca/gtpca.c
* src/rtl/net.c
* src/rtl/hbproces.c
* src/rtl/gtsys.c
* src/rtl/hbcom.c
* external/zlib/inflate.c
* external/jpeg/jmorecfg.h
* external/pcre/Makefile
* include/hbapifs.h
* include/hbthread.h
* include/hbdefs.h
* include/hbsetup.h
* contrib/xhb/hboutdbg.c
* contrib/xhb/hbsyslog.c
* contrib/xhb/hbserv.c
+ vxworks/gcc port. First phase.
; Please review.
; NOTE: - vxworks has no termios, for serial comm
support it has sioLib.h.
- vxworks supports another C compiler, which
was not tested yet.
- vxworks supports lots of CPUs, only x86 was
tested yet.
- There are still mutex related warnings to sort out.
- Some parts had to disabled, like HB_LIB*() functionality.
; TODO: Regenarate .difs in external/.
* src/vm/hashfunc.c
* Silenced warnings shown by vxworks/gcc.
* src/vm/dynlibhb.c
* include/hbthread.h
+ Added QNX support.
* src/rtl/hbzlib.c
! Added hack to fix missing zlibVersion() and zError()
functions from the zlib lib shipped with QNX 6.2.1.
+ config/qnx/libs.mk
+ Added QNX specific lib configuration.
* utils/hbmk2/hbmk2.prg
+ Added (untested) list of system libs for qnx/gcc.
* INSTALL
+ Added QNX reference to one more place.
; NOTE on QNX:
All binaries build cleanly, hbtest works.
; TOFIX/TODO:
- hbrun seems to misdetect the width of the terminal
- Clean some hack in QNX port
- platform autodetection
- retest whole port from vanilla SVN source, test MT
linkage.
; So now Harbour can run in cars, planes and spaceships.
* include/hbthread.h
! Added missing HB_EXPORT, and in some place 'extern'
qualifier to thread/atomic Harbour API declarations.
* ChangeLog
! Fixed entry header in previous commit (again).
* harbour/include/hbthread.h
* harbour/src/vm/thread.c
% use thread local memory to optimize _hb_gettid()
% use _hb_gettid() instead of _gettid() in OS2 GCC builds
* harbour/src/vm/hvm.c
% minor speed improvement
* harbour/src/vm/memvars.c
! cleaned local vars detaching code
* src/vm/extrap.c
* src/vm/dynlibhb.c
* src/common/hbgete.c
* src/common/hbffind.c
* src/common/hbver.c
* src/rtl/filesys.c
* src/rtl/diskspac.c
* src/rtl/gtos2/gtos2.c
* src/rtl/cputime.c
* src/rtl/disksphb.c
* include/hbthread.h
* contrib/hbmzip/hbmzip.c
! Fixed to setup all OS/2 INCL_* constants and
to #include os2.h by themselves, and not to rely
on Harbour headers to do this job for them.
; TODO: Do the same for dos.h.
* doc/hdr_tpl.txt
- Deleted local changelog.
! Fixes to .prg function docs
+ Update copyright year to 2010.
+ Added fact that $SEEALSO$ should be comma separated.
+ Added .c function example (far from perfect)
* examples/hbdoc2/tmplates.prg
* doc/hdr_tpl.txt
+ Added $VERSION$ tag. (pls update HBIDE. We haven't finalized
the format yet, to it's little bit premature to create
new and new parsers/generators for it yet)
* include/hbdefs.h
! Fixed to not unconditionally include OS/2 headers with
an arbitrary selection of INCL_ macros.
Now OS/2 headers will only be included if legacy types
are requested (off by default), and no INCL_ macros
are defined. This latter change may affect 3rd party
code written for OS/2, so I'm marking it INCOMPATIBLE.
* contrib/hbqt/generator/hbqtgen.prg
* contrib/hbqt/hbqt.h
* Changed to #include hbapi.h from hbqt.h. It needs it,
so this is the clean way. Changed generator to leave
out hbapi.h from each source file and refer to hbqt.h
only. (untested)
+ Added logic to #include OS/2 headers with some INCL_
macros defined, to make QT on OS/2 happy. (copied them
from the dev. list)
; TODO: Regenerate HBQT sources.
* utils/hbtest/hbtest.prg
! Cleaned old problem reported by Chen. It seems like
a feature which was never finished, and it's not even
hugely needed, so I deleted it.
* config/global.mk
+ Will now provide HB_COMP_PATH_PUB value for os2-gcc, os2-gccomf
compilers. This value can be used to manually form ld.exe
command line.
(NOTE: This may be deleted in the future, when sorting
out line-length limit problems for these compilers.
* harbour/include/hbsetup.h
* harbour/include/hbdefs.h
* harbour/include/hbthread.h
* harbour/src/common/hbver.c
* harbour/bin/hb-func.sh
* harbour/bin/postinst.sh
* harbour/config/linux/gcc.mk
+ harbour/config/linux/open64.mk
+ added support for Open64 C/C++ compiler in Linux builds
* harbour/src/common/hbver.c
* removed unnecessary casting compiler version number parameters
to 'short'
* extended the size of szBuf buffer as requested by Tamas
* harbour/include/hbthread.h
* minor cleanup in comment
* harbour/src/vm/dlmalloc.c
* use harbour spinlocks in windows builds to eliminate calling
InterlockedCompareExchange[Pointer]() function
* harbour/include/hbstack.h
! disabled TLS ASM inline code which seems to not work with Win9x.
* harbour/config/win/bcc.mk
* increased library page size for 64 to 96
* harbour/src/vm/thread.c
* harbour/include/hbthread.h
% removed 'BOOL fSync' parameter from hb_threadMutexCreate().
This parameter was added in the past to emulate xbase++ behavior
when oSignal:wait() is called from SYNC method but real life tests
shows that such feature works in xbase++ in different way then
it was initially described and Harbour code was updated to use
different solution making above parameter unusable.
* harbour/src/vm/hvm.c
* harbour/src/vm/thread.c
* harbour/src/vm/classes.c
* harbour/src/rtl/hbgtcore.c
* harbour/contrib/hbnetio/netiocli.c
* harbour/contrib/hbqt/hbqt_slots.cpp
* updated to use hb_threadMutexCreate() without parameters
* harbour/include/hbthread.h
* modified some internal structure definitions (used nameless unions)
to pacify possible warnings on structure initialization.
* make_gnu_os2.cmd
% Minor opt. I hope OS/2 accepts such 'if' command.
* include/hbthread.h
! Fix to poccarm build. Provided by Przemek.
* utils/hbmk2/hbmk2.prg
* config/wce/msvcarm.cf
* config/wce/global.cf
* config/wce/poccarm.cf
+ Added -DUNICODE for mingwarm. It didn't seem to require it so far,
but I thought it's better to define this for all wce compilers.
% Deleted -DHB_NO_WIN_CONSOLE. No longer exists in Harbour.
% Deleted /stack:65536,4096 linker option from wce/msvcarm.
I'm just guessing it's not needed.
+ -DUNICODE is now enforced through HB_BUILD_UNICODE=yes setting
in GNU Make for all wce compilers.
* harbour/include/hbthread.h
* added workaround for different CRITICAL_SECTION definitions in
some compiler header files
* harbour/source/vm/fm.c
* harbour/source/hbzlib/ChangeLog
* harbour/source/hbzlib/zutil.c
* use #pragma warning to pacify OpenWatcom warnings
* harbour/include/hbsetup.h
* harbour/include/hbthread.h
* harbour/include/hbatomic.h
* harbour/source/vm/thread.c
* added support for MT mode in WinCE builds using raw MS-Windows API
instead of CRTL wrappers. It's possible that it may badly interact
with some CRTLs functions we are using in our code so I do not know
it will work. Please test.
* harbour/config/os2/watcom.cf
* harbour/config/os2/dir.cf
* harbour/config/os2/install.cf
* small cleanup for builds with *nix like shells and cross builds
* harbour/contrib/rddads/Makefile
! disabld from OS2 builds - if ADS supports OS2 then please speak-up
* harbour/include/hbthread.h
* added small hack as workaround for missing OS2 declarations
* harbour/source/rtl/filesys.c
! fixed typo in OS2 builds
* harbour/source/rtl/hbproces.c
! fixed non GCC OS2 builds
* harbour/contrib/hbtpathy/tpos2.c
! fixed casting in OS2 builds
* harbour/contrib/xhb/hbserv.c
! disabled from OS2 non GCC builds
Now I can create OS2 OpenWatcom build in my Linux box using this simple
script:
#!/bin/sh
if [ -z "${WATCOM}" ]; then
export WATCOM="/opt/lng/watcom"
export INCLUDE="${WATCOM}/h:${WATCOM}/h/os2"
export PATH="${WATCOM}/binl:$PATH"
fi
export HB_ARCHITECTURE=os2
export HB_COMPILER=watcom
export HB_INSTALL_PREFIX="$(pwd)/hb-os2/watcom"
#cross build settings
# this should be fixed and we should use HB_PPGEN_PATH as direct
# reference to hbpp binaries and HB_COMP_PATH as direct reference
# to harbour binaries in all builds. Otherwise we have to create
# some hacks to create platform specific names for above binaries
# i.e. in *nixes links with .exe extension.
export HB_PPGEN_PATH="/tmp/cros-hb"
export HB_BIN_COMPILE="/tmp/cros-hb"
export HB_USER_PRGFLAGS="${HB_USER_PRGFLAGS} -D__PLATFORM__OS2"
export HB_USER_PRGFLAGS="${HB_USER_PRGFLAGS} -undef:__PLATFORM__UNIX"
export HB_USER_PRGFLAGS="${HB_USER_PRGFLAGS} -undef:__PLATFORM__LINUX"
# eliminate libraries which scans for local host header files
export HB_XBUILD=yes
./make_gnu.sh "$@"
It should work also in Windows with MSys.
This should resolve the problem with testing OS2 builds, at least
for OpenWatcom. I do not know if GCC for OS2 is available as cross
build environment.
I think that Viktor can quite easy adopt hbmk2 for OS2 cross compilation.
+ harbour/include/hbtask.h
+ harbour/source/vm/task.c
* harbour/include/hbthread.h
* harbour/include/hbatomic.h
* harbour/source/vm/thread.c
* harbour/source/vm/hvm.c
* harbour/source/vm/fm.c
* harbour/source/rtl/idle.c
* harbour/source/rtl/filesys.c
+ implemented OS independent task switching system - it gives PTHREAD
compatible basic API so it can be used in HVM as alternative MT support
which does not use any OS threads. As long as Harbour does not call
any blocking OS function then it's possible to create and execute
simultaneously many threads though only one CPU is used and switched
between HVM threads. It gives similar scalability to xbase++ threads
and also similar behavior in item protection at .prg level.
Now it's possible to use HVM threads in any OS.
Of course it does not mean that Harbour adds in some magic way
thread support to OS-es which does not support threads like DOS.
It only means that HVM supports threads for .prg code just like
in native MT environment as long as some C code does not block
task switching or process execution will not be frozen by sth, i.e.
executing other process (__run()) in single process OS like DOS.
In some cases it can be interesting alternative even in OS which
have native thread support.
All tests/mttest*.prg programs and speedtst --thread=<n> --scale
are executed correctly with new task switching just like with
OS native MT support.
Compilation with task switching in hbvmmt library can be forced
by HB_TASK_THREAD macro which also disable native OS threads
support.
For task context switching two alternative methods are used:
1) getcontext()/makecontext()/swapcontext() (SUSv2, POSIX.1-2001)
which is preferable because does not need any additional
hacks but not all OS-es supports these functions.
It's enabled by default in Linux builds.
2) setjmp()/longjmp() (POSIX, ISO 9899 (C99)) otherwise.
These functions are supported by most of C compilers
but there is no function to set new stack in saved context
so it's necessary to introduce for each architecure/C compiler
peace of code which makes it. Macro HB_TASK_STACK_INIT() in
task.c makes it. I defined this macro for x86@32 in DJGPP
Linux GCC and OpenWatcom builds. I tested OpenWatcom builds only
in DOS and Linux but probably it works in all x86@32 builds.
If someone is interesting in adding support for some other
platforms which does not support ucontext.h and 1-st methods
then please define above macro for them.
Have a fun with new toy ;-)
* harbour/source/vm/Makefile
* enabled hbvmmt in DJGPP and OpenWatcom DOS builds. It works well.
Viktor if possible please add support for -mt switch in hbmk2
in all builds even if we do not compile hbvmmt by default so
it can be used with DJGPP and OW and any other builds for which
someone enable hbtask.c though OS does not support threads.
* harbour/contrib/hbmzip/hbmzip.c
! fixed '[const] char|BYTE *' casting in DOS and OS2 builds
* harbour/include/hbclass.ch
+ extended support for xbase++ compatible method declaration:
[SYNC] METHOD <methodName1>[([<params>])] ;
[ , <methodNameN>[([<params>])] ]
* harbour/include/hbthread.h
* harbour/source/vm/thread.c
* harbour/source/vm/classes.c
+ added alternative support for SYNC method which does not use
sync mutexes. The old method is still present. I'll remove it
when xbase++ users confirm that the new one exactly emulates
xbase++ behavior.
* harbour/source/vm/classes.c
* harbour/source/rtl/tthreadx.prg
* switch to alternative SYNC method implementation which seems to be
xbase++ compatible - please test
! fixed missing thread interrupt in recent modification for ::setInterval
* harbour/include/hbthread.h
* harbour/source/vm/thread.c
* emulate POSIX thread conditional variables in Windows builds.
It should fix some possible bad behavior in MS-Windows Harbour
MT programs.
* harbour/source/rtl/hbinet.c
! fixed typo in HB_INETDATAREADY() - the second parameter (timeout)
was ignored.
* harbour/contrib/examples/uhttpd/uhttpdc.c
* fixed typo in conditional iMsec usage.
* harbour/contrib/examples/uhttpd/uhttpd.prg
* set default timeout for socket operations to 3 sec.
* use timeout parameter in HB_INETDATAREADY() and
increased default timeout for accept to 250 millisecs.
Please correct this modification if you prefer different values.
* harbour/include/hbthread.h
* harbour/source/vm/thread.c
! added support for conditional variables working like in PTHREADS
in OS2 builds - it fixes the problem with possible dead lock or
starvation effect which can also cause dead lock in some cases.
OS2 users please test current code.
* harbour/include/hbthread.h
* harbour/source/vm/thread.c
! fixed a bug on OS/2 MT implementation adding a new function,
_hb_cond_timed_wait() because when a semaphore gets posted it has
to be reset, otherwise it does not stop new threads entering it in a wait.
* include/hbdefs.h
* include/hbthread.h
* added HB_OS_SUNOS to be able to build under OpenSolaris 2008.11
using pthreads.
* source/common/hbprintf.c
* include ieeefp.h under OpenSolaris 2008.11
* 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/include/hbthread.h
! fixed typo
* harbour/source/vm/Makefile
* excluded mainpm.c from OS2 builds
* harbour/source/rtl/hbinet.c
* changed the #include order for OS2 OpenWatcom builds and added some
cleanups - please test other builds.
* harbour/include/hbthread.h
* harbour/source/vm/thread.c
+ added ULONG _hb_gettid( void ) to OS2 builds - thanks to Maurilio
* harbour/source/rtl/hbinet.c
* changed a little bit the order of including header files in OS2 builds
(blink fix for OpenWatcom OS2 builds).
* harbour/include/hbstack.h
* harbour/include/hbgtcore.h
* harbour/include/hbthread.h
* harbour/include/hbapigt.h
* harbour/source/vm/estack.c
* harbour/source/vm/hvm.c
* harbour/source/vm/thread.c
* harbour/source/rtl/hbgtcore.c
+ added support for optional allocating independent console window by
each thread. By default new thread inherits console Window from
parent thread. But each thread can allocate its own console window
by calling hb_gtReload( <cGtName> ) function, f.e. by:
hb_gtReload( hb_gtVersion() )
If GT driver supports such functionality then new it will allocate
new console windows.
Each console window has reference counter which is increased when
new thread starts and decreased when hb_gtReload() is executed or
thread terminates. When counter reach zero give console window is
destroyed.
* harbour/source/rtl/gtwvt/gtwvt.c
! use SendNotifyMessage() instead of SendMessage() to not block
threads which inherited GT from parent thread. Why non of MS-Win
users reported this problem?
+ added reference counter to window class for multi GT support
+ harbour/tests/mt/mttest10.prg
+ added demonstration/test code for using independent console window
in different threads. It needs GT driver which supports such
functionality, f.e GTXWC in *nixes or GTWVT in MS-Windows
* harbour/tests/mt/mttest09.prg
! fixed typo in comment
* 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.