|
x-engine-c v0.2.13
The C engine for x-lang
|
Character type for the x-lang type system. More...
#include "x-type.h"Go to the source code of this file.
Macros | |
| #define | X_TYPE_CHAR_NAME "CHARACTER" |
| #define | x_obj_type_ischar(B, X) x_obj_is_type((B), (X), X_TYPE_CHAR_NAME) |
| #define | x_charval(X) x_firstchar((X)) |
| #define | x_mkchar(B, C) x_make_char((B), X_OBJ_FLAG_NONE, (C)) |
| #define | x_mkfchar(B, F, C) x_make_char((B), (F), (C)) |
Functions | |
| x_obj_t * | x_make_char (x_obj_t *p_base, x_obj_flag_t flags, x_int_t cp) |
| x_int_t | x_char_utf8_decode (const x_char_t *bytes, x_int_t nbytes) |
| x_obj_t * | x_type_char_struct (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_char_register (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_char_make (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_char_analyse1 (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_char_analyse2 (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_char_read (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_char_write (x_obj_t *p_base, x_obj_t *p_args) |
Character type for the x-lang type system.
| #define x_charval | ( | X | ) | x_firstchar((X)) |
Extract the character value from a character object.
| #define x_mkchar | ( | B, | |
| C | |||
| ) | x_make_char((B), X_OBJ_FLAG_NONE, (C)) |
Make a character with default flags.
| #define x_mkfchar | ( | B, | |
| F, | |||
| C | |||
| ) | x_make_char((B), (F), (C)) |
Make a character with explicit flags F.
| #define x_obj_type_ischar | ( | B, | |
| X | |||
| ) | x_obj_is_type((B), (X), X_TYPE_CHAR_NAME) |
Test whether object X is a character on base B.
| #define X_TYPE_CHAR_NAME "CHARACTER" |
Type-system symbol name
Decode an nbytes-long UTF-8 sequence into a code point.
Decode a UTF-8 byte sequence into a code point.
Bytes are read unsigned. The byte count is supplied by the caller (derived from the lead byte), so no bounds scanning is done here.
| bytes | const x_char_t* – Start of the UTF-8 sequence |
| nbytes | x_int_t – Number of bytes in the sequence (1-4) |
| x_obj_t * x_make_char | ( | x_obj_t * | p_base, |
| x_obj_flag_t | flags, | ||
| x_int_t | cp | ||
| ) |
Allocate a heap character object holding code point cp.
Allocate a heap character object with a given value.
Builds a stack-based argument list and delegates to x_type_char_make.
| p_base | x_obj_t* – Base (execution context) |
| flags | x_obj_flag_t – Object flags |
| cp | x_int_t – Unicode code point |
Tokenizer analyse callback (phase 1) for character literals.
Tokenizer analyse callback (phase 2) for character literals.
Type-system make callback for character.
Type-system make callback for character objects.
Extracts the character value and optional flags from p_args, then allocates a heap object via x_obj_make.
| p_base | x_obj_t* – Base (execution context) |
| p_args | x_obj_t* – (char-value . (flags | nil)) |
Tokenizer read callback for character literals.
Register (or retrieve) the character type struct on p_base.
Register or retrieve the character type on the base context.
| p_base | x_obj_t* – Base (execution context) |
| p_args | x_obj_t* – Unused |
Build the character type descriptor struct.