jx_eval.h File Reference

Implements evaluation of JX expressions. More...

`#include "jx.h"`

Go to the source code of this file.

## Functions

struct jx * | jx_eval (struct jx *j, struct jx *context)
| Evaluate an expression.
struct jx * | jx_eval_with_defines (struct jx *j, struct jx *context)
| Evaluate an expression with embedded definitions.
void | jx_eval_enable_external (int enable)
| Enable external functions.

## Detailed Description

Implements evaluation of JX expressions.

## Function Documentation

## jx_eval()

struct jx * jx_eval | ( | struct jx * | j,
|  | struct jx * | context )

Evaluate an expression.

Traverses the expression, evaluates all operators and evalutes unbound symbols by looking for matches in the context object.

Parameters

  j | The expression to evaluate.
  context | An object in which values will be found.

Returns
  A newly created result expression, which must be deleted with jx_delete. If the expression is invalid in some way, an object of type JX_NULL is returned.

## jx_eval_with_defines()

struct jx * jx_eval_with_defines | ( | struct jx * | j,
|  | struct jx * | context )

Evaluate an expression with embedded definitions.

Same as jx_eval, except first looks for a "defines" clause and combines that with the context. Allows an expression to have its own bound values, for convenience.

Parameters

  j | The expression to evaluate, which may contain a "defines" clause.
  context | An object in which values will be found.

Returns
  A newly created result expression, which must be deleted with jx_delete. If the expression is invalid in some way, an object of type JX_NULL is returned.

## jx_eval_enable_external()

void jx_eval_enable_external | ( | int | enable | ) |

Enable external functions.

A small number of JX functions make use of "external" context, For safety, these functions are not enabled unless the user first calls jx_eval_enable_external(1).

Parameters

  enable | If non-zero, enable external functions, otherwise disable.