diff options
Diffstat (limited to 'pd/src')
-rw-r--r-- | pd/src/d_soundfile.c | 44 | ||||
-rw-r--r-- | pd/src/g_canvas.c | 13 | ||||
-rw-r--r-- | pd/src/g_canvas.h | 1 | ||||
-rw-r--r-- | pd/src/g_editor.c | 4 | ||||
-rw-r--r-- | pd/src/g_template.c | 16 | ||||
-rw-r--r-- | pd/src/g_traversal.c | 2 | ||||
-rw-r--r-- | pd/src/m_pd.h | 2 | ||||
-rw-r--r-- | pd/src/s_loader.c | 4 | ||||
-rw-r--r-- | pd/src/u_main.tk | 2 | ||||
-rw-r--r-- | pd/src/x_qlist.c | 5 |
10 files changed, 69 insertions, 24 deletions
diff --git a/pd/src/d_soundfile.c b/pd/src/d_soundfile.c index 562979f8..9f186b2d 100644 --- a/pd/src/d_soundfile.c +++ b/pd/src/d_soundfile.c @@ -200,18 +200,13 @@ static void swapstring(char *foo, int doit) * header and fill in the properties. */ -int open_soundfile(const char *dirname, const char *filename, int headersize, +int open_soundfile_via_fd(int fd, int headersize, int *p_bytespersamp, int *p_bigendian, int *p_nchannels, long *p_bytelimit, long skipframes) { - char buf[OBUFSIZE], *bufptr; - int fd, format, nchannels, bigendian, bytespersamp, swap, sysrtn; + int format, nchannels, bigendian, bytespersamp, swap, sysrtn; long bytelimit = 0x7fffffff; errno = 0; - fd = open_via_path(dirname, filename, - "", buf, &bufptr, MAXPDSTRING, 1); - if (fd < 0) - return (-1); if (headersize >= 0) /* header detection overridden */ { bigendian = *p_bigendian; @@ -221,6 +216,7 @@ int open_soundfile(const char *dirname, const char *filename, int headersize, } else { + char buf[OBUFSIZE]; int bytesread = read(fd, buf, READHDRSIZE); int format; if (bytesread < 4) @@ -392,6 +388,38 @@ badheader: return (-1); } + /* open a soundfile, using open_via_path(). This is used by readsf~ in + a not-perfectly-threadsafe way. LATER replace with a thread-hardened + version of open_soundfile_via_canvas() */ +int open_soundfile(const char *dirname, const char *filename, int headersize, + int *p_bytespersamp, int *p_bigendian, int *p_nchannels, long *p_bytelimit, + long skipframes) +{ + char buf[OBUFSIZE], *bufptr; + int fd; + fd = open_via_path(dirname, filename, "", buf, &bufptr, MAXPDSTRING, 1); + if (fd < 0) + return (-1); + else return (open_soundfile_via_fd(fd, headersize, p_bytespersamp, + p_bigendian, p_nchannels, p_bytelimit, skipframes)); +} + + /* open a soundfile, using open_via_canvas(). This is used by readsf~ in + a not-perfectly-threadsafe way. LATER replace with a thread-hardened + version of open_soundfile_via_canvas() */ +int open_soundfile_via_canvas(t_canvas *canvas, const char *filename, int headersize, + int *p_bytespersamp, int *p_bigendian, int *p_nchannels, long *p_bytelimit, + long skipframes) +{ + char buf[OBUFSIZE], *bufptr; + int fd; + fd = canvas_open(canvas, filename, "", buf, &bufptr, MAXPDSTRING, 1); + if (fd < 0) + return (-1); + else return (open_soundfile_via_fd(fd, headersize, p_bytespersamp, + p_bigendian, p_nchannels, p_bytelimit, skipframes)); +} + static void soundfile_xferin(int sfchannels, int nvecs, float **vecs, long itemsread, unsigned char *buf, int nitems, int bytespersamp, int bigendian) @@ -1033,7 +1061,7 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s, } finalsize = vecsize; } - fd = open_soundfile(canvas_getdir(x->x_canvas)->s_name, filename, + fd = open_soundfile_via_canvas(x->x_canvas, filename, headersize, &bytespersamp, &bigendian, &channels, &bytelimit, skipframes); diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c index 9385c05f..5a52a07a 100644 --- a/pd/src/g_canvas.c +++ b/pd/src/g_canvas.c @@ -1552,9 +1552,20 @@ int canvas_open(t_canvas *x, const char *name, const char *ext, if (y->gl_env) { t_namelist *nl; + t_canvas *x2 = x; + char *dir; + while (x2 && x2->gl_owner) + x2 = x2->gl_owner; + dir = (x2 ? canvas_getdir(x2)->s_name : "."); for (nl = y->gl_env->ce_path; nl; nl = nl->nl_next) { - if ((fd = sys_trytoopenone(nl->nl_string, name, ext, + char realname[MAXPDSTRING]; + strncpy(realname, dir, MAXPDSTRING); + realname[MAXPDSTRING-3] = 0; + strcat(realname, "/"); + strncat(realname, nl->nl_string, MAXPDSTRING-strlen(realname)); + realname[MAXPDSTRING-1] = 0; + if ((fd = sys_trytoopenone(realname, name, ext, dirresult, nameresult, size, bin)) >= 0) return (fd); } diff --git a/pd/src/g_canvas.h b/pd/src/g_canvas.h index f1c99769..d3dee3d3 100644 --- a/pd/src/g_canvas.h +++ b/pd/src/g_canvas.h @@ -536,6 +536,7 @@ EXTERN void array_free(t_array *x); EXTERN t_gstub *gstub_new(t_glist *gl, t_array *a); EXTERN void gstub_cutoff(t_gstub *gs); EXTERN void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x); +EXTERN void gpointer_setarray(t_gpointer *gp, t_array *array, t_word *w); /* --------------------- scalars ------------------------- */ EXTERN void word_init(t_word *wp, t_template *tmpl, t_gpointer *gp); diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index cbc9e1d7..aa8b35c0 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -1947,7 +1947,7 @@ static void canvas_copy(t_canvas *x) int bufsize; rtext_getseltext(x->gl_editor->e_textedfor, &buf, &bufsize); -#if defined(MSW) || defined(MACOSX) +#if defined(MSW) || defined(__APPLE__) /* for Mac or Windows, copy the text to the clipboard here */ sys_vgui("clipboard clear\n", bufsize, buf); sys_vgui("clipboard append {%.*s}\n", bufsize, buf); @@ -2111,7 +2111,7 @@ static void canvas_paste(t_canvas *x) if (x->gl_editor->e_textedfor) { /* simulate keystrokes as if the copy buffer were typed in. */ -#if defined(MSW) || defined(MACOSX) +#if defined(MSW) || defined(__APPLE__) /* for Mac or Windows, ask the GUI to send the clipboard down */ sys_gui("pdtk_pastetext\n"); #else diff --git a/pd/src/g_template.c b/pd/src/g_template.c index 2ee67196..3d00b5dd 100644 --- a/pd/src/g_template.c +++ b/pd/src/g_template.c @@ -1285,8 +1285,11 @@ static int curve_click(t_gobj *z, t_glist *glist, curve_motion_wp = data; curve_motion_field = 2*bestn; curve_motion_template = template; - gpointer_setglist(&curve_motion_gpointer, curve_motion_glist, - curve_motion_scalar); + if (curve_motion_scalar) + gpointer_setglist(&curve_motion_gpointer, curve_motion_glist, + curve_motion_scalar); + else gpointer_setarray(&curve_motion_gpointer, + curve_motion_array, curve_motion_wp); glist_grab(glist, z, curve_motion, 0, xpix, ypix); } return (1); @@ -2268,9 +2271,12 @@ static int drawnumber_click(t_gobj *z, t_glist *glist, drawnumber_motion_ycumulative = fielddesc_getfloat(&x->x_value, template, data, 0); drawnumber_motion_symbol = ((x->x_flags & DRAW_SYMBOL) != 0); - gpointer_setglist(&drawnumber_motion_gpointer, - drawnumber_motion_glist, drawnumber_motion_scalar); - glist_grab(glist, z, drawnumber_motion, drawnumber_key, + if (drawnumber_motion_scalar) + gpointer_setglist(&drawnumber_motion_gpointer, + drawnumber_motion_glist, drawnumber_motion_scalar); + else gpointer_setarray(&drawnumber_motion_gpointer, + drawnumber_motion_array, drawnumber_motion_wp); + glist_grab(glist, z, drawnumber_motion, drawnumber_key, xpix, ypix); } return (1); diff --git a/pd/src/g_traversal.c b/pd/src/g_traversal.c index 9ec8ca90..7de67848 100644 --- a/pd/src/g_traversal.c +++ b/pd/src/g_traversal.c @@ -143,7 +143,7 @@ void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x) gs->gs_refcount++; } -static void gpointer_setarray(t_gpointer *gp, t_array *array, t_word *w) +void gpointer_setarray(t_gpointer *gp, t_array *array, t_word *w) { t_gstub *gs; if (gs = gp->gp_stub) gstub_dis(gs); diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h index d733a6cd..8f22b765 100644 --- a/pd/src/m_pd.h +++ b/pd/src/m_pd.h @@ -10,7 +10,7 @@ extern "C" { #define PD_MAJOR_VERSION 0 #define PD_MINOR_VERSION 40 -#define PD_BUGFIX_VERSION 0 +#define PD_BUGFIX_VERSION 1 #define PD_TEST_VERSION "" /* old name for "MSW" flag -- we have to take it for the sake of many old diff --git a/pd/src/s_loader.c b/pd/src/s_loader.c index b72d799b..a10ebab6 100644 --- a/pd/src/s_loader.c +++ b/pd/src/s_loader.c @@ -13,7 +13,7 @@ #include <io.h> #include <windows.h> #endif -#ifdef MACOSX +#ifdef __APPLE__ #include <mach-o/dyld.h> #endif #include <string.h> @@ -41,7 +41,7 @@ static char sys_dllextent[] = ".l_ia64", sys_dllextent2[] = ".pd_linux"; static char sys_dllextent[] = ".l_i386", sys_dllextent2[] = ".pd_linux"; #endif #endif -#ifdef MACOSX +#ifdef __APPLE__ #ifndef MACOSX3 static char sys_dllextent[] = ".d_fat", sys_dllextent2[] = ".pd_darwin"; #else diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk index 97fc77b4..a05d145f 100644 --- a/pd/src/u_main.tk +++ b/pd/src/u_main.tk @@ -394,7 +394,7 @@ proc menu_openhtml {filename} { exec sh -c [format "open %s" $filename] } else { exec rundll32 url.dll,FileProtocolHandler \ - [format "file:%s" $filename] & + [format "file://%s" $filename] & } } diff --git a/pd/src/x_qlist.c b/pd/src/x_qlist.c index 4b6a393b..271259a3 100644 --- a/pd/src/x_qlist.c +++ b/pd/src/x_qlist.c @@ -181,9 +181,8 @@ static void qlist_read(t_qlist *x, t_symbol *filename, t_symbol *format) cr = 1; else if (*format->s_name) error("qlist_read: unknown flag: %s", format->s_name); - - if (binbuf_read_via_path(x->x_binbuf, filename->s_name, - canvas_getdir(x->x_canvas)->s_name, cr)) + + if (binbuf_read_via_canvas(x->x_binbuf, filename->s_name, x->x_canvas, cr)) error("%s: read failed", filename->s_name); x->x_onset = 0x7fffffff; x->x_reentered = 1; |