WIDL: emit argument types, print the names of the types

Mike McCormack mike at codeweavers.com
Wed Apr 27 00:26:09 CDT 2005


ChangeLog:
* emit argument types
* print the names of the types

-------------- next part --------------
? tools/widl/x
Index: tools/widl/client.c
===================================================================
RCS file: /home/wine/wine/tools/widl/client.c,v
retrieving revision 1.4
diff -u -p -r1.4 client.c
--- tools/widl/client.c	15 Apr 2005 14:09:45 -0000	1.4
+++ tools/widl/client.c	26 Apr 2005 09:15:31 -0000
@@ -64,10 +64,30 @@ static int print_client( const char *for
     return r;
 }
 
+const char *get_type_name(int type)
+{
+    switch(type)
+    {
+    case RPC_FC_BYTE:   return "FC_BYTE";
+    case RPC_FC_CHAR:   return "FC_CHAR";
+    case RPC_FC_WCHAR:  return "FC_WCHAR";
+    case RPC_FC_USHORT: return "FC_USHORT";
+    case RPC_FC_SHORT:  return "FC_SHORT";
+    case RPC_FC_ULONG:  return "FC_ULONG";
+    case RPC_FC_LONG:   return "FC_LONG";
+    case RPC_FC_HYPER:  return "FC_HYPER";
+    case RPC_FC_IGNORE: return "FC_IGNORE";
+    case RPC_FC_SMALL:  return "FC_SMALL";
+    case RPC_FC_FLOAT:  return "FC_FLOAT";
+    case RPC_FC_DOUBLE: return "FC_DOUBLE";
+    }
+    return "Unknown/unsupported type";
+}
 
 static void write_procformatstring(type_t *iface)
 {
     func_t *cur = iface->funcs;
+    var_t *var;
 
     print_client("static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =\n");
     print_client("{\n");
@@ -79,17 +99,44 @@ static void write_procformatstring(type_
     while (NEXT_LINK(cur)) cur = NEXT_LINK(cur);
     while (cur)
     {
-        var_t *def = cur->def;
+        /* emit argument data */
+        if (cur->args)
+        {
+            var = cur->args;
+            while (NEXT_LINK(var)) var = NEXT_LINK(var);
+            while (var)
+            {
+                int type = var->type->type;
+
+                switch(type)
+                {
+                case RPC_FC_USHORT:
+                    type = RPC_FC_SHORT;
+                    break;
+                case RPC_FC_ULONG:
+                    type = RPC_FC_LONG;
+                    break;
+                }
+                print_client("0x4e,    /* FC_IN_PARAM_BASETYPE */\n");
+                print_client("0x%02x,    /* %s */\n", get_type_name(type), type);
 
-        if (is_void(def->type, NULL))
+                var = PREV_LINK(var);
+            }
+        }
+
+        /* emit return value data */
+        var = cur->def;
+        if (is_void(var->type, NULL))
         {
             print_client("0x5b,    /* FC_END */\n");
             print_client("0x5c,    /* FC_PAD */\n");
         }
         else
         {
+            int type = var->type->type;
+
             print_client("0x53,    /* FC_RETURN_PARAM_BASETYPE */\n");
-            print_client("0x%02x,    /* <type> */\n", def->type->type);
+            print_client("0x%02x,    /* %s */\n", get_type_name(type), type);
         }
 
         cur = PREV_LINK(cur);


More information about the wine-patches mailing list