Xmlb.Opcode

Fields

None

Methods

class

kind_from_string (str)

class

kind_to_string (kind)

cmp_str ()

cmp_val ()

func_init (func)

get_kind ()

get_str ()

get_val ()

integer_init (val)

text_init (str)

text_init_static (str)

text_init_steal (str)

to_string ()

Details

class Xmlb.Opcode
classmethod kind_from_string(str)
Parameters:

str (str) – a string, e.g. FUNC

Returns:

a Xmlb.OpcodeKind, e.g. Xmlb.OpcodeKind.TEXT

Return type:

Xmlb.OpcodeKind

Converts a string to an opcode kind.

New in version 0.1.1.

classmethod kind_to_string(kind)
Parameters:

kind (Xmlb.OpcodeKind) – a Xmlb.OpcodeKind, e.g. Xmlb.OpcodeKind.FUNCTION

Returns:

opcode kind, e.g. FUNC

Return type:

str

Converts the opcode kind to a string.

New in version 0.1.1.

cmp_str()
Returns:

#:obj:True if this opcode can be compared as an string

Return type:

bool

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

New in version 0.1.1.

cmp_val()
Returns:

#:obj:True if this opcode can be compared as an integer

Return type:

bool

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

New in version 0.1.1.

func_init(func)
Parameters:

func (int) – a function index

Initialises a stack allocated Xmlb.Opcode to contain a specific function. Custom functions can be registered using xb_machine_add_func() and retrieved using xb_machine_opcode_func_new().

New in version 0.2.0.

get_kind()
Returns:

a Xmlb.OpcodeKind, e.g. Xmlb.OpcodeKind.INTEGER

Return type:

Xmlb.OpcodeKind

Gets the opcode kind.

New in version 0.1.1.

get_str()
Returns:

a string, or None if unset

Return type:

str

Gets the string value stored on the opcode.

New in version 0.1.1.

get_val()
Returns:

value, or 0 for unset.

Return type:

int

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

New in version 0.1.1.

integer_init(val)
Parameters:

val (int) – a integer value

Initialises a stack allocated Xmlb.Opcode to contain an integer literal.

New in version 0.2.0.

text_init(str)
Parameters:

str (str) – a string

Initialises a stack allocated Xmlb.Opcode to contain a text literal. The str argument is copied internally and is not tied to the lifecycle of the Xmlb.Opcode.

New in version 0.2.0.

text_init_static(str)
Parameters:

str (str) – a string

Initialises a stack allocated Xmlb.Opcode to contain a text literal, where str is either static text or will outlive the Xmlb.Opcode lifecycle.

New in version 0.2.0.

text_init_steal(str)
Parameters:

str (str) – a string

Initialises a stack allocated Xmlb.Opcode to contain a text literal, stealing the str. Once the opcode is finalized GLib.free() will be called on str.

New in version 0.2.0.

to_string()
Returns:

text

Return type:

str

Returns a string representing the specific opcode.

New in version 0.1.4.