scanner: Don't hardcode the wl_ prefix in the code generator

This commit is contained in:
Kristian Høgsberg 2011-04-18 10:24:11 -04:00
parent 7e4f44e2ba
commit c5ec478d46
3 changed files with 67 additions and 67 deletions

View file

@ -3,7 +3,7 @@
<!-- The core global object. This is a special singleton object. <!-- The core global object. This is a special singleton object.
It is used for internal wayland protocol features. --> It is used for internal wayland protocol features. -->
<interface name="display" version="1"> <interface name="wl_display" version="1">
<request name="bind"> <request name="bind">
<arg name="id" type="uint"/> <arg name="id" type="uint"/>
<arg name="interface" type="string"/> <arg name="interface" type="string"/>
@ -24,7 +24,7 @@
animations. The notification will only be posted for one animations. The notification will only be posted for one
frame unless requested again. --> frame unless requested again. -->
<request name="frame"> <request name="frame">
<arg name="surface" type="object" interface="surface"/> <arg name="surface" type="object" interface="wl_surface"/>
<arg name="key" type="uint"/> <arg name="key" type="uint"/>
</request> </request>
@ -51,7 +51,7 @@
server will always announce an object before the object sends server will always announce an object before the object sends
out events. --> out events. -->
<event name="global"> <event name="global">
<arg name="id" type="new_id" interface="object"/> <arg name="id" type="new_id" interface="wl_object"/>
<arg name="name" type="string"/> <arg name="name" type="string"/>
<arg name="version" type="uint"/> <arg name="version" type="uint"/>
</event> </event>
@ -80,17 +80,17 @@
<!-- A compositor. This object is a global. The compositor is in <!-- A compositor. This object is a global. The compositor is in
charge of combining the contents of multiple surfaces into one charge of combining the contents of multiple surfaces into one
displayable output. --> displayable output. -->
<interface name="compositor" version="1"> <interface name="wl_compositor" version="1">
<!-- Factory request for a surface objects. A surface is akin to a <!-- Factory request for a surface objects. A surface is akin to a
window. --> window. -->
<request name="create_surface"> <request name="create_surface">
<arg name="id" type="new_id" interface="surface"/> <arg name="id" type="new_id" interface="wl_surface"/>
</request> </request>
</interface> </interface>
<!-- Shared memory support --> <!-- Shared memory support -->
<interface name="shm" version="1"> <interface name="wl_shm" version="1">
<!-- Transfer a shm buffer to the server. The allocated buffer <!-- Transfer a shm buffer to the server. The allocated buffer
would include at least stride * height bytes starting at the would include at least stride * height bytes starting at the
beginning of fd. The file descriptor is transferred over the beginning of fd. The file descriptor is transferred over the
@ -98,12 +98,12 @@
and visual describe the respective properties of the pixel and visual describe the respective properties of the pixel
data contained in the buffer. --> data contained in the buffer. -->
<request name="create_buffer"> <request name="create_buffer">
<arg name="id" type="new_id" interface="buffer"/> <arg name="id" type="new_id" interface="wl_buffer"/>
<arg name="fd" type="fd"/> <arg name="fd" type="fd"/>
<arg name="width" type="int"/> <arg name="width" type="int"/>
<arg name="height" type="int"/> <arg name="height" type="int"/>
<arg name="stride" type="uint"/> <arg name="stride" type="uint"/>
<arg name="visual" type="object" interface="visual"/> <arg name="visual" type="object" interface="wl_visual"/>
</request> </request>
</interface> </interface>
@ -111,15 +111,15 @@
<!-- A pixel buffer. Created using the drm, shm or similar objects. <!-- A pixel buffer. Created using the drm, shm or similar objects.
It has a size, visual and contents, but not a location on the It has a size, visual and contents, but not a location on the
screen --> screen -->
<interface name="buffer" version="1"> <interface name="wl_buffer" version="1">
<!-- Abandon a buffer. This will invalidate the object id. --> <!-- Abandon a buffer. This will invalidate the object id. -->
<request name="destroy" type="destructor"/> <request name="destroy" type="destructor"/>
</interface> </interface>
<interface name="shell" version="1"> <interface name="wl_shell" version="1">
<request name="move"> <request name="move">
<arg name="surface" type="object" interface="surface"/> <arg name="surface" type="object" interface="wl_surface"/>
<arg name="input_device" type="object" interface="input_device"/> <arg name="input_device" type="object" interface="wl_input_device"/>
<arg name="time" type="uint"/> <arg name="time" type="uint"/>
</request> </request>
@ -136,19 +136,19 @@
</enum> </enum>
<request name="resize"> <request name="resize">
<arg name="surface" type="object" interface="surface"/> <arg name="surface" type="object" interface="wl_surface"/>
<arg name="input_device" type="object" interface="input_device"/> <arg name="input_device" type="object" interface="wl_input_device"/>
<arg name="time" type="uint"/> <arg name="time" type="uint"/>
<!-- edges is an enum, need to get the values in here --> <!-- edges is an enum, need to get the values in here -->
<arg name="edges" type="uint"/> <arg name="edges" type="uint"/>
</request> </request>
<request name="create_drag"> <request name="create_drag">
<arg name="id" type="new_id" interface="drag"/> <arg name="id" type="new_id" interface="wl_drag"/>
</request> </request>
<request name="create_selection"> <request name="create_selection">
<arg name="id" type="new_id" interface="selection"/> <arg name="id" type="new_id" interface="wl_selection"/>
</request> </request>
<!-- The configure event asks the client to resize its surface. <!-- The configure event asks the client to resize its surface.
@ -160,13 +160,13 @@
<event name="configure"> <event name="configure">
<arg name="time" type="uint"/> <arg name="time" type="uint"/>
<arg name="edges" type="uint"/> <arg name="edges" type="uint"/>
<arg name="surface" type="object" interface="surface"/> <arg name="surface" type="object" interface="wl_surface"/>
<arg name="width" type="int"/> <arg name="width" type="int"/>
<arg name="height" type="int"/> <arg name="height" type="int"/>
</event> </event>
</interface> </interface>
<interface name="selection" version="1"> <interface name="wl_selection" version="1">
<!-- Add an offered mime type. Can be called several times to <!-- Add an offered mime type. Can be called several times to
offer multiple types, but must be called before 'activate'. --> offer multiple types, but must be called before 'activate'. -->
<request name="offer"> <request name="offer">
@ -175,7 +175,7 @@
<!-- Can the selection be activated for multiple devices? --> <!-- Can the selection be activated for multiple devices? -->
<request name="activate"> <request name="activate">
<arg name="input_device" type="object" interface="input_device"/> <arg name="input_device" type="object" interface="wl_input_device"/>
<arg name="time" type="uint"/> <arg name="time" type="uint"/>
</request> </request>
@ -193,7 +193,7 @@
<event name="cancelled"/> <event name="cancelled"/>
</interface> </interface>
<interface name="selection_offer" version="1"> <interface name="wl_selection_offer" version="1">
<!-- Called to receive the selection data as the specified type. <!-- Called to receive the selection data as the specified type.
Sends the pipe fd to the compositor, which forwards it to the Sends the pipe fd to the compositor, which forwards it to the
source in the 'send' event --> source in the 'send' event -->
@ -210,11 +210,11 @@
</event> </event>
<event name="keyboard_focus"> <event name="keyboard_focus">
<arg name="input_device" type="object" interface="input_device"/> <arg name="input_device" type="object" interface="wl_input_device"/>
</event> </event>
</interface> </interface>
<interface name="drag" version="1"> <interface name="wl_drag" version="1">
<!-- Add an offered mime type. Can be called several times to <!-- Add an offered mime type. Can be called several times to
offer multiple types, but must be called before 'activate'. --> offer multiple types, but must be called before 'activate'. -->
<request name="offer"> <request name="offer">
@ -222,8 +222,8 @@
</request> </request>
<request name="activate"> <request name="activate">
<arg name="surface" type="object" interface="surface"/> <arg name="surface" type="object" interface="wl_surface"/>
<arg name="input_device" type="object" interface="input_device"/> <arg name="input_device" type="object" interface="wl_input_device"/>
<arg name="time" type="uint"/> <arg name="time" type="uint"/>
</request> </request>
@ -251,7 +251,7 @@
</interface> </interface>
<interface name="drag_offer" version="1"> <interface name="wl_drag_offer" version="1">
<!-- Call to accept the offer of the given type --> <!-- Call to accept the offer of the given type -->
<request name="accept"> <request name="accept">
<arg name="time" type="uint"/> <arg name="time" type="uint"/>
@ -281,7 +281,7 @@
drag object may no longer be valid. --> drag object may no longer be valid. -->
<event name="pointer_focus"> <event name="pointer_focus">
<arg name="time" type="uint"/> <arg name="time" type="uint"/>
<arg name="surface" type="object" interface="surface"/> <arg name="surface" type="object" interface="wl_surface"/>
<arg name="x" type="int"/> <arg name="x" type="int"/>
<arg name="y" type="int"/> <arg name="y" type="int"/>
<arg name="surface_x" type="int"/> <arg name="surface_x" type="int"/>
@ -308,7 +308,7 @@
<!-- A surface. This is an image that is displayed on the screen. <!-- A surface. This is an image that is displayed on the screen.
It has a location, size and pixel contents. Similar to a window. --> It has a location, size and pixel contents. Similar to a window. -->
<interface name="surface" version="1"> <interface name="wl_surface" version="1">
<!-- Deletes the surface and invalidates its object id. --> <!-- Deletes the surface and invalidates its object id. -->
<request name="destroy" type="destructor"/> <request name="destroy" type="destructor"/>
@ -316,7 +316,7 @@
arguments specify the location of the new buffers upper left arguments specify the location of the new buffers upper left
corner, relative to the old buffers upper left corner. --> corner, relative to the old buffers upper left corner. -->
<request name="attach"> <request name="attach">
<arg name="buffer" type="object" interface="buffer"/> <arg name="buffer" type="object" interface="wl_buffer"/>
<arg name="x" type="int"/> <arg name="x" type="int"/>
<arg name="y" type="int"/> <arg name="y" type="int"/>
</request> </request>
@ -333,7 +333,7 @@
determines the initial position or if the surface is locked determines the initial position or if the surface is locked
to that relative position during moves. --> to that relative position during moves. -->
<request name="map_transient"> <request name="map_transient">
<arg name="parent" type="object" interface="surface"/> <arg name="parent" type="object" interface="wl_surface"/>
<arg name="x" type="int"/> <arg name="x" type="int"/>
<arg name="y" type="int"/> <arg name="y" type="int"/>
<arg name="flags" type="uint"/> <arg name="flags" type="uint"/>
@ -369,13 +369,13 @@
or when such a device is hot plugged. A input_device group or when such a device is hot plugged. A input_device group
typically has a pointer and maintains a keyboard_focus and a typically has a pointer and maintains a keyboard_focus and a
pointer_focus. --> pointer_focus. -->
<interface name="input_device" version="1"> <interface name="wl_input_device" version="1">
<!-- Set the pointer's image. This request only takes effect if <!-- Set the pointer's image. This request only takes effect if
the pointer focus for this device is one of the requesting the pointer focus for this device is one of the requesting
clients surfaces. --> clients surfaces. -->
<request name="attach"> <request name="attach">
<arg name="time" type="uint"/> <arg name="time" type="uint"/>
<arg name="buffer" type="object" interface="buffer"/> <arg name="buffer" type="object" interface="wl_buffer"/>
<arg name="hotspot_x" type="int"/> <arg name="hotspot_x" type="int"/>
<arg name="hotspot_y" type="int"/> <arg name="hotspot_y" type="int"/>
</request> </request>
@ -413,7 +413,7 @@
this event by setting an apropriate pointer image. --> this event by setting an apropriate pointer image. -->
<event name="pointer_focus"> <event name="pointer_focus">
<arg name="time" type="uint"/> <arg name="time" type="uint"/>
<arg name="surface" type="object" interface="surface"/> <arg name="surface" type="object" interface="wl_surface"/>
<arg name="x" type="int"/> <arg name="x" type="int"/>
<arg name="y" type="int"/> <arg name="y" type="int"/>
<arg name="surface_x" type="int"/> <arg name="surface_x" type="int"/>
@ -422,7 +422,7 @@
<event name="keyboard_focus"> <event name="keyboard_focus">
<arg name="time" type="uint"/> <arg name="time" type="uint"/>
<arg name="surface" type="object" interface="surface"/> <arg name="surface" type="object" interface="wl_surface"/>
<arg name="keys" type="array"/> <arg name="keys" type="array"/>
</event> </event>
</interface> </interface>
@ -435,7 +435,7 @@
displays part of the compositor space. This object is displays part of the compositor space. This object is
published as global during start up, or when a screen is hot published as global during start up, or when a screen is hot
plugged. --> plugged. -->
<interface name="output" version="1"> <interface name="wl_output" version="1">
<!-- Notification about the screen size. --> <!-- Notification about the screen size. -->
<event name="geometry"> <event name="geometry">
<arg name="x" type="int"/> <arg name="x" type="int"/>
@ -449,6 +449,6 @@
<!-- A visual is the pixel format. The different visuals are <!-- A visual is the pixel format. The different visuals are
currently only identified by the order they are advertised by currently only identified by the order they are advertised by
the 'global' events. We need something better. --> the 'global' events. We need something better. -->
<interface name="visual" version="1"/> <interface name="wl_visual" version="1"/>
</protocol> </protocol>

