Vuo
2.3.2
type
VuoMathExpression.c
Go to the documentation of this file.
1
10
#include <string.h>
11
12
#include "
type.h
"
13
#include "
VuoMathExpression.h
"
14
16
#ifdef VUO_COMPILER
17
VuoModuleMetadata
({
18
"title"
:
"Math Expression"
,
19
"description"
:
"A mathematical expression that can be used for calculations."
,
20
"keywords"
: [ ],
21
"version"
:
"1.0.0"
,
22
"dependencies"
: [
23
"c"
,
24
"VuoMathExpressionParser"
25
]
26
});
27
#endif
29
40
VuoMathExpression
VuoMathExpression_makeFromJson
(
json_object
*js)
41
{
42
VuoMathExpression
me;
43
json_object
*o = NULL;
44
45
if
(json_object_object_get_ex(js,
"expression"
, &o))
46
{
47
me.
expression
=
VuoText_makeFromJson
(o);
48
49
VuoMathExpressionError
error = NULL;
50
me.
parser
=
VuoMathExpressionParser_makeFromSingleExpression
(me.
expression
, &error);
51
free(error);
52
}
53
else
54
{
55
me.
expression
=
VuoText_make
(
""
);
56
me.
parser
= NULL;
57
}
58
59
return
me;
60
}
61
77
json_object
*
VuoMathExpression_getJson
(
const
VuoMathExpression
me)
78
{
79
json_object
*js = json_object_new_object();
80
81
json_object_object_add(js,
"expression"
,
VuoText_getJson
(me.
expression
));
82
83
if
(me.
parser
)
84
{
85
VuoList_VuoText
inputVariables =
VuoMathExpressionParser_getInputVariables
(me.
parser
);
86
json_object_object_add(js,
"inputVariables"
,
VuoList_VuoText_getJson
(inputVariables));
87
VuoRelease
(inputVariables);
88
89
VuoList_VuoText
outputVariables =
VuoMathExpressionParser_getOutputVariables
(me.
parser
);
90
json_object_object_add(js,
"outputVariables"
,
VuoList_VuoText_getJson
(outputVariables));
91
VuoRelease
(outputVariables);
92
}
93
94
return
js;
95
}
96
101
char
*
VuoMathExpression_getSummary
(
const
VuoMathExpression
me)
102
{
103
return
VuoText_getSummary
(me.
expression
);
104
}
Generated on Sat Jun 19 2021 10:17:49 for Vuo by
1.9.1