Cattle.Program¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
Get/set program’s input |
||
r/w |
Get/set instructions |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Cattle.Program(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Opaque data structure representing a program. It should never be accessed directly.
- classmethod new()[source]¶
- Returns:
a new
Cattle.Program
- Return type:
Create a new
Cattle.Program
.A single instance of a program can be shared between multiple interpreters, as long as the object is not modified after it has been initialized.
- get_input()[source]¶
- Returns:
input for self
- Return type:
Get the input for self. See
Cattle.Program.set_input
().
- get_instructions()[source]¶
- Returns:
the first instruction in self
- Return type:
Get the instructions for self. See
Cattle.Program.load
() andCattle.Program.set_instructions
().
- load(buffer)[source]¶
- Parameters:
buffer (
Cattle.Buffer
) – aCattle.Buffer
containing the code- Raises:
- Returns:
- Return type:
Load self from buffer.
The buffer can optionally contain also the input for the program: in that case, the input must be separated from the code by a bang (!) character.
In case of failure, error is filled with detailed information. The error domain is %CATTLE_ERROR, and the error code is from the
Cattle.Error
enumeration.
- set_input(input)[source]¶
- Parameters:
input (
Cattle.Buffer
) – input for self
Set the input for self.
If the size of input is zero, the program’s input will be retrieved at runtime.
- set_instructions(instructions)[source]¶
- Parameters:
instructions (
Cattle.Instruction
) – instructions for self
Set the instructions for self.
You shouldn’t usually need to use this: see
Cattle.Program.load
() for the standard way to load a program.
Property Details¶
- Cattle.Program.props.input¶
- Name:
input
- Type:
- Default Value:
- Flags:
Input for the program, or
None
if no input was available at the time of loading.Changes to this property are not notified.
- Cattle.Program.props.instructions¶
- Name:
instructions
- Type:
- Default Value:
- Flags:
Instructions for the program.
Changes to this property are not notified.