## CamelSExp

CamelSExp

## Functions

CamelSExpResult | (*CamelSExpFunc) ()
CamelSExpResult | (*CamelSExpIFunc) ()
CamelSExp * | camel_sexp_new ()
void | camel_sexp_add_function ()
void | camel_sexp_add_ifunction ()
void | camel_sexp_add_variable ()
void | camel_sexp_remove_symbol ()
gint | camel_sexp_set_scope ()
void | camel_sexp_input_text ()
void | camel_sexp_input_file ()
gint | camel_sexp_parse ()
CamelSExpResult * | camel_sexp_eval ()
CamelSExpResult * | camel_sexp_term_eval ()
CamelSExpResult * | camel_sexp_result_new ()
void | camel_sexp_result_free ()
void | camel_sexp_resultv_free ()
void | camel_sexp_encode_bool ()
void | camel_sexp_encode_string ()
void | camel_sexp_fatal_error ()
const gchar * | camel_sexp_error ()
CamelSExpTerm * | camel_sexp_parse_value ()
gboolean | camel_sexp_evaluate_occur_times ()

## Types and Values

struct | CamelSExp
struct | CamelSExpSymbol
struct | CamelSExpResult
struct | CamelSExpTerm
enum | CamelSExpResultType
enum | CamelSExpTermType

## Object Hierarchy

        GObject
        ╰── CamelSExp

## Description

## Functions

### CamelSExpFunc ()

    CamelSExpResult
    (*CamelSExpFunc) (CamelSExp *sexp,
                      gint argc,
                      CamelSExpResult **argv,
                      gpointer data);

Since 3.4

### CamelSExpIFunc ()

    CamelSExpResult
    (*CamelSExpIFunc) (CamelSExp *sexp,
                       gint argc,
                       CamelSExpTerm **argv,
                       gpointer data);

Since 3.4

### camel_sexp_new ()

    CamelSExp *
    camel_sexp_new (void);

Since 3.4

### camel_sexp_add_function ()

    void
    camel_sexp_add_function (CamelSExp *sexp,
                             guint scope,
                             const gchar *name,
                             CamelSExpFunc func,
                             gpointer data);

Since 3.4

### camel_sexp_add_ifunction ()

    void
    camel_sexp_add_ifunction (CamelSExp *sexp,
                              guint scope,
                              const gchar *name,
                              CamelSExpIFunc func,
                              gpointer data);

Since 3.4

### camel_sexp_add_variable ()

    void
    camel_sexp_add_variable (CamelSExp *sexp,
                             guint scope,
                             gchar *name,
                             CamelSExpTerm *value);

Since 3.4

### camel_sexp_remove_symbol ()

    void
    camel_sexp_remove_symbol (CamelSExp *sexp,
                              guint scope,
                              const gchar *name);

Since 3.4

### camel_sexp_set_scope ()

    gint
    camel_sexp_set_scope (CamelSExp *sexp,
                          guint scope);

Since 3.4

### camel_sexp_input_text ()

    void
    camel_sexp_input_text (CamelSExp *sexp,
                           const gchar *text,
                           gint len);

Since 3.4

### camel_sexp_input_file ()

    void
    camel_sexp_input_file (CamelSExp *sexp,
                           gint fd);

Since 3.4

### camel_sexp_parse ()

    gint
    camel_sexp_parse (CamelSExp *sexp);

Since 3.4

### camel_sexp_eval ()

    CamelSExpResult *
    camel_sexp_eval (CamelSExp *sexp);

Since 3.4

### camel_sexp_term_eval ()

    CamelSExpResult *
    camel_sexp_term_eval (CamelSExp *sexp,
                          CamelSExpTerm *term);

Since 3.4

### camel_sexp_result_new ()

    CamelSExpResult *
    camel_sexp_result_new (CamelSExp *sexp,
                           gint type);

Since 3.4

### camel_sexp_result_free ()

    void
    camel_sexp_result_free (CamelSExp *sexp,
                            CamelSExpResult *term);

Since 3.4

### camel_sexp_resultv_free ()

    void
    camel_sexp_resultv_free (CamelSExp *sexp,
                             gint argc,
                             CamelSExpResult **argv);

Since 3.4

### camel_sexp_encode_bool ()

    void
    camel_sexp_encode_bool (GString *string,
                            gboolean v_bool);

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

Since 3.4

### camel_sexp_encode_string ()

    void
    camel_sexp_encode_string (GString *string,
                              const gchar *v_string);

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

#### Parameters

string | Destination string. |
v_string | String expression. |

Since 3.4

### camel_sexp_fatal_error ()

    void
    camel_sexp_fatal_error (CamelSExp *sexp,
                            const gchar *why,
                            ...);

Since 3.4

### camel_sexp_error ()

    const gchar *
    camel_sexp_error (CamelSExp *sexp);

Since 3.4

### camel_sexp_parse_value ()

    CamelSExpTerm *
    camel_sexp_parse_value (CamelSExp *sexp);

Since 3.4

### camel_sexp_evaluate_occur_times ()

    gboolean
    camel_sexp_evaluate_occur_times (CamelSExp *sexp,
                                     time_t *start,
                                     time_t *end);

## Types and Values

### struct CamelSExp

    struct CamelSExp;

Since 3.4

### struct CamelSExpSymbol

    struct CamelSExpSymbol {
    	gint type;		/* TERM_FUNC or TERM_VAR */
    	gchar *name;
    	gpointer data;
    	union {
    		CamelSExpFunc func;
    		CamelSExpIFunc ifunc;
    	} f;
    };

Since 3.4

### struct CamelSExpResult

    struct CamelSExpResult {
    	CamelSExpResultType 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;
    };

Since 3.4

### struct CamelSExpTerm

    struct CamelSExpTerm {
    	CamelSExpTermType type;
    	union {
    		gchar *string;
    		gint number;
    		gint boolean;
    		time_t time;
    		struct {
    			CamelSExpSymbol *sym;
    			CamelSExpTerm **terms;
    			gint termcount;
    		} func;
    		CamelSExpSymbol *var;
    	} value;
    };

Since 3.4

### enum CamelSExpResultType

#### Members

CAMEL_SEXP_RES_ARRAY_PTR |  |
CAMEL_SEXP_RES_INT |  |
CAMEL_SEXP_RES_STRING |  |
CAMEL_SEXP_RES_BOOL |  |
CAMEL_SEXP_RES_TIME |  |
CAMEL_SEXP_RES_UNDEFINED |  |

Since 3.4

### enum CamelSExpTermType

#### Members

CAMEL_SEXP_TERM_INT |  |
CAMEL_SEXP_TERM_BOOL |  |
CAMEL_SEXP_TERM_STRING |  |
CAMEL_SEXP_TERM_TIME |  |
CAMEL_SEXP_TERM_FUNC |  |
CAMEL_SEXP_TERM_IFUNC |  |
CAMEL_SEXP_TERM_VAR |  |

Since 3.4