Closed catfact closed 7 years ago
huh, turns out nesting vargs functions in C is non trivial: http://c-faq.com/varargs/handoff.html
internaly, liblo's vargs functions are wrappers around va_list (as they should be):
in lo_macros.h.in
:
#define lo_send(targ, path, types...) \
lo_send_internal(targ, __FILE__, __LINE__, path, types, \
LO_MARKER_A, LO_MARKER_B)
in send.c
:
int lo_send_internal(lo_address t, const char *file, const int line,
const char *path, const char *types, ...)
{
va_list ap;
va_start(ap, types);
return lo_send_varargs_internal(t, file, line, path, types, ap);
}
#if defined(USE_ANSI_C) || defined(DLL_EXPORT)
int lo_send(lo_address t, const char *path, const char *types, ...)
{
const char *file = "";
int line = 0;
va_list ap;
va_start(ap, types);
return lo_send_varargs_internal(t, file, line, path, types, ap);
}
#endif
so it seems fine to hack our own wrappers, no need to fork liblo or anything.
ech, actually no joy there: most everything in liblo that accepts a va_list
has static linkage; we can build a message but we can't do anything with it without access to liblo's opaque data structures. rather than hacking into those, i'd rather:
a) just fork liblo and make some light modifictions to wrap e.g. lo_send(...)
around vlo_send(va_list)
in the typical C manner
b) use the gnu extensions for explicitly building function calls: http://tigcc.ticalc.org/doc/gnuexts.html#SEC67
conclusion: nested varargs in C are nigh-impossible, but fortunately liblo gives us the abilility to dynamically construct a message and then pass it to the send
internals directly. the end.
3bbfeae8033c6e30d20dc91c574c1922b642045b
arbitrary engine commands
in matron:
oracle.c:
events.c
weaver.c:
and elsewhere: