summaryrefslogtreecommitdiffstats
path: root/fickle
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-03-03 22:52:38 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-03-03 22:52:38 (GMT)
commitd0d911010be430036b02a3cca7b884a4281c2208 (patch)
treede10c6142f2a0d9914b88a048d03401d0fd761ef /fickle
parente7b4d65a7d83358bf1647547112e4b48b830ea76 (diff)
downloadblt-d0d911010be430036b02a3cca7b884a4281c2208.zip
blt-d0d911010be430036b02a3cca7b884a4281c2208.tar.gz
blt-d0d911010be430036b02a3cca7b884a4281c2208.tar.bz2
add defs include file
Diffstat (limited to 'fickle')
-rw-r--r--fickle/fickle.tcl15
1 files changed, 7 insertions, 8 deletions
diff --git a/fickle/fickle.tcl b/fickle/fickle.tcl
index 9af8479..0019d52 100644
--- a/fickle/fickle.tcl
+++ b/fickle/fickle.tcl
@@ -878,9 +878,12 @@ proc fickle_args {argv} {
if {$argvp >= [llength $argv]} {
# read from stdin
set ::src stdin
+ set ::in_filename {}
+ set ::in_dir {}
set out_filename "lex.yy.tcl"
} else {
set ::in_filename [lindex $argv $argvp]
+ set ::in_dir [file dirname $::in_filename]
if {$out_filename == ""} {
set out_filename [file rootname $::in_filename]
append out_filename ".tcl"
@@ -927,10 +930,9 @@ proc fickle_main {} {
}
} else {
if {[lindex $line 0] == "#tab"} {
- set dir [file dirname $::in_filename]
set fn [lindex $line 1]
if {$fn != {}} {
- if [catch {open [file join $dir $fn] r} ch] {
+ if [catch {open [file join $::in_dir $fn] r} ch] {
puts stderr "Could not open tab file '$fn'."
exit $::IO_ERROR
}
@@ -939,10 +941,9 @@ proc fickle_main {} {
}
} elseif {$file_state == "definitions"} {
if {[lindex $line 0] == "#include"} {
- set dir [file dirname $::in_filename]
set fn [lindex $line 1]
if {$fn != {}} {
- if [catch {open [file join $dir $fn] r} ch] {
+ if [catch {open [file join $::in_dir $fn] r} ch] {
puts stderr "Could not open definition file '$fn'."
exit $::IO_ERROR
}
@@ -964,17 +965,15 @@ proc fickle_main {} {
set file_state "subroutines"
break
} elseif {[lindex $line 0] == "#include"} {
- set dir [file dirname $::in_filename]
set fn [lindex $line 1]
if {$fn != {}} {
- if [catch {open [file join $dir $fn] r} ch] {
+ if [catch {open [file join $::in_dir $fn] r} ch] {
puts stderr "Could not open include file '$fn'."
exit $::IO_ERROR
}
while {[gets $ch line] >= 0} {
incr ::line_count
- append rules_buf "\n" \
- [strip_only_comments $line]
+ append rules_buf "\n" [strip_only_comments $line]
}
catch {close $fn}
}