Moved bldEnvData,blderrSymTbl, makeStatTbl to libCom dir
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
105
src/libCom/bldEnvData
Executable file
105
src/libCom/bldEnvData
Executable file
@@ -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
|
||||
/* ${HERE}/${OBJ}
|
||||
*
|
||||
* created by ${TOOL}
|
||||
*
|
||||
* from:
|
||||
* ${SRC}
|
||||
* ${ENV_DATA}
|
||||
* ${SITE_DATA}
|
||||
*
|
||||
* `date`
|
||||
*
|
||||
*/
|
||||
|
||||
#include <envDefs.h>
|
||||
|
||||
!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} <<!EOF
|
||||
|
||||
ENV_PARAM* env_param_list[] = {
|
||||
!EOF
|
||||
|
||||
# Contents are the addresses of each parameter
|
||||
for ENV in ${PARAMS}
|
||||
do
|
||||
echo ' &'${ENV}, >>${OBJ}
|
||||
done
|
||||
|
||||
# Finally finish list with 0
|
||||
cat >>${OBJ} <<!EOF
|
||||
0
|
||||
};
|
||||
|
||||
!EOF
|
||||
|
||||
exit 0
|
||||
|
||||
118
src/libCom/blderrSymTbl
Executable file
118
src/libCom/blderrSymTbl
Executable file
@@ -0,0 +1,118 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# base/tools $Id$
|
||||
# Author: Robert Zieman (ANL)
|
||||
# Date: 6/03/91
|
||||
#
|
||||
# Experimental Physics and Industrial Control System (EPICS)
|
||||
#
|
||||
# Copyright 1991, the Regents of the University of California,
|
||||
# and the University of Chicago Board of Governors.
|
||||
#
|
||||
# This software was produced under U.S. Government contracts:
|
||||
# (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
# and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
#
|
||||
# Initial development by:
|
||||
# The Controls and Automation Group (AT-8)
|
||||
# Ground Test Accelerator
|
||||
# Accelerator Technology Division
|
||||
# Los Alamos National Laboratory
|
||||
#
|
||||
# Co-developed with
|
||||
# The Controls and Computing Group
|
||||
# Accelerator Systems Division
|
||||
# Advanced Photon Source
|
||||
# Argonne National Laboratory
|
||||
#
|
||||
# Modification Log:
|
||||
# -----------------
|
||||
# .00 mm-dd-yy iii Comment
|
||||
# .01 05-04-94 pg HPUX port modifications.
|
||||
# .02 08-25-94 mda use makedepend for HP or Alpha if no GCC
|
||||
# .03 04-28-95 anj use GetVar and case for host arch
|
||||
# ...
|
||||
#
|
||||
|
||||
# tool to rebuild errSymTbl.c when errInc.c or it's depends change
|
||||
|
||||
# Usage blderrSymTbl EPICS HOST_ARCH MAKE VXLIST - IOC and commmon
|
||||
# Usage blderrSymTbl EPICS HOST_ARCH MAKE - just common
|
||||
|
||||
if [ "x" = "x$4" ]; then
|
||||
DEF="XXX"
|
||||
else
|
||||
DEF="${4}"
|
||||
fi
|
||||
|
||||
|
||||
TMPMAKEFILE=/tmp/tmpmakefile
|
||||
SFILES=/tmp/sfiles
|
||||
EPICS=$1
|
||||
HOST_ARCH=$2
|
||||
MAKE=$3
|
||||
|
||||
case $HOST_ARCH in
|
||||
alpha | hp700)
|
||||
# Use gcc if it can be found, or makedepend
|
||||
|
||||
GCC=`which gcc`
|
||||
if [ -x "$GCC" ]; then
|
||||
FILES=`"$GCC" -M -D$DEF -I../../../include \
|
||||
errInc.c 2>/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 <<!addon
|
||||
/bin/rm -f errSymTbl.c
|
||||
../makeStatTbl \`cat $SFILES\` >errSymTbl.c
|
||||
/bin/rm -f errInc.o
|
||||
touch errInc.o
|
||||
!addon
|
||||
$MAKE -f $TMPMAKEFILE
|
||||
/bin/rm -f $TMPMAKEFILE $SFILES
|
||||
exit 0
|
||||
75
src/libCom/makeStatTbl
Executable file
75
src/libCom/makeStatTbl
Executable file
@@ -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 </dev/null >$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
|
||||
Reference in New Issue
Block a user