File: mkfallback

package info (click to toggle)
fonty 1.0-8
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,988 kB
  • ctags: 112
  • sloc: perl: 2,097; cpp: 1,114; makefile: 133; sh: 97
file content (20 lines) | stat: -rwxr-xr-x 443 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl -na

@F = map
{
	s/^\\(.)/${{s => " ", n => "\n", "\\" => "\\", "#" => "#"}}{$1}/e;
	sprintf "U+%04X",
		/^([\xC0-\xDF])([\x80-\xBF])$/ ?
			(ord ($1) & 0x1F) << 6 |
			(ord ($2) & 0x3F)
		:
		/^([\xE0-\xEF])([\x80-\xBF])([\x80-\xBF])$/ ?
			(ord ($1) & 0x0F) << 12 |
			(ord ($2) & 0x3F) << 6 |
			(ord ($3) & 0x3F)
		:
		ord;
}
	grep /^(\\?[^\200-\377]|[\300-\377][\200-\277]+)$/, @F;

print join ("\t", @F), "\n" if @F > 1;