php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
mbfl_language.c
Go to the documentation of this file.
1/*
2 * "streamable kanji code filter and converter"
3 * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved.
4 *
5 * LICENSE NOTICES
6 *
7 * This file is part of "streamable kanji code filter and converter",
8 * which is distributed under the terms of GNU Lesser General Public
9 * License (version 2) as published by the Free Software Foundation.
10 *
11 * This software is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with "streamable kanji code filter and converter";
18 * if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 * Suite 330, Boston, MA 02111-1307 USA
20 *
21 * The author of this file:
22 *
23 */
24/*
25 * The source code included in this file was separated from mbfilter.c
26 * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file
27 * mbfilter.c is included in this package .
28 *
29 */
30
31#include "libmbfl/config.h"
32
33#include <stddef.h>
34#include <string.h>
35
36#ifdef HAVE_STRINGS_H
37#include <strings.h>
38#endif
39
40#include "mbfl_encoding.h"
41#include "mbfl_language.h"
42
43#include "nls/nls_ja.h"
44#include "nls/nls_kr.h"
45#include "nls/nls_zh.h"
46#include "nls/nls_uni.h"
47#include "nls/nls_de.h"
48#include "nls/nls_ru.h"
49#include "nls/nls_ua.h"
50#include "nls/nls_en.h"
51#include "nls/nls_hy.h"
52#include "nls/nls_tr.h"
53#include "nls/nls_neutral.h"
54
55#ifndef HAVE_STRCASECMP
56#ifdef HAVE_STRICMP
57#define strcasecmp stricmp
58#endif
59#endif
60
61static const mbfl_language *mbfl_language_ptr_table[] = {
74 NULL
75};
76
77/* language resolver */
78const mbfl_language *
80{
82 int i, j;
83
84 if (name == NULL) {
85 return NULL;
86 }
87
88 i = 0;
89 while ((language = mbfl_language_ptr_table[i++]) != NULL){
90 if (strcasecmp(language->name, name) == 0) {
91 return language;
92 }
93 }
94
95 i = 0;
96 while ((language = mbfl_language_ptr_table[i++]) != NULL){
97 if (strcasecmp(language->short_name, name) == 0) {
98 return language;
99 }
100 }
101
102 /* search aliases */
103 i = 0;
104 while ((language = mbfl_language_ptr_table[i++]) != NULL) {
105 if (language->aliases != NULL) {
106 j = 0;
107 while (language->aliases[j]) {
108 if (strcasecmp(language->aliases[j], name) == 0) {
109 return language;
110 }
111 j++;
112 }
113 }
114 }
115
116 return NULL;
117}
118
119const mbfl_language *
121{
122 const mbfl_language *language;
123 int i;
124
125 i = 0;
126 while ((language = mbfl_language_ptr_table[i++]) != NULL){
127 if (language->no_language == no_language) {
128 return language;
129 }
130 }
131
132 return NULL;
133}
134
137{
138 const mbfl_language *language;
139
141 if (language == NULL) {
143 } else {
144 return language->no_language;
145 }
146}
147
148const char *
150{
151 const mbfl_language *language;
152
153 language = mbfl_no2language(no_language);
154 if (language == NULL) {
155 return "";
156 } else {
157 return language->name;
158 }
159}
#define NULL
Definition gdcache.h:45
again j
const char * mbfl_no_language2name(enum mbfl_no_language no_language)
const mbfl_language * mbfl_no2language(enum mbfl_no_language no_language)
const mbfl_language * mbfl_name2language(const char *name)
enum mbfl_no_language mbfl_name2no_language(const char *name)
struct _mbfl_language mbfl_language
mbfl_no_language
@ mbfl_no_language_invalid
enum mbfl_no_language language
Definition mbstring.h:96
const mbfl_language mbfl_language_german
Definition nls_de.c:5
const mbfl_language mbfl_language_english
Definition nls_en.c:4
const mbfl_language mbfl_language_armenian
Definition nls_hy.c:4
const mbfl_language mbfl_language_japanese
Definition nls_ja.c:4
const mbfl_language mbfl_language_korean
Definition nls_kr.c:4
const mbfl_language mbfl_language_neutral
Definition nls_neutral.c:4
const mbfl_language mbfl_language_russian
Definition nls_ru.c:4
const mbfl_language mbfl_language_turkish
Definition nls_tr.c:4
const mbfl_language mbfl_language_ukrainian
Definition nls_ua.c:4
const mbfl_language mbfl_language_uni
Definition nls_uni.c:5
const mbfl_language mbfl_language_traditional_chinese
Definition nls_zh.c:14
const mbfl_language mbfl_language_simplified_chinese
Definition nls_zh.c:4
#define strcasecmp(s1, s2)
zend_string * name