#!/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