RULEXDB_RETRIEVE_ITEM(3)

πŸ’– RULEXDB_RETRIEVE_ITEM πŸ’–

okay bestie so this is a page from the Library Functions Manual, section 3 (that's the "functions you call from C" section, iykyk), and it's all about rulexdb_retrieve_item β€” the lil function that goes and fetches your stuff out of the rulex database. let's get into it 🫢


🌸 NAME 🌸

rulexdb_retrieve_item β€” retrieve an item from the rulex database


✨ SYNOPSIS ✨

#include <rulexdb.h>

int rulexdb_retrieve_item(RULEXDB *rulexdb, const char *key, char *value, int item_type);

πŸ¦‹ DESCRIPTION πŸ¦‹

so rulexdb_retrieve_item() grabs an item out of one of the dictionary datasets inside the database that rulexdb points at. one job, does it well, periodt.

the key argument points to a text string holding the word you wanna fetch. that's your search term, your little query, your main character.

the value argument points to the memory area where the corresponding pronunciation string will get placed. yes babe, you provide that buffer, so make sure there's room πŸ’…

the item_type argument says which dataset you're targeting. it can take one of these values:

  • RULEXDB_LEXBASE β€” the item should be fetched from the Implicit dictionary, and therefore it represents a lexical base.
  • RULEXDB_EXCEPTION β€” the item representing an exception should be fetched from the Explicit dictionary.
  • RULEXDB_DEFAULT β€” the target dictionary gets guessed from the key you specified: if it represents any lexical base, the Implicit dictionary is chosen; otherwise the Explicit dictionary is used. so it's like, doing the vibes check for you 🧚

πŸŽ€ RETURN VALUE πŸŽ€

rulexdb_retrieve_item() returns:

  • RULEXDB_SUCCESS, which is zero, when the specified item was successfully retrieved (slay),
  • the positive value RULEXDB_SPECIAL when the specified key does not exist in the dictionary (not a flop, just… not there 😭),
  • or a negative error code otherwise.

πŸ’€ ERRORS πŸ’€

  • RULEXDB_FAILURE β€” the referenced database has not been opened, internal data structures are corrupted, or some other general failure has occurred. like, something is deeply wrong.
  • RULEXDB_EINVKEY β€” invalid key specified.
  • RULEXDB_EPARM β€” the rulexdb argument or the item_type argument has an invalid value.
bestie if you're getting negative returns, check those last two first. EPARM especially is like, "girl, what did you even pass me" πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

your girl is not alone in this library, here's the whole friend group:


πŸ’œ AUTHOR πŸ’œ

Igor B. Poretsky <poretsky@mlbox.ru>. iconic behavior, we love to see it πŸ’–


and that's the whole page!! this little slice of the Library Functions Manual is dated June 22, 2023, and yeah it's RULEXDB_RETRIEVE_ITEM(3) through and through β€” go forth and retrieve your items, bestie πŸ’…βœ¨

πŸ“¦ where this page comes from