EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: 3.14 build system doesn't cope with hyphens in IOC names
From: "Denison, PN \(Peter\)" <[email protected]>
To: <[email protected]>
Date: Thu, 1 Sep 2005 13:48:22 +0100
The build system in R3.14 won't cope with IOC names containing hyphens
(or any other character permitted in filenames, but not permitted in C
identifiers). This is a problem for us with our current naming
convention. It occurs because the auto-generated
<name>_registerRecordDeviceDriver.cpp file uses the app name to
construct a function <name>_registerRecordDeviceDriver() that is then
called from the st.cmd file.

The following patch to base just converts all the non-allowed characters
in the app name to underscores. Unfortunately, it relies on a change to
the ioc templates for makeBaseApp.pl, introducing a "_CSAFEAPPNAME_"
substitution where previously there was just "_APPNAME_". 

Is this a candidate for sneaking into R3.14.8? Can anyone suggest a
better way?

Index: src/registry/registerRecordDeviceDriver.pl
===================================================================
--- src/registry/registerRecordDeviceDriver.pl	(revision 67)
+++ src/registry/registerRecordDeviceDriver.pl	(working copy)
@@ -15,6 +15,11 @@
 $numberDeviceSupport = 0;
 $numberDriverSupport = 0;
 
+# PND 2005-08-31 avoid C errors by using only allowed characters in
identifiers
+# Requires a corresponding change in the substitution of st.cmd files
+$c_bad_ident_chars = '[^0-9A-Za-z_]';
+$subname =~ s/$c_bad_ident_chars/_/g;
+
 open(INP,"$file") or die "$! opening file";
 while(<INP>) {
     next if m/ ^ \s* \# /x;
Index: src/makeBaseApp/top/iocBoot/ioc/st.cmd@Common
===================================================================
--- src/makeBaseApp/top/iocBoot/ioc/st.cmd@Common	(revision 67)
+++ src/makeBaseApp/top/iocBoot/ioc/st.cmd@Common	(working copy)
@@ -9,7 +9,7 @@
 
 ## Register all support components
 dbLoadDatabase("dbd/_APPNAME_.dbd",0,0)
-_APPNAME__registerRecordDeviceDriver(pdbbase)
+_CSAFEAPPNAME__registerRecordDeviceDriver(pdbbase)
 
 ## Load record instances
 #dbLoadRecords("db/xxx.db","user=_USER_Host")
Index: src/makeBaseApp/top/iocBoot/ioc/st.cmd@RTEMS
===================================================================
--- src/makeBaseApp/top/iocBoot/ioc/st.cmd@RTEMS	(revision 67)
+++ src/makeBaseApp/top/iocBoot/ioc/st.cmd@RTEMS	(working copy)
@@ -7,7 +7,7 @@
 
 ## Register all support components
 dbLoadDatabase("dbd/_APPNAME_.dbd",0,0)
-_APPNAME__registerRecordDeviceDriver(pdbbase) 
+_CSAFEAPPNAME__registerRecordDeviceDriver(pdbbase) 
 
 ## Load record instances
 dbLoadRecords("../../db/_APPNAME_.db","user=_USER_")
Index: src/makeBaseApp/top/iocBoot/ioc/st.cmd@vxWorks
===================================================================
--- src/makeBaseApp/top/iocBoot/ioc/st.cmd@vxWorks	(revision 67)
+++ src/makeBaseApp/top/iocBoot/ioc/st.cmd@vxWorks	(working copy)
@@ -16,7 +16,7 @@
 ## Register all support components
 cd top
 dbLoadDatabase("dbd/_APPNAME_.dbd",0,0)
-_APPNAME__registerRecordDeviceDriver(pdbbase)
+_CSAFEAPPNAME__registerRecordDeviceDriver(pdbbase)
 
 ## Load record instances
 #dbLoadRecords("db/_APPNAME_.db","macro=value")
Index: src/makeBaseApp/makeBaseApp.pl
===================================================================
--- src/makeBaseApp/makeBaseApp.pl	(revision 67)
+++ src/makeBaseApp/makeBaseApp.pl	(working copy)
@@ -14,6 +14,8 @@
 %release = (TOP => $app_top);
 @apps   = (TOP);
 
+$c_bad_ident_chars = '[^0-9A-Za-z_]';
+
 &GetUser;		# Ensure we know who's in charge
 &readRelease("configure/RELEASE", \%release, \@apps) if (-r
"configure/RELEASE");
 &readRelease("configure/RELEASE.$ENV{EPICS_HOST_ARCH}", \%release,
\@apps)
@@ -93,6 +95,7 @@
     $line =~ s/_TEMPLATE_TOP_/$app_template_top/go;
     $line =~ s/_TOP_/$app_top/go;
     $line =~ s/_APPNAME_/$appname/g;
+    $line =~ s/_CSAFEAPPNAME_/$csafeappname/g;
     $line =~ s/_APPTYPE_/$apptype/go;
     $line =~ s/_ARCH_/$arch/go if ($opt_i);
     $line =~ s/_IOC_/$ioc/g if ($ioc);
@@ -122,6 +125,7 @@
 
     foreach $ioc ( @ARGV ) {
 	($appname = $ioc) =~ s/App$//;
+	($csafeappname = $appname) =~ s/$c_bad_ident_chars/_/g;
 	$ioc = "ioc" . $ioc unless ($ioc =~ /^ioc/);
         if (-d "iocBoot/$ioc") {
 	    print "iocBoot/$ioc exists, not modified.\n";
@@ -137,6 +141,7 @@
 #
 foreach $app ( @ARGV ) {
     ($appname = $app) =~ s/App$//;
+    ($csafeappname = $appname) =~ s/$c_bad_ident_chars/_/g;
     $appdir  = $appname . "App";
     if (-d "$appdir") {
 	print "$appname exists, not modified.\n";

Peter Denison, Senior Software Engineer
Diamond Light Source Ltd., Diamond House, Chilton, Didcot, Oxon, OX11
0DE
Tel: +44 1235 778511


Replies:
Re: 3.14 build system doesn't cope with hyphens in IOC names Ernest L. Williams Jr.

Navigate by Date:
Prev: Re: Fwd: FW: Font problem when using EDM Noboru Yamamoto
Next: Re: 3.14 build system doesn't cope with hyphens in IOC names Ernest L. Williams Jr.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: job openings for Gemini Observatory Matthieu Bec
Next: Re: 3.14 build system doesn't cope with hyphens in IOC names Ernest L. Williams Jr.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·