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