From e4ac79105947e08aa90e05888ff3e027abbfa28e Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 28 Dec 2004 09:29:30 +0000 Subject: [PATCH] 2004-12-28 10:30 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/harbour.spec * harbour/hbgtmk.sh * harbour/make_rpm.sh * harbour/bin/pack_src.sh * updated for recent changes in make process * harbour/contrib/Makefile * added odbc lib for Linux compilation * harbour/contrib/btree/Makefile * changed lib name from hb_btree to hbtree * harbour/contrib/btree/hb_btree.api * harbour/contrib/btree/hb_btree.c * fixed GCC compilation in HB_TR_DEBUG mode * harbour/contrib/hbzlib/hbzip.h * harbour/contrib/hbzlib/include/hbzip.h * harbour/include/hbapi.h * harbour/include/hbapicdp.h * harbour/include/hbapierr.h * harbour/include/hbapifs.h * harbour/include/hbapigt.h * harbour/include/hbapiitm.h * harbour/include/hbapilng.h * harbour/include/hbapirdd.h * harbour/include/hbcomp.h * harbour/include/hbdate.h * harbour/include/hbdbsort.h * harbour/include/hberrors.h * harbour/include/hbexprb.c * harbour/include/hbexprop.h * harbour/include/hbhash.h * harbour/include/hbinit.h * harbour/include/hbmacro.h * harbour/include/hbpp.h * harbour/include/hbrdddel.h * harbour/include/hbrddntx.h * harbour/include/hbrddsdf.h * harbour/include/hbrddwrk.h * harbour/include/hbset.h * harbour/include/hbstack.h * harbour/include/hbtrace.h * harbour/include/hbvm.h * harbour/include/hbvmpub.h * changed #if defined (HB_EXTERN_C) to HB_EXTERN_BEGIN / HB_EXTERN_END macros for easier manipulation with different ABI * added HB_IS_BADITEM() macro for debugging * synced CDP with xHarbour - added basic Unicode support * synced RDD with xHarbour * harbour/source/codepage/Makefile * harbour/source/codepage/cdp_tpl.c * harbour/source/codepage/cdpeldos.c * harbour/source/codepage/cdpelwin.c * harbour/source/codepage/cdpesdos.c * harbour/source/codepage/cdpeswin.c * harbour/source/codepage/cdpgedos.c * harbour/source/codepage/cdpgewin.c * harbour/source/codepage/cdphu852.c * harbour/source/codepage/cdphuwin.c * harbour/source/codepage/cdppl852.c * harbour/source/codepage/cdppliso.c * harbour/source/codepage/cdpplmaz.c * harbour/source/codepage/cdpplwin.c * harbour/source/codepage/cdppt850.c * harbour/source/codepage/cdpptiso.c * harbour/source/codepage/cdpru866.c * harbour/source/codepage/cdprukoi.c * harbour/source/codepage/cdpruwin.c * harbour/source/codepage/cdpsl437.c * harbour/source/codepage/cdpsl852.c * harbour/source/codepage/cdpsliso.c * harbour/source/codepage/cdpslwin.c * harbour/source/codepage/cdpsrwin.c + harbour/source/codepage/uc1250.c + harbour/source/codepage/uc1251.c + harbour/source/codepage/uc1253.c + harbour/source/codepage/uc1257.c + harbour/source/codepage/uc737.c + harbour/source/codepage/uc850.c + harbour/source/codepage/uc852.c + harbour/source/codepage/uc866.c + harbour/source/codepage/uc88591b.c + harbour/source/codepage/uc8859_1.c + harbour/source/codepage/uc8859_2.c + harbour/source/codepage/uckoi8.c + harbour/source/codepage/uckoi8u.c + harbour/source/codepage/ucmaz.c * harbour/source/rtl/cdpapi.c * synced HB CDP API with xHarbour - added basic Unicode support * harbour/source/common/expropt2.c * harbour/source/common/hbstr.c * removed unnecessary initialization to avoid BCC warnings * harbour/source/compiler/harbour.c * formatting hb_compCodeBlockStop() looks like work in progress or is has some old unused code - Ryszard, can you look at it? * harbour/source/macro/macro.y * removed hack for GCC and old Bison versions * harbour/source/pp/ppcore.c * removed unnecessary initialization to avoid BCC warnings * harbour/source/pp/pptable.c + added some sets for RDD synchronization with xHarbour * harbour/source/rdd/dbcmd.c + added __RDDGETTEMPALIAS * harbour/source/rdd/dbf1.c * harbour/source/rdd/dbfuncs.prg * harbour/source/rdd/dbnubs.c * harbour/source/rdd/dbstrux.prg * harbour/source/rdd/hbdbsort.c * harbour/source/rdd/rddord.prg * harbour/source/rdd/workarea.c * harbour/source/rdd/dbfcdx/dbfcdx1.c * harbour/source/rdd/dbfdbt/dbfdbt1.c * harbour/source/rdd/dbffpt/dbffpt1.c * harbour/source/rdd/dbfntx/dbfntx1.c * synchronized with xHarbour - still dbcmd.c has to be synced yet ! fixed all known bugs Alexander, please look at DBFNTX - I hope all is correct. * harbour/source/vm/codebloc.c * formatting * harbour/source/vm/fm.c + added HB_PARANOID_MEM_CHECK to force reallocations in hb_xrealloc and fill allocated and freed memory with HB_MEMFILER (0xff by default) It's for debugging only. * harbour/source/vm/hvm.c ! fixed hb_vmTopNumber() declaration for BCC * use hb_gcCollectAll() at HVM exit instead of hb_gcReleaseAll() to report allocated and not freed items - It could caused that some programs begin to report memory leaks. * harbour/source/vm/itemapi.c * check for HB_IS_BADITEM inside hb_itemClear() when compiled with HB_PARANOID_MEM_CHECK for debugging * harbour/source/vm/memvars.c * formatting ! fixed pItem initialization in hb_memvarDetachLocal() BTW - is this really necessary? I copy it form hb_itemUnRef() but in fact it cannot detect all possible item reference cycles if they appear - can they appear? --- harbour/ChangeLog | 155 ++++++ harbour/bin/pack_src.sh | 24 +- harbour/contrib/Makefile | 1 + harbour/contrib/btree/Makefile | 2 +- harbour/contrib/btree/hb_btree.api | 8 +- harbour/contrib/btree/hb_btree.c | 14 +- harbour/contrib/hbzlib/hbzip.h | 11 +- harbour/contrib/hbzlib/include/hbzip.h | 11 +- harbour/harbour.spec | 547 +++++++-------------- harbour/hbgtmk.sh | 6 +- harbour/include/hbapi.h | 17 +- harbour/include/hbapicdp.h | 144 ++++-- harbour/include/hbapierr.h | 8 +- harbour/include/hbapifs.h | 8 +- harbour/include/hbapigt.h | 4 +- harbour/include/hbapiitm.h | 8 +- harbour/include/hbapilng.h | 8 +- harbour/include/hbapirdd.h | 44 +- harbour/include/hbcomp.h | 8 +- harbour/include/hbdate.h | 8 +- harbour/include/hbdbsort.h | 9 +- harbour/include/hberrors.h | 8 +- harbour/include/hbexprb.c | 4 +- harbour/include/hbexprop.h | 8 +- harbour/include/hbhash.h | 8 +- harbour/include/hbinit.h | 8 +- harbour/include/hbmacro.h | 8 +- harbour/include/hbpp.h | 8 +- harbour/include/hbrdddel.h | 8 +- harbour/include/hbrddntx.h | 44 +- harbour/include/hbrddsdf.h | 8 +- harbour/include/hbrddwrk.h | 10 +- harbour/include/hbset.h | 8 +- harbour/include/hbstack.h | 8 +- harbour/include/hbtrace.h | 8 +- harbour/include/hbvm.h | 8 +- harbour/include/hbvmpub.h | 8 +- harbour/make_rpm.sh | 142 +++++- harbour/source/codepage/Makefile | 16 +- harbour/source/codepage/cdp_tpl.c | 3 +- harbour/source/codepage/cdpeldos.c | 3 +- harbour/source/codepage/cdpelwin.c | 3 +- harbour/source/codepage/cdpesdos.c | 2 +- harbour/source/codepage/cdpeswin.c | 7 +- harbour/source/codepage/cdpgedos.c | 3 +- harbour/source/codepage/cdpgewin.c | 7 +- harbour/source/codepage/cdphu852.c | 3 +- harbour/source/codepage/cdphuwin.c | 7 +- harbour/source/codepage/cdppl852.c | 3 +- harbour/source/codepage/cdppliso.c | 3 +- harbour/source/codepage/cdpplmaz.c | 3 +- harbour/source/codepage/cdpplwin.c | 3 +- harbour/source/codepage/cdppt850.c | 3 +- harbour/source/codepage/cdpptiso.c | 3 +- harbour/source/codepage/cdpru866.c | 3 +- harbour/source/codepage/cdprukoi.c | 3 +- harbour/source/codepage/cdpruwin.c | 3 +- harbour/source/codepage/cdpsl437.c | 3 +- harbour/source/codepage/cdpsl852.c | 3 +- harbour/source/codepage/cdpsliso.c | 3 +- harbour/source/codepage/cdpslwin.c | 3 +- harbour/source/codepage/cdpsrwin.c | 2 +- harbour/source/codepage/uc1250.c | 93 ++++ harbour/source/codepage/uc1251.c | 93 ++++ harbour/source/codepage/uc1253.c | 93 ++++ harbour/source/codepage/uc1257.c | 93 ++++ harbour/source/codepage/uc737.c | 93 ++++ harbour/source/codepage/uc850.c | 93 ++++ harbour/source/codepage/uc852.c | 93 ++++ harbour/source/codepage/uc866.c | 93 ++++ harbour/source/codepage/uc88591b.c | 93 ++++ harbour/source/codepage/uc8859_1.c | 93 ++++ harbour/source/codepage/uc8859_2.c | 93 ++++ harbour/source/codepage/uckoi8.c | 93 ++++ harbour/source/codepage/uckoi8u.c | 93 ++++ harbour/source/codepage/ucmaz.c | 93 ++++ harbour/source/common/expropt2.c | 64 +-- harbour/source/common/hbstr.c | 4 +- harbour/source/compiler/harbour.c | 6 +- harbour/source/macro/macro.y | 4 - harbour/source/pp/ppcore.c | 3 +- harbour/source/pp/pptable.c | 11 +- harbour/source/rdd/dbcmd.c | 10 + harbour/source/rdd/dbf1.c | 2 + harbour/source/rdd/dbfcdx/dbfcdx1.c | 26 +- harbour/source/rdd/dbfdbt/dbfdbt1.c | 44 +- harbour/source/rdd/dbffpt/dbffpt1.c | 4 +- harbour/source/rdd/dbfntx/dbfntx1.c | 627 ++++++++++++++++--------- harbour/source/rdd/dbfuncs.prg | 4 +- harbour/source/rdd/dbnubs.c | 46 +- harbour/source/rdd/dbstrux.prg | 16 +- harbour/source/rdd/hbdbsort.c | 1 - harbour/source/rdd/rddord.prg | 28 +- harbour/source/rdd/workarea.c | 47 +- harbour/source/rtl/cdpapi.c | 316 ++++++++++++- harbour/source/vm/codebloc.c | 4 - harbour/source/vm/fm.c | 34 ++ harbour/source/vm/hvm.c | 13 +- harbour/source/vm/itemapi.c | 10 +- harbour/source/vm/memvars.c | 22 +- 100 files changed, 3025 insertions(+), 1067 deletions(-) create mode 100644 harbour/source/codepage/uc1250.c create mode 100644 harbour/source/codepage/uc1251.c create mode 100644 harbour/source/codepage/uc1253.c create mode 100644 harbour/source/codepage/uc1257.c create mode 100644 harbour/source/codepage/uc737.c create mode 100644 harbour/source/codepage/uc850.c create mode 100644 harbour/source/codepage/uc852.c create mode 100644 harbour/source/codepage/uc866.c create mode 100644 harbour/source/codepage/uc88591b.c create mode 100644 harbour/source/codepage/uc8859_1.c create mode 100644 harbour/source/codepage/uc8859_2.c create mode 100644 harbour/source/codepage/uckoi8.c create mode 100644 harbour/source/codepage/uckoi8u.c create mode 100644 harbour/source/codepage/ucmaz.c diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2770c24656..393f0e08aa 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,161 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2004-12-28 10:30 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/harbour.spec + * harbour/hbgtmk.sh + * harbour/make_rpm.sh + * harbour/bin/pack_src.sh + * updated for recent changes in make process + + * harbour/contrib/Makefile + * added odbc lib for Linux compilation + + * harbour/contrib/btree/Makefile + * changed lib name from hb_btree to hbtree + + * harbour/contrib/btree/hb_btree.api + * harbour/contrib/btree/hb_btree.c + * fixed GCC compilation in HB_TR_DEBUG mode + + * harbour/contrib/hbzlib/hbzip.h + * harbour/contrib/hbzlib/include/hbzip.h + * harbour/include/hbapi.h + * harbour/include/hbapicdp.h + * harbour/include/hbapierr.h + * harbour/include/hbapifs.h + * harbour/include/hbapigt.h + * harbour/include/hbapiitm.h + * harbour/include/hbapilng.h + * harbour/include/hbapirdd.h + * harbour/include/hbcomp.h + * harbour/include/hbdate.h + * harbour/include/hbdbsort.h + * harbour/include/hberrors.h + * harbour/include/hbexprb.c + * harbour/include/hbexprop.h + * harbour/include/hbhash.h + * harbour/include/hbinit.h + * harbour/include/hbmacro.h + * harbour/include/hbpp.h + * harbour/include/hbrdddel.h + * harbour/include/hbrddntx.h + * harbour/include/hbrddsdf.h + * harbour/include/hbrddwrk.h + * harbour/include/hbset.h + * harbour/include/hbstack.h + * harbour/include/hbtrace.h + * harbour/include/hbvm.h + * harbour/include/hbvmpub.h + * changed #if defined (HB_EXTERN_C) to HB_EXTERN_BEGIN / HB_EXTERN_END + macros for easier manipulation with different ABI + * added HB_IS_BADITEM() macro for debugging + * synced CDP with xHarbour - added basic Unicode support + * synced RDD with xHarbour + + * harbour/source/codepage/Makefile + * harbour/source/codepage/cdp_tpl.c + * harbour/source/codepage/cdpeldos.c + * harbour/source/codepage/cdpelwin.c + * harbour/source/codepage/cdpesdos.c + * harbour/source/codepage/cdpeswin.c + * harbour/source/codepage/cdpgedos.c + * harbour/source/codepage/cdpgewin.c + * harbour/source/codepage/cdphu852.c + * harbour/source/codepage/cdphuwin.c + * harbour/source/codepage/cdppl852.c + * harbour/source/codepage/cdppliso.c + * harbour/source/codepage/cdpplmaz.c + * harbour/source/codepage/cdpplwin.c + * harbour/source/codepage/cdppt850.c + * harbour/source/codepage/cdpptiso.c + * harbour/source/codepage/cdpru866.c + * harbour/source/codepage/cdprukoi.c + * harbour/source/codepage/cdpruwin.c + * harbour/source/codepage/cdpsl437.c + * harbour/source/codepage/cdpsl852.c + * harbour/source/codepage/cdpsliso.c + * harbour/source/codepage/cdpslwin.c + * harbour/source/codepage/cdpsrwin.c + + harbour/source/codepage/uc1250.c + + harbour/source/codepage/uc1251.c + + harbour/source/codepage/uc1253.c + + harbour/source/codepage/uc1257.c + + harbour/source/codepage/uc737.c + + harbour/source/codepage/uc850.c + + harbour/source/codepage/uc852.c + + harbour/source/codepage/uc866.c + + harbour/source/codepage/uc88591b.c + + harbour/source/codepage/uc8859_1.c + + harbour/source/codepage/uc8859_2.c + + harbour/source/codepage/uckoi8.c + + harbour/source/codepage/uckoi8u.c + + harbour/source/codepage/ucmaz.c + * harbour/source/rtl/cdpapi.c + * synced HB CDP API with xHarbour - added basic Unicode support + + * harbour/source/common/expropt2.c + + * harbour/source/common/hbstr.c + * removed unnecessary initialization to avoid BCC warnings + + * harbour/source/compiler/harbour.c + * formatting + hb_compCodeBlockStop() looks like work in progress or is has + some old unused code - Ryszard, can you look at it? + + * harbour/source/macro/macro.y + * removed hack for GCC and old Bison versions + + * harbour/source/pp/ppcore.c + * removed unnecessary initialization to avoid BCC warnings + + * harbour/source/pp/pptable.c + + added some sets for RDD synchronization with xHarbour + + * harbour/source/rdd/dbcmd.c + + added __RDDGETTEMPALIAS + + * harbour/source/rdd/dbf1.c + * harbour/source/rdd/dbfuncs.prg + * harbour/source/rdd/dbnubs.c + * harbour/source/rdd/dbstrux.prg + * harbour/source/rdd/hbdbsort.c + * harbour/source/rdd/rddord.prg + * harbour/source/rdd/workarea.c + * harbour/source/rdd/dbfcdx/dbfcdx1.c + * harbour/source/rdd/dbfdbt/dbfdbt1.c + * harbour/source/rdd/dbffpt/dbffpt1.c + * harbour/source/rdd/dbfntx/dbfntx1.c + * synchronized with xHarbour - still dbcmd.c has to be synced yet + ! fixed all known bugs + Alexander, please look at DBFNTX - I hope all is correct. + + * harbour/source/vm/codebloc.c + * formatting + + * harbour/source/vm/fm.c + + added HB_PARANOID_MEM_CHECK to force reallocations in hb_xrealloc + and fill allocated and freed memory with HB_MEMFILER (0xff by default) + It's for debugging only. + + * harbour/source/vm/hvm.c + ! fixed hb_vmTopNumber() declaration for BCC + * use hb_gcCollectAll() at HVM exit instead of hb_gcReleaseAll() to + report allocated and not freed items - It could caused that some + programs begin to report memory leaks. + + * harbour/source/vm/itemapi.c + * check for HB_IS_BADITEM inside hb_itemClear() when compiled with + HB_PARANOID_MEM_CHECK for debugging + + * harbour/source/vm/memvars.c + * formatting + ! fixed pItem initialization in hb_memvarDetachLocal() + BTW - is this really necessary? I copy it form hb_itemUnRef() + but in fact it cannot detect all possible item reference cycles + if they appear - can they appear? + 2004-12-27 10:37 UTC+0100 Ryszard Glab * source/vm/memvars.c * changed algorithm for recycling of unused memvar values diff --git a/harbour/bin/pack_src.sh b/harbour/bin/pack_src.sh index 1b4fe13389..710a66388f 100644 --- a/harbour/bin/pack_src.sh +++ b/harbour/bin/pack_src.sh @@ -268,6 +268,12 @@ $hb_collect contrib/libct/*.[ch] $hb_collect contrib/libct/*.prg $hb_collect contrib/libct/*.ch +# CONTRIB\LIBNF +$hb_collect contrib/libnf/Makefile +$hb_collect contrib/libnf/*.[ch] +$hb_collect contrib/libnf/*.prg +$hb_collect contrib/libnf/*.ch + # CONTRIB\DOT $hb_collect contrib/dot/*.prg $hb_collect contrib/dot/*.ch @@ -280,6 +286,15 @@ $hb_collect contrib/odbc/*.ch $hb_collect contrib/odbc/*.prg $hb_collect contrib/odbc/*.txt +# CONTRIB\BTREE +$hb_collect contrib/btree/[mM]akefile* +$hb_collect contrib/btree/*.[ch] +$hb_collect contrib/btree/*.api +$hb_collect contrib/btree/*.ch +$hb_collect contrib/btree/*.prg +$hb_collect contrib/btree/*.bat +$hb_collect contrib/btree/doc/*.txt + # CONTRIB\HTMLLIB $hb_collect contrib/htmllib/[mM]akefile* $hb_collect contrib/htmllib/*.ch @@ -290,19 +305,18 @@ $hb_collect contrib/htmllib/*.bat $hb_collect contrib/libgt/[Mm]akefile* $hb_collect contrib/libgt/*.[ch] $hb_collect contrib/libgt/*.bat - -# CONTRIB\LIBGT\DOC $hb_collect contrib/libgt/doc/gen* $hb_collect contrib/libgt/doc/lib* - -# CONTRIB\LIBGT\DOC\EN -$hb_collect contrib/libgt/doc/*.txt +$hb_collect contrib/libgt/doc/en/*.txt # CONTRIB\LIBMISC $hb_collect contrib/libmisc/[mM]akefile* $hb_collect contrib/libmisc/*.[ch] $hb_collect contrib/libmisc/*.ch $hb_collect contrib/libmisc/*.prg +$hb_collect contrib/libmisc/doc/gen* +$hb_collect contrib/libmisc/doc/lib* +$hb_collect contrib/libmisc/doc/en/*.txt # CONTRIB\SAMPLES $hb_collect contrib/samples/[mM]akefile* diff --git a/harbour/contrib/Makefile b/harbour/contrib/Makefile index 816ca424ac..5ebc138c30 100644 --- a/harbour/contrib/Makefile +++ b/harbour/contrib/Makefile @@ -53,6 +53,7 @@ ifeq ($(HB_ARCHITECTURE),linux) DIRS +=\ rdd_ads \ + odbc \ endif endif diff --git a/harbour/contrib/btree/Makefile b/harbour/contrib/btree/Makefile index 60a4d2f7b4..407686cc13 100644 --- a/harbour/contrib/btree/Makefile +++ b/harbour/contrib/btree/Makefile @@ -16,6 +16,6 @@ PRG_SOURCES=\ PRG_HEADERS=\ hb_btree.ch -LIBNAME=hb_btree +LIBNAME=hbbtree include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/contrib/btree/hb_btree.api b/harbour/contrib/btree/hb_btree.api index 68fb89da2a..bc00668236 100644 --- a/harbour/contrib/btree/hb_btree.api +++ b/harbour/contrib/btree/hb_btree.api @@ -53,9 +53,7 @@ #ifndef HB_BTREE_API #define HB_BTREE_API -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN #include "hb_btree.ch" @@ -74,8 +72,6 @@ const BYTE * hb_BTreeKey( struct hb_BTree * pBTree ); LONG hb_BTreeData( struct hb_BTree * pBTree ); PHB_ITEM hb_BTreeDataItem( struct hb_BTree * pBTree ); -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif diff --git a/harbour/contrib/btree/hb_btree.c b/harbour/contrib/btree/hb_btree.c index ef026fd047..8cde17c4ca 100644 --- a/harbour/contrib/btree/hb_btree.c +++ b/harbour/contrib/btree/hb_btree.c @@ -186,9 +186,7 @@ see ChangeLog 2002-07-14 14:14 UTC+0500 April White #include "hb_btree.api" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN #if !defined( DEBUG ) && !defined( NDEBUG ) #define NDEBUG @@ -199,13 +197,15 @@ extern "C" { #if defined( __GNUC__ ) - #if 1 + #if 0 #define STRINGIFY_2( n ) #n #define STRINGIFY_1( n ) STRINGIFY_2( n ) #define SRCLINENO __FUNCTION__ " (" STRINGIFY_1( __LINE__ ) ")" #define FILESRCLINENO __FILE__ "." SRCLINENO - #else + #elif 0 #define SRCLINENO __FUNCTION__ + #else + #define SRCLINENO "%s (%d)", __FUNCTION__, __LINE__ #endif #else @@ -2017,6 +2017,4 @@ HB_INIT_SYMBOLS_BEGIN( hb_BTree_Initialize_Terminate ) { "hb_BTree_Terminate" , HB_FS_EXIT, {hb_BTree_Terminate} , NULL }, HB_INIT_SYMBOLS_END( hb_BTree_Initialize_Terminate ) -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END diff --git a/harbour/contrib/hbzlib/hbzip.h b/harbour/contrib/hbzlib/hbzip.h index 0da70cc170..129f663caa 100644 --- a/harbour/contrib/hbzlib/hbzip.h +++ b/harbour/contrib/hbzlib/hbzip.h @@ -62,9 +62,9 @@ #include #include "zip.h" #include "unzip.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif + +HB_EXTERN_BEGIN + #define filePos 1 #define Lenght 2 #define Method 3 @@ -84,8 +84,7 @@ extern void hb____ChangeFileDate(char *filename,uLong dosdate,tm_unz tmu_date); extern int hb___MakeDir(char *szNewDirectory); extern int hb___GetNumbersofFilestoUnzip(char *szFile); extern PHB_ITEM hb___GetFilesNamesFromZip(char *szFile,BOOL iMode); -#if defined(HB_EXTERN_C) -} -#endif + +HB_EXTERN_END #endif /* HB_APIEXT_H_ */ diff --git a/harbour/contrib/hbzlib/include/hbzip.h b/harbour/contrib/hbzlib/include/hbzip.h index 0da70cc170..129f663caa 100644 --- a/harbour/contrib/hbzlib/include/hbzip.h +++ b/harbour/contrib/hbzlib/include/hbzip.h @@ -62,9 +62,9 @@ #include #include "zip.h" #include "unzip.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif + +HB_EXTERN_BEGIN + #define filePos 1 #define Lenght 2 #define Method 3 @@ -84,8 +84,7 @@ extern void hb____ChangeFileDate(char *filename,uLong dosdate,tm_unz tmu_date); extern int hb___MakeDir(char *szNewDirectory); extern int hb___GetNumbersofFilestoUnzip(char *szFile); extern PHB_ITEM hb___GetFilesNamesFromZip(char *szFile,BOOL iMode); -#if defined(HB_EXTERN_C) -} -#endif + +HB_EXTERN_END #endif /* HB_APIEXT_H_ */ diff --git a/harbour/harbour.spec b/harbour/harbour.spec index 80c519c90d..0b7b6b7330 100644 --- a/harbour/harbour.spec +++ b/harbour/harbour.spec @@ -10,38 +10,68 @@ # See doc/license.txt for licensing terms. # --------------------------------------------------------------- +###################################################################### +# Conditional build: +# --with static - link all binaries with static libs +# --with adsrdd - build ads RDD +# --with mysql - build mysql lib (unused) +# --with pgsql - build pgsql lib (unused) +# --with odbc - build build odbc lib +# --without nf - do not build nanforum lib +# --without x11 - do not build GTXVT and GTXWC +# --without gpm - build GTSLN and GTCRS without GPM support +# --without gtsln - do not build GTSLN +###################################################################### + ###################################################################### ## Definitions. ###################################################################### -%define platform %(release=$(rpm -q --queryformat='.%{VERSION}' mandrake-release 2>/dev/null) && echo "mdk$release"|tr -d ".") +# please add your distro suffix if it not belong to the one recognized below +# and remember that order checking can be important + +%define platform %(release=$(rpm -q --queryformat='%{VERSION}' mandrake-release 2>/dev/null) && echo "mdk$release"|tr -d ".") %if "%{platform}" == "" - %define platform %(release=$(rpm -q --queryformat='.%{VERSION}' redhat-release 2>/dev/null) && echo "rh$release"|tr -d ".") +%define platform %(release=$(rpm -q --queryformat='%{VERSION}' redhat-release 2>/dev/null) && echo "rh$release"|tr -d ".") +%if "%{platform}" == "" +%define platform %(release=$(rpm -q --queryformat='%{VERSION}' fedora-release 2>/dev/null) && echo "fc$release"|tr -d ".") +%if "%{platform}" == "" +%define platform %(release=$(rpm -q --queryformat='%{VERSION}' suse-release 2>/dev/null) && echo "sus$release"|tr -d ".") +%if "%{platform}" == "" +%define platform %(release=$(rpm -q --queryformat='%{VERSION}' conectiva-release 2>/dev/null) && echo "cl$release"|tr -d ".") +%if "%{platform}" == "" +%define platform %(release=$(rpm -q --queryformat='%{VERSION}' aurox-release 2>/dev/null) && echo "aur$release"|tr -d ".") +%if "%{platform}" == "" +%define platform %([ -f /etc/pld-release ] && cat /etc/pld-release|sed -e '/1/ !d' -e 's/[^0-9]//g' -e 's/^/pld/') +%endif +%endif +%endif +%endif +%endif %endif %define name harbour %define dname Harbour %define version 0.44.0 %define releasen 0 -%define prefix /usr %define hb_pref hb -%define hb_gt crs -%define hb_gpm yes -%define hb_mt no -%define hb_mgt no -%define hb_lnkso yes -%define hb_libs vm pp rtl rdd dbfdbt dbffpt dbfcdx dbfntx macro common lang codepage gtnul gtcrs gtsln gtcgi gtstd gtpca odbc ct debug profiler +%define hb_arch export HB_ARCHITECTURE=linux %define hb_cc export HB_COMPILER=gcc %define hb_cflag export C_USR="-DHB_FM_STATISTICS_OFF -O2" -%define hb_arch export HB_ARCHITECTURE=linux -%define hb_cmt export HB_MT=%{hb_mt} -%define hb_cgt export HB_GT_LIB=gt%{hb_gt} -%define hb_cgpm export HB_GPM_MOUSE=%{hb_gpm} -%define hb_cmgt export HB_MULTI_GT=%{hb_mgt} -%define hb_bdir export HB_BIN_INSTALL=%{prefix}/bin -%define hb_idir export HB_INC_INSTALL=%{prefix}/include/%{name} -%define hb_ldir export HB_LIB_INSTALL=%{prefix}/lib/%{name} -%define hb_env %{hb_cc} ; %{hb_cflag} ; %{hb_arch} ; %{hb_cmt} ; %{hb_cgt} ; %{hb_cgpm} ; %{hb_cmgt} ; %{hb_bdir} ; %{hb_idir} ; %{hb_ldir} +%define hb_lflag export L_USR=%{?_with_static:-static} +%define hb_mt export HB_MT=no +%define hb_mgt export HB_MULTI_GT=no +%define hb_gt export HB_GT_LIB=gtcrs +%define hb_gpm export HB_GPM_MOUSE=%{!?_without_gpm:yes} +%define hb_sln export HB_WITHOUT_GTSLN=%{?_without_gtsln:yes} +%define hb_x11 export HB_WITHOUT_X11=%{?_without_x11:yes} +%define hb_bdir export HB_BIN_INSTALL=%{_bindir} +%define hb_idir export HB_INC_INSTALL=%{_includedir}/%{name} +%define hb_ldir export HB_LIB_INSTALL=%{_libdir}/%{name} +%define hb_opt export HB_GTALLEG=%{?_with_allegro:yes} +%define hb_cmrc export HB_COMMERCE=no +%define hb_env %{hb_arch} ; %{hb_cc} ; %{hb_cflag} ; %{hb_lflag} ; %{hb_mt} ; %{hb_gt} ; %{hb_gpm} ; %{hb_sln} ; %{hb_x11} ; %{hb_mgt} ; %{hb_bdir} ; %{hb_idir} ; %{hb_ldir} ; %{hb_opt} ; %{hb_cmrc} + %define hb_host www.harbour-project.org %define readme README.RPM ###################################################################### @@ -51,17 +81,17 @@ Summary: Free software Clipper compatible compiler Summary(pl): Darmowy kompilator kompatybilny z jЙzykiem Clipper. Summary(pt_BR): Um compilador Clipper compativel Gratis +Summary(ru): Свободный компилятор, совместимый с языком Clipper. Name: %{name} Version: %{version} Release: %{releasen}%{platform} -Prefix: %{prefix} Copyright: GPL (plus exception) Group: Development/Languages Vendor: %{hb_host} URL: http://%{hb_host}/ Source: %{name}-%{version}.src.tar.gz Packager: PrzemysЁaw Czerpak Luiz Rafael Culik Guimaraes -BuildPrereq: gcc binutils bash bison ncurses ncurses-devel slang-devel gpm-devel +BuildPrereq: gcc binutils bash bison ncurses ncurses-devel %{!?_without_gpm: gpm-devel} Requires: gcc binutils bash sh-utils %{name}-lib = %{version} Provides: %{name} harbour BuildRoot: /tmp/%{name}-%{version}-root @@ -81,8 +111,13 @@ zbiory nag %description -l pt_BR %{dname} ┌ um compilador Clipper compativel para multiplas plataformas. -Esse pacote contem um compilador ,um pr┌-processador, arquivos de cabe┤alho -uma maquina virtual e documenta┤фo +Esse pacote contem um compilador, um pr┌-processador, arquivos de cabe┤alho +uma maquina virtual e documenta┤фo. + +%description -l ru +%{dname} - многоплатформенный компилятор, совместимый с языком CA-Clipper. +Этот пакет содержит компилятор, препроцессор, файлы заголовков, виртуальную +машину и документацию. ###################################################################### @@ -92,6 +127,7 @@ uma maquina virtual e documenta %package lib Summary: Shared runtime libaries for %{dname} compiler Summary(pl): Dzielone bilioteki dla kompilatora %{dname} +Summary(ru): Совместно используемые библиотеки для компилятора %{dname} Group: Development/Languages Provides: lib%{name}.so lib%{name}mt.so @@ -108,7 +144,12 @@ dla program %description -l pt_BR lib %{dname} ┌ um compilador compativel com o Clipper. Esse pacote %{dname} provem as bibliotecas compartilhadas para programas -linkados dinamicamente +linkados dinamicamente. + +%description -l ru lib +%{dname} - компилятор, совместимый с языком CA-Clipper. +Этот пакет содержит совместно используемые библиотеки %{dname}, +необходимые для работы динамически скомпонованных программ. ###################################################################### @@ -118,6 +159,7 @@ linkados dinamicamente %package static Summary: Static runtime libaries for %{dname} compiler Summary(pl): Statyczne bilioteki dla kompilatora %{dname} +Summary(ru): Статические библиотеки для компилятора %{dname} Group: Development/Languages Requires: %{name} = %{version} @@ -136,6 +178,38 @@ niezb Esse pacote %{dname} provem as bibliotecas de run time staticas para linkagem dos os programas +%description -l ru static +%{dname} - компилятор, совместимый с языком CA-Clipper. +Этот пакет содержит статические библиотеки компилятора %{dname}, +необходимые для статической компоновки программ. + + +%package contrib +Summary: Contrib runtime libaries for %{dname} compiler +Summary(pl): Bilioteki z drzewa contrib dla kompilatora %{dname} +Summary(pt_BR): Libs contrib para %{dname} +Summary(ru): Библиотеки из дерева contrib для компилятора %{dname} +Group: Development/Languages +Requires: %{name} = %{version} + +%description contrib +%{dname} is a Clipper compatible compiler. +This package provides %{dname} contrib libraries for program linking. + +%description -l pl contrib +%{dname} to kompatybilny z jЙzykiem CA-Clipper kompilator. +Ten pakiet udostЙpnia statyczne bilioteki z drzewa contrib dla +kompilatora %{dname}. + +%description -l pt_BR contrib +%{dname} ┌ um compilador compativel com o clippe. +Esse pacote %{dname} provem as bibliotecas contrib para linkagem +dos programas. + +%description -l ru contrib +%{dname} - компилятор, совместимый с языком CA-Clipper. +Этот пакет содержит статические библиотеки %{dname} из дерева contrib. + ###################################################################### ## PP @@ -144,6 +218,7 @@ dos os programas %package pp Summary: Clipper/Harbour/xBase compatible Pre-Processor, DOT prompt and interpreter Summary(pl): Kompatybilny z Clipper/Harbour/xBase Preprocesor i interpreter +Summary(ru): Совместимый с Clipper/Harbour/xBase препроцессор и интерпретатор Copyright: GPL Group: Development/Languages Requires: %{name} = %{version} @@ -182,6 +257,18 @@ uma da outra. Voce pode escrever seus proprios scritps em .prg ao adicionar as seus arquivos .prg #!/usr/bin/pprun +%description -l ru pp +%{dname} - компилятор, совместимый с языком CA-Clipper. +Этот пакет содержит препроцессор %{dname}, который состоит из трех тесно +связанных частей. +1. 100%-совместимый с Clipper препроцессор (с некоторыми расширениями). +2. DOT Prompt, в котором можно использовать большинство конструкций Clipper. +3. Кроме того, PP - ограниченный интерпретатор Clipper. За исключением + нескольких описанных ограничений, он может выполнять большинство + конструкций Harbour. Можно создавать собственные xBase-скрипты путем + добавления в начало .prg-файла строки: + #!/usr/bin/pprun + ###################################################################### ## Preperation. @@ -198,12 +285,7 @@ rm -rf $RPM_BUILD_ROOT %build %{hb_env} -make - -# build CT lib -pushd contrib/libct - make -popd +make -r ###################################################################### ## Install. @@ -215,7 +297,9 @@ popd %{hb_env} -_DEFAULT_INC_DIR=$HB_INC_INSTALL +export _DEFAULT_BIN_DIR=$HB_BIN_INSTALL +export _DEFAULT_INC_DIR=$HB_INC_INSTALL +export _DEFAULT_LIB_DIR=$HB_LIB_INSTALL export HB_BIN_INSTALL=$RPM_BUILD_ROOT/$HB_BIN_INSTALL export HB_INC_INSTALL=$RPM_BUILD_ROOT/$HB_INC_INSTALL export HB_LIB_INSTALL=$RPM_BUILD_ROOT/$HB_LIB_INSTALL @@ -223,330 +307,18 @@ export HB_LIB_INSTALL=$RPM_BUILD_ROOT/$HB_LIB_INSTALL mkdir -p $HB_BIN_INSTALL mkdir -p $HB_INC_INSTALL mkdir -p $HB_LIB_INSTALL -mkdir -p $RPM_BUILD_ROOT/usr/lib -make -i install +make -r -i install -# install CT lib -pushd contrib/libct - make -i install -popd - -# build fm lib with memory statistic -pushd source/vm - TMP_C_USR=$C_USR - C_USR=${C_USR//-DHB_FM_STATISTICS_OFF/-DHB_PARANOID_MEM_CHECK} - rm -f fm.o - make fm.o - ar -r $HB_LIB_INSTALL/libfm.a fm.o - rm -f fm.o - if [ $HB_MT = "MT" ]; then - make fm.o 'HB_LIBCOMP_MT=YES' - ar -r $HB_LIB_INSTALL/libfmmt.a fm.o - rm -f fm.o - fi - C_USR=$TMP_C_USR -popd +[ "%{?_without_gtsln:1}" ] && rm -f $HB_LIB_INSTALL/libgtsln.a +[ "%{?_with_odbc:1}" ] || rm -f $HB_LIB_INSTALL/libhbodbc.a +[ "%{?_with_allegro:1}" ] || rm -f $HB_LIB_INSTALL/libgtalleg.a # Keep the size of the binaries to a minimim. strip $HB_BIN_INSTALL/harbour # Keep the size of the libraries to a minimim. strip --strip-debug $HB_LIB_INSTALL/* -install -m755 bin/hb-mkslib.sh $HB_BIN_INSTALL/hb-mkslib - -pushd $HB_LIB_INSTALL -LIBS="" -LIBSMT="" -for l in %{hb_libs} -do - case $l in - debug|profiler) ;; - *) - ls="lib${l}.a" - if [ -f lib${l}mt.a ] - then - lm="lib${l}mt.a" - else - lm="${ls}" - fi - if [ "${HB_MULTI_GT}" = "yes" ] || \ - [ "${l#gt}" = "${l}" ] || \ - [ "${l}" == "${HB_GT_LIB}" ] - then - if [ -f $ls ] - then - LIBS="$LIBS $ls" - fi - if [ -f $lm ] - then - LIBSMT="$LIBSMT $lm" - fi - fi - ;; - esac -done -$HB_BIN_INSTALL/hb-mkslib lib%{name}-%{version}.so $LIBS -[ $HB_MT != "MT" ] || $HB_BIN_INSTALL/hb-mkslib lib%{name}mt-%{version}.so $LIBSMT -for l in lib%{name}-%{version}.so lib%{name}mt-%{version}.so -do - if [ -f $l ] - then - ll=${l%%-%{version}.so}.so - ln -s $l $ll && ln -s %{name}/$l $RPM_BUILD_ROOT/usr/lib/$ll - fi -done -#export LD_LIBRARY_PATH="$HB_LIB_INSTALL:$LD_LIBRARY_PATH" -popd - -# Add a harbour compiler wrapper. -cat > $HB_BIN_INSTALL/%{hb_pref}-build <] [.prg|.o] - -\"%{hb_pref}cc\", \"%{hb_pref}cmp\", \"%{hb_pref}lnk\" and \"%{hb_pref}mk\" parameters: - -o # output file name -\"%{hb_pref}lnk\" and \"%{hb_pref}mk\" parameters: - -static # link with static %{dname} libs - -fullstatic # link with all static libs - -shared # link with shared libs (default) - -mt # link with multi-thread libs - -gt # link with GT driver, can be repeated to - # link with more GTs. The first one will be - # the default at runtime - -fmstat # link with the memory statistics lib - -nofmstat # do not link with the memory statistics lib (default) - -main= # set the name of main program function/procedure. - # if not set then 'MAIN' is used or if it doesn't - # exist the name of first public function/procedure - # in first linked object module (link) -" - exit 1 -elif [ "\$*" == "mk-links" ]; then - DIR="\${0%/*}" - NAME="\${0##*/}" - if [ "\${DIR}" != "\${NAME}" ]; then - for n in %{hb_pref}cc %{hb_pref}cmp %{hb_pref}mk %{hb_pref}lnk gharbour harbour-link; do - ln -sf "\${NAME}" "\${DIR}/\${n}" - done - fi - exit -fi - -## default parameters -HB_STATIC="no" -HB_MT="" -HB_GT="%{hb_gt}" -HB_MG="%{hb_mgt}" - -HB_GT_REQ="" -HB_FM_REQ="" -HB_MAIN_FUNC="" -_TMP_FILE_="/tmp/hb-build-\$USER-\$\$.c" - -## parse params -P=( "\$@" ); n=0; DIROUT="."; FILEOUT="" -while [ \$n -lt \${#P[@]} ]; do - v=\${P[\$n]}; p="" - case "\$v" in - -o*) - d="\${v#-o}"; p="\${v}" - if [ -d "\${d}" ]; then - DIROUT="\${d%/}" - elif [ -d "\${d%/*}" ]; then - DIROUT="\${d%/*}"; FILEOUT="\${d##*/}"; p="-o\${d%.*}" - elif [ -n "\${d}" ]; then - FILEOUT="\${d}"; p="-o\${d%.*}" - fi ;; - -static) HB_STATIC="yes" ;; - -fullstatic) HB_STATIC="full" ;; - -shared) HB_STATIC="no" ;; - -mt) HB_MT="MT" ;; - -gt*) HB_GT_REQ="\${HB_GT_REQ} \${v#-gt}" ;; - -fmstat) HB_FM_REQ="STAT" ;; - -nofmstat) HB_FM_REQ="NOSTAT" ;; - -main=*) HB_MAIN_FUNC="\${v#*=}" ;; - -*) p="\${v}" ;; - *) [ -z \${FILEOUT} ] && FILEOUT="\${v##*/}"; p="\${v}" ;; - esac - [ -n "\$p" ] && PP[\$n]="\$p" - n=\$[\$n + 1] -done -P=( "\${PP[@]}" ) - -case "\${HB_MT}" in - [Mm][Tt]|[Yy][Ee][Ss]|1) HB_MT="MT";; - *) HB_MT="";; -esac - -SYSTEM_LIBS="-lm -lncurses -lslang -lgpm" -# use pthread system library for MT programs -if [ "\${HB_MT}" = "MT" ]; then - SYSTEM_LIBS="-lpthread \${SYSTEM_LIBS}" -fi - -HB_GT_STAT="" -[ -z "\${HB_GT_REQ}" ] && HB_GT_REQ="\${HB_GT}" -if [ "\${HB_MG}" != "yes" ]; then - [ "\${HB_STATIC}" = "yes" ] && HB_GT_STAT=\`echo \${HB_GT_REQ}|tr A-Z a-z\` - HB_GT_REQ="" -else - HB_GT_REQ=\`echo \${HB_GT_REQ}|tr a-z A-Z\` -fi -HB_MAIN_FUNC=\`echo \${HB_MAIN_FUNC}|tr a-z A-Z\` - -# set environment variables -%{hb_arch} -%{hb_cc} -[ -z "\${HB_BIN_INSTALL}" ] && %{hb_bdir} -[ -z "\${HB_INC_INSTALL}" ] && %{hb_idir} -[ -z "\${HB_LIB_INSTALL}" ] && %{hb_ldir} - -# be sure that %{name} binaries are in your path -export PATH="\${HB_BIN_INSTALL}:\${PATH}" - -HB_PATHS="-I\${HB_INC_INSTALL}" -GCC_PATHS="\${HB_PATHS} -L\${HB_LIB_INSTALL}" -LINK_OPT="" -if [ "\${HB_STATIC}" = "full" ]; then - LINK_OPT="\${LINK_OPT} -static" - HB_STATIC="yes" -fi - -HARBOUR_LIBS="" -if [ "\${HB_STATIC}" = "yes" ]; then - libs="%{hb_libs}" -else - l="%{name}" - [ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.so" ] && l="\${l}mt" - [ -f "\${HB_LIB_INSTALL}/lib\${l}.so" ] && HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}" - libs="debug profiler" -fi -for l in \${libs} -do - if [ "\${HB_MG}" = "yes" ] || [ "\${l#gt}" = "\${l}" ] || [ "\${l}" == "gt\${HB_GT_STAT}" ]; then - [ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.a" ] && l="\${l}mt" - [ -f "\${HB_LIB_INSTALL}/lib\${l}.a" ] && HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}" - fi -done -HARBOUR_LIBS="-Wl,--start-group \${HARBOUR_LIBS} -Wl,--end-group" -l="fm" -[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.a" ] && l="\${l}mt" -if [ -f "\${HB_LIB_INSTALL}/lib\${l}.a" ]; then - if [ "\${HB_STATIC}" = "yes" ] && [ "\${HB_FM_REQ}" = "STAT" ]; then - HARBOUR_LIBS="-l\${l} \${HARBOUR_LIBS}" - else - HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}" - fi -fi - -FOUTC="\${DIROUT}/\${FILEOUT%.*}.c" -FOUTO="\${DIROUT}/\${FILEOUT%.*}.o" -FOUTE="\${DIROUT}/\${FILEOUT%.[Pp][Rr][Gg]}" -FOUTE="\${FOUTE%.[oc]}" - -hb_cc() -{ - harbour "\$@" \${HB_PATHS} && [ -f "\${FOUTC}" ] -} - -hb_link() -{ - if [ -n "\${HB_MAIN_FUNC}" ]; then - HB_MAIN_FUNC="@\${HB_MAIN_FUNC}" - elif [ -f "\${FOUTO}" ]; then - HB_MAIN_FUNC=\`hb_lnk_main "\${FOUTO}"\` - fi - if [ -n "\${HB_GT_REQ}" ] || [ -n "\${HB_FM_REQ}" ] || [ -n "\${HB_MAIN_FUNC}" ]; then - hb_lnk_request > \${_TMP_FILE_} && \\ - gcc "\$@" "\${_TMP_FILE_}" \${LINK_OPT} \${GCC_PATHS} \${HARBOUR_LIBS} \${SYSTEM_LIBS} -o "\${FOUTE}" - else - gcc "\$@" \${LINK_OPT} \${GCC_PATHS} \${HARBOUR_LIBS} \${SYSTEM_LIBS} -o "\${FOUTE}" - fi -} - -hb_cmp() -{ - hb_cc "\$@" && \\ - gcc -g -c "\${FOUTC}" -o "\${FOUTO}" \${GCC_PATHS} && \\ - rm -f "\${FOUTC}" -} - -hb_lnk_request() -{ - echo "#include \\"hbapi.h\\"" - if [ "\${HB_STATIC}" = "yes" ] || [ -n "\${HB_FM_REQ}" ]; then - for gt in \${HB_GT_REQ}; do - echo "extern HB_FUNC( HB_GT_\${gt} );" - done - if [ -n "\${HB_FM_REQ}" ]; then - echo "extern HB_FUNC( HB_FM_\${HB_FM_REQ} );" - fi - echo "void hb_lnk_ForceLink_build( void )" - echo "{" - for gt in \${HB_GT_REQ}; do - echo " HB_FUNCNAME( HB_GT_\${gt} )();" - done - if [ -n "\${HB_FM_REQ}" ]; then - echo " HB_FUNCNAME( HB_FM_\${HB_FM_REQ} )();" - fi - echo "}" - fi - gt="\${HB_GT_REQ%%%% *}" - if [ -n "\$gt" ] || [ -n "\${HB_MAIN_FUNC}" ]; then - echo "#include \\"hbinit.h\\"" - echo "extern char * s_defaultGT;" - echo "extern char * s_pszLinkedMain;" - echo "HB_CALL_ON_STARTUP_BEGIN( hb_lnk_SetDefault_build )" - if [ -n "\$gt" ]; then - echo " s_defaultGT = \\"\$gt\\";" - fi - if [ -n "\${HB_MAIN_FUNC}" ]; then - echo " s_pszLinkedMain = \\"\${HB_MAIN_FUNC}\\";" - fi - echo "HB_CALL_ON_STARTUP_END( hb_lnk_SetDefault_build )" - fi -} - -hb_lnk_main() -{ -# (nm \$1 -g -n --defined-only|sed -e '/HB_FUN_/ ! d' -e 's/^[0-9a-fA-F]* T HB_FUN_//'|head -1|grep -v '^MAIN\$')2>/dev/null - (nm \$1 -n --defined-only|sed -e '/HB_FUN_/ ! d' -e 's/^[0-9a-fA-F]* [Tt] HB_FUN_//'|head -1|grep -v '^MAIN\$')2>/dev/null -} - -hb_cleanup() -{ - rm -f "\${_TMP_FILE_}" -} - -trap hb_cleanup EXIT &>/dev/null - -## get basename -HB="\${0##*/}" - -case "\${HB}" in - *cc) - hb_cc "\${P[@]}" - ;; - *cmp|gharbour) - hb_cmp "\${P[@]}" - ;; - *lnk|harbour-link) - hb_link "\${P[@]}" - ;; - *mk) - hb_cmp "\${P[@]}" && \\ - hb_link "\${FOUTO}" && \\ - strip "\${FOUTE}" && \\ - rm -f "\${FOUTO}" - ;; -esac -EOF -chmod 755 $HB_BIN_INSTALL/%{hb_pref}-build -$HB_BIN_INSTALL/%{hb_pref}-build mk-links - mkdir -p $RPM_BUILD_ROOT/etc/harbour #install -m644 source/rtl/gtcrs/hb-charmap.def $RPM_BUILD_ROOT/etc/harbour/hb-charmap.def cat > $RPM_BUILD_ROOT/etc/harbour.cfg < doc/%{readme} < /dev/null + rpm -q --whatprovides "$1" &> /dev/null } TOINST_LST="" -for i in cvs gcc binutils bash bison ncurses ncurses-devel slang-devel gpm-devel +for i in cvs gcc binutils bash bison ncurses ncurses-devel do test_reqrpm "$i" || TOINST_LST="${TOINST_LST} $i" done diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index 5740b42e83..9e3fc27a68 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -60,9 +60,7 @@ #include "hbvmpub.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN #define HB_MAX_MACRO_ARGS 16 @@ -108,6 +106,7 @@ extern "C" { #define HB_IS_NUMERIC( p ) ( ( p )->type & HB_IT_NUMERIC ) #define HB_IS_NUMINT( p ) ( ( p )->type & HB_IT_NUMINT ) #define HB_IS_COMPLEX( p ) ( ( p )->type & HB_IT_COMPLEX ) +#define HB_IS_BADITEM( p ) ( ( p )->type & HB_IT_COMPLEX && ( p )->type & ~( HB_IT_COMPLEX | HB_IT_MEMOFLAG ) ) #if defined(__GNUC__) # define HB_ITEM_NIL { HB_IT_NIL, {} } @@ -293,9 +292,9 @@ typedef struct _HB_CODEBLOCK typedef struct _HB_VALUE { - HB_ITEM_PTR pVarItem; - ULONG counter; - HB_HANDLE hPrevMemvar; + HB_ITEM_PTR pVarItem; + HB_COUNTER counter; + HB_HANDLE hPrevMemvar; } HB_VALUE, * PHB_VALUE, * HB_VALUE_PTR; typedef struct _HB_NESTED_CLONED @@ -574,7 +573,7 @@ extern void hb_memvarNewParameter( PHB_SYMB pSymbol, PHB_ITEM pValue ); extern char * hb_memvarGetStrValuePtr( char * szVarName, ULONG *pulLen ); extern void hb_memvarCreateFromItem( PHB_ITEM pMemvar, BYTE bScope, PHB_ITEM pValue ); extern int hb_memvarScope( char * szVarName, ULONG ulLength ); /* retrieve scope of a dynamic variable symbol */ -extern HB_ITEM_PTR hb_memvarDetachLocal( HB_ITEM_PTR pLocal ); /* Detach a local variable from the eval stack */ +extern HB_ITEM_PTR hb_memvarDetachLocal( HB_ITEM_PTR pLocal ); /* Detach a local variable from the eval stack */ /* console I/O subsystem */ extern void hb_conInit( void ); /* initialize the console API system */ @@ -695,8 +694,6 @@ extern char * hb_getenv( const char * name ); /* Dummy define for start */ #define HB_I_( x ) x -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_APIEXT_H_ */ diff --git a/harbour/include/hbapicdp.h b/harbour/include/hbapicdp.h index 35ca89c052..53c0f7aa5f 100644 --- a/harbour/include/hbapicdp.h +++ b/harbour/include/hbapicdp.h @@ -50,6 +50,8 @@ * */ +#ifndef HB_CDP_SUPPORT_OFF + #ifndef HB_APICDP_H_ #define HB_APICDP_H_ @@ -57,23 +59,29 @@ #include "hbapi.h" #include "hbinit.h" +HB_EXTERN_BEGIN + /* This hack is needed to force preprocessing if id is also a macro */ -#define HB_CODEPAGE_REQUEST( id ) HB_CODEPAGE_REQUEST_( id ) -#define HB_CODEPAGE_REQUEST_( id ) \ - extern HB_FUNC( HB_CODEPAGE_##id ); \ - void hb_codepage_ForceLink( void ) \ - { \ - HB_FUNCNAME( HB_CODEPAGE_##id )(); \ - } +#define HB_CODEPAGE_REQUEST( id ) HB_CODEPAGE_REQUEST_( id ) +#define HB_CODEPAGE_REQUEST_( id ) HB_FUNC_EXTERN( HB_CODEPAGE_##id ); \ + void hb_codepage_ForceLink_##id( void ) \ + { \ + HB_FUNCNAME( HB_CODEPAGE_##id )(); \ + } +#define HB_CODEPAGE_ANNOUNCE( id ) HB_FUNC( HB_CODEPAGE_##id ) {} -#define HB_CODEPAGE_ANNOUNCE( id ) HB_FUNC( HB_CODEPAGE_##id ) {} - -#define HB_CODEPAGE_INIT( id ) \ - HB_CODEPAGE_ANNOUNCE( id ); \ - HB_CALL_ON_STARTUP_BEGIN( hb_codepage_Init_##id ) \ - hb_cdpRegister( &s_codepage ); \ - HB_CALL_ON_STARTUP_END( hb_codepage_Init_##id ) +#define HB_CODEPAGE_INIT( id ) HB_CODEPAGE_ANNOUNCE( id ); \ + HB_CALL_ON_STARTUP_BEGIN( hb_codepage_Init_##id ) \ + hb_cdpRegister( &s_codepage ); \ + HB_CALL_ON_STARTUP_END( hb_codepage_Init_##id ) +typedef struct _HB_UNITABLE +{ + char *uniID; + int nChars; + BOOL lMulti; + USHORT *uniCodes; +} HB_UNITABLE, * PHB_UNITABLE; typedef struct _HB_MULTICHAR { @@ -84,31 +92,95 @@ typedef struct _HB_MULTICHAR typedef struct _HB_CODEPAGE { - char *id; - int nChars; - char *CharsUpper; - char *CharsLower; - BOOL lLatin; - BOOL lAccEqual; - BOOL lAccInterleave; - BOOL lSort; - BYTE *s_chars; - BYTE *s_upper; - BYTE *s_lower; - BYTE *s_accent; - int nMulti; - PHB_MULTICHAR multi; + char * id; + char * uniID; + PHB_UNITABLE uniTable; + int nChars; + char * CharsUpper; + char * CharsLower; + BOOL lLatin; + BOOL lAccEqual; + BOOL lAccInterleave; + BOOL lSort; + BYTE * s_chars; + BYTE * s_upper; + BYTE * s_lower; + BYTE * s_accent; + int nMulti; + PHB_MULTICHAR multi; } HB_CODEPAGE, * PHB_CODEPAGE; -extern BOOL hb_cdpRegister( PHB_CODEPAGE ); -extern char * hb_cdpSelectID( char * ); -extern PHB_CODEPAGE hb_cdpSelect( PHB_CODEPAGE ); -extern PHB_CODEPAGE hb_cdpFind( char * ); -extern void hb_cdpTranslate( char*, PHB_CODEPAGE, PHB_CODEPAGE ); -extern void hb_cdpnTranslate( char*, PHB_CODEPAGE, PHB_CODEPAGE, unsigned int ); -extern int hb_cdpcmp( char*, char*, ULONG, PHB_CODEPAGE, ULONG* ); -extern int hb_cdpchrcmp( char cFirst, char cSecond, PHB_CODEPAGE cdpage ); +extern BOOL HB_EXPORT hb_cdpRegister( PHB_CODEPAGE ); +extern char * HB_EXPORT hb_cdpSelectID( char * ); +extern PHB_CODEPAGE HB_EXPORT hb_cdpSelect( PHB_CODEPAGE ); +extern PHB_CODEPAGE HB_EXPORT hb_cdpFind( char * ); +extern void HB_EXPORT hb_cdpTranslate( char*, PHB_CODEPAGE, PHB_CODEPAGE ); +extern void HB_EXPORT hb_cdpnTranslate( char*, PHB_CODEPAGE, PHB_CODEPAGE, unsigned int ); +extern int HB_EXPORT hb_cdpcmp( char*, char*, ULONG, PHB_CODEPAGE, ULONG* ); +extern int HB_EXPORT hb_cdpchrcmp( char, char, PHB_CODEPAGE ); +extern void HB_EXPORT hb_cdpReleaseAll( void ); + +extern USHORT HB_EXPORT hb_cdpGetU16( PHB_CODEPAGE, BYTE ); +extern BOOL HB_EXPORT hb_cdpGetFromUTF8( PHB_CODEPAGE cdp, BYTE ch, int * n, USHORT * uc ); +extern ULONG HB_EXPORT hb_cdpStrnToUTF( PHB_CODEPAGE, BYTE*, ULONG, BYTE* ); +extern ULONG HB_EXPORT hb_cdpStrnToU16( PHB_CODEPAGE, BYTE*, ULONG, BYTE* ); extern PHB_CODEPAGE hb_cdp_page; + +#define CPID_437 "cp437" +#define CPID_737 "cp737" +#define CPID_850 "cp850" +#define CPID_852 "cp852" +#define CPID_866 "cp866" +#define CPID_1250 "cp1250" +#define CPID_1251 "cp1251" +#define CPID_1253 "cp1253" +#define CPID_1257 "cp1257" +#define CPID_8859_1 "iso8859-1" +#define CPID_8859_1B "iso8859-1b" +#define CPID_8859_2 "iso8859-2" +#define CPID_KOI_8 "koi-8" +#define CPID_KOI_8U "koi-8u" +#define CPID_MAZ "plmaz" +#define UNITB_437 &hb_uniTbl_437 +#define UNITB_737 &hb_uniTbl_737 +#define UNITB_850 &hb_uniTbl_850 +#define UNITB_852 &hb_uniTbl_852 +#define UNITB_866 &hb_uniTbl_866 +#define UNITB_1250 &hb_uniTbl_1250 +#define UNITB_1251 &hb_uniTbl_1251 +#define UNITB_1253 &hb_uniTbl_1253 +#define UNITB_1257 &hb_uniTbl_1257 +#define UNITB_8859_1 &hb_uniTbl_8859_1 +#define UNITB_8859_1B &hb_uniTbl_8859_1b +#define UNITB_8859_2 &hb_uniTbl_8859_2 +#define UNITB_KOI_8 &hb_uniTbl_KOI_8 +#define UNITB_KOI_8U &hb_uniTbl_KOI_8U +#define UNITB_MAZ &hb_uniTbl_mazovia +#define UNITB_UNDEF NULL /* ((PHB_UNITABLE) (-1)) */ + +extern HB_UNITABLE hb_uniTbl_437; +extern HB_UNITABLE hb_uniTbl_737; +extern HB_UNITABLE hb_uniTbl_850; +extern HB_UNITABLE hb_uniTbl_852; +extern HB_UNITABLE hb_uniTbl_866; +extern HB_UNITABLE hb_uniTbl_1250; +extern HB_UNITABLE hb_uniTbl_1251; +extern HB_UNITABLE hb_uniTbl_1253; +extern HB_UNITABLE hb_uniTbl_1257; +extern HB_UNITABLE hb_uniTbl_8859_1; +extern HB_UNITABLE hb_uniTbl_8859_1b; +extern HB_UNITABLE hb_uniTbl_8859_2; +extern HB_UNITABLE hb_uniTbl_KOI_8; +extern HB_UNITABLE hb_uniTbl_KOI_8U; +extern HB_UNITABLE hb_uniTbl_mazovia; + +HB_EXTERN_END + #endif /* HB_APICDP_H_ */ +#else + +#define PHB_CODEPAGE void* + +#endif /* HB_CDP_SUPPORT_OFF */ diff --git a/harbour/include/hbapierr.h b/harbour/include/hbapierr.h index edac6280fd..03c1b22cee 100644 --- a/harbour/include/hbapierr.h +++ b/harbour/include/hbapierr.h @@ -56,9 +56,7 @@ #include "hbapi.h" #include "error.ch" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN /* Error codes (returned from hb_errLaunch()) */ @@ -173,8 +171,6 @@ typedef struct HB_ERROR_INFO_ /* set/get current error handler */ extern HB_ERROR_INFO_PTR hb_errorHandler( HB_ERROR_INFO_PTR pNewHandler ); -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_APIERR_H_ */ diff --git a/harbour/include/hbapifs.h b/harbour/include/hbapifs.h index 2596d34bb6..5db4bb4ad7 100644 --- a/harbour/include/hbapifs.h +++ b/harbour/include/hbapifs.h @@ -56,9 +56,7 @@ #include "hbapi.h" #include "fileio.ch" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN #define FS_ERROR F_ERROR #if defined(X__WIN32__) @@ -204,8 +202,6 @@ extern char * hb_fsAttrDecode( USHORT uiAttr, char * szAttr ); extern BYTE * hb_filecase ( char * ); /* Convert string to environment case */ extern BYTE HB_EXPORT * hb_fileNameConv(char *str) ; -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_APIFS_H_ */ diff --git a/harbour/include/hbapigt.h b/harbour/include/hbapigt.h index 5aa4df9edd..cba753b093 100644 --- a/harbour/include/hbapigt.h +++ b/harbour/include/hbapigt.h @@ -325,8 +325,6 @@ extern void hb_setkeyExit( void ); /* none as of yet */ -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_APIGT_H_ */ diff --git a/harbour/include/hbapiitm.h b/harbour/include/hbapiitm.h index 8f6728e5c1..1dc75ffefd 100644 --- a/harbour/include/hbapiitm.h +++ b/harbour/include/hbapiitm.h @@ -55,9 +55,7 @@ #include "hbapi.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN #define HB_EVAL_PARAM_MAX_ 9 @@ -143,8 +141,6 @@ extern PHB_ITEM hb_itemValToStr ( PHB_ITEM pItem ); /* Convert any scalar to a s extern char * hb_itemPadConv ( PHB_ITEM pItem, ULONG * pulSize, BOOL * bFreeReq ); extern void hb_itemSwap ( PHB_ITEM pItem1, PHB_ITEM pItem2 ); -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_APIITM_H_ */ diff --git a/harbour/include/hbapilng.h b/harbour/include/hbapilng.h index 323e0dc185..4e4273864f 100644 --- a/harbour/include/hbapilng.h +++ b/harbour/include/hbapilng.h @@ -59,9 +59,7 @@ #include "hblang.ch" /* Base values for the unified language item table */ -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN /* This hack is needed to force preprocessing if id is also a macro */ #define HB_LANG_REQUEST( id ) HB_LANG_REQUEST_( id ) @@ -97,9 +95,7 @@ extern char * hb_langName ( void ); extern char * hb_langDGetErrorDesc ( ULONG ulIndex ); -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_APILNG_H_ */ diff --git a/harbour/include/hbapirdd.h b/harbour/include/hbapirdd.h index c3e22368e5..b64ff4fb6f 100644 --- a/harbour/include/hbapirdd.h +++ b/harbour/include/hbapirdd.h @@ -57,9 +57,7 @@ #include "dbinfo.ch" /* Constants for SELF_ORDINFO, SELF_INFO(), SELF_RECINFO() */ #include "dbstruct.ch" /* Constants for SELF_FIELDINFO() */ -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN #define HARBOUR_MAX_RDD_DRIVERNAME_LENGTH 32 #define HARBOUR_MAX_RDD_ALIAS_LENGTH 32 @@ -90,6 +88,7 @@ extern void hb_rddShutDown( void ); #define EDBCMD_USE_BADPARAMETER 1005 #define EDBCMD_REL_BADPARAMETER 1006 #define EDBCMD_FIELDNAME_BADPARAMETER 1009 +#define EDBCMD_BADALIAS 1010 #define EDBCMD_DUPALIAS 1011 #define EDBCMD_DBCMDBADPARAMETER 1014 #define EDBCMD_BADPARAMETER 1015 @@ -558,15 +557,15 @@ typedef USHORT ( * DBENTRYP_SVL )( AREAP area, USHORT index, ULONG * param ); typedef USHORT ( * DBENTRYP_SSI )( AREAP area, USHORT p1, USHORT p2, PHB_ITEM p3 ); typedef USHORT ( * DBENTRYP_ISI )( AREAP area, PHB_ITEM p1, USHORT p2, PHB_ITEM p3 ); typedef USHORT ( * DBENTRYP_BIB )( AREAP area, BOOL p1, PHB_ITEM p2, BOOL p3 ); -typedef USHORT ( * DBENTRYP_VPL )( AREAP area, void * p1, LONG p2); -typedef USHORT ( * DBENTRYP_VPLP )( AREAP area, void * p1, LONG * p2); -typedef USHORT ( * DBENTRYP_LSP )( AREAP area, LONG p1, USHORT * p2); +typedef USHORT ( * DBENTRYP_VPL )( AREAP area, void * p1, LONG p2 ); +typedef USHORT ( * DBENTRYP_VPLP )( AREAP area, void * p1, LONG * p2 ); +typedef USHORT ( * DBENTRYP_LSP )( AREAP area, LONG p1, USHORT * p2 ); /* this methods DO USE take a Workarea but an RDDNODE */ typedef USHORT ( * DBENTRYP_I0 )( void ); -typedef USHORT ( * DBENTRYP_I1 )( PHB_ITEM p1); -typedef USHORT ( * DBENTRYP_I2 )( PHB_ITEM p1, PHB_ITEM p2); +typedef USHORT ( * DBENTRYP_I1 )( PHB_ITEM p1 ); +typedef USHORT ( * DBENTRYP_I2 )( PHB_ITEM p1, PHB_ITEM p2 ); /*--------------------* Virtual Method Table *----------------------*/ typedef struct _RDDFUNCS @@ -723,6 +722,7 @@ typedef struct _RDDNODE char szName[ HARBOUR_MAX_RDD_DRIVERNAME_LENGTH + 1 ]; /* Name of RDD */ USHORT uiType; /* Type of RDD */ RDDFUNCS pTable; /* Table of functions */ + RDDFUNCS pSuperTable; /* Table of super functions */ USHORT uiAreaSize; /* Size of the WorkArea */ struct _RDDNODE * pNext; /* Next RDD in the list */ } RDDNODE; @@ -882,7 +882,7 @@ typedef RDDNODE * LPRDDNODE; #define SELF_TABLEEXT(w, fp) ((*(w)->lprfsHost->info)(w, DBI_TABLEEXT, fp)) - /* non WorkArea functions */ +/* non WorkArea functions */ #define SELF_EXIT(r) ((*(r)->pTable.exit)()) #define SELF_DROP(r, i) ((*(r)->pTable.drop)(i)) #define SELF_EXISTS(r, it, ii) ((*(r)->pTable.exists)(it,ii)) @@ -1013,7 +1013,7 @@ typedef RDDNODE * LPRDDNODE; #define SUPER_GETLOCKS(w, g) ((*(SUPERTABLE)->info)(w, DBI_GETLOCKARRAY, g)) #define SUPER_RAWLOCK(w, i, l) ((*(SUPERTABLE)->rawlock)(w, i, l)) #define SUPER_LOCK(w, sp) ((*(SUPERTABLE)->lock)(w, sp)) -#define SUPER_UNLOCK(w,l) ((*(SUPERTABLE)->unlock)(w,l)) +#define SUPER_UNLOCK(w,l) ((*(SUPERTABLE)->unlock)(w,l)) /* Memofile functions */ @@ -1033,17 +1033,17 @@ typedef RDDNODE * LPRDDNODE; /* Info operations */ -#define SUPER_RECSIZE(w, lp) ((*(SUPERTABLE)->info)(w, DBI_GETRECSIZE, lp)) -#define SUPER_HEADERSIZE(w, fp) ((*(SUPERTABLE)->info)(w, DBI_GETHEADERSIZE, fp)) -#define SUPER_LUPDATE(w, fp) ((*(SUPERTABLE)->info)(w, DBI_LASTUPDATE, fp )) -#define SUPER_SETDELIM(w, fp) ((*(SUPERTABLE)->info)(w, DBI_SETDELIMITER, fp)) -#define SUPER_GETDELIM(w, fp) ((*(SUPERTABLE)->info)(w, DBI_GETDELIMITER, fp)) -#define SUPER_TABLEEXT(w, fp) ((*(SUPERTABLE)->info)(w, DBI_TABLEEXT, fp)) +#define SUPER_RECSIZE(w, lp) ((*(SUPERTABLE)->info)(w, DBI_GETRECSIZE, lp)) +#define SUPER_HEADERSIZE(w, fp) ((*(SUPERTABLE)->info)(w, DBI_GETHEADERSIZE, fp)) +#define SUPER_LUPDATE(w, fp) ((*(SUPERTABLE)->info)(w, DBI_LASTUPDATE, fp )) +#define SUPER_SETDELIM(w, fp) ((*(SUPERTABLE)->info)(w, DBI_SETDELIMITER, fp)) +#define SUPER_GETDELIM(w, fp) ((*(SUPERTABLE)->info)(w, DBI_GETDELIMITER, fp)) +#define SUPER_TABLEEXT(w, fp) ((*(SUPERTABLE)->info)(w, DBI_TABLEEXT, fp)) - /* non WorkArea functions */ -#define SUPER_EXIT() ((*(SUPERTABLE)->exit)()) -#define SUPER_DROP(i) ((*(SUPERTABLE)->drop)(i)) -#define SUPER_EXISTS(it, ii) ((*(SUPERTABLE)->exists)(it, ii)) +/* non WorkArea functions */ +#define SUPER_EXIT() ((*(SUPERTABLE)->exit)()) +#define SUPER_DROP(i) ((*(SUPERTABLE)->drop)(i)) +#define SUPER_EXISTS(it, ii) ((*(SUPERTABLE)->exists)(it, ii)) /* * PROTOTYPES @@ -1059,8 +1059,6 @@ extern ERRCODE hb_rddIterateWorkAreas ( WACALLBACK pCallBack, int data ); USHORT hb_rddFieldIndex( AREAP pArea, char * szName); ERRCODE hb_rddGetTempAlias( char * szAliasTmp ); -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_APIRDD_H_ */ diff --git a/harbour/include/hbcomp.h b/harbour/include/hbcomp.h index 34a44acc1c..926848ce6b 100644 --- a/harbour/include/hbcomp.h +++ b/harbour/include/hbcomp.h @@ -70,9 +70,7 @@ #include "hbpcode.h" #include "hbhash.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN /* compiler related declarations */ @@ -555,9 +553,7 @@ extern ULONG hb_comp_Supported; #define HB_COMP_ISSUPPORTED(flag) ( hb_comp_Supported & (flag) ) #endif -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_COMP_H_ */ diff --git a/harbour/include/hbdate.h b/harbour/include/hbdate.h index 2777227f80..7c55be87cc 100644 --- a/harbour/include/hbdate.h +++ b/harbour/include/hbdate.h @@ -55,9 +55,7 @@ #include "hbsetup.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN extern double hb_dateSeconds( void ); extern void hb_dateToday( int * piYear, int * piMonth, int * piDay ); @@ -73,8 +71,6 @@ extern void hb_dateStrGet( const char * szDate, int * piYear, int * piMonth, extern char * hb_dateDecStr( char * szDate, long lJulian ); extern long hb_dateEncStr( char * szDate ); -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_DATE_H_ */ diff --git a/harbour/include/hbdbsort.h b/harbour/include/hbdbsort.h index 0ff6b17ac9..188b62dc93 100644 --- a/harbour/include/hbdbsort.h +++ b/harbour/include/hbdbsort.h @@ -53,11 +53,10 @@ #ifndef HB_DBSORT_H_ #define HB_DBSORT_H_ +#define HB_EXTERNAL_RDDDBF_USE #include "hbrdddbf.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN /* * DBQUICKSORT @@ -90,8 +89,6 @@ extern void hb_dbQSortExit( LPDBQUICKSORT pQuickSort ); extern BOOL hb_dbQSortAdvance( LPDBQUICKSORT pQuickSort, USHORT uiCount ); extern void hb_dbQSortComplete( LPDBQUICKSORT pQuickSort ); -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_DBSORT_H_ */ diff --git a/harbour/include/hberrors.h b/harbour/include/hberrors.h index 5278ba50a4..a837c2b7f6 100644 --- a/harbour/include/hberrors.h +++ b/harbour/include/hberrors.h @@ -55,9 +55,7 @@ #include "hbsetup.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN /* * Errors generated by Harbour compiler @@ -176,8 +174,6 @@ extern "C" { extern void hb_compGenError( char * szErrors[], char cPrefix, int iError, const char * szError1, const char * szError2 ); /* generic parsing error management function */ extern void hb_compGenWarning( char * szWarnings[], char cPrefix, int iWarning, const char * szWarning1, const char * szWarning2); /* generic parsing warning management function */ -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_ERRORS_H_ */ diff --git a/harbour/include/hbexprb.c b/harbour/include/hbexprb.c index 58bd749912..9c57ef14b7 100644 --- a/harbour/include/hbexprb.c +++ b/harbour/include/hbexprb.c @@ -565,7 +565,7 @@ static void hb_compExprCodeblockEarly( HB_EXPR_PTR pSelf ) char *szDupl; BOOL bUseTextSubst; - HB_EXPR_PCODE0( hb_compCodeBlockStart ); + HB_EXPR_PCODE0( hb_compCodeBlockStart ); szDupl = hb_strupr( hb_strdup( pSelf->value.asCodeblock.string ) ); if( !hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_MACRO_PARAM ) ) @@ -577,7 +577,7 @@ static void hb_compExprCodeblockEarly( HB_EXPR_PTR pSelf ) pNew = hb_compExprNewMacro( hb_compExprNewString(pSelf->value.asCodeblock.string), 0, NULL ); HB_EXPR_USE( pNew, HB_EA_PUSH_PCODE ); hb_compExprDelete( pNew ); - HB_EXPR_PCODE0( hb_compCodeBlockStop ); + HB_EXPR_PCODE0( hb_compCodeBlockStop ); } } diff --git a/harbour/include/hbexprop.h b/harbour/include/hbexprop.h index 5b2f7d7f75..644315b98f 100644 --- a/harbour/include/hbexprop.h +++ b/harbour/include/hbexprop.h @@ -55,9 +55,7 @@ #include "hbapi.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN /* value types seen at language level */ @@ -413,8 +411,6 @@ HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr ); #endif -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_EXPROP_H_ */ diff --git a/harbour/include/hbhash.h b/harbour/include/hbhash.h index 6d71108df6..1f9510118b 100644 --- a/harbour/include/hbhash.h +++ b/harbour/include/hbhash.h @@ -55,9 +55,7 @@ #include "hbapi.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN #define HB_HASH_FUNC( hbfunc ) ULONG hbfunc( void *Value, void *Cargo ) typedef HB_HASH_FUNC( HB_HASH_FUNC_ ); @@ -90,8 +88,6 @@ extern BOOL hb_hashTableAdd( HB_HASH_TABLE_PTR pTable, void *pValue ); /* add a extern void * hb_hashTableFind( HB_HASH_TABLE_PTR pTable, void *pValue ); /* return the pointer to item's value or NULL if not found */ extern HB_HASH_TABLE_PTR hb_hashTableResize( HB_HASH_TABLE_PTR pTable, ULONG ulNewSize ); /* resize the hash table */ -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_HASH_H_ */ diff --git a/harbour/include/hbinit.h b/harbour/include/hbinit.h index 91def36cfc..04dee1f048 100644 --- a/harbour/include/hbinit.h +++ b/harbour/include/hbinit.h @@ -55,9 +55,7 @@ #include "hbsetup.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN extern void HB_EXPORT hb_vmProcessSymbols( PHB_SYMB pSymbols, USHORT uiSymbols ); /* statics symbols initialization */ @@ -177,8 +175,6 @@ extern void HB_EXPORT hb_vmProcessSymbols( PHB_SYMB pSymbols, USHORT uiSymbols ) #define HB_PRAGMA_STARTUP #endif -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_INIT_H_ */ diff --git a/harbour/include/hbmacro.h b/harbour/include/hbmacro.h index b86176ace6..4d19178a19 100644 --- a/harbour/include/hbmacro.h +++ b/harbour/include/hbmacro.h @@ -74,9 +74,7 @@ #include "hbpcode.h" #include "hbmacro.ch" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN /* flags for compilation process */ @@ -155,8 +153,6 @@ extern void hb_compGenPushString( char * szText, ULONG ulStrLen, HB_BISON_PTR pM extern void hb_compCodeBlockStart( HB_BISON_PTR pMacro ); extern void hb_compCodeBlockEnd( HB_BISON_PTR pMacro ); -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_MACRO_H_ */ diff --git a/harbour/include/hbpp.h b/harbour/include/hbpp.h index ab7114f01a..6473d5a4cb 100644 --- a/harbour/include/hbpp.h +++ b/harbour/include/hbpp.h @@ -58,9 +58,7 @@ #include "hberrors.h" #include "hbver.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN struct _DEFINES; typedef struct _DEFINES @@ -129,9 +127,7 @@ extern COMMANDS * hb_pp_topTranslate; extern void hb_pp_ParsePragma( char * szline ); -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_PP_H_ */ diff --git a/harbour/include/hbrdddel.h b/harbour/include/hbrdddel.h index f961c0a570..7d4617c838 100644 --- a/harbour/include/hbrdddel.h +++ b/harbour/include/hbrdddel.h @@ -55,9 +55,7 @@ #include "hbapirdd.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN /* * -- DELIMITED METHODS -- @@ -159,8 +157,6 @@ extern "C" { #define hb_delimExists NULL #define hb_delimWhoCares NULL -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_RDDDEL_H_ */ diff --git a/harbour/include/hbrddntx.h b/harbour/include/hbrddntx.h index f24171a7a0..fd6d3c367e 100644 --- a/harbour/include/hbrddntx.h +++ b/harbour/include/hbrddntx.h @@ -55,15 +55,13 @@ #include "hbapirdd.h" #include "hbdbferr.h" +#ifndef HB_CDP_SUPPORT_OFF #include "hbapicdp.h" - -#if defined(HB_EXTERN_C) -extern "C" { #endif +HB_EXTERN_BEGIN /* DBFNTX default extensions */ -#define NTX_MEMOEXT ".dbt" #define NTX_INDEXEXT ".ntx" /* DBFNTX constants declarations */ @@ -75,6 +73,7 @@ extern "C" { #define NTX_MAX_KEY 256 /* Max len of key */ #define NTXBLOCKSIZE 1024 /* Size of block in NTX file */ +#define NTX_MAX_TAGNAME 12 /* Max len of tag name */ #define NTX_LOCK_OFFSET 1000000000 #define NTX_PAGES_PER_TAG 32 @@ -167,6 +166,7 @@ typedef struct _NTXINDEX LONG NextAvail; struct _NTXAREA * Owner; FHANDLE DiskFile; + BOOL fFlush; LPTAGINFO CompoundTag; struct _NTXINDEX * pNext; /* The next index in the list */ } NTXINDEX; @@ -177,22 +177,22 @@ typedef NTXINDEX * LPNTXINDEX; typedef struct _NTXHEADER /* Header of NTX file */ { - USHORT type; - USHORT version; - ULONG root; - ULONG next_page; - USHORT item_size; - USHORT key_size; - USHORT key_dec; - USHORT max_item; - USHORT half_page; + UINT16 type; + UINT16 version; + UINT32 root; + UINT32 next_page; + UINT16 item_size; + UINT16 key_size; + UINT16 key_dec; + UINT16 max_item; + UINT16 half_page; char key_expr[ NTX_MAX_KEY ]; char unique; char unknown1; char descend; char unknown2; char for_expr[ NTX_MAX_KEY ]; - char tag_name[ 12 ]; + char tag_name[ NTX_MAX_TAGNAME ]; char custom; } NTXHEADER; @@ -201,16 +201,16 @@ typedef NTXHEADER * LPNTXHEADER; typedef struct _NTXBUFFER /* Header of each block in NTX file (only block with header has other format */ { - USHORT item_count; - USHORT item_offset[ 1 ]; + UINT16 item_count; + UINT16 item_offset[ 1 ]; } NTXBUFFER; typedef NTXBUFFER * LPNTXBUFFER; typedef struct _NTXITEM /* each item in NTX block has following format */ { - ULONG page; /* subpage (each key in subpage has < value like this key */ - ULONG rec_no; /* RecNo of record with this key */ + UINT32 page; /* subpage (each key in subpage has < value like this key */ + UINT32 rec_no; /* RecNo of record with this key */ char key[ 1 ]; /* value of key */ } NTXITEM; @@ -293,7 +293,9 @@ typedef struct _NTXAREA BYTE bLockType; /* Type of locking shemes */ ULONG * pLocksPos; /* List of records locked */ ULONG ulNumLocksPos; /* Number of records locked */ +#ifndef HB_CDP_SUPPORT_OFF PHB_CODEPAGE cdPage; /* Area's codepage pointer */ +#endif /* * NTX's additions to the workarea structure @@ -343,7 +345,7 @@ static ERRCODE ntxSkipRaw( NTXAREAP pArea, LONG lToSkip ); #define ntxFieldDisplay NULL #define ntxFieldInfo NULL #define ntxFieldName NULL -#define ntxFlush NULL +static ERRCODE ntxFlush( NTXAREAP pArea ); #define ntxGetRec NULL #define ntxGetValue NULL #define ntxGetVarLen NULL @@ -425,8 +427,6 @@ static ERRCODE ntxSetScope( NTXAREAP pArea, LPDBORDSCOPEINFO sInfo ); #define ntxExists NULL #define ntxWhoCares NULL -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_RDDNTX_H_ */ diff --git a/harbour/include/hbrddsdf.h b/harbour/include/hbrddsdf.h index 5d02d6962b..b6280dc9a5 100644 --- a/harbour/include/hbrddsdf.h +++ b/harbour/include/hbrddsdf.h @@ -55,9 +55,7 @@ #include "hbapirdd.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN /* * -- SDF METHODS -- @@ -159,8 +157,6 @@ extern "C" { #define hb_sdfExists NULL #define hb_sdfWhoCares NULL -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_RDDSDF_H_ */ diff --git a/harbour/include/hbrddwrk.h b/harbour/include/hbrddwrk.h index 8bdc4e4d5c..fc74568c9c 100644 --- a/harbour/include/hbrddwrk.h +++ b/harbour/include/hbrddwrk.h @@ -55,9 +55,7 @@ #include "hbapirdd.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN /* * -- METHODS -- @@ -130,7 +128,7 @@ extern ERRCODE hb_waSetRel( AREAP pArea, LPDBRELINFO pRelInfo ); extern ERRCODE hb_waOrderCondition( AREAP pArea, LPDBORDERCONDINFO param ); #define hb_waOrderCreate ( DBENTRYP_VOC ) hb_waUnsupported #define hb_waOrderDestroy ( DBENTRYP_OI ) hb_waUnsupported -//#define hb_waOrderInfo ( DBENTRYP_OII ) hb_waNull +/* #define hb_waOrderInfo ( DBENTRYP_OII ) hb_waNull */ extern ERRCODE hb_waOrderInfo( AREAP pArea, USHORT index, LPDBORDERINFO param ); extern ERRCODE hb_waClearFilter( AREAP pArea ); extern ERRCODE hb_waClearLocate( AREAP pArea ); @@ -162,8 +160,6 @@ extern ERRCODE hb_waEvalBlock( AREAP pArea, PHB_ITEM pBlock ); #define hb_waWhoCares ( DBENTRYP_SVP ) hb_waUnsupported -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_RDDWRK_H_ */ diff --git a/harbour/include/hbset.h b/harbour/include/hbset.h index 0aa0fc01dc..5c0396290a 100644 --- a/harbour/include/hbset.h +++ b/harbour/include/hbset.h @@ -57,9 +57,7 @@ #include "hbapifs.h" #include "hbapigt.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN typedef enum { @@ -226,8 +224,6 @@ extern int hb_setListenerAdd( HB_SET_LISTENER_CALLBACK * ); extern void hb_setListenerNotify( HB_set_enum, HB_set_listener_enum ); extern int hb_setListenerRemove( int ); -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_SET_H_ */ diff --git a/harbour/include/hbstack.h b/harbour/include/hbstack.h index 5484c1eb52..f50bf7f407 100644 --- a/harbour/include/hbstack.h +++ b/harbour/include/hbstack.h @@ -60,9 +60,7 @@ #include "hbvmpub.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN #ifndef HB_NO_DEFAULT_STACK_MACROS #define HB_STACK_MACROS @@ -152,8 +150,6 @@ extern void hb_stackRemove( LONG lUntilPos ); extern HB_ITEM_PTR hb_stackNewFrame( HB_STACK_STATE * pStack, USHORT uiParams ); extern void hb_stackOldFrame( HB_STACK_STATE * pStack ); -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_STACK_H_ */ diff --git a/harbour/include/hbtrace.h b/harbour/include/hbtrace.h index 064c3b1efb..b816298e7f 100644 --- a/harbour/include/hbtrace.h +++ b/harbour/include/hbtrace.h @@ -55,9 +55,7 @@ #include "hbsetup.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN /* * Tracing levels. @@ -224,8 +222,6 @@ extern int hb_tracelevel( int new_level ); extern int hb_tr_level( void ); extern void hb_tr_trace( char * fmt, ... ); -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_TRACE_H_ */ diff --git a/harbour/include/hbvm.h b/harbour/include/hbvm.h index 055bfd9ceb..8f0ccc300d 100644 --- a/harbour/include/hbvm.h +++ b/harbour/include/hbvm.h @@ -55,9 +55,7 @@ #include "hbapi.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN /* Harbour virtual machine init/exit functions */ extern void HB_EXPORT hb_vmInit( BOOL bStartMainProc ); @@ -113,8 +111,6 @@ extern void hb_vmPushPointer( void * ); /* push an item of HB_IT_POINTER type extern ULONG hb_vmFlagEnabled( ULONG flag); -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_VM_H_ */ diff --git a/harbour/include/hbvmpub.h b/harbour/include/hbvmpub.h index b1d5d09bbe..9aae8678c7 100644 --- a/harbour/include/hbvmpub.h +++ b/harbour/include/hbvmpub.h @@ -55,9 +55,7 @@ #include "hbdefs.h" -#if defined(HB_EXTERN_C) -extern "C" { -#endif +HB_EXTERN_BEGIN struct _HB_DYNS; @@ -107,8 +105,6 @@ typedef HB_DYNS_FUNC( PHB_DYNS_FUNC ); extern void HB_EXPORT hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ); /* invokes the virtual machine */ -#if defined(HB_EXTERN_C) -} -#endif +HB_EXTERN_END #endif /* HB_VMPUB_H_ */ diff --git a/harbour/make_rpm.sh b/harbour/make_rpm.sh index 7e97e0706d..c5c1c649c3 100644 --- a/harbour/make_rpm.sh +++ b/harbour/make_rpm.sh @@ -10,47 +10,147 @@ # See doc/license.txt for licensing terms. # --------------------------------------------------------------- +###################################################################### +# Conditional build: +# --with static - link all binaries with static libs +# --with adsrdd - build ads RDD +# --with mysql - build mysql lib +# --with pgsql - build pgsql lib +# --with odbc - build build odbc lib +# --with allegro - build GTALLEG - Allegro based GT driver +# --without nf - do not build nanforum lib +# --without x11 - do not build GTXVT +# --without gpm - build GTSLN and GTCRS without GPM support +# --without gtsln - do not build GTSLN +###################################################################### + test_reqrpm() { rpm -q --whatprovides "$1" &> /dev/null } +get_rpmmacro() +{ + local R X Y + + R=`rpm --showrc|sed -e "/^-14:.${1}[^a-z0-9A-Z_]/ !d" -e "s/^-14: ${1}.//"` + X=`echo "${R}"|sed -e "s/.*\(%{\([^}]*\)}\).*/\2/"` + while [ "${X}" != "${R}" ] + do + Y=`get_rpmmacro "$X"` + if [ -n "${Y}" ] + then + R=`echo "${R}"|sed -e "s!%{${X}}!${Y}!g"` + X=`echo "${R}"|sed -e "s/.*\(%{\([^}]*\)}\).*/\2/"` + else + X="${R}" + fi + done + echo -n "${R}" +} + +NEED_RPM="gcc binutils bash bison ncurses ncurses-devel" + +FORCE="" +BUGGY_RPM="" +if [ -f /etc/conectiva-release ] +then + BUGGY_RPM="yes" +fi + +LAST="" +while [ $# -gt 0 ] +do + if [ "$1" = "--force" ] + then + FORCE="yes" + else + INST_PARAM="${INST_PARAM} $1" + if [ "${LAST}" = "--with" ] + then + if [ -f /etc/conectiva-release ] + then + [ "$1" = "mysql" ] && NEED_RPM="${NEED_RPM} MySQL-devel" + [ "$1" = "odbc" ] && NEED_RPM="${NEED_RPM} unixodbc-devel" + else + [ "$1" = "mysql" ] && NEED_RPM="${NEED_RPM} mysql-devel" + [ "$1" = "odbc" ] && NEED_RPM="${NEED_RPM} unixODBC-devel" + fi + [ "$1" = "pgsql" ] && NEED_RPM="${NEED_RPM} postgresql-devel" + [ "$1" = "allegro" ] && NEED_RPM="${NEED_RPM} allegro-devel" + fi + fi + LAST="$1" + shift +done + +if test_reqrpm "MySQL-devel" || test_reqrpm "mysql-devel" +then + INST_PARAM="${INST_PARAM} --with mysql" +fi +if test_reqrpm "postgresql-devel" +then + INST_PARAM="${INST_PARAM} --with pgsql" +fi +if test_reqrpm "unixodbc-devel" || test_reqrpm "unixODBC-devel" +then + INST_PARAM="${INST_PARAM} --with odbc" +fi +if test_reqrpm "allegro-devel" +then + INST_PARAM="${INST_PARAM} --with allegro" +fi +if ! test_reqrpm "gpm-devel" +then + INST_PARAM="${INST_PARAM} --without gpm" +fi + TOINST_LST="" -for i in gcc binutils bash bison ncurses ncurses-devel slang-devel gpm-devel +for i in ${NEED_RPM} do test_reqrpm "$i" || TOINST_LST="${TOINST_LST} $i" done -if [ -z "${TOINST_LST}" ] || [ "$1" = "--force" ] +if [ -z "${TOINST_LST}" ] || [ "${FORCE}" = "yes" ] then . ./bin/pack_src.sh stat="$?" if [ -z "${hb_filename}" ] then - echo "The script ./bin/pack_src.sh doesn't set archive name to \${hb_filename}" - exit 1 + echo "The script ./bin/pack_src.sh doesn't set archive name to \${hb_filename}" + exit 1 elif [ "${stat}" != 0 ] then - echo "Error during packing the sources in ./bin/pack_src.sh" - exit 1 + echo "Error during packing the sources in ./bin/pack_src.sh" + exit 1 elif [ -f ${hb_filename} ] then - if [ `id -u` != 0 ] && [ ! -f ${HOME}/.rpmmacros ] - then - RPMDIR="${HOME}/RPM" - mkdir -p ${RPMDIR}/SOURCES ${RPMDIR}/RPMS ${RPMDIR}/SRPMS \ - ${RPMDIR}/BUILD ${RPMDIR}/SPECS - echo "%_topdir ${RPMDIR}" > ${HOME}/.rpmmacros - fi - if which rpmbuild &>/dev/null - then - rpmbuild -ta ${hb_filename} --rmsource - else - rpm -ta ${hb_filename} --rmsource - fi + if [ `id -u` != 0 ] && [ ! -f ${HOME}/.rpmmacros ] + then + RPMDIR="${HOME}/RPM" + mkdir -p ${RPMDIR}/SOURCES ${RPMDIR}/RPMS ${RPMDIR}/SRPMS \ + ${RPMDIR}/BUILD ${RPMDIR}/SPECS + echo "%_topdir ${RPMDIR}" > ${HOME}/.rpmmacros + else + RPMDIR=`get_rpmmacro "_topdir"` + fi + if [ "${BUGGY_RPM}" = "yes" ] + then + cp ${hb_filename} ${RPMDIR}/SOURCES + cp harbour.spec ${RPMDIR}/SPECS + fi + if [ "${BUGGY_RPM}" = "yes" ] + then + rpm -ba harbour.spec ${INST_PARAM} + elif which rpmbuild &>/dev/null + then + rpmbuild -ta ${hb_filename} --rmsource ${INST_PARAM} + else + rpm -ta ${hb_filename} --rmsource ${INST_PARAM} + fi else - echo "Cannot find archive file: ${hb_filename}" - exit 1 + echo "Cannot find archive file: ${hb_filename}" + exit 1 fi else echo "If you want to build Harbour compiler" diff --git a/harbour/source/codepage/Makefile b/harbour/source/codepage/Makefile index 8bb50b4550..a42d1bdf18 100644 --- a/harbour/source/codepage/Makefile +++ b/harbour/source/codepage/Makefile @@ -26,7 +26,21 @@ C_SOURCES=\ cdpsl852.c \ cdpsliso.c \ cdpslwin.c \ - cdpsrwin.c + cdpsrwin.c \ + uc1250.c \ + uc1251.c \ + uc1253.c \ + uc1257.c \ + uc737.c \ + uc850.c \ + uc852.c \ + uc866.c \ + uc8859_1.c \ + uc88591b.c \ + uc8859_2.c \ + uckoi8.c \ + uckoi8u.c \ + ucmaz.c \ LIBNAME=codepage diff --git a/harbour/source/codepage/cdp_tpl.c b/harbour/source/codepage/cdp_tpl.c index 9f979b9489..384eed56ff 100644 --- a/harbour/source/codepage/cdp_tpl.c +++ b/harbour/source/codepage/cdp_tpl.c @@ -83,7 +83,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "EN",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "EN", + CPID_437,UNITB_437,NUMBER_OF_CHARACTERS, "ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpeldos.c b/harbour/source/codepage/cdpeldos.c index 8f35238508..1ad930d54a 100644 --- a/harbour/source/codepage/cdpeldos.c +++ b/harbour/source/codepage/cdpeldos.c @@ -83,7 +83,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "EL",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "EL", + CPID_737, UNITB_737, NUMBER_OF_CHARACTERS, "─~Й│┌┐└К┘├~Л┤┬~М┴┼▀▄█▌~Н▐░▒▒▓⌠~О■∙√≈~П","≤~А≥ ⌡°~Б²·~Ц÷═~Е║╒ё╓╔╕~Ф╖╗╘╙╚╛~Г╜╝╞Ю~И", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpelwin.c b/harbour/source/codepage/cdpelwin.c index e0126ed423..bd913f0d10 100644 --- a/harbour/source/codepage/cdpelwin.c +++ b/harbour/source/codepage/cdpelwin.c @@ -84,7 +84,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "ELWIN",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "ELWIN", + CPID_1253, UNITB_1253, NUMBER_OF_CHARACTERS, "а~╒бцде╦фг~╧хи~╨йклмно~╪пяссту~╬жвьы~©","А~эБЦДЕ~щФГ~чХИ~ъЙКЛМНО~ЭПЯСРТУ~ЩЖВЬЫ~Ч", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpesdos.c b/harbour/source/codepage/cdpesdos.c index bcb821304d..1ca7007dfa 100644 --- a/harbour/source/codepage/cdpesdos.c +++ b/harbour/source/codepage/cdpesdos.c @@ -85,7 +85,7 @@ */ static HB_CODEPAGE s_codepage = { "ES", - NUMBER_OF_CHARACTERS, + CPID_850, UNITB_850, NUMBER_OF_CHARACTERS, "A╣BCDE░FGHIжJKLMN╔OЮPQRSTUИ VWXYZ", "a═bcde┌fghi║jklmn╓o╒pqrstuё│vwxyz", IS_LATIN, diff --git a/harbour/source/codepage/cdpeswin.c b/harbour/source/codepage/cdpeswin.c index b1b3093324..6c36ec4ba4 100644 --- a/harbour/source/codepage/cdpeswin.c +++ b/harbour/source/codepage/cdpeswin.c @@ -51,9 +51,9 @@ * */ -/* Language name: Spanish WIN */ +/* Language name: Spanish */ /* ISO language code (2 chars): ES (please look it up in /doc/lang_id.txt) */ -/* Codepage: ES */ +/* Codepage: ISO-8859-1 */ #include #include "hbapi.h" @@ -84,7 +84,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "ESWIN", NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "ESWIN", + CPID_8859_1, UNITB_8859_1, NUMBER_OF_CHARACTERS, "AаBCDEиFGHIмJKLMNяOсPQRSTUзэVWXYZ", "aАbcdeИfghiМjklmnЯoСpqrstuЗЭvwxyz", IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0,NULL, NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpgedos.c b/harbour/source/codepage/cdpgedos.c index ea74050178..887355a60f 100644 --- a/harbour/source/codepage/cdpgedos.c +++ b/harbour/source/codepage/cdpgedos.c @@ -84,7 +84,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "DE",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "DE", + CPID_850, UNITB_850, NUMBER_OF_CHARACTERS, "A▌BCDEFGHIJKLMNO≥PQRSАTU VWXYZ","a└bcdefghijklmno■pqrsАtu│vwxyz", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpgewin.c b/harbour/source/codepage/cdpgewin.c index bbc9b42380..287be3a543 100644 --- a/harbour/source/codepage/cdpgewin.c +++ b/harbour/source/codepage/cdpgewin.c @@ -51,9 +51,9 @@ * */ -/* Language name: German WIN*/ +/* Language name: German */ /* ISO language code (2 chars): DE (please look it up in /doc/lang_id.txt) */ -/* Codepage: DE */ +/* Codepage: ISO-8859-1 */ #include #include "hbapi.h" @@ -84,7 +84,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "DEWIN",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "DEWIN", + CPID_8859_1, UNITB_8859_1, NUMBER_OF_CHARACTERS, "AдBCDEFGHIJKLMNOжPQRSъTUэVWXYZ","aДbcdefghijklmnoЖpqrsъtuЭvwxyz", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdphu852.c b/harbour/source/codepage/cdphu852.c index 0ea0217fa9..c7df041e42 100644 --- a/harbour/source/codepage/cdphu852.c +++ b/harbour/source/codepage/cdphu852.c @@ -83,7 +83,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "HU852", NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "HU852", + CPID_852, UNITB_852, NUMBER_OF_CHARACTERS, "A╣BCDE░FGHIжJKLMNOЮ≥┼PQRSTUИ КVWXYZ","a═bcde┌fghi║jklmno╒■▀pqrstuё│Шvwxyz", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdphuwin.c b/harbour/source/codepage/cdphuwin.c index f52d0b7acb..40bb696492 100644 --- a/harbour/source/codepage/cdphuwin.c +++ b/harbour/source/codepage/cdphuwin.c @@ -51,8 +51,8 @@ */ /* Language name: */ -/* ISO language code (2 chars): (please look it up in /doc/lang_id.txt) */ -/* Codepage: */ +/* ISO language code (2 chars): HU */ +/* Codepage: 1250 */ #include #include "hbapi.h" @@ -83,7 +83,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "HUWIN", NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "HUWIN", + CPID_1250, UNITB_1250, NUMBER_OF_CHARACTERS, "AаBCDEиFGHIмJKLMNOсжуPQRSTUзэшVWXYZ","aАbcdeИfghiМjklmnoСЖУpqrstuЗЭШvwxyz", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdppl852.c b/harbour/source/codepage/cdppl852.c index 5afde61696..e1ccca68e5 100644 --- a/harbour/source/codepage/cdppl852.c +++ b/harbour/source/codepage/cdppl852.c @@ -84,7 +84,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "PL852",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "PL852", + CPID_852, UNITB_852, NUMBER_OF_CHARACTERS, "A╓BC▐DE╗FGHIJKL²MNЦOЮPQRS≈TUVWXYZ█╫","a╔bc├de╘fghijkl┬mnДo╒pqrs≤tuvwxyz╚╬", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdppliso.c b/harbour/source/codepage/cdppliso.c index d90c0b85fa..41fda51fab 100644 --- a/harbour/source/codepage/cdppliso.c +++ b/harbour/source/codepage/cdppliso.c @@ -84,7 +84,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "PLISO",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "PLISO", + CPID_8859_2, UNITB_8859_2, NUMBER_OF_CHARACTERS, "A║BCфDEйFGHIJKLёMNяOсPQRS╕TUVWXYZ╛╞","a╠bcФdeЙfghijklЁmnЯoСpqrs╤tuvwxyz╪©", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpplmaz.c b/harbour/source/codepage/cdpplmaz.c index 16d24eb10d..569d2b26d2 100644 --- a/harbour/source/codepage/cdpplmaz.c +++ b/harbour/source/codepage/cdpplmaz.c @@ -84,7 +84,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "PLMAZ",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "PLMAZ", + CPID_MAZ, UNITB_MAZ, NUMBER_OF_CHARACTERS, "A▐BC∙DE░FGHIJKL°MN╔OёPQRS≤TUVWXYZ═║","a├bc█de▒fghijkl▓mn╓o╒pqrs·tuvwxyz╕╖", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpplwin.c b/harbour/source/codepage/cdpplwin.c index 3dcc85edee..1c7169e73d 100644 --- a/harbour/source/codepage/cdpplwin.c +++ b/harbour/source/codepage/cdpplwin.c @@ -84,7 +84,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "PLWIN",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "PLWIN", + CPID_1250, UNITB_1250, NUMBER_OF_CHARACTERS, "A╔BCфDEйFGHIJKLёMNяOсPQRS▄TUVWXYZ▐╞","a╧bcФdeЙfghijklЁmnЯoСpqrs°tuvwxyz÷©", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdppt850.c b/harbour/source/codepage/cdppt850.c index eea177fb45..4aa939e984 100644 --- a/harbour/source/codepage/cdppt850.c +++ b/harbour/source/codepage/cdppt850.c @@ -85,7 +85,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "PT850",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "PT850", + CPID_850, UNITB_850, NUMBER_OF_CHARACTERS, "A╣╥╤г▌BC─DE░трFGHIжчвьJKLMN╔OЮЦБЕ≥PQRSTUИКЙ VWXYZ","a═┘┐ф└bc┤de┌┼┬fghi║█▄▀jklmn╓o╒∙⌠Д■pqrstuё≈√│vwxyz", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpptiso.c b/harbour/source/codepage/cdpptiso.c index ebeb6e9c98..fd19ee5ec6 100644 --- a/harbour/source/codepage/cdpptiso.c +++ b/harbour/source/codepage/cdpptiso.c @@ -85,7 +85,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "PTISO",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "PTISO", + CPID_8859_1, UNITB_8859_1, NUMBER_OF_CHARACTERS, "AаюбцдBCгDEихйFGHIмлноJKLMNяOсртужPQRSTUзышэVWXYZ","aАЮБЦДbcГdeИХЙfghiМЛНОjklmnЯoСРТУЖpqrstuЗЫШЭvwxyz", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpru866.c b/harbour/source/codepage/cdpru866.c index 1392072cec..88f8358b26 100644 --- a/harbour/source/codepage/cdpru866.c +++ b/harbour/source/codepage/cdpru866.c @@ -58,7 +58,8 @@ #include "hbapi.h" #include "hbapicdp.h" -static HB_CODEPAGE s_codepage = { "RU866",32, +static HB_CODEPAGE s_codepage = { "RU866", + CPID_866, UNITB_866, 32, "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷","═║╒ё╓╔╕╖╗╘╙╚╛╜╝╞ЮАБЦДЕФГХИЙКЛМНО", 0,0,0,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdprukoi.c b/harbour/source/codepage/cdprukoi.c index 6de61e59f1..293c85d029 100644 --- a/harbour/source/codepage/cdprukoi.c +++ b/harbour/source/codepage/cdprukoi.c @@ -58,7 +58,8 @@ #include "hbapi.h" #include "hbapicdp.h" -static HB_CODEPAGE s_codepage = { "RUKOI8",32, +static HB_CODEPAGE s_codepage = { "RUKOI8", + CPID_KOI_8, UNITB_KOI_8, 32, "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ","абвгдежзийклмнопрстуфхцчшщъыьэюя", 0,0,0,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpruwin.c b/harbour/source/codepage/cdpruwin.c index 3caba65d09..add87111ca 100644 --- a/harbour/source/codepage/cdpruwin.c +++ b/harbour/source/codepage/cdpruwin.c @@ -58,7 +58,8 @@ #include "hbapi.h" #include "hbapicdp.h" -static HB_CODEPAGE s_codepage = { "RU1251",32, +static HB_CODEPAGE s_codepage = { "RU1251", + CPID_1251, UNITB_1251, 32, "юабцдефгхийклмнопярстужвьызшэщчъ","ЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ", 0,0,0,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpsl437.c b/harbour/source/codepage/cdpsl437.c index 6ec0ecfce0..d8024c0836 100644 --- a/harbour/source/codepage/cdpsl437.c +++ b/harbour/source/codepage/cdpsl437.c @@ -84,7 +84,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "SL437",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "SL437", + CPID_437, UNITB_437, NUMBER_OF_CHARACTERS, "ABC^]D\EFGHIJKLMNOPQRS[TUVWZ@XY","abc~}d|efghijklmnopqrs{tuvwz`xy", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpsl852.c b/harbour/source/codepage/cdpsl852.c index afc250c500..b923591702 100644 --- a/harbour/source/codepage/cdpsl852.c +++ b/harbour/source/codepage/cdpsl852.c @@ -84,7 +84,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "SL852",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "SL852", + CPID_852, UNITB_852, NUMBER_OF_CHARACTERS, "ABC╛▐DяEFGHIJKLMNOPQRSФTUVWZ╕XY","abc÷├dпefghijklmnopqrsГtuvwz╖xy", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpsliso.c b/harbour/source/codepage/cdpsliso.c index 6d35765d8f..844f7748f6 100644 --- a/harbour/source/codepage/cdpsliso.c +++ b/harbour/source/codepage/cdpsliso.c @@ -84,7 +84,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "SLISO",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "SLISO", + CPID_8859_2, UNITB_8859_2, NUMBER_OF_CHARACTERS, "ABCхфDпEFGHIJKLMNOPQRS╘TUVWZ╝XY","abcХФdПefghijklmnopqrs╧tuvwz╬xy", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpslwin.c b/harbour/source/codepage/cdpslwin.c index 62241c1d7f..3267b5ce43 100644 --- a/harbour/source/codepage/cdpslwin.c +++ b/harbour/source/codepage/cdpslwin.c @@ -84,7 +84,8 @@ same excepting the characters case, of course. */ -static HB_CODEPAGE s_codepage = { "SLWIN",NUMBER_OF_CHARACTERS, +static HB_CODEPAGE s_codepage = { "SLWIN", + CPID_1250, UNITB_1250, NUMBER_OF_CHARACTERS, "ABCхфDпEFGHIJKLMNOPQRS┼TUVWZ▌XY","abcХФdПefghijklmnopqrs tuvwz·xy", IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; diff --git a/harbour/source/codepage/cdpsrwin.c b/harbour/source/codepage/cdpsrwin.c index 4739109c31..25d90d7bef 100644 --- a/harbour/source/codepage/cdpsrwin.c +++ b/harbour/source/codepage/cdpsrwin.c @@ -85,7 +85,7 @@ */ static HB_CODEPAGE s_codepage = { "SRWIN", - NUMBER_OF_CHARACTERS, + CPID_1251, UNITB_1251, NUMBER_OF_CHARACTERS, "юабцд─ефгхёйк┼лм▄нопяр▌стужв▐ь", "ЮАБЦД░ЕФГХ╪ЙК ЛМ°НОПЯР·СТУЖВ÷Ь", IS_LATIN, diff --git a/harbour/source/codepage/uc1250.c b/harbour/source/codepage/uc1250.c new file mode 100644 index 0000000000..03dce60ad5 --- /dev/null +++ b/harbour/source/codepage/uc1250.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2003 Przemyslaw Czerpak + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021, + 0x0000, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, + 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x0000, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A, + 0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B, + 0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C, + 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, + 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, + 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, + 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, + 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, + 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, + 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, + 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9, +}; + +HB_UNITABLE hb_uniTbl_1250 = { CPID_1250, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/codepage/uc1251.c b/harbour/source/codepage/uc1251.c new file mode 100644 index 0000000000..e147b0052e --- /dev/null +++ b/harbour/source/codepage/uc1251.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2003 Przemyslaw Czerpak + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, + 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, + 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x0000, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, + 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, + 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, + 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, + 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, +}; + +HB_UNITABLE hb_uniTbl_1251 = { CPID_1251, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/codepage/uc1253.c b/harbour/source/codepage/uc1253.c new file mode 100644 index 0000000000..4213a12095 --- /dev/null +++ b/harbour/source/codepage/uc1253.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2003 Przemyslaw Czerpak + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x0088, 0x2030, 0x008A, 0x2039, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x0098, 0x2122, 0x009A, 0x203A, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7, + 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, + 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, + 0x03A0, 0x03A1, 0x00D2, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, + 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, + 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, + 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, + 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, + 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x00FF, +}; + +HB_UNITABLE hb_uniTbl_1253 = { CPID_1253, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/codepage/uc1257.c b/harbour/source/codepage/uc1257.c new file mode 100644 index 0000000000..168297febc --- /dev/null +++ b/harbour/source/codepage/uc1257.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2003 Przemyslaw Czerpak + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021, + 0x0000, 0x2030, 0x0000, 0x2039, 0x0000, 0x00A8, 0x02C7, 0x00B8, + 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x0000, 0x2122, 0x0000, 0x203A, 0x0000, 0x00AF, 0x02DB, 0x0000, + 0x00A0, 0x0000, 0x00A2, 0x00A3, 0x00A4, 0x0000, 0x00A6, 0x00A7, + 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, + 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, + 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, + 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, + 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, + 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, + 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, + 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, + 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9, +}; + +HB_UNITABLE hb_uniTbl_1257 = { CPID_1257, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/codepage/uc737.c b/harbour/source/codepage/uc737.c new file mode 100644 index 0000000000..de066a8f23 --- /dev/null +++ b/harbour/source/codepage/uc737.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2003 Przemyslaw Czerpak + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, + 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0, + 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, + 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, + 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, + 0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x03C9, 0x03AC, 0x03AD, 0x03AE, 0x03CA, 0x03AF, 0x03CC, 0x03CD, + 0x03CB, 0x03CE, 0x0386, 0x0388, 0x0389, 0x038A, 0x038C, 0x038E, + 0x038F, 0x00B1, 0x2265, 0x2264, 0x03AA, 0x03AB, 0x00F7, 0x2248, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0, +}; + +HB_UNITABLE hb_uniTbl_737 = { CPID_737, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/codepage/uc850.c b/harbour/source/codepage/uc850.c new file mode 100644 index 0000000000..49957f8902 --- /dev/null +++ b/harbour/source/codepage/uc850.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2003 Przemyslaw Czerpak + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, + 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, + 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, + 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192, + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, + 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, + 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, + 0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, + 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580, + 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, + 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4, + 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, + 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0, +}; + +HB_UNITABLE hb_uniTbl_850 = { CPID_850, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/codepage/uc852.c b/harbour/source/codepage/uc852.c new file mode 100644 index 0000000000..06e742a5df --- /dev/null +++ b/harbour/source/codepage/uc852.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2003 Przemyslaw Czerpak + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x016F, 0x0107, 0x00E7, + 0x0142, 0x00EB, 0x0150, 0x0151, 0x00EE, 0x0179, 0x00C4, 0x0106, + 0x00C9, 0x0139, 0x013A, 0x00F4, 0x00F6, 0x013D, 0x013E, 0x015A, + 0x015B, 0x00D6, 0x00DC, 0x0164, 0x0165, 0x0141, 0x00D7, 0x010D, + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x0104, 0x0105, 0x017D, 0x017E, + 0x0118, 0x0119, 0x00AC, 0x017A, 0x010C, 0x015F, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x011A, + 0x015E, 0x2563, 0x2551, 0x2557, 0x255D, 0x017B, 0x017C, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0102, 0x0103, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, + 0x0111, 0x0110, 0x010E, 0x00CB, 0x010F, 0x0147, 0x00CD, 0x00CE, + 0x011B, 0x2518, 0x250C, 0x2588, 0x2584, 0x0162, 0x016E, 0x2580, + 0x00D3, 0x00DF, 0x00D4, 0x0143, 0x0144, 0x0148, 0x0160, 0x0161, + 0x0154, 0x00DA, 0x0155, 0x0170, 0x00FD, 0x00DD, 0x0163, 0x00B4, + 0x00AD, 0x02DD, 0x02DB, 0x02C7, 0x02D8, 0x00A7, 0x00F7, 0x00B8, + 0x00B0, 0x00A8, 0x02D9, 0x0171, 0x0158, 0x0159, 0x25A0, 0x00A0, +}; + +HB_UNITABLE hb_uniTbl_852 = { CPID_852, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/codepage/uc866.c b/harbour/source/codepage/uc866.c new file mode 100644 index 0000000000..45aee9b968 --- /dev/null +++ b/harbour/source/codepage/uc866.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2003 Przemyslaw Czerpak + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, + 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0, +}; + +HB_UNITABLE hb_uniTbl_866 = { CPID_866, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/codepage/uc88591b.c b/harbour/source/codepage/uc88591b.c new file mode 100644 index 0000000000..d5ccde4a7f --- /dev/null +++ b/harbour/source/codepage/uc88591b.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2003 Przemyslaw Czerpak + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, + 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, +}; + +HB_UNITABLE hb_uniTbl_8859_1b = { CPID_8859_1B, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/codepage/uc8859_1.c b/harbour/source/codepage/uc8859_1.c new file mode 100644 index 0000000000..34a7276c61 --- /dev/null +++ b/harbour/source/codepage/uc8859_1.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2003 Przemyslaw Czerpak + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, + 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, + 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, +}; + +HB_UNITABLE hb_uniTbl_8859_1 = { CPID_8859_1, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/codepage/uc8859_2.c b/harbour/source/codepage/uc8859_2.c new file mode 100644 index 0000000000..482469276a --- /dev/null +++ b/harbour/source/codepage/uc8859_2.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2003 Przemyslaw Czerpak + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, + 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, + 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, + 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, + 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, + 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, + 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, + 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, + 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, + 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, + 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, + 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9, +}; + +HB_UNITABLE hb_uniTbl_8859_2 = { CPID_8859_2, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/codepage/uckoi8.c b/harbour/source/codepage/uckoi8.c new file mode 100644 index 0000000000..a3b4c6acdb --- /dev/null +++ b/harbour/source/codepage/uckoi8.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2003 Przemyslaw Czerpak + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, + 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, + 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, + 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, + 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, + 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E, + 0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565, + 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x00A9, + 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, + 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, + 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, + 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A, +}; + +HB_UNITABLE hb_uniTbl_KOI_8 = { CPID_KOI_8, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/codepage/uckoi8u.c b/harbour/source/codepage/uckoi8u.c new file mode 100644 index 0000000000..e695dc236e --- /dev/null +++ b/harbour/source/codepage/uckoi8u.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2004 Pavel Tsarenko + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, + 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, + 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, + 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, + 0x2550, 0x2551, 0x2552, 0x0451, 0x0454, 0x2554, 0x0456, 0x0457, + 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x0491, 0x255D, 0x255E, + 0x255F, 0x2560, 0x2561, 0x0401, 0x0404, 0x2563, 0x0406, 0x0407, + 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x0490, 0x256C, 0x00A9, + 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, + 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, + 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, + 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A, +}; + +HB_UNITABLE hb_uniTbl_KOI_8U = { CPID_KOI_8U, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/codepage/ucmaz.c b/harbour/source/codepage/ucmaz.c new file mode 100644 index 0000000000..7a0f6a5eab --- /dev/null +++ b/harbour/source/codepage/ucmaz.c @@ -0,0 +1,93 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * + * + * Copyright 2003 Przemyslaw Czerpak + * www - http://www.xharbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARS 256 + +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x0105, 0x00E7, + 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0107, 0x00C4, 0x0104, + 0x0118, 0x0119, 0x0142, 0x00F4, 0x00F6, 0x0106, 0x00FB, 0x00F9, + 0x015A, 0x00D6, 0x00DC, 0x00A2, 0x0141, 0x00A5, 0x015B, 0x0192, + 0x0179, 0x017B, 0x00F3, 0x00D3, 0x0144, 0x0143, 0x017A, 0x017C, + 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, + 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, + 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0, +}; + +HB_UNITABLE hb_uniTbl_mazovia = { CPID_MAZ, NUMBER_OF_CHARS, FALSE, uniCodes }; diff --git a/harbour/source/common/expropt2.c b/harbour/source/common/expropt2.c index ea43c6c2ad..2dc1183260 100644 --- a/harbour/source/common/expropt2.c +++ b/harbour/source/common/expropt2.c @@ -1090,8 +1090,8 @@ HB_EXPR_PTR hb_compExprReduceIIF( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) ( pExpr->ExprType == HB_ET_CODEBLOCK ) || ( pExpr->ExprType == HB_ET_SELF ) || ( pExpr->ExprType == HB_ET_ARRAY ) ) - { - hb_compExprErrorType( pExpr, HB_MACRO_PARAM ); + { + hb_compExprErrorType( pExpr, HB_MACRO_PARAM ); } return pSelf; } @@ -1123,55 +1123,55 @@ HB_EXPR_PTR hb_compExprListStrip( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) BOOL hb_compExprReduceAT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) { - HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; - HB_EXPR_PTR pSub = pParms->value.asList.pExprList; - HB_EXPR_PTR pText = pSub->pNext; + HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; + HB_EXPR_PTR pSub = pParms->value.asList.pExprList; + HB_EXPR_PTR pText = pSub->pNext; HB_EXPR_PTR pReduced; if( pSub->ExprType == HB_ET_STRING && pText->ExprType == HB_ET_STRING ) { if( pSub->value.asString.string[0] == '\0' ) { - pReduced = hb_compExprNewLong( 1 ); + pReduced = hb_compExprNewLong( 1 ); } else { - pReduced = hb_compExprNewLong( hb_strAt( pSub->value.asString.string, pSub->ulLength, pText->value.asString.string, pText->ulLength ) ); + pReduced = hb_compExprNewLong( hb_strAt( pSub->value.asString.string, pSub->ulLength, pText->value.asString.string, pText->ulLength ) ); } - hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM ); hb_compExprFree( pSelf->value.asFunCall.pParms, HB_MACRO_PARAM ); memcpy( pSelf, pReduced, sizeof( HB_EXPR ) ); hb_compExprClear( pReduced ); - return TRUE; + return TRUE; } - else - return FALSE; + else + return FALSE; } BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) { - HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; + HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; HB_EXPR_PTR pArg = pParms->value.asList.pExprList; - HB_EXPR_PTR pExpr = NULL; - /* try to change it into a string */ + /* try to change it into a string */ if( pArg->ExprType == HB_ET_NUMERIC ) { - /* NOTE: CA-Cl*pper's compiler optimizer will be wrong for those - CHR() cases where the passed parameter is a constant which - can be divided by 256 but it's not zero, in this case it - will return an empty string instead of a Chr(0). [vszakats] */ + /* NOTE: CA-Cl*pper's compiler optimizer will be wrong for those + CHR() cases where the passed parameter is a constant which + can be divided by 256 but it's not zero, in this case it + will return an empty string instead of a Chr(0). [vszakats] */ - pExpr = hb_compExprNew( HB_ET_STRING ); - pExpr->ValType = HB_EV_STRING; - if( pArg->value.asNum.NumType == HB_ET_LONG ) + HB_EXPR_PTR pExpr = hb_compExprNew( HB_ET_STRING ); + + pExpr->ValType = HB_EV_STRING; + if( pArg->value.asNum.NumType == HB_ET_LONG ) { - BYTE bVal; - bVal = ( pArg->value.asNum.lVal % 256 ); - - if( bVal == 0 && pArg->value.asNum.lVal != 0 ) + BYTE bVal; + bVal = ( pArg->value.asNum.lVal % 256 ); + + if( bVal == 0 && pArg->value.asNum.lVal != 0 ) { pExpr->value.asString.string = ( char * ) hb_xgrab( 1 ); pExpr->value.asString.string[ 0 ] = '\0'; @@ -1183,7 +1183,7 @@ BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) pExpr->value.asString.string = ( char * ) hb_xgrab( 2 ); pExpr->value.asString.string[ 0 ] = bVal; pExpr->value.asString.string[ 1 ] = '\0'; - pExpr->value.asString.dealloc = TRUE; + pExpr->value.asString.dealloc = TRUE; pExpr->ulLength = 1; } } @@ -1208,7 +1208,7 @@ BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) BOOL hb_compExprReduceLEN( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) { - HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; + HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; HB_EXPR_PTR pArg = pParms->value.asList.pExprList; if( pArg->ExprType == HB_ET_STRING || pArg->ExprType == HB_ET_ARRAY ) @@ -1220,13 +1220,13 @@ BOOL hb_compExprReduceLEN( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) memcpy( pSelf, pExpr, sizeof( HB_EXPR ) ); hb_compExprClear( pExpr ); return TRUE; - } - return FALSE; + } + return FALSE; } BOOL hb_compExprReduceASC( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) { - HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; + HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; HB_EXPR_PTR pArg = pParms->value.asList.pExprList; if( pArg->ExprType == HB_ET_STRING ) @@ -1238,6 +1238,6 @@ BOOL hb_compExprReduceASC( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) memcpy( pSelf, pExpr, sizeof( HB_EXPR ) ); hb_compExprClear( pExpr ); return TRUE; - } - return FALSE; + } + return FALSE; } diff --git a/harbour/source/common/hbstr.c b/harbour/source/common/hbstr.c index f834389eda..3e684fb208 100644 --- a/harbour/source/common/hbstr.c +++ b/harbour/source/common/hbstr.c @@ -406,9 +406,9 @@ double hb_numInt( double dNum ) static BOOL hb_str2number( BOOL fPCode, const char* szNum, ULONG ulLen, HB_LONG * lVal, double * dVal, int * piDec, int * piWidth ) { - BOOL fDbl = FALSE, fDec = FALSE, fNeg = FALSE, fHex = FALSE; + BOOL fDbl = FALSE, fDec = FALSE, fNeg, fHex = FALSE; ULONG ulPos = 0; - int c, iWidth = 0, iDec = 0, iDecR = 0; + int c, iWidth, iDec = 0, iDecR = 0; HB_TRACE(HB_TR_DEBUG, ("hb_str2number(%d, %p, %ul %p, %p, %p, %p)", (int) fPCode, szNum, ulLen, lVal, dVal, piDec, piWidth )); diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index 1a5e019398..66b76a9cfe 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -3919,8 +3919,8 @@ void hb_compCodeBlockEnd( void ) void hb_compCodeBlockStop( void ) { PFUNCTION pCodeblock; /* pointer to the current codeblock */ - PFUNCTION pFunc;/* pointer to a function that owns a codeblock */ - USHORT wLocals = 0; /* number of referenced local variables */ + PFUNCTION pFunc; /* pointer to a function that owns a codeblock */ + USHORT wLocals = 0; /* number of referenced local variables */ USHORT wUsed; PVAR pVar, pFree; @@ -3960,7 +3960,7 @@ void hb_compCodeBlockStop( void ) hb_xfree( ( void * ) pFree ); } - hb_compGenPCodeN( pCodeblock->pCode, pCodeblock->lPCodePos, ( BOOL ) 0 ); + hb_compGenPCodeN( pCodeblock->pCode, pCodeblock->lPCodePos, FALSE ); hb_xfree( ( void * ) pCodeblock->pCode ); hb_xfree( ( void * ) pCodeblock ); } diff --git a/harbour/source/macro/macro.y b/harbour/source/macro/macro.y index 467960fd2b..58953e30cc 100644 --- a/harbour/source/macro/macro.y +++ b/harbour/source/macro/macro.y @@ -87,10 +87,6 @@ #endif #endif -#ifdef __GNUC__ -#undef __GNUC__ -#endif - /* yacc/lex related definitions */ #undef YYPARSE_PARAM diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 513d44a89c..959e361d2b 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -624,7 +624,6 @@ int hb_pp_ParseDefine( char * sLine ) sLine++; HB_SKIPTABSPACES( sLine ); - i = 0; npars = 0; while( *sLine && *sLine != ')' ) { @@ -695,7 +694,7 @@ int hb_pp_ParseDefine( char * sLine ) iPar = strlen( tmp ); memcpy( pars, tmp, iPar ); pars[ iPar ] = '\0'; - iPos = iOldPos = 0; + iOldPos = 0; while( (iPos = md_strAt( pars+1, iPar-1, sLine+iOldPos, TRUE, FALSE, FALSE )) ) { if( sLine[iOldPos+iPos] != '\001' ) diff --git a/harbour/source/pp/pptable.c b/harbour/source/pp/pptable.c index c99232a142..c133aedb81 100644 --- a/harbour/source/pp/pptable.c +++ b/harbour/source/pp/pptable.c @@ -125,6 +125,9 @@ void hb_pp_Table( void ) static DEFINES sD___54 = {"_SET_DIRCASE",NULL,-1,"103", &sD___53 }; static DEFINES sD___55 = {"_SET_DIRSEPARATOR",NULL,-1,"104", &sD___54 }; static DEFINES sD___56 = {"_SET_EOF",NULL,-1,"105", &sD___55 }; + static DEFINES sD___57 = {"_SET_HARDCOMMIT",NULL,-1,"106", &sD___56 }; + static DEFINES sD___58 = {"_SET_FORCEOPT",NULL,-1,"107", &sD___57 }; + static DEFINES sD___59 = {"_SET_DBFLOCKSCHEME",NULL,-1,"108", &sD___58 }; static COMMANDS sC___1 = {0,"NOTE","\1A30",NULL,NULL }; static COMMANDS sC___2 = {0,"DO","WHILE \1A00","while \1A00",&sC___1 }; @@ -442,8 +445,12 @@ void hb_pp_Table( void ) static COMMANDS sC___257 = {0,"SET","AUTORDER TO","Set( _SET_AUTORDER, 0 )",&sC___256 }; static COMMANDS sC___258 = {0,"SET","STRICTREAD \1A20 ON,OFF,&>","Set(_SET_STRICTREAD,\1A30 )",&sC___257 }; static COMMANDS sC___259 = {0,"SET","STRICTREAD (\1A00)","Set(_SET_STRICTREAD,\1A00 )",&sC___258 }; + static COMMANDS sC___260 = {0,"SET","HARDCOMMIT \1A20 ON,OFF,&>","Set(_SET_HARDCOMMIT,\1A30 )",&sC___259 }; + static COMMANDS sC___261 = {0,"SET","HARDCOMMIT (\1A00)","Set(_SET_HARDCOMMIT,\1A00 )",&sC___260 }; + static COMMANDS sC___262 = {0,"SET","DBFLOCKSCHEME TO \1A00","Set(_SET_DBFLOCKSCHEME, \1A00 )",&sC___261 }; + static COMMANDS sC___263 = {0,"SET","DBFLOCKSCHEME TO","Set(_SET_DBFLOCKSCHEME, 0 )",&sC___262 }; - hb_pp_topDefine = &sD___56; - hb_pp_topCommand = &sC___259; + hb_pp_topDefine = &sD___59; + hb_pp_topCommand = &sC___263; hb_pp_topTranslate = NULL; } diff --git a/harbour/source/rdd/dbcmd.c b/harbour/source/rdd/dbcmd.c index 877073f3b0..3180f242d7 100644 --- a/harbour/source/rdd/dbcmd.c +++ b/harbour/source/rdd/dbcmd.c @@ -4104,3 +4104,13 @@ ERRCODE hb_rddGetTempAlias( char * szAliasTmp ) return SUCCESS; } } + +HB_FUNC( __RDDGETTEMPALIAS ) +{ + char szAliasTmp[ HARBOUR_MAX_RDD_ALIAS_LENGTH + 1 ]; + + if ( hb_rddGetTempAlias( szAliasTmp ) == FAILURE ) + hb_ret(); + else + hb_retc( szAliasTmp ); +} diff --git a/harbour/source/rdd/dbf1.c b/harbour/source/rdd/dbf1.c index fd9e00c4f6..ab21fcb209 100644 --- a/harbour/source/rdd/dbf1.c +++ b/harbour/source/rdd/dbf1.c @@ -799,6 +799,8 @@ static ERRCODE hb_dbfGoTo( DBFAREAP pArea, ULONG ulRecNo ) if( SELF_GOCOLD( ( AREAP ) pArea ) == FAILURE ) return FAILURE; + if( pArea->lpdbPendingRel && pArea->lpdbPendingRel->isScoped ) + SELF_FORCEREL( ( AREAP ) pArea ); /* Reset parent rel struct */ pArea->lpdbPendingRel = NULL; diff --git a/harbour/source/rdd/dbfcdx/dbfcdx1.c b/harbour/source/rdd/dbfcdx/dbfcdx1.c index d3464ce4d2..3a6b13224c 100644 --- a/harbour/source/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/source/rdd/dbfcdx/dbfcdx1.c @@ -4953,7 +4953,6 @@ static BOOL hb_cdxCurKeyRefresh( CDXAREAP pArea, LPCDXTAG pTag ) /* not found, create new key from DBF and if differs seek again */ if ( !fBuf || memcmp( buf, pKey->val, pKey->len ) != 0 ) { - fBuf = TRUE; memcpy( buf, pKey->val, pKey->len ); hb_cdxTagKeyFind( pTag, pKey ); } @@ -5797,6 +5796,9 @@ static ERRCODE hb_cdxGoBottom( CDXAREAP pArea ) if ( ! pTag ) return SUPER_GOBOTTOM( ( AREAP ) pArea ); + if( pArea->lpdbPendingRel && pArea->lpdbPendingRel->isScoped ) + SELF_FORCEREL( ( AREAP ) pArea ); + hb_cdxIndexLockRead( pTag->pIndex ); hb_cdxTagGoBottom( pTag ); @@ -5839,6 +5841,9 @@ static ERRCODE hb_cdxGoTop( CDXAREAP pArea ) if ( ! pTag ) return SUPER_GOTOP( ( AREAP ) pArea ); + if( pArea->lpdbPendingRel && pArea->lpdbPendingRel->isScoped ) + SELF_FORCEREL( ( AREAP ) pArea ); + hb_cdxIndexLockRead( pTag->pIndex ); hb_cdxTagGoTop( pTag ); @@ -5882,6 +5887,9 @@ static ERRCODE hb_cdxSeek( CDXAREAP pArea, BOOL fSoftSeek, PHB_ITEM pKeyItm, BOO BOOL fEOF = FALSE, fLast; ULONG ulRec; + if( pArea->lpdbPendingRel && pArea->lpdbPendingRel->isScoped ) + SELF_FORCEREL( ( AREAP ) pArea ); + pArea->fTop = pArea->fBottom = FALSE; pArea->fEof = FALSE; @@ -6426,7 +6434,7 @@ static ERRCODE hb_cdxPack( CDXAREAP pArea ) if ( SUPER_PACK( ( AREAP ) pArea ) == SUCCESS ) { - return hb_cdxOrderListRebuild( pArea ); + return SELF_ORDLSTREBUILD( ( AREAP ) pArea ); } else return FAILURE; @@ -6445,10 +6453,9 @@ static ERRCODE hb_cdxZap ( CDXAREAP pArea ) if ( FAST_GOCOLD( ( AREAP ) pArea ) == FAILURE ) return FAILURE; - hb_cdxOrderListRebuild( pArea ); if ( SUPER_ZAP( ( AREAP ) pArea ) == SUCCESS ) { - return hb_cdxOrderListRebuild( pArea ); + return SELF_ORDLSTREBUILD( ( AREAP ) pArea ); } else return FAILURE; @@ -7494,6 +7501,9 @@ static ERRCODE hb_cdxClearScope( CDXAREAP pArea ) if ( pTag ) { + /* resolve any pending scope relations first */ + if( pArea->lpdbPendingRel && pArea->lpdbPendingRel->isScoped ) + SELF_FORCEREL( ( AREAP ) pArea ); hb_cdxTagClearScope( pTag, 0); hb_cdxTagClearScope( pTag, 1); } @@ -7528,6 +7538,10 @@ static ERRCODE hb_cdxScopeInfo( CDXAREAP pArea, USHORT nScope, PHB_ITEM pItem ) { PHB_ITEM *pScope; + /* resolve any pending scope relations first */ + if( pArea->lpdbPendingRel && pArea->lpdbPendingRel->isScoped ) + SELF_FORCEREL( ( AREAP ) pArea ); + pScope = ( pTag->UsrAscend ? nScope == 0 : nScope != 0 ) ? &(pTag->topScope) : &(pTag->bottomScope); if ( *pScope ) @@ -7556,6 +7570,10 @@ static ERRCODE hb_cdxSetScope( CDXAREAP pArea, LPDBORDSCOPEINFO sInfo ) if ( pTag ) { + /* resolve any pending scope relations first */ + if( pArea->lpdbPendingRel && pArea->lpdbPendingRel->isScoped ) + SELF_FORCEREL( ( AREAP ) pArea ); + if ( !sInfo->scopeValue ) { hb_cdxTagClearScope( pTag, sInfo->nScope ); diff --git a/harbour/source/rdd/dbfdbt/dbfdbt1.c b/harbour/source/rdd/dbfdbt/dbfdbt1.c index de4ec7065d..7f253fb3e1 100644 --- a/harbour/source/rdd/dbfdbt/dbfdbt1.c +++ b/harbour/source/rdd/dbfdbt/dbfdbt1.c @@ -270,12 +270,18 @@ static BOOL hb_dbtFileLockEx( DBTAREAP pArea ) { BOOL fRet; - do + if ( !pArea->fShared ) { - fRet = hb_fsLock( pArea->hMemoFile, DBT_LOCKPOS, DBT_LOCKSIZE, - FL_LOCK | FLX_EXCLUSIVE | FLX_WAIT ); - } while ( !fRet ); - + fRet = TRUE; + } + else + { + do + { + fRet = hb_fsLock( pArea->hMemoFile, DBT_LOCKPOS, DBT_LOCKSIZE, + FL_LOCK | FLX_EXCLUSIVE | FLX_WAIT ); + } while ( !fRet ); + } return fRet; } @@ -286,12 +292,18 @@ static BOOL hb_dbtFileLockSh( DBTAREAP pArea ) { BOOL fRet; - do + if ( !pArea->fShared ) { - fRet = hb_fsLock( pArea->hMemoFile, DBT_LOCKPOS, DBT_LOCKSIZE, - FL_LOCK | FLX_SHARED | FLX_WAIT ); - } while ( !fRet ); - + fRet = TRUE; + } + else + { + do + { + fRet = hb_fsLock( pArea->hMemoFile, DBT_LOCKPOS, DBT_LOCKSIZE, + FL_LOCK | FLX_SHARED | FLX_WAIT ); + } while ( !fRet ); + } return fRet; } @@ -300,7 +312,7 @@ static BOOL hb_dbtFileLockSh( DBTAREAP pArea ) */ static BOOL hb_dbtFileUnLock( DBTAREAP pArea ) { - return hb_fsLock( pArea->hMemoFile, DBT_LOCKPOS, DBT_LOCKSIZE, FL_UNLOCK ); + return !pArea->fShared || hb_fsLock( pArea->hMemoFile, DBT_LOCKPOS, DBT_LOCKSIZE, FL_UNLOCK ); } /* @@ -320,11 +332,13 @@ static ULONG hb_dbtGetMemoLen( DBTAREAP pArea, USHORT uiIndex ) ulBlock = 0; do { - hb_fsRead( pArea->hMemoFile, pBlock, DBT_BLOCKSIZE ); uiIndex = 0; - while( uiIndex < DBT_BLOCKSIZE && pBlock[ uiIndex ] != 0x1A ) - uiIndex++; - ulBlock += uiIndex; + if ( hb_fsRead( pArea->hMemoFile, pBlock, DBT_BLOCKSIZE ) == DBT_BLOCKSIZE ) + { + while( uiIndex < DBT_BLOCKSIZE && pBlock[ uiIndex ] != 0x1A ) + uiIndex++; + ulBlock += uiIndex; + } } while( uiIndex == DBT_BLOCKSIZE ); return ulBlock; } diff --git a/harbour/source/rdd/dbffpt/dbffpt1.c b/harbour/source/rdd/dbffpt/dbffpt1.c index 7509cde89f..77e6f22669 100644 --- a/harbour/source/rdd/dbffpt/dbffpt1.c +++ b/harbour/source/rdd/dbffpt/dbffpt1.c @@ -380,7 +380,7 @@ static BOOL hb_fptFileLockSh( FPTAREAP pArea, BOOL fWait ) */ static BOOL hb_fptFileUnLock( FPTAREAP pArea ) { - return hb_fsLock( pArea->hMemoFile, FPT_LOCKPOS, FPT_LOCKSIZE, FL_UNLOCK ); + return !pArea->fShared || hb_fsLock( pArea->hMemoFile, FPT_LOCKPOS, FPT_LOCKSIZE, FL_UNLOCK ); } /* @@ -2071,7 +2071,7 @@ static ERRCODE hb_fptGetVarLen( FPTAREAP pArea, USHORT uiIndex, ULONG * pLength if( pArea->fHasMemo && pArea->hMemoFile != FS_ERROR && pArea->lpFields[ uiIndex - 1 ].uiType == HB_IT_MEMO ) { - ERRCODE uiError = SUCCESS; + ERRCODE uiError; BOOL bLocked, bDeleted; #if defined( HB_FPT_USE_READLOCK ) ULONG ulOffset; diff --git a/harbour/source/rdd/dbfntx/dbfntx1.c b/harbour/source/rdd/dbfntx/dbfntx1.c index e8e57bc514..d1f9ea3a49 100644 --- a/harbour/source/rdd/dbfntx/dbfntx1.c +++ b/harbour/source/rdd/dbfntx/dbfntx1.c @@ -116,7 +116,6 @@ * ntxSetScope() */ -#include #include "hbapi.h" #include "hbinit.h" #include "hbapiitm.h" @@ -127,26 +126,38 @@ #include "hbapierr.h" #include "hbapilng.h" #include "hbrddntx.h" -#include "hbapicdp.h" +#ifndef HB_CDP_SUPPORT_OFF + #include "hbapicdp.h" +#endif + +#include +#ifdef HB_OS_BSD +#include /* We need mkstemp() */ +#endif -extern PHB_CODEPAGE hb_cdp_page; #define __PRG_SOURCE__ __FILE__ -extern USHORT hb_rddFieldIndex( AREAP pArea, char * szName ); - - -HB_FUNC( _DBFNTX ); -HB_FUNC( DBFNTX_GETFUNCTABLE ); +#ifndef __XHARBOUR__ + #define HB_VM_STACK hb_stack +#endif #ifdef HB_PCODE_VER #undef HB_PRG_PCODE_VER #define HB_PRG_PCODE_VER HB_PCODE_VER #endif +extern USHORT hb_rddFieldIndex( AREAP pArea, char * szName ); + +HB_FUNC( _DBFNTX ); +HB_FUNC( DBFNTX_GETFUNCTABLE ); + HB_INIT_SYMBOLS_BEGIN( dbfntx1__InitSymbols ) { "_DBFNTX", HB_FS_PUBLIC, {HB_FUNCNAME( _DBFNTX )}, 0 }, { "DBFNTX_GETFUNCTABLE", HB_FS_PUBLIC, {HB_FUNCNAME( DBFNTX_GETFUNCTABLE)} , 0 } HB_INIT_SYMBOLS_END( dbfntx1__InitSymbols ) -#if defined(_MSC_VER) + +#if defined(HB_PRAGMA_STARTUP) + #pragma startup dbfntx1__InitSymbols +#elif defined(_MSC_VER) #if _MSC_VER >= 1010 #pragma data_seg( ".CRT$XIY" ) #pragma comment( linker, "/Merge:.CRT=.data" ) @@ -155,8 +166,6 @@ HB_INIT_SYMBOLS_END( dbfntx1__InitSymbols ) #endif static HB_$INITSYM hb_vm_auto_dbfntx1__InitSymbols = dbfntx1__InitSymbols; #pragma data_seg() -#elif ! defined(__GNUC__) - #pragma startup dbfntx1__InitSymbols #endif static RDDFUNCS ntxSuper; @@ -165,7 +174,7 @@ static RDDFUNCS ntxSuper; static LPKEYINFO hb_ntxKeyNew( LPKEYINFO pKeyFrom, int keylen ); static LONG hb_ntxTagKeyFind( LPTAGINFO pTag, LPKEYINFO pKey, int keylen, BOOL* result, BOOL bSoftSeek ); static BOOL hb_ntxIsRecBad( NTXAREAP pArea, LONG ulRecNo ); -static int hb_ntxTagFindCurrentKey( LPTAGINFO pTag, LPPAGEINFO pPage, LPKEYINFO pKey, int keylen, BOOL bExact, BOOL lSeek ); +static int hb_ntxTagFindCurrentKey( LPTAGINFO pTag, LPPAGEINFO pPage, LPKEYINFO pKey, int keylen, BOOL bExact, int lSeek ); static USHORT hb_ntxPageFindCurrentKey( LPPAGEINFO pPage, ULONG ulRecno ); static void hb_ntxGetCurrentKey( LPTAGINFO pTag, LPKEYINFO pKey ); static void hb_ntxTagKeyGoTo( LPTAGINFO pTag, BYTE bTypRead, BOOL * lContinue ); @@ -216,7 +225,7 @@ static ULONG* hb_ntxKeysInPage( ULONG ulRecCount, USHORT maxkeys ) } while( dSum < recCount ); - lpArray = (ULONG*) hb_xgrab( sizeof(int) * (iLevel+2) ); + lpArray = (ULONG*) hb_xgrab( sizeof(ULONG) * (iLevel+2) ); lpArray[0] = (ULONG)iLevel; for( i=1; i<=iLevel; i++ ) lpArray[i] = 0; @@ -275,12 +284,12 @@ static void hb_IncString( NTXAREAP pArea, char* s, int slen ) if( nsymb < 255 ) { UINT n1, i; - if( pArea->cdPage->lSort && ( n1 = (UINT)pArea->cdPage->s_chars[ nsymb ] ) != 0 ) + if( pArea->cdPage->lSort && ( n1 = (UINT) pArea->cdPage->s_chars[ nsymb ] ) != 0 ) { n1 ++; for( i=0; i<255; i++ ) { - if( n1 == (UINT)pArea->cdPage->s_chars[ i ] ) + if( n1 == (UINT) pArea->cdPage->s_chars[ i ] ) { *ptr = (char) i; break; @@ -296,6 +305,38 @@ static void hb_IncString( NTXAREAP pArea, char* s, int slen ) } } +static void hb_DecString( NTXAREAP pArea, char* s, int slen ) +{ + char *ptr; + UINT nsymb; + + for( ptr=s+slen-1;ptr>=s;ptr-- ) + { + nsymb = (UINT) *ptr; + if( nsymb > 0 ) + { + UINT n1, i; + if( pArea->cdPage->lSort && ( n1 = (UINT) pArea->cdPage->s_chars[ nsymb ] ) != 0 ) + { + n1 --; + for( i=0; i<255; i++ ) + { + if( n1 == (UINT) pArea->cdPage->s_chars[ i ] ) + { + *ptr = (char) i; + break; + } + } + if( i >= 255 ) + *ptr = (char) --nsymb; + } + else + *ptr = (char) --nsymb; + break; + } + } +} + static char * numToStr( PHB_ITEM pItem, char* szBuffer, USHORT length, USHORT dec ) { char *ptr = szBuffer; @@ -340,7 +381,7 @@ static BOOL checkLogicalExpr( PHB_ITEM pForItem, PHB_ITEM pItem ) hb_vmPushSymbol( &hb_symEval ); hb_vmPush( pForItem ); hb_vmSend( 0 ); - hb_itemCopy( pItem, &hb_stack.Return ); + hb_itemCopy( pItem, &(HB_VM_STACK.Return) ); } else { @@ -374,9 +415,12 @@ static void hb__ntxTagKeyCount( LPTAGINFO pTag, LPPAGEINFO pPage, ULONG* ulKeyCo static BOOL hb_ntxInTopScope( LPTAGINFO pTag, char* key ) { if( pTag->topScope ) - return ( hb_ntxItemCompare( pTag->topScope->item.asString.value, - key, pTag->topScope->item.asString.length, - pTag->KeyLength,0,pTag->Owner->Owner->cdPage ) <= 0 ); + { + int i = hb_ntxItemCompare( pTag->topScope->item.asString.value, + key, pTag->topScope->item.asString.length, + pTag->KeyLength,0,pTag->Owner->Owner->cdPage ); + return pTag->AscendKey ? i <= 0 : i >= 0; + } else return TRUE; } @@ -384,9 +428,12 @@ static BOOL hb_ntxInTopScope( LPTAGINFO pTag, char* key ) static BOOL hb_ntxInBottomScope( LPTAGINFO pTag, char* key ) { if( pTag->bottomScope ) - return ( hb_ntxItemCompare( pTag->bottomScope->item.asString.value, - key, pTag->bottomScope->item.asString.length, - pTag->KeyLength,0,pTag->Owner->Owner->cdPage ) >= 0 ); + { + int i = hb_ntxItemCompare( pTag->bottomScope->item.asString.value, + key, pTag->bottomScope->item.asString.length, + pTag->KeyLength,0,pTag->Owner->Owner->cdPage ); + return pTag->AscendKey ? i >= 0 : i <= 0; + } else return TRUE; } @@ -397,7 +444,7 @@ static ULONG hb_ntxTagKeyNo( LPTAGINFO pTag ) if( pTag->Owner->Owner->fShared && !pTag->Memory ) { - while( !hb_fsLock( pTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK ) ); + while( !hb_fsLock( pTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK | FLX_SHARED | FLX_WAIT ) ); pTag->Owner->Locked = TRUE; } @@ -434,7 +481,7 @@ static ULONG hb_ntxTagKeyNo( LPTAGINFO pTag ) hb_ntxGetCurrentKey( pTag,pKey ); pTag->stackLevel = 0; - seekRes = hb_ntxTagFindCurrentKey( pTag, hb_ntxPageLoad( pTag,0 ), pKey, (int)pTag->KeyLength, FALSE, FALSE ); + seekRes = hb_ntxTagFindCurrentKey( pTag, hb_ntxPageLoad( pTag,0 ), pKey, (int)pTag->KeyLength, FALSE, 0 ); hb_ntxKeyFree( pKey ); if( !seekRes ) { @@ -475,7 +522,7 @@ static ULONG hb_ntxTagKeyCount( LPTAGINFO pTag ) if( pTag->Owner->Owner->fShared && !pTag->Memory ) { - while( !hb_fsLock( pTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK ) ); + while( !hb_fsLock( pTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK | FLX_SHARED | FLX_WAIT ) ); pTag->Owner->Locked = TRUE; } else if( pTag->keyCount ) @@ -496,7 +543,7 @@ static ULONG hb_ntxTagKeyCount( LPTAGINFO pTag ) pTag->CurKeyInfo->Tag = pTag->CurKeyInfo->Xtra = pTag->TagEOF = 0; pTag->stackLevel = 0; lRecno = ( hb_ntxTagFindCurrentKey( pTag, hb_ntxPageLoad( pTag,0 ), - pKey, (int)pTag->KeyLength, FALSE, TRUE ) <= 0 )? pTag->CurKeyInfo->Xtra:0; + pKey, (int)pTag->KeyLength, FALSE, 1 ) <= 0 )? pTag->CurKeyInfo->Xtra:0; hb_ntxKeyFree( pKey ); if( lRecno ) { @@ -591,7 +638,7 @@ static USHORT hb_ntxGetKeyType( LPTAGINFO pTag ) hb_vmPushSymbol( &hb_symEval ); hb_vmPush( pTag->pKeyItem ); hb_vmSend( 0 ); - return hb_itemType( &hb_stack.Return ); + return hb_itemType( &(HB_VM_STACK.Return) ); } else { @@ -631,7 +678,7 @@ static LONG hb_ntxTagKeyFind( LPTAGINFO pTag, LPKEYINFO pKey, int keylen, BOOL * pTag->CurKeyInfo->Tag = pTag->CurKeyInfo->Xtra = 0; pTag->TagBOF = pTag->TagEOF = *result = FALSE; pTag->stackLevel = 0; - K = hb_ntxTagFindCurrentKey( pTag, hb_ntxPageLoad( pTag,0 ), pKey, keylen, FALSE, (bSoftSeek)? 2:1 ); + K = hb_ntxTagFindCurrentKey( pTag, hb_ntxPageLoad( pTag,0 ), pKey, keylen, FALSE, bSoftSeek ? 2 : 1 ); if( K == 0 ) { *result = TRUE; @@ -685,7 +732,7 @@ static int hb_ntxPageKeySearch( LPTAGINFO pTag, LPPAGEINFO pPage, char* key, SHO } } -static int hb_ntxTagFindCurrentKey( LPTAGINFO pTag, LPPAGEINFO pPage, LPKEYINFO pKey, int keylen, BOOL bExact, BOOL lSeek ) +static int hb_ntxTagFindCurrentKey( LPTAGINFO pTag, LPPAGEINFO pPage, LPKEYINFO pKey, int keylen, BOOL bExact, int lSeek ) { int k, kChild; LPNTXITEM p; @@ -791,10 +838,11 @@ static USHORT hb_ntxPageFindCurrentKey( LPPAGEINFO pPage, ULONG ulRecno ) static void hb_ntxGetCurrentKey( LPTAGINFO pTag, LPKEYINFO pKey ) { char szBuffer[ NTX_MAX_KEY ]; - PHB_CODEPAGE cdpTmp = hb_cdp_page; PHB_ITEM pItem; - +#ifndef HB_CDP_SUPPORT_OFF + PHB_CODEPAGE cdpTmp = hb_cdp_page; hb_cdp_page = pTag->Owner->Owner->cdPage; +#endif if( pTag->nField ) { pItem = hb_itemNew( NULL ); @@ -805,7 +853,7 @@ static void hb_ntxGetCurrentKey( LPTAGINFO pTag, LPKEYINFO pKey ) hb_vmPushSymbol( &hb_symEval ); hb_vmPush( pTag->pKeyItem ); hb_vmSend( 0 ); - pItem = &hb_stack.Return; + pItem = &(HB_VM_STACK.Return); } else { @@ -839,7 +887,9 @@ static void hb_ntxGetCurrentKey( LPTAGINFO pTag, LPKEYINFO pKey ) else if( hb_itemType( pTag->pKeyItem ) != HB_IT_BLOCK ) hb_stackPop(); pKey->Xtra = pTag->Owner->Owner->ulRecNo; +#ifndef HB_CDP_SUPPORT_OFF hb_cdp_page = cdpTmp; +#endif } static BOOL hb_ntxTagGoToNextKey( LPTAGINFO pTag, BOOL lContinue ) @@ -859,7 +909,7 @@ static BOOL hb_ntxTagGoToNextKey( LPTAGINFO pTag, BOOL lContinue ) ( KEYITEM( pPage, pPage->CurKey ) )->page ) ) ) lCurrrentKey = TRUE; else - hb_ntxPageRelease( pTag,pPage ); + hb_ntxPageRelease( pTag, pPage ); } if( !lCurrrentKey ) @@ -876,7 +926,7 @@ static BOOL hb_ntxTagGoToNextKey( LPTAGINFO pTag, BOOL lContinue ) else hb_ntxGetCurrentKey( pTag,pKey ); pTag->stackLevel = 0; - seekRes = hb_ntxTagFindCurrentKey( pTag, hb_ntxPageLoad( pTag,0 ), pKey, (int)pTag->KeyLength, FALSE, FALSE ); + seekRes = hb_ntxTagFindCurrentKey( pTag, hb_ntxPageLoad( pTag,0 ), pKey, (int)pTag->KeyLength, FALSE, 0 ); hb_ntxKeyFree( pKey ); if( seekRes ) { @@ -975,7 +1025,7 @@ static BOOL hb_ntxTagGoToPrevKey( LPTAGINFO pTag, BOOL lContinue ) else hb_ntxGetCurrentKey( pTag, pKey ); pTag->stackLevel = 0; - seekRes = hb_ntxTagFindCurrentKey( pTag, hb_ntxPageLoad( pTag,0 ), pKey, (int)pTag->KeyLength, FALSE, FALSE ); + seekRes = hb_ntxTagFindCurrentKey( pTag, hb_ntxPageLoad( pTag,0 ), pKey, (int)pTag->KeyLength, FALSE, 0 ); hb_ntxKeyFree( pKey ); if( seekRes ) { @@ -1108,7 +1158,7 @@ static void hb_ntxTagKeyGoTo( LPTAGINFO pTag, BYTE bTypRead, BOOL * lContinue ) { if( pTag->Owner->Owner->fShared && !pTag->Owner->Locked && !pTag->Memory ) { - while( !hb_fsLock( pTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK ) ); + while( !hb_fsLock( pTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK | FLX_SHARED | FLX_WAIT ) ); wasLocked = pTag->Owner->Locked; pTag->Owner->Locked = TRUE; } @@ -1179,7 +1229,11 @@ static int hb_ntxItemCompare( char* s1, char* s2, int ilen1, int ilen2, BOOL Exa return -1; iLimit = ( ilen1 > ilen2 ) ? ilen2 : ilen1; +#ifndef HB_CDP_SUPPORT_OFF iResult = (cdpage->lSort)? hb_cdpcmp( s1, s2, (ULONG)iLimit, cdpage, NULL ):memcmp( s1, s2, iLimit ); +#else + iResult = memcmp( s1, s2, iLimit ); +#endif if( !iResult ) { if( ( iResult = ilen1 - ilen2 ) != 0 ) @@ -1214,6 +1268,7 @@ static void hb_ntxPageSave( LPTAGINFO pTag, LPPAGEINFO pPage ) ( ( LPNTXBUFFER ) pPage->buffer )->item_count = pPage->uiKeys; hb_fsSeek( pTag->Owner->DiskFile, pPage->Page, FS_SET ); hb_fsWrite( pTag->Owner->DiskFile, (BYTE *) pPage->buffer, NTXBLOCKSIZE ); + pTag->Owner->fFlush = TRUE; pPage->Changed = FALSE; } @@ -1226,7 +1281,9 @@ static LPPAGEINFO hb_ntxPageLoad( LPTAGINFO pTag, ULONG ulOffset ) if( !ulOffset ) { if( pTag->Owner->Owner->fShared && !pTag->Memory ) + { hb_ntxHeaderRead( pTag->Owner ); + } ulOffset = pTag->RootBlock; } if( pTag->Memory ) @@ -1868,7 +1925,7 @@ typedef SWAPPAGE * LPSWAPPAGE; typedef struct _PAGEITEM { - ULONG rec_no; + UINT32 rec_no; char key[ 1 ]; } PAGEITEM; @@ -1878,7 +1935,7 @@ struct _SORTITEM; typedef struct _SORTITEM { struct _SORTITEM * pNext; - ULONG rec_no; + UINT32 rec_no; char key[ 1 ]; } SORTITEM; @@ -1907,7 +1964,7 @@ typedef NTXSORTINFO * LPNTXSORTINFO; static void hb_ntxSwapPageSave( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, USHORT nPart ) { LPSORTITEM pKey = pSortInfo->pKeyFirst; - USHORT itemLength = sizeof( ULONG ) + pTag->KeyLength; + USHORT itemLength = sizeof( UINT32 ) + pTag->KeyLength; USHORT numKeys = 0, maxKeys = 512/itemLength, numAllkeys = 0; LPSWAPPAGE pSwapPage = (LPSWAPPAGE) ( pSortInfo->swappages + sizeof(SWAPPAGE)*nPart ); LPPAGEITEM ptr; @@ -1949,8 +2006,12 @@ static void hb_ntxKeysSort( LPNTXSORTINFO pSortInfo, LPSORTITEM* pKeyFirst, LPSO } else if( pSortInfo->pKey1 ) { +#ifndef HB_CDP_SUPPORT_OFF result = (hb_cdp_page->lSort)? - hb_cdpcmp( pKeyNew->key, pSortInfo->pKey1->key, (ULONG)KeyLength, hb_cdp_page, NULL ):memcmp( pKeyNew->key, pSortInfo->pKey1->key, KeyLength ); + hb_cdpcmp( pKeyNew->key, pSortInfo->pKey1->key, (ULONG)KeyLength, hb_cdp_page, NULL ):memcmp( pKeyNew->key, pSortInfo->pKey1->key, KeyLength ); +#else + result = memcmp( pKeyNew->key, pSortInfo->pKey1->key, KeyLength ); +#endif if( fDescend && result ) result = ( result > 0 )? -1:1; if( result >= 0 ) @@ -1974,8 +2035,12 @@ static void hb_ntxKeysSort( LPNTXSORTINFO pSortInfo, LPSORTITEM* pKeyFirst, LPSO pKey = *pKeyFirst; while( pKey ) { +#ifndef HB_CDP_SUPPORT_OFF result = (hb_cdp_page->lSort)? - hb_cdpcmp( pKeyNew->key, pKey->key, (ULONG)KeyLength, hb_cdp_page, NULL ):memcmp( pKeyNew->key, pKey->key, KeyLength ); + hb_cdpcmp( pKeyNew->key, pKey->key, (ULONG)KeyLength, hb_cdp_page, NULL ):memcmp( pKeyNew->key, pKey->key, KeyLength ); +#else + result = memcmp( pKeyNew->key, pKey->key, KeyLength ); +#endif if( fDescend && result ) result = ( result > 0 )? -1:1; if( result < 0 ) @@ -2085,7 +2150,10 @@ static void hb_ntxWritePage( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, char* buff /* printf( "\nhb_ntxWritePage-1A" ); */ } else + { hb_fsWrite( pTag->Owner->DiskFile, (BYTE *) buffer, NTXBLOCKSIZE ); + pTag->Owner->fFlush = TRUE; + } } static void hb_ntxRootPage( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, LPSORTITEM pKey, ULONG* lpArray, USHORT level ) @@ -2137,9 +2205,13 @@ static BOOL hb_ntxGetSortedKey( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, LPSORTI { char *key1, *key2; short int nPage, iPage; - int result = 0; + int result = 0; /* TODO: It's something wrong here, result was + not initialized. I forced initialization + but this code should be cleaned. Alex please do + that. Best regards, Przemek. + */ BOOL fDescend = !pTag->AscendKey; - USHORT itemLength = sizeof( ULONG ) + pTag->KeyLength; + USHORT itemLength = sizeof( UINT32 ) + pTag->KeyLength; LPSORTITEM pKey = *ppKey; LPSWAPPAGE pSwapPage = (LPSWAPPAGE) ( pSortInfo->swappages ); @@ -2192,7 +2264,7 @@ static BOOL hb_ntxGetSortedKey( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, LPSORTI /* printf( "\nSortedKey - 2 %d %d %c%c%c%c%c%c",nPage,*rec_no,key1[0],key1[1],key1[2],key1[3],key1[4],key1[5] ); */ if( ++(pSwapPage->curkey) == pSwapPage->numkeys ) { - USHORT pageItemLength = sizeof( ULONG ) + pTag->KeyLength; + USHORT pageItemLength = sizeof( UINT32 ) + pTag->KeyLength; USHORT maxKeys = 512/pageItemLength, nRead; if( pSwapPage->numReadkeys >= pSwapPage->numAllkeys ) @@ -2245,17 +2317,23 @@ static void hb_ntxBufferSave( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo ) pTag->pages[ul].buffer = pTag->pages[0].buffer + ul*NTXBLOCKSIZE; } else + { hb_fsSeek( pTag->Owner->DiskFile, 1024, FS_SET ); + } pSortInfo->Tag = 0; pSortInfo->pageBuffers = (char**) hb_xgrab( sizeof( char* ) * lpArray[0] ); for( i = 0; i < (USHORT)lpArray[0]; i++ ) + { pSortInfo->pageBuffers[i] = NULL; + } pSortInfo->pageBuffers[0] = (char*) hb_xgrab( NTXBLOCKSIZE ); memset( pSortInfo->pageBuffers[0], 0, NTXBLOCKSIZE ); itemlist = ( LPNTXBUFFER ) pSortInfo->pageBuffers[0]; for( i = 0; i < pTag->MaxKeys+1; i++ ) + { itemlist->item_offset[i] = 2 + 2 * ( pTag->MaxKeys + 1 ) + - i * ( pTag->KeyLength + 8 ); + i * ( pTag->KeyLength + 8 ); + } buffer = pSortInfo->pageBuffers[0]; if( !pKey ) @@ -2269,7 +2347,7 @@ static void hb_ntxBufferSave( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo ) { BOOL lKeys = FALSE; LPSORTITEM pKeyRoot = (LPSORTITEM) hb_xgrab( pSortInfo->itemLength ); - USHORT pageItemLength = sizeof( ULONG ) + pTag->KeyLength; + USHORT pageItemLength = sizeof( UINT32 ) + pTag->KeyLength; USHORT maxKeysSwapPage = 512/pageItemLength, nRead; LPSWAPPAGE pSwapPage; @@ -2327,7 +2405,7 @@ static void hb_ntxBufferSave( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo ) { while( pKey ) { - for( i = 0; ( i < maxKeys || numKey == pSortInfo->ulKeyCount-1 ) && pKey != 0; i++, numKey++, pKey = pKey->pNext ) + for( i = 0; ( i < maxKeys || numKey == pSortInfo->ulKeyCount-1 ) && pKey; i++, numKey++, pKey = pKey->pNext ) { /* printf( "\nhb_ntxBufferSave - 2 ( i=%d maxKeys=%d )",i,maxKeys ); */ item = (NTXITEM *)( buffer + itemlist->item_offset[i] ); @@ -2380,17 +2458,22 @@ static void hb_ntxBufferSave( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo ) pTag->RootBlock = 1024; } -static BOOL hb_ntxReadBuf( NTXAREAP pArea, BYTE* readBuffer, USHORT* numRecinBuf, LPDBORDERCONDINFO lpdbOrdCondInfo ) +static BOOL hb_ntxReadBuf( NTXAREAP pArea, BYTE* readBuffer, SHORT* numRecinBuf, LPDBORDERCONDINFO lpdbOrdCondInfo, ULONG ulRecNo ) { - if( ( !lpdbOrdCondInfo || lpdbOrdCondInfo->fAll ) && !pArea->lpdbRelations ) + if( *numRecinBuf >= 0 ) { if( *numRecinBuf == 10 ) *numRecinBuf = 0; if( *numRecinBuf == 0 ) - hb_fsReadLarge( pArea->hDataFile, readBuffer, pArea->uiRecordLen * 10 ); - + { + ULONG ulBufLen = pArea->uiRecordLen * 10; + hb_fsSeek( pArea->hDataFile, + pArea->uiHeaderLen + pArea->uiRecordLen * ( ulRecNo - 1 ), FS_SET ); + hb_fsReadLarge( pArea->hDataFile, readBuffer, ulBufLen ); + } pArea->pRecord = readBuffer + (*numRecinBuf) * pArea->uiRecordLen; pArea->fDeleted = ( pArea->pRecord[ 0 ] == '*' ); + pArea->ulRecNo = ulRecNo; (*numRecinBuf) ++; return TRUE; } @@ -2400,7 +2483,6 @@ static BOOL hb_ntxReadBuf( NTXAREAP pArea, BYTE* readBuffer, USHORT* numRecinBuf return FALSE; if( lpdbOrdCondInfo->lRecno ) { - SELF_GOTO( ( AREAP ) pArea, (ULONG)lpdbOrdCondInfo->lRecno ); lpdbOrdCondInfo->lNextCount = -1; return TRUE; } @@ -2421,15 +2503,11 @@ static BOOL hb_ntxReadBuf( NTXAREAP pArea, BYTE* readBuffer, USHORT* numRecinBuf return TRUE; } -/* DJGPP can sprintf a float that is almost 320 digits long */ -#define HB_MAX_DOUBLE_LENGTH 320 - static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex ) { - - ULONG ulRecNo = 0, ulRecCount, ulKeyNo = 0, lStep = 0, ulRecMax = 0; + ULONG ulRecNo, ulRecCount, ulKeyNo = 0, lStep = 0, ulRecMax; USHORT uiCurLen; - char szBuffer[ HB_MAX_DOUBLE_LENGTH + 1 ]; + char szBuffer[ NTX_MAX_KEY ]; char * pszTempName = NULL; NTXAREAP pArea = pIndex->Owner; LPTAGINFO pTag; @@ -2438,27 +2516,31 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex ) BOOL bWhileOk; NTXSORTINFO sortInfo; BYTE* readBuffer; - USHORT numRecinBuf = 0, nParts = 0; + SHORT numRecinBuf = -1; + USHORT nParts = 0; BYTE * pRecordTmp = NULL; BOOL fValidBuffer = FALSE; + LPTAGINFO pSaveTag = pArea->lpCurTag; +#ifndef HB_CDP_SUPPORT_OFF PHB_CODEPAGE cdpTmp = hb_cdp_page; + hb_cdp_page = pArea->cdPage; +#endif ulRecCount = pArea->ulRecCount; pTag = pIndex->CompoundTag; pItem = hb_itemNew( NULL ); - hb_cdp_page = pArea->cdPage; memset( &sortInfo, 0, sizeof( sortInfo ) ); readBuffer = (BYTE*) hb_xgrab( pArea->uiRecordLen * 10 ); /* itemLength = sizeof( LPSORTITEM ) + sizeof( ULONG ) + pTag->KeyLength; */ - sortInfo.itemLength = sizeof( LPSORTITEM ) + sizeof( ULONG ) + pTag->KeyLength; + sortInfo.itemLength = sizeof( LPSORTITEM ) + sizeof( UINT32 ) + pTag->KeyLength; sortInfo.nItems = 0; sortInfo.pKey1 = sortInfo.pKey2 = sortInfo.pKeyFirst = sortInfo.pKeyTemp = NULL; if( pArea->lpdbOrdCondInfo && pArea->lpdbOrdCondInfo->fCustom ) ulRecCount = 0; + ulRecMax = ulRecCount; if( ulRecCount ) { - ulRecMax = ulRecCount; sortInfo.sortBuffer = (BYTE*) hb_xalloc( ulRecCount * sortInfo.itemLength ); if( !sortInfo.sortBuffer ) { @@ -2490,25 +2572,57 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex ) else sortInfo.sortBuffer = NULL; - if( ( !pArea->lpdbOrdCondInfo || pArea->lpdbOrdCondInfo->fAll ) && !pArea->lpdbRelations ) + if( !hb_set.HB_SET_STRICTREAD && !pArea->lpdbRelations && + ( !pArea->lpdbOrdCondInfo || pArea->lpdbOrdCondInfo->fAll ) ) { pRecordTmp = pArea->pRecord; fValidBuffer = pArea->fValidBuffer; pArea->fValidBuffer = TRUE; - hb_fsSeek( pArea->hDataFile, pArea->uiHeaderLen, FS_SET ); + numRecinBuf = 0; } - else if( pArea->lpdbRelations || pArea->lpdbOrdCondInfo->fUseCurrent ) - SELF_GOTOP( ( AREAP ) pArea ); + else + { + if ( !pArea->lpdbOrdCondInfo || pArea->lpdbOrdCondInfo->fAll ) + { + pArea->lpCurTag = NULL; + SELF_GOTOP( ( AREAP ) pArea ); + } + else if ( pArea->lpdbOrdCondInfo->lRecno ) + { + SELF_GOTO( ( AREAP ) pArea, pArea->lpdbOrdCondInfo->lRecno ); + } + else if ( pArea->lpdbOrdCondInfo->fUseCurrent ) + { + if ( pArea->lpdbOrdCondInfo->lStartRecno ) + { + SELF_GOTO( ( AREAP ) pArea, pArea->lpdbOrdCondInfo->lStartRecno ); + } + else + { + SELF_GOTOP( ( AREAP ) pArea ); + } + } + else if ( pArea->lpdbOrdCondInfo->fRest || pArea->lpdbOrdCondInfo->lNextCount ) + { + if ( pArea->lpdbOrdCondInfo->lStartRecno ) + { + SELF_GOTO( ( AREAP ) pArea, pArea->lpdbOrdCondInfo->lStartRecno ); + } + } + else + { + pArea->lpCurTag = NULL; + SELF_GOTOP( ( AREAP ) pArea ); + } + } + + bWhileOk = TRUE; for( ulRecNo = 1; ulRecNo <= ulRecCount; ulRecNo++) { - if( !hb_ntxReadBuf( pArea, readBuffer, &numRecinBuf, pArea->lpdbOrdCondInfo ) ) + if( !hb_ntxReadBuf( pArea, readBuffer, &numRecinBuf, pArea->lpdbOrdCondInfo, ulRecNo ) ) break; - if( !pArea->lpdbOrdCondInfo || pArea->lpdbOrdCondInfo->fAll ) - pArea->ulRecNo = ulRecNo; if( pTag->pForItem != NULL ) bWhileOk = checkLogicalExpr( pTag->pForItem, pItem ); - else - bWhileOk = TRUE; if( bWhileOk ) { ulKeyNo ++; @@ -2517,7 +2631,7 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex ) { if( nParts == 1 ) { - BYTE szTempName[ _POSIX_PATH_MAX ]; + BYTE szTempName[ _POSIX_PATH_MAX + 1 ]; sortInfo.tempHandle = hb_fsCreateTemp( NULL, NULL, FC_NORMAL, szTempName ); if( sortInfo.tempHandle == FS_ERROR ) hb_errInternal( HB_EI_ERRUNRECOV, "Cannot create temp file", "hb_ntxIndexCreate", NULL ); @@ -2540,7 +2654,7 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex ) hb_vmPushSymbol( &hb_symEval ); hb_vmPush( pTag->pKeyItem ); hb_vmSend( 0 ); - hb_itemCopy( pItem, &hb_stack.Return ); + hb_itemCopy( pItem, &(HB_VM_STACK.Return) ); } else { @@ -2552,7 +2666,7 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex ) switch( hb_itemType( pItem ) ) { case HB_IT_STRING: - uiCurLen = (USHORT) hb_itemGetCLen( pItem ); + uiCurLen = (USHORT) pItem->item.asString.length; if(uiCurLen > NTX_MAX_KEY ) uiCurLen = NTX_MAX_KEY ; if( pTag->KeyLength != uiCurLen ) @@ -2581,10 +2695,8 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex ) printf( "ntxCreateOrder" ); } } - if( pArea->lpdbOrdCondInfo || pArea->lpdbRelations ) + if( pArea->lpdbOrdCondInfo ) { - if( !pArea->lpdbOrdCondInfo->fAll || pArea->lpdbRelations ) - SELF_SKIP( ( AREAP ) pArea, 1 ); if( pArea->lpdbOrdCondInfo->lStep ) { lStep ++; @@ -2596,27 +2708,30 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex ) hb_vmPushSymbol( &hb_symEval ); hb_vmPush( pArea->lpdbOrdCondInfo->itmCobEval ); hb_vmSend( 0 ); + if( ! hb_itemGetL( &(HB_VM_STACK.Return) ) ) + break; } } - /* - else if( pArea->lpdbRelations ) + if( numRecinBuf < 0 ) SELF_SKIP( ( AREAP ) pArea, 1 ); - */ } hb_ntxSortKeyEnd( pTag, &sortInfo ); - if( ( !pArea->lpdbOrdCondInfo || pArea->lpdbOrdCondInfo->fAll ) && !pArea->lpdbRelations ) + if( numRecinBuf >= 0 ) { pArea->pRecord = pRecordTmp; pArea->fValidBuffer = fValidBuffer; } + pArea->lpCurTag = pSaveTag; + if( sortInfo.nSwappages ) sortInfo.nSwappages = nParts - 1; /* Building index file with previously sorted keys */ hb_ntxBufferSave( pTag, &sortInfo ); +#ifndef HB_CDP_SUPPORT_OFF hb_cdp_page = cdpTmp; - +#endif if( pszTempName ) { /* Close temporary swap file, delete it and free name buffer */ hb_fsClose( sortInfo.tempHandle ); @@ -2640,13 +2755,15 @@ static void hb_ntxHeaderSave( LPNTXINDEX pIndex, BOOL bFull ) return; hb_fsSeek( pIndex->DiskFile , 0 , 0 ); memset( (void*) &Header, 0, sizeof( NTXHEADER ) ); - Header.type = 6; + Header.type = 0x06 | ( pIndex->CompoundTag->ForExpr ? 0x01 : 0x00 ) | + ( pIndex->Owner->bLockType == HB_SET_DBFLOCK_CL53 ? 0x20 : 0 ); Header.version = 1; Header.root = pIndex->CompoundTag->RootBlock; Header.next_page = pIndex->NextAvail; Header.item_size = pIndex->CompoundTag->KeyLength+8; Header.key_size = pIndex->CompoundTag->KeyLength; Header.key_dec = pIndex->CompoundTag->KeyDec; + if( bFull ) { Header.max_item = pIndex->CompoundTag->MaxKeys; @@ -2655,7 +2772,8 @@ static void hb_ntxHeaderSave( LPNTXINDEX pIndex, BOOL bFull ) if( pIndex->CompoundTag->ForExpr ) strcpy( Header.for_expr , pIndex->CompoundTag->ForExpr ); if( pIndex->CompoundTag->fTagName ) - strcpy( Header.tag_name , pIndex->CompoundTag->TagName ); + strncpy( Header.tag_name , pIndex->CompoundTag->TagName, NTX_MAX_TAGNAME ); + Header.unique = pIndex->CompoundTag->UniqueKey; Header.descend = !pIndex->CompoundTag->AscendKey; Header.custom = pIndex->CompoundTag->Custom; @@ -2665,6 +2783,8 @@ static void hb_ntxHeaderSave( LPNTXINDEX pIndex, BOOL bFull ) } else hb_fsWrite( pIndex->DiskFile,(BYTE*)&Header,16 ); + + pIndex->fFlush = TRUE; } static LPTAGINFO hb_ntxTagNew( LPNTXINDEX PIF, char * ITN, BOOL fTagName, char *szKeyExpr, @@ -2699,6 +2819,7 @@ static LPTAGINFO hb_ntxTagNew( LPNTXINDEX PIF, char * ITN, BOOL fTagName, char * pTag->KeyType = bKeyType; pTag->KeyLength = uiKeyLen; pTag->KeyDec = uiKeyDec; + /* Please check me - it was: (NTXBLOCKSIZE-6)/(uiKeyLen+10) - 1 */ pTag->MaxKeys = (NTXBLOCKSIZE-3)/(uiKeyLen+10) - 1; if( pTag->MaxKeys%2 && pTag->MaxKeys>2 ) pTag->MaxKeys--; @@ -2780,7 +2901,7 @@ static ERRCODE hb_ntxHeaderRead( LPNTXINDEX pIndex ) return SUCCESS; } -static ERRCODE hb_ntxHeaderLoad( LPNTXINDEX pIndex , char *ITN) +static ERRCODE hb_ntxHeaderLoad( LPNTXINDEX pIndex , char *ITN ) { NTXHEADER Header; LPTAGINFO pTag; @@ -2815,14 +2936,14 @@ static ERRCODE hb_ntxHeaderLoad( LPNTXINDEX pIndex , char *ITN) if( Header.tag_name[0] > 20 ) { pTag->fTagName = TRUE; - pTag->TagName = (char *) hb_xgrab( strlen( Header.tag_name ) + 1 ); - hb_strncpyUpper( pTag->TagName, Header.tag_name, strlen( Header.tag_name ) ); + pTag->TagName = (char *) hb_xgrab( NTX_MAX_TAGNAME + 1 ); + hb_strncpyUpper( pTag->TagName, Header.tag_name, NTX_MAX_TAGNAME ); } else { pTag->fTagName = FALSE; - pTag->TagName = (char *) hb_xgrab( strlen( ITN ) + 1 ); - hb_strncpyUpper( pTag->TagName, ITN, strlen( ITN ) ); + pTag->TagName = (char *) hb_xgrab( NTX_MAX_TAGNAME + 1 ); + hb_strncpyUpper( pTag->TagName, ITN, NTX_MAX_TAGNAME ); } pTag->KeyExpr = (char *) hb_xgrab( NTX_MAX_KEY ); strcpy( pTag->KeyExpr, Header.key_expr ); @@ -2882,7 +3003,7 @@ static LPTAGINFO ntxFindIndex( NTXAREAP pArea , PHB_ITEM lpOrder ) { do { - if( !hb_stricmp( current->TagName , hb_itemGetCPtr( lpOrder ) ) ) + if( !hb_stricmp( current->TagName , lpOrder->item.asString.value ) ) return current; current = current->pNext; } while( current ); @@ -2915,7 +3036,7 @@ static BOOL hb_ntxOrdKeyAdd( LPTAGINFO pTag ) { pKey->Tag = 0; if( pTag->Owner->Owner->fShared && !pTag->Memory ) - while( !hb_fsLock( pTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK ) ); + while( !hb_fsLock( pTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK | FLX_WAIT ) ); hb_ntxTagKeyAdd( pTag, pKey ); if( pTag->Owner->Owner->fShared && !pTag->Memory ) { @@ -2941,11 +3062,11 @@ static BOOL hb_ntxOrdKeyDel( LPTAGINFO pTag ) pKey = hb_ntxKeyNew( NULL,pTag->KeyLength ); hb_ntxGetCurrentKey( pTag, pKey ); if( pTag->Owner->Owner->fShared && !pTag->Memory ) - while( !hb_fsLock( pTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK ) ); + while( !hb_fsLock( pTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK | FLX_WAIT ) ); pTag->stackLevel = 0; if( hb_ntxInTopScope( pTag, pTag->CurKeyInfo->key ) && hb_ntxInBottomScope( pTag, pTag->CurKeyInfo->key ) && - !hb_ntxTagFindCurrentKey( pTag, hb_ntxPageLoad( pTag,0 ), pKey, (int)pTag->KeyLength, FALSE, FALSE ) ) + !hb_ntxTagFindCurrentKey( pTag, hb_ntxPageLoad( pTag,0 ), pKey, (int)pTag->KeyLength, FALSE, 0 ) ) { LPPAGEINFO pPage = hb_ntxPageLoad( pTag,pTag->CurKeyInfo->Tag ); pPage->CurKey = hb_ntxPageFindCurrentKey( pPage,pTag->CurKeyInfo->Xtra ) - 1; @@ -2973,21 +3094,21 @@ static ERRCODE ntxGoBottom( NTXAREAP pArea ) if( SELF_GOCOLD( ( AREAP ) pArea ) == FAILURE ) return FAILURE; if ( !pArea->lpCurTag || !pArea->lpNtxTag ) - SUPER_GOBOTTOM( ( AREAP ) pArea ); + SUPER_GOBOTTOM( ( AREAP ) pArea ); else { - LPTAGINFO pTag; + LPTAGINFO pTag; - pTag = pArea->lpCurTag; - if( pTag->bottomScope ) - { - ntxSeek( pArea, 0, pTag->bottomScope, 1 ); - if( pArea->fEof ) - return SUCCESS; - } - else - hb_ntxTagKeyGoTo( pTag, BTTM_RECORD, NULL ); - SELF_GOTO( ( AREAP ) pArea, pTag->CurKeyInfo->Xtra ); + pTag = pArea->lpCurTag; + if( pTag->bottomScope ) + { + ntxSeek( pArea, TRUE, pTag->bottomScope, TRUE ); + if ( pArea->fEof ) + return SUCCESS; + } + else + hb_ntxTagKeyGoTo( pTag, BTTM_RECORD, NULL ); + SELF_GOTO( ( AREAP ) pArea, pTag->CurKeyInfo->Xtra ); } return SELF_SKIPFILTER( ( AREAP ) pArea, -1 ); } @@ -3020,7 +3141,7 @@ static ERRCODE ntxGoTop( NTXAREAP pArea ) if( pTag->topScope ) { - ntxSeek( pArea, 1, pTag->topScope, 0 ); + ntxSeek( pArea, TRUE, pTag->topScope, FALSE ); if( pTag->TagEOF ) { hb_ntxGoEof( pArea ); @@ -3036,7 +3157,7 @@ static ERRCODE ntxGoTop( NTXAREAP pArea ) static ERRCODE ntxSeek( NTXAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFindLast ) { - ERRCODE retvalue; + ERRCODE retvalue = 0xFFFF; BOOL result; HB_TRACE(HB_TR_DEBUG, ("ntxSeek(%p, %d, %p, %d)", pArea, bSoftSeek, pKey, bFindLast)); @@ -3070,7 +3191,9 @@ static ERRCODE ntxSeek( NTXAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFin } keylen = ( ((USHORT)pKey->item.asString.length)KeyLength)? pKey->item.asString.length:pTag->KeyLength; memcpy( pKey2->key, pKey->item.asString.value, keylen ); +#ifndef HB_CDP_SUPPORT_OFF hb_cdpnTranslate( pKey2->key, hb_cdp_page, pArea->cdPage, keylen ); +#endif break; case HB_IT_INTEGER: case HB_IT_LONG: @@ -3098,7 +3221,7 @@ static ERRCODE ntxSeek( NTXAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFin if( pArea->fShared && !pTag->Memory ) { - while( !hb_fsLock( pArea->lpCurTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK ) ); + while( !hb_fsLock( pArea->lpCurTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK | FLX_SHARED | FLX_WAIT ) ); pArea->lpCurTag->Owner->Locked = TRUE; } lRecno = hb_ntxTagKeyFind( pTag, pKey2, keylen, &result, bSoftSeek ); @@ -3107,9 +3230,11 @@ static ERRCODE ntxSeek( NTXAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFin LONG lRecnoLast; pArea->fEof = pArea->fBof = FALSE; - hb_IncString( pArea, pKey2->key, keylen ); - lRecnoLast = hb_ntxTagKeyFind( pTag, pKey2, keylen, &result, 0 ); - hb_ntxKeyFree( pKey2 ); + if( pTag->AscendKey ) + hb_IncString( pArea, pKey2->key, keylen ); + else + hb_DecString( pArea, pKey2->key, keylen ); + lRecnoLast = hb_ntxTagKeyFind( pTag, pKey2, keylen, &result, FALSE ); if( lRecnoLast > 0 ) { BOOL lContinue = FALSE; @@ -3120,21 +3245,13 @@ static ERRCODE ntxSeek( NTXAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFin hb_ntxTagKeyGoTo( pTag, PREV_RECORD, &lContinue ); while( hb_ntxIsRecBad( pArea, pTag->CurKeyInfo->Xtra ) ); retvalue = SELF_GOTO( ( AREAP ) pArea, pTag->CurKeyInfo->Xtra ); - pArea->fFound = TRUE; } else { hb_ntxTagKeyGoTo( pTag, BTTM_RECORD, NULL ); retvalue = SELF_GOTO( ( AREAP ) pArea, pTag->CurKeyInfo->Xtra ); - pArea->fFound = TRUE; } - if( pArea->fShared && !pTag->Memory ) - { - hb_ntxPageFree( pTag,FALSE ); - hb_fsLock( pArea->lpCurTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_UNLOCK ); - pArea->lpCurTag->Owner->Locked = FALSE; - } - return retvalue; + pArea->fFound = TRUE; } if( pArea->fShared && !pTag->Memory ) { @@ -3142,60 +3259,60 @@ static ERRCODE ntxSeek( NTXAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFin hb_fsLock( pArea->lpCurTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_UNLOCK ); pArea->lpCurTag->Owner->Locked = FALSE; } - pArea->fEof = pTag->TagEOF; - pArea->fBof = pTag->TagBOF; - hb_ntxKeyFree( pKey2 ); - if ( lRecno > 0 && result ) + if( retvalue == 0xFFFF ) { - retvalue = SELF_GOTO( ( AREAP ) pArea, lRecno ); - pArea->fFound = TRUE; - return retvalue; - } - else - { - pArea->fFound = FALSE; - if ( lRecno > 0 && !result && bSoftSeek && !pTag->TagEOF ) + pArea->fEof = pTag->TagEOF; + pArea->fBof = pTag->TagBOF; + if ( lRecno > 0 && result ) { - SELF_GOTO( ( AREAP ) pArea, lRecno ); - if( pTag->bottomScope ) - { - hb_ntxGetCurrentKey( pTag, pTag->CurKeyInfo ); - if( !hb_ntxInBottomScope( pTag, pTag->CurKeyInfo->key ) ) - pArea->fEof = pTag->TagEOF = TRUE; - } - return SUCCESS; + retvalue = SELF_GOTO( ( AREAP ) pArea, lRecno ); + pArea->fFound = TRUE; } else - return hb_ntxGoEof( pArea ); + { + pArea->fFound = FALSE; + if ( lRecno > 0 && !result && bSoftSeek && !pTag->TagEOF ) + { + retvalue = SELF_GOTO( ( AREAP ) pArea, lRecno ); + if( pTag->bottomScope ) + { + hb_ntxGetCurrentKey( pTag, pTag->CurKeyInfo ); + if( !hb_ntxInBottomScope( pTag, pTag->CurKeyInfo->key ) ) + { + pArea->fEof = pTag->TagEOF = TRUE; + } + } + } + } } + if ( retvalue == 0xFFFF ) + { + retvalue = hb_ntxGoEof( pArea ); + } + hb_ntxKeyFree( pKey2 ); + return retvalue; } } static ERRCODE ntxSkipRaw( NTXAREAP pArea, LONG lToSkip ) { + LPTAGINFO pTag = pArea->lpCurTag; + BOOL lContinue = FALSE; + ULONG ulRecNo = pArea->ulRecNo; + HB_TRACE(HB_TR_DEBUG, ("ntxSkipRaw(%p, %ld)", pArea, lToSkip)); if( SELF_GOCOLD( ( AREAP ) pArea ) == FAILURE ) return FAILURE; - if ( ! pArea->lpCurTag ) - SUPER_SKIPRAW( ( AREAP ) pArea, lToSkip ); - else + if ( ! pArea->lpCurTag || lToSkip == 0 ) + return SUPER_SKIPRAW( ( AREAP ) pArea, lToSkip ); + + if ( lToSkip > 0 ) { - LPTAGINFO pTag = pArea->lpCurTag; - BOOL lContinue = FALSE; - ULONG ulRecNo = pArea->ulRecNo; - - if ( pArea->fBof && !pArea->fEof ) - SELF_GOTOP( ( AREAP ) pArea ); - - if ( lToSkip == 0 ) - SUPER_SKIPRAW( ( AREAP ) pArea, 0 ); - else if ( lToSkip > 0 ) - { - if ( !pArea->fEof ) - { - while ( !pTag->TagEOF && lToSkip-- > 0 ) - { + if ( !pArea->fEof ) + { + while ( !pTag->TagEOF && lToSkip-- > 0 ) + { hb_ntxTagKeyGoTo( pTag, NEXT_RECORD, &lContinue ); if( !pTag->TagEOF ) { @@ -3203,58 +3320,59 @@ static ERRCODE ntxSkipRaw( NTXAREAP pArea, LONG lToSkip ) { ntxSeek( pArea, 1, pTag->topScope, 0 ); } - else if( !hb_ntxInBottomScope( pTag, pTag->CurKeyInfo->key ) ) + if( !hb_ntxInBottomScope( pTag, pTag->CurKeyInfo->key ) ) { pTag->TagEOF = TRUE; } } - } - pArea->ulRecNo = ulRecNo; - if ( !pTag->TagEOF ) - { + } + pArea->ulRecNo = ulRecNo; + if ( !pTag->TagEOF ) + { if( pTag->CurKeyInfo->Tag ) SELF_GOTO( ( AREAP ) pArea, pTag->CurKeyInfo->Xtra ); - } - else - { + } + else + { hb_ntxGoEof( pArea ); - } - } - } - else /* ( lToSkip < 0 ) */ - { - if ( pArea->fEof ) - { + } + } + } + else /* ( lToSkip < 0 ) */ + { + if ( pArea->fEof ) + { SELF_GOBOTTOM( ( AREAP ) pArea ); lToSkip++; - } - pTag->TagBOF = FALSE; - while ( !pTag->TagBOF && lToSkip++ < 0 ) - { + } + pTag->TagBOF = FALSE; + while ( !pTag->TagBOF && lToSkip++ < 0 ) + { hb_ntxTagKeyGoTo( pTag, PREV_RECORD, &lContinue ); - if( !hb_ntxInTopScope( pTag, pTag->CurKeyInfo->key ) ) + if ( !pTag->TagBOF ) { - ntxSeek( pArea, 1, pTag->topScope, 0 ); - pTag->TagBOF = TRUE; + if( !hb_ntxInTopScope( pTag, pTag->CurKeyInfo->key ) ) + { + pTag->TagBOF = TRUE; + } + else if( !hb_ntxInBottomScope( pTag, pTag->CurKeyInfo->key ) ) + { + ntxSeek( pArea, 1, pTag->bottomScope, 1 ); + } } - else if( !hb_ntxInBottomScope( pTag, pTag->CurKeyInfo->key ) ) - { - ntxSeek( pArea, 1, pTag->bottomScope, 1 ); - } - } - pArea->ulRecNo = ulRecNo; - if ( !pTag->TagBOF ) - { + } + pArea->ulRecNo = ulRecNo; + if ( !pTag->TagBOF ) + { if( pTag->CurKeyInfo->Tag ) SELF_GOTO( ( AREAP ) pArea, pTag->CurKeyInfo->Xtra ); - } - else - { + } + else + { pTag->TagBOF = FALSE; SELF_GOTOP( ( AREAP ) pArea ); pArea->fBof = pTag->TagBOF = TRUE; - } - } + } } return SUCCESS; } @@ -3299,13 +3417,14 @@ static ERRCODE ntxGoCold( NTXAREAP pArea ) { pArea->lpCurTag = pTag; if( pArea->fShared && !pTag->Memory ) - while( !hb_fsLock( pTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK ) ); + while( !hb_fsLock( pTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_LOCK | FLX_WAIT ) ); + pTag->Owner->Locked = TRUE; if( !pArea->fNtxAppend && !fAppend && pTag->InIndex ) { LPKEYINFO pKeyOld = hb_ntxKeyNew( pTag->CurKeyInfo,pTag->KeyLength ); pTag->stackLevel = 0; - if( hb_ntxTagFindCurrentKey( pTag, hb_ntxPageLoad( pTag,0 ), pKeyOld, (int)pTag->KeyLength, FALSE, FALSE ) ) + if( hb_ntxTagFindCurrentKey( pTag, hb_ntxPageLoad( pTag,0 ), pKeyOld, (int)pTag->KeyLength, FALSE, 0 ) ) { printf( "\n\rntxGoCold: Cannot find current key:" ); pTag = pTag->pNext; @@ -3336,6 +3455,7 @@ static ERRCODE ntxGoCold( NTXAREAP pArea ) { hb_ntxPageFree( pTag,FALSE ); hb_fsLock( pTag->Owner->DiskFile, NTX_LOCK_OFFSET, 1, FL_UNLOCK ); + pTag->Owner->Locked = FALSE; } } hb_ntxKeyFree( pKey ); @@ -3378,6 +3498,38 @@ static ERRCODE ntxGoHot( NTXAREAP pArea ) return FAILURE; } +/* + * Flush _system_ buffers to disk + */ +static ERRCODE ntxFlush( NTXAREAP pArea ) +{ + LPTAGINFO pTag; + ERRCODE uiError; + + HB_TRACE(HB_TR_DEBUG, ("ntxFlush(%p)", pArea)); + + if( SELF_GOCOLD( ( AREAP ) pArea ) == FAILURE ) + return FAILURE; + + uiError = SUPER_FLUSH( ( AREAP ) pArea ); + + if ( hb_set.HB_SET_HARDCOMMIT ) + { + pTag = pArea->lpNtxTag; + while( pTag ) + { + if( !pTag->Memory && pTag->Owner->fFlush ) + { + hb_fsCommit( pTag->Owner->DiskFile ); + pTag->Owner->fFlush = FALSE; + } + pTag = pTag->pNext; + } + } + + return uiError; +} + /* * Retrieve the size of the WorkArea structure. */ @@ -3451,16 +3603,18 @@ static ERRCODE ntxZap( NTXAREAP pArea ) hb_fsSeek( pTag->Owner->DiskFile, NTXBLOCKSIZE, FS_SET ); hb_fsWrite( pTag->Owner->DiskFile, (BYTE *) buffer, NTXBLOCKSIZE ); hb_fsWrite( pTag->Owner->DiskFile, NULL, 0 ); + pTag->Owner->fFlush = TRUE; } pTag = pTag->pNext; } + pArea->lpCurTag = pTagTmp; hb_xfree( buffer ); return SELF_GOTOP( ( AREAP ) pArea ); } else - return FAILURE; + return FAILURE; } static ERRCODE ntxOrderCondition( NTXAREAP area, LPDBORDERCONDINFO pOrdCondInfo ) @@ -3484,6 +3638,7 @@ static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) LPTAGINFO pTag; PHB_FNAME pFileName; DBORDERINFO pExtInfo; + BOOL fTagName; BYTE bType; HB_TRACE(HB_TR_DEBUG, ("ntxOrderCreate(%p, %p)", pArea, pOrderInfo)); @@ -3528,7 +3683,7 @@ static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) pExpMacro = ( HB_MACRO_PTR ) hb_itemGetPtr( pExpr ); hb_macroRun( pExpMacro ); pResult = pExpr; - hb_itemCopy( pResult, &hb_stack.Return ); + hb_itemCopy( pResult, hb_stackItemFromTop( -1 ) ); hb_stackPop(); } @@ -3619,7 +3774,7 @@ static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) pForMacro = ( HB_MACRO_PTR ) hb_itemGetPtr( pExpr ); hb_macroRun( pForMacro ); pResult = pExpr; - hb_itemCopy( pResult, &hb_stack.Return ); + hb_itemCopy( pResult, hb_stackItemFromTop( -1 ) ); hb_stackPop(); } uiType = hb_itemType( pResult ); @@ -3664,24 +3819,29 @@ static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) } } - if( pOrderInfo->atomBagName ) + if( pOrderInfo->atomBagName && strlen( ( const char * ) pOrderInfo->atomBagName ) > 0 ) { int iTagNameLen = strlen( ( const char * ) pOrderInfo->atomBagName ); if( iTagNameLen > 10 ) iTagNameLen = 10; szTagName = ( char * ) hb_xgrab( iTagNameLen + 1 ); hb_strncpyUpper( szTagName, ( const char * ) pOrderInfo->atomBagName, iTagNameLen ); + fTagName = TRUE; } else { - szTagName = ( char * ) hb_xgrab( strlen( pFileName->szName ) + 1 ); - hb_strncpyUpper( szTagName, pFileName->szName, strlen( pFileName->szName ) ); + int iTagNameLen = strlen( pFileName->szName ); + if( iTagNameLen > 10 ) + iTagNameLen = 10; + szTagName = ( char * ) hb_xgrab( iTagNameLen + 1 ); + hb_strncpyUpper( szTagName, pFileName->szName, iTagNameLen ); + fTagName = FALSE; } hb_xfree( pFileName ); pIndex = hb_ntxIndexNew( pArea ); pIndex->IndexName = szFileName; - pTag = hb_ntxTagNew( pIndex, szTagName, (pOrderInfo->atomBagName)? 1:0, pOrderInfo->abExpr->item.asString.value, + pTag = hb_ntxTagNew( pIndex, szTagName, fTagName, pOrderInfo->abExpr->item.asString.value, pKeyExp, bType, (USHORT) uiLen, (USHORT) uiDec, (char *) ( pArea->lpdbOrdCondInfo ? pArea->lpdbOrdCondInfo->abFor : NULL ), pForExp, pArea->lpdbOrdCondInfo ? !pArea->lpdbOrdCondInfo->fDescending : TRUE, pOrderInfo->fUnique, pArea->lpdbOrdCondInfo ? pArea->lpdbOrdCondInfo->fCustom : FALSE, @@ -3766,15 +3926,15 @@ static ERRCODE ntxOrderInfo( NTXAREAP pArea, USHORT uiIndex, LPDBORDERINFO pInfo case DBOI_EXPRESSION: hb_itemPutC( pInfo->itmResult , pTag->KeyExpr ); break; - case DBOI_NUMBER: - hb_itemPutNI( pInfo->itmResult, pTag->TagRoot ); - break; case DBOI_BAGNAME: hb_itemPutC( pInfo->itmResult, pTag->Owner->IndexName ); break; case DBOI_NAME: hb_itemPutC( pInfo->itmResult, pTag->TagName ); break; + case DBOI_NUMBER: + hb_itemPutNI( pInfo->itmResult, pTag->TagRoot ); + break; case DBOI_KEYCOUNT: hb_itemPutNL( pInfo->itmResult, hb_ntxTagKeyCount( pTag ) ); break; @@ -3822,7 +3982,7 @@ static ERRCODE ntxOrderInfo( NTXAREAP pArea, USHORT uiIndex, LPDBORDERINFO pInfo } break; case DBOI_ORDERCOUNT: - if( pInfo->atomBagName && (char*) hb_itemGetCPtr( pInfo->atomBagName )) + if( pInfo->atomBagName && (char*) hb_itemGetCPtr( pInfo->atomBagName ) ) { hb_itemPutNL( pInfo->itmResult, 1 ); } @@ -3871,6 +4031,7 @@ static ERRCODE ntxOrderInfo( NTXAREAP pArea, USHORT uiIndex, LPDBORDERINFO pInfo case DBOI_SCOPEBOTTOMCLEAR : hb_itemClear( pInfo->itmResult ); break; + case DBOI_NUMBER: case DBOI_ORDERCOUNT: hb_itemPutNL( pInfo->itmResult, 0 ); break; @@ -3897,8 +4058,8 @@ static ERRCODE ntxScopeInfo( NTXAREAP pArea, USHORT nScope, PHB_ITEM pItem ) HB_TRACE(HB_TR_DEBUG, ("ntxScopeInfo(%p, %hu, %p)", pArea, nScope, pItem)); - if( !pArea->lpCurTag || ( nScope == 0 && !pArea->lpCurTag->topScope ) || - ( nScope == 1 && !pArea->lpCurTag->bottomScope ) ) + if( !pArea->lpCurTag || ( (nScope) ? !pArea->lpCurTag->bottomScope : + !pArea->lpCurTag->topScope ) ) hb_itemClear( pItem ); else { @@ -3913,12 +4074,15 @@ static ERRCODE ntxScopeInfo( NTXAREAP pArea, USHORT nScope, PHB_ITEM pItem ) case HB_IT_INTEGER: case HB_IT_LONG: case HB_IT_DOUBLE: - hb_itemPutND( pItem, hb_strVal( - hb_itemGetCPtr( (nScope)? pTag->bottomScope:pTag->topScope ), - hb_itemGetCLen( (nScope)? pTag->bottomScope:pTag->topScope ) ) ); + if ( nScope ) + hb_itemPutND( pItem, hb_strVal( pTag->bottomScope->item.asString.value, + pTag->bottomScope->item.asString.length ) ); + else + hb_itemPutND( pItem, hb_strVal( pTag->topScope->item.asString.value, + pTag->topScope->item.asString.length ) ); break; case HB_IT_DATE: - hb_itemPutDS( pItem, hb_itemGetCPtr( (nScope)? pTag->bottomScope:pTag->topScope ) ); + hb_itemPutDS( pItem, (nScope)? pTag->bottomScope->item.asString.value:pTag->topScope->item.asString.value ); break; } } @@ -3941,9 +4105,8 @@ static ERRCODE ntxOrderListAdd( NTXAREAP pArea, LPDBORDERINFO pOrderInfo ) if( SELF_GOCOLD( ( AREAP ) pArea ) == FAILURE ) return FAILURE; - szFileName = ( char * ) hb_xgrab( _POSIX_PATH_MAX + 3 ); - szFileName[ 0 ] = '\0'; - strcpy( szFileName, hb_itemGetCPtr( pOrderInfo->atomBagName ) ); + szFileName = ( char * ) hb_xgrab( _POSIX_PATH_MAX + 1 ); + hb_strncpy( szFileName, hb_itemGetCPtr( pOrderInfo->atomBagName ), _POSIX_PATH_MAX ); if( strlen( szFileName ) == 0 ) { hb_xfree( szFileName ); @@ -3954,15 +4117,19 @@ static ERRCODE ntxOrderListAdd( NTXAREAP pArea, LPDBORDERINFO pOrderInfo ) { pExtInfo.itmResult = hb_itemPutC( NULL, "" ); SELF_ORDINFO( ( AREAP ) pArea, DBOI_BAGEXT, &pExtInfo ); - strcat( szFileName, hb_itemGetCPtr( pExtInfo.itmResult ) ); + hb_strncat( szFileName, hb_itemGetCPtr( pExtInfo.itmResult ), _POSIX_PATH_MAX ); hb_itemRelease( pExtInfo.itmResult ); } pIndex = hb_ntxIndexNew( pArea ); /* Index file could be opened with FO_READ only in exclusive readonly mode - to allow locking in other modes */ - uiFlags = !pArea->fShared && pArea->fReadonly ? FO_READ : FO_READWRITE; - uiFlags |= pArea->fShared ? FO_DENYNONE : FO_EXCLUSIVE; + to allow locking in other modes + Alexander, it's not proper solution. It will cause that you cannot open + readonly files in exclusive mode. Shared locks should be used instead + this hack for readonly mode. + */ + uiFlags = ( pArea->fReadonly ? FO_READ : FO_READWRITE ) | + ( pArea->fShared ? FO_DENYNONE : FO_EXCLUSIVE ); do { @@ -4059,13 +4226,16 @@ static ERRCODE ntxOrderListFocus( NTXAREAP pArea, LPDBORDERINFO pOrderInfo ) HB_TRACE(HB_TR_DEBUG, ("ntxOrderListFocus(%p, %p)", pArea, pOrderInfo)); - hb_itemPutC( pOrderInfo->itmResult, (pArea->lpCurTag)? pArea->lpCurTag->TagName:"" ); + pOrderInfo->itmResult = hb_itemPutC( pOrderInfo->itmResult, + (pArea->lpCurTag) ? pArea->lpCurTag->TagName : "" ); if( pOrderInfo->itmOrder ) { if( hb_itemType( pOrderInfo->itmOrder ) != HB_IT_STRING && hb_itemGetNI( pOrderInfo->itmOrder ) == 0 ) + { pArea->lpCurTag = NULL; + } else { pTag = ntxFindIndex( pArea, pOrderInfo->itmOrder ); @@ -4101,6 +4271,7 @@ static ERRCODE ntxOrderListRebuild( NTXAREAP pArea ) { hb_fsSeek( pTag->Owner->DiskFile, NTXBLOCKSIZE, FS_SET ); hb_fsWrite( pTag->Owner->DiskFile, NULL, 0 ); + pTag->Owner->fFlush = TRUE; } pTag->RootBlock = 0; pTag->keyCount = pTag->Owner->NextAvail = 0; @@ -4110,8 +4281,7 @@ static ERRCODE ntxOrderListRebuild( NTXAREAP pArea ) { hb_ntxHeaderSave( pTag->Owner, TRUE ); hb_fsSeek( pTag->Owner->DiskFile , 0 , 0 ); - pTag->TagBlock = - hb_fsSeek( pTag->Owner->DiskFile, 0, SEEK_END ) - 1024; + pTag->TagBlock = hb_fsSeek( pTag->Owner->DiskFile, 0, SEEK_END ) - 1024; } pTag = pTag->pNext; @@ -4136,9 +4306,12 @@ static ERRCODE ntxSetScope( NTXAREAP pArea, LPDBORDSCOPEINFO sInfo ) { LPTAGINFO pTag = pArea->lpCurTag; USHORT nKeyType = hb_ntxGetKeyType( pTag ); - PHB_ITEM *ppItem = (sInfo->nScope)? &(pTag->bottomScope):&(pTag->topScope); + PHB_ITEM *ppItem; + USHORT nScope = sInfo->nScope; char szBuffer[ NTX_MAX_KEY ]; + ppItem = (nScope) ? &(pTag->bottomScope) : &(pTag->topScope); + pTag->keyCount = 0; if( !sInfo->scopeValue ) { @@ -4154,7 +4327,9 @@ static ERRCODE ntxSetScope( NTXAREAP pArea, LPDBORDSCOPEINFO sInfo ) if( *ppItem == NULL ) *ppItem = hb_itemNew( NULL ); hb_itemCopy( *ppItem, sInfo->scopeValue ); +#ifndef HB_CDP_SUPPORT_OFF hb_cdpnTranslate( (*ppItem)->item.asString.value, hb_cdp_page, pArea->cdPage, (*ppItem)->item.asString.length ); +#endif } break; case HB_IT_INTEGER: @@ -4201,7 +4376,7 @@ static RDDFUNCS ntxTable = { ntxBof, ntxFieldDisplay, ntxFieldInfo, ntxFieldName, - ntxFlush, + ( DBENTRYP_V ) ntxFlush, ntxGetRec, ntxGetValue, ntxGetVarLen, @@ -4278,7 +4453,7 @@ static RDDFUNCS ntxTable = { ntxBof, ntxWhoCares }; -HB_FUNC(_DBFNTX ){;} +HB_FUNC(_DBFNTX ) {;} HB_FUNC( DBFNTX_GETFUNCTABLE ) { diff --git a/harbour/source/rdd/dbfuncs.prg b/harbour/source/rdd/dbfuncs.prg index 395cc8d7ef..2d3973dfb3 100644 --- a/harbour/source/rdd/dbfuncs.prg +++ b/harbour/source/rdd/dbfuncs.prg @@ -56,8 +56,8 @@ FUNCTION DBCLEARFIL() FUNCTION DBSETDRIVE(cDriver) Return DBSETDRIVER(cDriver) -FUNCTION DBSETRELAT(xArea,bRelation,cRelation) - Return DBSETRELATION(xArea,bRelation,cRelation) +FUNCTION DBSETRELAT(xArea,bRelation,cRelation,lScoped) + Return DBSETRELATION(xArea,bRelation,cRelation,lScoped) FUNCTION DBRLOCKLIS() Return DBRLOCKLIST() diff --git a/harbour/source/rdd/dbnubs.c b/harbour/source/rdd/dbnubs.c index 7929c76cf5..d8edebb3ac 100644 --- a/harbour/source/rdd/dbnubs.c +++ b/harbour/source/rdd/dbnubs.c @@ -54,29 +54,29 @@ #ifdef HB_C52_UNDOC -extern HB_FUNC( DBSEEK ); -extern HB_FUNC( DBSKIP ); -extern HB_FUNC( DBGOTOP ); -extern HB_FUNC( DBGOBOTTOM ); -extern HB_FUNC( DBGOTO ); -extern HB_FUNC( DBAPPEND ); -extern HB_FUNC( DBDELETE ); -extern HB_FUNC( DBRECALL ); -extern HB_FUNC( DBCOMMITALL ); -extern HB_FUNC( DBUNLOCK ); -extern HB_FUNC( DBUNLOCKALL ); -extern HB_FUNC( DBSETFILTER ); -extern HB_FUNC( DBCLEARRELATION ); -extern HB_FUNC( DBSETRELATION ); -extern HB_FUNC( DBREINDEX ); -extern HB_FUNC( DBCREATEINDEX ); -extern HB_FUNC( DBCLEARINDEX ); -extern HB_FUNC( DBSETINDEX ); -extern HB_FUNC( DBSETORDER ); -extern HB_FUNC( DBCLOSEALL ); -extern HB_FUNC( DBCLOSEAREA ); -extern HB_FUNC( DBUSEAREA ); -extern HB_FUNC( DBSELECTAREA ); +HB_FUNC_EXTERN( DBSEEK ); +HB_FUNC_EXTERN( DBSKIP ); +HB_FUNC_EXTERN( DBGOTOP ); +HB_FUNC_EXTERN( DBGOBOTTOM ); +HB_FUNC_EXTERN( DBGOTO ); +HB_FUNC_EXTERN( DBAPPEND ); +HB_FUNC_EXTERN( DBDELETE ); +HB_FUNC_EXTERN( DBRECALL ); +HB_FUNC_EXTERN( DBCOMMITALL ); +HB_FUNC_EXTERN( DBUNLOCK ); +HB_FUNC_EXTERN( DBUNLOCKALL ); +HB_FUNC_EXTERN( DBSETFILTER ); +HB_FUNC_EXTERN( DBCLEARRELATION ); +HB_FUNC_EXTERN( DBSETRELATION ); +HB_FUNC_EXTERN( DBREINDEX ); +HB_FUNC_EXTERN( DBCREATEINDEX ); +HB_FUNC_EXTERN( DBCLEARINDEX ); +HB_FUNC_EXTERN( DBSETINDEX ); +HB_FUNC_EXTERN( DBSETORDER ); +HB_FUNC_EXTERN( DBCLOSEALL ); +HB_FUNC_EXTERN( DBCLOSEAREA ); +HB_FUNC_EXTERN( DBUSEAREA ); +HB_FUNC_EXTERN( DBSELECTAREA ); HB_FUNC( __DBSEEK ) { diff --git a/harbour/source/rdd/dbstrux.prg b/harbour/source/rdd/dbstrux.prg index 6172979396..641784e3f8 100644 --- a/harbour/source/rdd/dbstrux.prg +++ b/harbour/source/rdd/dbstrux.prg @@ -62,6 +62,7 @@ FUNCTION __dbCopyXStruct( cFileName ) LOCAL nOldArea LOCAL oError LOCAL aStruct + local cTmpAlias IF Empty( aStruct := dbStruct() ) RETURN .F. @@ -70,9 +71,10 @@ FUNCTION __dbCopyXStruct( cFileName ) nOldArea := Select() BEGIN SEQUENCE + cTmpAlias := __rddGetTempAlias() dbSelectArea( 0 ) - __dbCreate( cFileName, NIL, NIL, .F., NIL ) + __dbCreate( cFileName, NIL, NIL, .F., cTmpAlias ) AEval( aStruct, {| aField | iif( aField[ DBS_TYPE ] == "C" .AND. aField[ DBS_LEN ] > 255, ; ( aField[ DBS_DEC ] := Int( aField[ DBS_LEN ] / 256 ), aField[ DBS_LEN ] := aField[ DBS_LEN ] % 256 ), NIL ) } ) @@ -84,7 +86,7 @@ FUNCTION __dbCopyXStruct( cFileName ) FIELD->FIELD_DEC := aField[ DBS_DEC ] } ) /* NOTE: CA-Cl*pper has a bug, where only a plain RECOVER statement is - used here (without the USING keyword), so oError will always be + used here (without the USING keyword), so oError will always be NIL. */ RECOVER USING oError END SEQUENCE @@ -104,6 +106,7 @@ FUNCTION __dbCreate( cFileName, cFileFrom, cRDDName, lNew, cAlias, cdpId ) LOCAL nOldArea := Select() LOCAL aStruct := {} LOCAL oError + local cTmpAlias DEFAULT lNew TO .F. @@ -124,7 +127,9 @@ FUNCTION __dbCreate( cFileName, cFileFrom, cRDDName, lNew, cAlias, cdpId ) ELSE - dbUseArea( lNew,, cFileFrom ) + cTmpAlias := __rddGetTempAlias() + + dbUseArea( lNew,, cFileFrom, cTmpAlias ) dbEval( {|| AAdd( aStruct, { Rtrim(FIELD->FIELD_NAME) ,; Rtrim(FIELD->FIELD_TYPE) ,; @@ -137,10 +142,11 @@ FUNCTION __dbCreate( cFileName, cFileFrom, cRDDName, lNew, cAlias, cdpId ) ENDIF AEval( aStruct, {| aField | iif( aField[ DBS_TYPE ] == "C" .AND. aField[ DBS_DEC ] != 0, ; - aField[ DBS_LEN ] := aField[ DBS_LEN ] + aField[ DBS_DEC ] * 256, NIL ) } ) + ( aField[ DBS_LEN ] += aField[ DBS_DEC ] * 256, ; + aField[ DBS_DEC ] := 0 ), NIL ) } ) dbCreate( cFileName, aStruct, cRDDName ) - dbUseArea( lNew, cRDDName, cFileName, cAlias,,,cdpId ) + dbUseArea( lNew, cRDDName, cFileName, cAlias,,, cdpId ) ENDIF diff --git a/harbour/source/rdd/hbdbsort.c b/harbour/source/rdd/hbdbsort.c index 87727ce8cb..8b4c56c61c 100644 --- a/harbour/source/rdd/hbdbsort.c +++ b/harbour/source/rdd/hbdbsort.c @@ -50,7 +50,6 @@ * */ -#define HB_EXTERNAL_RDDDBF_USE #include "hbdbsort.h" BOOL hb_dbQSortInit( LPDBQUICKSORT pQuickSort, LPDBSORTINFO pSortInfo, USHORT uiRecordLen ) diff --git a/harbour/source/rdd/rddord.prg b/harbour/source/rdd/rddord.prg index f9f93fbfdd..800ab22c09 100644 --- a/harbour/source/rdd/rddord.prg +++ b/harbour/source/rdd/rddord.prg @@ -51,6 +51,7 @@ */ #include "common.ch" +#include "dbinfo.ch" /* NOTE: The fifth parameters (cOrderName) is undocumented. */ @@ -105,4 +106,29 @@ FUNCTION ORDSETFOCU( xOrder, cFile ) RETURN ORDSETFOCUS( xOrder, cFile ) FUNCTION ORDSETRELA( xArea, bRelation, cRelation ) - RETURN ORDSETRELATION( xArea, bRelation, cRelation, .T. ) + RETURN ORDSETRELATION( xArea, bRelation, cRelation ) + +FUNCTION ORDWILDSEEK( cPattern, lCont, lBack ) + LOCAL lFound := .F. + + IF VALTYPE( lCont ) != "L" + lCont := .F. + ENDIF + IF VALTYPE( lBack ) != "L" + lBack := .F. + ENDIF + + IF ! lCont + IF lBack + DBGOBOTTOM() + ELSE + DBGOTOP() + ENDIF + lFound := WildMatch( cPattern, ORDKEYVAL() ) + ENDIF + + IF ! lFound + lFound := DBORDERINFO( IIF( lBack, DBOI_SKIPWILDBACK, DBOI_SKIPWILD ),,, cPattern ) + ENDIF + + RETURN lFound diff --git a/harbour/source/rdd/workarea.c b/harbour/source/rdd/workarea.c index d0fc3005b9..e56696e876 100644 --- a/harbour/source/rdd/workarea.c +++ b/harbour/source/rdd/workarea.c @@ -486,30 +486,9 @@ ERRCODE hb_waAlias( AREAP pArea, BYTE * szAlias ) } /* - * Close the table in the WorkArea. + * Close the table in the WorkArea - helper function */ -short hb_waCloseAux ( AREAP pArea, int nChildArea ); - -ERRCODE hb_waClose( AREAP pArea ) -{ - HB_TRACE(HB_TR_DEBUG, ("hb_waClose(%p)", pArea)); - - /* Clear items */ - SELF_CLEARFILTER( pArea ); - SELF_CLEARREL( pArea ); - SELF_CLEARLOCATE( pArea ); - - if( pArea->uiParents > 0 ) - { - /* Clear relations that has this area as a child */ - hb_rddIterateWorkAreas ( hb_waCloseAux, pArea->uiArea ); - } - - ( ( PHB_DYNS ) pArea->atomAlias )->hArea = 0; - return SUCCESS; -} - -short hb_waCloseAux ( AREAP pArea, int nChildArea ) +static short hb_waCloseAux( AREAP pArea, int nChildArea ) { USHORT uiPrevArea, uiArea; LPDBRELINFO lpdbRelation, lpdbRelPrev, lpdbRelTmp; @@ -550,6 +529,28 @@ short hb_waCloseAux ( AREAP pArea, int nChildArea ) return 1; } +/* + * Close the table in the WorkArea. + */ +ERRCODE hb_waClose( AREAP pArea ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_waClose(%p)", pArea)); + + /* Clear items */ + SELF_CLEARFILTER( pArea ); + SELF_CLEARREL( pArea ); + SELF_CLEARLOCATE( pArea ); + + if( pArea->uiParents > 0 ) + { + /* Clear relations that has this area as a child */ + hb_rddIterateWorkAreas ( hb_waCloseAux, pArea->uiArea ); + } + + ( ( PHB_DYNS ) pArea->atomAlias )->hArea = 0; + return SUCCESS; +} + /* * Retrieve information about the current driver. */ diff --git a/harbour/source/rtl/cdpapi.c b/harbour/source/rtl/cdpapi.c index 544db83f23..9e1a6a135c 100644 --- a/harbour/source/rtl/cdpapi.c +++ b/harbour/source/rtl/cdpapi.c @@ -58,11 +58,174 @@ #define HB_CDP_MAX_ 64 -static HB_CODEPAGE s_en_codepage = { "EN",0,NULL,NULL,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL }; -static PHB_CODEPAGE s_cdpList[ HB_CDP_MAX_ ]; +#define NUMBER_OF_CHARS 256 +static USHORT uniCodes[NUMBER_OF_CHARS] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, + 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, + 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, + 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192, + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, + 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, + 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, + 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0, +}; + +HB_UNITABLE hb_uniTbl_437 = { CPID_437, NUMBER_OF_CHARS, FALSE, uniCodes }; + +static HB_CODEPAGE s_en_codepage = { "EN",CPID_437,UNITB_437,0,NULL,NULL,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL }; +static PHB_CODEPAGE s_cdpList[ HB_CDP_MAX_ ]; PHB_CODEPAGE hb_cdp_page = &s_en_codepage; + +static int u16toutf8( BYTE *szUTF8, USHORT uc ) +{ + int n; + + if ( uc < 0x0080 ) + { + szUTF8[0] = uc & 0xff; + n = 1; + } + else if ( uc < 0x0800 ) + { + szUTF8[0] = 0xc0 | ( ( uc >> 6 ) & 0x1f ); + szUTF8[1] = 0x80 | ( uc & 0x3f ); + n = 2; + } + else /* if ( uc <= 0xffff ) */ + { + szUTF8[0] = 0xe0 | ( ( uc >> 12 ) & 0x0f); + szUTF8[1] = 0x80 | ( ( uc >> 6 ) & 0x3f); + szUTF8[2] = 0x80 | ( uc & 0x3f ); + n = 3; + } +/* + else + { + n = 0; + } +*/ + return n; +} + +static BOOL utf8tou16nextchar( BYTE byChar, int * n, USHORT * uc ) +{ + if ( *n > 0 ) + { + if ( ( byChar & 0xc0 ) != 0x80 ) + return FALSE; + *uc = ( *uc << 6 ) | ( byChar & 0x3f ); + (*n)--; + return TRUE; + } + + *n = 0; + *uc = byChar; + if ( byChar >= 0xc0 ) + { + if ( byChar < 0xe0 ) + { + *uc &= 0x1f; + *n = 1; + } + else if ( byChar < 0xf0 ) + { + *uc &= 0x0f; + *n = 2; + } + else if ( byChar < 0xf8 ) + { + *uc &= 0x07; + *n = 3; + } + else if ( byChar < 0xfc ) + { + *uc &= 0x03; + *n = 4; + } + else if ( byChar < 0xfe ) + { + *uc &= 0x01; + *n = 5; + } + } + return TRUE; +} + +#if 0 /* currently unused, it will in the future */ +static int utf8tou16( BYTE *szUTF8, USHORT *uc ) +{ + int n = 1, m = 1; + UINT32 u32; + + u32 = *szUTF8; + if ( u32 >= 0xc0 ) + { + if ( u32 < 0xe0 ) + { + u32 &= 0x1f; + m = 2; + } + else if ( u32 < 0xf0 ) + { + u32 &= 0x0f; + m = 3; + } + else if ( u32 < 0xf8 ) + { + u32 &= 0x07; + m = 4; + } + else if ( u32 < 0xfc ) + { + u32 &= 0x03; + m = 5; + } + else if ( u32 < 0xfe ) + { + u32 &= 0x01; + m = 6; + } + while ( n < m && ( szUTF8[n] & 0xc0 ) == 0x80 ) + { + u32 = ( u32 << 6 ) | ( szUTF8[n++] & 0x3f ); + } + if ( n < m ) + { + u32 <<= 6 * (m - n); + } + } + + *uc = (USHORT) u32; + return n; +} +#endif + static int hb_cdpFindPos( char * pszID ) { int iPos; @@ -79,7 +242,7 @@ static int hb_cdpFindPos( char * pszID ) return -1; } -BOOL hb_cdpRegister( PHB_CODEPAGE cdpage ) +BOOL HB_EXPORT hb_cdpRegister( PHB_CODEPAGE cdpage ) { HB_TRACE(HB_TR_DEBUG, ("hb_cdpRegister(%p)", cdpage)); @@ -228,7 +391,7 @@ BOOL hb_cdpRegister( PHB_CODEPAGE cdpage ) return FALSE; } -PHB_CODEPAGE hb_cdpFind( char * pszID ) +PHB_CODEPAGE HB_EXPORT hb_cdpFind( char * pszID ) { int iPos; @@ -239,7 +402,7 @@ PHB_CODEPAGE hb_cdpFind( char * pszID ) return ( iPos != -1 ) ? s_cdpList[ iPos ] : NULL; } -PHB_CODEPAGE hb_cdpSelect( PHB_CODEPAGE cdpage ) +PHB_CODEPAGE HB_EXPORT hb_cdpSelect( PHB_CODEPAGE cdpage ) { PHB_CODEPAGE cdpOld = hb_cdp_page; @@ -253,7 +416,7 @@ PHB_CODEPAGE hb_cdpSelect( PHB_CODEPAGE cdpage ) return cdpOld; } -char * hb_cdpSelectID( char * pszID ) +char HB_EXPORT * hb_cdpSelectID( char * pszID ) { char * pszIDOld = hb_cdp_page->id; @@ -264,7 +427,7 @@ char * hb_cdpSelectID( char * pszID ) return pszIDOld; } -void hb_cdpTranslate( char* psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) +void HB_EXPORT hb_cdpTranslate( char* psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) { int n; @@ -274,9 +437,9 @@ void hb_cdpTranslate( char* psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) for( ; *psz; psz++ ) { n = (int)cdpIn->s_chars[ ((int)*psz)&255 ]; - if( ( n != 0 ) && - ( ( n <= cdpIn->nChars ) || ( ( n > (cdpOut->nChars+nAddLower) ) && - ( n <= (cdpOut->nChars*2+nAddLower) ) ) ) ) + if( n != 0 && + ( n <= cdpOut->nChars || ( n > (cdpOut->nChars+nAddLower) && + n <= (cdpOut->nChars*2+nAddLower) ) ) ) { n--; *psz = ( n >= (cdpOut->nChars+nAddLower) )? @@ -286,7 +449,7 @@ void hb_cdpTranslate( char* psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) } } -void hb_cdpnTranslate( char* psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, unsigned int nChars ) +void HB_EXPORT hb_cdpnTranslate( char* psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, unsigned int nChars ) { int n; unsigned int i; @@ -297,9 +460,9 @@ void hb_cdpnTranslate( char* psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, unsi for( i=0; is_chars[ ((int)*psz)&255 ]; - if( ( n != 0 ) && - ( ( n <= cdpIn->nChars ) || ( ( n > (cdpOut->nChars+nAddLower) ) && - ( n <= (cdpOut->nChars*2+nAddLower) ) ) ) ) + if( n != 0 && + ( n <= cdpOut->nChars || ( n > (cdpOut->nChars+nAddLower) && + n <= (cdpOut->nChars*2+nAddLower) ) ) ) { n--; *psz = ( n >= (cdpOut->nChars+nAddLower) )? @@ -309,7 +472,126 @@ void hb_cdpnTranslate( char* psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, unsi } } -int hb_cdpchrcmp( char cFirst, char cSecond, PHB_CODEPAGE cdpage ) +USHORT HB_EXPORT hb_cdpGetU16( PHB_CODEPAGE cdp, BYTE ch ) +{ + USHORT u; + + if ( cdp && cdp->uniTable && cdp->uniTable->uniCodes && ch < cdp->uniTable->nChars ) + { + u = cdp->uniTable->uniCodes[ ch ]; + } + else + { + u = ch; + } + return u; +} + +BOOL HB_EXPORT hb_cdpGetFromUTF8( PHB_CODEPAGE cdp, BYTE ch, int * n, USHORT * uc ) +{ + if ( utf8tou16nextchar( ch, n, uc ) ) + { + if ( *n == 0 && cdp && cdp->uniTable && cdp->uniTable->uniCodes && *uc >= 0x100 ) + { + int i; + for ( i = 0; i < cdp->uniTable->nChars; i++ ) + { + if ( cdp->uniTable->uniCodes[ i ] == *uc ) + { + *uc = i; + break; + } + } + } + return TRUE; + } + return FALSE; +} + + +ULONG HB_EXPORT hb_cdpStrnToUTF( PHB_CODEPAGE cdp, BYTE* pSrc, ULONG ulLen, BYTE* pDst ) +{ + USHORT u, *uniCodes, nChars; + ULONG i, n; + + if ( cdp && cdp->uniTable ) + { + if ( cdp->nMulti || cdp->uniTable->lMulti ) + { + /* + * TODO: this translation is bad, please fix me!!! + */ + for ( i = 0, n = 0; i < ulLen; i++ ) + { + u = hb_cdpGetU16( cdp, pSrc[ i ] ); + n += u16toutf8( &pDst[n], u ); + } + return n; + } + else + { + uniCodes = cdp->uniTable->uniCodes; + nChars = cdp->uniTable->nChars; + } + } + else + { + nChars = 0; + uniCodes = NULL; + } + + for ( i = 0, n = 0; i < ulLen; i++ ) + { + u = pSrc[ i ]; + if ( uniCodes && u < nChars ) + u = uniCodes[ u ]; + n += u16toutf8( &pDst[n], u ); + } + return n; +} + +ULONG HB_EXPORT hb_cdpStrnToU16( PHB_CODEPAGE cdp, BYTE* pSrc, ULONG ulLen, BYTE* pDst ) +{ + USHORT u, *uniCodes, nChars; + ULONG i; + + if ( cdp && cdp->uniTable ) + { + if ( cdp->nMulti || cdp->uniTable->lMulti ) + { + /* + * TODO: this translation is bad, please fix me!!! + */ + for ( i = 0; i < ulLen; i++, pDst += 2 ) + { + u = hb_cdpGetU16( cdp, pSrc[ i ] ); + HB_PUT_BE_UINT16( pDst, u ); + } + return i<<1; + } + else + { + uniCodes = cdp->uniTable->uniCodes; + nChars = cdp->uniTable->nChars; + } + } + else + { + nChars = 0; + uniCodes = NULL; + } + + for ( i = 0; i < ulLen; i++, pDst += 2 ) + { + u = pSrc[ i ]; + if ( uniCodes && u < nChars ) + u = uniCodes[ u ]; + HB_PUT_BE_UINT16( pDst, u ); + } + return i<<1; +} + +int HB_EXPORT hb_cdpchrcmp( char cFirst, char cSecond, PHB_CODEPAGE cdpage ) { int n1, n2; @@ -324,7 +606,7 @@ int hb_cdpchrcmp( char cFirst, char cSecond, PHB_CODEPAGE cdpage ) } -int hb_cdpcmp( char* szFirst, char* szSecond, ULONG ulLen, PHB_CODEPAGE cdpage, ULONG* piCounter ) +int HB_EXPORT hb_cdpcmp( char* szFirst, char* szSecond, ULONG ulLen, PHB_CODEPAGE cdpage, ULONG* piCounter ) { ULONG ul; int iRet = 0, n1, n2; @@ -408,7 +690,7 @@ int hb_cdpcmp( char* szFirst, char* szSecond, ULONG ulLen, PHB_CODEPAGE cdpage, return iRet; } -void hb_cdpReleaseAll( void ) +void HB_EXPORT hb_cdpReleaseAll( void ) { int iPos = 0; diff --git a/harbour/source/vm/codebloc.c b/harbour/source/vm/codebloc.c index fc7cd9f948..3e3ccfacee 100644 --- a/harbour/source/vm/codebloc.c +++ b/harbour/source/vm/codebloc.c @@ -111,9 +111,6 @@ HB_CODEBLOCK_PTR hb_codeblockNew( BYTE * pBuffer, pLocalPosTable += 2; pLocal = hb_memvarDetachLocal( pLocal ); - /* Increment the reference counter so this value will not be - * released if other codeblock will be deleted - */ memcpy( pCBlock->pLocals + ui, pLocal, sizeof( HB_ITEM ) ); /* Increment the reference counter so this value will not be * released if other codeblock will be deleted @@ -121,7 +118,6 @@ HB_CODEBLOCK_PTR hb_codeblockNew( BYTE * pBuffer, hb_memvarValueIncRef( pLocal->item.asMemvar.value ); ++ui; } - } else { diff --git a/harbour/source/vm/fm.c b/harbour/source/vm/fm.c index 14dc0146c0..035c8751fc 100644 --- a/harbour/source/vm/fm.c +++ b/harbour/source/vm/fm.c @@ -84,12 +84,21 @@ #include "hbapierr.h" #include "hbmemory.ch" +/* #define HB_PARANOID_MEM_CHECK */ + +#ifndef HB_FM_STATISTICS +# undef HB_PARANOID_MEM_CHECK +#endif + #if defined(HB_FM_STATISTICS) && !defined(HB_TR_LEVEL) #define HB_TR_LEVEL HB_TR_ERROR #endif #ifdef HB_FM_STATISTICS +#ifndef HB_MEMFILER +# define HB_MEMFILER 0xff +#endif #define HB_MEMINFO_SIGNATURE 0x19730403 typedef struct _HB_MEMINFO @@ -188,6 +197,9 @@ void HB_EXPORT * hb_xalloc( ULONG ulSize ) /* allocates fixed memory, re if( s_lMemoryMaxBlocks < s_lMemoryBlocks ) s_lMemoryMaxBlocks = s_lMemoryBlocks; +#ifdef HB_PARANOID_MEM_CHECK + memset( ( char * ) pMem + HB_MEMINFO_SIZE, HB_MEMFILER, ulSize ); +#endif return ( void * ) ( ( BYTE * ) pMem + HB_MEMINFO_SIZE ); #else @@ -270,6 +282,9 @@ void HB_EXPORT * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exi if( s_lMemoryMaxBlocks < s_lMemoryBlocks ) s_lMemoryMaxBlocks = s_lMemoryBlocks; +#ifdef HB_PARANOID_MEM_CHECK + memset( ( char * ) pMem + HB_MEMINFO_SIZE, HB_MEMFILER, ulSize ); +#endif return ( void * ) ( ( BYTE * ) pMem + HB_MEMINFO_SIZE ); #else @@ -311,7 +326,23 @@ void HB_EXPORT * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates m HB_PUT_LONG( ( ( BYTE * ) pMem ) + ulMemSize, 0 ); +#ifdef HB_PARANOID_MEM_CHECK + pMem = malloc( ulSize + HB_MEMINFO_SIZE + sizeof( ULONG ) ); + if ( pMem ) + { + if ( ulSize > ulMemSize ) + { + memcpy( pMem, pMemBlock, ulMemSize + HB_MEMINFO_SIZE ); + memset( ( char * ) pMem + HB_MEMINFO_SIZE + ulMemSize, HB_MEMFILER, ulSize - ulMemSize ); + } + else + memcpy( pMem, pMemBlock, ulSize + HB_MEMINFO_SIZE ); + } + memset( pMemBlock, HB_MEMFILER, ulMemSize + HB_MEMINFO_SIZE + sizeof( ULONG ) ); + free( pMemBlock ); +#else pMem = realloc( pMemBlock, ulSize + HB_MEMINFO_SIZE + sizeof( ULONG ) ); +#endif s_lMemoryConsumed += ( ulSize - ulMemSize ); if( s_lMemoryMaxConsumed < s_lMemoryConsumed ) @@ -386,6 +417,9 @@ void HB_EXPORT hb_xfree( void * pMem ) /* frees fixed memory */ pMemBlock->ulSignature = 0; HB_PUT_LONG( ( ( BYTE * ) pMem ) + pMemBlock->ulSize, 0 ); +#ifdef HB_PARANOID_MEM_CHECK + memset( pMemBlock, HB_MEMFILER, pMemBlock->ulSize + HB_MEMINFO_SIZE + sizeof( ULONG ) ); +#endif free( ( void * ) pMemBlock ); } else diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 447e8d2a55..bf521ac86a 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -83,6 +83,8 @@ #include "inkey.ch" #include "hbdebug.ch" +#include "hbmemory.ch" + #ifdef HB_MACRO_STATEMENTS #include "hbpp.h" #endif @@ -196,7 +198,7 @@ static void hb_vmPopLocal( SHORT iLocal ); /* pops the stack latest value static void hb_vmPopStatic( USHORT uiStatic ); /* pops the stack latest value onto a static */ /* Take the value from stack top without POP */ -static double hb_vmTopNumber(); /* pops the stack latest value and returns its numeric value */ +static double hb_vmTopNumber( void ); /* take the stack latest value and returns its numeric value */ /* misc */ static void hb_vmDoInitStatics( void ); /* executes all _INITSTATICS functions */ @@ -488,8 +490,13 @@ void HB_EXPORT hb_vmQuit( void ) hb_memvarsRelease(); /* clear all PUBLIC variables */ /* release all known garbage */ - hb_gcReleaseAll(); - /* hb_gcCollectAll(); */ + /* hb_gcReleaseAll(); */ + + /* release all known garbage */ + if ( hb_xquery( HB_MEM_USEDMAX ) ) /* check if fmstat is ON */ + hb_gcCollectAll(); + else + hb_gcReleaseAll(); hb_memvarsFree(); /* free memory allocated for memvars table */ hb_stackFree(); diff --git a/harbour/source/vm/itemapi.c b/harbour/source/vm/itemapi.c index c7602dac4d..f7f9d7312a 100644 --- a/harbour/source/vm/itemapi.c +++ b/harbour/source/vm/itemapi.c @@ -1126,6 +1126,11 @@ void HB_EXPORT hb_itemClear( PHB_ITEM pItem ) else if( HB_IS_MEMVAR( pItem ) ) hb_memvarValueDecRef( pItem->item.asMemvar.value ); +#if defined( HB_FM_STATISTICS ) && defined( HB_PARANOID_MEM_CHECK ) + else if( HB_IS_BADITEM( pItem ) ) + hb_errInternal( HB_EI_VMPOPINVITEM, NULL, "hb_itemClear()", NULL ); +#endif + pItem->type = HB_IT_NIL; } @@ -1212,8 +1217,9 @@ PHB_ITEM hb_itemUnRef( PHB_ITEM pItem ) HB_TRACE(HB_TR_DEBUG, ("hb_itemUnRef(%p)", pItem)); - do { - pItem = hb_itemUnRefOnce( pItem ); + do + { + pItem = hb_itemUnRefOnce( pItem ); } while( HB_IS_BYREF( pItem ) && (pRef != pItem) ); diff --git a/harbour/source/vm/memvars.c b/harbour/source/vm/memvars.c index c4a43f6015..7306da39e9 100644 --- a/harbour/source/vm/memvars.c +++ b/harbour/source/vm/memvars.c @@ -233,12 +233,7 @@ HB_ITEM_PTR hb_memvarDetachLocal( HB_ITEM_PTR pLocal ) if( HB_IS_BYREF( pLocal ) && ! HB_IS_MEMVAR( pLocal ) ) { - /* Change the value only if this variable is not referenced - * by another codeblock yet. - * In this case we have to copy the current value to a global memory - * pool so it can be shared by codeblocks - */ - HB_ITEM_PTR pItem; + HB_ITEM_PTR pItem = pLocal; do { @@ -247,13 +242,18 @@ HB_ITEM_PTR hb_memvarDetachLocal( HB_ITEM_PTR pLocal ) while( HB_IS_BYREF( pLocal ) && ! HB_IS_MEMVAR( pLocal ) && ( pLocal != pItem ) ); } - if( ! HB_IS_MEMVAR( pLocal ) ) + /* Change the value only if this variable is not referenced + * by another codeblock yet. + * In this case we have to copy the current value to a global memory + * pool so it can be shared by codeblocks + */ + if ( ! HB_IS_MEMVAR( pLocal ) ) { - HB_HANDLE hMemvar = hb_memvarValueNew( pLocal, FALSE ); + HB_HANDLE hMemvar = hb_memvarValueNew( pLocal, FALSE ); - pLocal->type = HB_IT_BYREF | HB_IT_MEMVAR; - pLocal->item.asMemvar.itemsbase = &s_globalTable; - pLocal->item.asMemvar.value = hMemvar; + pLocal->type = HB_IT_BYREF | HB_IT_MEMVAR; + pLocal->item.asMemvar.itemsbase = &s_globalTable; + pLocal->item.asMemvar.value = hMemvar; } return pLocal; }