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
766eb867
Commit
766eb867
authored
Aug 25, 2004
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utr11-dump.c:
new file
parent
a2bcb2a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
112 additions
and
0 deletions
+112
-0
strings/utr11-dump.c
strings/utr11-dump.c
+112
-0
No files found.
strings/utr11-dump.c
0 → 100644
View file @
766eb867
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
Dump an EastAsianWidth.txt file.
See http://www.unicode.org/reports/tr11/ for details.
Character types:
F - Full width = 1
H - Half width = 0
W - Wide = 1
Na - Narrow = 0
A - Ambiguous = 0
N - Neutral = 0
*/
int
main
(
int
ac
,
char
**
av
)
{
char
str
[
128
];
int
errors
=
0
;
int
plane
[
0x10000
];
int
page
[
256
];
int
i
;
memset
(
plane
,
0
,
sizeof
(
plane
));
memset
(
page
,
0
,
sizeof
(
page
));
while
(
fgets
(
str
,
sizeof
(
str
),
stdin
))
{
int
code1
,
code2
,
width
;
char
*
end
;
if
(
str
[
0
]
==
'#'
)
continue
;
code1
=
strtol
(
str
,
&
end
,
16
);
if
(
code1
<
0
||
code1
>
0xFFFF
)
continue
;
if
(
end
[
0
]
==
';'
)
/* One character */
{
code2
=
code1
;
}
else
if
(
end
[
0
]
==
'.'
&&
end
[
1
]
==
'.'
)
/* Range */
{
end
+=
2
;
code2
=
strtol
(
end
,
&
end
,
16
);
if
(
code2
<
0
||
code2
>
0xFFFF
)
continue
;
if
(
end
[
0
]
!=
';'
)
{
errors
++
;
fprintf
(
stderr
,
"error: %s"
,
str
);
continue
;
}
}
else
{
errors
++
;
fprintf
(
stderr
,
"error: %s"
,
str
);
continue
;
}
end
++
;
width
=
(
end
[
0
]
==
'F'
||
end
[
0
]
==
'W'
)
?
1
:
0
;
for
(
;
code1
<=
code2
;
code1
++
)
{
plane
[
code1
]
=
width
;
}
}
if
(
errors
)
return
1
;
for
(
i
=
0
;
i
<
256
;
i
++
)
{
int
j
;
int
*
p
=
plane
+
256
*
i
;
page
[
i
]
=
0
;
for
(
j
=
0
;
j
<
256
;
j
++
)
{
page
[
i
]
+=
p
[
j
];
}
if
(
page
[
i
]
!=
0
&&
page
[
i
]
!=
256
)
{
printf
(
"static char pg%02X[256]=
\n
{
\n
"
,
i
);
for
(
j
=
0
;
j
<
256
;
j
++
)
{
printf
(
"%d%s%s"
,
p
[
j
],
j
<
255
?
","
:
""
,
(
j
+
1
)
%
32
?
""
:
"
\n
"
);
}
printf
(
"};
\n\n
"
);
}
}
printf
(
"static struct {int page; char *p;} utr11_data[256]=
\n
{
\n
"
);
for
(
i
=
0
;
i
<
256
;
i
++
)
{
if
(
page
[
i
]
==
0
||
page
[
i
]
==
256
)
{
int
width
=
(
page
[
i
]
==
256
)
?
1
:
0
;
printf
(
"{%d,NULL}"
,
width
);
}
else
{
printf
(
"{0,pg%02X}"
,
i
);
}
printf
(
"%s%s"
,
i
<
255
?
","
:
""
,
(
i
+
1
)
%
8
?
""
:
"
\n
"
);
}
printf
(
"};
\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