File: simplemys.pl

package info (click to toggle)
yudit 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 18,472 kB
  • sloc: cpp: 76,344; perl: 5,630; makefile: 989; ansic: 823; sh: 441
file content (43 lines) | stat: -rwxr-xr-x 929 bytes parent folder | download | duplicates (2)
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
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl
# This script creates a mys source file from a simple
# keymap file.

print <<EOD;
# YUDIT-NtoN  1.0
NAME=Kmap for $ARGV[0]
COMM=Made from UnicodeData.txt version 13.0.0
COMM=Script: simplemys.pl
COMM=GNU (C) 2020-12-12
COMM=This map will produce UCS4 characters.
TYPE=00000001
SECTION=Section1
ENCODE=00
KEY_WIDTH=00
VALUE_WIDTH=02
KEY_LENGTH=00
VALUE_LENGTH=00
EOD

while (<>) {
    chop;
    next if (/^#/);
    my @kvle = split (',', $_, 2);
    next unless ($#kvle == 1);
    my @vles = split (/ /, $kvle[0]);
    my $vle = "";
    for (@vles) {
       $vle .= sprintf (" %08X", hex($_));
    } 
    my $raw = $kvle[1];
    $raw =~ s/\([^\)]+\)//go;
    $raw =~ s/“//go;
    $raw =~ s/”//go;
    $raw =~ s/’/'/go;
    $raw =~ s/: /:/go;
    $raw =~ s/^ //go;
    $raw =~ s/ $//go;
    $raw =~ s/ /-/go;
    my @chars = split (//, $raw);
    my $key = join ("'", @chars);
    print "'$key ->$vle\n"; 
}