Update of /cvsroot/pure-data/externals/hcs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28410
Modified Files: TODO folder_list.c Added Files: split_path.c split_path-help.pd Log Message: wrote [strip_path] to separate path from filename, and to handle filenames without paths properly; added instance counters so that the version is only displayed on the first instantiation
Index: folder_list.c =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/folder_list.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** folder_list.c 27 Mar 2006 03:16:14 -0000 1.8 --- folder_list.c 8 Apr 2006 23:48:38 -0000 1.9 *************** *** 37,40 **** --- 37,42 ---- static char *version = "$Revision$";
+ t_int folder_list_instance_count; + #define DEBUG(x) //#define DEBUG(x) x *************** *** 164,169 **** t_folder_list *x = (t_folder_list *)pd_new(folder_list_class); ! post("[folder_list] %s",version); ! post("\twritten by Hans-Christoph Steiner hans@at.or.at"); /* TODO set current dir of patch as default */ #ifdef _WIN32 --- 166,176 ---- t_folder_list *x = (t_folder_list *)pd_new(folder_list_class); ! if(!folder_list_instance_count) ! { ! post("[folder_list] %s",version); ! post("\twritten by Hans-Christoph Steiner hans@at.or.at"); ! } ! folder_list_instance_count++; ! /* TODO set current dir of patch as default */ #ifdef _WIN32
Index: TODO =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/TODO,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TODO 26 Mar 2006 23:48:04 -0000 1.4 --- TODO 8 Apr 2006 23:48:38 -0000 1.5 *************** *** 1,3 **** --- 1,5 ----
+ - rename [folder_list] to [file/match] and make other file lib objects + - make [file/match] handle lists of patterns
- write [version] object
--- NEW FILE: split_path-help.pd --- #N canvas 0 22 458 308 10; #X obj 111 141 split_path; #X symbolatom 111 201 0 0 0 3 path - -; #X symbolatom 175 165 0 0 0 3 filename - -; #X msg 80 43 symbol just-a-file.pd; #X msg 108 71 symbol /path/to/a/file; #X obj 95 161 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 159 160 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X connect 0 0 1 0; #X connect 0 0 5 0; #X connect 0 1 2 0; #X connect 0 1 6 0; #X connect 3 0 0 0; #X connect 4 0 0 0;
--- NEW FILE: split_path.c --- /* (C) Guenter Geiger geiger@epy.co.at */
/* I started with stripdir.c and turned it into split_path.c hans@at.or.at */
#include <m_pd.h> #include <string.h> #include <sys/param.h>
#ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif
static char *version = "$Revision: 1.1 $";
t_int strip_path_instance_count;
/* ------------------------ split_path ----------------------------- */
static t_class *split_path_class;
typedef struct _split_path { t_object x_obj; t_outlet *x_path_outlet; t_outlet *x_filename_outlet; } t_split_path;
void split_path_symbol(t_split_path *x, t_symbol *s) { int length = strlen(s->s_name); char path_buffer[MAXPATHLEN] = ""; while (length--) if (*(s->s_name + length) == '/') break; if (length < MAXPATHLEN) outlet_symbol(x->x_filename_outlet,gensym(s->s_name + length + 1)); else error("[split_path] filename name too long. The limit is %d characters",MAXPATHLEN); while (length > 0) { length--; if(*(s->s_name + length) != '/') break; } if (length < MAXPATHLEN) { strncpy(path_buffer, s->s_name, length + 1); outlet_symbol(x->x_path_outlet,gensym(path_buffer)); } else { error("[split_path] path name too long. The limit is %d characters",MAXPATHLEN); } }
static void *split_path_new() { t_split_path *x = (t_split_path *)pd_new(split_path_class); x->x_path_outlet = (t_outlet *)outlet_new(&x->x_obj, &s_symbol); x->x_filename_outlet = (t_outlet *)outlet_new(&x->x_obj, &s_symbol); if(!strip_path_instance_count) { post("[strip_path] %s",version); post("\twritten by Hans-Christoph Steiner hans@at.or.at"); } strip_path_instance_count++; return (x); }
void split_path_setup(void) { split_path_class = class_new(gensym("split_path"), (t_newmethod)split_path_new, 0, sizeof(t_split_path), 0,0); class_addsymbol(split_path_class,split_path_symbol); }