Debian Codegraph @

scripts/external.pl

raw
1 #!/usr/bin/perl
2 # -*- mode: cperl; indent-tabs-mode: nil; tab-width: 3; cperl-indent-level: 3; -*-
3 BEGIN {
4 $| = 1;
5 };
6 use warnings;
7 use strict;
8 use utf8;
9 #use feature 'unicode_strings';
10
11 use IO::Handle;
12 autoflush STDOUT 1;
13 autoflush STDERR 1;
14
15 use FindBin;
16 use lib $FindBin::Bin.'/';
17 use CG3_External qw(check_protocol read_window write_window write_null_response);
18
19 binmode(STDIN);
20 binmode(STDOUT);
21
22 if (!check_protocol(*STDIN)) {
23 die("Out of date protocol!\n");
24 }
25
26 while (my $w = read_window(*STDIN)) {
27 foreach my $c (@{$w->{'cohorts'}}) {
28 #print $c->{'wordform'}, "\n";
29 foreach my $r (@{$c->{'readings'}}) {
30 #print "\t", $r->{'baseform'}, "\n";
31 $r->{'flags'} |= (1 << 0);
32 push @{$r->{'tags'}}, "æ発ø";
33 foreach my $t (@{$r->{'tags'}}) {
34 #print "\t\t", $t, "\n";
35 }
36 }
37 }
38 write_window(*STDOUT, $w);
39 }