aboutsummaryrefslogtreecommitdiff
path: root/shared/toxy/scriptlet.h
blob: 336d72996655c690832821022d56b5906d54a1c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* Copyright (c) 2003 krzYszcz and others.
 * For information on usage and redistribution, and for a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */

#ifndef __SCRIPTLET_H__
#define __SCRIPTLET_H__

enum { SCRIPTLET_OK = 0, SCRIPTLET_NOFILE, SCRIPTLET_BADFILE,
       SCRIPTLET_IGNORED };

EXTERN_STRUCT _scriptlet;
#define t_scriptlet  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,
		  int resolveall, int visedonly, int ac, t_atom *av);
int scriptlet_addstring(t_scriptlet *sp, char *ibuf,
			int resolveall, int visedonly,
			int ac, t_atom *av, t_props *argprops);
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);
int scriptlet_rcload(t_scriptlet *sp, char *rc, char *ext,
		     t_scriptlet_cmntfn cmntfn);
int scriptlet_read(t_scriptlet *sp, t_symbol *fn);
int scriptlet_write(t_scriptlet *sp, t_symbol *fn);
char *scriptlet_getcontents(t_scriptlet *sp, int *lenp);
char *scriptlet_getbuffer(t_scriptlet *sp, int *sizep);
void scriptlet_clone(t_scriptlet *to, t_scriptlet *from);
void scriptlet_free(t_scriptlet *sp);
t_scriptlet *scriptlet_new(t_pd *owner, t_symbol *rptarget, t_symbol *cbtarget,
			   t_symbol *item, t_scriptlet_cvfn cvfn);

#endif