diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2008-09-10 23:56:49 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2008-09-10 23:56:49 +0000 |
| commit | b6bde2e4569aa617c8a6af64947c688c624ed7f8 (patch) | |
| tree | 010d15843eb7d4faf7cd1b0cd44d5b9c00462a83 /src/xutf8/utils/case.sh | |
| parent | dfb50e85292687561927610e689eb5ab30d0ba26 (diff) | |
Merging the UTF8 patch, consisting of O'ksi'd s original 1.1.6 patch and additions by Ian. PLEASE BE AWARE that the patch in its current incarnation is a regression in many aspects and further work is required before we can announce Unicode support.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6212 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/xutf8/utils/case.sh')
| -rwxr-xr-x | src/xutf8/utils/case.sh | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/src/xutf8/utils/case.sh b/src/xutf8/utils/case.sh new file mode 100755 index 000000000..a824ad638 --- /dev/null +++ b/src/xutf8/utils/case.sh @@ -0,0 +1,107 @@ +#!/bin/sh + + +nopsc=`grep 'CAPITAL' ../UnicodeData-2.txt` + +IFS=" +" + +#echo "# +# List of case chars +# +# +# Format: Three tab-separated columns +# Column #1 is the non-spacing Unicode (in hex as 0xXXXX) +# Column #2 is the spacing Unicode (in hex as 0xXXXX) +# Column #3 the Unicode name (follows a comment sign, '#') +# " > case.txt + +rm -f case.txt + + +for line in ${nopsc} +do + ucs=`echo ${line} | cut -d\; -f1` + name=`echo ${line} | cut -d\; -f2 | cut -d\; -f1| sed s/CAPITAL/SMALL/` + small=`grep ";${name};" ../UnicodeData-2.txt` + if test "X${small}" != X ;then + tbl=`echo ${small} | cut -d\; -f1` + # echo "0x${ucs} 0x${tbl} # ${name}" >> space.txt + echo "/* U+${ucs} */ 0x${tbl}," >> case.txt + else + # echo "0x${ucs} 0x${ucs} # ${name}" >> space.txt + echo "/* U+${ucs} */ 0x0," >> case.txt + fi +done + +unset nospc + +# echo "/* EOF */" >> space.txt + +cat case.txt | ./create_table "spacing" > "../headers/case.h" 2> ../headers/case_tbl.txt + +rm -f case.txt + +cat >../case.c << ENDOFTEXT +/****************************************************************************** + Copyright 2001 by O'ksi'D + +Permission to use, copy, modify, distribute, and sell this software +and its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and +that both that copyright notice and this permission notice appear +in supporting documentation, and that the name of O'ksi'D +not be used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. +O'ksi'D makes no representations about the suitability of +this software for any purpose. It is provided "as is" without +express or implied warranty. + +O'ksi'D DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, +IN NO EVENT SHALL O'ksi'D BE LIABLE FOR ANY SPECIAL, INDIRECT +OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE +OR PERFORMANCE OF THIS SOFTWARE. + + Author: Jean-Marc Lienher ( http://oksid.ch ) + +******************************************************************************/ + +#include "headers/case.h" + +ENDOFTEXT + +echo " +int +XUtf8Tolower( + int ucs) +{ + int ret; +" >>../case.c + +tables=`cat ../headers/case_tbl.txt` + +for line in ${tables} +do + tbl=`echo ${line} | cut -d']' -f1` + bot=`echo ${line} | cut -d'_' -f3 | cut -d'[' -f1` + eot=`echo ${line} | cut -d' ' -f2 | cut -d'+' -f2 | cut -d' ' -f1` + echo "\ + if (ucs <= 0x${eot}) { + if (ucs >= 0x${bot}) { + ret = ${tbl}ucs - 0x${bot}]; + if (ret > 0) return ret; + } + return ucs; + } +" >>../case.c + +done + +echo " return ucs; +} +" >>../case.c + + |
