RULEXDB_SUBSCRIBE_RULE(3)

✨ RULEXDB_SUBSCRIBE_RULE ✨

okay so bestie, welcome to RULEXDB_SUBSCRIBE_RULE(3) β€” a page from the Library Functions Manual and honestly? it's giving "new rule just dropped" πŸ’… stay with me, it's short and slay.


🌸 NAME 🌸

rulexdb_subscribe_rule β€” store a new rule into the rulex database πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <rulexdb.h>

int rulexdb_subscribe_rule(RULEXDB *rulexdb, const char *src, int rule_type, unsigned int position);

πŸ’– DESCRIPTION πŸ’–

so rulexdb_subscribe_rule() literally just adds a brand new rule to the specified ruleset in the database that the rulexdb argument points at. that's the whole vibe. new rule, in the ruleset, periodt ✨

the argument src points to the text representation of the rule you wanna add β€” like, the actual rule as text, okay? πŸ‘‘

the argument rule_type specifies the rule type. it may accept one of these iconic values:

  • RULEXDB_LEXCLASS β€” this rule is the word classifier and should be added to the Classifiers dataset. it's the main character of word classification, no cap.
  • RULEXDB_PREFIX β€” the rule should be added to the Prefix detectors ruleset. prefix girly pop πŸŽ€
  • RULEXDB_RULE β€” the rule should be treated as a general rule and added to the General rules dataset. just a regular queen living her regular life 🌸
  • RULEXDB_CORRECTOR β€” this rule is a correction rule and should be added to the Correctors dataset. fixing things, as she should πŸ’…

the argument position defines the position of the newly added rule in the ruleset. so:

  • if it's 0, this rule is appended at the end of the ruleset (chill, she goes last)
  • otherwise, the new rule will be inserted at the specified position (cut the line bestie, she's going in the middle 😭)

πŸ”₯ RETURN VALUE πŸ”₯

rulexdb_subscribe_rule() returns RULEXDB_SUCCESS, which is zero, when it's a success πŸ’– β€” or a non-zero error code otherwise. so like, 0 = we ate, anything else = we did not eat πŸ™ˆ


πŸ’€ ERRORS πŸ’€

here's where it can go wrong, and ngl you need to know all of these:

  • RULEXDB_FAILURE β€” the referenced database has not been opened, internal data structures are corrupted, or some other general failure has occurred. it's giving "everything is broken and we don't know why" πŸ’€
  • RULEXDB_EINVKEY β€” the argument position has a non-zero value, but it is out of the ruleset range that must be continuous. so the range has to be continuous, and your position was not. not slay.
  • RULEXDB_EPARM β€” the argument rulexdb or rule_type has an invalid value. bad param, bad vibe 🚫
  • RULEXDB_EACCESS β€” the database is not opened for updating. she's read-only rn, sorry bestie, you can't write to her 😭

🌈 SEE ALSO 🌈

go read these next, they're all connected, iykyk 🫢


πŸ‘‘ AUTHOR πŸ‘‘

written by Igor B. Poretsky <poretsky@mlbox.ru> β€” icon behavior, thank you for your service πŸ«‘πŸ’œ


and that's the page bestie!! 🌟 this was RULEXDB_SUBSCRIBE_RULE(3) from the Library Functions Manual, dated February 19, 2012 β€” go forth and subscribe those rules, you absolute legend πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from