View file

@ -281,7 +281,7 @@ emit_opcodes(struct wl_list *message_list, struct interface *interface)
opcode = 0; opcode = 0;
wl_list_for_each(m, message_list, link) wl_list_for_each(m, message_list, link)
printf("#define WL_%s_%s\t%d\n", printf("#define %s_%s\t%d\n",
interface->uppercase_name, m->uppercase_name, opcode++); interface->uppercase_name, m->uppercase_name, opcode++);
printf("\n"); printf("\n");
@ -304,7 +304,7 @@ emit_type(struct arg *a)
printf("const char *"); printf("const char *");
break; break;
case OBJECT: case OBJECT:
printf("struct wl_%s *", a->interface_name); printf("struct %s *", a->interface_name);
break; break;
case ARRAY: case ARRAY:
printf("struct wl_array *"); printf("struct wl_array *");
@ -320,13 +320,13 @@ emit_stubs(struct wl_list *message_list, struct interface *interface)
int has_destructor, has_destroy; int has_destructor, has_destroy;
/* We provide a hand written constructor for the display object */ /* We provide a hand written constructor for the display object */
if (strcmp(interface->name, "display") != 0) if (strcmp(interface->name, "wl_display") != 0)
printf("static inline struct wl_%s *\n" printf("static inline struct %s *\n"
"wl_%s_create(struct wl_display *display, uint32_t id, uint32_t version)\n" "%s_create(struct wl_display *display, uint32_t id, uint32_t version)\n"
"{\n" "{\n"
"\twl_display_bind(display, id, \"%s\", version);\n\n" "\twl_display_bind(display, id, \"%s\", version);\n\n"
"\treturn (struct wl_%s *)\n" "\treturn (struct %s *)\n"
"\t\twl_proxy_create_for_id(display, &wl_%s_interface, id);\n" "\t\twl_proxy_create_for_id(display, &%s_interface, id);\n"
"}\n\n", "}\n\n",
interface->name, interface->name,
interface->name, interface->name,
@ -335,7 +335,7 @@ emit_stubs(struct wl_list *message_list, struct interface *interface)
interface->name); interface->name);
printf("static inline void\n" printf("static inline void\n"
"wl_%s_set_user_data(struct wl_%s *%s, void *user_data)\n" "%s_set_user_data(struct %s *%s, void *user_data)\n"
"{\n" "{\n"
"\twl_proxy_set_user_data((struct wl_proxy *) %s, user_data);\n" "\twl_proxy_set_user_data((struct wl_proxy *) %s, user_data);\n"
"}\n\n", "}\n\n",
@ -343,7 +343,7 @@ emit_stubs(struct wl_list *message_list, struct interface *interface)
interface->name); interface->name);
printf("static inline void *\n" printf("static inline void *\n"
"wl_%s_get_user_data(struct wl_%s *%s)\n" "%s_get_user_data(struct %s *%s)\n"
"{\n" "{\n"
"\treturn wl_proxy_get_user_data((struct wl_proxy *) %s);\n" "\treturn wl_proxy_get_user_data((struct wl_proxy *) %s);\n"
"}\n\n", "}\n\n",
@ -367,9 +367,9 @@ emit_stubs(struct wl_list *message_list, struct interface *interface)
} }
/* And we have a hand-written display destructor */ /* And we have a hand-written display destructor */
if (!has_destructor && strcmp(interface->name, "display") != 0) if (!has_destructor && strcmp(interface->name, "wl_display") != 0)
printf("static inline void\n" printf("static inline void\n"
"wl_%s_destroy(struct wl_%s *%s)\n" "%s_destroy(struct %s *%s)\n"
"{\n" "{\n"
"\twl_proxy_destroy(" "\twl_proxy_destroy("
"(struct wl_proxy *) %s);\n" "(struct wl_proxy *) %s);\n"
@ -388,12 +388,12 @@ emit_stubs(struct wl_list *message_list, struct interface *interface)
} }
if (ret) if (ret)
printf("static inline struct wl_%s *\n", printf("static inline struct %s *\n",
ret->interface_name); ret->interface_name);
else else
printf("static inline void\n"); printf("static inline void\n");
printf("wl_%s_%s(struct wl_%s *%s", printf("%s_%s(struct %s *%s",
interface->name, m->name, interface->name, m->name,
interface->name, interface->name); interface->name, interface->name);
@ -411,7 +411,7 @@ emit_stubs(struct wl_list *message_list, struct interface *interface)
printf("\tstruct wl_proxy *%s;\n\n" printf("\tstruct wl_proxy *%s;\n\n"
"\t%s = wl_proxy_create(" "\t%s = wl_proxy_create("
"(struct wl_proxy *) %s,\n" "(struct wl_proxy *) %s,\n"
"\t\t\t &wl_%s_interface);\n" "\t\t\t &%s_interface);\n"
"\tif (!%s)\n" "\tif (!%s)\n"
"\t\treturn NULL;\n\n", "\t\treturn NULL;\n\n",
ret->name, ret->name,
@ -420,7 +420,7 @@ emit_stubs(struct wl_list *message_list, struct interface *interface)
ret->name); ret->name);
printf("\twl_proxy_marshal((struct wl_proxy *) %s,\n" printf("\twl_proxy_marshal((struct wl_proxy *) %s,\n"
"\t\t\t WL_%s_%s", "\t\t\t %s_%s",
interface->name, interface->name,
interface->uppercase_name, interface->uppercase_name,
m->uppercase_name); m->uppercase_name);
@ -437,7 +437,7 @@ emit_stubs(struct wl_list *message_list, struct interface *interface)
interface->name); interface->name);
if (ret) if (ret)
printf("\n\treturn (struct wl_%s *) %s;\n", printf("\n\treturn (struct %s *) %s;\n",
ret->interface_name, ret->name); ret->interface_name, ret->name);
printf("}\n\n"); printf("}\n\n");
@ -467,18 +467,18 @@ emit_enumerations(struct interface *interface)
struct entry *entry; struct entry *entry;
wl_list_for_each(e, &interface->enumeration_list, link) { wl_list_for_each(e, &interface->enumeration_list, link) {
printf("#ifndef WL_%s_%s_ENUM\n", printf("#ifndef %s_%s_ENUM\n",
interface->uppercase_name, e->uppercase_name); interface->uppercase_name, e->uppercase_name);
printf("#define WL_%s_%s_ENUM\n", printf("#define %s_%s_ENUM\n",
interface->uppercase_name, e->uppercase_name); interface->uppercase_name, e->uppercase_name);
printf("enum wl_%s_%s {\n", interface->name, e->name); printf("enum %s_%s {\n", interface->name, e->name);
wl_list_for_each(entry, &e->entry_list, link) wl_list_for_each(entry, &e->entry_list, link)
printf("\tWL_%s_%s_%s = %s,\n", printf("\t%s_%s_%s = %s,\n",
interface->uppercase_name, interface->uppercase_name,
e->uppercase_name, e->uppercase_name,
entry->uppercase_name, entry->value); entry->uppercase_name, entry->value);
printf("};\n"); printf("};\n");
printf("#endif /* WL_%s_%s_ENUM */\n\n", printf("#endif /* %s_%s_ENUM */\n\n",
interface->uppercase_name, e->uppercase_name); interface->uppercase_name, e->uppercase_name);
} }
} }
@ -494,7 +494,7 @@ emit_structs(struct wl_list *message_list, struct interface *interface)
return; return;
is_interface = message_list == &interface->request_list; is_interface = message_list == &interface->request_list;
printf("struct wl_%s_%s {\n", interface->name, printf("struct %s_%s {\n", interface->name,
is_interface ? "interface" : "listener"); is_interface ? "interface" : "listener");
wl_list_for_each(m, message_list, link) { wl_list_for_each(m, message_list, link) {
@ -503,12 +503,12 @@ emit_structs(struct wl_list *message_list, struct interface *interface)
n = strlen(m->name) + 17; n = strlen(m->name) + 17;
if (is_interface) { if (is_interface) {
printf("struct wl_client *client,\n" printf("struct wl_client *client,\n"
"%sstruct wl_%s *%s", "%sstruct %s *%s",
indent(n), indent(n),
interface->name, interface->name); interface->name, interface->name);
} else { } else {
printf("void *data,\n"), printf("void *data,\n"),
printf("%sstruct wl_%s *%s", printf("%sstruct %s *%s",
indent(n), interface->name, interface->name); indent(n), interface->name, interface->name);
} }
@ -526,8 +526,8 @@ emit_structs(struct wl_list *message_list, struct interface *interface)
if (!is_interface) { if (!is_interface) {
printf("static inline int\n" printf("static inline int\n"
"wl_%s_add_listener(struct wl_%s *%s,\n" "%s_add_listener(struct %s *%s,\n"
"%sconst struct wl_%s_listener *listener, void *data)\n" "%sconst struct %s_listener *listener, void *data)\n"
"{\n" "{\n"
"\treturn wl_proxy_add_listener((struct wl_proxy *) %s,\n" "\treturn wl_proxy_add_listener((struct wl_proxy *) %s,\n"
"%s(void (**)(void)) listener, data);\n" "%s(void (**)(void)) listener, data);\n"
@ -564,12 +564,12 @@ emit_header(struct protocol *protocol, int server)
protocol->uppercase_name, s); protocol->uppercase_name, s);
wl_list_for_each(i, &protocol->interface_list, link) wl_list_for_each(i, &protocol->interface_list, link)
printf("struct wl_%s;\n", i->name); printf("struct %s;\n", i->name);
printf("\n"); printf("\n");
wl_list_for_each(i, &protocol->interface_list, link) { wl_list_for_each(i, &protocol->interface_list, link) {
printf("extern const struct wl_interface " printf("extern const struct wl_interface "
"wl_%s_interface;\n", "%s_interface;\n",
i->name); i->name);
} }
printf("\n"); printf("\n");
@ -660,7 +660,7 @@ emit_code(struct protocol *protocol)
emit_messages(&i->event_list, i, "events"); emit_messages(&i->event_list, i, "events");
printf("WL_EXPORT const struct wl_interface " printf("WL_EXPORT const struct wl_interface "
"wl_%s_interface = {\n" "%s_interface = {\n"
"\t\"%s\", %d,\n", "\t\"%s\", %d,\n",
i->name, i->name, i->version); i->name, i->name, i->version);

View file

@ -290,10 +290,10 @@ display_handle_global(void *data,
struct wl_global_listener *listener; struct wl_global_listener *listener;
struct wl_global *global; struct wl_global *global;
if (strcmp(interface, "display") == 0) if (strcmp(interface, "wl_display") == 0)
wl_hash_table_insert(display->objects, wl_hash_table_insert(display->objects,
id, &display->proxy.object); id, &display->proxy.object);
else if (strcmp(interface, "visual") == 0) else if (strcmp(interface, "wl_visual") == 0)
add_visual(display, id); add_visual(display, id);
global = malloc(sizeof *global); global = malloc(sizeof *global);
@ -456,7 +456,7 @@ wl_display_connect(const char *name)
return NULL; return NULL;
} }
wl_display_bind(display, 1, "display", 1); wl_display_bind(display, 1, "wl_display", 1);
return display; return display;
} }