diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-08-23 10:17:01 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-08-23 10:17:01 +0000 |
commit | 82e002633513b0b73099d293aba30fb14360fa9a (patch) | |
tree | 06d3e4ce4cde2988646b6967ca11598d22278cbe /Build/source/texk/ptexenc/unicode.c | |
parent | 16c57cd409df0f406fc2710bcadadbd790cab70b (diff) |
more upTeX and e-upTeX
git-svn-id: svn://tug.org/texlive/trunk@23652 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/ptexenc/unicode.c')
-rw-r--r-- | Build/source/texk/ptexenc/unicode.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/Build/source/texk/ptexenc/unicode.c b/Build/source/texk/ptexenc/unicode.c index 275ebd75d40..be8768964e3 100644 --- a/Build/source/texk/ptexenc/unicode.c +++ b/Build/source/texk/ptexenc/unicode.c @@ -43,7 +43,7 @@ int UTF8length(int first_byte) /* with strict range check */ -int UTF8Slength(string buff, int buff_len) +int UTF8Slength(unsigned char *buff, int buff_len) { int i, len; @@ -58,7 +58,7 @@ int UTF8Slength(string buff, int buff_len) /* WITHOUT strict range check */ -long UTF8StoUCS(string s) +long UTF8StoUCS(unsigned char *s) { switch (UTF8length(s[0])) { case 1: return s[0]; @@ -70,7 +70,7 @@ long UTF8StoUCS(string s) } #if 0 /* not used */ -int UCStoUTF8S(long ucs, string s) +int UCStoUTF8S(long ucs, unsigned char *s) { if (ucs < 0x80) { *s = ucs; @@ -112,3 +112,20 @@ long UCStoUTF8(long ucs) UCStoUTF8D4(ucs)); return 0; /* unsupported */ } + + +#define UCS_MAX 0x110000L + +/* using over U+10.FFFF Area */ +long UCStoUPTEX (long ucs) +{ + if (0x7F < ucs && ucs < 0x1000) ucs += UCS_MAX; + return ucs; +} + +/* using over U+10.FFFF Area */ +long UPTEXtoUCS (long uptex) +{ + if (UCS_MAX + 0x7F < uptex && uptex < UCS_MAX + 0x1000) uptex -= UCS_MAX; + return uptex; +} |