From 2c474f44e8f7c0e704617da9209c8edfc5afa7a5 Mon Sep 17 00:00:00 2001 From: zimoch Date: Tue, 26 Feb 2013 16:47:58 +0000 Subject: [PATCH] aliases and link target check added --- externalLinks | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/externalLinks b/externalLinks index 8468cf7..50afaee 100755 --- a/externalLinks +++ b/externalLinks @@ -4,8 +4,8 @@ version () { echo '$Author: zimoch $' >&2 - echo '$Date: 2011/09/23 10:04:09 $' >&2 - echo '$Revision: 1.9 $' >&2 + echo '$Date: 2013/02/26 16:47:58 $' >&2 + echo '$Revision: 1.10 $' >&2 echo '$Source: /cvs/G/EPICS/App/scripts/externalLinks,v $' >&2 exit 1 } @@ -212,6 +212,7 @@ function expandFile () { /field\(.*,DBF_.*\)/ { match($0,/\((.*),/,a) field = a[1] + isfield[rtype,field] = 1 } /field\(.*,DBF_NOACCESS\)/ { isnoaccess[rtype,field] = 1 @@ -313,7 +314,7 @@ function expandFile () { issoft[rtype,dtype] = 1 } if (isdefined[rtype, dtype]) { if (debug) { - printf("duplicate device type %s for record type %s\n\t%s line %d\n\t%s\n", + printf("duplicate device type \"%s\" for record type %s\n\t%s line %d\n\t%s\n", dtype, rtype, filename, line, definition[rtype, dtype]) > "/dev/stderr" } modulename[rtype, dtype] = modulename[rtype, dtype] "\" or \"" module @@ -347,12 +348,21 @@ function expandFile () { } soft = 1 } + /alias\(".*\",".*\")/ { + match($0,/\("(.*)","(.*)"/,a) + record = a[1] + aliasname = a[2] + if (recordtype[record] == "") { + printf ("alias \"%s\" defined for not existing record \"%s\"\n\tin %s\n", + aliasname, record, filename) > "/dev/stderr" + } + alias[aliasname] = record; + } /field\(.*, ".*\")/ { if (!stringsize[rtype,"NAME"]) next; match($0,/\((.*), "(([^-+0-9\.][^\. ]*)?.*)"\)/,a) field = a[1] value = a[2] - target = a[3] menu = menuname[rtype,field] if (fieldvalue[record,field] && fieldvalue[record,field] != value) { @@ -385,9 +395,9 @@ function expandFile () { soft = issoft[rtype,value] dtyp[record] = value } else if (islink[rtype,field]) { - if (target != "" && \ + if (value != "" && \ ((field != "INP" && field != "OUT") || soft)) { - reference[target] = filename ": "record "." field + reference[value] = filename ": "record "." field } if (field == "INP" || field == "OUT") { iolink[record] = field @@ -440,9 +450,25 @@ function expandFile () { } END { for (target in reference) { - if (recordtype[target] == "") { + split(target,a,".") + record = a[1] + field = a[2] + if (alias[record] != "") { record = alias[record] } + if (recordtype[record] == "") { if (where) print reference[target],target else print target + } else { + if (field == "") { field = "VAL" } + rtype = recordtype[record] + 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" + } else if (isnoaccess[rtype,field]) { + printf("link \"%s\" points to NOACCESS %s field \"%s.%s\"\n", + link, rtype, record, field) > "/dev/stderr" + } } } if (require) {