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

Files

file  canonical_string.c
file  canonical_string.h

Typedefs

typedef struct
canonical_string_impl
canonical_string_h
typedef struct
canonical_string_impl const * 
canonical_string_const_h

Functions

canonical_string_h canonical_string_new (char const *start, size_t nbytes, char const **pend)
canonical_string_h canonical_numeral (struct int_spec const *int_spec)
canonical_string_h canonical_identifier (char const **cpp)
canonical_string_h canonical_string_copy (canonical_string_const_h src)
void canonical_string_dispose (canonical_string_h cs)
void canonical_string_swap (canonical_string_h lhs, canonical_string_h rhs)
void canonical_string_assign (canonical_string_h dest, canonical_string_const_h src)
bool canonical_string_equal (canonical_string_const_h lhs, canonical_string_const_h rhs)
char const * canonical_string_text (canonical_string_const_h cs)
size_t canonical_string_length (canonical_string_const_h cs)
int canonical_string_compare (canonical_string_const_h lhs, void const *rhs, size_t rhslen)
void canonical_string_appendc (canonical_string_h cs, char more)
void canonical_string_appends (canonical_string_h cs, canonical_string_const_h more, bool punct)
canonical_string_h canonical_string_substr (canonical_string_const_h cs, size_t start, size_t len)
void canonical_string_replace (canonical_string_h cs, size_t start, size_t len, canonical_string_const_h subst)

Typedef Documentation

Abstract type of constant canonical string object

Definition at line 54 of file canonical_string.h.

Abstract type of canonical string object

Definition at line 51 of file canonical_string.h.


Function Documentation

canonical_string_h canonical_identifier ( char const **  cpp)

Construct a new canonical string to contain a symbol name.

Parameters:
cppOn entry, pointer to the address of the text to be parsed as a symbol name. On return, stores the address of the first scanned character that is not part of an identifier.
Returns:
A canonical string containing the parsed symbol.

Definition at line 424 of file canonical_string.c.

References canonical_string_init_by_test(), is_valid_symbol_char(), and zallocate().

Referenced by configured_symbol_seek_const(), eval_hash_define(), eval_hash_undef(), eval_line(), eval_possible_symbol(), and eval_unary().

Here is the call graph for this function:

canonical_string_h canonical_numeral ( struct int_spec const *  int_spec)

Forward decl

Construct a new canonical string to represent a given integer as a numeral.

Parameters:
int_specAn int_spec representing the integer to be returned as a string. string.
Returns:
A canonical string containing the decimal numeral that represents val/

Referenced by symbol_resolve().

void canonical_string_appendc ( canonical_string_h  cs,
char  more 
)

Append a character to a canonical string.

Parameters:
csThe canonical string to be extended.
moreThe character to be appended.

Definition at line 539 of file canonical_string.c.

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

Here is the call graph for this function:

void canonical_string_appends ( canonical_string_h  cs,
canonical_string_const_h  more,
bool  punct 
)

Append one canonical string to another

Parameters:
csThe canonical string to be extended.
moreThe canonical string to be appended.
punctIf true then a punctuating space is appended to cs before more is appended.

Definition at line 520 of file canonical_string.c.

References canonical_string_assign(), canonical_string_length(), reallocate(), and canonical_string_impl::text.

Here is the call graph for this function:

void canonical_string_assign ( canonical_string_h  dest,
canonical_string_const_h  src 
)

Assign one canonical string to another

Definition at line 459 of file canonical_string.c.

References canonical_string_copy(), canonical_string_dispose(), and canonical_string_swap().

Referenced by canonical_string_appends(), and hash_include_define().

Here is the call graph for this function:

int canonical_string_compare ( canonical_string_const_h  lhs,
void const *  rhs,
size_t  rhslen 
)

Compare a canonical string with another canonical string or region of text.

Parameters:
lhsFirst canonical string to be compared.
rhsSecond canonical string or pointer to text.
rhslenIf 0 then rhs addresses a second canonical string to be compared with lhs. Otherwise rhs addresses text of length keylen to be compared with the text of lhs.
Returns:
A negative value if lhs is less than rhs; 0 if lhs is equal to rhs; a positive value if lhs is greater than rhs.

Definition at line 481 of file canonical_string.c.

Referenced by directive_text_lookup().

canonical_string_h canonical_string_copy ( canonical_string_const_h  src)

Construct a copy of a canonical string.

Definition at line 432 of file canonical_string.c.

References allocate(), and canonical_string_copy_init().

Referenced by canonical_string_assign(), directive_text_lookup(), eval_hash_undef(), hash_include_define(), symbol_copy_init(), and symbol_definition_resolve().

Here is the call graph for this function:

void canonical_string_dispose ( canonical_string_h  cs)
bool canonical_string_equal ( canonical_string_const_h  lhs,
canonical_string_const_h  rhs 
)

Say whether two canonical strings are equal

Definition at line 469 of file canonical_string.c.

References eq().

Referenced by hash_include_tally(), symbol_define(), and symbol_equal().

Here is the call graph for this function:

size_t canonical_string_length ( canonical_string_const_h  cs)

Get the length of a canonical string

Parameters:
csThe canonical string to query.
Returns:
The length of cs.

Definition at line 513 of file canonical_string.c.

Referenced by canonical_string_appendc(), canonical_string_appends(), canonical_string_replace(), canonical_string_substr(), configured_symbol_find(), eval_line(), eval_possible_symbol(), and eval_unary().

canonical_string_h canonical_string_new ( char const *  start,
size_t  nbytes,
char const **  pend 
)

Construct a new canonical string from given text. The constructed canonical string contains the given text with all comments stripped, all line-continuations joined and all whitespace sequences condensed to a single space.

Parameters:
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 405 of file canonical_string.c.

References canonical_string_init(), and zallocate().

Referenced by eval_free_form_directive(), eval_hash_define(), symbol_define(), and symbol_resolve().

Here is the call graph for this function:

void canonical_string_replace ( canonical_string_h  cs,
size_t  start,
size_t  len,
canonical_string_const_h  subst 
)

Replace a portion of a canonical string

Parameters:
csThe canonical string to be modified.
startThe offset in cs of the portion to be replaced.
lenThe length of the portion to be replaced.
substThe string to replace the delimited portion.

Definition at line 560 of file canonical_string.c.

References canonical_string_length(), canonical_string_impl::text, and zallocate().

Referenced by symbol_definition_resolve().

Here is the call graph for this function:

canonical_string_h canonical_string_substr ( canonical_string_const_h  cs,
size_t  start,
size_t  len 
)

Get a substring of a canonical string

Parameters:
csThe canonical string from which a substring is required.
startThe offset in cs of the required substring.
lenThe length of the substring.
Returns:
NULL if start is out of range, otherwise the longest substring of cs starting at start that is no longer than len.

Definition at line 548 of file canonical_string.c.

References canonical_string_length(), clone(), canonical_string_impl::text, and zallocate().

Here is the call graph for this function:

void canonical_string_swap ( canonical_string_h  lhs,
canonical_string_h  rhs 
)

Swap two canonical strings

Definition at line 451 of file canonical_string.c.

References PODSWAP, and canonical_string_impl::text.

Referenced by canonical_string_assign(), and symbol_swap().

char const* canonical_string_text ( canonical_string_const_h  cs)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines