#include <unistd.h>#include <fcntl.h>#include "BUILD/bitc-runtime.h"Go to the source code of this file.
Functions | ||||
| static bitc_char_t | utf8_decode (const char *s, const char **snext) | |||
Decode a UTF-8 encoded character, returning both the code point and updating snext (if non-null) to point to the next byte in the string. | ||||
| static unsigned | utf8_encode (uint32_t ucs4, char utf[7]) | |||
| Encode a unicode code point into a UTF-8 encoded byte sequence. | ||||
| bitc_word_t | DEFUN (bitc_string_length, bitc_string_t *str) | |||
| Return the number of UNICODE code points in a UTF8-encoded string. | ||||
| DEFCLOSURE (bitc_string_length) | ||||
| bitc_char_t | DEFUN (bitc_string_nth, bitc_string_t *str, bitc_word_t ndx) | |||
Fetch the UNICODE code point at offset ndx in a UTF-8 encoded string.
| ||||
| DEFCLOSURE (bitc_string_nth) | ||||
| bitc_string_t * | DEFUN (bitc_vector_string, arg_0_bitc_vector_string vec) | |||
Given a vector of characters, return the corresponding string.
| ||||
| DEFCLOSURE (bitc_vector_string) | ||||
| DEFCLOSURE | ( | bitc_vector_string | ) |
| DEFCLOSURE | ( | bitc_string_nth | ) |
| DEFCLOSURE | ( | bitc_string_length | ) |
| bitc_string_t* DEFUN | ( | bitc_vector_string | , | |
| arg_0_bitc_vector_string | vec | |||
| ) |
Given a vector of characters, return the corresponding string.
| OutOfMemory | Heap memory was exhausted. |
This is implemented by the C runtime library because it needs to initialize all of the positions in the vector. This cannot (currently) be encoded in BitC without making the elements of the vector mutable.
Definition at line 192 of file string.c.
References GC_ALLOC_ATOMIC, bitc_string_t::length, bitc_string_t::s, and utf8_encode().
| bitc_char_t DEFUN | ( | bitc_string_nth | , | |
| bitc_string_t * | str, | |||
| bitc_word_t | ndx | |||
| ) |
Fetch the UNICODE code point at offset ndx in a UTF-8 encoded string.
| IndexBoundsError | Parameter ndx exceeds last string position. |
Definition at line 166 of file string.c.
References BITC_THROW, bitc_string_t::s, utf8_decode(), and val_ExIndexBoundsError.
| bitc_word_t DEFUN | ( | bitc_string_length | , | |
| bitc_string_t * | str | |||
| ) |
Return the number of UNICODE code points in a UTF8-encoded string.
Definition at line 149 of file string.c.
References bitc_string_t::s, and utf8_decode().
| static bitc_char_t utf8_decode | ( | const char * | s, | |
| const char ** | snext | |||
| ) | [static] |
Decode a UTF-8 encoded character, returning both the code point and updating snext (if non-null) to point to the next byte in the string.
Definition at line 49 of file string.c.
Referenced by DEFUN().
| static unsigned utf8_encode | ( | uint32_t | ucs4, | |
| char | utf[7] | |||
| ) | [static] |
Encode a unicode code point into a UTF-8 encoded byte sequence.
Definition at line 102 of file string.c.
Referenced by DEFUN().
1.4.7