[PD-cvs] SF.net SVN: pure-data: [9883] trunk/externals/pdvjtools/pdp_freeframe

eighthave at users.sourceforge.net eighthave at users.sourceforge.net
Sat May 24 02:05:54 CEST 2008


Revision: 9883
          http://pure-data.svn.sourceforge.net/pure-data/?rev=9883&view=rev
Author:   eighthave
Date:     2008-05-23 17:05:54 -0700 (Fri, 23 May 2008)

Log Message:
-----------
store plugindir as symbol in object's struct and use that with [plugindir( message; ported to Mac OS X

Modified Paths:
--------------
    trunk/externals/pdvjtools/pdp_freeframe/FreeFrame.h
    trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c

Modified: trunk/externals/pdvjtools/pdp_freeframe/FreeFrame.h
===================================================================
--- trunk/externals/pdvjtools/pdp_freeframe/FreeFrame.h	2008-05-23 23:47:25 UTC (rev 9882)
+++ trunk/externals/pdvjtools/pdp_freeframe/FreeFrame.h	2008-05-24 00:05:54 UTC (rev 9883)
@@ -51,7 +51,7 @@
  *	includes
  */
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #if _MSC_VER > 1000
 #pragma once
@@ -60,17 +60,12 @@
 #define WIN32_LEAN_AND_MEAN		/* Exclude rarely-used stuff from Windows headers */
 #include <windows.h>
 
-#elif defined LINUX
+#elif defined(__linux__) || defined(__APPLE__)
 
 typedef unsigned int DWORD;
 typedef void *LPVOID;
 typedef unsigned char BYTE;
 
-#elif defined MACOS
-
-typedef unsigned int DWORD;
-typedef unsigned char BYTE;
-
 #endif
 
 
@@ -207,7 +202,7 @@
  *
  */
 
-#ifdef WIN32
+#ifdef _WIN32
 
 BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, DWORD lpReserved );
 
@@ -215,12 +210,12 @@
 
 typedef __declspec(dllimport) LPVOID (__stdcall *FF_Main_FuncPtr)(DWORD, LPVOID, DWORD);
 
-#elif LINUX
+#elif __linux__
 
 plugMainUnion plugMain(DWORD functionCode, LPVOID pParam, DWORD reserved);
 
 
-#elif MACOS
+#elif __APPLE__
 
 typedef LPVOID (*FF_Main_FuncPtr)(DWORD, LPVOID, DWORD);
 

Modified: trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c
===================================================================
--- trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c	2008-05-23 23:47:25 UTC (rev 9882)
+++ trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c	2008-05-24 00:05:54 UTC (rev 9883)
@@ -70,6 +70,7 @@
     int x_plugin; 
     int x_infosok; 
     char x_pdetails[FREEFRAME_PARAM_DETAILS_LENGTH]; 
+    t_symbol *plugindir;
 
     PLUGIN *plugins;
     
@@ -188,6 +189,12 @@
     x->plugins = NULL;
 }
 
+static void pdp_freeframe_plugindir(t_pdp_freeframe *x, t_symbol *s)
+{
+    x->plugindir = s;
+    ff_loadplugins(x, x->plugindir);
+}
+
 static void pdp_freeframe_process_rgb(t_pdp_freeframe *x)
 {
     t_pdp     *header = pdp_packet_header(x->x_packet0);
@@ -213,7 +220,7 @@
     	x->x_size = x->x_width*x->x_height;
     
     	//load the plugins
-    	ff_loadplugins(x, FF_PLUGIN_DIR);
+        ff_loadplugins(x, x->plugindir);
     }
     
     newheader->info.image.encoding = header->info.image.encoding;
@@ -429,8 +436,20 @@
     //load the plugins
     x->x_plugin_count = 0;
     x->x_infosok = 0;
-    //ff_loadplugins(x, FF_PLUGIN_DIR);
 
+    char ff_plugin_dir[FILENAME_MAX];
+    char *home = getenv("HOME");
+    int home_len;
+    if(home != NULL)
+    {
+        home_len = strlen(home);
+        if(home_len >= FILENAME_MAX)
+            home_len = FILENAME_MAX - 1;
+        memcpy(ff_plugin_dir, home, home_len);
+        ff_plugin_dir[home_len] = '\0';
+        strncpy(ff_plugin_dir, "/.frf", FILENAME_MAX - home_len);
+        pdp_freeframe_plugindir(x, gensym(ff_plugin_dir));
+    }
     pdp_freeframe_plugin(x, f);
 
     return (void *)x;
@@ -453,7 +472,7 @@
     class_addmethod(pdp_freeframe_class, (t_method)pdp_freeframe_input_0, gensym("pdp"),  A_SYMBOL, A_DEFFLOAT, A_NULL);
     class_addmethod(pdp_freeframe_class, (t_method)pdp_freeframe_plugin, gensym("plugin"),  A_FLOAT, A_NULL);   
     class_addmethod(pdp_freeframe_class, (t_method)pdp_freeframe_param, gensym("param"),  A_FLOAT, A_FLOAT, A_NULL);   
-    class_addmethod(pdp_freeframe_class, (t_method)ff_loadplugins, gensym("plugindir"),  A_SYMBOL, A_NULL);   
+    class_addmethod(pdp_freeframe_class, (t_method)pdp_freeframe_plugindir, gensym("plugindir"),  A_SYMBOL, A_NULL);   
 
 
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Pd-cvs mailing list