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
105fae05
Commit
105fae05
authored
Dec 25, 2003
by
bar@bar.intranet.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dump_map.c:
new file
parent
08d8c0b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
0 deletions
+72
-0
strings/dump_map.c
strings/dump_map.c
+72
-0
No files found.
strings/dump_map.c
0 → 100644
View file @
105fae05
#include <stdio.h>
#include <string.h>
static
void
print_short_array
(
unsigned
short
*
a
)
{
int
i
;
printf
(
"{
\n
"
);
for
(
i
=
0
;
i
<=
0xFF
;
i
++
)
{
printf
(
"0x%04X%s%s"
,(
int
)
a
[
i
],
i
<
0xFF
?
","
:
""
,(
i
+
1
)
%
8
?
""
:
"
\n
"
);
}
printf
(
"};
\n
"
);
}
int
main
(
void
)
{
char
str
[
160
];
unsigned
short
touni
[
256
];
unsigned
short
fromuni
[
65536
];
unsigned
short
fromstat
[
256
];
int
i
;
bzero
((
void
*
)
touni
,
sizeof
(
touni
));
bzero
((
void
*
)
fromuni
,
sizeof
(
fromuni
));
bzero
((
void
*
)
fromstat
,
sizeof
(
fromstat
));
while
(
fgets
(
str
,
sizeof
(
str
),
stdin
))
{
unsigned
int
c
,
u
;
if
((
str
[
0
]
==
'#'
)
||
(
2
!=
sscanf
(
str
,
"%x%x"
,
&
c
,
&
u
)))
continue
;
if
(
c
>
0xFF
||
u
>
0xFFFF
)
continue
;
touni
[
c
]
=
u
;
fromuni
[
u
]
=
c
;
}
printf
(
"unsigned short cs_to_uni[256]="
);
print_short_array
(
touni
);
for
(
i
=
0
;
i
<=
0xFF
;
i
++
)
{
fromstat
[
touni
[
i
]
>>
8
]
++
;
}
for
(
i
=
0
;
i
<=
256
;
i
++
)
{
if
(
fromstat
[
i
])
{
printf
(
"unsigned char pl%02X[256]="
,
i
);
print_short_array
(
fromuni
+
i
*
256
);
}
}
printf
(
"unsigned short *uni_to_cs[256]={
\n
"
);
for
(
i
=
0
;
i
<=
255
;
i
++
)
{
if
(
fromstat
[
i
])
printf
(
"pl%02X"
,
i
);
else
printf
(
"NULL"
);
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