Top | ![]() |
![]() |
![]() |
![]() |
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 () |
enum | CamelSExpResultType |
struct | CamelSExpResult |
enum | CamelSExpTermType |
struct | CamelSExpSymbol |
struct | CamelSExpTerm |
struct | CamelSExp |
CamelSExpResult * (*CamelSExpFunc) (CamelSExp *sexp
,gint argc
,CamelSExpResult **argv
,gpointer user_data
);
Callback type for function symbols used with camel_sexp_add_function()
.
sexp |
||
argc |
count of arguments |
|
argv |
array of values of the arguments. |
[in][array length=argc] |
user_data |
user data as passed to |
Since: 3.4
CamelSExpResult * (*CamelSExpIFunc) (CamelSExp *sexp
,gint argc
,CamelSExpTerm **argv
,gpointer user_data
);
Callback type for function symbols used with camel_sexp_add_ifunction()
.
sexp |
||
argc |
count of arguments |
|
argv |
array of values of the arguments. |
[in][array length=argc] |
user_data |
user data as passed to |
Since: 3.4
void camel_sexp_add_function (CamelSExp *sexp
,guint scope
,const gchar *name
,CamelSExpFunc func
,gpointer user_data
);
Adds a function symbol which can not perform short evaluation.
Use camel_sexp_add_ifunction()
for functions which can.
sexp |
||
scope |
a scope |
|
name |
a function name |
|
func |
a function callback. |
[scope call][closure user_data] |
user_data |
user data for |
Since: 3.4
void camel_sexp_add_ifunction (CamelSExp *sexp
,guint scope
,const gchar *name
,CamelSExpIFunc ifunc
,gpointer user_data
);
Adds a function symbol which can perform short evaluation,
or doesn't execute everything. Use camel_sexp_add_function()
for any other types of the function symbols.
sexp |
||
scope |
a scope |
|
name |
a function name |
|
ifunc |
a function callback. |
[scope call][closure user_data] |
user_data |
user data for |
Since: 3.4
void camel_sexp_add_variable (CamelSExp *sexp
,guint scope
,const gchar *name
,CamelSExpTerm *value
);
Adds a variable named name
to the given scope
, set to the given value
.
Since: 3.4
void camel_sexp_remove_symbol (CamelSExp *sexp
,guint scope
,const gchar *name
);
Revoes a symbol from a scope.
Since: 3.4
gint camel_sexp_set_scope (CamelSExp *sexp
,guint scope
);
sets the current scope for the scanner.
Since: 3.4
void camel_sexp_input_text (CamelSExp *sexp
,const gchar *text
,gint len
);
Prepares to scan a text buffer.
Since: 3.4
void camel_sexp_input_file (CamelSExp *sexp
,gint fd
);
Prepares to scan a file.
Since: 3.4
CamelSExpResult * camel_sexp_term_eval (CamelSExp *sexp
,CamelSExpTerm *term
);
Evaluates a part of the expression.
[skip]
a newly allocated result of the evaluation. Free
the returned pointer with camel_sexp_result_free()
, when no longer needed.
[transfer full]
Since: 3.4
CamelSExpResult * camel_sexp_result_new (CamelSExp *sexp
,gint type
);
[skip]
A new CamelSExpResult result structure, associated with sexp
.
Free with camel_sexp_result_free()
, when no longer needed.
[transfer full]
Since: 3.4
void camel_sexp_result_free (CamelSExp *sexp
,CamelSExpResult *result
);
Frees the result
and its internal data. Does nothing,
when the result
is NULL
.
Since: 3.4
void camel_sexp_resultv_free (CamelSExp *sexp
,gint argc
,CamelSExpResult **argv
);
Frees an array of results.
sexp |
||
argc |
a count of the |
|
argv |
an array of CamelSExpResult to free. |
[array length=argc] |
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 *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.
Since: 3.4
void camel_sexp_fatal_error (CamelSExp *sexp
,const gchar *why
,...
);
Sets an error from the given format and stops execution. Int replaces previously set error, if any.
Since: 3.4
CamelSExpTerm *
camel_sexp_parse_value (CamelSExp *sexp
);
[skip]
Since: 3.4
gboolean camel_sexp_evaluate_occur_times (CamelSExp *sexp
,time_t *start
,time_t *end
);
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; };
CamelSExpResultType |
a CamelSExpResultType, defining the |
|
a boolean whether the occuring times are used |
||
start time |
||
end time |
Since: 3.4
Defines type of a CamelSExpTerm and partly also CamelSExpSymbol
integer literal |
||
boolean literal |
||
string literal |
||
time_t literal (number of seconds past the epoch) |
||
normal function, arguments are evaluated before calling |
||
immediate function, raw terms are arguments |
||
variable reference |
Since: 3.4
struct CamelSExpSymbol { gint type; /* TERM_FUNC or TERM_VAR */ gchar *name; gpointer data; union { CamelSExpFunc func; CamelSExpIFunc ifunc; } f; };
Describes a function or a variable symbol
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