MCPcopy Create free account
hub / github.com/KratosMultiphysics/Kratos / te_compile

Function te_compile

external_libraries/tinyexpr/tinyexpr/tinyexpr.c:691–716  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689
690
691te_expr *te_compile(const char *expression, const te_variable *variables, int var_count, int *error) {
692 state s;
693 s.start = s.next = expression;
694 s.lookup = variables;
695 s.lookup_len = var_count;
696
697 next_token(&s);
698 te_expr *root = list(&s);
699 if (root == NULL) {
700 if (error) *error = -1;
701 return NULL;
702 }
703
704 if (s.type != TOK_END) {
705 te_free(root);
706 if (error) {
707 *error = (s.next - s.start);
708 if (*error == 0) *error = 1;
709 }
710 return 0;
711 } else {
712 optimize(root);
713 if (error) *error = 0;
714 return root;
715 }
716}
717
718
719double te_interp(const char *expression, int *error) {

Callers 3

te_interpFunction · 0.85
ScalingMethod · 0.85
InitializeParserMethod · 0.85

Calls 4

next_tokenFunction · 0.85
te_freeFunction · 0.85
optimizeFunction · 0.85
listFunction · 0.70

Tested by

no test coverage detected