|
fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) ![]() |
00001 /* 00002 * "$Id: $" 00003 * 00004 * Author: Jean-Marc Lienher ( http://oksid.ch ) 00005 * Copyright 2000-2010 by O'ksi'D. 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Library General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Library General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Library General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00020 * USA. 00021 * 00022 * Please report all bugs and problems on the following page: 00023 * 00024 * http://www.fltk.org/str.php 00025 */ 00026 00027 /* 00028 * This file is required on all platforms for utf8 support 00029 */ 00030 00031 #include "headers/case.h" 00032 #include <stdlib.h> 00033 00034 int 00035 XUtf8Tolower(int ucs) { 00036 int ret; 00037 if (ucs <= 0x02B6) { 00038 if (ucs >= 0x0041) { 00039 ret = ucs_table_0041[ucs - 0x0041]; 00040 if (ret > 0) return ret; 00041 } 00042 return ucs; 00043 } 00044 00045 if (ucs <= 0x0556) { 00046 if (ucs >= 0x0386) { 00047 ret = ucs_table_0386[ucs - 0x0386]; 00048 if (ret > 0) return ret; 00049 } 00050 return ucs; 00051 } 00052 00053 if (ucs <= 0x10C5) { 00054 if (ucs >= 0x10A0) { 00055 ret = ucs_table_10A0[ucs - 0x10A0]; 00056 if (ret > 0) return ret; 00057 } 00058 return ucs; 00059 } 00060 00061 if (ucs <= 0x1FFC) { 00062 if (ucs >= 0x1E00) { 00063 ret = ucs_table_1E00[ucs - 0x1E00]; 00064 if (ret > 0) return ret; 00065 } 00066 return ucs; 00067 } 00068 00069 if (ucs <= 0x2133) { 00070 if (ucs >= 0x2102) { 00071 ret = ucs_table_2102[ucs - 0x2102]; 00072 if (ret > 0) return ret; 00073 } 00074 return ucs; 00075 } 00076 00077 if (ucs <= 0x24CF) { 00078 if (ucs >= 0x24B6) { 00079 ret = ucs_table_24B6[ucs - 0x24B6]; 00080 if (ret > 0) return ret; 00081 } 00082 return ucs; 00083 } 00084 00085 if (ucs <= 0x33CE) { 00086 if (ucs >= 0x33CE) { 00087 ret = ucs_table_33CE[ucs - 0x33CE]; 00088 if (ret > 0) return ret; 00089 } 00090 return ucs; 00091 } 00092 00093 if (ucs <= 0xFF3A) { 00094 if (ucs >= 0xFF21) { 00095 ret = ucs_table_FF21[ucs - 0xFF21]; 00096 if (ret > 0) return ret; 00097 } 00098 return ucs; 00099 } 00100 00101 return ucs; 00102 } 00103 00104 int 00105 XUtf8Toupper(int ucs) { 00106 int i; 00107 static unsigned short *table = NULL; 00108 00109 if (!table) { 00110 table = (unsigned short*) malloc(sizeof(unsigned short) * 0x10000); 00111 for (i = 0; i < 0x10000; i++) { 00112 table[i] = (unsigned short) i; 00113 } 00114 for (i = 0; i < 0x10000; i++) { 00115 int l; 00116 l = XUtf8Tolower(i); 00117 if (l != i) table[l] = (unsigned short) i; 00118 } 00119 } 00120 if (ucs >= 0x10000 || ucs < 0) return ucs; 00121 return table[ucs]; 00122 } 00123 00124 /* 00125 * End of "$Id$". 00126 */