File: make-inp-rules.pl

package info (click to toggle)
xindy 2.5.1.20160104-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,304 kB
  • sloc: perl: 15,840; lisp: 4,845; makefile: 1,548; lex: 541; sh: 165; sed: 97
file content (31 lines) | stat: -rwxr-xr-x 721 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
#!/usr/bin/perl

print <<"EOF";
;; this file was generated by make-inp-rules.pl
;; these rules map inputenc generated macros (back) to 8-bit characters

EOF


while (<STDIN>) {
  if (/\\indexentry\{(.+)--([8-9a-f][0-9a-f])\}\{1\}/) {
    if (!($1 =~ /inputenc Error|\@inpenc\@undefined/)) {
      $i = hex($2);
      $macro = $1;
      $macro =~ s/\~/~~/g;
      $macro =~ s/\"/~\"/g;
      printf("(merge-rule \"%s\" \"%c\" :string)\n",
        $macro, $i);
      if (@ARGV[0] eq "cyracc" &&
        $macro =~ /(cyra |cyre |cyri |cyro |cyru |cyrerev |cyryu |cyrya )/i) {
        printf("(merge-rule \"\\'{%s}\" \"\\'%c\" :string)\n",
          $macro, $i);
      }
    }
  }
}

print <<"EOF";

;; end of style file.
EOF