1 --- misc/mythes-1.2.0.orig/th_gen_idx.pl
2 +++ misc/build/mythes-1.2.0/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+"$@"}'
11 +#*************************************************************************
13 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
15 +# Copyright 2000, 2010 Oracle and/or its affiliates.
17 +# OpenOffice.org - a multi-platform office productivity suite
19 +# This file is part of OpenOffice.org.
21 +# OpenOffice.org is free software: you can redistribute it and/or modify
22 +# it under the terms of the GNU Lesser General Public License version 3
23 +# only, as published by the Free Software Foundation.
25 +# OpenOffice.org is distributed in the hope that it will be useful,
26 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
27 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 +# GNU Lesser General Public License version 3 for more details
29 +# (a copy is included in the LICENSE file that accompanied this code).
31 -# typcially invoked as follows:
32 -# cat th_en_US_new.dat | ./th_gen_idx.pl > th_en_US_new.idx
33 +# You should have received a copy of the GNU Lesser General Public License
34 +# version 3 along with OpenOffice.org. If not, see
35 +# <http://www.openoffice.org/license.html>
36 +# for a copy of the LGPLv3 License.
38 +#*************************************************************************
41 my ($aent, $aoff) = split('\|',$a);
42 @@ -13,6 +34,27 @@ sub by_entry {
46 +#FIXME: someone may want "infile" or even parameter parsing
48 + my $next_is_file = 0;
50 + if ( $next_is_file ) {
62 + print "$0 -o outfile < input\n";
68 my $ne = 0; # number of entries in index
69 my @tindex=(); # the index itself
70 @@ -24,6 +66,10 @@ my $nm=0; # number of meaning fo
71 my $meaning=""; # current meaning and synonyms
73 my $encoding; # encoding used by text file
76 +$outfile = get_outfile();
77 +usage() if ( $outfile eq "" );
79 # top line of thesaurus provides encoding
81 @@ -51,9 +97,13 @@ while ($rec=<STDIN>){
82 # now we have all of the information
83 # so sort it and then output the encoding, count and index data
84 @tindex = sort by_entry @tindex;
85 -print STDOUT "$encoding\n";
86 -print STDOUT "$ne\n";
89 +open OUTFILE, ">$outfile" or die "ERROR: Can't open $outfile for writing!";
90 +print OUTFILE "$encoding\n";
91 +print OUTFILE "$ne\n";
92 foreach $one (@tindex) {
93 - print STDOUT "$one\n";
94 + print OUTFILE "$one\n";