Skip to content

Commit 9fbb9b3

Browse files
committed
glist_findrtext -> glist_getrtext
closes #75
1 parent f363065 commit 9fbb9b3

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

pdlua.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,13 @@
5959

6060
#include "pdlua_gfx.h"
6161

62-
typedef void (*t_signal_setmultiout)(t_signal **, int);
63-
static t_signal_setmultiout g_signal_setmultiout;
62+
// function pointer type for signal_setmultiout (added with Pd 0.54)
63+
typedef void (*t_signal_setmultiout_fn)(t_signal **, int);
64+
static t_signal_setmultiout_fn g_signal_setmultiout;
65+
66+
// function pointer type for glist_getrtext/glist_findrtext (changes with Pd 0.55-3)
67+
typedef t_rtext *(*t_glist_rtext_fn)(t_glist *, t_text *);
68+
static t_glist_rtext_fn g_glist_getrtext = NULL;
6469

6570
// This used to be in s_stuff.h, but not anymore since 0.55.1test1.
6671
int sys_trytoopenone(const char *dir, const char *name, const char* ext,
@@ -1314,7 +1319,7 @@ static int pdlua_set_arguments(lua_State *L)
13141319
if (redraw) {
13151320
// update the text in the object box; this makes sure that
13161321
// the arguments in the display are what we just set
1317-
t_rtext *y = glist_findrtext(o->canvas, x);
1322+
t_rtext *y = g_glist_getrtext(o->canvas, x);
13181323
rtext_retext(y);
13191324
// redraw the object and its iolets (including incident
13201325
// cord lines), in case the object box size has changed
@@ -3041,21 +3046,29 @@ void pdlua_setup(void)
30413046
#endif
30423047
post(luaversionStr);
30433048

3044-
// multichannel handling copied from https://github.com/Spacechild1/vstplugin/blob/3f0ed8a800ea238bf204a2ead940b2d1324ac909/pd/src/vstplugin~.cpp#L4122-L4136
3049+
// compatibility handling copied from https://github.com/Spacechild1/vstplugin/blob/3f0ed8a800ea238bf204a2ead940b2d1324ac909/pd/src/vstplugin~.cpp#L4122-L4136
30453050
#ifdef _WIN32
30463051
// get a handle to the module containing the Pd API functions.
30473052
// NB: GetModuleHandle("pd.dll") does not cover all cases.
30483053
HMODULE module;
30493054
if (GetModuleHandleEx(
30503055
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
30513056
(LPCSTR)&pd_typedmess, &module)) {
3052-
g_signal_setmultiout = (t_signal_setmultiout)(void *)GetProcAddress(
3057+
g_signal_setmultiout = (t_signal_setmultiout_fn)(void *)GetProcAddress(
30533058
module, "signal_setmultiout");
3059+
g_glist_getrtext = (t_glist_rtext_fn)GetProcAddress(module, "glist_getrtext");
3060+
if (!g_glist_getrtext)
3061+
g_glist_getrtext = (t_glist_rtext_fn)GetProcAddress(module, "glist_findrtext");
30543062
}
30553063
#else
30563064
// search recursively, starting from the main program
3057-
g_signal_setmultiout = (t_signal_setmultiout)dlsym(
3065+
g_signal_setmultiout = (t_signal_setmultiout_fn)dlsym(
30583066
dlopen(NULL, RTLD_NOW), "signal_setmultiout");
3067+
g_glist_getrtext = (t_glist_rtext_fn)dlsym(
3068+
dlopen(NULL, RTLD_NOW), "glist_getrtext");
3069+
if (!g_glist_getrtext)
3070+
g_glist_getrtext = (t_glist_rtext_fn)dlsym(
3071+
dlopen(NULL, RTLD_NOW), "glist_findrtext");
30593072
#endif
30603073

30613074
pdlua_proxyinlet_setup();

pdlua_gfx.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,8 +876,8 @@ static int start_paint(lua_State* L) {
876876

877877
#ifdef PURR_DATA
878878
if (gfx->object_tag[0] == '*') {
879-
// late initialization, deferred until glist_findrtext will work
880-
t_rtext *y = glist_findrtext(obj->canvas, (t_text*)obj);
879+
// late initialization, deferred until glist_getrtext will work
880+
t_rtext *y = glist_getrtext(obj->canvas, (t_text*)obj);
881881
if (y) {
882882
const char *s = rtext_gettag(y);
883883
strcpy(gfx->object_tag, s);

0 commit comments

Comments
 (0)