isdnlog-4.04

- Support for Luxemburg added:
  - isdnlog/country-de.dat ... no +352 1 luxemburg city
  - isdnlog/rate-lu.dat ... initial LU version NEW
  - isdnlog/holiday-lu.dat ... NEW - FIXME
  - isdnlog/.Config.in  ... LU support
  - isdnlog/configure.in ... LU support
  - isdnlog/samples/isdn.conf.lu ... LU support NEW

 - German zone-table enhanced
  - isdnlog/tools/zone/de/01033/mk ...fixed, with verify now
  - isdnlog/tools/zone/redzone ... fixed
  - isdnlog/tools/zone/de/01033/mzoneall ... fixed, faster
  - isdnlog/tools/zone/mkzonedb.c .... data Version 1.21

 - Patch from Philipp Matthias Hahn <pmhahn@titan.lahn.de>
  - PostgreSQL SEGV solved

 - Patch from Armin Schindler <mac@melware.de>
  - Eicon-Driver Support for isdnlog
This commit is contained in:
akool 2000-01-23 22:31:13 +00:00
parent 450863ca2b
commit 947689f778
14 changed files with 288 additions and 94 deletions

View File

@ -7,7 +7,7 @@ string 'Log file' CONFIG_ISDNLOG_LOGFILE
string 'Reload command' CONFIG_ISDNLOG_RELOADCMD
string 'Stop command' CONFIG_ISDNLOG_STOPCMD
string 'Reboot command' CONFIG_ISDNLOG_REBOOTCMD
string 'Old config directory' CONFIG_ISDNLOG_OLDI4LCONFDIR
string 'Old config directory' CONFIG_ISDNLOG_OLDI4LCONFDIR
string 'Old config file' CONFIG_ISDNLOG_OLDI4LCONFFILE
bool 'Support postgres95 SQL-Database' CONFIG_ISDNLOG_POSTGRES
if [ "$CONFIG_ISDNLOG_POSTGRES" = "y" ]; then
@ -22,22 +22,23 @@ choice 'Country specific chargeinfo support' \
"DE CONFIG_ISDN_LOG_DE \
AT CONFIG_ISDN_LOG_AT \
NL CONFIG_ISDN_LOG_NL \
LU CONFIG_ISDN_LOG_LU \
CH CONFIG_ISDN_LOG_CH" DE
if [ "$CONFIG_ISDN_LOG_DE" = "y" ]; then
CONFIG_ISDN_LOG_DEST_DE="y"
fi
fi
if [ "$CONFIG_ISDN_LOG_AT" = "y" ]; then
CONFIG_ISDN_LOG_DEST_AT="y"
fi
fi
if [ "$CONFIG_ISDN_LOG_NL" = "y" ]; then
CONFIG_ISDN_LOG_DEST_NL="y"
fi
fi
if [ "$CONFIG_ISDN_LOG_CH" = "y" ]; then
CONFIG_ISDN_LOG_DEST_CH="y"
fi
fi
choice 'Primary language for country names' \
"DE CONFIG_ISDN_LOG_CC_DE \
EN CONFIG_ISDN_LOG_CC_EN" DE
EN CONFIG_ISDN_LOG_CC_EN" DE
bool 'Include German cities in destination database' CONFIG_ISDN_LOG_DEST_DE y
bool 'Include Austrian cities in destination database' CONFIG_ISDN_LOG_DEST_AT y
bool 'Include Dutch cities in destination database' CONFIG_ISDN_LOG_DEST_NL y

View File

