diff options
author | Karl Berry <karl@freefriends.org> | 2009-05-19 18:36:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-05-19 18:36:39 +0000 |
commit | 8b36748d305846db9cd0fc23569497a178dd4683 (patch) | |
tree | 720c5218762952e12c3e69917d3093e719dc3cfd /Master/texmf-dist/doc/metapost/mpman-ru/bm-to-utf16be.awk | |
parent | a105d37fbd235ef9e97bc383de505739fcde2712 (diff) |
move mpman-ru out of texmf-doc
git-svn-id: svn://tug.org/texlive/trunk@13248 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/metapost/mpman-ru/bm-to-utf16be.awk')
-rw-r--r-- | Master/texmf-dist/doc/metapost/mpman-ru/bm-to-utf16be.awk | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/metapost/mpman-ru/bm-to-utf16be.awk b/Master/texmf-dist/doc/metapost/mpman-ru/bm-to-utf16be.awk new file mode 100644 index 00000000000..1b6fc262666 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/mpman-ru/bm-to-utf16be.awk @@ -0,0 +1,29 @@ +function to_utf16be(s) { + s1="\\376\\377" + for (i = 1; i <= length(s); i++) { + k = x[substr(s, i, 1)] + if (k == 208) + s1=s1 sprintf("\\004\\%03o", x[substr(s, ++i, 1)] + 128) + else if (k == 209) + s1=s1 sprintf("\\004\\%03o", x[substr(s, ++i, 1)] - 64) + else + s1=s1 sprintf("\\000\\%03o", k) + } + return s1 +} + +BEGIN { + for (i = 0; i < 256; i++) { + x[sprintf("%c", i)] = i + } +} + +{ + p=index($0,"}{") + s1=substr($0,1,p+1) + s=substr($0,p+2) + p=index(s,"}") + s2=substr(s,p) + s=substr(s,1,p-1) + print s1 to_utf16be(s) s2 +} |