diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1f4fbed78c..efa1f88f6d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,295 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-08 02:43 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/vm/set.c + ! fixed small typos in returned values (FALSE instead of NULL and 0) + + * harbour/src/vm/estack.c + * make calling hb_stackTotalItems() safe in MT mode when stack is not + initialized - now this function can be used to check if HVM stack + exists and is initialized in ST and MT mode + + * harbour/src/rtl/errintlo.c + ! fixed at least 4 GPF traps exploited when hb_errInternal() was called + and HVM stack was not initialized + + * harbour/include/Makefile + + harbour/include/hbcdpreg.h + * harbour/include/hbapicdp.h + * harbour/src/rtl/cdpapi.c + + added new CDP API which fixes many errors and limitations in old + implementation. + Warning !!! some very serious bugs in national sorting have been + fixed. It may cause that old indexes using some national + sorting will not be compatible. Please rebuild existing + indexes. + + * harbour/src/vm/itemapi.c + * harbour/src/rdd/hsx/hsx.c + * harbour/src/rdd/dbfntx/dbfntx1.c + * harbour/src/rdd/dbfnsx/dbfnsx1.c + * harbour/src/rdd/dbfcdx/dbfcdx1.c + * harbour/contrib/hbbmcdx/bmdbfcdx.c + * harbour/contrib/rddads/adsx.c + * harbour/contrib/rddsql/sqlmix.c + * updated to work with new CDP API + TOFIX: update adsx.c and sqlmix.c to use hb_cdpcmp() which resepcts + sorting with accented and mulitybyts characters. + Mindaugas, can you update above code? + + * harbour/src/codepage/cpbg866.c + * harbour/src/codepage/cpbgiso.c + * harbour/src/codepage/cpbgmik.c + * harbour/src/codepage/cpbgwin.c + * harbour/src/codepage/cpcs852.c + * harbour/src/codepage/cpcsiso.c + * harbour/src/codepage/cpcskam.c + * harbour/src/codepage/cpcswin.c + * harbour/src/codepage/cpde850.c + * harbour/src/codepage/cpdeiso.c + * harbour/src/codepage/cpdewin.c + * harbour/src/codepage/cpel737.c + * harbour/src/codepage/cpeliso.c + * harbour/src/codepage/cpelwin.c + * harbour/src/codepage/cpes850.c + * harbour/src/codepage/cpes850c.c + * harbour/src/codepage/cpesiso.c + * harbour/src/codepage/cpesisoc.c + * harbour/src/codepage/cpeswin.c + * harbour/src/codepage/cpeswinc.c + * harbour/src/codepage/cpeswinm.c + * harbour/src/codepage/cpfr850.c + * harbour/src/codepage/cpfriso.c + * harbour/src/codepage/cpfrwin.c + * harbour/src/codepage/cphr437.c + * harbour/src/codepage/cphr852.c + * harbour/src/codepage/cphrwin.c + * harbour/src/codepage/cphu852.c + * harbour/src/codepage/cphu852s.c + * harbour/src/codepage/cphuiso.c + * harbour/src/codepage/cphuisos.c + * harbour/src/codepage/cphuwin.c + * harbour/src/codepage/cphuwins.c + * harbour/src/codepage/cpit437.c + * harbour/src/codepage/cpit850.c + * harbour/src/codepage/cpitisb.c + * harbour/src/codepage/cpitiso.c + * harbour/src/codepage/cpitwin.c + * harbour/src/codepage/cpltwin.c + * harbour/src/codepage/cppl852.c + * harbour/src/codepage/cppliso.c + * harbour/src/codepage/cpplmaz.c + * harbour/src/codepage/cpplwin.c + * harbour/src/codepage/cppt850.c + * harbour/src/codepage/cpptiso.c + * harbour/src/codepage/cpro852.c + * harbour/src/codepage/cproiso.c + * harbour/src/codepage/cprowin.c + * harbour/src/codepage/cpru866.c + * harbour/src/codepage/cpruiso.c + * harbour/src/codepage/cprukoi.c + * harbour/src/codepage/cpruwin.c + * harbour/src/codepage/cpsk852.c + * harbour/src/codepage/cpskiso.c + * harbour/src/codepage/cpskkam.c + * harbour/src/codepage/cpskwin.c + * harbour/src/codepage/cpsl437.c + * harbour/src/codepage/cpsl852.c + * harbour/src/codepage/cpsliso.c + * harbour/src/codepage/cpslwin.c + * harbour/src/codepage/cpsrwin.c + * harbour/src/codepage/cpsv850.c + * harbour/src/codepage/cpsvclip.c + * harbour/src/codepage/cpsviso.c + * harbour/src/codepage/cpsvwin.c + * harbour/src/codepage/cptr857.c + * harbour/src/codepage/cptriso.c + * harbour/src/codepage/cptrwin.c + * harbour/src/codepage/cpua1125.c + * harbour/src/codepage/cpua866.c + * harbour/src/codepage/cpuakoi.c + * harbour/src/codepage/cpuawin.c + * harbour/src/codepage/uc037.c + * harbour/src/codepage/uc1006.c + * harbour/src/codepage/uc1026.c + * harbour/src/codepage/uc1125.c + * harbour/src/codepage/uc1250.c + * harbour/src/codepage/uc1251.c + * harbour/src/codepage/uc1252.c + * harbour/src/codepage/uc1253.c + * harbour/src/codepage/uc1254.c + * harbour/src/codepage/uc1255.c + * harbour/src/codepage/uc1256.c + * harbour/src/codepage/uc1257.c + * harbour/src/codepage/uc1258.c + * harbour/src/codepage/uc424.c + * harbour/src/codepage/uc500.c + * harbour/src/codepage/uc737.c + * harbour/src/codepage/uc775.c + * harbour/src/codepage/uc850.c + * harbour/src/codepage/uc852.c + * harbour/src/codepage/uc855.c + * harbour/src/codepage/uc856.c + * harbour/src/codepage/uc857.c + * harbour/src/codepage/uc860.c + * harbour/src/codepage/uc861.c + * harbour/src/codepage/uc862.c + * harbour/src/codepage/uc863.c + * harbour/src/codepage/uc864.c + * harbour/src/codepage/uc865.c + * harbour/src/codepage/uc866.c + * harbour/src/codepage/uc869.c + * harbour/src/codepage/uc874.c + * harbour/src/codepage/uc875.c + * harbour/src/codepage/uc885910.c + * harbour/src/codepage/uc885911.c + * harbour/src/codepage/uc885913.c + * harbour/src/codepage/uc885914.c + * harbour/src/codepage/uc885915.c + * harbour/src/codepage/uc885916.c + * harbour/src/codepage/uc88591b.c + * harbour/src/codepage/uc8859_1.c + * harbour/src/codepage/uc8859_2.c + * harbour/src/codepage/uc8859_3.c + * harbour/src/codepage/uc8859_4.c + * harbour/src/codepage/uc8859_5.c + * harbour/src/codepage/uc8859_6.c + * harbour/src/codepage/uc8859_7.c + * harbour/src/codepage/uc8859_8.c + * harbour/src/codepage/uc8859_9.c + * harbour/src/codepage/ucascii.c + * harbour/src/codepage/ucatari.c + * harbour/src/codepage/uckam.c + * harbour/src/codepage/uckoi8.c + * harbour/src/codepage/uckoi8u.c + * harbour/src/codepage/ucmacce.c + * harbour/src/codepage/ucmaccyr.c + * harbour/src/codepage/ucmacgrk.c + * harbour/src/codepage/ucmacice.c + * harbour/src/codepage/ucmacrom.c + * harbour/src/codepage/ucmactrk.c + * harbour/src/codepage/ucmaz.c + * harbour/src/codepage/ucmik.c + * harbour/src/codepage/ucnext.c + * updated for new CP API + Warning: please test all national CPs. I'm not able to test unknown for + me national character conditions so it's possible that I made + something wrong. Additionally current CP API does not have + some limitations which existed in the old one so now some hacks + or workarounds can be cleaned. I.e. now all translations are + done using Unicode tables so it's not necessary to use the + same number of characters to make them working. + Updating CP files I've found the following potential problems + in definitions which I haven't fixed or fixed only partially: + + cpes850c.c - update for new format removing hacks for old CP + implementation + cpesisoc.c > remove, it's not longer necessary + cpeswinc.c / + cpeswinm.c - it is the same as cpesiso.c so it should be removed + + cphu852.c \ + cphu852s.c \ + cphuiso.c > update for new format removing hacks for old CP + cphuwin.c / implementation + + cphuisos.c > remove, it's not longer necessary + cphuwins.c / + + cphr437.c > does it really use CP-437? and ^]\[@~}|{` instead of + cpsl437.c / nationalletters or it uses different then 437 CP for + 7-bit Croatian characters encoding. It's important + because without valid unicode table translations will + not work. + + cpit437.c - update for new version if necessary (upper characters) + + cpsv850.c \ + cpsviso.c > they had ACCENTED_INTERLEAVED but without ACCENTED_EQUAL + cpsvwin.c / so this setting was ignored. Now it's not ignored. + + cpsvclip.c - update for new format to be fully not only + "almost compatible with Clipper's NTXSWE.OBJ" + + For sure these are not all problems inherited from old CP + implementation so please verify all existing CPs. + + * harbour/src/codepage/cp_tpl.c + + added new example for CP definition. Working on new CPs please read + this description: + If accented characters need special sorting ( HB_CDP_ACSORT_EQUAL or + HB_CDP_ACSORT_INTERLEAVE ) then you need to mark the accented + characters with the symbol '~' before each of them, for example: + a~_ + If there is two-character sequence, which is considered as one, it + should be marked with '.' before and after it, for example: + ... h.ch.i ... + if such multibyte character has its own Unicode representation then + this Unicode value can be set using '=' symbol, for example: + ....h.ch=2A7C.i + and it will be used in translations. + + The Upper case string and the Lower case string should use the + same letters. If some characters does not have corresponding upper + or lower letter then space ' ' can be used as dummy character, for + example in German CPs there is no upper case 'scharfes S' letter + so space is used as dummy character. + + HB_CP_LATIN should be 1 if the national alphabet is based on Latin + otherwise 0 + + Please note that now you can use two versions of CP definition. + The 1-st one which uses human readable form similar to the old CP + definition and 2-nd which uses directly final CP tables so it + allows to replicate any conditions which existed in Clipper or + any other compatible language which uses static tables. + tests/cpinfo.prg can generate automatically .c files with new CP + definition in the 2-nd version. Now if user wants to create new + Harbour CP which is fully Clipper compatible he only has to + compile and link cpinfo.prg with given national sorting module + and then execute it with new Harbour CP name as 1-st parameter. + cp.c file is generated which can be added to Harbour + repository. Optional 2-nd parameter is CP description and 3-rd + is Harbour Unicode table ID (if not given 437 is used and should + be updated by user in .c file). This method should definitely + resolve any problems with creating Clipper compatible CP definition. + It also allows to easy verify if CP definitions are compatible. It's + enough to compare generated .c files. + + * harbour/src/codepage/uckam.c + ! fixed Kamenicky Unicode table definition - it was Mazovia CP :) + + * harbour/src/codepage/cpde850.c + * harbour/src/codepage/cpdeiso.c + * harbour/src/codepage/cpdewin.c + ! fixed CP wrongly encoded CP due to limitations in old CP definition. + Now it's possible to define different number of upper an lower + characters (space " " can be used as dummy character) and I used + it to eliminate hack for 'scharfes S' which does not exists as upper + case. + Please clean other CPs which contain similar hacks. + + * harbour/src/codepage/cphu852.c + * harbour/src/codepage/cphuiso.c + * harbour/src/codepage/cphuwin.c + * harbour/src/codepage/cpua866.c + * removed dummy letters introduced for old translation code + + * harbour/src/rtl/natmsg.c + * harbour/src/rtl/cdpapi.c + * harbour/include/hbextern.ch + + added HB_CDPINFO() function + * redirected _NATSORTVER() function to HB_CDPINFO() + + To All, + Please check your national sorting in current version and make + any updates if necessary or inform me about found problems. + I've checked that Polish CPs are working fine and all existing + CPs passes my test program which verified some technical aspects + of CP implementation. But I cannot verify if this definitions + satisfy users in different countries. + 2009-11-07 04:22 UTC+0600 April White (april users.sourceforge.net) * harbour/doc/inet.txt * intentionally removed DOC header/footer so that hbdoc/hbdoc2 ignore this file diff --git a/harbour/contrib/hbbmcdx/bmdbfcdx.c b/harbour/contrib/hbbmcdx/bmdbfcdx.c index 009ea2ccad..dcd40861ff 100644 --- a/harbour/contrib/hbbmcdx/bmdbfcdx.c +++ b/harbour/contrib/hbbmcdx/bmdbfcdx.c @@ -101,13 +101,6 @@ #ifndef HB_CDP_SUPPORT_OFF /* for nation sorting support */ #include "hbapicdp.h" - #define hb_cdpcharcmp( c1, c2, cdpage ) \ - ( ( cdpage && cdpage->lSort ) ? \ - hb_cdpchrcmp( c1, c2, cdpage ) : \ - ( (BYTE)(c1) - (BYTE)(c2) ) ) -/* - #define hb_cdpcharcmp( c1, c2, cdpage ) ( (BYTE)(c1) - (BYTE)(c2) ) - */ #endif /* @@ -408,7 +401,7 @@ static HB_ERRCODE hb_cdxErrorRT( CDXAREAP pArea, USHORT uiGenCode, USHORT uiSubC static void hb_cdxMakeSortTab( CDXAREAP pArea ) { #ifndef HB_CDP_SUPPORT_OFF - if( pArea->dbfarea.area.cdPage && pArea->dbfarea.area.cdPage->lSort && !pArea->bCdxSortTab ) + if( pArea->dbfarea.area.cdPage && pArea->dbfarea.area.cdPage->sort && !pArea->bCdxSortTab ) { int i, j, l; BYTE * pbSort; diff --git a/harbour/contrib/rddads/adsx.c b/harbour/contrib/rddads/adsx.c index 7c4e34ec9c..70e380f220 100644 --- a/harbour/contrib/rddads/adsx.c +++ b/harbour/contrib/rddads/adsx.c @@ -276,16 +276,16 @@ static void mixKeyFree( LPMIXKEY pKey ) static BYTE * mixBuildSortTable( PHB_CODEPAGE pCodepage ) { - BYTE* pSortTable; - BYTE* pChars; - int i, j; - BYTE c; + BYTE* pSortTable; + const BYTE* pChars; + int i, j; + BYTE c; pSortTable = ( BYTE * ) hb_xgrab( 256 ); - if( pCodepage && pCodepage->s_chars ) + if( pCodepage && pCodepage->sort ) { - pChars = pCodepage->s_chars; + pChars = pCodepage->sort; c = 0; for( i = 0; i < 256; i++ ) diff --git a/harbour/contrib/rddsql/sqlmix.c b/harbour/contrib/rddsql/sqlmix.c index 3a0ffecda8..aae8a4c908 100644 --- a/harbour/contrib/rddsql/sqlmix.c +++ b/harbour/contrib/rddsql/sqlmix.c @@ -843,16 +843,16 @@ static BOOL hb_mixTagDelKey( PMIXTAG pTag, PMIXKEY pKey ) static BYTE* hb_mixBuildSortTable( PHB_CODEPAGE pCodepage ) { - BYTE* pSortTable; - BYTE* pChars; - int i, j; - BYTE c; + BYTE* pSortTable; + const BYTE* pChars; + int i, j; + BYTE c; pSortTable = ( BYTE * ) hb_xalloc( 256 ); - if ( pCodepage && pCodepage->s_chars ) + if ( pCodepage && pCodepage->sort ) { - pChars = pCodepage->s_chars; + pChars = pCodepage->sort; c = 0; for ( i = 0; i < 256; i++ ) @@ -909,7 +909,7 @@ static PMIXTAG hb_mixTagCreate( const char* szTagName, PHB_ITEM pKeyExpr, PHB_IT /* Use national support */ if ( bType == 'C' ) { - if( pArea->sqlarea.area.cdPage && pArea->sqlarea.area.cdPage->lSort && !pArea->pSortTable ) + if( pArea->sqlarea.area.cdPage && pArea->sqlarea.area.cdPage->sort && !pArea->pSortTable ) { pArea->pSortTable = hb_mixBuildSortTable( pArea->sqlarea.area.cdPage ); } diff --git a/harbour/include/Makefile b/harbour/include/Makefile index 3e8984a7e5..041e5c336c 100644 --- a/harbour/include/Makefile +++ b/harbour/include/Makefile @@ -20,6 +20,7 @@ C_HEADERS := \ hbassert.h \ hbatomic.h \ hbbfish.h \ + hbcdpreg.h \ hbchksum.h \ hbcomp.h \ hbcompdf.h \ diff --git a/harbour/include/hbapicdp.h b/harbour/include/hbapicdp.h index 7f3b297cd8..827e07b7a3 100644 --- a/harbour/include/hbapicdp.h +++ b/harbour/include/hbapicdp.h @@ -7,6 +7,7 @@ * Header file for the CodePages API * * Copyright 2002 Alexander S.Kresin + * Copyright 2009 Przemyslaw Czerpak * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify @@ -67,7 +68,8 @@ HB_EXTERN_BEGIN { \ HB_FUNC_EXEC( HB_CODEPAGE_##id ); \ } -#define HB_CODEPAGE_ANNOUNCE( id ) HB_FUNC( HB_CODEPAGE_##id ) {} +#define HB_CODEPAGE_ANNOUNCE( id ) HB_CODEPAGE_ANNOUNCE_( 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 ) \ @@ -78,38 +80,38 @@ typedef USHORT HB_WCHAR; typedef struct _HB_UNITABLE { - const char * uniID; - int nChars; - BOOL lMulti; - HB_WCHAR * uniCodes; + const char * uniID; + HB_WCHAR * uniCodes; + unsigned char * uniTrans; + HB_WCHAR wcMax; } HB_UNITABLE, * PHB_UNITABLE; typedef struct _HB_MULTICHAR { - char cLast[2]; - char cFirst[2]; - int nCode; + char cFirst[ 2 ]; + char cLast[ 2 ]; + int sortUp; + int sortLo; + HB_WCHAR wcUp; + HB_WCHAR wcLo; } HB_MULTICHAR, * PHB_MULTICHAR; typedef struct _HB_CODEPAGE { - const char * id; - const char * uniID; - PHB_UNITABLE uniTable; - int nChars; - const char * CharsUpper; - const char * CharsLower; - BOOL lLatin; - BOOL lAccEqual; - BOOL lAccInterleave; - BOOL lSort; - unsigned char * s_chars; - unsigned char * s_upper; - unsigned char * s_lower; - unsigned char * s_accent; - unsigned char * buffer; - int nMulti; - PHB_MULTICHAR multi; + const char * id; + const char * info; + PHB_UNITABLE uniTable; + const unsigned char * flags; + const unsigned char * upper; + const unsigned char * lower; + const unsigned char * sort; + const unsigned char * acc; + int nACSort; + int nMulti; + int nMultiUC; + PHB_MULTICHAR multi; + void * buffer; + struct _HB_CODEPAGE * next; } HB_CODEPAGE, * PHB_CODEPAGE; #define HB_CPID_437 "cp437" @@ -305,70 +307,81 @@ extern HB_UNITABLE hb_uniTbl_ATARIST; extern HB_UNITABLE hb_uniTbl_NEXTSTEP; extern HB_UNITABLE hb_uniTbl_USASCII; -extern HB_EXPORT PHB_CODEPAGE hb_vmCDP( void ); -extern HB_EXPORT void hb_vmSetCDP( PHB_CODEPAGE pCDP ); +extern HB_EXPORT PHB_CODEPAGE hb_vmCDP( void ); +extern HB_EXPORT void hb_vmSetCDP( PHB_CODEPAGE pCDP ); -extern HB_EXPORT BOOL hb_cdpRegister( PHB_CODEPAGE ); -extern HB_EXPORT void hb_cdpReleaseAll( void ); -extern HB_EXPORT const char * hb_cdpSelectID( const char * ); -extern HB_EXPORT const char * hb_cdpID( void ); -extern HB_EXPORT PHB_CODEPAGE hb_cdpSelect( PHB_CODEPAGE ); -extern HB_EXPORT PHB_CODEPAGE hb_cdpFind( const char * ); -extern HB_EXPORT PHB_CODEPAGE hb_cdpFindExt( const char * ); -extern HB_EXPORT BOOL hb_cdpIsDigit( PHB_CODEPAGE, int ); -extern HB_EXPORT BOOL hb_cdpIsAlpha( PHB_CODEPAGE, int ); -extern HB_EXPORT BOOL hb_cdpIsLower( PHB_CODEPAGE, int ); -extern HB_EXPORT BOOL hb_cdpIsUpper( PHB_CODEPAGE, int ); -extern HB_EXPORT int hb_cdpcmp( const char *, ULONG, const char *, ULONG, PHB_CODEPAGE, BOOL ); -extern HB_EXPORT int hb_cdpicmp( const char *, ULONG, const char *, ULONG, PHB_CODEPAGE, BOOL ); -extern HB_EXPORT int hb_cdpchrcmp( char, char, PHB_CODEPAGE ); -extern HB_EXPORT char * hb_cdpDup( const char *, PHB_CODEPAGE, PHB_CODEPAGE ); -extern HB_EXPORT char * hb_cdpnDup( const char *, ULONG *, PHB_CODEPAGE, PHB_CODEPAGE ); -extern HB_EXPORT const char * hb_cdpnDup2( const char *, ULONG, char *, ULONG *, PHB_CODEPAGE, PHB_CODEPAGE ); -extern HB_EXPORT const char * hb_cdpnDup3( const char *, ULONG, char *, ULONG *, char **, ULONG *, PHB_CODEPAGE, PHB_CODEPAGE ); -extern HB_EXPORT ULONG hb_cdpnDupLen( const char *, ULONG, PHB_CODEPAGE, PHB_CODEPAGE ); -extern HB_EXPORT ULONG hb_cdpnDup2Len( const char *, ULONG, ULONG, PHB_CODEPAGE, PHB_CODEPAGE ); +/* accented character sorting */ +#define HB_CDP_ACSORT_NONE 0 /* no special sorting for accented + characters */ +#define HB_CDP_ACSORT_EQUAL 1 /* accented characters have the same + weight as corresponding unaccented + ones */ +#define HB_CDP_ACSORT_INTERLEAVED 2 /* accented characters sort after + their unaccented counterparts only + if the unaccented versions of all + characters being compared are the + same ( interleaving ) */ -extern HB_EXPORT void hb_cdpTranslate( char *, PHB_CODEPAGE, PHB_CODEPAGE ); -extern HB_EXPORT void hb_cdpnTranslate( char *, PHB_CODEPAGE, PHB_CODEPAGE, ULONG ); +extern HB_EXPORT BOOL hb_cdpRegisterRaw( PHB_CODEPAGE cdp ); +extern HB_EXPORT BOOL hb_cdpRegisterNew( const char * id, + const char * info, + PHB_UNITABLE uniTable, + const char * pszUpper, + const char * pszLower, + unsigned int nACSort ); +extern HB_EXPORT void hb_cdpReleaseAll( void ); +extern HB_EXPORT const char * hb_cdpID( void ); +extern HB_EXPORT PHB_CODEPAGE hb_cdpSelect( PHB_CODEPAGE cdp ); +extern HB_EXPORT const char * hb_cdpSelectID( const char * id ); +extern HB_EXPORT PHB_CODEPAGE hb_cdpFind( const char * id ); +extern HB_EXPORT PHB_CODEPAGE hb_cdpFindExt( const char * id ); -extern HB_EXPORT int hb_cdpTranslateChar( int iChar, BOOL fCtrl, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ); +extern HB_EXPORT BOOL hb_cdpIsDigit( PHB_CODEPAGE cdp, int iChar ); +extern HB_EXPORT BOOL hb_cdpIsAlpha( PHB_CODEPAGE cdp, int iChar ); +extern HB_EXPORT BOOL hb_cdpIsLower( PHB_CODEPAGE cdp, int iChar ); +extern HB_EXPORT BOOL hb_cdpIsUpper( PHB_CODEPAGE cdp, int iChar ); +extern HB_EXPORT int hb_cdpcmp( const char *szFirst, ULONG ulLenFirst, const char *szSecond, ULONG ulLenSecond, PHB_CODEPAGE cdp, BOOL fExact ); +extern HB_EXPORT int hb_cdpicmp( const char *szFirst, ULONG ulLenFirst, const char *szSecond, ULONG ulLenSecond, PHB_CODEPAGE cdp, BOOL fExact ); +extern HB_EXPORT int hb_cdpchrcmp( char cFirst, char cSecond, PHB_CODEPAGE cdp ); -extern HB_EXPORT HB_WCHAR hb_cdpGetU16( PHB_CODEPAGE, BOOL, UCHAR ); -extern HB_EXPORT UCHAR hb_cdpGetChar( PHB_CODEPAGE, BOOL, HB_WCHAR ); -extern HB_EXPORT BOOL hb_cdpGetFromUTF8( PHB_CODEPAGE, BOOL, UCHAR, int *, HB_WCHAR * ); +extern HB_EXPORT char * hb_cdpDup( const char *, PHB_CODEPAGE, PHB_CODEPAGE ); +extern HB_EXPORT char * hb_cdpnDup( const char *, ULONG *, PHB_CODEPAGE, PHB_CODEPAGE ); +extern HB_EXPORT const char * hb_cdpnDup2( const char *, ULONG, char *, ULONG *, PHB_CODEPAGE, PHB_CODEPAGE ); +extern HB_EXPORT const char * hb_cdpnDup3( const char *, ULONG, char *, ULONG *, char **, ULONG *, PHB_CODEPAGE, PHB_CODEPAGE ); +extern HB_EXPORT ULONG hb_cdpnDupLen( const char *, ULONG, PHB_CODEPAGE, PHB_CODEPAGE ); +extern HB_EXPORT ULONG hb_cdpnDup2Len( const char *, ULONG, ULONG, PHB_CODEPAGE, PHB_CODEPAGE ); -extern HB_EXPORT ULONG hb_cdpStrnToU16( PHB_CODEPAGE, BOOL, const char *, ULONG, HB_WCHAR * ); -extern HB_EXPORT ULONG hb_cdpStrnToU16n( PHB_CODEPAGE, BOOL, const char *, ULONG, HB_WCHAR *, ULONG ); -extern HB_EXPORT ULONG hb_cdpStrnToU16LE( PHB_CODEPAGE, BOOL, const char *, ULONG, HB_WCHAR * ); -extern HB_EXPORT ULONG hb_cdpStrnToU16LEn( PHB_CODEPAGE, BOOL, const char *, ULONG, HB_WCHAR *, ULONG ); -extern HB_EXPORT ULONG hb_cdpStringInU16Length( PHB_CODEPAGE, BOOL, const char *, ULONG ); -extern HB_EXPORT ULONG hb_cdpStringInU16Length2( PHB_CODEPAGE, BOOL, const char *, ULONG, ULONG ); +extern HB_EXPORT int hb_cdpTranslateChar( int iChar, BOOL fCtrl, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ); +extern HB_EXPORT ULONG hb_cdpTransLen( const char * pSrc, ULONG ulSrc, ULONG ulMax, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ); +extern HB_EXPORT ULONG hb_cdpTransTo( const char * pSrc, ULONG ulSrc, char * pDst, ULONG ulDst, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ); -extern HB_EXPORT char * hb_cdpU16ToStr( PHB_CODEPAGE, BOOL, const HB_WCHAR *, ULONG, char *, ULONG * ); -extern HB_EXPORT char * hb_cdpU16LEToStr( PHB_CODEPAGE, BOOL, const HB_WCHAR *, ULONG, char *, ULONG * ); +extern HB_EXPORT HB_WCHAR hb_cdpGetU16( PHB_CODEPAGE cdp, BOOL fCtrl, unsigned char ch ); +extern HB_EXPORT UCHAR hb_cdpGetChar( PHB_CODEPAGE cdp, BOOL fCtrl, HB_WCHAR wc ); +extern HB_EXPORT BOOL hb_cdpGetFromUTF8( PHB_CODEPAGE cdp, BOOL fCtrl, unsigned char ch, int * n, HB_WCHAR * pwc ); -extern HB_EXPORT ULONG hb_cdpStrnToUTF8( PHB_CODEPAGE, BOOL, const char *, ULONG, char * ); -extern HB_EXPORT ULONG hb_cdpStrnToUTF8n( PHB_CODEPAGE, BOOL, const char *, ULONG, char *, ULONG ); -extern HB_EXPORT ULONG hb_cdpStringInUTF8Length( PHB_CODEPAGE, BOOL, const char *, ULONG ); -extern HB_EXPORT ULONG hb_cdpStringInUTF8Length2( PHB_CODEPAGE, BOOL, const char *, ULONG, ULONG ); +extern HB_EXPORT ULONG hb_cdpUTF8StringLength( const char * pSrc, ULONG ulLen ); +extern HB_EXPORT ULONG hb_cdpUTF8StringPeek( const char * pSrc, ULONG ulLen, ULONG ulPos ); +extern HB_EXPORT char * hb_cdpUTF8StringSubstr( const char * pSrc, ULONG ulLen, ULONG ulFrom, ULONG ulCount, ULONG * pulDest ); -extern HB_EXPORT ULONG hb_cdpUTF8ToStrn( PHB_CODEPAGE, BOOL, const char *, ULONG, char *, ULONG ); -extern HB_EXPORT ULONG hb_cdpUTF8StringLength( const char *, ULONG ); -extern HB_EXPORT char * hb_cdpUTF8StringSubstr( const char *, ULONG, ULONG, ULONG, ULONG * ); -extern HB_EXPORT ULONG hb_cdpUTF8StringPeek( const char *, ULONG, ULONG ); +extern HB_EXPORT ULONG hb_cdpUTF8AsStrLen( PHB_CODEPAGE cdp, BOOL fCtrl, const char * pSrc, ULONG ulSrc, ULONG ulMax ); +extern HB_EXPORT ULONG hb_cdpUTF8ToStr( PHB_CODEPAGE cdp, BOOL fCtrl, const char * pSrc, ULONG ulSrc, char * pDst, ULONG ulDst ); +extern HB_EXPORT ULONG hb_cdpStrAsUTF8Len( PHB_CODEPAGE cdp, BOOL fCtrl, const char * pSrc, ULONG ulSrc, ULONG ulMax ); +extern HB_EXPORT ULONG hb_cdpStrToUTF8( PHB_CODEPAGE cdp, BOOL fCtrl, const char * pSrc, ULONG ulSrc, char * pDst, ULONG ulDst ); -extern HB_EXPORT PHB_ITEM hb_itemDeserializeCP( const char ** pBufferPtr, ULONG * pulSize, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ); -extern HB_EXPORT char * hb_itemSerializeCP( PHB_ITEM pItem, BOOL fNumSize, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, ULONG *pulSize ); +extern HB_EXPORT PHB_ITEM hb_itemDeserializeCP( const char ** pBufferPtr, ULONG * pulSize, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ); +extern HB_EXPORT char * hb_itemSerializeCP( PHB_ITEM pItem, BOOL fNumSize, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, ULONG *pulSize ); -#define hb_cdpStrToUTF8( cdp, ctrl, src, slen, dst, dlen ) \ - hb_cdpStrnToUTF8( cdp, ctrl, src, slen, dst ) +#ifdef HB_LEGACY_LEVEL2 +extern HB_EXPORT void hb_cdpTranslate( char *, PHB_CODEPAGE, PHB_CODEPAGE ); +extern HB_EXPORT void hb_cdpnTranslate( char *, PHB_CODEPAGE, PHB_CODEPAGE, ULONG ); +#endif HB_EXTERN_END #else typedef void * PHB_CODEPAGE; +typedef USHORT HB_WCHAR; #endif /* HB_CDP_SUPPORT_OFF */ diff --git a/harbour/include/hbcdpreg.h b/harbour/include/hbcdpreg.h new file mode 100644 index 0000000000..b6bd31e2f8 --- /dev/null +++ b/harbour/include/hbcdpreg.h @@ -0,0 +1,77 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * code used to register new CP definition + * + * Copyright 2009 Przemyslaw Czerpak + * www - http://www.harbour-project.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 "hbapicdp.h" + +HB_CODEPAGE_ANNOUNCE( HB_CP_ID ) + +HB_CALL_ON_STARTUP_BEGIN( _hb_codepage_Init_ ) + +#if defined( HB_CP_RAW ) + hb_cdpRegisterRaw( HB_CP_RAW ); +#else + hb_cdpRegisterNew( HB_MACRO2STRING( HB_CP_ID ), HB_CP_INFO, HB_CP_UNITB, + HB_CP_UPPER, HB_CP_LOWER, HB_CP_ACSORT ); +#endif /* HB_CP_RAW */ + +HB_CALL_ON_STARTUP_END( _hb_codepage_Init_ ) + +#if defined( HB_PRAGMA_STARTUP ) + #pragma startup _hb_codepage_Init_ +#elif defined( HB_MSC_STARTUP ) + #if defined( HB_OS_WIN_64 ) + #pragma section( HB_MSC_START_SEGMENT, long, read ) + #endif + #pragma data_seg( HB_MSC_START_SEGMENT ) + static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ = _hb_codepage_Init_; + #pragma data_seg() +#endif diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index 43994724bc..f627f6b15a 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -837,11 +837,12 @@ EXTERNAL HB_LANGSELECT EXTERNAL HB_LANGERRMSG EXTERNAL HB_LANGMESSAGE #ifndef HB_CDP_SUPPORT_OFF -EXTERNAL HB_SETCODEPAGE -EXTERNAL HB_TRANSLATE -EXTERNAL HB_CDPSELECT EXTERNAL HB_CDPLIST EXTERNAL HB_CDPUNIID +EXTERNAL HB_CDPINFO +EXTERNAL HB_CDPSELECT +EXTERNAL HB_SETCODEPAGE +EXTERNAL HB_TRANSLATE EXTERNAL HB_STRTOUTF8 EXTERNAL HB_UTF8TOSTR EXTERNAL HB_UTF8LEN diff --git a/harbour/src/codepage/cp_tpl.c b/harbour/src/codepage/cp_tpl.c index 3dc8014bb4..dbd8895456 100644 --- a/harbour/src/codepage/cp_tpl.c +++ b/harbour/src/codepage/cp_tpl.c @@ -54,55 +54,34 @@ /* ISO language code (2 chars): (please look it up in /doc/lang_id.txt) */ /* Codepage: */ -#include "hbapi.h" -#include "hbapicdp.h" - -/* NOTE: In order to codepage translate work in Harbour, you must - ensure that the NUMBER_OF_CHARACTERS and the order of the - lowercase/uppercase chars are exactly matching in every - codepage that belong to the same language. - [vszakats] */ - -#define NUMBER_OF_CHARACTERS 26 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: +/* + If accented characters need special sorting ( HB_CDP_ACSORT_EQUAL or + HB_CDP_ACSORT_INTERLEAVE ) then you need to mark the accented characters + with the symbol '~' before each of them, for example: a~ If there is two-character sequence, which is considered as one, it should be marked with '.' before and after it, for example: ... h.ch.i ... + if such multibyte character has its own Unicode representation then + this Unicode value can be set using '=' symbol, for example: + ....h.ch=2A7C.i + and it will be used in translations. - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. + The Upper case string and the Lower case string should use the same + letters. If some characters does not have corresponding upper or lower + letter then space ' ' can be used as dummy character, for example in + German CPs there is no upper case 'scharfes S' letter so space is used + as dummy character. + + otherwise 0 */ -static HB_CODEPAGE s_codepage = { "EN", - HB_CPID_437,HB_UNITB_437,NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; +#define HB_CP_ID EN +#define HB_CP_INFO "English CP-437" +#define HB_CP_UNITB HB_UNITB_437 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -HB_CODEPAGE_INIT( EN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_EN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_EN = hb_codepage_Init_EN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpbg866.c b/harbour/src/codepage/cpbg866.c index e84f593c59..b3e364236a 100644 --- a/harbour/src/codepage/cpbg866.c +++ b/harbour/src/codepage/cpbg866.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): BG */ /* Codepage: CP-866 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID BG866 +#define HB_CP_INFO "Bulgarian CP-866" +#define HB_CP_UNITB HB_UNITB_866 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "" +#define HB_CP_LOWER "" -#define NUMBER_OF_CHARACTERS 32 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "BG866", - HB_CPID_866, HB_UNITB_866, NUMBER_OF_CHARACTERS, - "", - "", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( BG866 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_BG866 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_BG866 = hb_codepage_Init_BG866; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpbgiso.c b/harbour/src/codepage/cpbgiso.c index d17e49e44e..784a4027d6 100644 --- a/harbour/src/codepage/cpbgiso.c +++ b/harbour/src/codepage/cpbgiso.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): BG */ /* Codepage: ISO-8859-5 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID BGISO +#define HB_CP_INFO "Bulgarian ISO-8859-5" +#define HB_CP_UNITB HB_UNITB_8859_5 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "" +#define HB_CP_LOWER "" -#define NUMBER_OF_CHARACTERS 32 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "BGISO", - HB_CPID_8859_5, HB_UNITB_8859_5, NUMBER_OF_CHARACTERS, - "", - "", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( BGISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_BGISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_BGISO = hb_codepage_Init_BGISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpbgmik.c b/harbour/src/codepage/cpbgmik.c index c64557c3c3..1b10e2e9d4 100644 --- a/harbour/src/codepage/cpbgmik.c +++ b/harbour/src/codepage/cpbgmik.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): BG */ /* Codepage: MIK */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID BGMIK +#define HB_CP_INFO "Bulgarian MIK" +#define HB_CP_UNITB HB_UNITB_MIK +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "" +#define HB_CP_LOWER "" -#define NUMBER_OF_CHARACTERS 32 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~_ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "BGMIK", - HB_CPID_MIK, HB_UNITB_MIK, NUMBER_OF_CHARACTERS, - "", - "", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( BGMIK ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_BGMIK -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_BGMIK = hb_codepage_Init_BGMIK; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpbgwin.c b/harbour/src/codepage/cpbgwin.c index c1a45d2828..74ec677644 100644 --- a/harbour/src/codepage/cpbgwin.c +++ b/harbour/src/codepage/cpbgwin.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): BG */ /* Codepage: Windows-1251 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID BGWIN +#define HB_CP_INFO "Bulgarian Windows-1251" +#define HB_CP_UNITB HB_UNITB_1251 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "" +#define HB_CP_LOWER "" -#define NUMBER_OF_CHARACTERS 32 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "BGWIN", - HB_CPID_1251, HB_UNITB_1251, NUMBER_OF_CHARACTERS, - "", - "", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( BGWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_BGWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_BGWIN = hb_codepage_Init_BGWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpcs852.c b/harbour/src/codepage/cpcs852.c index c49251303c..4820f75ecc 100644 --- a/harbour/src/codepage/cpcs852.c +++ b/harbour/src/codepage/cpcs852.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): CS */ /* Codepage: 852 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID CS852 +#define HB_CP_INFO "Czech CP-852" +#define HB_CP_UNITB HB_UNITB_852 +#define HB_CP_ACSORT HB_CDP_ACSORT_INTERLEAVED +#define HB_CP_UPPER "A~~BCD~E~~~FGH.CH.I~JKLMN~O~~PQRST~U~~~VWXY~Z" +#define HB_CP_LOWER "a~~bcd~e~~~fgh.ch.i~jklmn~o~~pqrst~u~~~vwxy~z" -#define NUMBER_OF_CHARACTERS 46 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 1 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~_ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "CS852", - HB_CPID_852, HB_UNITB_852, NUMBER_OF_CHARACTERS, - "A~~BCD~E~~~FGH.CH.I~JKLMN~O~~PQRST~U~~~VWXY~Z", - "a~~bcd~e~~~fgh.ch.i~jklmn~o~~pqrst~u~~~vwxy~z", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( CS852 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_CS852 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_CS852 = hb_codepage_Init_CS852; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpcsiso.c b/harbour/src/codepage/cpcsiso.c index 4e2ecea316..808e95d0ce 100644 --- a/harbour/src/codepage/cpcsiso.c +++ b/harbour/src/codepage/cpcsiso.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): CS */ /* Codepage: ISO-8859-2 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID CSISO +#define HB_CP_INFO "Czech ISO-8859-2" +#define HB_CP_UNITB HB_UNITB_8859_2 +#define HB_CP_ACSORT HB_CDP_ACSORT_INTERLEAVED +#define HB_CP_UPPER "A~~BCD~E~~~FGH.CH.I~JKLMN~O~~PQRST~U~~~VWXY~Z" +#define HB_CP_LOWER "a~~bcd~e~~~fgh.ch.i~jklmn~o~~pqrst~u~~~vwxy~z" -#define NUMBER_OF_CHARACTERS 46 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 1 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "CSISO", - HB_CPID_8859_2, HB_UNITB_8859_2, NUMBER_OF_CHARACTERS, - "A~~BCD~E~~~FGH.CH.I~JKLMN~O~~PQRST~U~~~VWXY~Z", - "a~~bcd~e~~~fgh.ch.i~jklmn~o~~pqrst~u~~~vwxy~z", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( CSISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_CSISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_CSISO = hb_codepage_Init_CSISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpcskam.c b/harbour/src/codepage/cpcskam.c index f0f1fdc709..27ae874246 100644 --- a/harbour/src/codepage/cpcskam.c +++ b/harbour/src/codepage/cpcskam.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): CS */ /* Codepage: 895(KAM) */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID CSKAM +#define HB_CP_INFO "Czech Kamenicky (895)" +#define HB_CP_UNITB HB_UNITB_KAM +#define HB_CP_ACSORT HB_CDP_ACSORT_INTERLEAVED +#define HB_CP_UPPER "A~~BCD~E~~FGH.CH.I~JKLMN~O~~PQRST~U~~~VWXY~Z" +#define HB_CP_LOWER "a~~bcd~e~~fgh.ch.i~jklmn~o~~pqrst~u~~~vwxy~z" -#define NUMBER_OF_CHARACTERS 46 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 1 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~_ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "CSKAM", - HB_CPID_KAM, HB_UNITB_KAM, NUMBER_OF_CHARACTERS, - "A~~BCD~E~~~ FGH.CH.I~JKLMN~O~~PQRST~U~~~VWXY~Z", - "a~~bcd~e~~~ fgh.ch.i~jklmn~o~~pqrst~u~~~vwxy~z", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( CSKAM ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_CSKAM -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_CSKAM = hb_codepage_Init_CSKAM; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpcswin.c b/harbour/src/codepage/cpcswin.c index f5d1d8a073..8e76563873 100644 --- a/harbour/src/codepage/cpcswin.c +++ b/harbour/src/codepage/cpcswin.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): CS */ /* Codepage: Windows-1250 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID CSWIN +#define HB_CP_INFO "Czech Windows-1250" +#define HB_CP_UNITB HB_UNITB_1250 +#define HB_CP_ACSORT HB_CDP_ACSORT_INTERLEAVED +#define HB_CP_UPPER "A~~BCD~E~~~FGH.CH.I~JKLMN~O~~PQRST~U~~~VWXY~Z" +#define HB_CP_LOWER "a~~bcd~e~~~fgh.ch.i~jklmn~o~~pqrst~u~~~vwxy~z" -#define NUMBER_OF_CHARACTERS 46 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 1 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "CSWIN", - HB_CPID_1250, HB_UNITB_1250, NUMBER_OF_CHARACTERS, - "A~~BCD~E~~~FGH.CH.I~JKLMN~O~~PQRST~U~~~VWXY~Z", - "a~~bcd~e~~~fgh.ch.i~jklmn~o~~pqrst~u~~~vwxy~z", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( CSWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_CSWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_CSWIN = hb_codepage_Init_CSWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpde850.c b/harbour/src/codepage/cpde850.c index d898b2ebae..0bafd009c6 100644 --- a/harbour/src/codepage/cpde850.c +++ b/harbour/src/codepage/cpde850.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): DE */ /* Codepage: 850 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID DE850 +#define HB_CP_INFO "German CP-850" +#define HB_CP_UNITB HB_UNITB_850 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRS TUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 30 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "DE850", - HB_CPID_850, HB_UNITB_850, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( DE850 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_DE850 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_DE850 = hb_codepage_Init_DE850; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpdeiso.c b/harbour/src/codepage/cpdeiso.c index d4bbd106ac..8d5d98c89c 100644 --- a/harbour/src/codepage/cpdeiso.c +++ b/harbour/src/codepage/cpdeiso.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): DE (please look it up in /doc/lang_id.txt) */ /* Codepage: ISO-8859-1 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID DEISO +#define HB_CP_INFO "German ISO-8859-1" +#define HB_CP_UNITB HB_UNITB_8859_1 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRS TUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 30 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "DEISO", - HB_CPID_8859_1, HB_UNITB_8859_1, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( DEISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_DEISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_DEISO = hb_codepage_Init_DEISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpdewin.c b/harbour/src/codepage/cpdewin.c index 2a82f4977b..8d246de2a8 100644 --- a/harbour/src/codepage/cpdewin.c +++ b/harbour/src/codepage/cpdewin.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): DE (please look it up in /doc/lang_id.txt) */ /* Codepage: Windows-1252 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID DEWIN +#define HB_CP_INFO "German Windows-1252" +#define HB_CP_UNITB HB_UNITB_1252 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRS TUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 30 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "DEWIN", - HB_CPID_1252, HB_UNITB_1252, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( DEWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_DEWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_DEWIN = hb_codepage_Init_DEWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpel737.c b/harbour/src/codepage/cpel737.c index 2ef02d8815..1e0122e006 100644 --- a/harbour/src/codepage/cpel737.c +++ b/harbour/src/codepage/cpel737.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): EL */ /* Codepage: 737 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID EL737 +#define HB_CP_INFO "Greek DOS CP-737" +#define HB_CP_UNITB HB_UNITB_737 +#define HB_CP_ACSORT HB_CDP_ACSORT_EQUAL +#define HB_CP_UPPER "~ꁂ~녆~쇈~퉊~~~" +#define HB_CP_LOWER "~ᙚ~❞~㟠~塢~槨~筮~" -#define NUMBER_OF_CHARACTERS 32 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~_ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "EL737", - HB_CPID_737, HB_UNITB_737, NUMBER_OF_CHARACTERS, - "~ꁂ~녆~쇈~퉊~~~", - "~ᙚ~❞~㟠~塢~槨~筮~", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( EL737 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_EL737 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_EL737 = hb_codepage_Init_EL737; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpeliso.c b/harbour/src/codepage/cpeliso.c index 12db784695..23b3813a8b 100644 --- a/harbour/src/codepage/cpeliso.c +++ b/harbour/src/codepage/cpeliso.c @@ -51,53 +51,16 @@ * */ -/* Language name: Greek WIN*/ +/* Language name: Greek */ /* ISO language code (2 chars): EL */ /* Codepage: ISO-8859-7 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ELISO +#define HB_CP_INFO "Greek ISO-8859-7" +#define HB_CP_UNITB HB_UNITB_8859_7 +#define HB_CP_ACSORT HB_CDP_ACSORT_EQUAL +#define HB_CP_UPPER "~~~~~~~" +#define HB_CP_LOWER "~~~~~~~" -#define NUMBER_OF_CHARACTERS 32 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ELISO", - HB_CPID_8859_7, HB_UNITB_8859_7, NUMBER_OF_CHARACTERS, - "~~~~~~~", - "~~~~~~~", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ELISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ELISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ELISO = hb_codepage_Init_ELISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpelwin.c b/harbour/src/codepage/cpelwin.c index c9a2ec54d5..791187dde1 100644 --- a/harbour/src/codepage/cpelwin.c +++ b/harbour/src/codepage/cpelwin.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): EL */ /* Codepage: ANSI (1253) */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ELWIN +#define HB_CP_INFO "Greek ANSI CP-1253" +#define HB_CP_UNITB HB_UNITB_1253 +#define HB_CP_ACSORT HB_CDP_ACSORT_EQUAL +#define HB_CP_UPPER "~~~~~~~" +#define HB_CP_LOWER "~~~~~~~" -#define NUMBER_OF_CHARACTERS 32 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ELWIN", - HB_CPID_1253, HB_UNITB_1253, NUMBER_OF_CHARACTERS, - "~~~~~~~", - "~~~~~~~", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ELWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ELWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ELWIN = hb_codepage_Init_ELWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpes850.c b/harbour/src/codepage/cpes850.c index 0acab533ad..aa8eeffcad 100644 --- a/harbour/src/codepage/cpes850.c +++ b/harbour/src/codepage/cpes850.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): ES */ /* Codepage: 850 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ES850 +#define HB_CP_INFO "Spanish (Modern) CP-850" +#define HB_CP_UNITB HB_UNITB_850 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 43 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~_ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ES850", - HB_CPID_850, HB_UNITB_850, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ES850 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ES850 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ES850 = hb_codepage_Init_ES850; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpes850c.c b/harbour/src/codepage/cpes850c.c index 6a423c1220..01962e4c68 100644 --- a/harbour/src/codepage/cpes850c.c +++ b/harbour/src/codepage/cpes850c.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): ES */ /* Codepage: 850 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ES850C +#define HB_CP_INFO "Spanish CP-850" +#define HB_CP_UNITB HB_UNITB_850 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "AABCDEFGHIIJKLMNOOPQRSTUUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 33 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~_ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ES850C", - HB_CPID_850, HB_UNITB_850, NUMBER_OF_CHARACTERS, - "AABCDEFGHIIJKLMNOOPQRSTUUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ES850C ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ES850C -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ES850C = hb_codepage_Init_ES850C; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpesiso.c b/harbour/src/codepage/cpesiso.c index 8e5f64996b..44c0797021 100644 --- a/harbour/src/codepage/cpesiso.c +++ b/harbour/src/codepage/cpesiso.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): ES */ /* Codepage: ISO-8859-1 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ESISO +#define HB_CP_INFO "Spanish (Modern) ISO-8859-1" +#define HB_CP_UNITB HB_UNITB_8859_1 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 43 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~_ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ESISO", - HB_CPID_8859_1, HB_UNITB_8859_1, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ESISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ESISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ESISO = hb_codepage_Init_ESISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpesisoc.c b/harbour/src/codepage/cpesisoc.c index fd32fcd823..9796459fb6 100644 --- a/harbour/src/codepage/cpesisoc.c +++ b/harbour/src/codepage/cpesisoc.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): ES */ /* Codepage: ISO-8859-1 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ESISOC +#define HB_CP_INFO "Spanish ISO-8859-1" +#define HB_CP_UNITB HB_UNITB_8859_1 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "AABCDEFGHIIJKLMNOOPQRSTUUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 33 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~_ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ESISOC", - HB_CPID_8859_1, HB_UNITB_8859_1, NUMBER_OF_CHARACTERS, - "AABCDEFGHIIJKLMNOOPQRSTUUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ESISOC ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ESISOC -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ESISOC = hb_codepage_Init_ESISOC; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpeswin.c b/harbour/src/codepage/cpeswin.c index 45a7d909a1..f60ed9c4d0 100644 --- a/harbour/src/codepage/cpeswin.c +++ b/harbour/src/codepage/cpeswin.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): ES */ /* Codepage: Windows-1252 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ESWIN +#define HB_CP_INFO "Spanish (Modern) Windows-1252" +#define HB_CP_UNITB HB_UNITB_1252 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 43 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~_ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ESWIN", - HB_CPID_1252, HB_UNITB_1252, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ESWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ESWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ESWIN = hb_codepage_Init_ESWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpeswinc.c b/harbour/src/codepage/cpeswinc.c index 8ddc64b0ac..c2c42700c4 100644 --- a/harbour/src/codepage/cpeswinc.c +++ b/harbour/src/codepage/cpeswinc.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): ES (please look it up in /doc/lang_id.txt) */ /* Codepage: Windows-1252 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ESWINC +#define HB_CP_INFO "Spanish Windows-1252" +#define HB_CP_UNITB HB_UNITB_1252 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "AABCDEFGHIIJKLMNOOPQRSTUUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 33 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~_ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ESWINC", - HB_CPID_1252, HB_UNITB_1252, NUMBER_OF_CHARACTERS, - "AABCDEFGHIIJKLMNOOPQRSTUUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ESWINC ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ESWINC -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ESWINC = hb_codepage_Init_ESWINC; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpeswinm.c b/harbour/src/codepage/cpeswinm.c index 78caef8f96..368786830e 100644 --- a/harbour/src/codepage/cpeswinm.c +++ b/harbour/src/codepage/cpeswinm.c @@ -56,49 +56,12 @@ /* ISO language code (2 chars): ES */ /* Codepage: ISO-8859-1 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ESMWIN +#define HB_CP_INFO "Spanish (Modern) ISO-8859-1" +#define HB_CP_UNITB HB_UNITB_8859_1 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 43 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ESMWIN", - HB_CPID_8859_1, HB_UNITB_8859_1, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ESMWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ESMWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ESMWIN = hb_codepage_Init_ESMWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpfr850.c b/harbour/src/codepage/cpfr850.c index 867a0c0d0c..6b0d99e5a6 100644 --- a/harbour/src/codepage/cpfr850.c +++ b/harbour/src/codepage/cpfr850.c @@ -56,49 +56,12 @@ /* ISO language code (2 chars): FR */ /* Codepage: 850 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID FR850 +#define HB_CP_INFO "French CP-850" +#define HB_CP_UNITB HB_UNITB_850 +#define HB_CP_ACSORT HB_CDP_ACSORT_EQUAL +#define HB_CP_UPPER "A~~~~BCDE~~~~FGHI~~~~JKLMNO~~~~PQRSTU~~~~VWXYZ" +#define HB_CP_LOWER "a~~~~bcde~~~~fghi~~~~jklmno~~~~pqrstu~~~~vwxyz" -#define NUMBER_OF_CHARACTERS 46 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "FR850", - HB_CPID_850, HB_UNITB_850, NUMBER_OF_CHARACTERS, - "A~~~~BCDE~~~~FGHI~~~~JKLMNO~~~~PQRSTU~~~~VWXYZ", - "a~~~~bcde~~~~fghi~~~~jklmno~~~~pqrstu~~~~vwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( FR850 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_FR850 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_FR850 = hb_codepage_Init_FR850; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpfriso.c b/harbour/src/codepage/cpfriso.c index bb359e9899..beaf808bf2 100644 --- a/harbour/src/codepage/cpfriso.c +++ b/harbour/src/codepage/cpfriso.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): FR */ /* Codepage: ISO-8859-1 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID FRISO +#define HB_CP_INFO "French ISO-8859-1" +#define HB_CP_UNITB HB_UNITB_8859_1 +#define HB_CP_ACSORT HB_CDP_ACSORT_EQUAL +#define HB_CP_UPPER "A~~~~BCDE~~~~FGHI~~~~JKLMNO~~~~PQRSTU~~~~VWXYZ" +#define HB_CP_LOWER "a~~~~bcde~~~~fghi~~~~jklmno~~~~pqrstu~~~~vwxyz" -#define NUMBER_OF_CHARACTERS 46 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "FRISO", - HB_CPID_8859_1, HB_UNITB_8859_1, NUMBER_OF_CHARACTERS, - "A~~~~BCDE~~~~FGHI~~~~JKLMNO~~~~PQRSTU~~~~VWXYZ", - "a~~~~bcde~~~~fghi~~~~jklmno~~~~pqrstu~~~~vwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( FRISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_FRISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_FRISO = hb_codepage_Init_FRISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpfrwin.c b/harbour/src/codepage/cpfrwin.c index 890b3cda11..4b9d9f2a63 100644 --- a/harbour/src/codepage/cpfrwin.c +++ b/harbour/src/codepage/cpfrwin.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): FR */ /* Codepage: Windows-1252 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID FRWIN +#define HB_CP_INFO "French Windows-1252" +#define HB_CP_UNITB HB_UNITB_1252 +#define HB_CP_ACSORT HB_CDP_ACSORT_EQUAL +#define HB_CP_UPPER "A~~~~BCDE~~~~FGHI~~~~JKLMNO~~~~PQRSTU~~~~VWXYZ" +#define HB_CP_LOWER "a~~~~bcde~~~~fghi~~~~jklmno~~~~pqrstu~~~~vwxyz" -#define NUMBER_OF_CHARACTERS 46 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "FRWIN", - HB_CPID_1252, HB_UNITB_1252, NUMBER_OF_CHARACTERS, - "A~~~~BCDE~~~~FGHI~~~~JKLMNO~~~~PQRSTU~~~~VWXYZ", - "a~~~~bcde~~~~fghi~~~~jklmno~~~~pqrstu~~~~vwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( FRWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_FRWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_FRWIN = hb_codepage_Init_FRWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cphr437.c b/harbour/src/codepage/cphr437.c index 19cbb1810e..78490a2644 100644 --- a/harbour/src/codepage/cphr437.c +++ b/harbour/src/codepage/cphr437.c @@ -54,49 +54,14 @@ /* ISO language code (2 chars): HR */ /* Codepage: 437 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID HR437 +#define HB_CP_INFO "Croatien CP-437" +#define HB_CP_UNITB HB_UNITB_437 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABC^]D\\EFGHIJKLMNOPQRS[TUVWZ@XY" +#define HB_CP_LOWER "abc~}d|efghijklmnopqrs{tuvwz`xy" -#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ +/* include CP registration code */ +#include "hbcdpreg.h" -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "HR437", - HB_CPID_437,HB_UNITB_437,NUMBER_OF_CHARACTERS, - "ABC^]D\\EFGHIJKLMNOPQRS[TUVWZ@XY", - "abc~}d|efghijklmnopqrs{tuvwz`xy", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( HR437 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_HR437 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_HR437 = hb_codepage_Init_HR437; - #pragma data_seg() -#endif +/* TOFIX: is it really CP-437? */ diff --git a/harbour/src/codepage/cphr852.c b/harbour/src/codepage/cphr852.c index 20fb502699..1c8514076f 100644 --- a/harbour/src/codepage/cphr852.c +++ b/harbour/src/codepage/cphr852.c @@ -56,49 +56,12 @@ /* ISO language code (2 chars): HR */ /* Codepage: 852 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID HR852 +#define HB_CP_INFO "Croatien CP-852" +#define HB_CP_UNITB HB_UNITB_852 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWZXY" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwzxy" -#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "HR852", - HB_CPID_852,HB_UNITB_852,NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWZXY", - "abcdefghijklmnopqrstuvwzxy", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( HR852 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_HR852 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_HR852 = hb_codepage_Init_HR852; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cphrwin.c b/harbour/src/codepage/cphrwin.c index 210775fd7b..5d086552ac 100644 --- a/harbour/src/codepage/cphrwin.c +++ b/harbour/src/codepage/cphrwin.c @@ -56,49 +56,12 @@ /* ISO language code (2 chars): HR */ /* Codepage: Windows-1250 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID HRWIN +#define HB_CP_INFO "Croatien Windows-1250" +#define HB_CP_UNITB HB_UNITB_1250 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWZXY" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwzxy" -#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "HRWIN", - HB_CPID_1250,HB_UNITB_1250,NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWZXY", - "abcdefghijklmnopqrstuvwzxy", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( HRWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_HRWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_HRWIN = hb_codepage_Init_HRWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cphu852.c b/harbour/src/codepage/cphu852.c index 218d7ba474..5e34775e52 100644 --- a/harbour/src/codepage/cphu852.c +++ b/harbour/src/codepage/cphu852.c @@ -54,34 +54,6 @@ /* ISO language code (2 chars): HU */ /* Codepage: 852 (ntxhu852 compatible) */ -#include "hbapi.h" -#include "hbapicdp.h" - -#define NUMBER_OF_CHARACTERS 42 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - /* NOTE: Several chars have been added above the standard 852 Hungarian ones to make it 100% compatible with ntxhu852.obj for CA-Cl*pper 5.x. Moreover the extra chars had to be replicated in the alternative @@ -95,21 +67,12 @@ ordering and Lower()/Upper() functions worked alright. [20070410] [vszakats] */ -static HB_CODEPAGE s_codepage = { "HU852", - HB_CPID_852, HB_UNITB_852, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTU隘VWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; +#define HB_CP_ID HU852 +#define HB_CP_INFO "Hungarian CP-852 (ntxhu852 compatible)" +#define HB_CP_UNITB HB_UNITB_852 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTU隘VWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -HB_CODEPAGE_INIT( HU852 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_HU852 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_HU852 = hb_codepage_Init_HU852; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cphu852s.c b/harbour/src/codepage/cphu852s.c index 5a762c65f3..ec56151aae 100644 --- a/harbour/src/codepage/cphu852s.c +++ b/harbour/src/codepage/cphu852s.c @@ -54,55 +54,18 @@ /* ISO language code (2 chars): HU */ /* Codepage: 852 (sixhu852 compatible) */ -#include "hbapi.h" -#include "hbapicdp.h" - -#define NUMBER_OF_CHARACTERS 36 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - /* NOTE: / has been added to make it fully compatible with sixhu852.obj for S*ccessWare SIx Driver. Moreover the extra chars had to be replicated in the alternative codepages (WIN, ISO) too, to keep the Harbour codepage translation work. [vszakats] */ -static HB_CODEPAGE s_codepage = { "HU852S", - HB_CPID_852, HB_UNITB_852, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; +#define HB_CP_ID HU852S +#define HB_CP_INFO "Hungarian CP-852 (sixhu852 compatible)" +#define HB_CP_UNITB HB_UNITB_852 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -HB_CODEPAGE_INIT( HU852S ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_HU852S -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_HU852S = hb_codepage_Init_HU852S; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cphuiso.c b/harbour/src/codepage/cphuiso.c index 7204b84e88..6a05b2aa59 100644 --- a/harbour/src/codepage/cphuiso.c +++ b/harbour/src/codepage/cphuiso.c @@ -54,34 +54,6 @@ /* ISO language code (2 chars): HU */ /* Codepage: ISO-8859-2 (ntxhu852 flavour) */ -#include "hbapi.h" -#include "hbapicdp.h" - -#define NUMBER_OF_CHARACTERS 42 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - /* NOTE: Several chars have been added above the standard 852 Hungarian ones to make it 100% compatible with ntxhu852.obj for CA-Cl*pper 5.x. Moreover the extra chars had to be replicated in the alternative @@ -95,21 +67,12 @@ ordering and Lower()/Upper() functions worked alright. [20070410] [vszakats] */ -static HB_CODEPAGE s_codepage = { "HUISO", - HB_CPID_8859_2, HB_UNITB_8859_2, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; +#define HB_CP_ID HUISO +#define HB_CP_INFO "Hungarian ISO-8859-2 (ntxhu852 flavour)" +#define HB_CP_UNITB HB_UNITB_8859_2 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -HB_CODEPAGE_INIT( HUISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_HUISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_HUISO = hb_codepage_Init_HUISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cphuisos.c b/harbour/src/codepage/cphuisos.c index 58258cd143..440b3315d5 100644 --- a/harbour/src/codepage/cphuisos.c +++ b/harbour/src/codepage/cphuisos.c @@ -54,55 +54,18 @@ /* ISO language code (2 chars): HU */ /* Codepage: ISO-8859-2 (sixhu852 flavour) */ -#include "hbapi.h" -#include "hbapicdp.h" - -#define NUMBER_OF_CHARACTERS 36 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - /* NOTE: / has been added to make it fully compatible with sixhu852.obj for S*ccessWare SIx Driver. Moreover the extra chars had to be replicated in the alternative codepages (WIN, ISO) too, to keep the Harbour codepage translation work. [vszakats] */ -static HB_CODEPAGE s_codepage = { "HUISOS", - HB_CPID_8859_2, HB_UNITB_8859_2, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; +#define HB_CP_ID HUISOS +#define HB_CP_INFO "Hungarian ISO-8859-2 (sixhu852 flavour)" +#define HB_CP_UNITB HB_UNITB_8859_2 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -HB_CODEPAGE_INIT( HUISOS ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_HUISOS -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_HUISOS = hb_codepage_Init_HUISOS; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cphuwin.c b/harbour/src/codepage/cphuwin.c index f191037a46..6188b42534 100644 --- a/harbour/src/codepage/cphuwin.c +++ b/harbour/src/codepage/cphuwin.c @@ -54,34 +54,6 @@ /* ISO language code (2 chars): HU */ /* Codepage: Windows-1250 (ntxhu852 flavour) */ -#include "hbapi.h" -#include "hbapicdp.h" - -#define NUMBER_OF_CHARACTERS 42 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - /* NOTE: Several chars have been added above the standard 852 Hungarian ones to make it 100% compatible with ntxhu852.obj for CA-Cl*pper 5.x. Moreover the extra chars had to be replicated in the alternative @@ -95,21 +67,12 @@ ordering and Lower()/Upper() functions worked alright. [20070410] [vszakats] */ -static HB_CODEPAGE s_codepage = { "HUWIN", - HB_CPID_1250, HB_UNITB_1250, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; +#define HB_CP_ID HUWIN +#define HB_CP_INFO "Hungarian Windows-1250 (ntxhu852 flavour)" +#define HB_CP_UNITB HB_UNITB_1250 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -HB_CODEPAGE_INIT( HUWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_HUWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_HUWIN = hb_codepage_Init_HUWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cphuwins.c b/harbour/src/codepage/cphuwins.c index 696e996931..6b7bfc3a49 100644 --- a/harbour/src/codepage/cphuwins.c +++ b/harbour/src/codepage/cphuwins.c @@ -54,55 +54,18 @@ /* ISO language code (2 chars): HU */ /* Codepage: Windows-1250 (sixhu852 flavour) */ -#include "hbapi.h" -#include "hbapicdp.h" - -#define NUMBER_OF_CHARACTERS 36 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - /* NOTE: / has been added to make it fully compatible with sixhu852.obj for S*ccessWare SIx Driver. Moreover the extra chars had to be replicated in the alternative codepages (WIN, ISO) too, to keep the Harbour codepage translation work. [vszakats] */ -static HB_CODEPAGE s_codepage = { "HUWINS", - HB_CPID_1250, HB_UNITB_1250, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; +#define HB_CP_ID HUWINS +#define HB_CP_INFO "Hungarian Windows-1250 (sixhu852 flavour)" +#define HB_CP_UNITB HB_UNITB_1250 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -HB_CODEPAGE_INIT( HUWINS ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_HUWINS -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_HUWINS = hb_codepage_Init_HUWINS; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpit437.c b/harbour/src/codepage/cpit437.c index 239650eb68..e64e56841a 100644 --- a/harbour/src/codepage/cpit437.c +++ b/harbour/src/codepage/cpit437.c @@ -53,49 +53,12 @@ /* ISO language code (2 chars): IT */ /* Codepage: 437 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID IT437 +#define HB_CP_INFO "Italian CP-437" +#define HB_CP_UNITB HB_UNITB_437 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "AAAABCDEEFGHIIIJKLMNOOOPQRSTUUUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 40 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "IT437", - HB_CPID_437, HB_UNITB_437, NUMBER_OF_CHARACTERS, - "AAAAABCDEEFGHIIIJKLMNOOOPQRSTUUUVWXYZ", - "aabcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( IT437 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_IT437 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_IT437 = hb_codepage_Init_IT437; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpit850.c b/harbour/src/codepage/cpit850.c index cad9b06c1e..c8e4cab711 100644 --- a/harbour/src/codepage/cpit850.c +++ b/harbour/src/codepage/cpit850.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): IT */ /* Codepage: 850 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID IT850 +#define HB_CP_INFO "Italian CP-850" +#define HB_CP_UNITB HB_UNITB_850 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "AǎBCDEԐFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "aƄbcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 40 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "IT850", - HB_CPID_850, HB_UNITB_850, NUMBER_OF_CHARACTERS, - "AǎBCDEԐFGHIJKLMNOPQRSTUVWXYZ", - "aƄbcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( IT850 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_IT850 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_IT850 = hb_codepage_Init_IT850; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpitisb.c b/harbour/src/codepage/cpitisb.c index be77597a71..f268081cdb 100644 --- a/harbour/src/codepage/cpitisb.c +++ b/harbour/src/codepage/cpitisb.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): IT */ /* Codepage: ISO-8859-1b (with BOX characters) */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ITISB +#define HB_CP_INFO "Italian ISO-8859-1b (with BOX characters)" +#define HB_CP_UNITB HB_UNITB_8859_1B +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 40 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ITISB", - HB_CPID_8859_1B, HB_UNITB_8859_1B, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ITISB ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ITISB -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ITISB = hb_codepage_Init_ITISB; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpitiso.c b/harbour/src/codepage/cpitiso.c index 3cc0be7847..827b7c3838 100644 --- a/harbour/src/codepage/cpitiso.c +++ b/harbour/src/codepage/cpitiso.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): IT */ /* Codepage: ISO-8859-1 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ITISO +#define HB_CP_INFO "Italian ISO-8859-1" +#define HB_CP_UNITB HB_UNITB_8859_1 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 40 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ITISO", - HB_CPID_8859_1, HB_UNITB_8859_1, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ITISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ITISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ITISO = hb_codepage_Init_ITISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpitwin.c b/harbour/src/codepage/cpitwin.c index 307ed85ce7..165c6c9d40 100644 --- a/harbour/src/codepage/cpitwin.c +++ b/harbour/src/codepage/cpitwin.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): IT */ /* Codepage: Windows-1252 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ITWIN +#define HB_CP_INFO "Italian Windows-1252" +#define HB_CP_UNITB HB_UNITB_1252 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 40 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ITWIN", - HB_CPID_1252, HB_UNITB_1252, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ITWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ITWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ITWIN = hb_codepage_Init_ITWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpltwin.c b/harbour/src/codepage/cpltwin.c index 64174e0af8..677b50d905 100644 --- a/harbour/src/codepage/cpltwin.c +++ b/harbour/src/codepage/cpltwin.c @@ -56,49 +56,12 @@ /* ISO language code (2 chars): LT */ /* Codepage: Windows-1257 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID LTWIN +#define HB_CP_INFO "Lithuanian Windows-1257" +#define HB_CP_UNITB HB_UNITB_1257 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIYJKLMNOPQRSTUVWXZ" +#define HB_CP_LOWER "abcdefghiyjklmnopqrstuvwxz" -#define NUMBER_OF_CHARACTERS 35 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "LTWIN", - HB_CPID_1257,HB_UNITB_1257,NUMBER_OF_CHARACTERS, - "ABCDEFGHIYJKLMNOPQRSTUVWXZ", - "abcdefghiyjklmnopqrstuvwxz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( LTWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_LTWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_LTWIN = hb_codepage_Init_LTWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cppl852.c b/harbour/src/codepage/cppl852.c index 82c036821f..eac83f7c03 100644 --- a/harbour/src/codepage/cppl852.c +++ b/harbour/src/codepage/cppl852.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): PL */ /* Codepage: 852 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID PL852 +#define HB_CP_INFO "Polish CP-852" +#define HB_CP_UNITB HB_UNITB_852 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 35 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "PL852", - HB_CPID_852, HB_UNITB_852, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( PL852 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_PL852 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_PL852 = hb_codepage_Init_PL852; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cppliso.c b/harbour/src/codepage/cppliso.c index dba27b3954..b96934dc1f 100644 --- a/harbour/src/codepage/cppliso.c +++ b/harbour/src/codepage/cppliso.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): PL */ /* Codepage: ISO-8859-2 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID PLISO +#define HB_CP_INFO "Polish ISO-8859-2" +#define HB_CP_UNITB HB_UNITB_8859_2 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 35 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "PLISO", - HB_CPID_8859_2, HB_UNITB_8859_2, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( PLISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_PLISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_PLISO = hb_codepage_Init_PLISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpplmaz.c b/harbour/src/codepage/cpplmaz.c index c22e6aa6ec..92600b22dd 100644 --- a/harbour/src/codepage/cpplmaz.c +++ b/harbour/src/codepage/cpplmaz.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): PL */ /* Codepage: Mazovia */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID PLMAZ +#define HB_CP_INFO "Polish Mazovia" +#define HB_CP_UNITB HB_UNITB_MAZ +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 35 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "PLMAZ", - HB_CPID_MAZ, HB_UNITB_MAZ, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( PLMAZ ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_PLMAZ -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_PLMAZ = hb_codepage_Init_PLMAZ; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpplwin.c b/harbour/src/codepage/cpplwin.c index 2abeb038b1..eddd3e6579 100644 --- a/harbour/src/codepage/cpplwin.c +++ b/harbour/src/codepage/cpplwin.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): PL */ /* Codepage: Windows-1250 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID PLWIN +#define HB_CP_INFO "Polish Windows-1250" +#define HB_CP_UNITB HB_UNITB_1250 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 35 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "PLWIN", - HB_CPID_1250, HB_UNITB_1250, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( PLWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_PLWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_PLWIN = hb_codepage_Init_PLWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cppt850.c b/harbour/src/codepage/cppt850.c index 6266263b39..fd16cad205 100644 --- a/harbour/src/codepage/cppt850.c +++ b/harbour/src/codepage/cppt850.c @@ -56,49 +56,12 @@ /* ISO language code (2 chars): PT */ /* Codepage: 850 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID PT850 +#define HB_CP_INFO "Portuguese CP-850" +#define HB_CP_UNITB HB_UNITB_850 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "AǎBCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "aƄbcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 49 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "PT850", - HB_CPID_850, HB_UNITB_850, NUMBER_OF_CHARACTERS, - "AǎBCDEFGHIJKLMNOPQRSTUVWXYZ", - "aƄbcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( PT850 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_PT850 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_PT850 = hb_codepage_Init_PT850; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpptiso.c b/harbour/src/codepage/cpptiso.c index 8b2a9101a5..d24298a14a 100644 --- a/harbour/src/codepage/cpptiso.c +++ b/harbour/src/codepage/cpptiso.c @@ -56,49 +56,12 @@ /* ISO language code (2 chars): PT */ /* Codepage: iso-8859-1 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID PTISO +#define HB_CP_INFO "Portuguese ISO-8859-1" +#define HB_CP_UNITB HB_UNITB_8859_1 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 49 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "PTISO", - HB_CPID_8859_1, HB_UNITB_8859_1, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( PTISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_PTISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_PTISO = hb_codepage_Init_PTISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpro852.c b/harbour/src/codepage/cpro852.c index 0d8f90627f..2a7361c8a4 100644 --- a/harbour/src/codepage/cpro852.c +++ b/harbour/src/codepage/cpro852.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): RO */ /* Codepage: 852 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID RO852 +#define HB_CP_INFO "Romanian CP-852" +#define HB_CP_UNITB HB_UNITB_852 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "AƶBCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "aǃbcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "RO852", - HB_CPID_852, HB_UNITB_852, NUMBER_OF_CHARACTERS, - "AƶBCDEFGHIJKLMNOPQRSTUVWXYZ", - "aǃbcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( RO852 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_RO852 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_RO852 = hb_codepage_Init_RO852; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cproiso.c b/harbour/src/codepage/cproiso.c index 1e8b8f4161..6fb583d40d 100644 --- a/harbour/src/codepage/cproiso.c +++ b/harbour/src/codepage/cproiso.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): RO */ /* Codepage: ISO-8859-2 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ROISO +#define HB_CP_INFO "Romanian ISO-8859-2" +#define HB_CP_UNITB HB_UNITB_8859_2 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ROISO", - HB_CPID_8859_2, HB_UNITB_8859_2, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ROISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ROISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ROISO = hb_codepage_Init_ROISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cprowin.c b/harbour/src/codepage/cprowin.c index 457ce9bc2a..aa78e0e801 100644 --- a/harbour/src/codepage/cprowin.c +++ b/harbour/src/codepage/cprowin.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): RO */ /* Codepage: Windows-1250 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID ROWIN +#define HB_CP_INFO "Romanian Windows-1250" +#define HB_CP_UNITB HB_UNITB_1250 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "ROWIN", - HB_CPID_1250, HB_UNITB_1250, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( ROWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_ROWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ROWIN = hb_codepage_Init_ROWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpru866.c b/harbour/src/codepage/cpru866.c index cdb6ff0cea..6e428e973d 100644 --- a/harbour/src/codepage/cpru866.c +++ b/harbour/src/codepage/cpru866.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): RU */ /* Codepage: 866 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID RU866 +#define HB_CP_INFO "Russian CP-866" +#define HB_CP_UNITB HB_UNITB_866 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "" +#define HB_CP_LOWER "" -#define NUMBER_OF_CHARACTERS 32 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "RU866", - HB_CPID_866, HB_UNITB_866, NUMBER_OF_CHARACTERS, - "", - "", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( RU866 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_RU866 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_RU866 = hb_codepage_Init_RU866; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpruiso.c b/harbour/src/codepage/cpruiso.c index 17b4d05e18..341d96bbec 100644 --- a/harbour/src/codepage/cpruiso.c +++ b/harbour/src/codepage/cpruiso.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): RU */ /* Codepage: ISO-8859-5 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID RUISO +#define HB_CP_INFO "Russian ISO-8859-5" +#define HB_CP_UNITB HB_UNITB_8859_5 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ϡ" +#define HB_CP_LOWER "" -#define NUMBER_OF_CHARACTERS 36 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "RUISO", - HB_CPID_8859_5, HB_UNITB_8859_5, NUMBER_OF_CHARACTERS, - "ϡ", - "", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( RUISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_RUISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_RUISO = hb_codepage_Init_RUISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cprukoi.c b/harbour/src/codepage/cprukoi.c index f022eb7eb4..5c22c0ef4c 100644 --- a/harbour/src/codepage/cprukoi.c +++ b/harbour/src/codepage/cprukoi.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): RU */ /* Codepage: KOI-8 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID RUKOI8 +#define HB_CP_INFO "Russian KOI-8" +#define HB_CP_UNITB HB_UNITB_KOI_8 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "" +#define HB_CP_LOWER "" -#define NUMBER_OF_CHARACTERS 32 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "RUKOI8", - HB_CPID_KOI_8, HB_UNITB_KOI_8, NUMBER_OF_CHARACTERS, - "", - "", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( RUKOI8 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_RUKOI8 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_RUKOI8 = hb_codepage_Init_RUKOI8; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpruwin.c b/harbour/src/codepage/cpruwin.c index b0d855c64e..be522745b2 100644 --- a/harbour/src/codepage/cpruwin.c +++ b/harbour/src/codepage/cpruwin.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): RU */ /* Codepage: Windows-1251 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID RU1251 +#define HB_CP_INFO "Russian Windows-1251" +#define HB_CP_UNITB HB_UNITB_1251 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "" +#define HB_CP_LOWER "" -#define NUMBER_OF_CHARACTERS 32 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "RU1251", - HB_CPID_1251, HB_UNITB_1251, NUMBER_OF_CHARACTERS, - "", - "", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( RU1251 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_RU1251 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_RU1251 = hb_codepage_Init_RU1251; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpsk852.c b/harbour/src/codepage/cpsk852.c index d4c6aba2eb..916854211f 100644 --- a/harbour/src/codepage/cpsk852.c +++ b/harbour/src/codepage/cpsk852.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): SK */ /* Codepage: 852 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID SK852 +#define HB_CP_INFO "Slovak CP-852" +#define HB_CP_UNITB HB_UNITB_852 +#define HB_CP_ACSORT HB_CDP_ACSORT_INTERLEAVED +#define HB_CP_UPPER "A~~BCD~.DZ..D.E~FGH.CH.I~JKL~~MN~O~~PQR~ST~U~VWXY~Z" +#define HB_CP_LOWER "a~~bcd~.dz..d.e~fgh.ch.i~jkl~~mn~o~~pqr~st~u~vwxy~z" -#define NUMBER_OF_CHARACTERS 46 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 1 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~_ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "SK852", - HB_CPID_852, HB_UNITB_852, NUMBER_OF_CHARACTERS, - "A~~BCD~.DZ..D.E~FGH.CH.I~JKL~~MN~O~~PQR~ST~U~VWXY~Z", - "a~~bcd~.dz..d.e~fgh.ch.i~jkl~~mn~o~~pqr~st~u~vwxy~z", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( SK852 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_SK852 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SK852 = hb_codepage_Init_SK852; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpskiso.c b/harbour/src/codepage/cpskiso.c index 3b235b49c0..9dd38b9474 100644 --- a/harbour/src/codepage/cpskiso.c +++ b/harbour/src/codepage/cpskiso.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): SK */ /* Codepage: ISO-8859-2 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID SKISO +#define HB_CP_INFO "Slovak ISO-8859-2" +#define HB_CP_UNITB HB_UNITB_8859_2 +#define HB_CP_ACSORT HB_CDP_ACSORT_INTERLEAVED +#define HB_CP_UPPER "A~~BCD~.DZ..D.E~FGH.CH.I~JKL~~MN~O~~PQR~ST~U~VWXY~Z" +#define HB_CP_LOWER "a~~bcd~.dz..d.e~fgh.ch.i~jkl~~mn~o~~pqr~st~u~vwxy~z" -#define NUMBER_OF_CHARACTERS 46 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 1 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "SKISO", - HB_CPID_8859_2, HB_UNITB_8859_2, NUMBER_OF_CHARACTERS, - "A~~BCD~.DZ..D.E~FGH.CH.I~JKL~~MN~O~~PQR~ST~U~VWXY~Z", - "a~~bcd~.dz..d.e~fgh.ch.i~jkl~~mn~o~~pqr~st~u~vwxy~z", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( SKISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_SKISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SKISO = hb_codepage_Init_SKISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpskkam.c b/harbour/src/codepage/cpskkam.c index 3e1191cc07..12349b9a8d 100644 --- a/harbour/src/codepage/cpskkam.c +++ b/harbour/src/codepage/cpskkam.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): SK */ /* Codepage: Kamenicky ("895") */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID SKKAM +#define HB_CP_INFO "Slovak Kamenicky (895)" +#define HB_CP_UNITB HB_UNITB_KAM +#define HB_CP_ACSORT HB_CDP_ACSORT_INTERLEAVED +#define HB_CP_UPPER "A~~BCD~.DZ..D.E~FGH.CH.I~JKL~~MN~O~~PQR~ST~U~VWXY~Z" +#define HB_CP_LOWER "a~~bcd~.dz..d.e~fgh.ch.i~jkl~~mn~o~~pqr~st~u~vwxy~z" -#define NUMBER_OF_CHARACTERS 46 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 1 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~_ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "SKKAM", - HB_CPID_KAM, HB_UNITB_KAM, NUMBER_OF_CHARACTERS, - "A~~BCD~.DZ..D.E~FGH.CH.I~JKL~~MN~O~~PQR~ST~U~VWXY~Z", - "a~~bcd~.dz..d.e~fgh.ch.i~jkl~~mn~o~~pqr~st~u~vwxy~z", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( SKKAM ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_SKKAM -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SKKAM = hb_codepage_Init_SKKAM; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpskwin.c b/harbour/src/codepage/cpskwin.c index 1c578ce933..58e7cd5eef 100644 --- a/harbour/src/codepage/cpskwin.c +++ b/harbour/src/codepage/cpskwin.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): SK */ /* Codepage: Windows-1250 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID SKWIN +#define HB_CP_INFO "Slovak Windows-1250" +#define HB_CP_UNITB HB_UNITB_1250 +#define HB_CP_ACSORT HB_CDP_ACSORT_INTERLEAVED +#define HB_CP_UPPER "A~~BCD~.DZ..D.E~FGH.CH.I~JKL~~MN~O~~PQR~ST~U~VWXY~Z" +#define HB_CP_LOWER "a~~bcd~.dz..d.e~fgh.ch.i~jkl~~mn~o~~pqr~st~u~vwxy~z" -#define NUMBER_OF_CHARACTERS 46 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 1 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 1 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "SKWIN", - HB_CPID_1250, HB_UNITB_1250, NUMBER_OF_CHARACTERS, - "A~~BCD~.DZ..D.E~FGH.CH.I~JKL~~MN~O~~PQR~ST~U~VWXY~Z", - "a~~bcd~.dz..d.e~fgh.ch.i~jkl~~mn~o~~pqr~st~u~vwxy~z", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( SKWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_SKWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SKWIN = hb_codepage_Init_SKWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpsl437.c b/harbour/src/codepage/cpsl437.c index e0095c677b..26f01e29e8 100644 --- a/harbour/src/codepage/cpsl437.c +++ b/harbour/src/codepage/cpsl437.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): SL */ /* Codepage: 437 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID SL437 +#define HB_CP_INFO "Slovenian CP-437" +#define HB_CP_UNITB HB_UNITB_437 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABC^]D\\EFGHIJKLMNOPQRS[TUVWZ@XY" +#define HB_CP_LOWER "abc~}d|efghijklmnopqrs{tuvwz`xy" -#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "SL437", - HB_CPID_437, HB_UNITB_437, NUMBER_OF_CHARACTERS, - "ABC^]D\\EFGHIJKLMNOPQRS[TUVWZ@XY", - "abc~}d|efghijklmnopqrs{tuvwz`xy", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( SL437 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_SL437 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SL437 = hb_codepage_Init_SL437; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpsl852.c b/harbour/src/codepage/cpsl852.c index e6818b91a9..63a7adac7b 100644 --- a/harbour/src/codepage/cpsl852.c +++ b/harbour/src/codepage/cpsl852.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): SL */ /* Codepage: 852 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID SL852 +#define HB_CP_INFO "Slovenian CP-852" +#define HB_CP_UNITB HB_UNITB_852 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWZXY" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwzxy" -#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "SL852", - HB_CPID_852, HB_UNITB_852, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWZXY", - "abcdefghijklmnopqrstuvwzxy", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( SL852 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_SL852 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SL852 = hb_codepage_Init_SL852; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpsliso.c b/harbour/src/codepage/cpsliso.c index a0d4f2bbc7..47523ede0a 100644 --- a/harbour/src/codepage/cpsliso.c +++ b/harbour/src/codepage/cpsliso.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): SL */ /* Codepage: ISO-8859-2 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID SLISO +#define HB_CP_INFO "Slovenian ISO-8859-2" +#define HB_CP_UNITB HB_UNITB_8859_2 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWZXY" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwzxy" -#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "SLISO", - HB_CPID_8859_2, HB_UNITB_8859_2, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWZXY", - "abcdefghijklmnopqrstuvwzxy", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( SLISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_SLISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SLISO = hb_codepage_Init_SLISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpslwin.c b/harbour/src/codepage/cpslwin.c index d164dbe5c4..dae17365da 100644 --- a/harbour/src/codepage/cpslwin.c +++ b/harbour/src/codepage/cpslwin.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): SL */ /* Codepage: 1250 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID SLWIN +#define HB_CP_INFO "Slovenian CP-1250" +#define HB_CP_UNITB HB_UNITB_1250 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWZXY" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwzxy" -#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "SLWIN", - HB_CPID_1250, HB_UNITB_1250, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWZXY", - "abcdefghijklmnopqrstuvwzxy", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( SLWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_SLWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SLWIN = hb_codepage_Init_SLWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpsrwin.c b/harbour/src/codepage/cpsrwin.c index 637d215437..53aacafda5 100644 --- a/harbour/src/codepage/cpsrwin.c +++ b/harbour/src/codepage/cpsrwin.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): SR */ /* Codepage: Windows-1251 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID SRWIN +#define HB_CP_INFO "Serbian Windows-1251" +#define HB_CP_UNITB HB_UNITB_1251 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "Āȣˊ͌Ҏ׏" +#define HB_CP_LOWER "" -#define NUMBER_OF_CHARACTERS 30 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "SRWIN", - HB_CPID_1251, HB_UNITB_1251, NUMBER_OF_CHARACTERS, - "Āȣˊ͌Ҏ׏", - "", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( SRWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_SRWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SRWIN = hb_codepage_Init_SRWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpsv850.c b/harbour/src/codepage/cpsv850.c index 1cce89c553..da1d9310c9 100644 --- a/harbour/src/codepage/cpsv850.c +++ b/harbour/src/codepage/cpsv850.c @@ -54,56 +54,12 @@ /* ISO language code (2 chars): SV */ /* Codepage: 850 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID SV850 +#define HB_CP_INFO "Swedish CP-850" +#define HB_CP_UNITB HB_UNITB_850 +#define HB_CP_ACSORT HB_CDP_ACSORT_INTERLEAVED +#define HB_CP_UPPER "A~~~~BC~DE~~~~FGHI~~~~JKLMN~O~~~~PQRSTU~~~V~WXY~~Z~~" +#define HB_CP_LOWER "a~~~~bc~de~~~~fghi~~~~jklmn~o~~~~pqrstu~~~v~wxy~~z~~" -#define NUMBER_OF_CHARACTERS 54 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 1 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -/* NOTE: The collation sequence below is compatible with the collation rules - described in the book "Svenska skrivregler" (Swedish Writing Rules) by - Svenska Sprknamnden (the Swedish Language Council). It is NOT Clipper - compatible. If you need to share data between Harbour and Clipper, use - the SVCLIP version instead. - */ - -static HB_CODEPAGE s_codepage = { "SV850", - HB_CPID_850,HB_UNITB_850,NUMBER_OF_CHARACTERS, - "A~~~~BC~DE~~~~FGHI~~~~JKLMN~O~~~~PQRSTU~~~V~WXY~~Z~~", - "a~~~~bc~de~~~~fghi~~~~jklmn~o~~~~pqrstu~~~v~wxy~~z~~", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( SV850 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_SV850 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SV850 = hb_codepage_Init_SV850; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpsvclip.c b/harbour/src/codepage/cpsvclip.c index b6bfd364ed..b4ae206751 100644 --- a/harbour/src/codepage/cpsvclip.c +++ b/harbour/src/codepage/cpsvclip.c @@ -54,34 +54,6 @@ /* ISO language code (2 chars): SV */ /* Codepage: 437 */ -#include "hbapi.h" -#include "hbapicdp.h" - -#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - /* NOTE: The collation sequence below is almost compatible with Clipper's NTXSWE.OBJ which does NOT provide a correct Swedish collation. The most notable error in NTXSWE.OBJ is the uppercase E with an acute accent @@ -104,21 +76,12 @@ not be Clipper compatible. */ -static HB_CODEPAGE s_codepage = { "SVCLIP", - HB_CPID_437,HB_UNITB_437,NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; +#define HB_CP_ID SVCLIP +#define HB_CP_INFO "Swedish CP-437" +#define HB_CP_UNITB HB_UNITB_437 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" -HB_CODEPAGE_INIT( SVCLIP ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_SVCLIP -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SVCLIP = hb_codepage_Init_SVCLIP; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpsviso.c b/harbour/src/codepage/cpsviso.c index 59c7285922..1b64c2a17a 100644 --- a/harbour/src/codepage/cpsviso.c +++ b/harbour/src/codepage/cpsviso.c @@ -55,49 +55,12 @@ /* ISO language code (2 chars): SV */ /* Codepage: ISO-8859-1 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID SVISO +#define HB_CP_INFO "Swedish ISO-8859-1" +#define HB_CP_UNITB HB_UNITB_8859_1 +#define HB_CP_ACSORT HB_CDP_ACSORT_INTERLEAVED +#define HB_CP_UPPER "A~~~~BC~D~E~~~~FGHI~~~~JKLMN~O~~~~PQRSTU~~~V~WXY~~~Z~~~" +#define HB_CP_LOWER "a~~~~bc~d~e~~~~fghi~~~~jklmn~o~~~~pqrstu~~~v~wxy~~~z~~~" -#define NUMBER_OF_CHARACTERS 57 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 1 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "SVISO", - HB_CPID_8859_1,HB_UNITB_8859_1,NUMBER_OF_CHARACTERS, - "A~~~~BC~D~E~~~~FGHI~~~~JKLMN~O~~~~PQRSTU~~~V~WXY~~~Z~~~", - "a~~~~bc~d~e~~~~fghi~~~~jklmn~o~~~~pqrstu~~~v~wxy~~~z~~~", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( SVISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_SVISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SVISO = hb_codepage_Init_SVISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpsvwin.c b/harbour/src/codepage/cpsvwin.c index 699dc8b00c..3d5d66a72c 100644 --- a/harbour/src/codepage/cpsvwin.c +++ b/harbour/src/codepage/cpsvwin.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): SV */ /* Codepage: Windows-1252 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID SVWIN +#define HB_CP_INFO "Swedish Windows-1252" +#define HB_CP_UNITB HB_UNITB_1252 +#define HB_CP_ACSORT HB_CDP_ACSORT_INTERLEAVED +#define HB_CP_UPPER "A~~~~BC~D~E~~~~FGHI~~~~JKLMN~O~~~~PQRSTU~~~V~WXY~~~Z~~~" +#define HB_CP_LOWER "a~~~~bc~d~e~~~~fghi~~~~jklmn~o~~~~pqrstu~~~v~wxy~~~z~~~" -#define NUMBER_OF_CHARACTERS 57 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 1 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "SVWIN", - HB_CPID_1252,HB_UNITB_1252,NUMBER_OF_CHARACTERS, - "A~~~~BC~D~E~~~~FGHI~~~~JKLMN~O~~~~PQRSTU~~~V~WXY~~~Z~~~", - "a~~~~bc~d~e~~~~fghi~~~~jklmn~o~~~~pqrstu~~~v~wxy~~~z~~~", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( SVWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_SVWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SVWIN = hb_codepage_Init_SVWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cptr857.c b/harbour/src/codepage/cptr857.c index ac82b5e740..1e1b736650 100644 --- a/harbour/src/codepage/cptr857.c +++ b/harbour/src/codepage/cptr857.c @@ -54,49 +54,12 @@ /* ISO language code TR : ( please look it up in /doc/lang_id.txt ) */ /* Codepage: 857 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID TR857 +#define HB_CP_INFO "Turkish CP-857" +#define HB_CP_UNITB HB_UNITB_857 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPRSTUVYZ" +#define HB_CP_LOWER "abcdefghijklmnoprstuvyz" -#define NUMBER_OF_CHARACTERS 34 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "TR857", - HB_CPID_857,HB_UNITB_857,NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPRSTUVYZ", - "abcdefghijklmnoprstuvyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( TR857 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_TR857 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_TR857 = hb_codepage_Init_TR857; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cptriso.c b/harbour/src/codepage/cptriso.c index b031edab51..51d8e6e651 100644 --- a/harbour/src/codepage/cptriso.c +++ b/harbour/src/codepage/cptriso.c @@ -54,49 +54,12 @@ /* ISO language code TR : (please look it up in /doc/lang_id.txt) */ /* Codepage: ISO-8859-9 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID TRISO +#define HB_CP_INFO "Turkish ISO-8859-9" +#define HB_CP_UNITB HB_UNITB_8859_9 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPRSTUVYZ" +#define HB_CP_LOWER "abcdefghijklmnoprstuvyz" -#define NUMBER_OF_CHARACTERS 34 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "TRISO", - HB_CPID_8859_9, HB_UNITB_8859_9, NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPRSTUVYZ", - "abcdefghijklmnoprstuvyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( TRISO ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_TRISO -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_TRISO = hb_codepage_Init_TRISO; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cptrwin.c b/harbour/src/codepage/cptrwin.c index 93c6ce886e..940e8b6d04 100644 --- a/harbour/src/codepage/cptrwin.c +++ b/harbour/src/codepage/cptrwin.c @@ -54,49 +54,12 @@ /* ISO language code TR : (please look it up in /doc/lang_id.txt) */ /* Codepage: 1254 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID TRWIN +#define HB_CP_INFO "Turkish Windows-1254" +#define HB_CP_UNITB HB_UNITB_1254 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "ABCDEFGHIJKLMNOPRSTUVYZ" +#define HB_CP_LOWER "abcdefghijklmnoprstuvyz" -#define NUMBER_OF_CHARACTERS 34 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 1 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "TRWIN", - HB_CPID_1254,HB_UNITB_1254,NUMBER_OF_CHARACTERS, - "ABCDEFGHIJKLMNOPRSTUVYZ", - "abcdefghijklmnoprstuvyz", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( TRWIN ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_TRWIN -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_TRWIN = hb_codepage_Init_TRWIN; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpua1125.c b/harbour/src/codepage/cpua1125.c index 202bd174dc..503a2e1f10 100644 --- a/harbour/src/codepage/cpua1125.c +++ b/harbour/src/codepage/cpua1125.c @@ -54,50 +54,12 @@ /* ISO language code (2 chars): UA */ /* Codepage: 1125 */ -#include "hbapi.h" -#include "hbapicdp.h" - -#define NUMBER_OF_CHARACTERS 37 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "UA1125", - HB_CPID_1125, HB_UNITB_1125, NUMBER_OF_CHARACTERS, - "􆇈", - "", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( UA1125 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_UA1125 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_UA1125 = hb_codepage_Init_UA1125; - #pragma data_seg() -#endif +#define HB_CP_ID UA1125 +#define HB_CP_INFO "Ukrainian CP-1125" +#define HB_CP_UNITB HB_UNITB_1125 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "􆇈" +#define HB_CP_LOWER "" +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpua866.c b/harbour/src/codepage/cpua866.c index 73d85bd352..395b9938c1 100644 --- a/harbour/src/codepage/cpua866.c +++ b/harbour/src/codepage/cpua866.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): UA */ /* Codepage: 866 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID UA866 +#define HB_CP_INFO "Ukrainian CP-866" +#define HB_CP_UNITB HB_UNITB_866 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "򆇈I􉊋" +#define HB_CP_LOWER "󦧨i" -#define NUMBER_OF_CHARACTERS 37 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "UA866", - HB_CPID_866, HB_UNITB_866, NUMBER_OF_CHARACTERS, - "򆇈I􉊋", - "󦧨i", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( UA866 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_UA866 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_UA866 = hb_codepage_Init_UA866; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpuakoi.c b/harbour/src/codepage/cpuakoi.c index 424294ea1a..8ef6bc9f98 100644 --- a/harbour/src/codepage/cpuakoi.c +++ b/harbour/src/codepage/cpuakoi.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): UA */ /* Codepage: KOI8-U */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID UAKOI8 +#define HB_CP_INFO "Ukrainian KOI8-U" +#define HB_CP_UNITB HB_UNITB_KOI_8U +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "峴鶷" +#define HB_CP_LOWER "ǭţɦ" -#define NUMBER_OF_CHARACTERS 37 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "UAKOI8", - HB_CPID_KOI_8U, HB_UNITB_KOI_8U, NUMBER_OF_CHARACTERS, - "峴鶷", - "ǭţɦ", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( UAKOI8 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_UAKOI8 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_UAKOI8 = hb_codepage_Init_UAKOI8; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpuawin.c b/harbour/src/codepage/cpuawin.c index 852538f5cb..81f733990f 100644 --- a/harbour/src/codepage/cpuawin.c +++ b/harbour/src/codepage/cpuawin.c @@ -54,49 +54,12 @@ /* ISO language code (2 chars): UA */ /* Codepage: Windows-1251 */ -#include "hbapi.h" -#include "hbapicdp.h" +#define HB_CP_ID UA1251 +#define HB_CP_INFO "Ukrainian Windows-1251" +#define HB_CP_UNITB HB_UNITB_1251 +#define HB_CP_ACSORT HB_CDP_ACSORT_NONE +#define HB_CP_UPPER "åŨȲ" +#define HB_CP_LOWER "帺賿" -#define NUMBER_OF_CHARACTERS 37 /* The number of single characters in the - alphabet, two-as-one aren't considered - here, accented - are considered. */ -#define IS_LATIN 0 /* Should be 1, if the national alphabet - is based on Latin */ -#define ACCENTED_EQUAL 0 /* Should be 1, if accented character - has the same weight as appropriate - unaccented. */ -#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters - sort after their unaccented counterparts - only if the unaccented versions of all - characters being compared are the same - ( interleaving ) */ - -/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the - accented characters with the symbol '~' before each of them, for example: - a~ - If there is two-character sequence, which is considered as one, it should - be marked with '.' before and after it, for example: - ... h.ch.i ... - - The Upper case string and the Lower case string should be absolutely the - same excepting the characters case, of course. - */ - -static HB_CODEPAGE s_codepage = { "UA1251", - HB_CPID_1251, HB_UNITB_1251, NUMBER_OF_CHARACTERS, - "åŨȲ", - "帺賿", - IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_INIT( UA1251 ) - -#if defined( HB_PRAGMA_STARTUP ) - #pragma startup hb_codepage_Init_UA1251 -#elif defined( HB_MSC_STARTUP ) - #if defined( HB_OS_WIN_64 ) - #pragma section( HB_MSC_START_SEGMENT, long, read ) - #endif - #pragma data_seg( HB_MSC_START_SEGMENT ) - static HB_$INITSYM hb_vm_auto_hb_codepage_Init_UA1251 = hb_codepage_Init_UA1251; - #pragma data_seg() -#endif +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/uc037.c b/harbour/src/codepage/uc037.c index cfb6be08f2..fbbf768e75 100644 --- a/harbour/src/codepage/uc037.c +++ b/harbour/src/codepage/uc037.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0038, 0x0039, 0x00B3, 0x00DB, 0x00DC, 0x00D9, 0x00DA, 0x009F }; -HB_UNITABLE hb_uniTbl_037 = { HB_CPID_037, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_037 = { HB_CPID_037, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc1006.c b/harbour/src/codepage/uc1006.c index dd94bc19c3..ccc41fca5d 100644 --- a/harbour/src/codepage/uc1006.c +++ b/harbour/src/codepage/uc1006.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0xFE8B, 0xFEF1, 0xFEF2, 0xFEF3, 0xFBB0, 0xFBAE, 0xFE7C, 0xFE7D }; -HB_UNITABLE hb_uniTbl_1006 = { HB_CPID_1006, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_1006 = { HB_CPID_1006, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc1026.c b/harbour/src/codepage/uc1026.c index 023d771377..b839770f56 100644 --- a/harbour/src/codepage/uc1026.c +++ b/harbour/src/codepage/uc1026.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0038, 0x0039, 0x00B3, 0x00DB, 0x0022, 0x00D9, 0x00DA, 0x009F }; -HB_UNITABLE hb_uniTbl_1026 = { HB_CPID_1026, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_1026 = { HB_CPID_1026, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc1125.c b/harbour/src/codepage/uc1125.c index aa28c07712..dad5572bfb 100644 --- a/harbour/src/codepage/uc1125.c +++ b/harbour/src/codepage/uc1125.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0407, 0x0457, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_1125 = { HB_CPID_1125, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_1125 = { HB_CPID_1125, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc1250.c b/harbour/src/codepage/uc1250.c index 5ff1d921d3..c32f3717e0 100644 --- a/harbour/src/codepage/uc1250.c +++ b/harbour/src/codepage/uc1250.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 }; -HB_UNITABLE hb_uniTbl_1250 = { HB_CPID_1250, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_1250 = { HB_CPID_1250, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc1251.c b/harbour/src/codepage/uc1251.c index ef24331f47..8cd4d36c9e 100644 --- a/harbour/src/codepage/uc1251.c +++ b/harbour/src/codepage/uc1251.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F }; -HB_UNITABLE hb_uniTbl_1251 = { HB_CPID_1251, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_1251 = { HB_CPID_1251, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc1252.c b/harbour/src/codepage/uc1252.c index 31922018d1..02edeff70b 100644 --- a/harbour/src/codepage/uc1252.c +++ b/harbour/src/codepage/uc1252.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF }; -HB_UNITABLE hb_uniTbl_1252 = { HB_CPID_1252, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_1252 = { HB_CPID_1252, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc1253.c b/harbour/src/codepage/uc1253.c index f866d560c6..365a44192c 100644 --- a/harbour/src/codepage/uc1253.c +++ b/harbour/src/codepage/uc1253.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x00FF }; -HB_UNITABLE hb_uniTbl_1253 = { HB_CPID_1253, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_1253 = { HB_CPID_1253, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc1254.c b/harbour/src/codepage/uc1254.c index 2e915447ee..8125e92755 100644 --- a/harbour/src/codepage/uc1254.c +++ b/harbour/src/codepage/uc1254.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF }; -HB_UNITABLE hb_uniTbl_1254 = { HB_CPID_1254, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_1254 = { HB_CPID_1254, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc1255.c b/harbour/src/codepage/uc1255.c index 140418fd80..e26a11dd27 100644 --- a/harbour/src/codepage/uc1255.c +++ b/harbour/src/codepage/uc1255.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x05E8, 0x05E9, 0x05EA, 0x0000, 0x0000, 0x200E, 0x200F, 0x0000 }; -HB_UNITABLE hb_uniTbl_1255 = { HB_CPID_1255, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_1255 = { HB_CPID_1255, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc1256.c b/harbour/src/codepage/uc1256.c index 831b6fe8bb..10700cf1e1 100644 --- a/harbour/src/codepage/uc1256.c +++ b/harbour/src/codepage/uc1256.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2 }; -HB_UNITABLE hb_uniTbl_1256 = { HB_CPID_1256, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_1256 = { HB_CPID_1256, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc1257.c b/harbour/src/codepage/uc1257.c index 3e7119d542..1014a9dc5f 100644 --- a/harbour/src/codepage/uc1257.c +++ b/harbour/src/codepage/uc1257.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9 }; -HB_UNITABLE hb_uniTbl_1257 = { HB_CPID_1257, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_1257 = { HB_CPID_1257, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc1258.c b/harbour/src/codepage/uc1258.c index 4e4b7de020..546588e52f 100644 --- a/harbour/src/codepage/uc1258.c +++ b/harbour/src/codepage/uc1258.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF }; -HB_UNITABLE hb_uniTbl_1258 = { HB_CPID_1258, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_1258 = { HB_CPID_1258, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc424.c b/harbour/src/codepage/uc424.c index 5599f34f8c..6d667cecb3 100644 --- a/harbour/src/codepage/uc424.c +++ b/harbour/src/codepage/uc424.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0038, 0x0039, 0x00B3, 0x0000, 0x0000, 0x0000, 0x0000, 0x009F }; -HB_UNITABLE hb_uniTbl_424 = { HB_CPID_424, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_424 = { HB_CPID_424, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc500.c b/harbour/src/codepage/uc500.c index 7934ad4ca4..34d6531fbb 100644 --- a/harbour/src/codepage/uc500.c +++ b/harbour/src/codepage/uc500.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0038, 0x0039, 0x00B3, 0x00DB, 0x00DC, 0x00D9, 0x00DA, 0x009F }; -HB_UNITABLE hb_uniTbl_500 = { HB_CPID_500, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_500 = { HB_CPID_500, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc737.c b/harbour/src/codepage/uc737.c index afbf7a6939..a17e4a9acf 100644 --- a/harbour/src/codepage/uc737.c +++ b/harbour/src/codepage/uc737.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_737 = { HB_CPID_737, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_737 = { HB_CPID_737, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc775.c b/harbour/src/codepage/uc775.c index a421f47abb..39e22d5f7f 100644 --- a/harbour/src/codepage/uc775.c +++ b/harbour/src/codepage/uc775.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x2219, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_775 = { HB_CPID_775, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_775 = { HB_CPID_775, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc850.c b/harbour/src/codepage/uc850.c index f1bec15b32..99d9b00e33 100644 --- a/harbour/src/codepage/uc850.c +++ b/harbour/src/codepage/uc850.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_850 = { HB_CPID_850, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_850 = { HB_CPID_850, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc852.c b/harbour/src/codepage/uc852.c index 3594378579..1470c5f965 100644 --- a/harbour/src/codepage/uc852.c +++ b/harbour/src/codepage/uc852.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x00A8, 0x02D9, 0x0171, 0x0158, 0x0159, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_852 = { HB_CPID_852, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_852 = { HB_CPID_852, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc855.c b/harbour/src/codepage/uc855.c index 17271866a2..9d55dc2569 100644 --- a/harbour/src/codepage/uc855.c +++ b/harbour/src/codepage/uc855.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x042D, 0x0449, 0x0429, 0x0447, 0x0427, 0x00A7, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_855 = { HB_CPID_855, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_855 = { HB_CPID_855, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc856.c b/harbour/src/codepage/uc856.c index b8de1fd4fb..3bf5d66043 100644 --- a/harbour/src/codepage/uc856.c +++ b/harbour/src/codepage/uc856.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_856 = { HB_CPID_856, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_856 = { HB_CPID_856, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc857.c b/harbour/src/codepage/uc857.c index 031b8af9ac..7b1881762c 100644 --- a/harbour/src/codepage/uc857.c +++ b/harbour/src/codepage/uc857.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_857 = { HB_CPID_857, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_857 = { HB_CPID_857, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc860.c b/harbour/src/codepage/uc860.c index 630d4a279d..93767177ee 100644 --- a/harbour/src/codepage/uc860.c +++ b/harbour/src/codepage/uc860.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_860 = { HB_CPID_860, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_860 = { HB_CPID_860, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc861.c b/harbour/src/codepage/uc861.c index 88b107121d..7eaa38b12b 100644 --- a/harbour/src/codepage/uc861.c +++ b/harbour/src/codepage/uc861.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_861 = { HB_CPID_861, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_861 = { HB_CPID_861, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc862.c b/harbour/src/codepage/uc862.c index 68e5e4f8a2..acc20e9e4b 100644 --- a/harbour/src/codepage/uc862.c +++ b/harbour/src/codepage/uc862.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_862 = { HB_CPID_862, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_862 = { HB_CPID_862, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc863.c b/harbour/src/codepage/uc863.c index a7c09de143..524880db48 100644 --- a/harbour/src/codepage/uc863.c +++ b/harbour/src/codepage/uc863.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_863 = { HB_CPID_863, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_863 = { HB_CPID_863, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc864.c b/harbour/src/codepage/uc864.c index 3534b52451..843cb27c16 100644 --- a/harbour/src/codepage/uc864.c +++ b/harbour/src/codepage/uc864.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0xFED5, 0xFEF5, 0xFEF6, 0xFEDD, 0xFED9, 0xFEF1, 0x25A0, 0x0000 }; -HB_UNITABLE hb_uniTbl_864 = { HB_CPID_864, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_864 = { HB_CPID_864, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc865.c b/harbour/src/codepage/uc865.c index 7b6168cab3..12632b65a8 100644 --- a/harbour/src/codepage/uc865.c +++ b/harbour/src/codepage/uc865.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_865 = { HB_CPID_865, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_865 = { HB_CPID_865, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc866.c b/harbour/src/codepage/uc866.c index 6c05729c05..55570c553b 100644 --- a/harbour/src/codepage/uc866.c +++ b/harbour/src/codepage/uc866.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_866 = { HB_CPID_866, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_866 = { HB_CPID_866, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc869.c b/harbour/src/codepage/uc869.c index a3f8563368..d2e329d86c 100644 --- a/harbour/src/codepage/uc869.c +++ b/harbour/src/codepage/uc869.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x00A8, 0x03C9, 0x03CB, 0x03B0, 0x03CE, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_869 = { HB_CPID_869, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_869 = { HB_CPID_869, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc874.c b/harbour/src/codepage/uc874.c index 3462b3a7ba..c710f2416d 100644 --- a/harbour/src/codepage/uc874.c +++ b/harbour/src/codepage/uc874.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0x0000, 0x0000, 0x0000, 0x0000 }; -HB_UNITABLE hb_uniTbl_874 = { HB_CPID_874, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_874 = { HB_CPID_874, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc875.c b/harbour/src/codepage/uc875.c index 227b0be6c2..4f10de5047 100644 --- a/harbour/src/codepage/uc875.c +++ b/harbour/src/codepage/uc875.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0038, 0x0039, 0x00B3, 0x00A9, 0x001A, 0x001A, 0x00BB, 0x009F }; -HB_UNITABLE hb_uniTbl_875 = { HB_CPID_875, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_875 = { HB_CPID_875, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc885910.c b/harbour/src/codepage/uc885910.c index 33e87f7c74..6220669d34 100644 --- a/harbour/src/codepage/uc885910.c +++ b/harbour/src/codepage/uc885910.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138 }; -HB_UNITABLE hb_uniTbl_8859_10 = { HB_CPID_8859_10, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_10 = { HB_CPID_8859_10, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc885911.c b/harbour/src/codepage/uc885911.c index 893a6ef4c6..7a1df66129 100644 --- a/harbour/src/codepage/uc885911.c +++ b/harbour/src/codepage/uc885911.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0x0000, 0x0000, 0x0000, 0x0000 }; -HB_UNITABLE hb_uniTbl_8859_11 = { HB_CPID_8859_11, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_11 = { HB_CPID_8859_11, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc885913.c b/harbour/src/codepage/uc885913.c index cb4adb59b2..4c339b9a5d 100644 --- a/harbour/src/codepage/uc885913.c +++ b/harbour/src/codepage/uc885913.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019 }; -HB_UNITABLE hb_uniTbl_8859_13 = { HB_CPID_8859_13, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_13 = { HB_CPID_8859_13, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc885914.c b/harbour/src/codepage/uc885914.c index a2853d354c..a4cb2520e4 100644 --- a/harbour/src/codepage/uc885914.c +++ b/harbour/src/codepage/uc885914.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF }; -HB_UNITABLE hb_uniTbl_8859_14 = { HB_CPID_8859_14, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_14 = { HB_CPID_8859_14, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc885915.c b/harbour/src/codepage/uc885915.c index 77401deccf..4bc1b174c2 100644 --- a/harbour/src/codepage/uc885915.c +++ b/harbour/src/codepage/uc885915.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF }; -HB_UNITABLE hb_uniTbl_8859_15 = { HB_CPID_8859_15, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_15 = { HB_CPID_8859_15, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc885916.c b/harbour/src/codepage/uc885916.c index 3126fb5cc1..e5e023eb9c 100644 --- a/harbour/src/codepage/uc885916.c +++ b/harbour/src/codepage/uc885916.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0171, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0119, 0x021B, 0x00FF }; -HB_UNITABLE hb_uniTbl_8859_16 = { HB_CPID_8859_16, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_16 = { HB_CPID_8859_16, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc88591b.c b/harbour/src/codepage/uc88591b.c index 33a72e9707..ba503a1084 100644 --- a/harbour/src/codepage/uc88591b.c +++ b/harbour/src/codepage/uc88591b.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF }; -HB_UNITABLE hb_uniTbl_8859_1b = { HB_CPID_8859_1B, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_1b = { HB_CPID_8859_1B, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc8859_1.c b/harbour/src/codepage/uc8859_1.c index acdfcc29b5..dbf6f14b01 100644 --- a/harbour/src/codepage/uc8859_1.c +++ b/harbour/src/codepage/uc8859_1.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF }; -HB_UNITABLE hb_uniTbl_8859_1 = { HB_CPID_8859_1, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_1 = { HB_CPID_8859_1, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc8859_2.c b/harbour/src/codepage/uc8859_2.c index cdd5ac0d61..e5bfb6d46d 100644 --- a/harbour/src/codepage/uc8859_2.c +++ b/harbour/src/codepage/uc8859_2.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 }; -HB_UNITABLE hb_uniTbl_8859_2 = { HB_CPID_8859_2, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_2 = { HB_CPID_8859_2, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc8859_3.c b/harbour/src/codepage/uc8859_3.c index 327bb4e527..a740e7ac40 100644 --- a/harbour/src/codepage/uc8859_3.c +++ b/harbour/src/codepage/uc8859_3.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9 }; -HB_UNITABLE hb_uniTbl_8859_3 = { HB_CPID_8859_3, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_3 = { HB_CPID_8859_3, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc8859_4.c b/harbour/src/codepage/uc8859_4.c index e5107eaf4f..0f0e5a5635 100644 --- a/harbour/src/codepage/uc8859_4.c +++ b/harbour/src/codepage/uc8859_4.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9 }; -HB_UNITABLE hb_uniTbl_8859_4 = { HB_CPID_8859_4, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_4 = { HB_CPID_8859_4, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc8859_5.c b/harbour/src/codepage/uc8859_5.c index 92320f2544..26de5b4027 100644 --- a/harbour/src/codepage/uc8859_5.c +++ b/harbour/src/codepage/uc8859_5.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F }; -HB_UNITABLE hb_uniTbl_8859_5 = { HB_CPID_8859_5, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_5 = { HB_CPID_8859_5, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc8859_6.c b/harbour/src/codepage/uc8859_6.c index 0b5cb09f42..827a430090 100644 --- a/harbour/src/codepage/uc8859_6.c +++ b/harbour/src/codepage/uc8859_6.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; -HB_UNITABLE hb_uniTbl_8859_6 = { HB_CPID_8859_6, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_6 = { HB_CPID_8859_6, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc8859_7.c b/harbour/src/codepage/uc8859_7.c index 8e23943ac3..f2edbebf69 100644 --- a/harbour/src/codepage/uc8859_7.c +++ b/harbour/src/codepage/uc8859_7.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000 }; -HB_UNITABLE hb_uniTbl_8859_7 = { HB_CPID_8859_7, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_7 = { HB_CPID_8859_7, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc8859_8.c b/harbour/src/codepage/uc8859_8.c index 6d4641bc07..1bab62c68a 100644 --- a/harbour/src/codepage/uc8859_8.c +++ b/harbour/src/codepage/uc8859_8.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x05E8, 0x05E9, 0x05EA, 0x0000, 0x0000, 0x200E, 0x200F, 0x0000 }; -HB_UNITABLE hb_uniTbl_8859_8 = { HB_CPID_8859_8, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_8 = { HB_CPID_8859_8, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uc8859_9.c b/harbour/src/codepage/uc8859_9.c index e607e09272..95d310756d 100644 --- a/harbour/src/codepage/uc8859_9.c +++ b/harbour/src/codepage/uc8859_9.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF }; -HB_UNITABLE hb_uniTbl_8859_9 = { HB_CPID_8859_9, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_8859_9 = { HB_CPID_8859_9, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/ucascii.c b/harbour/src/codepage/ucascii.c index fefcf65b19..a4ab5ceb9f 100644 --- a/harbour/src/codepage/ucascii.c +++ b/harbour/src/codepage/ucascii.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; -HB_UNITABLE hb_uniTbl_USASCII = { HB_CPID_USASCII, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_USASCII = { HB_CPID_USASCII, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/ucatari.c b/harbour/src/codepage/ucatari.c index c060816d96..e414a270fe 100644 --- a/harbour/src/codepage/ucatari.c +++ b/harbour/src/codepage/ucatari.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x00B3, 0x00AF }; -HB_UNITABLE hb_uniTbl_ATARIST = { HB_CPID_ATARIST, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_ATARIST = { HB_CPID_ATARIST, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uckam.c b/harbour/src/codepage/uckam.c index c3c32995d1..e6fc8eb5ce 100644 --- a/harbour/src/codepage/uckam.c +++ b/harbour/src/codepage/uckam.c @@ -51,12 +51,13 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +/* TOFIX: it's Mazovia CP not Kamenicky */ + +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -74,12 +75,12 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 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, + 0x010C, 0x00FC, 0x00E9, 0x010F, 0x00E4, 0x010E, 0x0164, 0x010D, + 0x011B, 0x011A, 0x0139, 0x00CD, 0x013E, 0x013A, 0x00C4, 0x00C1, + 0x00C9, 0x017E, 0x017D, 0x00F4, 0x00F6, 0x00D3, 0x016F, 0x00DA, + 0x00FD, 0x00D6, 0x00DC, 0x0160, 0x013D, 0x00DD, 0x0158, 0x0165, + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x0148, 0x0147, 0x016E, 0x00D4, + 0x0161, 0x0159, 0x0155, 0x0154, 0x00BC, 0x00A7, 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, @@ -92,4 +93,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_kamenicky = { HB_CPID_KAM, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_kamenicky = { HB_CPID_KAM, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uckoi8.c b/harbour/src/codepage/uckoi8.c index 4e2201332e..8a926b2b21 100644 --- a/harbour/src/codepage/uckoi8.c +++ b/harbour/src/codepage/uckoi8.c @@ -51,12 +51,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -92,4 +91,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A }; -HB_UNITABLE hb_uniTbl_KOI_8 = { HB_CPID_KOI_8, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_KOI_8 = { HB_CPID_KOI_8, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/uckoi8u.c b/harbour/src/codepage/uckoi8u.c index 8a4dfdc64d..b1469c248a 100644 --- a/harbour/src/codepage/uckoi8u.c +++ b/harbour/src/codepage/uckoi8u.c @@ -51,12 +51,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -92,4 +91,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A }; -HB_UNITABLE hb_uniTbl_KOI_8U = { HB_CPID_KOI_8U, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_KOI_8U = { HB_CPID_KOI_8U, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/ucmacce.c b/harbour/src/codepage/ucmacce.c index 10204b96bf..08799dab26 100644 --- a/harbour/src/codepage/ucmacce.c +++ b/harbour/src/codepage/ucmacce.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00DD, 0x00FD, 0x0137, 0x017B, 0x0141, 0x017C, 0x0122, 0x02C7 }; -HB_UNITABLE hb_uniTbl_10029 = { HB_CPID_10029, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_10029 = { HB_CPID_10029, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/ucmaccyr.c b/harbour/src/codepage/ucmaccyr.c index 1c21c3c73b..99d04d3d71 100644 --- a/harbour/src/codepage/ucmaccyr.c +++ b/harbour/src/codepage/ucmaccyr.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x00A4 }; -HB_UNITABLE hb_uniTbl_10007 = { HB_CPID_10007, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_10007 = { HB_CPID_10007, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/ucmacgrk.c b/harbour/src/codepage/ucmacgrk.c index 77d15fc0c5..fad1473096 100644 --- a/harbour/src/codepage/ucmacgrk.c +++ b/harbour/src/codepage/ucmacgrk.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x03C7, 0x03C5, 0x03B6, 0x03CA, 0x03CB, 0x0390, 0x03B0, 0x0000 }; -HB_UNITABLE hb_uniTbl_10006 = { HB_CPID_10006, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_10006 = { HB_CPID_10006, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/ucmacice.c b/harbour/src/codepage/ucmacice.c index 1540c09616..d0ff15b7d6 100644 --- a/harbour/src/codepage/ucmacice.c +++ b/harbour/src/codepage/ucmacice.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 }; -HB_UNITABLE hb_uniTbl_10079 = { HB_CPID_10079, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_10079 = { HB_CPID_10079, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/ucmacrom.c b/harbour/src/codepage/ucmacrom.c index 8d1fe96459..8ae220b0df 100644 --- a/harbour/src/codepage/ucmacrom.c +++ b/harbour/src/codepage/ucmacrom.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 }; -HB_UNITABLE hb_uniTbl_10000 = { HB_CPID_10000, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_10000 = { HB_CPID_10000, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/ucmactrk.c b/harbour/src/codepage/ucmactrk.c index 3889da6bf9..0ae51e9a03 100644 --- a/harbour/src/codepage/ucmactrk.c +++ b/harbour/src/codepage/ucmactrk.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 }; -HB_UNITABLE hb_uniTbl_10081 = { HB_CPID_10081, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_10081 = { HB_CPID_10081, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/ucmaz.c b/harbour/src/codepage/ucmaz.c index 1615569739..ee2f8a594c 100644 --- a/harbour/src/codepage/ucmaz.c +++ b/harbour/src/codepage/ucmaz.c @@ -51,12 +51,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -92,4 +91,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_mazovia = { HB_CPID_MAZ, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_mazovia = { HB_CPID_MAZ, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/ucmik.c b/harbour/src/codepage/ucmik.c index 921053d7c4..ac5b5ca7b4 100644 --- a/harbour/src/codepage/ucmik.c +++ b/harbour/src/codepage/ucmik.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_MIK = { HB_CPID_MIK, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_MIK = { HB_CPID_MIK, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/codepage/ucnext.c b/harbour/src/codepage/ucnext.c index 364e76daa9..0da6156a5f 100644 --- a/harbour/src/codepage/ucnext.c +++ b/harbour/src/codepage/ucnext.c @@ -50,12 +50,11 @@ * */ -#include "hbapi.h" #include "hbapicdp.h" #define NUMBER_OF_CHARS 256 -static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = +static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = { 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, @@ -91,4 +90,4 @@ static HB_WCHAR uniCodes[ NUMBER_OF_CHARS ] = 0x0142, 0x00F8, 0x0153, 0x00DF, 0x00FE, 0x00FF, 0xFFFD, 0xFFFD }; -HB_UNITABLE hb_uniTbl_NEXTSTEP = { HB_CPID_NEXTSTEP, NUMBER_OF_CHARS, FALSE, uniCodes }; +HB_UNITABLE hb_uniTbl_NEXTSTEP = { HB_CPID_NEXTSTEP, s_uniCodes, NULL, 0 }; diff --git a/harbour/src/rdd/dbfcdx/dbfcdx1.c b/harbour/src/rdd/dbfcdx/dbfcdx1.c index 59bceef451..e39c07e1c1 100644 --- a/harbour/src/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/src/rdd/dbfcdx/dbfcdx1.c @@ -226,12 +226,11 @@ static HB_ERRCODE hb_cdxErrorRT( CDXAREAP pArea, USHORT uiGenCode, USHORT uiSubC static void hb_cdxMakeSortTab( CDXAREAP pArea ) { #ifndef HB_CDP_SUPPORT_OFF - if( pArea->dbfarea.area.cdPage && pArea->dbfarea.area.cdPage->lSort && + if( pArea->dbfarea.area.cdPage && pArea->dbfarea.area.cdPage->sort && !( pArea->fSortCDP || pArea->bCdxSortTab ) ) { if( pArea->dbfarea.area.cdPage->nMulti || - pArea->dbfarea.area.cdPage->lAccEqual || - pArea->dbfarea.area.cdPage->lAccInterleave ) + pArea->dbfarea.area.cdPage->nACSort ) { pArea->fSortCDP = TRUE; } diff --git a/harbour/src/rdd/dbfnsx/dbfnsx1.c b/harbour/src/rdd/dbfnsx/dbfnsx1.c index f2d55e2771..bb5ef28c7d 100644 --- a/harbour/src/rdd/dbfnsx/dbfnsx1.c +++ b/harbour/src/rdd/dbfnsx/dbfnsx1.c @@ -871,7 +871,7 @@ static int hb_nsxValCompare( LPTAGINFO pTag, UCHAR * val1, int len1, if( iLimit > 0 ) { #ifndef HB_CDP_SUPPORT_OFF - if( pTag->pIndex->pArea->dbfarea.area.cdPage->lSort ) + if( pTag->pIndex->pArea->dbfarea.area.cdPage->sort ) iResult = hb_cdpcmp( ( const char * ) val1, ( ULONG ) iLimit, ( const char * ) val2, ( ULONG ) iLimit, pTag->pIndex->pArea->dbfarea.area.cdPage, 0 ); diff --git a/harbour/src/rdd/dbfntx/dbfntx1.c b/harbour/src/rdd/dbfntx/dbfntx1.c index 944841dd29..040825a68d 100644 --- a/harbour/src/rdd/dbfntx/dbfntx1.c +++ b/harbour/src/rdd/dbfntx/dbfntx1.c @@ -693,7 +693,7 @@ static int hb_ntxValCompare( LPTAGINFO pTag, const char* val1, int len1, if( iLimit > 0 ) { #ifndef HB_CDP_SUPPORT_OFF - if( pTag->Owner->Owner->dbfarea.area.cdPage->lSort ) + if( pTag->Owner->Owner->dbfarea.area.cdPage->sort ) iResult = hb_cdpcmp( val1, ( ULONG ) iLimit, val2, ( ULONG ) iLimit, pTag->Owner->Owner->dbfarea.area.cdPage, 0 ); else #endif diff --git a/harbour/src/rdd/hsx/hsx.c b/harbour/src/rdd/hsx/hsx.c index 7ade39b017..caf0385611 100644 --- a/harbour/src/rdd/hsx/hsx.c +++ b/harbour/src/rdd/hsx/hsx.c @@ -425,11 +425,11 @@ static int hb_hsxHashVal( int c1, int c2, int iKeyBits, if( fNoCase ) { #ifndef HB_CDP_SUPPORT_OFF - PHB_CODEPAGE cdp; - if( iFilter == 3 && ( cdp = hb_vmCDP() )->nChars ) + if( iFilter == 3 ) { - c1 = ( UCHAR ) cdp->s_upper[ c1 ]; - c2 = ( UCHAR ) cdp->s_upper[ c2 ]; + PHB_CODEPAGE cdp = hb_vmCDP(); + c1 = ( UCHAR ) cdp->upper[ c1 ]; + c2 = ( UCHAR ) cdp->upper[ c2 ]; } else #endif @@ -515,11 +515,11 @@ static int hb_hsxStrCmp( const char * pSub, ULONG ulSub, const char * pStr, ULON if( fNoCase ) { #ifndef HB_CDP_SUPPORT_OFF - PHB_CODEPAGE cdp; - if( iFilter == 3 && ( cdp = hb_vmCDP() )->nChars ) + if( iFilter == 3 ) { - c1 = ( UCHAR ) cdp->s_upper[ c1 ]; - c2 = ( UCHAR ) cdp->s_upper[ c2 ]; + PHB_CODEPAGE cdp = hb_vmCDP(); + c1 = ( UCHAR ) cdp->upper[ c1 ]; + c2 = ( UCHAR ) cdp->upper[ c2 ]; } else #endif diff --git a/harbour/src/rtl/cdpapi.c b/harbour/src/rtl/cdpapi.c index 94b473f6ad..cf71cce6c9 100644 --- a/harbour/src/rtl/cdpapi.c +++ b/harbour/src/rtl/cdpapi.c @@ -7,6 +7,7 @@ * The CodePages API * * Copyright 2002 Alexander S.Kresin + * Copyright 2009 Przemyslaw Czerpak * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify @@ -51,14 +52,21 @@ */ #include "hbapi.h" - -#ifndef HB_CDP_SUPPORT_OFF - +#include "hbvm.h" #include "hbapiitm.h" -#include "hbapicdp.h" #include "hbapierr.h" +#include "hbapicdp.h" +#include "hbthread.h" + + +/* character flags */ +#define HB_CDP_DIGIT 0x01 +#define HB_CDP_ALPHA 0x02 +#define HB_CDP_LOWER 0x04 +#define HB_CDP_UPPER 0x08 +#define HB_CDP_MULTI1 0x10 +#define HB_CDP_MULTI2 0x20 -#define HB_CDP_MAX_ 128 /* Now we are using only 16bit Unicode values so the maximum size * of single character encoded in UTF8 is 3 though ISO 10646 Universal @@ -69,6 +77,13 @@ */ #define HB_MAX_UTF8 3 + +/* MT macros */ +#define HB_CDP_LOCK hb_threadEnterCriticalSection( &s_cdpMtx ); +#define HB_CDP_UNLOCK hb_threadLeaveCriticalSection( &s_cdpMtx ); +static HB_CRITICAL_NEW( s_cdpMtx ); + + #define NUMBER_OF_CHARS 256 static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = @@ -107,49 +122,539 @@ static HB_WCHAR s_uniCodes[ NUMBER_OF_CHARS ] = 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; -HB_UNITABLE hb_uniTbl_437 = { HB_CPID_437, NUMBER_OF_CHARS, FALSE, s_uniCodes }; +HB_UNITABLE hb_uniTbl_437 = { HB_CPID_437, s_uniCodes, NULL, 0 }; static HB_CODEPAGE s_en_codepage = - { "EN", HB_CPID_437, HB_UNITB_437, 0, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; - -HB_CODEPAGE_ANNOUNCE( EN ) - -static PHB_CODEPAGE s_cdpList[HB_CDP_MAX_] = { &s_en_codepage }; + { "EN", "", HB_UNITB_437, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL }; /* pseudo codepage for translations only */ static HB_CODEPAGE s_utf8_codepage = - { "UTF8", HB_CPID_437, HB_UNITB_437, 0, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; + { "UTF8", "", HB_UNITB_437, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL }; -static int utf8Size( HB_WCHAR uc ) +HB_CODEPAGE_ANNOUNCE( EN ) + +static PHB_CODEPAGE s_cdpList = NULL; + + +/* + * basic CP functions + */ +BOOL hb_cdpIsDigit( PHB_CODEPAGE cdp, int iChar ) { - if( uc < 0x0080 ) + if( cdp ) + return ( cdp->flags[ iChar & 0x0ff ] & HB_CDP_DIGIT ) != 0; + else + return HB_ISDIGIT( iChar ); +} + +BOOL hb_cdpIsAlpha( PHB_CODEPAGE cdp, int iChar ) +{ + if( cdp ) + return ( cdp->flags[ iChar & 0x0ff ] & HB_CDP_ALPHA ) != 0; + else + return HB_ISALPHA( iChar ); +} + +BOOL hb_cdpIsLower( PHB_CODEPAGE cdp, int iChar ) +{ + if( cdp ) + return ( cdp->flags[ iChar & 0x0ff ] & HB_CDP_LOWER ) != 0; + else + return HB_ISLOWER( iChar ); +} + +BOOL hb_cdpIsUpper( PHB_CODEPAGE cdp, int iChar ) +{ + if( cdp ) + return ( cdp->flags[ iChar & 0x0ff ] & HB_CDP_UPPER ) != 0; + else + return HB_ISUPPER( iChar ); +} + +BOOL hb_charIsDigit( int iChar ) +{ + PHB_CODEPAGE cdp = hb_vmCDP(); + + if( cdp ) + return ( cdp->flags[ iChar & 0x0ff ] & HB_CDP_DIGIT ) != 0; + else + return HB_ISDIGIT( iChar ); +} + +BOOL hb_charIsAlpha( int iChar ) +{ + PHB_CODEPAGE cdp = hb_vmCDP(); + + if( cdp ) + return ( cdp->flags[ iChar & 0x0ff ] & HB_CDP_ALPHA ) != 0; + else + return HB_ISALPHA( iChar ); +} + +BOOL hb_charIsLower( int iChar ) +{ + PHB_CODEPAGE cdp = hb_vmCDP(); + + if( cdp ) + return ( cdp->flags[ iChar & 0x0ff ] & HB_CDP_LOWER ) != 0; + else + return HB_ISLOWER( iChar ); +} + +BOOL hb_charIsUpper( int iChar ) +{ + PHB_CODEPAGE cdp = hb_vmCDP(); + + if( cdp ) + return ( cdp->flags[ iChar & 0x0ff ] & HB_CDP_UPPER ) != 0; + else + return HB_ISUPPER( iChar ); +} + +int hb_charLower( int iChar ) +{ + PHB_CODEPAGE cdp = hb_vmCDP(); + + if( cdp ) + return cdp->lower[ iChar & 0x0ff ]; + else + return HB_TOLOWER( iChar ); +} + +int hb_charUpper( int iChar ) +{ + PHB_CODEPAGE cdp = hb_vmCDP(); + + if( cdp ) + return cdp->upper[ iChar & 0x0ff ]; + else + return HB_TOUPPER( iChar ); +} + +char * hb_strLower( char * szText, ULONG ulLen ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_strLower(%s, %lu)", szText, ulLen)); + + { + PHB_CODEPAGE cdp = hb_vmCDP(); + ULONG u; + + if( cdp ) + for( u = 0; u < ulLen; u++ ) + szText[ u ] = ( char ) cdp->lower[ ( unsigned char ) szText[ u ] ]; + else + for( u = 0; u < ulLen; u++ ) + szText[ u ] = HB_TOLOWER( szText[ u ] ); + } + + return szText; +} + +char * hb_strUpper( char * szText, ULONG ulLen ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_strUpper(%s, %lu)", szText, ulLen)); + + { + PHB_CODEPAGE cdp = hb_vmCDP(); + ULONG u; + + if( cdp ) + for( u = 0; u < ulLen; u++ ) + szText[ u ] = ( char ) cdp->upper[ ( unsigned char ) szText[ u ] ]; + else + for( u = 0; u < ulLen; u++ ) + szText[ u ] = HB_TOUPPER( szText[ u ] ); + } + + return szText; +} + +/* + * comparison + */ +int hb_cdpchrcmp( char cFirst, char cSecond, PHB_CODEPAGE cdp ) +{ + int n1, n2; + + if( cFirst == cSecond ) + return 0; + + if( cdp->sort ) + { + if( ( n1 = cdp->sort[ ( unsigned char ) cFirst ] ) != 0 && + ( n2 = cdp->sort[ ( unsigned char ) cSecond ] ) != 0 ) + { + if( n1 == n2 ) + { + if( cdp->acc ) + { + n1 = cdp->acc[ ( unsigned char ) cFirst ]; + n2 = cdp->acc[ ( unsigned char ) cSecond ]; + } + else + return 0; + } + return ( n1 < n2 ) ? -1 : 1; + } + } + + return ( ( unsigned char ) cFirst < ( unsigned char ) cSecond ) ? -1 : 1; +} + +static int hb_cdpMultiWeight( PHB_CODEPAGE cdp, const char *szChar ) +{ + PHB_MULTICHAR pmulti = cdp->multi; + int i; + + for( i = cdp->nMulti; i; --i, ++pmulti ) + { + if( ( szChar[ 0 ] == pmulti->cFirst[ 0 ] || + szChar[ 0 ] == pmulti->cFirst[ 1 ] ) && + ( szChar[ 1 ] == pmulti->cLast[ 0 ] || + szChar[ 1 ] == pmulti->cLast[ 1 ] ) ) + { + return ( szChar[ 0 ] == pmulti->cFirst[ 0 ] ) ? + pmulti->sortUp : pmulti->sortLo; + } + } + + return 0; +} + +int hb_cdpcmp( const char *szFirst, ULONG ulLenFirst, + const char *szSecond, ULONG ulLenSecond, + PHB_CODEPAGE cdp, BOOL fExact ) +{ + int iRet = 0, iAcc = 0, n, n1, n2; + ULONG ul, ulLen; + + ulLen = ulLenFirst < ulLenSecond ? ulLenFirst : ulLenSecond; + if( cdp->sort == NULL ) + { + iRet = memcmp( szFirst, szSecond, ulLen ); + } + else if( cdp->nMulti ) + { + for( ul = 0; ul < ulLen; ++szFirst, ++szSecond, ++ul ) + { + unsigned char u1 = ( unsigned char ) * szFirst; + unsigned char u2 = ( unsigned char ) * szSecond; + + n1 = cdp->sort[ u1 ]; + if( ( cdp->flags[ u1 ] & HB_CDP_MULTI1 ) != 0 && + ( ul < ulLenFirst - 1 ) && + ( cdp->flags[ ( unsigned char ) szFirst[ 1 ] ] & HB_CDP_MULTI2 ) != 0 ) + { + n = hb_cdpMultiWeight( cdp, szFirst ); + if( n != 0 ) + { + n1 = n; + ++szFirst; + if( --ulLenFirst < ulLen ) + ulLen = ulLenFirst; + } + } + n2 = cdp->sort[ u2 ]; + if( ( cdp->flags[ u2 ] & HB_CDP_MULTI1 ) != 0 && + ( ul < ulLenSecond - 1 ) && + ( cdp->flags[ ( unsigned char ) szSecond[ 1 ] ] & HB_CDP_MULTI2 ) != 0 ) + { + n = hb_cdpMultiWeight( cdp, szSecond ); + if( n != 0 ) + { + n2 = n; + ++szSecond; + if( --ulLenSecond < ulLen ) + ulLen = ulLenSecond; + } + } + if( n1 != n2 ) + { + if( n1 == 0 || n2 == 0 ) + /* One of characters doesn't belong to the national characters */ + iRet = ( u1 < u2 ) ? -1 : 1; + else + iRet = ( n1 < n2 ) ? -1 : 1; + break; + } + else if( u1 != u2 ) + { + if( n1 == 0 ) + { + iRet = ( u1 < u2 ) ? -1 : 1; + break; + } + if( iAcc == 0 && ( fExact || ( ulLenFirst == ulLenSecond && cdp->acc ) ) ) + { + if( cdp->acc ) + iAcc = ( cdp->acc[ u1 ] < cdp->acc[ u2 ] ) ? -1 : 1; + else + iAcc = ( u1 < u2 ) ? -1 : 1; + } + } + } + } + else + { + for( ul = 0; ul < ulLen; ++szFirst, ++szSecond, ++ul ) + { + if( *szFirst != *szSecond ) + { + if( ( n1 = ( unsigned char ) cdp->sort[ ( unsigned char ) * szFirst ] ) == 0 || + ( n2 = ( unsigned char ) cdp->sort[ ( unsigned char ) * szSecond ] ) == 0 ) + { + /* One of characters doesn't belong to the national characters */ + iRet = ( ( unsigned char ) * szFirst < ( unsigned char ) * szSecond ) ? -1 : 1; + break; + } + else if( n1 != n2 ) + { + iRet = ( n1 < n2 ) ? -1 : 1; + break; + } + if( iAcc == 0 && ( fExact || ( ulLenFirst == ulLenSecond && cdp->acc ) ) ) + { + if( cdp->acc ) + iAcc = ( cdp->acc[ ( unsigned char ) * szFirst ] < + cdp->acc[ ( unsigned char ) * szSecond ] ) ? -1 : 1; + else + iAcc = ( ( unsigned char ) * szFirst < ( unsigned char ) * szSecond ) ? -1 : 1; + } + } + } + } + + if( !iRet ) + { + if( iAcc ) + iRet = iAcc; + else if( ulLenSecond > ulLenFirst ) + iRet = -1; + else if( fExact && ulLenSecond < ulLenFirst ) + iRet = 1; + } + + return iRet; +} + +static int hb_cdpMultiWeightI( PHB_CODEPAGE cdp, const char *szChar ) +{ + PHB_MULTICHAR pmulti = cdp->multi; + int i; + + for( i = cdp->nMulti; i; --i, ++pmulti ) + { + if( ( szChar[ 0 ] == pmulti->cFirst[ 0 ] || + szChar[ 0 ] == pmulti->cFirst[ 1 ] ) && + ( szChar[ 1 ] == pmulti->cLast[ 0 ] || + szChar[ 1 ] == pmulti->cLast[ 1 ] ) ) + { + return pmulti->sortUp; + } + } + + return 0; +} + +int hb_cdpicmp( const char *szFirst, ULONG ulLenFirst, + const char *szSecond, ULONG ulLenSecond, + PHB_CODEPAGE cdp, BOOL fExact ) +{ + int iRet = 0, iAcc = 0, n, n1, n2, u1, u2; + ULONG ul, ulLen; + + ulLen = ulLenFirst < ulLenSecond ? ulLenFirst : ulLenSecond; + if( cdp->sort == NULL ) + { + for( ul = 0; ul < ulLen; ++szFirst, ++szSecond, ++ul ) + { + u1 = cdp->upper[ ( unsigned char ) * szFirst ]; + u2 = cdp->upper[ ( unsigned char ) * szSecond ]; + if( u1 != u2 ) + { + iRet = ( u1 < u2 ) ? -1 : 1; + break; + } + } + } + else if( cdp->nMulti ) + { + for( ul = 0; ul < ulLen; ++szFirst, ++szSecond, ++ul ) + { + u1 = cdp->upper[ ( unsigned char ) * szFirst ]; + u2 = cdp->upper[ ( unsigned char ) * szSecond ]; + + if( ( cdp->flags[ u1 ] & HB_CDP_MULTI1 ) != 0 && + ( ul < ulLenFirst - 1 ) && + ( cdp->flags[ ( unsigned char ) szFirst[ 1 ] ] & HB_CDP_MULTI2 ) != 0 ) + { + n = hb_cdpMultiWeightI( cdp, szFirst ); + if( n != 0 ) + { + n1 = n; + ++szFirst; + if( --ulLenFirst < ulLen ) + ulLen = ulLenFirst; + } + else + n1 = cdp->sort[ u1 ]; + } + else + n1 = cdp->sort[ u1 ]; + + if( ( cdp->flags[ u2 ] & HB_CDP_MULTI1 ) != 0 && + ( ul < ulLenSecond - 1 ) && + ( cdp->flags[ ( unsigned char ) szSecond[ 1 ] ] & HB_CDP_MULTI2 ) != 0 ) + { + n = hb_cdpMultiWeightI( cdp, szSecond ); + if( n != 0 ) + { + n2 = n; + ++szSecond; + if( --ulLenSecond < ulLen ) + ulLen = ulLenSecond; + } + else + n2 = cdp->sort[ u2 ]; + } + else + n2 = cdp->sort[ u2 ]; + + if( n1 != n2 ) + { + if( n1 == 0 || n2 == 0 ) + /* One of characters doesn't belong to the national characters */ + iRet = ( u1 < u2 ) ? -1 : 1; + else + iRet = ( n1 < n2 ) ? -1 : 1; + break; + } + else if( u1 != u2 ) + { + if( n1 == 0 ) + { + iRet = ( u1 < u2 ) ? -1 : 1; + break; + } + if( iAcc == 0 && ( fExact || ( ulLenFirst == ulLenSecond && cdp->acc ) ) ) + { + if( cdp->acc ) + iAcc = ( cdp->acc[ u1 ] < cdp->acc[ u2 ] ) ? -1 : 1; + else + iAcc = ( u1 < u2 ) ? -1 : 1; + } + } + } + } + else + { + for( ul = 0; ul < ulLen; ++szFirst, ++szSecond, ++ul ) + { + u1 = cdp->upper[ ( unsigned char ) * szFirst ]; + u2 = cdp->upper[ ( unsigned char ) * szSecond ]; + + if( u1 != u2 ) + { + if( ( n1 = ( unsigned char ) cdp->sort[ u1 ] ) == 0 || + ( n2 = ( unsigned char ) cdp->sort[ u2 ] ) == 0 ) + { + /* One of characters doesn't belong to the national characters */ + iRet = ( u1 < u2 ) ? -1 : 1; + break; + } + else if( n1 != n2 ) + { + iRet = ( n1 < n2 ) ? -1 : 1; + break; + } + if( iAcc == 0 && ( fExact || ( ulLenFirst == ulLenSecond && cdp->acc ) ) ) + { + if( cdp->acc ) + iAcc = ( cdp->acc[ u1 ] < cdp->acc[ u2 ] ) ? -1 : 1; + else + iAcc = ( u1 < u2 ) ? -1 : 1; + } + } + } + } + + if( !iRet ) + { + if( iAcc ) + iRet = iAcc; + else if( ulLenSecond > ulLenFirst ) + iRet = -1; + else if( fExact && ulLenSecond < ulLenFirst ) + iRet = 1; + } + + return iRet; +} + +/* + * conversions + */ +static void hb_cdpBuildTransTable( PHB_UNITABLE uniTable ) +{ + HB_WCHAR wcMax = 0; + int i; + + HB_CDP_LOCK + if( uniTable->uniTrans == NULL ) + { + unsigned char * uniTrans; + + for( i = 0; i < 256; ++i ) + { + HB_WCHAR wc = uniTable->uniCodes[ i ]; + if( wc > wcMax ) + wcMax = wc; + } + uniTrans = ( unsigned char * ) + hb_xgrab( ( wcMax + 1 ) * sizeof( unsigned char ) ); + memset( uniTrans, '\0', ( wcMax + 1 ) * sizeof( unsigned char ) ); + for( i = 0; i < 256; ++i ) + uniTrans[ uniTable->uniCodes[ i ] ] = ( unsigned char ) i; + + uniTable->wcMax = wcMax; + uniTable->uniTrans = uniTrans; + } + HB_CDP_UNLOCK +} + +/* + * UTF8 conversions + */ +static int utf8Size( HB_WCHAR wc ) +{ + if( wc < 0x0080 ) return 1; - else if( uc < 0x0800 ) + else if( wc < 0x0800 ) return 2; - else /* if( uc <= 0xffff ) */ + else /* if( wc <= 0xffff ) */ return 3; } -static int u16toutf8( char * szUTF8, HB_WCHAR uc ) +static int u16toutf8( char * szUTF8, HB_WCHAR wc ) { int n; - if( uc < 0x0080 ) + if( wc < 0x0080 ) { - szUTF8[0] = uc & 0xff; + szUTF8[0] = wc & 0xff; n = 1; } - else if( uc < 0x0800 ) + else if( wc < 0x0800 ) { - szUTF8[0] = 0xc0 | ( ( uc >> 6 ) & 0x1f ); - szUTF8[1] = 0x80 | ( uc & 0x3f ); + szUTF8[0] = 0xc0 | ( ( wc >> 6 ) & 0x1f ); + szUTF8[1] = 0x80 | ( wc & 0x3f ); n = 2; } - else /* if( uc <= 0xffff ) */ + else /* if( wc <= 0xffff ) */ { - szUTF8[0] = 0xe0 | ( ( uc >> 12 ) & 0x0f ); - szUTF8[1] = 0x80 | ( ( uc >> 6 ) & 0x3f ); - szUTF8[2] = 0x80 | ( uc & 0x3f ); + szUTF8[0] = 0xe0 | ( ( wc >> 12 ) & 0x0f ); + szUTF8[1] = 0x80 | ( ( wc >> 6 ) & 0x3f ); + szUTF8[2] = 0x80 | ( wc & 0x3f ); n = 3; } /* @@ -161,99 +666,50 @@ static int u16toutf8( char * szUTF8, HB_WCHAR uc ) return n; } -static BOOL utf8tou16nextchar( UCHAR ucChar, int *n, HB_WCHAR * uc ) +static BOOL utf8tou16nextchar( unsigned char ucChar, int *n, HB_WCHAR * pwc ) { if( *n > 0 ) { if( ( ucChar & 0xc0 ) != 0x80 ) return FALSE; - *uc = ( *uc << 6 ) | ( ucChar & 0x3f ); + *pwc = ( *pwc << 6 ) | ( ucChar & 0x3f ); ( *n )--; return TRUE; } *n = 0; - *uc = ucChar; + *pwc = ucChar; if( ucChar >= 0xc0 ) { if( ucChar < 0xe0 ) { - *uc &= 0x1f; + *pwc &= 0x1f; *n = 1; } else if( ucChar < 0xf0 ) { - *uc &= 0x0f; + *pwc &= 0x0f; *n = 2; } else if( ucChar < 0xf8 ) { - *uc &= 0x07; + *pwc &= 0x07; *n = 3; } else if( ucChar < 0xfc ) { - *uc &= 0x03; + *pwc &= 0x03; *n = 4; } else if( ucChar < 0xfe ) { - *uc &= 0x01; + *pwc &= 0x01; *n = 5; } } return TRUE; } -# if 0 /* currently unused, it will in the future */ -static int utf8tou16( const char * szUTF8, HB_WCHAR * uc ) -{ - int n = 1, m = 1; - UINT32 u32; - - u32 = ( UCHAR ) *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 && ( ( UCHAR ) szUTF8[ n ] & 0xc0 ) == 0x80 ) - { - u32 = ( u32 << 6 ) | ( ( UCHAR ) szUTF8[n++] & 0x3f ); - } - if( n < m ) - { - u32 <<= 6 * ( m - n ); - } - } - - *uc = ( HB_WCHAR ) u32; - return n; -} -# endif - static ULONG utf8pos( const char * szUTF8, ULONG ulLen, ULONG ulUTF8Pos ) { if( ulUTF8Pos ) @@ -278,498 +734,62 @@ static ULONG utf8pos( const char * szUTF8, ULONG ulLen, ULONG ulUTF8Pos ) return 0; } -static int hb_cdpFindPos( const char *pszID ) +ULONG hb_cdpUTF8StringLength( const char * pSrc, ULONG ulLen ) { - int iPos; + ULONG ul, ulDst; + HB_WCHAR uc; + int n = 0; - if( pszID != NULL ) + for( ul = ulDst = 0; ul < ulLen; ++ul ) { - for( iPos = 0; iPos < HB_CDP_MAX_ && s_cdpList[iPos]; iPos++ ) + if( utf8tou16nextchar( ( UCHAR ) pSrc[ ul ], &n, &uc ) ) { - if( strcmp( s_cdpList[iPos]->id, pszID ) == 0 ) - return iPos; + if( n == 0 ) + ++ulDst; } } - return -1; + return ulDst; } -BOOL hb_cdpRegister( PHB_CODEPAGE cdpage ) +ULONG hb_cdpUTF8StringPeek( const char * pSrc, ULONG ulLen, ULONG ulPos ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_cdpRegister(%p)", cdpage ) ); - - if( cdpage ) + if( ulLen ) { - int iPos = hb_cdpFindPos( cdpage->id ); + ULONG ul; + HB_WCHAR uc = 0; + int n = 0; - if( iPos == -1 ) + for( ul = 0; ul < ulLen && ulPos; ++ul ) { - for( iPos = 0; iPos < HB_CDP_MAX_; iPos++ ) + if( utf8tou16nextchar( ( UCHAR ) pSrc[ ul ], &n, &uc ) ) { - if( !s_cdpList[iPos] ) + if( n == 0 ) + --ulPos; + } + } + + if( ul < ulLen ) + { + n = 0; + do + { + if( utf8tou16nextchar( ( UCHAR ) pSrc[ ul ], &n, &uc ) ) { - int i, ia, iu, il, iumax = 0, ilmax = 0; - char *ptrUpper = ( char * ) cdpage->CharsUpper; - char *ptrLower = ( char * ) cdpage->CharsLower; - char *ptr; - HB_MULTICHAR multi[12]; - int nMulti = 0; - - s_cdpList[iPos] = cdpage; - - cdpage->lSort = cdpage->lAccInterleave || cdpage->lAccEqual; - if( cdpage->nChars ) - { - int nAddLower = cdpage->nChars + ( ( cdpage->lLatin ) ? 6 : 0 ), - size = 0x300, nUpper = 0, nLower = 0; - unsigned char * pszBuffer; - - if( cdpage->lAccInterleave ) - size += 0x300; - if( strpbrk( cdpage->CharsUpper, "~." ) != NULL ) - { - nUpper = ( int ) strlen( cdpage->CharsUpper ); - size += nUpper + 1; - } - if( strpbrk( cdpage->CharsLower, "~." ) != NULL ) - { - nLower = ( int ) strlen( cdpage->CharsLower ); - size += nLower + 1; - } - pszBuffer = cdpage->buffer = ( unsigned char * ) hb_xgrab( size ); - memset( pszBuffer, '\0', size ); - cdpage->s_chars = pszBuffer; - cdpage->s_upper = pszBuffer + 0x100; - cdpage->s_lower = pszBuffer + 0x200; - pszBuffer += 0x300; - if( cdpage->lAccInterleave ) - { - cdpage->s_accent = pszBuffer; - pszBuffer += 0x100; - } - if( nUpper ) - { - cdpage->CharsUpper = ptrUpper = ( char * ) - memcpy( pszBuffer, cdpage->CharsUpper, nUpper ); - pszBuffer += nUpper + 1; - } - if( nLower ) - { - cdpage->CharsLower = ptrLower = ( char * ) - memcpy( pszBuffer, cdpage->CharsLower, nLower ); - } - for( i = 0; i < 256; i++ ) - { - cdpage->s_upper[ i ] = ( char ) HB_TOUPPER( ( UCHAR ) i ); - cdpage->s_lower[ i ] = ( char ) HB_TOLOWER( ( UCHAR ) i ); - } - for( i = ia = 1; *ptrUpper; i++, ia++, ptrUpper++, ptrLower++ ) - { - if( ( cdpage->lAccEqual || cdpage->lAccInterleave ) && - *ptrUpper == '~' && *ptrLower == '~' ) - { - for( ptr = ptrUpper + 1; *ptr; ptr++ ) - *( ptr - 1 ) = *ptr; - *( ptr - 1 ) = '\0'; - for( ptr = ptrLower + 1; *ptr; ptr++ ) - *( ptr - 1 ) = *ptr; - *( ptr - 1 ) = '\0'; - if( cdpage->lAccEqual ) - i--; - } - else if( *ptrUpper == '.' && *ptrLower == '.' && - ptrUpper[1] && ptrUpper[2] && ptrUpper[3] == '.' && - ptrLower[1] && ptrLower[2] && ptrLower[3] == '.' ) - { - multi[nMulti].cFirst[0] = *( ptrUpper + 1 ); - multi[nMulti].cFirst[1] = *( ptrLower + 1 ); - multi[nMulti].cLast[0] = *( ptrUpper + 2 ); - multi[nMulti].cLast[1] = *( ptrLower + 2 ); - multi[nMulti].nCode = i; - - for( ptr = ptrUpper + 4; *ptr; ptr++ ) - *( ptr - 4 ) = *ptr; - *( ptr - 4 ) = '\0'; - for( ptr = ptrLower + 4; *ptr; ptr++ ) - *( ptr - 4 ) = *ptr; - *( ptr - 4 ) = '\0'; - - nMulti++; - ptrUpper--; - ptrLower--; - cdpage->lSort = TRUE; - continue; - } - iu = ( UCHAR ) * ptrUpper; - il = ( UCHAR ) * ptrLower; - if( iu < iumax || il < ilmax ) - cdpage->lSort = TRUE; - iumax = iu; - ilmax = il; - - cdpage->s_chars[iu] = ( char ) i; - cdpage->s_chars[il] = ( char ) ( i + nAddLower ); - if( cdpage->lAccInterleave ) - { - cdpage->s_accent[iu] = ( char ) ia; - cdpage->s_accent[il] = ( char ) ( ia + nAddLower ); - } - cdpage->s_upper[il] = *ptrUpper; - cdpage->s_lower[iu] = *ptrLower; - } - if( cdpage->lLatin ) - { - for( i = 91; i <= 96; i++ ) - { - if( !cdpage->s_chars[ i ] ) - cdpage->s_chars[ i ] = ( char ) ( cdpage->nChars + ( i - 90 ) ); - } - for( i = 123; i < 256; i++ ) - { - if( !cdpage->s_chars[ i ] ) - cdpage->s_chars[ i ] = ( char ) ( cdpage->nChars + nAddLower + ( i - 122 ) ); - } - } - /* - for( i=0; i<32; i++ ) - printf( "\n %3d %3d %3d %3d %3d %3d %3d %3d",cdpage->s_chars[i*8], - cdpage->s_chars[i*8+1],cdpage->s_chars[i*8+2], - cdpage->s_chars[i*8+3],cdpage->s_chars[i*8+4], - cdpage->s_chars[i*8+5],cdpage->s_chars[i*8+6], - cdpage->s_chars[i*8+7] ); - if( nMulti ) - { - printf( "\n" ); - for( i=0; imulti = ( PHB_MULTICHAR ) hb_xgrab( sizeof( HB_MULTICHAR ) * nMulti ); - memcpy( cdpage->multi, multi, sizeof( HB_MULTICHAR ) * nMulti ); - cdpage->nMulti = nMulti; - } - else - cdpage->multi = NULL; - } - return TRUE; + if( n == 0 ) + return uc; } } + while( ++ul < ulLen ); } } - return FALSE; -} - -BOOL hb_charIsDigit( int iChar ) -{ - return HB_ISDIGIT( ( unsigned char ) iChar ); -} - -BOOL hb_charIsAlpha( int iChar ) -{ - if( HB_ISALPHA( ( unsigned char ) iChar ) ) - return TRUE; - else - { - PHB_CODEPAGE cdp = hb_vmCDP(); - /* ( char * ) casting for MSVC */ - if( cdp && cdp->nChars && iChar && - ( strchr( ( char * ) cdp->CharsUpper, iChar ) || - strchr( ( char * ) cdp->CharsLower, iChar ) ) ) - return TRUE; - } - - return FALSE; -} - -BOOL hb_charIsLower( int iChar ) -{ - if( HB_ISLOWER( ( unsigned char ) iChar ) ) - return TRUE; - else - { - PHB_CODEPAGE cdp = hb_vmCDP(); - /* ( char * ) casting for MSVC */ - if( cdp && cdp->nChars && iChar && - strchr( ( char * ) cdp->CharsLower, iChar ) ) - return TRUE; - } - - return FALSE; -} - -BOOL hb_charIsUpper( int iChar ) -{ - if( HB_ISUPPER( ( unsigned char ) iChar ) ) - return TRUE; - else - { - PHB_CODEPAGE cdp = hb_vmCDP(); - /* ( char * ) casting for MSVC */ - if( cdp && cdp->nChars && iChar && - strchr( ( char * ) cdp->CharsUpper, iChar ) ) - return TRUE; - } - - return FALSE; -} - -BOOL hb_cdpIsDigit( PHB_CODEPAGE cdp, int iChar ) -{ - HB_SYMBOL_UNUSED( cdp ); - - return HB_ISDIGIT( ( unsigned char ) iChar ); -} - -BOOL hb_cdpIsAlpha( PHB_CODEPAGE cdp, int iChar ) -{ - if( HB_ISALPHA( ( unsigned char ) iChar ) ) - return TRUE; - else - { - /* ( char * ) casting for MSVC */ - if( cdp && cdp->nChars && iChar && - ( strchr( ( char * ) cdp->CharsUpper, iChar ) || - strchr( ( char * ) cdp->CharsLower, iChar ) ) ) - return TRUE; - } - - return FALSE; -} - -BOOL hb_cdpIsLower( PHB_CODEPAGE cdp, int iChar ) -{ - if( HB_ISLOWER( ( unsigned char ) iChar ) ) - return TRUE; - else - { - /* ( char * ) casting for MSVC */ - if( cdp && cdp->nChars && iChar && - strchr( ( char * ) cdp->CharsLower, iChar ) ) - return TRUE; - } - - return FALSE; -} - -BOOL hb_cdpIsUpper( PHB_CODEPAGE cdp, int iChar ) -{ - if( HB_ISUPPER( ( unsigned char ) iChar ) ) - return TRUE; - else - { - /* ( char * ) casting for MSVC */ - if( cdp && cdp->nChars && iChar && - strchr( ( char * ) cdp->CharsUpper, iChar ) ) - return TRUE; - } - - return FALSE; -} - -PHB_CODEPAGE hb_cdpFind( const char *pszID ) -{ - int iPos; - - HB_TRACE( HB_TR_DEBUG, ( "hb_cdpFind(%s)", pszID ) ); - - iPos = hb_cdpFindPos( pszID ); - - return ( iPos != -1 ) ? s_cdpList[iPos] : NULL; -} - -PHB_CODEPAGE hb_cdpFindExt( const char *pszID ) -{ - int iPos; - - HB_TRACE( HB_TR_DEBUG, ( "hb_cdpFindExt(%s)", pszID ) ); - - if( pszID && strcmp( pszID, "UTF8" ) == 0 ) - return &s_utf8_codepage; - - iPos = hb_cdpFindPos( pszID ); - - return ( iPos != -1 ) ? s_cdpList[iPos] : NULL; -} - -PHB_CODEPAGE hb_cdpSelect( PHB_CODEPAGE cdpage ) -{ - PHB_CODEPAGE cdpOld; - - HB_TRACE( HB_TR_DEBUG, ( "hb_cdpSelect(%p)", cdpage ) ); - - cdpOld = hb_vmCDP(); - if( cdpage ) - hb_vmSetCDP( cdpage ); - - return cdpOld; -} - -const char * hb_cdpID( void ) -{ - PHB_CODEPAGE cdp; - - HB_TRACE( HB_TR_DEBUG, ( "hb_cdpID()" ) ); - - cdp = hb_vmCDP(); - - return cdp ? cdp->id : NULL; -} - -const char * hb_cdpSelectID( const char *pszID ) -{ - const char * pszIDOld; - - HB_TRACE( HB_TR_DEBUG, ( "hb_cdpSelectID(%s)", pszID ) ); - - pszIDOld = hb_cdpID(); - hb_cdpSelect( hb_cdpFind( pszID ) ); - - return pszIDOld; -} - -void hb_cdpTranslate( char *psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) -{ - if( cdpIn != cdpOut && cdpIn->nChars == cdpOut->nChars ) - { - if( cdpIn->lAccEqual ) - { - for( ; *psz; psz++ ) - { - char * ptr; - - /* ( char * ) casting for MSVC */ - ptr = strchr( ( char * ) cdpIn->CharsUpper, *psz ); - if( ptr ) - *psz = cdpOut->CharsUpper[ ptr - cdpIn->CharsUpper ]; - else - { - /* ( char * ) casting for MSVC */ - ptr = strchr( ( char * ) cdpIn->CharsLower, *psz ); - if( ptr ) - *psz = cdpOut->CharsLower[ ptr - cdpIn->CharsLower ]; - } - } - } - else - { - int nAddLower = ( cdpIn->lLatin ) ? 6 : 0; - - for( ; *psz; psz++ ) - { - int n = ( int ) cdpIn->s_chars[( UCHAR ) * psz]; - - if( n != 0 && - ( n <= cdpOut->nChars || ( n > ( cdpOut->nChars + nAddLower ) && - n <= ( cdpOut->nChars * 2 + nAddLower ) ) ) ) - { - n--; - *psz = ( n >= ( cdpOut->nChars + nAddLower ) ) ? - cdpOut->CharsLower[ n - cdpOut->nChars - nAddLower ] : cdpOut->CharsUpper[ n ]; - } - } - } - } -} - -void hb_cdpnTranslate( char *psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, ULONG nChars ) -{ - if( cdpIn != cdpOut && cdpIn->nChars == cdpOut->nChars ) - { - if( cdpIn->lAccEqual ) - { - for( ; nChars--; psz++ ) - { - char * ptr; - - /* ( char * ) casting for MSVC */ - ptr = strchr( ( char * ) cdpIn->CharsUpper, *psz ); - if( ptr ) - *psz = cdpOut->CharsUpper[ ptr - cdpIn->CharsUpper ]; - else - { - /* ( char * ) casting for MSVC */ - ptr = strchr( ( char * ) cdpIn->CharsLower, *psz ); - if( ptr ) - *psz = cdpOut->CharsLower[ ptr - cdpIn->CharsLower ]; - } - } - } - else - { - int nAddLower = ( cdpIn->lLatin ) ? 6 : 0; - - for( ; nChars--; psz++ ) - { - int n = ( int ) cdpIn->s_chars[( UCHAR ) * psz]; - - if( n != 0 && - ( n <= cdpOut->nChars || ( n > ( cdpOut->nChars + nAddLower ) && - n <= ( cdpOut->nChars * 2 + nAddLower ) ) ) ) - { - n--; - *psz = ( n >= ( cdpOut->nChars + nAddLower ) ) ? - cdpOut->CharsLower[n - cdpOut->nChars - nAddLower] : cdpOut->CharsUpper[ n ]; - } - } - } - } -} - -int hb_cdpTranslateChar( int iChar, BOOL fCtrl, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) -{ - if( cdpIn && cdpOut && cdpIn != cdpOut && cdpIn->nChars == cdpOut->nChars && - iChar >= ( fCtrl ? 32 : 0 ) && iChar < 256 ) - { - /* ( char * ) casting for MSVC */ - char * ptr = strchr( ( char * ) cdpIn->CharsUpper, iChar ); - if( ptr ) - iChar = ( unsigned char ) cdpOut->CharsUpper[ ptr - cdpIn->CharsUpper ]; - else - { - /* ( char * ) casting for MSVC */ - ptr = strchr( ( char * ) cdpIn->CharsLower, iChar ); - if( ptr ) - iChar = ( unsigned char ) cdpOut->CharsLower[ ptr - cdpIn->CharsLower ]; - } - } - - return iChar; -} - -HB_WCHAR hb_cdpGetU16( PHB_CODEPAGE cdp, BOOL fCtrl, UCHAR ch ) -{ - if( ( fCtrl || ch >= 32 ) && cdp && cdp->uniTable && - cdp->uniTable->uniCodes && ch < cdp->uniTable->nChars ) - return cdp->uniTable->uniCodes[ ch ]; - else - return ch; -} - -UCHAR hb_cdpGetChar( PHB_CODEPAGE cdp, BOOL fCtrl, HB_WCHAR uc ) -{ - if( ( fCtrl || uc >= 32 ) && cdp && cdp->uniTable && cdp->uniTable->uniCodes ) - { - int i; - - for( i = fCtrl ? 0 : 32; i < cdp->uniTable->nChars; i++ ) - { - if( cdp->uniTable->uniCodes[ i ] == uc ) - { - uc = ( HB_WCHAR ) i; - break; - } - } - } - return uc >= 0x100 ? '?' : ( UCHAR ) uc; + return 0; } /* caller must free the returned buffer if not NULL */ -char *hb_cdpUTF8StringSubstr( const char * pSrc, ULONG ulLen, - ULONG ulFrom, ULONG ulCount, ULONG * pulDest ) +char * hb_cdpUTF8StringSubstr( const char * pSrc, ULONG ulLen, + ULONG ulFrom, ULONG ulCount, ULONG * pulDest ) { ULONG ul, ulCnt, ulDst = 0; HB_WCHAR uc; @@ -816,151 +836,21 @@ char *hb_cdpUTF8StringSubstr( const char * pSrc, ULONG ulLen, return pDst; } -ULONG hb_cdpUTF8StringPeek( const char * pSrc, ULONG ulLen, ULONG ulPos ) +BOOL hb_cdpGetFromUTF8( PHB_CODEPAGE cdp, BOOL fCtrl, unsigned char ch, + int * n, HB_WCHAR * pwc ) { - if( ulLen ) + if( utf8tou16nextchar( ch, n, pwc ) ) { - ULONG ul; - HB_WCHAR uc = 0; - int n = 0; - - for( ul = 0; ul < ulLen && ulPos; ++ul ) + if( *n == 0 && cdp && ( fCtrl || *pwc >= 32 ) ) { - if( utf8tou16nextchar( ( UCHAR ) pSrc[ ul ], &n, &uc ) ) + if( cdp->uniTable->uniTrans == NULL ) + hb_cdpBuildTransTable( cdp->uniTable ); + + if( *pwc <= cdp->uniTable->wcMax ) { - if( n == 0 ) - --ulPos; - } - } - - if( ul < ulLen ) - { - n = 0; - do - { - if( utf8tou16nextchar( ( UCHAR ) pSrc[ ul ], &n, &uc ) ) - { - if( n == 0 ) - return uc; - } - } - while( ++ul < ulLen ); - } - } - - return 0; -} - -ULONG hb_cdpUTF8StringLength( const char * pSrc, ULONG ulLen ) -{ - ULONG ul, ulDst; - HB_WCHAR uc; - int n = 0; - - /* - * TODO: add support for multibyte characters - */ - - for( ul = ulDst = 0; ul < ulLen; ++ul ) - { - if( utf8tou16nextchar( ( UCHAR ) pSrc[ ul ], &n, &uc ) ) - { - if( n == 0 ) - ++ulDst; - } - } - - return ulDst; -} - -ULONG hb_cdpStringInUTF8Length( PHB_CODEPAGE cdp, BOOL fCtrl, - const char * pSrc, ULONG ulLen ) -{ - ULONG ul, ulDst; - - for( ul = ulDst = 0; ul < ulLen; ++ul ) - { - ulDst += utf8Size( hb_cdpGetU16( cdp, fCtrl, ( UCHAR ) pSrc[ ul ] ) ); - } - - return ulDst; -} - -ULONG hb_cdpStringInUTF8Length2( PHB_CODEPAGE cdp, BOOL fCtrl, - const char * pSrc, ULONG ulLen, ULONG ulMax ) -{ - ULONG ul, ulDst; - int n; - - for( ul = ulDst = 0; ul < ulLen; ++ul ) - { - n = utf8Size( hb_cdpGetU16( cdp, fCtrl, ( UCHAR ) pSrc[ ul ] ) ); - if( ulDst + n > ulMax ) - break; - ulDst += n; - } - - return ulDst; -} - -ULONG hb_cdpUTF8ToStrn( PHB_CODEPAGE cdp, BOOL fCtrl, - const char * pSrc, ULONG ulSrc, - char * pDst, ULONG ulDst ) -{ - ULONG ulS, ulD; - HB_WCHAR uc = 0; - int n = 0; - - for( ulS = ulD = 0; ulS < ulSrc; ++ulS ) - { - if( utf8tou16nextchar( ( UCHAR ) pSrc[ulS], &n, &uc ) ) - { - if( n == 0 ) - { - if( ulD < ulDst ) - { - if( ( fCtrl || uc >= 32 ) && cdp->uniTable && cdp->uniTable->uniCodes ) - { - int i; - - for( i = fCtrl ? 0 : 32; i < cdp->uniTable->nChars; i++ ) - { - if( cdp->uniTable->uniCodes[ i ] == uc ) - { - uc = ( HB_WCHAR ) i; - break; - } - } - } - pDst[ulD] = uc >= 0x100 ? '?' : ( UCHAR ) uc; - } - ++ulD; - } - } - } - - if( ulD < ulDst ) - pDst[ulD] = '\0'; - - return ulD; -} - -BOOL hb_cdpGetFromUTF8( PHB_CODEPAGE cdp, BOOL fCtrl, UCHAR ch, - int *n, HB_WCHAR * uc ) -{ - if( utf8tou16nextchar( ch, n, uc ) ) - { - if( *n == 0 && cdp && ( fCtrl || *uc >= 32 ) && cdp->uniTable && cdp->uniTable->uniCodes ) - { - int i; - - for( i = fCtrl ? 0 : 32; i < cdp->uniTable->nChars; i++ ) - { - if( cdp->uniTable->uniCodes[ i ] == *uc ) - { - *uc = ( HB_WCHAR ) i; - break; - } + unsigned char uc = cdp->uniTable->uniTrans[ *pwc ]; + if( uc ) + *pwc = uc; } } return TRUE; @@ -968,466 +858,551 @@ BOOL hb_cdpGetFromUTF8( PHB_CODEPAGE cdp, BOOL fCtrl, UCHAR ch, return FALSE; } -ULONG hb_cdpStrnToUTF8( PHB_CODEPAGE cdp, BOOL fCtrl, - const char * pSrc, ULONG ulLen, char * pDst ) +ULONG hb_cdpStrAsUTF8Len( PHB_CODEPAGE cdp, BOOL fCtrl, + const char * pSrc, ULONG ulSrc, + ULONG ulMax ) { - HB_WCHAR u, *uniCodes, nChars; - ULONG i, n; + HB_WCHAR * uniCodes; + ULONG ulS, ulD, u; + int i; - if( cdp && cdp->uniTable ) + uniCodes = cdp->uniTable->uniCodes; + for( ulS = ulD = 0; ulS < ulSrc; ++ulS ) { - 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, fCtrl, ( UCHAR ) pSrc[ i ] ); - n += u16toutf8( &pDst[ n ], u ); - } - pDst[ n ] = '\0'; - return n; - } + unsigned char uc = ( unsigned char ) pSrc[ ulS ]; + HB_WCHAR wc; + + if( !fCtrl && uc < 32 ) + wc = uc; else { - uniCodes = cdp->uniTable->uniCodes; - nChars = ( HB_WCHAR ) cdp->uniTable->nChars; + wc = uniCodes[ uc ]; + if( cdp->nMultiUC && + ( cdp->flags[ uc ] & HB_CDP_MULTI1 ) != 0 && + ulS + 1 < ulSrc && + ( cdp->flags[ ( unsigned char ) pSrc[ ulS + 1 ] ] & HB_CDP_MULTI2 ) != 0 ) + { + for( i = 0; i < cdp->nMulti; ++i ) + { + if( pSrc[ ulS + 1 ] == cdp->multi[ i ].cLast[ 0 ] || + pSrc[ ulS + 1 ] == cdp->multi[ i ].cLast[ 1 ] ) + { + if( pSrc[ ulS ] == cdp->multi[ i ].cFirst[ 0 ] ) + { + wc = cdp->multi[ i ].wcUp; + ++ulS; + break; + } + else if( pSrc[ ulS ] == cdp->multi[ i ].cFirst[ 1 ] ) + { + wc = cdp->multi[ i ].wcLo; + ++ulS; + break; + } + } + } + } } - } - else - { - nChars = 0; - uniCodes = NULL; + u = utf8Size( wc ); + if( ulMax && ulD + u > ulMax ) + break; + ulD += u; } - for( i = 0, n = 0; i < ulLen; i++ ) - { - u = ( UCHAR ) pSrc[ i ]; - if( uniCodes && u < nChars && ( fCtrl || u >= 32 ) ) - u = uniCodes[ u ]; - n += u16toutf8( &pDst[ n ], u ); - } - pDst[ n ] = '\0'; - - return n; + return ulD; } -ULONG hb_cdpStrnToUTF8n( PHB_CODEPAGE cdp, BOOL fCtrl, - const char * pSrc, ULONG ulLen, - char * pDst, ULONG ulDst ) +ULONG hb_cdpStrToUTF8( PHB_CODEPAGE cdp, BOOL fCtrl, + const char * pSrc, ULONG ulSrc, + char * pDst, ULONG ulDst ) { - HB_WCHAR u, *uniCodes, nChars; - ULONG i, n, l; + HB_WCHAR * uniCodes; + ULONG ulS, ulD, u; + int i; - if( cdp && cdp->uniTable ) + uniCodes = cdp->uniTable->uniCodes; + for( ulS = ulD = 0; ulS < ulSrc && ulD < ulDst; ++ulS ) { - 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, fCtrl, ( UCHAR ) pSrc[ i ] ); - l = utf8Size( u ); - if( n + l <= ulDst ) - { - u16toutf8( &pDst[ n ], u ); - n += l; - } - else - break; - } - if( n < ulDst ) - pDst[ n ] = '\0'; - return n; - } + unsigned char uc = ( unsigned char ) pSrc[ ulS ]; + HB_WCHAR wc; + + if( !fCtrl && uc < 32 ) + wc = uc; else { - uniCodes = cdp->uniTable->uniCodes; - nChars = ( HB_WCHAR ) cdp->uniTable->nChars; + wc = uniCodes[ uc ]; + if( cdp->nMultiUC && + ( cdp->flags[ uc ] & HB_CDP_MULTI1 ) != 0 && + ulS + 1 < ulSrc && + ( cdp->flags[ ( unsigned char ) pSrc[ ulS + 1 ] ] & HB_CDP_MULTI2 ) != 0 ) + { + for( i = 0; i < cdp->nMulti; ++i ) + { + if( pSrc[ ulS + 1 ] == cdp->multi[ i ].cLast[ 0 ] || + pSrc[ ulS + 1 ] == cdp->multi[ i ].cLast[ 1 ] ) + { + if( pSrc[ ulS ] == cdp->multi[ i ].cFirst[ 0 ] ) + { + wc = cdp->multi[ i ].wcUp; + ++ulS; + break; + } + else if( pSrc[ ulS ] == cdp->multi[ i ].cFirst[ 1 ] ) + { + wc = cdp->multi[ i ].wcLo; + ++ulS; + break; + } + } + } + } } - } - else - { - nChars = 0; - uniCodes = NULL; - } - - for( i = 0, n = 0; i < ulLen; i++ ) - { - u = ( UCHAR ) pSrc[ i ]; - if( uniCodes && u < nChars && ( fCtrl || u >= 32 ) ) - u = uniCodes[ u ]; - l = utf8Size( u ); - if( n + l <= ulDst ) + u = utf8Size( wc ); + if( ulD + u <= ulDst ) { - u16toutf8( &pDst[ n ], u ); - n += l; + u16toutf8( &pDst[ ulD ], wc ); + ulD += u; } else break; } - if( n < ulDst ) - pDst[ n ] = '\0'; + if( ulD < ulDst ) + pDst[ ulD ] = '\0'; - return n; + return ulD; } -ULONG hb_cdpStringInU16Length( PHB_CODEPAGE cdp, BOOL fCtrl, - const char *pSrc, ULONG ulLen ) +ULONG hb_cdpUTF8AsStrLen( PHB_CODEPAGE cdp, BOOL fCtrl, + const char * pSrc, ULONG ulSrc, + ULONG ulMax ) { - if( cdp && cdp->uniTable ) + unsigned char * uniTrans; + HB_WCHAR wcMax, wc = 0; + ULONG ulS, ulD; + int n = 0, i; + + if( cdp->uniTable->uniTrans == NULL ) + hb_cdpBuildTransTable( cdp->uniTable ); + uniTrans = cdp->uniTable->uniTrans; + wcMax = cdp->uniTable->wcMax; + + for( ulS = ulD = 0; ulS < ulSrc; ++ulS ) { - /* - * TODO: add support for multibyte characters - */ - } - - HB_SYMBOL_UNUSED( cdp ); - HB_SYMBOL_UNUSED( fCtrl ); - HB_SYMBOL_UNUSED( pSrc ); - - return ulLen; -} - -ULONG hb_cdpStringInU16Length2( PHB_CODEPAGE cdp, BOOL fCtrl, - const char *pSrc, ULONG ulLen, ULONG ulDst ) -{ - if( cdp && cdp->uniTable ) - { - /* - * TODO: add support for multibyte characters - */ - } - - HB_SYMBOL_UNUSED( cdp ); - HB_SYMBOL_UNUSED( fCtrl ); - HB_SYMBOL_UNUSED( pSrc ); - - if( ulDst < ulLen ) - ulLen = ulDst; - - return ulLen; -} - -char * hb_cdpU16ToStr( PHB_CODEPAGE cdp, BOOL fCtrl, - const HB_WCHAR * pSrc, ULONG ulLen, - char * pDst, ULONG * pulDst ) -{ - ULONG ulDst, ul; - HB_WCHAR wc; - - /* - * TODO: add support for multibyte characters - */ - - if( pDst ) - { - ulDst = *pulDst; - } - else - { - ulDst = ulLen + 1; - pDst = ( char * ) hb_xgrab( ulDst ); - } - - for( ul = 0; ul < ulLen && ul < ulDst; ++ul ) - { - wc = HB_GET_BE_UINT16( &pSrc[ ul ] ); - if( fCtrl || wc >= 32 ) + if( utf8tou16nextchar( ( unsigned char ) pSrc[ ulS ], &n, &wc ) ) { - int i; - for( i = fCtrl ? 0 : 32; i < cdp->uniTable->nChars; i++ ) + if( n == 0 ) { - if( cdp->uniTable->uniCodes[ i ] == wc ) - { - wc = ( HB_WCHAR ) i; + ++ulD; + if( ulMax && ulD >= ulMax ) break; + if( wc && cdp->nMultiUC && ( fCtrl || wc >= 32 ) && + ( wc > wcMax || uniTrans[ wc ] == 0 ) ) + { + for( i = 0; i < cdp->nMulti; ++i ) + { + if( wc == cdp->multi[ i ].wcUp || + wc == cdp->multi[ i ].wcLo ) + { + ++ulD; + break; + } + } + if( ulMax && ulD >= ulMax ) + break; } } } - pDst[ ul ] = wc >= 0x100 ? '?' : ( UCHAR ) wc; } - if( ul < ulDst ) - pDst[ ul ] = 0; - *pulDst = ul; - - return pDst; + return ulD; } -char * hb_cdpU16LEToStr( PHB_CODEPAGE cdp, BOOL fCtrl, - const HB_WCHAR * pSrc, ULONG ulLen, - char * pDst, ULONG * pulDst ) +ULONG hb_cdpUTF8ToStr( PHB_CODEPAGE cdp, BOOL fCtrl, + const char * pSrc, ULONG ulSrc, + char * pDst, ULONG ulDst ) { - ULONG ulDst, ul; - HB_WCHAR wc; + unsigned char * uniTrans; + HB_WCHAR wcMax, wc = 0; + ULONG ulS, ulD; + int n = 0, i; - /* - * TODO: add support for multibyte characters - */ + if( cdp->uniTable->uniTrans == NULL ) + hb_cdpBuildTransTable( cdp->uniTable ); + uniTrans = cdp->uniTable->uniTrans; + wcMax = cdp->uniTable->wcMax; - if( pDst ) + for( ulS = ulD = 0; ulS < ulSrc && ulD < ulDst; ++ulS ) { - ulDst = *pulDst; - } - else - { - ulDst = ulLen + 1; - pDst = ( char * ) hb_xgrab( ulDst ); - } - - for( ul = 0; ul < ulLen && ul < ulDst; ++ul ) - { - wc = HB_GET_LE_UINT16( &pSrc[ ul ] ); - if( fCtrl || wc >= 32 ) + if( utf8tou16nextchar( ( unsigned char ) pSrc[ ulS ], &n, &wc ) ) { - int i; - for( i = fCtrl ? 0 : 32; i < cdp->uniTable->nChars; i++ ) + if( n == 0 ) { - if( cdp->uniTable->uniCodes[ i ] == wc ) + if( !fCtrl && wc < 32 ) + pDst[ ulD++ ] = ( unsigned char ) wc; + else if( wc <= wcMax && uniTrans[ wc ] ) + pDst[ ulD++ ] = uniTrans[ wc ]; + else { - wc = ( HB_WCHAR ) i; - break; + if( wc && cdp->nMultiUC ) + { + for( i = 0; i < cdp->nMulti; ++i ) + { + if( wc == cdp->multi[ i ].wcUp ) + { + pDst[ ulD++ ] = cdp->multi[ i ].cFirst[ 0 ]; + if( ulD < ulDst ) + pDst[ ulD++ ] = cdp->multi[ i ].cLast[ 0 ]; + break; + } + if( wc == cdp->multi[ i ].wcLo ) + { + pDst[ ulD++ ] = cdp->multi[ i ].cFirst[ 1 ]; + if( ulD < ulDst ) + pDst[ ulD++ ] = cdp->multi[ i ].cLast[ 1 ]; + break; + } + } + if( i < cdp->nMulti ) + continue; + } + pDst[ ulD++ ] = wc >= 0x100 ? '?' : ( unsigned char ) wc; } } } - pDst[ ul ] = wc >= 0x100 ? '?' : ( UCHAR ) wc; } - if( ul < ulDst ) - pDst[ ul ] = 0; - *pulDst = ul; + if( ulD < ulDst ) + pDst[ ulD ] = '\0'; - return pDst; + return ulD; } -ULONG hb_cdpStrnToU16( PHB_CODEPAGE cdp, BOOL fCtrl, - const char * pSrc, ULONG ulLen, HB_WCHAR * pDst ) +/* + * U16 (hb wide char) conversions + */ +HB_WCHAR hb_cdpGetU16( PHB_CODEPAGE cdp, BOOL fCtrl, unsigned char ch ) { - HB_WCHAR 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++ ) - { - u = hb_cdpGetU16( cdp, fCtrl, ( UCHAR ) pSrc[ i ] ); - HB_PUT_BE_UINT16( pDst, u ); - } - return i; - } - else - { - uniCodes = cdp->uniTable->uniCodes; - nChars = ( HB_WCHAR ) cdp->uniTable->nChars; - } - } + if( cdp && ( fCtrl || ch >= 32 ) ) + return cdp->uniTable->uniCodes[ ch ]; else - { - nChars = 0; - uniCodes = NULL; - } - - for( i = 0; i < ulLen; i++, pDst++ ) - { - u = ( UCHAR ) pSrc[ i ]; - if( uniCodes && u < nChars && ( fCtrl || u >= 32 ) ) - u = uniCodes[ u ]; - HB_PUT_BE_UINT16( pDst, u ); - } - return i; + return ch; } -ULONG hb_cdpStrnToU16n( PHB_CODEPAGE cdp, BOOL fCtrl, - const char * pSrc, ULONG ulLen, - HB_WCHAR * pDst, ULONG ulDst ) +unsigned char hb_cdpGetChar( PHB_CODEPAGE cdp, BOOL fCtrl, HB_WCHAR wc ) { - HB_WCHAR u, *uniCodes, nChars; - ULONG i; - - if( ulLen > ulDst ) - ulLen = ulDst; - - if( cdp && cdp->uniTable ) + if( cdp && ( fCtrl || wc >= 32 ) ) { - if( cdp->nMulti || cdp->uniTable->lMulti ) + if( cdp->uniTable->uniTrans == NULL ) + hb_cdpBuildTransTable( cdp->uniTable ); + + if( wc <= cdp->uniTable->wcMax ) { - /* - * TODO: this translation is bad, please fix me!!! - */ - for( i = 0; i < ulLen; i++, pDst++ ) - { - u = hb_cdpGetU16( cdp, fCtrl, ( UCHAR ) pSrc[ i ] ); - HB_PUT_BE_UINT16( pDst, u ); - } - if( i < ulDst ) - pDst[ i ] = '\0'; - return i; - } - else - { - uniCodes = cdp->uniTable->uniCodes; - nChars = ( HB_WCHAR ) cdp->uniTable->nChars; + unsigned char uc = cdp->uniTable->uniTrans[ wc ]; + if( uc ) + wc = uc; } } - else - { - nChars = 0; - uniCodes = NULL; - } - - for( i = 0; i < ulLen; i++, pDst++ ) - { - u = ( UCHAR ) pSrc[ i ]; - if( uniCodes && u < nChars && ( fCtrl || u >= 32 ) ) - u = uniCodes[ u ]; - HB_PUT_BE_UINT16( pDst, u ); - } - if( i < ulDst ) - pDst[ i ] = '\0'; - return i; + return wc >= 0x100 ? '?' : ( UCHAR ) wc; } -ULONG hb_cdpStrnToU16LE( PHB_CODEPAGE cdp, BOOL fCtrl, - const char * pSrc, ULONG ulLen, HB_WCHAR * pDst ) -{ - HB_WCHAR 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++ ) - { - u = hb_cdpGetU16( cdp, fCtrl, ( UCHAR ) pSrc[ i ] ); - HB_PUT_LE_UINT16( pDst, u ); - } - return i; - } - else - { - uniCodes = cdp->uniTable->uniCodes; - nChars = ( HB_WCHAR) cdp->uniTable->nChars; - } - } - else - { - nChars = 0; - uniCodes = NULL; - } - - for( i = 0; i < ulLen; i++, pDst++ ) - { - u = ( UCHAR ) pSrc[ i ]; - if( uniCodes && u < nChars && ( fCtrl || u >= 32 ) ) - u = uniCodes[ u ]; - HB_PUT_LE_UINT16( pDst, u ); - } - return i; -} - -ULONG hb_cdpStrnToU16LEn( PHB_CODEPAGE cdp, BOOL fCtrl, - const char * pSrc, ULONG ulLen, - HB_WCHAR * pDst, ULONG ulDst ) -{ - HB_WCHAR u, *uniCodes, nChars; - ULONG i; - - if( ulLen > ulDst ) - ulLen = ulDst; - - 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++ ) - { - u = hb_cdpGetU16( cdp, fCtrl, ( UCHAR ) pSrc[ i ] ); - HB_PUT_LE_UINT16( pDst, u ); - } - if( i < ulDst ) - pDst[ i ] = '\0'; - return i; - } - else - { - uniCodes = cdp->uniTable->uniCodes; - nChars = ( HB_WCHAR) cdp->uniTable->nChars; - } - } - else - { - nChars = 0; - uniCodes = NULL; - } - - for( i = 0; i < ulLen; i++, pDst++ ) - { - u = ( UCHAR ) pSrc[ i ]; - if( uniCodes && u < nChars && ( fCtrl || u >= 32 ) ) - u = uniCodes[ u ]; - HB_PUT_LE_UINT16( pDst, u ); - } - if( i < ulDst ) - pDst[ i ] = '\0'; - return i; -} - -ULONG hb_cdpnDupLen( const char * pszSrc, ULONG ulLen, - PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) -{ - if( cdpIn && cdpOut && cdpIn != cdpOut && ulLen ) - { - if( cdpIn == &s_utf8_codepage ) - ulLen = hb_cdpUTF8StringLength( pszSrc, ulLen ); - else if( cdpOut == &s_utf8_codepage ) - ulLen = hb_cdpStringInUTF8Length( cdpIn, FALSE, pszSrc, ulLen ); - else - { - /* TODO: add unicode base translation which can respect - * multibyte characters - */ - } - } - - return ulLen; -} - -ULONG hb_cdpnDup2Len( const char * pszSrc, ULONG ulLen, ULONG ulMax, +/* + * CP translations + */ +ULONG hb_cdpTransLen( const char * pSrc, ULONG ulSrc, ULONG ulMax, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) { - if( cdpIn && cdpOut && cdpIn != cdpOut && ulLen ) + ULONG ulSize; + + if( cdpIn && cdpOut && cdpIn != cdpOut ) { if( cdpIn == &s_utf8_codepage ) - ulLen = hb_cdpUTF8StringLength( pszSrc, ulLen ); + return hb_cdpUTF8AsStrLen( cdpOut, FALSE, pSrc, ulSrc, ulMax ); else if( cdpOut == &s_utf8_codepage ) - ulLen = hb_cdpStringInUTF8Length2( cdpIn, FALSE, pszSrc, ulLen, ulMax ); + return hb_cdpStrAsUTF8Len( cdpIn, FALSE, pSrc, ulSrc, ulMax ); else { - /* TODO: add unicode base translation which can respect - * multibyte characters - */ + unsigned char * uniTrans; + HB_WCHAR wcMax; + + if( cdpOut->uniTable->uniTrans == NULL ) + hb_cdpBuildTransTable( cdpOut->uniTable ); + uniTrans = cdpOut->uniTable->uniTrans; + wcMax = cdpOut->uniTable->wcMax; + + if( cdpIn->nMultiUC || cdpOut->nMultiUC ) + { + ULONG ul; + int i; + + for( ul = ulSize = 0; ul < ulSrc && ( ulMax == 0 || ulSize < ulMax ); ++ul, ++ulSize ) + { + unsigned char uc = ( unsigned char ) pSrc[ ul ]; + HB_WCHAR wc = cdpIn->uniTable->uniCodes[ uc ]; + + if( cdpIn->nMultiUC && + ( cdpIn->flags[ uc ] & HB_CDP_MULTI1 ) != 0 && + ul + 1 < ulSrc && + ( cdpIn->flags[ ( unsigned char ) pSrc[ ul + 1 ] ] & HB_CDP_MULTI2 ) != 0 ) + { + for( i = 0; i < cdpIn->nMulti; ++i ) + { + if( pSrc[ ul + 1 ] == cdpIn->multi[ i ].cLast[ 0 ] || + pSrc[ ul + 1 ] == cdpIn->multi[ i ].cLast[ 1 ] ) + { + if( pSrc[ ul ] == cdpIn->multi[ i ].cFirst[ 0 ] ) + { + wc = cdpIn->multi[ i ].wcUp; + ++ul; + break; + } + else if( pSrc[ ul ] == cdpIn->multi[ i ].cFirst[ 1 ] ) + { + wc = cdpIn->multi[ i ].wcLo; + ++ul; + break; + } + } + } + } + + if( wc && ( wc > wcMax || uniTrans[ wc ] ) && cdpOut->nMultiUC && + ( ulMax == 0 || ulSize + 1 < ulMax ) ) + { + for( i = 0; i < cdpOut->nMulti; ++i ) + { + if( wc == cdpOut->multi[ i ].wcUp || + wc == cdpOut->multi[ i ].wcLo ) + { + ++ulSize; + break; + } + } + } + } + } + else + ulSize = ( ulMax && ulSrc > ulMax ) ? ulMax : ulSrc; } } - if( ulLen > ulMax ) - ulLen = ulMax; + else + ulSize = ( ulMax && ulSrc > ulMax ) ? ulMax : ulSrc; - return ulLen; + return ulSize; +} + +ULONG hb_cdpTransTo( const char * pSrc, ULONG ulSrc, + char * pDst, ULONG ulDst, + PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) +{ + ULONG ulSize; + + if( cdpIn && cdpOut && cdpIn != cdpOut ) + { + if( cdpIn == &s_utf8_codepage ) + return hb_cdpUTF8ToStr( cdpOut, FALSE, pSrc, ulSrc, pDst, ulDst ); + else if( cdpOut == &s_utf8_codepage ) + return hb_cdpStrToUTF8( cdpIn, FALSE, pSrc, ulSrc, pDst, ulDst ); + else + { + unsigned char * uniTrans; + HB_WCHAR wcMax; + + if( cdpOut->uniTable->uniTrans == NULL ) + hb_cdpBuildTransTable( cdpOut->uniTable ); + uniTrans = cdpOut->uniTable->uniTrans; + wcMax = cdpOut->uniTable->wcMax; + + if( cdpIn->nMultiUC || cdpOut->nMultiUC ) + { + ULONG ul; + int i; + + for( ul = ulSize = 0; ul < ulSrc && ulSize < ulDst; ++ul, ++ulSize ) + { + unsigned char uc = ( unsigned char ) pSrc[ ul ]; + HB_WCHAR wc = cdpIn->uniTable->uniCodes[ uc ]; + + if( cdpIn->nMultiUC && + ( cdpIn->flags[ uc ] & HB_CDP_MULTI1 ) != 0 && + ul + 1 < ulSrc && + ( cdpIn->flags[ ( unsigned char ) pSrc[ ul + 1 ] ] & HB_CDP_MULTI2 ) != 0 ) + { + for( i = 0; i < cdpIn->nMulti; ++i ) + { + if( pSrc[ ul + 1 ] == cdpIn->multi[ i ].cLast[ 0 ] || + pSrc[ ul + 1 ] == cdpIn->multi[ i ].cLast[ 1 ] ) + { + if( pSrc[ ul ] == cdpIn->multi[ i ].cFirst[ 0 ] ) + { + wc = cdpIn->multi[ i ].wcUp; + ++ul; + break; + } + else if( pSrc[ ul ] == cdpIn->multi[ i ].cFirst[ 1 ] ) + { + wc = cdpIn->multi[ i ].wcLo; + ++ul; + break; + } + } + } + } + + if( wc ) + { + if( wc <= wcMax && uniTrans[ wc ] ) + uc = uniTrans[ wc ]; + else if( cdpOut->nMultiUC ) + { + for( i = 0; i < cdpOut->nMulti; ++i ) + { + if( wc == cdpOut->multi[ i ].wcUp ) + { + if( ulSize + 1 < ulDst ) + { + pDst[ ulSize++ ] = cdpOut->multi[ i ].cFirst[ 0 ]; + uc = cdpOut->multi[ i ].cLast[ 0 ]; + } + else + uc = cdpOut->multi[ i ].cFirst[ 0 ]; + break; + } + if( wc == cdpOut->multi[ i ].wcLo ) + { + if( ulSize + 1 < ulDst ) + { + pDst[ ulSize++ ] = cdpOut->multi[ i ].cFirst[ 1 ]; + uc = cdpOut->multi[ i ].cLast[ 1 ]; + } + else + uc = cdpOut->multi[ i ].cFirst[ 1 ]; + break; + } + } + } + } + + pDst[ ulSize ] = uc; + } + } + else + { + if( ulSrc > ulDst ) + ulSrc = ulDst; + for( ulSize = 0; ulSize < ulSrc; ++ulSize ) + { + unsigned char uc = ( unsigned char ) pSrc[ ulSize ]; + HB_WCHAR wc = cdpIn->uniTable->uniCodes[ uc ]; + if( wc && wc <= wcMax && uniTrans[ wc ] ) + uc = uniTrans[ wc ]; + pDst[ ulSize ] = uc; + } + } + } + } + else + { + ulSize = ( ulSrc > ulDst ) ? ulDst : ulSrc; + memcpy( pDst, pSrc, ulSize ); + } + + if( ulSize < ulDst ) + pDst[ ulSize ] = '\0'; + + return ulSize; +} + +int hb_cdpTranslateChar( int iChar, BOOL fCtrl, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) +{ + if( cdpIn && cdpOut && cdpIn != cdpOut && + iChar >= ( fCtrl ? 32 : 0 ) && iChar < 256 ) + { + HB_WCHAR wc; + + if( cdpOut->uniTable->uniTrans == NULL ) + hb_cdpBuildTransTable( cdpOut->uniTable ); + + wc = cdpIn->uniTable->uniCodes[ iChar ]; + if( wc && wc <= cdpIn->uniTable->wcMax && + cdpOut->uniTable->uniTrans[ wc ] ) + iChar = cdpOut->uniTable->uniTrans[ wc ]; + } + + return iChar; +} + +ULONG hb_cdpnDupLen( const char * pSrc, ULONG ulSrc, + PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) +{ + return hb_cdpTransLen( pSrc, ulSrc, 0, cdpIn, cdpOut ); +} + +ULONG hb_cdpnDup2Len( const char * pSrc, ULONG ulSrc, ULONG ulMax, + PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) +{ + return hb_cdpTransLen( pSrc, ulSrc, ulMax, cdpIn, cdpOut ); +} + +char * hb_cdpnDup( const char * pSrc, ULONG * pulLen, + PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) +{ + char * pDst; + ULONG ulDst; + + ulDst = hb_cdpTransLen( pSrc, *pulLen, 0, cdpIn, cdpOut ); + pDst = ( char * ) hb_xgrab( ulDst + 1 ); + hb_cdpTransTo( pSrc, *pulLen, pDst, ulDst + 1, cdpIn, cdpOut ); + *pulLen = ulDst; + + return pDst; +} + +const char * hb_cdpnDup2( const char * pSrc, ULONG ulSrc, + char * pDst, ULONG * pulDst, + PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) +{ + hb_cdpTransTo( pSrc, ulSrc, pDst, *pulDst, cdpIn, cdpOut ); + return pDst; +} + +const char * hb_cdpnDup3( const char * pSrc, ULONG ulSrc, + char * pDst, ULONG * pulDst, + char ** pFree, ULONG * pulSize, + PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) +{ + if( cdpIn && cdpOut && cdpIn != cdpOut && ulSrc ) + { + char * pPrev = NULL; + ULONG ulDst = hb_cdpTransLen( pSrc, ulSrc, 0, cdpIn, cdpOut ); + + if( pDst == NULL ) + { + pDst = *pFree; + if( pDst == NULL && *pulSize > 0 ) + pDst = ( char * ) pSrc; + } + + if( ulDst >= *pulSize || ( pDst == pSrc && + ( cdpOut == &s_utf8_codepage || cdpOut->nMultiUC ) ) ) + { + pPrev = *pFree; + pDst = *pFree = ( char * ) hb_xgrab( ulDst + 1 ); + *pulSize = ulDst + 1; + } + + ulDst = hb_cdpTransTo( pSrc, ulSrc, pDst, *pulSize, cdpIn, cdpOut ); + + if( pPrev ) + hb_xfree( pPrev ); + if( pulDst ) + *pulDst = ulDst; + return pDst; + } + + if( pulDst ) + *pulDst = ulSrc; + + return pSrc; } char * hb_cdpDup( const char * pszSrc, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) @@ -1436,438 +1411,528 @@ char * hb_cdpDup( const char * pszSrc, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) return hb_cdpnDup( pszSrc, &ulLen, cdpIn, cdpOut ); } -char * hb_cdpnDup( const char * pszSrc, ULONG * pulLen, - PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) + +/* + * CP management + */ +static PHB_CODEPAGE hb_buildCodePage( const char * id, const char * info, + PHB_UNITABLE uniTable, + const char * pszUpper, + const char * pszLower, + unsigned int nACSort ) { - char * pszDst; - ULONG ulDst; + BOOL lSort, fError; + int iMulti, iAcc, iAccUp, iAccLo, iSortUp, iSortLo, i; + const char * pup, * plo; + unsigned char ucUp, ucLo, ucUp2, ucLo2; + ULONG ulSize, ul; + unsigned char * buffer, * flags, * upper, * lower, * sort, * acc; + unsigned char used[ 256 ]; + PHB_CODEPAGE cdp; + PHB_MULTICHAR multi; - if( cdpIn && cdpOut && cdpIn != cdpOut ) + memset( used, '\0', sizeof( used ) ); + + iMulti = iAcc = iSortUp = iSortLo = 0; + fError = lSort = FALSE; + + ucUp2 = ucLo2 = 0; + pup = pszUpper; + plo = pszLower; + for( ;; ) { - if( cdpIn == &s_utf8_codepage ) + ucUp = ( unsigned char ) *pup++; + ucLo = ( unsigned char ) *plo++; + if( ucUp == 0 || ucLo == 0 ) { - ulDst = hb_cdpUTF8StringLength( pszSrc, *pulLen ); - pszDst = ( char * ) hb_xgrab( ulDst + 1 ); - hb_cdpUTF8ToStrn( cdpOut, FALSE, pszSrc, *pulLen, pszDst, ulDst + 1 ); + if( ucUp || ucLo ) + fError = TRUE; + break; } - else if( cdpOut == &s_utf8_codepage ) + if( ucUp == '.' ) { - ulDst = hb_cdpStringInUTF8Length( cdpIn, FALSE, pszSrc, *pulLen ); - pszDst = ( char * ) hb_xgrab( ulDst + 1 ); - hb_cdpStrnToUTF8( cdpIn, FALSE, pszSrc, *pulLen, pszDst ); - } - else - { - /* TODO: add unicode base translation which can respect - * multibyte characters - */ - ulDst = *pulLen; - pszDst = ( char * ) hb_xgrab( ulDst + 1 ); - memcpy( pszDst, pszSrc, ulDst ); - pszDst[ ulDst ] = '\0'; - hb_cdpnTranslate( pszDst, cdpIn, cdpOut, ulDst ); - } - } - else - { - ulDst = *pulLen; - pszDst = ( char * ) hb_xgrab( ulDst + 1 ); - memcpy( pszDst, pszSrc, ulDst ); - pszDst[ ulDst ] = '\0'; - } - - *pulLen = ulDst; - - return pszDst; -} - -const char * hb_cdpnDup2( const char * pszSrc, ULONG ulSrc, - char * pszDst, ULONG * pulDst, - PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) -{ - if( cdpIn && cdpOut && cdpIn != cdpOut ) - { - if( cdpIn == &s_utf8_codepage ) - *pulDst = hb_cdpUTF8ToStrn( cdpOut, FALSE, pszSrc, ulSrc, pszDst, *pulDst ); - else if( cdpOut == &s_utf8_codepage ) - *pulDst = hb_cdpStrnToUTF8n( cdpIn, FALSE, pszSrc, ulSrc, pszDst, *pulDst ); - else - { - /* TODO: add unicode base translation which can respect - * multibyte characters - */ - if( *pulDst > ulSrc ) + if( ucLo == '.' && + pup[ 0 ] && pup[ 1 ] && + ( pup[ 2 ] == '.' || pup[ 2 ] == '=' ) && + plo[ 0 ] && plo[ 1 ] && + ( plo[ 2 ] == '.' || plo[ 2 ] == '=' ) ) { - *pulDst = ulSrc; - pszDst[ ulSrc ] = '\0'; + ucUp = ( unsigned char ) *pup; + ucLo = ( unsigned char ) *plo; + + if( ( ucUp != ' ' || ucLo != ' ' ) && + ( ucUp == *pup || ( ucUp != ' ' && *pup != ' ' ) ) && + ( ucLo == *plo || ( ucLo != ' ' && *plo != ' ' ) ) ) + { + if( ucUp != ' ' ) + ++iSortLo; + pup += 2; + plo += 2; + if( *pup == '=' ) + { + do + ++pup; + while( HB_ISXDIGIT( *pup ) ); + } + if( *plo == '=' ) + { + do + ++plo; + while( HB_ISXDIGIT( *plo ) ); + } + if( *pup == '.' && *plo == '.' ) + { + lSort = TRUE; + iMulti++; + pup++; + plo++; + continue; + } + } } + fError = TRUE; + break; + } + if( ucUp == '~' ) + { + if( ucLo != '~' || *pup == '\0' || *plo == '\0' ) + { + fError = TRUE; + break; + } + ucUp = ( unsigned char ) *pup++; + ucLo = ( unsigned char ) *plo++; + ++iAcc; + } + if( used[ ucUp ] != 0 ) + ucUp = ' '; + if( used[ ucLo ] != 0 ) + ucLo = ' '; + if( ucUp == ' ' && ucLo == ' ' ) + { + fError = TRUE; + break; + } + if( ucUp != ' ' ) + { + used[ ucUp ] = 1; + ++iSortLo; + if( ucUp < ucUp2 ) + lSort = TRUE; + ucUp2 = ucUp; + } + if( ucLo != ' ' ) + { + used[ ucLo ] = 1; + if( ucLo < ucLo2 ) + lSort = TRUE; + ucLo2 = ucLo; + } + } + + if( iMulti > 64 ) + fError = TRUE; + + if( fError || nACSort > HB_CDP_ACSORT_INTERLEAVED ) + hb_errInternal( 9994, "Harbour CP (%s) initialization failure", id, NULL ); + + if( iAcc == 0 ) + nACSort = HB_CDP_ACSORT_NONE; + else if( nACSort != HB_CDP_ACSORT_NONE ) + lSort = TRUE; + + ulSize = 0x300; + if( lSort ) + { + ulSize += 0x100; + if( nACSort == HB_CDP_ACSORT_INTERLEAVED ) + ulSize += 0x100; + } + ul = ulSize; + ulSize += sizeof( HB_CODEPAGE ); + if( iMulti ) + ulSize += iMulti * sizeof( HB_MULTICHAR ); + + buffer = ( unsigned char * ) hb_xgrab( ulSize ); + memset( buffer, '\0', ulSize ); + cdp = ( PHB_CODEPAGE ) &buffer[ ul ]; + cdp->buffer = buffer; + + cdp->flags = flags = buffer; + buffer += 0x100; + cdp->upper = upper = buffer; + buffer += 0x100; + cdp->lower = lower = buffer; + buffer += 0x100; + sort = acc = NULL; + if( lSort ) + { + cdp->sort = sort = buffer; + buffer += 0x100; + if( nACSort == HB_CDP_ACSORT_INTERLEAVED ) + { + cdp->acc = acc = buffer; + buffer += 0x100; + } + } + if( iMulti ) + cdp->multi = ( PHB_MULTICHAR ) &buffer[ sizeof( HB_CODEPAGE ) ]; + + cdp->id = id; + cdp->info = info; + cdp->uniTable = uniTable; + cdp->nACSort = nACSort; + cdp->nMulti = iMulti; + for( i = 0; i < 0x100; ++i ) + { + if( HB_ISDIGIT( i ) ) + flags[ i ] |= HB_CDP_DIGIT; + if( HB_ISALPHA( i ) ) + flags[ i ] |= HB_CDP_ALPHA; + if( HB_ISUPPER( i ) ) + flags[ i ] |= HB_CDP_UPPER; + if( HB_ISLOWER( i ) ) + flags[ i ] |= HB_CDP_LOWER; + upper[ i ] = ( unsigned char ) HB_TOUPPER( i ); + lower[ i ] = ( unsigned char ) HB_TOLOWER( i ); + } + + iAccUp = iAccLo = 0; + multi = cdp->multi; + pup = pszUpper; + plo = pszLower; + ucUp2 = ucLo2 = 255; + while( *pup ) + { + ucUp = ( unsigned char ) *pup++; + ucLo = ( unsigned char ) *plo++; + if( ucUp == '.' ) + { + multi->cFirst[ 0 ] = *pup++; + multi->cLast [ 0 ] = *pup++; + multi->cFirst[ 1 ] = *plo++; + multi->cLast [ 1 ] = *plo++; + if( multi->cFirst[ 0 ] != ' ' ) + { + flags[ ( unsigned char ) multi->cFirst[ 0 ] ] |= HB_CDP_MULTI1; + flags[ ( unsigned char ) multi->cLast [ 0 ] ] |= HB_CDP_MULTI2; + multi->sortUp = ++iSortUp; + } + if( multi->cFirst[ 1 ] != ' ' ) + { + flags[ ( unsigned char ) multi->cFirst[ 1 ] ] |= HB_CDP_MULTI1; + flags[ ( unsigned char ) multi->cLast [ 1 ] ] |= HB_CDP_MULTI2; + multi->sortLo = ++iSortLo; + } + if( *pup == '=' ) + { + ++pup; + while( HB_ISXDIGIT( *pup ) ) + { + multi->wcUp = ( multi->wcUp << 4 ) | + ( *pup >= 'a' ? ( *pup - 'a' + 10 ) : + ( *pup >= 'A' ? ( *pup - 'A' + 10 ) : + ( *pup - '0' ) ) ); + ++pup; + } + } + pup++; + if( *plo == '=' ) + { + ++plo; + while( HB_ISXDIGIT( *plo ) ) + { + multi->wcLo = ( multi->wcLo << 4 ) | + ( *plo >= 'a' ? ( *plo - 'a' + 10 ) : + ( *plo >= 'A' ? ( *plo - 'A' + 10 ) : + ( *plo - '0' ) ) ); + ++plo; + } + } + plo++; + if( multi->wcUp || multi->wcLo ) + cdp->nMultiUC++; + multi++; + } + else + { + iAcc = 0; + if( ucUp == '~' ) + { + iAcc = 1; + ucUp = ( unsigned char ) *pup++; + ucLo = ( unsigned char ) *plo++; + } + if( ucUp != ' ' ) + { + flags[ ucUp ] |= HB_CDP_ALPHA; + flags[ ucUp ] |= HB_CDP_UPPER; + if( ucLo != ' ' ) + lower[ ucUp ] = ucLo; + if( sort ) + { + if( sort[ ucUp ] == 0 ) + { + if( iAcc && nACSort != HB_CDP_ACSORT_NONE ) + ++iAccUp; + sort[ ucUp ] = ++iSortUp - iAccUp; + if( acc ) + acc[ ucUp ] = iSortUp; + if( ucUp2 > ucUp ) + ucUp2 = ucUp; + } + } + } + if( ucLo != ' ' ) + { + flags[ ucLo ] |= HB_CDP_ALPHA; + flags[ ucLo ] |= HB_CDP_LOWER; + if( ucUp != ' ' ) + upper[ ucLo ] = ucUp; + if( sort ) + { + if( sort[ ucLo ] == 0 ) + { + if( iAcc && nACSort != HB_CDP_ACSORT_NONE ) + ++iAccLo; + sort[ ucLo ] = ++iSortLo - iAccLo; + if( acc ) + acc[ ucLo ] = iSortLo; + if( ucLo2 > ucLo ) + ucLo2 = ucLo; + } + } + } + } + } + + if( sort ) + { + int iUp, iLo, iSort1, iSort2, iSort3, iAdd; + + if( iMulti > 0 ) + { + if( iMulti > ucUp2 || iMulti > ucLo2 ) + hb_errInternal( 9994, "Harbour CP (%s) initialization failure", id, NULL ); + + if( iMulti <= 32 ) + iMulti = 33; else - ulSrc = *pulDst; - memcpy( pszDst, pszSrc, ulSrc ); - hb_cdpnTranslate( pszDst, cdpIn, cdpOut, ulSrc ); - } - } - else - { - if( *pulDst > ulSrc ) - { - *pulDst = ulSrc; - pszDst[ ulSrc ] = '\0'; + iMulti = 65; } else - ulSrc = *pulDst; - memcpy( pszDst, pszSrc, ulSrc ); - } + iMulti = 1; - return pszDst; -} - -const char * hb_cdpnDup3( const char * pszSrc, ULONG ulSrc, - char * pszDst, ULONG * pulDst, - char ** pszFree, ULONG * pulSize, - PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) -{ - if( cdpIn && cdpOut && cdpIn != cdpOut && ulSrc ) - { - char * pszPrev = NULL; - ULONG ulDst = cdpOut != &s_utf8_codepage ? ulSrc : - hb_cdpStringInUTF8Length( cdpIn, FALSE, pszSrc, ulSrc ); - - if( pszDst == NULL ) + for( iUp = iLo = 0, i = iMulti; i < 256; ++i ) { - pszDst = *pszFree; - if( pszDst == NULL && *pulSize > 0 ) - pszDst = ( char * ) pszSrc; - } - - if( ulDst >= *pulSize || - ( pszDst == pszSrc && cdpOut == &s_utf8_codepage ) ) - { - pszPrev = *pszFree; - pszDst = *pszFree = ( char * ) hb_xgrab( ulDst + 1 ); - *pulSize = ulDst + 1; - } - - if( cdpIn == &s_utf8_codepage ) - ulDst = hb_cdpUTF8ToStrn( cdpOut, FALSE, pszSrc, ulSrc, pszDst, *pulSize ); - else if( cdpOut == &s_utf8_codepage ) - ulDst = hb_cdpStrnToUTF8n( cdpIn, FALSE, pszSrc, ulSrc, pszDst, *pulSize ); - else - { - /* TODO: add unicode base translation which can respect - * multibyte characters - */ - if( pszDst != pszSrc ) - memcpy( pszDst, pszSrc, ulDst ); - pszDst[ ulDst ] = '\0'; - hb_cdpnTranslate( pszDst, cdpIn, cdpOut, ulSrc ); - } - if( pszPrev ) - hb_xfree( pszPrev ); - if( pulDst ) - *pulDst = ulDst; - return pszDst; - } - - if( pulDst ) - *pulDst = ulSrc; - return pszSrc; -} - -int hb_cdpchrcmp( char cFirst, char cSecond, PHB_CODEPAGE cdpage ) -{ - int n1, n2; - - if( cFirst == cSecond ) - return 0; - - if( ( n1 = ( int ) cdpage->s_chars[ ( UCHAR ) cFirst ] ) != 0 && - ( n2 = ( int ) cdpage->s_chars[ ( UCHAR ) cSecond ] ) != 0 ) - return ( n1 < n2 ) ? -1 : 1; - - return ( ( UCHAR ) cFirst < ( UCHAR ) cSecond ) ? -1 : 1; -} - -static int hb_cdpMultiWeight( PHB_CODEPAGE cdpage, const char *szChar ) -{ - PHB_MULTICHAR pmulti = cdpage->multi; - int j; - - for( j = 0; j < cdpage->nMulti; ++j, ++pmulti ) - { - if( ( *szChar == pmulti->cFirst[0] || - *szChar == pmulti->cFirst[1] ) && - ( *( szChar + 1 ) == pmulti->cLast[0] || *( szChar + 1 ) == pmulti->cLast[1] ) ) - { - return pmulti->nCode + - ( ( *szChar == pmulti->cFirst[0] ) ? 0 : - ( cdpage->nChars + ( cdpage->lLatin ? 6 : 0 ) ) ); - } - } - - return 0; -} - -int hb_cdpcmp( const char *szFirst, ULONG ulLenFirst, - const char *szSecond, ULONG ulLenSecond, - PHB_CODEPAGE cdpage, BOOL fExact ) -{ - int iRet = 0, iAcc = 0, n1 = 0, n2 = 0; - ULONG ul, ulLen; - - ulLen = ulLenFirst < ulLenSecond ? ulLenFirst : ulLenSecond; - for( ul = 0; ul < ulLen; ++szFirst, ++szSecond, ++ul ) - { - if( *szFirst != *szSecond ) - { - if( cdpage->nMulti ) + if( sort[ i ] == 0 ) { - int nd1, nd2; - - if( ul > 0 ) - { - nd1 = hb_cdpMultiWeight( cdpage, szFirst - 1 ); - nd2 = hb_cdpMultiWeight( cdpage, szSecond - 1 ); - if( nd1 ) - { - if( nd2 ) - { - if( nd1 == nd2 ) - { - nd1 = ( UCHAR ) cdpage->s_chars[ ( UCHAR ) * szFirst ]; - nd2 = ( UCHAR ) cdpage->s_chars[ ( UCHAR ) * szSecond ]; - if( nd1 == nd2 || !nd1 || !nd2 ) - { - nd1 = ( UCHAR ) * szFirst; - nd2 = ( UCHAR ) * szSecond; - } - } - } - else - nd2 = n2; - iRet = ( nd1 < nd2 ) ? -1 : 1; - break; - } - else if( nd2 ) - { - iRet = ( n1 < nd2 ) ? -1 : 1; - break; - } - } - nd1 = ( ul < ulLenFirst - 1 ) ? hb_cdpMultiWeight( cdpage, szFirst ) : 0; - nd2 = ( ul < ulLenSecond - 1 ) ? hb_cdpMultiWeight( cdpage, szSecond ) : 0; - if( nd1 ) - { - if( nd2 ) - { - if( nd1 == nd2 ) - { - nd1 = ( UCHAR ) cdpage->s_chars[ ( UCHAR ) * szFirst ]; - nd2 = ( UCHAR ) cdpage->s_chars[ ( UCHAR ) * szSecond ]; - if( nd1 == nd2 || !nd1 || !nd2 ) - { - nd1 = ( UCHAR ) * szFirst; - nd2 = ( UCHAR ) * szSecond; - } - } - } - else - nd2 = ( UCHAR ) cdpage->s_chars[( UCHAR ) * szSecond]; - iRet = ( nd1 < nd2 ) ? -1 : 1; - break; - } - else if( nd2 ) - { - nd1 = ( UCHAR ) cdpage->s_chars[( UCHAR ) * szFirst]; - iRet = ( nd1 < nd2 ) ? -1 : 1; - break; - } + if( i < ( int ) ucUp2 ) + ++iUp; + else if( i < ( int ) ucLo2 ) + ++iLo; } - - if( ( n1 = ( UCHAR ) cdpage->s_chars[ ( UCHAR ) * szFirst ] ) == 0 || - ( n2 = ( UCHAR ) cdpage->s_chars[ ( UCHAR ) * szSecond ] ) == 0 ) + } + for( iSort1 = iSort2 = iSort3 = 0, i = iMulti; i < 256; ++i ) + { + if( sort[ i ] == 0 ) { - /* One of characters doesn't belong to the national characters */ - iRet = ( ( UCHAR ) * szFirst < ( UCHAR ) * szSecond ) ? -1 : 1; - break; - } - else if( n1 == n2 ) - { - if( iAcc == 0 && ( fExact || ( ulLenFirst == ulLenSecond && cdpage->lAccInterleave ) ) ) - { - if( cdpage->lAccInterleave ) - iAcc = ( cdpage->s_accent[ ( UCHAR ) * szFirst ] < - cdpage->s_accent[ ( UCHAR ) * szSecond ] ) ? -1 : 1; - else - iAcc = ( ( UCHAR ) * szFirst < ( UCHAR ) * szSecond ) ? -1 : 1; - } + if( i < ( int ) ucUp2 ) + iAdd = ++iSort1; + else if( i < ( int ) ucLo2 ) + iAdd = ++iSort2 + iSortUp + iUp; + else + iAdd = ++iSort3 + iUp + iSortLo + iLo; } + else if( sort[ i ] <= iSortUp ) + iAdd = iUp; else - { - iRet = ( n1 < n2 ) ? -1 : 1; - break; - } + iAdd = iUp + iLo; + + sort[ i ] += iAdd; + if( acc ) + acc[ i ] += iAdd; } } - if( !iRet ) - { - if( iAcc ) - iRet = iAcc; - else if( ulLenSecond > ulLenFirst ) - iRet = -1; - else if( fExact && ulLenSecond < ulLenFirst ) - iRet = 1; - } - - return iRet; + return cdp; } -static int hb_cdpMultiWeightI( PHB_CODEPAGE cdpage, const char *szChar ) +static PHB_CODEPAGE * hb_cdpFindPos( const char * id ) { - PHB_MULTICHAR pmulti = cdpage->multi; - int j; + PHB_CODEPAGE * cdp_ptr; - for( j = 0; j < cdpage->nMulti; ++j, ++pmulti ) + if( s_cdpList == NULL ) { - if( ( *szChar == pmulti->cFirst[0] || - *szChar == pmulti->cFirst[1] ) && - ( *( szChar + 1 ) == pmulti->cLast[0] || *( szChar + 1 ) == pmulti->cLast[1] ) ) + unsigned char * flags, * upper, * lower; + int i; + + s_en_codepage.buffer = ( unsigned char * ) hb_xgrab( 0x300 ); + memset( s_en_codepage.buffer, '\0', 0x300 ); + s_en_codepage.flags = flags = ( unsigned char * ) s_en_codepage.buffer; + s_en_codepage.upper = upper = ( unsigned char * ) s_en_codepage.buffer + 0x100; + s_en_codepage.lower = lower = ( unsigned char * ) s_en_codepage.buffer + 0x200; + for( i = 0; i < 0x100; ++i ) { - return pmulti->nCode; + if( HB_ISDIGIT( i ) ) + flags[ i ] |= HB_CDP_DIGIT; + if( HB_ISALPHA( i ) ) + flags[ i ] |= HB_CDP_ALPHA; + if( HB_ISUPPER( i ) ) + flags[ i ] |= HB_CDP_UPPER; + if( HB_ISLOWER( i ) ) + flags[ i ] |= HB_CDP_LOWER; + upper[ i ] = ( unsigned char ) HB_TOUPPER( i ); + lower[ i ] = ( unsigned char ) HB_TOLOWER( i ); } + s_utf8_codepage.flags = s_en_codepage.flags; + s_utf8_codepage.upper = s_en_codepage.upper; + s_utf8_codepage.lower = s_en_codepage.lower; + s_cdpList = &s_en_codepage; } - return 0; + cdp_ptr = &s_cdpList; + while( *cdp_ptr ) + { + if( strcmp( ( *cdp_ptr )->id, id ) == 0 ) + break; + cdp_ptr = &( *cdp_ptr )->next; + } + return cdp_ptr; } -int hb_cdpicmp( const char *szFirst, ULONG ulLenFirst, - const char *szSecond, ULONG ulLenSecond, - PHB_CODEPAGE cdpage, BOOL fExact ) +BOOL hb_cdpRegisterRaw( PHB_CODEPAGE cdp ) { - int iRet = 0, iAcc = 0, n1 = 0, n2 = 0, u1, u2; - ULONG ul, ulLen; + PHB_CODEPAGE * cdp_ptr; - ulLen = ulLenFirst < ulLenSecond ? ulLenFirst : ulLenSecond; - for( ul = 0; ul < ulLen; ++szFirst, ++szSecond, ++ul ) + HB_TRACE( HB_TR_DEBUG, ( "hb_cdpRegisterRaw(%p)", cdp ) ); + + cdp_ptr = hb_cdpFindPos( cdp->id ); + if( *cdp_ptr == NULL ) { - u1 = ( UCHAR ) cdpage->s_upper[( UCHAR ) * szFirst]; - u2 = ( UCHAR ) cdpage->s_upper[( UCHAR ) * szSecond]; - if( u1 != u2 ) - { - if( cdpage->nMulti ) - { - int nd1, nd2; - - if( ul > 0 ) - { - nd1 = hb_cdpMultiWeightI( cdpage, szFirst - 1 ); - nd2 = hb_cdpMultiWeightI( cdpage, szSecond - 1 ); - if( nd1 ) - { - if( nd2 ) - { - if( nd1 == nd2 ) - { - nd1 = ( UCHAR ) cdpage->s_chars[u1]; - nd2 = ( UCHAR ) cdpage->s_chars[u2]; - if( nd1 == nd2 || !nd1 || !nd2 ) - { - nd1 = u1; - nd2 = u2; - } - } - } - else - nd2 = n2; - iRet = ( nd1 < nd2 ) ? -1 : 1; - break; - } - else if( nd2 ) - { - iRet = ( n1 < nd2 ) ? -1 : 1; - break; - } - } - nd1 = ( ul < ulLenFirst - 1 ) ? hb_cdpMultiWeightI( cdpage, szFirst ) : 0; - nd2 = ( ul < ulLenSecond - 1 ) ? hb_cdpMultiWeightI( cdpage, szSecond ) : 0; - if( nd1 ) - { - if( nd2 ) - { - if( nd1 == nd2 ) - { - nd1 = ( UCHAR ) cdpage->s_chars[u1]; - nd2 = ( UCHAR ) cdpage->s_chars[u2]; - if( nd1 == nd2 || !nd1 || !nd2 ) - { - nd1 = u1; - nd2 = u2; - } - } - } - else - nd2 = ( UCHAR ) cdpage->s_chars[u2]; - iRet = ( nd1 < nd2 ) ? -1 : 1; - break; - } - else if( nd2 ) - { - nd1 = ( UCHAR ) cdpage->s_chars[u1]; - iRet = ( nd1 < nd2 ) ? -1 : 1; - break; - } - } - - if( ( n1 = ( UCHAR ) cdpage->s_chars[u1] ) == 0 || - ( n2 = ( UCHAR ) cdpage->s_chars[u2] ) == 0 ) - { - /* One of characters doesn't belong to the national characters */ - iRet = ( u1 < u2 ) ? -1 : 1; - break; - } - else if( n1 == n2 ) - { - if( iAcc == 0 && ( fExact || ( ulLenFirst == ulLenSecond && cdpage->lAccInterleave ) ) ) - { - if( cdpage->lAccInterleave ) - iAcc = ( cdpage->s_accent[u1] < cdpage->s_accent[u2] ) ? -1 : 1; - else - iAcc = ( u1 < u2 ) ? -1 : 1; - } - } - else - { - iRet = ( n1 < n2 ) ? -1 : 1; - break; - } - } + *cdp_ptr = cdp; + return TRUE; } + return FALSE; +} - if( !iRet ) +BOOL hb_cdpRegisterNew( const char * id, const char * info, + PHB_UNITABLE uniTable, + const char * pszUpper, const char * pszLower, + unsigned int nACSort ) +{ + PHB_CODEPAGE * cdp_ptr; + + HB_TRACE( HB_TR_DEBUG, ( "hb_cdpRegisterNew(%s,%s,%s,%s,%d)", id, info, pszUpper, pszLower, nACSort ) ); + + cdp_ptr = hb_cdpFindPos( id ); + if( *cdp_ptr == NULL ) { - if( iAcc ) - iRet = iAcc; - else if( ulLenSecond > ulLenFirst ) - iRet = -1; - else if( fExact && ulLenSecond < ulLenFirst ) - iRet = 1; + *cdp_ptr = hb_buildCodePage( id, info, uniTable, pszUpper, pszLower, nACSort ); + return *cdp_ptr != NULL; } - - return iRet; + return FALSE; } void hb_cdpReleaseAll( void ) { - int iPos = 0; + HB_TRACE( HB_TR_DEBUG, ( "hb_cdpReleaseAll()" ) ); - while( iPos < HB_CDP_MAX_ && s_cdpList[iPos] ) + while( s_cdpList ) { - if( s_cdpList[iPos]->buffer ) - hb_xfree( s_cdpList[iPos]->buffer ); - if( s_cdpList[iPos]->multi ) - hb_xfree( s_cdpList[iPos]->multi ); - iPos++; + void * buffer = s_cdpList->buffer; + if( s_cdpList->uniTable->uniTrans ) + { + hb_xfree( s_cdpList->uniTable->uniTrans ); + s_cdpList->uniTable->uniTrans = NULL; + } + s_cdpList = s_cdpList->next; + if( buffer ) + hb_xfree( buffer ); + } +} + +PHB_CODEPAGE hb_cdpFind( const char * id ) +{ + HB_TRACE( HB_TR_DEBUG, ( "hb_cdpFind(%s)", id ) ); + + return id ? * hb_cdpFindPos( id ) : NULL; +} + +PHB_CODEPAGE hb_cdpFindExt( const char * id ) +{ + PHB_CODEPAGE cdp = NULL; + + HB_TRACE( HB_TR_DEBUG, ( "hb_cdpFindExt(%s)", id ) ); + + if( id ) + { + cdp = * hb_cdpFindPos( id ); + if( cdp == NULL && strcmp( id, "UTF8" ) == 0 ) + return &s_utf8_codepage; + } + return cdp; +} + +PHB_CODEPAGE hb_cdpSelect( PHB_CODEPAGE cdp ) +{ + PHB_CODEPAGE cdpOld; + + HB_TRACE( HB_TR_DEBUG, ( "hb_cdpSelect(%p)", cdp ) ); + + cdpOld = hb_vmCDP(); + if( cdp ) + hb_vmSetCDP( cdp ); + + return cdpOld; +} + +const char * hb_cdpID( void ) +{ + PHB_CODEPAGE cdp; + + HB_TRACE( HB_TR_DEBUG, ( "hb_cdpID()" ) ); + + cdp = hb_vmCDP(); + + return cdp ? cdp->id : NULL; +} + +const char * hb_cdpSelectID( const char * id ) +{ + const char * idOld; + + HB_TRACE( HB_TR_DEBUG, ( "hb_cdpSelectID(%s)", id ) ); + + idOld = hb_cdpID(); + hb_cdpSelect( hb_cdpFind( id ) ); + + return idOld; +} + +/* + * basic CP PRG functions + */ +HB_FUNC( HB_CDPLIST ) +{ + PHB_CODEPAGE cdp; + int iCount; + + cdp = s_cdpList; + iCount = 0; + while( cdp ) + { + ++iCount; + cdp = cdp->next; + } + + hb_reta( iCount ); + cdp = s_cdpList; + iCount = 0; + while( cdp ) + { + hb_storvc( cdp->id, -1, ++iCount ); + cdp = cdp->next; } } @@ -1881,9 +1946,26 @@ HB_FUNC( HB_CDPSELECT ) HB_FUNC( HB_CDPUNIID ) { - PHB_CODEPAGE cdp = hb_cdpFind( hb_parcx( 1 ) ); + const char * id = hb_parc( 1 ); + PHB_CODEPAGE cdp = id ? *hb_cdpFindPos( id ) : hb_vmCDP(); - hb_retc( cdp ? cdp->uniID : NULL ); + hb_retc( cdp ? cdp->uniTable->uniID : NULL ); +} + +HB_FUNC( HB_CDPINFO ) +{ + const char * id = hb_parc( 1 ); + PHB_CODEPAGE cdp = id ? *hb_cdpFindPos( id ) : hb_vmCDP(); + + hb_retc( cdp ? cdp->info : NULL ); +} + +HB_FUNC( __NATSORTVER ) +{ + /* NOTE: CA-Cl*pper 5.2e Intl. will return: "NATSORT v1.2i x14 19/Mar/93" */ + /* NOTE: CA-Cl*pper 5.3 Intl. will return: "NATSORT v1.3i x19 06/Mar/95" */ + + HB_FUNC_EXEC( HB_CDPINFO ); } HB_FUNC( HB_SETCODEPAGE ) @@ -1891,6 +1973,9 @@ HB_FUNC( HB_SETCODEPAGE ) HB_FUNC_EXEC( HB_CDPSELECT ); } +/* + * extended CP PRG functions + */ HB_FUNC( HB_TRANSLATE ) { ULONG ulLen = hb_parclen( 1 ); @@ -1914,21 +1999,18 @@ HB_FUNC( HB_TRANSLATE ) hb_retc_null(); } -HB_FUNC( HB_CDPLIST ) +HB_FUNC( HB_UTF8CHR ) { - int iCount, iPos; - - for( iCount = 0; iCount < HB_CDP_MAX_; ++iCount ) + if( HB_ISNUM( 1 ) ) { - if( !s_cdpList[iCount] ) - break; - } + char utf8Char[ HB_MAX_UTF8 ]; + int iLen; - hb_reta( iCount ); - for( iPos = 0; iPos < iCount; ++iPos ) - { - hb_storvc( s_cdpList[iPos]->id, -1, iPos + 1 ); + iLen = u16toutf8( utf8Char, ( HB_WCHAR ) hb_parni( 1 ) ); + hb_retclen( utf8Char, iLen ); } + else + hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } HB_FUNC( HB_STRTOUTF8 ) @@ -1944,9 +2026,9 @@ HB_FUNC( HB_STRTOUTF8 ) if( cdp ) { szString = hb_parc( 1 ); - ulDest = hb_cdpStringInUTF8Length( cdp, FALSE, szString, ulLen ); + ulDest = hb_cdpStrAsUTF8Len( cdp, FALSE, szString, ulLen, 0 ); szDest = ( char * ) hb_xgrab( ulDest + 1 ); - hb_cdpStrnToUTF8( cdp, FALSE, szString, ulLen, szDest ); + hb_cdpStrToUTF8( cdp, FALSE, szString, ulLen, szDest, ulDest + 1 ); } } if( szDest ) @@ -1955,22 +2037,6 @@ HB_FUNC( HB_STRTOUTF8 ) hb_retc_null(); } -HB_FUNC( HB_UTF8CHR ) -{ - if( HB_ISNUM( 1 ) ) - { - char utf8Char[ HB_MAX_UTF8 ]; - int iLen; - - iLen = u16toutf8( utf8Char, ( HB_WCHAR ) hb_parni( 1 ) ); - hb_retclen( utf8Char, iLen ); - } - else - { - hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); - } -} - HB_FUNC( HB_UTF8TOSTR ) { const char *szString = hb_parc( 1 ); @@ -1987,9 +2053,9 @@ HB_FUNC( HB_UTF8TOSTR ) if( cdp ) { szString = hb_parc( 1 ); - ulDest = hb_cdpUTF8StringLength( szString, ulLen ); + ulDest = hb_cdpUTF8AsStrLen( cdp, FALSE, szString, ulLen, 0 ); szDest = ( char * ) hb_xgrab( ulDest + 1 ); - hb_cdpUTF8ToStrn( cdp, FALSE, szString, ulLen, szDest, ulDest ); + hb_cdpUTF8ToStr( cdp, FALSE, szString, ulLen, szDest, ulDest + 1 ); } } @@ -2215,7 +2281,7 @@ HB_FUNC( HB_UTF8LEN ) hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* non of numeric parameters in STRTRAN() (4-th and 5-th) refers to +/* none of numeric parameters in STRTRAN() (4-th and 5-th) refers to * character position in string so we do not need to create new * HB_UTF8STRTRAN() but we can safely use normal STRTRAN() function */ @@ -2226,92 +2292,35 @@ HB_FUNC( HB_UTF8STRTRAN ) HB_FUNC_EXEC( STRTRAN ) } -#else /* !HB_CDP_SUPPORT_OFF */ - -BOOL hb_charIsDigit( int iChar ) +#ifdef HB_LEGACY_LEVEL2 +void hb_cdpnTranslate( char *psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, ULONG nChars ) { - return HB_ISDIGIT( ( unsigned char ) iChar ); -} - -BOOL hb_charIsAlpha( int iChar ) -{ - return HB_ISALPHA( ( unsigned char ) iChar ); -} - -BOOL hb_charIsLower( int iChar ) -{ - return HB_ISLOWER( ( unsigned char ) iChar ); -} - -BOOL hb_charIsUpper( int iChar ) -{ - return HB_ISUPPER( ( unsigned char ) iChar ); -} - -#endif /* HB_CDP_SUPPORT_OFF */ - -/* converts szText to lower case. Does not create a new string! */ -char * hb_strLower( char * szText, ULONG ulLen ) -{ - HB_TRACE(HB_TR_DEBUG, ("hb_strLower(%s, %lu)", szText, ulLen)); - + if( cdpIn != cdpOut ) { - ULONG i; -#ifndef HB_CDP_SUPPORT_OFF - PHB_CODEPAGE cdp = hb_vmCDP(); - if( cdp && cdp->nChars ) - for( i = 0; i < ulLen; i++ ) - szText[ i ] = ( char ) cdp->s_lower[ ( UCHAR ) szText[ i ] ]; - else -#endif - for( i = 0; i < ulLen; i++ ) - szText[ i ] = HB_TOLOWER( szText[ i ] ); + ULONG ulDst = nChars; + char * pDst = psz; + + if( cdpOut == &s_utf8_codepage || cdpOut->nMultiUC ) + { + ulDst = hb_cdpTransLen( psz, nChars, 0, cdpIn, cdpOut ); + pDst = ( char * ) hb_xgrab( ulDst ); + } + ulDst = hb_cdpTransTo( psz, nChars, pDst, ulDst, cdpIn, cdpOut ); + if( psz != pDst ) + { + if( ulDst > nChars ) + ulDst = nChars; + memcpy( psz, pDst, ulDst ); + hb_xfree( pDst ); + } + if( ulDst < nChars ) + memset( psz + ulDst, '\0', nChars - ulDst ); } - - return szText; } -/* converts szText to upper case. Does not create a new string! */ -char * hb_strUpper( char * szText, ULONG ulLen ) +void hb_cdpTranslate( char *psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut ) { - HB_TRACE(HB_TR_DEBUG, ("hb_strUpper(%s, %lu)", szText, ulLen)); - - { - ULONG i; -#ifndef HB_CDP_SUPPORT_OFF - PHB_CODEPAGE cdp = hb_vmCDP(); - if( cdp && cdp->nChars ) - for( i = 0; i < ulLen; i++ ) - szText[ i ] = ( char ) cdp->s_upper[ ( UCHAR ) szText[ i ] ]; - else -#endif - for( i = 0; i < ulLen; i++ ) - szText[ i ] = HB_TOUPPER( szText[ i ] ); - } - - return szText; + if( cdpIn != cdpOut ) + hb_cdpnTranslate( psz, cdpIn, cdpOut, strlen( psz ) ); } - -/* converts iChar to lower case */ -int hb_charLower( int iChar ) -{ -#ifndef HB_CDP_SUPPORT_OFF - PHB_CODEPAGE cdp = hb_vmCDP(); - if( cdp && cdp->nChars ) - return ( unsigned char ) cdp->s_lower[ (unsigned char) iChar ]; - else #endif - return HB_TOLOWER( iChar ); -} - -/* converts iChar to upper case */ -int hb_charUpper( int iChar ) -{ -#ifndef HB_CDP_SUPPORT_OFF - PHB_CODEPAGE cdp = hb_vmCDP(); - if( cdp && cdp->nChars ) - return ( unsigned char ) cdp->s_upper[ (unsigned char) iChar ]; - else -#endif - return HB_TOUPPER( iChar ); -} diff --git a/harbour/src/rtl/errintlo.c b/harbour/src/rtl/errintlo.c index 3d360253a9..2c320fc747 100644 --- a/harbour/src/rtl/errintlo.c +++ b/harbour/src/rtl/errintlo.c @@ -55,6 +55,7 @@ #include "hbapilng.h" #include "hbdate.h" #include "hbset.h" +#include "hbstack.h" /* NOTE: Use as minimal calls from here, as possible. Don't allocate memory from this function. [vszakats] */ @@ -63,12 +64,12 @@ void hb_errInternalRaw( ULONG ulIntCode, const char * szText, const char * szPar { char buffer[ 8192 ]; char file[ HB_PATH_MAX ]; - const char * szFile; + const char * szFile, * szInfo; + BOOL fStack, fLang; USHORT uiLine; int iLevel; FILE * hLog; - BOOL fLang; HB_TRACE(HB_TR_DEBUG, ("hb_errInternal(%lu, %s, %s, %s)", ulIntCode, szText, szPar1, szPar2)); @@ -78,9 +79,10 @@ void hb_errInternalRaw( ULONG ulIntCode, const char * szText, const char * szPar if( szPar2 == NULL ) szPar2 = ""; - fLang = ( hb_langID() != NULL ); + fStack = hb_stackId() != NULL; + fLang = fStack && hb_langID() != NULL; - szFile = hb_setGetCPtr( HB_SET_HBOUTLOG ); + szFile = fStack ? hb_setGetCPtr( HB_SET_HBOUTLOG ) : NULL; if( !szFile ) szFile = "hb_out.log"; @@ -95,8 +97,9 @@ void hb_errInternalRaw( ULONG ulIntCode, const char * szText, const char * szPar fprintf( hLog, "Application Internal Error - %s\n", hb_cmdargARGVN( 0 ) ); fprintf( hLog, "Terminated at: %04d.%02d.%02d %s\n", iYear, iMonth, iDay, szTime ); - if( *hb_setGetCPtr( HB_SET_HBOUTLOGINFO ) ) - fprintf( hLog, "Info: %s\n", hb_setGetCPtr( HB_SET_HBOUTLOGINFO ) ); + szInfo = fStack ? hb_setGetCPtr( HB_SET_HBOUTLOGINFO ) : NULL; + if( szInfo && *szInfo ) + fprintf( hLog, "Info: %s\n", szInfo ); } hb_conOutErr( hb_conNewLine(), 0 ); @@ -122,16 +125,19 @@ void hb_errInternalRaw( ULONG ulIntCode, const char * szText, const char * szPar if( hLog ) fprintf( hLog, "%s\n", buffer ); - iLevel = 0; - while( hb_procinfo( iLevel++, buffer, &uiLine, file ) ) + if( fStack && hb_stackTotalItems() ) { - char msg[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 32 ]; + iLevel = 0; + while( hb_procinfo( iLevel++, buffer, &uiLine, file ) ) + { + char msg[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 32 ]; - hb_snprintf( msg, sizeof( msg ), "Called from %s(%hu)%s%s\n", buffer, uiLine, *file ? " in " : "", file ); + hb_snprintf( msg, sizeof( msg ), "Called from %s(%hu)%s%s\n", buffer, uiLine, *file ? " in " : "", file ); - hb_conOutErr( msg, 0 ); - if( hLog ) - fprintf( hLog, "%s", msg ); + hb_conOutErr( msg, 0 ); + if( hLog ) + fprintf( hLog, "%s", msg ); + } } if( hLog ) diff --git a/harbour/src/rtl/natmsg.c b/harbour/src/rtl/natmsg.c index 687374035f..30c6a02356 100644 --- a/harbour/src/rtl/natmsg.c +++ b/harbour/src/rtl/natmsg.c @@ -116,14 +116,6 @@ HB_FUNC( __NATMSG ) hb_retc_null(); } -HB_FUNC( __NATSORTVER ) -{ - /* NOTE: CA-Cl*pper 5.2e Intl. will return: "NATSORT v1.2i x14 19/Mar/93" */ - /* NOTE: CA-Cl*pper 5.3 Intl. will return: "NATSORT v1.3i x19 06/Mar/95" */ - - hb_retc_const( "NATSORT (Harbour)" ); -} - HB_FUNC( __NATMSGVER ) { /* NOTE: CA-Cl*pper 5.2e Intl. will return: "NATMSGS v1.2i x14 19/Mar/93" */ diff --git a/harbour/src/vm/estack.c b/harbour/src/vm/estack.c index 6184ab48ac..732f69f6a5 100644 --- a/harbour/src/vm/estack.c +++ b/harbour/src/vm/estack.c @@ -228,6 +228,7 @@ static void hb_stack_free( PHB_STACK pStack ) hb_xfree( pStack->pItems[ i-- ] ); hb_xfree( pStack->pItems ); pStack->pItems = pStack->pPos = pStack->pBase = NULL; + pStack->wItems = 0; #if defined( HB_MT_VM ) if( pStack->pDirBuffer ) { @@ -819,9 +820,19 @@ LONG hb_stackBaseOffset( void ) #undef hb_stackTotalItems LONG hb_stackTotalItems( void ) { +#if defined( HB_MT_VM ) + if( hb_stack_ready() ) + { + HB_STACK_TLS_PRELOAD + + return hb_stack.wItems; + } + return 0; +#else HB_STACK_TLS_PRELOAD return hb_stack.wItems; +#endif } #undef hb_stackDateBuffer diff --git a/harbour/src/vm/itemapi.c b/harbour/src/vm/itemapi.c index 247965105a..3ae96616d8 100644 --- a/harbour/src/vm/itemapi.c +++ b/harbour/src/vm/itemapi.c @@ -2095,7 +2095,7 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) { #ifndef HB_CDP_SUPPORT_OFF PHB_CODEPAGE cdp = hb_vmCDP(); - if( cdp && cdp->lSort ) + if( cdp && cdp->sort ) iRet = hb_cdpcmp( szFirst, ulLenFirst, szSecond, ulLenSecond, cdp, bForceExact ); else @@ -2176,7 +2176,7 @@ int hb_itemStrICmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) { #ifndef HB_CDP_SUPPORT_OFF PHB_CODEPAGE cdp = hb_vmCDP(); - if( cdp && cdp->lSort ) + if( cdp && cdp->sort ) iRet = hb_cdpicmp( szFirst, ulLenFirst, szSecond, ulLenSecond, cdp, bForceExact ); else diff --git a/harbour/src/vm/set.c b/harbour/src/vm/set.c index cf2d70a897..c77ee28de9 100644 --- a/harbour/src/vm/set.c +++ b/harbour/src/vm/set.c @@ -2104,7 +2104,7 @@ const char * hb_setGetCPtr( HB_set_enum set_specifier ) } hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, 0 ); - return FALSE; + return NULL; } int hb_setGetNI( HB_set_enum set_specifier ) @@ -2206,7 +2206,7 @@ int hb_setGetNI( HB_set_enum set_specifier ) } hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, 0 ); - return FALSE; + return 0; } long hb_setGetNL( HB_set_enum set_specifier ) diff --git a/harbour/tests/cpinfo.prg b/harbour/tests/cpinfo.prg index f1d2a3a0bb..f43f9cfe35 100644 --- a/harbour/tests/cpinfo.prg +++ b/harbour/tests/cpinfo.prg @@ -16,18 +16,25 @@ */ -proc main() - local cUp, cLo, cOrd, cOrd2, c, i, a, lWarn +proc main( cdp, info, unicode ) + local cUp, cLo, cOrd, cOrd2, c, i, a, lWarn, lEqual set alternate to cpinfo.txt additive set alternate on + #ifdef __HARBOUR__ /* for test */ - REQUEST HB_CODEPAGE_PLMAZ - set( _SET_CODEPAGE, "PLMAZ" ) + set( _SET_CODEPAGE, iif( empty( cdp ), "PLMAZ", upper( cdp ) ) ) + lEqual := .t. +#else + lEqual := .f. #endif + if !empty( cdp ) + memowrit( "cp" + lower( cdp ) + ".c", genCP( cdp, info, unicode ) ) + endif + a := array( 256 ) for i := 1 to len( a ) a[ i ] := i - 1 @@ -60,6 +67,16 @@ proc main() lWarn := .t. endif c := chr( a[ i ] ) + if i < len(a) + if c + chr( 0 ) > chr( a[ i + 1 ] ) + chr( 0 ) + ? "character " + charis( c ) + " is wrongly sorted" + lWarn := .t. + elseif !lEqual .and. c + chr( 0 ) = chr( a[ i + 1 ] ) + chr( 0 ) + ? "character " + charis( c ) + " and " + chr( a[ i + 1 ] ) + ; + " have the same weight" + lWarn := .t. + endif + endif cOrd += c if isdigit( c ) if asc( c ) < asc( "0" ) .or. asc( c ) > asc( "9" ) @@ -103,6 +120,20 @@ proc main() lWarn := .t. endif next + for i := 1 to len( cUp ) - 1 + c := substr( cUp, i, 1 ) + if c + chr( 0 ) > substr( cUp, i + 1, 1 ) + chr( 0 ) + ? "letter " + charis( c ) + " is wrongly sorted" + lWarn := .t. + endif + next + for i := 1 to len( cLo ) - 1 + c := substr( cLo, i, 1 ) + if c + chr( 0 ) > substr( cLo, i + 1, 1 ) + chr( 0 ) + ? "letter " + charis( c ) + " is wrongly sorted" + lWarn := .t. + endif + next cOrd2 := "" for i := 0 to 255 if i == asc( cUp ) @@ -149,3 +180,107 @@ static function charinfo( c ) cInfo += ", ISLOWER->" + iif( islower( c ), "Y", "N" ) cInfo += ", ISDIGIT->" + iif( isdigit( c ), "Y", "N" ) return cInfo + + +#ifdef __HARBOUR__ + #include "hbextcdp.ch" + #define EOL hb_osNewLine() +#else + #define EOL chr( 13 ) + chr( 10 ) +#endif + +#define HB_CDP_DIGIT 1 +#define HB_CDP_ALPHA 2 +#define HB_CDP_LOWER 4 +#define HB_CDP_UPPER 8 + +static function genCP( id, info, unicode ) + local flags[ 256 ], upper[ 256 ], lower[ 256 ], sort[ 256 ], tmp[ 256 ] + local i, c + + id := upper( id ) + if empty( info ) + info := _natSortVer() + endif + if empty( unicode ) + unicode := "437" + else + unicode := upper( unicode ) + endif + + for i := 1 to 256 + c := chr( i - 1 ) + flags[ i ] := 0 + if isdigit( c ) + flags[ i ] += HB_CDP_DIGIT + endif + if isalpha( c ) + flags[ i ] += HB_CDP_ALPHA + endif + if isupper( c ) + flags[ i ] += HB_CDP_UPPER + endif + if islower( c ) + flags[ i ] += HB_CDP_LOWER + endif + upper[ i ] := asc( upper( c ) ) + lower[ i ] := asc( lower( c ) ) + tmp[ i ] := i - 1 + next + asort( tmp,,, { |x,y| chr( x ) + chr( 0 ) < chr( y ) + chr( 0 ) } ) + for i := 1 to 256 + sort[ tmp[ i ] + 1 ] := i - 1 + next + + return genCPfile( id, info, unicode, flags, upper, lower, sort ) + +static function genCPfile( id, info, unicode, flags, upper, lower, sort ) + local cDef := ; + '/*' + EOL + ' * $Id$' + EOL + ' */' + EOL + EOL + ; + '/*' + EOL + ; + ' * Harbour Project source code:' + EOL + ; + ' * National Collation Support Module ( $1 )' + EOL + ; + ' *' + EOL + ; + ' * Copyright 2009 Przemyslaw Czerpak ' + EOL + ; + ' * www - http://www.harbour-project.org' + EOL + ; + ' *' + EOL + ; + ' * This file is generated automatically by cpinfo.prg' + EOL + ; + ' */' + EOL + ; + '#include "hbapicdp.h"' + EOL + EOL + ; + '#define HB_CP_RAW &s_codePage' + EOL + EOL + ; + 'static const unsigned char s_flags[ 256 ] = { $f };' + EOL + ; + 'static const unsigned char s_upper[ 256 ] = { $u };' + EOL + ; + 'static const unsigned char s_lower[ 256 ] = { $l };' + EOL + ; + 'static const unsigned char s_sort [ 256 ] = { $s };' + EOL + ; + EOL + ; + 'static HB_CODEPAGE s_codePage =' + EOL + ; + '{' + EOL + ; + ' "$1",' + EOL + ; + ' "$2",' + EOL + ; + ' HB_UNITB_$3,' + EOL + ; + ' s_flags,' + EOL + ; + ' s_upper,' + EOL + ; + ' s_lower,' + EOL + ; + ' s_sort,' + EOL + ; + ' NULL,' + EOL + ; + ' 0,' + EOL + ' 0,' + EOL + ' 0,' + EOL + ; + ' NULL,' + EOL + ' NULL,' + EOL + ' NULL,' + EOL + ; + '};' + EOL + EOL + ; + '/* include CP registration code */' + EOL + ; + '#include "hbcdpreg.h"' + EOL + + cDef := strtran( cDef, "$f", a2def( flags ) ) + cDef := strtran( cDef, "$u", a2def( upper ) ) + cDef := strtran( cDef, "$l", a2def( lower ) ) + cDef := strtran( cDef, "$s", a2def( sort ) ) + cDef := strtran( cDef, "$1", id ) + cDef := strtran( cDef, "$2", info ) + cDef := strtran( cDef, "$3", unicode ) +return cDef + +func a2def( a ) + local i, cData := "" + for i := 1 to len( a ) + cData += iif( i == 1, "", "," ) + ltrim( str( a[ i ] ) ) + next +return cData