aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.txt11
-rw-r--r--libOSC/LIBOSC.DSP2
-rw-r--r--libOSC/LIBOSC.PLG12
-rw-r--r--src/OSC-common.h17
-rw-r--r--src/OSC-system-dependent.c5
-rw-r--r--src/OSC.c20
-rw-r--r--src/OSC.dsp14
-rw-r--r--src/OSCroute.c7
-rw-r--r--src/VERSION2
-rw-r--r--src/dumpOSC.c30
-rw-r--r--src/htmsocket.c4
-rw-r--r--src/sendOSC.c42
12 files changed, 95 insertions, 71 deletions
diff --git a/README.txt b/README.txt
index cb34018..2859403 100644
--- a/README.txt
+++ b/README.txt
@@ -17,8 +17,8 @@ which installs the files in /usr/lib/pd/extra and /usr/lib/pd/doc
windows:
use extra/OSC.dll
-.dsw and .dsp files are also included.
-i m not sure how compilation would work on windows. if you manage to build the current stuff on win let me know then i can include these instead of the outdated OSC.dll
+.dsw and .dsp files are also included. You'll want to adapt include and link paths for pd and LIBOSC.
+
files:
@@ -33,6 +33,13 @@ send+dump/ CNMAT's OSC commandline utils (with some changes)
log:
+ 20050830: v0.3: (piotr@majdak.com)
+ adapted to compile on Windows2000
+ dumpOSC routes up to 128 branches (tested with 24)
+ sendOSC doesn't crash on longer messages (tested with one argument of 120 characters)
+ sendOSC # of arguments limited by the length of the message (tested with 110 messages)
+ tested on Windows 2000 ONLY!
+
20040409: changed build setup to suit externals build system
single object objects, no lib
diff --git a/libOSC/LIBOSC.DSP b/libOSC/LIBOSC.DSP
index 99e661a..6f19738 100644
--- a/libOSC/LIBOSC.DSP
+++ b/libOSC/LIBOSC.DSP
@@ -49,7 +49,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\..\pd\lib\LIBOSC.lib"
+# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "LIBOSC - Win32 Debug"
diff --git a/libOSC/LIBOSC.PLG b/libOSC/LIBOSC.PLG
index d011835..37f24da 100644
--- a/libOSC/LIBOSC.PLG
+++ b/libOSC/LIBOSC.PLG
@@ -6,18 +6,8 @@
--------------------Configuration: LIBOSC - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\gustav\LOCALS~1\Temp\RSPB.tmp" with contents
-[
-/nologo /ML /W3 /GX /O2 /I "../../pd/src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"Release/LIBOSC.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c
-"D:\pd\OSC\LIBOSC\OSC-client.c"
-"D:\pd\OSC\LIBOSC\OSC-timetag.c"
-]
-Creating command line "cl.exe @C:\DOCUME~1\gustav\LOCALS~1\Temp\RSPB.tmp"
-Creating command line "link.exe -lib /nologo /out:"..\..\..\pd\lib\LIBOSC.lib" ".\Release\OSC-client.obj" ".\Release\OSC-timetag.obj" "
+Creating command line "link.exe -lib /nologo /out:"Release\LIBOSC.lib" ".\Release\OSC-client.obj" ".\Release\OSC-timetag.obj" "
<h3>Output Window</h3>
-Compiling...
-OSC-client.c
-OSC-timetag.c
Creating library...
diff --git a/src/OSC-common.h b/src/OSC-common.h
index 80ee70b..d457686 100644
--- a/src/OSC-common.h
+++ b/src/OSC-common.h
@@ -41,7 +41,21 @@ typedef int Boolean;
#define TRUE 1
#define FALSE 0
#endif
-
+
+
+#ifdef WIN32
+ #include <stdio.h>
+ #ifdef OSC_EXPORTS
+ #define OSC_API __declspec(dllexport)
+ #else
+ #define OSC_API __declspec(dllimport)
+ #endif
+ #ifdef _DEBUG
+ #define DEBUG
+ #endif
+#endif
+
+//#define int32_t t_int
/* Fixed byte width types */
typedef int int4; /* 4 byte int */
@@ -57,4 +71,3 @@ void OSCProblem(char *s, ...);
/* Warning for user */
void OSCWarning(char *s, ...);
-
diff --git a/src/OSC-system-dependent.c b/src/OSC-system-dependent.c
index 010b9b5..8ecaa07 100644
--- a/src/OSC-system-dependent.c
+++ b/src/OSC-system-dependent.c
@@ -50,7 +50,10 @@ The OpenSound Control WWW page is
*/
#include <stdarg.h>
-#include <stdio.h>
+#include <stdio.h>
+#ifdef WIN32
+ #include <stdlib.h>
+#endif
void fatal_error(char *s, ...) {
va_list ap;
diff --git a/src/OSC.c b/src/OSC.c
index 4982dee..9063dc3 100644
--- a/src/OSC.c
+++ b/src/OSC.c
@@ -5,6 +5,7 @@
-- tweaks for Win32 www.zeggz.com/raf 13-April-2002
-- smoothed out build, clean up for Darwin <hans@at.or.at> 2004.04.04
-- shoutz: miller and the others
+ -- Windows-ification by Piotr Majdak <piotr@majdak.com> 30.08.2005
*/
#if HAVE_CONFIG_H
@@ -14,7 +15,7 @@
#include <m_pd.h>
#include "OSC-common.h"
-#define VERSION "0.2"
+#define VERSION "0.3"
#ifndef OSC_API
#define OSC_API
@@ -28,11 +29,11 @@ typedef struct _OSC
OSC_API void OSC_setup(void);
OSC_API void OSC_version(t_OSC*);
-/*
+
OSC_API void sendOSC_setup(void);
OSC_API void dumpOSC_setup(void);
OSC_API void OSCroute_setup(void);
-*/
+
static t_class* OSC_class;
@@ -45,12 +46,11 @@ static void* OSC_new(t_symbol* s) {
OSC_API void OSC_version (t_OSC *x) {
- // EnterCallback();
- post("OSC4PD Version " VERSION
- "\n ¯\\ original code by matt wright. pd-fication jdl@xdv.org\n"
- " · Win32-port raf@interaccess.com unified versions hans@at.or.at\n"
- " \\_ Compiled " __TIME__ " " __DATE__);
- // ExitCallback();
+ post("OSC4PD Version " VERSION "\n"
+ " Original code by matt wright. pd-fication jdl@xdv.org\n"
+ " Win32-port raf@interaccess.com unified versions hans@at.or.at\n"
+ " Adaptations for Windows: piotr@majdak.com\n"
+ " Compiled: "__DATE__);
}
OSC_API void OSC_setup(void) {
@@ -64,5 +64,5 @@ OSC_API void OSC_setup(void) {
post("O : Open Sound Control 4 PD, http://www.cnmat.berkeley.edu/OSC");
post(" S : original code by matt wright, pd hakcs cxc, Win32-port raf@interaccess.com");
- post(" C: ver: "VERSION ", compiled: "__DATE__);
+ post(" C: ver: "VERSION ", compiled: "__DATE__ " -- adapted by piotr@majdak.com");
}
diff --git a/src/OSC.dsp b/src/OSC.dsp
index 8f0116d..fc16ecd 100644
--- a/src/OSC.dsp
+++ b/src/OSC.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAFOSC_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../pd/src" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSC_EXPORTS" /D "NT" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "c:\pd\src" /I "LIBOSC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSC_EXPORTS" /D "NT" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 pd.lib libc.lib kernel32.lib wsock32.lib LIBOSC.lib /nologo /dll /machine:I386 /nodefaultlib /out:"../../../pd/extra/OSC.dll" /libpath:"../../../pd/lib" /libpath:"../../../pd/bin"
+# ADD LINK32 c:\pd\bin\pd.lib libc.lib kernel32.lib wsock32.lib LIBOSC/Release/LIBOSC.lib /nologo /dll /machine:I386 /nodefaultlib /libpath:"../../../pd/lib" /libpath:"../../../pd/bin"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "OSC - Win32 Debug"
@@ -70,7 +70,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAFOSC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSC_EXPORTS" /D "NT" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "c:\pd\src" /I "LIBOSC" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSC_EXPORTS" /D "NT" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -80,7 +80,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 pd.lib libc.lib kernel32.lib wsock32.lib LIBOSC.lib /nologo /dll /debug /machine:I386 /nodefaultlib /pdbtype:sept
+# ADD LINK32 c:\pd\bin\pd.lib libc.lib kernel32.lib wsock32.lib LIBOSC/Release/LIBOSC.lib /nologo /dll /debug /machine:I386 /nodefaultlib /pdbtype:sept /libpath:"c:\pd\src"
!ENDIF
@@ -105,11 +105,15 @@ SOURCE=".\OSC-pattern-match.c"
# End Source File
# Begin Source File
+SOURCE=".\OSC-system-dependent.c"
+# End Source File
+# Begin Source File
+
SOURCE=.\OSC.c
# End Source File
# Begin Source File
-SOURCE=.\routeOSC.c
+SOURCE=.\OSCroute.c
# End Source File
# Begin Source File
diff --git a/src/OSCroute.c b/src/OSCroute.c
index 895a492..5c4bd40 100644
--- a/src/OSCroute.c
+++ b/src/OSCroute.c
@@ -56,6 +56,7 @@ The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl
#ifdef WIN32
#include <stdlib.h>
#include <string.h>
+ #include <stdio.h>
#endif
#ifdef __APPLE__
#include <stdio.h>
@@ -65,7 +66,7 @@ The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl
#endif
/* structure definition of your object */
-#define MAX_NUM 20
+#define MAX_NUM 128
#define OSC_ROUTE_VERSION "1.05"
/* Version 1.04: Allows #1 thru #9 as typed-in arguments
Version 1.05: Allows "list" messages as well as "message" messages.
@@ -125,7 +126,7 @@ static void OSCroute_free(t_OSCroute *x)
// setup
#ifdef WIN32
- OSC_API void OSCroute_setup(void) {
+ OSC_API void OSCroute_setup(void) {
#else
void OSCroute_setup(void) {
#endif
@@ -149,7 +150,7 @@ void OSCroute_setup(void) {
ps_emptySymbol = gensym("");
post("OSCroute object version " OSC_ROUTE_VERSION " by Matt Wright. pd: jdl Win32 raf.");
- post("OSCroute Copyright © 1999 Regents of the University of California. All Rights Reserved.");
+ post("OSCroute Copyright © 1999 Regents of the Univ. of California. All Rights Reserved.");
}
diff --git a/src/VERSION b/src/VERSION
index 3b04cfb..be58634 100644
--- a/src/VERSION
+++ b/src/VERSION
@@ -1 +1 @@
-0.2
+0.3
diff --git a/src/dumpOSC.c b/src/dumpOSC.c
index bedc5e1..873a3a9 100644
--- a/src/dumpOSC.c
+++ b/src/dumpOSC.c
@@ -77,7 +77,7 @@ The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl
/* declarations */
// typedef void (*t_fdpollfn)(void *ptr, int fd);
-void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr);
+//void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr);
#if defined(__sgi) || defined(__linux) || defined(WIN32) || defined(__APPLE__)
@@ -92,6 +92,7 @@ void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr);
#include <sys/stat.h>
#include <ctype.h>
#include <signal.h>
+ #include <stdio.h>
#else
#include <stdio.h>
#include <string.h>
@@ -134,7 +135,7 @@ typedef struct ClientAddressStruct {
int sockfd;
} *ClientAddr;
-typedef unsigned long long osc_time_t;
+
Boolean ShowBytes = FALSE;
Boolean Silent = FALSE;
@@ -144,6 +145,14 @@ Boolean Silent = FALSE;
static int unixinitudp(int chan);
#endif
+#ifdef WIN32
+ typedef unsigned __int64 osc_time_t;
+#else
+ typedef unsigned long long osc_time_t;
+#endif
+
+
+
static int initudp(int chan);
static void closeudp(int sockfd);
Boolean ClientReply(int packetsize, void *packet, int socketfd,
@@ -156,6 +165,7 @@ static int Synthmessage(char *m, int n, void *clientdesc, int clientdesclength,
char *DataAfterAlignedString(char *string, char *boundary) ;
Boolean IsNiceString(char *string, char *boundary) ;
void complain(char *s, ...);
+osc_time_t ReadTime(const char* src);
#define MAXMESG 32768
static char mbuf[MAXMESG];
@@ -225,7 +235,7 @@ static void dumpOSC_read(t_dumpOSC *x, int sockfd) {
printf("dumpOSC_read: received UDP packet of length %d\n", n);
#endif
- if(!dumpOSC_SendReply(mbuf, n, &x->x_server, clilen, sockfd))
+ //if(!dumpOSC_SendReply(mbuf, n, &x->x_server, clilen, sockfd))
{
dumpOSC_ParsePacket(x, mbuf, n, ra);
}
@@ -506,7 +516,7 @@ void PrintClientAddr(ClientAddr CA) {
//*******************
-void WriteTime(char* dst, osc_time_t osctime)
+/*void WriteTime(char* dst, osc_time_t osctime)
{
*(int32_t*)dst = htonl((int32_t)(osctime >> 32));
*(int32_t*)(dst+4) = htonl((int32_t)osctime);
@@ -525,13 +535,15 @@ osc_time_t ReadTime(const char* src)
double TimeToSeconds(osc_time_t osctime)
{
- return (double)osctime * 2.3283064365386962890625e-10 /* 1/2^32 */;
+ return (double)osctime * 2.3283064365386962890625e-10 // 1/2^32 ;
+// ^^^^^^^^^^^^^^^ isn't working on WIN32 (and on other machines: doesn't make sense!)
}
int timeRound(double x)
{
return x >= 0.0 ? x+0.5 : x-0.5;
}
+*/
/*
void WriteLogicalTime(char* dst)
{
@@ -551,10 +563,10 @@ void WriteLogicalTime(char* dst)
}
*/
-void WriteLogicalTime(char* dst)
+/*void WriteLogicalTime(char* dst)
{
double sTime = clock_gettimesince(19230720) / 1000.0;
- double tau = sTime - timeRound(sTime);
+ double tau = sTime - (double)timeRound(sTime);
//fprintf(stderr, "sSec = %f tau = %f\n", sTime, tau);
@@ -562,7 +574,7 @@ void WriteLogicalTime(char* dst)
*(int32_t*)(dst+4) = htonl((int32_t)(4294967296 * tau));
}
-Boolean dumpOSC_SendReply(char *buf, int n, void *clientDesc, int clientDescLenght, int fd)
+int dumpOSC_SendReply(char *buf, int n, void *clientDesc, int clientDescLenght, int fd)
{
if((n == 24) && (strcmp(buf, "#time") == 0))
{
@@ -587,7 +599,7 @@ Boolean dumpOSC_SendReply(char *buf, int n, void *clientDesc, int clientDescLeng
{
return FALSE;
}
-}
+}*/
//**********************
diff --git a/src/htmsocket.c b/src/htmsocket.c
index 3bcf3b9..d9d9343 100644
--- a/src/htmsocket.c
+++ b/src/htmsocket.c
@@ -54,6 +54,7 @@ The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl
#include <sys/types.h>
#include <stdlib.h>
#include "OSC-common.h"
+ #include <stdio.h>
#else
#include <stdio.h>
#include <unistd.h>
@@ -113,11 +114,12 @@ void *OpenHTMSocket(char *host, int portnumber)
unsigned int sockfd;
#endif
+ char oval = 1;
+
desc *o;
o = malloc(sizeof(*o));
if(!o)
return 0;
- int oval = 1;
#ifndef WIN32
diff --git a/src/sendOSC.c b/src/sendOSC.c
index 045c98c..701bfa0 100644
--- a/src/sendOSC.c
+++ b/src/sendOSC.c
@@ -218,7 +218,7 @@ void sendOSC_disconnect(t_sendOSC *x)
}
}
-void sendOSC_senduntyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv)
+/*void sendOSC_senduntyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv)
{
char* targv[MAXPDARG];
char tmparg[MAXPDSTRING];
@@ -247,7 +247,7 @@ void sendOSC_senduntyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv)
post("sendOSC: not connected");
// exit(3);
}
-}
+}*/
//////////////////////////////////////////////////////////////////////
// this is the real and only sending routine now, for both typed and
@@ -267,24 +267,22 @@ static void sendOSC_sendtyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv)
int numArgs = 0;
messageName = "";
-#ifdef DEBUG
- post ("sendOSC: messageName: %s", messageName);
-#endif
-
+ if(argc>MAX_ARGS)
+ { post ("sendOSC: too many arguments! (max: %d)", MAX_ARGS); return; }
for (c=0;c<argc;c++) {
- atom_string(argv+c,tmp, 80);
+ atom_string(argv+c,tmp, MAXPDSTRING);
#ifdef DEBUG
- // post ("sendOSC: %d, %s",c, tmp);
+ post ("sendOSC: %d, %s",c, tmp);
#endif
targv[c] = tmp;
tmp += strlen(tmp)+1;
#ifdef DEBUG
- // post ("sendOSC: %d, %s",c, targv[c]);
+ post ("sendOSC: %d, %s",c, targv[c]);
#endif
}
@@ -298,35 +296,29 @@ static void sendOSC_sendtyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv)
messageName = strtok(targv[0], ",");
j = 1;
for (i = j; i < argc; i++) {
- token = strtok(targv[i],",");
- args[i-j] = ParseToken(token);
+ token = strtok(targv[i],",");
+ args[i-j] = ParseToken(token);
#ifdef DEBUG
- printf("cell-cont: %s\n", targv[i]);
- printf(" type-id: %d\n", args[i-j]);
+ printf("cell-cont: %s\n", targv[i]);
+ printf(" type-id: %d\n", args[i-j]);
#endif
- numArgs = i;
+ numArgs = i;
}
if(WriteMessage(x->x_oscbuf, messageName, numArgs, args)) {
- post("sendOSC: usage error, write-msg failed: %s", OSC_errorMessage);
- return;
+ post("sendOSC: usage error, write-msg failed: %s", OSC_errorMessage);
+ return;
}
if(!x->x_bundle) {
-/* // post("sendOSC: accumulating bundle, not sending things ..."); */
-/* } else { */
- // post("sendOSC: yeah and OUT!");
- SendBuffer(x->x_htmsocket, x->x_oscbuf);
- OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf);
+ SendBuffer(x->x_htmsocket, x->x_oscbuf);
+ OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf);
}
- //CommandLineMode(argc, targv, x->x_htmsocket);
- //useTypeTags = 0;
}
else {
post("sendOSC: not connected");
- // exit(3);
}
}
@@ -351,7 +343,7 @@ static void sendOSC_free(t_sendOSC *x)
}
#ifdef WIN32
- OSC_API void sendOSC_setup(void) {
+ void sendOSC_setup(void) {
#else
void sendOSC_setup(void) {
#endif