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:
parent
8d3e6ab33b
commit
246900abc9
@ -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
|
configuration files for a component named @command{@var{program}} are
|
||||||
|
|
||||||
@example
|
@example
|
||||||
@file{/etc/utt/conf/@var{program}.conf}
|
@file{/usr/local/etc/utt/@var{program}.conf}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
for system-wide configuration file and
|
for system-wide configuration file and
|
||||||
|
|
||||||
@example
|
@example
|
||||||
@file{~/.utt/conf/@var{program}.conf}
|
@file{~/.utt/@var{program}.conf}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
for user configuration file.
|
for user configuration file.
|
||||||
|
@ -5,6 +5,7 @@ all: compiledic aut2fsa
|
|||||||
|
|
||||||
compiledic:
|
compiledic:
|
||||||
|
|
||||||
|
|
||||||
aut2fsa: aut2fsa.cc
|
aut2fsa: aut2fsa.cc
|
||||||
#g++ -m32 -Wno-deprecated -O3 -fpermissive -static -o aut2fsa aut2fsa.cc
|
#g++ -m32 -Wno-deprecated -O3 -fpermissive -static -o aut2fsa aut2fsa.cc
|
||||||
g++ $(CFLAG1) -o aut2fsa aut2fsa.cc
|
g++ $(CFLAG1) -o aut2fsa aut2fsa.cc
|
||||||
|
1098
app/src/kon/kon
1098
app/src/kon/kon
File diff suppressed because it is too large
Load Diff
@ -7,19 +7,19 @@ my $help=0;
|
|||||||
my $gap_fill="\n-----\n";
|
my $gap_fill="\n-----\n";
|
||||||
my $spaces=0;
|
my $spaces=0;
|
||||||
|
|
||||||
my $configfile1="../../conf/kot.conf";
|
my $systemconfigfile='/usr/local/etc/utt/kot.conf';
|
||||||
my $configfile2="../conf/kot.conf";
|
my $userconfigfile="$ENV{'HOME'}/.utt/kot.conf";
|
||||||
|
|
||||||
#read configuration files###########################
|
#read configuration files###########################
|
||||||
my $file;
|
my $file;
|
||||||
foreach $file ($configfile1, $configfile2){
|
foreach $file ($systemconfigfile, $userconfigfile){
|
||||||
if(open(CONFIG, $file)){
|
if(open(CONFIG, $file)){
|
||||||
while (<CONFIG>) {
|
while (<CONFIG>) {
|
||||||
chomp;
|
chomp;
|
||||||
s/#.*//;
|
s/#.*//;
|
||||||
s/^\s+//;
|
s/^\s+//;
|
||||||
s/\s+$//;
|
s/\s+$//;
|
||||||
next unless length;
|
next unless length;
|
||||||
my ($name, $value) = split(/\s*=\s*/, $_, 2);
|
my ($name, $value) = split(/\s*=\s*/, $_, 2);
|
||||||
if(($name eq "gap-fill")or($name eq "g")){
|
if(($name eq "gap-fill")or($name eq "g")){
|
||||||
$gap_fill=$value;
|
$gap_fill=$value;
|
||||||
@ -30,8 +30,8 @@ foreach $file ($configfile1, $configfile2){
|
|||||||
elsif(($name eq "help")or($name eq "h")){
|
elsif(($name eq "help")or($name eq "h")){
|
||||||
$help=1;
|
$help=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
close CONFIG;
|
close CONFIG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ Usage: ser [OPTIONS] [file ..]
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
--gap-fill -g Help.
|
--gap-fill -g Help.
|
||||||
--spaces -r
|
--spaces -r
|
||||||
--define=FILE Read macrodefinitions from FILE.
|
--define=FILE Read macrodefinitions from FILE.
|
||||||
--flex-template=FILE Read flex code template from FILE.
|
--flex-template=FILE Read flex code template from FILE.
|
||||||
--only-matching -m Print only fragments matching PATTERN.
|
--only-matching -m Print only fragments matching PATTERN.
|
||||||
@ -70,14 +70,14 @@ my $count=0;
|
|||||||
while(<>)
|
while(<>)
|
||||||
{
|
{
|
||||||
my ($start,$len,$type,$form) = /^\s*(\d+)\s+(\d+)\s+(\S+)\s+(\S+)/;
|
my ($start,$len,$type,$form) = /^\s*(\d+)\s+(\d+)\s+(\S+)\s+(\S+)/;
|
||||||
|
|
||||||
if($start > $prevend)
|
if($start > $prevend)
|
||||||
{
|
{
|
||||||
print $gap_fill unless $count++ == 0;
|
print $gap_fill unless $count++ == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$prevend=$start+$len;
|
$prevend=$start+$len;
|
||||||
|
|
||||||
next if $len==0;# || $form eq "*";
|
next if $len==0;# || $form eq "*";
|
||||||
|
|
||||||
$form =~ s/\\\*/*/g;
|
$form =~ s/\\\*/*/g;
|
||||||
@ -93,7 +93,3 @@ while(<>)
|
|||||||
|
|
||||||
print $form;
|
print $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
#print $gap_fill;
|
|
||||||
|
|
||||||
# print "\n";
|
|
||||||
|
@ -6,19 +6,19 @@ use Getopt::Long;
|
|||||||
my $interactive=0;
|
my $interactive=0;
|
||||||
my $help;
|
my $help;
|
||||||
|
|
||||||
my $configfile1=".../../conf/tok.conf";
|
my $systemconfigfile='/usr/local/etc/utt/tok.conf';
|
||||||
my $configfile2="../conf/tok.conf";
|
my $userconfigfile="$ENV{'HOME'}/.utt/tok.conf";
|
||||||
|
|
||||||
#read configuration files###########################
|
#read configuration files###########################
|
||||||
my $file;
|
my $file;
|
||||||
foreach $file ($configfile1, $configfile2){
|
foreach $file ($systemconfigfile, $userconfigfile){
|
||||||
if(open(CONFIG, $configfile1)){
|
if(open(CONFIG, $configfile1)){
|
||||||
while (<CONFIG>) {
|
while (<CONFIG>) {
|
||||||
chomp;
|
chomp;
|
||||||
s/#.*//;
|
s/#.*//;
|
||||||
s/^\s+//;
|
s/^\s+//;
|
||||||
s/\s+$//;
|
s/\s+$//;
|
||||||
next unless length;
|
next unless length;
|
||||||
my ($name, $value) = split(/\s*=\s*/, $_, 2);
|
my ($name, $value) = split(/\s*=\s*/, $_, 2);
|
||||||
if(($name eq "interactive")or($name eq "i")){
|
if(($name eq "interactive")or($name eq "i")){
|
||||||
$interactive=1;
|
$interactive=1;
|
||||||
@ -26,7 +26,7 @@ foreach $file ($configfile1, $configfile2){
|
|||||||
elsif(($name eq "help")or($name eq "h")){
|
elsif(($name eq "help")or($name eq "h")){
|
||||||
$help=1;
|
$help=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close CONFIG;
|
close CONFIG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ my $offset = 0;
|
|||||||
|
|
||||||
while(<>)
|
while(<>)
|
||||||
{
|
{
|
||||||
1 while
|
1 while
|
||||||
/ [[:alpha:]]+ (?{seg('W',$&)})
|
/ [[:alpha:]]+ (?{seg('W',$&)})
|
||||||
| \d+ (?{seg('N',$&)})
|
| \d+ (?{seg('N',$&)})
|
||||||
| \s+ (?{seg('S',$&)})
|
| \s+ (?{seg('S',$&)})
|
||||||
@ -95,4 +95,3 @@ sub seg
|
|||||||
print "\n";
|
print "\n";
|
||||||
$offset += $len;
|
$offset += $len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user