[PATCH] widl: Support function pointers in structs

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Thu Jan 23 20:27:11 CST 2020


Visual Studio idl's support functions pointers within struct's.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 include/xact3.idl    | 6 +++---
 tools/widl/parser.y  | 5 ++---
 tools/widl/typegen.c | 1 +
 tools/widl/typegen.h | 1 +
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/xact3.idl b/include/xact3.idl
index 85b18d0b9f..252478b83e 100644
--- a/include/xact3.idl
+++ b/include/xact3.idl
@@ -70,8 +70,8 @@ typedef BOOL (__stdcall *XACT_GETOVERLAPPEDRESULT_CALLBACK)(
 );
 typedef struct XACT_FILEIO_CALLBACKS
 {
-    BYTE* readFileCallback; /* FIXME: XACT_READFILE_CALLBACK */
-    BYTE* getOverlappedResultCallback; /* FIXME: XACT_GETOVERLAPPEDRESULT_CALLBACK */
+    XACT_READFILE_CALLBACK readFileCallback;
+    XACT_GETOVERLAPPEDRESULT_CALLBACK getOverlappedResultCallback;
 } XACT_FILEIO_CALLBACKS;
 
 typedef struct XACT_NOTIFICATION XACT_NOTIFICATION;
@@ -87,7 +87,7 @@ typedef struct XACT_RUNTIME_PARAMETERS
     DWORD globalSettingsFlags;
     DWORD globalSettingsAllocAttributes;
     XACT_FILEIO_CALLBACKS fileIOCallbacks;
-    BYTE* fnNotificationCallback; /* FIXME: XACT_NOTIFICATION_CALLBACK */
+    XACT_NOTIFICATION_CALLBACK fnNotificationCallback;
     LPCWSTR pRendererID;
     IXAudio2 *pXAudio2;
     IXAudio2MasteringVoice *pMasteringVoice;
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 5f6eb50878..090fb00339 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -2521,9 +2521,6 @@ static void check_field_common(const type_t *container_type,
             case TYPE_VOID:
                 reason = "cannot derive from void *";
                 break;
-            case TYPE_FUNCTION:
-                reason = "cannot be a function pointer";
-                break;
             case TYPE_BITFIELD:
                 reason = "cannot be a bit-field";
                 break;
@@ -2575,6 +2572,7 @@ static void check_field_common(const type_t *container_type,
                 error_loc_info(&arg->loc_info, "undefined type declaration \"enum %s\"\n", type->name);
             }
         case TGT_USER_TYPE:
+        case TGT_FUNCTION_POINTER:
         case TGT_IFACE_POINTER:
         case TGT_BASIC:
         case TGT_RANGE:
@@ -2659,6 +2657,7 @@ static void check_remoting_args(const var_t *func)
             case TGT_INVALID:
                 /* already error'd before we get here */
             case TGT_CTXT_HANDLE_POINTER:
+            case TGT_FUNCTION_POINTER:
             case TGT_POINTER:
             case TGT_ARRAY:
                 /* OK */
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 9b8aa1a322..ce3b1207c6 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -367,6 +367,7 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att
     case TYPE_ARRAY:
         return TGT_ARRAY;
     case TYPE_FUNCTION:
+        return TGT_FUNCTION_POINTER;
     case TYPE_COCLASS:
     case TYPE_INTERFACE:
     case TYPE_MODULE:
diff --git a/tools/widl/typegen.h b/tools/widl/typegen.h
index 95ad601768..c388e62434 100644
--- a/tools/widl/typegen.h
+++ b/tools/widl/typegen.h
@@ -58,6 +58,7 @@ enum typegen_type
     TGT_STRUCT,
     TGT_UNION,
     TGT_RANGE,
+    TGT_FUNCTION_POINTER,
 };
 
 typedef int (*type_pred_t)(const type_t *);
-- 
2.17.1




More information about the wine-devel mailing list