@ -1,4 +1,4 @@
## $Id: Makefile.in,v 1.140 2000/01/16 12:36:58 akool Exp $
## $Id: Makefile.in,v 1.141 2000/01/23 22:31:13 akool Exp $
##
## ISDN accounting for isdn4linux.
##
@ -19,6 +19,28 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Log: Makefile.in,v $
## Revision 1.141 2000/01/23 22:31:13 akool
## isdnlog-4.04
## - Support for Luxemburg added:
## - isdnlog/country-de.dat ... no +352 1 luxemburg city
## - isdnlog/rate-lu.dat ... initial LU version NEW
## - isdnlog/holiday-lu.dat ... NEW - FIXME
## - isdnlog/.Config.in ... LU support
## - isdnlog/configure.in ... LU support
## - isdnlog/samples/isdn.conf.lu ... LU support NEW
##
## - German zone-table enhanced
## - isdnlog/tools/zone/de/01033/mk ...fixed, with verify now
## - isdnlog/tools/zone/redzone ... fixed
## - isdnlog/tools/zone/de/01033/mzoneall ... fixed, faster
## - isdnlog/tools/zone/mkzonedb.c .... data Version 1.21
##
## - Patch from Philipp Matthias Hahn <pmhahn@titan.lahn.de>
## - PostgreSQL SEGV solved
##
## - Patch from Armin Schindler <mac@melware.de>
## - Eicon-Driver Support for isdnlog
##
## Revision 1.140 2000/01/16 12:36:58 akool
## isdnlog-4.03
## - Patch from Gerrit Pape <pape@innominate.de>
@ -1003,7 +1025,7 @@ SERVICEFILE = /etc/services
# DON'T EDIT BELOW THIS LINE
######################################################################
VERSION = 4.03
VERSION = 4.04
MANPAGES = isdnlog/callerid.conf.5 isdnlog/isdn.conf.5 \
isdnlog/isdnformat.5 isdnlog/isdnlog.5 isdnlog/isdnlog.8 \

View File

@ -108,6 +108,11 @@ if test "$CONFIG_ISDN_LOG_NL" = "y" ; then
NATION_MACRO="ISDN_NL"
AC_DEFINE(ISDN_NL)
fi
if test "$CONFIG_ISDN_LOG_LU" = "y" ; then
NATION="lu"
NATION_MACRO="ISDN_LU"
AC_DEFINE(ISDN_LU)
fi
dnl Checks for programs.
AC_PROG_CC

View File

@ -1291,11 +1291,6 @@ E:Ireland
C:+353
T:IE
N:Luxemburg City
C:+3521
R:LU
T:_LUXE
N:Luxemburg
E:Luxembourg
C:+352

26
isdnlog/holiday-lu.dat Normal file
View File

@ -0,0 +1,26 @@
V:1.00-Luxemburg [16-Jan-2000]
# s. http://www.itm.etat.lu/droit/de/2/3/2.htm
W:1 Montag
W:2 Dienstag
W:3 Mittwoch
W:4 Donnerstag
W:5 Freitag
W:6 Samstag
W:7 Sonntag
W:W Werktag
W:E Wochenende
W:H Feiertag
D:1.1 Neujahr
D:easter Ostersonntag
D:easter+1 Ostermontag
D:1.5 1. Mai
D:easter+39 Christi Himmelfahrt
D:easter+49 Pfingstsonntag
D:easter+50 Pfingstmontag
D:23.6 Grossherzogs Geburtstag
D:15.8 Maria Himmelfahrt
D:1.11 Allerheiligen
D:25.12 1. Weihnachtsfeiertag
D:26.12 2. Weihnachtsfeiertag

View File

