libacfutils
A general purpose library of utility functions designed to make it easier to develop addons for the X-Plane flight simulator.
Loading...
Searching...
No Matches
cmd.h
Go to the documentation of this file.
1/*
2 * CDDL HEADER START
3 *
4 * This file and its contents are supplied under the terms of the
5 * Common Development and Distribution License ("CDDL"), version 1.0.
6 * You may only use this file in accordance with the terms of version
7 * 1.0 of the CDDL.
8 *
9 * A full copy of the text of the CDDL should have accompanied this
10 * source. A copy of the CDDL is also available via the Internet at
11 * http://www.illumos.org/license/CDDL.
12 *
13 * CDDL HEADER END
14*/
15/*
16 * Copyright 2023 Saso Kiselkov. All rights reserved.
17 */
24#ifndef _ACFUTILS_CMD_H_
25#define _ACFUTILS_CMD_H_
26
27#include <stdarg.h>
28
29#include <XPLMUtilities.h>
30
31#include "sysmacros.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37typedef int (*cmd_cb_t)(XPLMCommandRef ref, XPLMCommandPhase phase,
38 void *refcon);
39
50API_EXPORT XPLMCommandRef cmd_find(PRINTF_FORMAT(const char *fmt), ...)
51 PRINTF_ATTR(1);
56API_EXPORT XPLMCommandRef fcmd_find(PRINTF_FORMAT(const char *fmt), ...)
57 PRINTF_ATTR(1);
62API_EXPORT XPLMCommandRef cmd_find_v(const char *fmt, va_list ap);
67API_EXPORT XPLMCommandRef fcmd_find_v(const char *fmt, va_list ap);
85API_EXPORT XPLMCommandRef cmd_bind(PRINTF_FORMAT(const char *fmt),
86 cmd_cb_t cb, bool_t before, void *refcon, ...) PRINTF_ATTR2(1, 5);
91API_EXPORT XPLMCommandRef cmd_bind_v(const char *fmt, cmd_cb_t cb,
92 bool_t before, void *refcon, va_list ap);
97API_EXPORT XPLMCommandRef fcmd_bind(const char *fmt,
98 cmd_cb_t cb, bool_t before, void *refcon, ...) PRINTF_ATTR2(1, 5);
103API_EXPORT bool_t cmd_unbind(PRINTF_FORMAT(const char *fmt), cmd_cb_t cb,
104 bool_t before, void *refcon, ...) PRINTF_ATTR2(1, 5);
109API_EXPORT bool_t cmd_unbind_v(const char *fmt, cmd_cb_t cb, bool_t before,
110 void *refcon, va_list ap);
115API_EXPORT void fcmd_unbind(PRINTF_FORMAT(const char *fmt), cmd_cb_t cb,
116 bool_t before, void *refcon, ...) PRINTF_ATTR2(1, 5);
117
118#ifdef __cplusplus
119}
120#endif
121
122#endif /* _ACFUTILS_CMD_H_ */
XPLMCommandRef cmd_bind(const char *fmt, cmd_cb_t cb, bool_t before, void *refcon,...)
Definition cmd.c:110
XPLMCommandRef fcmd_find(const char *fmt,...)
Definition cmd.c:61
XPLMCommandRef fcmd_find_v(const char *fmt, va_list ap)
Definition cmd.c:80
void fcmd_unbind(const char *fmt, cmd_cb_t cb, bool_t before, void *refcon,...)
Definition cmd.c:184
XPLMCommandRef cmd_find(const char *fmt,...)
Definition cmd.c:48
XPLMCommandRef cmd_bind_v(const char *fmt, cmd_cb_t cb, bool_t before, void *refcon, va_list ap)
Definition cmd.c:86
bool_t cmd_unbind(const char *fmt, cmd_cb_t cb, bool_t before, void *refcon,...)
Definition cmd.c:171
XPLMCommandRef fcmd_bind(const char *fmt, cmd_cb_t cb, bool_t before, void *refcon,...)
Definition cmd.c:123
bool_t cmd_unbind_v(const char *fmt, cmd_cb_t cb, bool_t before, void *refcon, va_list ap)
Definition cmd.c:144
XPLMCommandRef cmd_find_v(const char *fmt, va_list ap)
Definition cmd.c:74