Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5a2b1ba6
Commit
5a2b1ba6
authored
Jun 03, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unicode collations: WL#916
XML and "collation customization" language parsers.
parent
2a32bb2b
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
547 additions
and
8 deletions
+547
-8
mysys/charset.c
mysys/charset.c
+496
-6
strings/ctype.c
strings/ctype.c
+51
-2
No files found.
mysys/charset.c
View file @
5a2b1ba6
This diff is collapsed.
Click to expand it.
strings/ctype.c
View file @
5a2b1ba6
...
@@ -22,6 +22,23 @@
...
@@ -22,6 +22,23 @@
#endif
#endif
/*
This files implements routines which parse XML based
character set and collation description files.
Unicode collations are encoded according to
Unicode Technical Standard #35
Locale Data Markup Language (LDML)
http://www.unicode.org/reports/tr35/
and converted into ICU string according to
Collation Customization
http://oss.software.ibm.com/icu/userguide/Collate_Customization.html
*/
static
char
*
mstr
(
char
*
str
,
const
char
*
src
,
uint
l1
,
uint
l2
)
static
char
*
mstr
(
char
*
str
,
const
char
*
src
,
uint
l1
,
uint
l2
)
{
{
...
@@ -54,6 +71,11 @@ struct my_cs_file_section_st
...
@@ -54,6 +71,11 @@ struct my_cs_file_section_st
#define _CS_PRIMARY_ID 15
#define _CS_PRIMARY_ID 15
#define _CS_BINARY_ID 16
#define _CS_BINARY_ID 16
#define _CS_CSDESCRIPT 17
#define _CS_CSDESCRIPT 17
#define _CS_RESET 18
#define _CS_DIFF1 19
#define _CS_DIFF2 20
#define _CS_DIFF3 21
static
struct
my_cs_file_section_st
sec
[]
=
static
struct
my_cs_file_section_st
sec
[]
=
{
{
...
@@ -83,6 +105,10 @@ static struct my_cs_file_section_st sec[] =
...
@@ -83,6 +105,10 @@ static struct my_cs_file_section_st sec[] =
{
_CS_ORDER
,
"charsets.charset.collation.order"
},
{
_CS_ORDER
,
"charsets.charset.collation.order"
},
{
_CS_FLAG
,
"charsets.charset.collation.flag"
},
{
_CS_FLAG
,
"charsets.charset.collation.flag"
},
{
_CS_COLLMAP
,
"charsets.charset.collation.map"
},
{
_CS_COLLMAP
,
"charsets.charset.collation.map"
},
{
_CS_RESET
,
"charsets.charset.collation.rules.reset"
},
{
_CS_DIFF1
,
"charsets.charset.collation.rules.p"
},
{
_CS_DIFF2
,
"charsets.charset.collation.rules.s"
},
{
_CS_DIFF3
,
"charsets.charset.collation.rules.t"
},
{
0
,
NULL
}
{
0
,
NULL
}
};
};
...
@@ -109,6 +135,7 @@ typedef struct my_cs_file_info
...
@@ -109,6 +135,7 @@ typedef struct my_cs_file_info
uchar
sort_order
[
MY_CS_SORT_ORDER_TABLE_SIZE
];
uchar
sort_order
[
MY_CS_SORT_ORDER_TABLE_SIZE
];
uint16
tab_to_uni
[
MY_CS_TO_UNI_TABLE_SIZE
];
uint16
tab_to_uni
[
MY_CS_TO_UNI_TABLE_SIZE
];
char
comment
[
MY_CS_CSDESCR_SIZE
];
char
comment
[
MY_CS_CSDESCR_SIZE
];
size_t
sort_order_length
;
CHARSET_INFO
cs
;
CHARSET_INFO
cs
;
int
(
*
add_collation
)(
CHARSET_INFO
*
cs
);
int
(
*
add_collation
)(
CHARSET_INFO
*
cs
);
}
MY_CHARSET_LOADER
;
}
MY_CHARSET_LOADER
;
...
@@ -156,9 +183,11 @@ static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len)
...
@@ -156,9 +183,11 @@ static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len)
struct
my_cs_file_section_st
*
s
=
cs_file_sec
(
attr
,
len
);
struct
my_cs_file_section_st
*
s
=
cs_file_sec
(
attr
,
len
);
if
(
s
&&
(
s
->
state
==
_CS_CHARSET
))
if
(
s
&&
(
s
->
state
==
_CS_CHARSET
))
{
bzero
(
&
i
->
cs
,
sizeof
(
i
->
cs
));
bzero
(
&
i
->
cs
,
sizeof
(
i
->
cs
));
}
if
(
s
&&
(
s
->
state
==
_CS_COLLATION
))
i
->
sort_order_length
=
0
;
return
MY_XML_OK
;
return
MY_XML_OK
;
}
}
...
@@ -242,6 +271,26 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len)
...
@@ -242,6 +271,26 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len)
fill_uchar
(
i
->
ctype
,
MY_CS_CTYPE_TABLE_SIZE
,
attr
,
len
);
fill_uchar
(
i
->
ctype
,
MY_CS_CTYPE_TABLE_SIZE
,
attr
,
len
);
i
->
cs
.
ctype
=
i
->
ctype
;
i
->
cs
.
ctype
=
i
->
ctype
;
break
;
break
;
case
_CS_RESET
:
case
_CS_DIFF1
:
case
_CS_DIFF2
:
case
_CS_DIFF3
:
{
/*
Convert collation description from
Locale Data Markup Language (LDML)
into ICU Collation Customization expression.
*/
char
arg
[
16
];
const
char
*
cmd
[]
=
{
"&"
,
"<"
,
"<<"
,
"<<<"
};
i
->
cs
.
sort_order
=
i
->
sort_order
;
mstr
(
arg
,
attr
,
len
,
sizeof
(
arg
)
-
1
);
if
(
i
->
sort_order_length
+
20
<
sizeof
(
i
->
sort_order
))
{
char
*
dst
=
i
->
sort_order_length
+
i
->
sort_order
;
i
->
sort_order_length
+=
sprintf
(
dst
,
" %s %s"
,
cmd
[
state
-
_CS_RESET
],
arg
);
}
}
}
}
return
MY_XML_OK
;
return
MY_XML_OK
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment