Author: tkreuzer
Date: Sun Dec 6 15:44:33 2009
New Revision: 44438
URL:
http://svn.reactos.org/svn/reactos?rev=44438&view=rev
Log:
copy widl from trunk
Modified:
branches/ros-amd64-bringup/reactos/tools/widl/header.c
branches/ros-amd64-bringup/reactos/tools/widl/parser.tab.c
branches/ros-amd64-bringup/reactos/tools/widl/parser.y
branches/ros-amd64-bringup/reactos/tools/widl/typegen.c
Modified: branches/ros-amd64-bringup/reactos/tools/widl/header.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/tools…
==============================================================================
--- branches/ros-amd64-bringup/reactos/tools/widl/header.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/tools/widl/header.c [iso-8859-1] Sun Dec 6
15:44:33 2009
@@ -318,14 +318,14 @@
{
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));
- }
+ 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));
+ }
break;
case TYPE_BITFIELD:
fprintf(h, " : %lu", type_bitfield_get_bits(t)->cval);
@@ -343,7 +343,7 @@
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)
@@ -354,40 +354,40 @@
if (!h) return;
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);
+ 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 (name) fprintf(h, "%s%s", !t || needs_space_after(t) ? " " :
"", name );
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 (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);
+ }
}
void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *name)
Modified: branches/ros-amd64-bringup/reactos/tools/widl/parser.tab.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/tools…
==============================================================================
--- branches/ros-amd64-bringup/reactos/tools/widl/parser.tab.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/tools/widl/parser.tab.c [iso-8859-1] Sun Dec 6
15:44:33 2009
@@ -5541,7 +5541,7 @@
}
static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const declarator_t
*decl,
- int top)
+ int top)
{
var_t *v = decl->var;
expr_list_t *sizes = get_attrp(attrs, ATTR_SIZEIS);
@@ -5614,8 +5614,8 @@
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);
+ 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);
@@ -6712,7 +6712,7 @@
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)
Modified: branches/ros-amd64-bringup/reactos/tools/widl/parser.y
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/tools…
==============================================================================
--- branches/ros-amd64-bringup/reactos/tools/widl/parser.y [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/tools/widl/parser.y [iso-8859-1] Sun Dec 6
15:44:33 2009
@@ -1376,7 +1376,7 @@
}
static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const declarator_t
*decl,
- int top)
+ int top)
{
var_t *v = decl->var;
expr_list_t *sizes = get_attrp(attrs, ATTR_SIZEIS);
@@ -1449,8 +1449,8 @@
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);
+ 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);
@@ -2547,7 +2547,7 @@
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)
Modified: branches/ros-amd64-bringup/reactos/tools/widl/typegen.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/tools…
==============================================================================
--- branches/ros-amd64-bringup/reactos/tools/widl/typegen.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/tools/widl/typegen.c [iso-8859-1] Sun Dec 6
15:44:33 2009
@@ -3249,7 +3249,7 @@
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;
@@ -3298,45 +3298,45 @@
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, "*(");
+ 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");
+ }
+
+ print_file(file, indent, "__frame->_StubMsg.Buffer += sizeof(");
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");
-}
+ fprintf(file, ");\n");
+ }
}
/* returns whether the MaxCount, Offset or ActualCount members need to be
@@ -3589,7 +3589,7 @@
break;
}
case TGT_BASIC:
- 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:
print_phase_basetype(file, indent, local_var_prefix, phase, pass, var,
var->name);
@@ -3661,7 +3661,7 @@
if (pointer_type == RPC_FC_RP) switch (typegen_detect_type(ref, NULL,
TDT_ALL_TYPES))
{
case TGT_BASIC:
- 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:
/* base types have known sizes, so don't need a sizing pass