xb-opcode

xb-opcode

Functions

gboolean xb_opcode_cmp_val ()
gboolean xb_opcode_cmp_str ()
gchar * xb_opcode_to_string ()
const gchar * xb_opcode_kind_to_string ()
XbOpcodeKind xb_opcode_kind_from_string ()
void xb_opcode_unref ()
XbOpcode * xb_opcode_ref ()
XbOpcodeKind xb_opcode_get_kind ()
const gchar * xb_opcode_get_str ()
guint32 xb_opcode_get_val ()
XbOpcode * xb_opcode_func_new ()
XbOpcode * xb_opcode_integer_new ()
XbOpcode * xb_opcode_text_new ()
XbOpcode * xb_opcode_text_new_static ()
XbOpcode * xb_opcode_text_new_steal ()

Types and Values

Description

Functions

xb_opcode_cmp_val ()

gboolean
xb_opcode_cmp_val (XbOpcode *self);

Checks if the opcode can be compared using the integer value.

Parameters

self

a XbOpcode

 

Returns

#TRUE if this opcode can be compared as an integer

Since: 0.1.1


xb_opcode_cmp_str ()

gboolean
xb_opcode_cmp_str (XbOpcode *self);

Checks if the opcode can be compared using the string value.

Parameters

self

a XbOpcode

 

Returns

#TRUE if this opcode can be compared as an string

Since: 0.1.1


xb_opcode_to_string ()

gchar *
xb_opcode_to_string (XbOpcode *self);

Returns a string representing the specific opcode.

Parameters

self

a XbOpcode

 

Returns

text

Since: 0.1.4


xb_opcode_kind_to_string ()

const gchar *
xb_opcode_kind_to_string (XbOpcodeKind kind);

Converts the opcode kind to a string.

Parameters

Returns

opcode kind, e.g. FUNC

Since: 0.1.1


xb_opcode_kind_from_string ()

XbOpcodeKind
xb_opcode_kind_from_string (const gchar *str);

Converts a string to an opcode kind.

Parameters

str

a string, e.g. FUNC

 

Since: 0.1.1


xb_opcode_unref ()

void
xb_opcode_unref (XbOpcode *self);

Decrements the reference count of the opcode, freeing the object when the refcount drops to zero.

Parameters

self

a XbOpcode

 

Since: 0.1.1


xb_opcode_ref ()

XbOpcode *
xb_opcode_ref (XbOpcode *self);

Increments the refcount of the opcode.

Parameters

self

a XbOpcode

 

Returns

the original self XbOpcode instance.

[transfer none]

Since: 0.1.1


xb_opcode_get_kind ()

XbOpcodeKind
xb_opcode_get_kind (XbOpcode *self);

Gets the opcode kind.

Parameters

self

a XbOpcode

 

Since: 0.1.1


xb_opcode_get_str ()

const gchar *
xb_opcode_get_str (XbOpcode *self);

Gets the string value stored on the opcode.

Parameters

self

a XbOpcode

 

Returns

a string, or NULL if unset

Since: 0.1.1


xb_opcode_get_val ()

guint32
xb_opcode_get_val (XbOpcode *self);

Gets the integer value stored in the opcode. This may be a function ID, a index into the string table or a literal integer.

Parameters

self

a XbOpcode

 

Returns

value, or 0 for unset.

Since: 0.1.1


xb_opcode_func_new ()

XbOpcode *
xb_opcode_func_new (guint32 func);

Creates an opcode for a specific function. Custom functions can be registered using xb_machine_add_func() and retrieved using xb_machine_opcode_func_new().

Parameters

func

a function index

 

Returns

a XbOpcode.

[transfer full]

Since: 0.1.1


xb_opcode_integer_new ()

XbOpcode *
xb_opcode_integer_new (guint32 val);

Creates an opcode with an literal integer.

Parameters

val

a integer value

 

Returns

a XbOpcode.

[transfer full]

Since: 0.1.1


xb_opcode_text_new ()

XbOpcode *
xb_opcode_text_new (const gchar *str);

Creates a new text literal opcode. The str argument is copied internally and is not tied to the lifecycle of the XbOpcode.

Parameters

str

a string

 

Returns

a XbOpcode.

[transfer full]

Since: 0.1.1


xb_opcode_text_new_static ()

XbOpcode *
xb_opcode_text_new_static (const gchar *str);

Creates a new text literal opcode, where str is either static text or will outlive the XbOpcode lifecycle.

Parameters

str

a string

 

Returns

a XbOpcode.

[transfer full]

Since: 0.1.1


xb_opcode_text_new_steal ()

XbOpcode *
xb_opcode_text_new_steal (gchar *str);

Creates a new text literal opcode, stealing the str . Once the opcode is finalized g_free() will be called on str .

Parameters

str

a string

 

Returns

a XbOpcode.

[transfer full]

Since: 0.1.1

Types and Values

enum XbOpcodeFlags

The opcode flags. The values have been carefully chosen so that a simple bitmask can be done to know how to compare for equality.

function─┐ ┌─string bound──┐ │ │ ┌──integer │ │ │ │ X X X X X X X 8 4 2 1

Members

XB_OPCODE_FLAG_UNKNOWN

   

XB_OPCODE_FLAG_INTEGER

   

XB_OPCODE_FLAG_TEXT

   

XB_OPCODE_FLAG_FUNCTION

   

XB_OPCODE_FLAG_BOUND

   

XB_OPCODE_FLAG_BOOLEAN

   

enum XbOpcodeKind

Members

XB_OPCODE_KIND_UNKNOWN

   

XB_OPCODE_KIND_INTEGER

   

XB_OPCODE_KIND_TEXT

   

XB_OPCODE_KIND_FUNCTION

   

XB_OPCODE_KIND_BOUND_UNSET

   

XB_OPCODE_KIND_BOUND_INTEGER

   

XB_OPCODE_KIND_BOUND_TEXT

   

XB_OPCODE_KIND_INDEXED_TEXT

   

XB_OPCODE_KIND_BOOLEAN