Ruby 4.1.0dev (2026-12-06 revision 2c909473e0801d734f63591bb567e8d554c8a771)
stringy.h
1#ifndef PRISM_INTERNAL_STRINGY_H
2#define PRISM_INTERNAL_STRINGY_H
3
4#include "prism/stringy.h"
5
6#include <stdbool.h>
7
8/*
9 * Backing storage for an empty string.
10 */
11static const uint8_t empty_source[] = "";
12
13/*
14 * Defines an empty string. This is useful for initializing a string that will
15 * be filled in later.
16 */
17#define PM_STRING_EMPTY ((pm_string_t) { .source = empty_source, .length = 0 })
18
19/* View a string literal without its terminating NUL. */
20#define PM_STRING_LITERAL(name_) ((pm_string_t) { .source = (const uint8_t *) ("" name_), .length = sizeof(name_) - 1 })
21
22/*
23 * Initialize a shared string that is based on initial input.
24 */
25void pm_string_shared_init(pm_string_t *string, const uint8_t *start, const uint8_t *end);
26
27/*
28 * Returns true if every byte of the string is ASCII.
29 */
30bool pm_string_ascii_only_p(const pm_string_t *string);
31
32#endif
C99 shim for <stdbool.h>.
A view of a sequence of bytes owned by someone else.
A view of a sequence of bytes.
Definition stringy.h:23