ESExp
3
LIBEDATASERVER Library

# ESExp

## Synopsis

    #define             E_TYPE_SEXP
    #define             E_SEXP                              (obj)
    #define             E_SEXP_CLASS                        (klass)
    #define             IS_E_SEXP                           (obj)
    #define             IS_E_SEXP_CLASS                     (klass)
    #define             E_SEXP_GET_CLASS                    (obj)
                        ESExpSymbol;
                        ESExpResult;
                        ESExpTerm;
    GType               e_sexp_get_type                     (void);
    ESExp*              e_sexp_new                          (void);
    void                e_sexp_ref                          (ESExp *f);
    void                e_sexp_unref                        (ESExp *f);
    void                e_sexp_add_function                 (ESExp *f,
                                                             int scope,
                                                             char *name,
                                                             ESExpFunc *func,
                                                             void *data);
    void                e_sexp_add_ifunction                (ESExp *f,
                                                             int scope,
                                                             char *name,
                                                             ESExpIFunc *func,
                                                             void *data);
    void                e_sexp_add_variable                 (ESExp *f,
                                                             int scope,
                                                             char *name,
                                                             ESExpTerm *value);
    void                e_sexp_remove_symbol                (ESExp *f,
                                                             int scope,
                                                             char *name);
    int                 e_sexp_set_scope                    (ESExp *f,
                                                             int scope);
    void                e_sexp_input_text                   (ESExp *f,
                                                             const char *text,
                                                             int len);
    void                e_sexp_input_file                   (ESExp *f,
                                                             int fd);
    int                 e_sexp_parse                        (ESExp *f);
    ESExpResult*        e_sexp_eval                         (ESExp *f);
    ESExpResult*        e_sexp_term_eval                    (struct _ESExp *f,
                                                             struct _ESExpTerm *t);
    ESExpResult*        e_sexp_result_new                   (struct _ESExp *f,
                                                             int type);
    void                e_sexp_result_free                  (struct _ESExp *f,
                                                             struct _ESExpResult *t);
    void                e_sexp_resultv_free                 (struct _ESExp *f,
                                                             int argc,
                                                             struct _ESExpResult **argv);
    void                e_sexp_encode_bool                  (GString *s,
                                                             gboolean state);
    void                e_sexp_encode_string                (GString *s,
                                                             const char *string);
    void                e_sexp_fatal_error                  (struct _ESExp *f,
                                                             char *why,
                                                             ...);
    const char*         e_sexp_error                        (struct _ESExp *f);

## Description

## Details

### E_TYPE_SEXP

    #define             E_TYPE_SEXP

### E_SEXP()

    #define             E_SEXP(obj)

`obj` :

### E_SEXP_CLASS()

    #define             E_SEXP_CLASS(klass)

`klass` :

### IS_E_SEXP()

    #define             IS_E_SEXP(obj)

`obj` :

### IS_E_SEXP_CLASS()

    #define             IS_E_SEXP_CLASS(klass)

`klass` :

### E_SEXP_GET_CLASS()

    #define             E_SEXP_GET_CLASS(obj)

`obj` :

### ESExpSymbol

    typedef struct {
    	int type;		/* ESEXP_TERM_FUNC or ESEXP_TERM_VAR */
    	char *name;
    	void *data;
    	union {
    		ESExpFunc *func;
    		ESExpIFunc *ifunc;
    	} f;
    } ESExpSymbol;

### ESExpResult

    typedef struct {
    	enum _ESExpResultType type;
    	union {
    		GPtrArray *ptrarray;
    		int number;
    		char *string;
    		int bool;
    		time_t time;
    	} value;
    } ESExpResult;

### ESExpTerm

    typedef struct {
    	enum _ESExpTermType type;
    	union {
    		char *string;
    		int number;
    		int bool;
    		time_t time;
    		struct {
    			struct _ESExpSymbol *sym;
    			struct _ESExpTerm **terms;
    			int termcount;
    		} func;
    		struct _ESExpSymbol *var;
    	} value;
    } ESExpTerm;

### e_sexp_get_type ()

    GType               e_sexp_get_type                     (void);

Returns :

### e_sexp_new ()

    ESExp*              e_sexp_new                          (void);

Returns :

### e_sexp_ref ()

    void                e_sexp_ref                          (ESExp *f);

`f` :

### e_sexp_unref ()

    void                e_sexp_unref                        (ESExp *f);

`f` :

### e_sexp_add_function ()

    void                e_sexp_add_function                 (ESExp *f,
                                                             int scope,
                                                             char *name,
                                                             ESExpFunc *func,
                                                             void *data);

`f` :

`scope` :

`name` :

`func` :

`data` :

### e_sexp_add_ifunction ()

    void                e_sexp_add_ifunction                (ESExp *f,
                                                             int scope,
                                                             char *name,
                                                             ESExpIFunc *func,
                                                             void *data);

`f` :

`scope` :

`name` :

`func` :

`data` :

### e_sexp_add_variable ()

    void                e_sexp_add_variable                 (ESExp *f,
                                                             int scope,
                                                             char *name,
                                                             ESExpTerm *value);

`f` :

`scope` :

`name` :

`value` :

### e_sexp_remove_symbol ()

    void                e_sexp_remove_symbol                (ESExp *f,
                                                             int scope,
                                                             char *name);

`f` :

`scope` :

`name` :

### e_sexp_set_scope ()

    int                 e_sexp_set_scope                    (ESExp *f,
                                                             int scope);

`f` :

`scope` :

Returns :

### e_sexp_input_text ()

    void                e_sexp_input_text                   (ESExp *f,
                                                             const char *text,
                                                             int len);

`f` :

`text` :

`len` :

### e_sexp_input_file ()

    void                e_sexp_input_file                   (ESExp *f,
                                                             int fd);

`f` :

`fd` :

### e_sexp_parse ()

    int                 e_sexp_parse                        (ESExp *f);

`f` :

Returns :

### e_sexp_eval ()

    ESExpResult*        e_sexp_eval                         (ESExp *f);

`f` :

Returns :

### e_sexp_term_eval ()

    ESExpResult*        e_sexp_term_eval                    (struct _ESExp *f,
                                                             struct _ESExpTerm *t);

`f` :

`t` :

Returns :

### e_sexp_result_new ()

    ESExpResult*        e_sexp_result_new                   (struct _ESExp *f,
                                                             int type);

`f` :

`type` :

Returns :

### e_sexp_result_free ()

    void                e_sexp_result_free                  (struct _ESExp *f,
                                                             struct _ESExpResult *t);

`f` :

`t` :

### e_sexp_resultv_free ()

    void                e_sexp_resultv_free                 (struct _ESExp *f,
                                                             int argc,
                                                             struct _ESExpResult **argv);

`f` :

`argc` :

`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.

`s` :

`state` :

### e_sexp_encode_string ()

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

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

`s` :

  Destination string.

`string` :

  String expression.

### e_sexp_fatal_error ()

    void                e_sexp_fatal_error                  (struct _ESExp *f,
                                                             char *why,
                                                             ...);

`f` :

`why` :

`...` :

### e_sexp_error ()

    const char*         e_sexp_error                        (struct _ESExp *f);

`f` :

Returns :