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