diff options
| author | Greg Ercolano <erco@seriss.com> | 2009-03-18 04:47:01 +0000 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2009-03-18 04:47:01 +0000 |
| commit | 6cbde8909b551f9561f0a06c210fb9fc059c4485 (patch) | |
| tree | 3d24e8bf8197cd62ccc5662523d0e88428d2e3a5 /src/xutf8/case.c | |
| parent | 5d601837b99ceb6285718034959bf38ca4a749cb (diff) | |
xutf8 files code conformance:
o C files containing C++ "//" comments -> C style "/* */" comments
o Converted unintended doxygen style comments to regular C comments
o FLTK brace/indent coding standard conformance
o Tested linux + sgi
o Avoided mods to xutf8/lcUniConv [libiconv/FSF code]
to avoid unwanted diffs with future updates of that lib
as per Fabien's fltk.dev request 03/14/09.
(Those files already compliant anyway)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6698 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/xutf8/case.c')
| -rw-r--r-- | src/xutf8/case.c | 180 |
1 files changed, 86 insertions, 94 deletions
diff --git a/src/xutf8/case.c b/src/xutf8/case.c index aad8afe9b..e21c96202 100644 --- a/src/xutf8/case.c +++ b/src/xutf8/case.c @@ -30,104 +30,96 @@ #include "headers/case.h" #include <stdlib.h> - int -XUtf8Tolower( - int ucs) -{ - int ret; - - if (ucs <= 0x02B6) { - if (ucs >= 0x0041) { - ret = ucs_table_0041[ucs - 0x0041]; - if (ret > 0) return ret; - } - return ucs; - } - - if (ucs <= 0x0556) { - if (ucs >= 0x0386) { - ret = ucs_table_0386[ucs - 0x0386]; - if (ret > 0) return ret; - } - return ucs; - } - - if (ucs <= 0x10C5) { - if (ucs >= 0x10A0) { - ret = ucs_table_10A0[ucs - 0x10A0]; - if (ret > 0) return ret; - } - return ucs; - } - - if (ucs <= 0x1FFC) { - if (ucs >= 0x1E00) { - ret = ucs_table_1E00[ucs - 0x1E00]; - if (ret > 0) return ret; - } - return ucs; - } - - if (ucs <= 0x2133) { - if (ucs >= 0x2102) { - ret = ucs_table_2102[ucs - 0x2102]; - if (ret > 0) return ret; - } - return ucs; - } - - if (ucs <= 0x24CF) { - if (ucs >= 0x24B6) { - ret = ucs_table_24B6[ucs - 0x24B6]; - if (ret > 0) return ret; - } - return ucs; - } - - if (ucs <= 0x33CE) { - if (ucs >= 0x33CE) { - ret = ucs_table_33CE[ucs - 0x33CE]; - if (ret > 0) return ret; - } - return ucs; - } - - if (ucs <= 0xFF3A) { - if (ucs >= 0xFF21) { - ret = ucs_table_FF21[ucs - 0xFF21]; - if (ret > 0) return ret; - } - return ucs; - } - - return ucs; +XUtf8Tolower(int ucs) { + int ret; + if (ucs <= 0x02B6) { + if (ucs >= 0x0041) { + ret = ucs_table_0041[ucs - 0x0041]; + if (ret > 0) return ret; + } + return ucs; + } + + if (ucs <= 0x0556) { + if (ucs >= 0x0386) { + ret = ucs_table_0386[ucs - 0x0386]; + if (ret > 0) return ret; + } + return ucs; + } + + if (ucs <= 0x10C5) { + if (ucs >= 0x10A0) { + ret = ucs_table_10A0[ucs - 0x10A0]; + if (ret > 0) return ret; + } + return ucs; + } + + if (ucs <= 0x1FFC) { + if (ucs >= 0x1E00) { + ret = ucs_table_1E00[ucs - 0x1E00]; + if (ret > 0) return ret; + } + return ucs; + } + + if (ucs <= 0x2133) { + if (ucs >= 0x2102) { + ret = ucs_table_2102[ucs - 0x2102]; + if (ret > 0) return ret; + } + return ucs; + } + + if (ucs <= 0x24CF) { + if (ucs >= 0x24B6) { + ret = ucs_table_24B6[ucs - 0x24B6]; + if (ret > 0) return ret; + } + return ucs; + } + + if (ucs <= 0x33CE) { + if (ucs >= 0x33CE) { + ret = ucs_table_33CE[ucs - 0x33CE]; + if (ret > 0) return ret; + } + return ucs; + } + + if (ucs <= 0xFF3A) { + if (ucs >= 0xFF21) { + ret = ucs_table_FF21[ucs - 0xFF21]; + if (ret > 0) return ret; + } + return ucs; + } + + return ucs; } int -XUtf8Toupper( - int ucs) -{ - int i; - static unsigned short *table = NULL; - - if (!table) { - table = (unsigned short*) malloc( - sizeof(unsigned short) * 0x10000); - for (i = 0; i < 0x10000; i++) { - table[i] = (unsigned short) i; - } - for (i = 0; i < 0x10000; i++) { - int l; - l = XUtf8Tolower(i); - if (l != i) table[l] = (unsigned short) i; - } - - } - if (ucs >= 0x10000 || ucs < 0) return ucs; - return table[ucs]; +XUtf8Toupper(int ucs) { + int i; + static unsigned short *table = NULL; + + if (!table) { + table = (unsigned short*) malloc(sizeof(unsigned short) * 0x10000); + for (i = 0; i < 0x10000; i++) { + table[i] = (unsigned short) i; + } + for (i = 0; i < 0x10000; i++) { + int l; + l = XUtf8Tolower(i); + if (l != i) table[l] = (unsigned short) i; + } + } + if (ucs >= 0x10000 || ucs < 0) return ucs; + return table[ucs]; } /* - * End of "$Id$". - */ +* End of "$Id$". +*/ |
