coan 4.2.4
The The Canonical String component interals.
Collaboration diagram for The The Canonical String component interals.:

Data Structures

struct  canonical_string_impl

Typedefs

typedef bool(* canonical_string_char_validator_t )(char ch, canonical_string_const_h cs)

Functions

static void canonical_string_parse_next_part (char const **start, size_t *len)
static void canonical_string_init (canonical_string_h cs, char const *start, size_t nbytes, char const **pend)
static bool is_zero_digit (canonical_string_const_h cs)
static bool is_octal_numeral (canonical_string_const_h cs)
static bool is_hex_numeral (canonical_string_const_h cs)
static bool is_decimal_numeral (canonical_string_const_h cs)
static bool is_type_suffix_char (char ch)
static char const * integer_type_suffix (canonical_string_const_h cs)
static bool is_valid_digit (char ch, canonical_string_const_h cs)
static bool is_valid_symbol_char (char ch, canonical_string_const_h cs)
static void canonical_string_init_by_test (canonical_string_h cs, char const **cpp, canonical_string_char_validator_t validator)
static void canonical_string_copy_init (canonical_string_h dest, canonical_string_const_h src)
static void canonical_string_finis (canonical_string_h cs)

Typedef Documentation

Type of function to validate characters for addition to a canonical string

Parameters:
chThe character to be tested for eligibility
csThe canonical string for which the eligibility of ch is to be tested.
Returns:
True if ch is eligible for addition to cs, sle false.

Definition at line 198 of file canonical_string.c.


Function Documentation

static void canonical_string_copy_init ( canonical_string_h  dest,
canonical_string_const_h  src 
) [static]

Initialise a canonical string from another.

Parameters:
destThe canonical string to initialise. Is assumed to control only unitialised storage.
srcThe canonical string to be copied.

dest is initialised as a copy of src

Definition at line 385 of file canonical_string.c.

References clone(), and canonical_string_impl::text.

Referenced by canonical_string_copy().

Here is the call graph for this function:

static void canonical_string_finis ( canonical_string_h  cs) [static]

Finalise a canonical string, releasing the resources of all contained objects

Definition at line 392 of file canonical_string.c.

References canonical_string_impl::text.

Referenced by canonical_string_dispose().

static void canonical_string_init ( canonical_string_h  cs,
char const *  start,
size_t  nbytes,
char const **  pend 
) [static]

Initialise a canonical string.

Parameters:
csThe canonical string to initialise. Is assumed to control only unitialised storage.
startOn entry, NULL, or else a pointer to the text to be scanned into a canonical string. If NULL, cs is initialised as the empty string.
nbytes0, or the maximum number of bytes that may consumed from start, when start is not NULL. If 0 when start != NULL then strlen(cp) is assumed.
pendIf not NULL, then the first address not scanned is stored here on return.

Definition at line 141 of file canonical_string.c.

References canonical_string_parse_next_part(), chew_on(), clone(), reallocate(), SET_PUBLIC, canonical_string_impl::text, and zallocate().

Referenced by canonical_string_new().

Here is the call graph for this function:

static void canonical_string_init_by_test ( canonical_string_h  cs,
char const **  cpp,
canonical_string_char_validator_t  validator 
) [static]

Initialise a canonical string to contain all successive non-0 characters at a text pointer. ignoring line-continuations, that satisfy a test.

Parameters:
csThe canonical string to initialise.
cppOn entry, a pointer to the address of the text to be scanned. On return, stores the address of the first scanned character that fails the test or is null.
validatorPointer to the function that tests eligibility of characters.

Definition at line 354 of file canonical_string.c.

References chew_continuation(), reallocate(), and canonical_string_impl::text.

Referenced by canonical_identifier().

Here is the call graph for this function:

static void canonical_string_parse_next_part ( char const **  start,
size_t *  len 
) [static]

Parse the next portion of a canonical string.

