soapcpp2.h

00001 /*
00002 
00003 soapcpp2.h
00004 
00005 gSOAP XML Web services tools
00006 Copyright (C) 2000-2004, Robert van Engelen, Genivia, Inc. All Rights Reserved.
00007 
00008 --------------------------------------------------------------------------------
00009 gSOAP public license.
00010 
00011 The contents of this file are subject to the gSOAP Public License Version 1.3
00012 (the "License"); you may not use this file except in compliance with the
00013 License. You may obtain a copy of the License at
00014 http://www.cs.fsu.edu/~engelen/soaplicense.html
00015 Software distributed under the License is distributed on an "AS IS" basis,
00016 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00017 for the specific language governing rights and limitations under the License.
00018 
00019 The Initial Developer of the Original Code is Robert A. van Engelen.
00020 Copyright (C) 2000-2004 Robert A. van Engelen, Genivia inc. All Rights Reserved.
00021 --------------------------------------------------------------------------------
00022 GPL license.
00023 
00024 This program is free software; you can redistribute it and/or modify it under
00025 the terms of the GNU General Public License as published by the Free Software
00026 Foundation; either version 2 of the License, or (at your option) any later
00027 version.
00028 
00029 This program is distributed in the hope that it will be useful, but WITHOUT ANY
00030 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
00031 PARTICULAR PURPOSE. See the GNU General Public License for more details.
00032 
00033 You should have received a copy of the GNU General Public License along with
00034 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00035 Place, Suite 330, Boston, MA 02111-1307 USA
00036 
00037 Author contact information:
00038 engelen@genivia.com / engelen@acm.org
00039 --------------------------------------------------------------------------------
00040 */
00041 
00042 #include <stdio.h>
00043 #include <stdlib.h>
00044 #include <errno.h>
00045 #include <string.h>
00046 #include <ctype.h>
00047 #include <time.h>
00048 #include "error2.h"
00049 
00050 #ifndef VERSION
00051 #define VERSION "2.5.1" /* Current version */
00052 #endif
00053 
00054 #if defined(WIN32)
00055 #ifndef WITH_BISON
00056 #define WITH_BISON
00057 #endif
00058 #endif
00059 
00060 /* #define DEBUG */ /* uncomment to debug */
00061 
00062 #ifdef DEBUG
00063 #define check(expr, msg) ((expr) ? 1 : progerror(msg, __FILE__, __LINE__))
00064 #define DBGLOG(DBGCMD) { DBGCMD; }
00065 #else
00066 #define check(expr, msg) (expr, 1)
00067 #define DBGLOG(DBGCMD)
00068 #endif
00069 
00070 #ifdef WITH_BISON
00071 #ifdef WIN32_WITHOUT_SOLARIS_FLEX
00072 #define yyparse soapcpp2parse
00073 #define yylex soapcpp2lex
00074 #define yyerror soapcpp2error
00075 #define yylval soapcpp2lval
00076 #define yychar soapcpp2char
00077 #define yydebug soapcpp2debug
00078 #define yynerrs soapcpp2nerrs
00079 #define yylineno soapcpp2lineno
00080 #define yytext soapcpp2text
00081 #define yyin soapcpp2in
00082 #define yywrap soapcpp2wrap
00083 #endif
00084 #endif
00085 
00086 #ifdef WIN32
00087 #define LONG64 __int64
00088 #else
00089 #define LONG64 long long
00090 #endif
00091 
00092 #if defined(WIN32)
00093 #define SOAP_LONG_FORMAT "%I64d"
00094 #define SOAP_ULONG_FORMAT "%I64u"
00095 #elif defined(TRU64)
00096 #define SOAP_LONG_FORMAT "%ld"
00097 #define SOAP_ULONG_FORMAT "%lu"
00098 #endif
00099 
00100 #ifndef SOAP_LONG_FORMAT
00101 #define SOAP_LONG_FORMAT "%lld"         /* printf format for 64 bit ints */
00102 #endif
00103 #ifndef SOAP_ULONG_FORMAT
00104 #define SOAP_ULONG_FORMAT "%llu"        /* printf format for unsigned 64 bit ints */
00105 #endif
00106 
00107 extern int yylineno;
00108 
00109 typedef enum Bool {False, True} Bool;
00110 
00111 typedef int Token;
00112 
00113 typedef enum Type
00114 {       Tnone,
00115         Tvoid,          /* primitive types */
00116         Tchar,
00117         Twchar,
00118         Tshort,
00119         Tint,
00120         Tlong,
00121         Tllong,
00122         Tfloat,
00123         Tdouble,
00124         Tuchar,
00125         Tushort,
00126         Tuint,
00127         Tulong,
00128         Tullong,
00129         Tenum,
00130         Ttime,
00131         Tclass,         /* compound types */
00132         Tstruct,
00133         Tunion,
00134         Tpointer,
00135         Treference,
00136         Tarray,
00137         Ttemplate,
00138         Tfun
00139 } Type;
00140 
00141 #define TYPES (Tfun+1)  /* number of type (operators) enumerated above */
00142 
00143 typedef enum Storage
00144 {       Snone           = 0,
00145         Sauto           = 0x0001,
00146         Sregister       = 0x0002,
00147         Sstatic         = 0x0004,
00148         Sextern         = 0x0008,
00149         Stypedef        = 0x0010,
00150         Svirtual        = 0x0020,
00151         Sconst          = 0x0040,
00152         Sfriend         = 0x0080,
00153         Sinline         = 0x0100,
00154         Sconstobj       = 0x0200,
00155         Sabstract       = 0x0400,
00156         SmustUnderstand = 0x0800,
00157         Sreturn         = 0x1000,
00158         Sattribute      = 0x2000,
00159         Sexplicit       = 0x4000
00160 } Storage;
00161 
00162 typedef enum Level { INTERNAL, GLOBAL, PARAM, LOCAL } Level;
00163 
00164 #define mknone()        mktype(Tnone,     NULL, 0)
00165 #define mkvoid()        mktype(Tvoid,     NULL, 0)
00166 #define mkbool()        mktype(Tenum,     booltable, 2)
00167 #define mkchar()        mktype(Tchar,     NULL, 1)
00168 #define mkwchart()      mktype(Twchar,    NULL, 4)
00169 #define mkshort()       mktype(Tshort,    NULL, 2)
00170 #define mkint()         mktype(Tint,      NULL, 4)
00171 #define mklong()        mktype(Tlong,     NULL, 8)
00172 #define mkllong()       mktype(Tllong,    NULL, 8)
00173 #define mkfloat()       mktype(Tfloat,    NULL, 4)
00174 #define mkdouble()      mktype(Tdouble,   NULL, 8)
00175 #define mkuchar()       mktype(Tuchar,    NULL, 1)      /* unsigned char */
00176 #define mkushort()      mktype(Tushort,   NULL, 2)      /* unsigned short */
00177 #define mkuint()        mktype(Tuint,     NULL, 4)      /* unsigned int */
00178 #define mkulong()       mktype(Tulong,    NULL, 8)      /* unsigned long */
00179 #define mkullong()      mktype(Tullong,   NULL, 8)      /* unsigned long */
00180 #define mktimet()       mktype(Ttime,     NULL, 4)
00181 #define mkenum(t)       mktype(Tenum,     t,    4)
00182 #define mkmask(t)       mktype(Tenum,     t,    8)
00183 #define mkpointer(t)    mktype(Tpointer,  t,    4)
00184 #define mkreference(t)  mktype(Treference,t,    4)
00185 #define mkclass(t, w)   mktype(Tclass,    t,    w)
00186 #define mkstruct(t, w)  mktype(Tstruct,   t,    w)
00187 #define mkunion(t, w)   mktype(Tunion,    t,    w)
00188 #define mkarray(t, w)   mktype(Tarray,    t,    w)
00189 #define mkfun(t)        mktype(Tfun,      t,    0)
00190 #define mkstring()      mkpointer(mkchar())
00191 
00192 typedef struct Symbol
00193 {       char    *name;
00194         Token   token;
00195         struct  Symbol *next;
00196 } Symbol;
00197 
00198 Symbol  *install(const char*, Token), *lookup(const char*), *gensym(const char*), *gensymidx(const char*, int);
00199 
00200 typedef struct Tnode
00201 {       Type    type;
00202         void    *ref;
00203         Symbol  *id;    /* struct/class/union/enum name */
00204         Symbol  *base;  /* base class name */
00205         Symbol  *sym;   /* typedef name */
00206         struct  Entry *response; /* funcs only: points to response struct */
00207         int     width;
00208         int     transient;
00209         int     imports;
00210         struct  Tnode *next;
00211         Bool generated;
00212         Bool wsdl;
00213         int     num;
00214 } Tnode;
00215 
00216 typedef union Value {
00217         LONG64  i;
00218         double  r;
00219         char    *s;
00220 } Value;
00221 
00222 typedef struct IDinfo {
00223         Tnode   *typ;
00224         Storage sto;
00225         Bool    hasval;         /* if true, identifier is constant */
00226         Value   val;            /* ... with this value */
00227         int     offset;
00228         int     minOccurs;
00229         int     maxOccurs;
00230         char    *pattern;
00231 } IDinfo;
00232 
00233 typedef struct Entry {
00234         Symbol  *sym;
00235         IDinfo  info;
00236         Level   level;
00237         int     lineno;
00238         struct  Entry *next;
00239 } Entry;
00240 
00241 typedef struct Table {
00242         Symbol  *sym;
00243         Level   level;
00244         Entry   *list;
00245         struct  Table *prev;
00246 } Table;
00247 
00248 typedef struct FNinfo {
00249         Tnode   *ret;
00250         Table   *args;
00251 } FNinfo;
00252 
00253 
00254 typedef struct Node {
00255         Tnode   *typ;
00256         Storage sto;
00257         Bool    hasval;         /* if true, this node has a constant value */
00258         Value   val;            /* ... this is the value */
00259         int     minOccurs;
00260         int     maxOccurs;
00261         char    *pattern;
00262 } Node;
00263 
00264 #define ACTION 0
00265 #define HDRIN 1         /* bits 0 and 1 are reserved for hdr ops */
00266 #define HDROUT 2
00267 #define COMMENT 4
00268 #define ENCODING 8
00269 #define RESPONSE_ENCODING 16
00270 #define STYLE 32
00271 #define FAULT 64
00272 
00273 typedef struct Method
00274 {       struct Method *next;
00275         char *name;
00276         short mess; /* see #defines above */
00277         char *part;
00278 } Method;
00279 
00280 typedef struct Service
00281 {       struct Service *next;
00282         char *ns;
00283         char *name;
00284         char *port;
00285         char *URL;
00286         char *executable;
00287         char *import;
00288         char *URI;
00289         char *WSDL;
00290         char *style;
00291         char *encoding;
00292         char *documentation;
00293         struct Method *list;
00294 } Service;
00295 
00296 typedef struct Pragma
00297 {       struct Pragma *next;
00298         char *pragma;
00299 } Pragma;
00300 
00301 extern Entry *enter(Table*, Symbol*), *entry(Table*, Symbol*), *reenter(Table*, Symbol*), *enumentry(Symbol*);
00302 
00303 extern Table *mktable(Table*);
00304 
00305 extern Tnode *mkmethod(Tnode*, Table*);
00306 
00307 extern char *emalloc(unsigned int);
00308 
00309 extern Tnode *mktype(Type, void*, int);
00310 extern Tnode *mksymtype(Tnode*, Symbol*);
00311 extern Tnode *mktemplate(Tnode*, Symbol*);
00312 
00313 extern int is_transient(Tnode*);
00314 extern int is_response(Tnode*);
00315 
00316 extern Table *typetable, *uniontable, *enumtable, *classtable, *booltable, *templatetable;
00317 
00318 extern void compile(Table*);
00319 extern void freetable(Table*);
00320 extern Entry *unlinklast(Table*); 
00321 
00322 extern int vflag;
00323 extern int wflag;
00324 extern int cflag;
00325 extern int eflag;
00326 extern int mflag;
00327 extern int nflag;
00328 extern int lflag;
00329 extern int xflag;
00330 extern char dirpath[1024];
00331 extern char filename[1024];
00332 extern char *prefix;
00333 extern char *importpath;
00334 extern int custom_header;
00335 extern int custom_fault;
00336 extern Pragma *pragmas;
00337 extern Service *services;
00338 extern char *namespaceid;
00339 extern int transient;
00340 extern int imports;
00341 extern int typeNO;
00342 
00343 extern char *envURI;
00344 extern char *encURI;
00345 extern char *rpcURI;
00346 extern char *xsiURI;
00347 extern char *xsdURI;

Generated on Mon Jun 5 10:20:42 2006 for Intelligence.kdevelop by  doxygen 1.4.6