Debian Codegraph @

src/core/lo/lo_macros.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2014 Steve Harris et al. (see AUTHORS)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 2.1
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * $Id$
15 */
16
17 #ifndef LO_MACROS_H
18 #define LO_MACROS_H
19
20 /* macros that have to be defined after function signatures */
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /* \brief Left for backward-compatibility. See
27 * LO_DEFAULT_MAX_MSG_SIZE below, and lo_server_max_msg_size().
28 */
29 #define LO_MAX_MSG_SIZE 32768
30
31 /* \brief Maximum length of incoming UDP messages in bytes.
32 */
33 #define LO_MAX_UDP_MSG_SIZE 65535
34
35 /* \brief Default maximum length of incoming messages in bytes,
36 * corresponds to max UDP message size.
37 */
38 #define LO_DEFAULT_MAX_MSG_SIZE LO_MAX_UDP_MSG_SIZE
39
40 /* \brief A set of macros to represent different communications transports
41 */
42 #define LO_DEFAULT 0x0
43 #define LO_UDP 0x1
44 #define LO_UNIX 0x2
45 #define LO_TCP 0x4
46
47 /* an internal value, ignored in transmission but check against LO_MARKER in the
48 * argument list. Used to do primitive bounds checking */
49 # define LO_MARKER_A (void *)0xdeadbeefdeadbeefLLU
50 # define LO_MARKER_B (void *)0xf00baa23f00baa23LLU
51
52 #define LO_ARGS_END LO_MARKER_A, LO_MARKER_B
53
54 #define lo_message_add_varargs(msg, types, list) \
55 lo_message_add_varargs_internal(msg, types, list, __FILE__, __LINE__)
56
57 #ifdef _MSC_VER
58 #ifndef USE_ANSI_C
59 #define USE_ANSI_C
60 #endif
61 #endif
62
63 #if defined(USE_ANSI_C) || defined(DLL_EXPORT)
64
65 /* In non-GCC compilers, there is no support for variable-argument
66 * macros, so provide "internal" vararg functions directly instead. */
67
68 int lo_message_add(lo_message msg, const char *types, ...);
69 int lo_send(lo_address targ, const char *path, const char *types, ...);
70 int lo_send_timestamped(lo_address targ, lo_timetag ts, const char *path, const char *types, ...);
71 int lo_send_from(lo_address targ, lo_server from, lo_timetag ts, const char *path, const char *types, ...);
72
73 #else // !USE_ANSI_C
74
75 #define lo_message_add(msg, types...) \
76 lo_message_add_internal(msg, __FILE__, __LINE__, types, \
77 LO_MARKER_A, LO_MARKER_B)
78
79 #define lo_send(targ, path, types...) \
80 lo_send_internal(targ, __FILE__, __LINE__, path, types, \
81 LO_MARKER_A, LO_MARKER_B)
82
83 #define lo_send_timestamped(targ, ts, path, types...) \
84 lo_send_timestamped_internal(targ, __FILE__, __LINE__, ts, path, \
85 types, LO_MARKER_A, LO_MARKER_B)
86
87 #define lo_send_from(targ, from, ts, path, types...) \
88 lo_send_from_internal(targ, from, __FILE__, __LINE__, ts, path, \
89 types, LO_MARKER_A, LO_MARKER_B)
90
91 #endif // USE_ANSI_C
92
93 #ifdef __cplusplus
94 }
95 #endif
96
97 #endif