1
0
Fork 0
This repository has been archived on 2019-12-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
arduinisten/arduino-0018-windows/hardware/tools/avr/share/insight1.0/editor.tcl

48 lines
1.5 KiB
Tcl
Raw Normal View History

2010-03-30 21:53:44 +02:00
# Editor
# Copyright (C) 2001 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License (GPL) as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# ----------------------------------------------------------------------
# Implements a set of editor commands
# ----------------------------------------------------------------------
namespace eval Editor {
namespace export edit
proc edit {loc_info} {
global external_editor_command
if {[info exists external_editor_command]} {
if {[catch {uplevel \#0 "$external_editor_command edit $loc_info"} \
err]} {
tk_dialog .warn-sn "Edit" $err error 0 Ok
}
return
}
lassign $loc_info baseName fnName fileName lineNum addr pc
set newCmd [pref get gdb/editor]
if {! [string compare $newCmd ""]} {
tk_dialog .warn "Edit" "No editor command specified" error 0 Ok
}
# Replace %s with file name and %d with line number.
regsub -all -- %s $newCmd $fileName newCmd
regsub -all -- %d $newCmd $lineNum newCmd
if {[catch "exec $newCmd &" err]} {
tk_dialog .warn "Edit" $err error 0 Ok
}
}
}