CI: Use git master for xkeyboard-config on Linux
[platform/upstream/libxkbcommon.git] / tools / tools-common.h
1 /*
2  * Copyright © 2012 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  *
23  * Author: Daniel Stone <daniel@fooishbar.org>
24  */
25
26 #pragma once
27
28 #include "config.h"
29
30 #include <assert.h>
31
32 /* Don't use compat names in internal code. */
33 #define _XKBCOMMON_COMPAT_H
34 #include "xkbcommon/xkbcommon.h"
35 #include "xkbcommon/xkbcommon-compose.h"
36
37 #define ARRAY_SIZE(arr) ((sizeof(arr) / sizeof(*(arr))))
38
39 void
40 tools_print_keycode_state(struct xkb_state *state,
41                           struct xkb_compose_state *compose_state,
42                           xkb_keycode_t keycode,
43                           enum xkb_consumed_mode consumed_mode);
44
45 void
46 tools_print_state_changes(enum xkb_state_component changed);
47
48 void
49 tools_disable_stdin_echo(void);
50
51 void
52 tools_enable_stdin_echo(void);
53
54 int
55 tools_exec_command(const char *prefix, int argc, char **argv);
56
57 #ifdef _WIN32
58 #define setenv(varname, value, overwrite) _putenv_s((varname), (value))
59 #define unsetenv(varname) _putenv_s(varname, "")
60 #endif