chromium/third_party/wayland/src/src/scanner.c

/*
 * Copyright © 2008-2011 Kristian Høgsberg
 * Copyright © 2011 Intel Corporation
 * Copyright © 2015 Red Hat, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#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>

/* Embedded wayland.dtd file */
/* static const char wayland_dtd[]; wayland.dtd */
#include "wayland.dtd.h"
#endif

/* Expat must be included after libxml as both want to declare XMLCALL; see
 * the Git commit that 'git blame' for this comment points to for more. */
#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)
{}

/* Convert string to unsigned integer
 *
 * Parses a non-negative base-10 number from the given string.  If the
 * specified string is blank, contains non-numerical characters, is out
 * of range, or results in a negative number, -1 is returned to indicate
 * an error.
 *
 * Upon error, this routine does not modify or set errno.
 *
 * Returns -1 on error, or a non-negative integer on success
 */
static int
strtouint(const char *str)
{}

/* Check that the provided string will produce valid "C" identifiers.
 *
 * If the string will form the prefix of an identifier in the
 * generated C code, then it must match [_a-zA-Z][_0-9a-zA-Z]*.
 *
 * If the string will form the suffix of an identifier, then
 * it must match [_0-9a-zA-Z]+.
 *
 * Unicode characters or escape sequences are not permitted,
 * since not all C compilers support them.
 *
 * If the above conditions are not met, then fail()
 */
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[])
{}