Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 45 lines (33 sloc) 1.422 kb
888ba12 Initial commit
David Sklar authored
1 /** Copyright 2010 Ning, Inc.
2
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 */
15 #ifndef __CASE_FOLD_H__
16 #define __CASE_FOLD_H__
17
18 #ifndef __BYTE__
19 typedef unsigned char byte;
20 #define __BYTE__
21 #endif
22
23
24 /* The nature of UTF-8 means that every node in the trie is either
25 * branch or a leaf, there are no branches that also are leaves. */
26
27 struct case_fold_leaf_t {
28 int folded_length;
29 byte folded[4];
30 };
31
32 struct case_fold_branch_t {
33 struct case_fold_branch_t *next[255];
34 struct case_fold_leaf_t *leaf;
35 };
36
37
38 void case_fold_map_load(struct case_fold_branch_t *root);
39 void case_fold_map_add(struct case_fold_branch_t *root, byte *upper, byte *lower);
40 byte *case_fold_lower(struct case_fold_branch_t *root, byte *word, int length);
41 struct case_fold_leaf_t *case_fold_find(struct case_fold_branch_t *root, byte *char_start);
42 void case_fold_map_free(struct case_fold_branch_t *root);
43
44 #endif // __CASE_FOLD_H__
Something went wrong with that request. Please try again.