From 7abf7dbc20e2ed47785930f03cfbaba538397703 Mon Sep 17 00:00:00 2001
From: Sojourner Truth <jon.w.wilkes@gmail.com>
Date: Sun, 24 Jul 2016 17:07:22 -0400
Subject: [PATCH] replace patch_name external with a simple abstraction

---
 l2ork_addons/patch_name/makefile      | 62 --------------------
 l2ork_addons/patch_name/patch_name.c  | 81 ---------------------------
 l2ork_addons/patch_name/patch_name.pd | 17 ++++++
 l2ork_addons/tar_em_up.sh             |  4 +-
 4 files changed, 18 insertions(+), 146 deletions(-)
 delete mode 100755 l2ork_addons/patch_name/makefile
 delete mode 100644 l2ork_addons/patch_name/patch_name.c
 create mode 100644 l2ork_addons/patch_name/patch_name.pd

diff --git a/l2ork_addons/patch_name/makefile b/l2ork_addons/patch_name/makefile
deleted file mode 100755
index d17100683..000000000
--- a/l2ork_addons/patch_name/makefile
+++ /dev/null
@@ -1,62 +0,0 @@
-NAME=patch_name
-SYM=patch_name
-
-# If you want to use a customized Pd, then define a $PD_PATH variable.
-# Otherwise, the Pd must be installed on the system
-PD_PATH=../../pd
-
-######################################################
-# You shouldn't need to change anything beyond here! #
-######################################################
-
-
-ifdef PD_PATH
-PD_INCLUDE := -I$(PD_PATH)/src
-PD_EXTRA_PATH := $(PD_PATH)/extra
-PD_DOC_PATH := $(PD_PATH)/doc
-else
-PD_INCLUDE := -I/usr/local/include
-PD_EXTRA_PATH := /usr/local/lib/pd/extra
-PD_DOC_PATH := /usr/local/lib/pd/doc
-endif
-
-# we just use the cwiid that comes with ubuntu/hardy
-# although the code still uses the cwiid_internal.h from the 
-# supplied source		
-LIBS =
-
-current: pd_linux
-
-##### LINUX:
-
-
-pd_linux: $(NAME).pd_linux
-
-.SUFFIXES: .pd_linux
-
-LINUXCFLAGS = -DPD -g -funroll-loops -fomit-frame-pointer \
-    -Wall -Wshadow -Wstrict-prototypes -fPIC
-
-.c.pd_linux:
-	cc $(LINUXCFLAGS) $(PD_INCLUDE) $(CWIID_INCLUDE) -o $*.o -c $*.c
-	ld --export-dynamic -shared -o $*.pd_linux $*.o $(LIBS) -lc -lm
-#strip --strip-unneeded $*.pd_linux 
-	rm -f $*.o
-
-install:
-
-ifdef ASCAPE_INSTALLED
-	-cp *help*.pd $(ASCAPE_PATH)/ss_engine/pd/help/.
-ifeq ($(findstring Linux,$(ASCAPE_OS)),Linux)
-	-cp *.pd_linux $(ASCAPE_PATH)/ss_engine/pd/externs/$(ASCAPE_OS)$(ASCAPE_ARCH)/.
-endif
-ifeq ($(findstring Darwin,$(SS_OS)),Darwin)
-	-cp *.pd_darwin $(ASCAPE_PATH)/ss_engine/pd/externs/$(ASCAPE_OS)$(ASCAPE_ARCH)/.
-endif
-endif
-
-	-cp *.pd_linux $(PD_EXTRA_PATH)/.
-	-cp *help*.pd $(PD_DOC_PATH)/.
-
-clean:
-	-rm -f *.o *.pd_* so_locations
diff --git a/l2ork_addons/patch_name/patch_name.c b/l2ork_addons/patch_name/patch_name.c
deleted file mode 100644
index 369f68a8e..000000000
--- a/l2ork_addons/patch_name/patch_name.c
+++ /dev/null
@@ -1,81 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <m_pd.h>
-#include "g_canvas.h"
-
-#define DEBUG(x)
-
-static t_class *patch_name_class;
-static t_canvas *canvas;
-
-typedef struct _patch_name
-{
-    t_object x_obj;
-    t_atom x_atom;
-	t_canvas *x_canvas;
-
-    t_symbol *x_patch_name;
-	t_symbol *x_patch_path;
-    t_symbol *x_remote_name;
-
-	t_outlet *x_outlet_path;
-	t_outlet *x_outlet_name;
-} t_patch_name;
-
-static void patch_name_bang(t_patch_name *x)
-{
-    char buf[MAXPDSTRING];
-
-    snprintf(buf, MAXPDSTRING, "%s", x->x_canvas->gl_name->s_name);
-    x->x_patch_name = gensym(buf);
-
-	snprintf(buf, MAXPDSTRING, "%s", canvas_getdir(x->x_canvas)->s_name);
-	x->x_patch_path = gensym(buf);
-
-    outlet_symbol(x->x_outlet_name, x->x_patch_name);
-	outlet_symbol(x->x_outlet_path,x->x_patch_path);
-}
-
-static void *patch_name_new(t_symbol *s, int argc, t_atom *argv)
-{
-    t_atom a;
-    if (argc == 0)
-    {
-        argc = 1;
-        SETFLOAT(&a, 0);
-        argv = &a;
-    }
-    t_patch_name *x = (t_patch_name *)pd_new(patch_name_class);
-    x->x_atom = *argv;
-	t_glist *glist=(t_glist *)canvas_getcurrent(); 
-	x->x_canvas=(t_canvas *)glist_getcanvas(glist);
-
-    if (argv->a_type == A_FLOAT)
-    {
-        int depth=(int)atom_getint(&x->x_atom);
-
-        if(depth<0)depth=0;
-        while(depth && x->x_canvas->gl_owner) {
-          x->x_canvas=x->x_canvas->gl_owner;
-          depth--;
-        }
-    }
-    else
-    {
-        x->x_remote_name = (t_symbol *)atom_getsymbol(&x->x_atom);
-    }
-    
-    x->x_outlet_path = outlet_new(&x->x_obj, &s_symbol);
-	x->x_outlet_name = outlet_new(&x->x_obj, &s_symbol);
-
-    return(x);
-}
-
-void patch_name_setup(void)
-{
-    patch_name_class = class_new(gensym("patch_name"), 
-        (t_newmethod)patch_name_new, NULL, 
-        sizeof(t_patch_name), 0, A_GIMME, 0);
-
-    class_addbang(patch_name_class, (t_method)patch_name_bang);
-}
diff --git a/l2ork_addons/patch_name/patch_name.pd b/l2ork_addons/patch_name/patch_name.pd
new file mode 100644
index 000000000..4c4a92d7a
--- /dev/null
+++ b/l2ork_addons/patch_name/patch_name.pd
@@ -0,0 +1,17 @@
+#N canvas 381 136 399 196 10;
+#X obj 68 39 inlet;
+#X obj 68 119 canvasinfo 1;
+#X obj 167 119 canvasinfo 1;
+#X obj 68 61 trigger bang bang;
+#X msg 167 91 filename;
+#X msg 68 91 dir;
+#X obj 68 141 outlet;
+#X obj 167 141 outlet;
+#X text 209 30 2016 Jonathan Wilkes;
+#X connect 0 0 3 0;
+#X connect 1 0 6 0;
+#X connect 2 0 7 0;
+#X connect 3 0 5 0;
+#X connect 3 1 4 0;
+#X connect 4 0 2 0;
+#X connect 5 0 1 0;
diff --git a/l2ork_addons/tar_em_up.sh b/l2ork_addons/tar_em_up.sh
index 2dab71f8e..460ce8405 100755
--- a/l2ork_addons/tar_em_up.sh
+++ b/l2ork_addons/tar_em_up.sh
@@ -273,9 +273,7 @@ then
 	mkdir -p ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra/images
 	# patch_name
 	cd ../../l2ork_addons/patch_name
-	make clean
-	make
-	cp -f patch_name.pd_linux ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
+	cp -f patch_name.pd ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
 	cp -f patch_name-help.pd ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
 	# disis_wiimote
 	cd ../disis_wiimote
-- 
GitLab