Sync to Wine-20050419:
Juan Lang <juan_lang(a)yahoo.com>
- Always initialize header file name, to prevent "#include (null)"
statements in generated files.
- Put space between include directive and include file.
- Add proxy/stub options to widl man page.
Vincent Beron <vberon(a)mecano.gme.usherb.ca>
- Add support for single in idl files.
- Keep types sorted in alphabetical order.
Francois Gouget <fgouget(a)free.fr>
- Assorted spelling fixes.
Modified: trunk/reactos/tools/widl/client.c
Modified: trunk/reactos/tools/widl/lex.yy.c
Modified: trunk/reactos/tools/widl/parser.l
Modified: trunk/reactos/tools/widl/parser.y
Modified: trunk/reactos/tools/widl/server.c
Modified: trunk/reactos/tools/widl/typelib_struct.h
Modified: trunk/reactos/tools/widl/widl.c
Modified: trunk/reactos/tools/widl/widl.man
Modified: trunk/reactos/tools/widl/widltypes.h
Modified: trunk/reactos/tools/widl/y.tab.c
Modified: trunk/reactos/tools/widl/y.tab.h
_____
Modified: trunk/reactos/tools/widl/client.c
--- trunk/reactos/tools/widl/client.c 2005-04-25 09:12:35 UTC (rev
14797)
+++ trunk/reactos/tools/widl/client.c 2005-04-25 10:58:34 UTC (rev
14798)
@@ -1714,12 +1714,12 @@
error("Could not open %s for output\n", client_name);
print_client("/*** Autogenerated by WIDL %s from %s - Do not edit
***/\n", WIDL_FULLVERSION, input_name);
- print_client("#include<string.h>\n");
+ print_client("#include <string.h>\n");
print_client("#ifdef _ALPHA_\n");
- print_client("#include<stdarg.h>\n");
+ print_client("#include <stdarg.h>\n");
print_client("#endif\n");
fprintf(client, "\n");
- print_client("#include\"%s\"\n", header_name);
+ print_client("#include \"%s\"\n", header_name);
fprintf(client, "\n");
}
_____
Modified: trunk/reactos/tools/widl/lex.yy.c
--- trunk/reactos/tools/widl/lex.yy.c 2005-04-25 09:12:35 UTC (rev
14797)
+++ trunk/reactos/tools/widl/lex.yy.c 2005-04-25 10:58:34 UTC (rev
14798)
@@ -1,4 +1,3 @@
-#line 2 "lex.yy.c"
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
@@ -10,6 +9,7 @@
#define YY_FLEX_MINOR_VERSION 5
#include <stdio.h>
+#include <unistd.h>
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
@@ -23,7 +23,6 @@
#ifdef __cplusplus
#include <stdlib.h>
-#include <unistd.h>
/* Use prototypes in function declarations. */
#define YY_USE_PROTOS
@@ -3088,7 +3087,7 @@
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
-#line 1 "parser.l"
+#line 1 "./parser.l"
#define INITIAL 0
/*
* IDL Compiler
@@ -3115,7 +3114,7 @@
#define pp_line 2
-#line 36 "parser.l"
+#line 36 "./parser.l"
#include "config.h"
@@ -3186,7 +3185,7 @@
* The flexer starts here
************************************************************************
**
*/
-#line 3190 "lex.yy.c"
+#line 3189 "lex.yy.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -3337,12 +3336,12 @@
YY_DECL
{
register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
+ register char *yy_cp = NULL, *yy_bp = NULL;
register int yy_act;
-#line 108 "parser.l"
+#line 108 "./parser.l"
-#line 3346 "lex.yy.c"
+#line 3345 "lex.yy.c"
if ( yy_init )
{
@@ -3431,12 +3430,12 @@
case 1:
YY_RULE_SETUP
-#line 109 "parser.l"
+#line 109 "./parser.l"
yy_push_state(pp_line);
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 110 "parser.l"
+#line 110 "./parser.l"
{
int lineno;
char *cptr, *fname;
@@ -3459,12 +3458,12 @@
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 129 "parser.l"
+#line 129 "./parser.l"
yy_push_state(QUOTE); cbufidx = 0;
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 130 "parser.l"
+#line 130 "./parser.l"
{
yy_pop_state();
yylval.str = get_buffered_cstring();
@@ -3472,25 +3471,25 @@
}
YY_BREAK
case 5:
-#line 136 "parser.l"
+#line 136 "./parser.l"
case 6:
YY_RULE_SETUP
-#line 136 "parser.l"
+#line 136 "./parser.l"
addcchar(yytext[1]);
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 137 "parser.l"
+#line 137 "./parser.l"
addcchar('\\'); addcchar(yytext[1]);
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 138 "parser.l"
+#line 138 "./parser.l"
addcchar(yytext[0]);
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 139 "parser.l"
+#line 139 "./parser.l"
{
yylval.uuid = parse_uuid(yytext);
return aUUID;
@@ -3498,7 +3497,7 @@
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 143 "parser.l"
+#line 143 "./parser.l"
{
yylval.num = strtoul(yytext, NULL, 0);
return aHEXNUM;
@@ -3506,7 +3505,7 @@
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 147 "parser.l"
+#line 147 "./parser.l"
{
yylval.num = strtoul(yytext, NULL, 0);
return aNUM;
@@ -3514,38 +3513,38 @@
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 151 "parser.l"
+#line 151 "./parser.l"
return kw_token(yytext);
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 152 "parser.l"
+#line 152 "./parser.l"
line_number++;
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 153 "parser.l"
+#line 153 "./parser.l"
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 154 "parser.l"
+#line 154 "./parser.l"
return SHL;
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 155 "parser.l"
+#line 155 "./parser.l"
return SHR;
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 156 "parser.l"
+#line 156 "./parser.l"
return yytext[0];
YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(QUOTE):
case YY_STATE_EOF(pp_line):
-#line 157 "parser.l"
+#line 157 "./parser.l"
{
if (import_stack_ptr) {
pop_import();
@@ -3556,10 +3555,10 @@
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 164 "parser.l"
+#line 164 "./parser.l"
ECHO;
YY_BREAK
-#line 3563 "lex.yy.c"
+#line 3562 "lex.yy.c"
case YY_END_OF_BUFFER:
{
@@ -3935,6 +3934,7 @@
#endif /* ifndef YY_NO_UNPUT */
+#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput()
#else
@@ -4007,8 +4007,8 @@
return c;
}
+#endif /* YY_NO_INPUT */
-
#ifdef YY_USE_PROTOS
void yyrestart( FILE *input_file )
#else
@@ -4118,11 +4118,6 @@
}
-#ifndef YY_ALWAYS_INTERACTIVE
-#ifndef YY_NEVER_INTERACTIVE
-extern int isatty YY_PROTO(( int ));
-#endif
-#endif
#ifdef YY_USE_PROTOS
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
@@ -4440,7 +4435,7 @@
return 0;
}
#endif
-#line 164 "parser.l"
+#line 164 "./parser.l"
#ifndef yywrap
@@ -4566,6 +4561,7 @@
/* ... */
{"short", tSHORT},
{"signed", tSIGNED},
+ {"single", tSINGLE},
{"size_is", tSIZEIS},
{"sizeof", tSIZEOF},
/* ... */
_____
Modified: trunk/reactos/tools/widl/parser.l
--- trunk/reactos/tools/widl/parser.l 2005-04-25 09:12:35 UTC (rev
14797)
+++ trunk/reactos/tools/widl/parser.l 2005-04-25 10:58:34 UTC (rev
14798)
@@ -286,6 +286,7 @@
/* ... */
{"short", tSHORT},
{"signed", tSIGNED},
+ {"single", tSINGLE},
{"size_is", tSIZEIS},
{"sizeof", tSIZEOF},
/* ... */
_____
Modified: trunk/reactos/tools/widl/parser.y
--- trunk/reactos/tools/widl/parser.y 2005-04-25 09:12:35 UTC (rev
14797)
+++ trunk/reactos/tools/widl/parser.y 2005-04-25 10:58:34 UTC (rev
14798)
@@ -169,6 +169,7 @@
%token tRETVAL
%token tSHORT
%token tSIGNED
+%token tSINGLE
%token tSIZEIS tSIZEOF
%token tSMALL
%token tSOURCE
@@ -565,9 +566,9 @@
default: break;
}
}
- | tUNSIGNED { $$ =
make_type(RPC_FC_ULONG, &std_int);
- $$->sign = -1; }
+ | tUNSIGNED { $$ =
make_type(RPC_FC_ULONG, &std_int); $$->sign = -1; }
| tFLOAT { $$ =
make_type(RPC_FC_FLOAT, NULL); }
+ | tSINGLE { $$ =
make_type(RPC_FC_FLOAT, NULL); }
| tDOUBLE { $$ =
make_type(RPC_FC_DOUBLE, NULL); }
| tBOOLEAN { $$ =
make_type(RPC_FC_SMALL, &std_bool); }
| tERRORSTATUST { $$ =
make_type(RPC_FC_ERROR_STATUS_T, NULL); }
_____
Modified: trunk/reactos/tools/widl/server.c
--- trunk/reactos/tools/widl/server.c 2005-04-25 09:12:35 UTC (rev
14797)
+++ trunk/reactos/tools/widl/server.c 2005-04-25 10:58:34 UTC (rev
14798)
@@ -1665,9 +1665,9 @@
error("Could not open %s for output\n", server_name);
print_server("/*** Autogenerated by WIDL %s from %s - Do not edit
***/\n", WIDL_FULLVERSION, input_name);
- print_server("#include<string.h>\n");
+ print_server("#include <string.h>\n");
fprintf(server, "\n");
- print_server("#include\"%s\"\n", header_name);
+ print_server("#include \"%s\"\n", header_name);
fprintf(server, "\n");
}
_____
Modified: trunk/reactos/tools/widl/typelib_struct.h
--- trunk/reactos/tools/widl/typelib_struct.h 2005-04-25 09:12:35 UTC
(rev 14797)
+++ trunk/reactos/tools/widl/typelib_struct.h 2005-04-25 10:58:34 UTC
(rev 14798)
@@ -165,7 +165,7 @@
/* function description data */
typedef struct {
/* INT recsize; record size including some xtra stuff */
- INT DataType; /* data type of the memeber, eg return of
function */
+ INT DataType; /* data type of the member, eg return of
function */
INT Flags; /* something to do with attribute flags
(LOWORD) */
#ifdef WORDS_BIGENDIAN
INT16 funcdescsize; /* size of reconstituted FUNCDESC and related
structs */
_____
Modified: trunk/reactos/tools/widl/widl.c
--- trunk/reactos/tools/widl/widl.c 2005-04-25 09:12:35 UTC (rev
14797)
+++ trunk/reactos/tools/widl/widl.c 2005-04-25 10:58:34 UTC (rev
14798)
@@ -236,7 +236,7 @@
(debuglevel & DEBUGLEVEL_PPTRACE) != 0,
(debuglevel & DEBUGLEVEL_PPMSG) != 0 );
- if (!header_name && do_header) {
+ if (!header_name) {
header_name = dup_basename(input_name, ".idl");
strcat(header_name, ".h");
}
_____
Modified: trunk/reactos/tools/widl/widl.man
--- trunk/reactos/tools/widl/widl.man 2005-04-25 09:12:35 UTC (rev
14797)
+++ trunk/reactos/tools/widl/widl.man 2005-04-25 10:58:34 UTC (rev
14798)
@@ -31,6 +31,20 @@
Define the name of the type library to be generated.
The default filename is infile.tlb.
.PP
+.B Proxy/stub generation options:
+.IP \fB-c\fR
+Generate client stub.
+.IP \fB-C \fIfile\fR
+Name of client stub file (default is infile_c.c)
+.IP \fB-c\fR
+Generate proxy.
+.IP \fB-P \fIfile\fR
+Name of proxy file (default is infile_p.c)
+.IP \fB-s\fR
+Generate server stub.
+.IP \fB-S \fIfile\fR
+Name of server stub file (default is infile_s.c)
+.PP
.B Preprocessor options:
.IP "\fB-I \fIpath\fR"
Add a header search dir to path. Multiple search
_____
Modified: trunk/reactos/tools/widl/widltypes.h
--- trunk/reactos/tools/widl/widltypes.h 2005-04-25 09:12:35 UTC
(rev 14797)
+++ trunk/reactos/tools/widl/widltypes.h 2005-04-25 10:58:34 UTC
(rev 14798)
@@ -66,11 +66,12 @@
ATTR_DEFAULT,
ATTR_DEFAULTVALUE_EXPR,
ATTR_DEFAULTVALUE_STRING,
+ ATTR_DISPINTERFACE,
ATTR_DLLNAME,
ATTR_DUAL,
ATTR_ENDPOINT,
+ ATTR_ENTRY_ORDINAL,
ATTR_ENTRY_STRING,
- ATTR_ENTRY_ORDINAL,
ATTR_EXPLICIT_HANDLE,
ATTR_HANDLE,
ATTR_HELPCONTEXT,
@@ -115,8 +116,7 @@
ATTR_V1ENUM,
ATTR_VARARG,
ATTR_VERSION,
- ATTR_WIREMARSHAL,
- ATTR_DISPINTERFACE
+ ATTR_WIREMARSHAL
};
enum expr_type
_____
Modified: trunk/reactos/tools/widl/y.tab.c
--- trunk/reactos/tools/widl/y.tab.c 2005-04-25 09:12:35 UTC (rev
14797)
+++ trunk/reactos/tools/widl/y.tab.c 2005-04-25 10:58:34 UTC (rev
14798)
@@ -1,3968 +1,3471 @@
-/* A Bison parser, made by GNU Bison 1.875. */
-
-/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-/* Written by Richard Stallman by simplifying the original so called
- ``semantic'' parser. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers. */
-#define YYPURE 0
-
-/* Using locations. */
-#define YYLSP_NEEDED 0
-
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other
debuggers
- know about them. */
- enum yytokentype {
- aIDENTIFIER = 258,
- aKNOWNTYPE = 259,
- aNUM = 260,
- aHEXNUM = 261,
- aSTRING = 262,
- aUUID = 263,
- aEOF = 264,
- SHL = 265,
- SHR = 266,
- tAGGREGATABLE = 267,
- tALLOCATE = 268,
- tAPPOBJECT = 269,
- tARRAYS = 270,
- tASYNC = 271,
- tASYNCUUID = 272,
- tAUTOHANDLE = 273,
- tBINDABLE = 274,
- tBOOLEAN = 275,
- tBROADCAST = 276,
- tBYTE = 277,
- tBYTECOUNT = 278,
- tCALLAS = 279,
- tCALLBACK = 280,
- tCASE = 281,
- tCDECL = 282,
- tCHAR = 283,
- tCOCLASS = 284,
- tCODE = 285,
- tCOMMSTATUS = 286,
- tCONST = 287,
- tCONTEXTHANDLE = 288,
- tCONTEXTHANDLENOSERIALIZE = 289,
- tCONTEXTHANDLESERIALIZE = 290,
- tCONTROL = 291,
- tCPPQUOTE = 292,
- tDEFAULT = 293,
- tDEFAULTVALUE = 294,
- tDISPINTERFACE = 295,
- tDLLNAME = 296,
- tDOUBLE = 297,
- tDUAL = 298,
- tENDPOINT = 299,
- tENTRY = 300,
- tENUM = 301,
- tERRORSTATUST = 302,
- tEXPLICITHANDLE = 303,
- tEXTERN = 304,
- tFLOAT = 305,
- tHANDLE = 306,
- tHANDLET = 307,
- tHELPCONTEXT = 308,
- tHELPFILE = 309,
- tHELPSTRING = 310,
- tHELPSTRINGCONTEXT = 311,
- tHELPSTRINGDLL = 312,
- tHIDDEN = 313,
- tHYPER = 314,
- tID = 315,
- tIDEMPOTENT = 316,
- tIIDIS = 317,
- tIMPLICITHANDLE = 318,
- tIMPORT = 319,
- tIMPORTLIB = 320,
- tIN = 321,
- tINCLUDE = 322,
- tINLINE = 323,
- tINPUTSYNC = 324,
- tINT = 325,
- tINT64 = 326,
- tINTERFACE = 327,
- tLENGTHIS = 328,
- tLIBRARY = 329,
- tLOCAL = 330,
- tLONG = 331,
- tMETHODS = 332,
- tMODULE = 333,
- tNONCREATABLE = 334,
- tOBJECT = 335,
- tODL = 336,
- tOLEAUTOMATION = 337,
- tOPTIONAL = 338,
- tOUT = 339,
- tPOINTERDEFAULT = 340,
- tPROPERTIES = 341,
- tPROPGET = 342,
- tPROPPUT = 343,
- tPROPPUTREF = 344,
- tPTR = 345,
- tPUBLIC = 346,
- tREADONLY = 347,
- tREF = 348,
- tRESTRICTED = 349,
- tRETVAL = 350,
- tSHORT = 351,
- tSIGNED = 352,
- tSIZEIS = 353,
- tSIZEOF = 354,
- tSMALL = 355,
- tSOURCE = 356,
- tSTDCALL = 357,
- tSTRING = 358,
- tSTRUCT = 359,
- tSWITCH = 360,
- tSWITCHIS = 361,
- tSWITCHTYPE = 362,
- tTRANSMITAS = 363,
- tTYPEDEF = 364,
- tUNION = 365,
- tUNIQUE = 366,
- tUNSIGNED = 367,
- tUUID = 368,
- tV1ENUM = 369,
- tVARARG = 370,
- tVERSION = 371,
- tVOID = 372,
- tWCHAR = 373,
- tWIREMARSHAL = 374,
- tPOINTERTYPE = 375,
- COND = 376,
- CAST = 377,
- PPTR = 378,
- NEG = 379
- };
-#endif
-#define aIDENTIFIER 258
-#define aKNOWNTYPE 259
-#define aNUM 260
-#define aHEXNUM 261
-#define aSTRING 262
-#define aUUID 263
-#define aEOF 264
-#define SHL 265
-#define SHR 266
-#define tAGGREGATABLE 267
-#define tALLOCATE 268
-#define tAPPOBJECT 269
-#define tARRAYS 270
-#define tASYNC 271
-#define tASYNCUUID 272
-#define tAUTOHANDLE 273
-#define tBINDABLE 274
-#define tBOOLEAN 275
-#define tBROADCAST 276
-#define tBYTE 277
-#define tBYTECOUNT 278
-#define tCALLAS 279
-#define tCALLBACK 280
-#define tCASE 281
-#define tCDECL 282
-#define tCHAR 283
-#define tCOCLASS 284
-#define tCODE 285
-#define tCOMMSTATUS 286
-#define tCONST 287
-#define tCONTEXTHANDLE 288
-#define tCONTEXTHANDLENOSERIALIZE 289
-#define tCONTEXTHANDLESERIALIZE 290
-#define tCONTROL 291
-#define tCPPQUOTE 292
-#define tDEFAULT 293
-#define tDEFAULTVALUE 294
-#define tDISPINTERFACE 295
-#define tDLLNAME 296
-#define tDOUBLE 297
-#define tDUAL 298
-#define tENDPOINT 299
-#define tENTRY 300
-#define tENUM 301
-#define tERRORSTATUST 302
-#define tEXPLICITHANDLE 303
-#define tEXTERN 304
-#define tFLOAT 305
-#define tHANDLE 306
-#define tHANDLET 307
-#define tHELPCONTEXT 308
-#define tHELPFILE 309
-#define tHELPSTRING 310
-#define tHELPSTRINGCONTEXT 311
-#define tHELPSTRINGDLL 312
-#define tHIDDEN 313
-#define tHYPER 314
-#define tID 315
-#define tIDEMPOTENT 316
-#define tIIDIS 317
-#define tIMPLICITHANDLE 318
-#define tIMPORT 319
-#define tIMPORTLIB 320
-#define tIN 321
-#define tINCLUDE 322
-#define tINLINE 323
-#define tINPUTSYNC 324
-#define tINT 325
-#define tINT64 326
-#define tINTERFACE 327
-#define tLENGTHIS 328
-#define tLIBRARY 329
-#define tLOCAL 330
-#define tLONG 331
-#define tMETHODS 332
-#define tMODULE 333
-#define tNONCREATABLE 334
-#define tOBJECT 335
-#define tODL 336
-#define tOLEAUTOMATION 337
-#define tOPTIONAL 338
-#define tOUT 339
-#define tPOINTERDEFAULT 340
-#define tPROPERTIES 341
-#define tPROPGET 342
-#define tPROPPUT 343
-#define tPROPPUTREF 344
-#define tPTR 345
-#define tPUBLIC 346
-#define tREADONLY 347
-#define tREF 348
-#define tRESTRICTED 349
-#define tRETVAL 350
-#define tSHORT 351
-#define tSIGNED 352
-#define tSIZEIS 353
-#define tSIZEOF 354
-#define tSMALL 355
-#define tSOURCE 356
-#define tSTDCALL 357
-#define tSTRING 358
-#define tSTRUCT 359
-#define tSWITCH 360
-#define tSWITCHIS 361
-#define tSWITCHTYPE 362
-#define tTRANSMITAS 363
-#define tTYPEDEF 364
-#define tUNION 365
-#define tUNIQUE 366
-#define tUNSIGNED 367
-#define tUUID 368
-#define tV1ENUM 369
-#define tVARARG 370
-#define tVERSION 371
-#define tVOID 372
-#define tWCHAR 373
-#define tWIREMARSHAL 374
-#define tPOINTERTYPE 375
-#define COND 376
-#define CAST 377
-#define PPTR 378
-#define NEG 379
-
-
-
-
-/* Copy the first part of user declarations. */
-#line 1 "parser.y"
-
-/*
- * IDL Compiler
- *
- * Copyright 2002 Ove Kaaven
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#include "widl.h"
-#include "utils.h"
-#include "parser.h"
-#include "header.h"
-#include "typelib.h"
-
-#if defined(YYBYACC)
- /* Berkeley yacc (byacc) doesn't seem to know about these */
- /* Some *BSD supplied versions do define these though */
-# ifndef YYEMPTY
-# define YYEMPTY (-1) /* Empty lookahead value of yychar */
-# endif
-# ifndef YYLEX
-# define YYLEX yylex()
-# endif
-
-#elif defined(YYBISON)
- /* Bison was used for original development */
- /* #define YYEMPTY -2 */
- /* #define YYLEX yylex() */
-
-#else
- /* No yacc we know yet */
-# if !defined(YYEMPTY) || !defined(YYLEX)
-# error Yacc version/type unknown. This version needs to be verified
for settings of YYEMPTY and YYLEX.
-# elif defined(__GNUC__) /* gcc defines the #warning directive */
-# warning Yacc version/type unknown. It defines YYEMPTY and YYLEX, but
is not tested
- /* #else we just take a chance that it works... */
-# endif
-#endif
-
-static attr_t *make_attr(enum attr_type type);
-static attr_t *make_attrv(enum attr_type type, unsigned long val);
-static attr_t *make_attrp(enum attr_type type, void *val);
-static expr_t *make_expr(enum expr_type type);
-static expr_t *make_exprl(enum expr_type type, long val);
-static expr_t *make_exprs(enum expr_type type, char *val);
-static expr_t *make_exprt(enum expr_type type, typeref_t *tref, expr_t
*expr);
-static expr_t *make_expr1(enum expr_type type, expr_t *expr);
-static expr_t *make_expr2(enum expr_type type, expr_t *exp1, expr_t
*exp2);
-static expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t
*expr2, expr_t *expr3);
-static type_t *make_type(unsigned char type, type_t *ref);
-static typeref_t *make_tref(char *name, type_t *ref);
-static typeref_t *uniq_tref(typeref_t *ref);
-static type_t *type_ref(typeref_t *ref);
-static void set_type(var_t *v, typeref_t *ref, expr_t *arr);
-static ifref_t *make_ifref(type_t *iface);
-static var_t *make_var(char *name);
-static func_t *make_func(var_t *def, var_t *args);
-static class_t *make_class(char *name);
-
-static type_t *reg_type(type_t *type, char *name, int t);
-static type_t *reg_types(type_t *type, var_t *names, int t);
-static type_t *find_type(char *name, int t);
-static type_t *find_type2(char *name, int t);
-static type_t *get_type(unsigned char type, char *name, int t);
-static type_t *get_typev(unsigned char type, var_t *name, int t);
-static int get_struct_type(var_t *fields);
-
-static var_t *reg_const(var_t *var);
-static var_t *find_const(char *name, int f);
-
-#define tsENUM 1
-#define tsSTRUCT 2
-#define tsUNION 3
-
-static type_t std_bool = { "boolean" };
-static type_t std_int = { "int" };
-static type_t std_int64 = { "__int64" };
-static type_t std_uhyper = { "MIDL_uhyper" };
-
-
-
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 106 "parser.y"
-typedef union YYSTYPE {
- attr_t *attr;
- expr_t *expr;
- type_t *type;
- typeref_t *tref;
- var_t *var;
- func_t *func;
- ifref_t *ifref;
- class_t *clas;
- char *str;
- UUID *uuid;
- unsigned int num;
-} YYSTYPE;
-/* Line 191 of yacc.c. */
-#line 443 "y.tab.c"
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-/* Copy the second part of user declarations. */
-
-
-/* Line 214 of yacc.c. */
-#line 455 "y.tab.c"
-
-#if ! defined (yyoverflow) || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols.
*/
-
-# if YYSTACK_USE_ALLOCA
-# define YYSTACK_ALLOC alloca
-# else
-# ifndef YYSTACK_USE_ALLOCA
-# if defined (alloca) || defined (_ALLOCA_H)
-# define YYSTACK_ALLOC alloca
-# else
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# else
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-# define YYSTACK_ALLOC malloc
-# define YYSTACK_FREE free
-# endif
-#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
-
-
-#if (! defined (yyoverflow) \
- && (! defined (__cplusplus) \
- || (YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- short yyss;
- YYSTYPE yyvs;
- };
-
-/* The size of the maximum gap between one aligned stack and the next.
*/
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (short) + sizeof (YYSTYPE))
\
- + YYSTACK_GAP_MAXIMUM)
-
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- register YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (0)
-# endif
-# endif
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number
of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack)
\
- do
\
- {
\
- YYSIZE_T yynewbytes;
\
- YYCOPY (&yyptr->Stack, Stack, yysize);
\
- Stack = &yyptr->Stack;
\
- yynewbytes = yystacksize * sizeof (*Stack) +
YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr);
\
- }
\
- while (0)
-
-#endif
-
-#if defined (__STDC__) || defined (__cplusplus)
- typedef signed char yysigned_char;
-#else
- typedef short yysigned_char;
-#endif
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 3
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 917
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 144
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 73
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 249
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 462
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.
*/
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 379
-
-#define YYTRANSLATE(YYX)
\
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.
*/
-static const unsigned char yytranslate[] =
-{
- 0, 2, 2, 2, 2, 2, 2, 2, 2,
2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2,
2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2,
2,
- 2, 2, 2, 2, 2, 2, 2, 2, 124,
2,
- 134, 135, 127, 126, 121, 125, 143, 128, 2,
2,
- 2, 2, 2, 2, 2, 2, 2, 2, 140,
133,
- 2, 141, 2, 142, 2, 2, 2, 2, 2,
2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2,
2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2,
2,
- 2, 138, 2, 139, 2, 2, 2, 2, 2,
2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2,
2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2,
2,
- 2, 2, 2, 136, 123, 137, 129, 2, 2,
2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2,
2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2,
2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2,
2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2,
2,
[truncated at 1000 lines; 7308 more skipped]