From 6bf2f0bbaf013d3d6b99d76199a64e20f02c89c9 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Thu, 13 Nov 2014 20:21:13 -0500
Subject: [PATCH] *updated jasch_lib in hope it will address an error Albert
 pointed out during the launchpad build, updated pd-l2ork TODO for externals

---
 externals/jasch_lib/strlen/strlen.c |   2 +-
 externals/jasch_lib/strtok/strtok.c | 109 +++++++++++++++++++++++++++-
 externals/pd-l2ork-TODO.txt         |   3 +-
 3 files changed, 111 insertions(+), 3 deletions(-)

diff --git a/externals/jasch_lib/strlen/strlen.c b/externals/jasch_lib/strlen/strlen.c
index 67aab655f..87e09ebf3 100644
--- a/externals/jasch_lib/strlen/strlen.c
+++ b/externals/jasch_lib/strlen/strlen.c
@@ -1 +1 @@
-/*__________________________________________________________________________

	strlen     á      strlen c-string function
						
    Copyright (C) 2003 jan schacher

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    
    initial build 20030507
    
____________________________________________________________________________*/

#include "m_pd.h"
#include <strings.h>

typedef struct strlen 		
{
	t_object		ob;		
	void 			*s_outlet;
	float			s_length;	
} t_strlen;

void *strlen_class;
void *strlen_new(t_symbol *s, long n);
void strlen_anything(t_strlen *x, t_symbol *s, long argc, t_atom *argv);
void strlen_free(t_strlen *x);

void strlen_setup(void)
{	
	strlen_class = class_new(gensym("strlen"), (t_newmethod)strlen_new, 
			(t_method)strlen_free, sizeof(t_strlen), 0, A_GIMME, 0);
	class_addsymbol(strlen_class, (t_method)strlen_anything);
	post(".    strlen    .    jasch    .    "__DATE__" ",0);
}

void *strlen_new(t_symbol *s, long n)
{
	t_strlen	*x;
	x = (t_strlen *)pd_new(strlen_class);
	x->s_outlet = outlet_new(&x->ob, gensym("float"));
	return (x);									
}

void strlen_anything(t_strlen *x, t_symbol *s, long argc, t_atom *argv)
{
	x->s_length = strlen(s->s_name);
	outlet_float(x->s_outlet,x->s_length);
}

void strlen_free(t_strlen *x)
{
		// notify_free((t_object *)x);
}
\ No newline at end of file
+/*__________________________________________________________________________

	strlen     á      strlen c-string function
						
    Copyright (C) 2003 jan schacher

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    
    initial build 20030507
    
____________________________________________________________________________*/

#include "m_pd.h"
#include <string.h>

typedef struct strlen 		
{
	t_object		ob;		
	void 			*s_outlet;
	float			s_length;	
} t_strlen;

void *strlen_class;
void *strlen_new(t_symbol *s, long n);
void strlen_anything(t_strlen *x, t_symbol *s, long argc, t_atom *argv);
void strlen_free(t_strlen *x);

void strlen_setup(void)
{	
	strlen_class = class_new(gensym("strlen"), (t_newmethod)strlen_new, 
			(t_method)strlen_free, sizeof(t_strlen), 0, A_GIMME, 0);
	class_addsymbol(strlen_class, (t_method)strlen_anything);
	post(".    strlen    .    jasch    .    "__DATE__" ",0);
}

void *strlen_new(t_symbol *s, long n)
{
	t_strlen	*x;
	x = (t_strlen *)pd_new(strlen_class);
	x->s_outlet = outlet_new(&x->ob, gensym("float"));
	return (x);									
}

void strlen_anything(t_strlen *x, t_symbol *s, long argc, t_atom *argv)
{
	x->s_length = strlen(s->s_name);
	outlet_float(x->s_outlet,x->s_length);
}

