1 --- misc/mythes-1.2.3.orig/th_gen_idx.pl
2 +++ misc/build/mythes-1.2.3/th_gen_idx.pl
6 -# perl program to take a thesaurus structured text data file
7 -# and create the proper sorted index file (.idx)
9 +eval 'exec perl -wS $0 ${1+"$@"}'
12 +# This file is part of the LibreOffice project.
14 +# This Source Code Form is subject to the terms of the Mozilla Public
15 +# License, v. 2.0. If a copy of the MPL was not distributed with this
16 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
18 +# This file incorporates work covered by the following license notice:
20 +# Licensed to the Apache Software Foundation (ASF) under one or more
21 +# contributor license agreements. See the NOTICE file distributed
22 +# with this work for additional information regarding copyright
23 +# ownership. The ASF licenses this file to you under the Apache
24 +# License, Version 2.0 (the "License"); you may not use this file
25 +# except in compliance with the License. You may obtain a copy of
26 +# the License at http://www.apache.org/licenses/LICENSE-2.0 .
29 -# typically invoked as follows:
30 -# cat th_en_US_new.dat | ./th_gen_idx.pl > th_en_US_new.idx
34 my ($aent, $aoff) = split('\|',$a);
35 @@ -13,6 +34,27 @@ sub by_entry {
39 +#FIXME: someone may want "infile" or even parameter parsing
41 + my $next_is_file = 0;
43 + if ( $next_is_file ) {
55 + print "$0 -o outfile < input\n";
61 my $ne = 0; # number of entries in index
62 my @tindex=(); # the index itself
63 @@ -24,6 +66,10 @@ my $nm=0; # number of meaning fo
64 my $meaning=""; # current meaning and synonyms
66 my $encoding; # encoding used by text file
69 +$outfile = get_outfile();
70 +usage() if ( $outfile eq "" );
72 # top line of thesaurus provides encoding
74 @@ -51,9 +97,13 @@ while ($rec=<STDIN>){
75 # now we have all of the information
76 # so sort it and then output the encoding, count and index data
77 @tindex = sort by_entry @tindex;
78 -print STDOUT "$encoding\n";
79 -print STDOUT "$ne\n";
82 +open OUTFILE, ">$outfile" or die "ERROR: Can't open $outfile for writing!";
83 +print OUTFILE "$encoding\n";
84 +print OUTFILE "$ne\n";
85 foreach $one (@tindex) {
86 - print STDOUT "$one\n";
87 + print OUTFILE "$one\n";