Mercurial > hg > sv-dependency-builds
changeset 94:d278df1123f9
Add liblo
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Wed, 20 Mar 2013 15:25:02 +0000 |
parents | 5fcdb63f4cc6 |
children | 89f5e221ed7b |
files | src/liblo-0.26/libtool win32-mingw/include/lo/lo.h win32-mingw/include/lo/lo_endian.h win32-mingw/include/lo/lo_errors.h win32-mingw/include/lo/lo_lowlevel.h win32-mingw/include/lo/lo_macros.h win32-mingw/include/lo/lo_osc_types.h win32-mingw/include/lo/lo_throw.h win32-mingw/include/lo/lo_types.h win32-mingw/lib/liblo.a |
diffstat | 10 files changed, 1813 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/src/liblo-0.26/libtool Wed Mar 20 15:23:43 2013 +0000 +++ b/src/liblo-0.26/libtool Wed Mar 20 15:25:02 2013 +0000 @@ -1,8 +1,8 @@ -#! /bin/bash +#! /bin/sh # libtool - Provide generalized library-building support services. # Generated automatically by config.status (liblo) 0.26 -# Libtool was configured on host utilitypod: +# Libtool was configured on host mortadella: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, @@ -39,10 +39,10 @@ # ### BEGIN LIBTOOL CONFIG # Whether or not to build static libraries. -build_old_libs=no +build_old_libs=yes # Whether or not to build shared libraries. -build_libtool_libs=yes +build_libtool_libs=no # Which release of libtool.m4 was used? macro_version=2.2.4 @@ -55,32 +55,32 @@ fast_install=yes # The host system. -host_alias= -host=i686-pc-linux-gnu -host_os=linux-gnu +host_alias=i486-unknown-windows +host=i486-unknown-windows +host_os=windows # The build system. build_alias= -build=i686-pc-linux-gnu +build=x86_64-unknown-linux-gnu build_os=linux-gnu # A sed program that does not truncate output. -SED="/bin/sed" +SED="/usr/bin/sed" # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # A grep program that handles long lines. -GREP="/bin/grep" +GREP="/usr/bin/grep" # An ERE matcher. -EGREP="/bin/grep -E" +EGREP="/usr/bin/grep -E" # A literal string matcher. -FGREP="/bin/grep -F" +FGREP="/usr/bin/grep -F" # A BSD- or MS-compatible name lister. -NM="/usr/bin/nm -B" +NM="link -dump -symbols" # Whether we need soft or hard links. LN_S="ln -s" @@ -108,7 +108,7 @@ reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" # Method to check whether dependent libraries are shared objects. -deplibs_check_method="pass_all" +deplibs_check_method="unknown" # Command to use when deplibs_check_method == "file_magic". file_magic_cmd="\$MAGIC_CMD" @@ -126,28 +126,28 @@ old_postuninstall_cmds="" # A C compiler. -LTCC="gcc" +LTCC="i486-mingw32-gcc -I/work/sonic-visualiser/sv-dependency-builds/src/liblo-0.26/../../script/win32/../..//win32-mingw/include -L/work/sonic-visualiser/sv-dependency-builds/src/liblo-0.26/../../script/win32/../..//win32-mingw/lib" # LTCC compiler flags. -LTCFLAGS="-g -O2" +LTCFLAGS="-g -O2 -DWIN32 -D_WIN32_WINNT=0x501" # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'" +global_symbol_pipe="" # Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'" +global_symbol_to_cdecl="" # Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'" +global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'" # Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'" +global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'" # The name of the directory that contains temporary libtool files. objdir=.libs # Shell to use when invoking shell scripts. -SHELL="/bin/bash" +SHELL="/bin/sh" # An echo program that does not interpret backslashes. ECHO="echo" @@ -184,35 +184,35 @@ # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. -variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +variables_saved_for_relink="PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" # Do we need the "lib" prefix for modules? -need_lib_prefix=no +need_lib_prefix=unknown # Do we need a version for libraries? -need_version=no +need_version=unknown # Library versioning type. -version_type=linux +version_type=none # Shared library runtime path variable. runpath_var=LD_RUN_PATH # Shared library path variable. -shlibpath_var=LD_LIBRARY_PATH +shlibpath_var= # Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=no +shlibpath_overrides_runpath=unknown # Format of library name prefix. libname_spec="lib\$name" # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME -library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}" +library_names_spec="" # The coded name of the library, if different from the real name. -soname_spec="\${libname}\${release}\${shared_ext}\$major" +soname_spec="" # Command to use after installation of a shared archive. postinstall_cmds="" @@ -221,20 +221,20 @@ postuninstall_cmds="" # Commands used to finish a libtool library installation in a directory. -finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" +finish_cmds="" # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval="" # Whether we should hardcode library paths into libraries. -hardcode_into_libs=yes +hardcode_into_libs=no # Compile-time system search path for libraries. -sys_lib_search_path_spec="/usr/lib/gcc/i486-linux-gnu/4.3.2 /usr/lib /lib" +sys_lib_search_path_spec="/usr/lib/gcc/i486-mingw32/4.7.2 /usr/i486-mingw32/lib" # Run-time system search path for libraries. -sys_lib_dlsearch_path_spec="/lib /usr/lib /lib/i486-linux-gnu /usr/lib/i486-linux-gnu /usr/lib/R/lib /usr/lib/alsa-lib /usr/local/lib /home/sinclairs/.local/lib " +sys_lib_dlsearch_path_spec="/lib /usr/lib" # Whether dlopen is supported. dlopen_support=unknown @@ -251,13 +251,13 @@ # The linker used to build libraries. -LD="/usr/bin/ld" +LD="/usr/i486-mingw32/bin/ld" # Commands used to build an old-style archive. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib" # A language specific compiler. -CC="gcc" +CC="i486-mingw32-gcc -I/work/sonic-visualiser/sv-dependency-builds/src/liblo-0.26/../../script/win32/../..//win32-mingw/include -L/work/sonic-visualiser/sv-dependency-builds/src/liblo-0.26/../../script/win32/../..//win32-mingw/lib" # Is the compiler the GNU compiler? with_gcc=yes @@ -269,7 +269,7 @@ wl="-Wl," # Additional compiler flags for building library objects. -pic_flag=" -fPIC -DPIC" +pic_flag="" # Compiler flag to prevent dynamic linking. link_static_flag="-static" @@ -278,7 +278,7 @@ compiler_c_o="yes" # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=no +build_libtool_need_lc=yes # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=no @@ -300,10 +300,7 @@ # Commands used to build a shared archive. archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" -archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~ - cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~ - echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~ - \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" +archive_expsym_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib" # Commands used to build a loadable module if different from building # a shared archive.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/win32-mingw/include/lo/lo.h Wed Mar 20 15:25:02 2013 +0000 @@ -0,0 +1,353 @@ +/* + * Copyright (C) 2004 Steve Harris + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * $Id$ + */ + +#ifndef LO_H +#define LO_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file lo.h The liblo main headerfile and high-level API functions. + */ + +#include "lo/lo_endian.h" +#include "lo/lo_types.h" +#include "lo/lo_osc_types.h" +#include "lo/lo_errors.h" +#include "lo/lo_lowlevel.h" + +/** + * \defgroup liblo High-level OSC API + * + * Defines the high-level API functions necessary to implement OSC support. + * Should be adequate for most applications, but if you require lower level + * control you can use the functions defined in lo_lowlevel.h + * @{ + */ + +/** + * \brief Declare an OSC destination, given IP address and port number. + * Same as lo_address_new_with_proto(), but using UDP. + * + * \param host An IP address or number, or NULL for the local machine. + * \param port a decimal port number or service name. + * + * The lo_address object may be used as the target of OSC messages. + * + * Note: if you wish to receive replies from the target of this address, you + * must first create a lo_server_thread or lo_server object which will receive + * the replies. The last lo_server(_thread) object creted will be the receiver. + */ +lo_address lo_address_new(const char *host, const char *port); + +/** + * \brief Declare an OSC destination, given IP address and port number, + * specifying protocol. + * + * \param proto The protocol to use, must be one of LO_UDP, LO_TCP or LO_UNIX. + * \param host An IP address or number, or NULL for the local machine. + * \param port a decimal port number or service name. + * + * The lo_address object may be used as the target of OSC messages. + * + * Note: if you wish to receive replies from the target of this address, you + * must first create a lo_server_thread or lo_server object which will receive + * the replies. The last lo_server(_thread) object creted will be the receiver. + */ +lo_address lo_address_new_with_proto(int proto, const char *host, const char *port); + +/** + * \brief Create a lo_address object from an OSC URL. + * + * example: \c "osc.udp://localhost:4444/my/path/" + */ +lo_address lo_address_new_from_url(const char *url); + +/** + * \brief Free the memory used by the lo_address object + */ +void lo_address_free(lo_address t); + +/** + * \brief Set the Time-to-Live value for a given target address. + * + * This is required for sending multicast UDP messages. A value of 1 + * (the usual case) keeps the message within the subnet, while 255 + * means a global, unrestricted scope. + * + * \param t An OSC address. + * \param ttl An integer specifying the scope of a multicast UDP message. + */ +void lo_address_set_ttl(lo_address t, int ttl); + +/** + * \brief Get the Time-to-Live value for a given target address. + * + * \param t An OSC address. + * \return An integer specifying the scope of a multicast UDP message. + */ +int lo_address_get_ttl(lo_address t); + +/** + * \brief Send a OSC formatted message to the address specified. + * + * \param targ The target OSC address + * \param path The OSC path the message will be delivered to + * \param type The types of the data items in the message, types are defined in + * lo_osc_types.h + * \param ... The data values to be transmitted. The types of the arguments + * passed here must agree with the types specified in the type parameter. + * + * example: + * \code + * lo_send(t, "/foo/bar", "ff", 0.1f, 23.0f); + * \endcode + * + * \return -1 on failure. + */ +int lo_send(lo_address targ, const char *path, const char *type, ...); + +/** + * \brief Send a OSC formatted message to the address specified, + * from the same socket as the specificied server. + * + * \param targ The target OSC address + * \param from The server to send message from (can be NULL to use new socket) + * \param ts The OSC timetag timestamp at which the message will be processed + * (can be LO_TT_IMMEDIATE if you don't want to attach a timetag) + * \param path The OSC path the message will be delivered to + * \param type The types of the data items in the message, types are defined in + * lo_osc_types.h + * \param ... The data values to be transmitted. The types of the arguments + * passed here must agree with the types specified in the type parameter. + * + * example: + * \code + * serv = lo_server_new(NULL, err); + * lo_server_add_method(serv, "/reply", "ss", reply_handler, NULL); + * lo_send_from(t, serv, LO_TT_IMMEDIATE, "/foo/bar", "ff", 0.1f, 23.0f); + * \endcode + * + * \return on success, the number of bytes sent, or -1 on failure. + */ +int lo_send_from(lo_address targ, lo_server from, lo_timetag ts, + const char *path, const char *type, ...); + +/** + * \brief Send a OSC formatted message to the address specified, scheduled to + * be dispatch at some time in the future. + * + * \param targ The target OSC address + * \param ts The OSC timetag timestamp at which the message will be processed + * \param path The OSC path the message will be delivered to + * \param type The types of the data items in the message, types are defined in + * lo_osc_types.h + * \param ... The data values to be transmitted. The types of the arguments + * passed here must agree with the types specified in the type parameter. + * + * example: + * \code + * lo_timetag now;<br> + * lo_timetag_now(&now);<br> + * lo_send_timestamped(t, now, "/foo/bar", "ff", 0.1f, 23.0f); + * \endcode + * + * \return on success, the number of bytes sent, or -1 on failure. + */ +int lo_send_timestamped(lo_address targ, lo_timetag ts, const char *path, + const char *type, ...); + +/** + * \brief Return the error number from the last failed lo_send() or + * lo_address_new() call + */ +int lo_address_errno(lo_address a); + +/** + * \brief Return the error string from the last failed lo_send() or + * lo_address_new() call + */ +const char *lo_address_errstr(lo_address a); + +/** + * \brief Create a new server thread to handle incoming OSC + * messages. + * + * Server threads take care of the message reception and dispatch by + * transparently creating a system thread to handle incoming messages. + * Use this if you do not want to handle the threading yourself. + * + * \param port If NULL is passed then an unused port will be chosen by the + * system, its number may be retrieved with lo_server_thread_get_port() + * so it can be passed to clients. Otherwise a decimal port number, service + * name or UNIX domain socket path may be passed. + * \param err_h A function that will be called in the event of an error being + * raised. The function prototype is defined in lo_types.h + */ +lo_server_thread lo_server_thread_new(const char *port, lo_err_handler err_h); + +/** + * \brief Create a new server thread to handle incoming OSC + * messages, and join a UDP multicast group. + * + * Server threads take care of the message reception and dispatch by + * transparently creating a system thread to handle incoming messages. + * Use this if you do not want to handle the threading yourself. + * + * \param group The multicast group to join. See documentation on IP + * multicast for the acceptable address range; e.g., http://tldp.org/HOWTO/Multicast-HOWTO-2.html + * \param port If NULL is passed then an unused port will be chosen by the + * system, its number may be retrieved with lo_server_thread_get_port() + * so it can be passed to clients. Otherwise a decimal port number, service + * name or UNIX domain socket path may be passed. + * \param err_h A function that will be called in the event of an error being + * raised. The function prototype is defined in lo_types.h + */ +lo_server_thread lo_server_thread_new_multicast(const char *group, const char *port, + lo_err_handler err_h); + +/** + * \brief Create a new server thread to handle incoming OSC + * messages, specifying protocol. + * + * Server threads take care of the message reception and dispatch by + * transparently creating a system thread to handle incoming messages. + * Use this if you do not want to handle the threading yourself. + * + * \param port If NULL is passed then an unused port will be chosen by the + * system, its number may be retrieved with lo_server_thread_get_port() + * so it can be passed to clients. Otherwise a decimal port number, service + * name or UNIX domain socket path may be passed. + * \param proto The protocol to use, should be one of LO_UDP, LO_TCP or LO_UNIX. + * \param err_h A function that will be called in the event of an error being + * raised. The function prototype is defined in lo_types.h + */ +lo_server_thread lo_server_thread_new_with_proto(const char *port, int proto, + lo_err_handler err_h); + +/** + * \brief Free memory taken by a server thread + * + * Frees the memory, and, if currently running will stop the associated thread. + */ +void lo_server_thread_free(lo_server_thread st); + +/** + * \brief Add an OSC method to the specifed server thread. + * + * \param st The server thread the method is to be added to. + * \param path The OSC path to register the method to. If NULL is passed the + * method will match all paths. + * \param typespec The typespec the method accepts. Incoming messages with + * similar typespecs (e.g. ones with numerical types in the same position) will + * be coerced to the typespec given here. + * \param h The method handler callback function that will be called it a + * matching message is received + * \param user_data A value that will be passed to the callback function, h, + * when its invoked matching from this method. + */ +lo_method lo_server_thread_add_method(lo_server_thread st, const char *path, + const char *typespec, lo_method_handler h, + void *user_data); +/** + * \brief Delete an OSC method from the specifed server thread. + * + * \param st The server thread the method is to be removed from. + * \param path The OSC path of the method to delete. If NULL is passed the + * method will match the generic handler. + * \param typespec The typespec the method accepts. + */ +void lo_server_thread_del_method(lo_server_thread st, const char *path, + const char *typespec); + +/** + * \brief Start the server thread + * + * \param st the server thread to start. + * \return Less than 0 on failure, 0 on success. + */ +int lo_server_thread_start(lo_server_thread st); + +/** + * \brief Stop the server thread + * + * \param st the server thread to start. + * \return Less than 0 on failure, 0 on success. + */ +int lo_server_thread_stop(lo_server_thread st); + +/** + * \brief Return the port number that the server thread has bound to. + */ +int lo_server_thread_get_port(lo_server_thread st); + +/** + * \brief Return a URL describing the address of the server thread. + * + * Return value must be free()'d to reclaim memory. + */ +char *lo_server_thread_get_url(lo_server_thread st); + +/** + * \brief Return the lo_server for a lo_server_thread + * + * This function is useful for passing a thread's lo_server + * to lo_send_from(). + */ +lo_server lo_server_thread_get_server(lo_server_thread st); + +/** \brief Return true if there are scheduled events (eg. from bundles) waiting + * to be dispatched by the thread */ +int lo_server_thread_events_pending(lo_server_thread st); + +/** + * \brief Create a new OSC blob type. + * + * \param size The amount of space to allocate in the blob structure. + * \param data The data that will be used to initialise the blob, should be + * size bytes long. + */ +lo_blob lo_blob_new(int32_t size, const void *data); + +/** + * \brief Free the memory taken by a blob + */ +void lo_blob_free(lo_blob b); + +/** + * \brief Return the amount of valid data in a lo_blob object. + * + * If you want to know the storage size, use lo_arg_size(). + */ +uint32_t lo_blob_datasize(lo_blob b); + +/** + * \brief Return a pointer to the start of the blob data to allow contents to + * be changed. + */ +void *lo_blob_dataptr(lo_blob b); + +/** @} */ + +#include "lo/lo_macros.h" + +#ifdef __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/win32-mingw/include/lo/lo_endian.h Wed Mar 20 15:25:02 2013 +0000 @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2004 Steve Harris + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * $Id$ + */ + +#ifndef LO_ENDIAN_H +#define LO_ENDIAN_H + +#include <sys/types.h> +#include <stdint.h> + +#ifdef WIN32 +#include <winsock2.h> +#include <ws2tcpip.h> +#else +#include <netinet/in.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define lo_swap16(x) htons(x) + +#define lo_swap32(x) htonl(x) + +/* These macros come from the Linux kernel */ + +#ifndef lo_swap16 +#define lo_swap16(x) \ +({ \ + uint16_t __x = (x); \ + ((uint16_t)( \ + (((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \ + (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \ +}) +#warning USING UNOPTIMISED ENDIAN STUFF +#endif + +#ifndef lo_swap32 +#define lo_swap32(x) \ +({ \ + uint32_t __x = (x); \ + ((uint32_t)( \ + (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ + (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ + (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ + (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \ +}) +#endif + +#if 0 +#ifndef lo_swap64 +#define lo_swap64(x) \ +({ \ + uint64_t __x = (x); \ + ((uint64_t)( \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \ +}) +#endif +#else + +typedef union { + uint64_t all; + struct { + uint32_t a; + uint32_t b; + } part; +} lo_split64; + +static inline uint64_t lo_swap64(uint64_t x) +{ + lo_split64 in, out; + + in.all = x; + out.part.a = lo_swap32(in.part.b); + out.part.b = lo_swap32(in.part.a); + + return out.all; +} +#endif + +/* Host to OSC and OSC to Host conversion macros */ + +#if 0 +#define lo_htoo16(x) (x) +#define lo_htoo32(x) (x) +#define lo_htoo64(x) (x) +#define lo_otoh16(x) (x) +#define lo_otoh32(x) (x) +#define lo_otoh64(x) (x) +#else +#define lo_htoo16 lo_swap16 +#define lo_htoo32 lo_swap32 +#define lo_htoo64 lo_swap64 +#define lo_otoh16 lo_swap16 +#define lo_otoh32 lo_swap32 +#define lo_otoh64 lo_swap64 +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/* vi:set ts=8 sts=4 sw=4: */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/win32-mingw/include/lo/lo_errors.h Wed Mar 20 15:25:02 2013 +0000 @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2004 Steve Harris + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * $Id$ + */ + +#ifndef LO_ERRORS_H +#define LO_ERRORS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define LO_ENOPATH 9901 +#define LO_ENOTYPE 9902 +#define LO_UNKNOWNPROTO 9903 +#define LO_NOPORT 9904 +#define LO_TOOBIG 9905 +#define LO_INT_ERR 9906 +#define LO_EALLOC 9907 +#define LO_EINVALIDPATH 9908 +#define LO_EINVALIDTYPE 9909 +#define LO_EBADTYPE 9910 +#define LO_ESIZE 9911 +#define LO_EINVALIDARG 9912 +#define LO_ETERM 9913 +#define LO_EPAD 9914 +#define LO_EINVALIDBUND 9915 +#define LO_EINVALIDTIME 9916 + +#ifdef __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/win32-mingw/include/lo/lo_lowlevel.h Wed Mar 20 15:25:02 2013 +0000 @@ -0,0 +1,860 @@ +/* + * Copyright (C) 2004 Steve Harris + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * $Id$ + */ + +#ifndef LO_LOWLEVEL_H +#define LO_LOWLEVEL_H + +#include "lo/lo_osc_types.h" + +/** + * \file lo_lowlevel.h The liblo headerfile defining the low-level API + * functions. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdarg.h> +#ifdef _MSC_VER +#define ssize_t SSIZE_T +#define uint32_t unsigned __int32 +#else +#include <stdint.h> +#endif + +#include "lo/lo_types.h" +#include "lo/lo_errors.h" + +/** + * \defgroup liblolowlevel Low-level OSC API + * + * Use these functions if you require more precise control over OSC message + * contruction or handling that what is provided in the high-level functions + * described in liblo. + * @{ + */ + +/** + * \brief Type used to represent numerical values in conversions between OSC + * types. + */ +typedef long double lo_hires; + + + + +/** + * \brief Send a lo_message object to target targ + * + * This is slightly more efficient than lo_send() if you want to send a lot of + * similar messages. The messages are constructed with the lo_message_new() and + * \ref lo_message_add_int32 "lo_message_add*()" functions. + */ +int lo_send_message(lo_address targ, const char *path, lo_message msg); + +/** + * \brief Send a lo_message object to target targ from address of serv + * + * This is slightly more efficient than lo_send() if you want to send a lot of + * similar messages. The messages are constructed with the lo_message_new() and + * \ref lo_message_add_int32 "lo_message_add*()" functions. + * + * \param targ The address to send the message to + * \param serv The server socket to send the message from + * (can be NULL to use new socket) + * \param path The path to send the message to + * \param msg The bundle itself + */ +int lo_send_message_from(lo_address targ, lo_server serv, + const char *path, lo_message msg); + +/** + * \brief Send a lo_bundle object to address targ + * + * Bundles are constructed with the + * lo_bundle_new() and lo_bundle_add_message() functions. + */ +int lo_send_bundle(lo_address targ, lo_bundle b); + +/** + * \brief Send a lo_bundle object to address targ from address of serv + * + * Bundles are constructed with the + * lo_bundle_new() and lo_bundle_add_message() functions. + * + * \param targ The address to send the bundle to + * \param serv The server socket to send the bundle from + * (can be NULL to use new socket) + * \param b The bundle itself + */ +int lo_send_bundle_from(lo_address targ, lo_server serv, lo_bundle b); + +/** + * \brief Create a new lo_message object + */ +lo_message lo_message_new(); + +/** + * \brief Free memory allocated by lo_message_new() and any subsequent + * \ref lo_message_add_int32 lo_message_add*() calls. + */ +void lo_message_free(lo_message m); + +/** + * \brief Append a number of arguments to a message. + * + * The data will be added in OSC byteorder (bigendian). + * + * \param m The message to be extended. + * \param types The types of the data items in the message, types are defined in + * lo_types_common.h + * \param ... The data values to be transmitted. The types of the arguments + * passed here must agree with the types specified in the type parameter. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add(lo_message m, const char *types, ...); + +/** \internal \brief the real message_add function (don't call directly) */ +int lo_message_add_internal(lo_message m, const char *file, const int line, + const char *types, ...); + +/** + * \brief Append a varargs list to a message. + * + * The data will be added in OSC byteorder (bigendian). + * IMPORTANT: args list must be terminated with LO_ARGS_END, or this call will + * fail. This is used to do simple error checking on the sizes of parameters + * passed. + * + * \param m The message to be extended. + * \param types The types of the data items in the message, types are defined in + * lo_types_common.h + * \param ap The va_list created by a C function declared with an + * ellipsis (...) argument, and pre-initialised with + * "va_start(ap)". The types of the arguments passed here must agree + * with the types specified in the type parameter. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_varargs(lo_message m, const char *types, va_list ap); + +/** \internal \brief the real message_add_varargs function (don't call directly) */ +int lo_message_add_varargs_internal(lo_message m, const char *types, va_list ap, + const char *file, const int line); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * + * The data will be added in OSC byteorder (bigendian). + * + * \param m The message to be extended. + * \param a The data item. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_int32(lo_message m, int32_t a); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * See lo_message_add_int32() for details. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_float(lo_message m, float a); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * See lo_message_add_int32() for details. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_string(lo_message m, const char *a); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * See lo_message_add_int32() for details. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_blob(lo_message m, lo_blob a); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * See lo_message_add_int32() for details. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_int64(lo_message m, int64_t a); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * See lo_message_add_int32() for details. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_timetag(lo_message m, lo_timetag a); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * See lo_message_add_int32() for details. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_double(lo_message m, double a); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * See lo_message_add_int32() for details. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_symbol(lo_message m, const char *a); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * See lo_message_add_int32() for details. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_char(lo_message m, char a); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * See lo_message_add_int32() for details. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_midi(lo_message m, uint8_t a[4]); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * See lo_message_add_int32() for details. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_true(lo_message m); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * See lo_message_add_int32() for details. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_false(lo_message m); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * See lo_message_add_int32() for details. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_nil(lo_message m); + +/** + * \brief Append a data item and typechar of the specified type to a message. + * See lo_message_add_int32() for details. + * + * \return Less than 0 on failure, 0 on success. + */ +int lo_message_add_infinitum(lo_message m); + +/** + * \brief Returns the source (lo_address) of an incoming message. + * + * Returns NULL if the message is outgoing. Do not free the returned address. + */ +lo_address lo_message_get_source(lo_message m); + +/** + * \brief Returns the timestamp (lo_timetag *) of a bundled incoming message. + * + * Returns LO_TT_IMMEDIATE if the message is outgoing, or did not arrive + * contained in a bundle. Do not free the returned timetag. + */ +lo_timetag lo_message_get_timestamp(lo_message m); + +/** + * \brief Return the message type tag string. + * + * The result is valid until further data is added with lo_message_add*(). + */ +char *lo_message_get_types(lo_message m); + +/** + * \brief Return the message argument count. + * + * The result is valid until further data is added with lo_message_add*(). + */ +int lo_message_get_argc(lo_message m); + +/** + * \brief Return the message arguments. Do not free the returned data. + * + * The result is valid until further data is added with lo_message_add*(). + */ +lo_arg **lo_message_get_argv(lo_message m); + +/** + * \brief Return the length of a message in bytes. + * + * \param m The message to be sized + * \param path The path the message will be sent to + */ +size_t lo_message_length(lo_message m, const char *path); + +/** + * \brief Serialise the lo_message object to an area of memory and return a + * pointer to the serialised form. Opposite of lo_message_deserialise(). + * + * \param m The message to be serialised + * \param path The path the message will be sent to + * \param to The address to serialise to, memory will be allocated if to is + * NULL. + * \param size If this pointer is non-NULL the size of the memory area + * will be written here + * + * The returned form is suitable to be sent over a low level OSC transport, + * having the correct endianess and bit-packed structure. + */ +void *lo_message_serialise(lo_message m, const char *path, void *to, + size_t *size); + +/** + * \brief Deserialise a raw OSC message and return a new lo_message object. + * Opposite of lo_message_serialise(). + * + * \param data Pointer to the raw OSC message data in network transmission form + * (network byte order where appropriate). + * \param size The size of data in bytes + * \param result If this pointer is non-NULL, the result or error code will + * be written here. + * + * Returns a new lo_message, or NULL if deserialisation fails. + * Use lo_message_free() to free the resulting object. + */ +lo_message lo_message_deserialise(void *data, size_t size, int *result); + +/** + * \brief Dispatch a raw block of memory containing an OSC message. + * + * This is useful when a raw block of memory is available that is + * structured as OSC, and you wish to use liblo to dispatch the + * message to a handler function as if it had been received over the + * network. + * + * \param s The lo_server to use for dispatching. + * \param data Pointer to the raw OSC message data in network transmission form + * (network byte order where appropriate). + * \param size The size of data in bytes + * + * Returns the number of bytes used if successful, or less than 0 otherwise. + */ +int lo_server_dispatch_data(lo_server s, void *data, size_t size); + +/** + * \brief Return the hostname of a lo_address object + * + * Returned value must not be modified or free'd. Value will be a dotted quad, + * colon'd IPV6 address, or resolvable name. + */ +const char *lo_address_get_hostname(lo_address a); + +/** + * \brief Return the port/service name of a lo_address object + * + * Returned value must not be modified or free'd. Value will be a service name + * or ASCII representation of the port number. + */ +const char *lo_address_get_port(lo_address a); + +/** + * \brief Return the protocol of a lo_address object + * + * Returned value will be one of LO_UDP, LO_TCP or LO_UNIX. + */ +int lo_address_get_protocol(lo_address a); + +/** + * \brief Return a URL representing an OSC address + * + * Returned value must be free'd. + */ +char *lo_address_get_url(lo_address a); + +/** + * \brief Set the Time-to-Live value for a given target address. + * + * This is required for sending multicast UDP messages. A value of 1 + * (the usual case) keeps the message within the subnet, while 255 + * means a global, unrestricted scope. + * + * \param t An OSC address. + * \param ttl An integer specifying the scope of a multicast UDP message. + */ +void lo_address_set_ttl(lo_address t, int ttl); + +/** + * \brief Get the Time-to-Live value for a given target address. + * + * \param t An OSC address. + * \return An integer specifying the scope of a multicast UDP message. + */ +int lo_address_get_ttl(lo_address t); + +/** + * \brief Create a new bundle object. + * + * OSC Bundles encapsulate one or more OSC messages and may include a timestamp + * indicating when the bundle should be dispatched. + * + * \param tt The timestamp when the bundle should be handled by the receiver. + * Pass LO_TT_IMMEDIATE if you want the receiving server to dispatch + * the bundle as soon as it receives it. + */ +lo_bundle lo_bundle_new(lo_timetag tt); + +/** + * \brief Adds an OSC message to an existing bundle. + * + * The message passed is appended to the list of messages in the bundle to be + * dispatched to 'path'. + * + * \return 0 if successful, less than 0 otherwise. + */ +int lo_bundle_add_message(lo_bundle b, const char *path, lo_message m); + +/** + * \brief Return the length of a bundle in bytes. + * + * Includes the marker and typetage length. + * + * \param b The bundle to be sized + */ +size_t lo_bundle_length(lo_bundle b); + +/** + * \brief Serialise the bundle object to an area of memory and return a + * pointer to the serialised form. + * + * \param b The bundle to be serialised + * \param to The address to serialise to, memory will be allocated if to is + * NULL. + * \param size If this pointer is non-NULL the size of the memory area + * will be written here + * + * The returned form is suitable to be sent over a low level OSC transport, + * having the correct endianess and bit-packed structure. + */ +void *lo_bundle_serialise(lo_bundle b, void *to, size_t *size); + +/** + * \brief Frees the memory taken by a bundle object. + * + * \param b The bundle to be freed. +*/ +void lo_bundle_free(lo_bundle b); + +/** + * \brief Frees the memory taken by a bundle object and messages in the bundle. + * + * \param b The bundle, which may contain messages, to be freed. +*/ +void lo_bundle_free_messages(lo_bundle b); + +/** + * \brief Return true if the type specified has a numerical value, such as + * LO_INT32, LO_FLOAT etc. + * + * \param a The type to be tested. + */ +int lo_is_numerical_type(lo_type a); + +/** + * \brief Return true if the type specified has a textual value, such as + * LO_STRING or LO_SYMBOL. + * + * \param a The type to be tested. + */ +int lo_is_string_type(lo_type a); + +/** + * \brief Attempt to convert one OSC type to another. + * + * Numerical types (eg LO_INT32, LO_FLOAT etc.) may be converted to other + * numerical types and string types (LO_STRING and LO_SYMBOL) may be converted + * to the other type. This is done automatically if a received message matches + * the path, but not the exact types, and is coercible (ie. all numerical + * types in numerical positions). + * + * On failure no translation occurs and false is returned. + * + * \param type_to The type of the destination variable. + * \param to A pointer to the destination variable. + * \param type_from The type of the source variable. + * \param from A pointer to the source variable. + */ +int lo_coerce(lo_type type_to, lo_arg *to, lo_type type_from, lo_arg *from); + +/** + * \brief Return the numerical value of the given argument with the + * maximum native system precision. + */ +lo_hires lo_hires_val(lo_type type, lo_arg *p); + +/** + * \brief Create a new server instance. + * + * Using lo_server_recv(), lo_servers block until they receive OSC + * messages. If you want non-blocking behaviour see + * lo_server_recv_noblock() or the \ref lo_server_thread_new + * "lo_server_thread_*" functions. + * + * \param port If NULL is passed then an unused UDP port will be chosen by the + * system, its number may be retrieved with lo_server_thread_get_port() + * so it can be passed to clients. Otherwise a decimal port number, service + * name or UNIX domain socket path may be passed. + * \param err_h An error callback function that will be called if there is an + * error in messge reception or server creation. Pass NULL if you do not want + * error handling. + */ +lo_server lo_server_new(const char *port, lo_err_handler err_h); + +/** + * \brief Create a new server instance, specifying protocol. + * + * Using lo_server_recv(), lo_servers block until they receive OSC + * messages. If you want non-blocking behaviour see + * lo_server_recv_noblock() or the \ref lo_server_thread_new + * "lo_server_thread_*" functions. + * + * \param port If using UDP then NULL may be passed to find an unused port. + * Otherwise a decimal port number orservice name or may be passed. + * If using UNIX domain sockets then a socket path should be passed here. + * \param proto The protocol to use, should be one of LO_UDP, LO_TCP or LO_UNIX. + * \param err_h An error callback function that will be called if there is an + * error in messge reception or server creation. Pass NULL if you do not want + * error handling. + */ +lo_server lo_server_new_with_proto(const char *port, int proto, + lo_err_handler err_h); + +/** + * \brief Create a new server instance, and join a UDP multicast group. + * + * \param group The multicast group to join. See documentation on IP + * multicast for the acceptable address range; e.g., http://tldp.org/HOWTO/Multicast-HOWTO-2.html + * \param port If using UDP then NULL may be passed to find an unused port. + * Otherwise a decimal port number or service name or may be passed. + * If using UNIX domain sockets then a socket path should be passed here. + * \param err_h An error callback function that will be called if there is an + * error in messge reception or server creation. Pass NULL if you do not want + * error handling. + */ +lo_server lo_server_new_multicast(const char *group, const char *port, + lo_err_handler err_h); + +/** + * \brief Free up memory used by the lo_server object + */ +void lo_server_free(lo_server s); + +/** + * \brief Wait for an OSC message to be received + * + * \param s The server to wait for connections on. + * \param timeout A timeout in milliseconds to wait for the incoming packet. + * a value of 0 will return immediately. + * + * The return value is 1 if there is a message waiting or 0 if + * there is no message. If there is a message waiting you can now + * call lo_server_recv() to receive that message. + */ +int lo_server_wait(lo_server s, int timeout); + +/** + * \brief Look for an OSC message waiting to be received + * + * \param s The server to wait for connections on. + * \param timeout A timeout in milliseconds to wait for the incoming packet. + * a value of 0 will return immediately. + * + * The return value is the number of bytes in the received message or 0 if + * there is no message. The message will be dispatched to a matching method + * if one is found. + */ +int lo_server_recv_noblock(lo_server s, int timeout); + +/** + * \brief Block, waiting for an OSC message to be received + * + * The return value is the number of bytes in the received message. The message + * will be dispatched to a matching method if one is found. + */ +int lo_server_recv(lo_server s); + +/** + * \brief Add an OSC method to the specifed server. + * + * \param s The server the method is to be added to. + * \param path The OSC path to register the method to. If NULL is passed the + * method will match all paths. + * \param typespec The typespec the method accepts. Incoming messages with + * similar typespecs (e.g. ones with numerical types in the same position) will + * be coerced to the typespec given here. + * \param h The method handler callback function that will be called if a + * matching message is received + * \param user_data A value that will be passed to the callback function, h, + * when its invoked matching from this method. + */ +lo_method lo_server_add_method(lo_server s, const char *path, + const char *typespec, lo_method_handler h, + void *user_data); + +/** + * \brief Delete an OSC method from the specifed server. + * + * \param s The server the method is to be removed from. + * \param path The OSC path of the method to delete. If NULL is passed the + * method will match the generic handler. + * \param typespec The typespec the method accepts. + */ +void lo_server_del_method(lo_server s, const char *path, + const char *typespec); + +/** + * \brief Return the file descriptor of the server socket. + * + * If the server protocol supports exposing the server's underlying + * receive mechanism for monitoring with select() or poll(), this function + * returns the file descriptor needed, otherwise, it returns -1. + * + * WARNING: when using this function beware that not all OSC packets that are + * received are dispatched immediately. lo_server_events_pending() and + * lo_server_next_event_delay() can be used to tell if there are pending + * events and how long before you should attempt to receive them. + */ +int lo_server_get_socket_fd(lo_server s); + +/** + * \brief Return the port number that the server has bound to. + * + * Useful when NULL is passed for the port number and you wish to know how to + * address the server. + */ +int lo_server_get_port(lo_server s); + +/** + * \brief Return the protocol that the server is using. + * + * Returned value will be one of LO_UDP, LO_TCP or LO_UNIX. + */ +int lo_server_get_protocol(lo_server s); + +/** + * \brief Return an OSC URL that can be used to contact the server. + * + * The return value should be free()'d when it is no longer needed. + */ +char *lo_server_get_url(lo_server s); + +/** + * \brief Return true if there are scheduled events (eg. from bundles) + * waiting to be dispatched by the server + */ +int lo_server_events_pending(lo_server s); + +/** + * \brief Return the time in seconds until the next scheduled event. + * + * If the delay is greater than 100 seconds then it will return 100.0. + */ +double lo_server_next_event_delay(lo_server s); + +/** + * \brief Return the protocol portion of an OSC URL, eg. udp, tcp. + * + * This library uses OSC URLs of the form: osc.prot://hostname:port/path if the + * prot part is missing, UDP is assumed. + * + * The return value should be free()'d when it is no longer needed. + */ +char *lo_url_get_protocol(const char *url); + +/** + * \brief Return the protocol ID of an OSC URL. + * + * This library uses OSC URLs of the form: osc.prot://hostname:port/path if the + * prot part is missing, UDP is assumed. + * Returned value will be one of LO_UDP, LO_TCP, LO_UNIX or -1. + * + * \return An integer specifying the protocol. Return -1 when the protocol is + * not supported by liblo. + * + */ +int lo_url_get_protocol_id(const char *url); + +/** + * \brief Return the hostname portion of an OSC URL. + * + * The return value should be free()'d when it is no longer needed. + */ +char *lo_url_get_hostname(const char *url); + +/** + * \brief Return the port portion of an OSC URL. + * + * The return value should be free()'d when it is no longer needed. + */ +char *lo_url_get_port(const char *url); + +/** + * \brief Return the path portion of an OSC URL. + * + * The return value should be free()'d when it is no longer needed. + */ +char *lo_url_get_path(const char *url); + +/* utility functions */ + +/** + * \brief A function to calculate the amount of OSC message space required by a + * C char *. + * + * Returns the storage size in bytes, which will always be a multiple of four. + */ +int lo_strsize(const char *s); + +/** + * \brief A function to calculate the amount of OSC message space required by a + * lo_blob object. + * + * Returns the storage size in bytes, which will always be a multiple of four. + */ +uint32_t lo_blobsize(lo_blob b); + +/** + * \brief Test a string against an OSC pattern glob + * + * \param str The string to test + * \param p The pattern to test against + */ +int lo_pattern_match(const char *str, const char *p); + +/** \internal \brief the real send function (don't call directly) */ +int lo_send_internal(lo_address t, const char *file, const int line, + const char *path, const char *types, ...); +/** \internal \brief the real send_timestamped function (don't call directly) */ +int lo_send_timestamped_internal(lo_address t, const char *file, const int line, + lo_timetag ts, const char *path, const char *types, ...); +/** \internal \brief the real lo_send_from() function (don't call directly) */ +int lo_send_from_internal(lo_address targ, lo_server from, const char *file, + const int line, const lo_timetag ts, + const char *path, const char *types, ...); + + +/** \brief Find the time difference between two timetags + * + * Returns a - b in seconds. + */ +double lo_timetag_diff(lo_timetag a, lo_timetag b); + +/** \brief Return a timetag for the current time + * + * On exit the timetag pointed to by t is filled with the OSC + * representation of this instant in time. + */ +void lo_timetag_now(lo_timetag *t); + +/** + * \brief Return the storage size, in bytes, of the given argument. + */ +size_t lo_arg_size(lo_type type, void *data); + +/** + * \brief Given a raw OSC message, return the message path. + * + * \param data A pointer to the raw OSC message data. + * \param size The size of data in bytes (total buffer bytes). + * + * Returns the message path or NULL if an error occurs. + * Do not free() the returned pointer. + */ +char *lo_get_path(void *data, ssize_t size); + +/** + * \brief Convert the specified argument to host byte order where necessary. + * + * \param type The OSC type of the data item (eg. LO_FLOAT). + * \param data A pointer to the data item to be converted. It is changed + * in-place. + */ +void lo_arg_host_endian(lo_type type, void *data); + +/** + * \brief Convert the specified argument to network byte order where necessary. + * + * \param type The OSC type of the data item (eg. LO_FLOAT). + * \param data A pointer to the data item to be converted. It is changed + * in-place. + */ +void lo_arg_network_endian(lo_type type, void *data); + +/** @} */ + +/* prettyprinters */ + +/** + * \defgroup pp Prettyprinting functions + * + * These functions all print an ASCII representation of their argument to + * stdout. Useful for debugging. + * @{ + */ + +/** \brief Pretty-print a lo_bundle object. */ +void lo_bundle_pp(lo_bundle b); + +/** \brief Pretty-print a lo_message object. */ +void lo_message_pp(lo_message m); + +/** \brief Pretty-print a set of typed arguments. + * \param type A type string in the form provided to lo_send(). + * \param data An OSC data pointer, like that provided in the + * lo_method_handler. + */ +void lo_arg_pp(lo_type type, void *data); + +/** \brief Pretty-print a lo_server object. */ +void lo_server_pp(lo_server s); + +/** \brief Pretty-print a lo_method object. */ +void lo_method_pp(lo_method m); + +/** \brief Pretty-print a lo_method object, but prepend a given prefix + * to all field names. */ +void lo_method_pp_prefix(lo_method m, const char *p); + +/** \brief Pretty-print a lo_server_thread object. */ +void lo_server_thread_pp(lo_server_thread st); +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/win32-mingw/include/lo/lo_macros.h Wed Mar 20 15:25:02 2013 +0000 @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2004 Steve Harris + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * $Id$ + */ + +#ifndef LO_MACROS_H +#define LO_MACROS_H + +/* macros that have to be defined after function signatures */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* \brief Maximum length of UDP messages in bytes + */ +#define LO_MAX_MSG_SIZE 32768 + +/* \brief A set of macros to represent different communications transports + */ +#define LO_DEFAULT 0x0 +#define LO_UDP 0x1 +#define LO_UNIX 0x2 +#define LO_TCP 0x4 + +/* an internal value, ignored in transmission but check against LO_MARKER in the + * argument list. Used to do primitive bounds checking */ +#define LO_MARKER_A 0xdeadbeef +#define LO_MARKER_B 0xf00baa23 +#define LO_ARGS_END LO_MARKER_A, LO_MARKER_B + +#define lo_message_add_varargs(msg, types, list) \ + lo_message_add_varargs_internal(msg, types, list, __FILE__, __LINE__) + +#ifdef __GNUC__ + +#define lo_message_add(msg, types...) \ + lo_message_add_internal(msg, __FILE__, __LINE__, types, \ + LO_MARKER_A, LO_MARKER_B) + +#define lo_send(targ, path, types...) \ + lo_send_internal(targ, __FILE__, __LINE__, path, types, \ + LO_MARKER_A, LO_MARKER_B) + +#define lo_send_timestamped(targ, ts, path, types...) \ + lo_send_timestamped_internal(targ, __FILE__, __LINE__, ts, path, \ + types, LO_MARKER_A, LO_MARKER_B) + +#define lo_send_from(targ, from, ts, path, types...) \ + lo_send_from_internal(targ, from, __FILE__, __LINE__, ts, path, \ + types, LO_MARKER_A, LO_MARKER_B) + +#else + +/* In non-GCC compilers, there is no support for variable-argument + * macros, so provide "internal" vararg functions directly instead. */ + +int lo_message_add(lo_message msg, const char *types, ...); +int lo_send(lo_address targ, const char *path, const char *types, ...); +int lo_send_timestamped(lo_address targ, lo_timetag ts, const char *path, const char *types, ...); +int lo_send_from(lo_address targ, lo_server from, lo_timetag ts, const char *path, const char *types, ...); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/win32-mingw/include/lo/lo_osc_types.h Wed Mar 20 15:25:02 2013 +0000 @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2004 Steve Harris + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * $Id$ + */ + +#ifndef LO_OSC_TYPES_H +#define LO_OSC_TYPES_H + +/** + * \file lo_osc_types.h A liblo header defining OSC-related types and + * constants. + */ + +#ifdef _MSC_VER +#define int32_t __int32 +#define int64_t __int64 +#define uint32_t unsigned __int32 +#define uint64_t unsigned __int64 +#define uint8_t unsigned __int8 +#else +#include <stdint.h> +#endif + +/** + * \addtogroup liblo + * @{ + */ + +/** + * \brief A structure to store OSC TimeTag values. + */ +typedef struct { + /** The number of seconds since Jan 1st 1900 in the UTC timezone. */ + uint32_t sec; + /** The fractions of a second offset from above, expressed as 1/2^32nds + * of a second */ + uint32_t frac; +} lo_timetag; + +/** + * \brief An enumeration of the OSC types liblo can send and receive. + * + * The value of the enumeration is the typechar used to tag messages and to + * specify arguments with lo_send(). + */ +typedef enum { +/* basic OSC types */ + /** 32 bit signed integer. */ + LO_INT32 = 'i', + /** 32 bit IEEE-754 float. */ + LO_FLOAT = 'f', + /** Standard C, NULL terminated string. */ + LO_STRING = 's', + /** OSC binary blob type. Accessed using the lo_blob_*() functions. */ + LO_BLOB = 'b', + +/* extended OSC types */ + /** 64 bit signed integer. */ + LO_INT64 = 'h', + /** OSC TimeTag type, represented by the lo_timetag structure. */ + LO_TIMETAG = 't', + /** 64 bit IEEE-754 double. */ + LO_DOUBLE = 'd', + /** Standard C, NULL terminated, string. Used in systems which + * distinguish strings and symbols. */ + LO_SYMBOL = 'S', + /** Standard C, 8 bit, char variable. */ + LO_CHAR = 'c', + /** A 4 byte MIDI packet. */ + LO_MIDI = 'm', + /** Sybol representing the value True. */ + LO_TRUE = 'T', + /** Sybol representing the value False. */ + LO_FALSE = 'F', + /** Sybol representing the value Nil. */ + LO_NIL = 'N', + /** Sybol representing the value Infinitum. */ + LO_INFINITUM = 'I' +} lo_type; + + +/** + * \brief Union used to read values from incoming messages. + * + * Types can generally be read using argv[n]->t where n is the argument number + * and t is the type character, with the exception of strings and symbols which + * must be read with &argv[n]->t. + */ +typedef union { + /** 32 bit signed integer. */ + int32_t i; + /** 32 bit signed integer. */ + int32_t i32; + /** 64 bit signed integer. */ + int64_t h; + /** 64 bit signed integer. */ + int64_t i64; + /** 32 bit IEEE-754 float. */ + float f; + /** 32 bit IEEE-754 float. */ + float f32; + /** 64 bit IEEE-754 double. */ + double d; + /** 64 bit IEEE-754 double. */ + double f64; + /** Standard C, NULL terminated string. */ + char s; + /** Standard C, NULL terminated, string. Used in systems which + * distinguish strings and symbols. */ + char S; + /** Standard C, 8 bit, char. */ + unsigned char c; + /** A 4 byte MIDI packet. */ + uint8_t m[4]; + /** OSC TimeTag value. */ + lo_timetag t; +} lo_arg; + +/** \brief A timetag constant representing "now". */ +/* Note: No struct literals in MSVC */ +#ifdef _MSC_VER +lo_timetag lo_get_tt_immediate(); +#define LO_TT_IMMEDIATE lo_get_tt_immediate() +#else +#define LO_TT_IMMEDIATE ((lo_timetag){0U,1U}) +#endif + +/** @} */ + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/win32-mingw/include/lo/lo_throw.h Wed Mar 20 15:25:02 2013 +0000 @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2004 Steve Harris + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * $Id$ + */ + +#ifndef LO_THROW_H +#define LO_THROW_H + +#ifdef __cplusplus +extern "C" { +#endif + +void lo_throw(lo_server s, int errnum, const char *message, const char *path); + +#ifdef __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/win32-mingw/include/lo/lo_types.h Wed Mar 20 15:25:02 2013 +0000 @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2004 Steve Harris + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * $Id$ + */ + +#ifndef LO_TYPES_H +#define LO_TYPES_H + +/** + * \file lo_types.h The liblo headerfile defining types used by this API. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef WIN32 +#include <winsock2.h> +#include <ws2tcpip.h> +#else +#include <netdb.h> +#endif + +#include <pthread.h> + +#include "lo/lo_osc_types.h" + +/** + * \brief A reference to an OSC service. + * + * Created by calls to lo_address_new() or lo_address_new_from_url(). + */ +typedef void *lo_address; + +/** + * \brief A object to store an opaque binary data object. + * + * Can be passed over OSC using the 'b' type. Created by calls to lo_blob_new(). + */ +typedef void *lo_blob; + +/** + * \brief A low-level object used to represent messages passed over OSC. + * + * Created by calls to lo_message_new(), arguments can be added with calls to + * lo_message_add_*(). + */ +typedef void *lo_message; + +/** + * \brief A low-level object used to represent bundles of messages passed over + * OSC. + * + * Created by calls to lo_bundle_new(), messages can be added with calls to + * lo_bundle_add_message(). + */ +typedef void *lo_bundle; + +/** + * \brief An object representing an method on a server. + * + * Returned by calls to lo_server_thread_add_method() and + * lo_server_add_method(). + */ +typedef void *lo_method; + +/** + * \brief An object representing an instance of an OSC server. + * + * Created by calls to lo_server_new(). If you with the library to take care of + * the threading as well you can just use server threads instead. + */ +typedef void *lo_server; + +/** + * \brief An object representing a thread containing an OSC server. + * + * Created by calls to lo_server_thread_new(). + */ +typedef void *lo_server_thread; + +/** + * \brief A callback function to receive notifcation of an error in a server or + * server thread. + * + * On callback the paramters will be set to the following values: + * + * \param num An error number that can be used to identify this condition. + * \param msg An error message describing the condidtion. + * \param where A string describing the place the error occured - typically + * either a function call or method path. + */ +typedef void (*lo_err_handler)(int num, const char *msg, const char *where); + +/** + * \brief A callback function to receive notifcation of matching message + * arriving in the server or server thread. + * + * The return value tells the method dispatcher whether this handler + * has dealt with the message correctly: a return value of 0 indicates + * that it has been handled, and it should not attempt to pass it on + * to any other handlers, non-0 means that it has not been handled and + * the dispatcher will attempt to find more handlers that match the + * path and types of the incoming message. + * + * On callback the paramters will be set to the following values: + * + * \param path That path that the incoming message was sent to + * \param types If you specided types in your method creation call then this + * will match those and the incoming types will have been coerced to match, + * otherwise it will be the types of the arguments of the incoming message. + * \param argv An array of lo_arg types containing the values, e.g. if the + * first argument of the incoming message is of type 'f' then the vlaue will be + * found in argv[0]->f. + * \param argc The number of argumets received. + * \param msg A structure containing the original raw message as received. No + * type coercion will have occured and the data will be in OSC byte order + * (bigendian). + * \param user_data This contains the user_data value passed in the call to + * lo_server_thread_add_method. + */ +typedef int (*lo_method_handler)(const char *path, const char *types, + lo_arg **argv, int argc, lo_message msg, + void *user_data); + +#ifdef __cplusplus +} +#endif + +#endif