Added support for Tcl8.0/Tk8.0.
[ir-tcl-moved-to-github.git] / display.tcl
1 # $Id: display.tcl,v 1.3 1997-04-13 19:00:42 adam Exp $
2 #
3 # Record display
4 proc display {zset no} {
5     set type [$zset type $no]
6     if {$type == "SD"} {
7         set err [lindex [$zset diag $no] 1]
8         set add [lindex [$zset diag $no] 2]
9         if {$add != {}} {
10             set add " :${add}"
11         }
12         puts "Error ${err}${add}"
13         return
14     }
15     if {$type != "DB"} {
16         return
17     }
18     set rtype [$zset recordType $no]
19     if {$rtype == "SUTRS"} {
20         puts [join [$zset getSutrs $no]]
21         return
22     }
23     if {$rtype == "GRS-1"} {
24         set r [$zset getGrs $no]
25         puts $r
26         return
27     }
28     if {[catch {set r [$zset getMarc $no line * * *]}]} {
29         puts "Unknown record type: $rtype"
30         return
31     }
32     foreach line $r {
33         set tag [lindex $line 0]
34         set indicator [lindex $line 1]
35         set fields [lindex $line 2]
36         puts -nonewline "$tag "
37         if {$indicator != ""} {
38             puts -nonewline $indicator
39         }
40         foreach field $fields {
41             set id [lindex $field 0]
42             set data [lindex $field 1]
43             if {$id != ""} {
44                 puts -nonewline " \$$id "
45             }
46             puts -nonewline $data
47         }
48         puts ""
49     }
50 }
51