mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Rebase against dd417540bb3afb3aa5a04a007eea9a7ee347655b.
This commit is contained in:
parent
cfe1b94e0f
commit
a2f82c5c85
@ -1,4 +1,4 @@
|
||||
From e5418972013afdb97f857e49d0beb06833b3b474 Mon Sep 17 00:00:00 2001
|
||||
From 45b0af272838c1b28dee3dd50c588af888604f59 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Thu, 7 Jun 2018 20:09:59 -0500
|
||||
Subject: [PATCH] server: Create server objects for eventfd-based
|
||||
@ -28,7 +28,7 @@ index b58ce1e3002..5f225fd0591 100644
|
||||
file.c \
|
||||
diff --git a/server/esync.c b/server/esync.c
|
||||
new file mode 100644
|
||||
index 00000000000..b8b257281bf
|
||||
index 00000000000..a571855c70a
|
||||
--- /dev/null
|
||||
+++ b/server/esync.c
|
||||
@@ -0,0 +1,320 @@
|
||||
@ -152,8 +152,8 @@ index 00000000000..b8b257281bf
|
||||
+static const struct object_ops esync_ops =
|
||||
+{
|
||||
+ sizeof(struct esync), /* size */
|
||||
+ &no_type, /* type */
|
||||
+ esync_dump, /* dump */
|
||||
+ no_get_type, /* get_type */
|
||||
+ no_add_queue, /* add_queue */
|
||||
+ NULL, /* remove_queue */
|
||||
+ NULL, /* signaled */
|
||||
@ -403,10 +403,10 @@ index dae08339874..f68888d0fa8 100644
|
||||
set_current_time();
|
||||
init_scheduler();
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index eba14534b9d..63fe88f9dda 100644
|
||||
index abccc0a1275..f41afda0251 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -3657,3 +3657,27 @@ struct handle_info
|
||||
@@ -3695,3 +3695,27 @@ struct handle_info
|
||||
@REQ(resume_process)
|
||||
obj_handle_t handle; /* process handle */
|
||||
@END
|
||||
@ -435,5 +435,5 @@ index eba14534b9d..63fe88f9dda 100644
|
||||
+ unsigned int shm_idx;
|
||||
+@END
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 05c4a58d8cc0fbafc760d3a0d4d6c14975e33fe2 Mon Sep 17 00:00:00 2001
|
||||
From d468fdd5f1b4351f357fa75628096c6d759f0331 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <zfigura@codeweavers.com>
|
||||
Date: Mon, 6 Jul 2020 15:11:12 -0500
|
||||
Subject: [PATCH] server: Create eventfd file descriptors for process objects.
|
||||
@ -11,7 +11,7 @@ Subject: [PATCH] server: Create eventfd file descriptors for process objects.
|
||||
4 files changed, 35 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/server/esync.c b/server/esync.c
|
||||
index cfbbcf55c48..61513333bfd 100644
|
||||
index d61dfdcd956..e18b76bff5b 100644
|
||||
--- a/server/esync.c
|
||||
+++ b/server/esync.c
|
||||
@@ -297,6 +297,24 @@ struct esync *create_esync( struct object *root, const struct unicode_str *name,
|
||||
@ -49,7 +49,7 @@ index 7ca4ca89394..6a0a367124d 100644
|
||||
void esync_init(void);
|
||||
+int esync_create_fd( int initval, int flags );
|
||||
diff --git a/server/process.c b/server/process.c
|
||||
index 30699fbaeae..febfc0237c6 100644
|
||||
index 310b2716dfa..d2919a2db09 100644
|
||||
--- a/server/process.c
|
||||
+++ b/server/process.c
|
||||
@@ -49,6 +49,7 @@
|
||||
@ -58,9 +58,9 @@ index 30699fbaeae..febfc0237c6 100644
|
||||
#include "security.h"
|
||||
+#include "esync.h"
|
||||
|
||||
/* process structure */
|
||||
/* process object */
|
||||
|
||||
@@ -68,6 +69,7 @@ static struct security_descriptor *process_get_sd( struct object *obj );
|
||||
@@ -72,6 +73,7 @@ static struct security_descriptor *process_get_sd( struct object *obj );
|
||||
static void process_poll_event( struct fd *fd, int event );
|
||||
static struct list *process_get_kernel_obj_list( struct object *obj );
|
||||
static void process_destroy( struct object *obj );
|
||||
@ -68,7 +68,7 @@ index 30699fbaeae..febfc0237c6 100644
|
||||
static void terminate_process( struct process *process, struct thread *skip, int exit_code );
|
||||
|
||||
static const struct object_ops process_ops =
|
||||
@@ -78,7 +80,7 @@ static const struct object_ops process_ops =
|
||||
@@ -82,7 +84,7 @@ static const struct object_ops process_ops =
|
||||
add_queue, /* add_queue */
|
||||
remove_queue, /* remove_queue */
|
||||
process_signaled, /* signaled */
|
||||
@ -77,7 +77,7 @@ index 30699fbaeae..febfc0237c6 100644
|
||||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
@@ -545,6 +547,7 @@ struct process *create_process( int fd, struct process *parent, int inherit_all,
|
||||
@@ -547,6 +549,7 @@ struct process *create_process( int fd, struct process *parent, int inherit_all,
|
||||
process->trace_data = 0;
|
||||
process->rawinput_mouse = NULL;
|
||||
process->rawinput_kbd = NULL;
|
||||
@ -85,7 +85,7 @@ index 30699fbaeae..febfc0237c6 100644
|
||||
list_init( &process->kernel_object );
|
||||
list_init( &process->thread_list );
|
||||
list_init( &process->locks );
|
||||
@@ -601,6 +604,9 @@ struct process *create_process( int fd, struct process *parent, int inherit_all,
|
||||
@@ -603,6 +606,9 @@ struct process *create_process( int fd, struct process *parent, int inherit_all,
|
||||
if (!token_assign_label( process->token, security_high_label_sid ))
|
||||
goto error;
|
||||
|
||||
@ -103,7 +103,7 @@ index 30699fbaeae..febfc0237c6 100644
|
||||
}
|
||||
|
||||
/* dump a process on stdout for debugging purposes */
|
||||
@@ -673,6 +680,13 @@ static int process_signaled( struct object *obj, struct wait_queue_entry *entry
|
||||
@@ -666,6 +673,13 @@ static int process_signaled( struct object *obj, struct wait_queue_entry *entry
|
||||
return !process->running_threads;
|
||||
}
|
||||
|
||||
@ -118,10 +118,10 @@ index 30699fbaeae..febfc0237c6 100644
|
||||
{
|
||||
if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | PROCESS_QUERY_INFORMATION | PROCESS_VM_READ;
|
||||
diff --git a/server/process.h b/server/process.h
|
||||
index 56092e5b1ac..eec69ddbcaf 100644
|
||||
index caab869c8a0..afa90581b97 100644
|
||||
--- a/server/process.h
|
||||
+++ b/server/process.h
|
||||
@@ -98,6 +98,7 @@ struct process
|
||||
@@ -95,6 +95,7 @@ struct process
|
||||
const struct rawinput_device *rawinput_mouse; /* rawinput mouse device, if any */
|
||||
const struct rawinput_device *rawinput_kbd; /* rawinput keyboard device, if any */
|
||||
struct list kernel_object; /* list of kernel object pointers */
|
||||
@ -130,5 +130,5 @@ index 56092e5b1ac..eec69ddbcaf 100644
|
||||
|
||||
#define CPU_FLAG(cpu) (1 << (cpu))
|
||||
--
|
||||
2.28.0
|
||||
2.20.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 3ff6192702c06e77ef2e6790215ec3a40216052f Mon Sep 17 00:00:00 2001
|
||||
From bc87843880d2a1ef6f092793c09439c729fe7dbb Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Fri, 8 Jun 2018 21:01:24 -0500
|
||||
Subject: [PATCH] server: Create eventfd file descriptors for event objects.
|
||||
@ -13,7 +13,7 @@ This lets system processes shut down.
|
||||
3 files changed, 36 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/server/esync.c b/server/esync.c
|
||||
index 5f6e60ab24c..cb9bfba4463 100644
|
||||
index 2b9307267f9..975e5d2ddd6 100644
|
||||
--- a/server/esync.c
|
||||
+++ b/server/esync.c
|
||||
@@ -331,6 +331,14 @@ void esync_wake_up( struct object *obj )
|
||||
@ -41,7 +41,7 @@ index 1e12560ddd6..fcbfd0989bb 100644
|
||||
void esync_wake_up( struct object *obj );
|
||||
+void esync_clear( int fd );
|
||||
diff --git a/server/event.c b/server/event.c
|
||||
index 06655fc7dd6..a416d214912 100644
|
||||
index 7c57ce54d13..78d90dac5d6 100644
|
||||
--- a/server/event.c
|
||||
+++ b/server/event.c
|
||||
@@ -35,6 +35,7 @@
|
||||
@ -50,9 +50,9 @@ index 06655fc7dd6..a416d214912 100644
|
||||
#include "security.h"
|
||||
+#include "esync.h"
|
||||
|
||||
struct event
|
||||
{
|
||||
@@ -42,15 +43,18 @@ struct event
|
||||
static const WCHAR event_name[] = {'E','v','e','n','t'};
|
||||
|
||||
@@ -49,14 +50,17 @@ struct event
|
||||
struct list kernel_object; /* list of kernel object pointers */
|
||||
int manual_reset; /* is it a manual reset event? */
|
||||
int signaled; /* event has been signaled */
|
||||
@ -60,7 +60,6 @@ index 06655fc7dd6..a416d214912 100644
|
||||
};
|
||||
|
||||
static void event_dump( struct object *obj, int verbose );
|
||||
static struct object_type *event_get_type( struct object *obj );
|
||||
static int event_signaled( struct object *obj, struct wait_queue_entry *entry );
|
||||
static void event_satisfied( struct object *obj, struct wait_queue_entry *entry );
|
||||
+static int event_get_esync_fd( struct object *obj, enum esync_type *type );
|
||||
@ -71,7 +70,7 @@ index 06655fc7dd6..a416d214912 100644
|
||||
|
||||
static const struct object_ops event_ops =
|
||||
{
|
||||
@@ -60,7 +64,7 @@ static const struct object_ops event_ops =
|
||||
@@ -66,7 +70,7 @@ static const struct object_ops event_ops =
|
||||
add_queue, /* add_queue */
|
||||
remove_queue, /* remove_queue */
|
||||
event_signaled, /* signaled */
|
||||
@ -80,7 +79,7 @@ index 06655fc7dd6..a416d214912 100644
|
||||
event_satisfied, /* satisfied */
|
||||
event_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
@@ -74,7 +78,7 @@ static const struct object_ops event_ops =
|
||||
@@ -80,7 +84,7 @@ static const struct object_ops event_ops =
|
||||
no_open_file, /* open_file */
|
||||
event_get_kernel_obj_list, /* get_kernel_obj_list */
|
||||
no_close_handle, /* close_handle */
|
||||
@ -89,7 +88,7 @@ index 06655fc7dd6..a416d214912 100644
|
||||
};
|
||||
|
||||
|
||||
@@ -128,6 +132,9 @@ struct event *create_event( struct object *root, const struct unicode_str *name,
|
||||
@@ -140,6 +144,9 @@ struct event *create_event( struct object *root, const struct unicode_str *name,
|
||||
list_init( &event->kernel_object );
|
||||
event->manual_reset = manual_reset;
|
||||
event->signaled = initial_state;
|
||||
@ -99,7 +98,7 @@ index 06655fc7dd6..a416d214912 100644
|
||||
}
|
||||
}
|
||||
return event;
|
||||
@@ -156,6 +163,9 @@ void set_event( struct event *event )
|
||||
@@ -168,6 +175,9 @@ void set_event( struct event *event )
|
||||
void reset_event( struct event *event )
|
||||
{
|
||||
event->signaled = 0;
|
||||
@ -109,7 +108,7 @@ index 06655fc7dd6..a416d214912 100644
|
||||
}
|
||||
|
||||
static void event_dump( struct object *obj, int verbose )
|
||||
@@ -180,6 +190,13 @@ static int event_signaled( struct object *obj, struct wait_queue_entry *entry )
|
||||
@@ -185,6 +195,13 @@ static int event_signaled( struct object *obj, struct wait_queue_entry *entry )
|
||||
return event->signaled;
|
||||
}
|
||||
|
||||
@ -123,7 +122,7 @@ index 06655fc7dd6..a416d214912 100644
|
||||
static void event_satisfied( struct object *obj, struct wait_queue_entry *entry )
|
||||
{
|
||||
struct event *event = (struct event *)obj;
|
||||
@@ -217,6 +234,14 @@ static struct list *event_get_kernel_obj_list( struct object *obj )
|
||||
@@ -222,6 +239,14 @@ static struct list *event_get_kernel_obj_list( struct object *obj )
|
||||
return &event->kernel_object;
|
||||
}
|
||||
|
||||
@ -139,5 +138,5 @@ index 06655fc7dd6..a416d214912 100644
|
||||
unsigned int attr, const struct security_descriptor *sd )
|
||||
{
|
||||
--
|
||||
2.28.0
|
||||
2.20.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 21ef43501fbef2d5ded6890932294b1160ccc810 Mon Sep 17 00:00:00 2001
|
||||
From 949b61856a56c339cbe6f8ec88a34902e200ae8e Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Fri, 8 Jun 2018 21:43:37 -0500
|
||||
Subject: [PATCH] server: Allow (re)setting esync events on the server side.
|
||||
@ -17,7 +17,7 @@ so this is how we do it.
|
||||
3 files changed, 42 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/server/esync.c b/server/esync.c
|
||||
index cb9bfba4463..ddee22432e5 100644
|
||||
index 975e5d2ddd6..ac59779a454 100644
|
||||
--- a/server/esync.c
|
||||
+++ b/server/esync.c
|
||||
@@ -116,7 +116,7 @@ struct esync
|
||||
@ -28,7 +28,7 @@ index cb9bfba4463..ddee22432e5 100644
|
||||
+const struct object_ops esync_ops =
|
||||
{
|
||||
sizeof(struct esync), /* size */
|
||||
esync_dump, /* dump */
|
||||
&no_type, /* type */
|
||||
@@ -339,6 +339,26 @@ void esync_clear( int fd )
|
||||
read( fd, &value, sizeof(value) );
|
||||
}
|
||||
@ -71,10 +71,10 @@ index fcbfd0989bb..aeb58c5469c 100644
|
||||
+void esync_set_event( struct esync *esync );
|
||||
+void esync_reset_event( struct esync *esync );
|
||||
diff --git a/server/event.c b/server/event.c
|
||||
index a416d214912..b6f989d4d6a 100644
|
||||
index 78d90dac5d6..bc2948c30aa 100644
|
||||
--- a/server/event.c
|
||||
+++ b/server/event.c
|
||||
@@ -142,6 +142,10 @@ struct event *create_event( struct object *root, const struct unicode_str *name,
|
||||
@@ -154,6 +154,10 @@ struct event *create_event( struct object *root, const struct unicode_str *name,
|
||||
|
||||
struct event *get_event_obj( struct process *process, obj_handle_t handle, unsigned int access )
|
||||
{
|
||||
@ -85,7 +85,7 @@ index a416d214912..b6f989d4d6a 100644
|
||||
return (struct event *)get_handle_obj( process, handle, access, &event_ops );
|
||||
}
|
||||
|
||||
@@ -155,6 +159,12 @@ void pulse_event( struct event *event )
|
||||
@@ -167,6 +171,12 @@ void pulse_event( struct event *event )
|
||||
|
||||
void set_event( struct event *event )
|
||||
{
|
||||
@ -98,7 +98,7 @@ index a416d214912..b6f989d4d6a 100644
|
||||
event->signaled = 1;
|
||||
/* wake up all waiters if manual reset, a single one otherwise */
|
||||
wake_up( &event->obj, !event->manual_reset );
|
||||
@@ -162,6 +172,11 @@ void set_event( struct event *event )
|
||||
@@ -174,6 +184,11 @@ void set_event( struct event *event )
|
||||
|
||||
void reset_event( struct event *event )
|
||||
{
|
||||
@ -111,5 +111,5 @@ index a416d214912..b6f989d4d6a 100644
|
||||
|
||||
if (do_esync())
|
||||
--
|
||||
2.28.0
|
||||
2.20.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 88819d39a698afb9024eb37d233cdddf490a0930 Mon Sep 17 00:00:00 2001
|
||||
From 183ec6174f0d6d02b9f94aaf0f0b35874e8b4b09 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Fri, 8 Jun 2018 22:04:29 -0500
|
||||
Subject: [PATCH] server: Create eventfd file descriptors for thread objects.
|
||||
@ -9,18 +9,18 @@ Subject: [PATCH] server: Create eventfd file descriptors for thread objects.
|
||||
2 files changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/server/thread.c b/server/thread.c
|
||||
index 0fddc37856a..48c3eae7413 100644
|
||||
index d3021d3d771..26cbeee68fd 100644
|
||||
--- a/server/thread.c
|
||||
+++ b/server/thread.c
|
||||
@@ -172,6 +172,7 @@ static const struct object_ops context_ops =
|
||||
@@ -178,6 +178,7 @@ struct type_descr thread_type =
|
||||
|
||||
static void dump_thread( struct object *obj, int verbose );
|
||||
static struct object_type *thread_get_type( struct object *obj );
|
||||
static int thread_signaled( struct object *obj, struct wait_queue_entry *entry );
|
||||
+static int thread_get_esync_fd( struct object *obj, enum esync_type *type );
|
||||
static unsigned int thread_map_access( struct object *obj, unsigned int access );
|
||||
static void thread_poll_event( struct fd *fd, int event );
|
||||
static struct list *thread_get_kernel_obj_list( struct object *obj );
|
||||
@@ -185,7 +186,7 @@ static const struct object_ops thread_ops =
|
||||
@@ -191,7 +192,7 @@ static const struct object_ops thread_ops =
|
||||
add_queue, /* add_queue */
|
||||
remove_queue, /* remove_queue */
|
||||
thread_signaled, /* signaled */
|
||||
@ -29,7 +29,7 @@ index 0fddc37856a..48c3eae7413 100644
|
||||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
@@ -225,6 +226,7 @@ static inline void init_thread_structure( struct thread *thread )
|
||||
@@ -231,6 +232,7 @@ static inline void init_thread_structure( struct thread *thread )
|
||||
thread->context = NULL;
|
||||
thread->teb = 0;
|
||||
thread->entry_point = 0;
|
||||
@ -37,7 +37,7 @@ index 0fddc37856a..48c3eae7413 100644
|
||||
thread->system_regs = 0;
|
||||
thread->queue = NULL;
|
||||
thread->wait = NULL;
|
||||
@@ -360,6 +362,9 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
|
||||
@@ -366,6 +368,9 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ index 0fddc37856a..48c3eae7413 100644
|
||||
set_fd_events( thread->request_fd, POLLIN ); /* start listening to events */
|
||||
add_process_thread( thread->process, thread );
|
||||
return thread;
|
||||
@@ -439,6 +444,9 @@ static void destroy_thread( struct object *obj )
|
||||
@@ -445,6 +450,9 @@ static void destroy_thread( struct object *obj )
|
||||
if (thread->exit_poll) remove_timeout_user( thread->exit_poll );
|
||||
if (thread->id) free_ptid( thread->id );
|
||||
if (thread->token) release_object( thread->token );
|
||||
@ -57,7 +57,7 @@ index 0fddc37856a..48c3eae7413 100644
|
||||
}
|
||||
|
||||
/* dump a thread on stdout for debugging purposes */
|
||||
@@ -464,6 +472,13 @@ static int thread_signaled( struct object *obj, struct wait_queue_entry *entry )
|
||||
@@ -463,6 +471,13 @@ static int thread_signaled( struct object *obj, struct wait_queue_entry *entry )
|
||||
return mythread->state == TERMINATED && !mythread->exit_poll;
|
||||
}
|
||||
|
||||
@ -84,5 +84,5 @@ index 077ab0929ba..99904557d44 100644
|
||||
struct msg_queue *queue; /* message queue */
|
||||
struct thread_wait *wait; /* current wait condition if sleeping */
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 9e3d043ea15a1814f2003b7c6ebe6968b51b7740 Mon Sep 17 00:00:00 2001
|
||||
From 8a5b98f58a86731874f7d8c0e387aeab22e15fea Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Fri, 15 Jun 2018 11:01:44 -0500
|
||||
Subject: [PATCH] server: Create eventfd descriptors for timers.
|
||||
@ -8,7 +8,7 @@ Subject: [PATCH] server: Create eventfd descriptors for timers.
|
||||
1 file changed, 18 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/server/timer.c b/server/timer.c
|
||||
index 319b9d142db..11fcdf3bae7 100644
|
||||
index be4d5943a41..f1abca3de90 100644
|
||||
--- a/server/timer.c
|
||||
+++ b/server/timer.c
|
||||
@@ -36,6 +36,7 @@
|
||||
@ -17,9 +17,9 @@ index 319b9d142db..11fcdf3bae7 100644
|
||||
#include "request.h"
|
||||
+#include "esync.h"
|
||||
|
||||
struct timer
|
||||
{
|
||||
@@ -48,11 +49,13 @@ struct timer
|
||||
static const WCHAR timer_name[] = {'T','i','m','e','r'};
|
||||
|
||||
@@ -55,10 +56,12 @@ struct timer
|
||||
struct thread *thread; /* thread that set the APC function */
|
||||
client_ptr_t callback; /* callback APC function */
|
||||
client_ptr_t arg; /* callback argument */
|
||||
@ -27,13 +27,12 @@ index 319b9d142db..11fcdf3bae7 100644
|
||||
};
|
||||
|
||||
static void timer_dump( struct object *obj, int verbose );
|
||||
static struct object_type *timer_get_type( struct object *obj );
|
||||
static int timer_signaled( struct object *obj, struct wait_queue_entry *entry );
|
||||
+static int timer_get_esync_fd( struct object *obj, enum esync_type *type );
|
||||
static void timer_satisfied( struct object *obj, struct wait_queue_entry *entry );
|
||||
static unsigned int timer_map_access( struct object *obj, unsigned int access );
|
||||
static void timer_destroy( struct object *obj );
|
||||
@@ -65,7 +68,7 @@ static const struct object_ops timer_ops =
|
||||
@@ -71,7 +74,7 @@ static const struct object_ops timer_ops =
|
||||
add_queue, /* add_queue */
|
||||
remove_queue, /* remove_queue */
|
||||
timer_signaled, /* signaled */
|
||||
@ -42,7 +41,7 @@ index 319b9d142db..11fcdf3bae7 100644
|
||||
timer_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
@@ -100,6 +103,10 @@ static struct timer *create_timer( struct object *root, const struct unicode_str
|
||||
@@ -106,6 +109,10 @@ static struct timer *create_timer( struct object *root, const struct unicode_str
|
||||
timer->period = 0;
|
||||
timer->timeout = NULL;
|
||||
timer->thread = NULL;
|
||||
@ -53,7 +52,7 @@ index 319b9d142db..11fcdf3bae7 100644
|
||||
}
|
||||
}
|
||||
return timer;
|
||||
@@ -173,6 +180,9 @@ static int set_timer( struct timer *timer, timeout_t expire, unsigned int period
|
||||
@@ -179,6 +186,9 @@ static int set_timer( struct timer *timer, timeout_t expire, unsigned int period
|
||||
{
|
||||
period = 0; /* period doesn't make any sense for a manual timer */
|
||||
timer->signaled = 0;
|
||||
@ -63,7 +62,7 @@ index 319b9d142db..11fcdf3bae7 100644
|
||||
}
|
||||
timer->when = (expire <= 0) ? expire - monotonic_time : max( expire, current_time );
|
||||
timer->period = period;
|
||||
@@ -207,6 +217,13 @@ static int timer_signaled( struct object *obj, struct wait_queue_entry *entry )
|
||||
@@ -206,6 +216,13 @@ static int timer_signaled( struct object *obj, struct wait_queue_entry *entry )
|
||||
return timer->signaled;
|
||||
}
|
||||
|
||||
@ -78,5 +77,5 @@ index 319b9d142db..11fcdf3bae7 100644
|
||||
{
|
||||
struct timer *timer = (struct timer *)obj;
|
||||
--
|
||||
2.28.0
|
||||
2.20.1
|
||||
|
||||
|
@ -1,63 +0,0 @@
|
||||
From c28cdfe81ad11729cbfe912ee25f5d7062ef880d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Fri, 13 May 2016 17:54:12 +0200
|
||||
Subject: kernel32: Update sr-Latn locale definition.
|
||||
|
||||
---
|
||||
dlls/kernel32/nls/srl.nls | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/nls/srl.nls b/dlls/kernel32/nls/srl.nls
|
||||
index a40556c..1cd21db 100644
|
||||
--- a/dlls/kernel32/nls/srl.nls
|
||||
+++ b/dlls/kernel32/nls/srl.nls
|
||||
@@ -64,7 +64,7 @@ STRINGTABLE LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_LATIN
|
||||
LOCALE_ITLZERO "0"
|
||||
LOCALE_S1159 ""
|
||||
LOCALE_S2359 ""
|
||||
- LOCALE_SABBREVCTRYNAME "SPB"
|
||||
+ LOCALE_SABBREVCTRYNAME "SCG"
|
||||
LOCALE_SABBREVDAYNAME1 "pon"
|
||||
LOCALE_SABBREVDAYNAME2 "uto"
|
||||
LOCALE_SABBREVDAYNAME3 "sre"
|
||||
@@ -86,7 +86,7 @@ STRINGTABLE LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_LATIN
|
||||
LOCALE_SABBREVMONTHNAME11 "nov"
|
||||
LOCALE_SABBREVMONTHNAME12 "dec"
|
||||
LOCALE_SABBREVMONTHNAME13 ""
|
||||
- LOCALE_SCOUNTRY "Serbia"
|
||||
+ LOCALE_SCOUNTRY "Serbia and Montenegro (Former)"
|
||||
LOCALE_SCURRENCY "Din."
|
||||
LOCALE_SDATE "."
|
||||
LOCALE_SDAYNAME1 "ponedeljak"
|
||||
@@ -97,14 +97,14 @@ STRINGTABLE LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_LATIN
|
||||
LOCALE_SDAYNAME6 "subota"
|
||||
LOCALE_SDAYNAME7 "nedelja"
|
||||
LOCALE_SDECIMAL ","
|
||||
- LOCALE_SENGCOUNTRY "Serbia"
|
||||
+ LOCALE_SENGCOUNTRY "Serbia and Montenegro (Former)"
|
||||
LOCALE_SENGCURRNAME "Serbian Dinar"
|
||||
LOCALE_SENGLANGUAGE "Serbian (Latin)"
|
||||
LOCALE_SGROUPING "3;0"
|
||||
LOCALE_SINTLSYMBOL "RSD"
|
||||
- LOCALE_SISO3166CTRYNAME "RS"
|
||||
+ LOCALE_SISO3166CTRYNAME "CS"
|
||||
LOCALE_SISO639LANGNAME "sr"
|
||||
- LOCALE_SLANGUAGE "Serbian (Latin)"
|
||||
+ LOCALE_SLANGUAGE "Serbian (Latin, Serbia and Montenegro (Former))"
|
||||
LOCALE_SLIST ";"
|
||||
LOCALE_SLONGDATE "d. MMMM yyyy"
|
||||
LOCALE_SMONDECIMALSEP ","
|
||||
@@ -123,8 +123,8 @@ STRINGTABLE LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_LATIN
|
||||
LOCALE_SMONTHNAME12 "decembar"
|
||||
LOCALE_SMONTHNAME13 ""
|
||||
LOCALE_SMONTHOUSANDSEP "."
|
||||
- LOCALE_SNAME "sr-Latn-RS"
|
||||
- LOCALE_SNATIVECTRYNAME "Srbija"
|
||||
+ LOCALE_SNAME "sr-Latn-CS"
|
||||
+ LOCALE_SNATIVECTRYNAME "Srbija i Crna Gora (Bivši)"
|
||||
LOCALE_SNATIVECURRNAME "dinar"
|
||||
LOCALE_SNATIVEDIGITS "0123456789"
|
||||
LOCALE_SNATIVEDISPLAYNAME "srpski (Srbija)"
|
||||
--
|
||||
2.8.0
|
||||
|
@ -1,200 +0,0 @@
|
||||
From e7fc618b090431d0baaadf917131bbcf3f8bff3f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Fri, 13 May 2016 17:55:15 +0200
|
||||
Subject: kernel32: Add sr-Latn-RS locale definition.
|
||||
|
||||
---
|
||||
dlls/kernel32/locale_rc.rc | 1 +
|
||||
dlls/kernel32/nls/srsl.nls | 168 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 169 insertions(+)
|
||||
create mode 100644 dlls/kernel32/nls/srsl.nls
|
||||
|
||||
diff --git a/dlls/kernel32/locale_rc.rc b/dlls/kernel32/locale_rc.rc
|
||||
index 363e7ab..5673c30 100644
|
||||
--- a/dlls/kernel32/locale_rc.rc
|
||||
+++ b/dlls/kernel32/locale_rc.rc
|
||||
@@ -143,6 +143,7 @@
|
||||
#include "nls/hrv.nls" /* 0x041a LANG_SERBIAN, SUBLANG_DEFAULT */
|
||||
#include "nls/srl.nls" /* 0x081a LANG_SERBIAN, SUBLANG_SERBIAN_LATIN */
|
||||
#include "nls/srb.nls" /* 0x0c1a LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC */
|
||||
+#include "nls/srsl.nls" /* 0x241a LANG_SERBIAN, SUBLANG_SERBIAN_SERBIA_LATIN */
|
||||
|
||||
#include "nls/sky.nls" /* 0x041b LANG_SLOVAK, SUBLANG_DEFAULT */
|
||||
|
||||
diff --git a/dlls/kernel32/nls/srsl.nls b/dlls/kernel32/nls/srsl.nls
|
||||
new file mode 100644
|
||||
index 0000000..455179b
|
||||
--- /dev/null
|
||||
+++ b/dlls/kernel32/nls/srsl.nls
|
||||
@@ -0,0 +1,168 @@
|
||||
+/*
|
||||
+ * Locale definitions for Serbian (Serbia, Latin)
|
||||
+ *
|
||||
+ * Copyright 2016 Michael Müller
|
||||
+ *
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
+ */
|
||||
+
|
||||
+#pragma code_page(65001) /* UTF-8 */
|
||||
+
|
||||
+STRINGTABLE LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_SERBIA_LATIN
|
||||
+{
|
||||
+ LOCALE_FONTSIGNATURE L"\x0027\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0002\x0000\x0000\x0400\x0012\x0000\x0000\xc5d4"
|
||||
+ LOCALE_ICALENDARTYPE "1"
|
||||
+ LOCALE_ICENTURY "1"
|
||||
+ LOCALE_ICOUNTRY "381"
|
||||
+ LOCALE_ICURRDIGITS "2"
|
||||
+ LOCALE_ICURRENCY "3"
|
||||
+ LOCALE_IDATE "1"
|
||||
+ LOCALE_IDAYLZERO "0"
|
||||
+ LOCALE_IDEFAULTANSICODEPAGE "1250"
|
||||
+ LOCALE_IDEFAULTCODEPAGE "852"
|
||||
+ LOCALE_IDEFAULTCOUNTRY "381"
|
||||
+ LOCALE_IDEFAULTEBCDICCODEPAGE "500"
|
||||
+ LOCALE_IDEFAULTLANGUAGE "241a"
|
||||
+ LOCALE_IDEFAULTMACCODEPAGE "10029"
|
||||
+ LOCALE_IDEFAULTUNIXCODEPAGE "28592"
|
||||
+ LOCALE_IDIGITS "2"
|
||||
+ LOCALE_IDIGITSUBSTITUTION "1"
|
||||
+ LOCALE_IFIRSTDAYOFWEEK "0"
|
||||
+ LOCALE_IFIRSTWEEKOFYEAR "0"
|
||||
+ LOCALE_IINTLCURRDIGITS "2"
|
||||
+ LOCALE_ILANGUAGE "241a"
|
||||
+ LOCALE_ILDATE "1"
|
||||
+ LOCALE_ILZERO "1"
|
||||
+ LOCALE_IMEASURE "0"
|
||||
+ LOCALE_IMONLZERO "0"
|
||||
+ LOCALE_INEGCURR "8"
|
||||
+ LOCALE_INEGNUMBER "1"
|
||||
+ LOCALE_INEGSEPBYSPACE "1"
|
||||
+ LOCALE_INEGSIGNPOSN "1"
|
||||
+ LOCALE_INEGSYMPRECEDES "0"
|
||||
+ LOCALE_INEUTRAL "0"
|
||||
+ LOCALE_IOPTIONALCALENDAR "0"
|
||||
+ LOCALE_IPAPERSIZE "9"
|
||||
+ LOCALE_IPOSSEPBYSPACE "1"
|
||||
+ LOCALE_IPOSSIGNPOSN "1"
|
||||
+ LOCALE_IPOSSYMPRECEDES "0"
|
||||
+ LOCALE_IREADINGLAYOUT "0"
|
||||
+ LOCALE_ITIME "1"
|
||||
+ LOCALE_ITIMEMARKPOSN "0"
|
||||
+ LOCALE_ITLZERO "1"
|
||||
+ LOCALE_S1159 "pre podne"
|
||||
+ LOCALE_S2359 "po podne"
|
||||
+ LOCALE_SABBREVCTRYNAME "SRB"
|
||||
+ LOCALE_SABBREVDAYNAME1 "pon"
|
||||
+ LOCALE_SABBREVDAYNAME2 "uto"
|
||||
+ LOCALE_SABBREVDAYNAME3 "sre"
|
||||
+ LOCALE_SABBREVDAYNAME4 "čet"
|
||||
+ LOCALE_SABBREVDAYNAME5 "pet"
|
||||
+ LOCALE_SABBREVDAYNAME6 "sub"
|
||||
+ LOCALE_SABBREVDAYNAME7 "ned"
|
||||
+ LOCALE_SABBREVLANGNAME "SRM"
|
||||
+ LOCALE_SABBREVMONTHNAME1 "jan"
|
||||
+ LOCALE_SABBREVMONTHNAME2 "feb"
|
||||
+ LOCALE_SABBREVMONTHNAME3 "mar"
|
||||
+ LOCALE_SABBREVMONTHNAME4 "apr"
|
||||
+ LOCALE_SABBREVMONTHNAME5 "maj"
|
||||
+ LOCALE_SABBREVMONTHNAME6 "jun"
|
||||
+ LOCALE_SABBREVMONTHNAME7 "jul"
|
||||
+ LOCALE_SABBREVMONTHNAME8 "avg"
|
||||
+ LOCALE_SABBREVMONTHNAME9 "sep"
|
||||
+ LOCALE_SABBREVMONTHNAME10 "okt"
|
||||
+ LOCALE_SABBREVMONTHNAME11 "nov"
|
||||
+ LOCALE_SABBREVMONTHNAME12 "dec"
|
||||
+ LOCALE_SABBREVMONTHNAME13 ""
|
||||
+ LOCALE_SCOUNTRY "Serbia"
|
||||
+ LOCALE_SCURRENCY "RSD"
|
||||
+ LOCALE_SDATE "."
|
||||
+ LOCALE_SDAYNAME1 "ponedeljak"
|
||||
+ LOCALE_SDAYNAME2 "utorak"
|
||||
+ LOCALE_SDAYNAME3 "sreda"
|
||||
+ LOCALE_SDAYNAME4 "četvrtak"
|
||||
+ LOCALE_SDAYNAME5 "petak"
|
||||
+ LOCALE_SDAYNAME6 "subota"
|
||||
+ LOCALE_SDAYNAME7 "nedelja"
|
||||
+ LOCALE_SDECIMAL ","
|
||||
+ LOCALE_SENGCOUNTRY "Serbia"
|
||||
+ LOCALE_SENGCURRNAME "Serbian Dinar"
|
||||
+ LOCALE_SENGLANGUAGE "Serbian (Latin)"
|
||||
+ LOCALE_SGROUPING "3;0"
|
||||
+ LOCALE_SINTLSYMBOL "RSD"
|
||||
+ LOCALE_SISO3166CTRYNAME "RS"
|
||||
+ LOCALE_SISO639LANGNAME "sr"
|
||||
+ LOCALE_SLANGUAGE "Serbian (Latin, Serbia)"
|
||||
+ LOCALE_SLIST ";"
|
||||
+ LOCALE_SLONGDATE "dddd, dd. MMMM yyyy"
|
||||
+ LOCALE_SMONDECIMALSEP ","
|
||||
+ LOCALE_SMONGROUPING "3;0"
|
||||
+ LOCALE_SMONTHNAME1 "januar"
|
||||
+ LOCALE_SMONTHNAME2 "februar"
|
||||
+ LOCALE_SMONTHNAME3 "mart"
|
||||
+ LOCALE_SMONTHNAME4 "april"
|
||||
+ LOCALE_SMONTHNAME5 "maj"
|
||||
+ LOCALE_SMONTHNAME6 "jun"
|
||||
+ LOCALE_SMONTHNAME7 "jul"
|
||||
+ LOCALE_SMONTHNAME8 "avgust"
|
||||
+ LOCALE_SMONTHNAME9 "septembar"
|
||||
+ LOCALE_SMONTHNAME10 "oktobar"
|
||||
+ LOCALE_SMONTHNAME11 "novembar"
|
||||
+ LOCALE_SMONTHNAME12 "decembar"
|
||||
+ LOCALE_SMONTHNAME13 ""
|
||||
+ LOCALE_SMONTHOUSANDSEP "."
|
||||
+ LOCALE_SNAME "sr-Latn-RS"
|
||||
+ LOCALE_SNATIVECTRYNAME "Srbija"
|
||||
+ LOCALE_SNATIVECURRNAME "Srpski dinar"
|
||||
+ LOCALE_SNATIVEDIGITS "0123456789"
|
||||
+ LOCALE_SNATIVEDISPLAYNAME "srpski (Srbija)"
|
||||
+ LOCALE_SNATIVELANGNAME "srpski"
|
||||
+ LOCALE_SNEGATIVESIGN "-"
|
||||
+ LOCALE_SOPENTYPELANGUAGETAG "SRB "
|
||||
+ LOCALE_SPOSITIVESIGN "+"
|
||||
+ LOCALE_SSCRIPTS "Latn;"
|
||||
+ LOCALE_SSHORTDATE "d.M.yyyy"
|
||||
+ LOCALE_SSHORTESTDAYNAME1 "pon"
|
||||
+ LOCALE_SSHORTESTDAYNAME2 "uto"
|
||||
+ LOCALE_SSHORTESTDAYNAME3 "sre"
|
||||
+ LOCALE_SSHORTESTDAYNAME4 "čet"
|
||||
+ LOCALE_SSHORTESTDAYNAME5 "pet"
|
||||
+ LOCALE_SSHORTESTDAYNAME6 "sub"
|
||||
+ LOCALE_SSHORTESTDAYNAME7 "ned"
|
||||
+ LOCALE_SSHORTTIME "H:mm"
|
||||
+ LOCALE_SSORTNAME "Default"
|
||||
+ LOCALE_STHOUSAND "."
|
||||
+ LOCALE_STIME ":"
|
||||
+ LOCALE_STIMEFORMAT "H:mm:ss"
|
||||
+ LOCALE_SYEARMONTH "MMMM yyyy"
|
||||
+
|
||||
+ LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE "Western Europe and United States"
|
||||
+ LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE "Central Europe"
|
||||
+ LGRPID_BALTIC+LGRPID_RES_BASE "Baltic"
|
||||
+ LGRPID_GREEK+LGRPID_RES_BASE "Greek"
|
||||
+ LGRPID_CYRILLIC+LGRPID_RES_BASE "Cyrillic"
|
||||
+ LGRPID_TURKISH+LGRPID_RES_BASE "Turkic"
|
||||
+ LGRPID_JAPANESE+LGRPID_RES_BASE "Japanese"
|
||||
+ LGRPID_KOREAN+LGRPID_RES_BASE "Korean"
|
||||
+ LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE "Traditional Chinese"
|
||||
+ LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE "Simplified Chinese"
|
||||
+ LGRPID_THAI+LGRPID_RES_BASE "Thai"
|
||||
+ LGRPID_HEBREW+LGRPID_RES_BASE "Hebrew"
|
||||
+ LGRPID_ARABIC+LGRPID_RES_BASE "Arabic"
|
||||
+ LGRPID_VIETNAMESE+LGRPID_RES_BASE "Vietnamese"
|
||||
+ LGRPID_INDIC+LGRPID_RES_BASE "Indic"
|
||||
+ LGRPID_GEORGIAN+LGRPID_RES_BASE "Georgian"
|
||||
+ LGRPID_ARMENIAN+LGRPID_RES_BASE "Armenian"
|
||||
+}
|
||||
--
|
||||
2.8.0
|
||||
|
@ -1,2 +0,0 @@
|
||||
# Fixes: [40619] Add sr-Latn-RS locale definition
|
||||
Disabled: true
|
@ -1,13 +1,13 @@
|
||||
From d6d1a8e33e479f9f7d8bd228efaaa5a9157255ab Mon Sep 17 00:00:00 2001
|
||||
From 8294521265f2ce0c316ddeadec39c50351239dd1 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Thu, 9 Jan 2020 13:44:01 -0600
|
||||
Subject: [PATCH] ntdll/tests: Move some tests to a new sync.c file.
|
||||
|
||||
---
|
||||
dlls/ntdll/tests/Makefile.in | 1 +
|
||||
dlls/ntdll/tests/om.c | 500 +-------------------------------
|
||||
dlls/ntdll/tests/om.c | 494 -------------------------------
|
||||
dlls/ntdll/tests/sync.c | 547 +++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 550 insertions(+), 498 deletions(-)
|
||||
3 files changed, 548 insertions(+), 494 deletions(-)
|
||||
create mode 100644 dlls/ntdll/tests/sync.c
|
||||
|
||||
diff --git a/dlls/ntdll/tests/Makefile.in b/dlls/ntdll/tests/Makefile.in
|
||||
@ -23,7 +23,7 @@ index ed15c51339f..9a99c01bd7c 100644
|
||||
time.c \
|
||||
virtual.c
|
||||
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
|
||||
index b318c0b2e64..a65c879465c 100644
|
||||
index 21de385a8bc..245a5ae2d15 100644
|
||||
--- a/dlls/ntdll/tests/om.c
|
||||
+++ b/dlls/ntdll/tests/om.c
|
||||
@@ -30,10 +30,6 @@
|
||||
@ -46,7 +46,7 @@ index b318c0b2e64..a65c879465c 100644
|
||||
static NTSTATUS (WINAPI *pNtCreateSemaphore)( PHANDLE, ACCESS_MASK,const POBJECT_ATTRIBUTES,LONG,LONG );
|
||||
static NTSTATUS (WINAPI *pNtOpenSemaphore)( PHANDLE, ACCESS_MASK, const POBJECT_ATTRIBUTES );
|
||||
static NTSTATUS (WINAPI *pNtQuerySemaphore)( PHANDLE, SEMAPHORE_INFORMATION_CLASS, PVOID, ULONG, PULONG );
|
||||
@@ -67,25 +61,17 @@ static NTSTATUS (WINAPI *pNtQueryObject)(HANDLE,OBJECT_INFORMATION_CLASS,PVOID,U
|
||||
@@ -67,15 +61,9 @@ static NTSTATUS (WINAPI *pNtQueryObject)(HANDLE,OBJECT_INFORMATION_CLASS,PVOID,U
|
||||
static NTSTATUS (WINAPI *pNtReleaseSemaphore)(HANDLE, ULONG, PULONG);
|
||||
static NTSTATUS (WINAPI *pNtCreateKeyedEvent)( HANDLE *, ACCESS_MASK, const OBJECT_ATTRIBUTES *, ULONG );
|
||||
static NTSTATUS (WINAPI *pNtOpenKeyedEvent)( HANDLE *, ACCESS_MASK, const OBJECT_ATTRIBUTES * );
|
||||
@ -61,20 +61,8 @@ index b318c0b2e64..a65c879465c 100644
|
||||
-static void (WINAPI *pRtlWakeAddressSingle)( const void * );
|
||||
static NTSTATUS (WINAPI *pNtOpenProcess)( HANDLE *, ACCESS_MASK, const OBJECT_ATTRIBUTES *, const CLIENT_ID * );
|
||||
static NTSTATUS (WINAPI *pNtCreateDebugObject)( HANDLE *, ACCESS_MASK, OBJECT_ATTRIBUTES *, ULONG );
|
||||
static NTSTATUS (WINAPI *pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
|
||||
|
||||
-#define KEYEDEVENT_WAIT 0x0001
|
||||
-#define KEYEDEVENT_WAKE 0x0002
|
||||
-#define KEYEDEVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x0003)
|
||||
-
|
||||
#define ROUND_UP(value, alignment) (((value) + ((alignment) - 1)) & ~((alignment)-1))
|
||||
|
||||
+#define KEYEDEVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x0003)
|
||||
+
|
||||
static LPCSTR wine_dbgstr_us( const UNICODE_STRING *us )
|
||||
{
|
||||
if (!us) return "(null)";
|
||||
@@ -1783,286 +1769,6 @@ static void test_type_mismatch(void)
|
||||
@@ -1665,286 +1653,6 @@ static void test_type_mismatch(void)
|
||||
pNtClose( h );
|
||||
}
|
||||
|
||||
@ -361,7 +349,7 @@ index b318c0b2e64..a65c879465c 100644
|
||||
static void test_null_device(void)
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
@@ -2136,119 +1842,6 @@ static void test_null_device(void)
|
||||
@@ -2018,119 +1726,6 @@ static void test_null_device(void)
|
||||
CloseHandle(ov.hEvent);
|
||||
}
|
||||
|
||||
@ -481,7 +469,7 @@ index b318c0b2e64..a65c879465c 100644
|
||||
static void test_semaphore(void)
|
||||
{
|
||||
SEMAPHORE_BASIC_INFORMATION info;
|
||||
@@ -2325,79 +1918,6 @@ static void test_semaphore(void)
|
||||
@@ -2207,79 +1802,6 @@ static void test_semaphore(void)
|
||||
NtClose( semaphore );
|
||||
}
|
||||
|
||||
@ -561,7 +549,7 @@ index b318c0b2e64..a65c879465c 100644
|
||||
static void test_process(void)
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
@@ -2461,13 +1981,7 @@ START_TEST(om)
|
||||
@@ -2343,13 +1865,7 @@ START_TEST(om)
|
||||
pNtCreateMailslotFile = (void *)GetProcAddress(hntdll, "NtCreateMailslotFile");
|
||||
pNtCreateMutant = (void *)GetProcAddress(hntdll, "NtCreateMutant");
|
||||
pNtOpenEvent = (void *)GetProcAddress(hntdll, "NtOpenEvent");
|
||||
@ -575,7 +563,7 @@ index b318c0b2e64..a65c879465c 100644
|
||||
pNtOpenFile = (void *)GetProcAddress(hntdll, "NtOpenFile");
|
||||
pNtClose = (void *)GetProcAddress(hntdll, "NtClose");
|
||||
pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
|
||||
@@ -2488,15 +2002,9 @@ START_TEST(om)
|
||||
@@ -2370,15 +1886,9 @@ START_TEST(om)
|
||||
pNtReleaseSemaphore = (void *)GetProcAddress(hntdll, "NtReleaseSemaphore");
|
||||
pNtCreateKeyedEvent = (void *)GetProcAddress(hntdll, "NtCreateKeyedEvent");
|
||||
pNtOpenKeyedEvent = (void *)GetProcAddress(hntdll, "NtOpenKeyedEvent");
|
||||
@ -590,10 +578,10 @@ index b318c0b2e64..a65c879465c 100644
|
||||
- pRtlWakeAddressSingle = (void *)GetProcAddress(hntdll, "RtlWakeAddressSingle");
|
||||
pNtOpenProcess = (void *)GetProcAddress(hntdll, "NtOpenProcess");
|
||||
pNtCreateDebugObject = (void *)GetProcAddress(hntdll, "NtCreateDebugObject");
|
||||
pNtQuerySystemInformation = (void *)GetProcAddress(hntdll, "NtQuerySystemInformation");
|
||||
@@ -2510,11 +2018,7 @@ START_TEST(om)
|
||||
|
||||
@@ -2390,11 +1900,7 @@ START_TEST(om)
|
||||
test_symboliclink();
|
||||
test_query_object();
|
||||
test_query_object_types();
|
||||
test_type_mismatch();
|
||||
- test_event();
|
||||
- test_mutant();
|
||||
@ -1157,5 +1145,5 @@ index 00000000000..3f41cdfeedd
|
||||
+ test_keyed_events();
|
||||
+}
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
Fixes: [50292] Process-local synchronization objects use private interfaces into the Unix library
|
||||
Depends: server-Object_Types
|
||||
#Depends: server-Object_Types
|
||||
|
@ -51,7 +51,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "2201ca08fb03d069fa2ccf46773c150a6f7988bc"
|
||||
echo "dd417540bb3afb3aa5a04a007eea9a7ee347655b"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -212,7 +212,6 @@ patch_enable_all ()
|
||||
enable_server_File_Permissions="$1"
|
||||
enable_server_Inherited_ACLs="$1"
|
||||
enable_server_Key_State="$1"
|
||||
enable_server_Object_Types="$1"
|
||||
enable_server_PeekMessage="$1"
|
||||
enable_server_Realtime_Priority="$1"
|
||||
enable_server_Signal_Thread="$1"
|
||||
@ -720,9 +719,6 @@ patch_enable ()
|
||||
server-Key_State)
|
||||
enable_server_Key_State="$2"
|
||||
;;
|
||||
server-Object_Types)
|
||||
enable_server_Object_Types="$2"
|
||||
;;
|
||||
server-PeekMessage)
|
||||
enable_server_PeekMessage="$2"
|
||||
;;
|
||||
@ -1577,13 +1573,6 @@ if test "$enable_ntdll_NtDevicePath" -eq 1; then
|
||||
enable_ntdll_Pipe_SpecialCharacters=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_NtAlertThreadByThreadId" -eq 1; then
|
||||
if test "$enable_server_Object_Types" -gt 1; then
|
||||
abort "Patchset server-Object_Types disabled, but ntdll-NtAlertThreadByThreadId depends on that."
|
||||
fi
|
||||
enable_server_Object_Types=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_Builtin_Prot" -eq 1; then
|
||||
if test "$enable_ntdll_WRITECOPY" -gt 1; then
|
||||
abort "Patchset ntdll-WRITECOPY disabled, but ntdll-Builtin_Prot depends on that."
|
||||
@ -3237,34 +3226,8 @@ if test "$enable_ntdll_NtAccessCheck" -eq 1; then
|
||||
patch_apply ntdll-NtAccessCheck/0001-ntdll-Improve-invalid-paramater-handling-in-NtAccess.patch
|
||||
fi
|
||||
|
||||
# Patchset server-Object_Types
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#44629] Process Hacker can't enumerate handles
|
||||
# | * [#45374] Yet Another Process Monitor (.NET 2.0 app) reports System.AccessViolationException
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ntdll/tests/info.c, dlls/ntdll/tests/om.c, dlls/ntdll/unix/file.c, dlls/ntdll/unix/system.c, include/winternl.h,
|
||||
# | server/completion.c, server/directory.c, server/event.c, server/file.c, server/handle.c, server/mailslot.c,
|
||||
# | server/main.c, server/mapping.c, server/mutex.c, server/named_pipe.c, server/object.c, server/object.h,
|
||||
# | server/process.c, server/protocol.def, server/registry.c, server/semaphore.c, server/symlink.c, server/thread.c,
|
||||
# | server/timer.c, server/token.c, server/winstation.c
|
||||
# |
|
||||
if test "$enable_server_Object_Types" -eq 1; then
|
||||
patch_apply server-Object_Types/0001-ntdll-Implement-SystemExtendedHandleInformation-in-N.patch
|
||||
patch_apply server-Object_Types/0002-ntdll-Implement-ObjectTypesInformation-in-NtQueryObj.patch
|
||||
patch_apply server-Object_Types/0003-server-Register-types-during-startup.patch
|
||||
patch_apply server-Object_Types/0004-server-Rename-ObjectType-to-Type.patch
|
||||
patch_apply server-Object_Types/0008-ntdll-Set-TypeIndex-for-ObjectTypeInformation-in-NtQ.patch
|
||||
patch_apply server-Object_Types/0009-ntdll-Set-object-type-for-System-Extended-HandleInfo.patch
|
||||
patch_apply server-Object_Types/0010-ntdll-Mimic-object-type-behavior-for-different-windo.patch
|
||||
fi
|
||||
|
||||
# Patchset ntdll-NtAlertThreadByThreadId
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * server-Object_Types
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#50292] Process-local synchronization objects use private interfaces into the Unix library
|
||||
# |
|
||||
@ -4429,28 +4392,38 @@ fi
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * include/windows.foundation.idl, include/windows.media.speechsynthesis.idl, tools/widl/expr.c, tools/widl/hash.c,
|
||||
# | tools/widl/hash.h, tools/widl/header.c, tools/widl/parser.l, tools/widl/parser.y, tools/widl/typegen.c,
|
||||
# | tools/widl/typelib.c, tools/widl/typetree.c, tools/widl/typetree.h, tools/widl/utils.c, tools/widl/utils.h,
|
||||
# | tools/widl/widltypes.h
|
||||
# | tools/widl/hash.h, tools/widl/header.c, tools/widl/parser.h, tools/widl/parser.l, tools/widl/parser.y,
|
||||
# | tools/widl/typegen.c, tools/widl/typelib.c, tools/widl/typetree.c, tools/widl/typetree.h, tools/widl/utils.c,
|
||||
# | tools/widl/utils.h, tools/widl/widltypes.h
|
||||
# |
|
||||
if test "$enable_widl_winrt_support" -eq 1; then
|
||||
patch_apply widl-winrt-support/0005-widl-Support-using-qualified-names-for-interfaces.patch
|
||||
patch_apply widl-winrt-support/0006-widl-Support-WinRT-static-attribute-parsing.patch
|
||||
patch_apply widl-winrt-support/0007-widl-Support-WinRT-requires-keyword.patch
|
||||
patch_apply widl-winrt-support/0008-widl-Support-WinRT-activatable-attribute.patch
|
||||
patch_apply widl-winrt-support/0009-widl-Support-WinRT-parameterized-type-parsing.patch
|
||||
patch_apply widl-winrt-support/0010-widl-Introduce-new-strappend-helper.patch
|
||||
patch_apply widl-winrt-support/0011-widl-Support-partially-specialized-parameterized-typ.patch
|
||||
patch_apply widl-winrt-support/0012-widl-Support-WinRT-parameterized-interface-type.patch
|
||||
patch_apply widl-winrt-support/0013-widl-Support-WinRT-delegate-type.patch
|
||||
patch_apply widl-winrt-support/0014-widl-Support-WinRT-parameterized-delegate-type.patch
|
||||
patch_apply widl-winrt-support/0015-widl-Compute-signatures-for-parameterized-types.patch
|
||||
patch_apply widl-winrt-support/0016-widl-Compute-uuids-for-parameterized-types.patch
|
||||
patch_apply widl-winrt-support/0017-widl-Generate-helper-macros-for-WinRT-implementation.patch
|
||||
patch_apply widl-winrt-support/0018-include-Add-IVectorView-HSTRING-declaration-to-windo.patch
|
||||
patch_apply widl-winrt-support/0019-widl-Never-use-the-namespace-ABI-prefix-for-global-t.patch
|
||||
patch_apply widl-winrt-support/0020-widl-Precompute-qualified-type-names-and-use-them-fo.patch
|
||||
patch_apply widl-winrt-support/0021-widl-Define-the-C-type-name-as-an-alias-for-the-C-qu.patch
|
||||
patch_apply widl-winrt-support/0001-widl-Factor-and-cleanup-interface-type-declaration-a.patch
|
||||
patch_apply widl-winrt-support/0002-widl-Factor-and-cleanup-dispinterface-type-declarati.patch
|
||||
patch_apply widl-winrt-support/0003-widl-Factor-and-cleanup-apicontract-type-declaration.patch
|
||||
patch_apply widl-winrt-support/0004-widl-Factor-and-cleanup-module-type-declaration-and-.patch
|
||||
patch_apply widl-winrt-support/0005-widl-Fold-aIDENTIFIER-aKNOWNTYPE-rules-together.patch
|
||||
patch_apply widl-winrt-support/0006-widl-Add-explicit-namespace-parameter-to-find_type_o.patch
|
||||
patch_apply widl-winrt-support/0007-widl-Use-explicit-namespace-parameter-for-qualified-.patch
|
||||
patch_apply widl-winrt-support/0008-widl-Disallow-qualified-types-in-expressions.patch
|
||||
patch_apply widl-winrt-support/0009-widl-Remove-aNAMESPACE-token-from-the-lexer.patch
|
||||
patch_apply widl-winrt-support/0010-widl-Fold-inherit-cases-by-using-typename-rule-in-qu.patch
|
||||
patch_apply widl-winrt-support/0011-widl-Support-referencing-qualified-interface-names.patch
|
||||
patch_apply widl-winrt-support/0012-widl-Support-WinRT-activatable-attribute-parsing.patch
|
||||
patch_apply widl-winrt-support/0013-widl-Support-WinRT-static-attribute-parsing.patch
|
||||
patch_apply widl-winrt-support/0014-include-Add-Windows.Media.SpeechSynthesis.SpeechSynt.patch
|
||||
patch_apply widl-winrt-support/0015-widl-Support-WinRT-requires-keyword.patch
|
||||
patch_apply widl-winrt-support/0016-widl-Support-WinRT-parameterized-type-parsing.patch
|
||||
patch_apply widl-winrt-support/0017-widl-Introduce-new-strappend-helper.patch
|
||||
patch_apply widl-winrt-support/0018-widl-Support-WinRT-parameterized-interface-type.patch
|
||||
patch_apply widl-winrt-support/0019-widl-Support-WinRT-delegate-type.patch
|
||||
patch_apply widl-winrt-support/0020-widl-Support-WinRT-parameterized-delegate-type.patch
|
||||
patch_apply widl-winrt-support/0021-widl-Compute-signatures-for-parameterized-types.patch
|
||||
patch_apply widl-winrt-support/0022-widl-Compute-uuids-for-parameterized-types.patch
|
||||
patch_apply widl-winrt-support/0023-widl-Generate-helper-macros-for-WinRT-implementation.patch
|
||||
patch_apply widl-winrt-support/0024-include-Add-IVectorView-HSTRING-declaration-to-windo.patch
|
||||
patch_apply widl-winrt-support/0025-widl-Never-use-the-namespace-ABI-prefix-for-global-t.patch
|
||||
patch_apply widl-winrt-support/0026-widl-Precompute-qualified-type-names-and-use-them-fo.patch
|
||||
patch_apply widl-winrt-support/0027-widl-Define-the-C-type-name-as-an-alias-for-the-C-qu.patch
|
||||
fi
|
||||
|
||||
# Patchset windows.media.speech.dll
|
||||
|
@ -1,3 +1,5 @@
|
||||
Fixes: [44629] Process Hacker can't enumerate handles
|
||||
Fixes: [45374] Yet Another Process Monitor (.NET 2.0 app) reports System.AccessViolationException
|
||||
#Depends: server-Shared_Memory
|
||||
# In the process of upstreaming...
|
||||
Disabled: true
|
||||
|
@ -1,4 +1,4 @@
|
||||
From c7290ab262bd880a7cae7401ff19e6692e047412 Mon Sep 17 00:00:00 2001
|
||||
From bb39aec79b0478b743dd77b306117acfd2657461 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Mon, 30 Mar 2015 13:04:23 +0200
|
||||
Subject: [PATCH] server: Store file security attributes with extended file
|
||||
@ -9,7 +9,7 @@ Subject: [PATCH] server: Store file security attributes with extended file
|
||||
1 file changed, 78 insertions(+)
|
||||
|
||||
diff --git a/server/file.c b/server/file.c
|
||||
index 64e59307aab..39c64180b6e 100644
|
||||
index d97cec98e67..0a0beb03303 100644
|
||||
--- a/server/file.c
|
||||
+++ b/server/file.c
|
||||
@@ -32,6 +32,7 @@
|
||||
@ -36,9 +36,9 @@ index 64e59307aab..39c64180b6e 100644
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
@@ -52,6 +62,21 @@
|
||||
#include "process.h"
|
||||
#include "security.h"
|
||||
@@ -59,6 +69,21 @@ struct type_descr file_type =
|
||||
{ file_name, sizeof(file_name) }, /* name */
|
||||
};
|
||||
|
||||
+#ifndef XATTR_USER_PREFIX
|
||||
+#define XATTR_USER_PREFIX "user."
|
||||
@ -58,7 +58,7 @@ index 64e59307aab..39c64180b6e 100644
|
||||
struct file
|
||||
{
|
||||
struct object obj; /* object header */
|
||||
@@ -205,6 +230,56 @@ int is_file_executable( const char *name )
|
||||
@@ -211,6 +236,56 @@ int is_file_executable( const char *name )
|
||||
return len >= 4 && (!strcasecmp( name + len - 4, ".exe") || !strcasecmp( name + len - 4, ".com" ));
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ index 64e59307aab..39c64180b6e 100644
|
||||
static struct object *create_file( struct fd *root, const char *nameptr, data_size_t len,
|
||||
unsigned int access, unsigned int sharing, int create,
|
||||
unsigned int options, unsigned int attrs,
|
||||
@@ -625,6 +700,9 @@ int set_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid,
|
||||
@@ -617,6 +692,9 @@ int set_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid,
|
||||
*mode = (*mode & S_IFMT) | new_mode;
|
||||
}
|
||||
|
||||
@ -126,5 +126,5 @@ index 64e59307aab..39c64180b6e 100644
|
||||
obj->sd = new_sd;
|
||||
return 1;
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
||||
|
@ -0,0 +1,162 @@
|
||||
From 72fb994d9750998fde2d8ecbb9bd98983aeb66f8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 4 Feb 2021 10:35:39 +0100
|
||||
Subject: [PATCH] widl: Factor and cleanup interface type declaration and
|
||||
definition.
|
||||
|
||||
---
|
||||
tools/widl/parser.y | 34 ++++++++++------------------------
|
||||
tools/widl/typetree.c | 19 ++++++++++++++++++-
|
||||
tools/widl/typetree.h | 4 +++-
|
||||
3 files changed, 31 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 1505e3e88a0..44716deb5b6 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -87,7 +87,6 @@ static void push_lookup_namespace(const char *name);
|
||||
static void check_arg_attrs(const var_t *arg);
|
||||
static void check_statements(const statement_list_t *stmts, int is_inside_library);
|
||||
static void check_all_user_types(const statement_list_t *stmts);
|
||||
-static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs);
|
||||
static attr_list_t *check_function_attrs(const char *name, attr_list_t *attrs);
|
||||
static attr_list_t *check_typedef_attrs(attr_list_t *attrs);
|
||||
static attr_list_t *check_enum_attrs(attr_list_t *attrs);
|
||||
@@ -281,7 +280,6 @@ static typelib_t *current_typelib;
|
||||
%type <expr> m_expr expr expr_const expr_int_const array m_bitfield
|
||||
%type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const
|
||||
%type <expr> contract_req
|
||||
-%type <type> interfacehdr
|
||||
%type <stgclass> storage_cls_spec
|
||||
%type <type_qualifier> type_qualifier m_type_qual_list
|
||||
%type <function_specifier> function_specifier
|
||||
@@ -971,31 +969,20 @@ inherit: { $$ = NULL; }
|
||||
| ':' qualified_type { $$ = $2; }
|
||||
;
|
||||
|
||||
-interface: tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
- | tINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
+interface:
|
||||
+ tINTERFACE aIDENTIFIER { $$ = type_interface_declare($2, current_namespace); }
|
||||
+ | tINTERFACE aKNOWNTYPE { $$ = type_interface_declare($2, current_namespace); }
|
||||
;
|
||||
|
||||
-interfacehdr: attributes interface { $$ = $2;
|
||||
- check_def($2);
|
||||
- $2->attrs = check_iface_attrs($2->name, $1);
|
||||
- $2->defined = TRUE;
|
||||
- }
|
||||
- ;
|
||||
-
|
||||
-interfacedef: interfacehdr inherit
|
||||
- '{' int_statements '}' semicolon_opt { $$ = $1;
|
||||
- if($$ == $2)
|
||||
- error_loc("Interface can't inherit from itself\n");
|
||||
- type_interface_define($$, $2, $4);
|
||||
+interfacedef: attributes interface inherit
|
||||
+ '{' int_statements '}' semicolon_opt { $$ = type_interface_define($2, $1, $3, $5);
|
||||
check_async_uuid($$);
|
||||
}
|
||||
/* MIDL is able to import the definition of a base class from inside the
|
||||
* definition of a derived class, I'll try to support it with this rule */
|
||||
- | interfacehdr ':' aIDENTIFIER
|
||||
+ | attributes interface ':' aIDENTIFIER
|
||||
'{' import int_statements '}'
|
||||
- semicolon_opt { $$ = $1;
|
||||
- type_interface_define($$, find_type_or_error($3), $6);
|
||||
- }
|
||||
+ semicolon_opt { $$ = type_interface_define($2, $1, find_type_or_error($4), $7); }
|
||||
| dispinterfacedef semicolon_opt { $$ = $1; }
|
||||
;
|
||||
|
||||
@@ -2340,7 +2327,7 @@ const char *get_attr_display_name(enum attr_type type)
|
||||
return allowed_attr[type].display_name;
|
||||
}
|
||||
|
||||
-static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs)
|
||||
+attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs)
|
||||
{
|
||||
const attr_t *attr;
|
||||
if (!attrs) return attrs;
|
||||
@@ -2978,8 +2965,7 @@ static void check_async_uuid(type_t *iface)
|
||||
if (!inherit)
|
||||
error_loc("async_uuid applied to an interface with incompatible parent\n");
|
||||
|
||||
- async_iface = get_type(TYPE_INTERFACE, strmake("Async%s", iface->name), iface->namespace, 0);
|
||||
- async_iface->attrs = map_attrs(iface->attrs, async_iface_attrs);
|
||||
+ async_iface = type_interface_declare(strmake("Async%s", iface->name), iface->namespace);
|
||||
|
||||
STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) )
|
||||
{
|
||||
@@ -3010,7 +2996,7 @@ static void check_async_uuid(type_t *iface)
|
||||
stmts = append_statement(stmts, make_statement_declaration(finish_func));
|
||||
}
|
||||
|
||||
- type_interface_define(async_iface, inherit, stmts);
|
||||
+ type_interface_define(async_iface, map_attrs(iface->attrs, async_iface_attrs), inherit, stmts);
|
||||
iface->details.iface->async_iface = async_iface->details.iface->async_iface = async_iface;
|
||||
}
|
||||
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index 825348ddef4..84be75fa3b7 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -442,8 +442,24 @@ static unsigned int compute_method_indexes(type_t *iface)
|
||||
return idx;
|
||||
}
|
||||
|
||||
-void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts)
|
||||
+type_t *type_interface_declare(char *name, struct namespace *namespace)
|
||||
{
|
||||
+ type_t *type = get_type(TYPE_INTERFACE, name, namespace, 0);
|
||||
+ if (type_get_type_detect_alias(type) != TYPE_INTERFACE)
|
||||
+ error_loc("interface %s previously not declared an interface at %s:%d\n",
|
||||
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
+type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts)
|
||||
+{
|
||||
+ if (iface->defined)
|
||||
+ error_loc("interface %s already defined at %s:%d\n",
|
||||
+ iface->name, iface->loc_info.input_name, iface->loc_info.line_number);
|
||||
+ if (iface == inherit)
|
||||
+ error_loc("interface %s can't inherit from itself\n",
|
||||
+ iface->name);
|
||||
+ iface->attrs = check_interface_attrs(iface->name, attrs);
|
||||
iface->details.iface = xmalloc(sizeof(*iface->details.iface));
|
||||
iface->details.iface->disp_props = NULL;
|
||||
iface->details.iface->disp_methods = NULL;
|
||||
@@ -453,6 +469,7 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm
|
||||
iface->details.iface->async_iface = NULL;
|
||||
iface->defined = TRUE;
|
||||
compute_method_indexes(iface);
|
||||
+ return iface;
|
||||
}
|
||||
|
||||
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods)
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index 8a8e1c529ac..7b67f3b996a 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -30,6 +30,7 @@ enum name_type {
|
||||
};
|
||||
|
||||
attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs);
|
||||
+attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs);
|
||||
attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs);
|
||||
|
||||
type_t *type_new_function(var_list_t *args);
|
||||
@@ -48,7 +49,8 @@ type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t
|
||||
type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases);
|
||||
type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
|
||||
type_t *type_runtimeclass_declare(char *name, struct namespace *namespace);
|
||||
-void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts);
|
||||
+type_t *type_interface_declare(char *name, struct namespace *namespace);
|
||||
+type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts);
|
||||
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods);
|
||||
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
|
||||
void type_module_define(type_t *module, statement_list_t *stmts);
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,182 @@
|
||||
From ae71cd3e9512f1b96ef79eb76507046128e94f6e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 4 Feb 2021 10:34:24 +0100
|
||||
Subject: [PATCH] widl: Factor and cleanup dispinterface type declaration and
|
||||
definition.
|
||||
|
||||
---
|
||||
tools/widl/parser.y | 36 +++++++++++++-----------------------
|
||||
tools/widl/typetree.c | 23 +++++++++++++++++++++--
|
||||
tools/widl/typetree.h | 6 ++++--
|
||||
3 files changed, 38 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 44716deb5b6..349e4730d96 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -95,7 +95,6 @@ static attr_list_t *check_struct_attrs(attr_list_t *attrs);
|
||||
static attr_list_t *check_union_attrs(attr_list_t *attrs);
|
||||
static attr_list_t *check_field_attrs(const char *name, attr_list_t *attrs);
|
||||
static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs);
|
||||
-static attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs);
|
||||
static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
|
||||
static attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs);
|
||||
const char *get_attr_display_name(enum attr_type type);
|
||||
@@ -276,6 +275,7 @@ static typelib_t *current_typelib;
|
||||
%type <attr> attribute acf_attribute
|
||||
%type <attr_list> m_attributes attributes attrib_list
|
||||
%type <attr_list> acf_attributes acf_attribute_list
|
||||
+%type <attr_list> dispattributes
|
||||
%type <str_list> str_list
|
||||
%type <expr> m_expr expr expr_const expr_int_const array m_bitfield
|
||||
%type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const
|
||||
@@ -286,7 +286,7 @@ static typelib_t *current_typelib;
|
||||
%type <declspec> decl_spec decl_spec_no_type m_decl_spec_no_type
|
||||
%type <type> inherit interface interfacedef
|
||||
%type <type> interfaceref
|
||||
-%type <type> dispinterface dispinterfacehdr dispinterfacedef
|
||||
+%type <type> dispinterface dispinterfacedef
|
||||
%type <type> module modulehdr moduledef
|
||||
%type <str> namespacedef
|
||||
%type <type> base_type int_std
|
||||
@@ -932,17 +932,12 @@ class_interface:
|
||||
m_attributes interfaceref ';' { $$ = make_ifref($2); $$->attrs = $1; }
|
||||
;
|
||||
|
||||
-dispinterface: tDISPINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
- | tDISPINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
+dispinterface:
|
||||
+ tDISPINTERFACE aIDENTIFIER { $$ = type_dispinterface_declare($2); }
|
||||
+ | tDISPINTERFACE aKNOWNTYPE { $$ = type_dispinterface_declare($2); }
|
||||
;
|
||||
|
||||
-dispinterfacehdr: attributes dispinterface { attr_t *attrs;
|
||||
- $$ = $2;
|
||||
- check_def($$);
|
||||
- attrs = make_attr(ATTR_DISPINTERFACE);
|
||||
- $$->attrs = append_attr( check_dispiface_attrs($2->name, $1), attrs );
|
||||
- $$->defined = TRUE;
|
||||
- }
|
||||
+dispattributes: attributes { $$ = append_attr($1, make_attr(ATTR_DISPINTERFACE)); }
|
||||
;
|
||||
|
||||
dispint_props: tPROPERTIES ':' { $$ = NULL; }
|
||||
@@ -953,16 +948,11 @@ dispint_meths: tMETHODS ':' { $$ = NULL; }
|
||||
| dispint_meths funcdef ';' { $$ = append_var( $1, $2 ); }
|
||||
;
|
||||
|
||||
-dispinterfacedef: dispinterfacehdr '{'
|
||||
- dispint_props
|
||||
- dispint_meths
|
||||
- '}' { $$ = $1;
|
||||
- type_dispinterface_define($$, $3, $4);
|
||||
- }
|
||||
- | dispinterfacehdr
|
||||
- '{' interface ';' '}' { $$ = $1;
|
||||
- type_dispinterface_define_from_iface($$, $3);
|
||||
- }
|
||||
+dispinterfacedef:
|
||||
+ dispattributes dispinterface '{' dispint_props dispint_meths '}'
|
||||
+ { $$ = type_dispinterface_define($2, $1, $4, $5); }
|
||||
+ | dispattributes dispinterface '{' interface ';' '}'
|
||||
+ { $$ = type_dispinterface_define_from_iface($2, $1, $4); }
|
||||
;
|
||||
|
||||
inherit: { $$ = NULL; }
|
||||
@@ -2214,7 +2204,7 @@ struct allowed_attr allowed_attr[] =
|
||||
/* ATTR_DEFAULTVALUE */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultvalue" },
|
||||
/* ATTR_DEFAULTVTABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "defaultvtable" },
|
||||
/* ATTR_DISABLECONSISTENCYCHECK */{ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "disable_consistency_check" },
|
||||
- /* ATTR_DISPINTERFACE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL },
|
||||
+ /* ATTR_DISPINTERFACE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, NULL },
|
||||
/* ATTR_DISPLAYBIND */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "displaybind" },
|
||||
/* ATTR_DLLNAME */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "dllname" },
|
||||
/* ATTR_DUAL */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "dual" },
|
||||
@@ -2471,7 +2461,7 @@ static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs)
|
||||
return attrs;
|
||||
}
|
||||
|
||||
-static attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs)
|
||||
+attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs)
|
||||
{
|
||||
const attr_t *attr;
|
||||
if (!attrs) return attrs;
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index 84be75fa3b7..81eaba5556b 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -472,8 +472,21 @@ type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit
|
||||
return iface;
|
||||
}
|
||||
|
||||
-void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods)
|
||||
+type_t *type_dispinterface_declare(char *name)
|
||||
{
|
||||
+ type_t *type = get_type(TYPE_INTERFACE, name, NULL, 0);
|
||||
+ if (type_get_type_detect_alias(type) != TYPE_INTERFACE)
|
||||
+ error_loc("dispinterface %s previously not declared a dispinterface at %s:%d\n",
|
||||
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
+type_t *type_dispinterface_define(type_t *iface, attr_list_t *attrs, var_list_t *props, var_list_t *methods)
|
||||
+{
|
||||
+ if (iface->defined)
|
||||
+ error_loc("dispinterface %s already defined at %s:%d\n",
|
||||
+ iface->name, iface->loc_info.input_name, iface->loc_info.line_number);
|
||||
+ iface->attrs = check_dispiface_attrs(iface->name, attrs);
|
||||
iface->details.iface = xmalloc(sizeof(*iface->details.iface));
|
||||
iface->details.iface->disp_props = props;
|
||||
iface->details.iface->disp_methods = methods;
|
||||
@@ -484,10 +497,15 @@ void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *met
|
||||
iface->details.iface->async_iface = NULL;
|
||||
iface->defined = TRUE;
|
||||
compute_method_indexes(iface);
|
||||
+ return iface;
|
||||
}
|
||||
|
||||
-void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface)
|
||||
+type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *attrs, type_t *iface)
|
||||
{
|
||||
+ if (dispiface->defined)
|
||||
+ error_loc("dispinterface %s already defined at %s:%d\n",
|
||||
+ dispiface->name, dispiface->loc_info.input_name, dispiface->loc_info.line_number);
|
||||
+ dispiface->attrs = check_dispiface_attrs(dispiface->name, attrs);
|
||||
dispiface->details.iface = xmalloc(sizeof(*dispiface->details.iface));
|
||||
dispiface->details.iface->disp_props = NULL;
|
||||
dispiface->details.iface->disp_methods = NULL;
|
||||
@@ -498,6 +516,7 @@ void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface)
|
||||
dispiface->details.iface->async_iface = NULL;
|
||||
dispiface->defined = TRUE;
|
||||
compute_method_indexes(dispiface);
|
||||
+ return dispiface;
|
||||
}
|
||||
|
||||
void type_module_define(type_t *module, statement_list_t *stmts)
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index 7b67f3b996a..280d2e722cf 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -30,6 +30,7 @@ enum name_type {
|
||||
};
|
||||
|
||||
attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs);
|
||||
+attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs);
|
||||
attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs);
|
||||
attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs);
|
||||
|
||||
@@ -51,8 +52,9 @@ type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
|
||||
type_t *type_runtimeclass_declare(char *name, struct namespace *namespace);
|
||||
type_t *type_interface_declare(char *name, struct namespace *namespace);
|
||||
type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts);
|
||||
-void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods);
|
||||
-void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
|
||||
+type_t *type_dispinterface_declare(char *name);
|
||||
+type_t *type_dispinterface_define(type_t *iface, attr_list_t *attrs, var_list_t *props, var_list_t *methods);
|
||||
+type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *attrs, type_t *iface);
|
||||
void type_module_define(type_t *module, statement_list_t *stmts);
|
||||
type_t *type_coclass_define(type_t *coclass, attr_list_t *attrs, ifref_list_t *ifaces);
|
||||
type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref_list_t *ifaces);
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,154 @@
|
||||
From 623643c78b618ae83aaebaaf16988d8765bf5eff Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 4 Feb 2021 10:56:18 +0100
|
||||
Subject: [PATCH] widl: Factor and cleanup apicontract type declaration and
|
||||
definition.
|
||||
|
||||
And remove unused check_def helper.
|
||||
---
|
||||
tools/widl/parser.y | 35 +++++++++++++++--------------------
|
||||
tools/widl/typetree.c | 19 +++++++++++++++++++
|
||||
tools/widl/typetree.h | 3 +++
|
||||
3 files changed, 37 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 349e4730d96..8c805e481f8 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -96,10 +96,8 @@ static attr_list_t *check_union_attrs(attr_list_t *attrs);
|
||||
static attr_list_t *check_field_attrs(const char *name, attr_list_t *attrs);
|
||||
static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs);
|
||||
static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
|
||||
-static attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs);
|
||||
const char *get_attr_display_name(enum attr_type type);
|
||||
static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func);
|
||||
-static void check_def(const type_t *t);
|
||||
|
||||
static void check_async_uuid(type_t *iface);
|
||||
|
||||
@@ -305,7 +303,7 @@ static typelib_t *current_typelib;
|
||||
%type <declarator_list> declarator_list struct_declarator_list
|
||||
%type <type> coclass coclassdef
|
||||
%type <type> runtimeclass runtimeclass_def
|
||||
-%type <type> apicontract
|
||||
+%type <type> apicontract apicontract_def
|
||||
%type <num> contract_ver
|
||||
%type <num> pointer_type threading_type marshaling_behavior version
|
||||
%type <str> libraryhdr callconv cppquote importlib import t_ident
|
||||
@@ -364,8 +362,9 @@ gbl_statements: { $$ = NULL; }
|
||||
| gbl_statements coclassdef { $$ = append_statement($1, make_statement_type_decl($2));
|
||||
reg_type($2, $2->name, current_namespace, 0);
|
||||
}
|
||||
- | gbl_statements apicontract ';' { $$ = append_statement($1, make_statement_type_decl($2));
|
||||
- reg_type($2, $2->name, current_namespace, 0); }
|
||||
+ | gbl_statements apicontract ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); }
|
||||
+ | gbl_statements apicontract_def { $$ = append_statement($1, make_statement_type_decl($2));
|
||||
+ reg_type($2, $2->name, current_namespace, 0); }
|
||||
| gbl_statements runtimeclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); }
|
||||
| gbl_statements runtimeclass_def { $$ = append_statement($1, make_statement_type_decl($2));
|
||||
reg_type($2, $2->name, current_namespace, 0); }
|
||||
@@ -384,8 +383,9 @@ imp_statements: { $$ = NULL; }
|
||||
| imp_statements coclassdef { $$ = append_statement($1, make_statement_type_decl($2));
|
||||
reg_type($2, $2->name, current_namespace, 0);
|
||||
}
|
||||
- | imp_statements apicontract ';' { $$ = append_statement($1, make_statement_type_decl($2));
|
||||
- reg_type($2, $2->name, current_namespace, 0); }
|
||||
+ | imp_statements apicontract ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); }
|
||||
+ | imp_statements apicontract_def { $$ = append_statement($1, make_statement_type_decl($2));
|
||||
+ reg_type($2, $2->name, current_namespace, 0); }
|
||||
| imp_statements runtimeclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); }
|
||||
| imp_statements runtimeclass_def { $$ = append_statement($1, make_statement_type_decl($2));
|
||||
reg_type($2, $2->name, current_namespace, 0); }
|
||||
@@ -913,11 +913,13 @@ runtimeclass_def: attributes runtimeclass '{' class_interfaces '}' semicolon_opt
|
||||
{ $$ = type_runtimeclass_define($2, $1, $4); }
|
||||
;
|
||||
|
||||
-apicontract: attributes tAPICONTRACT aIDENTIFIER '{' '}'
|
||||
- { $$ = get_type(TYPE_APICONTRACT, $3, current_namespace, 0);
|
||||
- check_def($$);
|
||||
- $$->attrs = check_apicontract_attrs($$->name, $1);
|
||||
- }
|
||||
+apicontract:
|
||||
+ tAPICONTRACT aIDENTIFIER { $$ = type_apicontract_declare($2, current_namespace); }
|
||||
+ | tAPICONTRACT aKNOWNTYPE { $$ = type_apicontract_declare($2, current_namespace); }
|
||||
+ ;
|
||||
+
|
||||
+apicontract_def: attributes apicontract '{' '}' semicolon_opt
|
||||
+ { $$ = type_apicontract_define($2, $1); }
|
||||
;
|
||||
|
||||
namespacedef: tNAMESPACE aIDENTIFIER { $$ = $2; }
|
||||
@@ -2511,7 +2513,7 @@ attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs)
|
||||
return attrs;
|
||||
}
|
||||
|
||||
-static attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs)
|
||||
+attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs)
|
||||
{
|
||||
const attr_t *attr;
|
||||
if (!attrs) return attrs;
|
||||
@@ -3205,10 +3207,3 @@ void init_loc_info(loc_info_t *i)
|
||||
i->line_number = line_number;
|
||||
i->near_text = parser_text;
|
||||
}
|
||||
-
|
||||
-static void check_def(const type_t *t)
|
||||
-{
|
||||
- if (t->defined)
|
||||
- error_loc("%s: redefinition error; original definition was at %s:%d\n",
|
||||
- t->name, t->loc_info.input_name, t->loc_info.line_number);
|
||||
-}
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index 81eaba5556b..004f7fc7b0d 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -569,6 +569,25 @@ type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref
|
||||
return runtimeclass;
|
||||
}
|
||||
|
||||
+type_t *type_apicontract_declare(char *name, struct namespace *namespace)
|
||||
+{
|
||||
+ type_t *type = get_type(TYPE_APICONTRACT, name, namespace, 0);
|
||||
+ if (type_get_type_detect_alias(type) != TYPE_APICONTRACT)
|
||||
+ error_loc("apicontract %s previously not declared a apicontract at %s:%d\n",
|
||||
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
+type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs)
|
||||
+{
|
||||
+ if (apicontract->defined)
|
||||
+ error_loc("apicontract %s already defined at %s:%d\n",
|
||||
+ apicontract->name, apicontract->loc_info.input_name, apicontract->loc_info.line_number);
|
||||
+ apicontract->attrs = check_apicontract_attrs(apicontract->name, attrs);
|
||||
+ apicontract->defined = TRUE;
|
||||
+ return apicontract;
|
||||
+}
|
||||
+
|
||||
int type_is_equal(const type_t *type1, const type_t *type2)
|
||||
{
|
||||
if (type_get_type_detect_alias(type1) != type_get_type_detect_alias(type2))
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index 280d2e722cf..7c19da8e045 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -29,6 +29,7 @@ enum name_type {
|
||||
NAME_C
|
||||
};
|
||||
|
||||
+attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs);
|
||||
attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs);
|
||||
attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs);
|
||||
attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs);
|
||||
@@ -58,6 +59,8 @@ type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *att
|
||||
void type_module_define(type_t *module, statement_list_t *stmts);
|
||||
type_t *type_coclass_define(type_t *coclass, attr_list_t *attrs, ifref_list_t *ifaces);
|
||||
type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref_list_t *ifaces);
|
||||
+type_t *type_apicontract_declare(char *name, struct namespace *namespace);
|
||||
+type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs);
|
||||
int type_is_equal(const type_t *type1, const type_t *type2);
|
||||
const char *type_get_name(const type_t *type, enum name_type name_type);
|
||||
char *gen_name(void);
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,146 @@
|
||||
From fd50398643cafcfa3868a9e47429db7136a16ef5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 4 Feb 2021 11:02:09 +0100
|
||||
Subject: [PATCH] widl: Factor and cleanup module type declaration and
|
||||
definition.
|
||||
|
||||
---
|
||||
tools/widl/parser.y | 20 ++++++--------------
|
||||
tools/widl/typetree.c | 27 +++++++++++++++------------
|
||||
tools/widl/typetree.h | 5 +++--
|
||||
3 files changed, 24 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 8c805e481f8..782ed39643c 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -95,7 +95,6 @@ static attr_list_t *check_struct_attrs(attr_list_t *attrs);
|
||||
static attr_list_t *check_union_attrs(attr_list_t *attrs);
|
||||
static attr_list_t *check_field_attrs(const char *name, attr_list_t *attrs);
|
||||
static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs);
|
||||
-static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
|
||||
const char *get_attr_display_name(enum attr_type type);
|
||||
static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func);
|
||||
|
||||
@@ -285,7 +284,7 @@ static typelib_t *current_typelib;
|
||||
%type <type> inherit interface interfacedef
|
||||
%type <type> interfaceref
|
||||
%type <type> dispinterface dispinterfacedef
|
||||
-%type <type> module modulehdr moduledef
|
||||
+%type <type> module moduledef
|
||||
%type <str> namespacedef
|
||||
%type <type> base_type int_std
|
||||
%type <type> enumdef structdef uniondef typedecl
|
||||
@@ -985,19 +984,12 @@ interfaceref:
|
||||
| tDISPINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
;
|
||||
|
||||
-module: tMODULE aIDENTIFIER { $$ = type_new_module($2); }
|
||||
- | tMODULE aKNOWNTYPE { $$ = type_new_module($2); }
|
||||
+module: tMODULE aIDENTIFIER { $$ = type_module_declare($2); }
|
||||
+ | tMODULE aKNOWNTYPE { $$ = type_module_declare($2); }
|
||||
;
|
||||
|
||||
-modulehdr: attributes module { $$ = $2;
|
||||
- $$->attrs = check_module_attrs($2->name, $1);
|
||||
- }
|
||||
- ;
|
||||
-
|
||||
-moduledef: modulehdr '{' int_statements '}'
|
||||
- semicolon_opt { $$ = $1;
|
||||
- type_module_define($$, $3);
|
||||
- }
|
||||
+moduledef: attributes module '{' int_statements '}' semicolon_opt
|
||||
+ { $$ = type_module_define($2, $1, $4); }
|
||||
;
|
||||
|
||||
storage_cls_spec:
|
||||
@@ -2476,7 +2468,7 @@ attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs)
|
||||
return attrs;
|
||||
}
|
||||
|
||||
-static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs)
|
||||
+attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs)
|
||||
{
|
||||
const attr_t *attr;
|
||||
if (!attrs) return attrs;
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index 004f7fc7b0d..b3f0725f00e 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -195,16 +195,6 @@ type_t *type_new_alias(const decl_spec_t *t, const char *name)
|
||||
return a;
|
||||
}
|
||||
|
||||
-type_t *type_new_module(char *name)
|
||||
-{
|
||||
- type_t *type = get_type(TYPE_MODULE, name, NULL, 0);
|
||||
- if (type->type_type != TYPE_MODULE || type->defined)
|
||||
- error_loc("%s: redefinition error; original definition was at %s:%d\n",
|
||||
- type->name, type->loc_info.input_name, type->loc_info.line_number);
|
||||
- type->name = name;
|
||||
- return type;
|
||||
-}
|
||||
-
|
||||
type_t *type_new_array(const char *name, const decl_spec_t *element, int declptr,
|
||||
unsigned int dim, expr_t *size_is, expr_t *length_is)
|
||||
{
|
||||
@@ -519,12 +509,25 @@ type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *att
|
||||
return dispiface;
|
||||
}
|
||||
|
||||
-void type_module_define(type_t *module, statement_list_t *stmts)
|
||||
+type_t *type_module_declare(char *name)
|
||||
+{
|
||||
+ type_t *type = get_type(TYPE_MODULE, name, NULL, 0);
|
||||
+ if (type_get_type_detect_alias(type) != TYPE_MODULE)
|
||||
+ error_loc("module %s previously not declared a module at %s:%d\n",
|
||||
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
+type_t *type_module_define(type_t* module, attr_list_t *attrs, statement_list_t *stmts)
|
||||
{
|
||||
- if (module->details.module) error_loc("multiple definition error\n");
|
||||
+ if (module->defined)
|
||||
+ error_loc("module %s already defined at %s:%d\n",
|
||||
+ module->name, module->loc_info.input_name, module->loc_info.line_number);
|
||||
+ module->attrs = check_module_attrs(module->name, attrs);
|
||||
module->details.module = xmalloc(sizeof(*module->details.module));
|
||||
module->details.module->stmts = stmts;
|
||||
module->defined = TRUE;
|
||||
+ return module;
|
||||
}
|
||||
|
||||
type_t *type_coclass_declare(char *name)
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index 7c19da8e045..8e04537ab4d 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -33,12 +33,13 @@ attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs);
|
||||
attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs);
|
||||
attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs);
|
||||
attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs);
|
||||
+attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
|
||||
attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs);
|
||||
|
||||
type_t *type_new_function(var_list_t *args);
|
||||
type_t *type_new_pointer(type_t *ref);
|
||||
type_t *type_new_alias(const decl_spec_t *t, const char *name);
|
||||
-type_t *type_new_module(char *name);
|
||||
+type_t *type_module_declare(char *name);
|
||||
type_t *type_new_array(const char *name, const decl_spec_t *element, int declptr,
|
||||
unsigned int dim, expr_t *size_is, expr_t *length_is);
|
||||
type_t *type_new_basic(enum type_basic_type basic_type);
|
||||
@@ -56,7 +57,7 @@ type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit
|
||||
type_t *type_dispinterface_declare(char *name);
|
||||
type_t *type_dispinterface_define(type_t *iface, attr_list_t *attrs, var_list_t *props, var_list_t *methods);
|
||||
type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *attrs, type_t *iface);
|
||||
-void type_module_define(type_t *module, statement_list_t *stmts);
|
||||
+type_t *type_module_define(type_t* module, attr_list_t *attrs, statement_list_t *stmts);
|
||||
type_t *type_coclass_define(type_t *coclass, attr_list_t *attrs, ifref_list_t *ifaces);
|
||||
type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref_list_t *ifaces);
|
||||
type_t *type_apicontract_declare(char *name, struct namespace *namespace);
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,159 @@
|
||||
From bc7044d3cd826d7b3e01566514f9515c3fd7bc5c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 4 Feb 2021 16:46:40 +0100
|
||||
Subject: [PATCH] widl: Fold aIDENTIFIER / aKNOWNTYPE rules together.
|
||||
|
||||
Splitting t_ident rule as typename / m_typename rules.
|
||||
---
|
||||
tools/widl/parser.y | 55 ++++++++++++++++++---------------------------
|
||||
1 file changed, 22 insertions(+), 33 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 782ed39643c..2d527805c14 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -305,7 +305,8 @@ static typelib_t *current_typelib;
|
||||
%type <type> apicontract apicontract_def
|
||||
%type <num> contract_ver
|
||||
%type <num> pointer_type threading_type marshaling_behavior version
|
||||
-%type <str> libraryhdr callconv cppquote importlib import t_ident
|
||||
+%type <str> libraryhdr callconv cppquote importlib import
|
||||
+%type <str> typename m_typename
|
||||
%type <uuid> uuid_string
|
||||
%type <import> import_start
|
||||
%type <typelib> library_start librarydef
|
||||
@@ -459,8 +460,7 @@ importlib: tIMPORTLIB '(' aSTRING ')'
|
||||
semicolon_opt { $$ = $3; if(!parse_only) add_importlib($3, current_typelib); }
|
||||
;
|
||||
|
||||
-libraryhdr: tLIBRARY aIDENTIFIER { $$ = $2; }
|
||||
- | tLIBRARY aKNOWNTYPE { $$ = $2; }
|
||||
+libraryhdr: tLIBRARY typename { $$ = $2; }
|
||||
;
|
||||
library_start: attributes libraryhdr '{' { $$ = make_library($2, check_library_attrs($2, $1));
|
||||
if (!parse_only && do_typelib) current_typelib = $$;
|
||||
@@ -715,7 +715,7 @@ enum: enum_member '=' expr_int_const { $$ = reg_const($1);
|
||||
}
|
||||
;
|
||||
|
||||
-enumdef: tENUM t_ident '{' enums '}' { $$ = type_new_enum($2, current_namespace, TRUE, $4); }
|
||||
+enumdef: tENUM m_typename '{' enums '}' { $$ = type_new_enum($2, current_namespace, TRUE, $4); }
|
||||
;
|
||||
|
||||
m_exprs: m_expr { $$ = append_expr( NULL, $1 ); }
|
||||
@@ -847,14 +847,15 @@ m_ident: { $$ = NULL; }
|
||||
| ident
|
||||
;
|
||||
|
||||
-t_ident: { $$ = NULL; }
|
||||
- | aIDENTIFIER { $$ = $1; }
|
||||
- | aKNOWNTYPE { $$ = $1; }
|
||||
+m_typename: { $$ = NULL; }
|
||||
+ | typename
|
||||
;
|
||||
|
||||
-ident: aIDENTIFIER { $$ = make_var($1); }
|
||||
-/* some "reserved words" used in attributes are also used as field names in some MS IDL files */
|
||||
- | aKNOWNTYPE { $$ = make_var($<str>1); }
|
||||
+typename: aIDENTIFIER
|
||||
+ | aKNOWNTYPE
|
||||
+ ;
|
||||
+
|
||||
+ident: typename { $$ = make_var($1); }
|
||||
;
|
||||
|
||||
base_type: tBYTE { $$ = find_type_or_error($<str>1); }
|
||||
@@ -895,26 +896,21 @@ qualified_type:
|
||||
| aNAMESPACE '.' { init_lookup_namespace($1); } qualified_seq { $$ = $4; }
|
||||
;
|
||||
|
||||
-coclass: tCOCLASS aIDENTIFIER { $$ = type_coclass_declare($2); }
|
||||
- | tCOCLASS aKNOWNTYPE { $$ = type_coclass_declare($2); }
|
||||
+coclass: tCOCLASS typename { $$ = type_coclass_declare($2); }
|
||||
;
|
||||
|
||||
coclassdef: attributes coclass '{' class_interfaces '}' semicolon_opt
|
||||
{ $$ = type_coclass_define($2, $1, $4); }
|
||||
;
|
||||
|
||||
-runtimeclass:
|
||||
- tRUNTIMECLASS aIDENTIFIER { $$ = type_runtimeclass_declare($2, current_namespace); }
|
||||
- | tRUNTIMECLASS aKNOWNTYPE { $$ = type_runtimeclass_declare($2, current_namespace); }
|
||||
+runtimeclass: tRUNTIMECLASS typename { $$ = type_runtimeclass_declare($2, current_namespace); }
|
||||
;
|
||||
|
||||
runtimeclass_def: attributes runtimeclass '{' class_interfaces '}' semicolon_opt
|
||||
{ $$ = type_runtimeclass_define($2, $1, $4); }
|
||||
;
|
||||
|
||||
-apicontract:
|
||||
- tAPICONTRACT aIDENTIFIER { $$ = type_apicontract_declare($2, current_namespace); }
|
||||
- | tAPICONTRACT aKNOWNTYPE { $$ = type_apicontract_declare($2, current_namespace); }
|
||||
+apicontract: tAPICONTRACT typename { $$ = type_apicontract_declare($2, current_namespace); }
|
||||
;
|
||||
|
||||
apicontract_def: attributes apicontract '{' '}' semicolon_opt
|
||||
@@ -933,9 +929,7 @@ class_interface:
|
||||
m_attributes interfaceref ';' { $$ = make_ifref($2); $$->attrs = $1; }
|
||||
;
|
||||
|
||||
-dispinterface:
|
||||
- tDISPINTERFACE aIDENTIFIER { $$ = type_dispinterface_declare($2); }
|
||||
- | tDISPINTERFACE aKNOWNTYPE { $$ = type_dispinterface_declare($2); }
|
||||
+dispinterface: tDISPINTERFACE typename { $$ = type_dispinterface_declare($2); }
|
||||
;
|
||||
|
||||
dispattributes: attributes { $$ = append_attr($1, make_attr(ATTR_DISPINTERFACE)); }
|
||||
@@ -960,9 +954,7 @@ inherit: { $$ = NULL; }
|
||||
| ':' qualified_type { $$ = $2; }
|
||||
;
|
||||
|
||||
-interface:
|
||||
- tINTERFACE aIDENTIFIER { $$ = type_interface_declare($2, current_namespace); }
|
||||
- | tINTERFACE aKNOWNTYPE { $$ = type_interface_declare($2, current_namespace); }
|
||||
+interface: tINTERFACE typename { $$ = type_interface_declare($2, current_namespace); }
|
||||
;
|
||||
|
||||
interfacedef: attributes interface inherit
|
||||
@@ -978,14 +970,11 @@ interfacedef: attributes interface inherit
|
||||
;
|
||||
|
||||
interfaceref:
|
||||
- tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
- | tINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
- | tDISPINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
- | tDISPINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
+ tINTERFACE typename { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
+ | tDISPINTERFACE typename { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
;
|
||||
|
||||
-module: tMODULE aIDENTIFIER { $$ = type_module_declare($2); }
|
||||
- | tMODULE aKNOWNTYPE { $$ = type_module_declare($2); }
|
||||
+module: tMODULE typename { $$ = type_module_declare($2); }
|
||||
;
|
||||
|
||||
moduledef: attributes module '{' int_statements '}' semicolon_opt
|
||||
@@ -1153,7 +1142,7 @@ pointer_type:
|
||||
| tPTR { $$ = FC_FP; }
|
||||
;
|
||||
|
||||
-structdef: tSTRUCT t_ident '{' fields '}' { $$ = type_new_struct($2, current_namespace, TRUE, $4); }
|
||||
+structdef: tSTRUCT m_typename '{' fields '}' { $$ = type_new_struct($2, current_namespace, TRUE, $4); }
|
||||
;
|
||||
|
||||
type: tVOID { $$ = type_new_void(); }
|
||||
@@ -1175,9 +1164,9 @@ typedef: m_attributes tTYPEDEF m_attributes decl_spec declarator_list
|
||||
}
|
||||
;
|
||||
|
||||
-uniondef: tUNION t_ident '{' ne_union_fields '}'
|
||||
+uniondef: tUNION m_typename '{' ne_union_fields '}'
|
||||
{ $$ = type_new_nonencapsulated_union($2, TRUE, $4); }
|
||||
- | tUNION t_ident
|
||||
+ | tUNION m_typename
|
||||
tSWITCH '(' s_field ')'
|
||||
m_ident '{' cases '}' { $$ = type_new_encapsulated_union($2, $5, $7, $9); }
|
||||
;
|
||||
--
|
||||
2.20.1
|
||||
|
@ -1,156 +0,0 @@
|
||||
From 2719c1018570b5fed5058541f54a3334044de160 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 25 Sep 2020 17:13:47 +0200
|
||||
Subject: [PATCH] widl: Support using qualified names for interfaces.
|
||||
|
||||
And make qualified name lookup more robust, only looking for types in
|
||||
the lookup namespace if it's active.
|
||||
---
|
||||
include/windows.media.speechsynthesis.idl | 2 +-
|
||||
tools/widl/parser.y | 58 +++++++++++++++--------
|
||||
2 files changed, 38 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/include/windows.media.speechsynthesis.idl b/include/windows.media.speechsynthesis.idl
|
||||
index 71c51b74c0c..502261f79c6 100644
|
||||
--- a/include/windows.media.speechsynthesis.idl
|
||||
+++ b/include/windows.media.speechsynthesis.idl
|
||||
@@ -64,7 +64,7 @@ namespace Windows {
|
||||
]
|
||||
runtimeclass VoiceInformation
|
||||
{
|
||||
- [default] interface IVoiceInformation;
|
||||
+ [default] interface Windows.Media.SpeechSynthesis.IVoiceInformation;
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 480552e3723..1e3e254ec8c 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -75,6 +75,8 @@ static void append_chain_callconv(type_t *chain, char *callconv);
|
||||
static warning_list_t *append_warning(warning_list_t *, int);
|
||||
|
||||
static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs);
|
||||
+static type_t *get_qualified_type(enum type_type type, char *name, int t);
|
||||
+static type_t *find_qualified_type_or_error(const char *name, int t);
|
||||
static type_t *find_type_or_error(const char *name, int t);
|
||||
static type_t *find_type_or_error2(char *name, int t);
|
||||
|
||||
@@ -82,7 +84,6 @@ static var_t *reg_const(var_t *var);
|
||||
|
||||
static void push_namespace(const char *name);
|
||||
static void pop_namespace(const char *name);
|
||||
-static void init_lookup_namespace(const char *name);
|
||||
static void push_lookup_namespace(const char *name);
|
||||
|
||||
static void check_arg_attrs(const var_t *arg);
|
||||
@@ -295,7 +296,7 @@ static typelib_t *current_typelib;
|
||||
%type <str> namespacedef
|
||||
%type <type> base_type int_std
|
||||
%type <type> enumdef structdef uniondef typedecl
|
||||
-%type <type> type qualified_seq qualified_type
|
||||
+%type <type> type qualified_type
|
||||
%type <ifref> class_interface
|
||||
%type <ifref_list> class_interfaces
|
||||
%type <var> arg ne_union_field union_field s_field case enum enum_member declaration
|
||||
@@ -888,15 +889,15 @@ int_std: tINT { $$ = type_new_int(TYPE_BASIC_INT, 0); }
|
||||
| tINT3264 { $$ = type_new_int(TYPE_BASIC_INT3264, 0); }
|
||||
;
|
||||
|
||||
-qualified_seq:
|
||||
- aKNOWNTYPE { $$ = find_type_or_error($1, 0); }
|
||||
- | aIDENTIFIER '.' { push_lookup_namespace($1); } qualified_seq { $$ = $4; }
|
||||
- ;
|
||||
+namespace_pfx:
|
||||
+ aNAMESPACE '.' { push_lookup_namespace($1); }
|
||||
+ | namespace_pfx aNAMESPACE '.' { push_lookup_namespace($2); }
|
||||
+ ;
|
||||
|
||||
qualified_type:
|
||||
- aKNOWNTYPE { $$ = find_type_or_error($1, 0); }
|
||||
- | aNAMESPACE '.' { init_lookup_namespace($1); } qualified_seq { $$ = $4; }
|
||||
- ;
|
||||
+ aKNOWNTYPE { $$ = find_type_or_error($1, 0); }
|
||||
+ | namespace_pfx aKNOWNTYPE { $$ = find_qualified_type_or_error($2, 0); }
|
||||
+ ;
|
||||
|
||||
coclass: tCOCLASS aIDENTIFIER { $$ = type_new_coclass($2); }
|
||||
| tCOCLASS aKNOWNTYPE { $$ = find_type($2, NULL, 0);
|
||||
@@ -994,6 +995,8 @@ inherit: { $$ = NULL; }
|
||||
|
||||
interface: tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
| tINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
+ | tINTERFACE namespace_pfx aIDENTIFIER { $$ = get_qualified_type(TYPE_INTERFACE, $3, 0); }
|
||||
+ | tINTERFACE namespace_pfx aKNOWNTYPE { $$ = get_qualified_type(TYPE_INTERFACE, $3, 0); }
|
||||
;
|
||||
|
||||
interfacehdr: attributes interface { $$ = $2;
|
||||
@@ -1970,12 +1973,6 @@ static void pop_namespace(const char *name)
|
||||
current_namespace = current_namespace->parent;
|
||||
}
|
||||
|
||||
-static void init_lookup_namespace(const char *name)
|
||||
-{
|
||||
- if (!(lookup_namespace = find_sub_namespace(&global_namespace, name)))
|
||||
- error_loc("namespace '%s' not found\n", name);
|
||||
-}
|
||||
-
|
||||
static void push_lookup_namespace(const char *name)
|
||||
{
|
||||
struct namespace *namespace;
|
||||
@@ -2093,11 +2090,29 @@ type_t *find_type(const char *name, struct namespace *namespace, int t)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+static type_t *get_qualified_type(enum type_type type_type, char *name, int t)
|
||||
+{
|
||||
+ type_t *type = get_type(type_type, name, lookup_namespace, t);
|
||||
+ lookup_namespace = &global_namespace;
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
+static type_t *find_qualified_type_or_error(const char *name, int t)
|
||||
+{
|
||||
+ type_t *type;
|
||||
+ if (!(type = find_type(name, lookup_namespace, t)))
|
||||
+ {
|
||||
+ error_loc("type '%s' not found\n", name);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ lookup_namespace = &global_namespace;
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
static type_t *find_type_or_error(const char *name, int t)
|
||||
{
|
||||
type_t *type;
|
||||
- if (!(type = find_type(name, current_namespace, t)) &&
|
||||
- !(type = find_type(name, lookup_namespace, t)))
|
||||
+ if (!(type = find_type(name, current_namespace, t)))
|
||||
{
|
||||
error_loc("type '%s' not found\n", name);
|
||||
return NULL;
|
||||
@@ -2114,15 +2129,16 @@ static type_t *find_type_or_error2(char *name, int t)
|
||||
|
||||
int is_type(const char *name)
|
||||
{
|
||||
- return find_type(name, current_namespace, 0) != NULL ||
|
||||
- find_type(name, lookup_namespace, 0) != NULL;
|
||||
+ if (lookup_namespace != &global_namespace)
|
||||
+ return find_type(name, lookup_namespace, 0) != NULL;
|
||||
+ else
|
||||
+ return find_type(name, current_namespace, 0) != NULL;
|
||||
}
|
||||
|
||||
int is_namespace(const char *name)
|
||||
{
|
||||
if (!winrt_mode) return 0;
|
||||
- return find_sub_namespace(current_namespace, name) != NULL ||
|
||||
- find_sub_namespace(&global_namespace, name) != NULL;
|
||||
+ return find_sub_namespace(lookup_namespace, name) != NULL;
|
||||
}
|
||||
|
||||
type_t *get_type(enum type_type type, char *name, struct namespace *namespace, int t)
|
||||
--
|
||||
2.29.2
|
||||
|
@ -0,0 +1,126 @@
|
||||
From f3dedfb67b596ff167e464bc2469be8a00f01be2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 4 Feb 2021 00:20:02 +0100
|
||||
Subject: [PATCH] widl: Add explicit namespace parameter to find_type_or_error.
|
||||
|
||||
---
|
||||
tools/widl/parser.y | 37 ++++++++++++++++++-------------------
|
||||
1 file changed, 18 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 2d527805c14..17a3727b114 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -75,7 +75,7 @@ static void append_chain_callconv(type_t *chain, char *callconv);
|
||||
static warning_list_t *append_warning(warning_list_t *, int);
|
||||
|
||||
static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs);
|
||||
-static type_t *find_type_or_error(const char *name);
|
||||
+static type_t *find_type_or_error(struct namespace *parent, const char *name);
|
||||
|
||||
static var_t *reg_const(var_t *var);
|
||||
|
||||
@@ -858,17 +858,17 @@ typename: aIDENTIFIER
|
||||
ident: typename { $$ = make_var($1); }
|
||||
;
|
||||
|
||||
-base_type: tBYTE { $$ = find_type_or_error($<str>1); }
|
||||
- | tWCHAR { $$ = find_type_or_error($<str>1); }
|
||||
+base_type: tBYTE { $$ = find_type_or_error(NULL, $<str>1); }
|
||||
+ | tWCHAR { $$ = find_type_or_error(NULL, $<str>1); }
|
||||
| int_std
|
||||
| tSIGNED int_std { $$ = type_new_int(type_basic_get_type($2), -1); }
|
||||
| tUNSIGNED int_std { $$ = type_new_int(type_basic_get_type($2), 1); }
|
||||
| tUNSIGNED { $$ = type_new_int(TYPE_BASIC_INT, 1); }
|
||||
- | tFLOAT { $$ = find_type_or_error($<str>1); }
|
||||
- | tDOUBLE { $$ = find_type_or_error($<str>1); }
|
||||
- | tBOOLEAN { $$ = find_type_or_error($<str>1); }
|
||||
- | tERRORSTATUST { $$ = find_type_or_error($<str>1); }
|
||||
- | tHANDLET { $$ = find_type_or_error($<str>1); }
|
||||
+ | tFLOAT { $$ = find_type_or_error(NULL, $<str>1); }
|
||||
+ | tDOUBLE { $$ = find_type_or_error(NULL, $<str>1); }
|
||||
+ | tBOOLEAN { $$ = find_type_or_error(NULL, $<str>1); }
|
||||
+ | tERRORSTATUST { $$ = find_type_or_error(NULL, $<str>1); }
|
||||
+ | tHANDLET { $$ = find_type_or_error(NULL, $<str>1); }
|
||||
;
|
||||
|
||||
m_int:
|
||||
@@ -887,12 +887,12 @@ int_std: tINT { $$ = type_new_int(TYPE_BASIC_INT, 0); }
|
||||
;
|
||||
|
||||
qualified_seq:
|
||||
- aKNOWNTYPE { $$ = find_type_or_error($1); }
|
||||
+ aKNOWNTYPE { $$ = find_type_or_error(lookup_namespace, $1); }
|
||||
| aIDENTIFIER '.' { push_lookup_namespace($1); } qualified_seq { $$ = $4; }
|
||||
;
|
||||
|
||||
qualified_type:
|
||||
- aKNOWNTYPE { $$ = find_type_or_error($1); }
|
||||
+ aKNOWNTYPE { $$ = find_type_or_error(current_namespace, $1); }
|
||||
| aNAMESPACE '.' { init_lookup_namespace($1); } qualified_seq { $$ = $4; }
|
||||
;
|
||||
|
||||
@@ -965,7 +965,7 @@ interfacedef: attributes interface inherit
|
||||
* definition of a derived class, I'll try to support it with this rule */
|
||||
| attributes interface ':' aIDENTIFIER
|
||||
'{' import int_statements '}'
|
||||
- semicolon_opt { $$ = type_interface_define($2, $1, find_type_or_error($4), $7); }
|
||||
+ semicolon_opt { $$ = type_interface_define($2, $1, find_type_or_error(current_namespace, $4), $7); }
|
||||
| dispinterfacedef semicolon_opt { $$ = $1; }
|
||||
;
|
||||
|
||||
@@ -1189,14 +1189,14 @@ acf_int_statements
|
||||
|
||||
acf_int_statement
|
||||
: tTYPEDEF acf_attributes aKNOWNTYPE ';'
|
||||
- { type_t *type = find_type_or_error($3);
|
||||
+ { type_t *type = find_type_or_error(current_namespace, $3);
|
||||
type->attrs = append_attr_list(type->attrs, $2);
|
||||
}
|
||||
;
|
||||
|
||||
acf_interface
|
||||
: acf_attributes tINTERFACE aKNOWNTYPE '{' acf_int_statements '}'
|
||||
- { type_t *iface = find_type_or_error($3);
|
||||
+ { type_t *iface = find_type_or_error(current_namespace, $3);
|
||||
if (type_get_type(iface) != TYPE_INTERFACE)
|
||||
error_loc("%s is not an interface\n", iface->name);
|
||||
iface->attrs = append_attr_list(iface->attrs, $1);
|
||||
@@ -2034,13 +2034,12 @@ type_t *find_type(const char *name, struct namespace *namespace, int t)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static type_t *find_type_or_error(const char *name)
|
||||
+static type_t *find_type_or_error(struct namespace *namespace, const char *name)
|
||||
{
|
||||
type_t *type;
|
||||
- if (!(type = find_type(name, current_namespace, 0)) &&
|
||||
- !(type = find_type(name, lookup_namespace, 0)))
|
||||
+ if (!(type = find_type(name, namespace, 0)))
|
||||
{
|
||||
- error_loc("type '%s' not found\n", name);
|
||||
+ error_loc("type '%s' not found in %s namespace\n", name, namespace && namespace->name ? namespace->name : "global");
|
||||
return NULL;
|
||||
}
|
||||
return type;
|
||||
@@ -2851,7 +2850,7 @@ static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func)
|
||||
* function */
|
||||
var_t *idl_handle = make_var(xstrdup("IDL_handle"));
|
||||
idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN));
|
||||
- idl_handle->declspec.type = find_type_or_error("handle_t");
|
||||
+ idl_handle->declspec.type = find_type_or_error(NULL, "handle_t");
|
||||
type_function_add_head_arg(func->declspec.type, idl_handle);
|
||||
}
|
||||
}
|
||||
@@ -3141,7 +3140,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls, int declonl
|
||||
LIST_FOR_EACH_ENTRY_SAFE( decl, next, decls, declarator_t, entry )
|
||||
{
|
||||
var_t *var = decl->var;
|
||||
- type_t *type = find_type_or_error(var->name);
|
||||
+ type_t *type = find_type_or_error(current_namespace, var->name);
|
||||
*type_list = xmalloc(sizeof(type_list_t));
|
||||
(*type_list)->type = type;
|
||||
(*type_list)->next = NULL;
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,134 @@
|
||||
From 5d47a8f72439a481b5f7ae1700488d9447bf74eb Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 4 Feb 2021 00:33:21 +0100
|
||||
Subject: [PATCH] widl: Use explicit namespace parameter for qualified names.
|
||||
|
||||
Instead of buggy alternate lookup namespace stack.
|
||||
---
|
||||
tools/widl/parser.y | 52 ++++++++++++++++++++++-----------------------
|
||||
1 file changed, 25 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 17a3727b114..e4834a06e23 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -76,13 +76,12 @@ static warning_list_t *append_warning(warning_list_t *, int);
|
||||
|
||||
static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs);
|
||||
static type_t *find_type_or_error(struct namespace *parent, const char *name);
|
||||
+static struct namespace *find_namespace_or_error(struct namespace *namespace, const char *name);
|
||||
|
||||
static var_t *reg_const(var_t *var);
|
||||
|
||||
static void push_namespace(const char *name);
|
||||
static void pop_namespace(const char *name);
|
||||
-static void init_lookup_namespace(const char *name);
|
||||
-static void push_lookup_namespace(const char *name);
|
||||
|
||||
static void check_arg_attrs(const var_t *arg);
|
||||
static void check_statements(const statement_list_t *stmts, int is_inside_library);
|
||||
@@ -120,7 +119,6 @@ static struct namespace global_namespace = {
|
||||
};
|
||||
|
||||
static struct namespace *current_namespace = &global_namespace;
|
||||
-static struct namespace *lookup_namespace = &global_namespace;
|
||||
|
||||
static typelib_t *current_typelib;
|
||||
|
||||
@@ -152,6 +150,7 @@ static typelib_t *current_typelib;
|
||||
enum storage_class stgclass;
|
||||
enum type_qualifier type_qualifier;
|
||||
enum function_specifier function_specifier;
|
||||
+ struct namespace *namespace;
|
||||
}
|
||||
|
||||
%token <str> aIDENTIFIER aPRAGMA
|
||||
@@ -288,7 +287,7 @@ static typelib_t *current_typelib;
|
||||
%type <str> namespacedef
|
||||
%type <type> base_type int_std
|
||||
%type <type> enumdef structdef uniondef typedecl
|
||||
-%type <type> type qualified_seq qualified_type
|
||||
+%type <type> type qualified_type
|
||||
%type <ifref> class_interface
|
||||
%type <ifref_list> class_interfaces
|
||||
%type <var> arg ne_union_field union_field s_field case enum enum_member declaration
|
||||
@@ -314,6 +313,7 @@ static typelib_t *current_typelib;
|
||||
%type <stmt_list> gbl_statements imp_statements int_statements
|
||||
%type <warning_list> warnings
|
||||
%type <num> allocate_option_list allocate_option
|
||||
+%type <namespace> namespace_pfx
|
||||
|
||||
%left ','
|
||||
%right '?' ':'
|
||||
@@ -886,15 +886,16 @@ int_std: tINT { $$ = type_new_int(TYPE_BASIC_INT, 0); }
|
||||
| tINT3264 { $$ = type_new_int(TYPE_BASIC_INT3264, 0); }
|
||||
;
|
||||
|
||||
-qualified_seq:
|
||||
- aKNOWNTYPE { $$ = find_type_or_error(lookup_namespace, $1); }
|
||||
- | aIDENTIFIER '.' { push_lookup_namespace($1); } qualified_seq { $$ = $4; }
|
||||
- ;
|
||||
+namespace_pfx:
|
||||
+ aNAMESPACE '.' { $$ = find_namespace_or_error(&global_namespace, $1); }
|
||||
+ | namespace_pfx aNAMESPACE '.' { $$ = find_namespace_or_error($1, $2); }
|
||||
+ | namespace_pfx aIDENTIFIER '.' { $$ = find_namespace_or_error($1, $2); }
|
||||
+ ;
|
||||
|
||||
qualified_type:
|
||||
- aKNOWNTYPE { $$ = find_type_or_error(current_namespace, $1); }
|
||||
- | aNAMESPACE '.' { init_lookup_namespace($1); } qualified_seq { $$ = $4; }
|
||||
- ;
|
||||
+ aKNOWNTYPE { $$ = find_type_or_error(current_namespace, $1); }
|
||||
+ | namespace_pfx typename { $$ = find_type_or_error($1, $2); }
|
||||
+ ;
|
||||
|
||||
coclass: tCOCLASS typename { $$ = type_coclass_declare($2); }
|
||||
;
|
||||
@@ -1911,20 +1912,6 @@ static void pop_namespace(const char *name)
|
||||
current_namespace = current_namespace->parent;
|
||||
}
|
||||
|
||||
-static void init_lookup_namespace(const char *name)
|
||||
-{
|
||||
- if (!(lookup_namespace = find_sub_namespace(&global_namespace, name)))
|
||||
- error_loc("namespace '%s' not found\n", name);
|
||||
-}
|
||||
-
|
||||
-static void push_lookup_namespace(const char *name)
|
||||
-{
|
||||
- struct namespace *namespace;
|
||||
- if (!(namespace = find_sub_namespace(lookup_namespace, name)))
|
||||
- error_loc("namespace '%s' not found\n", name);
|
||||
- lookup_namespace = namespace;
|
||||
-}
|
||||
-
|
||||
struct rtype {
|
||||
const char *name;
|
||||
type_t *type;
|
||||
@@ -2045,10 +2032,21 @@ static type_t *find_type_or_error(struct namespace *namespace, const char *name)
|
||||
return type;
|
||||
}
|
||||
|
||||
+static struct namespace *find_namespace_or_error(struct namespace *parent, const char *name)
|
||||
+{
|
||||
+ struct namespace *namespace = NULL;
|
||||
+
|
||||
+ if (!winrt_mode)
|
||||
+ error_loc("namespaces are only supported in winrt mode.\n");
|
||||
+ else if (!(namespace = find_sub_namespace(parent, name)))
|
||||
+ error_loc("namespace '%s' not found in '%s'\n", name, parent->name);
|
||||
+
|
||||
+ return namespace;
|
||||
+}
|
||||
+
|
||||
int is_type(const char *name)
|
||||
{
|
||||
- return find_type(name, current_namespace, 0) != NULL ||
|
||||
- find_type(name, lookup_namespace, 0) != NULL;
|
||||
+ return find_type(name, current_namespace, 0) != NULL;
|
||||
}
|
||||
|
||||
int is_namespace(const char *name)
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,86 @@
|
||||
From 170f789b5924560ff2a80565880d73a76ea6c021 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 4 Feb 2021 11:35:33 +0100
|
||||
Subject: [PATCH] widl: Disallow qualified types in expressions.
|
||||
|
||||
MIDL WinRT mode only supports a limited subset of original IDL syntax
|
||||
anyway, and this will save some conflicts when removing the lexer trick
|
||||
for namespaces.
|
||||
---
|
||||
tools/widl/parser.y | 24 ++++++++++++++++++------
|
||||
1 file changed, 18 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index e4834a06e23..9fb6772ba33 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -279,7 +279,7 @@ static typelib_t *current_typelib;
|
||||
%type <stgclass> storage_cls_spec
|
||||
%type <type_qualifier> type_qualifier m_type_qual_list
|
||||
%type <function_specifier> function_specifier
|
||||
-%type <declspec> decl_spec decl_spec_no_type m_decl_spec_no_type
|
||||
+%type <declspec> decl_spec unqualified_decl_spec decl_spec_no_type m_decl_spec_no_type
|
||||
%type <type> inherit interface interfacedef
|
||||
%type <type> interfaceref
|
||||
%type <type> dispinterface dispinterfacedef
|
||||
@@ -287,7 +287,7 @@ static typelib_t *current_typelib;
|
||||
%type <str> namespacedef
|
||||
%type <type> base_type int_std
|
||||
%type <type> enumdef structdef uniondef typedecl
|
||||
-%type <type> type qualified_type
|
||||
+%type <type> type unqualified_type qualified_type
|
||||
%type <ifref> class_interface
|
||||
%type <ifref_list> class_interfaces
|
||||
%type <var> arg ne_union_field union_field s_field case enum enum_member declaration
|
||||
@@ -763,9 +763,9 @@ expr: aNUM { $$ = make_exprl(EXPR_NUM, $1); }
|
||||
| '*' expr %prec PPTR { $$ = make_expr1(EXPR_PPTR, $2); }
|
||||
| expr MEMBERPTR aIDENTIFIER { $$ = make_expr2(EXPR_MEMBER, make_expr1(EXPR_PPTR, $1), make_exprs(EXPR_IDENTIFIER, $3)); }
|
||||
| expr '.' aIDENTIFIER { $$ = make_expr2(EXPR_MEMBER, $1, make_exprs(EXPR_IDENTIFIER, $3)); }
|
||||
- | '(' decl_spec m_abstract_declarator ')' expr %prec CAST
|
||||
+ | '(' unqualified_decl_spec m_abstract_declarator ')' expr %prec CAST
|
||||
{ $$ = make_exprt(EXPR_CAST, declare_var(NULL, $2, $3, 0), $5); free($2); free($3); }
|
||||
- | tSIZEOF '(' decl_spec m_abstract_declarator ')'
|
||||
+ | tSIZEOF '(' unqualified_decl_spec m_abstract_declarator ')'
|
||||
{ $$ = make_exprt(EXPR_SIZEOF, declare_var(NULL, $3, $4, 0), NULL); free($3); free($4); }
|
||||
| expr '[' expr ']' { $$ = make_expr2(EXPR_ARRAY, $1, $3); }
|
||||
| '(' expr ')' { $$ = $2; }
|
||||
@@ -1005,6 +1005,12 @@ decl_spec: type m_decl_spec_no_type { $$ = make_decl_spec($1, $2, NULL, STG_NON
|
||||
{ $$ = make_decl_spec($2, $1, $3, STG_NONE, 0, 0); }
|
||||
;
|
||||
|
||||
+unqualified_decl_spec: unqualified_type m_decl_spec_no_type
|
||||
+ { $$ = make_decl_spec($1, $2, NULL, STG_NONE, 0, 0); }
|
||||
+ | decl_spec_no_type unqualified_type m_decl_spec_no_type
|
||||
+ { $$ = make_decl_spec($2, $1, $3, STG_NONE, 0, 0); }
|
||||
+ ;
|
||||
+
|
||||
m_decl_spec_no_type: { $$ = NULL; }
|
||||
| decl_spec_no_type
|
||||
;
|
||||
@@ -1146,8 +1152,8 @@ pointer_type:
|
||||
structdef: tSTRUCT m_typename '{' fields '}' { $$ = type_new_struct($2, current_namespace, TRUE, $4); }
|
||||
;
|
||||
|
||||
-type: tVOID { $$ = type_new_void(); }
|
||||
- | qualified_type { $$ = $1; }
|
||||
+unqualified_type:
|
||||
+ tVOID { $$ = type_new_void(); }
|
||||
| base_type { $$ = $1; }
|
||||
| enumdef { $$ = $1; }
|
||||
| tENUM aIDENTIFIER { $$ = type_new_enum($2, current_namespace, FALSE, NULL); }
|
||||
@@ -1156,6 +1162,12 @@ type: tVOID { $$ = type_new_void(); }
|
||||
| uniondef { $$ = $1; }
|
||||
| tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, FALSE, NULL); }
|
||||
| tSAFEARRAY '(' type ')' { $$ = make_safearray($3); }
|
||||
+ | aKNOWNTYPE { $$ = find_type_or_error(current_namespace, $1); }
|
||||
+ ;
|
||||
+
|
||||
+type:
|
||||
+ unqualified_type
|
||||
+ | namespace_pfx typename { $$ = find_type_or_error($1, $2); }
|
||||
;
|
||||
|
||||
typedef: m_attributes tTYPEDEF m_attributes decl_spec declarator_list
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,84 @@
|
||||
From 7eafbb307b59167e9af8ceb683990a2f3b44b0cc Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 4 Feb 2021 00:40:58 +0100
|
||||
Subject: [PATCH] widl: Remove aNAMESPACE token from the lexer.
|
||||
|
||||
---
|
||||
tools/widl/parser.h | 1 -
|
||||
tools/widl/parser.l | 2 +-
|
||||
tools/widl/parser.y | 13 ++-----------
|
||||
3 files changed, 3 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/parser.h b/tools/widl/parser.h
|
||||
index a6dc94ae6b8..a67b160d48a 100644
|
||||
--- a/tools/widl/parser.h
|
||||
+++ b/tools/widl/parser.h
|
||||
@@ -38,7 +38,6 @@ void pop_import(void);
|
||||
#define parse_only import_stack_ptr
|
||||
|
||||
int is_type(const char *name);
|
||||
-int is_namespace(const char *name);
|
||||
|
||||
int do_warning(char *toggle, warning_list_t *wnum);
|
||||
int is_warning_enabled(int warning);
|
||||
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
|
||||
index 7e20d30e7f0..8acc9c9590c 100644
|
||||
--- a/tools/widl/parser.l
|
||||
+++ b/tools/widl/parser.l
|
||||
@@ -468,7 +468,7 @@ static int kw_token(const char *kw)
|
||||
return kwp->token;
|
||||
}
|
||||
parser_lval.str = xstrdup(kw);
|
||||
- return is_type(kw) ? aKNOWNTYPE : is_namespace(kw) ? aNAMESPACE : aIDENTIFIER;
|
||||
+ return is_type(kw) ? aKNOWNTYPE : aIDENTIFIER;
|
||||
}
|
||||
|
||||
static int attr_token(const char *kw)
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 9fb6772ba33..d3a79e9fcb7 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -154,7 +154,7 @@ static typelib_t *current_typelib;
|
||||
}
|
||||
|
||||
%token <str> aIDENTIFIER aPRAGMA
|
||||
-%token <str> aKNOWNTYPE aNAMESPACE
|
||||
+%token <str> aKNOWNTYPE
|
||||
%token <num> aNUM aHEXNUM
|
||||
%token <dbl> aDOUBLE
|
||||
%token <str> aSTRING aWSTRING aSQSTRING
|
||||
@@ -887,8 +887,7 @@ int_std: tINT { $$ = type_new_int(TYPE_BASIC_INT, 0); }
|
||||
;
|
||||
|
||||
namespace_pfx:
|
||||
- aNAMESPACE '.' { $$ = find_namespace_or_error(&global_namespace, $1); }
|
||||
- | namespace_pfx aNAMESPACE '.' { $$ = find_namespace_or_error($1, $2); }
|
||||
+ aIDENTIFIER '.' { $$ = find_namespace_or_error(&global_namespace, $1); }
|
||||
| namespace_pfx aIDENTIFIER '.' { $$ = find_namespace_or_error($1, $2); }
|
||||
;
|
||||
|
||||
@@ -919,7 +918,6 @@ apicontract_def: attributes apicontract '{' '}' semicolon_opt
|
||||
;
|
||||
|
||||
namespacedef: tNAMESPACE aIDENTIFIER { $$ = $2; }
|
||||
- | tNAMESPACE aNAMESPACE { $$ = $2; }
|
||||
;
|
||||
|
||||
class_interfaces: { $$ = NULL; }
|
||||
@@ -2061,13 +2059,6 @@ int is_type(const char *name)
|
||||
return find_type(name, current_namespace, 0) != NULL;
|
||||
}
|
||||
|
||||
-int is_namespace(const char *name)
|
||||
-{
|
||||
- if (!winrt_mode) return 0;
|
||||
- return find_sub_namespace(current_namespace, name) != NULL ||
|
||||
- find_sub_namespace(&global_namespace, name) != NULL;
|
||||
-}
|
||||
-
|
||||
type_t *get_type(enum type_type type, char *name, struct namespace *namespace, int t)
|
||||
{
|
||||
type_t *tp;
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,38 @@
|
||||
From fcb515de7ef61b806c7da1fc57875fb60edb59db Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 4 Feb 2021 13:40:11 +0100
|
||||
Subject: [PATCH] widl: Fold inherit cases by using typename rule in
|
||||
qualified_type.
|
||||
|
||||
---
|
||||
tools/widl/parser.y | 7 +------
|
||||
1 file changed, 1 insertion(+), 6 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index d3a79e9fcb7..bbf71a2e3ef 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -892,7 +892,7 @@ namespace_pfx:
|
||||
;
|
||||
|
||||
qualified_type:
|
||||
- aKNOWNTYPE { $$ = find_type_or_error(current_namespace, $1); }
|
||||
+ typename { $$ = find_type_or_error(current_namespace, $1); }
|
||||
| namespace_pfx typename { $$ = find_type_or_error($1, $2); }
|
||||
;
|
||||
|
||||
@@ -960,11 +960,6 @@ interfacedef: attributes interface inherit
|
||||
'{' int_statements '}' semicolon_opt { $$ = type_interface_define($2, $1, $3, $5);
|
||||
check_async_uuid($$);
|
||||
}
|
||||
-/* MIDL is able to import the definition of a base class from inside the
|
||||
- * definition of a derived class, I'll try to support it with this rule */
|
||||
- | attributes interface ':' aIDENTIFIER
|
||||
- '{' import int_statements '}'
|
||||
- semicolon_opt { $$ = type_interface_define($2, $1, find_type_or_error(current_namespace, $4), $7); }
|
||||
| dispinterfacedef semicolon_opt { $$ = $1; }
|
||||
;
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
@ -1,136 +0,0 @@
|
||||
From 99bc0225cdc921dc87d3906de145533690ad7816 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Tue, 1 Dec 2020 14:41:01 +0100
|
||||
Subject: [PATCH] widl: Introduce new strappend helper.
|
||||
|
||||
And use it for format_namespace to grow buffer as needed.
|
||||
---
|
||||
tools/widl/typetree.c | 46 ++++++++++++++-----------------------------
|
||||
tools/widl/utils.c | 37 ++++++++++++++++++++++++++++++++++
|
||||
tools/widl/utils.h | 1 +
|
||||
3 files changed, 53 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index f451f8f3a1a..95c04c245b8 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -89,41 +89,25 @@ const char *type_get_name(const type_t *type, enum name_type name_type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static char *append_namespace(char *ptr, struct namespace *namespace, const char *separator, const char *abi_prefix)
|
||||
+static size_t append_namespace(char **buf, size_t *len, size_t pos, struct namespace *namespace, const char *separator, const char *abi_prefix)
|
||||
{
|
||||
- if(is_global_namespace(namespace)) {
|
||||
- if(!abi_prefix) return ptr;
|
||||
- strcpy(ptr, abi_prefix);
|
||||
- strcat(ptr, separator);
|
||||
- return ptr + strlen(ptr);
|
||||
- }
|
||||
-
|
||||
- ptr = append_namespace(ptr, namespace->parent, separator, abi_prefix);
|
||||
- strcpy(ptr, namespace->name);
|
||||
- strcat(ptr, separator);
|
||||
- return ptr + strlen(ptr);
|
||||
+ int nested = namespace && !is_global_namespace(namespace);
|
||||
+ const char *name = nested ? namespace->name : abi_prefix;
|
||||
+ size_t n = 0;
|
||||
+ if (!name) return 0;
|
||||
+ if (nested) n += append_namespace(buf, len, pos + n, namespace->parent, separator, abi_prefix);
|
||||
+ n += strappend(buf, len, pos + n, "%s%s", name, separator);
|
||||
+ return n;
|
||||
}
|
||||
|
||||
-char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix,
|
||||
- const char *abi_prefix)
|
||||
+char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix, const char *abi_prefix)
|
||||
{
|
||||
- unsigned len = strlen(prefix) + strlen(suffix);
|
||||
- unsigned sep_len = strlen(separator);
|
||||
- struct namespace *iter;
|
||||
- char *ret, *ptr;
|
||||
-
|
||||
- if(abi_prefix)
|
||||
- len += strlen(abi_prefix) + sep_len;
|
||||
-
|
||||
- for(iter = namespace; !is_global_namespace(iter); iter = iter->parent)
|
||||
- len += strlen(iter->name) + sep_len;
|
||||
-
|
||||
- ret = xmalloc(len+1);
|
||||
- strcpy(ret, prefix);
|
||||
- ptr = append_namespace(ret + strlen(ret), namespace, separator, abi_prefix);
|
||||
- strcpy(ptr, suffix);
|
||||
-
|
||||
- return ret;
|
||||
+ size_t len = 0, pos = 0;
|
||||
+ char *buf = NULL;
|
||||
+ pos += strappend(&buf, &len, pos, "%s", prefix);
|
||||
+ pos += append_namespace(&buf, &len, pos, namespace, separator, abi_prefix);
|
||||
+ pos += strappend(&buf, &len, pos, "%s", suffix);
|
||||
+ return buf;
|
||||
}
|
||||
|
||||
type_t *type_new_function(var_list_t *args)
|
||||
diff --git a/tools/widl/utils.c b/tools/widl/utils.c
|
||||
index ea92372c8c7..634bd12a0ba 100644
|
||||
--- a/tools/widl/utils.c
|
||||
+++ b/tools/widl/utils.c
|
||||
@@ -245,6 +245,43 @@ char *strmake( const char* fmt, ... )
|
||||
}
|
||||
}
|
||||
|
||||
+size_t strappend(char **buf, size_t *len, size_t pos, const char* fmt, ...)
|
||||
+{
|
||||
+ size_t size;
|
||||
+ va_list ap;
|
||||
+ char *ptr;
|
||||
+ int n;
|
||||
+
|
||||
+ assert( buf && len );
|
||||
+ assert( (*len == 0 && *buf == NULL) || (*len != 0 && *buf != NULL) );
|
||||
+
|
||||
+ if (*buf)
|
||||
+ {
|
||||
+ size = *len;
|
||||
+ ptr = *buf;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ size = 100;
|
||||
+ ptr = xmalloc( size );
|
||||
+ }
|
||||
+
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ va_start( ap, fmt );
|
||||
+ n = vsnprintf( ptr + pos, size - pos, fmt, ap );
|
||||
+ va_end( ap );
|
||||
+ if (n == -1) size *= 2;
|
||||
+ else if (pos + (size_t)n >= size) size = pos + n + 1;
|
||||
+ else break;
|
||||
+ ptr = xrealloc( ptr, size );
|
||||
+ }
|
||||
+
|
||||
+ *len = size;
|
||||
+ *buf = ptr;
|
||||
+ return n;
|
||||
+}
|
||||
+
|
||||
char *xstrdup(const char *str)
|
||||
{
|
||||
char *s;
|
||||
diff --git a/tools/widl/utils.h b/tools/widl/utils.h
|
||||
index 37406656504..82e0a6ae489 100644
|
||||
--- a/tools/widl/utils.h
|
||||
+++ b/tools/widl/utils.h
|
||||
@@ -45,6 +45,7 @@ void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
void warning_loc_info(const loc_info_t *, const char *s, ...) __attribute__((format (printf, 2, 3)));
|
||||
void chat(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
char *strmake(const char* fmt, ...) __attribute__((__format__ (__printf__, 1, 2 )));
|
||||
+size_t strappend(char **buf, size_t *len, size_t pos, const char* fmt, ...) __attribute__((__format__ (__printf__, 4, 5 )));
|
||||
|
||||
char *dup_basename(const char *name, const char *ext);
|
||||
size_t widl_getline(char **linep, size_t *lenp, FILE *fp);
|
||||
--
|
||||
2.29.2
|
||||
|
@ -1,209 +0,0 @@
|
||||
From 680c7575c78c63e8bc8e971d8f1385175bf5f106 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Mon, 12 Oct 2020 23:23:18 +0200
|
||||
Subject: [PATCH] widl: Support partially specialized parameterized type.
|
||||
|
||||
This allows parameterized types to reference each other with a different
|
||||
set of parameters. This is required for instance for IIterable<T>, that
|
||||
needs to reference IIterator<T>.
|
||||
|
||||
The partial specialization is recorded by adding a new parameterized
|
||||
type, referencing the original one as its template. The parameterized
|
||||
type chain will be resolved all at once when the type is declared.
|
||||
---
|
||||
include/windows.foundation.idl | 9 ++++++++
|
||||
tools/widl/parser.y | 35 +++++++++++++++++++++++++++++
|
||||
tools/widl/typetree.c | 41 +++++++++++++++++++++++++++++++---
|
||||
tools/widl/typetree.h | 2 ++
|
||||
tools/widl/widltypes.h | 1 +
|
||||
5 files changed, 85 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl
|
||||
index ab7c4753c3b..5f7a49c38e4 100644
|
||||
--- a/include/windows.foundation.idl
|
||||
+++ b/include/windows.foundation.idl
|
||||
@@ -127,6 +127,15 @@ namespace Windows {
|
||||
HRESULT GetMany([in] UINT32 count, [out] T *items, [out, retval] UINT32 *value);
|
||||
}
|
||||
|
||||
+ [
|
||||
+ contract(Windows.Foundation.FoundationContract, 1.0),
|
||||
+ uuid(faa585ea-6214-4217-afda-7f46de5869b3)
|
||||
+ ]
|
||||
+ interface IIterable<T> : IInspectable
|
||||
+ {
|
||||
+ HRESULT First([out, retval] Windows.Foundation.Collections.IIterator<T> **value);
|
||||
+ }
|
||||
+
|
||||
[
|
||||
contract(Windows.Foundation.FoundationContract, 1.0),
|
||||
uuid(bbe1fa4c-b0e3-4583-baef-1f1b2e483e56)
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 9083df8cf27..61bbe2a50ee 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -302,6 +302,8 @@ static typelib_t *current_typelib;
|
||||
%type <type> type qualified_type
|
||||
%type <type> type_parameter
|
||||
%type <typelist> type_parameters
|
||||
+%type <type> parameterized_type
|
||||
+%type <typelist> parameterized_types
|
||||
%type <typelist> requires required_types
|
||||
%type <ifref> class_interface
|
||||
%type <ifref_list> class_interfaces
|
||||
@@ -912,6 +914,20 @@ qualified_type:
|
||||
| namespace_pfx aKNOWNTYPE { $$ = find_qualified_type_or_error($2, 0); }
|
||||
;
|
||||
|
||||
+parameterized_type: qualified_type '<' parameterized_types '>'
|
||||
+ { $$ = find_parameterized_type($1, $3, 0); }
|
||||
+ ;
|
||||
+
|
||||
+parameterized_types:
|
||||
+ base_type { $$ = append_type(NULL, $1); }
|
||||
+ | qualified_type { $$ = append_type(NULL, $1); }
|
||||
+ | qualified_type '*' { $$ = append_type(NULL, type_new_pointer($1)); }
|
||||
+ | parameterized_type { $$ = append_type(NULL, $1); }
|
||||
+ | parameterized_type '*' { $$ = append_type(NULL, type_new_pointer($1)); }
|
||||
+ | parameterized_types ',' parameterized_types
|
||||
+ { $$ = append_types($1, $3); }
|
||||
+ ;
|
||||
+
|
||||
coclass: tCOCLASS aIDENTIFIER { $$ = type_new_coclass($2); }
|
||||
| tCOCLASS aKNOWNTYPE { $$ = find_type($2, NULL, 0);
|
||||
if (type_get_type_detect_alias($$) != TYPE_COCLASS)
|
||||
@@ -1004,6 +1020,7 @@ dispinterfacedef: dispinterfacehdr '{'
|
||||
|
||||
inherit: { $$ = NULL; }
|
||||
| ':' qualified_type { $$ = $2; }
|
||||
+ | ':' parameterized_type { $$ = $2; }
|
||||
;
|
||||
|
||||
interface: tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
@@ -1030,6 +1047,7 @@ type_parameters:
|
||||
|
||||
required_types:
|
||||
qualified_type { $$ = append_type(NULL, $1); }
|
||||
+ | parameterized_type { $$ = append_type(NULL, $1); }
|
||||
| required_types ',' required_types { $$ = append_types($1, $3); }
|
||||
|
||||
requires: { $$ = NULL; }
|
||||
@@ -1251,6 +1269,7 @@ structdef: tSTRUCT t_ident '{' fields '}' { $$ = type_new_struct($2, current_nam
|
||||
|
||||
type: tVOID { $$ = type_new_void(); }
|
||||
| qualified_type { $$ = $1; }
|
||||
+ | parameterized_type { $$ = $1; }
|
||||
| base_type { $$ = $1; }
|
||||
| enumdef { $$ = $1; }
|
||||
| tENUM aIDENTIFIER { $$ = type_new_enum($2, current_namespace, FALSE, NULL); }
|
||||
@@ -3369,3 +3388,19 @@ static void check_def(const type_t *t)
|
||||
error_loc("%s: redefinition error; original definition was at %s:%d\n",
|
||||
t->name, t->loc_info.input_name, t->loc_info.line_number);
|
||||
}
|
||||
+
|
||||
+type_t *find_parameterized_type(type_t *type, type_list_t *params, int t)
|
||||
+{
|
||||
+ char *name = format_parameterized_type_name(type, params);
|
||||
+
|
||||
+ if (parameters_namespace)
|
||||
+ {
|
||||
+ assert(type->type_type == TYPE_PARAMETERIZED_TYPE);
|
||||
+ type = type_parameterized_type_specialize_partial(type, params);
|
||||
+ }
|
||||
+ /* FIXME: If not in another parameterized type, we'll have to look for the declared specialization. */
|
||||
+ else error_loc("parameterized type '%s' not declared\n", name);
|
||||
+
|
||||
+ free(name);
|
||||
+ return type;
|
||||
+}
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index 95c04c245b8..d2c472fcca0 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -100,13 +100,40 @@ static size_t append_namespace(char **buf, size_t *len, size_t pos, struct names
|
||||
return n;
|
||||
}
|
||||
|
||||
+static size_t append_namespaces(char **buf, size_t *len, size_t pos, struct namespace *namespace, const char *prefix,
|
||||
+ const char *separator, const char *suffix, const char *abi_prefix)
|
||||
+{
|
||||
+ size_t n = 0;
|
||||
+ n += strappend(buf, len, pos + n, "%s", prefix);
|
||||
+ n += append_namespace(buf, len, pos + n, namespace, separator, abi_prefix);
|
||||
+ n += strappend(buf, len, pos + n, "%s", suffix);
|
||||
+ return n;
|
||||
+}
|
||||
+
|
||||
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix, const char *abi_prefix)
|
||||
+{
|
||||
+ size_t len = 0;
|
||||
+ char *buf = NULL;
|
||||
+ append_namespaces(&buf, &len, 0, namespace, prefix, separator, suffix, abi_prefix);
|
||||
+ return buf;
|
||||
+}
|
||||
+
|
||||
+char *format_parameterized_type_name(type_t *type, type_list_t *params)
|
||||
{
|
||||
size_t len = 0, pos = 0;
|
||||
char *buf = NULL;
|
||||
- pos += strappend(&buf, &len, pos, "%s", prefix);
|
||||
- pos += append_namespace(&buf, &len, pos, namespace, separator, abi_prefix);
|
||||
- pos += strappend(&buf, &len, pos, "%s", suffix);
|
||||
+ type_list_t *entry;
|
||||
+
|
||||
+ pos += strappend(&buf, &len, pos, "%s<", type->name);
|
||||
+ for (entry = params; entry; entry = entry->next)
|
||||
+ {
|
||||
+ for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {}
|
||||
+ pos += append_namespaces(&buf, &len, pos, type->namespace, "", "::", type->name, use_abi_namespace ? "ABI" : NULL);
|
||||
+ for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) pos += strappend(&buf, &len, pos, "*");
|
||||
+ if (entry->next) pos += strappend(&buf, &len, pos, ",");
|
||||
+ }
|
||||
+ pos += strappend(&buf, &len, pos, ">");
|
||||
+
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -447,6 +474,14 @@ static unsigned int compute_method_indexes(type_t *iface)
|
||||
return idx;
|
||||
}
|
||||
|
||||
+type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params)
|
||||
+{
|
||||
+ type_t *new_type = duptype(type, 0);
|
||||
+ new_type->details.parameterized.type = type;
|
||||
+ new_type->details.parameterized.params = params;
|
||||
+ return new_type;
|
||||
+}
|
||||
+
|
||||
void type_parameterized_interface_declare(type_t *type, type_list_t *params)
|
||||
{
|
||||
type_t *iface = make_type(TYPE_INTERFACE);
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index 79c5a01ce3a..c46a2629467 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -45,6 +45,8 @@ type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t
|
||||
type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases);
|
||||
type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
|
||||
type_t *type_new_runtimeclass(char *name, struct namespace *namespace);
|
||||
+type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params);
|
||||
+type_t *find_parameterized_type(type_t *type, type_list_t *params, int t);
|
||||
void type_parameterized_interface_declare(type_t *type, type_list_t *params);
|
||||
void type_parameterized_interface_define(type_t *type, type_list_t *params, type_t *inherit, statement_list_t *stmts);
|
||||
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts, type_list_t *requires);
|
||||
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
|
||||
index 2c0ac4003ce..be82342e31a 100644
|
||||
--- a/tools/widl/widltypes.h
|
||||
+++ b/tools/widl/widltypes.h
|
||||
@@ -650,6 +650,7 @@ void init_loc_info(loc_info_t *);
|
||||
|
||||
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix,
|
||||
const char *abi_prefix);
|
||||
+char *format_parameterized_type_name(type_t *type, type_list_t *params);
|
||||
|
||||
static inline enum type_type type_get_type_detect_alias(const type_t *type)
|
||||
{
|
||||
--
|
||||
2.29.2
|
||||
|
@ -0,0 +1,60 @@
|
||||
From 0a610b81e85384af6c3fe086b50adcf7bc6f77cc Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 4 Feb 2021 12:20:26 +0100
|
||||
Subject: [PATCH] widl: Support referencing qualified interface names.
|
||||
|
||||
And split the dispinterface case, which is not supported in WinRT mode.
|
||||
---
|
||||
include/windows.media.speechsynthesis.idl | 2 +-
|
||||
tools/widl/parser.y | 8 +++++++-
|
||||
2 files changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/include/windows.media.speechsynthesis.idl b/include/windows.media.speechsynthesis.idl
|
||||
index 71c51b74c0c..502261f79c6 100644
|
||||
--- a/include/windows.media.speechsynthesis.idl
|
||||
+++ b/include/windows.media.speechsynthesis.idl
|
||||
@@ -64,7 +64,7 @@ namespace Windows {
|
||||
]
|
||||
runtimeclass VoiceInformation
|
||||
{
|
||||
- [default] interface IVoiceInformation;
|
||||
+ [default] interface Windows.Media.SpeechSynthesis.IVoiceInformation;
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index bbf71a2e3ef..b43a1cdd5f2 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -282,6 +282,7 @@ static typelib_t *current_typelib;
|
||||
%type <declspec> decl_spec unqualified_decl_spec decl_spec_no_type m_decl_spec_no_type
|
||||
%type <type> inherit interface interfacedef
|
||||
%type <type> interfaceref
|
||||
+%type <type> dispinterfaceref
|
||||
%type <type> dispinterface dispinterfacedef
|
||||
%type <type> module moduledef
|
||||
%type <str> namespacedef
|
||||
@@ -926,6 +927,7 @@ class_interfaces: { $$ = NULL; }
|
||||
|
||||
class_interface:
|
||||
m_attributes interfaceref ';' { $$ = make_ifref($2); $$->attrs = $1; }
|
||||
+ | m_attributes dispinterfaceref ';' { $$ = make_ifref($2); $$->attrs = $1; }
|
||||
;
|
||||
|
||||
dispinterface: tDISPINTERFACE typename { $$ = type_dispinterface_declare($2); }
|
||||
@@ -965,7 +967,11 @@ interfacedef: attributes interface inherit
|
||||
|
||||
interfaceref:
|
||||
tINTERFACE typename { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
- | tDISPINTERFACE typename { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
+ | tINTERFACE namespace_pfx typename { $$ = get_type(TYPE_INTERFACE, $3, $2, 0); }
|
||||
+ ;
|
||||
+
|
||||
+dispinterfaceref:
|
||||
+ tDISPINTERFACE typename { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
|
||||
;
|
||||
|
||||
module: tMODULE typename { $$ = type_module_declare($2); }
|
||||
--
|
||||
2.20.1
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 58ae5534e33ac94eaac4885bb0d9aa31abc5496d Mon Sep 17 00:00:00 2001
|
||||
From a9478fb534dbb1bc2319a147cd3794112304df68 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Tue, 13 Oct 2020 11:35:29 +0200
|
||||
Subject: [PATCH] widl: Support WinRT activatable attribute.
|
||||
Subject: [PATCH] widl: Support WinRT activatable attribute parsing.
|
||||
|
||||
---
|
||||
tools/widl/parser.l | 1 +
|
||||
@ -10,10 +10,10 @@ Subject: [PATCH] widl: Support WinRT activatable attribute.
|
||||
3 files changed, 5 insertions(+)
|
||||
|
||||
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
|
||||
index 0a5ef3c1b89..e09722d7023 100644
|
||||
index 8acc9c9590c..d726e76744e 100644
|
||||
--- a/tools/widl/parser.l
|
||||
+++ b/tools/widl/parser.l
|
||||
@@ -321,6 +321,7 @@ static const struct keyword keywords[] = {
|
||||
@@ -320,6 +320,7 @@ static const struct keyword keywords[] = {
|
||||
*/
|
||||
static const struct keyword attr_keywords[] =
|
||||
{
|
||||
@ -22,10 +22,10 @@ index 0a5ef3c1b89..e09722d7023 100644
|
||||
{"agile", tAGILE, 1},
|
||||
{"all_nodes", tALLNODES, 0},
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index b774b01cdd7..e5a39872524 100644
|
||||
index b43a1cdd5f2..eaeba90609d 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -173,6 +173,7 @@ static typelib_t *current_typelib;
|
||||
@@ -166,6 +166,7 @@ static typelib_t *current_typelib;
|
||||
%token GREATEREQUAL LESSEQUAL
|
||||
%token LOGICALOR LOGICALAND
|
||||
%token ELLIPSIS
|
||||
@ -33,7 +33,7 @@ index b774b01cdd7..e5a39872524 100644
|
||||
%token tAGGREGATABLE
|
||||
%token tAGILE
|
||||
%token tALLNODES tALLOCATE tANNOTATION
|
||||
@@ -547,6 +548,7 @@ static_attr: decl_spec ',' contract_req { if ($1->type->type_type != TYPE_INTER
|
||||
@@ -539,6 +540,7 @@ contract_req: decl_spec ',' contract_ver { if ($1->type->type_type != TYPE_APICO
|
||||
}
|
||||
|
||||
attribute: { $$ = NULL; }
|
||||
@ -41,7 +41,7 @@ index b774b01cdd7..e5a39872524 100644
|
||||
| tAGGREGATABLE { $$ = make_attr(ATTR_AGGREGATABLE); }
|
||||
| tANNOTATION '(' aSTRING ')' { $$ = make_attrp(ATTR_ANNOTATION, $3); }
|
||||
| tAPPOBJECT { $$ = make_attr(ATTR_APPOBJECT); }
|
||||
@@ -2277,6 +2279,7 @@ struct allowed_attr
|
||||
@@ -2162,6 +2164,7 @@ struct allowed_attr
|
||||
struct allowed_attr allowed_attr[] =
|
||||
{
|
||||
/* attr { D ACF M I Fn ARG T En Enm St Un Fi L DI M C AC R <display name> } */
|
||||
@ -50,7 +50,7 @@ index b774b01cdd7..e5a39872524 100644
|
||||
/* ATTR_ALLOCATE */ { 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "allocate" },
|
||||
/* ATTR_ANNOTATION */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "annotation" },
|
||||
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
|
||||
index 7db2deb1839..a3000a7417b 100644
|
||||
index 0fba33d6a09..5d4532d6434 100644
|
||||
--- a/tools/widl/widltypes.h
|
||||
+++ b/tools/widl/widltypes.h
|
||||
@@ -69,6 +69,7 @@ typedef struct list warning_list_t;
|
||||
@ -62,5 +62,5 @@ index 7db2deb1839..a3000a7417b 100644
|
||||
ATTR_ALLOCATE,
|
||||
ATTR_ANNOTATION,
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 0a3ad97a115851c604c6291de3fc71ef7c418cba Mon Sep 17 00:00:00 2001
|
||||
From c0c6947738f5e41804b475f889eeb37161083455 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Tue, 13 Oct 2020 14:30:32 +0200
|
||||
Subject: [PATCH] widl: Support WinRT static attribute parsing.
|
||||
@ -10,10 +10,10 @@ Subject: [PATCH] widl: Support WinRT static attribute parsing.
|
||||
3 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
|
||||
index 7e20d30e7f0..dd7cdae5338 100644
|
||||
index d726e76744e..9b93a53b839 100644
|
||||
--- a/tools/widl/parser.l
|
||||
+++ b/tools/widl/parser.l
|
||||
@@ -426,6 +426,7 @@ static const struct keyword attr_keywords[] =
|
||||
@@ -427,6 +427,7 @@ static const struct keyword attr_keywords[] =
|
||||
{"size_is", tSIZEIS, 0},
|
||||
{"source", tSOURCE, 0},
|
||||
{"standard", tSTANDARD, 1},
|
||||
@ -22,18 +22,18 @@ index 7e20d30e7f0..dd7cdae5338 100644
|
||||
{"string", tSTRING, 0},
|
||||
{"switch_is", tSWITCHIS, 0},
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 1e3e254ec8c..01cdbffe4c7 100644
|
||||
index eaeba90609d..b8c916f8336 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -285,6 +285,7 @@ static typelib_t *current_typelib;
|
||||
@@ -277,6 +277,7 @@ static typelib_t *current_typelib;
|
||||
%type <expr> m_expr expr expr_const expr_int_const array m_bitfield
|
||||
%type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const
|
||||
%type <expr> contract_req
|
||||
+%type <expr> static_attr
|
||||
%type <type> interfacehdr
|
||||
%type <stgclass> storage_cls_spec
|
||||
%type <type_qualifier> type_qualifier m_type_qual_list
|
||||
@@ -541,6 +542,11 @@ contract_req: decl_spec ',' contract_ver { if ($1->type->type_type != TYPE_APICO
|
||||
%type <function_specifier> function_specifier
|
||||
@@ -539,6 +540,11 @@ contract_req: decl_spec ',' contract_ver { if ($1->type->type_type != TYPE_APICO
|
||||
$$ = make_exprt(EXPR_GTREQL, declare_var(NULL, $1, make_declarator(NULL), 0), $$);
|
||||
}
|
||||
|
||||
@ -43,9 +43,9 @@ index 1e3e254ec8c..01cdbffe4c7 100644
|
||||
+ }
|
||||
+
|
||||
attribute: { $$ = NULL; }
|
||||
| tACTIVATABLE '(' contract_req ')' { $$ = make_attrp(ATTR_ACTIVATABLE, $3); }
|
||||
| tAGGREGATABLE { $$ = make_attr(ATTR_AGGREGATABLE); }
|
||||
| tANNOTATION '(' aSTRING ')' { $$ = make_attrp(ATTR_ANNOTATION, $3); }
|
||||
@@ -638,6 +644,7 @@ attribute: { $$ = NULL; }
|
||||
@@ -637,6 +643,7 @@ attribute: { $$ = NULL; }
|
||||
| tRETVAL { $$ = make_attr(ATTR_RETVAL); }
|
||||
| tSIZEIS '(' m_exprs ')' { $$ = make_attrp(ATTR_SIZEIS, $3); }
|
||||
| tSOURCE { $$ = make_attr(ATTR_SOURCE); }
|
||||
@ -53,7 +53,7 @@ index 1e3e254ec8c..01cdbffe4c7 100644
|
||||
| tSTRICTCONTEXTHANDLE { $$ = make_attr(ATTR_STRICTCONTEXTHANDLE); }
|
||||
| tSTRING { $$ = make_attr(ATTR_STRING); }
|
||||
| tSWITCHIS '(' expr ')' { $$ = make_attrp(ATTR_SWITCHIS, $3); }
|
||||
@@ -2336,6 +2343,7 @@ struct allowed_attr allowed_attr[] =
|
||||
@@ -2258,6 +2265,7 @@ struct allowed_attr allowed_attr[] =
|
||||
/* ATTR_RETVAL */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "retval" },
|
||||
/* ATTR_SIZEIS */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "size_is" },
|
||||
/* ATTR_SOURCE */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "source" },
|
||||
@ -62,10 +62,10 @@ index 1e3e254ec8c..01cdbffe4c7 100644
|
||||
/* ATTR_STRING */ { 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "string" },
|
||||
/* ATTR_SWITCHIS */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "switch_is" },
|
||||
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
|
||||
index 0fba33d6a09..8e9ba3e4460 100644
|
||||
index 5d4532d6434..facfff21453 100644
|
||||
--- a/tools/widl/widltypes.h
|
||||
+++ b/tools/widl/widltypes.h
|
||||
@@ -162,6 +162,7 @@ enum attr_type
|
||||
@@ -163,6 +163,7 @@ enum attr_type
|
||||
ATTR_RETVAL,
|
||||
ATTR_SIZEIS,
|
||||
ATTR_SOURCE,
|
||||
@ -74,5 +74,5 @@ index 0fba33d6a09..8e9ba3e4460 100644
|
||||
ATTR_STRING,
|
||||
ATTR_SWITCHIS,
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -0,0 +1,56 @@
|
||||
From 3390b91447ab5cea8f8855cfeb3cd3a6a5041650 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Tue, 2 Feb 2021 09:12:08 +0100
|
||||
Subject: [PATCH] include: Add Windows.Media.SpeechSynthesis.SpeechSynthesizer
|
||||
runtimeclass.
|
||||
|
||||
As an illustration for the newly supported attributes.
|
||||
---
|
||||
include/windows.media.speechsynthesis.idl | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
diff --git a/include/windows.media.speechsynthesis.idl b/include/windows.media.speechsynthesis.idl
|
||||
index 502261f79c6..87497678f30 100644
|
||||
--- a/include/windows.media.speechsynthesis.idl
|
||||
+++ b/include/windows.media.speechsynthesis.idl
|
||||
@@ -24,10 +24,16 @@ import "inspectable.idl";
|
||||
import "windows.foundation.idl";
|
||||
|
||||
namespace Windows {
|
||||
+ namespace Foundation {
|
||||
+ interface IClosable;
|
||||
+ }
|
||||
namespace Media {
|
||||
namespace SpeechSynthesis {
|
||||
typedef enum VoiceGender VoiceGender;
|
||||
interface IInstalledVoicesStatic;
|
||||
+ interface IInstalledVoicesStatic2;
|
||||
+ interface ISpeechSynthesizer;
|
||||
+ interface ISpeechSynthesizer2;
|
||||
interface IVoiceInformation;
|
||||
runtimeclass VoiceInformation;
|
||||
}
|
||||
@@ -66,6 +72,20 @@ namespace Windows {
|
||||
{
|
||||
[default] interface Windows.Media.SpeechSynthesis.IVoiceInformation;
|
||||
}
|
||||
+
|
||||
+ [
|
||||
+ activatable(Windows.Foundation.UniversalApiContract, 1.0),
|
||||
+ contract(Windows.Foundation.UniversalApiContract, 1.0),
|
||||
+ marshaling_behavior(agile),
|
||||
+ static(Windows.Media.SpeechSynthesis.IInstalledVoicesStatic, Windows.Foundation.UniversalApiContract, 1.0),
|
||||
+ static(Windows.Media.SpeechSynthesis.IInstalledVoicesStatic2, Windows.Foundation.UniversalApiContract, 5.0)
|
||||
+ ]
|
||||
+ runtimeclass SpeechSynthesizer
|
||||
+ {
|
||||
+ [default] interface Windows.Media.SpeechSynthesis.ISpeechSynthesizer;
|
||||
+ interface Windows.Foundation.IClosable;
|
||||
+ [contract(Windows.Foundation.UniversalApiContract, 4.0)] interface Windows.Media.SpeechSynthesis.ISpeechSynthesizer2;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
2.20.1
|
||||
|
@ -1,18 +1,18 @@
|
||||
From ca531da15e6fb32e182d83e98857e6945163e083 Mon Sep 17 00:00:00 2001
|
||||
From 8b5c17d32ec132669fc345bce9616d6631e072ab Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Tue, 13 Oct 2020 00:31:57 +0200
|
||||
Subject: [PATCH] widl: Support WinRT requires keyword.
|
||||
|
||||
---
|
||||
tools/widl/parser.l | 1 +
|
||||
tools/widl/parser.y | 49 ++++++++++++++++++++++++++++++++----------
|
||||
tools/widl/parser.y | 45 +++++++++++++++++++++++++++++++++---------
|
||||
tools/widl/typetree.c | 5 ++++-
|
||||
tools/widl/typetree.h | 9 +++++++-
|
||||
tools/widl/typetree.h | 9 ++++++++-
|
||||
tools/widl/widltypes.h | 1 +
|
||||
5 files changed, 52 insertions(+), 13 deletions(-)
|
||||
5 files changed, 50 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
|
||||
index dd7cdae5338..0a5ef3c1b89 100644
|
||||
index 9b93a53b839..946dba84cd6 100644
|
||||
--- a/tools/widl/parser.l
|
||||
+++ b/tools/widl/parser.l
|
||||
@@ -298,6 +298,7 @@ static const struct keyword keywords[] = {
|
||||
@ -24,7 +24,7 @@ index dd7cdae5338..0a5ef3c1b89 100644
|
||||
{"short", tSHORT, 0},
|
||||
{"signed", tSIGNED, 0},
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 01cdbffe4c7..b774b01cdd7 100644
|
||||
index b8c916f8336..169a5ba6386 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -38,12 +38,6 @@
|
||||
@ -49,7 +49,7 @@ index 01cdbffe4c7..b774b01cdd7 100644
|
||||
static attr_list_t *append_attr(attr_list_t *list, attr_t *attr);
|
||||
static attr_list_t *append_attr_list(attr_list_t *new_list, attr_list_t *old_list);
|
||||
static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right,
|
||||
@@ -141,6 +137,7 @@ static typelib_t *current_typelib;
|
||||
@@ -130,6 +126,7 @@ static typelib_t *current_typelib;
|
||||
expr_t *expr;
|
||||
expr_list_t *expr_list;
|
||||
type_t *type;
|
||||
@ -57,7 +57,7 @@ index 01cdbffe4c7..b774b01cdd7 100644
|
||||
var_t *var;
|
||||
var_list_t *var_list;
|
||||
declarator_t *declarator;
|
||||
@@ -249,6 +246,7 @@ static typelib_t *current_typelib;
|
||||
@@ -240,6 +237,7 @@ static typelib_t *current_typelib;
|
||||
%token tREADONLY tREF
|
||||
%token tREGISTER tREPRESENTAS
|
||||
%token tREQUESTEDIT
|
||||
@ -65,19 +65,20 @@ index 01cdbffe4c7..b774b01cdd7 100644
|
||||
%token tRESTRICTED
|
||||
%token tRETVAL
|
||||
%token tRUNTIMECLASS
|
||||
@@ -298,6 +296,7 @@ static typelib_t *current_typelib;
|
||||
@@ -291,6 +289,7 @@ static typelib_t *current_typelib;
|
||||
%type <type> base_type int_std
|
||||
%type <type> enumdef structdef uniondef typedecl
|
||||
%type <type> type qualified_type
|
||||
%type <type> type unqualified_type qualified_type
|
||||
+%type <typelist> requires required_types
|
||||
%type <ifref> class_interface
|
||||
%type <ifref_list> class_interfaces
|
||||
%type <var> arg ne_union_field union_field s_field case enum enum_member declaration
|
||||
@@ -1013,19 +1012,27 @@ interfacehdr: attributes interface { $$ = $2;
|
||||
}
|
||||
@@ -967,8 +966,16 @@ inherit: { $$ = NULL; }
|
||||
interface: tINTERFACE typename { $$ = type_interface_declare($2, current_namespace); }
|
||||
;
|
||||
|
||||
-interfacedef: interfacehdr inherit
|
||||
-interfacedef: attributes interface inherit
|
||||
- '{' int_statements '}' semicolon_opt { $$ = type_interface_define($2, $1, $3, $5);
|
||||
+required_types:
|
||||
+ qualified_type { $$ = append_type(NULL, $1); }
|
||||
+ | required_types ',' required_types { $$ = append_types($1, $3); }
|
||||
@ -86,26 +87,12 @@ index 01cdbffe4c7..b774b01cdd7 100644
|
||||
+ | tREQUIRES required_types { $$ = $2; }
|
||||
+ ;
|
||||
+
|
||||
+interfacedef: interfacehdr inherit requires
|
||||
'{' int_statements '}' semicolon_opt { $$ = $1;
|
||||
if($$ == $2)
|
||||
error_loc("Interface can't inherit from itself\n");
|
||||
- type_interface_define($$, $2, $4);
|
||||
+ type_interface_define($$, $2, $5, $3);
|
||||
+interfacedef: attributes interface inherit requires
|
||||
+ '{' int_statements '}' semicolon_opt { $$ = type_interface_define($2, $1, $3, $6, $4);
|
||||
check_async_uuid($$);
|
||||
}
|
||||
/* MIDL is able to import the definition of a base class from inside the
|
||||
* definition of a derived class, I'll try to support it with this rule */
|
||||
- | interfacehdr ':' aIDENTIFIER
|
||||
+ | interfacehdr ':' aIDENTIFIER requires
|
||||
'{' import int_statements '}'
|
||||
semicolon_opt { $$ = $1;
|
||||
- type_interface_define($$, find_type_or_error2($3, 0), $6);
|
||||
+ type_interface_define($$, find_type_or_error2($3, 0), $7, $4);
|
||||
}
|
||||
| dispinterfacedef semicolon_opt { $$ = $1; }
|
||||
;
|
||||
@@ -1344,6 +1351,26 @@ static str_list_t *append_str(str_list_t *list, char *str)
|
||||
@@ -1296,6 +1303,26 @@ static str_list_t *append_str(str_list_t *list, char *str)
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -132,66 +119,66 @@ index 01cdbffe4c7..b774b01cdd7 100644
|
||||
static attr_list_t *move_attr(attr_list_t *dst, attr_list_t *src, enum attr_type type)
|
||||
{
|
||||
attr_t *attr;
|
||||
@@ -3060,7 +3087,7 @@ static void check_async_uuid(type_t *iface)
|
||||
@@ -2981,7 +3008,7 @@ static void check_async_uuid(type_t *iface)
|
||||
stmts = append_statement(stmts, make_statement_declaration(finish_func));
|
||||
}
|
||||
|
||||
- type_interface_define(async_iface, inherit, stmts);
|
||||
+ type_interface_define(async_iface, inherit, stmts, NULL);
|
||||
- type_interface_define(async_iface, map_attrs(iface->attrs, async_iface_attrs), inherit, stmts);
|
||||
+ type_interface_define(async_iface, map_attrs(iface->attrs, async_iface_attrs), inherit, stmts, NULL);
|
||||
iface->details.iface->async_iface = async_iface->details.iface->async_iface = async_iface;
|
||||
}
|
||||
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index a18ffe1f4a5..fa21766b253 100644
|
||||
index b3f0725f00e..c67daa6ae8c 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -463,7 +463,7 @@ static unsigned int compute_method_indexes(type_t *iface)
|
||||
return idx;
|
||||
@@ -441,7 +441,7 @@ type_t *type_interface_declare(char *name, struct namespace *namespace)
|
||||
return type;
|
||||
}
|
||||
|
||||
-void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts)
|
||||
+void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts, type_list_t *requires)
|
||||
-type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts)
|
||||
+type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts, type_list_t *requires)
|
||||
{
|
||||
iface->details.iface = xmalloc(sizeof(*iface->details.iface));
|
||||
iface->details.iface->disp_props = NULL;
|
||||
@@ -472,6 +472,7 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm
|
||||
if (iface->defined)
|
||||
error_loc("interface %s already defined at %s:%d\n",
|
||||
@@ -457,6 +457,7 @@ type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit
|
||||
iface->details.iface->inherit = inherit;
|
||||
iface->details.iface->disp_inherit = NULL;
|
||||
iface->details.iface->async_iface = NULL;
|
||||
+ iface->details.iface->requires = requires;
|
||||
iface->defined = TRUE;
|
||||
compute_method_indexes(iface);
|
||||
}
|
||||
@@ -486,6 +487,7 @@ void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *met
|
||||
return iface;
|
||||
@@ -485,6 +486,7 @@ type_t *type_dispinterface_define(type_t *iface, attr_list_t *attrs, var_list_t
|
||||
if (!iface->details.iface->inherit) error_loc("IDispatch is undefined\n");
|
||||
iface->details.iface->disp_inherit = NULL;
|
||||
iface->details.iface->async_iface = NULL;
|
||||
+ iface->details.iface->requires = NULL;
|
||||
iface->defined = TRUE;
|
||||
compute_method_indexes(iface);
|
||||
}
|
||||
@@ -500,6 +502,7 @@ void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface)
|
||||
return iface;
|
||||
@@ -504,6 +506,7 @@ type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *att
|
||||
if (!dispiface->details.iface->inherit) error_loc("IDispatch is undefined\n");
|
||||
dispiface->details.iface->disp_inherit = iface;
|
||||
dispiface->details.iface->async_iface = NULL;
|
||||
+ dispiface->details.iface->requires = NULL;
|
||||
dispiface->defined = TRUE;
|
||||
compute_method_indexes(dispiface);
|
||||
}
|
||||
return dispiface;
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index dc44c3f5fa7..a4ba4333bae 100644
|
||||
index 8e04537ab4d..b238c11f615 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -45,7 +45,7 @@ type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t
|
||||
type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases);
|
||||
@@ -53,7 +53,7 @@ type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *unio
|
||||
type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
|
||||
type_t *type_new_runtimeclass(char *name, struct namespace *namespace);
|
||||
-void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts);
|
||||
+void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts, type_list_t *requires);
|
||||
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods);
|
||||
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
|
||||
void type_module_define(type_t *module, statement_list_t *stmts);
|
||||
@@ -170,6 +170,13 @@ static inline type_t *type_iface_get_inherit(const type_t *type)
|
||||
type_t *type_runtimeclass_declare(char *name, struct namespace *namespace);
|
||||
type_t *type_interface_declare(char *name, struct namespace *namespace);
|
||||
-type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts);
|
||||
+type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts, type_list_t *requires);
|
||||
type_t *type_dispinterface_declare(char *name);
|
||||
type_t *type_dispinterface_define(type_t *iface, attr_list_t *attrs, var_list_t *props, var_list_t *methods);
|
||||
type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *attrs, type_t *iface);
|
||||
@@ -181,6 +181,13 @@ static inline type_t *type_iface_get_inherit(const type_t *type)
|
||||
return type->details.iface->inherit;
|
||||
}
|
||||
|
||||
@ -206,10 +193,10 @@ index dc44c3f5fa7..a4ba4333bae 100644
|
||||
{
|
||||
type = type_get_real_type(type);
|
||||
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
|
||||
index 8e9ba3e4460..7db2deb1839 100644
|
||||
index facfff21453..a3000a7417b 100644
|
||||
--- a/tools/widl/widltypes.h
|
||||
+++ b/tools/widl/widltypes.h
|
||||
@@ -385,6 +385,7 @@ struct iface_details
|
||||
@@ -386,6 +386,7 @@ struct iface_details
|
||||
struct _type_t *inherit;
|
||||
struct _type_t *disp_inherit;
|
||||
struct _type_t *async_iface;
|
||||
@ -218,5 +205,5 @@ index 8e9ba3e4460..7db2deb1839 100644
|
||||
|
||||
struct module_details
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From e0a0dba826b36993a81ae1df1186e53bfbe8e61c Mon Sep 17 00:00:00 2001
|
||||
From ed06a9e2f0f490cd146c3fc0854f88ce59a134ae Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Tue, 13 Oct 2020 16:31:16 +0200
|
||||
Subject: [PATCH] widl: Support WinRT parameterized type parsing.
|
||||
@ -15,16 +15,16 @@ Having these interfaces declared in the IDL, guarded with __WIDL__ ifdef
|
||||
is easier and more flexible than re-creating the types by hand in WIDL
|
||||
source.
|
||||
---
|
||||
include/windows.foundation.idl | 29 +++++++++++++++++
|
||||
include/windows.foundation.idl | 29 +++++++++++++++
|
||||
tools/widl/expr.c | 2 ++
|
||||
tools/widl/header.c | 8 +++--
|
||||
tools/widl/parser.y | 57 ++++++++++++++++++++++++++++++++--
|
||||
tools/widl/parser.y | 64 ++++++++++++++++++++++++++++++----
|
||||
tools/widl/typegen.c | 6 ++++
|
||||
tools/widl/typelib.c | 2 ++
|
||||
tools/widl/typetree.c | 30 ++++++++++++++++++
|
||||
tools/widl/typetree.c | 39 +++++++++++++++++++++
|
||||
tools/widl/typetree.h | 4 +++
|
||||
tools/widl/widltypes.h | 9 ++++++
|
||||
9 files changed, 142 insertions(+), 5 deletions(-)
|
||||
tools/widl/widltypes.h | 9 +++++
|
||||
9 files changed, 154 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl
|
||||
index 5e17062f399..ab7c4753c3b 100644
|
||||
@ -79,7 +79,7 @@ index 13bd5a889aa..c83e9aa5ec0 100644
|
||||
break;
|
||||
case TYPE_ALIAS:
|
||||
diff --git a/tools/widl/header.c b/tools/widl/header.c
|
||||
index 4db244fef5d..344b6891747 100644
|
||||
index e6394991317..8423756e060 100644
|
||||
--- a/tools/widl/header.c
|
||||
+++ b/tools/widl/header.c
|
||||
@@ -488,6 +488,8 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i
|
||||
@ -100,7 +100,7 @@ index 4db244fef5d..344b6891747 100644
|
||||
/* not supposed to be here */
|
||||
assert(0);
|
||||
break;
|
||||
@@ -1860,10 +1864,8 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
|
||||
@@ -1864,10 +1868,8 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
|
||||
write_apicontract(header, stmt->u.type);
|
||||
else if (type_get_type(stmt->u.type) == TYPE_RUNTIMECLASS)
|
||||
write_runtimeclass(header, stmt->u.type);
|
||||
@ -113,41 +113,41 @@ index 4db244fef5d..344b6891747 100644
|
||||
case STMT_TYPEREF:
|
||||
/* FIXME: shouldn't write out forward declarations for undefined
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index e5a39872524..9083df8cf27 100644
|
||||
index 169a5ba6386..c417a3ec963 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -81,6 +81,8 @@ static var_t *reg_const(var_t *var);
|
||||
@@ -78,6 +78,8 @@ static var_t *reg_const(var_t *var);
|
||||
|
||||
static void push_namespace(const char *name);
|
||||
static void pop_namespace(const char *name);
|
||||
static void push_lookup_namespace(const char *name);
|
||||
+static void push_parameters_namespace(const char *name);
|
||||
+static void pop_parameters_namespace(const char *name);
|
||||
|
||||
static void check_arg_attrs(const var_t *arg);
|
||||
static void check_statements(const statement_list_t *stmts, int is_inside_library);
|
||||
@@ -126,6 +128,7 @@ static struct namespace global_namespace = {
|
||||
@@ -115,6 +117,7 @@ static struct namespace global_namespace = {
|
||||
};
|
||||
|
||||
static struct namespace *current_namespace = &global_namespace;
|
||||
static struct namespace *lookup_namespace = &global_namespace;
|
||||
+static struct namespace *parameters_namespace = NULL;
|
||||
|
||||
static typelib_t *current_typelib;
|
||||
|
||||
@@ -297,6 +300,8 @@ static typelib_t *current_typelib;
|
||||
@@ -289,6 +292,8 @@ static typelib_t *current_typelib;
|
||||
%type <type> base_type int_std
|
||||
%type <type> enumdef structdef uniondef typedecl
|
||||
%type <type> type qualified_type
|
||||
%type <type> type unqualified_type qualified_type
|
||||
+%type <type> type_parameter
|
||||
+%type <typelist> type_parameters
|
||||
%type <typelist> requires required_types
|
||||
%type <ifref> class_interface
|
||||
%type <ifref_list> class_interfaces
|
||||
@@ -1014,6 +1019,15 @@ interfacehdr: attributes interface { $$ = $2;
|
||||
}
|
||||
@@ -963,7 +968,18 @@ inherit: { $$ = NULL; }
|
||||
| ':' qualified_type { $$ = $2; }
|
||||
;
|
||||
|
||||
+type_parameter: aIDENTIFIER { $$ = get_type(TYPE_PARAMETER, $1, parameters_namespace, 0); }
|
||||
+ | aKNOWNTYPE { $$ = get_type(TYPE_PARAMETER, $1, parameters_namespace, 0); }
|
||||
-interface: tINTERFACE typename { $$ = type_interface_declare($2, current_namespace); }
|
||||
+type_parameter: typename { $$ = get_type(TYPE_PARAMETER, $1, parameters_namespace, 0); }
|
||||
+ ;
|
||||
+
|
||||
+type_parameters:
|
||||
@ -155,37 +155,37 @@ index e5a39872524..9083df8cf27 100644
|
||||
+ | type_parameters ',' type_parameter { $$ = append_type($1, $3); }
|
||||
+ ;
|
||||
+
|
||||
required_types:
|
||||
qualified_type { $$ = append_type(NULL, $1); }
|
||||
| required_types ',' required_types { $$ = append_types($1, $3); }
|
||||
@@ -1029,6 +1043,13 @@ interfacedef: interfacehdr inherit requires
|
||||
type_interface_define($$, $2, $5, $3);
|
||||
check_async_uuid($$);
|
||||
}
|
||||
+ | interfacehdr '<' { push_parameters_namespace($1->name); } type_parameters '>' inherit
|
||||
+ '{' int_statements '}' semicolon_opt { $$ = $1;
|
||||
+ if($$ == $6) error_loc("Interface can't inherit from itself\n");
|
||||
+ type_parameterized_interface_define($$, $4, $6, $8);
|
||||
+ check_async_uuid($$);
|
||||
+ pop_parameters_namespace($1->name);
|
||||
+ }
|
||||
/* MIDL is able to import the definition of a base class from inside the
|
||||
* definition of a derived class, I'll try to support it with this rule */
|
||||
| interfacehdr ':' aIDENTIFIER requires
|
||||
@@ -1041,6 +1062,11 @@ interfacedef: interfacehdr inherit requires
|
||||
|
||||
interfacedec:
|
||||
interface ';' { $$ = $1; }
|
||||
+ | interface '<' { push_parameters_namespace($1->name); } type_parameters '>' ';'
|
||||
+ { $$ = $1;
|
||||
+ type_parameterized_interface_declare($$, $4);
|
||||
+ pop_parameters_namespace($1->name);
|
||||
+ }
|
||||
| dispinterface ';' { $$ = $1; }
|
||||
+interface:
|
||||
+ tINTERFACE typename { $$ = type_interface_declare($2, current_namespace); }
|
||||
+ | tINTERFACE typename '<' { push_parameters_namespace($2); } type_parameters { pop_parameters_namespace($2); } '>'
|
||||
+ { $$ = type_parameterized_interface_declare($2, current_namespace, $5); }
|
||||
;
|
||||
|
||||
@@ -2017,6 +2043,29 @@ static void push_lookup_namespace(const char *name)
|
||||
lookup_namespace = namespace;
|
||||
required_types:
|
||||
@@ -974,9 +990,18 @@ requires: { $$ = NULL; }
|
||||
| tREQUIRES required_types { $$ = $2; }
|
||||
;
|
||||
|
||||
-interfacedef: attributes interface inherit requires
|
||||
- '{' int_statements '}' semicolon_opt { $$ = type_interface_define($2, $1, $3, $6, $4);
|
||||
- check_async_uuid($$);
|
||||
+interfacedef: attributes interface { if ($2->type_type == TYPE_PARAMETERIZED_TYPE) push_parameters_namespace($2->name); }
|
||||
+ inherit requires '{' int_statements '}' semicolon_opt
|
||||
+ { if ($2->type_type == TYPE_PARAMETERIZED_TYPE)
|
||||
+ {
|
||||
+ $$ = type_parameterized_interface_define($2, $1, $4, $7, $5);
|
||||
+ pop_parameters_namespace($2->name);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ $$ = type_interface_define($2, $1, $4, $7, $5);
|
||||
+ check_async_uuid($$);
|
||||
+ }
|
||||
}
|
||||
| dispinterfacedef semicolon_opt { $$ = $1; }
|
||||
;
|
||||
@@ -1959,6 +1984,29 @@ static void pop_namespace(const char *name)
|
||||
current_namespace = current_namespace->parent;
|
||||
}
|
||||
|
||||
+static void push_parameters_namespace(const char *name)
|
||||
@ -214,27 +214,27 @@ index e5a39872524..9083df8cf27 100644
|
||||
struct rtype {
|
||||
const char *name;
|
||||
type_t *type;
|
||||
@@ -2148,7 +2197,8 @@ static type_t *find_qualified_type_or_error(const char *name, int t)
|
||||
static type_t *find_type_or_error(const char *name, int t)
|
||||
@@ -2071,7 +2119,8 @@ type_t *find_type(const char *name, struct namespace *namespace, int t)
|
||||
static type_t *find_type_or_error(struct namespace *namespace, const char *name)
|
||||
{
|
||||
type_t *type;
|
||||
- if (!(type = find_type(name, current_namespace, t)))
|
||||
+ if (!(type = find_type(name, current_namespace, t)) &&
|
||||
+ !(type = find_type(name, parameters_namespace, t)))
|
||||
- if (!(type = find_type(name, namespace, 0)))
|
||||
+ if (!(type = find_type(name, namespace, 0)) &&
|
||||
+ !(type = find_type(name, parameters_namespace, 0)))
|
||||
{
|
||||
error_loc("type '%s' not found\n", name);
|
||||
error_loc("type '%s' not found in %s namespace\n", name, namespace && namespace->name ? namespace->name : "global");
|
||||
return NULL;
|
||||
@@ -2168,7 +2218,8 @@ int is_type(const char *name)
|
||||
if (lookup_namespace != &global_namespace)
|
||||
return find_type(name, lookup_namespace, 0) != NULL;
|
||||
else
|
||||
- return find_type(name, current_namespace, 0) != NULL;
|
||||
+ return find_type(name, current_namespace, 0) != NULL ||
|
||||
+ find_type(name, parameters_namespace, 0) != NULL;
|
||||
@@ -2093,7 +2142,8 @@ static struct namespace *find_namespace_or_error(struct namespace *parent, const
|
||||
|
||||
int is_type(const char *name)
|
||||
{
|
||||
- return find_type(name, current_namespace, 0) != NULL;
|
||||
+ return find_type(name, current_namespace, 0) != NULL ||
|
||||
+ find_type(name, parameters_namespace, 0);
|
||||
}
|
||||
|
||||
int is_namespace(const char *name)
|
||||
@@ -2666,6 +2717,8 @@ static int is_allowed_conf_type(const type_t *type)
|
||||
type_t *get_type(enum type_type type, char *name, struct namespace *namespace, int t)
|
||||
@@ -2585,6 +2635,8 @@ static int is_allowed_conf_type(const type_t *type)
|
||||
case TYPE_RUNTIMECLASS:
|
||||
return FALSE;
|
||||
case TYPE_APICONTRACT:
|
||||
@ -288,33 +288,39 @@ index ace6424e3a0..6f6c5f3ccc8 100644
|
||||
assert(0);
|
||||
break;
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index fa21766b253..f451f8f3a1a 100644
|
||||
index c67daa6ae8c..3a0934af7c5 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -463,6 +463,36 @@ static unsigned int compute_method_indexes(type_t *iface)
|
||||
return idx;
|
||||
@@ -594,6 +594,45 @@ type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs)
|
||||
return apicontract;
|
||||
}
|
||||
|
||||
+void type_parameterized_interface_declare(type_t *type, type_list_t *params)
|
||||
+type_t *type_parameterized_interface_declare(char *name, struct namespace *namespace, type_list_t *params)
|
||||
+{
|
||||
+ type_t *iface = make_type(TYPE_INTERFACE);
|
||||
+ type->type_type = TYPE_PARAMETERIZED_TYPE;
|
||||
+ type->details.parameterized.type = iface;
|
||||
+ type_t *type = get_type(TYPE_PARAMETERIZED_TYPE, name, namespace, 0);
|
||||
+ if (type_get_type_detect_alias(type) != TYPE_PARAMETERIZED_TYPE)
|
||||
+ error_loc("pinterface %s previously not declared a pinterface at %s:%d\n",
|
||||
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
|
||||
+ type->details.parameterized.type = make_type(TYPE_INTERFACE);
|
||||
+ type->details.parameterized.params = params;
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
+void type_parameterized_interface_define(type_t *type, type_list_t *params, type_t *inherit, statement_list_t *stmts)
|
||||
+type_t *type_parameterized_interface_define(type_t *type, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts, type_list_t *requires)
|
||||
+{
|
||||
+ type_t *iface;
|
||||
+
|
||||
+ if (type->type_type != TYPE_PARAMETERIZED_TYPE) type_parameterized_interface_declare(type, params);
|
||||
+ iface = type->details.parameterized.type;
|
||||
+ if (type->defined)
|
||||
+ error_loc("pinterface %s already defined at %s:%d\n",
|
||||
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
|
||||
+
|
||||
+ /* The parameterized type UUID is actually a PIID that is then used as a seed to generate
|
||||
+ * a new type GUID with the rules described in:
|
||||
+ * https://docs.microsoft.com/en-us/uwp/winrt-cref/winrt-type-system#parameterized-types
|
||||
+ * FIXME: store type signatures for generated interfaces, and generate their GUIDs
|
||||
+ * TODO: store type signatures for generated interfaces, and generate their GUIDs
|
||||
+ */
|
||||
+ type->attrs = check_interface_attrs(type->name, attrs);
|
||||
+
|
||||
+ iface = type->details.parameterized.type;
|
||||
+ iface->details.iface = xmalloc(sizeof(*iface->details.iface));
|
||||
+ iface->details.iface->disp_props = NULL;
|
||||
+ iface->details.iface->disp_methods = NULL;
|
||||
@ -322,26 +328,29 @@ index fa21766b253..f451f8f3a1a 100644
|
||||
+ iface->details.iface->inherit = inherit;
|
||||
+ iface->details.iface->disp_inherit = NULL;
|
||||
+ iface->details.iface->async_iface = NULL;
|
||||
+ iface->details.iface->requires = NULL;
|
||||
+ iface->details.iface->requires = requires;
|
||||
+
|
||||
+ type->defined = TRUE;
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts, type_list_t *requires)
|
||||
int type_is_equal(const type_t *type1, const type_t *type2)
|
||||
{
|
||||
iface->details.iface = xmalloc(sizeof(*iface->details.iface));
|
||||
if (type_get_type_detect_alias(type1) != type_get_type_detect_alias(type2))
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index a4ba4333bae..79c5a01ce3a 100644
|
||||
index b238c11f615..fab32ff9e64 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -45,6 +45,8 @@ type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t
|
||||
type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases);
|
||||
type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
|
||||
type_t *type_new_runtimeclass(char *name, struct namespace *namespace);
|
||||
+void type_parameterized_interface_declare(type_t *type, type_list_t *params);
|
||||
+void type_parameterized_interface_define(type_t *type, type_list_t *params, type_t *inherit, statement_list_t *stmts);
|
||||
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts, type_list_t *requires);
|
||||
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods);
|
||||
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
|
||||
@@ -235,6 +237,8 @@ static inline int type_is_complete(const type_t *type)
|
||||
@@ -62,6 +62,8 @@ type_t *type_coclass_define(type_t *coclass, attr_list_t *attrs, ifref_list_t *i
|
||||
type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref_list_t *ifaces);
|
||||
type_t *type_apicontract_declare(char *name, struct namespace *namespace);
|
||||
type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs);
|
||||
+type_t *type_parameterized_interface_declare(char *name, struct namespace *namespace, type_list_t *params);
|
||||
+type_t *type_parameterized_interface_define(type_t *type, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts, type_list_t *requires);
|
||||
int type_is_equal(const type_t *type1, const type_t *type2);
|
||||
const char *type_get_name(const type_t *type, enum name_type name_type);
|
||||
char *gen_name(void);
|
||||
@@ -246,6 +248,8 @@ static inline int type_is_complete(const type_t *type)
|
||||
case TYPE_RUNTIMECLASS:
|
||||
return TRUE;
|
||||
case TYPE_APICONTRACT:
|
||||
@ -385,5 +394,5 @@ index a3000a7417b..2c0ac4003ce 100644
|
||||
const char *c_name;
|
||||
unsigned int typestring_offset;
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -0,0 +1,309 @@
|
||||
From ef2cb861ce5a9d47ecc10e337a192a3de32dbda3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Tue, 1 Dec 2020 14:41:01 +0100
|
||||
Subject: [PATCH] widl: Introduce new strappend helper.
|
||||
|
||||
And use it for format_namespace to grow buffer as needed.
|
||||
---
|
||||
include/windows.foundation.idl | 9 +++++
|
||||
tools/widl/parser.y | 35 ++++++++++++++++
|
||||
tools/widl/typetree.c | 73 +++++++++++++++++++++-------------
|
||||
tools/widl/typetree.h | 3 ++
|
||||
tools/widl/utils.c | 37 +++++++++++++++++
|
||||
tools/widl/utils.h | 1 +
|
||||
tools/widl/widltypes.h | 1 +
|
||||
7 files changed, 132 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl
|
||||
index ab7c4753c3b..5f7a49c38e4 100644
|
||||
--- a/include/windows.foundation.idl
|
||||
+++ b/include/windows.foundation.idl
|
||||
@@ -127,6 +127,15 @@ namespace Windows {
|
||||
HRESULT GetMany([in] UINT32 count, [out] T *items, [out, retval] UINT32 *value);
|
||||
}
|
||||
|
||||
+ [
|
||||
+ contract(Windows.Foundation.FoundationContract, 1.0),
|
||||
+ uuid(faa585ea-6214-4217-afda-7f46de5869b3)
|
||||
+ ]
|
||||
+ interface IIterable<T> : IInspectable
|
||||
+ {
|
||||
+ HRESULT First([out, retval] Windows.Foundation.Collections.IIterator<T> **value);
|
||||
+ }
|
||||
+
|
||||
[
|
||||
contract(Windows.Foundation.FoundationContract, 1.0),
|
||||
uuid(bbe1fa4c-b0e3-4583-baef-1f1b2e483e56)
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index c417a3ec963..92f6345e2dc 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -294,6 +294,8 @@ static typelib_t *current_typelib;
|
||||
%type <type> type unqualified_type qualified_type
|
||||
%type <type> type_parameter
|
||||
%type <typelist> type_parameters
|
||||
+%type <type> parameterized_type
|
||||
+%type <typelist> parameterized_types
|
||||
%type <typelist> requires required_types
|
||||
%type <ifref> class_interface
|
||||
%type <ifref_list> class_interfaces
|
||||
@@ -910,6 +912,20 @@ qualified_type:
|
||||
| namespace_pfx typename { $$ = find_type_or_error($1, $2); }
|
||||
;
|
||||
|
||||
+parameterized_type: qualified_type '<' parameterized_types '>'
|
||||
+ { $$ = find_parameterized_type($1, $3); }
|
||||
+ ;
|
||||
+
|
||||
+parameterized_types:
|
||||
+ base_type { $$ = append_type(NULL, $1); }
|
||||
+ | qualified_type { $$ = append_type(NULL, $1); }
|
||||
+ | qualified_type '*' { $$ = append_type(NULL, type_new_pointer($1)); }
|
||||
+ | parameterized_type { $$ = append_type(NULL, $1); }
|
||||
+ | parameterized_type '*' { $$ = append_type(NULL, type_new_pointer($1)); }
|
||||
+ | parameterized_types ',' parameterized_types
|
||||
+ { $$ = append_types($1, $3); }
|
||||
+ ;
|
||||
+
|
||||
coclass: tCOCLASS typename { $$ = type_coclass_declare($2); }
|
||||
;
|
||||
|
||||
@@ -966,6 +982,7 @@ dispinterfacedef:
|
||||
|
||||
inherit: { $$ = NULL; }
|
||||
| ':' qualified_type { $$ = $2; }
|
||||
+ | ':' parameterized_type { $$ = $2; }
|
||||
;
|
||||
|
||||
type_parameter: typename { $$ = get_type(TYPE_PARAMETER, $1, parameters_namespace, 0); }
|
||||
@@ -984,6 +1001,7 @@ interface:
|
||||
|
||||
required_types:
|
||||
qualified_type { $$ = append_type(NULL, $1); }
|
||||
+ | parameterized_type { $$ = append_type(NULL, $1); }
|
||||
| required_types ',' required_types { $$ = append_types($1, $3); }
|
||||
|
||||
requires: { $$ = NULL; }
|
||||
@@ -1208,6 +1226,7 @@ unqualified_type:
|
||||
type:
|
||||
unqualified_type
|
||||
| namespace_pfx typename { $$ = find_type_or_error($1, $2); }
|
||||
+ | parameterized_type { $$ = $1; }
|
||||
;
|
||||
|
||||
typedef: m_attributes tTYPEDEF m_attributes decl_spec declarator_list
|
||||
@@ -3279,3 +3298,19 @@ void init_loc_info(loc_info_t *i)
|
||||
i->line_number = line_number;
|
||||
i->near_text = parser_text;
|
||||
}
|
||||
+
|
||||
+type_t *find_parameterized_type(type_t *type, type_list_t *params)
|
||||
+{
|
||||
+ char *name = format_parameterized_type_name(type, params);
|
||||
+
|
||||
+ if (parameters_namespace)
|
||||
+ {
|
||||
+ assert(type->type_type == TYPE_PARAMETERIZED_TYPE);
|
||||
+ type = type_parameterized_type_specialize_partial(type, params);
|
||||
+ }
|
||||
+ /* FIXME: If not in another parameterized type, we'll have to look for the declared specialization. */
|
||||
+ else error_loc("parameterized type '%s' not declared\n", name);
|
||||
+
|
||||
+ free(name);
|
||||
+ return type;
|
||||
+}
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index 3a0934af7c5..1a5b13add96 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -89,41 +89,52 @@ const char *type_get_name(const type_t *type, enum name_type name_type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static char *append_namespace(char *ptr, struct namespace *namespace, const char *separator, const char *abi_prefix)
|
||||
+static size_t append_namespace(char **buf, size_t *len, size_t pos, struct namespace *namespace, const char *separator, const char *abi_prefix)
|
||||
{
|
||||
- if(is_global_namespace(namespace)) {
|
||||
- if(!abi_prefix) return ptr;
|
||||
- strcpy(ptr, abi_prefix);
|
||||
- strcat(ptr, separator);
|
||||
- return ptr + strlen(ptr);
|
||||
- }
|
||||
-
|
||||
- ptr = append_namespace(ptr, namespace->parent, separator, abi_prefix);
|
||||
- strcpy(ptr, namespace->name);
|
||||
- strcat(ptr, separator);
|
||||
- return ptr + strlen(ptr);
|
||||
+ int nested = namespace && !is_global_namespace(namespace);
|
||||
+ const char *name = nested ? namespace->name : abi_prefix;
|
||||
+ size_t n = 0;
|
||||
+ if (!name) return 0;
|
||||
+ if (nested) n += append_namespace(buf, len, pos + n, namespace->parent, separator, abi_prefix);
|
||||
+ n += strappend(buf, len, pos + n, "%s%s", name, separator);
|
||||
+ return n;
|
||||
}
|
||||
|
||||
-char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix,
|
||||
- const char *abi_prefix)
|
||||
+static size_t append_namespaces(char **buf, size_t *len, size_t pos, struct namespace *namespace, const char *prefix,
|
||||
+ const char *separator, const char *suffix, const char *abi_prefix)
|
||||
{
|
||||
- unsigned len = strlen(prefix) + strlen(suffix);
|
||||
- unsigned sep_len = strlen(separator);
|
||||
- struct namespace *iter;
|
||||
- char *ret, *ptr;
|
||||
+ size_t n = 0;
|
||||
+ n += strappend(buf, len, pos + n, "%s", prefix);
|
||||
+ n += append_namespace(buf, len, pos + n, namespace, separator, abi_prefix);
|
||||
+ n += strappend(buf, len, pos + n, "%s", suffix);
|
||||
+ return n;
|
||||
+}
|
||||
|
||||
- if(abi_prefix)
|
||||
- len += strlen(abi_prefix) + sep_len;
|
||||
+char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix, const char *abi_prefix)
|
||||
+{
|
||||
+ size_t len = 0;
|
||||
+ char *buf = NULL;
|
||||
+ append_namespaces(&buf, &len, 0, namespace, prefix, separator, suffix, abi_prefix);
|
||||
+ return buf;
|
||||
+}
|
||||
|
||||
- for(iter = namespace; !is_global_namespace(iter); iter = iter->parent)
|
||||
- len += strlen(iter->name) + sep_len;
|
||||
+char *format_parameterized_type_name(type_t *type, type_list_t *params)
|
||||
+{
|
||||
+ size_t len = 0, pos = 0;
|
||||
+ char *buf = NULL;
|
||||
+ type_list_t *entry;
|
||||
|
||||
- ret = xmalloc(len+1);
|
||||
- strcpy(ret, prefix);
|
||||
- ptr = append_namespace(ret + strlen(ret), namespace, separator, abi_prefix);
|
||||
- strcpy(ptr, suffix);
|
||||
+ pos += strappend(&buf, &len, pos, "%s<", type->name);
|
||||
+ for (entry = params; entry; entry = entry->next)
|
||||
+ {
|
||||
+ for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {}
|
||||
+ pos += append_namespaces(&buf, &len, pos, type->namespace, "", "::", type->name, use_abi_namespace ? "ABI" : NULL);
|
||||
+ for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) pos += strappend(&buf, &len, pos, "*");
|
||||
+ if (entry->next) pos += strappend(&buf, &len, pos, ",");
|
||||
+ }
|
||||
+ pos += strappend(&buf, &len, pos, ">");
|
||||
|
||||
- return ret;
|
||||
+ return buf;
|
||||
}
|
||||
|
||||
type_t *type_new_function(var_list_t *args)
|
||||
@@ -633,6 +644,14 @@ type_t *type_parameterized_interface_define(type_t *type, attr_list_t *attrs, ty
|
||||
return type;
|
||||
}
|
||||
|
||||
+type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params)
|
||||
+{
|
||||
+ type_t *new_type = duptype(type, 0);
|
||||
+ new_type->details.parameterized.type = type;
|
||||
+ new_type->details.parameterized.params = params;
|
||||
+ return new_type;
|
||||
+}
|
||||
+
|
||||
int type_is_equal(const type_t *type1, const type_t *type2)
|
||||
{
|
||||
if (type_get_type_detect_alias(type1) != type_get_type_detect_alias(type2))
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index fab32ff9e64..538134871a2 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -36,6 +36,8 @@ attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs);
|
||||
attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
|
||||
attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs);
|
||||
|
||||
+type_t *find_parameterized_type(type_t *type, type_list_t *params);
|
||||
+
|
||||
type_t *type_new_function(var_list_t *args);
|
||||
type_t *type_new_pointer(type_t *ref);
|
||||
type_t *type_new_alias(const decl_spec_t *t, const char *name);
|
||||
@@ -64,6 +66,7 @@ type_t *type_apicontract_declare(char *name, struct namespace *namespace);
|
||||
type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs);
|
||||
type_t *type_parameterized_interface_declare(char *name, struct namespace *namespace, type_list_t *params);
|
||||
type_t *type_parameterized_interface_define(type_t *type, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts, type_list_t *requires);
|
||||
+type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params);
|
||||
int type_is_equal(const type_t *type1, const type_t *type2);
|
||||
const char *type_get_name(const type_t *type, enum name_type name_type);
|
||||
char *gen_name(void);
|
||||
diff --git a/tools/widl/utils.c b/tools/widl/utils.c
|
||||
index ea92372c8c7..634bd12a0ba 100644
|
||||
--- a/tools/widl/utils.c
|
||||
+++ b/tools/widl/utils.c
|
||||
@@ -245,6 +245,43 @@ char *strmake( const char* fmt, ... )
|
||||
}
|
||||
}
|
||||
|
||||
+size_t strappend(char **buf, size_t *len, size_t pos, const char* fmt, ...)
|
||||
+{
|
||||
+ size_t size;
|
||||
+ va_list ap;
|
||||
+ char *ptr;
|
||||
+ int n;
|
||||
+
|
||||
+ assert( buf && len );
|
||||
+ assert( (*len == 0 && *buf == NULL) || (*len != 0 && *buf != NULL) );
|
||||
+
|
||||
+ if (*buf)
|
||||
+ {
|
||||
+ size = *len;
|
||||
+ ptr = *buf;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ size = 100;
|
||||
+ ptr = xmalloc( size );
|
||||
+ }
|
||||
+
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ va_start( ap, fmt );
|
||||
+ n = vsnprintf( ptr + pos, size - pos, fmt, ap );
|
||||
+ va_end( ap );
|
||||
+ if (n == -1) size *= 2;
|
||||
+ else if (pos + (size_t)n >= size) size = pos + n + 1;
|
||||
+ else break;
|
||||
+ ptr = xrealloc( ptr, size );
|
||||
+ }
|
||||
+
|
||||
+ *len = size;
|
||||
+ *buf = ptr;
|
||||
+ return n;
|
||||
+}
|
||||
+
|
||||
char *xstrdup(const char *str)
|
||||
{
|
||||
char *s;
|
||||
diff --git a/tools/widl/utils.h b/tools/widl/utils.h
|
||||
index 37406656504..82e0a6ae489 100644
|
||||
--- a/tools/widl/utils.h
|
||||
+++ b/tools/widl/utils.h
|
||||
@@ -45,6 +45,7 @@ void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
void warning_loc_info(const loc_info_t *, const char *s, ...) __attribute__((format (printf, 2, 3)));
|
||||
void chat(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
char *strmake(const char* fmt, ...) __attribute__((__format__ (__printf__, 1, 2 )));
|
||||
+size_t strappend(char **buf, size_t *len, size_t pos, const char* fmt, ...) __attribute__((__format__ (__printf__, 4, 5 )));
|
||||
|
||||
char *dup_basename(const char *name, const char *ext);
|
||||
size_t widl_getline(char **linep, size_t *lenp, FILE *fp);
|
||||
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
|
||||
index 2c0ac4003ce..be82342e31a 100644
|
||||
--- a/tools/widl/widltypes.h
|
||||
+++ b/tools/widl/widltypes.h
|
||||
@@ -650,6 +650,7 @@ void init_loc_info(loc_info_t *);
|
||||
|
||||
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix,
|
||||
const char *abi_prefix);
|
||||
+char *format_parameterized_type_name(type_t *type, type_list_t *params);
|
||||
|
||||
static inline enum type_type type_get_type_detect_alias(const type_t *type)
|
||||
{
|
||||
--
|
||||
2.20.1
|
||||
|
@ -1,6 +1,6 @@
|
||||
From 5ef017f5ca2e3676b9558f328b192033875d5ba1 Mon Sep 17 00:00:00 2001
|
||||
From 5ec925e389c8b5403173aaa81940dbc63cd4b7ed Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Tue, 1 Dec 2020 17:34:23 +0100
|
||||
Date: Thu, 4 Feb 2021 17:10:15 +0100
|
||||
Subject: [PATCH] widl: Support WinRT parameterized interface type.
|
||||
|
||||
This allows parameterized interfaces to be instanciated in declare
|
||||
@ -17,12 +17,12 @@ with the given types.
|
||||
6 files changed, 330 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/include/windows.media.speechsynthesis.idl b/include/windows.media.speechsynthesis.idl
|
||||
index 502261f79c6..7e9af77316a 100644
|
||||
index 87497678f30..af4466681dc 100644
|
||||
--- a/include/windows.media.speechsynthesis.idl
|
||||
+++ b/include/windows.media.speechsynthesis.idl
|
||||
@@ -29,11 +29,24 @@ namespace Windows {
|
||||
typedef enum VoiceGender VoiceGender;
|
||||
interface IInstalledVoicesStatic;
|
||||
@@ -35,11 +35,24 @@ namespace Windows {
|
||||
interface ISpeechSynthesizer;
|
||||
interface ISpeechSynthesizer2;
|
||||
interface IVoiceInformation;
|
||||
+ runtimeclass SpeechSynthesizer;
|
||||
runtimeclass VoiceInformation;
|
||||
@ -45,7 +45,7 @@ index 502261f79c6..7e9af77316a 100644
|
||||
namespace Windows {
|
||||
namespace Media {
|
||||
namespace SpeechSynthesis {
|
||||
@@ -58,6 +71,17 @@ namespace Windows {
|
||||
@@ -64,6 +77,17 @@ namespace Windows {
|
||||
[propget] HRESULT Gender([out] [retval] VoiceGender* value);
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ index 502261f79c6..7e9af77316a 100644
|
||||
contract(Windows.Foundation.UniversalApiContract, 1.0),
|
||||
marshaling_behavior(agile)
|
||||
diff --git a/tools/widl/header.c b/tools/widl/header.c
|
||||
index 344b6891747..e81c31aabb2 100644
|
||||
index 8423756e060..a4f1db56a01 100644
|
||||
--- a/tools/widl/header.c
|
||||
+++ b/tools/widl/header.c
|
||||
@@ -1479,7 +1479,8 @@ static void write_forward(FILE *header, type_t *iface)
|
||||
@ -93,7 +93,7 @@ index 344b6891747..e81c31aabb2 100644
|
||||
if (type_iface_get_inherit(iface))
|
||||
{
|
||||
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
|
||||
index e09722d7023..228e988530f 100644
|
||||
index 946dba84cd6..d319954edd3 100644
|
||||
--- a/tools/widl/parser.l
|
||||
+++ b/tools/widl/parser.l
|
||||
@@ -276,6 +276,7 @@ static const struct keyword keywords[] = {
|
||||
@ -105,10 +105,10 @@ index e09722d7023..228e988530f 100644
|
||||
{"dispinterface", tDISPINTERFACE, 0},
|
||||
{"double", tDOUBLE, 0},
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 61bbe2a50ee..60268f1b7d4 100644
|
||||
index 92f6345e2dc..7ab825b612b 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -84,6 +84,7 @@ static void push_lookup_namespace(const char *name);
|
||||
@@ -81,6 +81,7 @@ static void pop_namespace(const char *name);
|
||||
static void push_parameters_namespace(const char *name);
|
||||
static void pop_parameters_namespace(const char *name);
|
||||
|
||||
@ -116,7 +116,7 @@ index 61bbe2a50ee..60268f1b7d4 100644
|
||||
static void check_arg_attrs(const var_t *arg);
|
||||
static void check_statements(const statement_list_t *stmts, int is_inside_library);
|
||||
static void check_all_user_types(const statement_list_t *stmts);
|
||||
@@ -118,6 +119,7 @@ static statement_t *make_statement_importlib(const char *str);
|
||||
@@ -108,6 +109,7 @@ static statement_t *make_statement_importlib(const char *str);
|
||||
static statement_t *make_statement_module(type_t *type);
|
||||
static statement_t *make_statement_typedef(var_list_t *names, int declonly);
|
||||
static statement_t *make_statement_import(const char *str);
|
||||
@ -124,15 +124,15 @@ index 61bbe2a50ee..60268f1b7d4 100644
|
||||
static statement_list_t *append_statement(statement_list_t *list, statement_t *stmt);
|
||||
static statement_list_t *append_statements(statement_list_t *, statement_list_t *);
|
||||
static attr_list_t *append_attribs(attr_list_t *, attr_list_t *);
|
||||
@@ -129,6 +131,7 @@ static struct namespace global_namespace = {
|
||||
@@ -118,6 +120,7 @@ static struct namespace global_namespace = {
|
||||
|
||||
static struct namespace *current_namespace = &global_namespace;
|
||||
static struct namespace *lookup_namespace = &global_namespace;
|
||||
static struct namespace *parameters_namespace = NULL;
|
||||
+static statement_list_t *parameterized_type_stmts = NULL;
|
||||
|
||||
static typelib_t *current_typelib;
|
||||
|
||||
@@ -190,6 +193,7 @@ static typelib_t *current_typelib;
|
||||
@@ -180,6 +183,7 @@ static typelib_t *current_typelib;
|
||||
%token tCONTRACTVERSION
|
||||
%token tCONTROL tCPPQUOTE
|
||||
%token tCUSTOM
|
||||
@ -140,7 +140,7 @@ index 61bbe2a50ee..60268f1b7d4 100644
|
||||
%token tDECODE tDEFAULT tDEFAULTBIND
|
||||
%token tDEFAULTCOLLELEM
|
||||
%token tDEFAULTVALUE
|
||||
@@ -327,6 +331,8 @@ static typelib_t *current_typelib;
|
||||
@@ -320,6 +324,8 @@ static typelib_t *current_typelib;
|
||||
%type <typelib> library_start librarydef
|
||||
%type <statement> statement typedef pragma_warning
|
||||
%type <stmt_list> gbl_statements imp_statements int_statements
|
||||
@ -148,8 +148,8 @@ index 61bbe2a50ee..60268f1b7d4 100644
|
||||
+%type <stmt_list> imp_decl_block imp_decl_statements
|
||||
%type <warning_list> warnings
|
||||
%type <num> allocate_option_list allocate_option
|
||||
|
||||
@@ -349,7 +355,8 @@ static typelib_t *current_typelib;
|
||||
%type <namespace> namespace_pfx
|
||||
@@ -343,7 +349,8 @@ static typelib_t *current_typelib;
|
||||
|
||||
%%
|
||||
|
||||
@ -159,7 +159,7 @@ index 61bbe2a50ee..60268f1b7d4 100644
|
||||
check_all_user_types($1);
|
||||
write_header($1);
|
||||
write_id_data($1);
|
||||
@@ -365,6 +372,22 @@ input: gbl_statements m_acf { check_statements($1, FALSE);
|
||||
@@ -359,6 +366,22 @@ input: gbl_statements m_acf { check_statements($1, FALSE);
|
||||
|
||||
m_acf: /* empty */ | aACF acf_statements
|
||||
|
||||
@ -182,7 +182,7 @@ index 61bbe2a50ee..60268f1b7d4 100644
|
||||
gbl_statements: { $$ = NULL; }
|
||||
| gbl_statements namespacedef '{' { push_namespace($2); } gbl_statements '}'
|
||||
{ pop_namespace($2); $$ = append_statements($1, $5); }
|
||||
@@ -384,6 +407,7 @@ gbl_statements: { $$ = NULL; }
|
||||
@@ -380,6 +403,7 @@ gbl_statements: { $$ = NULL; }
|
||||
| gbl_statements moduledef { $$ = append_statement($1, make_statement_module($2)); }
|
||||
| gbl_statements librarydef { $$ = append_statement($1, make_statement_library($2)); }
|
||||
| gbl_statements statement { $$ = append_statement($1, $2); }
|
||||
@ -190,7 +190,7 @@ index 61bbe2a50ee..60268f1b7d4 100644
|
||||
;
|
||||
|
||||
imp_statements: { $$ = NULL; }
|
||||
@@ -404,6 +428,7 @@ imp_statements: { $$ = NULL; }
|
||||
@@ -402,6 +426,7 @@ imp_statements: { $$ = NULL; }
|
||||
| imp_statements statement { $$ = append_statement($1, $2); }
|
||||
| imp_statements importlib { $$ = append_statement($1, make_statement_importlib($2)); }
|
||||
| imp_statements librarydef { $$ = append_statement($1, make_statement_library($2)); }
|
||||
@ -198,7 +198,7 @@ index 61bbe2a50ee..60268f1b7d4 100644
|
||||
;
|
||||
|
||||
int_statements: { $$ = NULL; }
|
||||
@@ -3166,6 +3191,27 @@ static void check_async_uuid(type_t *iface)
|
||||
@@ -3083,6 +3108,27 @@ static void check_async_uuid(type_t *iface)
|
||||
iface->details.iface->async_iface = async_iface->details.iface->async_iface = async_iface;
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ index 61bbe2a50ee..60268f1b7d4 100644
|
||||
static void check_statements(const statement_list_t *stmts, int is_inside_library)
|
||||
{
|
||||
const statement_t *stmt;
|
||||
@@ -3347,6 +3393,15 @@ static statement_t *make_statement_typedef(declarator_list_t *decls, int declonl
|
||||
@@ -3264,6 +3310,15 @@ static statement_t *make_statement_typedef(declarator_list_t *decls, int declonl
|
||||
return stmt;
|
||||
}
|
||||
|
||||
@ -242,13 +242,13 @@ index 61bbe2a50ee..60268f1b7d4 100644
|
||||
static statement_list_t *append_statements(statement_list_t *l1, statement_list_t *l2)
|
||||
{
|
||||
if (!l2) return l1;
|
||||
@@ -3398,8 +3453,10 @@ type_t *find_parameterized_type(type_t *type, type_list_t *params, int t)
|
||||
@@ -3308,8 +3363,10 @@ type_t *find_parameterized_type(type_t *type, type_list_t *params)
|
||||
assert(type->type_type == TYPE_PARAMETERIZED_TYPE);
|
||||
type = type_parameterized_type_specialize_partial(type, params);
|
||||
}
|
||||
- /* FIXME: If not in another parameterized type, we'll have to look for the declared specialization. */
|
||||
- else error_loc("parameterized type '%s' not declared\n", name);
|
||||
+ else if ((type = find_type(name, type->namespace, t)))
|
||||
+ else if ((type = find_type(name, type->namespace, 0)))
|
||||
+ assert(type->type_type != TYPE_PARAMETERIZED_TYPE);
|
||||
+ else
|
||||
+ error_loc("parameterized type '%s' not declared\n", name);
|
||||
@ -256,7 +256,7 @@ index 61bbe2a50ee..60268f1b7d4 100644
|
||||
free(name);
|
||||
return type;
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index d2c472fcca0..a7c04a509e5 100644
|
||||
index 1a5b13add96..77148de8d0f 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -137,6 +137,41 @@ char *format_parameterized_type_name(type_t *type, type_list_t *params)
|
||||
@ -301,8 +301,8 @@ index d2c472fcca0..a7c04a509e5 100644
|
||||
type_t *type_new_function(var_list_t *args)
|
||||
{
|
||||
var_t *arg;
|
||||
@@ -474,6 +509,177 @@ static unsigned int compute_method_indexes(type_t *iface)
|
||||
return idx;
|
||||
@@ -652,6 +687,209 @@ type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *pa
|
||||
return new_type;
|
||||
}
|
||||
|
||||
+static type_t *replace_type_parameters_in_type(type_t *type, type_list_t *orig, type_list_t *repl);
|
||||
@ -448,7 +448,7 @@ index d2c472fcca0..a7c04a509e5 100644
|
||||
+ return t;
|
||||
+ case TYPE_PARAMETERIZED_TYPE:
|
||||
+ t = type->details.parameterized.type;
|
||||
+ if (t->type_type != TYPE_PARAMETERIZED_TYPE) return find_parameterized_type(type, repl, 0);
|
||||
+ if (t->type_type != TYPE_PARAMETERIZED_TYPE) return find_parameterized_type(type, repl);
|
||||
+ repl = replace_type_parameters_in_type_list(type->details.parameterized.params, orig, repl);
|
||||
+ return replace_type_parameters_in_type(t, t->details.parameterized.params, repl);
|
||||
+ case TYPE_STRUCT:
|
||||
@ -476,13 +476,6 @@ index d2c472fcca0..a7c04a509e5 100644
|
||||
+ iface->details.iface->requires = NULL;
|
||||
+}
|
||||
+
|
||||
type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params)
|
||||
{
|
||||
type_t *new_type = duptype(type, 0);
|
||||
@@ -482,6 +688,38 @@ type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *pa
|
||||
return new_type;
|
||||
}
|
||||
|
||||
+type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *params)
|
||||
+{
|
||||
+ type_t *tmpl = type->details.parameterized.type;
|
||||
@ -500,7 +493,7 @@ index d2c472fcca0..a7c04a509e5 100644
|
||||
+{
|
||||
+ type_list_t *orig = type->details.parameterized.params;
|
||||
+ type_t *tmpl = type->details.parameterized.type;
|
||||
+ type_t *iface = find_parameterized_type(type, params, 0);
|
||||
+ type_t *iface = find_parameterized_type(type, params);
|
||||
+
|
||||
+ if (tmpl->type_type == TYPE_INTERFACE)
|
||||
+ type_parameterized_interface_specialize(tmpl, iface, orig, params);
|
||||
@ -515,22 +508,22 @@ index d2c472fcca0..a7c04a509e5 100644
|
||||
+ return iface;
|
||||
+}
|
||||
+
|
||||
void type_parameterized_interface_declare(type_t *type, type_list_t *params)
|
||||
int type_is_equal(const type_t *type1, const type_t *type2)
|
||||
{
|
||||
type_t *iface = make_type(TYPE_INTERFACE);
|
||||
if (type_get_type_detect_alias(type1) != type_get_type_detect_alias(type2))
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index c46a2629467..1e726d3a264 100644
|
||||
index 538134871a2..b3812649f59 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -46,6 +46,8 @@ type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *unio
|
||||
type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
|
||||
type_t *type_new_runtimeclass(char *name, struct namespace *namespace);
|
||||
@@ -67,6 +67,8 @@ type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs);
|
||||
type_t *type_parameterized_interface_declare(char *name, struct namespace *namespace, type_list_t *params);
|
||||
type_t *type_parameterized_interface_define(type_t *type, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts, type_list_t *requires);
|
||||
type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params);
|
||||
+type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *params);
|
||||
+type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *params);
|
||||
type_t *find_parameterized_type(type_t *type, type_list_t *params, int t);
|
||||
void type_parameterized_interface_declare(type_t *type, type_list_t *params);
|
||||
void type_parameterized_interface_define(type_t *type, type_list_t *params, type_t *inherit, statement_list_t *stmts);
|
||||
int type_is_equal(const type_t *type1, const type_t *type2);
|
||||
const char *type_get_name(const type_t *type, enum name_type name_type);
|
||||
char *gen_name(void);
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -1,19 +1,19 @@
|
||||
From 4f91c256296729cd02b8ed85b5caf28ac7ff1e64 Mon Sep 17 00:00:00 2001
|
||||
From bb8fd38219aa4696173b859eeefcea793a4738b3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 24 Sep 2020 00:00:54 +0200
|
||||
Date: Thu, 4 Feb 2021 17:16:55 +0100
|
||||
Subject: [PATCH] widl: Support WinRT delegate type.
|
||||
|
||||
---
|
||||
tools/widl/expr.c | 1 +
|
||||
tools/widl/header.c | 16 +++++++++++-----
|
||||
tools/widl/header.c | 16 +++++++++-----
|
||||
tools/widl/parser.l | 1 +
|
||||
tools/widl/parser.y | 25 +++++++++++++++++++++++++
|
||||
tools/widl/parser.y | 20 +++++++++++++++++
|
||||
tools/widl/typegen.c | 4 ++++
|
||||
tools/widl/typelib.c | 1 +
|
||||
tools/widl/typetree.c | 30 ++++++++++++++++++++++++++++++
|
||||
tools/widl/typetree.h | 9 +++++++++
|
||||
tools/widl/widltypes.h | 7 +++++++
|
||||
9 files changed, 89 insertions(+), 5 deletions(-)
|
||||
tools/widl/typetree.c | 49 ++++++++++++++++++++++++++++++++++++++++++
|
||||
tools/widl/typetree.h | 10 +++++++++
|
||||
tools/widl/widltypes.h | 7 ++++++
|
||||
9 files changed, 104 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/expr.c b/tools/widl/expr.c
|
||||
index c83e9aa5ec0..88d59290d6b 100644
|
||||
@ -28,7 +28,7 @@ index c83e9aa5ec0..88d59290d6b 100644
|
||||
break;
|
||||
case TYPE_ALIAS:
|
||||
diff --git a/tools/widl/header.c b/tools/widl/header.c
|
||||
index e81c31aabb2..e3a2aec08fe 100644
|
||||
index a4f1db56a01..7ab79d3b6e1 100644
|
||||
--- a/tools/widl/header.c
|
||||
+++ b/tools/widl/header.c
|
||||
@@ -470,6 +470,9 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i
|
||||
@ -58,7 +58,7 @@ index e81c31aabb2..e3a2aec08fe 100644
|
||||
return 1;
|
||||
if (iface->attrs) LIST_FOR_EACH_ENTRY( attr, iface->attrs, const attr_t, entry )
|
||||
if (attr->type == ATTR_OBJECT || attr->type == ATTR_ODL) return 1;
|
||||
@@ -1795,9 +1799,10 @@ static void write_forward_decls(FILE *header, const statement_list_t *stmts)
|
||||
@@ -1799,9 +1803,10 @@ static void write_forward_decls(FILE *header, const statement_list_t *stmts)
|
||||
switch (stmt->type)
|
||||
{
|
||||
case STMT_TYPE:
|
||||
@ -70,7 +70,7 @@ index e81c31aabb2..e3a2aec08fe 100644
|
||||
if (is_object(iface) || is_attr(iface->attrs, ATTR_DISPINTERFACE))
|
||||
{
|
||||
write_forward(header, iface);
|
||||
@@ -1837,10 +1842,11 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
|
||||
@@ -1841,10 +1846,11 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
|
||||
switch (stmt->type)
|
||||
{
|
||||
case STMT_TYPE:
|
||||
@ -86,7 +86,7 @@ index e81c31aabb2..e3a2aec08fe 100644
|
||||
if (is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE) || is_object(stmt->u.type))
|
||||
{
|
||||
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
|
||||
index 228e988530f..c3d4b4ebd8e 100644
|
||||
index d319954edd3..f5e91dc741a 100644
|
||||
--- a/tools/widl/parser.l
|
||||
+++ b/tools/widl/parser.l
|
||||
@@ -278,6 +278,7 @@ static const struct keyword keywords[] = {
|
||||
@ -98,10 +98,10 @@ index 228e988530f..c3d4b4ebd8e 100644
|
||||
{"double", tDOUBLE, 0},
|
||||
{"enum", tENUM, 0},
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 60268f1b7d4..3670da04715 100644
|
||||
index 7ab825b612b..5c3eae7bf82 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -120,6 +120,7 @@ static statement_t *make_statement_module(type_t *type);
|
||||
@@ -110,6 +110,7 @@ static statement_t *make_statement_module(type_t *type);
|
||||
static statement_t *make_statement_typedef(var_list_t *names, int declonly);
|
||||
static statement_t *make_statement_import(const char *str);
|
||||
static statement_t *make_statement_parameterized_type(type_t *type, type_list_t *params);
|
||||
@ -109,7 +109,7 @@ index 60268f1b7d4..3670da04715 100644
|
||||
static statement_list_t *append_statement(statement_list_t *list, statement_t *stmt);
|
||||
static statement_list_t *append_statements(statement_list_t *, statement_list_t *);
|
||||
static attr_list_t *append_attribs(attr_list_t *, attr_list_t *);
|
||||
@@ -195,6 +196,7 @@ static typelib_t *current_typelib;
|
||||
@@ -185,6 +186,7 @@ static typelib_t *current_typelib;
|
||||
%token tCUSTOM
|
||||
%token tDECLARE
|
||||
%token tDECODE tDEFAULT tDEFAULTBIND
|
||||
@ -117,23 +117,23 @@ index 60268f1b7d4..3670da04715 100644
|
||||
%token tDEFAULTCOLLELEM
|
||||
%token tDEFAULTVALUE
|
||||
%token tDEFAULTVTABLE
|
||||
@@ -293,6 +295,7 @@ static typelib_t *current_typelib;
|
||||
@@ -283,6 +285,7 @@ static typelib_t *current_typelib;
|
||||
%type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const
|
||||
%type <expr> contract_req
|
||||
%type <expr> static_attr
|
||||
%type <type> interfacehdr
|
||||
+%type <type> delegatedef
|
||||
%type <stgclass> storage_cls_spec
|
||||
%type <type_qualifier> type_qualifier m_type_qual_list
|
||||
%type <function_specifier> function_specifier
|
||||
@@ -393,6 +396,7 @@ gbl_statements: { $$ = NULL; }
|
||||
{ pop_namespace($2); $$ = append_statements($1, $5); }
|
||||
| gbl_statements interfacedec { $$ = append_statement($1, make_statement_reference($2)); }
|
||||
@@ -388,6 +391,7 @@ gbl_statements: { $$ = NULL; }
|
||||
| gbl_statements interface ';' { $$ = append_statement($1, make_statement_reference($2)); }
|
||||
| gbl_statements dispinterface ';' { $$ = append_statement($1, make_statement_reference($2)); }
|
||||
| gbl_statements interfacedef { $$ = append_statement($1, make_statement_type_decl($2)); }
|
||||
+ | gbl_statements delegatedef { $$ = append_statement($1, make_statement_type_decl($2)); }
|
||||
| gbl_statements coclass ';' { $$ = $1;
|
||||
reg_type($2, $2->name, current_namespace, 0);
|
||||
}
|
||||
@@ -415,6 +419,7 @@ imp_statements: { $$ = NULL; }
|
||||
@@ -412,6 +416,7 @@ imp_statements: { $$ = NULL; }
|
||||
| imp_statements namespacedef '{' { push_namespace($2); } imp_statements '}'
|
||||
{ pop_namespace($2); $$ = append_statements($1, $5); }
|
||||
| imp_statements interfacedef { $$ = append_statement($1, make_statement_type_decl($2)); }
|
||||
@ -141,25 +141,20 @@ index 60268f1b7d4..3670da04715 100644
|
||||
| imp_statements coclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); }
|
||||
| imp_statements coclassdef { $$ = append_statement($1, make_statement_type_decl($2));
|
||||
reg_type($2, $2->name, current_namespace, 0);
|
||||
@@ -1070,6 +1075,17 @@ type_parameters:
|
||||
| type_parameters ',' type_parameter { $$ = append_type($1, $3); }
|
||||
@@ -1024,6 +1029,12 @@ interface:
|
||||
{ $$ = type_parameterized_interface_declare($2, current_namespace, $5); }
|
||||
;
|
||||
|
||||
+delegatedef:
|
||||
+ m_attributes tDELEGATE type ident '(' m_args ')'
|
||||
+ semicolon_opt { $$ = get_type(TYPE_DELEGATE, $4->name, current_namespace, 0);
|
||||
+ check_def($$);
|
||||
+ $$->attrs = check_iface_attrs($$->name, $1);
|
||||
+ $$->defined = TRUE;
|
||||
+ type_delegate_define($$, append_statement(NULL, make_statement_delegate($3, $6)));
|
||||
+ check_async_uuid($$);
|
||||
+delegatedef: m_attributes tDELEGATE type ident '(' m_args ')' semicolon_opt
|
||||
+ { $$ = type_delegate_declare($4->name, current_namespace);
|
||||
+ $$ = type_delegate_define($$, $1, append_statement(NULL, make_statement_delegate($3, $6)));
|
||||
+ }
|
||||
+ ;
|
||||
+
|
||||
required_types:
|
||||
qualified_type { $$ = append_type(NULL, $1); }
|
||||
| parameterized_type { $$ = append_type(NULL, $1); }
|
||||
@@ -2759,6 +2775,7 @@ static int is_allowed_conf_type(const type_t *type)
|
||||
@@ -2677,6 +2688,7 @@ static int is_allowed_conf_type(const type_t *type)
|
||||
case TYPE_INTERFACE:
|
||||
case TYPE_BITFIELD:
|
||||
case TYPE_RUNTIMECLASS:
|
||||
@ -167,7 +162,7 @@ index 60268f1b7d4..3670da04715 100644
|
||||
return FALSE;
|
||||
case TYPE_APICONTRACT:
|
||||
case TYPE_PARAMETERIZED_TYPE:
|
||||
@@ -3402,6 +3419,14 @@ static statement_t *make_statement_parameterized_type(type_t *type, type_list_t
|
||||
@@ -3319,6 +3331,14 @@ static statement_t *make_statement_parameterized_type(type_t *type, type_list_t
|
||||
return stmt;
|
||||
}
|
||||
|
||||
@ -231,11 +226,11 @@ index 6f6c5f3ccc8..8b2a2401367 100644
|
||||
|
||||
case TYPE_VOID:
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index a7c04a509e5..8c3ed223144 100644
|
||||
index 77148de8d0f..08f9a0e0c09 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -509,6 +509,14 @@ static unsigned int compute_method_indexes(type_t *iface)
|
||||
return idx;
|
||||
@@ -640,6 +640,54 @@ type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs)
|
||||
return apicontract;
|
||||
}
|
||||
|
||||
+static void compute_delegate_iface_names(type_t *delegate)
|
||||
@ -246,25 +241,27 @@ index a7c04a509e5..8c3ed223144 100644
|
||||
+ iface->c_name = format_namespace(delegate->namespace, "__x_", "_C", iface->name, use_abi_namespace ? "ABI" : NULL);
|
||||
+}
|
||||
+
|
||||
static type_t *replace_type_parameters_in_type(type_t *type, type_list_t *orig, type_list_t *repl);
|
||||
|
||||
static type_list_t *replace_type_parameters_in_type_list(type_list_t *type_list, type_list_t *orig, type_list_t *repl)
|
||||
@@ -621,6 +629,7 @@ static type_t *replace_type_parameters_in_type(type_t *type, type_list_t *orig,
|
||||
case TYPE_BITFIELD:
|
||||
case TYPE_INTERFACE:
|
||||
case TYPE_RUNTIMECLASS:
|
||||
+ case TYPE_DELEGATE:
|
||||
return type;
|
||||
case TYPE_PARAMETER:
|
||||
for (o = orig, r = repl; o && r; o = o->next, r = r->next)
|
||||
@@ -764,6 +773,27 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm
|
||||
compute_method_indexes(iface);
|
||||
}
|
||||
|
||||
+void type_delegate_define(type_t *delegate, statement_list_t *stmts)
|
||||
+type_t *type_delegate_declare(char *name, struct namespace *namespace)
|
||||
+{
|
||||
+ type_t *iface = make_type(TYPE_INTERFACE);
|
||||
+ type_t *type = get_type(TYPE_DELEGATE, name, NULL, 0);
|
||||
+ if (type_get_type_detect_alias(type) != TYPE_DELEGATE)
|
||||
+ error_loc("delegate %s previously not declared a delegate at %s:%d\n",
|
||||
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
+type_t *type_delegate_define(type_t *delegate, attr_list_t *attrs, statement_list_t *stmts)
|
||||
+{
|
||||
+ type_t *iface;
|
||||
+
|
||||
+ if (delegate->defined)
|
||||
+ error_loc("delegate %s already defined at %s:%d\n",
|
||||
+ delegate->name, delegate->loc_info.input_name, delegate->loc_info.line_number);
|
||||
+
|
||||
+ delegate->attrs = check_interface_attrs(delegate->name, attrs);
|
||||
+
|
||||
+ iface = make_type(TYPE_INTERFACE);
|
||||
+ iface->attrs = delegate->attrs;
|
||||
+ iface->details.iface = xmalloc(sizeof(*iface->details.iface));
|
||||
+ iface->details.iface->disp_props = NULL;
|
||||
+ iface->details.iface->disp_methods = NULL;
|
||||
@ -275,29 +272,40 @@ index a7c04a509e5..8c3ed223144 100644
|
||||
+ iface->details.iface->async_iface = NULL;
|
||||
+ iface->details.iface->requires = NULL;
|
||||
+ iface->defined = TRUE;
|
||||
+ iface->attrs = delegate->attrs;
|
||||
+ compute_method_indexes(iface);
|
||||
+
|
||||
+ delegate->details.delegate.iface = iface;
|
||||
+ delegate->defined = TRUE;
|
||||
+ compute_delegate_iface_names(delegate);
|
||||
+
|
||||
+ return delegate;
|
||||
+}
|
||||
+
|
||||
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods)
|
||||
type_t *type_parameterized_interface_declare(char *name, struct namespace *namespace, type_list_t *params)
|
||||
{
|
||||
iface->details.iface = xmalloc(sizeof(*iface->details.iface));
|
||||
type_t *type = get_type(TYPE_PARAMETERIZED_TYPE, name, namespace, 0);
|
||||
@@ -799,6 +847,7 @@ static type_t *replace_type_parameters_in_type(type_t *type, type_list_t *orig,
|
||||
case TYPE_BITFIELD:
|
||||
case TYPE_INTERFACE:
|
||||
case TYPE_RUNTIMECLASS:
|
||||
+ case TYPE_DELEGATE:
|
||||
return type;
|
||||
case TYPE_PARAMETER:
|
||||
for (o = orig, r = repl; o && r; o = o->next, r = r->next)
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index 1e726d3a264..3b5db8f50f6 100644
|
||||
index b3812649f59..413f1f9e41b 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -52,6 +52,7 @@ type_t *find_parameterized_type(type_t *type, type_list_t *params, int t);
|
||||
void type_parameterized_interface_declare(type_t *type, type_list_t *params);
|
||||
void type_parameterized_interface_define(type_t *type, type_list_t *params, type_t *inherit, statement_list_t *stmts);
|
||||
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts, type_list_t *requires);
|
||||
+void type_delegate_define(type_t *iface, statement_list_t *stmts);
|
||||
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods);
|
||||
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
|
||||
void type_module_define(type_t *module, statement_list_t *stmts);
|
||||
@@ -239,6 +240,7 @@ static inline int type_is_complete(const type_t *type)
|
||||
@@ -64,6 +64,8 @@ type_t *type_coclass_define(type_t *coclass, attr_list_t *attrs, ifref_list_t *i
|
||||
type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref_list_t *ifaces);
|
||||
type_t *type_apicontract_declare(char *name, struct namespace *namespace);
|
||||
type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs);
|
||||
+type_t *type_delegate_declare(char *name, struct namespace *namespace);
|
||||
+type_t *type_delegate_define(type_t *delegate, attr_list_t *attrs, statement_list_t *stmts);
|
||||
type_t *type_parameterized_interface_declare(char *name, struct namespace *namespace, type_list_t *params);
|
||||
type_t *type_parameterized_interface_define(type_t *type, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts, type_list_t *requires);
|
||||
type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params);
|
||||
@@ -251,6 +253,7 @@ static inline int type_is_complete(const type_t *type)
|
||||
case TYPE_ARRAY:
|
||||
case TYPE_BITFIELD:
|
||||
case TYPE_RUNTIMECLASS:
|
||||
@ -305,7 +313,7 @@ index 1e726d3a264..3b5db8f50f6 100644
|
||||
return TRUE;
|
||||
case TYPE_APICONTRACT:
|
||||
case TYPE_PARAMETERIZED_TYPE:
|
||||
@@ -361,6 +363,13 @@ static inline type_t *type_runtimeclass_get_default_iface(const type_t *type)
|
||||
@@ -373,6 +376,13 @@ static inline type_t *type_runtimeclass_get_default_iface(const type_t *type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -352,5 +360,5 @@ index be82342e31a..d55922b72e9 100644
|
||||
const char *c_name;
|
||||
unsigned int typestring_offset;
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -1,14 +1,14 @@
|
||||
From fb6ba3b61a5b4c1c0fc8ccb061d29680f247d17c Mon Sep 17 00:00:00 2001
|
||||
From bb804812bf6bd0e15e3c2474f1ef2c0d24873fac Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Tue, 1 Dec 2020 17:43:01 +0100
|
||||
Date: Thu, 4 Feb 2021 17:19:39 +0100
|
||||
Subject: [PATCH] widl: Support WinRT parameterized delegate type.
|
||||
|
||||
---
|
||||
include/windows.foundation.idl | 6 ++++
|
||||
tools/widl/parser.y | 11 +++++++
|
||||
tools/widl/typetree.c | 55 +++++++++++++++++++++++++++++-----
|
||||
tools/widl/typetree.h | 1 +
|
||||
4 files changed, 66 insertions(+), 7 deletions(-)
|
||||
include/windows.foundation.idl | 6 +++
|
||||
tools/widl/parser.y | 6 +++
|
||||
tools/widl/typetree.c | 73 ++++++++++++++++++++++++++++++----
|
||||
tools/widl/typetree.h | 2 +
|
||||
4 files changed, 80 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl
|
||||
index 5f7a49c38e4..9583fa5bcc8 100644
|
||||
@ -28,29 +28,24 @@ index 5f7a49c38e4..9583fa5bcc8 100644
|
||||
{
|
||||
[
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 3670da04715..12be073c01a 100644
|
||||
index 5c3eae7bf82..d8ab4a24ced 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -1084,6 +1084,17 @@ delegatedef:
|
||||
type_delegate_define($$, append_statement(NULL, make_statement_delegate($3, $6)));
|
||||
check_async_uuid($$);
|
||||
@@ -1033,6 +1033,12 @@ delegatedef: m_attributes tDELEGATE type ident '(' m_args ')' semicolon_opt
|
||||
{ $$ = type_delegate_declare($4->name, current_namespace);
|
||||
$$ = type_delegate_define($$, $1, append_statement(NULL, make_statement_delegate($3, $6)));
|
||||
}
|
||||
+ | m_attributes tDELEGATE type ident
|
||||
+ '<' { push_parameters_namespace($4->name); } type_parameters '>'
|
||||
+ '(' m_args ')'
|
||||
+ semicolon_opt { $$ = get_type(TYPE_DELEGATE, $4->name, current_namespace, 0);
|
||||
+ check_def($$);
|
||||
+ $$->attrs = check_iface_attrs($$->name, $1);
|
||||
+ $$->defined = TRUE;
|
||||
+ type_parameterized_delegate_define($$, $7, append_statement(NULL, make_statement_delegate($3, $10)));
|
||||
+ check_async_uuid($$);
|
||||
+ pop_parameters_namespace($4->name);
|
||||
+ '(' m_args ')' { pop_parameters_namespace($4->name); } semicolon_opt
|
||||
+ { $$ = type_parameterized_delegate_declare($4->name, current_namespace, $7);
|
||||
+ $$ = type_parameterized_delegate_define($$, $1, append_statement(NULL, make_statement_delegate($3, $10)));
|
||||
+ }
|
||||
;
|
||||
|
||||
required_types:
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index 8c3ed223144..6a30891f656 100644
|
||||
index 08f9a0e0c09..a83e175d288 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -142,16 +142,16 @@ static char const *parameterized_type_shorthands[][2] = {
|
||||
@ -73,8 +68,8 @@ index 8c3ed223144..6a30891f656 100644
|
||||
for (entry = params; entry; entry = entry->next)
|
||||
{
|
||||
for (type = entry->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {}
|
||||
@@ -509,12 +509,13 @@ static unsigned int compute_method_indexes(type_t *iface)
|
||||
return idx;
|
||||
@@ -640,12 +640,13 @@ type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs)
|
||||
return apicontract;
|
||||
}
|
||||
|
||||
-static void compute_delegate_iface_names(type_t *delegate)
|
||||
@ -88,8 +83,64 @@ index 8c3ed223144..6a30891f656 100644
|
||||
+ else iface->c_name = format_namespace(delegate->namespace, "__x_", "_C", iface->name, use_abi_namespace ? "ABI" : NULL);
|
||||
}
|
||||
|
||||
static type_t *replace_type_parameters_in_type(type_t *type, type_list_t *orig, type_list_t *repl);
|
||||
@@ -689,6 +690,11 @@ static void type_parameterized_interface_specialize(type_t *tmpl, type_t *iface,
|
||||
type_t *type_delegate_declare(char *name, struct namespace *namespace)
|
||||
@@ -683,7 +684,7 @@ type_t *type_delegate_define(type_t *delegate, attr_list_t *attrs, statement_lis
|
||||
|
||||
delegate->details.delegate.iface = iface;
|
||||
delegate->defined = TRUE;
|
||||
- compute_delegate_iface_names(delegate);
|
||||
+ compute_delegate_iface_names(delegate, NULL, NULL);
|
||||
|
||||
return delegate;
|
||||
}
|
||||
@@ -727,6 +728,46 @@ type_t *type_parameterized_interface_define(type_t *type, attr_list_t *attrs, ty
|
||||
return type;
|
||||
}
|
||||
|
||||
+type_t *type_parameterized_delegate_declare(char *name, struct namespace *namespace, type_list_t *params)
|
||||
+{
|
||||
+ type_t *type = get_type(TYPE_PARAMETERIZED_TYPE, name, namespace, 0);
|
||||
+ if (type_get_type_detect_alias(type) != TYPE_PARAMETERIZED_TYPE)
|
||||
+ error_loc("pdelegate %s previously not declared a pdelegate at %s:%d\n",
|
||||
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
|
||||
+ type->details.parameterized.type = make_type(TYPE_DELEGATE);
|
||||
+ type->details.parameterized.params = params;
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
+type_t *type_parameterized_delegate_define(type_t *type, attr_list_t *attrs, statement_list_t *stmts)
|
||||
+{
|
||||
+ type_t *iface, *delegate;
|
||||
+
|
||||
+ if (type->defined)
|
||||
+ error_loc("pdelegate %s already defined at %s:%d\n",
|
||||
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
|
||||
+
|
||||
+ type->attrs = check_interface_attrs(type->name, attrs);
|
||||
+
|
||||
+ delegate = type->details.parameterized.type;
|
||||
+ delegate->attrs = type->attrs;
|
||||
+ delegate->details.delegate.iface = make_type(TYPE_INTERFACE);
|
||||
+
|
||||
+ iface = delegate->details.delegate.iface;
|
||||
+ iface->details.iface = xmalloc(sizeof(*iface->details.iface));
|
||||
+ iface->details.iface->disp_props = NULL;
|
||||
+ iface->details.iface->disp_methods = NULL;
|
||||
+ iface->details.iface->stmts = stmts;
|
||||
+ iface->details.iface->inherit = find_type("IUnknown", NULL, 0);
|
||||
+ if (!iface->details.iface->inherit) error_loc("IUnknown is undefined\n");
|
||||
+ iface->details.iface->disp_inherit = NULL;
|
||||
+ iface->details.iface->async_iface = NULL;
|
||||
+ iface->details.iface->requires = NULL;
|
||||
+
|
||||
+ type->defined = TRUE;
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params)
|
||||
{
|
||||
type_t *new_type = duptype(type, 0);
|
||||
@@ -907,6 +948,11 @@ static void type_parameterized_interface_specialize(type_t *tmpl, type_t *iface,
|
||||
iface->details.iface->requires = NULL;
|
||||
}
|
||||
|
||||
@ -98,10 +149,10 @@ index 8c3ed223144..6a30891f656 100644
|
||||
+ type_parameterized_interface_specialize(tmpl->details.delegate.iface, delegate->details.delegate.iface, orig, repl);
|
||||
+}
|
||||
+
|
||||
type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params)
|
||||
type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *params)
|
||||
{
|
||||
type_t *new_type = duptype(type, 0);
|
||||
@@ -705,7 +711,13 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa
|
||||
type_t *tmpl = type->details.parameterized.type;
|
||||
@@ -915,7 +961,13 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa
|
||||
new_type->namespace = type->namespace;
|
||||
new_type->name = format_parameterized_type_name(type, params);
|
||||
reg_type(new_type, new_type->name, new_type->namespace, 0);
|
||||
@ -116,7 +167,7 @@ index 8c3ed223144..6a30891f656 100644
|
||||
|
||||
return new_type;
|
||||
}
|
||||
@@ -718,6 +730,8 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
|
||||
@@ -928,6 +980,8 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
|
||||
|
||||
if (tmpl->type_type == TYPE_INTERFACE)
|
||||
type_parameterized_interface_specialize(tmpl, iface, orig, params);
|
||||
@ -125,7 +176,7 @@ index 8c3ed223144..6a30891f656 100644
|
||||
else
|
||||
{
|
||||
error_loc("Unsupported parameterized type template %d\n", tmpl->type_type);
|
||||
@@ -725,6 +739,11 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
|
||||
@@ -935,6 +989,11 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
|
||||
}
|
||||
|
||||
iface->defined = TRUE;
|
||||
@ -137,49 +188,19 @@ index 8c3ed223144..6a30891f656 100644
|
||||
compute_method_indexes(iface);
|
||||
return iface;
|
||||
}
|
||||
@@ -791,7 +810,29 @@ void type_delegate_define(type_t *delegate, statement_list_t *stmts)
|
||||
compute_method_indexes(iface);
|
||||
|
||||
delegate->details.delegate.iface = iface;
|
||||
- compute_delegate_iface_names(delegate);
|
||||
+ compute_delegate_iface_names(delegate, NULL, NULL);
|
||||
+}
|
||||
+
|
||||
+void type_parameterized_delegate_define(type_t *type, type_list_t *params, statement_list_t *stmts)
|
||||
+{
|
||||
+ type_t *delegate = make_type(TYPE_DELEGATE);
|
||||
+ type_t *iface = make_type(TYPE_INTERFACE);
|
||||
+
|
||||
+ type->type_type = TYPE_PARAMETERIZED_TYPE;
|
||||
+ type->details.parameterized.type = delegate;
|
||||
+ type->details.parameterized.params = params;
|
||||
+
|
||||
+ delegate->details.delegate.iface = iface;
|
||||
+
|
||||
+ iface->details.iface = xmalloc(sizeof(*iface->details.iface));
|
||||
+ iface->details.iface->disp_props = NULL;
|
||||
+ iface->details.iface->disp_methods = NULL;
|
||||
+ iface->details.iface->stmts = stmts;
|
||||
+ iface->details.iface->inherit = find_type("IUnknown", NULL, 0);
|
||||
+ if (!iface->details.iface->inherit) error_loc("IUnknown is undefined\n");
|
||||
+ iface->details.iface->disp_inherit = NULL;
|
||||
+ iface->details.iface->async_iface = NULL;
|
||||
+ iface->details.iface->requires = NULL;
|
||||
}
|
||||
|
||||
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods)
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index 3b5db8f50f6..e354259ab18 100644
|
||||
index 413f1f9e41b..b2592473c8c 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -53,6 +53,7 @@ void type_parameterized_interface_declare(type_t *type, type_list_t *params);
|
||||
void type_parameterized_interface_define(type_t *type, type_list_t *params, type_t *inherit, statement_list_t *stmts);
|
||||
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts, type_list_t *requires);
|
||||
void type_delegate_define(type_t *iface, statement_list_t *stmts);
|
||||
+void type_parameterized_delegate_define(type_t *type, type_list_t *params, statement_list_t *stmts);
|
||||
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods);
|
||||
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
|
||||
void type_module_define(type_t *module, statement_list_t *stmts);
|
||||
@@ -68,6 +68,8 @@ type_t *type_delegate_declare(char *name, struct namespace *namespace);
|
||||
type_t *type_delegate_define(type_t *delegate, attr_list_t *attrs, statement_list_t *stmts);
|
||||
type_t *type_parameterized_interface_declare(char *name, struct namespace *namespace, type_list_t *params);
|
||||
type_t *type_parameterized_interface_define(type_t *type, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts, type_list_t *requires);
|
||||
+type_t *type_parameterized_delegate_declare(char *name, struct namespace *namespace, type_list_t *params);
|
||||
+type_t *type_parameterized_delegate_define(type_t *type, attr_list_t *attrs, statement_list_t *stmts);
|
||||
type_t *type_parameterized_type_specialize_partial(type_t *type, type_list_t *params);
|
||||
type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *params);
|
||||
type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *params);
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 466bf2736d778fdc23bdcb338c00fac0aa80c1b3 Mon Sep 17 00:00:00 2001
|
||||
From 4280840f7593bfdcd5d20891640271617d570801 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Tue, 1 Dec 2020 17:44:43 +0100
|
||||
Subject: [PATCH] widl: Compute signatures for parameterized types.
|
||||
@ -10,7 +10,7 @@ Subject: [PATCH] widl: Compute signatures for parameterized types.
|
||||
3 files changed, 163 insertions(+)
|
||||
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index 6a30891f656..74ee92ed094 100644
|
||||
index a83e175d288..de7f24aeed5 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -49,6 +49,7 @@ type_t *make_type(enum type_type type)
|
||||
@ -190,7 +190,7 @@ index 6a30891f656..74ee92ed094 100644
|
||||
type_t *type_new_function(var_list_t *args)
|
||||
{
|
||||
var_t *arg;
|
||||
@@ -738,10 +887,12 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
|
||||
@@ -988,10 +1137,12 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -204,10 +204,10 @@ index 6a30891f656..74ee92ed094 100644
|
||||
}
|
||||
compute_method_indexes(iface);
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index e354259ab18..4d705a060f3 100644
|
||||
index b2592473c8c..9697c4a639f 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -81,6 +81,16 @@ static inline enum type_type type_get_type(const type_t *type)
|
||||
@@ -95,6 +95,16 @@ static inline enum type_type type_get_type(const type_t *type)
|
||||
return type_get_type_detect_alias(type_get_real_type(type));
|
||||
}
|
||||
|
||||
@ -245,5 +245,5 @@ index d55922b72e9..a1fce0ef87d 100644
|
||||
static inline enum type_type type_get_type_detect_alias(const type_t *type)
|
||||
{
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 9d5f825326a9e00db5eacbc0beeafbcb4bea85ee Mon Sep 17 00:00:00 2001
|
||||
From 9da07acdf882567f4f1e6c3fd017af96ba11348e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Mon, 28 Sep 2020 17:00:41 +0200
|
||||
Subject: [PATCH] widl: Compute uuids for parameterized types.
|
||||
@ -222,7 +222,7 @@ index 3c2fd2914bf..208b193ac87 100644
|
||||
+
|
||||
#endif
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index 74ee92ed094..4002b9d62ae 100644
|
||||
index de7f24aeed5..ae11a7cb171 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -29,6 +29,7 @@
|
||||
@ -233,8 +233,8 @@ index 74ee92ed094..4002b9d62ae 100644
|
||||
|
||||
type_t *duptype(type_t *t, int dupname)
|
||||
{
|
||||
@@ -667,6 +668,57 @@ static void compute_delegate_iface_names(type_t *delegate, type_t *type, type_li
|
||||
else iface->c_name = format_namespace(delegate->namespace, "__x_", "_C", iface->name, use_abi_namespace ? "ABI" : NULL);
|
||||
@@ -1121,6 +1122,57 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa
|
||||
return new_type;
|
||||
}
|
||||
|
||||
+static void compute_interface_signature_uuid(type_t *iface)
|
||||
@ -288,10 +288,10 @@ index 74ee92ed094..4002b9d62ae 100644
|
||||
+ memcpy(&uuid->Data4, hash + 8, sizeof(*uuid) - offsetof(GUID, Data4));
|
||||
+}
|
||||
+
|
||||
static type_t *replace_type_parameters_in_type(type_t *type, type_list_t *orig, type_list_t *repl);
|
||||
|
||||
static type_list_t *replace_type_parameters_in_type_list(type_list_t *type_list, type_list_t *orig, type_list_t *repl)
|
||||
@@ -895,6 +947,7 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
|
||||
type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *params)
|
||||
{
|
||||
type_list_t *orig = type->details.parameterized.params;
|
||||
@@ -1145,6 +1197,7 @@ type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *par
|
||||
iface->signature = format_parameterized_type_signature(type, params);
|
||||
iface->defined = TRUE;
|
||||
}
|
||||
@ -300,10 +300,10 @@ index 74ee92ed094..4002b9d62ae 100644
|
||||
return iface;
|
||||
}
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index 4d705a060f3..eefd79f139d 100644
|
||||
index 9697c4a639f..db43a9aa456 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -85,7 +85,7 @@ static inline const GUID *type_get_uuid(const type_t *type)
|
||||
@@ -99,7 +99,7 @@ static inline const GUID *type_get_uuid(const type_t *type)
|
||||
{
|
||||
static const GUID empty;
|
||||
attr_t *attr;
|
||||
@ -313,5 +313,5 @@ index 4d705a060f3..eefd79f139d 100644
|
||||
error("type '%s' uuid not found\n", type->name);
|
||||
return ∅
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From f41e0e81316bade72909f7abd6eb9943c44fff72 Mon Sep 17 00:00:00 2001
|
||||
From cfe5dc40372336a60520b2b7d4459c2687984129 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Wed, 26 Aug 2020 22:46:02 +0200
|
||||
Subject: [PATCH] widl: Generate helper macros for WinRT implementation.
|
||||
@ -22,7 +22,7 @@ interface methods with the simple non-prefixed names instead.
|
||||
3 files changed, 90 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/header.c b/tools/widl/header.c
|
||||
index e3a2aec08fe..5130d82a774 100644
|
||||
index 7ab79d3b6e1..a8141d5f61d 100644
|
||||
--- a/tools/widl/header.c
|
||||
+++ b/tools/widl/header.c
|
||||
@@ -48,6 +48,8 @@ static void write_type_v(FILE *f, const decl_spec_t *t, int is_field, int declon
|
||||
@ -128,7 +128,7 @@ index e3a2aec08fe..5130d82a774 100644
|
||||
fprintf(header, "\n");
|
||||
fprintf(header, "#endif\n");
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index 4002b9d62ae..cd2ce3c9348 100644
|
||||
index ae11a7cb171..65bc24edb0f 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -51,6 +51,7 @@ type_t *make_type(enum type_type type)
|
||||
@ -162,7 +162,7 @@ index 4002b9d62ae..cd2ce3c9348 100644
|
||||
type_t *type_new_function(var_list_t *args)
|
||||
{
|
||||
var_t *arg;
|
||||
@@ -913,11 +930,13 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa
|
||||
@@ -1112,11 +1129,13 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa
|
||||
new_type->name = format_parameterized_type_name(type, params);
|
||||
reg_type(new_type, new_type->name, new_type->namespace, 0);
|
||||
new_type->c_name = format_parameterized_type_c_name(type, params, "");
|
||||
@ -189,5 +189,5 @@ index a1fce0ef87d..21598a9213d 100644
|
||||
unsigned int ptrdesc; /* used for complex structs */
|
||||
int typelib_idx;
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 61216c5e78aaa94ada1580b5b95a9171b78cbb5f Mon Sep 17 00:00:00 2001
|
||||
From 47ca5f5da753a7aef76f63d14b7be3a50a6889aa Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 25 Sep 2020 17:05:17 +0200
|
||||
Subject: [PATCH] include: Add IVectorView<HSTRING> declaration to
|
||||
@ -25,5 +25,5 @@ index 9583fa5bcc8..9b9b40897be 100644
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From e2d3c65428092ad029f1182ecd5768f54f3e105a Mon Sep 17 00:00:00 2001
|
||||
From f3fb964cf3cf78efb9242cc0ca281c2a16bec089 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||||
Date: Thu, 7 Jan 2021 13:07:33 +0100
|
||||
Subject: [PATCH] widl: Never use the namespace ABI prefix for global types.
|
||||
@ -9,7 +9,7 @@ Otherwise we end up with types like ABI::IInspectable.
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index cd2ce3c9348..a6fc2b79857 100644
|
||||
index 65bc24edb0f..bd7ae2e4463 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -106,9 +106,10 @@ static size_t append_namespace(char **buf, size_t *len, size_t pos, struct names
|
||||
@ -25,5 +25,5 @@ index cd2ce3c9348..a6fc2b79857 100644
|
||||
return n;
|
||||
}
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 800d1ba0a89f1344bd13ef1a078764c8eba28296 Mon Sep 17 00:00:00 2001
|
||||
From 6253706be0eef579fd9f68530ce646575e42a2e3 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||||
Date: Thu, 7 Jan 2021 14:28:21 +0100
|
||||
Subject: [PATCH] widl: Precompute qualified type names, and use them for C++
|
||||
@ -14,7 +14,7 @@ This is what MIDL does and avoid mismatching and even fixes some compiling issue
|
||||
5 files changed, 27 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/header.c b/tools/widl/header.c
|
||||
index 5130d82a774..60f0cd96fce 100644
|
||||
index a8141d5f61d..d327c621ad8 100644
|
||||
--- a/tools/widl/header.c
|
||||
+++ b/tools/widl/header.c
|
||||
@@ -137,15 +137,13 @@ static void write_guid(FILE *f, const char *guid_prefix, const char *name, const
|
||||
@ -51,10 +51,10 @@ index 5130d82a774..60f0cd96fce 100644
|
||||
case TYPE_VOID:
|
||||
fprintf(h, "void");
|
||||
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
|
||||
index 12be073c01a..35b6ca74cf2 100644
|
||||
index d8ab4a24ced..bd6f5c7e37f 100644
|
||||
--- a/tools/widl/parser.y
|
||||
+++ b/tools/widl/parser.y
|
||||
@@ -2158,9 +2158,15 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
|
||||
@@ -2089,9 +2089,15 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
|
||||
nt = xmalloc(sizeof(struct rtype));
|
||||
nt->name = name;
|
||||
if (is_global_namespace(namespace))
|
||||
@ -71,7 +71,7 @@ index 12be073c01a..35b6ca74cf2 100644
|
||||
nt->t = t;
|
||||
nt->next = namespace->type_hash[hash];
|
||||
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
|
||||
index a6fc2b79857..b4dac8b5f70 100644
|
||||
index bd7ae2e4463..fc8da22c730 100644
|
||||
--- a/tools/widl/typetree.c
|
||||
+++ b/tools/widl/typetree.c
|
||||
@@ -52,6 +52,7 @@ type_t *make_type(enum type_type type)
|
||||
@ -103,20 +103,20 @@ index a6fc2b79857..b4dac8b5f70 100644
|
||||
static size_t append_namespace(char **buf, size_t *len, size_t pos, struct namespace *namespace, const char *separator, const char *abi_prefix)
|
||||
{
|
||||
int nested = namespace && !is_global_namespace(namespace);
|
||||
@@ -684,6 +699,7 @@ static void compute_delegate_iface_names(type_t *delegate, type_t *type, type_li
|
||||
@@ -815,6 +830,7 @@ static void compute_delegate_iface_names(type_t *delegate, type_t *type, type_li
|
||||
iface->name = strmake("I%s", delegate->name);
|
||||
if (type) iface->c_name = format_parameterized_type_c_name(type, params, "I");
|
||||
else iface->c_name = format_namespace(delegate->namespace, "__x_", "_C", iface->name, use_abi_namespace ? "ABI" : NULL);
|
||||
+ iface->qualified_name = format_namespace(delegate->namespace, "", "::", iface->name, use_abi_namespace ? "ABI" : NULL);
|
||||
}
|
||||
|
||||
static void compute_interface_signature_uuid(type_t *iface)
|
||||
type_t *type_delegate_declare(char *name, struct namespace *namespace)
|
||||
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
|
||||
index eefd79f139d..b48c794c125 100644
|
||||
index db43a9aa456..b72147af5c7 100644
|
||||
--- a/tools/widl/typetree.h
|
||||
+++ b/tools/widl/typetree.h
|
||||
@@ -61,6 +61,7 @@ type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces);
|
||||
type_t *type_runtimeclass_define(type_t *runtimeclass, ifref_list_t *ifaces);
|
||||
@@ -75,6 +75,7 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, type_list_t *pa
|
||||
type_t *type_parameterized_type_specialize_define(type_t *type, type_list_t *params);
|
||||
int type_is_equal(const type_t *type1, const type_t *type2);
|
||||
const char *type_get_name(const type_t *type, enum name_type name_type);
|
||||
+const char *type_get_qualified_name(const type_t *type, enum name_type name_type);
|
||||
@ -136,5 +136,5 @@ index 21598a9213d..6aeeac228b6 100644
|
||||
unsigned int ptrdesc; /* used for complex structs */
|
||||
int typelib_idx;
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From dc7e23bd6fc0a32c640957dfe8bab603ef800871 Mon Sep 17 00:00:00 2001
|
||||
From 248bbf6533e66975d4971a5cc72ae9e8d2091210 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||||
Date: Thu, 7 Jan 2021 14:14:22 +0100
|
||||
Subject: [PATCH] widl: Define the C type name as an alias for the C++
|
||||
@ -9,7 +9,7 @@ Subject: [PATCH] widl: Define the C type name as an alias for the C++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/tools/widl/header.c b/tools/widl/header.c
|
||||
index 60f0cd96fce..e635f6360f7 100644
|
||||
index d327c621ad8..1bf527c642d 100644
|
||||
--- a/tools/widl/header.c
|
||||
+++ b/tools/widl/header.c
|
||||
@@ -1483,6 +1483,8 @@ static void write_forward(FILE *header, type_t *iface)
|
||||
@ -22,5 +22,5 @@ index 60f0cd96fce..e635f6360f7 100644
|
||||
if (strchr(iface->name, '<')) write_line(header, 0, "template<> struct %s;", iface->name);
|
||||
else write_line(header, 0, "interface %s;", iface->name);
|
||||
--
|
||||
2.29.2
|
||||
2.20.1
|
||||
|
@ -1 +1 @@
|
||||
2201ca08fb03d069fa2ccf46773c150a6f7988bc
|
||||
dd417540bb3afb3aa5a04a007eea9a7ee347655b
|
||||
|
Loading…
Reference in New Issue
Block a user