Fields in list data, names of source nodes, and everything in between use human readable text to represent their identity. When working with the Data API, ink_ident is used to represent these names. Reasons for using ink_ident instead of raw strings is largely for performance and program complexity.

An ink_ident is a 64 bit integer, with a few APIs to handle converting to and from text.

Automatic Identifier Generation#

A project's settings file has options for generating code that maps between all identifiers used in quill and constant language specific identifiers.

For example, take the following configuration in a project's quill.toml file:

identifiers_c = "src/idents.h"

Will cause Quill to create a file that might look something like this:

#define I_Button_Icon 1397746334359631977llu // Button Icon
#define I_Entries 17718144473556522940llu // Entries
#define I_main 6571252440867548112llu // main
#define I_my_field_ 6389251175874865077llu // my field
#define I_my_field 18377038611343822735llu // my_field

Which would allow you to use these C identifiers instead of calling ink_ident_from_str.

Identifiers generated by Quill have their original string value saved in gui.bin. Upon loading they are added to the reverse lookup cache and accessible from ink_ident_as_char.


Convert a string to an identifier:

ink_ident ink_ident_from_str(const char*);
ink_ident ink_ident_from_strn(const char* str, size_t len);

Convert a string to an identifier without adding it to the reverse lookup cache:

ink_ident ink_ident_from_strn_no_reverse(const char* str, size_t len);

Adds a string to the reverse lookup cache:

void ink_ident_add_reverse(const char* str, size_t len);

Retrieve the string that was used to create the ident, returns null if the ident doesn't exist in the reverse lookup cache:

const char* ink_ident_as_char(ink_ident);