File: frommap

package info (click to toggle)
ttf2pt1 3.4.4-1.3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,056 kB
  • ctags: 1,142
  • sloc: ansic: 13,816; perl: 1,851; sh: 558; makefile: 190
file content (24 lines) | stat: -rwxr-xr-x 370 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl
#
# A script to convert a Unicode character map to
# the C code
#

sub fromhex
{
	return eval "0x".$_[0];
}

$inmap=0;

while(<>)
{
	if(/^CHARMAP/) {
		$inmap=1;
	} elsif(/^END CHARMAP/) {
		$inmap=0;
	} elsif($inmap
	&& /^\s*\S+\s+\/x([0-9a-fA-F][0-9a-fA-F])\s+\<U([0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])/) {
		$map[fromhex($1)]=fromhex($2);
	}
}