Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Commit [e1c955] Maximize Restore History

portmidi to version 217 (2010-10-08)

Miller Puckette Miller Puckette 2013-06-19

<< < 1 2 (Page 2 of 2)
added portmidi/pm_mac/finddefault.c
added portmidi/pm_mac/readbinaryplist.c
removed portmidi/pm_win/copy-dll.bat
removed portmidi/pm_win/debugging_dlls.txt
changed portmidi
changed portmidi/CHANGELOG.txt
changed portmidi/README.txt
changed portmidi/license.txt
changed portmidi/pm_common
changed portmidi/pm_common/pminternal.h
changed portmidi/pm_common/pmutil.c
changed portmidi/pm_common/pmutil.h
changed portmidi/pm_common/portmidi.c
changed portmidi/pm_common/portmidi.h
changed portmidi/pm_linux
changed portmidi/pm_linux/README_LINUX.txt
changed portmidi/pm_linux/pmlinux.c
changed portmidi/pm_linux/pmlinuxalsa.c
changed portmidi/pm_mac
changed portmidi/pm_mac/pmmac.c
changed portmidi/pm_mac/pmmacosxcm.c
changed portmidi/pm_mac/pmmacosxcm.h
changed portmidi/pm_win
changed portmidi/pm_win/README_WIN.txt
changed portmidi/pm_win/pmwin.c
changed portmidi/pm_win/pmwinmm.c
changed portmidi/porttime
changed portmidi/porttime/porttime.h
changed portmidi/porttime/ptlinux.c
changed portmidi/porttime/ptmacosx_cf.c
changed portmidi/porttime/ptmacosx_mach.c
changed portmidi/porttime/ptwinmm.c
changed src
changed src/makefile.mac
changed src/notes.txt
copied portmidi/pm_win/pm_dll.dsp -> portmidi/pm_linux/finddefault.c
copied portmidi/porttime/porttime.dsp -> portmidi/pm_mac/readbinaryplist.h
portmidi/pm_mac/finddefault.c Diff Switch to side-by-side view
Loading...
portmidi/pm_mac/readbinaryplist.c Diff Switch to side-by-side view
Loading...
portmidi/pm_win/copy-dll.bat
File was removed.
portmidi
Directory.
portmidi/CHANGELOG.txt Diff Switch to side-by-side view
Loading...
portmidi/README.txt Diff Switch to side-by-side view
Loading...
portmidi/license.txt Diff Switch to side-by-side view
Loading...
portmidi/pm_common
Directory.
portmidi/pm_common/pminternal.h Diff Switch to side-by-side view
Loading...
portmidi/pm_common/pmutil.c Diff Switch to side-by-side view
Loading...
portmidi/pm_common/pmutil.h Diff Switch to side-by-side view
Loading...
portmidi/pm_common/portmidi.c Diff Switch to side-by-side view
Loading...
portmidi/pm_common/portmidi.h Diff Switch to side-by-side view
Loading...
portmidi/pm_linux
Directory.
portmidi/pm_linux/README_LINUX.txt Diff Switch to side-by-side view
Loading...
portmidi/pm_linux/pmlinux.c Diff Switch to side-by-side view
Loading...
portmidi/pm_linux/pmlinuxalsa.c Diff Switch to side-by-side view
Loading...
portmidi/pm_mac
Directory.
portmidi/pm_mac/pmmac.c Diff Switch to side-by-side view
Loading...
portmidi/pm_mac/pmmacosxcm.c Diff Switch to side-by-side view
Loading...
portmidi/pm_mac/pmmacosxcm.h Diff Switch to side-by-side view
Loading...
portmidi/pm_win
Directory.
portmidi/pm_win/README_WIN.txt Diff Switch to side-by-side view
Loading...
portmidi/pm_win/pmwin.c Diff Switch to side-by-side view
Loading...
portmidi/pm_win/pmwinmm.c Diff Switch to side-by-side view
Loading...
portmidi/porttime
Directory.
portmidi/porttime/porttime.h Diff Switch to side-by-side view
Loading...
portmidi/porttime/ptlinux.c Diff Switch to side-by-side view
Loading...
portmidi/porttime/ptmacosx_cf.c Diff Switch to side-by-side view
Loading...
portmidi/porttime/ptmacosx_mach.c Diff Switch to side-by-side view
Loading...
portmidi/porttime/ptwinmm.c Diff Switch to side-by-side view
Loading...
src
Directory.
src/makefile.mac Diff Switch to side-by-side view
Loading...
src/notes.txt Diff Switch to side-by-side view
Loading...
portmidi/pm_win/pm_dll.dsp to portmidi/pm_linux/finddefault.c
--- a/portmidi/pm_win/pm_dll.dsp
+++ b/portmidi/pm_linux/finddefault.c
@@ -1,107 +1,92 @@
-# Microsoft Developer Studio Project File - Name="pm_dll" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=pm_dll - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "pm_dll.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "pm_dll.mak" CFG="pm_dll - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "pm_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "pm_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "pm_dll - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# 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 "PM_DLL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PM_DLL_EXPORTS" /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"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 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
-
-!ELSEIF  "$(CFG)" == "pm_dll - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PM_DLL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "pm_common" /D "_WINDOWS" /D "_USRDLL" /D "PM_DLL_EXPORTS" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "USE_DLL_FOR_CLEANUP" /FR /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"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "pm_dll - Win32 Release"
-# Name "pm_dll - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\pmdll.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\pmdll.h
-# End Source File
-# End Group
-# End Target
-# End Project
+/* finddefault.c -- find_default_device() implementation
+   Roger Dannenberg, Jan 2009
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "portmidi.h"
+
+#define STRING_MAX 256
+
+/* skip over spaces, return first non-space */
+void skip_spaces(FILE *inf)
+{
+    char c;
+    while (isspace(c = getc(inf))) ;
+    ungetc(c, inf);
+}
+
+/* trim leading spaces and match a string */
+int match_string(FILE *inf, char *s)
+{
+    skip_spaces(inf);
+    while (*s && *s == getc(inf)) s++;
+    return (*s == 0);
+} 
+
+
+/* 
+/* Parse preference files, find default device, search devices --
+ */
+PmDeviceID find_default_device(char *path, int input, PmDeviceID id)
+/* path -- the name of the preference we are searching for
+   input -- true iff this is an input device
+   id -- current default device id
+   returns matching device id if found, otherwise id
+*/
+{
+    static char *pref_2 = "/.java/.userPrefs/";
+    static char *pref_3 = "prefs.xml";
+    char *pref_1 = getenv("HOME");
+    char *full_name, *path_ptr;
+    FILE *inf;
+    int c, i;
+    if (!pref_1) goto nopref; // cannot find preference file
+    // full_name will be larger than necessary
+    full_name  = malloc(strlen(pref_1) + strlen(pref_2) + strlen(pref_3) +
+                        strlen(path) + 2);
+    strcpy(full_name, pref_1); 
+    strcat(full_name, pref_2);
+    // copy all but last path segment to full_name
+    if (*path == '/') path++; // skip initial slash in path
+    path_ptr = strrchr(path, '/'); 
+    if (path_ptr) { // copy up to slash after full_name
+        path_ptr++;
+        int offset = strlen(full_name);
+        memcpy(full_name + offset, path, path_ptr - path);
+        full_name[offset + path_ptr - path] = 0; // end of string
+    } else {
+        path_ptr = path;
+    }
+    strcat(full_name, pref_3);
+    inf = fopen(full_name, "r");
+    if (!inf) goto nopref; // cannot open preference file
+    // We're not going to build or link in a full XML parser.
+    // Instead, find the path string and quoute. Then, look for
+    // "value", "=", quote. Then get string up to quote.
+    while ((c = getc(inf)) != EOF) {
+        char pref_str[STRING_MAX];
+        if (c != '"') continue; // scan up to quote
+        // look for quote string quote
+        if (!match_string(inf, path_ptr)) continue; // path not found
+        if (getc(inf) != '"') continue; // path not found, keep scanning
+        if (!match_string(inf, "value")) goto nopref; // value not found
+        if (!match_string(inf, "=")) goto nopref; // = not found
+        if (!match_string(inf, "\"")) goto nopref; // quote not found
+        // now read the value up to the close quote
+        for (i = 0; i < STRING_MAX; i++) {
+            if ((c = getc(inf)) == '"') break;
+            pref_str[i] = c;
+        }
+        if (i == STRING_MAX) continue; // value too long, ignore
+        pref_str[i] == 0;
+        i = pm_find_default_device(pref_str, input);
+        if (i != pmNoDevice) {
+            id = i;
+	}
+        break;
+    }
+ nopref:
+    return id;
+}
portmidi/porttime/porttime.dsp to portmidi/pm_mac/readbinaryplist.h
--- a/portmidi/porttime/porttime.dsp
+++ b/portmidi/pm_mac/readbinaryplist.h
@@ -1,104 +1,88 @@
-# Microsoft Developer Studio Project File - Name="porttime" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=porttime - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "porttime.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "porttime.mak" CFG="porttime - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "porttime - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "porttime - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "porttime - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF  "$(CFG)" == "porttime - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_LIB" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "USE_DLL_FOR_CLEANUP" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF 
-
-# Begin Target
-
-# Name "porttime - Win32 Release"
-# Name "porttime - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\porttime.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ptwinmm.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\porttime.h
-# End Source File
-# End Group
-# End Target
-# End Project
+/* readbinaryplist.h -- header to read preference files
+
+   Roger B. Dannenberg, Jun 2008
+*/
+
+#include <stdint.h> /* for uint8_t ... */
+
+#ifndef TRUE
+    #define TRUE 1
+    #define FALSE 0
+#endif
+
+#define MAX_KEY_SIZE 256
+
+enum
+{
+    // Object tags (high nybble)
+    kTAG_SIMPLE = 0x00,        // Null, true, false, filler, or invalid
+    kTAG_INT = 0x10,
+    kTAG_REAL = 0x20,
+    kTAG_DATE = 0x30,
+    kTAG_DATA = 0x40,
+    kTAG_ASCIISTRING = 0x50,
+    kTAG_UNICODESTRING = 0x60,
+    kTAG_UID = 0x80,
+    kTAG_ARRAY = 0xA0,
+    kTAG_DICTIONARY = 0xD0,
+    
+    // "simple" object values
+    kVALUE_NULL = 0x00,
+    kVALUE_FALSE = 0x08,
+    kVALUE_TRUE = 0x09,
+    kVALUE_FILLER = 0x0F,
+    
+    kVALUE_FULLDATETAG = 0x33        // Dates are tagged with a whole byte.
+};
+
+
+typedef struct pldata_struct {
+    uint8_t *data;
+    size_t len;
+} pldata_node, *pldata_ptr;
+
+
+typedef struct array_struct {
+    struct value_struct **array;
+    uint64_t length;
+} array_node, *array_ptr;
+
+
+// a dict_node is a list of <key, value> pairs
+typedef struct dict_struct {
+    struct value_struct *key;
+    struct value_struct *value;
+    struct dict_struct *next;
+} dict_node, *dict_ptr;
+
+
+// an value_node is a value with a tag telling the type
+typedef struct value_struct {
+    int tag;
+    union {
+        int64_t integer;
+        uint64_t uinteger;
+        double real;
+        char *string;
+        pldata_ptr data;
+        array_ptr array;
+        struct dict_struct *dict;
+    };
+} value_node, *value_ptr;
+
+
+value_ptr bplist_read_file(char *filename);
+value_ptr bplist_read_user_pref(char *filename);
+value_ptr bplist_read_system_pref(char *filename);
+void bplist_free_data();
+
+/*************** functions for accessing values ****************/
+
+char *value_get_asciistring(value_ptr v);
+value_ptr value_dict_lookup_using_string(value_ptr v, char *key);
+value_ptr value_dict_lookup_using_path(value_ptr v, char *path);
+
+/*************** functions for debugging ***************/
+
+void plist_print(value_ptr v);
+
<< < 1 2 (Page 2 of 2)