Files
tmux/parser-test/tmux.h
2026-06-30 07:27:06 +01:00

63 lines
1.7 KiB
C

/* Stub tmux.h for the standalone cmd-parse.y test harness.
*
* This is NOT the real tmux.h. It provides just enough for cmd-parse.y to
* compile and link on its own: the queue macros, the allocation/logging
* helpers it calls, and the small part of struct cmd_parse_input it touches.
* It is found ahead of the real tmux.h via the harness include path.
*/
#ifndef TMUX_TEST_STUB_H
#define TMUX_TEST_STUB_H
#include <sys/types.h>
#include <limits.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "compat/queue.h"
#ifndef __dead
#define __dead __attribute__((__noreturn__))
#endif
#ifndef __unused
#define __unused __attribute__((__unused__))
#endif
#ifndef printflike
#define printflike(a, b) __attribute__((format(printf, a, b)))
#endif
/* Allocation helpers (implemented in xstubs.c). */
void *xmalloc(size_t);
void *xcalloc(size_t, size_t);
void *xrealloc(void *, size_t);
char *xstrdup(const char *);
char *xstrndup(const char *, size_t);
int xasprintf(char **, const char *, ...) printflike(2, 3);
int xvasprintf(char **, const char *, va_list);
/* Logging and fatal errors (implemented in xstubs.c). */
void log_debug(const char *, ...) printflike(1, 2);
__dead void fatal(const char *, ...) printflike(1, 2);
__dead void fatalx(const char *, ...) printflike(1, 2);
/*
* Parser input. The real struct has more fields, but the AST parser only
* touches flags, file and line.
*/
struct cmd_parse_input {
int flags;
#define CMD_PARSE_QUIET 0x1
#define CMD_PARSE_PARSEONLY 0x2
#define CMD_PARSE_NOALIAS 0x4
#define CMD_PARSE_VERBOSE 0x8
#define CMD_PARSE_ONEGROUP 0x10
const char *file;
u_int line;
};
#endif /* TMUX_TEST_STUB_H */