lo_macros.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2004 Steve Harris
00003  *
00004  *  This program is free software; you can redistribute it and/or
00005  *  modify it under the terms of the GNU Lesser General Public License
00006  *  as published by the Free Software Foundation; either version 2.1
00007  *  of the License, or (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Lesser General Public License for more details.
00013  *
00014  *  $Id$
00015  */
00016 
00017 #ifndef LO_MACROS_H
00018 #define LO_MACROS_H
00019 
00020 /* macros that have to be defined after function signatures */
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 /* \brief Maximum length of UDP messages in bytes
00027  */
00028 #define LO_MAX_MSG_SIZE 32768
00029 
00030 /* \brief A set of macros to represent different communications transports
00031  */
00032 #define LO_DEFAULT 0x0
00033 #define LO_UDP     0x1
00034 #define LO_UNIX    0x2
00035 #define LO_TCP     0x4
00036 
00037 /* an internal value, ignored in transmission but check against LO_MARKER in the
00038  * argument list. Used to do primitive bounds checking */
00039 #define LO_MARKER_A 0xdeadbeef
00040 #define LO_MARKER_B 0xf00baa23
00041 #define LO_ARGS_END LO_MARKER_A, LO_MARKER_B
00042 
00043 #define lo_message_add_varargs(msg, types, list) \
00044     lo_message_add_varargs_internal(msg, types, list, __FILE__, __LINE__)
00045 
00046 #ifdef __GNUC__
00047 
00048 #define lo_message_add(msg, types...)                         \
00049     lo_message_add_internal(msg, __FILE__, __LINE__, types,   \
00050                             LO_MARKER_A, LO_MARKER_B)
00051 
00052 #define lo_send(targ, path, types...) \
00053         lo_send_internal(targ, __FILE__, __LINE__, path, types, \
00054              LO_MARKER_A, LO_MARKER_B)
00055 
00056 #define lo_send_timestamped(targ, ts, path, types...) \
00057         lo_send_timestamped_internal(targ, __FILE__, __LINE__, ts, path, \
00058                              types, LO_MARKER_A, LO_MARKER_B)
00059 
00060 #define lo_send_from(targ, from, ts, path, types...) \
00061         lo_send_from_internal(targ, from, __FILE__, __LINE__, ts, path, \
00062                              types, LO_MARKER_A, LO_MARKER_B)
00063 
00064 #else
00065 
00066 /* In non-GCC compilers, there is no support for variable-argument
00067  * macros, so provide "internal" vararg functions directly instead. */
00068 
00069 int lo_message_add(lo_message msg, const char *types, ...);
00070 int lo_send(lo_address targ, const char *path, const char *types, ...);
00071 int lo_send_timestamped(lo_address targ, lo_timetag ts, const char *path, const char *types, ...);
00072 int lo_send_from(lo_address targ, lo_server from, lo_timetag ts, const char *path, const char *types, ...);
00073 
00074 #endif
00075 
00076 #ifdef __cplusplus
00077 }
00078 #endif
00079 
00080 #endif

Generated on Sat Oct 17 14:12:32 2009 for CSL by  doxygen 1.4.5-20051010