aboutsummaryrefslogtreecommitdiff
path: root/packages/patches/loaderHEX-0.39-1.patch
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-11-21 04:39:02 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-11-21 04:39:02 +0000
commitc67180156bb011ebe9a0524757052a28a6c62692 (patch)
treea0c3e3660a926a44c1254516338ac83cff0d05b2 /packages/patches/loaderHEX-0.39-1.patch
parent3382e067199abb3bb8fcb2044711910640a459c1 (diff)
Lots of changes, got the first complete(-ish) build with the new extended
build system. I left as much of the old functionality in place as possible, definitely were it was being used. But there are some changes that break backwards compatibility, thought they should be noticed by few, and be easy to fix going forward. Some highlights: - centralized patch system (packages/patches with targets patch_pd and unpatch_pd) - easily redirected builds, using INSTALL_PREFIX and all of the *_DEST variables. This makes building packages like Pd.app, .deb, .rpm, etc. much easier. - libdir format: basically a libdir is a directory that has both the objects and the help files together in one folder. It can be added using -lib or the StartUp preferences, or you can access them via geiger namespaces, i.e. [mylibrary/myobject]. - special characters allow in setup function/file names for objects. This makes objects like [||~] possible without having to be in a library. Now they can be either .pd files or individual .pd_darwin files (thanks IOhannes for the patch). svn path=/trunk/; revision=3993
Diffstat (limited to 'packages/patches/loaderHEX-0.39-1.patch')
-rw-r--r--packages/patches/loaderHEX-0.39-1.patch208
1 files changed, 208 insertions, 0 deletions
diff --git a/packages/patches/loaderHEX-0.39-1.patch b/packages/patches/loaderHEX-0.39-1.patch
new file mode 100644
index 00000000..d3656662
--- /dev/null
+++ b/packages/patches/loaderHEX-0.39-1.patch
@@ -0,0 +1,208 @@
+Index: m_class.c
+===================================================================
+RCS file: /cvsroot/pure-data/pd/src/m_class.c,v
+retrieving revision 1.4
+diff -u -w -r1.4 m_class.c
+--- m_class.c 28 Nov 2004 21:20:42 -0000 1.4
++++ m_class.c 17 Nov 2005 23:33:06 -0000
+@@ -16,6 +16,7 @@
+
+ #include <stdarg.h>
+ #include <string.h>
++#include <stdio.h>
+
+ static t_symbol *class_loadsym; /* name under which an extern is invoked */
+ static void pd_defaultfloat(t_pd *x, t_float f);
+@@ -513,6 +514,42 @@
+ t_symbol* pathsearch(t_symbol *s,char* ext);
+ int pd_setloadingabstraction(t_symbol *sym);
+
++
++/* replace everything but [a-zA-Z0-9_] by "0x%x" */
++static char*alternative_classname(char*classname)
++{
++ char *altname=(char*)getbytes(sizeof(char)*MAXPDSTRING);
++ int count=0;
++ int i=0;
++ for(i=0; i<MAXPDSTRING; i++)
++ altname[i]=0;
++ i=0;
++ while(*classname)
++ {
++ char c=*classname;
++ if((c>=48 && c<=57)|| /* [0-9] */
++ (c>=65 && c<=90)|| /* [A-Z] */
++ (c>=97 && c<=122)||/* [a-z] */
++ (c==95)) /* [_] */
++ {
++ altname[i]=c;
++ i++;
++ }
++ else /* a "bad" character */
++ {
++ sprintf(altname+i, "0x%02x", c);
++ i+=4;
++ count++;
++ }
++ classname++;
++ }
++ if(count>0)return altname;
++ /* seems like the given classname is fine as can be */
++ freebytes(altname, sizeof(char)*MAXPDSTRING);
++ return 0;
++}
++
++
+ /* this routine is called when a new "object" is requested whose class Pd
+ doesn't know. Pd tries to load it as an extern, then as an abstraction. */
+ void new_anything(void *dummy, t_symbol *s, int argc, t_atom *argv)
+@@ -521,10 +558,11 @@
+ t_symbol *dir = canvas_getcurrentdir();
+ int fd;
+ char dirbuf[MAXPDSTRING], *nameptr;
++ char *altname=alternative_classname(s->s_name);
+ if (tryingalready) return;
+ newest = 0;
+ class_loadsym = s;
+- if (sys_load_lib(dir->s_name, s->s_name))
++ if (sys_load_lib_alt(dir->s_name, s->s_name,altname))
+ {
+ tryingalready = 1;
+ typedmess(dummy, s, argc, argv);
+@@ -535,6 +573,8 @@
+ current = s__X.s_thing;
+ if ((fd = open_via_path(dir->s_name, s->s_name, ".pd",
+ dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0 ||
++ (altname && (fd = open_via_path(dir->s_name, altname, ".pd",
++ dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0) ||
+ (fd = open_via_path(dir->s_name, s->s_name, ".pat",
+ dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0)
+ {
+Index: s_loader.c
+===================================================================
+RCS file: /cvsroot/pure-data/pd/src/s_loader.c,v
+retrieving revision 1.6
+diff -u -w -r1.6 s_loader.c
+--- s_loader.c 30 May 2005 03:04:19 -0000 1.6
++++ s_loader.c 17 Nov 2005 23:33:07 -0000
+@@ -46,10 +46,11 @@
+
+ void class_set_extern_dir(t_symbol *s);
+
+-int sys_load_lib(char *dirname, char *classname)
++int sys_load_lib_alt(char *dirname, char *classname, char*altname)
+ {
+ char symname[MAXPDSTRING], filename[MAXPDSTRING], dirbuf[MAXPDSTRING],
+- classname2[MAXPDSTRING], *nameptr, *lastdot;
++ classname2[MAXPDSTRING], *nameptr, *lastdot,
++ altsymname[MAXPDSTRING];
+ void *dlobj;
+ t_xxx makeout = NULL;
+ int fd;
+@@ -72,6 +73,25 @@
+ if ((fd = open_via_path(dirname, classname2, sys_dllextent,
+ dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
+ {
++ /* next try (alternative_classname).(sys_dllextent) */
++ if(altname)
++ {
++ if ((fd = open_via_path(dirname, altname, sys_dllextent,
++ dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
++
++ /* next try (alternative_classname)/(alternative_classname).(sys_dllextent) ... */
++ strncpy(classname2, altname, MAXPDSTRING);
++ filename[MAXPDSTRING-2] = 0;
++ strcat(classname2, "/");
++ strncat(classname2, altname, MAXPDSTRING-strlen(classname2));
++ filename[MAXPDSTRING-1] = 0;
++ if ((fd = open_via_path(dirname, classname2, sys_dllextent,
++ dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
++ {
++ return 0;
++ }
++ }
++ else
+ return (0);
+ }
+ }
+@@ -93,9 +113,20 @@
+ #ifdef MACOSX
+ strcpy(symname, "_");
+ strcat(symname, nameptr);
++ if(altname)
++ {
++ strcpy(altsymname, "_setup_");
++ strcat(symname, altname);
++ }
+ #else
+ strcpy(symname, nameptr);
++ if(altname)
++ {
++ strcpy(altsymname, "setup_");
++ strcat(altsymname, altname);
++ }
+ #endif
++
+ /* if the last character is a tilde, replace with "_tilde" */
+ if (symname[strlen(symname) - 1] == '~')
+ strcpy(symname + (strlen(symname) - 1), "_tilde");
+@@ -110,6 +141,7 @@
+ return (0);
+ }
+ makeout = (t_xxx)dlsym(dlobj, symname);
++ if(!makeout)makeout = (t_xxx)dlsym(dlobj, altsymname);
+ #endif
+ #ifdef MSW
+ sys_bashfilename(filename, filename);
+@@ -121,6 +153,7 @@
+ return (0);
+ }
+ makeout = (t_xxx)GetProcAddress(ntdll, symname);
++ if(!makeout)makeout = (t_xxx)GetProcAddress(ntdll, altsymname);
+ #endif
+ #ifdef MACOSX
+ {
+@@ -147,6 +180,8 @@
+ }
+ s = NSLookupSymbolInModule(ret, symname);
+
++ if(!s)s=NSLookupSymbolInModule(ret, altsymname);
++
+ if (s)
+ makeout = (t_xxx)NSAddressOfSymbol( s);
+ else makeout = 0;
+@@ -156,6 +191,8 @@
+ if (!makeout)
+ {
+ post("load_object: Symbol \"%s\" not found", symname);
++ if(altname)
++ post("load_object: Symbol \"%s\" not found", altsymname);
+ class_set_extern_dir(&s_);
+ return 0;
+ }
+@@ -164,6 +201,10 @@
+ return (1);
+ }
+
++int sys_load_lib(char *dirname, char *filename)
++{
++ return sys_load_lib_alt(dirname, filename, 0);
++}
+
+
+
+Index: s_stuff.h
+===================================================================
+RCS file: /cvsroot/pure-data/pd/src/s_stuff.h,v
+retrieving revision 1.7
+diff -u -w -r1.7 s_stuff.h
+--- s_stuff.h 16 Jul 2005 01:43:18 -0000 1.7
++++ s_stuff.h 17 Nov 2005 23:33:07 -0000
+@@ -47,6 +47,7 @@
+
+ /* s_loader.c */
+ int sys_load_lib(char *dirname, char *filename);
++int sys_load_lib_alt(char *dirname, char *filename, char* altname);
+
+ /* s_audio.c */
+