aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in29
-rw-r--r--src/OSC-common.h36
-rw-r--r--src/OSC-pattern-match.c399
-rw-r--r--src/OSC-pattern-match.h44
-rw-r--r--src/OSC-system-dependent.c81
-rw-r--r--src/sendOSC.c38
6 files changed, 353 insertions, 274 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 03e256e..2b52150 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,3 +1,20 @@
+#
+# Copyright (C) 2004 Hans-Christoph Steiner
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
EXT=o
LIBS = -lm -lc
@@ -9,7 +26,7 @@ LDFLAGS = @LDFLAGS@
prefix=$(DESTDIR)/usr
-SOURCES = OSC-pattern-match.c OSC.c dumpOSC.c htmsocket.c OSCroute.c sendOSC.c
+SOURCES = OSC-pattern-match.c OSC.c dumpOSC.c htmsocket.c OSCroute.c sendOSC.c OSC-system-dependent.c
TARGETS = $(SOURCES:.c=.o)
EXTS=sendOSC.@pd_suffix@ dumpOSC.@pd_suffix@ OSCroute.@pd_suffix@ OSC.@pd_suffix@
@@ -17,16 +34,16 @@ EXTS=sendOSC.@pd_suffix@ dumpOSC.@pd_suffix@ OSCroute.@pd_suffix@ OSC.@pd_suffix
all: $(EXTS)
-sendOSC.@pd_suffix@: sendOSC.o htmsocket.o
- cc $(LDFLAGS) -o sendOSC.@pd_suffix@ $? -lc -lm $(LIBOSC)
-
dumpOSC.@pd_suffix@: dumpOSC.o
cc $(LDFLAGS) -o dumpOSC.@pd_suffix@ $? -lc -lm
-OSCroute.@pd_suffix@: OSCroute.o OSC-pattern-match.o
+sendOSC.@pd_suffix@: sendOSC.o htmsocket.o OSC-system-dependent.o
+ cc $(LDFLAGS) -o sendOSC.@pd_suffix@ $? -lc -lm $(LIBOSC)
+
+OSCroute.@pd_suffix@: OSCroute.o OSC-pattern-match.o OSC-system-dependent.o
cc $(LDFLAGS) -o OSCroute.@pd_suffix@ $? -lc -lm
-OSC.@pd_suffix@: OSC.o sendOSC.o dumpOSC.o OSCroute.o htmsocket.o OSC-pattern-match.o
+OSC.@pd_suffix@: OSC.o sendOSC.o dumpOSC.o OSCroute.o htmsocket.o OSC-pattern-match.o OSC-system-dependent.o
cc $(LDFLAGS) -o OSC.@pd_suffix@ $? -lc -lm $(LIBOSC)
$(TARGETS): %.o : %.c
diff --git a/src/OSC-common.h b/src/OSC-common.h
index 8eb6576..80ee70b 100644
--- a/src/OSC-common.h
+++ b/src/OSC-common.h
@@ -1,35 +1,33 @@
/*
-Copyright (c) 1998. The Regents of the University of California (Regents).
+Copyright © 1998. The Regents of the University of California (Regents).
All Rights Reserved.
-Permission to use, copy, modify, and distribute this software and its
-documentation for educational, research, and not-for-profit purposes, without
-fee and without a signed licensing agreement, is hereby granted, provided that
-the above copyright notice, this paragraph and the following two paragraphs
-appear in all copies, modifications, and distributions. Contact The Office of
-Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley,
-CA 94720-1620, (510) 643-7201, for commercial licensing opportunities.
-
Written by Matt Wright, The Center for New Music and Audio Technologies,
University of California, Berkeley.
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Permission to use, copy, modify, distribute, and distribute modified versions
+of this software and its documentation without fee and without a signed
+licensing agreement, is hereby granted, provided that the above copyright
+notice, this paragraph and the following two paragraphs appear in all copies,
+modifications, and distributions.
+
+IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
+OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING
- DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
- REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
- ENHANCEMENTS, OR MODIFICATIONS.
+REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
+HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
+MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
The OpenSound Control WWW page is
http://www.cnmat.berkeley.edu/OpenSoundControl
*/
+
/* OSC-common.h
Simple stuff to #include everywhere in the OSC package
diff --git a/src/OSC-pattern-match.c b/src/OSC-pattern-match.c
index 7b04042..847ebb3 100644
--- a/src/OSC-pattern-match.c
+++ b/src/OSC-pattern-match.c
@@ -1,207 +1,192 @@
-/*
-Copyright (c) 1998. The Regents of the University of California (Regents).
-All Rights Reserved.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for educational, research, and not-for-profit purposes, without
-fee and without a signed licensing agreement, is hereby granted, provided that
-the above copyright notice, this paragraph and the following two paragraphs
-appear in all copies, modifications, and distributions. Contact The Office of
-Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley,
-CA 94720-1620, (510) 643-7201, for commercial licensing opportunities.
-
-Written by Matt Wright, The Center for New Music and Audio Technologies,
-University of California, Berkeley.
-
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING
- DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
- REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
- ENHANCEMENTS, OR MODIFICATIONS.
-
-The OpenSound Control WWW page is
- http://www.cnmat.berkeley.edu/OpenSoundControl
-*/
-
-
-/*
- OSC-pattern-match.c
- Matt Wright, 3/16/98
- Adapted from oscpattern.c, by Matt Wright and Amar Chaudhury
- */
-#ifdef UNIX
- #include <stdio.h>
-#endif
-
-// #ifdef __APPLE__
-// #include <stdio.h>
-// #endif
-
-#include "OSC-common.h"
-#include "OSC-pattern-match.h"
-
-static const char *theWholePattern; /* Just for warning messages */
-
-static Boolean MatchBrackets (const char *pattern, const char *test);
-static Boolean MatchList (const char *pattern, const char *test);
-
-Boolean PatternMatch (const char * pattern, const char * test) {
-
- // printf("OSC-pattern-match.c: pattern: %s, test: %s\n", pattern, test);
-
- theWholePattern = pattern;
-
- // post("pattern: %s, test: %s", pattern, test);
-
- if(test[0] == '*') {
- return TRUE;
- }
-
- if (pattern == 0 || pattern[0] == 0) {
- return test[0] == 0;
- }
-
- if (test[0] == 0) {
- if (pattern[0] == '*')
- return PatternMatch (pattern+1,test);
- else
- return FALSE;
- }
-
- switch (pattern[0]) {
- case 0 : return test[0] == 0;
- case '?' : return PatternMatch (pattern + 1, test + 1);
- case '*' :
- if (PatternMatch (pattern+1, test)) {
- return TRUE;
- } else {
- return PatternMatch (pattern, test+1);
- }
- case ']' :
- case '}' :
- printf("Spurious %c in pattern \".../%s/...\"",pattern[0], theWholePattern);
- return FALSE;
- case '[' :
- return MatchBrackets (pattern,test);
- case '{' :
- return MatchList (pattern,test);
- case '\\' :
- if (pattern[1] == 0) {
- return test[0] == 0;
- } else if (pattern[1] == test[0]) {
- return PatternMatch (pattern+2,test+1);
- } else {
- return FALSE;
- }
- default :
- if (pattern[0] == test[0]) {
- return PatternMatch (pattern+1,test+1);
- } else {
- return FALSE;
- }
- }
-}
-
-
-/* we know that pattern[0] == '[' and test[0] != 0 */
-
-static Boolean MatchBrackets (const char *pattern, const char *test) {
- Boolean result;
- Boolean negated = FALSE;
- const char *p = pattern;
-
- if (pattern[1] == 0) {
- printf("Unterminated [ in pattern \".../%s/...\"", theWholePattern);
- return FALSE;
- }
-
- if (pattern[1] == '!') {
- negated = TRUE;
- p++;
- }
-
- while (*p != ']') {
- if (*p == 0) {
- printf("Unterminated [ in pattern \".../%s/...\"", theWholePattern);
- return FALSE;
- }
- if (p[1] == '-' && p[2] != 0) {
- if (test[0] >= p[0] && test[0] <= p[2]) {
- result = !negated;
- goto advance;
- }
- }
- if (p[0] == test[0]) {
- result = !negated;
- goto advance;
- }
- p++;
- }
-
- result = negated;
-
-advance:
-
- if (!result)
- return FALSE;
-
- while (*p != ']') {
- if (*p == 0) {
- printf("Unterminated [ in pattern \".../%s/...\"", theWholePattern);
- return FALSE;
- }
- p++;
- }
-
- return PatternMatch (p+1,test+1);
-}
-
-static Boolean MatchList (const char *pattern, const char *test) {
-
- const char *restOfPattern, *tp = test;
-
-
- for(restOfPattern = pattern; *restOfPattern != '}'; restOfPattern++) {
- if (*restOfPattern == 0) {
- printf("Unterminated { in pattern \".../%s/...\"", theWholePattern);
- return FALSE;
- }
- }
-
- restOfPattern++; /* skip close curly brace */
-
-
- pattern++; /* skip open curly brace */
-
- while (1) {
-
- if (*pattern == ',') {
- if (PatternMatch (restOfPattern, tp)) {
- return TRUE;
- } else {
- tp = test;
- ++pattern;
- }
- } else if (*pattern == '}') {
- return PatternMatch (restOfPattern, tp);
- } else if (*pattern == *tp) {
- ++pattern;
- ++tp;
- } else {
- tp = test;
- while (*pattern != ',' && *pattern != '}') {
- pattern++;
- }
- if (*pattern == ',') {
- pattern++;
- }
- }
- }
-
-}
+/*
+Copyright © 1998. The Regents of the University of California (Regents).
+All Rights Reserved.
+
+Written by Matt Wright, The Center for New Music and Audio Technologies,
+University of California, Berkeley.
+
+Permission to use, copy, modify, distribute, and distribute modified versions
+of this software and its documentation without fee and without a signed
+licensing agreement, is hereby granted, provided that the above copyright
+notice, this paragraph and the following two paragraphs appear in all copies,
+modifications, and distributions.
+
+IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
+OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
+HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
+MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+The OpenSound Control WWW page is
+ http://www.cnmat.berkeley.edu/OpenSoundControl
+*/
+
+
+
+/*
+ OSC-pattern-match.c
+ Matt Wright, 3/16/98
+ Adapted from oscpattern.c, by Matt Wright and Amar Chaudhury
+ */
+
+#include "OSC-common.h"
+#include "OSC-pattern-match.h"
+
+static const char *theWholePattern; /* Just for warning messages */
+
+static Boolean MatchBrackets (const char *pattern, const char *test);
+static Boolean MatchList (const char *pattern, const char *test);
+
+Boolean PatternMatch (const char * pattern, const char * test) {
+ theWholePattern = pattern;
+
+ if (pattern == 0 || pattern[0] == 0) {
+ return test[0] == 0;
+ }
+
+ if (test[0] == 0) {
+ if (pattern[0] == '*')
+ return PatternMatch (pattern+1,test);
+ else
+ return FALSE;
+ }
+
+ switch (pattern[0]) {
+ case 0 : return test[0] == 0;
+ case '?' : return PatternMatch (pattern + 1, test + 1);
+ case '*' :
+ if (PatternMatch (pattern+1, test)) {
+ return TRUE;
+ } else {
+ return PatternMatch (pattern, test+1);
+ }
+ case ']' :
+ case '}' :
+ OSCWarning("Spurious %c in pattern \".../%s/...\"",pattern[0], theWholePattern);
+ return FALSE;
+ case '[' :
+ return MatchBrackets (pattern,test);
+ case '{' :
+ return MatchList (pattern,test);
+ case '\\' :
+ if (pattern[1] == 0) {
+ return test[0] == 0;
+ } else if (pattern[1] == test[0]) {
+ return PatternMatch (pattern+2,test+1);
+ } else {
+ return FALSE;
+ }
+ default :
+ if (pattern[0] == test[0]) {
+ return PatternMatch (pattern+1,test+1);
+ } else {
+ return FALSE;
+ }
+ }
+}
+
+
+/* we know that pattern[0] == '[' and test[0] != 0 */
+
+static Boolean MatchBrackets (const char *pattern, const char *test) {
+ Boolean result;
+ Boolean negated = FALSE;
+ const char *p = pattern;
+
+ if (pattern[1] == 0) {
+ OSCWarning("Unterminated [ in pattern \".../%s/...\"", theWholePattern);
+ return FALSE;
+ }
+
+ if (pattern[1] == '!') {
+ negated = TRUE;
+ p++;
+ }
+
+ while (*p != ']') {
+ if (*p == 0) {
+ OSCWarning("Unterminated [ in pattern \".../%s/...\"", theWholePattern);
+ return FALSE;
+ }
+ if (p[1] == '-' && p[2] != 0) {
+ if (test[0] >= p[0] && test[0] <= p[2]) {
+ result = !negated;
+ goto advance;
+ }
+ }
+ if (p[0] == test[0]) {
+ result = !negated;
+ goto advance;
+ }
+ p++;
+ }
+
+ result = negated;
+
+advance:
+
+ if (!result)
+ return FALSE;
+
+ while (*p != ']') {
+ if (*p == 0) {
+ OSCWarning("Unterminated [ in pattern \".../%s/...\"", theWholePattern);
+ return FALSE;
+ }
+ p++;
+ }
+
+ return PatternMatch (p+1,test+1);
+}
+
+static Boolean MatchList (const char *pattern, const char *test) {
+
+ const char *restOfPattern, *tp = test;
+
+
+ for(restOfPattern = pattern; *restOfPattern != '}'; restOfPattern++) {
+ if (*restOfPattern == 0) {
+ OSCWarning("Unterminated { in pattern \".../%s/...\"", theWholePattern);
+ return FALSE;
+ }
+ }
+
+ restOfPattern++; /* skip close curly brace */
+
+
+ pattern++; /* skip open curly brace */
+
+ while (1) {
+
+ if (*pattern == ',') {
+ if (PatternMatch (restOfPattern, tp)) {
+ return TRUE;
+ } else {
+ tp = test;
+ ++pattern;
+ }
+ } else if (*pattern == '}') {
+ return PatternMatch (restOfPattern, tp);
+ } else if (*pattern == *tp) {
+ ++pattern;
+ ++tp;
+ } else {
+ tp = test;
+ while (*pattern != ',' && *pattern != '}') {
+ pattern++;
+ }
+ if (*pattern == ',') {
+ pattern++;
+ }
+ }
+ }
+
+}
+
+
+
diff --git a/src/OSC-pattern-match.h b/src/OSC-pattern-match.h
index a5d7306..653b54d 100644
--- a/src/OSC-pattern-match.h
+++ b/src/OSC-pattern-match.h
@@ -1,35 +1,35 @@
/*
-Copyright (c) 1998. The Regents of the University of California (Regents).
+Copyright © 1998. The Regents of the University of California (Regents).
All Rights Reserved.
-Permission to use, copy, modify, and distribute this software and its
-documentation for educational, research, and not-for-profit purposes, without
-fee and without a signed licensing agreement, is hereby granted, provided that
-the above copyright notice, this paragraph and the following two paragraphs
-appear in all copies, modifications, and distributions. Contact The Office of
-Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley,
-CA 94720-1620, (510) 643-7201, for commercial licensing opportunities.
-
Written by Matt Wright, The Center for New Music and Audio Technologies,
University of California, Berkeley.
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING
- DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
- REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
- ENHANCEMENTS, OR MODIFICATIONS.
+Permission to use, copy, modify, distribute, and distribute modified versions
+of this software and its documentation without fee and without a signed
+licensing agreement, is hereby granted, provided that the above copyright
+notice, this paragraph and the following two paragraphs appear in all copies,
+modifications, and distributions.
+
+IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
+OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
+HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
+MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+The OpenSound Control WWW page is
+ http://www.cnmat.berkeley.edu/OpenSoundControl
+*/
- The OpenSound Control WWW page is http://www.cnmat.berkeley.edu/OpenSoundControl
+/*
OSC-pattern-match.h
*/
-//Boolean PatternMatch (const char *pattern, const char *test);
Boolean PatternMatch (const char *pattern, const char *test);
diff --git a/src/OSC-system-dependent.c b/src/OSC-system-dependent.c
new file mode 100644
index 0000000..010b9b5
--- /dev/null
+++ b/src/OSC-system-dependent.c
@@ -0,0 +1,81 @@
+/*
+Copyright © 1998. The Regents of the University of California (Regents).
+All Rights Reserved.
+
+Written by Matt Wright, The Center for New Music and Audio Technologies,
+University of California, Berkeley.
+
+Permission to use, copy, modify, distribute, and distribute modified versions
+of this software and its documentation without fee and without a signed
+licensing agreement, is hereby granted, provided that the above copyright
+notice, this paragraph and the following two paragraphs appear in all copies,
+modifications, and distributions.
+
+IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
+OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
+HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
+MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+The OpenSound Control WWW page is
+ http://www.cnmat.berkeley.edu/OpenSoundControl
+*/
+
+
+
+/* OSC-system-dependent.c
+
+ Matt Wright, 3/13/98
+
+ File of procedures OSC has to call that are not part of the OSC package
+ and that you, the developer adding OSC addressability to an application,
+ must write in a way that makes sense in the context of your system.
+
+ You should also look at OSC-timetag.c and see if there's a better way
+ to handle time tags on your system.
+
+*/
+
+#include "OSC-common.h"
+
+/* Printing stuff: for now, use stderr. Some cleverer stuff we could do:
+
+ - Make a silent mode where these don't do anything.
+ - Return error messages via OSC to some client
+*/
+
+#include <stdarg.h>
+#include <stdio.h>
+
+void fatal_error(char *s, ...) {
+ va_list ap;
+ fprintf(stderr, "Fatal error: ");
+ va_start(ap, s);
+ vfprintf(stderr, s, ap);
+ fprintf(stderr, "\n");
+ va_end(ap);
+ exit(-321);
+}
+
+void OSCProblem(char *s, ...) {
+ va_list ap;
+ fprintf(stderr, "OSC Problem: ");
+ va_start(ap, s);
+ vfprintf(stderr, s, ap);
+ fprintf(stderr, "\n");
+ va_end(ap);
+}
+
+void OSCWarning(char *s, ...) {
+ va_list ap;
+ fprintf(stderr, "OSC Warning: ");
+ va_start(ap, s);
+ vfprintf(stderr, s, ap);
+ fprintf(stderr, "\n");
+ va_end(ap);
+}
diff --git a/src/sendOSC.c b/src/sendOSC.c
index 5dc8f59..f4c1d8e 100644
--- a/src/sendOSC.c
+++ b/src/sendOSC.c
@@ -60,30 +60,26 @@ University of California, Berkeley.
compiling:
cc -o sendOSC sendOSC.c htmsocket.c OpenSoundControl.c OSC_timeTag.c
*/
+#include "m_pd.h"
+
+#include "OSC-common.h"
+#include "OSC-client.h"
+#include "htmsocket.h"
+
+#include <string.h>
+#include <sys/types.h>
+#include <stdlib.h>
#ifdef WIN32
- #include "m_pd.h"
- #include "OSC-client.h"
- #include "htmsocket.h"
- #include "OSC-common.h"
#include <winsock2.h>
#include <io.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
- #include <stdlib.h>
- #include <string.h>
- #include <sys/types.h>
#else
- #include "m_pd.h"
//#include "x_osc.h"
- #include "OSC-client.h"
- #include "htmsocket.h"
#include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
@@ -111,7 +107,8 @@ typedArg ParseToken(char *token);
int WriteMessage(OSCbuf *buf, char *messageName, int numArgs, typedArg *args);
void SendBuffer(void *htmsocket, OSCbuf *buf);
void SendData(void *htmsocket, int size, char *data);
-void fatal_error(char *s);
+/* defined in OSC-system-dependent.c now */
+/* void fatal_error(char *s); */
void send_complain(char *s, ...);
//static void *htmsocket;
@@ -581,7 +578,7 @@ OSCTimeTag ParseTimeTag(char *s) {
and this machine is little-endian, so sscanf
wrote each half of the time tag in the wrong half
of the struct. */
- uint32 temp;
+ uint4 temp;
temp = tt.seconds;
tt.seconds = tt.fraction ;
tt.fraction = temp;
@@ -837,11 +834,12 @@ void SendData(void *htmsocket, int size, char *data) {
}
}
-void fatal_error(char *s) {
- fprintf(stderr, "FATAL ERROR: %s\n", s);
- post("fatal error, not exiting ...");
- //exit(4);
-}
+/* defined in OSC-system-dependent.c now */
+/* void fatal_error(char *s) { */
+/* fprintf(stderr, "FATAL ERROR: %s\n", s); */
+/* post("fatal error, not exiting ..."); */
+/* //exit(4); */
+/* } */
#include <stdarg.h>
void send_complain(char *s, ...) {