widl: Emit default argument values for cpp methods (try2)

Nikolay Sivov nsivov at codeweavers.com
Thu Jul 26 06:22:32 CDT 2012


try2: use get_attrp() this time
-------------- next part --------------
>From 4db673f7e15618fafdc8b1b5e5ee69a41129d5f4 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu, 26 Jul 2012 15:20:50 +0400
Subject: [PATCH 4/4] Emit default argument values for cpp methods

---
 tools/widl/header.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/tools/widl/header.c b/tools/widl/header.c
index 0b2b9d5..0fd1e91 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -876,6 +876,16 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i
         else fprintf(h, ",");
     }
     write_type_decl(h, arg->type, arg->name);
+    if (method == 2) {
+        const expr_t *expr = get_attrp(arg->attrs, ATTR_DEFAULTVALUE);
+        if (expr) {
+            fprintf(h, " = ");
+            if (expr->type == EXPR_STRLIT || expr->type == EXPR_WSTRLIT)
+                fprintf(h, "%s", expr->u.sval);
+            else
+                fprintf(h, "%d", expr->cval);
+        }
+    }
     count++;
   }
   if (do_indent) indentation--;
-- 
1.5.6.5



More information about the wine-patches mailing list