"#!/usr/local/bin/wish -f\n" "###############################################################################\n" "#\n" "# CREATED: 7-24-98\n" "# OWNER : Xavier Plasencia\n" "# ORG: SDSU\n" "# DESC: Allows the programmer to set the memory location of the timer\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= 0x10021 IRQ = 0x5\")\n" "# - All device scripts should be modal dialogs\n" "###############################################################################\n" "# $Id: $\n" "###############################################################################\n" "proc DeviceSetupGetValues {} {\n" " set base [.device.inputs.entry.address get]\n" " set irq [.device.inputs.entry.interrupt get]\n" " set result \"BaseAddress = $base IRQ = $irq\"\n" " return \"$result\"\n" "}\n" "proc DeviceSetupCheckValues {} {\n" " set base [.device.inputs.entry.address get]\n" " set irq [.device.inputs.entry.interrupt get]\n" " if {[regexp {^[0-9A-Fa-f]+$} $base] && [regexp {^[57]$} $irq]} {\n" " destroy .device \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 \"Timer Setup\"\n" " wm iconname .device \"Timer Setup\"\n" " message .device.message -width 4.25i -justify left \ -text \"This device is modeled after the digital timer feature of the M68230 PI/T.\\n\\nPlease enter the base address of the timer as well as its interrupt level. Common values are 10021 for the base address and 5 or 7 for the interrupt level:\"\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.interrupt -text \"Interrupt Level:\"\n" " pack .device.inputs.label.address -side top \n" " pack .device.inputs.label.interrupt -side top \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.interrupt }\n" " entry .device.inputs.entry.interrupt -width 10 -relief sunken\n" " bind .device.inputs.entry.interrupt \ { focus .device.inputs.entry.address }\n" " pack .device.inputs.entry.address -side top -fill x -expand 1 -pady 2\n" " pack .device.inputs.entry.interrupt -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"