void strlen_free(t_strlen *x)
{
		// notify_free((t_object *)x);
}
\ No newline at end of file
diff --git a/externals/jasch_lib/strtok/strtok.c b/externals/jasch_lib/strtok/strtok.c
index bdc72231c..3e529db73 100644
--- a/externals/jasch_lib/strtok/strtok.c
+++ b/externals/jasch_lib/strtok/strtok.c
@@ -1 +1,108 @@
-/*__________________________________________________________________________

	strtok     á      strtok c-string function wrapper
						
    Copyright (C) 2003 jan schacher
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    
    initial build 20030507
    
____________________________________________________________________________*/

#include "m_pd.h"
#include <strings.h>


typedef struct strtok 		
{
	t_object		ob;		
	void 			*s_outlet;	
	char 			s_tempstring[4096];
} t_strtok;

void *strtok_class;
void *strtok_new(t_symbol *s, long argc, t_atom *argv);
void strtok_free(t_strtok *x);
//void strtok_assist(t_strtok *x, void *b, long msg, long arg, char *dst);
void strtok_anything(t_strtok *x, t_symbol *s, long argc, t_atom *argv);
void strtok_set(t_strtok *x, t_symbol *s, long argc, t_atom *argv);

void strtok_setup(void)
{
	strtok_class = class_new(gensym("strtok"), (t_newmethod)strtok_new, 
		(t_method)strtok_free, sizeof(t_strtok), 0, A_GIMME, 0);
	class_addsymbol(strtok_class, (t_method)strtok_anything);
	class_addmethod(strtok_class, (t_method)strtok_set,		gensym("set"),	A_GIMME, 0);
	post(".    strtok    .    jasch    .    "__DATE__" ",0);
	
	
}

void *strtok_new(t_symbol *s, long argc, t_atom *argv)
{
	t_strtok	*x;
	x = (t_strtok *)pd_new(strtok_class);
	x->s_outlet = outlet_new(&x->ob, gensym("list"));
	if((argc >= 1)&&(argv[0].a_type == A_SYMBOL)){
		strcpy(x->s_tempstring, argv[0].a_w.w_symbol->s_name);
		// post("argument is %s", argv[0].a_w.w_symbol->s_name);
	}else{
		strcpy(x->s_tempstring, "/");
		// post("defualt-argument is %s", x->s_tempstring);
	}
	return (x);									
}

void strtok_anything(t_strtok *x, t_symbol *s, long argc, t_atom *argv)
{
	char 	*ptr;
	char	local[4096];
	long	status = 0;
	short	i, j;
	t_atom	result[256];
	t_atom  head;
	i = 0;
	
	strcpy(local, s->s_name);
  	ptr = strtok(local,x->s_tempstring);
  	while (ptr != NULL){
  	  	result[i].a_type = A_SYMBOL;
  	  	result[i].a_w.w_symbol = gensym(ptr);
	    ptr = strtok (NULL, x->s_tempstring);
	    i++;
  	}
  	j = i;
  	head.a_w.w_symbol = result[0].a_w.w_symbol;
  	for(j=0;j<i;j++) result[j] = result[j+1];
  	outlet_anything(x->s_outlet,head.a_w.w_symbol,i-1,result);
	return;
}

void strtok_set(t_strtok *x, t_symbol *s, long argc, t_atom *argv)
{
	switch (argv[0].a_type) {
		case A_FLOAT: error("wrong argument type for set");break;
		// case A_LONG:error("wrong argument type for set"); break;
		case A_SYMBOL: strcpy(x->s_tempstring, argv[0].a_w.w_symbol->s_name); break;
		}
}

