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