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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
3082312f
Commit
3082312f
authored
Nov 22, 2004
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uca-dump.c:
Mofidications to dump secondary and tertiary weigthts And some minor improvements
parent
e3b94d4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
24 deletions
+56
-24
strings/uca-dump.c
strings/uca-dump.c
+56
-24
No files found.
strings/uca-dump.c
View file @
3082312f
...
...
@@ -23,13 +23,14 @@ struct uca_item_st
#define MY_UCA_PSHIFT 8
#endif
static
char
*
pname
[]
=
{
""
,
"2"
,
"3"
};
int
main
(
int
ac
,
char
**
av
)
{
char
str
[
256
];
char
*
weights
[
64
];
struct
uca_item_st
uca
[
64
*
1024
];
size_t
code
,
page
,
w
;
int
pagemaxlen
[
MY_UCA_NPAGES
];
size_t
code
,
w
;
int
pageloaded
[
MY_UCA_NPAGES
];
bzero
(
uca
,
sizeof
(
uca
));
...
...
@@ -155,14 +156,20 @@ int main(int ac, char **av)
printf
(
"#define MY_UCA_CMASK %d
\n
"
,
MY_UCA_CMASK
);
printf
(
"#define MY_UCA_PSHIFT %d
\n
"
,
MY_UCA_PSHIFT
);
for
(
w
=
0
;
w
<
1
;
w
++
)
for
(
w
=
0
;
w
<
3
;
w
++
)
{
size_t
page
;
int
pagemaxlen
[
MY_UCA_NPAGES
];
for
(
page
=
0
;
page
<
MY_UCA_NPAGES
;
page
++
)
{
size_t
offs
;
size_t
maxnum
=
0
;
size_t
nchars
=
0
;
size_t
mchars
;
size_t
ndefs
=
0
;
pagemaxlen
[
page
]
=
0
;
/*
Skip this page if no weights were loaded
...
...
@@ -183,15 +190,37 @@ int main(int ac, char **av)
code
=
page
*
MY_UCA_NCHARS
+
offs
;
/* Calculate only non-zero weights */
num
=
0
;
for
(
i
=
0
;
i
<
uca
[
code
].
num
;
i
++
)
for
(
num
=
0
,
i
=
0
;
i
<
uca
[
code
].
num
;
i
++
)
if
(
uca
[
code
].
weight
[
w
][
i
])
num
++
;
maxnum
=
maxnum
<
num
?
num
:
maxnum
;
/* Check if default weight */
if
(
w
==
1
&&
num
==
1
)
{
/* 0020 0000 ... */
if
(
uca
[
code
].
weight
[
w
][
0
]
==
0x0020
)
ndefs
++
;
}
else
if
(
w
==
2
&&
num
==
1
)
{
/* 0002 0000 ... */
if
(
uca
[
code
].
weight
[
w
][
0
]
==
0x0002
)
ndefs
++
;
}
}
maxnum
++
;
/*
If the page have only default weights
then no needs to dump it, skip.
*/
if
(
ndefs
==
MY_UCA_NCHARS
)
{
printf
(
"/* Don't dump w=%d pg=%3X: ndefs=%d */
\n
"
,
w
,
page
,
ndefs
);
continue
;
}
switch
(
maxnum
)
{
case
0
:
mchars
=
8
;
break
;
...
...
@@ -210,8 +239,8 @@ int main(int ac, char **av)
*/
printf
(
"uint16 page%03Xdata[]= { /* %04X (%d weights per char) */
\n
"
,
page
,
page
*
MY_UCA_NCHARS
,
maxnum
);
printf
(
"uint16 page%03Xdata
%s
[]= { /* %04X (%d weights per char) */
\n
"
,
page
,
p
name
[
w
],
p
age
*
MY_UCA_NCHARS
,
maxnum
);
for
(
offs
=
0
;
offs
<
MY_UCA_NCHARS
;
offs
++
)
{
...
...
@@ -251,25 +280,28 @@ int main(int ac, char **av)
}
printf
(
"};
\n\n
"
);
}
}
printf
(
"uchar ucal[%d]={
\n
"
,
MY_UCA_NPAGES
);
for
(
page
=
0
;
page
<
MY_UCA_NPAGES
;
page
++
)
{
printf
(
"%d%s%s"
,
pagemaxlen
[
page
],
page
<
MY_UCA_NPAGES
-
1
?
","
:
""
,(
page
+
1
)
%
16
?
""
:
"
\n
"
);
}
printf
(
"};
\n
"
);
printf
(
"uint16 *ucaw[%d]={
\n
"
,
MY_UCA_NPAGES
);
for
(
page
=
0
;
page
<
MY_UCA_NPAGES
;
page
++
)
{
if
(
!
pageloaded
[
page
])
printf
(
"NULL %s%s"
,
page
<
MY_UCA_NPAGES
-
1
?
","
:
""
,
(
page
+
1
)
%
4
?
""
:
"
\n
"
);
else
printf
(
"page%03Xdata%s%s"
,
page
,
page
<
MY_UCA_NPAGES
-
1
?
","
:
""
,
(
page
+
1
)
%
4
?
""
:
"
\n
"
);
printf
(
"uchar ucal%s[%d]={
\n
"
,
pname
[
w
],
MY_UCA_NPAGES
);
for
(
page
=
0
;
page
<
MY_UCA_NPAGES
;
page
++
)
{
printf
(
"%d%s%s"
,
pagemaxlen
[
page
],
page
<
MY_UCA_NPAGES
-
1
?
","
:
""
,(
page
+
1
)
%
16
?
""
:
"
\n
"
);
}
printf
(
"};
\n
"
);
printf
(
"uint16 *ucaw%s[%d]={
\n
"
,
pname
[
w
],
MY_UCA_NPAGES
);
for
(
page
=
0
;
page
<
MY_UCA_NPAGES
;
page
++
)
{
const
char
*
comma
=
page
<
MY_UCA_NPAGES
-
1
?
","
:
""
;
const
char
*
nline
=
(
page
+
1
)
%
4
?
""
:
"
\n
"
;
if
(
!
pagemaxlen
[
page
])
printf
(
"NULL %s%s"
,
comma
,
nline
);
else
printf
(
"page%03Xdata%s%s%s"
,
page
,
pname
[
w
],
comma
,
nline
);
}
printf
(
"};
\n
"
);
}
printf
(
"};
\n
"
);
printf
(
"int main(void){ return 0;};
\n
"
);
return
0
;
...
...
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