Parameters:
startOn entry, points to the address of the text to to be parsed. If on return the value stored here is different then it is the address at which parsing of has stopped after consuming characters to be discarded from the canonical form of the text. If the stored value is unchanged then it is the start of some text that belongs to the canonical form.
lenThe value stored here on entry is insignificant. The meaning of the value stored here on return depends upon the value stored at start:-
  • If the value stored at start on return if different from its entry value then discardable text has been parsed. In this case, if the value at len is > 0 it is the length of discardable whitespace and comments. If the value at len is 0 then a discardable sequence line-continuations has been parsed.
  • If the value stored at start on return is unchanged from its entry value then it may address text to be retained in the canonical form. In this case, if the value stored at len is > 0 it is the length of the text to be retained. If the value stored at is 0 then the string at start was empty.

The function can be called with start initialised to the address of a string to be parsed into canonical form. On return, start will contain the address to be passed to the next call to continue the parsing, and the appropriate handling of the returned values can be deduced from a comparsion of the entry and return values at start, together with the value returned at len:-

  • When the value returned at start is changed and the value stored at len is 0 then line-continuations have been consumed and nothing need be appended to the canonical form of the string.
  • When the value returned at start is changed and the value stored at len is > 0 then whitespace and/or comments have been consumed and a single space should be appended to the canonical form of the string.
  • When the value returned at start is unchanged and the value stored at len is 0 then parsing is done.
  • When the value returned at start is unchanged and the value stored at len is > 0 then then that number of characters should be appended to the canonical form from the address at start.

Definition at line 109 of file canonical_string.c.

References chew_continuation(), chew_on(), chew_unbroken_string(), read_offset(), and read_pos().

Referenced by canonical_string_init().

Here is the call graph for this function:

static char const* integer_type_suffix ( canonical_string_const_h  cs) [static]

Get the integer type suffix, if any, from the numeral represented by a canonical string.

Parameters:
csThe canonical string to scan
Returns:
The address of the first character in cs that is not part of some initial numeral, or NULL if there is no such numeral.

Definition at line 270 of file canonical_string.c.

Referenced by is_valid_digit().

static bool is_decimal_numeral ( canonical_string_const_h  cs) [static]

Say whether a canonical string consists of a decimal numeral

Definition at line 240 of file canonical_string.c.

Referenced by is_valid_digit().

static bool is_hex_numeral ( canonical_string_const_h  cs) [static]

Say whether a canonical string consists of a hex numeral

Definition at line 225 of file canonical_string.c.

Referenced by is_valid_digit().

static bool is_octal_numeral ( canonical_string_const_h  cs) [static]

Say whether a canonical string consists of an octal numeral

Definition at line 210 of file canonical_string.c.

Referenced by is_valid_digit().

static bool is_type_suffix_char ( char  ch) [static]

Say whether a character can appear in the type-suffix to an integer constant

Definition at line 255 of file canonical_string.c.

Referenced by is_valid_digit().

static bool is_valid_digit ( char  ch,
canonical_string_const_h  cs 
) [static]

Say whether a character can validly be added to a canonical string to form or extend a numeral.

Parameters:
chThe candidate character.
csThe target canonical string.
Returns:
True if ch can validly be appended to cs, else false.

A numeral may consist of an decimal, octal or hex constant as recognised by strtol() with the usual optional type prefixes composed of 'u'/'U' and 'l'/'L'.

Definition at line 291 of file canonical_string.c.

References integer_type_suffix(), is_decimal_numeral(), is_hex_numeral(), is_octal_numeral(), is_type_suffix_char(), and is_zero_digit().

Here is the call graph for this function:

static bool is_valid_symbol_char ( char  ch,
canonical_string_const_h  cs 
) [static]

Say whether a character can validly be added to a canonical string to form or extend a symbol name.

Parameters:
chThe candidate character.
csThe target canonical string.

Definition at line 335 of file canonical_string.c.

References is_symbol_inner_char(), and is_symbol_start_char().

Referenced by canonical_identifier().

Here is the call graph for this function:

static bool is_zero_digit ( canonical_string_const_h  cs) [static]

Say whether a canonical string consists just of the digit '0'

Definition at line 202 of file canonical_string.c.

Referenced by is_valid_digit().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines