LMMS
Loading...
Searching...
No Matches
eel_eval.h
Go to the documentation of this file.
1#ifndef _EEL_EVAL_H_
2#define _EEL_EVAL_H_
3
4#ifndef EEL_EVAL_GET_CACHED
5#define EEL_EVAL_GET_CACHED(str, ch) (NULL)
6#endif
7
8#ifndef EEL_EVAL_SET_CACHED
9#define EEL_EVAL_SET_CACHED(sv, ch) { NSEEL_code_free(ch); free(sv); }
10#endif
11
12#ifndef EEL_EVAL_SCOPE_ENTER
13#define EEL_EVAL_SCOPE_ENTER 1
14#define EEL_EVAL_SCOPE_LEAVE
15#endif
16
17static EEL_F NSEEL_CGEN_CALL _eel_eval(void *opaque, EEL_F *s)
18{
21 char *sv=NULL;
22 if (r)
23 {
25 const char *str=EEL_STRING_GET_FOR_INDEX(*s,NULL);
26#ifdef EEL_STRING_DEBUGOUT
27 if (!str)
28 {
29 EEL_STRING_DEBUGOUT("eval() passed invalid string handle %f",*s);
30 }
31#endif
32 if (str && *str)
33 {
34 sv=EEL_EVAL_GET_CACHED(str,ch);
35 if (!sv) sv=strdup(str);
36 }
37 }
38 if (sv)
39 {
40 if (!ch) ch = NSEEL_code_compile(r,sv,0);
41 if (ch)
42 {
44 {
47 }
48 else
49 {
50#ifdef EEL_STRING_DEBUGOUT
51 EEL_STRING_DEBUGOUT("eval() reentrancy limit reached");
52#endif
53 }
54
56 return 1.0;
57 }
58 else
59 {
60#ifdef EEL_STRING_DEBUGOUT
61 const char *err=NSEEL_code_getcodeerror(r);
62 if (err) EEL_STRING_DEBUGOUT("eval() error: %s",err);
63#endif
64 }
65 free(sv);
66 }
67 return 0.0;
68}
69
74
75#ifdef EEL_WANT_DOCUMENTATION
76static const char *eel_eval_function_reference =
77 "eval\t\"code\"\tExecutes code passed in. Code can use functions, but functions created in code can't be used elsewhere.\0"
78;
79#endif
80
81#endif
#define NULL
Definition CarlaBridgeFormat.cpp:30
unsigned s
Definition inflate.c:1555
#define EEL_EVAL_GET_CACHED(str, ch)
Definition eel_eval.h:5
static EEL_F NSEEL_CGEN_CALL _eel_eval(void *opaque, EEL_F *s)
Definition eel_eval.h:17
#define EEL_EVAL_SET_CACHED(sv, ch)
Definition eel_eval.h:9
void EEL_eval_register()
Definition eel_eval.h:70
#define EEL_EVAL_SCOPE_ENTER
Definition eel_eval.h:13
#define EEL_EVAL_SCOPE_LEAVE
Definition eel_eval.h:14
void(* NSEEL_code_execute)(NSEEL_CODEHANDLE code)
Definition eel_import.h:19
#define NSEEL_addfunc_retval(name, np, pproc, fptr)
Definition eel_import.h:51
char *(* NSEEL_code_getcodeerror)(NSEEL_VMCTX ctx)
Definition eel_import.h:18
void *(* NSEEL_PProc_THIS)(void *data, int data_size, struct _compileContext *ctx)
Definition eel_import.h:40
#define EEL_STRING_GET_FOR_INDEX(x, wr)
Definition eel_strings.h:96
#define EEL_STRING_MUTEXLOCK_SCOPE
Definition eel_strings.h:90
#define opaque
Definition eelscript.h:281
#define EEL_EVAL_GET_VMCTX(opaque)
Definition eelscript.h:216
#define NSEEL_CGEN_CALL
Definition ns-eel.h:44
void * NSEEL_VMCTX
Definition ns-eel.h:117
void * NSEEL_CODEHANDLE
Definition ns-eel.h:118
NSEEL_CODEHANDLE NSEEL_code_compile(NSEEL_VMCTX ctx, const char *code, int lineoffs)
Definition nseel-compiler.c:4514
int r
Definition crypt.c:458