Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2b3659f3
Commit
2b3659f3
authored
Nov 07, 2009
by
Rob Shearman
Committed by
Alexandre Julliard
Nov 09, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Implement [range] attribute.
parent
c3676245
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
197 additions
and
14 deletions
+197
-14
server.c
dlls/rpcrt4/tests/server.c
+19
-0
server.idl
dlls/rpcrt4/tests/server.idl
+15
-0
parser.y
tools/widl/parser.y
+37
-0
typegen.c
tools/widl/typegen.c
+125
-14
typegen.h
tools/widl/typegen.h
+1
-0
No files found.
dlls/rpcrt4/tests/server.c
View file @
2b3659f3
...
...
@@ -571,6 +571,16 @@ s_get_filename(void)
return
(
char
*
)
__FILE__
;
}
int
s_echo_ranged_int
(
int
n
)
{
return
n
;
}
void
s_get_ranged_enum
(
renum_t
*
re
)
{
*
re
=
RE3
;
}
void
s_context_handle_test
(
void
)
{
...
...
@@ -762,6 +772,7 @@ basic_tests(void)
wstr_struct_t
ws
=
{
wstring
};
str_t
str
;
se_t
se
;
renum_t
re
;
ok
(
int_return
()
==
INT_CODE
,
"RPC int_return
\n
"
);
...
...
@@ -869,6 +880,14 @@ basic_tests(void)
str
=
get_filename
();
ok
(
!
strcmp
(
str
,
__FILE__
),
"get_filename() returned %s instead of %s
\n
"
,
str
,
__FILE__
);
midl_user_free
(
str
);
x
=
echo_ranged_int
(
0
);
ok
(
x
==
0
,
"echo_ranged_int() returned %d instead of 0
\n
"
,
x
);
x
=
echo_ranged_int
(
100
);
ok
(
x
==
100
,
"echo_ranged_int() returned %d instead of 100
\n
"
,
x
);
get_ranged_enum
(
&
re
);
ok
(
re
==
RE3
,
"get_ranged_enum() returned %d instead of RE3
\n
"
,
re
);
}
static
void
...
...
dlls/rpcrt4/tests/server.idl
View file @
2b3659f3
...
...
@@ -339,6 +339,21 @@ cpp_quote("#endif")
void
get_numbers_struct
(
[
out
]
numbers_struct_t
**
ns
)
;
str_t
get_filename
(
void
)
;
enum
renum
{
RE0
,
RE1
,
RE2
,
RE3
,
}
;
const
int
RE_MIN
=
RE0
;
const
int
RE_MAX
=
RE3
;
typedef
[
range
(
RE_MIN
,
RE_MAX
)
]
enum
renum
renum_t
;
typedef
[
range
(
0
,
100
)
]
int
rint_t
;
rint_t
echo_ranged_int
(
[
range
(
0
,
100
)
]
int
n
)
;
void
get_ranged_enum
(
[
out
]
renum_t
*
re
)
;
void
context_handle_test
(
void
)
;
void
stop
(
void
)
;
}
tools/widl/parser.y
View file @
2b3659f3
...
...
@@ -1274,6 +1274,37 @@ 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_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;
...
...
@@ -1363,6 +1394,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)
...
...
@@ -2339,6 +2374,7 @@ static void check_field_common(const type_t *container_type,
case TGT_IFACE_POINTER:
case TGT_BASIC:
case TGT_ENUM:
case TGT_RANGE:
/* nothing to do */
break;
}
...
...
@@ -2388,6 +2424,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:
...
...
tools/widl/typegen.c
View file @
2b3659f3
This diff is collapsed.
Click to expand it.
tools/widl/typegen.h
View file @
2b3659f3
...
...
@@ -56,6 +56,7 @@ enum typegen_type
TGT_ENUM
,
TGT_STRUCT
,
TGT_UNION
,
TGT_RANGE
,
};
typedef
int
(
*
type_pred_t
)(
const
type_t
*
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment