CattleConfiguration

CattleConfiguration — Configuration for an interpreter

Synopsis

#include <cattle/cattle.h>

enum                CattleOnEOFAction;
struct              CattleConfiguration;
CattleConfiguration * cattle_configuration_new          (void);
void                cattle_configuration_set_on_eof_action
                                                        (CattleConfiguration *configuration,
                                                         CattleOnEOFAction action);
CattleOnEOFAction   cattle_configuration_get_on_eof_action
                                                        (CattleConfiguration *configuration);
void                cattle_configuration_set_debug_is_enabled
                                                        (CattleConfiguration *configuration,
                                                         gboolean enabled);
gboolean            cattle_configuration_get_debug_is_enabled
                                                        (CattleConfiguration *configuration);

Object Hierarchy

  GObject
   +----CattleConfiguration

Properties

  "debug-is-enabled"         gboolean              : Read / Write
  "on-eof-action"            CattleOnEOFAction     : Read / Write

Description

A CattleConfiguration contains the configuration for a CattleInterpreter.

Details

enum CattleOnEOFAction

typedef enum {
	CATTLE_ON_EOF_STORE_ZERO,
	CATTLE_ON_EOF_STORE_EOF,
	CATTLE_ON_EOF_DO_NOTHING
} CattleOnEOFAction;

Possible actions to be performed by a CattleInterpreter when an EOF character is encountered in the input.

CATTLE_ON_EOF_STORE_ZERO

Store a zero in the current cell. This is the default behaviour

CATTLE_ON_EOF_STORE_EOF

Store an EOF character in the current cell

CATTLE_ON_EOF_DO_NOTHING

Do nothing.

struct CattleConfiguration

struct CattleConfiguration;

Opaque data structure representing a configuration. It should never be accessed directly; use the methods below instead.


cattle_configuration_new ()

CattleConfiguration * cattle_configuration_new          (void);

Create and initialize a new configuration.

A single configuration object can be shared between multiple interpreters, but modifying it while an interpreter is running can lead to unexpected and unpredictable results.

Returns :

a new CattleConfiguration. [transfer full]

cattle_configuration_set_on_eof_action ()

void                cattle_configuration_set_on_eof_action
                                                        (CattleConfiguration *configuration,
                                                         CattleOnEOFAction action);

Set the action to be performed when an EOF character is encountered in the input.

Accepted values are from the CattleOnEOFAction enumeration.

configuration :

a CattleConfiguration

action :

the action to be performed

cattle_configuration_get_on_eof_action ()

CattleOnEOFAction   cattle_configuration_get_on_eof_action
                                                        (CattleConfiguration *configuration);

Get the action to be performed when an EOF character is read from the input source. See cattle_configuration_set_on_eof_action().

configuration :

a CattleConfiguration

Returns :

the current action

cattle_configuration_set_debug_is_enabled ()

void                cattle_configuration_set_debug_is_enabled
                                                        (CattleConfiguration *configuration,
                                                         gboolean enabled);

Set the status of the debugging support. It is disabled by default.

If debugging is disabled, instructions whose value is CATTLE_INSTRUCTION_DEBUG will be ignored by the interpreter.

configuration :

a CattleConfiguration

enabled :

TRUE to enable debug, FALSE otherwise

cattle_configuration_get_debug_is_enabled ()

gboolean            cattle_configuration_get_debug_is_enabled
                                                        (CattleConfiguration *configuration);

Get the current status of the debugging support. See cattle_configuration_set_debug_is_enabled().

configuration :

a CattleConfiguration

Returns :

TRUE if debugging is enabled, FALSE otherwise

Property Details

The "debug-is-enabled" property

  "debug-is-enabled"         gboolean              : Read / Write

If FALSE, instructions whose value is CATTLE_INSTRUCTION_DEBUG are not executed by the interpreter.

Changes to this property are not notified.

Default value: FALSE


The "on-eof-action" property

  "on-eof-action"            CattleOnEOFAction     : Read / Write

Action to be performed when an EOF character is encountered in the input.

Changes to this property are not notified.

Default value: CATTLE_ON_EOF_STORE_ZERO