Ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e0ba6b95ab71a441357ed5484e33498)
string.h
Go to the documentation of this file.
1#ifndef RBIMPL_INTERN_STRING_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_INTERN_STRING_H
23#include "ruby/internal/config.h"
24
25#ifdef STDC_HEADERS
26# include <stddef.h>
27#endif
28
29#ifdef HAVE_STRING_H
30# include <string.h>
31#endif
32
33#ifdef HAVE_STDINT_H
34# include <stdint.h>
35#endif
36
42#include "ruby/internal/value.h"
43#include "ruby/internal/variable.h" /* rb_gvar_setter_t */
44#include "ruby/st.h" /* st_index_t */
45
47
48/* string.c */
49
50
63VALUE rb_str_new(const char *ptr, long len);
64
76VALUE rb_str_new_cstr(const char *ptr);
77
90VALUE rb_str_new_shared(VALUE str);
91
102VALUE rb_str_new_frozen(VALUE str);
103
123VALUE rb_str_new_with_class(VALUE obj, const char *ptr, long len);
124
137VALUE rb_tainted_str_new_cstr(const char *ptr);
138
154VALUE rb_tainted_str_new(const char *ptr, long len);
155
174VALUE rb_external_str_new(const char *ptr, long len);
175
195VALUE rb_external_str_new_cstr(const char *ptr);
196
217VALUE rb_locale_str_new(const char *ptr, long len);
218
238VALUE rb_locale_str_new_cstr(const char *ptr);
239
260VALUE rb_filesystem_str_new(const char *ptr, long len);
261
281VALUE rb_filesystem_str_new_cstr(const char *ptr);
282
292VALUE rb_str_buf_new(long capa);
293
309VALUE rb_str_buf_new_cstr(const char *ptr);
310
319VALUE rb_str_tmp_new(long len);
320
334VALUE rb_usascii_str_new(const char *ptr, long len);
335
349VALUE rb_usascii_str_new_cstr(const char *ptr);
350
362VALUE rb_utf8_str_new(const char *ptr, long len);
363
377VALUE rb_utf8_str_new_cstr(const char *ptr);
378
406VALUE rb_str_new_static(const char *ptr, long len);
407
423VALUE rb_usascii_str_new_static(const char *ptr, long len);
424
440VALUE rb_utf8_str_new_static(const char *ptr, long len);
441
462VALUE rb_str_to_interned_str(VALUE str);
463
483VALUE rb_interned_str(const char *ptr, long len);
484
499VALUE rb_interned_str_cstr(const char *ptr);
500
516void rb_str_free(VALUE str);
517
534void rb_str_shared_replace(VALUE dst, VALUE src);
535
551VALUE rb_str_buf_append(VALUE dst, VALUE src);
552
554VALUE rb_str_buf_cat(VALUE, const char*, long);
555
557VALUE rb_str_buf_cat2(VALUE, const char*);
558
573VALUE rb_str_buf_cat_ascii(VALUE dst, const char *src);
574
583VALUE rb_obj_as_string(VALUE obj);
584
597VALUE rb_check_string_type(VALUE obj);
598
613void rb_must_asciicompat(VALUE obj);
614
622VALUE rb_str_dup(VALUE str);
623
633VALUE rb_str_resurrect(VALUE str);
634
646VALUE rb_str_locktmp(VALUE str);
647
656VALUE rb_str_unlocktmp(VALUE str);
657
659VALUE rb_str_dup_frozen(VALUE);
660
662#define rb_str_dup_frozen rb_str_new_frozen
663
680VALUE rb_str_plus(VALUE lhs, VALUE rhs);
681
690VALUE rb_str_times(VALUE str, VALUE num);
691
703long rb_str_sublen(VALUE str, long pos);
704
755VALUE rb_str_substr(VALUE str, long beg, long len);
756
768VALUE rb_str_subseq(VALUE str, long beg, long len);
769
783char *rb_str_subpos(VALUE str, long beg, long *len);
784
796void rb_str_modify(VALUE str);
797
811void rb_str_modify_expand(VALUE str, long capa);
812
820VALUE rb_str_freeze(VALUE str);
821
845void rb_str_set_len(VALUE str, long len);
846
861VALUE rb_str_resize(VALUE str, long len);
862
874VALUE rb_str_cat(VALUE dst, const char *src, long srclen);
875
889VALUE rb_str_cat_cstr(VALUE dst, const char *src);
890
892VALUE rb_str_cat2(VALUE, const char*);
893
907VALUE rb_str_append(VALUE dst, VALUE src);
908
923VALUE rb_str_concat(VALUE dst, VALUE src);
924
925/* random.c */
926
939st_index_t rb_memhash(const void *ptr, long len);
940
967st_index_t rb_hash_start(st_index_t i);
968
970#define rb_hash_uint32(h, i) st_hash_uint32((h), (i))
971
973#define rb_hash_uint(h, i) st_hash_uint((h), (i))
974
976#define rb_hash_end(h) st_hash_end(h)
977
978/* string.c */
979
996st_index_t rb_str_hash(VALUE str);
997
1014int rb_str_hash_cmp(VALUE str1, VALUE str2);
1015
1032int rb_str_comparable(VALUE str1, VALUE str2);
1033
1046int rb_str_cmp(VALUE lhs, VALUE rhs);
1047
1061VALUE rb_str_equal(VALUE str1, VALUE str2);
1062
1079VALUE rb_str_drop_bytes(VALUE str, long len);
1080
1099void rb_str_update(VALUE dst, long beg, long len, VALUE src);
1100
1115VALUE rb_str_replace(VALUE dst, VALUE src);
1116
1138VALUE rb_str_inspect(VALUE str);
1139
1152VALUE rb_str_dump(VALUE str);
1153
1170VALUE rb_str_split(VALUE str, const char *delim);
1171
1178
1179/* symbol.c */
1180
1194VALUE rb_str_intern(VALUE str);
1195
1196/* string.c */
1197
1209VALUE rb_sym_to_s(VALUE sym);
1210
1220long rb_str_strlen(VALUE str);
1221
1228VALUE rb_str_length(VALUE);
1229
1239long rb_str_offset(VALUE str, long pos);
1240
1249size_t rb_str_capacity(VALUE str);
1250
1265VALUE rb_str_ellipsize(VALUE str, long len);
1266
1296VALUE rb_str_scrub(VALUE str, VALUE repl);
1297
1368VALUE rb_str_succ(VALUE orig);
1369
1379static inline long
1380rbimpl_strlen(const char *str)
1381{
1382 return RBIMPL_CAST((long)strlen(str));
1383}
1384
1394static inline VALUE
1395rbimpl_str_new_cstr(const char *str)
1396{
1397 long len = rbimpl_strlen(str);
1398 return rb_str_new_static(str, len);
1399}
1400
1401RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea."))
1410static inline VALUE
1411rbimpl_tainted_str_new_cstr(const char *str)
1412{
1413 long len = rbimpl_strlen(str);
1414 return rb_tainted_str_new(str, len);
1415}
1416
1426static inline VALUE
1427rbimpl_usascii_str_new_cstr(const char *str)
1428{
1429 long len = rbimpl_strlen(str);
1430 return rb_usascii_str_new_static(str, len);
1431}
1432
1442static inline VALUE
1443rbimpl_utf8_str_new_cstr(const char *str)
1444{
1445 long len = rbimpl_strlen(str);
1446 return rb_utf8_str_new_static(str, len);
1447}
1448
1458static inline VALUE
1459rbimpl_external_str_new_cstr(const char *str)
1460{
1461 long len = rbimpl_strlen(str);
1462 return rb_external_str_new(str, len);
1463}
1464
1474static inline VALUE
1475rbimpl_locale_str_new_cstr(const char *str)
1476{
1477 long len = rbimpl_strlen(str);
1478 return rb_locale_str_new(str, len);
1479}
1480
1490static inline VALUE
1491rbimpl_str_buf_new_cstr(const char *str)
1492{
1493 long len = rbimpl_strlen(str);
1494 VALUE buf = rb_str_buf_new(len);
1495 return rb_str_buf_cat(buf, str, len);
1496}
1497
1508static inline VALUE
1509rbimpl_str_cat_cstr(VALUE buf, const char *str)
1510{
1511 long len = rbimpl_strlen(str);
1512 return rb_str_cat(buf, str, len);
1513}
1514
1525static inline VALUE
1526rbimpl_exc_new_cstr(VALUE exc, const char *str)
1527{
1528 long len = rbimpl_strlen(str);
1529 return rb_exc_new(exc, str, len);
1530}
1531
1545#define rb_str_new(str, len) \
1546 ((RBIMPL_CONSTANT_P(str) && \
1547 RBIMPL_CONSTANT_P(len) ? \
1548 rb_str_new_static : \
1549 rb_str_new) ((str), (len)))
1550
1561#define rb_str_new_cstr(str) \
1562 ((RBIMPL_CONSTANT_P(str) ? \
1563 rbimpl_str_new_cstr : \
1564 rb_str_new_cstr) (str))
1565
1579#define rb_usascii_str_new(str, len) \
1580 ((RBIMPL_CONSTANT_P(str) && \
1581 RBIMPL_CONSTANT_P(len) ? \
1582 rb_usascii_str_new_static : \
1583 rb_usascii_str_new) ((str), (len)))
1584
1596#define rb_utf8_str_new(str, len) \
1597 ((RBIMPL_CONSTANT_P(str) && \
1598 RBIMPL_CONSTANT_P(len) ? \
1599 rb_utf8_str_new_static : \
1600 rb_utf8_str_new) ((str), (len)))
1601
1613#define rb_tainted_str_new_cstr(str) \
1614 ((RBIMPL_CONSTANT_P(str) ? \
1615 rbimpl_tainted_str_new_cstr : \
1616 rb_tainted_str_new_cstr) (str))
1617
1630#define rb_usascii_str_new_cstr(str) \
1631 ((RBIMPL_CONSTANT_P(str) ? \
1632 rbimpl_usascii_str_new_cstr : \
1633 rb_usascii_str_new_cstr) (str))
1634
1646#define rb_utf8_str_new_cstr(str) \
1647 ((RBIMPL_CONSTANT_P(str) ? \
1648 rbimpl_utf8_str_new_cstr : \
1649 rb_utf8_str_new_cstr) (str))
1650
1667#define rb_external_str_new_cstr(str) \
1668 ((RBIMPL_CONSTANT_P(str) ? \
1669 rbimpl_external_str_new_cstr : \
1670 rb_external_str_new_cstr) (str))
1671
1688#define rb_locale_str_new_cstr(str) \
1689 ((RBIMPL_CONSTANT_P(str) ? \
1690 rbimpl_locale_str_new_cstr : \
1691 rb_locale_str_new_cstr) (str))
1692
1702#define rb_str_buf_new_cstr(str) \
1703 ((RBIMPL_CONSTANT_P(str) ? \
1704 rbimpl_str_buf_new_cstr : \
1705 rb_str_buf_new_cstr) (str))
1706
1719#define rb_str_cat_cstr(buf, str) \
1720 ((RBIMPL_CONSTANT_P(str) ? \
1721 rbimpl_str_cat_cstr : \
1722 rb_str_cat_cstr) ((buf), (str)))
1723
1733#define rb_exc_new_cstr(exc, str) \
1734 ((RBIMPL_CONSTANT_P(str) ? \
1735 rbimpl_exc_new_cstr : \
1736 rb_exc_new_cstr) ((exc), (str)))
1737
1738#define rb_str_new2 rb_str_new_cstr
1739#define rb_str_new3 rb_str_new_shared
1740#define rb_str_new4 rb_str_new_frozen
1741#define rb_str_new5 rb_str_new_with_class
1742#define rb_tainted_str_new2 rb_tainted_str_new_cstr
1743#define rb_str_buf_new2 rb_str_buf_new_cstr
1744#define rb_usascii_str_new2 rb_usascii_str_new_cstr
1745#define rb_str_buf_cat rb_str_cat
1746#define rb_str_buf_cat2 rb_str_cat_cstr
1747#define rb_str_cat2 rb_str_cat_cstr
1756#define rb_strlen_lit(str) (sizeof(str "") - 1)
1757
1769#define rb_str_new_lit(str) rb_str_new_static((str), rb_strlen_lit(str))
1770
1783#define rb_usascii_str_new_lit(str) rb_usascii_str_new_static((str), rb_strlen_lit(str))
1784
1797#define rb_utf8_str_new_lit(str) rb_utf8_str_new_static((str), rb_strlen_lit(str))
1798
1812#define rb_enc_str_new_lit(str, enc) rb_enc_str_new_static((str), rb_strlen_lit(str), (enc))
1813
1814#define rb_str_new_literal(str) rb_str_new_lit(str)
1815#define rb_usascii_str_new_literal(str) rb_usascii_str_new_lit(str)
1816#define rb_utf8_str_new_literal(str) rb_utf8_str_new_lit(str)
1817#define rb_enc_str_new_literal(str, enc) rb_enc_str_new_lit(str, enc)
1820
1821#endif /* RBIMPL_INTERN_STRING_H */
Defines RBIMPL_CONSTANT_P.
Defines RBIMPL_ATTR_DEPRECATED.
#define RBIMPL_ATTR_DEPRECATED(msg)
Wraps (or simulates) [[deprecated]]
Definition: deprecated.h:36
Tweaking visibility of C variables/functions.
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:106
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:97
#define rb_str_buf_cat2
Old name of rb_usascii_str_new_cstr.
Definition: string.h:1746
#define rb_str_cat2
Old name of rb_str_cat_cstr.
Definition: string.h:1747
VALUE rb_str_to_interned_str(VALUE str)
Identical to rb_interned_str(), except it takes a Ruby's string instead of C's.
Definition: string.c:11934
void rb_str_free(VALUE str)
Destroys the given string for no reason.
Definition: string.c:1546
VALUE rb_str_new_shared(VALUE str)
Identical to rb_str_new_cstr(), except it takes a Ruby's string instead of C's.
Definition: string.c:1350
VALUE rb_str_plus(VALUE lhs, VALUE rhs)
Generates a new string, concatenating the former to the latter.
Definition: string.c:2232
#define rb_utf8_str_new_cstr(str)
Identical to rb_str_new_cstr, except it generates a string of "UTF-8" encoding.
Definition: string.h:1646
VALUE rb_str_append(VALUE dst, VALUE src)
Identical to rb_str_buf_append(), except it converts the right hand side before concatenating.
Definition: string.c:3317
VALUE rb_filesystem_str_new(const char *ptr, long len)
Identical to rb_str_new(), except it generates a string of "filesystem" encoding.
Definition: string.c:1263
VALUE rb_sym_to_s(VALUE sym)
This is an rb_sym2str() + rb_str_dup() combo.
Definition: string.c:11516
VALUE rb_str_times(VALUE str, VALUE num)
Repetition of a string.
Definition: string.c:2304
VALUE rb_external_str_new(const char *ptr, long len)
Identical to rb_str_new(), except it generates a string of "default external" encoding.
Definition: string.c:1239
VALUE rb_str_tmp_new(long len)
Allocates a "temporary" string.
Definition: string.c:1540
long rb_str_offset(VALUE str, long pos)
"Inverse" of rb_str_sublen().
Definition: string.c:2763
VALUE rb_str_succ(VALUE orig)
Searches for the "successor" of a string.
Definition: string.c:4564
int rb_str_hash_cmp(VALUE str1, VALUE str2)
Compares two strings.
Definition: string.c:3526
VALUE rb_str_subseq(VALUE str, long beg, long len)
Identical to rb_str_substr(), except the numbers are interpreted as byte offsets instead of character...
Definition: string.c:2821
VALUE rb_str_ellipsize(VALUE str, long len)
Shortens str and adds three dots, an ellipsis, if it is longer than len characters.
Definition: string.c:10800
st_index_t rb_memhash(const void *ptr, long len)
This is a universal hash function.
Definition: random.c:1720
#define rb_str_new(str, len)
Allocates an instance of rb_cString.
Definition: string.h:1545
void rb_str_shared_replace(VALUE dst, VALUE src)
Replaces the contents of the former with the latter.
Definition: string.c:1593
#define rb_str_buf_cat
Just another name of rb_str_cat.
Definition: string.h:1745
VALUE rb_str_new_static(const char *ptr, long len)
Identical to rb_str_new(), except it takes a C string literal.
Definition: string.c:1016
#define rb_usascii_str_new(str, len)
Identical to rb_str_new, except it generates a string of "US ASCII" encoding.
Definition: string.h:1579
size_t rb_str_capacity(VALUE str)
Queries the capacity of the given string.
Definition: string.c:828
VALUE rb_str_new_frozen(VALUE str)
Creates a frozen copy of the string, if necessary.
Definition: string.c:1356
VALUE rb_str_dup(VALUE str)
Duplicates a string.
Definition: string.c:1808
void rb_str_modify(VALUE str)
Declares that the string is about to be modified.
Definition: string.c:2459
st_index_t rb_str_hash(VALUE str)
Calculates a hash value of a string.
Definition: string.c:3516
VALUE rb_str_cat(VALUE dst, const char *src, long srclen)
Destructively appends the passed contents to the string.
Definition: string.c:3161
VALUE rb_str_locktmp(VALUE str)
Obtains a "temporary lock" of the string.
long rb_str_strlen(VALUE str)
Counts the number of characters (not bytes) that are stored inside of the given string.
Definition: string.c:2160
VALUE rb_str_resurrect(VALUE str)
I guess there is no use case of this function in extension libraries, but this is a routine identical...
Definition: string.c:1814
#define rb_str_buf_new_cstr(str)
Identical to rb_str_new_cstr, except done differently.
Definition: string.h:1702
#define rb_usascii_str_new_cstr(str)
Identical to rb_str_new_cstr, except it generates a string of "US ASCII" encoding.
Definition: string.h:1630
VALUE rb_str_replace(VALUE dst, VALUE src)
Replaces the contents of the former object with the stringised contents of the latter.
Definition: string.c:5841
char * rb_str_subpos(VALUE str, long beg, long *len)
Identical to rb_str_substr(), except it returns a C's string instead of Ruby's.
Definition: string.c:2844
rb_gvar_setter_t rb_str_setter
This is a rb_gvar_setter_t that refutes non-string assignments.
Definition: string.h:1177
VALUE rb_interned_str_cstr(const char *ptr)
Identical to rb_interned_str(), except it assumes the passed pointer is a pointer to a C's string.
Definition: string.c:11947
VALUE rb_filesystem_str_new_cstr(const char *ptr)
Identical to rb_filesystem_str_new(), except it assumes the passed pointer is a pointer to a C string...
Definition: string.c:1269
#define rb_external_str_new_cstr(str)
Identical to rb_str_new_cstr, except it generates a string of "default external" encoding.
Definition: string.h:1667
VALUE rb_str_buf_append(VALUE dst, VALUE src)
Identical to rb_str_cat_cstr(), except it takes Ruby's string instead of C's.
Definition: string.c:3302
long rb_str_sublen(VALUE str, long pos)
Byte offset to character offset conversion.
Definition: string.c:2810
VALUE rb_str_equal(VALUE str1, VALUE str2)
Equality of two strings.
Definition: string.c:3628
void rb_str_set_len(VALUE str, long len)
Overwrites the length of the string.
Definition: string.c:3039
st_index_t rb_hash_start(st_index_t i)
Starts a series of hashing.
Definition: random.c:1714
VALUE rb_str_inspect(VALUE str)
Generates a "readable" version of the receiver.
Definition: string.c:6456
void rb_must_asciicompat(VALUE obj)
Asserts that the given string's encoding is (Ruby's definition of) ASCII compatible.
Definition: string.c:2511
VALUE rb_interned_str(const char *ptr, long len)
Identical to rb_str_new(), except it returns an infamous "f"string.
Definition: string.c:11940
int rb_str_cmp(VALUE lhs, VALUE rhs)
Compares two strings, as in strcmp(3).
Definition: string.c:3582
VALUE rb_str_concat(VALUE dst, VALUE src)
Identical to rb_str_append(), except it also accepts an integer as a codepoint.
Definition: string.c:3418
VALUE rb_tainted_str_new(const char *ptr, long len)
Definition: string.c:1040
int rb_str_comparable(VALUE str1, VALUE str2)
Checks if two strings are comparable each other or not.
Definition: string.c:3557
VALUE rb_str_buf_cat_ascii(VALUE dst, const char *src)
Identical to rb_str_cat_cstr(), except it additionally assumes the source string be a NUL terminated ...
Definition: string.c:3278
VALUE rb_str_freeze(VALUE str)
This is the implementation of String#freeze.
Definition: string.c:2963
void rb_str_update(VALUE dst, long beg, long len, VALUE src)
Replaces some (or all) of the contents of the given string.
Definition: string.c:5145
VALUE rb_str_scrub(VALUE str, VALUE repl)
"Cleanses" the string.
Definition: string.c:10858
#define rb_locale_str_new_cstr(str)
Identical to rb_external_str_new_cstr, except it generates a string of "locale" encoding instead of "...
Definition: string.h:1688
VALUE rb_str_new_with_class(VALUE obj, const char *ptr, long len)
Identical to rb_str_new(), except it takes the class of the allocating object.
Definition: string.c:1487
#define rb_str_dup_frozen
Just another name of rb_str_new_frozen.
Definition: string.h:662
VALUE rb_check_string_type(VALUE obj)
Try converting an object to its stringised representation using its to_str method,...
Definition: string.c:2659
VALUE rb_str_substr(VALUE str, long beg, long len)
This is the implementation of two-argumented String#slice.
Definition: string.c:2931
#define rb_str_cat_cstr(buf, str)
Identical to rb_str_cat(), except it assumes the passed pointer is a pointer to a C string.
Definition: string.h:1719
VALUE rb_str_unlocktmp(VALUE str)
Releases a lock formerly obtained by rb_str_locktmp().
Definition: string.c:3022
VALUE rb_str_resize(VALUE str, long len)
Overwrites the length of the string.
Definition: string.c:3056
VALUE rb_utf8_str_new_static(const char *ptr, long len)
Identical to rb_str_new_static(), except it generates a string of "UTF-8" encoding instead of "binary...
Definition: string.c:1028
#define rb_utf8_str_new(str, len)
Identical to rb_str_new, except it generates a string of "UTF-8" encoding.
Definition: string.h:1596
void rb_str_modify_expand(VALUE str, long capa)
Identical to rb_str_modify(), except it additionally expands the capacity of the receiver.
Definition: string.c:2467
VALUE rb_str_dump(VALUE str)
"Inverse" of rb_eval_string().
Definition: string.c:6567
VALUE rb_locale_str_new(const char *ptr, long len)
Identical to rb_str_new(), except it generates a string of "locale" encoding.
Definition: string.c:1251
VALUE rb_str_buf_new(long capa)
Allocates a "string buffer".
Definition: string.c:1506
#define rb_tainted_str_new_cstr(str)
Definition: string.h:1613
VALUE rb_str_length(VALUE)
Identical to rb_str_strlen(), except it returns the value in rb_cInteger.
Definition: string.c:2180
#define rb_str_new_cstr(str)
Identical to rb_str_new, except it assumes the passed pointer is a pointer to a C string.
Definition: string.h:1561
VALUE rb_str_drop_bytes(VALUE str, long len)
Shrinks the given string for the given number of bytes.
Definition: string.c:5071
VALUE rb_str_split(VALUE str, const char *delim)
Divides the given string based on the given delimiter.
Definition: string.c:8674
VALUE rb_usascii_str_new_static(const char *ptr, long len)
Identical to rb_str_new_static(), except it generates a string of "US ASCII" encoding instead of "bin...
Definition: string.c:1022
VALUE rb_str_intern(VALUE str)
Identical to rb_to_symbol(), except it assumes the receiver being an instance of RString.
Definition: symbol.c:837
VALUE rb_obj_as_string(VALUE obj)
Try converting an object to its stringised representation using its to_s method, if any.
Definition: string.c:1657
Declares rb_define_variable().
void rb_gvar_setter_t(VALUE val, ID id, VALUE *data)
Type that represents a global variable setter function.
Definition: variable.h:46
RBIMPL_ATTR_PURE() int rb_io_read_pending(rb_io_t *fptr)
Queries if the passed IO has any pending reads.
Defines RBIMPL_ATTR_NONNULL.
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
Definition: nonnull.h:27
Defines RBIMPL_ATTR_PURE.
Defines VALUE and ID.