| Camel Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | ||||
struct CamelSExp; struct CamelSExpSymbol; struct CamelSExpResult; struct CamelSExpTerm; enum CamelSExpResultType; CamelSExpResult (*CamelSExpFunc) (CamelSExp *sexp,,gint argcCamelSExpResult **argv,); CamelSExpResult (*CamelSExpIFunc) (gpointer dataCamelSExp *sexp,,gint argcCamelSExpTerm **argv,); enum CamelSExpTermType; CamelSExp * camel_sexp_new (gpointer datavoid);void camel_sexp_add_function (CamelSExp *sexp,,guint scopeconst,gchar *nameCamelSExpFunc func,);gpointer datavoid camel_sexp_add_ifunction (CamelSExp *sexp,,guint scopeconst,gchar *nameCamelSExpIFunc func,);gpointer datavoid camel_sexp_add_variable (CamelSExp *sexp,,guint scope,gchar *nameCamelSExpTerm *value);void camel_sexp_remove_symbol (CamelSExp *sexp,,guint scopeconst);gchar *namegint camel_sexp_set_scope (CamelSExp *sexp,);guint scopevoid camel_sexp_input_text (CamelSExp *sexp,const,gchar *text);gint lenvoid camel_sexp_input_file (CamelSExp *sexp,);gint fdgint camel_sexp_parse (CamelSExp *sexp); CamelSExpResult * camel_sexp_eval (CamelSExp *sexp); CamelSExpResult * camel_sexp_term_eval (CamelSExp *sexp,CamelSExpTerm *term); CamelSExpResult * camel_sexp_result_new (CamelSExp *sexp,);gint typevoid camel_sexp_result_free (CamelSExp *sexp,CamelSExpResult *term);void camel_sexp_resultv_free (CamelSExp *sexp,,gint argcCamelSExpResult **argv);void camel_sexp_encode_bool (,GString *string);gboolean v_boolvoid camel_sexp_encode_string (,GString *stringconst);gchar *v_stringvoid camel_sexp_fatal_error (CamelSExp *sexp,const,gchar *why...); constgchar * camel_sexp_error (CamelSExp *sexp); CamelSExpTerm * camel_sexp_parse_value (CamelSExp *sexp);gboolean camel_sexp_evaluate_occur_times (CamelSExp *sexp,,time_t *start);time_t *end
struct CamelSExpSymbol {
gint type; /* TERM_FUNC or TERM_VAR */
gchar *name;
gpointer data;
union {
CamelSExpFunc func;
CamelSExpIFunc ifunc;
} f;
};
Since 3.4
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 {
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
typedef enum {
CAMEL_SEXP_RES_ARRAY_PTR, /* type is a ptrarray, what it points to is implementation dependant */
CAMEL_SEXP_RES_INT, /* type is a number */
CAMEL_SEXP_RES_STRING, /* type is a pointer to a single string */
CAMEL_SEXP_RES_BOOL, /* boolean type */
CAMEL_SEXP_RES_TIME, /* time_t type */
CAMEL_SEXP_RES_UNDEFINED /* unknown type */
} CamelSExpResultType;
Since 3.4
CamelSExpResult (*CamelSExpFunc) (CamelSExp *sexp,,gint argcCamelSExpResult **argv,);gpointer data
Since 3.4
CamelSExpResult (*CamelSExpIFunc) (CamelSExp *sexp,,gint argcCamelSExpTerm **argv,);gpointer data
Since 3.4
typedef enum {
CAMEL_SEXP_TERM_INT, /* integer literal */
CAMEL_SEXP_TERM_BOOL, /* boolean literal */
CAMEL_SEXP_TERM_STRING, /* string literal */
CAMEL_SEXP_TERM_TIME, /* time_t literal (number of seconds past the epoch) */
CAMEL_SEXP_TERM_FUNC, /* normal function, arguments are evaluated before calling */
CAMEL_SEXP_TERM_IFUNC, /* immediate function, raw terms are arguments */
CAMEL_SEXP_TERM_VAR /* variable reference */
} CamelSExpTermType;
Since 3.4
void camel_sexp_add_function (CamelSExp *sexp,,guint scopeconst,gchar *nameCamelSExpFunc func,);gpointer data
Since 3.4
void camel_sexp_add_ifunction (CamelSExp *sexp,,guint scopeconst,gchar *nameCamelSExpIFunc func,);gpointer data
Since 3.4
void camel_sexp_add_variable (CamelSExp *sexp,,guint scope,gchar *nameCamelSExpTerm *value);
Since 3.4
void camel_sexp_remove_symbol (CamelSExp *sexp,,guint scopeconst);gchar *name
Since 3.4
void camel_sexp_input_text (CamelSExp *sexp,const,gchar *text);gint len
Since 3.4
CamelSExpResult * camel_sexp_term_eval (CamelSExp *sexp,CamelSExpTerm *term);
Since 3.4
CamelSExpResult * camel_sexp_result_new (CamelSExp *sexp,);gint type
Since 3.4
void camel_sexp_result_free (CamelSExp *sexp,CamelSExpResult *term);
Since 3.4
void camel_sexp_resultv_free (CamelSExp *sexp,,gint argcCamelSExpResult **argv);
Since 3.4
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
void camel_sexp_encode_string (,GString *stringconst);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.
|
Destination string. |
|
String expression. |
Since 3.4
void camel_sexp_fatal_error (CamelSExp *sexp,const,gchar *why...);
Since 3.4
gboolean camel_sexp_evaluate_occur_times (CamelSExp *sexp,,time_t *start);time_t *end