diff --git a/configure/CONFIG_BASE b/configure/CONFIG_BASE index e88e1e80d..5b5319b2c 100644 --- a/configure/CONFIG_BASE +++ b/configure/CONFIG_BASE @@ -57,11 +57,11 @@ TOOLS = $(EPICS_BASE_HOST_BIN) # Epics base build tools and tool flags MAKEBPT = $(call PATH_FILTER, $(TOOLS)/makeBpt$(HOSTEXE)) -DBEXPAND = $(call PATH_FILTER, $(TOOLS)/dbExpand$(HOSTEXE)) -DBTORECORDTYPEH = $(call PATH_FILTER, $(TOOLS)/dbToRecordtypeH$(HOSTEXE)) -DBTOMENUH = $(call PATH_FILTER, $(TOOLS)/dbToMenuH$(HOSTEXE)) +DBEXPAND = $(PERL) $(TOOLS)/dbdExpand.pl +DBTORECORDTYPEH = $(PERL) $(TOOLS)/dbdToRecordtypeH.pl +DBTOMENUH = $(PERL) $(TOOLS)/dbdToMenuH.pl REGISTERRECORDDEVICEDRIVER = $(PERL) $(TOOLS)/registerRecordDeviceDriver.pl -CONVERTRELEASE=$(PERL) $(TOOLS)/convertRelease.pl +CONVERTRELEASE = $(PERL) $(TOOLS)/convertRelease.pl #------------------------------------------------------- # tools for installing libraries and products diff --git a/src/Makefile b/src/Makefile index 88a03d7c6..b370c1d50 100644 --- a/src/Makefile +++ b/src/Makefile @@ -23,6 +23,9 @@ template/ext_DEPEND_DIRS = tools # Common +DIRS += dbHost +dbHost_DEPEND_DIRS = tools + DIRS += libCom libCom_DEPEND_DIRS = tools diff --git a/src/dbHost/Getopts.pm b/src/dbHost/Getopts.pm deleted file mode 100644 index 53b08e447..000000000 --- a/src/dbHost/Getopts.pm +++ /dev/null @@ -1,76 +0,0 @@ -package Getopts; -require 5.000; -require Exporter; - -@ISA = qw(Exporter); -@EXPORT = qw(getopts); - -# getopts.pl - our getopts stuff -# -# This version of getopts is modified from the Perl original in the -# following ways: -# -# 1. The perl routine in GetOpt::Std allows a perl hash to be passed -# in as a third argument and used for storing option values. This -# functionality has been deleted. -# 2. Arguments without a ':' modifier are now counted, rather than -# being binary. This means that multiple copies of the same option -# can be detected by the program. -# 3. A new '@' modifier is provided which collects the option arguments -# in an array @opt_X. Multiple copies of this option are permitted -# and push the arguments onto the end of the list. - -sub getopts ( $;$ ) { - my ($argumentative) = @_; - my (@args,$first,$rest); - my $errs = 0; - local $_; - local @EXPORT; - - @args = split( / */, $argumentative ); - while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) { - ($first,$rest) = ($1,$2); - if (/^--$/) { # early exit if -- - shift @ARGV; - last; - } - $pos = index($argumentative,$first); - if ($pos >= 0) { - if (defined($args[$pos+1]) and (index(':@', $args[$pos+1]) >= 0)) { - shift(@ARGV); - if ($rest eq '') { - ++$errs unless @ARGV; - $rest = shift(@ARGV); - } - if ($args[$pos+1] eq ':') { - ${"opt_$first"} = $rest; - push @EXPORT, "\$opt_$first"; - } elsif ($args[$pos+1] eq '@') { - push @{"opt_$first"}, $rest; - push @EXPORT, "\@opt_$first"; - } - } else { - ${"opt_$first"} += 1; - push @EXPORT, "\$opt_$first"; - if ($rest eq '') { - shift(@ARGV); - } else { - $ARGV[0] = "-$rest"; - } - } - } else { - warn "Unknown option: $first\n"; - ++$errs; - if ($rest ne '') { - $ARGV[0] = "-$rest"; - } else { - shift(@ARGV); - } - } - } - local $Exporter::ExportLevel = 1; - import Getopts; - $errs == 0; -} - -1; diff --git a/src/dbHost/Makefile b/src/dbHost/Makefile index 0158ca2a5..927d8f53c 100644 --- a/src/dbHost/Makefile +++ b/src/dbHost/Makefile @@ -7,8 +7,6 @@ TOP=../.. include $(TOP)/configure/CONFIG -PERL_MODULES += macLib.pm -PERL_MODULES += Readfile.pm PERL_MODULES += DBD.pm PERL_MODULES += DBD/Base.pm PERL_MODULES += DBD/Breaktable.pm diff --git a/src/dbHost/dbdExpand.pl b/src/dbHost/dbdExpand.pl index 5919ddbe4..34df25f4e 100755 --- a/src/dbHost/dbdExpand.pl +++ b/src/dbHost/dbdExpand.pl @@ -1,5 +1,14 @@ #!/usr/bin/perl +#************************************************************************* +# Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in file LICENSE that is included with this distribution. +#************************************************************************* + +# $Id$ + use FindBin qw($Bin); use lib "$Bin/../../lib/perl"; @@ -8,13 +17,13 @@ use DBD::Parser; use DBD::Output; use EPICS::Getopts; use Readfile; -use macLib; +use EPICS::macLib; getopts('DI@S@o:') or die "Usage: dbdExpand [-D] [-I dir] [-S macro=val] [-o out.dbd] in.dbd ..."; my @path = map { split /[:;]/ } @opt_I; -my $macros = macLib->new(@opt_S); +my $macros = EPICS::macLib->new(@opt_S); my $dbd = DBD->new(); while (@ARGV) { diff --git a/src/dbHost/dbdReport b/src/dbHost/dbdReport index a9d198614..b62e84ded 100755 --- a/src/dbHost/dbdReport +++ b/src/dbHost/dbdReport @@ -1,16 +1,25 @@ #!/usr/bin/perl +#************************************************************************* +# Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in file LICENSE that is included with this distribution. +#************************************************************************* + +# $Id$ + use FindBin qw($Bin); use lib "$Bin/../../lib/perl"; use DBD; use DBD::Parser; use EPICS::Getopts; -use macLib; +use EPICS::macLib; use Readfile; use Text::Wrap; -#$Readfile::debug = 1; +#$EPICS::Readfile::debug = 1; #$DBD::Parser::debug = 1; getopts('I@S@') or die usage(); @@ -20,7 +29,7 @@ sub usage() { } my @path = map { split /[:;]/ } @opt_I; -my $macros = macLib->new(@opt_S); +my $macros = EPICS::macLib->new(@opt_S); my $dbd = DBD->new(); &ParseDBD($dbd, &Readfile(shift @ARGV, $macros, \@opt_I)); diff --git a/src/dbHost/dbdToMenuH.pl b/src/dbHost/dbdToMenuH.pl index e321bc336..3f52fa446 100755 --- a/src/dbHost/dbdToMenuH.pl +++ b/src/dbHost/dbdToMenuH.pl @@ -1,4 +1,12 @@ #!/usr/bin/perl + +#************************************************************************* +# Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in file LICENSE that is included with this distribution. +#************************************************************************* + # $Id$ use FindBin qw($Bin); @@ -8,7 +16,7 @@ use EPICS::Getopts; use File::Basename; use DBD; use DBD::Parser; -use macLib; +use EPICS::macLib; use Readfile; my $tool = 'dbdToMenuH.pl'; diff --git a/src/dbHost/dbdToRecordtypeH.pl b/src/dbHost/dbdToRecordtypeH.pl index 0850b6e2a..6c0f0c575 100755 --- a/src/dbHost/dbdToRecordtypeH.pl +++ b/src/dbHost/dbdToRecordtypeH.pl @@ -1,4 +1,12 @@ #!/usr/bin/perl + +#************************************************************************* +# Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in file LICENSE that is included with this distribution. +#************************************************************************* + # $Id$ use FindBin qw($Bin); @@ -8,7 +16,7 @@ use EPICS::Getopts; use File::Basename; use DBD; use DBD::Parser; -use macLib; +use EPICS::macLib; use Readfile; my $tool = 'dbdToRecordtypeH.pl'; diff --git a/src/dbHost/Readfile.pm b/src/tools/EPICS/Readfile.pm similarity index 85% rename from src/dbHost/Readfile.pm rename to src/tools/EPICS/Readfile.pm index 1a04a7e0a..43ee493f4 100644 --- a/src/dbHost/Readfile.pm +++ b/src/tools/EPICS/Readfile.pm @@ -1,8 +1,17 @@ -package Readfile; +#************************************************************************* +# Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in file LICENSE that is included with this distribution. +#************************************************************************* + +# $Id$ + +package EPICS::Readfile; require 5.000; require Exporter; -use macLib; +use EPICS::macLib; @ISA = qw(Exporter); @EXPORT = qw(@inputfiles &Readfile); diff --git a/src/dbHost/macLib.pm b/src/tools/EPICS/macLib.pm similarity index 92% rename from src/dbHost/macLib.pm rename to src/tools/EPICS/macLib.pm index e4065483c..332ceca67 100644 --- a/src/dbHost/macLib.pm +++ b/src/tools/EPICS/macLib.pm @@ -1,4 +1,13 @@ -package macLib::entry; +#************************************************************************* +# Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in file LICENSE that is included with this distribution. +#************************************************************************* + +# $Id$ + +package EPICS::macLib::entry; sub new ($$) { my $class = shift; @@ -22,7 +31,7 @@ sub report ($) { } -package macLib; +package EPICS::macLib; use Carp; @@ -88,7 +97,7 @@ sub putValue ($$$) { $this->{macros}[0]{$name}{raw} = $raw; } } else { - my $entry = macLib::entry->new($name, 'macro'); + my $entry = EPICS::macLib::entry->new($name, 'macro'); $entry->{raw} = $raw; $this->{macros}[0]{$name} = $entry; } @@ -113,7 +122,7 @@ sub suppressWarning($$) { sub expandString($$) { my ($this, $src) = @_; $this->_expand; - my $entry = macLib::entry->new($src, 'string'); + my $entry = EPICS::macLib::entry->new($src, 'string'); my $result = $this->_translate($entry, 0, $src); return $result unless $entry->{error}; return $this->{noWarn} ? $result : undef; diff --git a/src/tools/Makefile b/src/tools/Makefile index 4dfc7aa1d..73a70cf88 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -14,7 +14,9 @@ TOOLS = $(TOP)/src/tools PERL_MODULES += EPICS/Copy.pm PERL_MODULES += EPICS/Path.pm PERL_MODULES += EPICS/Release.pm +PERL_MODULES += EPICS/Readfile.pm PERL_MODULES += EPICS/Getopts.pm +PERL_MODULES += EPICS/macLib.pm PERL_SCRIPTS += convertRelease.pl PERL_SCRIPTS += cvsclean.pl