error on unknown command

commit 48a2e4c57dd605fed5ea8d88aac0d7d535d0fce9
Author: James Cherry <cherry@parallaxsw.com>
Date:   Tue Nov 15 08:36:03 2022 -0700

    error on unknown commands

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 18a2174a76043620827002a5e1d8c2e6a40c8c9b
Author: James Cherry <cherry@parallaxsw.com>
Date:   Mon Nov 14 20:17:15 2022 -0700

    do not rename unknown

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 1aa65285049e97a0a8c64273baa44754f28cbd16
Author: James Cherry <cherry@parallaxsw.com>
Date:   Mon Nov 14 20:06:27 2022 -0700

    typo

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit a9abd197b9751737918883c389860f5ced79b62a
Author: James Cherry <cherry@parallaxsw.com>
Date:   Mon Nov 14 19:36:50 2022 -0700

    init cleanup

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2022-11-15 15:35:17 -07:00
parent d71b59be60
commit 48d6e00419
5 changed files with 42 additions and 56 deletions

View File

@ -181,7 +181,7 @@ initStaApp(int &argc,
Sta_Init(interp);
// Eval encoded sta TCL sources.
evalTclInit(interp, tcl_inits);
Tcl_Eval(interp, "init_sta");
Tcl_Eval(interp, "init_sta_cmds");
}
static void

View File

@ -14,11 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
proc init_sta {} {
proc init_sta_cmds {} {
global auto_index
# Import exported commands from sta namespace to global namespace.
sta::define_sta_cmds
namespace import sta::*
if { [info exists tclreadline::version] } {

View File

@ -39,6 +39,15 @@ proc_redirect read_sdc {
################################################################
# The builtin Tcl "source" command is redefined by sta.
# This rename provides a mechanism to refer to the original TCL
# command.
# Protected so this file can be reloaded without blowing up.
if { ![info exists renamed_source] } {
rename source builtin_source
set renamed_source 1
}
set ::sta_continue_on_error 0
define_cmd_args "source" \

View File

@ -1086,23 +1086,6 @@ proc report_path_ends { path_ends } {
report_path_end_footer
}
proc define_report_path_fields {} {
variable report_path_field_width_extra
set_rise_fall_short_names "^" "v"
set_report_path_field_order { fanout capacitance slew \
incr total edge case description }
set_report_path_field_properties "description" "Description" 36 1
set width $report_path_field_width_extra
set_report_path_field_properties "total" "Time" $width 0
set_report_path_field_properties "incr" "Delay" $width 0
set_report_path_field_properties "capacitance" "Cap" $width 0
set_report_path_field_properties "slew" "Slew" $width 0
set_report_path_field_properties "fanout" "Fanout" 6 0
set_report_path_field_properties "edge" " " 1 0
set_report_path_field_properties "case" " " 11 0
}
################################################################
define_cmd_args "report_clock_min_period" \

View File

@ -395,50 +395,45 @@ proc check_percent { cmd_arg arg } {
################################################################
# The builtin Tcl "source" and "unknown" commands are redefined by sta.
# This rename provides a mechanism to refer to the original TCL
# command.
# Protected so this file can be reloaded without blowing up.
if { ![info exists renamed_source] } {
rename source builtin_source
rename unknown builtin_unknown
set renamed_source 1
}
# Numeric expressions eval to themselves so braces aren't required
# around bus names like foo[2] or foo[*].
# Bus signal names like foo[2] or bar[31:0] use brackets that
# look like "eval" to TCL. Catch the numeric "function" with the
# namespace's unknown handler and return the value instead of an error.
proc sta_unknown { args } {
global errorCode errorInfo
set name [lindex $args 0]
if { [llength $args] == 1 \
&& ([string is integer $name] || [string equal $name "*"]) } {
if { [llength $args] == 1 && [is_bus_subscript $args] } {
return "\[$args\]"
} else {
# Implement command name abbreviation from init.tcl/unknown.
# Remove restrictions in that version that prevent it from
# running in non-interactive interpreters.
set ret [catch {set cmds [info commands $name*]} msg]
if {[string equal $name "::"]} {
set name ""
}
# Command name abbreviation support.
set ret [catch {set cmds [info commands $name*]} msg]
if {[string equal $name "::"]} {
set name ""
}
if { $ret != 0 } {
return -code $ret -errorcode $errorCode \
"error in unknown while checking if \"$name\" is a unique command abbreviation: $msg"
}
if {$ret != 0} {
return -code $ret -errorcode $errorCode \
"error in unknown while checking if \"$name\" is a unique command abbreviation: $msg"
}
if {[llength $cmds] == 1} {
return [uplevel 1 [lreplace $args 0 0 $cmds]]
}
if {[llength $cmds]} {
if {[string equal $name ""]} {
return -code error "empty command name \"\""
} else {
return -code error \
"ambiguous command name \"$name\": [lsort $cmds]"
}
if { [llength $cmds] == 1 } {
return [uplevel 1 [lreplace $args 0 0 $cmds]]
}
if { [llength $cmds] > 1 } {
if {[string equal $name ""]} {
return -code error "empty command name \"\""
} else {
return -code error \
"ambiguous command name \"$name\": [lsort $cmds]"
}
}
::unknown {*}$args
}
proc is_bus_subscript { subscript } {
return [expr [string is integer $subscript] \
|| [string match $subscript "*"] \
|| [regexp {[0-9]+:[0-9]} $subscript]]
}
namespace unknown sta_unknown