diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-03-03 22:28:39 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-03-03 22:28:39 (GMT) |
commit | a739df3afe46b9d61cf7e613cfdd48cd920fdba1 (patch) | |
tree | f54b7f692365da2e3ce869ff0ecc169a86485971 /fickle | |
parent | ba8061452f32fac6265da4cc8763d2f2a8f1bb43 (diff) | |
download | blt-a739df3afe46b9d61cf7e613cfdd48cd920fdba1.zip blt-a739df3afe46b9d61cf7e613cfdd48cd920fdba1.tar.gz blt-a739df3afe46b9d61cf7e613cfdd48cd920fdba1.tar.bz2 |
add defs include file
Diffstat (limited to 'fickle')
-rw-r--r-- | fickle/fickle.tcl | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/fickle/fickle.tcl b/fickle/fickle.tcl index a0454b0..9af8479 100644 --- a/fickle/fickle.tcl +++ b/fickle/fickle.tcl @@ -926,8 +926,35 @@ proc fickle_main {} { fickle_error "Syntax error." $::SYNTAX_ERROR } } else { - if {$file_state == "definitions"} { - handle_defs $line + 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] { + puts stderr "Could not open tab file '$fn'." + exit $::IO_ERROR + } + catch {set ::tab [read $ch]} + catch {close $fn} + } + } 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] { + puts stderr "Could not open definition file '$fn'." + exit $::IO_ERROR + } + while {[gets $ch line] >= 0} { + incr ::line_count + handle_defs $line + } + catch {close $fn} + } + } else { + handle_defs $line + } } elseif {$file_state == "rules"} { # keep reading the rest of the file until EOF or # another '%%' appears @@ -936,17 +963,6 @@ proc fickle_main {} { if {$line == "%%"} { set file_state "subroutines" break - } elseif {[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] { - puts stderr "Could not open tab file '$fn'." - exit $::IO_ERROR - } - catch {set ::tab [read $ch]} - catch {close $fn} - } } elseif {[lindex $line 0] == "#include"} { set dir [file dirname $::in_filename] set fn [lindex $line 1] |