NAME

src/string/charset/ascii.c

DESCRIPTION

This file implements the charset functions for ascii data and common charset functionality for similar charsets like iso-8859-1.

STRING *ascii_get_graphemes
Retrieves the graphemes for the STRING source_string, starting at offset and ending at offset + count.
static void set_graphemes
Sets the graphemes for source_string, starting at offset. Replace replace_count graphemes with those from STRING insert_string.
STRING *ascii_get_graphemes_inplace
Retrieves the graphemes in place for ascii STRING source_string, starting at offset. Retrieves count graphemes and puts them into dest_string.
static STRING *to_ascii
Attempts to convert STRING src to ASCII in STRING dest. Throws an exception if unconvertable UNICODE characters are involved.
static STRING *to_unicode
Converts the ASCII STRING src to UNICODE STRING dest.
static STRING *to_charset
Converts STRING src to ASCII charset STRING dest.
static STRING *compose
Can't compose ASCII strings, so performs a string copy on it and returns the new string.
static STRING *decompose
Can't decompose ASCII, so we perform a string copy instead and return a pointer to the new string.
static void upcase
Converts the STRING source_string to all uppercase.
static void downcase
Converts the STRING source_string to all lower-case.
static void titlecase
Converts the STRING given by source_string to title case, where the first character is upper case and all the rest of the characters are lower-case.
static void upcase_first
Sets the first character in the STRING source_string to upper case, but doesn't modify the rest of the string.
static void downcase_first
Sets the first character of the STRING source_string to lowercase, but doesn't modify the rest of the characters.
static void titlecase_first
Converts the first letter of STRING source_string to upper case, but doesn't modify the rest of the string.
INTVAL ascii_compare
Compares two strings as ASCII strings. If STRING lhs > rhs, returns 1. If lhs == rhs returns 0. If STRING lhs < rhs, returns -1.
INTVAL mixed_cs_index
Searches for the first instance of STRING search in STRING src. returns the position where the substring is found if it is indeed found. Returns -1 otherwise. Operates on different types of strings, not just ASCII.
INTVAL ascii_cs_index
Searches for the first instance of STRING search in STRING src. returns the position where the substring is found if it is indeed found. Returns -1 otherwise.
INTVAL ascii_cs_rindex
Searches for the last instance of STRING search_string in STRING source_string. Starts searching at offset.
static UINTVAL validate
Verifies that the given string is valid ASCII. Returns 1 if it is ASCII, returns 0 otherwise.
static STRING *string_from_codepoint
Creates a new STRING object from a single codepoint codepoint. Returns the new STRING.
static INTVAL is_cclass
RT#48260: Not yet documented!!!
static INTVAL find_cclass
RT#48260: Not yet documented!!!
static INTVAL find_not_cclass
RT#48260: Not yet documented!!!
size_t ascii_compute_hash
Computes the hash of STRING source_string starting with seed value seed.
const CHARSET *Parrot_charset_ascii_init
Initialize the ASCII charset but registering all the necessary function pointers and settings.
STRING *charset_cvt_ascii_to_binary
Converts an ASCII STRING src to a binary STRING dest.
STRING *charset_cvt_ascii_to_iso_8859_1
Converts ASCII STRING src to ISO8859-1 STRING dest.