File: MakeUnicodeNames.pl

package info (click to toggle)
teckit 2.5.13%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,352 kB
  • sloc: cpp: 48,249; sh: 5,340; ansic: 3,162; perl: 562; makefile: 194; java: 43; xml: 15
file content (32 lines) | stat: -rw-r--r-- 508 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!perl

# make name list for teckit compiler from UnicodeData.txt

open FH, "<UnicodeData.txt" or die;
while (<FH>) {
	chomp;
	@fields = split(/;/);
	$uc = $fields[0];
	$un = $fields[1];

	next if $un =~ /</;
	
	push @names, [ $uc, $un ];
}
close FH;

print << '__END__';
#include "Compiler.h"

CharName	gUnicodeNames[] = {
__END__

# sort the names so that we can use binary search
foreach (sort { $a->[1] cmp $b->[1] } @names) {
	print "{0x$_->[0],\"$_->[1]\"},\n";
}

print << '__END__';
{0,0}
};
__END__