Rob Shearman : widl: Add support for strict context handles.
Alexandre Julliard
julliard at winehq.org
Mon Jan 7 08:39:23 CST 2008
Module: wine
Branch: master
Commit: 15af19c6ecf63cca7c1326d53cc637f2ecbf7067
URL: http://source.winehq.org/git/wine.git/?a=commit;h=15af19c6ecf63cca7c1326d53cc637f2ecbf7067
Author: Rob Shearman <rob at codeweavers.com>
Date: Sun Jan 6 21:25:50 2008 +0000
widl: Add support for strict context handles.
---
tools/widl/parser.l | 1 +
tools/widl/parser.y | 2 ++
tools/widl/typegen.c | 7 ++++++-
tools/widl/widltypes.h | 1 +
4 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index d2fd3c1..98f17af 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -299,6 +299,7 @@ static const struct keyword attr_keywords[] =
{"single", tSINGLE},
{"size_is", tSIZEIS},
{"source", tSOURCE},
+ {"strict_context_handle", tSTRICTCONTEXTHANDLE},
{"string", tSTRING},
{"switch_is", tSWITCHIS},
{"switch_type", tSWITCHTYPE},
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 6c8337e..499ae15 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -225,6 +225,7 @@ static void check_all_user_types(ifref_list_t *ifaces);
%token tSMALL
%token tSOURCE
%token tSTDCALL
+%token tSTRICTCONTEXTHANDLE
%token tSTRING tSTRUCT
%token tSWITCH tSWITCHIS tSWITCHTYPE
%token tTRANSMITAS
@@ -497,6 +498,7 @@ attribute: { $$ = NULL; }
| tRETVAL { $$ = make_attr(ATTR_RETVAL); }
| tSIZEIS '(' m_exprs ')' { $$ = make_attrp(ATTR_SIZEIS, $3); }
| tSOURCE { $$ = make_attr(ATTR_SOURCE); }
+ | tSTRICTCONTEXTHANDLE { $$ = make_attr(ATTR_STRICTCONTEXTHANDLE); }
| tSTRING { $$ = make_attr(ATTR_STRING); }
| tSWITCHIS '(' expr ')' { $$ = make_attrp(ATTR_SWITCHIS, $3); }
| tSWITCHTYPE '(' type ')' { $$ = make_attrp(ATTR_SWITCHTYPE, $3); }
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index b9d3306..3953b96 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -43,6 +43,7 @@
static const func_t *current_func;
static const type_t *current_structure;
+static const ifref_t *current_iface;
static struct list expr_eval_routines = LIST_INIT(expr_eval_routines);
struct expr_eval_routine
@@ -2057,7 +2058,10 @@ static size_t write_contexthandle_tfs(FILE *file, const type_t *type,
unsigned int *typeformat_offset)
{
size_t start_offset = *typeformat_offset;
- unsigned char flags = 0x08 /* strict */;
+ unsigned char flags = 0;
+
+ if (is_attr(current_iface->attrs, ATTR_STRICTCONTEXTHANDLE))
+ flags |= 0x08 /* strict */;
if (is_ptr(type))
{
@@ -2280,6 +2284,7 @@ static size_t process_tfs(FILE *file, const ifref_list_t *ifaces, type_pred_t pr
if (iface->iface->funcs)
{
const func_t *func;
+ current_iface = iface;
LIST_FOR_EACH_ENTRY( func, iface->iface->funcs, const func_t, entry )
{
if (is_local(func->def->attrs)) continue;
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 6930f71..acdc3f1 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -121,6 +121,7 @@ enum attr_type
ATTR_RETVAL,
ATTR_SIZEIS,
ATTR_SOURCE,
+ ATTR_STRICTCONTEXTHANDLE,
ATTR_STRING,
ATTR_SWITCHIS,
ATTR_SWITCHTYPE,
More information about the wine-cvs
mailing list