• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/tcl-102/tcl_ext/tcllib/tcllib/modules/struct/

Lines Matching defs:record

2 # ::struct::record --
9 # Each record definition is kept in a master array
10 # (_recorddefn) under the ::struct::record namespace. Each
11 # instance of a record is kept within a separate namespace
12 # for each record definition. Hence, instances of
13 # the same record definition are managed under the
24 # $Id: record.tcl,v 1.10 2004/09/29 20:56:18 andreas_kupries Exp $
32 namespace eval ::struct::record {
37 ## record
44 ## holds the count for each record
57 ## array that holds the defining record's
66 ## This holds the defaults for a record definition.
67 ## If no default is given for a member of a record,
85 namespace export record
90 # ::struct::record::record --
102 proc ::struct::record::record {cmd_ args} {
110 return [uplevel 1 ::struct::record::${cmd_} $args]
112 }; # end proc ::struct::record::record
117 # ::struct::record::Define --
119 # Used to define a record
122 # defn_ the name of the record definition
123 # vars_ the variables of the record (as a list)
131 proc ::struct::record::Define {defn_ vars_ args} {
152 ## Loop through the members of the record
164 ## 3 --> there is a nested record
174 if {![string match "record" "[lindex $V 0]"]} {
176 Delete record $defn_
177 error "$V is a Bad member for record definition
190 Delete record $defn_
195 ## Will take care of the nested record later
208 uplevel #0 [list interp alias {} $defn_ {} ::struct::record::Create $defn_]
212 namespace eval ::struct::record${defn_} {
225 uplevel 1 [list ::struct::record::Create $defn_ $A]
230 }; # end proc ::struct::record::Define
235 # ::struct::record::Create --
237 # Creates an instance of a record definition
240 # defn_ the name of the record definition
242 # args values to set to the record's members
248 proc ::struct::record::Create {defn_ inst_ args} {
259 ## test to see if the record
269 ## then assume that the record
292 ## Initialize record variables to
296 uplevel #0 [list interp alias {} ${inst_} {} ::struct::record::Cmd $inst_]
304 ## Test to see if there is a nested record
327 ## evaluate the nested record. If there
330 ## this nested record is a list
333 ## the nested record's instantiation.
353 uplevel #0 [list interp alias {} ${inst_}.$V {} ::struct::record::Access $defn_ $inst_ $V]
373 }; # end proc ::struct::record::Create
378 # ::struct::record::Access --
381 # from the aliases create for each variable in the record
384 # defn_ the name of the record to access
386 # var_ the variable of the record to access
390 # Returns the value of the record member (var_)
393 proc ::struct::record::Access {defn_ inst_ var_ args} {
401 error "$var_ does not exist in record $defn_"
425 }; # end proc ::struct::record::Access
430 # ::struct::record::Cmd --
435 # inst_ the record instance name
436 # args For 'get' this is the record members to
445 proc ::struct::record::Cmd {inst_ args} {
484 }; # end proc ::struct::record::Cmd
489 # ::struct::record::Ns --
501 proc ::struct::record::Ns {inst_} {
509 return [format "%s%s%s" "::struct::record" $ret "::"]
511 }; # end proc ::struct::record::Ns
516 # ::struct::record::Show --
518 # Display info about the record that exist
522 # record_ record or instance to process
525 # if what_ = record, then return list of records
528 # or members of the record.
530 # with record definition of record_
535 proc ::struct::record::Show {what_ {record_ ""}} {
546 if {[string match "record*" "$what_"]} {
551 error "Bad arguments while accessing members. Bad record name"
559 lappend res [list record $d $i]
573 if {![info exists ::struct::record${record_}::instances]} {
576 return [lsort [set ::struct::record${record_}::instances]]
593 set v [::struct::record::Show values ${record_}.${inst}]
604 }; # end proc ::struct::record::Show
609 # ::struct::record::Delete --
611 # Deletes a record instance or a record definition
614 # sub_ what to delete. Either 'instance' or 'record'
615 # item_ the specific record instance or definition
623 proc ::struct::record::Delete {sub_ item_} {
668 record -
674 ## record
684 namespace delete ::struct::record${item_}
699 }; # end proc ::struct::record::Delete
704 # ::struct::record::Exists --
706 # Tests whether a record definition or record
710 # sub_ what to test. Either 'instance' or 'record'
711 # item_ the specific record instance or definition
718 proc ::struct::record::Exists {sub_ item_} {
730 record {
740 error "Wrong arguments. Must be exists record|instance target"
744 }; # end proc ::struct::record::Exists
749 # ::struct::record::Qualify --
764 proc ::struct::record::Qualify {item_ {level_ 2}} {
778 }; # end proc ::struct::record::Qualify
784 # Get 'record::record' into the general structure namespace.
785 namespace import -force record::record
786 namespace export record
788 package provide struct::record 1.2.1