1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.13 1997-11-19 11:22:10 adam
8 # Object identifiers can be accessed in GRS-1 records.
10 # Revision 1.12 1996/04/12 13:45:50 adam
13 # Revision 1.11 1996/03/29 16:05:37 adam
14 # Bug fix: GRS records wasn't recognized.
16 # Revision 1.10 1996/01/23 15:24:24 adam
17 # Wrore more comments.
19 # Revision 1.9 1995/10/17 14:18:10 adam
20 # Minor changes in presentation formats.
22 # Revision 1.8 1995/10/17 10:58:09 adam
23 # More work on presentation formats.
25 # Revision 1.7 1995/10/12 14:46:58 adam
26 # The record position in the raw format is much more visible.
28 # Revision 1.6 1995/09/20 11:37:07 adam
31 # Revision 1.5 1995/08/28 12:22:09 adam
32 # Use 'line' instead of 'list' in MARC extraction.
34 # Revision 1.4 1995/06/22 13:16:29 adam
35 # Feature: SUTRS. Setting getSutrs implemented.
36 # Work on display formats.
38 # Revision 1.3 1995/06/14 12:16:42 adam
39 # Minor presentation format changes.
41 # Revision 1.2 1995/06/12 15:18:10 adam
42 # Work on presentation formats. These are used in the main window as well
46 proc display-grs-raw {w r i} {
48 for {set j 0} {$j < $i} {incr j} {
49 insertWithTags $w " " {}
51 insertWithTags $w "([lindex $e 0],[lindex $e 2])" marc-tag
52 if {[lindex $e 3] == "string"} {
53 insertWithTags $w [lindex $e 4] {}
54 insertWithTags $w "\n" {}
55 } elseif {[lindex $e 3] == "subtree"} {
56 insertWithTags $w "\n" {}
57 display-grs-raw $w [lindex $e 4] [expr $i+1]
59 insertWithTags $w [lindex $e 4] {}
60 insertWithTags $w "\n" {}
65 # Procedure display-raw {sno no w flag}
66 # sno result set number (integer)
67 # no record position (integer)
68 # w text widget in which the record should be displayed.
69 # hflag header flag. If true a header showing the record position
70 # should be displayed.
71 # This procedure attempts to display records in a raw format.
72 proc display-raw {sno no w hflag} {
74 insertWithTags $w " $no " marc-head
75 insertWithTags $w "\n"
79 set type [z39.$sno type $no]
81 set err [lindex [z39.$sno diag $no] 1]
82 set add [lindex [z39.$sno diag $no] 2]
86 insertWithTags $w "Error ${err}${add}\n" marc-id
92 set rtype [z39.$sno recordType $no]
93 if {$rtype == "SUTRS"} {
94 insertWithTags $w [join [z39.$sno getSutrs $no]] {}
98 if {$rtype == "GRS-1"} {
99 display-grs-raw $w [z39.$sno getGrs $no] 0
102 if {[catch {set r [z39.$sno getMarc $no line * * *]}]} {
103 insertWithTags $w "Unknown record type: $rtype\n" marc-id
107 set tag [lindex $line 0]
108 set indicator [lindex $line 1]
109 set fields [lindex $line 2]
111 if {$indicator != ""} {
112 insertWithTags $w "$tag $indicator" marc-tag
114 insertWithTags $w "$tag " marc-tag
116 foreach field $fields {
117 set id [lindex $field 0]
118 set data [lindex $field 1]
120 insertWithTags $w " $id " marc-id
122 insertWithTags $w $data {}