New MARC utilities. Uses prefix query.
[ir-tcl-moved-to-github.git] / ir-tclp.h
1 /*
2  * IR toolkit for tcl/tk
3  * (c) Index Data 1995
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: ir-tclp.h,v $
7  * Revision 1.3  1995-05-26 08:54:17  adam
8  * New MARC utilities. Uses prefix query.
9  *
10  * Revision 1.2  1995/05/24  14:10:23  adam
11  * Work on idAuthentication, protocolVersion and options.
12  *
13  * Revision 1.1  1995/05/23  15:34:49  adam
14  * Many new settings, userInformationField, smallSetUpperBound, etc.
15  * A number of settings are inherited when ir-set is executed.
16  * This version is incompatible with the graphical test client (client.tcl).
17  *
18  */
19
20 #ifndef IR_TCLP_H
21 #define IR_TCLP_H
22
23 #include <tcl.h>
24
25 #include <pquery.h>
26 #if CCL2RPN
27 #include <yaz-ccl.h>
28 #endif
29 #if 0
30 #include <iso2709.h>
31 #endif
32
33 #include <comstack.h>
34 #include <tcpip.h>
35
36 #if MOSI
37 #include <xmosi.h>
38 #endif
39
40 #include <odr.h>
41 #include <proto.h>
42 #include <oid.h>
43 #include <diagbib1.h>
44
45 #include "ir-tcl.h"
46
47 typedef struct {
48     char      **databaseNames;
49     int         num_databaseNames;
50
51     char       *queryType;
52     int         replaceIndicator;
53
54     int         smallSetUpperBound;
55     int         largeSetLowerBound;
56     int         mediumSetPresentNumber;
57 } IRSetCObj;
58     
59 typedef struct {
60     char       *cs_type;
61     char       *protocol_type;
62     int         connectFlag;
63     COMSTACK    cs_link;
64
65     int         preferredMessageSize;
66     int         maximumRecordSize;
67     Odr_bitmask options;
68     Odr_bitmask protocolVersion;
69
70     char       *idAuthenticationOpen;
71     char       *idAuthenticationGroupId;
72     char       *idAuthenticationUserId;
73     char       *idAuthenticationPassword;
74
75     char       *implementationName;
76     char       *implementationId;
77     int        initResult;
78     char       *targetImplementationName;
79     char       *targetImplementationId;
80     char       *targetImplementationVersion;
81     char       *userInformationField;
82
83     char       *hostname;
84    
85     char       *buf_out;
86     int         len_out;
87     char       *buf_in;
88     int         len_in;
89     char       *sbuf;
90     int         slen;
91     ODR         odr_in;
92     ODR         odr_out;
93     ODR         odr_pr;
94
95     Tcl_Interp *interp;
96     char       *callback;
97     char       *failback;
98
99 #if CCL2RPN
100     CCL_bibset  bibset;
101 #endif
102
103     oident      bib1;
104
105     struct IRSetObj_ *set_child;
106     struct IRScanObj_ *scan_child;
107
108     IRSetCObj   set_inher;
109 } IRObj;
110
111 typedef struct IRRecordList_ {
112     int no;
113     int which;
114     union {
115         struct {
116             char *buf;
117             size_t size;
118         } dbrec;
119         struct {
120             int  condition;
121             char *addinfo;
122         } diag;
123     } u;
124     struct IRRecordList_ *next;
125 } IRRecordList;
126
127 typedef struct IRSetObj_ {
128     IRObj      *parent;
129     int         searchStatus;
130     int         resultCount;
131     int         start;
132     int         number;
133     int         numberOfRecordsReturned;
134     char       *setName;
135     int         recordFlag;
136     int         which;
137     int         condition;
138     char       *addinfo;
139     IRRecordList *record_list;
140     IRSetCObj   set_inher;
141 } IRSetObj;
142
143 typedef struct IRScanEntry_ {
144     int         which;
145     union {
146         struct {
147             char *buf;
148             int  globalOccurrences;
149         } term;
150         struct {
151             int  condition;
152             char *addinfo;
153         } diag;
154     } u;
155 } IRScanEntry;
156
157 typedef struct IRScanDiag_ {
158     int         dummy;
159 } IRScanDiag;
160
161 typedef struct IRScanObj_ {
162     IRObj      *parent;
163     int         stepSize;
164     int         numberOfTermsRequested;
165     int         preferredPositionInResponse;
166
167     int         scanStatus;
168     int         numberOfEntriesReturned;
169     int         positionOfTerm;
170
171     int         entries_flag;
172     int         which;
173
174     int         num_entries;
175     int         num_diagRecs;
176
177     IRScanEntry *entries;
178     IRScanDiag  *nonSurrogateDiagnostics;
179 } IRScanObj;
180
181 struct ir_named_entry {
182     char *name;
183     int  pos;
184 };
185
186 int ir_tcl_get_marc (Tcl_Interp *interp, const char *buf,
187                      int argc, char **argv);
188 char *ir_tcl_fread_marc (FILE *inf, size_t *size);
189 #endif