From e465a280b562cf0ed4ab136e240437f6574189f8 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 30 Dec 2010 05:04:04 +0100 Subject: old Virtual OSC Controller project exported from SVN working copy unfortunately the repository is long gone, so is its history working and tested for: * POSIX/gcc (Linux, Windows Cygwin, OS/2 EMX) * Open Watcom C (native OS/2 and Windows) --- AUTHORS | 0 COPYING | 1 + ChangeLog | 0 Makefile.am | 3 + Makefile.watcom | 45 + NEWS | 0 README | 0 configure.ac | 60 + expat_watcom/Makefile.watcom | 116 ++ expat_watcom/expat_external.h | 117 ++ samples/sample.xml | 25 + samples/simple_osc.pd | 33 + samples/simple_osc.xml | 16 + src/Makefile.am | 5 + src/OSC-client.c | 496 +++++++ src/OSC-client.h | 197 +++ src/biosfont.h.cpp | 750 ++++++++++ src/controller.c | 553 ++++++++ src/controller.h | 55 + src/controls.c | 190 +++ src/controls.h | 113 ++ src/fontface.c | 3101 +++++++++++++++++++++++++++++++++++++++++ src/fontface.h | 12 + src/graphics.c | 175 +++ src/graphics.h | 37 + src/osc.c | 312 +++++ src/osc.h | 61 + src/xml.c | 378 +++++ src/xml.h | 9 + 29 files changed, 6860 insertions(+) create mode 100644 AUTHORS create mode 120000 COPYING create mode 100644 ChangeLog create mode 100644 Makefile.am create mode 100644 Makefile.watcom create mode 100644 NEWS create mode 100644 README create mode 100644 configure.ac create mode 100644 expat_watcom/Makefile.watcom create mode 100644 expat_watcom/expat_external.h create mode 100644 samples/sample.xml create mode 100644 samples/simple_osc.pd create mode 100644 samples/simple_osc.xml create mode 100644 src/Makefile.am create mode 100644 src/OSC-client.c create mode 100644 src/OSC-client.h create mode 100644 src/biosfont.h.cpp create mode 100644 src/controller.c create mode 100644 src/controller.h create mode 100644 src/controls.c create mode 100644 src/controls.h create mode 100644 src/fontface.c create mode 100644 src/fontface.h create mode 100644 src/graphics.c create mode 100644 src/graphics.h create mode 100644 src/osc.c create mode 100644 src/osc.h create mode 100644 src/xml.c create mode 100644 src/xml.h diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/COPYING b/COPYING new file mode 120000 index 0000000..0b6cbf8 --- /dev/null +++ b/COPYING @@ -0,0 +1 @@ +/usr/share/automake-1.10/COPYING \ No newline at end of file diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..6b75694 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,3 @@ + +SUBDIRS = src + diff --git a/Makefile.watcom b/Makefile.watcom new file mode 100644 index 0000000..0434bb8 --- /dev/null +++ b/Makefile.watcom @@ -0,0 +1,45 @@ +# Virtual OSC Controller +# Open Watcom Makefile + +ccl = owcc + +exeext = .exe +dllext = .dll +objext = .obj +libext = .lib + +sdl = c:\prg\libsdl +incl += -I$(sdl)\include\SDL +libs += $(sdl)\SDL\sdl12$libext +# ^ adapt to your SDL configuration + +expat = c:\prg\expat-2.0.1 +incl += -I$(expat)\lib +libs += $(expat)\lib\expat$libext + +optimization = -mtune=i386 -g3 -O0 +# ^ adapt to your system architecture etc. +cflags = -std=c99 -mthreads -fno-short-enum -mregparm=0 $optimization +#lflags = -s +# ^ adapt to your needs + +defs = -DOSC_NOBUNDLES +#defs += -DPACKAGE_VERSION="1.0" + +manifest = src\controller.c src\xml.c src\graphics.c src\controls.c & + src\fontface.c src\OSC-client.c src\osc.c +objects = $(manifest:.c=$objext) + +all : controller$exeext .symbolic + +controller$exeext : $objects + $ccl $lflags -o $^@ $< $libs + +.c : src +.c$objext: + $ccl $cflags $incl $defs -c -o $^@ $[@ + +clean: .symbolic + @for %i in ($objects controller$exeext) do & + @if exist %i del %i + diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..fc0fea9 --- /dev/null +++ b/configure.ac @@ -0,0 +1,60 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.61) +AC_INIT([Virtual OSC Controller], [dev]) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([src/controller.c]) +AC_CONFIG_HEADERS([config.h]) + +# Checks for programs. +AC_PROG_CC(gcc cc owcc) +AC_PROG_CC_C_O +AC_PROG_CC_C99 +AC_PROG_INSTALL +AC_PROG_LIBTOOL + +# Checks for libraries. +AC_CHECK_LIB(expat, XML_ParserCreate, , [ + AC_MSG_ERROR([Required libexpat is missing!]) +]) + +# libSDL depends on sdl-config script +AC_CHECK_PROG(SDL_CONFIG, sdl-config, sdl-config) +if test x$SDL_CONFIG = x; then + AC_MSG_ERROR([Required sdl-config script is missing! libSDL cannot be configured.]) +fi + +CFLAGS="$CFLAGS `$SDL_CONFIG --cflags`" +LIBS="$LIBS `$SDL_CONFIG --libs`" +AC_DEFINE(HAVE_LIBSDL, , [We've got libSDL]) + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/select.h unistd.h]) + +AC_CHECK_HEADERS([expat.h], , [ + AC_MSG_ERROR([Required libexpat headers are missing!]) +]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIZE_T +AC_CHECK_TYPE(in_addr_t, [ + AC_DEFINE([HAVE_IN_ADDR_T], , [netinet/in.h defines in_addr_t type]) +], , [ + #include +]) + +# Checks for library functions. +AC_FUNC_MALLOC +AC_FUNC_REALLOC +AC_CHECK_FUNCS([atexit gethostbyname memset socket strcasecmp strchr strdup strrchr strtoul]) + +# Arbitrary defines +AC_DEFINE([OSC_NOBUNDLES], , [Don't include OSC bundle support in OSC-client.c]) + +AC_CONFIG_FILES([Makefile src/Makefile]) +AC_OUTPUT + diff --git a/expat_watcom/Makefile.watcom b/expat_watcom/Makefile.watcom new file mode 100644 index 0000000..329d0b0 --- /dev/null +++ b/expat_watcom/Makefile.watcom @@ -0,0 +1,116 @@ +# libexpat Open Watcom Makefile (tested with libexpat 2.0.1) +# creates expat.dll and expat.lib import library +# watcomconfig.h - if provided - may contain additional macro definitions + +ccl = owcc +link = wlink +strip = wstrip +libman = wlib + +exeext = .exe +dllext = .dll +objext = .obj +libext = .lib + +incl = + +optimization = -O3 -mtune=i386 +# ^ adapt to your system architecture etc. +cflags = -shared -std=c99 -fno-short-enum $optimization +lstats = sys OS2V2_DLL +# ^ adapt to your system target + +defs = -DHAVE_MEMMOVE -DHAVE_BCOPY -DHAVE_GETPAGESIZE -DHAVE_MMAP -DSTDC_HEADERS +#defs += -DXML_DTD -DXML_NS +# ^ unrem to enable DTD parsing and XML namespaces + +manifest = xmlparse.c xmltok.c xmlrole.c +objects = $(manifest:.c=$objext) + +exports = & + XML_SetElementDeclHandler & + XML_SetAttlistDeclHandler & + XML_SetXmlDeclHandler & + XML_ParserCreate & + XML_ParserCreateNS & + XML_ParserCreate_MM & + XML_ParserReset & + XML_SetEntityDeclHandler & + XML_SetElementHandler & + XML_SetStartElementHandler & + XML_SetEndElementHandler & + XML_SetCharacterDataHandler & + XML_SetProcessingInstructionHandler & + XML_SetCommentHandler & + XML_SetCdataSectionHandler & + XML_SetStartCdataSectionHandler & + XML_SetEndCdataSectionHandler & + XML_SetDefaultHandler & + XML_SetDefaultHandlerExpand & + XML_SetDoctypeDeclHandler & + XML_SetStartDoctypeDeclHandler & + XML_SetEndDoctypeDeclHandler & + XML_SetUnparsedEntityDeclHandler & + XML_SetNotationDeclHandler & + XML_SetNamespaceDeclHandler & + XML_SetStartNamespaceDeclHandler & + XML_SetEndNamespaceDeclHandler & + XML_SetNotStandaloneHandler & + XML_SetExternalEntityRefHandler & + XML_SetExternalEntityRefHandlerArg & + XML_SetSkippedEntityHandler & + XML_SetUnknownEncodingHandler & + XML_DefaultCurrent & + XML_SetReturnNSTriplet & + XML_SetUserData & + XML_SetEncoding & + XML_UseParserAsHandlerArg & + XML_UseForeignDTD & + XML_SetBase & + XML_GetBase & + XML_GetSpecifiedAttributeCount & + XML_GetIdAttributeIndex & + XML_Parse & + XML_GetBuffer & + XML_ParseBuffer & + XML_StopParser & + XML_ResumeParser & + XML_GetParsingStatus & + XML_ExternalEntityParserCreate & + XML_SetParamEntityParsing & + XML_GetErrorCode & + XML_GetCurrentLineNumber & + XML_GetCurrentColumnNumber & + XML_GetCurrentByteIndex & + XML_GetCurrentByteCount & + XML_GetInputContext & + XML_FreeContentModel & + XML_MemMalloc & + XML_MemRealloc & + XML_MemFree & + XML_ParserFree & + XML_ErrorString & + XML_ExpatVersion & + XML_ExpatVersionInfo & + XML_GetFeatureList + +all : watcomconfig.h expat$libext .symbolic + +watcomconfig.h: + touch $^@ + +expat$libext : expat$dllext + $libman -n -b $^@ +$[@ + +expat$dllext : $objects + $link $lstats n $^@ f {$<} exp {$exports} + $strip -n $^@ +# ^ rem to disable debugging symbol stripping + +.c$objext: + $ccl $cflags $incl $defs -c -o $^@ $[@ + +clean: .symbolic + @for %i in ($objects expat$dllext expat$libext) do & + @if exist %i del %i + diff --git a/expat_watcom/expat_external.h b/expat_watcom/expat_external.h new file mode 100644 index 0000000..9961799 --- /dev/null +++ b/expat_watcom/expat_external.h @@ -0,0 +1,117 @@ +/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#ifndef Expat_External_INCLUDED +#define Expat_External_INCLUDED 1 + +/* External API definitions */ + +#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) +#define XML_USE_MSC_EXTENSIONS 1 +#endif + +/* Expat tries very hard to make the API boundary very specifically + defined. There are two macros defined to control this boundary; + each of these can be defined before including this header to + achieve some different behavior, but doing so it not recommended or + tested frequently. + + XMLCALL - The calling convention to use for all calls across the + "library boundary." This will default to cdecl, and + try really hard to tell the compiler that's what we + want. + + XMLIMPORT - Whatever magic is needed to note that a function is + to be imported from a dynamically loaded library + (.dll, .so, or .sl, depending on your platform). + + The XMLCALL macro was added in Expat 1.95.7. The only one which is + expected to be directly useful in client code is XMLCALL. + + Note that on at least some Unix versions, the Expat library must be + compiled with the cdecl calling convention as the default since + system headers may assume the cdecl convention. +*/ +#ifndef XMLCALL +#if defined(_MSC_VER) +#define XMLCALL __cdecl +#elif defined(__WATCOMC__) && defined(__OS2__) +#define XMLCALL __syscall +#elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER) +#define XMLCALL __attribute__((cdecl)) +#else +/* For any platform which uses this definition and supports more than + one calling convention, we need to extend this definition to + declare the convention used on that platform, if it's possible to + do so. + + If this is the case for your platform, please file a bug report + with information on how to identify your platform via the C + pre-processor and how to specify the same calling convention as the + platform's malloc() implementation. +*/ +#define XMLCALL +#endif +#endif /* not defined XMLCALL */ + + +#if !defined(XML_STATIC) && !defined(XMLIMPORT) +#ifndef XML_BUILDING_EXPAT +/* using Expat from an application */ + +#ifdef XML_USE_MSC_EXTENSIONS +#define XMLIMPORT __declspec(dllimport) +#endif + +#endif +#endif /* not defined XML_STATIC */ + + +/* If we didn't define it above, define it away: */ +#ifndef XMLIMPORT +#define XMLIMPORT +#endif + + +#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef XML_UNICODE_WCHAR_T +#define XML_UNICODE +#endif + +#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ +#ifdef XML_UNICODE_WCHAR_T +typedef wchar_t XML_Char; +typedef wchar_t XML_LChar; +#else +typedef unsigned short XML_Char; +typedef char XML_LChar; +#endif /* XML_UNICODE_WCHAR_T */ +#else /* Information is UTF-8 encoded. */ +typedef char XML_Char; +typedef char XML_LChar; +#endif /* XML_UNICODE */ + +#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ +#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 +typedef __int64 XML_Index; +typedef unsigned __int64 XML_Size; +#else +typedef long long XML_Index; +typedef unsigned long long XML_Size; +#endif +#else +typedef long XML_Index; +typedef unsigned long XML_Size; +#endif /* XML_LARGE_SIZE */ + +#ifdef __cplusplus +} +#endif + +#endif /* not Expat_External_INCLUDED */ diff --git a/samples/sample.xml b/samples/sample.xml new file mode 100644 index 0000000..71758d2 --- /dev/null +++ b/samples/sample.xml @@ -0,0 +1,25 @@ + + + + + 100 + + 23 + + 100 + + 23 + + true + +