~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Open Mash Cross Reference
mash/tcl/common/smash-compat.tcl

Component: ~ [ mash ] ~ [ apps ] ~ [ gsm ] ~ [ lib ] ~ [ otcl ] ~ [ srm ] ~ [ tcl8.3 ] ~ [ tclcl ] ~ [ tk8.3 ] ~ [ tutorials ] ~

  1 # smash-compat.tcl --
  2 #
  3 #       Provide a Tk-compatible "option" command for tcl/smash
  4 #       applications.
  5 #
  6 # Copyright (c) 1997-2002 The Regents of the University of California.
  7 # All rights reserved.
  8 #
  9 # Redistribution and use in source and binary forms, with or without
 10 # modification, are permitted provided that the following conditions are met:
 11 #
 12 # A. Redistributions of source code must retain the above copyright notice,
 13 #    this list of conditions and the following disclaimer.
 14 # B. Redistributions in binary form must reproduce the above copyright notice,
 15 #    this list of conditions and the following disclaimer in the documentation
 16 #    and/or other materials provided with the distribution.
 17 # C. Neither the names of the copyright holders nor the names of its
 18 #    contributors may be used to endorse or promote products derived from this
 19 #    software without specific prior written permission.
 20 #
 21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 22 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 23 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 24 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
 25 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 26 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 27 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 28 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 29 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 31 #
 32 # @(#) $Header: /usr/mash/src/repository/mash/mash-1/tcl/common/smash-compat.tcl,v 1.5 2002/02/07 00:22:36 weitsang Exp $
 33 
 34 proc option args {
 35         global _db
 36         if { [lindex $args 0] == "add" } {
 37                 set o [split [lindex $args 1] .]
 38                 set cls [lindex $o 0]
 39                 set resource [lindex $o 1]
 40                 set value [lindex $args 2]
 41                 set pri [lindex $args 3]
 42                 if { $pri == "" } {
 43                         set pri 80
 44                 }
 45                 if [info exists _db($cls,$resource,pri)] {
 46                         set oldpri $_db($cls,$resource,pri)
 47                 } else {
 48                         set oldpri -1
 49                 }
 50                 if { $oldpri > $pri } {
 51                         return
 52                 }
 53                 set _db($cls,$resource,val) $value
 54                 set _db($cls,$resource,pri) $pri
 55         } elseif { [lindex $args 0] == "get" } {
 56                 set resource [lindex $args 2]
 57                 set cls [lindex $args 3]
 58                 if [info exists _db($cls,$resource,val)] {
 59                         return $_db($cls,$resource,val)
 60                 } else {
 61                         return ""
 62                 }
 63         } elseif { [lindex $args 0] == "clear" } {
 64                 unset _db
 65         }
 66 }
 67 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.