annotate GEMBASSY-1.0.3/gsoap/src/soapcpp2_lex.l @ 0:8300eb051bea draft

Initial upload
author ktnyt
date Fri, 26 Jun 2015 05:19:29 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2 soapcpp2_lex.l
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4 Flex/Lex tokenizer.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6 --------------------------------------------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7 gSOAP XML Web services tools
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8 Copyright (C) 2000-2013, Robert van Engelen, Genivia Inc. All Rights Reserved.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9 This part of the software is released under ONE of the following licenses:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10 GPL or Genivia's license for commercial use.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11 --------------------------------------------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
12 GPL license.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
13
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
14 This program is free software; you can redistribute it and/or modify it under
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
15 the terms of the GNU General Public License as published by the Free Software
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
16 Foundation; either version 2 of the License, or (at your option) any later
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
17 version.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
18
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
19 This program is distributed in the hope that it will be useful, but WITHOUT ANY
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
20 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
21 PARTICULAR PURPOSE. See the GNU General Public License for more details.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
22
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
23 You should have received a copy of the GNU General Public License along with
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
24 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
25 Place, Suite 330, Boston, MA 02111-1307 USA
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
26
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
27 Author contact information:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
28 engelen@genivia.com / engelen@acm.org
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
29
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
30 This program is released under the GPL with the additional exemption that
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
31 compiling, linking, and/or using OpenSSL is allowed.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
32 --------------------------------------------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
33 A commercial use license is available from Genivia, Inc., contact@genivia.com
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
34 --------------------------------------------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
35 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
36
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
37 %{
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
38 #include "soapcpp2.h"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
39
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
40 #ifdef HAVE_CONFIG_H
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
41 #include "soapcpp2_yacc.h"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
42 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
43 #include "soapcpp2_yacc.tab.h"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
44 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
45
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
46 #ifdef WITH_BISON
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
47 YYSTYPE yylval;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
48 #undef YY_INPUT
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
49 #define YY_INPUT(buf, result, max_size) \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
50 { \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
51 int c = getc(yyin); \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
52 result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
53 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
54 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
55
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
56 #ifndef WITH_LEX
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
57 #define MAX_IMPORT_DEPTH 16
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
58 static struct importlist { struct importlist *next; char name[1]; } *importlist = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
59 static char fnstk[MAX_IMPORT_DEPTH][1024];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
60 static int lnstk[MAX_IMPORT_DEPTH];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
61 static char *imstk[MAX_IMPORT_DEPTH];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
62 static YY_BUFFER_STATE instk[MAX_IMPORT_DEPTH];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
63 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
64 int imports = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
65 char *imported = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
66 static void check_id(const char*);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
67 static Token install_id(void);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
68 static Token install_tag(void);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
69 static Token install_int(void);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
70 static Token install_hex(void);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
71 static Token install_num(void);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
72 static Token install_chr(void);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
73 static Token install_str(void);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
74 static Token install_pragma(void);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
75 static void directive(void), option(void);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
76 static Token error_chr(void);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
77 static Token error_str(void);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
78 static int convchar(int*);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
79 static int hexchar(int*);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
80 static int octchar(int*);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
81 static void module(const char *name, const char *fullname);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
82 static void import(const char *file);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
83 static int magic(const char *name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
84 %}
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
85 ws [ \t\v\r\f\n\x1A\xA0]
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
86 digit [0-9]
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
87 alpha [a-zA-Z_]
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
88 id ({alpha}|:{alpha})({alpha}|{digit}|::|:{alpha})*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
89 tag `[^`\t\v\r\f\n>]+`
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
90 int {digit}+
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
91 hex 0[xX][0-9a-fA-F]+
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
92 num {int}(\.{int}([Ee][+-]?{int})?|(\.{int})?[Ee][+-]?{int})
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
93 chr '(\\'|[^'\n])*'
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
94 str L?\"(\\\"|\\\n|[^"])*\"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
95 module #module{ws}+.*\n
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
96 import #import{ws}+.*\n
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
97 %x MLCOMMENT
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
98 %%
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
99 {ws} { /* skip white space */ }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
100 "/*" { BEGIN(MLCOMMENT); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
101 <MLCOMMENT>.|\n { }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
102 <MLCOMMENT>"*/" { BEGIN(INITIAL); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
103 <MLCOMMENT><<EOF>> { execerror("Unclosed multiline comment at the end of file"); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
104 "//"\/*"gsoapopt".*\n { option(); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
105 "//"\/*"gsoap".*\n { directive(); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
106 "//".*\n { /* skip single line comment */ }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
107 "+=" { return PA; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
108 "-=" { return NA; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
109 "*=" { return TA; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
110 "/=" { return DA; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
111 "%=" { return MA; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
112 "&=" { return AA; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
113 "^=" { return XA; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
114 "|=" { return OA; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
115 "<<=" { return LA; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
116 ">>=" { return RA; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
117 "||" { return OR; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
118 "&&" { return AN; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
119 "==" { return EQ; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
120 "!=" { return NE; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
121 "<=" { return LE; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
122 ">=" { return GE; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
123 "<<" { return LS; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
124 ">>" { return RS; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
125 "++" { return PP; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
126 "--" { return NN; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
127 "->" { return AR; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
128 [;,:=|^&<>+\-*/%!?~(){}\[\].@$] { return yytext[0]; }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
129 {id} { return install_id(); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
130 {tag} { return install_tag(); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
131 {int} { return install_int(); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
132 {hex} { return install_hex(); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
133 {num} { return install_num(); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
134 {chr} { return install_chr(); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
135 {str} { return install_str(); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
136 {module} { char *s, *t, buf[1024];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
137 s = strchr(yytext, '"');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
138 if (!s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
139 t = yytext+7;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
140 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
141 { strcpy(buf, s+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
142 s = strchr(buf, '"');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
143 *s = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
144 t = strchr(s+1, '"');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
145 if (t)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
146 { t++;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
147 s = strchr(t+1, '"');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
148 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
149 *s = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
150 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
151 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
152 module(buf, t);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
153 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
154 {import} { char *s, buf[1024];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
155 s = strchr(yytext, '"');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
156 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
157 { strcpy(buf, s+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
158 s = strchr(buf, '"');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
159 *s = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
160 import(buf);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
161 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
162 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
163 lexerror("Invalid import directive");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
164 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
165 #.*\n { return install_pragma(); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
166 '[^'\n]*/\n { return error_chr(); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
167 \"[^"\n]*/\n { return error_str(); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
168 . { lexerror("Skipping unknown symbol"); }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
169 <<EOF>> { /* when Lex complains: remove this line and below */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
170 #ifndef WITH_LEX
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
171 if (--imports < 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
172 yyterminate();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
173 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
174 { yy_delete_buffer(YY_CURRENT_BUFFER);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
175 yy_switch_to_buffer(instk[imports]);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
176 strcpy(filename, fnstk[imports]);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
177 yylineno = lnstk[imports];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
178 imported = imstk[imports];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
179 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
180 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
181 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
182 %%
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
183
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
184 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
185 install_id - lookup identifier in symbol table. If found, return token
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
186 and symbol table entry. If not found, create entry in symbol table and
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
187 return ID token.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
188 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
189 static Token
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
190 install_id()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
191 { Symbol *p = lookup(yytext);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
192 if (!p)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
193 { int i, flag = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
194 p = install(yytext, ID);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
195 /* [_](x|X)(m|M)(l|L)__ is OK */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
196 /* [_](x|X)(m|M)(l|L).* is not OK */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
197 /* .*__(x|X)(m|M)(l|L) is not OK */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
198 /* .*::(x|X)(m|M)(l|L) is not OK */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
199 for (i = 0; i < yyleng; i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
200 { if ((yytext[i] == '_' && yytext[i+1] == '_')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
201 || (yytext[i] == ':' && yytext[i+1] == ':'))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
202 { flag = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
203 check_id(yytext + i + 2);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
204 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
205 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
206 if (!flag && strcmp(yytext, "XML"))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
207 check_id(yytext);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
208 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
209 yylval.sym = p;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
210 return p->token;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
211 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
212
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
213 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
214 install_tag -
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
215 return TAG token.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
216 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
217 static Token
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
218 install_tag()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
219 { yylval.s = emalloc(yyleng-1); /* yyleng = length(yytext) */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
220 strcpy(yylval.s, yytext+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
221 yylval.s[yyleng-2] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
222 return TAG;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
223 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
224
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
225 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
226 check_id - check for (x|X)(m|M)(l|L)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
227 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
228 static void
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
229 check_id(const char *s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
230 { while (*s == '_')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
231 s++;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
232 if ((s[0] == 'x' || s[0] == 'X')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
233 && (s[1] == 'm' || s[1] == 'M')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
234 && (s[2] == 'l' || s[2] == 'L'))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
235 { sprintf(errbuf, "identifier '%s' starts with or embeds '%3.3s' character sequence exclusively reserved for the XML standard (for enum constants: please ignore this warning)", yytext, s);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
236 semwarn(errbuf);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
237 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
238 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
239
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
240 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
241 install_int - convert digits to integer and return LNG token.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
242 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
243 static Token
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
244 install_int(void)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
245 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
246 sscanf(yytext, SOAP_ULONG_FORMAT, &yylval.i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
247 return LNG;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
248 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
249
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
250 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
251 install_hex - convert hexadecimal digits to integer and return LNG
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
252 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
253 static Token
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
254 install_hex(void)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
255 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
256 sscanf(yytext, SOAP_XLONG_FORMAT, &yylval.i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
257 return LNG;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
258 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
259
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
260 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
261 install_num - convert digits to floating point number and return DBL
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
262 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
263 static Token
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
264 install_num(void)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
265 { sscanf(yytext, "%lf", &yylval.r);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
266 return DBL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
267 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
268
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
269 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
270 install_chr - convert character constant and return CHR.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
271 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
272 static Token
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
273 install_chr(void)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
274 { int i = 2;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
275 if (yytext[1] == '\\')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
276 yylval.c = convchar(&i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
277 else yylval.c = yytext[i-1];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
278 if (yytext[i] != '\'')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
279 lexerror("Illegal character constant");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
280 return CHR;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
281 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
282
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
283 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
284 install_str - convert and store string in memory. Return STR.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
285 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
286 static Token
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
287 install_str(void)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
288 { int i, j = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
289 yylval.s = emalloc(yyleng-1); /* yyleng = length(yytext) */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
290 for (i = 1 + (yytext[0] == 'L'); i < yyleng-1; i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
291 if (yytext[i] == '\\')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
292 { if (yytext[++i] != '\n')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
293 { yylval.s[j++] = convchar(&i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
294 i--;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
295 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
296 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
297 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
298 yylval.s[j++] = yytext[i];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
299 yylval.s[j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
300 return STR;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
301 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
302
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
303 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
304 install_pragma - store pragma in string. Return PRAGMA.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
305 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
306 static Token
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
307 install_pragma(void)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
308 { yylval.s = emalloc(yyleng); /* yyleng = length(yytext) */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
309 strncpy(yylval.s, yytext, strlen(yytext)-1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
310 yylval.s[strlen(yytext)-1] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
311 return PRAGMA;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
312 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
313
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
314 static void directive(void)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
315 { int i, j, k;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
316 char *s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
317 Service *sp;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
318 Method *m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
319 Data *d;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
320 int service;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
321 for (i = 7; yytext[i]; i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
322 if (yytext[i] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
323 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
324 for (j = i; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
325 if (yytext[j] <= 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
326 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
327 if (i == j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
328 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
329 s = (char*)emalloc(j-i+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
330 for (k = 0; k < j-i; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
331 { s[k] = yytext[k+i];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
332 if (s[k] == '_')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
333 s[k] = '-';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
334 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
335 s[k] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
336 for (sp = services; sp; sp = sp->next)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
337 if (!strcmp(sp->ns, s))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
338 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
339 if (!sp)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
340 { sp = (Service*)emalloc(sizeof(Service));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
341 sp->next = services;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
342 sp->ns = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
343 sp->name = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
344 sp->porttype = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
345 sp->portname = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
346 sp->binding = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
347 sp->definitions = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
348 sp->transport = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
349 sp->URL = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
350 sp->URI = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
351 sp->URI2 = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
352 sp->WSDL = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
353 sp->style = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
354 sp->encoding = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
355 sp->protocol = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
356 sp->xsi_type = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
357 sp->elementForm = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
358 sp->attributeForm = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
359 sp->executable = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
360 sp->import = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
361 sp->documentation = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
362 sp->list = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
363 sp->data = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
364 services = sp;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
365 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
366 for (i = j; yytext[i]; i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
367 if (yytext[i] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
368 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
369 if (!strncmp(yytext+i, "service", 7) || !strncmp(yytext+i, "schema", 6))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
370 { service = strncmp(yytext+i, "schema", 6);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
371 for (i += 7; yytext[i]; i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
372 if (yytext[i] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
373 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
374 for (j = i; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
375 if (yytext[j] <= 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
376 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
377 for (; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
378 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
379 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
380 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
381 if (yytext[k] <= 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
382 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
383 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
384 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
385 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
386 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
387 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
388 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
389 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
390 if (!strncmp(yytext+i, "name:", 5))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
391 { sp->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
392 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
393 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
394 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
395 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
396 if (yytext[k] == 10 || yytext[k] == 13)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
397 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
398 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
399 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
400 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
401 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
402 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
403 sp->documentation = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
404 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
405 else if (!strncmp(yytext+i, "type:", 5) || !strncmp(yytext+i, "portType:", 9) || !strncmp(yytext+i, "interface:", 10))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
406 sp->porttype = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
407 else if (!strncmp(yytext+i, "portName:", 9))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
408 sp->portname = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
409 else if (!strncmp(yytext+i, "binding:", 8))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
410 sp->binding = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
411 else if (!strncmp(yytext+i, "definitions:", 12))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
412 sp->definitions = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
413 else if (!strncmp(yytext+i, "documentation:", 14))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
414 { for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
415 if (yytext[k] == 10 || yytext[k] == 13)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
416 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
417 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
418 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
419 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
420 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
421 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
422 sp->documentation = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
423 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
424 else if (!strncmp(yytext+i, "transport:", 10))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
425 sp->transport = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
426 else if (!strncmp(yytext+i, "location:", 9) || !strncmp(yytext+i, "endpoint:", 9) || !strncmp(yytext+i, "port:", 5))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
427 { if (sp->URL)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
428 { char *t = (char*)emalloc(strlen(sp->URL) + strlen(s) + 2);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
429 strcpy(t, sp->URL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
430 strcat(t, " ");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
431 strcat(t, s);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
432 sp->URL = t;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
433 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
434 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
435 sp->URL = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
436 if (!service && !sp->import)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
437 sp->import = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
438 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
439 else if (!strncmp(yytext+i, "executable:", 11))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
440 sp->executable = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
441 else if (!strncmp(yytext+i, "namespace:", 10))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
442 { if (service)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
443 { if (!sp->URI)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
444 sp->URI = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
445 sp->WSDL = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
446 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
447 else if (!strcmp(sp->ns, "SOAP-ENV"))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
448 { if (vflag > 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
449 semwarn("option -1 or -2 overrides SOAP-ENV namespace");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
450 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
451 envURI = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
452 sp->URI = envURI;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
453 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
454 else if (!strcmp(sp->ns, "SOAP-ENC"))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
455 { if (vflag > 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
456 semwarn("option -1 or -2 overrides SOAP-ENC namespace");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
457 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
458 encURI = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
459 sp->URI = encURI;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
460 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
461 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
462 sp->URI = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
463 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
464 else if (!strncmp(yytext+i, "namespace2:", 11))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
465 { sp->URI2 = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
466 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
467 else if (!strncmp(yytext+i, "typed:", 6))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
468 { sp->xsi_type = (*s == 'y');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
469 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
470 else if (!strncmp(yytext+i, "form:", 5))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
471 { sp->elementForm = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
472 sp->attributeForm = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
473 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
474 else if (!strncmp(yytext+i, "elementForm:", 12))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
475 sp->elementForm = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
476 else if (!strncmp(yytext+i, "attributeForm:", 14))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
477 sp->attributeForm = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
478 else if (!strncmp(yytext+i, "import:", 7))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
479 { if (!sp->URI)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
480 sp->URI = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
481 sp->import = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
482 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
483 else if (!strncmp(yytext+i, "encoding:", 9))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
484 { if (!strcmp(s, "encoded"))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
485 sp->encoding = "";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
486 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
487 sp->encoding = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
488 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
489 else if (!strncmp(yytext+i, "style:", 6))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
490 sp->style = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
491 else if (!strncmp(yytext+i, "protocol:", 9))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
492 sp->protocol = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
493 else if (!strncmp(yytext+i, "method-protocol:", 16))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
494 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
495 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
496 m->mess = PROTOCOL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
497 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
498 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
499 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
500 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
501 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
502 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
503 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
504 if (yytext[k] == 10 || yytext[k] == 13)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
505 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
506 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
507 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
508 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
509 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
510 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
511 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
512 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
513 else if (!strncmp(yytext+i, "method-style:", 13))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
514 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
515 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
516 m->mess = STYLE;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
517 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
518 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
519 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
520 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
521 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
522 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
523 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
524 if (yytext[k] == 10 || yytext[k] == 13)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
525 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
526 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
527 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
528 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
529 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
530 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
531 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
532 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
533 else if (!strncmp(yytext+i, "method-encoding:", 16))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
534 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
535 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
536 m->mess = ENCODING;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
537 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
538 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
539 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
540 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
541 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
542 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
543 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
544 if (yytext[k] == 10 || yytext[k] == 13)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
545 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
546 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
547 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
548 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
549 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
550 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
551 if (strcmp(s, "encoded"))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
552 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
553 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
554 m->part = "";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
555 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
556 else if (!strncmp(yytext+i, "method-response-encoding:", 25))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
557 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
558 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
559 m->mess = RESPONSE_ENCODING;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
560 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
561 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
562 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
563 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
564 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
565 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
566 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
567 if (yytext[k] == 10 || yytext[k] == 13)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
568 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
569 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
570 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
571 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
572 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
573 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
574 if (strcmp(s, "encoded"))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
575 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
576 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
577 m->part = "";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
578 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
579 else if (!strncmp(yytext+i, "method-documentation:", 21))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
580 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
581 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
582 m->mess = COMMENT;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
583 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
584 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
585 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
586 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
587 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
588 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
589 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
590 if (yytext[k] == 10 || yytext[k] == 13)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
591 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
592 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
593 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
594 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
595 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
596 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
597 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
598 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
599 else if (!strncmp(yytext+i, "method-action:", 14))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
600 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
601 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
602 m->mess = ACTION;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
603 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
604 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
605 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
606 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
607 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
608 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
609 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
610 if (yytext[k] == 10 || yytext[k] == 13)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
611 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
612 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
613 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
614 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
615 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
616 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
617 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
618 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
619 else if (!strncmp(yytext+i, "method-input-action:", 20))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
620 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
621 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
622 m->mess = REQUEST_ACTION;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
623 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
624 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
625 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
626 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
627 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
628 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
629 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
630 if (yytext[k] == 10 || yytext[k] == 13)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
631 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
632 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
633 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
634 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
635 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
636 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
637 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
638 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
639 else if (!strncmp(yytext+i, "method-output-action:", 21))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
640 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
641 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
642 m->mess = RESPONSE_ACTION;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
643 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
644 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
645 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
646 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
647 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
648 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
649 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
650 if (yytext[k] == 10 || yytext[k] == 13)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
651 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
652 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
653 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
654 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
655 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
656 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
657 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
658 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
659 else if (!strncmp(yytext+i, "method-fault-action:", 20))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
660 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
661 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
662 m->mess = FAULT_ACTION;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
663 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
664 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
665 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
666 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
667 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
668 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
669 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
670 if (yytext[k] == 10 || yytext[k] == 13)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
671 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
672 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
673 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
674 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
675 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
676 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
677 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
678 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
679 else if (!strncmp(yytext+i, "method-mime-type:", 17))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
680 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
681 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
682 m->mess = MIMEIN | MIMEOUT;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
683 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
684 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
685 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
686 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
687 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
688 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
689 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
690 if (yytext[k] <= 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
691 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
692 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
693 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
694 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
695 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
696 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
697 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
698 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
699 else if (!strncmp(yytext+i, "method-input-mime-type:", 23))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
700 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
701 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
702 m->mess = MIMEIN;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
703 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
704 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
705 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
706 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
707 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
708 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
709 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
710 if (yytext[k] <= 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
711 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
712 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
713 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
714 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
715 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
716 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
717 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
718 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
719 else if (!strncmp(yytext+i, "method-output-mime-type:", 24))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
720 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
721 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
722 m->mess = MIMEOUT;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
723 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
724 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
725 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
726 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
727 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
728 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
729 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
730 if (yytext[k] <= 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
731 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
732 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
733 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
734 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
735 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
736 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
737 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
738 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
739 else if (!strncmp(yytext+i, "method-header-part:", 19))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
740 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
741 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
742 m->mess = HDRIN | HDROUT;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
743 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
744 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
745 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
746 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
747 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
748 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
749 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
750 if (yytext[k] <= 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
751 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
752 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
753 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
754 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
755 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
756 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
757 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
758 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
759 else if (!strncmp(yytext+i, "method-input-header-part:", 25))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
760 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
761 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
762 m->mess = HDRIN;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
763 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
764 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
765 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
766 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
767 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
768 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
769 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
770 if (yytext[k] <= 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
771 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
772 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
773 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
774 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
775 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
776 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
777 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
778 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
779 else if (!strncmp(yytext+i, "method-output-header-part:", 26))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
780 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
781 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
782 m->mess = HDROUT;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
783 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
784 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
785 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
786 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
787 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
788 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
789 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
790 if (yytext[k] <= 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
791 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
792 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
793 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
794 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
795 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
796 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
797 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
798 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
799 else if (!strncmp(yytext+i, "method-fault:", 13))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
800 { m = (Method*)emalloc(sizeof(Method));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
801 m->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
802 m->mess = FAULT;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
803 m->part = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
804 m->next = sp->list;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
805 sp->list = m;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
806 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
807 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
808 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
809 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
810 if (yytext[k] <= 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
811 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
812 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
813 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
814 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
815 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
816 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
817 m->part = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
818 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
819 else if (!strncmp(yytext+i, "type-documentation:", 19))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
820 { d = (Data*)emalloc(sizeof(Data));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
821 d->name = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
822 d->text = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
823 d->next = sp->data;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
824 sp->data = d;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
825 for (j = k; yytext[j]; j++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
826 if (yytext[j] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
827 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
828 for (k = j; yytext[k]; k++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
829 if (yytext[k] == 10 || yytext[k] == 13)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
830 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
831 if (j == k)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
832 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
833 s = (char*)emalloc(k-j+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
834 strncpy(s, yytext+j, k-j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
835 s[k-j] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
836 d->text = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
837 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
838 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
839 { sprintf(errbuf, "unrecognized gsoap directive: %s", yytext+i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
840 semwarn(errbuf);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
841 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
842 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
843 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
844 { sprintf(errbuf, "unrecognized gsoap directive: %s", yytext);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
845 semwarn(errbuf);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
846 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
847 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
848
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
849 static void option(void)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
850 { int i;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
851 if (imports)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
852 { sprintf(errbuf, "options directive: %s ignored in imported file(s)", yytext);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
853 semwarn(errbuf);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
854 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
855 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
856 for (i = 10; yytext[i]; i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
857 if (yytext[i] > 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
858 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
859 for (; yytext[i]; i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
860 switch (yytext[i])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
861 { case 'a':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
862 aflag = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
863 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
864 case 'c':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
865 cflag = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
866 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
867 case 'e':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
868 eflag = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
869 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
870 case 'n':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
871 nflag = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
872 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
873 case 'l':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
874 lflag = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
875 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
876 case 't':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
877 tflag = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
878 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
879 case 'w':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
880 wflag = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
881 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
882 default:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
883 if (yytext[i] <= 32)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
884 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
885 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
886 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
887
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
888 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
889 error_chr - lexical error in character constant. Return character 0 to
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
890 allow parsing to continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
891 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
892 static Token
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
893 error_chr(void)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
894 { lexerror("Ending-' missing in character constant");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
895 yylval.c = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
896 return CHR;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
897 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
898
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
899 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
900 error_str - lexical error in string. Return empty string to allow
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
901 parsing to continue
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
902 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
903 static Token
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
904 error_str(void)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
905 { lexerror("Ending-\" missing in string");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
906 yylval.s = "";
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
907 return STR;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
908 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
909
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
910 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
911 Character conversion functions
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
912 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
913 static int
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
914 convchar(int *p)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
915 { switch (yytext[(*p)++])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
916 { case 'a': return '\a';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
917 case 'b': return '\b';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
918 case 'f': return '\f';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
919 case 'n': return '\n';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
920 case 'r': return '\r';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
921 case 't': return '\t';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
922 case 'v': return '\v';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
923 case 'x': return hexchar(p);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
924 case '0':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
925 case '1':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
926 case '2':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
927 case '3':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
928 case '4':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
929 case '5':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
930 case '6':
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
931 case '7': (*p)--;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
932 return octchar(p);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
933 default: return yytext[*p-1];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
934 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
935 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
936
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
937 static int
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
938 hexchar(int *p)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
939 { int i, d, c = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
940 for (i = 0; isxdigit(d = yytext[*p]) && i < 2; i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
941 { c = (c << 4) + (d <= '9' ? d - '0' : toupper(d) - '7');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
942 (*p)++;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
943 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
944 return c;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
945 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
946
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
947 static int
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
948 octchar(int *p)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
949 { int i, d, c = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
950 for (i = 0; (d = yytext[*p]) >= '0' && d <= '7' && i < 3; i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
951 { c = (c << 3) + d - '0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
952 (*p)++;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
953 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
954 return c;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
955 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
956
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
957 static void module(const char *name, const char *fullname)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
958 { if (!fullname)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
959 fullname = name;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
960 if (imports)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
961 { Pragma **pp;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
962 char *s = emalloc(strlen(fullname)+15);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
963 sprintf(s, "#include \"%sH.h\"", fullname);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
964 for (pp = &pragmas; *pp; pp = &(*pp)->next)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
965 if (!strcmp((*pp)->pragma, s))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
966 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
967 if (!*pp)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
968 { *pp = (Pragma*)emalloc(sizeof(Pragma));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
969 (*pp)->pragma = s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
970 (*pp)->next = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
971 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
972 imported = (char*)emalloc(strlen(fullname)+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
973 strcpy(imported, fullname);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
974 fprintf(stderr, "Importing module '%s'\n\n", fullname);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
975 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
976 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
977 { lflag = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
978 typeNO = magic(name);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
979 prefix = (char*)emalloc(strlen(fullname)+1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
980 strcpy(prefix, fullname);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
981 fprintf(stderr, "Compiling module '%s' (magic number = %d)\n\n", fullname, typeNO);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
982 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
983 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
984
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
985 static int magic(const char *name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
986 { size_t i;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
987 int n;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
988 if (strlen(name) > 4)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
989 semerror("#module name length must not exceed four characters");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
990 n = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
991 for (i = 0; i < strlen(name); i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
992 if (name[i] >= 'a' && name[i] <= 'z')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
993 n = 26*n + name[i] - 'a';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
994 else if (name[i] >= 'A' && name[i] <= 'Z')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
995 n = 26*n + name[i] - 'A';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
996 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
997 semerror("#module name must be alphabetic and the length must not exceed four characters.\nUse '#module name longname' for longer names.");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
998 return 4699*n + 153424;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
999 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1000
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1001 #ifdef WITH_LEX
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1002 static void import(const char *file)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1003 { execerror("Cannot #import: soapcpp2 not compiled with flex (replace lex with flex)");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1004 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1005 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1006 static void import(const char *file)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1007 { char buf[1024];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1008 struct importlist *p;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1009 for (p = importlist; p; p = p->next)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1010 if (!strcmp(p->name, file))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1011 return;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1012 if (imports >= MAX_IMPORT_DEPTH)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1013 execerror("Imports nested too deep");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1014 instk[imports] = YY_CURRENT_BUFFER;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1015 strcpy(fnstk[imports], filename);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1016 lnstk[imports] = yylineno;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1017 imstk[imports] = imported;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1018 yylineno = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1019 /* imported = NULL; this is useful to change the semantics of #import to NOT consider non-module imports to be part of the current module */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1020 imports++;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1021 if (!(yyin = fopen(file, "r")))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1022 { if (importpath)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1023 { char *s, *t;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1024 s = importpath;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1025 do
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1026 { size_t n;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1027 t = strstr(s, SOAP_PATHSEP);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1028 if (t)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1029 { if (t - s >= sizeof(buf))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1030 t = s + sizeof(buf) - 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1031 strncpy(buf, s, t - s);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1032 buf[t - s] = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1033 s = t + sizeof(SOAP_PATHSEP) - 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1034 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1035 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1036 { strcpy(buf, s);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1037 s = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1038 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1039 n = strlen(buf) - 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1040 #ifdef __VMS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1041 if (buf[n] != ']' && buf[n] != ':')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1042 strcat(buf, ":");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1043 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1044 if (buf[n] != SOAP_PATHCAT[0])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1045 strcat(buf, SOAP_PATHCAT);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1046 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1047 strcat(buf, file);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1048 yyin = fopen(buf, "r");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1049 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1050 while (s && !yyin);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1051 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1052 if (!yyin)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1053 { sprintf(errbuf, "#import: Cannot open file \"%s\" for reading.\nHint: use option -I<path> (for example -Igsoap/import"SOAP_PATHSEP"gsoap/custom:.)", file);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1054 execerror(errbuf);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1055 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1056 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1057 p = (struct importlist*)malloc(sizeof(struct importlist) + strlen(file)); /* has already + 1 byte size */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1058 strcpy(p->name, file);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1059 p->next = importlist;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1060 importlist = p;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1061 strcpy(filename, file);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1062 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1063 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1064 #endif