2009-11-10 11:00 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/tests/cpinfo.prg
    + try to generate HB_CP_UPPER and HB_CP_LOWER strings which are ready to
      use in Harbour CP definition using human readable form.
      Warning: please remember that not all CPs can be created in human
               readable form and if you want to create Clipper compatible
               definition then it should be always verified by comparing .c
               files generated by cpinfo compiled using Clipper and Harbour.
This commit is contained in:
Przemyslaw Czerpak
2009-11-10 10:00:28 +00:00
parent 38029fd7c9
commit 1585573c61
2 changed files with 49 additions and 2 deletions

View File

@@ -17,6 +17,15 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-11-10 11:00 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/tests/cpinfo.prg
+ try to generate HB_CP_UPPER and HB_CP_LOWER strings which are ready to
use in Harbour CP definition using human readable form.
Warning: please remember that not all CPs can be created in human
readable form and if you want to create Clipper compatible
definition then it should be always verified by comparing .c
files generated by cpinfo compiled using Clipper and Harbour.
2009-11-10 09:43 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/codepage/cphu852c.c
* converted to use human readable form which I think should better

View File

@@ -165,12 +165,50 @@ proc main( cdp, info, unicode )
if lWarn
? "Warning: irregular CP which needs special definition in Harbour"
endif
? 'upper: "' + cUp + '"'
? 'lower: "' + cLo + '"'
? ' upper: "' + cUp + '"'
? ' lower: "' + cLo + '"'
if pad_letters( @cUp, @cLo )
? 'HB_CP_UPPER: "' + cUp + '"'
? 'HB_CP_LOWER: "' + cLo + '"'
endif
? repl( "=", 50 )
?
return
static function pad_letters( cUp, cLo )
local lRet, cUp2, cLo2, cU, cL, i, j
cUp2 := cLo2 := ""
i := j := 1
while i <= len( cUp ) .or. j <= len( cLo )
cU := substr( cUp, i, 1 )
cL := substr( cLo, j, 1 )
if upper( cL ) == cU .and. lower( cU ) == cL
++i
++j
elseif cL == "" .or. !islower( lower( cU ) )
cL := " "
++i
elseif cU == "" .or. !isupper( upper( cL ) )
cU := " "
++j
elseif upper( cL ) $ substr( cUp, i + 1 )
cL := lower( cU )
++i
else
cU := upper( cL )
++j
endif
cUp2 += cU
cLo2 += cL
enddo
lRet := !( cUp == cUp2 .and. cLo == cLo2 )
cUp := cUp2
cLo := cLo2
return lRet
static function charval( c )
return "'" + c + "' (" + ltrim( str( asc( c ) ) ) + ")"