@ -1,4 +1,4 @@
/* $Id: postgres.c,v 1.1 1997/03/16 20:58:45 luethje Exp $
/* $Id: postgres.c,v 1.2 2000/01/23 22:31:13 akool Exp $
*
* Interface for Postgres95-Database for isdn4linux. (db-module)
*
@ -19,6 +19,28 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: postgres.c,v $
* Revision 1.2 2000/01/23 22:31:13 akool
* isdnlog-4.04
* - Support for Luxemburg added:
* - isdnlog/country-de.dat ... no +352 1 luxemburg city
* - isdnlog/rate-lu.dat ... initial LU version NEW
* - isdnlog/holiday-lu.dat ... NEW - FIXME
* - isdnlog/.Config.in ... LU support
* - isdnlog/configure.in ... LU support
* - isdnlog/samples/isdn.conf.lu ... LU support NEW
*
* - German zone-table enhanced
* - isdnlog/tools/zone/de/01033/mk ...fixed, with verify now
* - isdnlog/tools/zone/redzone ... fixed
* - isdnlog/tools/zone/de/01033/mzoneall ... fixed, faster
* - isdnlog/tools/zone/mkzonedb.c .... data Version 1.21
*
* - Patch from Philipp Matthias Hahn <pmhahn@titan.lahn.de>
* - PostgreSQL SEGV solved
*
* - Patch from Armin Schindler <mac@melware.de>
* - Eicon-Driver Support for isdnlog
*
* Revision 1.1 1997/03/16 20:58:45 luethje
* Added the source code isdnlog. isdnlog is not working yet.
* A workaround for that problem:
@ -39,8 +61,12 @@
#include "postgres.h"
void _PQfinish(void)
{
if ( db_Conn )
PQfinish( db_Conn);
db_Conn = NULL;
}
int dbOpen(void)
@ -100,7 +126,7 @@ int dbOpen(void)
{
syslog( LOG_ERR, "%s", "Connection to ISDN-database failed.");
syslog( LOG_ERR, "%s", PQerrorMessage( db_Conn));
PQfinish( db_Conn);
_PQfinish();
return( -1);
}
@ -109,7 +135,7 @@ int dbOpen(void)
int dbClose(void)
{
PQfinish( db_Conn);
_PQfinish();
if ( db_Host)
free( db_Host);
@ -150,7 +176,7 @@ int dbAdd( DbStrIn *in)
{
syslog( LOG_ERR, "%s", "Connection to ISDN-database failed.");
syslog( LOG_ERR, "%s", PQerrorMessage( db_Conn));
PQfinish( db_Conn);
_PQfinish();
return( -1);
}
@ -187,7 +213,7 @@ int dbAdd( DbStrIn *in)
{
syslog( LOG_ERR, "%s", "Connection to ISDN-database failed.");
syslog( LOG_ERR, "%s", PQerrorMessage( db_Conn));
PQfinish( db_Conn);
_PQfinish();
return( -1);
}
@ -201,7 +227,7 @@ int dbAdd( DbStrIn *in)
{
syslog( LOG_ERR, "%s", "Connection to ISDN-database failed.");
syslog( LOG_ERR, "%s", PQerrorMessage( db_Conn));
PQfinish( db_Conn);
_PQfinish();
return( -1);
}

View File

@ -1,4 +1,4 @@
/* $Id: processor.c,v 1.96 2000/01/20 07:30:09 kai Exp $
/* $Id: processor.c,v 1.97 2000/01/23 22:31:13 akool Exp $
*
* ISDN accounting for isdn4linux. (log-module)
*
@ -19,6 +19,28 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: processor.c,v $
* Revision 1.97 2000/01/23 22:31:13 akool
* isdnlog-4.04
* - Support for Luxemburg added:
* - isdnlog/country-de.dat ... no +352 1 luxemburg city
* - isdnlog/rate-lu.dat ... initial LU version NEW
* - isdnlog/holiday-lu.dat ... NEW - FIXME
* - isdnlog/.Config.in ... LU support
* - isdnlog/configure.in ... LU support
* - isdnlog/samples/isdn.conf.lu ... LU support NEW
*
* - German zone-table enhanced
* - isdnlog/tools/zone/de/01033/mk ...fixed, with verify now
* - isdnlog/tools/zone/redzone ... fixed
* - isdnlog/tools/zone/de/01033/mzoneall ... fixed, faster
* - isdnlog/tools/zone/mkzonedb.c .... data Version 1.21
*
* - Patch from Philipp Matthias Hahn <pmhahn@titan.lahn.de>
* - PostgreSQL SEGV solved
*
* - Patch from Armin Schindler <mac@melware.de>
* - Eicon-Driver Support for isdnlog
*
* Revision 1.96 2000/01/20 07:30:09 kai
* rewrote the ASN.1 parsing stuff. No known problems so far, apart from the
* following:
@ -3884,6 +3906,14 @@ static void processctrl(int card, char *s)
memcpy(ps, "HEX: ", 5);
} /* if */
if (!memcmp(ps, "DTRC:", 5)) { /* Eicon Driver */
if (firsttime) {
firsttime = 0;
print_msg (PRT_NORMAL, "(Eicon active driver detected)\n");
} /* if */
memcpy(ps, "HEX: ", 5);
} /* if */
if (!memcmp(ps, "HEX: ", 5)) { /* new HiSax Driver */
if (((verbose & VERBOSE_HEX) && !(verbose & VERBOSE_CTRL)) || stdoutput)

19
isdnlog/rate-lu.dat Normal file
View File

@ -0,0 +1,19 @@
V:0.02-Luxemburg [18.01.2000]
U:%.3f LUF
P: 01 P&T Luxembourg
B:1001 # Fixme: ???
Z:1 Inland # Ganzes Land
A:+352
T:W/8-19=0.25/240 Werktag
T:W/6-8,19-23=0.25/480 Sparzeit
T:6/6-23=0.25/480 Samstag
#
# line below works onyl f. isdnlog/rate >= 4.02
# else you have to set all dates/times separatedly
T:*/*=0.25/960 Sonstige Zeit

View File

@ -0,0 +1,40 @@
# exapmle of /etc/isdn/isdn.conf
# copy this file to /etc/isdn/isdn.conf and edit
#
# More information: /usr/doc/packages/i4l/isdnlog/README
[GLOBAL]
COUNTRYPREFIX = +
COUNTRYCODE = 352
AREAPREFIX = 0
# EDIT THIS LINE:
AREACODE = 0
[VARIABLES]
[ISDNLOG]
LOGFILE = /var/log/isdn.log
ILABEL = %b %e %T %ICall to tei %t from %N2 on %n2
OLABEL = %b %e %T %Itei %t calling %N2 with '%n0'
REPFMTWWW = "%X %D %17.17H %T %-17.17F %-20.20l SI: %S %9u %U %I %O"
REPFMTSHORT = "%X%D %8.8H %T %-14.14F%U%I %O"
REPFMT = " %X %D %15.15H %T %-15.15F %7u %U %I %O"
CHARGEMAX = 50.00
CURRENCY = 1,LUF
COUNTRYFILE = /usr/lib/isdn/country-de.dat
# RATECONF= /etc/isdn/rate.conf.lu
RATEFILE= /usr/lib/isdn/rate-lu.dat
HOLIDAYS= /usr/lib/isdn/holiday-lu.dat
# ZONEFILE= /usr/lib/isdn/zone-lu-%s.gdbm
DESTFILE= /usr/lib/isdn/dest.gdbm
# providerselect
VBN = 10 #?
VBNLEN = 2 #?
PRESELECTED=1 #?

View File

@ -2,22 +2,34 @@
# This job fully generates a new "zone-de-dtag.gdbm"
#
# Be warned: This job runs about 2 day's, and requires more than
# 100 Mb of free disk space!
# Be warned: This job runs several hours, and requires more than
# 300 Mb of free disk space!
cd /usr/src/isdn4k-utils/isdnlog/tools/zone/de/01033
#cd /usr/src/isdn4k-utils/isdnlog/tools/zone/de/01033
# code contains 1xx numbers
mv ../code ../code1
grep ^[^1] ../code1 > ../code
bzip2 -d zneu.de9.bz2
./mzoneall
bzip2 -9 zneu.de9
# restore code
mv ../code1 ../code
../../redzone -zzoneall -rzred.dtag -l5 -v2 -n
rm -f zred.dtag.bz2
bzip2 -9 zred.dtag
rm zoneall
cd ../..
rm ../../zone-de-dtag.gdbm
make DE
# verify it
./zone -d ../../zone-de-dtag.gdbm -z de/01033/zoneall -v
rm de/01033/zoneall

View File

@ -25,7 +25,7 @@ my($i, $num, @all, %all, @ax);
push(@all, $num);
push(@{$ax[substr($num,0,1)]}, $num);
$all{$num}=1;
}
}
close(IN);
open(IN, $in) || die("Can't read $in");
@ -47,18 +47,18 @@ while(<IN>) {
if ($fields[4] eq 'R') {
(@rnum) = split(/ /,$fields[5]);
}
}
}
elsif ($fields[2] eq 'R') {
(@rnum) = split(/ /,$fields[3]);
}
foreach $f (@cnum) {
print1($num, $f, $CITY);
$first{substr($f,0,1)}=1;
}
}
foreach $f (@rnum) {
print1($num, $f, $REGIO);
$first{substr($f,0,1)}=1;
}
}
if ($expand_all) {
foreach $f (@all) {
next if ($done{"$num $f"});
@ -66,25 +66,33 @@ while(<IN>) {
if (defined $first{substr($f,0,1)}) {
print1($num, $f, $FERN);
}
else {
else {
print1($num, substr($f,0,1), $FERN);
}
}
}
}
}
}
else {
print OZ "$num XXXXX $FERN\n";
}
}
}
}
close(IN);
close(OZ);
print "\Sorting...\n";
system("export TMPDIR=.;sort <$outz.temp|uniq>$outz");
unlink("$outz.temp");
sub print1 {
my($from, $to, $z) = @_;
return if($from eq $to);
if($all{$to}) {
print OZ "$from $to $z\n";
$done{"$from $to"}=1;
grep { $done{"$from $_"}=1 if(/^$to/) } @{$ax[substr($to,0,1)]};
}
}
elsif (length($to)==1) {
print OZ "$from $to $z\n";
$done{"$from $to"}=1;
}
else {
grep { print1($from,$_,$z) if(/^$to/) } @{$ax[substr($to,0,1)]};
}
}

View File

@ -35,7 +35,7 @@ static char progversion[] = "1.24";
* in this case \tLEN is appended to text
*
*/
#define STANDALONE
#define _MKZONEDB_C_
@ -130,7 +130,7 @@ static void read_rzfile(char *rf) {
if (to > keylen)
keylen=to;
if(to>maxnum) {
maxnum=to;
maxnum=to;
if ((numbers = realloc(numbers,(maxnum+1)*sizeof(int))) == 0) {
fprintf(stderr, "Out of mem\n");
exit(EXIT_FAILURE);
@ -204,7 +204,7 @@ static void write_db(char * df) {
key.dptr = "vErSiO";
key.dsize = 7;
/* version of zone.c must be not smaller than dataversion */
sprintf(version,"V1.20 K%c C%c N%d T%d O%d L%d",
sprintf(version,"V1.21 K%c C%c N%d T%d O%d L%d",
keylen==2?'S':'L',tablelen==1?'C':tablelen==2?'S':'L',
nn,n, ortszone, numlen?numlen:keydigs);
value.dptr = version;

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl
# redzone - reduce a zone file
# redzone - reduce a zone file
# Copyright 1999 by Leopold Toetsch <lt@toetsch.at>
#
# This program is free software; you can redistribute it and/or modify
@ -48,7 +48,7 @@ sub getargs {
$LEN = $opt{'l'} if ($opt{'l'});
$keep_files=1 if(defined $opt{'k'});
$opt_only=1 if(defined $opt{'o'});
$rc = $LEN - 1;
$rc = $LEN-1;
&usage unless($inf && $outf);
}
@ -68,7 +68,7 @@ sub go {
my ($i);
for ($i=0; $i<20; $i++) {
$red[$i] = 0;
}
}
open(IN, "$inf") or die("Can't read $inf");
open(OUT, ">$outf") or die("Can't write $outf");
#
@ -85,10 +85,10 @@ sub go {
if($opt_only) {
&optimize;
}
else {
else {
&reduce;
&optimize;
}
}
&clean_up unless($keep_files);
my $perc = $tot?$redt/$tot*100:0;
if ($verbose) {
@ -111,7 +111,7 @@ sub go {
sub clean_up {
system("rm $inf.{a,b,n}* t1~ t2~ 2>/dev/null");
}
}
## sort data correctly
#
@ -121,9 +121,9 @@ sub normalize {
while (<IN>) {
chomp;
($from, $to, $z) = split(/\s+/);
($to, $from) = ($from, $to) if ($from gt $to);
$from .= 'X' x ($LEN-length($from));
$to .= 'X' x ($LEN-length($to));
($to, $from) = ($from, $to) if ($from gt $to);
print OUT "$from $to $z\n";
print STDERR "$i\r" if ($verbose >= 2 && $i%1000==0);
$i++;
@ -169,14 +169,14 @@ sub sort_them {
if ($pass eq $rc) {
system(qq(export TMPDIR=.;sort < $newinf | sed -e"s/X\\+//g" > $outf));
}
else {
else {
if ($x eq 'n0') {
system(qq(export TMPDIR=.;sort < $newinf | uniq > $outf));
}
else {
else {
system(qq(export TMPDIR=.;sort < $newinf > $outf));
}
}
}
}
open_new("$inf.$x.sorted");
}
@ -218,8 +218,8 @@ sub reduce_2 {
# }
if ((substr($to, $which-1, $pass+1) =~ /^$old$/ || $old eq '') &&
($olda eq $from || $olda eq '') &&
($LEN-$pass-1 <= 0 ||
substr($to, 0, $LEN-$pass-1) eq substr($oldto,0, $LEN-$pass-1) ||
($LEN-$pass-1 <= 0 ||
substr($to, 0, $LEN-$pass-1) eq substr($oldto,0, $LEN-$pass-1) ||
$oldto eq '')) {
push(@from, $from);
push(@to, $to);
@ -241,8 +241,17 @@ sub reduce_2 {
}
$redc = ((sort {$zc{$b} <=> $zc{$a} } (keys(%zc)))[0]);
print "Got $n: ($from[0] $to[0] - $to[$#to]) Red $redc Old '$old'\n" if ($verbose >= 3);
print "There are ",scalar(keys(%zc))," zones\n" if($verbose>=3);
#if there is a shorter one than this is the default
if (scalar(keys(%zc)) == 1) { # write shortcut
$k=0;
substr($to[$k], $which, $pass) = 'X' x $pass;
print OUT "$from[$k] $to[$k] $z[$k]\n";
$rem++;
$redt-=$n,$red-=$n;
}
else {
my ($l);
$l = $LEN-$pass+1;
for ($j=1 ;$j < $n; $j++) {
@ -251,7 +260,7 @@ sub reduce_2 {
$l = length($&);
$redc = $z[$j];
print "But '$from[$j] $to[$j]' is shorter Red $redc now\n" if ($verbose >= 3);
}
}
}
$k=-1;
for ($j=0 ;$j < $n; $j++) {
@ -271,9 +280,10 @@ sub reduce_2 {
$rem++;
$redt--,$red--;
}
}
# clean up & init for next bunch
@from = @to = @z = ();
push(@from, $from); # these we have already red
push(@from, $from); # these we have already read
push(@to, $to);
push(@z, $z);
if (length($to) > $which) {
@ -311,7 +321,7 @@ sub sort_opt {
$to .= 'X' x ($LEN-length($to));
$to = "X$to" if ($z eq $LINK); # sort link after others
print OUT "$from $to $z\n";
}
}
close(IN);
close(OUT);
$newinf = "$inf.a-${pass}q";
@ -326,7 +336,7 @@ sub sort_opt {
$redt += $red;
print "Pass o-$pass: $red data killed $rem remaining\n" if ($verbose);
$red[$pass + 10] = $red;
}
@ -352,8 +362,8 @@ sub optimize_2 {
#
# read one bunch with same digs at begin and same len
#
if ($old eq '' ||
(substr($from, 0 ,length($old)) eq $old &&
if ($old eq '' ||
(substr($from, 0 ,length($old)) eq $old &&
length($from)==length($old)+1)) {
push(@from, $from);
push(@to, $to);
@ -373,16 +383,16 @@ sub optimize_2 {
$rem++;
last if ($eof);
next;
}
}
push(@from,'end'); # for the loop to finish
OUTER:
for ($jj = 0; $jj < @from; $jj++) {
if ($from[$jj] eq $oldfr1) {
if ($from[$jj] ne 'end') {
push(@fr1, substr($from[$jj],0,length($old)));
push(@fr1, substr($from[$jj],0,length($old)));
push(@to1, $to[$jj]);
push(@z1, $z[$jj]);
}
}
}
else {
$next2 = $jj;
@ -393,15 +403,15 @@ sub optimize_2 {
for ($k=0; $k < @to1; $k++) {
print T1 "$fr1[$k] $to1[$k] $z1[$k]\n";
}
close(T1);
INNER:
close(T1);
INNER:
for ($j = $next2; $j < @from; $j++) {
if ($from[$j] eq $oldfr2) {
if ($from[$j] ne 'end') {
push(@fr2, substr($from[$j],0,length($old)));
push(@fr2, substr($from[$j],0,length($old)));
push(@to2, $to[$j]);
push(@z2, $z[$j]);
}
}
}
else {
print "Now Inner $from[$next2]\n" if($verbose==4);
@ -412,7 +422,7 @@ sub optimize_2 {
for ($k=0; $k<@to2; $k++) {
print T2 "$fr2[$k] $to2[$k] $z2[$k]\n";
}
close(T2);
close(T2);
my(@difls) = `diff -U0 t1~ t2~`;
print "Are:@difls\n" if($verbose==4);
my($add);
@ -440,18 +450,18 @@ sub optimize_2 {
if ($t ne $to2[$o] && $to2[$o] =~ /^$t/) {
$udif{"$from[$next2] $to2[$o] $z2[$o]"}=1;
print "\tAnd longer2 $from[$next2] $to2[$o] $z2[$o]\n" if($verbose==4);
}
}
}
}
last NL;
}
} # for m
$t = substr($t,0,length($t)-1);
} # while
} # while
if ($verbose==4) {
$p="$from[$next1] $to[$next1+$l1+$l] $z[$next1+$l1+$l]";
print "\t$p = $q\n";
}
}
}
}
if($c2) {
foreach ($l=-1; $l<$c2-1; $l++) {
my ($m, $t);
@ -460,19 +470,19 @@ sub optimize_2 {
if ($verbose==4) {
$p="$from[$next2] $t $z[$next2+$l2+$l]";
print "\t$p\n";
}
}
for ($m = 0; $m < @to2; $m++) {
if ($t ne $to2[$m] && $to2[$m] =~ /^$t/) {
$udif{"$from[$next2] $to2[$m] $z2[$m]"}=1;
print "\tAnd longer $from[$next2] $to2[$m] $z2[$m]\n" if($verbose==4);
}
}
}
}
# also write all longer matching
} #foreach
} #if c2
} #if
} # foreach difls
if (keys(%udif)+$add < @fr2) {
} # foreach difls
if (keys(%udif)+$add < @fr2) {
print "Used $from[$next1] $from[$next2]\n" if($verbose==4);
my %found;
my $p;
@ -483,49 +493,49 @@ sub optimize_2 {
print OUT "$p\n";
$found{$to1[$k]}=1;
delete $toprint{$p};
}
}
}
$used1{$from[$next1]}=1;
$used2{$from[$next2]}=1;
for ($k=0; $k < @fr2; $k++) {
delete $toprint{"$from[$next2+$k] $to2[$k] $z2[$k]"};
}
}
print OUT "$from[$next2] $from[$next1] $LINK\n";
foreach $k (keys(%udif)) {
print OUT "$k\n";
}
}
#goto N1;
}
else {
print "Too many diffs $from[$next1] $from[$next2]\n" if($verbose>2);
}
N2:
}
N2:
%udif = ();
@fr2 = @to2 = @z2 = ();
push(@fr2, substr($from[$j],0,length($old)));
push(@fr2, substr($from[$j],0,length($old)));
push(@to2, $to[$j]);
push(@z2, $z[$j]);
$next2 = $j;
} # else
} # else
} # for $j
N1:
N1:
%udif = ();
foreach $k (keys(%toprint)) {
print OUT "$k\n";
$rem++;
}
%toprint = ();
%toprint = ();
@fr2 = @to2 = @z2 = ();
@fr1 = @to1 = @z1 = ();
if ($from[$jj] ne 'end') {
push(@fr1, substr($from[$jj],0,length($old)));
push(@fr1, substr($from[$jj],0,length($old)));
push(@to1, $to[$jj]);
push(@z1, $z[$jj]);
}
}
$oldfr1 = $from[$jj];
$next1 = $jj;
} # else
} # else
} # for jj
@fr2 = @to2 = @z2 = ();
@fr1 = @to1 = @z1 = ();
@ -539,6 +549,6 @@ sub optimize_2 {
$toprint{"$from $to $z"}=1;
$old = '';
last if($eof);
} # while
} # while
$tot = $i if($pass == 1 && $opt_only);
} # optimize