Commit 2ad82986 authored by Nils Goroll's avatar Nils Goroll

use named command line arguments, prepare for more than one dbfile

parent 33bc6f6c
......@@ -30,16 +30,16 @@ dcs_classifier.c: $(srcdir)/gen_dcs_classifier.pl dbfile $(srcdir)/../classes.co
@ if $(AM_V_P); then set -x; else echo " GEN dcs_classifier.c ... "; fi; \
if [[ -f fixup.remove ]] && [[ -f fixup.reorder ]] ; then \
$(srcdir)/gen_dcs_classifier.pl \
dbfile \
$(DCS_KEY) \
$(srcdir)/../classes.conf \
fixup.remove \
fixup.reorder ; \
--key $(DCS_KEY) \
--classes $(srcdir)/../classes.conf \
--remove fixup.remove \
--reorder fixup.reorder \
dbfile ; \
else \
$(srcdir)/gen_dcs_classifier.pl \
dbfile \
$(DCS_KEY) \
$(srcdir)/../classes.conf ; \
--key $(DCS_KEY) \
--classes $(srcdir)/../classes.conf \
dbfile ; \
fi
# -- gen_dcs_match_mem
......
......@@ -596,10 +596,28 @@ sub load_reorder($) {
\@reorder;
}
my ($dbref, $dbchecksum) = load_classifier_db($ARGV[0], $ARGV[1]);
load_classes($ARGV[2]);
my $removeref = load_remove($ARGV[3]);
my $reorderref = load_reorder($ARGV[4]);
use Getopt::Long;
my %opt;
GetOptions ('key=s' => \$opt{key},
'classes=s' => \$opt{classes},
'remove=s' => \$opt{remove},
'reorder=s' => \$opt{reorder})
|| die("Error in command line arguments\n");
# remaining arguments are db files
my @dbrefs;
my @dbchecksums;
foreach my $f (@ARGV) {
my ($dbref, $dbchecksum) = load_classifier_db($f, $opt{key});
push @dbrefs, ($dbref);
push @dbchecksums, ($dbchecksum);
}
load_classes($opt{classes});
my $removeref = load_remove($opt{remove});
my $reorderref = load_reorder($opt{reorder});
my @entries;
use constant {
......@@ -686,8 +704,8 @@ my %special_entries;
## build %common_subkeys
## build @entries, except that not all fields are filled
my %subkeys_count;
my $dbboilerplate = "checksum ".$dbchecksum."\n";
foreach (split(/[\n\r\f]/, $$dbref)) {
my $dbboilerplate = "checksum ".$dbchecksums[0]."\n";
foreach (split(/[\n\r\f]/, ${$dbrefs[0]})) {
if (/^\s*#/) {
$dbboilerplate .= $_."\n";
next;
......@@ -914,7 +932,7 @@ my $dcs_type_count = scalar(keys %typeenum2nbtype);
################################################################################
## generate the data
_VCL (F_CHECKSUM, VCL_TOP, $dbchecksum."\n");
_VCL (F_CHECKSUM, VCL_TOP, $dbchecksums[0]."\n");
boilerplate_autogen_c(F_CLASSIFIER_C, $dbboilerplate);
boilerplate_autogen_c(F_CLASSIFIER_H, undef);
......@@ -925,7 +943,7 @@ _VCL (F_CLASSIFIER_H, VCL_TOP, <<EOF);
#define DCS_CLASSIFIER_H 1
#include <stdint.h>
#define DCS_CHECKSUM "$dbchecksum"
#define DCS_CHECKSUM "$dbchecksums[0]"
/* tunable */
#define DCS_MAX_NEGMATCH_CAND 32
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment