"#!/usr/local/bin/wish -f\n"
"###############################################################################\n"
"# Gdbsock.tcl\n"
"# Adapted from RAM.tcl\n"
"#\n"
"# (c) DJ, July 1996\n"
"#\n"
"# Only need base address and port number\n"
"#\n"
"# * USUAL DISCLAIMER... NO WARRANTY FOR ANY PURPOSE *\n"
"###############################################################################\n"
"# $Id:$\n"
"###############################################################################\n"
"proc DeviceSetupGetValues {} {\n"
"  set base [.device.inputs.entry.address get]\n"
"  set port [.device.inputs.entry.port get]\n"
"  set result \"BaseAddress = $base PortNumber = $port\"\n"
"  return \"$result\"\n"
"}\n"
"proc DeviceSetupCheckValues {} {\n"
"  set base [.device.inputs.entry.address get]\n"
"  set port [.device.inputs.entry.port get]\n"
"  if {[regexp {^[0-9A-Fa-f]+$} $base] && [regexp {^[0-9]+$} $port]} {\n"
"    destroy .device \n"
"  } else {\n"
"    \n"
"  }\n"
"}\n"
"###############################################################################\n"
"# This is the procedure the User Interface calls\n"
"###############################################################################\n"
"proc DeviceSetup {} {\n"
"  global DeviceSetupReturnValue\n"
"  catch {destroy .device}\n"
" \n"
"  toplevel .device\n"
"  wm title .device \"GDB Socket Setup\"\n"
"  wm iconname .device \"GDB Socket Setup\"\n"
"  message .device.message \
    -text \"Please enter the base address and port for GDB socket.\\n\\nAddress in hexadecimal\\n\\nPort in decimal!\" \
    -width 3i -justify left\n"
"  frame .device.inputs -relief ridge -borderwidth 2\n"
"    frame .device.inputs.label\n"
"      label .device.inputs.label.address -text \"Base Address:\"\n"
"      label .device.inputs.label.port -text \"Port:\"\n"
"      pack .device.inputs.label.address -side top \n"
"      pack .device.inputs.label.port -side right\n"
"    frame .device.inputs.entry\n"
"      entry .device.inputs.entry.address -width 10 -relief sunken\n"
"      bind .device.inputs.entry.address \
          <Return> { focus .device.inputs.entry.port }\n"
"      entry .device.inputs.entry.port -width 10 -relief sunken\n"
"      bind .device.inputs.entry.port \
          <Return> { focus .device.inputs.entry.address }\n"
"      pack .device.inputs.entry.address -side top -fill x -expand 1 -pady 2\n"
"      pack .device.inputs.entry.port -side top -fill x -expand 1 -pady 2\n"
"    pack .device.inputs.label -side left \n"
"    pack .device.inputs.entry -side left -fill x -expand 1 -padx 2\n"
"  frame .device.buttons\n"
"    button .device.buttons.ok -text \"Okay\" \
      -command {set DeviceSetupReturnValue [DeviceSetupGetValues]\n"
"                DeviceSetupCheckValues}\n"
"    button .device.buttons.cancel -text \"Cancel\" \
      -command {set DeviceSetupReturnValue \"\"; destroy .device}\n"
"    pack .device.buttons.ok -side left -expand 1 -fill x -padx 4\n"
"    pack .device.buttons.cancel -side right -expand 1 -fill x -padx 4\n"
"  pack .device.message -side top -fill x -pady 4 -padx 4\n"
"  pack .device.inputs -side top -fill x -pady 2 -padx 4 -ipady 2\n"
"  pack .device.buttons -side top -fill x -pady 4\n"
"  # Set input focus to the first entry widget\n"
"  tkwait visibility .device\n"
"  focus .device.inputs.entry.address\n"
"  # Make this a modal dialog\n"
"  grab set .device\n"
"  tkwait window .device\n"
"  return $DeviceSetupReturnValue\n"
"}\n"
