Vuo  2.3.2
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
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 
41 {
43  json_object *o = NULL;
44 
45  if (json_object_object_get_ex(js, "expression", &o))
46  {
48 
49  VuoMathExpressionError error = NULL;
51  free(error);
52  }
53  else
54  {
55  me.expression = VuoText_make("");
56  me.parser = NULL;
57  }
58 
59  return me;
60 }
61 
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  {
86  json_object_object_add(js, "inputVariables", VuoList_VuoText_getJson(inputVariables));
87  VuoRelease(inputVariables);
88 
90  json_object_object_add(js, "outputVariables", VuoList_VuoText_getJson(outputVariables));
91  VuoRelease(outputVariables);
92  }
93 
94  return js;
95 }
96 
102 {
103  return VuoText_getSummary(me.expression);
104 }