comparison GEMBASSY-1.0.3/gsoap/src/soapcpp2.h @ 0:8300eb051bea draft

Initial upload
author ktnyt
date Fri, 26 Jun 2015 05:19:29 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:8300eb051bea
1 /*
2 soapcpp2.h
3
4 Common declarations.
5
6 --------------------------------------------------------------------------------
7 gSOAP XML Web services tools
8 Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc. All Rights Reserved.
9 This part of the software is released under one of the following licenses:
10 GPL or Genivia's license for commercial use.
11 --------------------------------------------------------------------------------
12 GPL license.
13
14 This program is free software; you can redistribute it and/or modify it under
15 the terms of the GNU General Public License as published by the Free Software
16 Foundation; either version 2 of the License, or (at your option) any later
17 version.
18
19 This program is distributed in the hope that it will be useful, but WITHOUT ANY
20 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 PARTICULAR PURPOSE. See the GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License along with
24 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
25 Place, Suite 330, Boston, MA 02111-1307 USA
26
27 Author contact information:
28 engelen@genivia.com / engelen@acm.org
29
30 This program is released under the GPL with the additional exemption that
31 compiling, linking, and/or using OpenSSL is allowed.
32 --------------------------------------------------------------------------------
33 A commercial use license is available from Genivia, Inc., contact@genivia.com
34 --------------------------------------------------------------------------------
35 */
36
37 #include <stdio.h>
38 #include <stdlib.h>
39 #include <errno.h>
40 #include <string.h>
41 #include <ctype.h>
42 #include <time.h>
43 #include "error2.h"
44
45 #ifndef VERSION
46 # define VERSION "2.8.17r" /* Current version */
47 # define GSOAP_VERSION 20817
48 #endif
49
50 #ifdef WIN32
51 # pragma warning(disable : 4996)
52 # ifndef WITH_BISON
53 # define WITH_BISON
54 # endif
55 #endif
56
57 /* #define DEBUG */ /* uncomment to debug */
58
59 #ifdef DEBUG
60 # define check(expr, msg) (void)((expr) ? 0 : (progerror(msg, __FILE__, __LINE__), 0))
61 # define DBGLOG(DBGCMD) { DBGCMD; }
62 #else
63 # define check(expr, msg) (void)(expr)
64 # define DBGLOG(DBGCMD)
65 #endif
66
67 #ifdef WIN32
68 # ifdef WITH_BISON
69 # ifdef WIN32_WITHOUT_SOLARIS_FLEX
70 # define yyparse soapcpp2parse
71 # define yylex soapcpp2lex
72 # define yyerror soapcpp2error
73 # define yylval soapcpp2lval
74 # define yychar soapcpp2char
75 # define yydebug soapcpp2debug
76 # define yynerrs soapcpp2nerrs
77 # define yylineno soapcpp2lineno
78 # define yytext soapcpp2text
79 # define yyin soapcpp2in
80 # define yywrap soapcpp2wrap
81 # endif
82 # endif
83 #endif
84
85 #ifdef WIN32
86 # define SOAP_PATHCAT "\\"
87 # define SOAP_PATHSEP ";"
88 # define LONG64 __int64
89 #else
90 # define SOAP_PATHCAT "/"
91 # define SOAP_PATHSEP ":"
92 # define LONG64 long long
93 #endif
94
95 #if defined(WIN32)
96 # define SOAP_LONG_FORMAT "%I64d"
97 # define SOAP_ULONG_FORMAT "%I64u"
98 # define SOAP_XLONG_FORMAT "%I64x"
99 #elif defined(TRU64)
100 # define SOAP_LONG_FORMAT "%ld"
101 # define SOAP_ULONG_FORMAT "%lu"
102 # define SOAP_XLONG_FORMAT "%lx"
103 #endif
104
105 #ifndef SOAP_LONG_FORMAT
106 # define SOAP_LONG_FORMAT "%lld" /* printf format for 64 bit ints */
107 #endif
108 #ifndef SOAP_ULONG_FORMAT
109 # define SOAP_ULONG_FORMAT "%llu" /* printf format for unsigned 64 bit ints */
110 #endif
111 #ifndef SOAP_XLONG_FORMAT
112 # define SOAP_XLONG_FORMAT "%llx" /* printf format for unsigned 64 bit hex ints */
113 #endif
114
115 extern int yylineno;
116
117 typedef enum Bool {False, True} Bool;
118
119 typedef int Token;
120
121 typedef enum Type
122 { Tnone,
123 Tvoid, /* primitive types */
124 Tchar,
125 Twchar,
126 Tshort,
127 Tint,
128 Tlong,
129 Tllong,
130 Tfloat,
131 Tdouble,
132 Tldouble,
133 Tuchar,
134 Tushort,
135 Tuint,
136 Tulong,
137 Tullong,
138 Ttime,
139 Tenum,
140 Tclass, /* compound types */
141 Tstruct,
142 Tunion,
143 Tpointer,
144 Treference,
145 Tarray,
146 Ttemplate,
147 Tfun
148 } Type;
149
150 #define TYPES (Tfun+1) /* number of type (operators) enumerated above */
151
152 typedef enum Storage
153 { Snone = 0,
154 Sauto = 0x000001,
155 Sregister = 0x000002,
156 Sstatic = 0x000004,
157 Sextern = 0x000008,
158 Stypedef = 0x000010,
159 Svirtual = 0x000020,
160 Sconst = 0x000040,
161 Sconstobj = 0x000080,
162 Sconstptr = 0x000100,
163 Sfriend = 0x000200,
164 Sinline = 0x000400,
165 Sabstract = 0x000800,
166 SmustUnderstand = 0x001000,
167 Sreturn = 0x002000,
168 Sattribute = 0x004000,
169 Sspecial = 0x008000,
170 Sexplicit = 0x010000,
171 Sprivate = 0x020000,
172 Sprotected = 0x040000
173 } Storage;
174
175 typedef enum Level { INTERNAL, GLOBAL, PARAM, LOCAL } Level;
176
177 #define mknone() mktype(Tnone, NULL, 0)
178 #define mkvoid() mktype(Tvoid, NULL, 0)
179 #define mkbool() mktype(Tenum, booltable, 4)
180 #define mkchar() mktype(Tchar, NULL, 1)
181 #define mkwchart() mktype(Twchar, NULL, 4)
182 #define mkshort() mktype(Tshort, NULL, 2)
183 #define mkint() mktype(Tint, NULL, 4)
184 #define mklong() mktype(Tlong, NULL, 8)
185 #define mkllong() mktype(Tllong, NULL, 8)
186 #define mkfloat() mktype(Tfloat, NULL, 4)
187 #define mkdouble() mktype(Tdouble, NULL, 8)
188 #define mkldouble() mktype(Tldouble, NULL, 16) /* long double */
189 #define mkuchar() mktype(Tuchar, NULL, 1) /* unsigned char */
190 #define mkushort() mktype(Tushort, NULL, 2) /* unsigned short */
191 #define mkuint() mktype(Tuint, NULL, 4) /* unsigned int */
192 #define mkulong() mktype(Tulong, NULL, 8) /* unsigned long */
193 #define mkullong() mktype(Tullong, NULL, 8) /* unsigned long */
194 #define mktimet() mktype(Ttime, NULL, 4)
195 #define mkenum(t) mktype(Tenum, t, 4)
196 #define mkmask(t) mktype(Tenum, t, 8)
197 #define mkpointer(t) mktype(Tpointer, t, 4)
198 #define mkreference(t) mktype(Treference,t, 4)
199 #define mkclass(t, w) mktype(Tclass, t, w)
200 #define mkstruct(t, w) mktype(Tstruct, t, w)
201 #define mkunion(t, w) mktype(Tunion, t, w)
202 #define mkarray(t, w) mktype(Tarray, t, w)
203 #define mkfun(t) mktype(Tfun, t, 0)
204 #define mkstring() mkpointer(mkchar())
205
206 #define MINLONG64 (0x8000000000000000LL)
207 #define MAXLONG64 (0x7FFFFFFFFFFFFFFFLL)
208
209 typedef struct Symbol
210 { char *name;
211 Token token;
212 struct Symbol *next;
213 } Symbol;
214
215 Symbol *install(const char*, Token), *lookup(const char*), *gensym(const char*), *gensymidx(const char*, int);
216
217 typedef struct Tnode
218 { Type type;
219 void *ref;
220 Symbol *id; /* struct/class/union/enum name */
221 Symbol *base; /* base class name */
222 Symbol *sym; /* typedef name */
223 struct Entry *response; /* funcs only: points to response struct */
224 int width;
225 int transient;
226 const char *imported;
227 struct Tnode *next;
228 Bool generated;
229 Bool classed; /* class qualified */
230 Bool wsdl;
231 int num;
232 char *pattern;
233 LONG64 minLength;
234 LONG64 maxLength;
235 } Tnode;
236
237 typedef union Value {
238 LONG64 i;
239 double r;
240 const char *s;
241 } Value;
242
243 typedef struct IDinfo {
244 Tnode *typ;
245 Storage sto;
246 Bool hasval; /* if true, identifier is constant */
247 Value val; /* ... with this value */
248 int offset;
249 LONG64 minOccurs;
250 LONG64 maxOccurs;
251 } IDinfo;
252
253 typedef struct Entry {
254 Symbol *sym;
255 char *tag;
256 IDinfo info;
257 Level level;
258 int lineno;
259 struct Entry *next;
260 } Entry;
261
262 typedef struct Table {
263 Symbol *sym;
264 Level level;
265 Entry *list;
266 struct Table *prev;
267 } Table;
268
269 typedef struct FNinfo {
270 Tnode *ret;
271 Table *args;
272 } FNinfo;
273
274 typedef struct Node {
275 Tnode *typ;
276 Storage sto;
277 Bool hasval; /* if true, this node has a constant value */
278 Value val; /* ... this is the value */
279 LONG64 minOccurs;
280 LONG64 maxOccurs;
281 char *pattern;
282 LONG64 minLength;
283 LONG64 maxLength;
284 } Node;
285
286 #define ACTION 0x0000
287 #define REQUEST_ACTION 0x0001
288 #define RESPONSE_ACTION 0x0002
289 #define FAULT_ACTION 0x0004
290 #define HDRIN 0x0010
291 #define HDROUT 0x0020
292 #define MIMEIN 0x0040
293 #define MIMEOUT 0x0080
294 #define COMMENT 0x0100
295 #define ENCODING 0x0200
296 #define RESPONSE_ENCODING 0x0400
297 #define STYLE 0x0800
298 #define FAULT 0x1000
299 #define PROTOCOL 0x2000
300
301 typedef struct Data
302 { struct Data *next;
303 char *name;
304 char *text;
305 } Data;
306
307 typedef struct Method
308 { struct Method *next;
309 char *name;
310 short mess; /* see #defines above */
311 char *part;
312 } Method;
313
314 typedef struct Service
315 { struct Service *next;
316 char *ns;
317 char *name;
318 char *porttype;
319 char *portname;
320 char *binding;
321 char *definitions;
322 char *transport;
323 char *URL;
324 char *executable;
325 char *import;
326 char *URI;
327 char *URI2;
328 char *WSDL;
329 char *style;
330 char *encoding;
331 char *protocol;
332 int xsi_type;
333 char *elementForm;
334 char *attributeForm;
335 char *documentation;
336 struct Method *list;
337 struct Data *data;
338 } Service;
339
340 typedef struct Pragma
341 { struct Pragma *next;
342 char *pragma;
343 } Pragma;
344
345 extern Entry *enter(Table*, Symbol*), *entry(Table*, Symbol*), *reenter(Table*, Symbol*), *enumentry(Symbol*);
346
347 extern int merge(Table*, Table*);
348
349 extern Table *mktable(Table*);
350
351 extern Tnode *mkmethod(Tnode*, Table*);
352
353 extern char *emalloc(size_t);
354
355 extern Tnode *mktype(Type, void*, int);
356 extern Tnode *mksymtype(Tnode*, Symbol*);
357 extern Tnode *mktemplate(Tnode*, Symbol*);
358
359 extern int is_transient(Tnode*);
360 extern int is_response(Tnode*);
361
362 extern Table *typetable, *enumtable, *classtable, *booltable, *templatetable;
363
364 extern void compile(Table*);
365 extern void freetable(Table*);
366 extern Entry *unlinklast(Table*);
367
368 extern FILE *fmsg;
369
370 extern int aflag;
371 extern int Aflag;
372 extern int bflag;
373 extern int vflag;
374 extern int wflag;
375 extern int cflag;
376 extern int Cflag;
377 extern int eflag;
378 extern unsigned long fflag;
379 extern int iflag;
380 extern int jflag;
381 extern int kflag;
382 extern int mflag;
383 extern int nflag;
384 extern int nflag;
385 extern int lflag;
386 extern int Lflag;
387 extern int Qflag;
388 extern int sflag;
389 extern int Sflag;
390 extern int Tflag;
391 extern int tflag;
392 extern int uflag;
393 extern int xflag;
394 extern int yflag;
395 extern int zflag;
396 extern char dirpath[1024];
397 extern char filename[1024];
398 extern char *prefix;
399 extern char *importpath;
400 extern int custom_header;
401 extern int custom_fault;
402 extern Pragma *pragmas;
403 extern Service *services;
404 extern char *namespaceid;
405 extern int transient;
406 extern int imports;
407 extern char *imported;
408 extern int typeNO;
409
410 extern char *envURI;
411 extern char *encURI;
412 extern char *rpcURI;
413 extern char *xsiURI;
414 extern char *xsdURI;