fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

case.c
Go to the documentation of this file.
1 /*
2  * "$Id: $"
3  *
4  * Author: Jean-Marc Lienher ( http://oksid.ch )
5  * Copyright 2000-2010 by O'ksi'D.
6  *
7  * This library is free software. Distribution and use rights are outlined in
8  * the file "COPYING" which should have been included with this file. If this
9  * file is missing or damaged, see the license at:
10  *
11  * http://www.fltk.org/COPYING.php
12  *
13  * Please report all bugs and problems on the following page:
14  *
15  * http://www.fltk.org/str.php
16  */
17 
18 /*
19  * This file is required on all platforms for UTF-8 support
20  */
21 
22 #if !defined(WIN32) && !defined(__APPLE__)
23 # include "../Xutf8.h"
24 #endif /* !defined(WIN32) && !defined(__APPLE__) */
25 
26 #include "headers/case.h"
27 #include <stdlib.h>
28 
29 int
30 XUtf8Tolower(int ucs) {
31  int ret;
32  if (ucs <= 0x02B6) {
33  if (ucs >= 0x0041) {
34  ret = ucs_table_0041[ucs - 0x0041];
35  if (ret > 0) return ret;
36  }
37  return ucs;
38  }
39 
40  if (ucs <= 0x0556) {
41  if (ucs >= 0x0386) {
42  ret = ucs_table_0386[ucs - 0x0386];
43  if (ret > 0) return ret;
44  }
45  return ucs;
46  }
47 
48  if (ucs <= 0x10C5) {
49  if (ucs >= 0x10A0) {
50  ret = ucs_table_10A0[ucs - 0x10A0];
51  if (ret > 0) return ret;
52  }
53  return ucs;
54  }
55 
56  if (ucs <= 0x1FFC) {
57  if (ucs >= 0x1E00) {
58  ret = ucs_table_1E00[ucs - 0x1E00];
59  if (ret > 0) return ret;
60  }
61  return ucs;
62  }
63 
64  if (ucs <= 0x2133) {
65  if (ucs >= 0x2102) {
66  ret = ucs_table_2102[ucs - 0x2102];
67  if (ret > 0) return ret;
68  }
69  return ucs;
70  }
71 
72  if (ucs <= 0x24CF) {
73  if (ucs >= 0x24B6) {
74  ret = ucs_table_24B6[ucs - 0x24B6];
75  if (ret > 0) return ret;
76  }
77  return ucs;
78  }
79 
80  if (ucs <= 0x33CE) {
81  if (ucs >= 0x33CE) {
82  ret = ucs_table_33CE[ucs - 0x33CE];
83  if (ret > 0) return ret;
84  }
85  return ucs;
86  }
87 
88  if (ucs <= 0xFF3A) {
89  if (ucs >= 0xFF21) {
90  ret = ucs_table_FF21[ucs - 0xFF21];
91  if (ret > 0) return ret;
92  }
93  return ucs;
94  }
95 
96  return ucs;
97 }
98 
99 int
100 XUtf8Toupper(int ucs) {
101  int i;
102  static unsigned short *table = NULL;
103 
104  if (!table) {
105  table = (unsigned short*) malloc(sizeof(unsigned short) * 0x10000);
106  for (i = 0; i < 0x10000; i++) {
107  table[i] = (unsigned short) i;
108  }
109  for (i = 0; i < 0x10000; i++) {
110  int l;
111  l = XUtf8Tolower(i);
112  if (l != i) table[l] = (unsigned short) i;
113  }
114  }
115  if (ucs >= 0x10000 || ucs < 0) return ucs;
116  return table[ucs];
117 }
118 
119 /*
120 * End of "$Id$".
121 */
ucs_table_33CE
static const unsigned short ucs_table_33CE[]
Definition: case.h:1739
NULL
#define NULL
Definition: forms.H:34
ucs_table_0386
static const unsigned short ucs_table_0386[]
Definition: case.h:636
ucs_table_FF21
static const unsigned short ucs_table_FF21[]
Definition: case.h:1743
ucs_table_1E00
static const unsigned short ucs_table_1E00[]
Definition: case.h:1145
XUtf8Tolower
int XUtf8Tolower(int ucs)
Definition: case.c:30
case.h
ucs_table_2102
static const unsigned short ucs_table_2102[]
Definition: case.h:1657
table
static symbol table[]
Definition: factory.cxx:1109
ucs_table_0041
static const unsigned short ucs_table_0041[]
Definition: case.h:3
ucs_table_10A0
static const unsigned short ucs_table_10A0[]
Definition: case.h:1104
malloc
voidp malloc()
XUtf8Toupper
int XUtf8Toupper(int ucs)
Definition: case.c:100
ucs_table_24B6
static const unsigned short ucs_table_24B6[]
Definition: case.h:1710