"#!/usr/local/bin/wish -f\n" "###############################################################################\n" "#\n" "# This Tcl script gets the setup information for the RAM device.\n" "#\n" "# Notes: - All Procedures and global variables begin with \"DeviceSetup\". This\n" "# should be true for all device scripts.\n" "# - The toplevel window should be .device for all device scripts.\n" "# - The script must return a valid argument for the device's\n" "# constructor. (i.e. \"BaseAddress=00000000 Size=00000000\")\n" "# - If the cancel button is pressed the empty string should be\n" "# returned\n" "# - All device scripts should be modal dialogs\n" "#\n" "# Copyright (c) 1993\n" "# By: Bradford W. Mott\n" "# October 30,1993\n" "#\n" "###############################################################################\n" "# $Id: RAM.tcl,v 1.1 1996/08/02 15:03:04 bwmott Exp $\n" "###############################################################################\n" "proc DeviceSetupGetValues {} {\n" " set base [.device.inputs.entry.address get]\n" " set size [.device.inputs.entry.size get]\n" " set result \"BaseAddress = $base Size = $size\"\n" " return \"$result\"\n" "}\n" "proc DeviceSetupCheckValues {} {\n" " set base [.device.inputs.entry.address get]\n" " set size [.device.inputs.entry.size get]\n" " if {[regexp {^[0-9A-Fa-f]+$} $base] && [regexp {^[0-9A-Fa-f]+$} $size]} {\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 \"RAM Setup\"\n" " wm iconname .device \"RAM Setup\"\n" " message .device.message \ -text \"Please enter the base address and size of the RAM.\\n\\nAll values are in hexadecimal!\" \ -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.size -text \"Size:\"\n" " pack .device.inputs.label.address -side top \n" " pack .device.inputs.label.size -side right\n" " frame .device.inputs.entry\n" " entry .device.inputs.entry.address -width 10 -relief sunken\n" " bind .device.inputs.entry.address \ { focus .device.inputs.entry.size }\n" " entry .device.inputs.entry.size -width 10 -relief sunken\n" " bind .device.inputs.entry.size \ { focus .device.inputs.entry.address }\n" " pack .device.inputs.entry.address -side top -fill x -expand 1 -pady 2\n" " pack .device.inputs.entry.size -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"