From 3c56d08b34d74455716057039bcaf6e2daf23246 Mon Sep 17 00:00:00 2001 From: zimoch Date: Thu, 22 Dec 2011 10:33:20 +0000 Subject: [PATCH] accept and strip illegal quotes in registrar, function, variable declarations (-> some SynApps drivers use them) --- App/tools/expandDBD.tcl | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/App/tools/expandDBD.tcl b/App/tools/expandDBD.tcl index 3299a30..ebdc143 100755 --- a/App/tools/expandDBD.tcl +++ b/App/tools/expandDBD.tcl @@ -16,6 +16,7 @@ while {[llength $argv]} { "-r" { set recordtypes 1; set quiet 1 } "-I" { lappend seachpath [lindex $argv 1]; set argv [lreplace $argv 0 1]; continue } "-I*" { lappend seachpath [string range [lindex $argv 0] 2 end] } + "--" { set argv [lreplace $argv 0 0]; break } "-*" { puts stderr "Unknown option [lindex $argv 0] ignored" } default { break } } @@ -39,16 +40,24 @@ scanmatch $global_context {^[ \t]*(#|%|$)} { } if {$recordtypes} { - scanmatch $global_context {include[ \t]+"?(.*)Record.dbd"?} { - puts $matchInfo(submatch0) + scanmatch $global_context {include[ \t]+"?((.*)Record.dbd)"?} { + if ![catch { + close [opendbd $matchInfo(submatch0)] + }] { + puts $matchInfo(submatch1) + } continue } } else { - scanmatch $global_context {(registrar|variable|function)[ \t]*\(} { + scanmatch $global_context {(registrar|variable|function)[ \t]*\([ \t]*"?([a-zA-Z0-9_]+)"?[ \t]*\)} { global epicsversion - if {$epicsversion == 3.14} {puts $matchInfo(line)} + if {$epicsversion == 3.14} {puts $matchInfo(submatch0)($matchInfo(submatch1))} + } + scanmatch $global_context {variable[ \t]*\([ \t]*"?([a-zA-Z0-9_]+)"?[ \t]*,[ \t]*"?([a-zA-Z0-9_]+)"?[ \t]*\)} { + global epicsversion + if {$epicsversion == 3.14} {puts variable($matchInfo(submatch0),$matchInfo(submatch1))} } scanmatch $global_context { @@ -87,4 +96,4 @@ foreach filename $argv { close $file } -# $Header: /cvs/G/DRV/misc/App/tools/expandDBD.tcl,v 1.3 2011/06/14 16:00:55 zimoch Exp $ +# $Header: /cvs/G/DRV/misc/App/tools/expandDBD.tcl,v 1.4 2011/12/22 10:33:20 zimoch Exp $