aboutsummaryrefslogtreecommitdiff
path: root/shared/toxy
diff options
context:
space:
mode:
Diffstat (limited to 'shared/toxy')
-rw-r--r--shared/toxy/scriptlet.c19
-rw-r--r--shared/toxy/scriptlet.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/shared/toxy/scriptlet.c b/shared/toxy/scriptlet.c
index 2592cee..e2f9883 100644
--- a/shared/toxy/scriptlet.c
+++ b/shared/toxy/scriptlet.c
@@ -277,6 +277,11 @@ static char *scriptlet_dedot(t_scriptlet *sp, char *ibuf, char *obuf,
return (len ? ibuf + len : 0);
}
+int scriptlet_isempty(t_scriptlet *sp)
+{
+ return (!(sp->s_tail > sp->s_head && *sp->s_head));
+}
+
void scriptlet_reset(t_scriptlet *sp)
{
sp->s_cvstate = SCRIPTLET_CVUNKNOWN;
@@ -395,6 +400,20 @@ void scriptlet_qpush(t_scriptlet *sp)
}
}
+/* Non-expanding -- LATER think if this is likely to cause any confusion.
+ Especially, consider the widget_vis() vs. widget_update() case. */
+void scriptlet_vpush(t_scriptlet *sp, char *varname)
+{
+ if (scriptlet_ready(sp))
+ {
+ char *tail = sp->s_tail;
+ strcpy(tail, "}\n");
+ sys_vgui("set ::toxy::%s { ", varname);
+ sys_gui(sp->s_head);
+ *tail = 0;
+ }
+}
+
int scriptlet_evaluate(t_scriptlet *insp, t_scriptlet *outsp,
int visedonly, int ac, t_atom *av, t_props *argprops)
{
diff --git a/shared/toxy/scriptlet.h b/shared/toxy/scriptlet.h
index 4b057b9..336d729 100644
--- a/shared/toxy/scriptlet.h
+++ b/shared/toxy/scriptlet.h
@@ -14,6 +14,7 @@ EXTERN_STRUCT _scriptlet;
typedef t_canvas *(*t_scriptlet_cvfn)(t_pd *);
typedef t_scriptlet *(*t_scriptlet_cmntfn)(t_pd *, char *, char, char *);
+int scriptlet_isempty(t_scriptlet *sp);
void scriptlet_reset(t_scriptlet *sp);
void scriptlet_prealloc(t_scriptlet *sp, int sz, int mayshrink);
int scriptlet_add(t_scriptlet *sp,
@@ -25,6 +26,7 @@ int scriptlet_addfloat(t_scriptlet *sp, t_float f);
void scriptlet_setseparator(t_scriptlet *sp, char c);
void scriptlet_push(t_scriptlet *sp);
void scriptlet_qpush(t_scriptlet *sp);
+void scriptlet_vpush(t_scriptlet *sp, char *varname);
int scriptlet_evaluate(t_scriptlet *insp, t_scriptlet *outsp,
int visedonly, int ac, t_atom *av, t_props *argprops);
char *scriptlet_nextword(char *buf);