| Top |
| gboolean | (*XbMachineOpcodeFixupFunc) () |
| gboolean | (*XbMachineTextHandlerFunc) () |
| gboolean | (*XbMachineMethodFunc) () |
| XbMachine * | xb_machine_new () |
| void | xb_machine_set_debug_flags () |
| XbStack * | xb_machine_parse () |
| XbStack * | xb_machine_parse_full () |
| gboolean | xb_machine_run () |
| void | xb_machine_add_opcode_fixup () |
| void | xb_machine_add_text_handler () |
| void | xb_machine_add_method () |
| void | xb_machine_add_operator () |
| XbOpcode * | xb_machine_opcode_func_new () |
| gchar * | xb_machine_opcode_to_string () |
| gchar * | xb_machine_opcodes_to_string () |
| XbOpcode * | xb_machine_stack_pop () |
| void | xb_machine_stack_push () |
| void | xb_machine_stack_push_steal () |
| void | xb_machine_stack_push_text () |
| void | xb_machine_stack_push_text_static () |
| void | xb_machine_stack_push_text_steal () |
| void | xb_machine_stack_push_integer () |
| void | xb_machine_set_stack_size () |
| guint | xb_machine_get_stack_size () |
| #define | XB_TYPE_MACHINE |
| struct | XbMachineClass |
| enum | XbMachineDebugFlags |
| enum | XbMachineParseFlags |
| XbMachine |
gboolean (*XbMachineOpcodeFixupFunc) (XbMachine *self,XbStack *opcodes,gpointer user_data,GError **error);
gboolean (*XbMachineTextHandlerFunc) (XbMachine *self,XbStack *opcodes,const gchar *text,gboolean *handled,gpointer user_data,GError **error);
gboolean (*XbMachineMethodFunc) (XbMachine *self,XbStack *stack,gboolean *result_unused,gpointer exec_data,gpointer user_data,GError **error);
void xb_machine_set_debug_flags (XbMachine *self,XbMachineDebugFlags flags);
Sets the debug level of the virtual machine.
Since: 0.1.1
XbStack * xb_machine_parse (XbMachine *self,const gchar *text,gssize text_len,GError **error);
xb_machine_parse is deprecated and should not be used in newly-written code.
Parses an XPath predicate. Not all of XPath 1.0 or XPath 1.0 is supported,
and new functions and mnemonics can be added using xb_machine_add_method()
and xb_machine_add_text_handler().
self |
||
text |
predicate to parse, e.g. |
|
text_len |
length of |
|
error |
a GError, or |
Since: 0.1.1
XbStack * xb_machine_parse_full (XbMachine *self,const gchar *text,gssize text_len,XbMachineParseFlags flags,GError **error);
Parses an XPath predicate. Not all of XPath 1.0 or XPath 1.0 is supported,
and new functions and mnemonics can be added using xb_machine_add_method()
and xb_machine_add_text_handler().
self |
||
text |
predicate to parse, e.g. |
|
text_len |
length of |
|
flags |
||
error |
a GError, or |
Since: 0.1.4
gboolean xb_machine_run (XbMachine *self,XbStack *opcodes,gboolean *result,gpointer exec_data,GError **error);
Runs a set of opcodes on the virtual machine.
It is safe to call this function from a different thread to the one that created the XbMachine.
self |
||
opcodes |
a XbStack of opcodes |
|
result |
return status after running |
[out] |
exec_data |
per-run user data that is passed to all the XbMachineMethodFunc functions |
|
error |
a GError, or |
Since: 0.1.1
void xb_machine_add_opcode_fixup (XbMachine *self,const gchar *opcodes_sig,XbMachineOpcodeFixupFunc fixup_cb,gpointer user_data,GDestroyNotify user_data_free);
Adds an opcode fixup. Fixups can be used to optimize the stack of opcodes or to add support for a nonstandard feature, for instance supporting missing attributes to functions.
self |
||
opcodes_sig |
signature, e.g. |
|
fixup_cb |
callback |
|
user_data |
user pointer to pass to |
|
user_data_free |
a function which gets called to free |
Since: 0.1.1
void xb_machine_add_text_handler (XbMachine *self,XbMachineTextHandlerFunc handler_cb,gpointer user_data,GDestroyNotify user_data_free);
Adds a text handler. This allows the virtual machine to support nonstandard encoding or shorthand mnemonics for standard functions.
self |
||
handler_cb |
callback |
|
user_data |
user pointer to pass to |
|
user_data_free |
a function which gets called to free |
Since: 0.1.1
void xb_machine_add_method (XbMachine *self,const gchar *name,guint n_opcodes,XbMachineMethodFunc method_cb,gpointer user_data,GDestroyNotify user_data_free);
Adds a new function to the virtual machine. Registered functions can then be used as methods.
You need to add a custom function using xb_machine_add_method() before using
methods that may reference it, for example xb_machine_add_opcode_fixup().
self |
||
name |
function name, e.g. |
|
n_opcodes |
minimum number of opcodes required on the stack |
|
method_cb |
function to call |
|
user_data |
user pointer to pass to |
|
user_data_free |
a function which gets called to free |
Since: 0.1.1
void xb_machine_add_operator (XbMachine *self,const gchar *str,const gchar *name);
Adds a new operator to the virtual machine. Operators can then be used
instead of explicit methods like .eq()
You need to add a custom operator using xb_machine_add_operator() before
using xb_machine_parse(). Common operators like <= and = are built-in
and do not have to be added manually.
Since: 0.1.1
XbOpcode * xb_machine_opcode_func_new (XbMachine *self,const gchar *func_name);
Creates a new opcode for a registered function. Some standard opcodes are
registered by default, for instance eq or ge. Other opcodes have to be
added using xb_machine_add_method().
Since: 0.1.1
gchar * xb_machine_opcode_to_string (XbMachine *self,XbOpcode *opcode);
xb_machine_opcode_to_string is deprecated and should not be used in newly-written code.
Returns a string representing the specific opcode.
Since: 0.1.1
gchar * xb_machine_opcodes_to_string (XbMachine *self,XbStack *opcodes);
xb_machine_opcodes_to_string is deprecated and should not be used in newly-written code.
Returns a string representing a set of opcodes.
Since: 0.1.1
XbOpcode * xb_machine_stack_pop (XbMachine *self,XbStack *stack);
Pops an opcode from the stack.
Since: 0.1.1
void xb_machine_stack_push (XbMachine *self,XbStack *stack,XbOpcode *opcode);
Adds an opcode to the stack.
Since: 0.1.1
void xb_machine_stack_push_steal (XbMachine *self,XbStack *stack,XbOpcode *opcode);
Adds an stolen opcode to the stack.
Since: 0.1.4
void xb_machine_stack_push_text (XbMachine *self,XbStack *stack,const gchar *str);
Adds a text literal to the stack, copying str
.
Since: 0.1.1
void xb_machine_stack_push_text_static (XbMachine *self,XbStack *stack,const gchar *str);
Adds static text literal to the stack.
Since: 0.1.1
void xb_machine_stack_push_text_steal (XbMachine *self,XbStack *stack,gchar *str);
Adds a stolen text literal to the stack.
Since: 0.1.1
void xb_machine_stack_push_integer (XbMachine *self,XbStack *stack,guint32 val);
Adds an integer literal to the stack.
Since: 0.1.1
void xb_machine_set_stack_size (XbMachine *self,guint stack_size);
Sets the maximum stack size used for the machine.
The stack size will be affective for new jobs started with xb_machine_run()
and xb_machine_parse().
Since: 0.1.3