void strtok_free(t_strtok *x)
{
		// notify_free((t_object *)x);
}
\ No newline at end of file
+/*__________________________________________________________________________
+
+	strtok     á      strtok c-string function wrapper
+						
+    Copyright (C) 2003 jan schacher
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+    
+    initial build 20030507
+    
+____________________________________________________________________________*/
+
+#include "m_pd.h"
+#include <string.h>
+
+
+typedef struct strtok 		
+{
+	t_object		ob;		
+	void 			*s_outlet;	
+	char 			s_tempstring[4096];
+} t_strtok;
+
+void *strtok_class;
+void *strtok_new(t_symbol *s, long argc, t_atom *argv);
+void strtok_free(t_strtok *x);
+//void strtok_assist(t_strtok *x, void *b, long msg, long arg, char *dst);
+void strtok_anything(t_strtok *x, t_symbol *s, long argc, t_atom *argv);
+void strtok_set(t_strtok *x, t_symbol *s, long argc, t_atom *argv);
+
+void strtok_setup(void)
+{
+	strtok_class = class_new(gensym("strtok"), (t_newmethod)strtok_new, 
+		(t_method)strtok_free, sizeof(t_strtok), 0, A_GIMME, 0);
+	class_addsymbol(strtok_class, (t_method)strtok_anything);
+	class_addmethod(strtok_class, (t_method)strtok_set,		gensym("set"),	A_GIMME, 0);
+	post(".    strtok    .    jasch    .    "__DATE__" ",0);
+	
+	
+}
+
+void *strtok_new(t_symbol *s, long argc, t_atom *argv)
+{
+	t_strtok	*x;
+	x = (t_strtok *)pd_new(strtok_class);
+	x->s_outlet = outlet_new(&x->ob, gensym("list"));
+	if((argc >= 1)&&(argv[0].a_type == A_SYMBOL)){
+		strcpy(x->s_tempstring, argv[0].a_w.w_symbol->s_name);
+		// post("argument is %s", argv[0].a_w.w_symbol->s_name);
+	}else{
+		strcpy(x->s_tempstring, "/");
+		// post("defualt-argument is %s", x->s_tempstring);
+	}
+	return (x);									
+}
+
+void strtok_anything(t_strtok *x, t_symbol *s, long argc, t_atom *argv)
+{
+	char 	*ptr;
+	char	local[4096];
+	long	status = 0;
+	short	i, j;
+	t_atom	result[256];
+	t_atom  head;
+	i = 0;
+	
+	strcpy(local, s->s_name);
+  	ptr = strtok(local,x->s_tempstring);
+  	while (ptr != NULL){
+  	  	result[i].a_type = A_SYMBOL;
+  	  	result[i].a_w.w_symbol = gensym(ptr);
+	    ptr = strtok (NULL, x->s_tempstring);
+	    i++;
+  	}
+  	j = i;
+  	head.a_w.w_symbol = result[0].a_w.w_symbol;
+  	for(j=0;j<i;j++) result[j] = result[j+1];
+  	outlet_anything(x->s_outlet,head.a_w.w_symbol,i-1,result);
+	return;
+}
+
+void strtok_set(t_strtok *x, t_symbol *s, long argc, t_atom *argv)
+{
+	switch (argv[0].a_type) {
+		case A_FLOAT: error("wrong argument type for set");break;
+		// case A_LONG:error("wrong argument type for set"); break;
+		case A_SYMBOL: strcpy(x->s_tempstring, argv[0].a_w.w_symbol->s_name); break;
+		}
+}
+
+void strtok_free(t_strtok *x)
+{
+		// notify_free((t_object *)x);
+}
+
+
diff --git a/externals/pd-l2ork-TODO.txt b/externals/pd-l2ork-TODO.txt
index 5a1da76da..a4d01aa53 100644
--- a/externals/pd-l2ork-TODO.txt
+++ b/externals/pd-l2ork-TODO.txt
@@ -1,5 +1,5 @@
 Diff status between pd-l2ork externals source tree and main community pd svn
-AS OF October 8, 2014
+AS OF November 14, 2014
 
 DONE: (*denotes unique changes)
 creb
@@ -7,6 +7,7 @@ flatgui (disabled, as all externals have various problems)
 gem2pdp
 hcs
 iemlib
+jasch_lib
 markex
 maxli4
 moonlib
-- 
GitLab