mirror of
https://github.com/reactos/reactos.git
synced 2025-05-17 16:27:00 +00:00
[WIDL]
- Update widl to Wine-1.1.33. svn path=/trunk/; revision=44284
This commit is contained in:
parent
1d110c440a
commit
5040fe13f1
16 changed files with 3065 additions and 2226 deletions
|
@ -101,9 +101,16 @@ expr_t *make_exprs(enum expr_type type, char *val)
|
|||
return e;
|
||||
}
|
||||
|
||||
expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr)
|
||||
expr_t *make_exprt(enum expr_type type, var_t *var, expr_t *expr)
|
||||
{
|
||||
expr_t *e;
|
||||
type_t *tref;
|
||||
|
||||
if (var->stgclass != STG_NONE && var->stgclass != STG_REGISTER)
|
||||
error_loc("invalid storage class for type expression\n");
|
||||
|
||||
tref = var->type;
|
||||
|
||||
e = xmalloc(sizeof(expr_t));
|
||||
e->type = type;
|
||||
e->ref = expr;
|
||||
|
@ -125,6 +132,7 @@ expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr)
|
|||
e->is_const = TRUE;
|
||||
e->cval = expr->cval;
|
||||
}
|
||||
free(var);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
@ -297,15 +305,19 @@ static int is_integer_type(const type_t *type)
|
|||
case TYPE_BASIC_INT32:
|
||||
case TYPE_BASIC_INT64:
|
||||
case TYPE_BASIC_INT:
|
||||
case TYPE_BASIC_INT3264:
|
||||
case TYPE_BASIC_CHAR:
|
||||
case TYPE_BASIC_HYPER:
|
||||
case TYPE_BASIC_BYTE:
|
||||
case TYPE_BASIC_WCHAR:
|
||||
case TYPE_BASIC_ERROR_STATUS_T:
|
||||
return TRUE;
|
||||
default:
|
||||
case TYPE_BASIC_FLOAT:
|
||||
case TYPE_BASIC_DOUBLE:
|
||||
case TYPE_BASIC_HANDLE:
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -376,6 +388,7 @@ static type_t *find_identifier(const char *identifier, const type_t *cont_type,
|
|||
case TYPE_INTERFACE:
|
||||
case TYPE_POINTER:
|
||||
case TYPE_ARRAY:
|
||||
case TYPE_BITFIELD:
|
||||
/* nothing to do */
|
||||
break;
|
||||
case TYPE_ALIAS:
|
||||
|
|
|
@ -29,7 +29,7 @@ extern expr_t *make_expr(enum expr_type type);
|
|||
extern expr_t *make_exprl(enum expr_type type, long val);
|
||||
extern expr_t *make_exprd(enum expr_type type, double val);
|
||||
extern expr_t *make_exprs(enum expr_type type, char *val);
|
||||
extern expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr);
|
||||
extern expr_t *make_exprt(enum expr_type type, var_t *var, expr_t *expr);
|
||||
extern expr_t *make_expr1(enum expr_type type, expr_t *expr);
|
||||
extern expr_t *make_expr2(enum expr_type type, expr_t *exp1, expr_t *exp2);
|
||||
extern expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, expr_t *expr3);
|
||||
|
|
|
@ -636,4 +636,4 @@ unsigned int lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr)
|
|||
nLoWord = (nLoWord % 65599) & 0xffff;
|
||||
|
||||
return nHiWord | nLoWord;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -265,6 +265,7 @@ void write_type_left(FILE *h, type_t *t, int declonly)
|
|||
case TYPE_BASIC_INT16: fprintf(h, "short"); break;
|
||||
case TYPE_BASIC_INT: fprintf(h, "int"); break;
|
||||
case TYPE_BASIC_INT64: fprintf(h, "__int64"); break;
|
||||
case TYPE_BASIC_INT3264: fprintf(h, "__int3264"); break;
|
||||
case TYPE_BASIC_BYTE: fprintf(h, "byte"); break;
|
||||
case TYPE_BASIC_CHAR: fprintf(h, "char"); break;
|
||||
case TYPE_BASIC_WCHAR: fprintf(h, "wchar_t"); break;
|
||||
|
@ -294,6 +295,9 @@ void write_type_left(FILE *h, type_t *t, int declonly)
|
|||
case TYPE_VOID:
|
||||
fprintf(h, "void");
|
||||
break;
|
||||
case TYPE_BITFIELD:
|
||||
write_type_left(h, type_bitfield_get_field(t), declonly);
|
||||
break;
|
||||
case TYPE_ALIAS:
|
||||
case TYPE_FUNCTION:
|
||||
/* handled elsewhere */
|
||||
|
@ -307,56 +311,83 @@ void write_type_right(FILE *h, type_t *t, int is_field)
|
|||
{
|
||||
if (!h) return;
|
||||
|
||||
if (type_get_type(t) == TYPE_ARRAY && !type_array_is_decl_as_ptr(t)) {
|
||||
if (is_conformant_array(t)) {
|
||||
fprintf(h, "[%s]", is_field ? "1" : "");
|
||||
t = type_array_get_element(t);
|
||||
switch (type_get_type(t))
|
||||
{
|
||||
case TYPE_ARRAY:
|
||||
if (!type_array_is_decl_as_ptr(t))
|
||||
{
|
||||
if (is_conformant_array(t))
|
||||
{
|
||||
fprintf(h, "[%s]", is_field ? "1" : "");
|
||||
t = type_array_get_element(t);
|
||||
}
|
||||
for ( ;
|
||||
type_get_type(t) == TYPE_ARRAY && !type_array_is_decl_as_ptr(t);
|
||||
t = type_array_get_element(t))
|
||||
fprintf(h, "[%u]", type_array_get_dim(t));
|
||||
}
|
||||
for ( ;
|
||||
type_get_type(t) == TYPE_ARRAY && !type_array_is_decl_as_ptr(t);
|
||||
t = type_array_get_element(t))
|
||||
fprintf(h, "[%u]", type_array_get_dim(t));
|
||||
break;
|
||||
case TYPE_BITFIELD:
|
||||
fprintf(h, " : %lu", type_bitfield_get_bits(t)->cval);
|
||||
break;
|
||||
case TYPE_VOID:
|
||||
case TYPE_BASIC:
|
||||
case TYPE_ENUM:
|
||||
case TYPE_STRUCT:
|
||||
case TYPE_ENCAPSULATED_UNION:
|
||||
case TYPE_UNION:
|
||||
case TYPE_ALIAS:
|
||||
case TYPE_MODULE:
|
||||
case TYPE_COCLASS:
|
||||
case TYPE_FUNCTION:
|
||||
case TYPE_INTERFACE:
|
||||
case TYPE_POINTER:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const char *name)
|
||||
{
|
||||
type_t *pt;
|
||||
type_t *pt = NULL;
|
||||
int ptr_level = 0;
|
||||
|
||||
if (!h) return;
|
||||
|
||||
for (pt = t; is_ptr(pt); pt = type_pointer_get_ref(pt), ptr_level++)
|
||||
;
|
||||
if (t) {
|
||||
for (pt = t; is_ptr(pt); pt = type_pointer_get_ref(pt), ptr_level++)
|
||||
;
|
||||
|
||||
if (type_get_type_detect_alias(pt) == TYPE_FUNCTION) {
|
||||
int i;
|
||||
const char *callconv = get_attrp(pt->attrs, ATTR_CALLCONV);
|
||||
if (!callconv) callconv = "";
|
||||
if (is_attr(pt->attrs, ATTR_INLINE)) fprintf(h, "inline ");
|
||||
write_type_left(h, type_function_get_rettype(pt), declonly);
|
||||
fputc(' ', h);
|
||||
if (ptr_level) fputc('(', h);
|
||||
fprintf(h, "%s ", callconv);
|
||||
for (i = 0; i < ptr_level; i++)
|
||||
fputc('*', h);
|
||||
} else
|
||||
write_type_left(h, t, declonly);
|
||||
if (type_get_type_detect_alias(pt) == TYPE_FUNCTION) {
|
||||
int i;
|
||||
const char *callconv = get_attrp(pt->attrs, ATTR_CALLCONV);
|
||||
if (!callconv) callconv = "";
|
||||
if (is_attr(pt->attrs, ATTR_INLINE)) fprintf(h, "inline ");
|
||||
write_type_left(h, type_function_get_rettype(pt), declonly);
|
||||
fputc(' ', h);
|
||||
if (ptr_level) fputc('(', h);
|
||||
fprintf(h, "%s ", callconv);
|
||||
for (i = 0; i < ptr_level; i++)
|
||||
fputc('*', h);
|
||||
} else
|
||||
write_type_left(h, t, declonly);
|
||||
}
|
||||
|
||||
if (name) fprintf(h, "%s%s", needs_space_after(t) ? " " : "", name );
|
||||
if (name) fprintf(h, "%s%s", !t || needs_space_after(t) ? " " : "", name );
|
||||
|
||||
if (type_get_type_detect_alias(pt) == TYPE_FUNCTION) {
|
||||
const var_list_t *args = type_function_get_args(pt);
|
||||
if (t) {
|
||||
if (type_get_type_detect_alias(pt) == TYPE_FUNCTION) {
|
||||
const var_list_t *args = type_function_get_args(pt);
|
||||
|
||||
if (ptr_level) fputc(')', h);
|
||||
fputc('(', h);
|
||||
if (args)
|
||||
write_args(h, args, NULL, 0, FALSE);
|
||||
else
|
||||
fprintf(h, "void");
|
||||
fputc(')', h);
|
||||
} else
|
||||
write_type_right(h, t, is_field);
|
||||
if (ptr_level) fputc(')', h);
|
||||
fputc('(', h);
|
||||
if (args)
|
||||
write_args(h, args, NULL, 0, FALSE);
|
||||
else
|
||||
fprintf(h, "void");
|
||||
fputc(')', h);
|
||||
} else
|
||||
write_type_right(h, t, is_field);
|
||||
}
|
||||
}
|
||||
|
||||
void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *name)
|
||||
|
|
|
@ -193,6 +193,7 @@ SAFEARRAY{ws}*/\( return tSAFEARRAY;
|
|||
<INITIAL,ATTR>\<= return LESSEQUAL;
|
||||
<INITIAL,ATTR>\|\| return LOGICALOR;
|
||||
<INITIAL,ATTR>&& return LOGICALAND;
|
||||
<INITIAL,ATTR>\.\.\. return ELLIPSIS;
|
||||
<INITIAL,ATTR>. return yytext[0];
|
||||
<<EOF>> {
|
||||
if (import_stack_ptr)
|
||||
|
@ -220,6 +221,7 @@ static const struct keyword keywords[] = {
|
|||
{"TRUE", tTRUE},
|
||||
{"__cdecl", tCDECL},
|
||||
{"__fastcall", tFASTCALL},
|
||||
{"__int3264", tINT3264},
|
||||
{"__int64", tINT64},
|
||||
{"__pascal", tPASCAL},
|
||||
{"__stdcall", tSTDCALL},
|
||||
|
@ -279,6 +281,7 @@ static const struct keyword attr_keywords[] =
|
|||
{
|
||||
{"aggregatable", tAGGREGATABLE},
|
||||
{"allocate", tALLOCATE},
|
||||
{"annotation", tANNOTATION},
|
||||
{"appobject", tAPPOBJECT},
|
||||
{"async", tASYNC},
|
||||
{"async_uuid", tASYNCUUID},
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -57,136 +57,139 @@
|
|||
LESSEQUAL = 273,
|
||||
LOGICALOR = 274,
|
||||
LOGICALAND = 275,
|
||||
tAGGREGATABLE = 276,
|
||||
tALLOCATE = 277,
|
||||
tAPPOBJECT = 278,
|
||||
tASYNC = 279,
|
||||
tASYNCUUID = 280,
|
||||
tAUTOHANDLE = 281,
|
||||
tBINDABLE = 282,
|
||||
tBOOLEAN = 283,
|
||||
tBROADCAST = 284,
|
||||
tBYTE = 285,
|
||||
tBYTECOUNT = 286,
|
||||
tCALLAS = 287,
|
||||
tCALLBACK = 288,
|
||||
tCASE = 289,
|
||||
tCDECL = 290,
|
||||
tCHAR = 291,
|
||||
tCOCLASS = 292,
|
||||
tCODE = 293,
|
||||
tCOMMSTATUS = 294,
|
||||
tCONST = 295,
|
||||
tCONTEXTHANDLE = 296,
|
||||
tCONTEXTHANDLENOSERIALIZE = 297,
|
||||
tCONTEXTHANDLESERIALIZE = 298,
|
||||
tCONTROL = 299,
|
||||
tCPPQUOTE = 300,
|
||||
tDEFAULT = 301,
|
||||
tDEFAULTCOLLELEM = 302,
|
||||
tDEFAULTVALUE = 303,
|
||||
tDEFAULTVTABLE = 304,
|
||||
tDISPLAYBIND = 305,
|
||||
tDISPINTERFACE = 306,
|
||||
tDLLNAME = 307,
|
||||
tDOUBLE = 308,
|
||||
tDUAL = 309,
|
||||
tENDPOINT = 310,
|
||||
tENTRY = 311,
|
||||
tENUM = 312,
|
||||
tERRORSTATUST = 313,
|
||||
tEXPLICITHANDLE = 314,
|
||||
tEXTERN = 315,
|
||||
tFALSE = 316,
|
||||
tFASTCALL = 317,
|
||||
tFLOAT = 318,
|
||||
tHANDLE = 319,
|
||||
tHANDLET = 320,
|
||||
tHELPCONTEXT = 321,
|
||||
tHELPFILE = 322,
|
||||
tHELPSTRING = 323,
|
||||
tHELPSTRINGCONTEXT = 324,
|
||||
tHELPSTRINGDLL = 325,
|
||||
tHIDDEN = 326,
|
||||
tHYPER = 327,
|
||||
tID = 328,
|
||||
tIDEMPOTENT = 329,
|
||||
tIIDIS = 330,
|
||||
tIMMEDIATEBIND = 331,
|
||||
tIMPLICITHANDLE = 332,
|
||||
tIMPORT = 333,
|
||||
tIMPORTLIB = 334,
|
||||
tIN = 335,
|
||||
tIN_LINE = 336,
|
||||
tINLINE = 337,
|
||||
tINPUTSYNC = 338,
|
||||
tINT = 339,
|
||||
tINT64 = 340,
|
||||
tINTERFACE = 341,
|
||||
tLCID = 342,
|
||||
tLENGTHIS = 343,
|
||||
tLIBRARY = 344,
|
||||
tLOCAL = 345,
|
||||
tLONG = 346,
|
||||
tMETHODS = 347,
|
||||
tMODULE = 348,
|
||||
tNONBROWSABLE = 349,
|
||||
tNONCREATABLE = 350,
|
||||
tNONEXTENSIBLE = 351,
|
||||
tNULL = 352,
|
||||
tOBJECT = 353,
|
||||
tODL = 354,
|
||||
tOLEAUTOMATION = 355,
|
||||
tOPTIONAL = 356,
|
||||
tOUT = 357,
|
||||
tPASCAL = 358,
|
||||
tPOINTERDEFAULT = 359,
|
||||
tPROPERTIES = 360,
|
||||
tPROPGET = 361,
|
||||
tPROPPUT = 362,
|
||||
tPROPPUTREF = 363,
|
||||
tPTR = 364,
|
||||
tPUBLIC = 365,
|
||||
tRANGE = 366,
|
||||
tREADONLY = 367,
|
||||
tREF = 368,
|
||||
tREGISTER = 369,
|
||||
tREQUESTEDIT = 370,
|
||||
tRESTRICTED = 371,
|
||||
tRETVAL = 372,
|
||||
tSAFEARRAY = 373,
|
||||
tSHORT = 374,
|
||||
tSIGNED = 375,
|
||||
tSIZEIS = 376,
|
||||
tSIZEOF = 377,
|
||||
tSMALL = 378,
|
||||
tSOURCE = 379,
|
||||
tSTATIC = 380,
|
||||
tSTDCALL = 381,
|
||||
tSTRICTCONTEXTHANDLE = 382,
|
||||
tSTRING = 383,
|
||||
tSTRUCT = 384,
|
||||
tSWITCH = 385,
|
||||
tSWITCHIS = 386,
|
||||
tSWITCHTYPE = 387,
|
||||
tTRANSMITAS = 388,
|
||||
tTRUE = 389,
|
||||
tTYPEDEF = 390,
|
||||
tUNION = 391,
|
||||
tUNIQUE = 392,
|
||||
tUNSIGNED = 393,
|
||||
tUUID = 394,
|
||||
tV1ENUM = 395,
|
||||
tVARARG = 396,
|
||||
tVERSION = 397,
|
||||
tVOID = 398,
|
||||
tWCHAR = 399,
|
||||
tWIREMARSHAL = 400,
|
||||
ADDRESSOF = 401,
|
||||
NEG = 402,
|
||||
POS = 403,
|
||||
PPTR = 404,
|
||||
CAST = 405
|
||||
ELLIPSIS = 276,
|
||||
tAGGREGATABLE = 277,
|
||||
tALLOCATE = 278,
|
||||
tANNOTATION = 279,
|
||||
tAPPOBJECT = 280,
|
||||
tASYNC = 281,
|
||||
tASYNCUUID = 282,
|
||||
tAUTOHANDLE = 283,
|
||||
tBINDABLE = 284,
|
||||
tBOOLEAN = 285,
|
||||
tBROADCAST = 286,
|
||||
tBYTE = 287,
|
||||
tBYTECOUNT = 288,
|
||||
tCALLAS = 289,
|
||||
tCALLBACK = 290,
|
||||
tCASE = 291,
|
||||
tCDECL = 292,
|
||||
tCHAR = 293,
|
||||
tCOCLASS = 294,
|
||||
tCODE = 295,
|
||||
tCOMMSTATUS = 296,
|
||||
tCONST = 297,
|
||||
tCONTEXTHANDLE = 298,
|
||||
tCONTEXTHANDLENOSERIALIZE = 299,
|
||||
tCONTEXTHANDLESERIALIZE = 300,
|
||||
tCONTROL = 301,
|
||||
tCPPQUOTE = 302,
|
||||
tDEFAULT = 303,
|
||||
tDEFAULTCOLLELEM = 304,
|
||||
tDEFAULTVALUE = 305,
|
||||
tDEFAULTVTABLE = 306,
|
||||
tDISPLAYBIND = 307,
|
||||
tDISPINTERFACE = 308,
|
||||
tDLLNAME = 309,
|
||||
tDOUBLE = 310,
|
||||
tDUAL = 311,
|
||||
tENDPOINT = 312,
|
||||
tENTRY = 313,
|
||||
tENUM = 314,
|
||||
tERRORSTATUST = 315,
|
||||
tEXPLICITHANDLE = 316,
|
||||
tEXTERN = 317,
|
||||
tFALSE = 318,
|
||||
tFASTCALL = 319,
|
||||
tFLOAT = 320,
|
||||
tHANDLE = 321,
|
||||
tHANDLET = 322,
|
||||
tHELPCONTEXT = 323,
|
||||
tHELPFILE = 324,
|
||||
tHELPSTRING = 325,
|
||||
tHELPSTRINGCONTEXT = 326,
|
||||
tHELPSTRINGDLL = 327,
|
||||
tHIDDEN = 328,
|
||||
tHYPER = 329,
|
||||
tID = 330,
|
||||
tIDEMPOTENT = 331,
|
||||
tIIDIS = 332,
|
||||
tIMMEDIATEBIND = 333,
|
||||
tIMPLICITHANDLE = 334,
|
||||
tIMPORT = 335,
|
||||
tIMPORTLIB = 336,
|
||||
tIN = 337,
|
||||
tIN_LINE = 338,
|
||||
tINLINE = 339,
|
||||
tINPUTSYNC = 340,
|
||||
tINT = 341,
|
||||
tINT3264 = 342,
|
||||
tINT64 = 343,
|
||||
tINTERFACE = 344,
|
||||
tLCID = 345,
|
||||
tLENGTHIS = 346,
|
||||
tLIBRARY = 347,
|
||||
tLOCAL = 348,
|
||||
tLONG = 349,
|
||||
tMETHODS = 350,
|
||||
tMODULE = 351,
|
||||
tNONBROWSABLE = 352,
|
||||
tNONCREATABLE = 353,
|
||||
tNONEXTENSIBLE = 354,
|
||||
tNULL = 355,
|
||||
tOBJECT = 356,
|
||||
tODL = 357,
|
||||
tOLEAUTOMATION = 358,
|
||||
tOPTIONAL = 359,
|
||||
tOUT = 360,
|
||||
tPASCAL = 361,
|
||||
tPOINTERDEFAULT = 362,
|
||||
tPROPERTIES = 363,
|
||||
tPROPGET = 364,
|
||||
tPROPPUT = 365,
|
||||
tPROPPUTREF = 366,
|
||||
tPTR = 367,
|
||||
tPUBLIC = 368,
|
||||
tRANGE = 369,
|
||||
tREADONLY = 370,
|
||||
tREF = 371,
|
||||
tREGISTER = 372,
|
||||
tREQUESTEDIT = 373,
|
||||
tRESTRICTED = 374,
|
||||
tRETVAL = 375,
|
||||
tSAFEARRAY = 376,
|
||||
tSHORT = 377,
|
||||
tSIGNED = 378,
|
||||
tSIZEIS = 379,
|
||||
tSIZEOF = 380,
|
||||
tSMALL = 381,
|
||||
tSOURCE = 382,
|
||||
tSTATIC = 383,
|
||||
tSTDCALL = 384,
|
||||
tSTRICTCONTEXTHANDLE = 385,
|
||||
tSTRING = 386,
|
||||
tSTRUCT = 387,
|
||||
tSWITCH = 388,
|
||||
tSWITCHIS = 389,
|
||||
tSWITCHTYPE = 390,
|
||||
tTRANSMITAS = 391,
|
||||
tTRUE = 392,
|
||||
tTYPEDEF = 393,
|
||||
tUNION = 394,
|
||||
tUNIQUE = 395,
|
||||
tUNSIGNED = 396,
|
||||
tUUID = 397,
|
||||
tV1ENUM = 398,
|
||||
tVARARG = 399,
|
||||
tVERSION = 400,
|
||||
tVOID = 401,
|
||||
tWCHAR = 402,
|
||||
tWIREMARSHAL = 403,
|
||||
ADDRESSOF = 404,
|
||||
NEG = 405,
|
||||
POS = 406,
|
||||
PPTR = 407,
|
||||
CAST = 408
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -229,7 +232,7 @@ typedef union YYSTYPE
|
|||
|
||||
|
||||
/* Line 1676 of yacc.c */
|
||||
#line 233 "parser.tab.h"
|
||||
#line 236 "parser.tab.h"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
|
|
|
@ -101,7 +101,7 @@ 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_list_t *append_expr(expr_list_t *list, expr_t *expr);
|
||||
static array_dims_t *append_array(array_dims_t *list, expr_t *expr);
|
||||
static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, int top);
|
||||
static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const declarator_t *decl, int top);
|
||||
static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_list_t *decls);
|
||||
static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface);
|
||||
static ifref_t *make_ifref(type_t *iface);
|
||||
|
@ -121,7 +121,7 @@ static type_t *find_type_or_error2(char *name, int t);
|
|||
static var_t *reg_const(var_t *var);
|
||||
|
||||
static char *gen_name(void);
|
||||
static void check_arg(var_t *arg);
|
||||
static void check_arg_attrs(const var_t *arg);
|
||||
static void check_statements(const statement_list_t *stmts, int is_inside_library);
|
||||
static void check_all_user_types(const statement_list_t *stmts);
|
||||
static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs);
|
||||
|
@ -194,7 +194,8 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
|
|||
%token EQUALITY INEQUALITY
|
||||
%token GREATEREQUAL LESSEQUAL
|
||||
%token LOGICALOR LOGICALAND
|
||||
%token tAGGREGATABLE tALLOCATE tAPPOBJECT tASYNC tASYNCUUID
|
||||
%token ELLIPSIS
|
||||
%token tAGGREGATABLE tALLOCATE tANNOTATION tAPPOBJECT tASYNC tASYNCUUID
|
||||
%token tAUTOHANDLE tBINDABLE tBOOLEAN tBROADCAST tBYTE tBYTECOUNT
|
||||
%token tCALLAS tCALLBACK tCASE tCDECL tCHAR tCOCLASS tCODE tCOMMSTATUS
|
||||
%token tCONST tCONTEXTHANDLE tCONTEXTHANDLENOSERIALIZE
|
||||
|
@ -224,7 +225,7 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
|
|||
%token tIMPORT tIMPORTLIB
|
||||
%token tIN tIN_LINE tINLINE
|
||||
%token tINPUTSYNC
|
||||
%token tINT tINT64
|
||||
%token tINT tINT3264 tINT64
|
||||
%token tINTERFACE
|
||||
%token tLCID
|
||||
%token tLENGTHIS tLIBRARY
|
||||
|
@ -278,7 +279,7 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
|
|||
%type <attr> attribute type_qualifier function_specifier
|
||||
%type <attr_list> m_attributes attributes attrib_list m_type_qual_list
|
||||
%type <str_list> str_list
|
||||
%type <expr> m_expr expr expr_const expr_int_const array
|
||||
%type <expr> m_expr expr expr_const expr_int_const array m_bitfield
|
||||
%type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const
|
||||
%type <ifinfo> interfacehdr
|
||||
%type <stgclass> storage_cls_spec
|
||||
|
@ -292,10 +293,13 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
|
|||
%type <ifref> coclass_int
|
||||
%type <ifref_list> coclass_ints
|
||||
%type <var> arg ne_union_field union_field s_field case enum declaration
|
||||
%type <var_list> m_args no_args args fields ne_union_fields cases enums enum_list dispint_props field
|
||||
%type <var_list> m_args arg_list args
|
||||
%type <var_list> fields ne_union_fields cases enums enum_list dispint_props field
|
||||
%type <var> m_ident ident
|
||||
%type <declarator> declarator direct_declarator init_declarator
|
||||
%type <declarator_list> declarator_list
|
||||
%type <declarator> declarator direct_declarator init_declarator struct_declarator
|
||||
%type <declarator> m_any_declarator any_declarator any_declarator_no_direct any_direct_declarator
|
||||
%type <declarator> m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator
|
||||
%type <declarator_list> declarator_list struct_declarator_list
|
||||
%type <func> funcdef
|
||||
%type <type> coclass coclasshdr coclassdef
|
||||
%type <num> pointer_type version
|
||||
|
@ -425,27 +429,24 @@ m_args: { $$ = NULL; }
|
|||
| args
|
||||
;
|
||||
|
||||
no_args: tVOID { $$ = NULL; }
|
||||
arg_list: arg { check_arg_attrs($1); $$ = append_var( NULL, $1 ); }
|
||||
| arg_list ',' arg { check_arg_attrs($3); $$ = append_var( $1, $3 ); }
|
||||
;
|
||||
|
||||
args: arg { check_arg($1); $$ = append_var( NULL, $1 ); }
|
||||
| args ',' arg { check_arg($3); $$ = append_var( $1, $3); }
|
||||
| no_args
|
||||
args: arg_list
|
||||
| arg_list ',' ELLIPSIS { $$ = append_var( $1, make_var(strdup("...")) ); }
|
||||
;
|
||||
|
||||
/* split into two rules to get bison to resolve a tVOID conflict */
|
||||
arg: attributes decl_spec declarator { $$ = $3->var;
|
||||
$$->attrs = $1;
|
||||
if ($2->stgclass != STG_NONE && $2->stgclass != STG_REGISTER)
|
||||
arg: attributes decl_spec m_any_declarator { if ($2->stgclass != STG_NONE && $2->stgclass != STG_REGISTER)
|
||||
error_loc("invalid storage class for function parameter\n");
|
||||
set_type($$, $2, $3, TRUE);
|
||||
free($3);
|
||||
$$ = declare_var($1, $2, $3, TRUE);
|
||||
free($2); free($3);
|
||||
}
|
||||
| decl_spec declarator { $$ = $2->var;
|
||||
if ($1->stgclass != STG_NONE && $1->stgclass != STG_REGISTER)
|
||||
| decl_spec m_any_declarator { if ($1->stgclass != STG_NONE && $1->stgclass != STG_REGISTER)
|
||||
error_loc("invalid storage class for function parameter\n");
|
||||
set_type($$, $1, $2, TRUE);
|
||||
free($2);
|
||||
$$ = declare_var(NULL, $1, $2, TRUE);
|
||||
free($1); free($2);
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -472,6 +473,7 @@ str_list: aSTRING { $$ = append_str( NULL, $1 ); }
|
|||
|
||||
attribute: { $$ = NULL; }
|
||||
| tAGGREGATABLE { $$ = make_attr(ATTR_AGGREGATABLE); }
|
||||
| tANNOTATION '(' aSTRING ')' { $$ = make_attrp(ATTR_ANNOTATION, $3); }
|
||||
| tAPPOBJECT { $$ = make_attr(ATTR_APPOBJECT); }
|
||||
| tASYNC { $$ = make_attr(ATTR_ASYNC); }
|
||||
| tAUTOHANDLE { $$ = make_attr(ATTR_AUTO_HANDLE); }
|
||||
|
@ -658,8 +660,10 @@ expr: aNUM { $$ = make_exprl(EXPR_NUM, $1); }
|
|||
| '*' expr %prec PPTR { $$ = make_expr1(EXPR_PPTR, $2); }
|
||||
| expr MEMBERPTR aIDENTIFIER { $$ = make_expr2(EXPR_MEMBER, make_expr1(EXPR_PPTR, $1), make_exprs(EXPR_IDENTIFIER, $3)); }
|
||||
| expr '.' aIDENTIFIER { $$ = make_expr2(EXPR_MEMBER, $1, make_exprs(EXPR_IDENTIFIER, $3)); }
|
||||
| '(' type ')' expr %prec CAST { $$ = make_exprt(EXPR_CAST, $2, $4); }
|
||||
| tSIZEOF '(' type ')' { $$ = make_exprt(EXPR_SIZEOF, $3, NULL); }
|
||||
| '(' decl_spec m_abstract_declarator ')' expr %prec CAST
|
||||
{ $$ = make_exprt(EXPR_CAST, declare_var(NULL, $2, $3, 0), $5); free($2); free($3); }
|
||||
| tSIZEOF '(' decl_spec m_abstract_declarator ')'
|
||||
{ $$ = make_exprt(EXPR_SIZEOF, declare_var(NULL, $3, $4, 0), NULL); free($3); free($4); }
|
||||
| expr '[' expr ']' { $$ = make_expr2(EXPR_ARRAY, $1, $3); }
|
||||
| '(' expr ')' { $$ = $2; }
|
||||
;
|
||||
|
@ -684,7 +688,7 @@ fields: { $$ = NULL; }
|
|||
| fields field { $$ = append_var_list($1, $2); }
|
||||
;
|
||||
|
||||
field: m_attributes decl_spec declarator_list ';'
|
||||
field: m_attributes decl_spec struct_declarator_list ';'
|
||||
{ const char *first = LIST_ENTRY(list_head($3), declarator_t, entry)->var->name;
|
||||
check_field_attrs(first, $1);
|
||||
$$ = set_var_types($1, $2, $3);
|
||||
|
@ -709,17 +713,16 @@ union_field:
|
|||
| ';' { $$ = NULL; }
|
||||
;
|
||||
|
||||
s_field: m_attributes decl_spec declarator { $$ = $3->var;
|
||||
$$->attrs = check_field_attrs($$->name, $1);
|
||||
set_type($$, $2, $3, FALSE);
|
||||
s_field: m_attributes decl_spec declarator { $$ = declare_var(check_field_attrs($3->var->name, $1),
|
||||
$2, $3, FALSE);
|
||||
free($3);
|
||||
}
|
||||
;
|
||||
|
||||
funcdef:
|
||||
m_attributes decl_spec declarator { var_t *v = $3->var;
|
||||
v->attrs = check_function_attrs(v->name, $1);
|
||||
set_type(v, $2, $3, FALSE);
|
||||
m_attributes decl_spec declarator { var_t *v;
|
||||
v = declare_var(check_function_attrs($3->var->name, $1),
|
||||
$2, $3, FALSE);
|
||||
free($3);
|
||||
$$ = make_func(v);
|
||||
}
|
||||
|
@ -727,13 +730,10 @@ funcdef:
|
|||
|
||||
declaration:
|
||||
attributes decl_spec init_declarator
|
||||
{ $$ = $3->var;
|
||||
$$->attrs = $1;
|
||||
set_type($$, $2, $3, FALSE);
|
||||
{ $$ = declare_var($1, $2, $3, FALSE);
|
||||
free($3);
|
||||
}
|
||||
| decl_spec init_declarator { $$ = $2->var;
|
||||
set_type($$, $1, $2, FALSE);
|
||||
| decl_spec init_declarator { $$ = declare_var(NULL, $1, $2, FALSE);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
|
@ -776,6 +776,7 @@ int_std: tINT { $$ = type_new_int(TYPE_BASIC_INT, 0); }
|
|||
| tHYPER m_int { $$ = type_new_int(TYPE_BASIC_HYPER, 0); }
|
||||
| tINT64 { $$ = type_new_int(TYPE_BASIC_INT64, 0); }
|
||||
| tCHAR { $$ = type_new_int(TYPE_BASIC_CHAR, 0); }
|
||||
| tINT3264 { $$ = type_new_int(TYPE_BASIC_INT3264, 0); }
|
||||
;
|
||||
|
||||
coclass: tCOCLASS aIDENTIFIER { $$ = type_new_coclass($2); }
|
||||
|
@ -944,11 +945,104 @@ direct_declarator:
|
|||
}
|
||||
;
|
||||
|
||||
/* abstract declarator */
|
||||
abstract_declarator:
|
||||
'*' m_type_qual_list m_abstract_declarator %prec PPTR
|
||||
{ $$ = $3; $$->type = append_ptrchain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
|
||||
| callconv m_abstract_declarator { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
|
||||
| abstract_direct_declarator
|
||||
;
|
||||
|
||||
/* abstract declarator without accepting direct declarator */
|
||||
abstract_declarator_no_direct:
|
||||
'*' m_type_qual_list m_any_declarator %prec PPTR
|
||||
{ $$ = $3; $$->type = append_ptrchain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
|
||||
| callconv m_any_declarator { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
|
||||
;
|
||||
|
||||
/* abstract declarator or empty */
|
||||
m_abstract_declarator: { $$ = make_declarator(NULL); }
|
||||
| abstract_declarator
|
||||
;
|
||||
|
||||
/* abstract direct declarator */
|
||||
abstract_direct_declarator:
|
||||
'(' abstract_declarator_no_direct ')' { $$ = $2; }
|
||||
| abstract_direct_declarator array { $$ = $1; $$->array = append_array($$->array, $2); }
|
||||
| array { $$ = make_declarator(NULL); $$->array = append_array($$->array, $1); }
|
||||
| '(' m_args ')'
|
||||
{ $$ = make_declarator(NULL);
|
||||
$$->func_type = append_ptrchain_type($$->type, type_new_function($2));
|
||||
$$->type = NULL;
|
||||
}
|
||||
| abstract_direct_declarator '(' m_args ')'
|
||||
{ $$ = $1;
|
||||
$$->func_type = append_ptrchain_type($$->type, type_new_function($3));
|
||||
$$->type = NULL;
|
||||
}
|
||||
;
|
||||
|
||||
/* abstract or non-abstract declarator */
|
||||
any_declarator:
|
||||
'*' m_type_qual_list m_any_declarator %prec PPTR
|
||||
{ $$ = $3; $$->type = append_ptrchain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
|
||||
| callconv m_any_declarator { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
|
||||
| any_direct_declarator
|
||||
;
|
||||
|
||||
/* abstract or non-abstract declarator without accepting direct declarator */
|
||||
any_declarator_no_direct:
|
||||
'*' m_type_qual_list m_any_declarator %prec PPTR
|
||||
{ $$ = $3; $$->type = append_ptrchain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
|
||||
| callconv m_any_declarator { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
|
||||
;
|
||||
|
||||
/* abstract or non-abstract declarator or empty */
|
||||
m_any_declarator: { $$ = make_declarator(NULL); }
|
||||
| any_declarator
|
||||
;
|
||||
|
||||
/* abstract or non-abstract direct declarator. note: direct declarators
|
||||
* aren't accepted inside brackets to avoid ambiguity with the rule for
|
||||
* function arguments */
|
||||
any_direct_declarator:
|
||||
ident { $$ = make_declarator($1); }
|
||||
| '(' any_declarator_no_direct ')' { $$ = $2; }
|
||||
| any_direct_declarator array { $$ = $1; $$->array = append_array($$->array, $2); }
|
||||
| array { $$ = make_declarator(NULL); $$->array = append_array($$->array, $1); }
|
||||
| '(' m_args ')'
|
||||
{ $$ = make_declarator(NULL);
|
||||
$$->func_type = append_ptrchain_type($$->type, type_new_function($2));
|
||||
$$->type = NULL;
|
||||
}
|
||||
| any_direct_declarator '(' m_args ')'
|
||||
{ $$ = $1;
|
||||
$$->func_type = append_ptrchain_type($$->type, type_new_function($3));
|
||||
$$->type = NULL;
|
||||
}
|
||||
;
|
||||
|
||||
declarator_list:
|
||||
declarator { $$ = append_declarator( NULL, $1 ); }
|
||||
| declarator_list ',' declarator { $$ = append_declarator( $1, $3 ); }
|
||||
;
|
||||
|
||||
m_bitfield: { $$ = NULL; }
|
||||
| ':' expr_const { $$ = $2; }
|
||||
;
|
||||
|
||||
struct_declarator: any_declarator m_bitfield { $$ = $1; $$->bits = $2;
|
||||
if (!$$->bits && !$$->var->name)
|
||||
error_loc("unnamed fields are not allowed");
|
||||
}
|
||||
;
|
||||
|
||||
struct_declarator_list:
|
||||
struct_declarator { $$ = append_declarator( NULL, $1 ); }
|
||||
| struct_declarator_list ',' struct_declarator
|
||||
{ $$ = append_declarator( $1, $3 ); }
|
||||
;
|
||||
|
||||
init_declarator:
|
||||
declarator { $$ = $1; }
|
||||
| declarator '=' expr_const { $$ = $1; $1->var->eval = $3; }
|
||||
|
@ -1237,6 +1331,38 @@ static void type_function_add_head_arg(type_t *type, var_t *arg)
|
|||
list_add_head( type->details.function->args, &arg->entry );
|
||||
}
|
||||
|
||||
static int is_allowed_range_type(const type_t *type)
|
||||
{
|
||||
switch (type_get_type(type))
|
||||
{
|
||||
case TYPE_ENUM:
|
||||
return TRUE;
|
||||
case TYPE_BASIC:
|
||||
switch (type_basic_get_type(type))
|
||||
{
|
||||
case TYPE_BASIC_INT8:
|
||||
case TYPE_BASIC_INT16:
|
||||
case TYPE_BASIC_INT32:
|
||||
case TYPE_BASIC_INT64:
|
||||
case TYPE_BASIC_INT:
|
||||
case TYPE_BASIC_INT3264:
|
||||
case TYPE_BASIC_BYTE:
|
||||
case TYPE_BASIC_CHAR:
|
||||
case TYPE_BASIC_WCHAR:
|
||||
case TYPE_BASIC_HYPER:
|
||||
return TRUE;
|
||||
case TYPE_BASIC_FLOAT:
|
||||
case TYPE_BASIC_DOUBLE:
|
||||
case TYPE_BASIC_ERROR_STATUS_T:
|
||||
case TYPE_BASIC_HANDLE:
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type)
|
||||
{
|
||||
type_t *ptrchain_type;
|
||||
|
@ -1249,11 +1375,12 @@ static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type)
|
|||
return ptrchain;
|
||||
}
|
||||
|
||||
static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
|
||||
int top)
|
||||
static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const declarator_t *decl,
|
||||
int top)
|
||||
{
|
||||
expr_list_t *sizes = get_attrp(v->attrs, ATTR_SIZEIS);
|
||||
expr_list_t *lengs = get_attrp(v->attrs, ATTR_LENGTHIS);
|
||||
var_t *v = decl->var;
|
||||
expr_list_t *sizes = get_attrp(attrs, ATTR_SIZEIS);
|
||||
expr_list_t *lengs = get_attrp(attrs, ATTR_LENGTHIS);
|
||||
int sizeless;
|
||||
expr_t *dim;
|
||||
type_t **ptype;
|
||||
|
@ -1278,6 +1405,7 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
|
|||
/* add type onto the end of the pointers in pident->type */
|
||||
v->type = append_ptrchain_type(decl ? decl->type : NULL, type);
|
||||
v->stgclass = decl_spec->stgclass;
|
||||
v->attrs = attrs;
|
||||
|
||||
/* check for pointer attribute being applied to non-pointer, non-array
|
||||
* type */
|
||||
|
@ -1316,9 +1444,26 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
|
|||
error_loc("%s: pointer attribute applied to non-pointer type\n", v->name);
|
||||
}
|
||||
|
||||
if (is_attr(v->attrs, ATTR_STRING) && !is_ptr(v->type) && !arr)
|
||||
error_loc("'%s': [string] attribute applied to non-pointer, non-array type\n",
|
||||
v->name);
|
||||
if (is_attr(v->attrs, ATTR_STRING))
|
||||
{
|
||||
type_t *t = type;
|
||||
|
||||
if (!is_ptr(v->type) && !arr)
|
||||
error_loc("'%s': [string] attribute applied to non-pointer, non-array type\n",
|
||||
v->name);
|
||||
|
||||
while (is_ptr(t))
|
||||
t = type_pointer_get_ref(t);
|
||||
|
||||
if (type_get_type(t) != TYPE_BASIC &&
|
||||
(get_basic_fc(t) != RPC_FC_CHAR &&
|
||||
get_basic_fc(t) != RPC_FC_BYTE &&
|
||||
get_basic_fc(t) != RPC_FC_WCHAR))
|
||||
{
|
||||
error_loc("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays\n",
|
||||
v->name);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_attr(v->attrs, ATTR_V1ENUM))
|
||||
{
|
||||
|
@ -1326,6 +1471,10 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
|
|||
error_loc("'%s': [v1_enum] attribute applied to non-enum type\n", v->name);
|
||||
}
|
||||
|
||||
if (is_attr(v->attrs, ATTR_RANGE) && !is_allowed_range_type(v->type))
|
||||
error_loc("'%s': [range] attribute applied to non-integer type\n",
|
||||
v->name);
|
||||
|
||||
ptype = &v->type;
|
||||
sizeless = FALSE;
|
||||
if (arr) LIST_FOR_EACH_ENTRY_REV(dim, arr, expr_t, entry)
|
||||
|
@ -1442,6 +1591,11 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
|
|||
if (is_attr(t->attrs, ATTR_CALLCONV))
|
||||
error_loc("calling convention applied to non-function-pointer type\n");
|
||||
}
|
||||
|
||||
if (decl->bits)
|
||||
v->type = type_new_bitfield(v->type, decl->bits);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_list_t *decls)
|
||||
|
@ -1451,13 +1605,11 @@ static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, dec
|
|||
|
||||
LIST_FOR_EACH_ENTRY_SAFE( decl, next, decls, declarator_t, entry )
|
||||
{
|
||||
var_t *var = decl->var;
|
||||
|
||||
var->attrs = attrs;
|
||||
set_type(var, decl_spec, decl, 0);
|
||||
var_t *var = declare_var(attrs, decl_spec, decl, 0);
|
||||
var_list = append_var(var_list, var);
|
||||
free(decl);
|
||||
}
|
||||
free(decl_spec);
|
||||
return var_list;
|
||||
}
|
||||
|
||||
|
@ -1531,10 +1683,11 @@ static declarator_list_t *append_declarator(declarator_list_t *list, declarator_
|
|||
static declarator_t *make_declarator(var_t *var)
|
||||
{
|
||||
declarator_t *d = xmalloc(sizeof(*d));
|
||||
d->var = var;
|
||||
d->var = var ? var : make_var(NULL);
|
||||
d->type = NULL;
|
||||
d->func_type = NULL;
|
||||
d->array = NULL;
|
||||
d->bits = NULL;
|
||||
return d;
|
||||
}
|
||||
|
||||
|
@ -1675,27 +1828,8 @@ static void fix_incomplete_types(type_t *complete_type)
|
|||
static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, attr_list_t *attrs)
|
||||
{
|
||||
const declarator_t *decl;
|
||||
int is_str = is_attr(attrs, ATTR_STRING);
|
||||
type_t *type = decl_spec->type;
|
||||
|
||||
if (is_str)
|
||||
{
|
||||
type_t *t = decl_spec->type;
|
||||
|
||||
while (is_ptr(t))
|
||||
t = type_pointer_get_ref(t);
|
||||
|
||||
if (type_get_type(t) != TYPE_BASIC &&
|
||||
(get_basic_fc(t) != RPC_FC_CHAR &&
|
||||
get_basic_fc(t) != RPC_FC_BYTE &&
|
||||
get_basic_fc(t) != RPC_FC_WCHAR))
|
||||
{
|
||||
decl = LIST_ENTRY( list_head( decls ), const declarator_t, entry );
|
||||
error_loc("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays\n",
|
||||
decl->var->name);
|
||||
}
|
||||
}
|
||||
|
||||
/* We must generate names for tagless enum, struct or union.
|
||||
Typedef-ing a tagless enum, struct or union means we want the typedef
|
||||
to be included in a library hence the public attribute. */
|
||||
|
@ -1714,20 +1848,18 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
|
|||
|
||||
LIST_FOR_EACH_ENTRY( decl, decls, const declarator_t, entry )
|
||||
{
|
||||
var_t *name = decl->var;
|
||||
|
||||
if (name->name) {
|
||||
if (decl->var->name) {
|
||||
type_t *cur;
|
||||
var_t *name;
|
||||
|
||||
cur = find_type(name->name, 0);
|
||||
cur = find_type(decl->var->name, 0);
|
||||
if (cur)
|
||||
error_loc("%s: redefinition error; original definition was at %s:%d\n",
|
||||
cur->name, cur->loc_info.input_name,
|
||||
cur->loc_info.line_number);
|
||||
|
||||
/* set the attributes to allow set_type to do some checks on them */
|
||||
name->attrs = attrs;
|
||||
set_type(name, decl_spec, decl, 0);
|
||||
name = declare_var(attrs, decl_spec, decl, 0);
|
||||
cur = type_new_alias(name->type, name->name);
|
||||
cur->attrs = attrs;
|
||||
|
||||
|
@ -1872,6 +2004,7 @@ struct allowed_attr allowed_attr[] =
|
|||
{
|
||||
/* attr { D ACF I Fn ARG T En St Un Fi L DI M C <display name> } */
|
||||
/* ATTR_AGGREGATABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "aggregatable" },
|
||||
/* ATTR_ANNOTATION */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "annotation" },
|
||||
/* ATTR_APPOBJECT */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "appobject" },
|
||||
/* ATTR_ASYNC */ { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "async" },
|
||||
/* ATTR_AUTO_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "auto_handle" },
|
||||
|
@ -1977,14 +2110,10 @@ static attr_list_t *check_function_attrs(const char *name, attr_list_t *attrs)
|
|||
return attrs;
|
||||
}
|
||||
|
||||
static void check_arg(var_t *arg)
|
||||
static void check_arg_attrs(const var_t *arg)
|
||||
{
|
||||
const type_t *t = arg->type;
|
||||
const attr_t *attr;
|
||||
|
||||
if (type_get_type(t) == TYPE_VOID)
|
||||
error_loc("argument '%s' has void type\n", arg->name);
|
||||
|
||||
if (arg->attrs)
|
||||
{
|
||||
LIST_FOR_EACH_ENTRY(attr, arg->attrs, const attr_t, entry)
|
||||
|
@ -2150,6 +2279,7 @@ static int is_allowed_conf_type(const type_t *type)
|
|||
case TYPE_COCLASS:
|
||||
case TYPE_FUNCTION:
|
||||
case TYPE_INTERFACE:
|
||||
case TYPE_BITFIELD:
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -2193,24 +2323,30 @@ static void check_field_common(const type_t *container_type,
|
|||
{
|
||||
type_t *type = arg->type;
|
||||
int more_to_do;
|
||||
const char *container_type_name = NULL;
|
||||
const char *container_type_name;
|
||||
const char *var_type;
|
||||
|
||||
switch (type_get_type_detect_alias(type))
|
||||
switch (type_get_type(container_type))
|
||||
{
|
||||
case TYPE_STRUCT:
|
||||
container_type_name = "struct";
|
||||
var_type = "field";
|
||||
break;
|
||||
case TYPE_UNION:
|
||||
container_type_name = "union";
|
||||
var_type = "arm";
|
||||
break;
|
||||
case TYPE_ENCAPSULATED_UNION:
|
||||
container_type_name = "encapsulated union";
|
||||
var_type = "arm";
|
||||
break;
|
||||
case TYPE_FUNCTION:
|
||||
container_type_name = "function";
|
||||
var_type = "parameter";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
/* should be no other container types */
|
||||
assert(0);
|
||||
}
|
||||
|
||||
if (is_attr(arg->attrs, ATTR_LENGTHIS) &&
|
||||
|
@ -2270,28 +2406,48 @@ static void check_field_common(const type_t *container_type,
|
|||
check_remoting_fields(arg, type);
|
||||
break;
|
||||
case TGT_INVALID:
|
||||
{
|
||||
const char *reason = "is invalid";
|
||||
switch (type_get_type(type))
|
||||
{
|
||||
case TYPE_VOID:
|
||||
error_loc_info(&arg->loc_info, "parameter \'%s\' of %s \'%s\' cannot derive from void *\n",
|
||||
arg->name, container_type_name, container_name);
|
||||
reason = "cannot derive from void *";
|
||||
break;
|
||||
case TYPE_FUNCTION:
|
||||
error_loc_info(&arg->loc_info, "parameter \'%s\' of %s \'%s\' cannot be a function pointer\n",
|
||||
arg->name, container_type_name, container_name);
|
||||
reason = "cannot be a function pointer";
|
||||
break;
|
||||
case TYPE_BITFIELD:
|
||||
reason = "cannot be a bit-field";
|
||||
break;
|
||||
case TYPE_COCLASS:
|
||||
reason = "cannot be a class";
|
||||
break;
|
||||
case TYPE_INTERFACE:
|
||||
reason = "cannot be a non-pointer to an interface";
|
||||
break;
|
||||
case TYPE_MODULE:
|
||||
/* FIXME */
|
||||
reason = "cannot be a module";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
error_loc_info(&arg->loc_info, "%s \'%s\' of %s \'%s\' %s\n",
|
||||
var_type, arg->name, container_type_name, container_name, reason);
|
||||
break;
|
||||
}
|
||||
case TGT_CTXT_HANDLE:
|
||||
case TGT_CTXT_HANDLE_POINTER:
|
||||
/* FIXME */
|
||||
break;
|
||||
case TGT_STRING:
|
||||
{
|
||||
const type_t *t = type;
|
||||
while (is_ptr(t))
|
||||
t = type_pointer_get_ref(t);
|
||||
if (is_aliaschain_attr(t, ATTR_RANGE))
|
||||
warning_loc_info(&arg->loc_info, "%s: range not verified for a string of ranged types\n", arg->name);
|
||||
break;
|
||||
}
|
||||
case TGT_POINTER:
|
||||
type = type_pointer_get_ref(type);
|
||||
more_to_do = TRUE;
|
||||
|
@ -2301,10 +2457,10 @@ static void check_field_common(const type_t *container_type,
|
|||
more_to_do = TRUE;
|
||||
break;
|
||||
case TGT_USER_TYPE:
|
||||
case TGT_STRING:
|
||||
case TGT_IFACE_POINTER:
|
||||
case TGT_BASIC:
|
||||
case TGT_ENUM:
|
||||
case TGT_RANGE:
|
||||
/* nothing to do */
|
||||
break;
|
||||
}
|
||||
|
@ -2354,6 +2510,7 @@ static void check_remoting_args(const var_t *func)
|
|||
{
|
||||
case TGT_BASIC:
|
||||
case TGT_ENUM:
|
||||
case TGT_RANGE:
|
||||
case TGT_STRUCT:
|
||||
case TGT_UNION:
|
||||
case TGT_CTXT_HANDLE:
|
||||
|
@ -2381,6 +2538,16 @@ static void check_remoting_args(const var_t *func)
|
|||
|
||||
check_field_common(func->type, funcname, arg);
|
||||
}
|
||||
|
||||
if (type_get_type(type_function_get_rettype(func->type)) != TYPE_VOID)
|
||||
{
|
||||
var_t var;
|
||||
var = *func;
|
||||
var.type = type_function_get_rettype(func->type);
|
||||
var.name = xstrdup("return value");
|
||||
check_field_common(func->type, funcname, &var);
|
||||
free(var.name);
|
||||
}
|
||||
}
|
||||
|
||||
static void add_explicit_handle_if_necessary(var_t *func)
|
||||
|
|
|
@ -301,25 +301,26 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
|
|||
*yy_cp = '\0'; \
|
||||
yy_c_buf_p = yy_cp;
|
||||
|
||||
#define YY_NUM_RULES 32
|
||||
#define YY_END_OF_BUFFER 33
|
||||
static yyconst short int yy_accept[139] =
|
||||
#define YY_NUM_RULES 33
|
||||
#define YY_END_OF_BUFFER 34
|
||||
static yyconst short int yy_accept[142] =
|
||||
{ 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
|
||||
33, 31, 21, 20, 31, 3, 31, 31, 16, 16,
|
||||
31, 31, 31, 19, 19, 19, 11, 31, 21, 1,
|
||||
10, 32, 4, 10, 6, 16, 16, 13, 13, 13,
|
||||
12, 2, 26, 30, 24, 0, 16, 16, 16, 0,
|
||||
22, 28, 25, 27, 23, 19, 5, 19, 29, 0,
|
||||
1, 1, 9, 8, 7, 16, 0, 13, 13, 2,
|
||||
17, 16, 16, 15, 19, 16, 0, 13, 0, 15,
|
||||
15, 19, 16, 0, 13, 0, 17, 15, 15, 19,
|
||||
16, 0, 13, 19, 16, 0, 13, 19, 16, 0,
|
||||
34, 32, 21, 20, 32, 3, 32, 32, 32, 16,
|
||||
16, 32, 32, 32, 19, 19, 19, 11, 32, 21,
|
||||
1, 10, 33, 4, 10, 6, 16, 16, 13, 13,
|
||||
13, 12, 2, 26, 30, 24, 0, 0, 16, 16,
|
||||
16, 0, 22, 28, 25, 27, 23, 19, 5, 19,
|
||||
29, 0, 1, 1, 9, 8, 7, 16, 0, 13,
|
||||
13, 2, 31, 17, 16, 16, 15, 19, 16, 0,
|
||||
13, 0, 15, 15, 19, 16, 0, 13, 0, 17,
|
||||
15, 15, 19, 16, 0, 13, 19, 16, 0, 13,
|
||||
|
||||
13, 19, 16, 0, 13, 19, 0, 16, 0, 18,
|
||||
19, 16, 0, 13, 19, 16, 0, 13, 19, 0,
|
||||
16, 0, 18, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 14, 0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 14,
|
||||
0
|
||||
} ;
|
||||
|
||||
static yyconst int yy_ec[256] =
|
||||
|
@ -362,112 +363,112 @@ static yyconst int yy_meta[36] =
|
|||
3, 4, 4, 4, 1
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_base[175] =
|
||||
static yyconst short int yy_base[178] =
|
||||
{ 0,
|
||||
0, 34, 34, 38, 39, 42, 71, 44, 268, 267,
|
||||
265, 491, 491, 491, 249, 491, 256, 241, 96, 22,
|
||||
37, 241, 38, 0, 250, 237, 491, 218, 53, 249,
|
||||
491, 491, 491, 33, 491, 119, 23, 142, 165, 245,
|
||||
491, 0, 491, 491, 491, 48, 0, 33, 88, 0,
|
||||
491, 491, 491, 491, 491, 0, 491, 228, 491, 63,
|
||||
241, 240, 491, 491, 491, 185, 0, 207, 0, 0,
|
||||
104, 491, 491, 124, 222, 227, 0, 249, 102, 94,
|
||||
102, 220, 269, 0, 291, 113, 168, 491, 491, 213,
|
||||
311, 0, 333, 212, 353, 0, 375, 217, 395, 0,
|
||||
0, 34, 34, 38, 39, 42, 71, 44, 270, 269,
|
||||
271, 491, 491, 491, 255, 491, 258, 248, 252, 96,
|
||||
22, 37, 242, 38, 0, 251, 238, 491, 219, 53,
|
||||
251, 491, 491, 491, 33, 491, 119, 23, 142, 165,
|
||||
246, 491, 0, 491, 491, 491, 239, 48, 0, 33,
|
||||
88, 0, 491, 491, 491, 491, 491, 0, 491, 228,
|
||||
491, 63, 241, 240, 491, 491, 491, 185, 0, 207,
|
||||
0, 0, 491, 104, 491, 491, 124, 222, 227, 0,
|
||||
249, 102, 94, 102, 220, 269, 0, 291, 113, 168,
|
||||
491, 491, 213, 311, 0, 333, 212, 353, 0, 375,
|
||||
|
||||
417, 206, 439, 222, 221, 62, 0, 220, 140, 491,
|
||||
0, 0, 0, 219, 0, 0, 0, 0, 218, 0,
|
||||
0, 0, 0, 213, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 491, 491, 472, 476,
|
||||
478, 482, 486, 219, 218, 212, 211, 210, 209, 208,
|
||||
206, 205, 203, 198, 197, 192, 191, 190, 189, 188,
|
||||
187, 186, 185, 183, 176, 169, 168, 167, 155, 144,
|
||||
140, 137, 130, 110
|
||||
217, 395, 0, 417, 206, 439, 222, 221, 62, 0,
|
||||
220, 140, 491, 0, 0, 0, 219, 0, 0, 0,
|
||||
0, 218, 0, 0, 0, 0, 213, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 491,
|
||||
491, 472, 476, 478, 482, 486, 219, 218, 212, 211,
|
||||
210, 209, 208, 206, 205, 203, 198, 197, 192, 191,
|
||||
190, 189, 188, 187, 186, 185, 183, 176, 169, 168,
|
||||
167, 155, 144, 140, 137, 130, 110
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_def[175] =
|
||||
static yyconst short int yy_def[178] =
|
||||
{ 0,
|
||||
138, 1, 139, 139, 139, 139, 138, 7, 140, 140,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 19,
|
||||
138, 138, 138, 141, 141, 141, 138, 138, 138, 138,
|
||||
138, 138, 138, 142, 138, 138, 36, 138, 38, 39,
|
||||
138, 143, 138, 138, 138, 138, 20, 138, 138, 144,
|
||||
138, 138, 138, 138, 138, 141, 138, 141, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 145, 39, 39, 143,
|
||||
138, 138, 138, 144, 141, 138, 146, 39, 138, 138,
|
||||
138, 141, 138, 147, 39, 138, 138, 138, 138, 141,
|
||||
138, 148, 39, 141, 138, 149, 39, 141, 138, 150,
|
||||
141, 1, 142, 142, 142, 142, 141, 7, 143, 143,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
20, 141, 141, 141, 144, 144, 144, 141, 141, 141,
|
||||
141, 141, 141, 141, 145, 141, 141, 37, 141, 39,
|
||||
40, 141, 146, 141, 141, 141, 141, 141, 21, 141,
|
||||
141, 147, 141, 141, 141, 141, 141, 144, 141, 144,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 148, 40,
|
||||
40, 146, 141, 141, 141, 141, 147, 144, 141, 149,
|
||||
40, 141, 141, 141, 144, 141, 150, 40, 141, 141,
|
||||
141, 141, 144, 141, 151, 40, 144, 141, 152, 40,
|
||||
|
||||
39, 141, 138, 138, 39, 141, 151, 103, 138, 138,
|
||||
152, 153, 154, 138, 155, 156, 157, 158, 138, 159,
|
||||
160, 161, 162, 138, 163, 164, 165, 166, 167, 168,
|
||||
169, 170, 171, 172, 173, 174, 138, 0, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138
|
||||
144, 141, 153, 40, 144, 141, 141, 40, 144, 154,
|
||||
106, 141, 141, 155, 156, 157, 141, 158, 159, 160,
|
||||
161, 141, 162, 163, 164, 165, 141, 166, 167, 168,
|
||||
169, 170, 171, 172, 173, 174, 175, 176, 177, 141,
|
||||
0, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_nxt[527] =
|
||||
{ 0,
|
||||
12, 13, 14, 15, 16, 12, 17, 12, 12, 18,
|
||||
12, 19, 20, 21, 22, 23, 24, 24, 24, 24,
|
||||
24, 25, 24, 26, 24, 24, 24, 27, 12, 12,
|
||||
24, 24, 24, 24, 28, 29, 32, 64, 33, 30,
|
||||
32, 32, 33, 35, 32, 29, 35, 138, 138, 30,
|
||||
51, 52, 54, 55, 60, 138, 138, 72, 61, 71,
|
||||
71, 65, 34, 109, 60, 72, 34, 34, 61, 110,
|
||||
34, 12, 13, 14, 15, 16, 12, 17, 12, 12,
|
||||
18, 12, 36, 37, 21, 22, 23, 38, 38, 38,
|
||||
38, 39, 40, 39, 39, 39, 39, 39, 27, 12,
|
||||
19, 20, 21, 22, 23, 24, 25, 25, 25, 25,
|
||||
25, 26, 25, 27, 25, 25, 25, 28, 12, 12,
|
||||
25, 25, 25, 25, 29, 30, 33, 66, 34, 31,
|
||||
33, 33, 34, 36, 33, 30, 36, 141, 141, 31,
|
||||
53, 54, 56, 57, 62, 141, 141, 75, 63, 74,
|
||||
74, 67, 35, 112, 62, 75, 35, 35, 63, 113,
|
||||
35, 12, 13, 14, 15, 16, 12, 17, 12, 12,
|
||||
18, 19, 37, 38, 22, 23, 24, 39, 39, 39,
|
||||
39, 40, 41, 40, 40, 40, 40, 40, 28, 12,
|
||||
|
||||
41, 38, 39, 39, 39, 28, 46, 47, 47, 73,
|
||||
86, 86, 137, 87, 87, 71, 71, 48, 88, 73,
|
||||
49, 50, 79, 89, 87, 87, 88, 48, 49, 50,
|
||||
66, 66, 136, 89, 79, 67, 67, 67, 67, 135,
|
||||
48, 109, 134, 49, 50, 80, 133, 110, 81, 67,
|
||||
48, 49, 50, 68, 68, 80, 81, 132, 68, 68,
|
||||
68, 68, 69, 69, 69, 69, 69, 69, 69, 131,
|
||||
130, 129, 68, 69, 69, 69, 69, 69, 128, 87,
|
||||
87, 69, 69, 69, 69, 127, 79, 126, 124, 123,
|
||||
122, 121, 119, 118, 117, 69, 76, 76, 79, 116,
|
||||
42, 39, 40, 40, 40, 29, 48, 49, 49, 76,
|
||||
89, 89, 140, 90, 90, 74, 74, 50, 91, 76,
|
||||
51, 52, 82, 92, 90, 90, 91, 50, 51, 52,
|
||||
68, 68, 139, 92, 82, 69, 69, 69, 69, 138,
|
||||
50, 112, 137, 51, 52, 83, 136, 113, 84, 69,
|
||||
50, 51, 52, 70, 70, 83, 84, 135, 70, 70,
|
||||
70, 70, 71, 71, 71, 71, 71, 71, 71, 134,
|
||||
133, 132, 70, 71, 71, 71, 71, 71, 131, 90,
|
||||
90, 71, 71, 71, 71, 130, 82, 129, 127, 126,
|
||||
125, 124, 122, 121, 120, 71, 79, 79, 82, 119,
|
||||
|
||||
114, 77, 77, 77, 77, 113, 48, 112, 111, 49,
|
||||
104, 100, 96, 92, 84, 77, 48, 49, 78, 78,
|
||||
77, 74, 125, 78, 78, 78, 78, 120, 115, 138,
|
||||
107, 107, 106, 102, 98, 94, 90, 78, 83, 83,
|
||||
82, 62, 62, 84, 84, 84, 84, 75, 48, 57,
|
||||
62, 49, 59, 58, 57, 53, 45, 84, 48, 49,
|
||||
85, 85, 44, 43, 138, 85, 85, 85, 85, 32,
|
||||
32, 138, 138, 138, 138, 138, 138, 138, 138, 85,
|
||||
91, 91, 138, 138, 138, 92, 92, 92, 92, 138,
|
||||
48, 138, 138, 49, 138, 138, 138, 138, 138, 92,
|
||||
117, 80, 80, 80, 80, 116, 50, 115, 114, 51,
|
||||
107, 103, 99, 95, 87, 80, 50, 51, 81, 81,
|
||||
80, 77, 128, 81, 81, 81, 81, 123, 118, 141,
|
||||
110, 110, 109, 105, 101, 97, 93, 81, 86, 86,
|
||||
85, 64, 64, 87, 87, 87, 87, 78, 50, 73,
|
||||
59, 51, 64, 61, 60, 59, 55, 87, 50, 51,
|
||||
88, 88, 47, 46, 45, 88, 88, 88, 88, 44,
|
||||
141, 33, 33, 141, 141, 141, 141, 141, 141, 88,
|
||||
94, 94, 141, 141, 141, 95, 95, 95, 95, 141,
|
||||
50, 141, 141, 51, 141, 141, 141, 141, 141, 95,
|
||||
|
||||
48, 49, 93, 93, 138, 138, 138, 93, 93, 93,
|
||||
93, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 93, 95, 95, 138, 138, 138, 96, 96, 96,
|
||||
96, 138, 48, 138, 138, 49, 138, 138, 138, 138,
|
||||
138, 96, 48, 49, 97, 97, 138, 138, 138, 97,
|
||||
97, 97, 97, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 97, 99, 99, 138, 138, 138, 100,
|
||||
100, 100, 100, 138, 48, 138, 138, 49, 138, 138,
|
||||
138, 138, 138, 100, 48, 49, 101, 101, 138, 138,
|
||||
138, 101, 101, 101, 101, 138, 138, 138, 138, 138,
|
||||
50, 51, 96, 96, 141, 141, 141, 96, 96, 96,
|
||||
96, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 96, 98, 98, 141, 141, 141, 99, 99, 99,
|
||||
99, 141, 50, 141, 141, 51, 141, 141, 141, 141,
|
||||
141, 99, 50, 51, 100, 100, 141, 141, 141, 100,
|
||||
100, 100, 100, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 100, 102, 102, 141, 141, 141, 103,
|
||||
103, 103, 103, 141, 50, 141, 141, 51, 141, 141,
|
||||
141, 141, 141, 103, 50, 51, 104, 104, 141, 141,
|
||||
141, 104, 104, 104, 104, 141, 141, 141, 141, 141,
|
||||
|
||||
138, 138, 138, 138, 138, 101, 103, 103, 138, 138,
|
||||
138, 104, 104, 104, 104, 138, 48, 138, 138, 49,
|
||||
138, 138, 138, 138, 138, 104, 48, 49, 105, 105,
|
||||
138, 138, 138, 105, 105, 105, 105, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 138, 105, 107, 138,
|
||||
108, 108, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
48, 138, 138, 49, 138, 138, 138, 138, 138, 138,
|
||||
48, 49, 31, 31, 31, 31, 42, 42, 42, 42,
|
||||
56, 56, 63, 138, 63, 63, 70, 138, 70, 70,
|
||||
11, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
141, 141, 141, 141, 141, 104, 106, 106, 141, 141,
|
||||
141, 107, 107, 107, 107, 141, 50, 141, 141, 51,
|
||||
141, 141, 141, 141, 141, 107, 50, 51, 108, 108,
|
||||
141, 141, 141, 108, 108, 108, 108, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 108, 110, 141,
|
||||
111, 111, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
50, 141, 141, 51, 141, 141, 141, 141, 141, 141,
|
||||
50, 51, 32, 32, 32, 32, 43, 43, 43, 43,
|
||||
58, 58, 65, 141, 65, 65, 72, 141, 72, 72,
|
||||
11, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_chk[527] =
|
||||
|
@ -475,61 +476,61 @@ static yyconst short int yy_chk[527] =
|
|||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 2, 3, 34, 3, 2,
|
||||
4, 5, 4, 5, 6, 8, 6, 20, 37, 8,
|
||||
21, 21, 23, 23, 29, 20, 37, 48, 29, 46,
|
||||
46, 34, 3, 106, 60, 48, 4, 5, 60, 106,
|
||||
1, 1, 1, 1, 1, 2, 3, 35, 3, 2,
|
||||
4, 5, 4, 5, 6, 8, 6, 21, 38, 8,
|
||||
22, 22, 24, 24, 30, 21, 38, 50, 30, 48,
|
||||
48, 35, 3, 109, 62, 50, 4, 5, 62, 109,
|
||||
6, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
|
||||
7, 7, 7, 7, 7, 7, 19, 19, 19, 49,
|
||||
79, 79, 174, 79, 79, 71, 71, 19, 80, 49,
|
||||
19, 19, 71, 81, 86, 86, 80, 19, 19, 19,
|
||||
36, 36, 173, 81, 71, 36, 36, 36, 36, 172,
|
||||
36, 109, 171, 36, 36, 74, 170, 109, 74, 36,
|
||||
36, 36, 36, 38, 38, 74, 74, 169, 38, 38,
|
||||
38, 38, 38, 38, 38, 38, 38, 38, 38, 168,
|
||||
167, 166, 38, 38, 38, 38, 39, 39, 165, 87,
|
||||
87, 39, 39, 39, 39, 164, 87, 163, 162, 161,
|
||||
160, 159, 158, 157, 156, 39, 66, 66, 87, 155,
|
||||
7, 7, 7, 7, 7, 7, 20, 20, 20, 51,
|
||||
82, 82, 177, 82, 82, 74, 74, 20, 83, 51,
|
||||
20, 20, 74, 84, 89, 89, 83, 20, 20, 20,
|
||||
37, 37, 176, 84, 74, 37, 37, 37, 37, 175,
|
||||
37, 112, 174, 37, 37, 77, 173, 112, 77, 37,
|
||||
37, 37, 37, 39, 39, 77, 77, 172, 39, 39,
|
||||
39, 39, 39, 39, 39, 39, 39, 39, 39, 171,
|
||||
170, 169, 39, 39, 39, 39, 40, 40, 168, 90,
|
||||
90, 40, 40, 40, 40, 167, 90, 166, 165, 164,
|
||||
163, 162, 161, 160, 159, 40, 68, 68, 90, 158,
|
||||
|
||||
154, 66, 66, 66, 66, 153, 66, 152, 151, 66,
|
||||
150, 149, 148, 147, 146, 66, 66, 66, 68, 68,
|
||||
145, 144, 124, 68, 68, 68, 68, 119, 114, 108,
|
||||
105, 104, 102, 98, 94, 90, 82, 68, 76, 76,
|
||||
75, 62, 61, 76, 76, 76, 76, 58, 76, 40,
|
||||
30, 76, 28, 26, 25, 22, 18, 76, 76, 76,
|
||||
78, 78, 17, 15, 11, 78, 78, 78, 78, 10,
|
||||
9, 0, 0, 0, 0, 0, 0, 0, 0, 78,
|
||||
83, 83, 0, 0, 0, 83, 83, 83, 83, 0,
|
||||
83, 0, 0, 83, 0, 0, 0, 0, 0, 83,
|
||||
157, 68, 68, 68, 68, 156, 68, 155, 154, 68,
|
||||
153, 152, 151, 150, 149, 68, 68, 68, 70, 70,
|
||||
148, 147, 127, 70, 70, 70, 70, 122, 117, 111,
|
||||
108, 107, 105, 101, 97, 93, 85, 70, 79, 79,
|
||||
78, 64, 63, 79, 79, 79, 79, 60, 79, 47,
|
||||
41, 79, 31, 29, 27, 26, 23, 79, 79, 79,
|
||||
81, 81, 19, 18, 17, 81, 81, 81, 81, 15,
|
||||
11, 10, 9, 0, 0, 0, 0, 0, 0, 81,
|
||||
86, 86, 0, 0, 0, 86, 86, 86, 86, 0,
|
||||
86, 0, 0, 86, 0, 0, 0, 0, 0, 86,
|
||||
|
||||
83, 83, 85, 85, 0, 0, 0, 85, 85, 85,
|
||||
85, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 85, 91, 91, 0, 0, 0, 91, 91, 91,
|
||||
91, 0, 91, 0, 0, 91, 0, 0, 0, 0,
|
||||
0, 91, 91, 91, 93, 93, 0, 0, 0, 93,
|
||||
93, 93, 93, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 93, 95, 95, 0, 0, 0, 95,
|
||||
95, 95, 95, 0, 95, 0, 0, 95, 0, 0,
|
||||
0, 0, 0, 95, 95, 95, 97, 97, 0, 0,
|
||||
0, 97, 97, 97, 97, 0, 0, 0, 0, 0,
|
||||
86, 86, 88, 88, 0, 0, 0, 88, 88, 88,
|
||||
88, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 88, 94, 94, 0, 0, 0, 94, 94, 94,
|
||||
94, 0, 94, 0, 0, 94, 0, 0, 0, 0,
|
||||
0, 94, 94, 94, 96, 96, 0, 0, 0, 96,
|
||||
96, 96, 96, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 96, 98, 98, 0, 0, 0, 98,
|
||||
98, 98, 98, 0, 98, 0, 0, 98, 0, 0,
|
||||
0, 0, 0, 98, 98, 98, 100, 100, 0, 0,
|
||||
0, 100, 100, 100, 100, 0, 0, 0, 0, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 97, 99, 99, 0, 0,
|
||||
0, 99, 99, 99, 99, 0, 99, 0, 0, 99,
|
||||
0, 0, 0, 0, 0, 99, 99, 99, 101, 101,
|
||||
0, 0, 0, 101, 101, 101, 101, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 101, 103, 0,
|
||||
103, 103, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
103, 0, 0, 103, 0, 0, 0, 0, 0, 0,
|
||||
103, 103, 139, 139, 139, 139, 140, 140, 140, 140,
|
||||
141, 141, 142, 0, 142, 142, 143, 0, 143, 143,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
0, 0, 0, 0, 0, 100, 102, 102, 0, 0,
|
||||
0, 102, 102, 102, 102, 0, 102, 0, 0, 102,
|
||||
0, 0, 0, 0, 0, 102, 102, 102, 104, 104,
|
||||
0, 0, 0, 104, 104, 104, 104, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 104, 106, 0,
|
||||
106, 106, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
106, 0, 0, 106, 0, 0, 0, 0, 0, 0,
|
||||
106, 106, 142, 142, 142, 142, 143, 143, 143, 143,
|
||||
144, 144, 145, 0, 145, 145, 146, 0, 146, 146,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141
|
||||
} ;
|
||||
|
||||
static yy_state_type yy_last_accepting_state;
|
||||
|
@ -661,7 +662,7 @@ UUID *parse_uuid(const char *u)
|
|||
* The flexer starts here
|
||||
**************************************************************************
|
||||
*/
|
||||
#line 665 "parser.yy.c"
|
||||
#line 666 "parser.yy.c"
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
|
@ -817,7 +818,7 @@ YY_DECL
|
|||
|
||||
#line 127 "parser.l"
|
||||
|
||||
#line 821 "parser.yy.c"
|
||||
#line 822 "parser.yy.c"
|
||||
|
||||
if ( yy_init )
|
||||
{
|
||||
|
@ -869,7 +870,7 @@ yy_match:
|
|||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 139 )
|
||||
if ( yy_current_state >= 142 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
|
@ -1092,6 +1093,11 @@ return LOGICALAND;
|
|||
case 31:
|
||||
YY_RULE_SETUP
|
||||
#line 196 "parser.l"
|
||||
return ELLIPSIS;
|
||||
YY_BREAK
|
||||
case 32:
|
||||
YY_RULE_SETUP
|
||||
#line 197 "parser.l"
|
||||
return yytext[0];
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
|
@ -1099,19 +1105,19 @@ case YY_STATE_EOF(QUOTE):
|
|||
case YY_STATE_EOF(WSTRQUOTE):
|
||||
case YY_STATE_EOF(ATTR):
|
||||
case YY_STATE_EOF(PP_LINE):
|
||||
#line 197 "parser.l"
|
||||
#line 198 "parser.l"
|
||||
{
|
||||
if (import_stack_ptr)
|
||||
return aEOF;
|
||||
else yyterminate();
|
||||
}
|
||||
YY_BREAK
|
||||
case 32:
|
||||
case 33:
|
||||
YY_RULE_SETUP
|
||||
#line 202 "parser.l"
|
||||
#line 203 "parser.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 1115 "parser.yy.c"
|
||||
#line 1121 "parser.yy.c"
|
||||
|
||||
case YY_END_OF_BUFFER:
|
||||
{
|
||||
|
@ -1402,7 +1408,7 @@ static yy_state_type yy_get_previous_state()
|
|||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 139 )
|
||||
if ( yy_current_state >= 142 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
|
@ -1437,11 +1443,11 @@ yy_state_type yy_current_state;
|
|||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 139 )
|
||||
if ( yy_current_state >= 142 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
yy_is_jam = (yy_current_state == 138);
|
||||
yy_is_jam = (yy_current_state == 141);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
|
@ -1997,7 +2003,7 @@ int main()
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
#line 202 "parser.l"
|
||||
#line 203 "parser.l"
|
||||
|
||||
|
||||
#ifndef parser_wrap
|
||||
|
@ -2019,6 +2025,7 @@ static const struct keyword keywords[] = {
|
|||
{"TRUE", tTRUE},
|
||||
{"__cdecl", tCDECL},
|
||||
{"__fastcall", tFASTCALL},
|
||||
{"__int3264", tINT3264},
|
||||
{"__int64", tINT64},
|
||||
{"__pascal", tPASCAL},
|
||||
{"__stdcall", tSTDCALL},
|
||||
|
@ -2078,6 +2085,7 @@ static const struct keyword attr_keywords[] =
|
|||
{
|
||||
{"aggregatable", tAGGREGATABLE},
|
||||
{"allocate", tALLOCATE},
|
||||
{"annotation", tANNOTATION},
|
||||
{"appobject", tAPPOBJECT},
|
||||
{"async", tASYNC},
|
||||
{"async_uuid", tASYNCUUID},
|
||||
|
|
|
@ -116,12 +116,27 @@ const char *string_of_type(unsigned char type)
|
|||
case RPC_FC_C_WSTRING: return "FC_C_WSTRING";
|
||||
case RPC_FC_CSTRING: return "FC_CSTRING";
|
||||
case RPC_FC_WSTRING: return "FC_WSTRING";
|
||||
case RPC_FC_INT3264: return "FC_INT3264";
|
||||
case RPC_FC_UINT3264: return "FC_UINT3264";
|
||||
default:
|
||||
error("string_of_type: unknown type 0x%02x\n", type);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void *get_aliaschain_attrp(const type_t *type, enum attr_type attr)
|
||||
{
|
||||
const type_t *t = type;
|
||||
for (;;)
|
||||
{
|
||||
if (is_attr(t->attrs, attr))
|
||||
return get_attrp(t->attrs, attr);
|
||||
else if (type_is_alias(t))
|
||||
t = type_alias_get_aliasee(t);
|
||||
else return 0;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char get_basic_fc(const type_t *type)
|
||||
{
|
||||
int sign = type_basic_get_sign(type);
|
||||
|
@ -132,6 +147,7 @@ unsigned char get_basic_fc(const type_t *type)
|
|||
case TYPE_BASIC_INT32: return (sign <= 0 ? RPC_FC_LONG : RPC_FC_ULONG);
|
||||
case TYPE_BASIC_INT64: return RPC_FC_HYPER;
|
||||
case TYPE_BASIC_INT: return (sign <= 0 ? RPC_FC_LONG : RPC_FC_ULONG);
|
||||
case TYPE_BASIC_INT3264: return (sign <= 0 ? RPC_FC_INT3264 : RPC_FC_UINT3264);
|
||||
case TYPE_BASIC_BYTE: return RPC_FC_BYTE;
|
||||
case TYPE_BASIC_CHAR: return RPC_FC_CHAR;
|
||||
case TYPE_BASIC_WCHAR: return RPC_FC_WCHAR;
|
||||
|
@ -140,8 +156,8 @@ unsigned char get_basic_fc(const type_t *type)
|
|||
case TYPE_BASIC_DOUBLE: return RPC_FC_DOUBLE;
|
||||
case TYPE_BASIC_ERROR_STATUS_T: return RPC_FC_ERROR_STATUS_T;
|
||||
case TYPE_BASIC_HANDLE: return RPC_FC_BIND_PRIMITIVE;
|
||||
default: return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned int clamp_align(unsigned int align)
|
||||
|
@ -200,8 +216,14 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att
|
|||
switch (type_get_type(type))
|
||||
{
|
||||
case TYPE_BASIC:
|
||||
if (!(flags & TDT_IGNORE_RANGES) &&
|
||||
(is_attr(attrs, ATTR_RANGE) || is_aliaschain_attr(type, ATTR_RANGE)))
|
||||
return TGT_RANGE;
|
||||
return TGT_BASIC;
|
||||
case TYPE_ENUM:
|
||||
if (!(flags & TDT_IGNORE_RANGES) &&
|
||||
(is_attr(attrs, ATTR_RANGE) || is_aliaschain_attr(type, ATTR_RANGE)))
|
||||
return TGT_RANGE;
|
||||
return TGT_ENUM;
|
||||
case TYPE_POINTER:
|
||||
if (type_get_type(type_pointer_get_ref(type)) == TYPE_INTERFACE ||
|
||||
|
@ -224,69 +246,12 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att
|
|||
case TYPE_MODULE:
|
||||
case TYPE_VOID:
|
||||
case TYPE_ALIAS:
|
||||
case TYPE_BITFIELD:
|
||||
break;
|
||||
}
|
||||
return TGT_INVALID;
|
||||
}
|
||||
|
||||
static type_t *get_user_type(const type_t *t, const char **pname);
|
||||
|
||||
static int type_contains_iface(const type_t *type)
|
||||
{
|
||||
enum typegen_type typegen_type;
|
||||
var_list_t *fields;
|
||||
const var_t *field;
|
||||
|
||||
typegen_type = typegen_detect_type(type, type->attrs, TDT_IGNORE_STRINGS);
|
||||
|
||||
switch(typegen_type)
|
||||
{
|
||||
case TGT_USER_TYPE:
|
||||
return type_contains_iface(get_user_type(type, NULL));
|
||||
|
||||
case TGT_BASIC:
|
||||
case TGT_ENUM:
|
||||
return FALSE;
|
||||
|
||||
case TGT_POINTER:
|
||||
return type_contains_iface(type_pointer_get_ref(type));
|
||||
|
||||
case TGT_ARRAY:
|
||||
return type_contains_iface(type_array_get_element(type));
|
||||
|
||||
case TGT_IFACE_POINTER:
|
||||
return TRUE;
|
||||
|
||||
case TGT_STRUCT:
|
||||
fields = type_struct_get_fields(type);
|
||||
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
|
||||
{
|
||||
if(type_contains_iface(field->type))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
case TGT_UNION:
|
||||
fields = type_union_get_cases(type);
|
||||
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
|
||||
{
|
||||
if(field->type && type_contains_iface(field->type))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
case TGT_STRING:
|
||||
/* shouldn't get here because of TDT_IGNORE_STRINGS above. fall through */
|
||||
case TGT_INVALID:
|
||||
case TGT_CTXT_HANDLE:
|
||||
case TGT_CTXT_HANDLE_POINTER:
|
||||
/* checking after parsing should mean that we don't get here. if we do,
|
||||
* it's a checker bug */
|
||||
assert(0);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
unsigned char get_struct_fc(const type_t *type)
|
||||
{
|
||||
int has_pointer = 0;
|
||||
|
@ -340,15 +305,15 @@ unsigned char get_struct_fc(const type_t *type)
|
|||
case TGT_IFACE_POINTER:
|
||||
return RPC_FC_BOGUS_STRUCT;
|
||||
case TGT_BASIC:
|
||||
if (type_basic_get_type(t) == TYPE_BASIC_INT3264 && pointer_size != 4)
|
||||
return RPC_FC_BOGUS_STRUCT;
|
||||
break;
|
||||
case TGT_ENUM:
|
||||
if (get_enum_fc(t) == RPC_FC_ENUM16)
|
||||
return RPC_FC_BOGUS_STRUCT;
|
||||
break;
|
||||
case TGT_ARRAY:
|
||||
if(type_contains_iface(type_array_get_element(t)))
|
||||
return RPC_FC_BOGUS_STRUCT;
|
||||
case TGT_POINTER:
|
||||
case TGT_ARRAY:
|
||||
if (get_pointer_fc(t, field->attrs, FALSE) == RPC_FC_RP || pointer_size != 4)
|
||||
return RPC_FC_BOGUS_STRUCT;
|
||||
has_pointer = 1;
|
||||
|
@ -397,6 +362,8 @@ unsigned char get_struct_fc(const type_t *type)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case TGT_RANGE:
|
||||
return RPC_FC_BOGUS_STRUCT;
|
||||
case TGT_STRING:
|
||||
/* shouldn't get here because of TDT_IGNORE_STRINGS above. fall through */
|
||||
case TGT_INVALID:
|
||||
|
@ -460,6 +427,11 @@ unsigned char get_array_fc(const type_t *type)
|
|||
case TGT_USER_TYPE:
|
||||
fc = RPC_FC_BOGUS_ARRAY;
|
||||
break;
|
||||
case TGT_BASIC:
|
||||
if (type_basic_get_type(elem_type) == TYPE_BASIC_INT3264 &&
|
||||
pointer_size != 4)
|
||||
fc = RPC_FC_BOGUS_ARRAY;
|
||||
break;
|
||||
case TGT_STRUCT:
|
||||
switch (get_struct_fc(elem_type))
|
||||
{
|
||||
|
@ -485,7 +457,9 @@ unsigned char get_array_fc(const type_t *type)
|
|||
if (get_pointer_fc(elem_type, NULL, FALSE) == RPC_FC_RP || pointer_size != 4)
|
||||
fc = RPC_FC_BOGUS_ARRAY;
|
||||
break;
|
||||
case TGT_BASIC:
|
||||
case TGT_RANGE:
|
||||
fc = RPC_FC_BOGUS_ARRAY;
|
||||
break;
|
||||
case TGT_CTXT_HANDLE:
|
||||
case TGT_CTXT_HANDLE_POINTER:
|
||||
case TGT_STRING:
|
||||
|
@ -559,6 +533,7 @@ static int type_has_pointers(const type_t *type)
|
|||
case TGT_IFACE_POINTER:
|
||||
case TGT_BASIC:
|
||||
case TGT_ENUM:
|
||||
case TGT_RANGE:
|
||||
case TGT_INVALID:
|
||||
break;
|
||||
}
|
||||
|
@ -612,6 +587,7 @@ static int type_has_full_pointer(const type_t *type, const attr_list_t *attrs,
|
|||
case TGT_IFACE_POINTER:
|
||||
case TGT_BASIC:
|
||||
case TGT_ENUM:
|
||||
case TGT_RANGE:
|
||||
case TGT_INVALID:
|
||||
break;
|
||||
}
|
||||
|
@ -1258,6 +1234,12 @@ unsigned int type_memsize(const type_t *t, unsigned int *align)
|
|||
size = 8;
|
||||
if (size > *align) *align = size;
|
||||
break;
|
||||
case RPC_FC_INT3264:
|
||||
case RPC_FC_UINT3264:
|
||||
assert( pointer_size );
|
||||
size = pointer_size;
|
||||
if (size > *align) *align = size;
|
||||
break;
|
||||
default:
|
||||
error("type_memsize: Unknown type 0x%x\n", get_basic_fc(t));
|
||||
size = 0;
|
||||
|
@ -1315,10 +1297,11 @@ unsigned int type_memsize(const type_t *t, unsigned int *align)
|
|||
case TYPE_COCLASS:
|
||||
case TYPE_MODULE:
|
||||
case TYPE_FUNCTION:
|
||||
case TYPE_BITFIELD:
|
||||
/* these types should not be encountered here due to language
|
||||
* restrictions (interface, void, coclass, module), logical
|
||||
* restrictions (alias - due to type_get_type call above) or
|
||||
* checking restrictions (function). */
|
||||
* checking restrictions (function, bitfield). */
|
||||
assert(0);
|
||||
}
|
||||
|
||||
|
@ -2737,6 +2720,33 @@ static unsigned int write_contexthandle_tfs(FILE *file, const type_t *type,
|
|||
return start_offset;
|
||||
}
|
||||
|
||||
static unsigned int write_range_tfs(FILE *file, const attr_list_t *attrs,
|
||||
type_t *type, expr_list_t *range_list,
|
||||
unsigned int *typeformat_offset)
|
||||
{
|
||||
unsigned char fc;
|
||||
unsigned int start_offset = *typeformat_offset;
|
||||
const expr_t *range_min = LIST_ENTRY(list_head(range_list), const expr_t, entry);
|
||||
const expr_t *range_max = LIST_ENTRY(list_next(range_list, list_head(range_list)), const expr_t, entry);
|
||||
|
||||
if (type_get_type(type) == TYPE_BASIC)
|
||||
fc = get_basic_fc(type);
|
||||
else
|
||||
fc = get_enum_fc(type);
|
||||
|
||||
/* fc must fit in lower 4-bits of 8-bit field below */
|
||||
assert(fc <= 0xf);
|
||||
|
||||
print_file(file, 0, "/* %u */\n", *typeformat_offset);
|
||||
print_file(file, 2, "0x%x,\t/* FC_RANGE */\n", RPC_FC_RANGE);
|
||||
print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc));
|
||||
print_file(file, 2, "NdrFcLong(0x%lx),\t/* %lu */\n", range_min->cval, range_min->cval);
|
||||
print_file(file, 2, "NdrFcLong(0x%lx),\t/* %lu */\n", range_max->cval, range_max->cval);
|
||||
*typeformat_offset += 10;
|
||||
|
||||
return start_offset;
|
||||
}
|
||||
|
||||
static unsigned int write_typeformatstring_var(FILE *file, int indent, const var_t *func,
|
||||
type_t *type, const var_t *var,
|
||||
int toplevel_param,
|
||||
|
@ -2784,6 +2794,13 @@ static unsigned int write_typeformatstring_var(FILE *file, int indent, const var
|
|||
case TGT_BASIC:
|
||||
/* nothing to do */
|
||||
return 0;
|
||||
case TGT_RANGE:
|
||||
{
|
||||
expr_list_t *range_list = get_attrp(var->attrs, ATTR_RANGE);
|
||||
if (!range_list)
|
||||
range_list = get_aliaschain_attrp(type, ATTR_RANGE);
|
||||
return write_range_tfs(file, var->attrs, type, range_list, typeformat_offset);
|
||||
}
|
||||
case TGT_IFACE_POINTER:
|
||||
return write_ip_tfs(file, var->attrs, type, typeformat_offset);
|
||||
case TGT_POINTER:
|
||||
|
@ -2888,6 +2905,14 @@ static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *ty
|
|||
case TGT_BASIC:
|
||||
/* nothing to do */
|
||||
break;
|
||||
case TGT_RANGE:
|
||||
{
|
||||
expr_list_t *range_list = get_attrp(attrs, ATTR_RANGE);
|
||||
if (!range_list)
|
||||
range_list = get_aliaschain_attrp(type, ATTR_RANGE);
|
||||
write_range_tfs(file, attrs, type, range_list, tfsoff);
|
||||
break;
|
||||
}
|
||||
case TGT_CTXT_HANDLE:
|
||||
case TGT_CTXT_HANDLE_POINTER:
|
||||
case TGT_INVALID:
|
||||
|
@ -2989,7 +3014,7 @@ static unsigned int get_required_buffer_size_type(
|
|||
const type_t *type, const char *name, const attr_list_t *attrs, int toplevel_param, unsigned int *alignment)
|
||||
{
|
||||
*alignment = 0;
|
||||
switch (typegen_detect_type(type, NULL, TDT_IGNORE_STRINGS))
|
||||
switch (typegen_detect_type(type, NULL, TDT_IGNORE_STRINGS|TDT_IGNORE_RANGES))
|
||||
{
|
||||
case TGT_USER_TYPE:
|
||||
{
|
||||
|
@ -3025,6 +3050,12 @@ static unsigned int get_required_buffer_size_type(
|
|||
*alignment = 8;
|
||||
return 8;
|
||||
|
||||
case RPC_FC_INT3264:
|
||||
case RPC_FC_UINT3264:
|
||||
assert( pointer_size );
|
||||
*alignment = pointer_size;
|
||||
return pointer_size;
|
||||
|
||||
case RPC_FC_IGNORE:
|
||||
case RPC_FC_BIND_PRIMITIVE:
|
||||
return 0;
|
||||
|
@ -3064,6 +3095,7 @@ static unsigned int get_required_buffer_size_type(
|
|||
{
|
||||
case TGT_BASIC:
|
||||
case TGT_ENUM:
|
||||
case TGT_RANGE:
|
||||
return get_required_buffer_size_type( ref, name, NULL, FALSE, alignment );
|
||||
case TGT_STRUCT:
|
||||
if (get_struct_fc(ref) == RPC_FC_STRUCT)
|
||||
|
@ -3191,28 +3223,36 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
|
|||
type_t *type = var->type;
|
||||
unsigned int size;
|
||||
unsigned int alignment = 0;
|
||||
const type_t *ref;
|
||||
|
||||
/* no work to do for other phases, buffer sizing is done elsewhere */
|
||||
if (phase != PHASE_MARSHAL && phase != PHASE_UNMARSHAL)
|
||||
return;
|
||||
|
||||
ref = is_ptr(type) ? type_pointer_get_ref(type) : type;
|
||||
if (type_get_type(ref) == TYPE_ENUM)
|
||||
if (type_get_type(type) == TYPE_ENUM ||
|
||||
(type_get_type(type) == TYPE_BASIC &&
|
||||
type_basic_get_type(type) == TYPE_BASIC_INT3264 &&
|
||||
pointer_size != 4))
|
||||
{
|
||||
if (get_enum_fc(ref) == RPC_FC_ENUM32)
|
||||
{
|
||||
size = 4;
|
||||
alignment = 4;
|
||||
}
|
||||
else /* RPC_FC_ENUM16 */
|
||||
{
|
||||
size = 2;
|
||||
alignment = 2;
|
||||
}
|
||||
unsigned char fc;
|
||||
|
||||
if (type_get_type(type) == TYPE_ENUM)
|
||||
fc = get_enum_fc(type);
|
||||
else
|
||||
fc = get_basic_fc(type);
|
||||
|
||||
if (phase == PHASE_MARSHAL)
|
||||
print_file(file, indent, "NdrSimpleTypeMarshall(\n");
|
||||
else
|
||||
print_file(file, indent, "NdrSimpleTypeUnmarshall(\n");
|
||||
print_file(file, indent+1, "&__frame->_StubMsg,\n");
|
||||
print_file(file, indent+1, "(unsigned char *)&%s%s,\n",
|
||||
local_var_prefix,
|
||||
var->name);
|
||||
print_file(file, indent+1, "0x%02x /* %s */);\n", fc, string_of_type(fc));
|
||||
}
|
||||
else
|
||||
{
|
||||
const type_t *ref = is_ptr(type) ? type_pointer_get_ref(type) : type;
|
||||
switch (get_basic_fc(ref))
|
||||
{
|
||||
case RPC_FC_BYTE:
|
||||
|
@ -3234,6 +3274,9 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
|
|||
case RPC_FC_LONG:
|
||||
case RPC_FC_FLOAT:
|
||||
case RPC_FC_ERROR_STATUS_T:
|
||||
/* pointer_size must be 4 if we got here in these two cases */
|
||||
case RPC_FC_INT3264:
|
||||
case RPC_FC_UINT3264:
|
||||
size = 4;
|
||||
alignment = 4;
|
||||
break;
|
||||
|
@ -3254,46 +3297,46 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
|
|||
var->name, get_basic_fc(ref));
|
||||
size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (phase == PHASE_MARSHAL)
|
||||
print_file(file, indent, "MIDL_memset(__frame->_StubMsg.Buffer, 0, (0x%x - (ULONG_PTR)__frame->_StubMsg.Buffer) & 0x%x);\n", alignment, alignment - 1);
|
||||
print_file(file, indent, "__frame->_StubMsg.Buffer = (unsigned char *)(((ULONG_PTR)__frame->_StubMsg.Buffer + %u) & ~0x%x);\n",
|
||||
alignment - 1, alignment - 1);
|
||||
if (phase == PHASE_MARSHAL)
|
||||
print_file(file, indent, "MIDL_memset(__frame->_StubMsg.Buffer, 0, (0x%x - (ULONG_PTR)__frame->_StubMsg.Buffer) & 0x%x);\n", alignment, alignment - 1);
|
||||
print_file(file, indent, "__frame->_StubMsg.Buffer = (unsigned char *)(((ULONG_PTR)__frame->_StubMsg.Buffer + %u) & ~0x%x);\n",
|
||||
alignment - 1, alignment - 1);
|
||||
|
||||
if (phase == PHASE_MARSHAL)
|
||||
{
|
||||
print_file(file, indent, "*(");
|
||||
write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL);
|
||||
if (is_ptr(type))
|
||||
fprintf(file, " *)__frame->_StubMsg.Buffer = *");
|
||||
else
|
||||
fprintf(file, " *)__frame->_StubMsg.Buffer = ");
|
||||
fprintf(file, "%s%s", local_var_prefix, varname);
|
||||
fprintf(file, ";\n");
|
||||
}
|
||||
else if (phase == PHASE_UNMARSHAL)
|
||||
{
|
||||
print_file(file, indent, "if (__frame->_StubMsg.Buffer + sizeof(");
|
||||
write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL);
|
||||
fprintf(file, ") > __frame->_StubMsg.BufferEnd)\n");
|
||||
print_file(file, indent, "{\n");
|
||||
print_file(file, indent + 1, "RpcRaiseException(RPC_X_BAD_STUB_DATA);\n");
|
||||
print_file(file, indent, "}\n");
|
||||
print_file(file, indent, "%s%s%s",
|
||||
(pass == PASS_IN || pass == PASS_RETURN) ? "" : "*",
|
||||
local_var_prefix, varname);
|
||||
if (pass == PASS_IN && is_ptr(type))
|
||||
fprintf(file, " = (");
|
||||
else
|
||||
fprintf(file, " = *(");
|
||||
write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL);
|
||||
fprintf(file, " *)__frame->_StubMsg.Buffer;\n");
|
||||
}
|
||||
if (phase == PHASE_MARSHAL)
|
||||
{
|
||||
print_file(file, indent, "*(");
|
||||
write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL);
|
||||
if (is_ptr(type))
|
||||
fprintf(file, " *)__frame->_StubMsg.Buffer = *");
|
||||
else
|
||||
fprintf(file, " *)__frame->_StubMsg.Buffer = ");
|
||||
fprintf(file, "%s%s", local_var_prefix, varname);
|
||||
fprintf(file, ";\n");
|
||||
}
|
||||
else if (phase == PHASE_UNMARSHAL)
|
||||
{
|
||||
print_file(file, indent, "if (__frame->_StubMsg.Buffer + sizeof(");
|
||||
write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL);
|
||||
fprintf(file, ") > __frame->_StubMsg.BufferEnd)\n");
|
||||
print_file(file, indent, "{\n");
|
||||
print_file(file, indent + 1, "RpcRaiseException(RPC_X_BAD_STUB_DATA);\n");
|
||||
print_file(file, indent, "}\n");
|
||||
print_file(file, indent, "%s%s%s",
|
||||
(pass == PASS_IN || pass == PASS_RETURN) ? "" : "*",
|
||||
local_var_prefix, varname);
|
||||
if (pass == PASS_IN && is_ptr(type))
|
||||
fprintf(file, " = (");
|
||||
else
|
||||
fprintf(file, " = *(");
|
||||
write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL);
|
||||
fprintf(file, " *)__frame->_StubMsg.Buffer;\n");
|
||||
}
|
||||
|
||||
print_file(file, indent, "__frame->_StubMsg.Buffer += sizeof(");
|
||||
write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL);
|
||||
fprintf(file, ");\n");
|
||||
print_file(file, indent, "__frame->_StubMsg.Buffer += sizeof(");
|
||||
write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL);
|
||||
fprintf(file, ");\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* returns whether the MaxCount, Offset or ActualCount members need to be
|
||||
|
@ -3546,21 +3589,33 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
|
|||
break;
|
||||
}
|
||||
case TGT_BASIC:
|
||||
if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL)
|
||||
print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name);
|
||||
print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name);
|
||||
break;
|
||||
case TGT_ENUM:
|
||||
if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL)
|
||||
print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name);
|
||||
break;
|
||||
case TGT_RANGE:
|
||||
print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name);
|
||||
/* Note: this goes beyond what MIDL does - it only supports arguments
|
||||
* with the [range] attribute in Oicf mode */
|
||||
if (phase == PHASE_UNMARSHAL)
|
||||
{
|
||||
if (phase == PHASE_MARSHAL)
|
||||
print_file(file, indent, "NdrSimpleTypeMarshall(\n");
|
||||
else
|
||||
print_file(file, indent, "NdrSimpleTypeUnmarshall(\n");
|
||||
print_file(file, indent+1, "&__frame->_StubMsg,\n");
|
||||
print_file(file, indent+1, "(unsigned char *)&%s%s,\n",
|
||||
local_var_prefix,
|
||||
var->name);
|
||||
print_file(file, indent+1, "0x%02x /* %s */);\n", get_enum_fc(type), string_of_type(get_enum_fc(type)));
|
||||
const expr_t *range_min;
|
||||
const expr_t *range_max;
|
||||
expr_list_t *range_list = get_attrp(var->attrs, ATTR_RANGE);
|
||||
if (!range_list)
|
||||
range_list = get_aliaschain_attrp(type, ATTR_RANGE);
|
||||
range_min = LIST_ENTRY(list_head(range_list), const expr_t, entry);
|
||||
range_max = LIST_ENTRY(list_next(range_list, list_head(range_list)), const expr_t, entry);
|
||||
|
||||
print_file(file, indent, "if ((%s%s < (", local_var_prefix, var->name);
|
||||
write_type_decl(file, var->type, NULL);
|
||||
fprintf(file, ")0x%lx) || (%s%s > (", range_min->cval, local_var_prefix, var->name);
|
||||
write_type_decl(file, var->type, NULL);
|
||||
fprintf(file, ")0x%lx))\n", range_max->cval);
|
||||
print_file(file, indent, "{\n");
|
||||
print_file(file, indent+1, "RpcRaiseException(RPC_S_INVALID_BOUND);\n");
|
||||
print_file(file, indent, "}\n");
|
||||
}
|
||||
break;
|
||||
case TGT_STRUCT:
|
||||
|
@ -3603,23 +3658,19 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
|
|||
case TGT_POINTER:
|
||||
{
|
||||
const type_t *ref = type_pointer_get_ref(type);
|
||||
if (pointer_type == RPC_FC_RP && !is_user_type(ref)) switch (type_get_type(ref))
|
||||
if (pointer_type == RPC_FC_RP) switch (typegen_detect_type(ref, NULL, TDT_ALL_TYPES))
|
||||
{
|
||||
case TYPE_BASIC:
|
||||
/* base types have known sizes, so don't need a sizing pass
|
||||
* and don't have any memory to free and so don't need a
|
||||
* freeing pass */
|
||||
if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL)
|
||||
print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name);
|
||||
case TGT_BASIC:
|
||||
print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name);
|
||||
break;
|
||||
case TYPE_ENUM:
|
||||
case TGT_ENUM:
|
||||
/* base types have known sizes, so don't need a sizing pass
|
||||
* and don't have any memory to free and so don't need a
|
||||
* freeing pass */
|
||||
if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL)
|
||||
print_phase_function(file, indent, "Pointer", local_var_prefix, phase, var, start_offset);
|
||||
break;
|
||||
case TYPE_STRUCT:
|
||||
case TGT_STRUCT:
|
||||
{
|
||||
const char *struct_type = NULL;
|
||||
switch (get_struct_fc(ref))
|
||||
|
@ -3665,8 +3716,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
|
|||
}
|
||||
break;
|
||||
}
|
||||
case TYPE_UNION:
|
||||
case TYPE_ENCAPSULATED_UNION:
|
||||
case TGT_UNION:
|
||||
{
|
||||
const char *union_type = NULL;
|
||||
if (phase == PHASE_FREE)
|
||||
|
@ -3685,16 +3735,17 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
|
|||
phase, var, start_offset);
|
||||
break;
|
||||
}
|
||||
case TYPE_POINTER:
|
||||
case TYPE_ARRAY:
|
||||
case TGT_STRING:
|
||||
case TGT_POINTER:
|
||||
case TGT_ARRAY:
|
||||
case TGT_RANGE:
|
||||
case TGT_IFACE_POINTER:
|
||||
case TGT_USER_TYPE:
|
||||
case TGT_CTXT_HANDLE:
|
||||
case TGT_CTXT_HANDLE_POINTER:
|
||||
print_phase_function(file, indent, "Pointer", local_var_prefix, phase, var, start_offset);
|
||||
break;
|
||||
case TYPE_VOID:
|
||||
case TYPE_ALIAS:
|
||||
case TYPE_MODULE:
|
||||
case TYPE_COCLASS:
|
||||
case TYPE_FUNCTION:
|
||||
case TYPE_INTERFACE:
|
||||
case TGT_INVALID:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
|
@ -3918,6 +3969,7 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
|
|||
case TGT_BASIC:
|
||||
case TGT_ENUM:
|
||||
case TGT_POINTER:
|
||||
case TGT_RANGE:
|
||||
print_file(file, indent, "%s_W%u = 0;\n", local_var_prefix, i);
|
||||
break;
|
||||
case TGT_STRUCT:
|
||||
|
|
|
@ -40,6 +40,7 @@ enum typegen_detect_flags
|
|||
{
|
||||
TDT_ALL_TYPES = 1 << 0,
|
||||
TDT_IGNORE_STRINGS = 1 << 1,
|
||||
TDT_IGNORE_RANGES = 1 << 2,
|
||||
};
|
||||
|
||||
enum typegen_type
|
||||
|
@ -56,6 +57,7 @@ enum typegen_type
|
|||
TGT_ENUM,
|
||||
TGT_STRUCT,
|
||||
TGT_UNION,
|
||||
TGT_RANGE,
|
||||
};
|
||||
|
||||
typedef int (*type_pred_t)(const type_t *);
|
||||
|
|
|
@ -180,6 +180,21 @@ unsigned short get_type_vt(type_t *t)
|
|||
return VT_UI8;
|
||||
else
|
||||
return VT_I8;
|
||||
case TYPE_BASIC_INT3264:
|
||||
if (typelib_kind == SYS_WIN64)
|
||||
{
|
||||
if (type_basic_get_sign(t) > 0)
|
||||
return VT_UI8;
|
||||
else
|
||||
return VT_I8;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type_basic_get_sign(t) > 0)
|
||||
return VT_UI4;
|
||||
else
|
||||
return VT_I4;
|
||||
}
|
||||
case TYPE_BASIC_FLOAT:
|
||||
return VT_R4;
|
||||
case TYPE_BASIC_DOUBLE:
|
||||
|
@ -228,6 +243,10 @@ unsigned short get_type_vt(type_t *t)
|
|||
case TYPE_FUNCTION:
|
||||
error("get_type_vt: functions not supported\n");
|
||||
break;
|
||||
|
||||
case TYPE_BITFIELD:
|
||||
error("get_type_vt: bitfields not supported\n");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,8 @@ enum VARENUM {
|
|||
VT_LPSTR = 30,
|
||||
VT_LPWSTR = 31,
|
||||
VT_RECORD = 36,
|
||||
VT_INT_PTR = 37,
|
||||
VT_UINT_PTR = 38,
|
||||
VT_FILETIME = 64,
|
||||
VT_BLOB = 65,
|
||||
VT_STREAM = 66,
|
||||
|
@ -70,6 +72,7 @@ enum VARENUM {
|
|||
VT_BLOB_OBJECT = 70,
|
||||
VT_CF = 71,
|
||||
VT_CLSID = 72,
|
||||
VT_VERSIONED_STREAM = 73,
|
||||
VT_BSTR_BLOB = 0xfff,
|
||||
VT_VECTOR = 0x1000,
|
||||
VT_ARRAY = 0x2000,
|
||||
|
|
|
@ -63,9 +63,63 @@ type_t *make_type(enum type_type type)
|
|||
return t;
|
||||
}
|
||||
|
||||
static const var_t *find_arg(const var_list_t *args, const char *name)
|
||||
{
|
||||
const var_t *arg;
|
||||
|
||||
if (args) LIST_FOR_EACH_ENTRY(arg, args, const var_t, entry)
|
||||
{
|
||||
if (arg->name && !strcmp(name, arg->name))
|
||||
return arg;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
type_t *type_new_function(var_list_t *args)
|
||||
{
|
||||
type_t *t = make_type(TYPE_FUNCTION);
|
||||
var_t *arg;
|
||||
type_t *t;
|
||||
unsigned int i = 0;
|
||||
|
||||
if (args)
|
||||
{
|
||||
arg = LIST_ENTRY(list_head(args), var_t, entry);
|
||||
if (list_count(args) == 1 && !arg->name && arg->type && type_get_type(arg->type) == TYPE_VOID)
|
||||
{
|
||||
list_remove(&arg->entry);
|
||||
free(arg);
|
||||
free(args);
|
||||
args = NULL;
|
||||
}
|
||||
}
|
||||
if (args) LIST_FOR_EACH_ENTRY(arg, args, var_t, entry)
|
||||
{
|
||||
if (arg->type && type_get_type(arg->type) == TYPE_VOID)
|
||||
error_loc("argument '%s' has void type\n", arg->name);
|
||||
if (!arg->name)
|
||||
{
|
||||
if (i > 26 * 26)
|
||||
error_loc("too many unnamed arguments\n");
|
||||
else
|
||||
{
|
||||
int unique;
|
||||
do
|
||||
{
|
||||
char name[3];
|
||||
name[0] = i > 26 ? 'a' + i / 26 : 'a' + i;
|
||||
name[1] = i > 26 ? 'a' + i % 26 : 0;
|
||||
name[2] = 0;
|
||||
unique = !find_arg(args, name);
|
||||
if (unique)
|
||||
arg->name = xstrdup(name);
|
||||
i++;
|
||||
} while (!unique);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
t = make_type(TYPE_FUNCTION);
|
||||
t->details.function = xmalloc(sizeof(*t->details.function));
|
||||
t->details.function->args = args;
|
||||
t->details.function->idx = -1;
|
||||
|
@ -248,6 +302,56 @@ type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *unio
|
|||
return t;
|
||||
}
|
||||
|
||||
static int is_valid_bitfield_type(const type_t *type)
|
||||
{
|
||||
switch (type_get_type(type))
|
||||
{
|
||||
case TYPE_ENUM:
|
||||
return TRUE;
|
||||
case TYPE_BASIC:
|
||||
switch (type_basic_get_type(type))
|
||||
{
|
||||
case TYPE_BASIC_INT8:
|
||||
case TYPE_BASIC_INT16:
|
||||
case TYPE_BASIC_INT32:
|
||||
case TYPE_BASIC_INT64:
|
||||
case TYPE_BASIC_INT:
|
||||
case TYPE_BASIC_INT3264:
|
||||
case TYPE_BASIC_CHAR:
|
||||
case TYPE_BASIC_HYPER:
|
||||
case TYPE_BASIC_BYTE:
|
||||
case TYPE_BASIC_WCHAR:
|
||||
case TYPE_BASIC_ERROR_STATUS_T:
|
||||
return TRUE;
|
||||
case TYPE_BASIC_FLOAT:
|
||||
case TYPE_BASIC_DOUBLE:
|
||||
case TYPE_BASIC_HANDLE:
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
type_t *type_new_bitfield(type_t *field, const expr_t *bits)
|
||||
{
|
||||
type_t *t;
|
||||
|
||||
if (!is_valid_bitfield_type(field))
|
||||
error_loc("bit-field has invalid type\n");
|
||||
|
||||
if (bits->cval < 0)
|
||||
error_loc("negative width for bit-field\n");
|
||||
|
||||
/* FIXME: validate bits->cval <= memsize(field) * 8 */
|
||||
|
||||
t = make_type(TYPE_BITFIELD);
|
||||
t->details.bitfield.field = field;
|
||||
t->details.bitfield.bits = bits;
|
||||
return t;
|
||||
}
|
||||
|
||||
static int compute_method_indexes(type_t *iface)
|
||||
{
|
||||
int idx;
|
||||
|
|
|
@ -39,6 +39,7 @@ type_t *type_new_enum(const char *name, int defined, var_list_t *enums);
|
|||
type_t *type_new_struct(char *name, int defined, var_list_t *fields);
|
||||
type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t *fields);
|
||||
type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases);
|
||||
type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
|
||||
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts);
|
||||
void type_dispinterface_define(type_t *iface, var_list_t *props, func_list_t *methods);
|
||||
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
|
||||
|
@ -190,6 +191,7 @@ static inline int type_is_complete(const type_t *type)
|
|||
case TYPE_COCLASS:
|
||||
case TYPE_POINTER:
|
||||
case TYPE_ARRAY:
|
||||
case TYPE_BITFIELD:
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -283,4 +285,18 @@ static inline unsigned char type_pointer_get_default_fc(const type_t *type)
|
|||
return type->details.pointer.def_fc;
|
||||
}
|
||||
|
||||
static inline type_t *type_bitfield_get_field(const type_t *type)
|
||||
{
|
||||
type = type_get_real_type(type);
|
||||
assert(type_get_type(type) == TYPE_BITFIELD);
|
||||
return type->details.bitfield.field;
|
||||
}
|
||||
|
||||
static inline const expr_t *type_bitfield_get_bits(const type_t *type)
|
||||
{
|
||||
type = type_get_real_type(type);
|
||||
assert(type_get_type(type) == TYPE_BITFIELD);
|
||||
return type->details.bitfield.bits;
|
||||
}
|
||||
|
||||
#endif /* WIDL_TYPE_TREE_H */
|
||||
|
|
|
@ -81,6 +81,7 @@ typedef struct list statement_list_t;
|
|||
enum attr_type
|
||||
{
|
||||
ATTR_AGGREGATABLE,
|
||||
ATTR_ANNOTATION,
|
||||
ATTR_APPOBJECT,
|
||||
ATTR_ASYNC,
|
||||
ATTR_AUTO_HANDLE,
|
||||
|
@ -238,6 +239,7 @@ enum type_basic_type
|
|||
TYPE_BASIC_INT32,
|
||||
TYPE_BASIC_INT64,
|
||||
TYPE_BASIC_INT,
|
||||
TYPE_BASIC_INT3264,
|
||||
TYPE_BASIC_CHAR,
|
||||
TYPE_BASIC_HYPER,
|
||||
TYPE_BASIC_BYTE,
|
||||
|
@ -350,6 +352,12 @@ struct pointer_details
|
|||
unsigned char def_fc;
|
||||
};
|
||||
|
||||
struct bitfield_details
|
||||
{
|
||||
struct _type_t *field;
|
||||
const expr_t *bits;
|
||||
};
|
||||
|
||||
enum type_type
|
||||
{
|
||||
TYPE_VOID,
|
||||
|
@ -365,6 +373,7 @@ enum type_type
|
|||
TYPE_INTERFACE,
|
||||
TYPE_POINTER,
|
||||
TYPE_ARRAY,
|
||||
TYPE_BITFIELD,
|
||||
};
|
||||
|
||||
struct _type_t {
|
||||
|
@ -382,6 +391,7 @@ struct _type_t {
|
|||
struct coclass_details coclass;
|
||||
struct basic_details basic;
|
||||
struct pointer_details pointer;
|
||||
struct bitfield_details bitfield;
|
||||
} details;
|
||||
type_t *orig; /* dup'd types */
|
||||
unsigned int typestring_offset;
|
||||
|
@ -415,6 +425,7 @@ struct _declarator_t {
|
|||
type_t *type;
|
||||
type_t *func_type;
|
||||
array_dims_t *array;
|
||||
expr_t *bits;
|
||||
|
||||
/* parser-internal */
|
||||
struct list entry;
|
||||
|
|
Loading…
Reference in a new issue