MMgr v2.3.0
Zero-heap memory manager in C11. One borrowed buffer, carved by asserted offset.
Loading...
Searching...
No Matches
ascii_persona_bitorum — character classes

Data Structures

struct  MmgrAsciiMask
 Sixteen bytes with one bit for each of the code points 0 to 127. More...
struct  AsciiCfg
 Arguments to mmgr_ascii_in: the class and the byte to test. More...
struct  AsciiPersonaBitorumNs
 Type of the ascii dispatch table. More...

Enumerations

enum  MmgrAsciiClass {
  MMGR_ASCII_NUM ,
  MMGR_ASCII_ALPHA ,
  MMGR_ASCII_ALNUM ,
  MMGR_ASCII_UPPER ,
  MMGR_ASCII_LOWER ,
  MMGR_ASCII_HEX ,
  MMGR_ASCII_PUNCT ,
  MMGR_ASCII_SPACE ,
  MMGR_ASCII_CTRL ,
  MMGR_ASCII_PRINT ,
  MMGR_ASCII_CLASSES
}
 Asserts an MmgrAsciiMask is exactly sixteen bytes. More...

Functions

EMBED_HOST_DEVICE embed_bool mmgr_ascii_in (const AsciiCfg *args)
 Returns whether args->byte has its bit set in the type bitmap.
EMBED_HOST_DEVICE uint8_t mmgr_ascii_lower (const AsciiCfg *args)
 Returns args->byte with an upper case letter folded to its lower case, as tolower folds it.
EMBED_HOST_DEVICE uint8_t mmgr_ascii_upper (const AsciiCfg *args)
 Returns args->byte with a lower case letter folded to its upper case, as toupper folds it.

Variables

static const AsciiPersonaBitorumNs ascii
 Dispatch table instance named ascii, with each member set to its mmgr_ascii_ function.

Detailed Description

Enumeration Type Documentation

◆ MmgrAsciiClass

Asserts an MmgrAsciiMask is exactly sixteen bytes.

Note
mmgr_ascii_in reads bits[byte >> 3] for every byte below 0x80. All sixteen have to be there.
Sixteen reach code point 127 and no further, as leaves a byte of 0x80 or above in no class at all.

Character class selector, numbered from 0.

Note
MMGR_ASCII_CLASSES is the enumerator count and not a class. As an argument it is out of range.
Enumerator
MMGR_ASCII_NUM 

'0' to '9'.

MMGR_ASCII_ALPHA 

'A' to 'Z' and 'a' to 'z'.

MMGR_ASCII_ALNUM 

'0' to '9', 'A' to 'Z' and 'a' to 'z'.

MMGR_ASCII_UPPER 

'A' to 'Z'.

MMGR_ASCII_LOWER 

'a' to 'z'.

MMGR_ASCII_HEX 

'0' to '9', 'A' to 'F' and 'a' to 'f'.

MMGR_ASCII_PUNCT 

'!' to '/', ':' to '@', '[' to '`' and '{' to '~'.

MMGR_ASCII_SPACE 

9 to 13, and 32.

MMGR_ASCII_CTRL 

0 to 31, and 127.

MMGR_ASCII_PRINT 

32 to 126.

MMGR_ASCII_CLASSES 

Enumerator count and not a class.

Definition at line 55 of file ascii_persona_bitorum.h.

Function Documentation

◆ mmgr_ascii_in()

EMBED_HOST_DEVICE embed_bool mmgr_ascii_in ( const AsciiCfg * args)

Returns whether args->byte has its bit set in the type bitmap.

Parameters
[in]argsClass and byte to test [BORROWS].
Returns
EMBED_TRUE when the bit holds, EMBED_FALSE otherwise.
Note
Bytes 0x80 and above return EMBED_FALSE.
Warning
args->type must be below MMGR_ASCII_CLASSES, and nothing holds it there outside a MMGR_DEBUG_CHECKS build. It indexes the bitmap, and a byte under 0x80 then reads past the table.

References mmgr_ascii_in().

Referenced by mmgr_ascii_in().

◆ mmgr_ascii_lower()

EMBED_HOST_DEVICE uint8_t mmgr_ascii_lower ( const AsciiCfg * args)

Returns args->byte with an upper case letter folded to its lower case, as tolower folds it.

Parameters
[in]argsThe byte, and args->type, which the call does not read [BORROWS].
Returns
'a' to 'z' for 'A' to 'Z', and any other byte as it is.

References mmgr_ascii_lower().

Referenced by mmgr_ascii_lower().

◆ mmgr_ascii_upper()

EMBED_HOST_DEVICE uint8_t mmgr_ascii_upper ( const AsciiCfg * args)

Returns args->byte with a lower case letter folded to its upper case, as toupper folds it.

Parameters
[in]argsThe byte, and args->type, which the call does not read [BORROWS].
Returns
'A' to 'Z' for 'a' to 'z', and any other byte as it is.

References mmgr_ascii_upper().

Referenced by mmgr_ascii_upper().

Variable Documentation

◆ ascii

const AsciiPersonaBitorumNs ascii
static

Dispatch table instance named ascii, with each member set to its mmgr_ascii_ function.

Definition at line 125 of file ascii_persona_bitorum.h.