1 |
wakaba |
1.1 |
use strict;
|
2 |
|
|
use vars qw(%PROP %SET %SET_ALIAS $VERSION);
|
3 |
wakaba |
1.7 |
$VERSION=do{my @r=(q$Revision: 1.6 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
|
4 |
wakaba |
1.1 |
|
5 |
|
|
$PROP{module_name} = 'FooScript';
|
6 |
|
|
|
7 |
|
|
sub header () {
|
8 |
|
|
<<"EOH";
|
9 |
wakaba |
1.7 |
## This file is auto-generated (at @{[ sprintf '%04d-%02d-%02dT%02d:%02d:%02dZ', (gmtime)[5]+1900, (gmtime)[4]+1, (gmtime)[3,2,1,0] ]}).
|
10 |
|
|
## Do not edit by hand!
|
11 |
wakaba |
1.1 |
use strict;
|
12 |
|
|
|
13 |
|
|
package Char::InSet::$PROP{module_name};
|
14 |
|
|
use Exporter;
|
15 |
|
|
use vars qw(\@EXPORT_OK \@ISA \$VERSION);
|
16 |
|
|
\@ISA = qw(Exporter);
|
17 |
|
|
\$VERSION = '$PROP{version}';
|
18 |
wakaba |
1.4 |
|
19 |
|
|
=head1 NAME
|
20 |
|
|
|
21 |
|
|
$PROP{module_name}.pm --- @{[ $PROP{script_name} || $PROP{module_name} ]} character sets for C<\\p{In@{[ exists $PROP{prefix_name} ? $PROP{prefix_name} : $PROP{module_name} ]}HogeHoge}> regexps
|
22 |
wakaba |
1.6 |
@{[$PROP{pod_description}? "
|
23 |
|
|
=head1 DESCRIPTION
|
24 |
|
|
|
25 |
|
|
$PROP{pod_description}":'']}
|
26 |
wakaba |
1.4 |
|
27 |
|
|
=cut
|
28 |
|
|
|
29 |
wakaba |
1.1 |
EOH
|
30 |
|
|
}
|
31 |
|
|
|
32 |
|
|
sub table () {
|
33 |
wakaba |
1.3 |
my $prefix = exists $PROP{prefix_name} ? $PROP{prefix_name} : $PROP{module_name};
|
34 |
wakaba |
1.1 |
my $r = '';
|
35 |
|
|
my @set;
|
36 |
wakaba |
1.6 |
my %set_description;
|
37 |
wakaba |
1.1 |
for (sort keys %SET) {
|
38 |
wakaba |
1.2 |
my (@aline,@aitem);
|
39 |
wakaba |
1.1 |
$SET{$_} =~ s{^#\+(\w+)$}{
|
40 |
wakaba |
1.3 |
push @aline, qq(\&In${prefix}$1.); ''
|
41 |
wakaba |
1.1 |
}mge;
|
42 |
wakaba |
1.2 |
$SET{$_} =~ s{^!(.+)$}{ ## Pre-formated
|
43 |
|
|
push @aitem, $1; ''
|
44 |
|
|
}mge;
|
45 |
wakaba |
1.6 |
$SET{$_} =~ s{^#DESCRIPTION\x20(.+)$}{
|
46 |
|
|
$set_description{qq(In${prefix}$_)} = $1;
|
47 |
|
|
}me;
|
48 |
wakaba |
1.1 |
$SET{$_} =~ s{^#.+$}{}mg;
|
49 |
|
|
$SET{$_} =~ tr/\x09\x0A\x0D\x20//d;
|
50 |
wakaba |
1.3 |
push @set, [qq(In${prefix}$_) =>
|
51 |
|
|
join "\n", qq(sub In${prefix}$_ {),
|
52 |
wakaba |
1.2 |
@aline,
|
53 |
|
|
(length $SET{$_}?
|
54 |
|
|
(q(<<EOH;),
|
55 |
|
|
@aitem,
|
56 |
|
|
(map {sprintf '%04X', $_} sort {$a <=> $b}
|
57 |
|
|
map {ord $_} split //, $SET{$_}),
|
58 |
|
|
q(EOH)):
|
59 |
|
|
@aitem > 0? (q(<<EOH;), @aitem, q(EOH)): "''"),
|
60 |
|
|
q(})
|
61 |
wakaba |
1.1 |
];
|
62 |
|
|
}
|
63 |
|
|
for (sort keys %SET_ALIAS) {
|
64 |
wakaba |
1.3 |
push @set, [qq(In${prefix}$_) => qq(\*In${prefix}$_ = \\&In${prefix}$SET_ALIAS{$_};)];
|
65 |
wakaba |
1.1 |
}
|
66 |
|
|
|
67 |
|
|
$r = qq(\@EXPORT_OK = qw(@{[map {$_->[0]} @set]});\n\n);
|
68 |
|
|
$r .= join '', map {$_->[1]."\n\n"} @set;
|
69 |
wakaba |
1.4 |
|
70 |
|
|
$r .= "=head1 COLLECTION NAMES\n\n=over 4\n\n";
|
71 |
wakaba |
1.6 |
for (sort {$a->[0] cmp $b->[0]} @set) {
|
72 |
wakaba |
1.4 |
$r .= sprintf "=item %s\n\n", $_->[0];
|
73 |
wakaba |
1.6 |
$r .= sprintf "%s\n\n", $set_description{ $_->[0] }
|
74 |
|
|
if $set_description{ $_->[0] };
|
75 |
wakaba |
1.4 |
}
|
76 |
|
|
$r .= "=cut\n\n";
|
77 |
|
|
|
78 |
wakaba |
1.1 |
$r;
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
sub footer () {
|
82 |
|
|
my $r = <<EOH;
|
83 |
wakaba |
1.6 |
@{[$PROP{pod_example}? "
|
84 |
wakaba |
1.4 |
=head1 EXAMPLE
|
85 |
wakaba |
1.1 |
|
86 |
wakaba |
1.4 |
$PROP{pod_example}":'']}@{[$PROP{pod_see_also}? "
|
87 |
|
|
=head1 SEE ALSO
|
88 |
wakaba |
1.2 |
|
89 |
wakaba |
1.4 |
$PROP{pod_see_also}":'']}@{[$PROP{pod_license}? "
|
90 |
|
|
=head1 LICENSE
|
91 |
wakaba |
1.1 |
|
92 |
wakaba |
1.6 |
$PROP{pod_license}":"
|
93 |
|
|
=head1 LICENSE
|
94 |
wakaba |
1.1 |
|
95 |
wakaba |
1.2 |
Copyright @{[(gmtime)[5]+1900]} $PROP{author_name} <$PROP{author_mail}>
|
96 |
wakaba |
1.1 |
|
97 |
|
|
This library and the library generated by it is free software;
|
98 |
|
|
you can redistribute them and/or modify them under the same
|
99 |
|
|
terms as Perl itself.
|
100 |
wakaba |
1.4 |
"]}
|
101 |
wakaba |
1.1 |
=cut
|
102 |
|
|
|
103 |
|
|
1;
|
104 |
|
|
### $PROP{module_name}.pm ends here
|
105 |
|
|
EOH
|
106 |
|
|
$r;
|
107 |
|
|
}
|
108 |
|
|
|
109 |
wakaba |
1.3 |
sub col2list ($) {
|
110 |
|
|
my $s = shift;
|
111 |
|
|
my @s;
|
112 |
wakaba |
1.6 |
my @c;
|
113 |
|
|
$s =~ s{^(#.+)}{
|
114 |
|
|
push @c, $1; '';
|
115 |
|
|
}gem;
|
116 |
wakaba |
1.3 |
$s =~ s{^[\x20\x09]*([0-9A-F][0-9A-F])((?:[\x20\x09]+[0-9A-F][0-9A-F](?:-[0-9A-F][0-9A-F])?)+)}{
|
117 |
|
|
my ($r, @c) = ($1, grep {length} split /\s+/, $2);
|
118 |
|
|
for (@c) {
|
119 |
|
|
if (/([0-9A-F][0-9A-F])-([0-9A-F][0-9A-F])/) {
|
120 |
|
|
push @s, sprintf '%s%s %s%s ', $r,$1, $r,$2;
|
121 |
|
|
} else {
|
122 |
|
|
push @s, sprintf '%s%s', $r,$_;
|
123 |
|
|
}
|
124 |
|
|
}
|
125 |
|
|
}gem;
|
126 |
wakaba |
1.6 |
join ("\n", @c, map {'!'.$_} @s)."\n";
|
127 |
wakaba |
1.3 |
}
|
128 |
|
|
|
129 |
wakaba |
1.1 |
sub print_module () {
|
130 |
|
|
no warnings;
|
131 |
|
|
print &header.&table.&footer;
|
132 |
|
|
}
|
133 |
|
|
|
134 |
|
|
=head1 NAME
|
135 |
|
|
|
136 |
|
|
mkpm.pl --- Char::InSet::Han modules generating library
|
137 |
|
|
|
138 |
|
|
=head1 LICENSE
|
139 |
|
|
|
140 |
|
|
Copyright 2002 Wakaba <w@suika.fam.cx>
|
141 |
|
|
|
142 |
|
|
This library and the library generated by it is free software;
|
143 |
|
|
you can redistribute them and/or modify them under the same
|
144 |
|
|
terms as Perl itself.
|
145 |
|
|
|
146 |
|
|
=cut
|
147 |
|
|
|
148 |
wakaba |
1.7 |
1; ## $Date: 2002/09/07 12:55:01 $
|
149 |
wakaba |
1.1 |
### mkpm.pl ends here
|