Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pd-lua
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonathan Wilkes
pd-lua
Commits
f5703f5e
Commit
f5703f5e
authored
7 years ago
by
Albert Gräf
Browse files
Options
Downloads
Patches
Plain Diff
nw.js (Pd-l2ork 2.x) support: opening the Lua script file does the right thing in Purr Data
parent
f7e98578
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pdlua.c
+24
-1
24 additions, 1 deletion
pdlua.c
with
24 additions
and
1 deletion
pdlua.c
+
24
−
1
View file @
f5703f5e
...
...
@@ -512,6 +512,10 @@ static void pdlua_stack_dump (lua_State *L)
printf
(
"
\n
"
);
/* end the listing */
}
/* nw.js support. If this is non-NULL then we're running inside Jonathan
Wilkes' Pd-L2Ork variant and access to the GUI uses JavaScript. */
static
void
(
*
nw_gui_vmess
)(
const
char
*
sel
,
char
*
fmt
,
...)
=
NULL
;
/** a handler for the open item in the right-click menu (mrpeach 20111025) */
/** Here we find the lua code for the object and open it in an editor */
static
void
pdlua_menu_open
(
t_pdlua
*
o
)
...
...
@@ -563,7 +567,10 @@ static void pdlua_menu_open(t_pdlua *o)
#else
logpost
(
NULL
,
3
,
"Opening %s for editing"
,
pathname
);
#endif
sys_vgui
(
"::pd_menucommands::menu_openfile {%s}
\n
"
,
pathname
);
if
(
nw_gui_vmess
)
nw_gui_vmess
(
"open_textfile"
,
"s"
,
pathname
);
else
sys_vgui
(
"::pd_menucommands::menu_openfile {%s}
\n
"
,
pathname
);
}
PDLUA_DEBUG
(
"pdlua_menu_open end. stack top is %d"
,
lua_gettop
(
L
));
}
...
...
@@ -1608,6 +1615,15 @@ static int pdlua_loader_pathwise
}
#ifndef WIN32
#define __USE_GNU // to get RTLD_DEFAULT
#include
<dlfcn.h>
// for dlsym
#ifndef RTLD_DEFAULT
/* If RTLD_DEFAULT still isn't defined then just passing NULL will hopefully
do the trick. */
#define RTLD_DEFAULT NULL
#endif
#endif
/** Start the Lua runtime and register our loader hook. */
#ifdef _WIN32
...
...
@@ -1716,6 +1732,13 @@ void pdlua_setup(void)
error
(
"lua: loader will not be registered!"
);
}
PDLUA_DEBUG
(
"pdlua_setup: end. stack top %d"
,
lua_gettop
(
L
));
#ifndef WIN32
/* nw.js support (currently only supported on Linux and Mac). XXXTODO:
Make this work on Windows as well. */
nw_gui_vmess
=
dlsym
(
RTLD_DEFAULT
,
"gui_vmess"
);
if
(
nw_gui_vmess
)
post
(
"pdlua: using JavaScript interface (Pd-l2ork nw.js version)"
);
#endif
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment