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