Przejrzałem kody programów pod kątem korzystania z plików konfiguracyjnych.

git-svn-id: svn://atos.wmid.amu.edu.pl/utt@10 e293616e-ec6a-49c2-aa92-f4a8b91c5d16
This commit is contained in:
pawelk 2008-03-14 13:05:07 +00:00
parent 8d3e6ab33b
commit 246900abc9
5 changed files with 575 additions and 579 deletions

View File

@ -629,13 +629,13 @@ may be set in configuration files. The default location of the
configuration files for a component named @command{@var{program}} are
@example
@file{/etc/utt/conf/@var{program}.conf}
@file{/usr/local/etc/utt/@var{program}.conf}
@end example
for system-wide configuration file and
@example
@file{~/.utt/conf/@var{program}.conf}
@file{~/.utt/@var{program}.conf}
@end example
for user configuration file.

View File

@ -5,6 +5,7 @@ all: compiledic aut2fsa
compiledic:
aut2fsa: aut2fsa.cc
#g++ -m32 -Wno-deprecated -O3 -fpermissive -static -o aut2fsa aut2fsa.cc
g++ $(CFLAG1) -o aut2fsa aut2fsa.cc

File diff suppressed because it is too large Load Diff

View File

@ -7,19 +7,19 @@ my $help=0;
my $gap_fill="\n-----\n";
my $spaces=0;
my $configfile1="../../conf/kot.conf";
my $configfile2="../conf/kot.conf";
my $systemconfigfile='/usr/local/etc/utt/kot.conf';
my $userconfigfile="$ENV{'HOME'}/.utt/kot.conf";
#read configuration files###########################
my $file;
foreach $file ($configfile1, $configfile2){
foreach $file ($systemconfigfile, $userconfigfile){
if(open(CONFIG, $file)){
while (<CONFIG>) {
chomp;
s/#.*//;
s/^\s+//;
s/\s+$//;
next unless length;
chomp;
s/#.*//;
s/^\s+//;
s/\s+$//;
next unless length;
my ($name, $value) = split(/\s*=\s*/, $_, 2);
if(($name eq "gap-fill")or($name eq "g")){
$gap_fill=$value;
@ -30,8 +30,8 @@ foreach $file ($configfile1, $configfile2){
elsif(($name eq "help")or($name eq "h")){
$help=1;
}
}
}
close CONFIG;
}
}
@ -48,7 +48,7 @@ Usage: ser [OPTIONS] [file ..]
Options:
--gap-fill -g Help.
--spaces -r
--spaces -r
--define=FILE Read macrodefinitions from FILE.
--flex-template=FILE Read flex code template from FILE.
--only-matching -m Print only fragments matching PATTERN.
@ -70,14 +70,14 @@ my $count=0;
while(<>)
{
my ($start,$len,$type,$form) = /^\s*(\d+)\s+(\d+)\s+(\S+)\s+(\S+)/;
if($start > $prevend)
{
print $gap_fill unless $count++ == 0;
}
$prevend=$start+$len;
next if $len==0;# || $form eq "*";
$form =~ s/\\\*/*/g;
@ -93,7 +93,3 @@ while(<>)
print $form;
}
#print $gap_fill;
# print "\n";

View File

@ -6,19 +6,19 @@ use Getopt::Long;
my $interactive=0;
my $help;
my $configfile1=".../../conf/tok.conf";
my $configfile2="../conf/tok.conf";
my $systemconfigfile='/usr/local/etc/utt/tok.conf';
my $userconfigfile="$ENV{'HOME'}/.utt/tok.conf";
#read configuration files###########################
my $file;
foreach $file ($configfile1, $configfile2){
foreach $file ($systemconfigfile, $userconfigfile){
if(open(CONFIG, $configfile1)){
while (<CONFIG>) {
chomp;
s/#.*//;
s/^\s+//;
s/\s+$//;
next unless length;
chomp;
s/#.*//;
s/^\s+//;
s/\s+$//;
next unless length;
my ($name, $value) = split(/\s*=\s*/, $_, 2);
if(($name eq "interactive")or($name eq "i")){
$interactive=1;
@ -26,7 +26,7 @@ foreach $file ($configfile1, $configfile2){
elsif(($name eq "help")or($name eq "h")){
$help=1;
}
}
}
close CONFIG;
}
}
@ -55,7 +55,7 @@ my $offset = 0;
while(<>)
{
1 while
1 while
/ [[:alpha:]]+ (?{seg('W',$&)})
| \d+ (?{seg('N',$&)})
| \s+ (?{seg('S',$&)})
@ -95,4 +95,3 @@ sub seg
print "\n";
$offset += $len;
}