From 4e46a2945b28449fee38736269ec808087fc5d43 Mon Sep 17 00:00:00 2001 From: zimoch Date: Fri, 6 Jul 2018 09:37:45 +0000 Subject: [PATCH] Prefer new /ioc/module drivers over old ones --- externalLinks | 112 +++++++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 51 deletions(-) diff --git a/externalLinks b/externalLinks index 2cbdf0e..b400909 100755 --- a/externalLinks +++ b/externalLinks @@ -4,8 +4,8 @@ version () { echo '$Author: zimoch $' >&2 - echo '$Date: 2018/07/05 15:37:55 $' >&2 - echo '$Revision: 1.23 $' >&2 + echo '$Date: 2018/07/06 09:37:45 $' >&2 + echo '$Revision: 1.24 $' >&2 echo '$Source: /cvs/G/EPICS/App/scripts/externalLinks,v $' >&2 exit 1 } @@ -129,7 +129,6 @@ function expandFile () { echo "can't find base.dbd or softIoc.dbd" >&2 exit 1 fi - echo "# file $MAINDBD base" cat $MAINDBD for dbd in dbd/*.dbd @@ -148,23 +147,14 @@ function expandFile () { echo $INSTBASE/iocBoot/R${EPICS}/dbd/+([^-]).dbd - for dbd in $INSTBASE/iocBoot/R${EPICS}/dbd/+([^-]).dbd - do - if [ -L $dbd ] - then - module=$(basename $dbd) - module=${module%.dbd} - if [ $module != base -a $module != slsMain -a $module != sls ] - then - echo "# file $dbd $module"; cat $dbd - fi - fi - done - for modulebase in ${EPICS_MODULES:=/ioc/modules}/* do debug modulebase: $modulebase > /dev/stderr module=$(basename $modulebase) + if [ $module = base ] + then + continue + fi debug module: $module > /dev/stderr moduledir=$(ls -1rvd $modulebase/*.*.*/R${EPICS} | head -n 1) [ $moduledir = "." ] && continue @@ -173,6 +163,7 @@ function expandFile () { do debug dbd: $dbd > /dev/stderr echo "# file $dbd $module"; cat $dbd + declare -A modules[$module]=$dbd done if [ -d $moduledir/db ] then @@ -181,6 +172,19 @@ function expandFile () { fi done + for dbd in $INSTBASE/iocBoot/R${EPICS}/dbd/+([^-]).dbd + do + if [ -L $dbd ] + then + module=$(basename $dbd) + module=${module%.dbd} + if [ "${modules[$module]}" = "" -a $module != base -a $module != slsMain -a $module != sls ] + then + echo "# file $dbd $module"; cat $dbd + fi + fi + done + for subs in $@ do debug includes: $INCLUDES > /dev/stderr @@ -206,6 +210,9 @@ function expandFile () { if (!module && match(filename,epicsmodules)==1) { /* happens for module templates only */ module = gensub(epicsmodules"/*([^/]*)/.*","\\1",1,filename) + if (debug) { + printf ("Using template %s requires \"%s\"\n", filename, module) > "/dev/stderr" + } required[module] = 1 } line = 0 @@ -235,7 +242,7 @@ function expandFile () { } else { ischoice[menu,choice] = 1 enum[menu,choicenum[menu]++] = choice - choices[menu] = choices[menu] "\"" choice "\" " + choices[menu] = choices[menu] "\t\t\"" choice "\"\n" modulename[menu,choice] = module definition[menu,choice] = filename ":" line } @@ -269,7 +276,7 @@ function expandFile () { printf("%s:%d\n\tduplicate recordtype %s\n\t%s\n", filename, line, rtype, definition[rtype]) > "/dev/stderr" } - modulename[rtype] = modulename[rtype] "\" or \"" module + if (modulename[rtype] !~ module) modulename[rtype] = modulename[rtype] "\" or \"" module valid = 0 } else { modulename[rtype] = module @@ -277,13 +284,13 @@ function expandFile () { valid = 1 } } - /field\(.*,DBF_.*\)/ {if (!valid) next } - /field\(.*,DBF_.*\)/ { + /field\(.*, *DBF_.*\)/ {if (!valid) next } + /field\(.*, *DBF_.*\)/ { match($0,/\((.*),/,a) field = a[1] isfield[rtype,field] = 1 } - /field\(.*,DBF_NOACCESS\)/ { + /field\(.*, *DBF_NOACCESS\)/ { isnoaccess[rtype,field] = 1 next } @@ -291,62 +298,62 @@ function expandFile () { isnoaccess[rtype,field] = 0 next } - /field\(.*,DBF_.*\)/ { + /field\(.*, *DBF_.*\)/ { if (field != "NAME") { - fields[rtype] = fields[rtype] field " " + fields[rtype] = fields[rtype] "\t\t" field "\n" } } - /field\(.*,DBF_.*LINK\)/ { + /field\(.*, *DBF_.*LINK\)/ { islink[rtype,field] = 1 next } - /field\(.*,DBF_STRING\)/ { + /field\(.*, *DBF_STRING\)/ { isstring[rtype,field] = 1 next } - /field\(.*,DBF_DEVICE\)/ { + /field\(.*, *DBF_DEVICE\)/ { isdevice[rtype,field] = 1 next } - /field\(.*,DBF_FLOAT\)/ { + /field\(.*, *DBF_FLOAT\)/ { isnumeric[rtype,field] = 1 next } - /field\(.*,DBF_DOUBLE\)/ { + /field\(.*, *DBF_DOUBLE\)/ { isnumeric[rtype,field] = 1 next } - /field\(.*,DBF_ULONG\)/ { + /field\(.*, *DBF_ULONG\)/ { isunsigned[rtype,field] = "ULONG" range[rtype,field] = 0xffffffff next } - /field\(.*,DBF_USHORT\)/ { + /field\(.*, *DBF_USHORT\)/ { isunsigned[rtype,field] = "USHORT" range[rtype,field] = 0xffff next } - /field\(.*,DBF_UCHAR\)/ { + /field\(.*, *DBF_UCHAR\)/ { isunsigned[rtype,field] = "UCHAR" range[rtype,field] = 0xff next } - /field\(.*,DBF_LONG\)/ { + /field\(.*, *DBF_LONG\)/ { isinteger[rtype,field] = "LONG" range[rtype,field] = 0x7fffffff next } - /field\(.*,DBF_SHORT\)/ { + /field\(.*, *DBF_SHORT\)/ { isinteger[rtype,field] = "SHORT" range[rtype,field] = 0x7fff next } - /field\(.*,DBF_CHAR\)/ { + /field\(.*, *DBF_CHAR\)/ { isinteger[rtype,field] = "CHAR" range[rtype,field] = 0x7f next } - /field\(.*,DBF_ENUM\)/ { + /field\(.*, *DBF_ENUM\)/ { isunsigned[rtype,field] = "ENUM" range[rtype,field] = 0xffff next @@ -390,10 +397,10 @@ function expandFile () { printf("%s:%d\n\tduplicate device type \"%s\" for record type %s\n\t%s\n", filename, line, dtype, rtype, definition[rtype, dtype]) > "/dev/stderr" } - modulename[rtype, dtype] = modulename[rtype, dtype] "\" or \"" module + if (modulename[rtype] !~ module) modulename[rtype, dtype] = modulename[rtype, dtype] "\" or \"" module } else { modulename[rtype, dtype] = module - devices[rtype] = devices[rtype] "\"" dtype "\" " + devices[rtype] = devices[rtype] "\t\t\"" dtype "\"\n" definition[rtype, dtype] = filename ":" line } } @@ -407,10 +414,10 @@ function expandFile () { } else { recordtype[record] = rtype definition[record] = filename ":" line - if (!required[modulename[rtype]]) { + if (modulename[rtype] && !required[modulename[rtype]]) { if (debug) { - printf ("recordtype %s requires \"%s\"\n", rtype, modulename[rtype]) > "/dev/stderr" - } + printf ("recordtype %s requires \"%s\"\n", rtype, modulename[rtype]) > "/dev/stderr" + } required[modulename[rtype]] = 1 } } @@ -453,7 +460,7 @@ function expandFile () { definition[record,field] = filename ":" line if (value == "") next if (!isfield[rtype,field]) { - printf("%s:%d\n\t%s record \"%s\" unknown field %s\n\tshould be one of:\n%s\n\n", + printf("%s:%d\n\t%s record \"%s\"\n\tUnknown field %s. Known fields:\n%s", filename, line, rtype, record, field, fields[rtype]) > "/dev/stderr" } else if (isnoaccess[rtype,field]) { printf("writing \"%s\" to NOACCESS field %s.%s\n", @@ -476,10 +483,10 @@ function expandFile () { } } if (!definition[rtype,value]) { - printf("%s:%d\n\t%s record \"%s\" field %s\n\tunknown device \"%s\" should be one of:\n%s\n\n", + printf("%s:%d\n\t%s record \"%s\" field %s\n\tUnknown device type \"%s\". Known types:\n%s", filename, line, rtype, record, field, value, devices[rtype]) > "/dev/stderr" } else { - if (!required[modulename[rtype,value]]) { + if (modulename[rtype,value] && !required[modulename[rtype,value]]) { if (debug) { printf ("%s \"%s\" for record type %s requires \"%s\"\n", field, value, rtype, modulename[rtype,value]) > "/dev/stderr" @@ -493,9 +500,10 @@ function expandFile () { if (!ischoice[menu,value]) { if (value != int(value) || value < 0) { - printf("%s:%d\n\t%s record \"%s\" field %s\n\tunknown %s choice \"%s\" should be one of:\n%s\n\n", + printf("%s:%d\n\t%s record \"%s\" field %s\n\tUnknown %s choice \"%s\". Known choices:\n%s", filename, line, rtype, record, field, menu, value, choices[menu]) > "/dev/stderr" } else { + if (enum[menu,value] != "") printf("%s:%d\n\t%s record \"%s\" field %s\n\tbetter use %s choice \"%s\" instead of number \"%s\"\n", filename, line, rtype, record, field, menu, enum[menu,value], value) > "/dev/stderr" } @@ -549,21 +557,23 @@ function expandFile () { split (reference[target],a," ") link = a[2] if (!isfield[rtype,field]) { - printf("link \"%s\" points to non-existing %s field \"%s.%s\"\n", - link, rtype, record, field) > "/dev/stderr" + if (!definition[rtype]) + printf("%s:%d\n\tLink \"%s\"\n\tpoints to unknown record type %s.\n", + filename, line, link, rtype) + else + printf("%s:%d\n\tLink \"%s\"\n\tpoints to non-existing %s field \"%s.%s\". I only know:\n%s", + filename, line, link, rtype, record, field, fields[rtype]) > "/dev/stderr" } else if (isnoaccess[rtype,field]) { if (!(field == "TIME" && gensub(/.*\./,"",1,link) == "TSEL")) { - printf("link \"%s\" points to NOACCESS %s field \"%s.%s\"\n", - link, rtype, record, field) > "/dev/stderr" + printf("%s:%d\n\tLink \"%s\" points to NOACCESS %s field \"%s.%s\"\n", + filename, line, link, rtype, record, field) > "/dev/stderr" } } } } if (require) { for (module in required) { - if (module != "base") { - print "require \"" module "\"" - } + printf ("require \"%s\"\n", module) } } }