Implemented preferredRecordSyntax.
[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.10  1995-06-16 12:28:20  adam
9  * Implemented preferredRecordSyntax.
10  * Minor changes in diagnostic handling.
11  * Record list deleted when connection closes.
12  *
13  * Revision 1.9  1995/06/14  15:08:01  adam
14  * Bug fix in cascade-target-list. Uses yaz-version.h.
15  *
16  * Revision 1.8  1995/06/14  13:37:18  adam
17  * Setting recordType implemented.
18  * Setting implementationVersion implemented.
19  * Settings implementationId / implementationName edited.
20  *
21  * Revision 1.7  1995/06/01  07:31:28  adam
22  * Rename of many typedefs -> IrTcl_...
23  *
24  * Revision 1.6  1995/05/31  08:36:40  adam
25  * Bug fix in client.tcl: didn't save options on clientrc.tcl.
26  * New method: referenceId. More work on scan.
27  *
28  * Revision 1.5  1995/05/29  08:44:25  adam
29  * Work on delete of objects.
30  *
31  * Revision 1.4  1995/05/26  11:44:10  adam
32  * Bugs fixed. More work on MARC utilities and queries. Test
33  * client is up-to-date again.
34  *
35  * Revision 1.3  1995/05/26  08:54:17  adam
36  * New MARC utilities. Uses prefix query.
37  *
38  * Revision 1.2  1995/05/24  14:10:23  adam
39  * Work on idAuthentication, protocolVersion and options.
40  *
41  * Revision 1.1  1995/05/23  15:34:49  adam
42  * Many new settings, userInformationField, smallSetUpperBound, etc.
43  * A number of settings are inherited when ir-set is executed.
44  * This version is incompatible with the graphical test client (client.tcl).
45  *
46  */
47
48 #ifndef IR_TCLP_H
49 #define IR_TCLP_H
50
51 #include <tcl.h>
52
53 #include <log.h>
54 #include <pquery.h>
55 #if CCL2RPN
56 #include <yaz-ccl.h>
57 #endif
58
59 #include <comstack.h>
60 #include <tcpip.h>
61
62 #if MOSI
63 #include <xmosi.h>
64 #endif
65
66 #include <yaz-version.h>
67 #include <odr.h>
68 #include <proto.h>
69 #include <oid.h>
70 #include <diagbib1.h>
71
72 #include "ir-tcl.h"
73
74 typedef struct {
75     char      **databaseNames;
76     int         num_databaseNames;
77     char       *queryType;
78     enum oid_value *preferredRecordSyntax;
79     int         replaceIndicator;
80     char       *referenceId;
81
82     int         smallSetUpperBound;
83     int         largeSetLowerBound;
84     int         mediumSetPresentNumber;
85 } IrTcl_SetCObj;
86     
87 typedef struct {
88     int         ref_count;
89
90     char       *cs_type;
91     int         protocol_type;
92     int         connectFlag;
93     COMSTACK    cs_link;
94
95     int         preferredMessageSize;
96     int         maximumRecordSize;
97     Odr_bitmask options;
98     Odr_bitmask protocolVersion;
99
100     char       *idAuthenticationOpen;
101     char       *idAuthenticationGroupId;
102     char       *idAuthenticationUserId;
103     char       *idAuthenticationPassword;
104
105     char       *implementationName;
106     char       *implementationId;
107     char       *implementationVersion;
108     int        initResult;
109     char       *targetImplementationName;
110     char       *targetImplementationId;
111     char       *targetImplementationVersion;
112     char       *userInformationField;
113
114     char       *hostname;
115    
116     char       *buf_out;
117     int         len_out;
118     char       *buf_in;
119     int         len_in;
120     char       *sbuf;
121     int         slen;
122     ODR         odr_in;
123     ODR         odr_out;
124     ODR         odr_pr;
125
126     Tcl_Interp *interp;
127     char       *callback;
128     char       *failback;
129
130 #if CCL2RPN
131     CCL_bibset  bibset;
132 #endif
133
134     struct IrTcl_SetObj_ *set_child;
135     struct IrTcl_ScanObj_ *scan_child;
136
137     IrTcl_SetCObj   set_inher;
138 } IrTcl_Obj;
139
140 typedef struct {
141     int condition;
142     char *addinfo;
143 } IrTcl_Diagnostic;
144
145 typedef struct IrTcl_RecordList_ {
146     int no;
147     int which;
148     union {
149         struct {
150             char *buf;
151             size_t size;
152             enum oid_value type;
153         } dbrec;
154         struct {
155             int num;
156             IrTcl_Diagnostic *list;
157         } surrogateDiagnostics;
158     } u;
159     struct IrTcl_RecordList_ *next;
160 } IrTcl_RecordList;
161
162 typedef struct IrTcl_SetObj_ {
163     IrTcl_Obj  *parent;
164     int         searchStatus;
165     int         presentStatus;
166     int         resultCount;
167     int         nextResultSetPosition;
168     int         start;
169     int         number;
170     int         numberOfRecordsReturned;
171     char       *setName;
172     int         recordFlag;
173     int         which;
174     int         nonSurrogateDiagnosticNum;
175     IrTcl_Diagnostic *nonSurrogateDiagnosticList;
176     IrTcl_RecordList *record_list;
177     IrTcl_SetCObj set_inher;
178 } IrTcl_SetObj;
179
180 typedef struct IrTcl_ScanEntry_ {
181     int         which;
182     union {
183         struct {
184             char *buf;
185             int  globalOccurrences;
186         } term;
187         struct {
188             IrTcl_Diagnostic *list;
189             int num;
190         } diag;
191     } u;
192 } IrTcl_ScanEntry;
193
194 typedef struct IrTcl_ScanObj_ {
195     IrTcl_Obj   *parent;
196     int         stepSize;
197     int         numberOfTermsRequested;
198     int         preferredPositionInResponse;
199
200     int         scanStatus;
201     int         numberOfEntriesReturned;
202     int         positionOfTerm;
203
204     int         entries_flag;
205     int         which;
206
207     int         num_entries;
208     int         num_diagRecs;
209
210     IrTcl_ScanEntry *entries;
211     IrTcl_Diagnostic  *nonSurrogateDiagnosticList;
212     int         nonSurrogateDiagnosticNum;
213 } IrTcl_ScanObj;
214
215 struct ir_named_entry {
216     char *name;
217     int  pos;
218 };
219
220 int ir_tcl_get_marc (Tcl_Interp *interp, const char *buf,
221                      int argc, char **argv);
222 char *ir_tcl_fread_marc (FILE *inf, size_t *size);
223 #endif