coan 4.2.4
|
![]() |
Defines | |
#define | IMPLEMENT_STATIC(component, init_type) |
#define | IMPLEMENT_DYNAMIC(component, init_type) |
#define | IMPLEMENT(component, init_type) IMPLEMENT_STATIC(component,init_type) |
#define | USE_STATIC_INITIALISER(component) |
#define | DEFINE_USER_INIT(component) |
#define | DEFINE_USER_FINIS(component) |
#define | INCLUDE_PUBLIC(component) PUBLIC_STATE_T(component) PUBLIC_STATE(component) |
#define | STATE_DEF(component) typedef struct component##_state_s |
#define | STATE_T(component) component##_state_t |
#define | NO_PRIVATE_STATE(component) typedef PUBLIC_STATE_T(component) STATE_T(component) |
#define | GET_STATE(component, field) GET_STATIC_STATE(component,field) |
#define | SET_STATE(component, field) SET_STATIC_STATE(component,field) |
Enumerations | |
enum | component_storage_type { STATE_STATIC, STATE_DYNAMIC } |
enum | component_initialisation_type { ZERO_INITABLE, STATIC_INITABLE, USER_INITABLE } |
implementation file.
#define DEFINE_USER_FINIS | ( | component | ) |
DECL_USER_FINIS(component);\ DECL_USER_FINIS_HANDLE(component) = &USER_FINIS(component);\ void USER_FINIS(component)
Define a user finalisation function for component.
component | Name of the component. The function body should be written immediately after the macro invocation: |
The macro generates the function signature:
A user finalisation function must be defined if the component is implemented with initialisation type USER_INITABLE
. The user finalisation function USER_FINIS(component)
should not be confused with the generated component finalisation function FINITOR(component)
. USER_FINIS(component)
does not need to destroy storage for the component's state, even if the component is implemented dynamically. That dynamic storage will be disposed of by FINITOR(component)
. USER_FINIS(component)
need only finalise the elements of the state structure.
Definition at line 732 of file state_utils.h.
#define DEFINE_USER_INIT | ( | component | ) |
DECL_USER_INIT(component);\ DECL_USER_INIT_HANDLE(component) = &USER_INIT(component);\ void USER_INIT(component)
Define a user initialisation function for component.
component | Name of the component. The function body should be written immediately after the macro invocation: |
The macro generates the function signature:
A user initialisation function must be defined if the component is implemented with initialisation type USER_INITABLE
. The user initialisation function USER_INIT(component)
should not be confused with the generated component initialisation function INITOR(component)
. USER_INIT(component)
does not need to provide storage for the component's state. It can assume that storage is addressed by the STATE_T(component) *
argument and need only initialise the the elements of the state structure.
Definition at line 708 of file state_utils.h.
#define GET_STATE | ( | component, | |
field | |||
) | GET_STATIC_STATE(component,field) |
Abbreviate GET_STATIC_STATE
as GET_STATE
when DEFAULT_STATIC_STATE
is defined.
Invoke this macro in the component's implementation file to evaluate a field in the component's global state. If the field also belongs to the component's public state, then prefer GET_PUBLIC
.
Definition at line 780 of file state_utils.h.
Referenced by backup_infile(), chew_on(), close_io(), compose_contradiction_insert_format(), dead_line(), debug(), directive_text_add(), directive_text_lookup(), drop(), ensure_buf(), eval_possible_symbol(), eval_unary(), exit_diagnostics(), exitcode(), filter_filename(), finish_args(), flush_contradiction(), forget_contradiction(), forget_pending_contradiction(), get_exit_flags(), if_depth(), if_start_line(), if_state(), input_opened(), insert_pending_contradiction(), is_unconditional_line(), make_backup_name(), make_tempfile(), nest(), open_output(), parse_args_file(), print(), read_filename(), readon(), replace_infile(), report_directive(), save_contradiction(), saved_read_pos(), set_state(), substitute(), transition(), and was_unconditional_line().
#define IMPLEMENT | ( | component, | |
init_type | |||
) | IMPLEMENT_STATIC(component,init_type) |
Abbreviate IMPLEMENT_STATIC
as IMPLEMENT
when DEFAULT_STATIC_STATE
is defined.
Definition at line 666 of file state_utils.h.
#define IMPLEMENT_DYNAMIC | ( | component, | |
init_type | |||
) |
DECL_DYNAMIC_STATE(component);\ SELECT_DYNAMIC(component);\ SELECT_INITIALISATION_TYPE(component,init_type);\ DECL_STATIC_INITIALISER_HANDLE(component);\ DECL_USER_INIT_HANDLE(component);\ DECL_USER_FINIS_HANDLE(component);\ DEFINE_INITOR(component)\ DEFINE_FINITOR(component)
Implement the component's state in dynamic storage
component | Name of the component |
init_type | Type of component initialisation. One of:
|
Definition at line 651 of file state_utils.h.
#define IMPLEMENT_STATIC | ( | component, | |
init_type | |||
) |
DECL_STATIC_STATE(component);\ SELECT_STATIC(component);\ SELECT_INITIALISATION_TYPE(component,init_type);\ DECL_STATIC_INITIALISER_HANDLE(component);\ DECL_USER_INIT_HANDLE(component);\ DECL_USER_FINIS_HANDLE(component);\ DEFINE_INITOR(component)\ DEFINE_FINITOR(component)
Implement the component's state in static storage
component | Name of the component |
init_type | Type of component initialisation. One of:
|
Definition at line 634 of file state_utils.h.
#define INCLUDE_PUBLIC | ( | component | ) | PUBLIC_STATE_T(component) PUBLIC_STATE(component) |
Invoke this macro immediately after opening STATE_DEF(component)
to place the public state instance at the start of the state instance. It must be invoked at that position if the component has public as well as private state.
component | Name of the component |
Definition at line 743 of file state_utils.h.
#define NO_PRIVATE_STATE | ( | component | ) | typedef PUBLIC_STATE_T(component) STATE_T(component) |
Invoke this macro in a component's implementation file in place of STATE_DEF(component)
to say that the component's global state is simply its public state (if any ).
component | Name of the component |
Definition at line 768 of file state_utils.h.
#define SET_STATE | ( | component, | |
field | |||
) | SET_STATIC_STATE(component,field) |
Abbreviate SET_STATIC_STATE
as SET_STATE
when DEFAULT_STATE_STATIC
is defined.
Invoke this macro in the component's implementation file to code an assignable reference to a field in the component's global state.
SET_STATE(component,field) = value;
component | Name of the component |
field | Name of the field to be evaluated in the component's state. |
If the field also belongs to the component's public state, then prefer SET_PUBLIC
.
Definition at line 795 of file state_utils.h.
Referenced by args_finis(), chew_on(), chew_toplevel(), close_io(), contradiction_policy(), dataset_filter_filetypes(), debugging(), Dendif(), drop(), ensure_buf(), eval_definition_text(), eval_line(), exitcode(), if_control_toplevel(), line_despatch_no_op(), make_backup_name(), make_tempfile(), nest(), open_io(), parse_args_file(), parse_command_args(), Pendif(), print(), read_filename(), readon(), save_contradiction(), save_read_pos(), set_exit_flags(), vbail(), and vreport().
#define STATE_DEF | ( | component | ) | typedef struct component##_state_s |
Invoke this macro in a component's implementation file to open the definition of the component's global state structure:
STATE_DEF(component) {...}
component | Name of the component |
Definition at line 752 of file state_utils.h.
#define STATE_T | ( | component | ) | component##_state_t |
Invoke this macro in a component's implementation file to close the definition of the component's global state:
component | Name of the component |
Definition at line 761 of file state_utils.h.
#define USE_STATIC_INITIALISER | ( | component | ) |
DECL_STATIC_INITIALISER(component);\ DECL_STATIC_INITIALISER_HANDLE(component) = &STATIC_INITIALISER(component);\ DECL_STATIC_INITIALISER(component)
Declare a static initialiser for the component.
component | The name of the component. The macro invocation should be immediately followed by the specification of the static initialiser: |
USE_STATIC_INITIALISER(component) = {...};
The static initialiser will be copied into the component's global state instance whenever INITIALISE(component)
is invoked.
Definition at line 684 of file state_utils.h.
The initialisation type of the component's state
ZERO_INITABLE |
Module is zero-initialisable |
STATIC_INITABLE |
Module has a constant static initialiser |
USER_INITABLE |
Module has user-defined initialisation and finalisation functions |
Definition at line 616 of file state_utils.h.
The storage type of the component's state
STATE_STATIC |
Module's state is in static storage |
STATE_DYNAMIC |
Module's state is in dynamic storage |
Definition at line 608 of file state_utils.h.