## ESExp

ESExp

## Functions

ESExp * | e_sexp_new ()
void | e_sexp_add_function ()
void | e_sexp_add_ifunction ()
void | e_sexp_add_variable ()
void | e_sexp_remove_symbol ()
gint | e_sexp_set_scope ()
void | e_sexp_input_text ()
void | e_sexp_input_file ()
gint | e_sexp_parse ()
ESExpResult * | e_sexp_eval ()
ESExpResult * | e_sexp_term_eval ()
ESExpResult * | e_sexp_result_new ()
void | e_sexp_result_free ()
void | e_sexp_resultv_free ()
void | e_sexp_encode_bool ()
void | e_sexp_encode_string ()
void | e_sexp_fatal_error ()
const gchar * | e_sexp_get_error ()
ESExpTerm * | e_sexp_parse_value ()
gboolean | e_sexp_evaluate_occur_times ()

## Types and Values

enum | ESExpResultType
struct | ESExpResult
enum | ESExpTermType
struct | ESExpSymbol
struct | ESExpTerm

## Object Hierarchy

        GObject
        ╰── ESExp

## Description

## Functions

### e_sexp_new ()

    ESExp *
    e_sexp_new (void);

### e_sexp_add_function ()

    void
    e_sexp_add_function (ESExp *sexp,
                         gint scope,
                         const gchar *name,
                         ESExpFunc *func,
                         gpointer user_data);

### e_sexp_add_ifunction ()

    void
    e_sexp_add_ifunction (ESExp *sexp,
                          gint scope,
                          const gchar *name,
                          ESExpIFunc *func,
                          gpointer user_data);

### e_sexp_add_variable ()

    void
    e_sexp_add_variable (ESExp *sexp,
                         gint scope,
                         gchar *name,
                         ESExpTerm *value);

### e_sexp_remove_symbol ()

    void
    e_sexp_remove_symbol (ESExp *sexp,
                          gint scope,
                          const gchar *name);

### e_sexp_set_scope ()

    gint
    e_sexp_set_scope (ESExp *sexp,
                      gint scope);

### e_sexp_input_text ()

    void
    e_sexp_input_text (ESExp *sexp,
                       const gchar *text,
                       gint len);

### e_sexp_input_file ()

    void
    e_sexp_input_file (ESExp *sexp,
                       gint fd);

### e_sexp_parse ()

    gint
    e_sexp_parse (ESExp *sexp);

### e_sexp_eval ()

    ESExpResult *
    e_sexp_eval (ESExp *sexp);

### e_sexp_term_eval ()

    ESExpResult *
    e_sexp_term_eval (ESExp *sexp,
                      ESExpTerm *t);

### e_sexp_result_new ()

    ESExpResult *
    e_sexp_result_new (ESExp *sexp,
                       gint type);

### e_sexp_result_free ()

    void
    e_sexp_result_free (ESExp *sexp,
                        ESExpResult *t);

### e_sexp_resultv_free ()

    void
    e_sexp_resultv_free (ESExp *sexp,
                         gint argc,
                         ESExpResult **argv);

### e_sexp_encode_bool ()

    void
    e_sexp_encode_bool (GString *s,
                        gboolean state);

Encode a bool into an s-expression `s` . Bools are encoded using #t #f syntax.

#### Parameters

s | A GString to append to |
state | The boolean value |

### e_sexp_encode_string ()

    void
    e_sexp_encode_string (GString *s,
                          const gchar *string);

Add a c string `string` to the s-expression stored in the gstring `s` . Quotes are added, and special characters are escaped appropriately.

#### Parameters

s | Destination string. |
string | String expression. |

### e_sexp_fatal_error ()

    void
    e_sexp_fatal_error (ESExp *sexp,
                        const gchar *why,
                        ...);

### e_sexp_get_error ()

    const gchar *
    e_sexp_get_error (ESExp *sexp);

### e_sexp_parse_value ()

    ESExpTerm *
    e_sexp_parse_value (ESExp *sexp);

#### Parameters

sexp | an ESExp |

#### Returns

an ESExpTerm of the next token, or `NULL` when there is none.

[nullable][transfer none]

Since: 2.28

### e_sexp_evaluate_occur_times ()

    gboolean
    e_sexp_evaluate_occur_times (ESExp *sexp,
                                 time_t *start,
                                 time_t *end);

## Types and Values

### enum ESExpResultType

#### Members

ESEXP_RES_ARRAY_PTR |  |
ESEXP_RES_INT |  |
ESEXP_RES_STRING |  |
ESEXP_RES_BOOL |  |
ESEXP_RES_TIME |  |
ESEXP_RES_UNDEFINED |  |

### struct ESExpResult

    struct ESExpResult {
    	ESExpResultType type;
    	union {
    		GPtrArray *ptrarray;
    		gint number;
    		gchar *string;
    		gint boolean;
    		time_t time;
    	} value;
    	gboolean time_generator;
    	time_t occuring_start;
    	time_t occuring_end;
    };

### enum ESExpTermType

#### Members

ESEXP_TERM_INT |  |
ESEXP_TERM_BOOL |  |
ESEXP_TERM_STRING |  |
ESEXP_TERM_TIME |  |
ESEXP_TERM_FUNC |  |
ESEXP_TERM_IFUNC |  |
ESEXP_TERM_VAR |  |

### struct ESExpSymbol

    struct ESExpSymbol {
    	gint type;		/* ESEXP_TERM_FUNC or ESEXP_TERM_VAR */
    	gchar *name;
    	gpointer data;
    	union {
    		ESExpFunc *func;
    		ESExpIFunc *ifunc;
    	} f;
    };

### struct ESExpTerm

    struct ESExpTerm {
    	ESExpTermType type;
    	union {
    		gchar *string;
    		gint number;
    		gint boolean;
    		time_t time;
    		struct {
    			struct _ESExpSymbol *sym;
    			struct _ESExpTerm **terms;
    			gint termcount;
    		} func;
    		struct _ESExpSymbol *var;
    	} value;
    };