Next: conditions regex comp, Up: conditions regex [Contents][Index]
The regex error exceptional–condition object–type is used by CCTests to represent an error related to the use of POSIX regular expressions; this type is the base for more specialised types. We can instantiate this type and also derive new types from it. To catch this exceptional condition we can do:
cce_location_t L[1];
if (cce_location(L)) {
if (cctests_condition_is_regex_error(cce_condition(L))) {
CCTESTS_PC(cctests_condition_regex_error_t, C, cce_condition(L));
do_something_with(C);
}
cce_run_catch_handlers_final(L);
} else {
do_something(L);
cce_run_body_handlers(L);
}
Type of data structure representing the exceptional–condition descriptor. It has the following public fields:
cce_descriptor_t descriptorThe condition descriptor’s base values.
The parent of this type descriptor is the one referenced by cce_descriptor_runtime_error_ptr,
See CCExceptions in CCExceptions.
Type of data structure representing the exceptional–condition object. It has the following public fields:
cce_condition_runtime_error_t runtime_errorThe condition object’s base values.
int errcodeThe error code as defined by the POSIX regex API.
char error_message[1024]An array holding the ASCIIZ representation of the error description generated by
regerror(). If the message is longer than 1024 characters: it is truncated.
Set the parent of the descriptor referenced by D to the descriptor of the
exceptional–condition object–type cctests_condition_regex_error_t.
Initialisation function for the condition object. This function is meant to be called from the
initialisation function of sub–types of cctests_condition_regex_error_t.
Return a pointer to exceptional condition object. If an error occurs building the condition object: raise an exception by performing a non–local exit to L.
Return true if C if of type cctests_condition_regex_error_t; otherwise
return false.
To define a sub–type of cctests_condition_regex_error_t we can copy the code in the files:
condition-regex-error-subtype.c condition-regex-error-subtype-headear.h condition-regex-error-subtype-body.c
under the tests directory of the source distribution; the code defines a new
condition–object type my_condition_regex_error_subtype_t.
Next: conditions regex comp, Up: conditions regex [Contents][Index]
This document describes version 0.4.1-devel.1 of CCTests.