#include "wayland-version.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <getopt.h>
#include <limits.h>
#include <unistd.h>
#if HAVE_LIBXML
#include <libxml/parser.h>
#include "wayland.dtd.h"
#endif
#include <expat.h>
#include "wayland-util.h"
#define PROGRAM_NAME …
enum side { … };
enum visibility { … };
static int
usage(int ret)
{ … }
static int
scanner_version(int ret)
{ … }
static bool
is_dtd_valid(FILE *input, const char *filename)
{ … }
#define XML_BUFFER_SIZE …
struct location { … };
struct description { … };
struct protocol { … };
struct interface { … };
struct message { … };
enum arg_type { … };
struct arg { … };
struct enumeration { … };
struct entry { … };
struct parse_context { … };
enum identifier_role { … };
static void *
fail_on_null(void *p)
{ … }
static void *
zalloc(size_t s)
{ … }
static void *
xzalloc(size_t s)
{ … }
static char *
xstrdup(const char *s)
{ … }
static char *
uppercase_dup(const char *src)
{ … }
static const char *indent(int n)
{ … }
static void
desc_dump(char *desc, const char *fmt, ...) WL_PRINTF(2, 3);
static void
desc_dump(char *desc, const char *fmt, ...)
{ … }
static void __attribute__ ((noreturn))
fail(struct location *loc, const char *msg, ...)
{ … }
static void
warn(struct location *loc, const char *msg, ...)
{ … }
static bool
is_nullable_type(struct arg *arg)
{ … }
static struct message *
create_message(struct location loc, const char *name)
{ … }
static void
free_arg(struct arg *arg)
{ … }
static struct arg *
create_arg(const char *name)
{ … }
static bool
set_arg_type(struct arg *arg, const char *type)
{ … }
static void
free_description(struct description *desc)
{ … }
static void
free_message(struct message *message)
{ … }
static struct enumeration *
create_enumeration(const char *name)
{ … }
static struct entry *
create_entry(const char *name, const char *value)
{ … }
static void
free_entry(struct entry *entry)
{ … }
static void
free_enumeration(struct enumeration *enumeration)
{ … }
static struct interface *
create_interface(struct location loc, const char *name, int version)
{ … }
static void
free_interface(struct interface *interface)
{ … }
static int
strtouint(const char *str)
{ … }
static void
validate_identifier(struct location *loc,
const char *str,
enum identifier_role role)
{ … }
static int
version_from_since(struct parse_context *ctx, const char *since)
{ … }
static int
version_from_deprecated_since(struct parse_context *ctx, const char *deprecated_since)
{ … }
static void
start_element(void *data, const char *element_name, const char **atts)
{ … }
static struct enumeration *
find_enumeration(struct protocol *protocol,
struct interface *interface,
char *enum_attribute)
{ … }
static void
verify_arguments(struct parse_context *ctx,
struct interface *interface,
struct wl_list *messages,
struct wl_list *enumerations)
{ … }
#ifndef HAVE_STRNDUP
char *
strndup(const char *s, size_t size)
{ … }
#endif
static void
end_element(void *data, const XML_Char *name)
{ … }
static void
character_data(void *data, const XML_Char *s, int len)
{ … }
static void
format_text_to_comment(const char *text, bool standalone_comment)
{ … }
static void
emit_opcodes(struct wl_list *message_list, struct interface *interface)
{ … }
static void
emit_opcode_versions(struct wl_list *message_list, struct interface *interface)
{ … }
static void
emit_type(struct arg *a)
{ … }
static void
emit_stubs(struct wl_list *message_list, struct interface *interface)
{ … }
static void
emit_event_wrappers(struct wl_list *message_list, struct interface *interface)
{ … }
static void
emit_enumerations(struct interface *interface, bool with_validators)
{ … }
static void
emit_structs(struct wl_list *message_list, struct interface *interface, enum side side)
{ … }
static void
emit_types_forward_declarations(struct protocol *protocol,
struct wl_list *message_list,
struct wl_array *types)
{ … }
static int
cmp_names(const void *p1, const void *p2)
{ … }
static const char *
get_include_name(bool core, enum side side)
{ … }
static void
emit_mainpage_blurb(const struct protocol *protocol, enum side side)
{ … }
static void
emit_header(struct protocol *protocol, enum side side)
{ … }
static void
emit_enum_header(struct protocol *protocol)
{ … }
static void
emit_null_run(struct protocol *protocol)
{ … }
static void
emit_types(struct protocol *protocol, struct wl_list *message_list)
{ … }
static void
emit_messages(const char *name, struct wl_list *message_list,
struct interface *interface, const char *suffix)
{ … }
static void
emit_code(struct protocol *protocol, enum visibility vis)
{ … }
static void
free_protocol(struct protocol *protocol)
{ … }
int main(int argc, char *argv[])
{ … }