Reorganized files, configure to use new versions.

* Moved Readfile and macLib into tools/EPICS
* dbHost/Getopts was a duplicate
* Added (c) headers
* Build in the dbHost dir
* Switch build system to use Perl versions.
This commit is contained in:
Andrew Johnson
2010-04-13 17:05:59 -05:00
parent f00684c8c3
commit ce43b9faf8
11 changed files with 74 additions and 95 deletions

View File

@@ -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

View File

@@ -23,6 +23,9 @@ template/ext_DEPEND_DIRS = tools
# Common
DIRS += dbHost
dbHost_DEPEND_DIRS = tools
DIRS += libCom
libCom_DEPEND_DIRS = tools

View File

@@ -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;

View File

@@ -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

View File

@@ -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) {

View File

@@ -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));

View File

@@ -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';

View File

@@ -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';

View File

@@ -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);

View File

@@ -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;

View File

@@ -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