From f9d32c165a873bab44967fa4b069a7945ecb6f7f Mon Sep 17 00:00:00 2001 From: Thomas O Fredericks Date: Fri, 25 Sep 2009 15:43:37 +0000 Subject: Added the openHelp external to tof svn path=/trunk/externals/tof/; revision=12450 --- help/openHelp-help.pd | 15 ++++++++ src/Makefile | 58 ++++++++--------------------- src/oldMakefile | 61 ++++++++++++++++++++++++++++++ src/openHelp.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 191 insertions(+), 43 deletions(-) create mode 100644 help/openHelp-help.pd mode change 100755 => 100644 src/Makefile create mode 100755 src/oldMakefile create mode 100644 src/openHelp.c diff --git a/help/openHelp-help.pd b/help/openHelp-help.pd new file mode 100644 index 0000000..76fda5b --- /dev/null +++ b/help/openHelp-help.pd @@ -0,0 +1,15 @@ +#N canvas 125 137 619 503 10; +#X obj 77 335 openHelp; +#X msg 77 213 symbol list; +#X msg 157 247 symbol until; +#X obj -1 29 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577 +0; +#X text 4 85 author: mrtoftrash@gmail.com; +#X text 4 28 description: searches for and tries to open an externals +help file.; +#X text 3 70 tags: file help; +#X text 4 106 version: 2009-09-25 (initial release); +#X msg 178 298 symbol zexy/list2symbol; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 8 0 0 0; diff --git a/src/Makefile b/src/Makefile old mode 100755 new mode 100644 index fcdb2a4..8d83e14 --- a/src/Makefile +++ b/src/Makefile @@ -1,37 +1,22 @@ -current: - echo make pd_linux, pd_win, or pd_darwin - -clean: ; rm -f *.pd_linux *.o - -# ----------------------- WINDOWS ----------------------- - -pd_win: breakpoints.dll breakpoints~.dll destroysend.dll folderpanel.dll getdollarzero.dll phasorshot~.dll - -.SUFFIXES: .dll +PARAM: param paramDump paramRoute paramFile -WINCFLAGS = -Wall -W -Wshadow -Wstrict-prototypes -DPD -DNT -W3 -WX -Wno-unused -mms-bitfields -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer - -WINPDPATH = /d/pd/bin - -WININCLUDE = -I.. -I../include -I$(WINPDPATH)/src - -LDFLAGS = -shared - -.c.dll: - gcc -mms-bitfields $(WINCFLAGS) $(WININCLUDE) -o $*.o -c $*.c - gcc $(LDFLAGS) -o $*.dll $*.o $(WINPDPATH)/bin/pd.dll - strip --strip-unneeded $*.dll - rm -f $*.o - +current: + echo make pd_linux +clean: + rm -f *.pd_linux *.o # ----------------------- LINUX i386 ----------------------- -pd_linux: breakpoints.pd_linux breakpoints~.pd_linux destroysend.pd_linux folderpanel.pd_linux getdollarzero.pd_linux phasorshot~.pd_linux +#paramL: param.pd_linux + +#patchArguments: patchArguments.pd_linux .SUFFIXES: .pd_linux -PDPATH = /home/tom/pd/cvs/pd +PDPATH = ../../../pd + +TOFPATH = ../src LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \ -Wall -W -Wshadow -Wstrict-prototypes \ @@ -39,23 +24,10 @@ LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \ LINUXINCLUDE = -I$(PDPATH)/src -.c.pd_linux: - cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c +#.pd_linux: .c + +.c: + cc $(LINUXCFLAGS) $(LINUXINCLUDE) -I $(TOFPATH) -o $*.o -c $*.c ld --export-dynamic -shared -o $*.pd_linux $*.o -lc -lm strip --strip-unneeded $*.pd_linux rm $*.o - -# ----------------------- Mac OSX ----------------------- - -pd_darwin: breakpoints~.pd_darwin breakpoints.pd_darwin destroysend.pd_darwin folderpanel.pd_darwin getdollarzero.pd_darwin .pd_darwin - -.SUFFIXES: .pd_darwin - -DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \ - -Wno-unused -Wno-parentheses -Wno-switch - -.c.pd_darwin: - cc $(DARWINCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c - cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o - rm -f $*.o - diff --git a/src/oldMakefile b/src/oldMakefile new file mode 100755 index 0000000..fcdb2a4 --- /dev/null +++ b/src/oldMakefile @@ -0,0 +1,61 @@ +current: + echo make pd_linux, pd_win, or pd_darwin + +clean: ; rm -f *.pd_linux *.o + +# ----------------------- WINDOWS ----------------------- + +pd_win: breakpoints.dll breakpoints~.dll destroysend.dll folderpanel.dll getdollarzero.dll phasorshot~.dll + +.SUFFIXES: .dll + +WINCFLAGS = -Wall -W -Wshadow -Wstrict-prototypes -DPD -DNT -W3 -WX -Wno-unused -mms-bitfields -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer + +WINPDPATH = /d/pd/bin + +WININCLUDE = -I.. -I../include -I$(WINPDPATH)/src + +LDFLAGS = -shared + +.c.dll: + gcc -mms-bitfields $(WINCFLAGS) $(WININCLUDE) -o $*.o -c $*.c + gcc $(LDFLAGS) -o $*.dll $*.o $(WINPDPATH)/bin/pd.dll + strip --strip-unneeded $*.dll + rm -f $*.o + + + +# ----------------------- LINUX i386 ----------------------- + +pd_linux: breakpoints.pd_linux breakpoints~.pd_linux destroysend.pd_linux folderpanel.pd_linux getdollarzero.pd_linux phasorshot~.pd_linux + +.SUFFIXES: .pd_linux + +PDPATH = /home/tom/pd/cvs/pd + +LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \ + -Wall -W -Wshadow -Wstrict-prototypes \ + -Wno-unused -Wno-parentheses -Wno-switch + +LINUXINCLUDE = -I$(PDPATH)/src + +.c.pd_linux: + cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c + ld --export-dynamic -shared -o $*.pd_linux $*.o -lc -lm + strip --strip-unneeded $*.pd_linux + rm $*.o + +# ----------------------- Mac OSX ----------------------- + +pd_darwin: breakpoints~.pd_darwin breakpoints.pd_darwin destroysend.pd_darwin folderpanel.pd_darwin getdollarzero.pd_darwin .pd_darwin + +.SUFFIXES: .pd_darwin + +DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \ + -Wno-unused -Wno-parentheses -Wno-switch + +.c.pd_darwin: + cc $(DARWINCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c + cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o + rm -f $*.o + diff --git a/src/openHelp.c b/src/openHelp.c new file mode 100644 index 0000000..d2d6810 --- /dev/null +++ b/src/openHelp.c @@ -0,0 +1,100 @@ + + +#include "tof.h" + + +EXTERN void open_via_helppath(const char *name, const char *dir); + +static t_class *openHelp_class; + + + + +typedef struct _openHelp { + t_object x_obj; + char buffer[MAXPDSTRING]; + //t_outlet* outlet1; + //t_canvas* canvas; + t_symbol* dir; + +} t_openHelp; + + + +/* +// BANG: output the current root path +static void openHelp_bang(t_openHelp *x) { + + outlet_symbol(x->outlet1, x->dir ); + +} +*/ + +//int canvas_open(t_canvas *x, const char *name, const char *ext, +// char *dirresult, char **nameresult, unsigned int size, int bin) + + +static void openHelp_symbol(t_openHelp *x, t_symbol *s) { + + + //int length = tof_anything_to_string(s,ac,av,tof_buf_temp_a); + //strcat(tof_buf_temp_a,".pd"); + int length = strlen(s->s_name) + 4; + char* name = getbytes(sizeof(*name)*length); + strcpy(name,s->s_name); + strcat(name,".pd"); + open_via_helppath(name, x->dir->s_name); + freebytes(name, length * sizeof *name ); + + + } + + + + +static void openHelp_free(t_openHelp *x) +{ + + //binbuf_free(x->binbuf); + +} + +void *openHelp_new(t_symbol *s, int argc, t_atom *argv) +{ + t_openHelp *x = (t_openHelp *)pd_new(openHelp_class); + + x->dir = tof_get_dir(tof_get_canvas()); + //strcpy(tof_buf_temp_a,x->dir->s_name); + //strcat(tof_buf_temp_a,"/"); + //x->dir = gensym(tof_buf_temp_a); + + //x->canvas = tof_get_canvas(); + + + + + return (void *)x; +} + +void openHelp_setup(void) { + openHelp_class = class_new(gensym("openHelp"), + (t_newmethod)openHelp_new, + (t_method)openHelp_free, sizeof(t_openHelp), + CLASS_DEFAULT, + A_GIMME, 0); + + // class_addbang(openHelp_class, openHelp_bang); + //class_addanything(openHelp_class,openHelp_anything); + class_addsymbol(openHelp_class,openHelp_symbol); + //class_addmethod(openHelp_class, + // (t_method)openHelp_append, gensym("append"), + // A_GIMME, 0); + + //class_addfloat (openHelp_class, openHelp_float); + /*class_addmethod(openHelp_class, + (t_method)openHelp_set, gensym("set"), + A_DEFFLOAT, 0); +*/ + //class_addlist (openHelp_class, openHelp_list); + +} -- cgit v1.2.1