From 8375a2cf18a5fbabce523de411f783bd2117c6fd Mon Sep 17 00:00:00 2001 From: "Janet B. Anderson" Date: Thu, 17 Aug 1995 20:22:13 +0000 Subject: [PATCH] Moved bldEnvData,blderrSymTbl, makeStatTbl to libCom dir --- src/libCom/Makefile.Unix | 4 +- src/libCom/Makefile.Vx | 4 +- src/libCom/bldEnvData | 105 ++++++++++++++++++++++++++++++++++ src/libCom/blderrSymTbl | 118 +++++++++++++++++++++++++++++++++++++++ src/libCom/makeStatTbl | 75 +++++++++++++++++++++++++ 5 files changed, 302 insertions(+), 4 deletions(-) create mode 100755 src/libCom/bldEnvData create mode 100755 src/libCom/blderrSymTbl create mode 100755 src/libCom/makeStatTbl diff --git a/src/libCom/Makefile.Unix b/src/libCom/Makefile.Unix index 7484d52e7..8f93a3048 100644 --- a/src/libCom/Makefile.Unix +++ b/src/libCom/Makefile.Unix @@ -56,11 +56,11 @@ errSymTbl.o: errSymTbl.c errInc.o errSymTbl.c errInc.o: errInc.c @$(RM) errInc.o - @$(EPICS_BASE)/tools/blderrSymTbl; + @../blderrSymTbl $(EPICS) $(HOST_ARCH) "$(MAKE)" envData.c: $(EPICS_BASE)/include/envDefs.h $(EPICS)/config/CONFIG_ENV \ $(EPICS)/config/CONFIG_SITE_ENV - $(EPICS_BASE)/tools/bldEnvData + ../bldEnvData $(EPICS) pre_build: @test -f errInc.c || ln -s ../errInc.c errInc.c diff --git a/src/libCom/Makefile.Vx b/src/libCom/Makefile.Vx index e18054928..542dae133 100644 --- a/src/libCom/Makefile.Vx +++ b/src/libCom/Makefile.Vx @@ -50,11 +50,11 @@ build: errSymTbl.o errInc.o errSymTbl.c errInc.o: errInc.c @$(RM) errInc.o - @$(EPICS_BASE)/tools/blderrSymTbl + ../blderrSymTbl $(EPICS) $(HOST_ARCH) "$(MAKE)" envData.c: $(EPICS_BASE)/include/envDefs.h $(EPICS)/config/CONFIG_ENV \ $(EPICS)/config/CONFIG_SITE_ENV - $(EPICS_BASE)/tools/bldEnvData + ../bldEnvData $(EPICS) pre_build: @test -f errInc.c || ln -s ../errInc.c errInc.c diff --git a/src/libCom/bldEnvData b/src/libCom/bldEnvData new file mode 100755 index 000000000..413434e2a --- /dev/null +++ b/src/libCom/bldEnvData @@ -0,0 +1,105 @@ +#!/bin/sh +# +# base/tools $Id$ +# Author: Andrew Johnson (RGO) +# Date: 14-Mar-95 +# +# Experimental Physics and Industrial Control System (EPICS) +# +# $Log$ +# Revision 1.3 1995/08/14 19:27:24 jhill +# extern => epicsShareExtern +# +# Revision 1.2 1995/05/04 09:49:24 anj +# Added CONFIG_SITE_ENV, changed envData to .c file +# +# Revision 1.1 1995/04/24 16:02:29 anj +# Moved environment parameter defaults to config/CONFIG_ENV +# +# + +# tool to build envData.c from envDefs.h and config/CONFIG*ENV + +# Usage bldEnvData + +HERE=`/bin/pwd` +cd $1 +EPICS=`/bin/pwd` +cd ${HERE} +SRC=${EPICS}/base/include/envDefs.h +ENV_DATA=${EPICS}/config/CONFIG_ENV +SITE_DATA=${EPICS}/config/CONFIG_SITE_ENV +OBJ=envData.c +TOOL=`basename $0` + +# Start by creating a list of the ENV_PARAM declarations +PARAMS=`sed -n -e 's/;//' \ + -e 's/^[ ]*epicsShareExtern[ ][ ]*ENV_PARAM[ ][ ]*//p' \ + ${SRC}` + +# Create a new header file +rm -rf ${OBJ} +cat >${OBJ} < + +!EOF + +# Make sure no corresponding shell environment variables +unset ${PARAMS} + +# Read the default values from the config file into shell variables +. ${ENV_DATA} +. ${SITE_DATA} + +# Scan through the parameters to create the definition +for ENV in ${PARAMS} +do + # Get the default, complain if not present + if [ `set | grep -c ${ENV}=` = 0 ]; + then + echo No default value for ${ENV} + DEFAULT="" + else + VAR='$'${ENV} + DEFAULT=`eval echo ${VAR}` + fi + + # Add this definition to the header file +# echo ${ENV} = ${DEFAULT} + echo ENV_PARAM ${ENV}'={"'${ENV}'","'${DEFAULT}'"};' >>${OBJ} +done + +# Now create an array pointing to all parameters +cat >>${OBJ} <>${OBJ} +done + +# Finally finish list with 0 +cat >>${OBJ} </dev/null \ + | sed -e 's/errInc\.o.*: errInc\.c//' -e 's/\\\//'` + else + MAKEDEPEND=`which makedepend` + if [ -x "$MAKEDEPEND" ]; then + FILES=`"$MAKEDEPEND" -f- -D$DEF -I../../../include \ + errInc.c 2>/dev/null | sed -e 's/errInc.o://' -e 's/\\\//'` + else + echo Neither GCC or MAKEDEPEND found. + exit 1 + fi + fi + ;; + solaris) + # use -xM option of ACC to list dependencies + + CC=`$EPICS/base/tools/GetVar $EPICS ACC $HOST_ARCH` + FILES=`$CC -xM -D$DEF -I../../../include errInc.c \ + | grep "errInc.o" | grep -v "errInc.c" \ + | sed -e 's/errInc\.o://'` + ;; + sun4) + # use -M option of Sun compiler to list make dependencies + + FILES=`cc -M -D$DEF -I../../../include errInc.c 2>/dev/null \ + | grep "errInc.o" | grep -v "errInc.c" \ + | sed -e 's/errInc\.o://'` + ;; + *) + # Unrecognised host architecture + echo $0: host architecture not supported + exit 1 +esac + + +# files with S_ defines +grep "^#define[ ]*S_" $FILES /dev/null \ + | sed -e 's-:.*--' | sort -u >$SFILES + + +# create a tmpmakefile +cat $SFILES | (awk ' +BEGIN {print "errInc.o : errInc.c \\"} +{print " "$0" \\" } +END {print " ../../../include/errMdef.h"} + +') > $TMPMAKEFILE + + cat >> $TMPMAKEFILE <errSymTbl.c + /bin/rm -f errInc.o + touch errInc.o +!addon + $MAKE -f $TMPMAKEFILE + /bin/rm -f $TMPMAKEFILE $SFILES +exit 0 diff --git a/src/libCom/makeStatTbl b/src/libCom/makeStatTbl new file mode 100755 index 000000000..042bce1ed --- /dev/null +++ b/src/libCom/makeStatTbl @@ -0,0 +1,75 @@ +#!/bin/sh +# +# makeStatTbl +# share/src/misc $Id$ +# makeStatTbl - Create Error Symbol Table +# +# modification history +# -------------------- +# 17-JUL-90 mrk Modified vxWorks makeStatTbl +# +# SYNOPSIS +# createErrSymTbl hdir [...] >errSymTbl.c +# +# DESCRIPTION +# This tool creates a symbol table (ERRSYMTAB) structure which contains the +# names and values of all the status codes defined in the .h files in the +# specified directory(s). The status codes must be prefixed with "S_" +# in order to be included in this table. +# A "err.h" file must exist in each hdir which defines the module +# numbers, eg. "M_". The table is created on standard output. +# +# This tool's primary use is for creating an error status table used +# by errPrint, and errSymFind. +# +# FILES +# errMdef.h module number file for each h directory +# +# SEE ALSO: errnoLib(1), symLib(1) +#*/ + +tmp=/tmp/mstt$$ + +trap "rm -f $tmp ; exit" 0 1 2 3 15 + +cat $tmp + +cat $* | egrep "^#define[ ]*S_" >>$tmp + + +echo "/* status code symbol table */ + +/* CREATED BY makeStatTbl" + +echo " * FROM `pwd`" + +echo " * ON `date` + */ +"' +#include "errMdef.h" +#include "errSymTbl.h" +' + +echo + +cat $tmp + +echo ' + +LOCAL ERRSYMBOL symbols[] = + {' + +sed -e 's/^.*define[ ]*\(S_[a-zA-Z0-9_]*\).*\/\*\(.*\)\*\/.*/ {"\2", (long) \1},/' \ + $tmp + +echo " }; + +LOCAL ERRSYMTAB symTbl = + { + NELEMENTS (symbols), /* current number of symbols in table */ + symbols, /* ptr to symbol array */ + }; + +ERRSYMTAB_ID errSymTbl = &symTbl;" + +exit 0