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 ...@@ -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 $(AM_V_P); then set -x; else echo " GEN dcs_classifier.c ... "; fi; \
if [[ -f fixup.remove ]] && [[ -f fixup.reorder ]] ; then \ if [[ -f fixup.remove ]] && [[ -f fixup.reorder ]] ; then \
$(srcdir)/gen_dcs_classifier.pl \ $(srcdir)/gen_dcs_classifier.pl \
dbfile \ --key $(DCS_KEY) \
$(DCS_KEY) \ --classes $(srcdir)/../classes.conf \
$(srcdir)/../classes.conf \ --remove fixup.remove \
fixup.remove \ --reorder fixup.reorder \
fixup.reorder ; \ dbfile ; \
else \ else \
$(srcdir)/gen_dcs_classifier.pl \ $(srcdir)/gen_dcs_classifier.pl \
dbfile \ --key $(DCS_KEY) \
$(DCS_KEY) \ --classes $(srcdir)/../classes.conf \
$(srcdir)/../classes.conf ; \ dbfile ; \
fi fi
# -- gen_dcs_match_mem # -- gen_dcs_match_mem
......
...@@ -596,10 +596,28 @@ sub load_reorder($) { ...@@ -596,10 +596,28 @@ sub load_reorder($) {
\@reorder; \@reorder;
} }
my ($dbref, $dbchecksum) = load_classifier_db($ARGV[0], $ARGV[1]); use Getopt::Long;
load_classes($ARGV[2]); my %opt;
my $removeref = load_remove($ARGV[3]);
my $reorderref = load_reorder($ARGV[4]); 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; my @entries;
use constant { use constant {
...@@ -686,8 +704,8 @@ my %special_entries; ...@@ -686,8 +704,8 @@ my %special_entries;
## build %common_subkeys ## build %common_subkeys
## build @entries, except that not all fields are filled ## build @entries, except that not all fields are filled
my %subkeys_count; my %subkeys_count;
my $dbboilerplate = "checksum ".$dbchecksum."\n"; my $dbboilerplate = "checksum ".$dbchecksums[0]."\n";
foreach (split(/[\n\r\f]/, $$dbref)) { foreach (split(/[\n\r\f]/, ${$dbrefs[0]})) {
if (/^\s*#/) { if (/^\s*#/) {
$dbboilerplate .= $_."\n"; $dbboilerplate .= $_."\n";
next; next;
...@@ -914,7 +932,7 @@ my $dcs_type_count = scalar(keys %typeenum2nbtype); ...@@ -914,7 +932,7 @@ my $dcs_type_count = scalar(keys %typeenum2nbtype);
################################################################################ ################################################################################
## generate the data ## 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_C, $dbboilerplate);
boilerplate_autogen_c(F_CLASSIFIER_H, undef); boilerplate_autogen_c(F_CLASSIFIER_H, undef);
...@@ -925,7 +943,7 @@ _VCL (F_CLASSIFIER_H, VCL_TOP, <<EOF); ...@@ -925,7 +943,7 @@ _VCL (F_CLASSIFIER_H, VCL_TOP, <<EOF);
#define DCS_CLASSIFIER_H 1 #define DCS_CLASSIFIER_H 1
#include <stdint.h> #include <stdint.h>
#define DCS_CHECKSUM "$dbchecksum" #define DCS_CHECKSUM "$dbchecksums[0]"
/* tunable */ /* tunable */
#define DCS_MAX_NEGMATCH_CAND 32 #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