EC_INTERA..._CALLBACK(3)

πŸ“¦
version 0.11.7 Β· 4 versions
, in fedora 44

πŸ’– EC_INTERACT_SET_CALLBACK β€” bestie edition πŸ’–

okay so real talk, this is page EC_INTERA..._CALLBACK(3) from the Libecoli Programmer's Manual, and it's literally about making your grammar nodes do something when parsing goes right. no cap. let's get into it 🫢


✨ NAME ✨

ec_interact_set_callback β€” set a callback function on a grammar node. that's it, that's the whole vibe πŸ’…


🌸 SYNOPSIS 🌸

#include <ecoli/interact.h>

int ec_interact_set_callback(
    /*
     * The ec_node on which to add the callback attribute.
     */
    struct ec_node           *node,
    ec_interact_command_cb_t  cb     /* The callback function pointer. */
);

like, you pull in the header, you hand it a node, you hand it a callback, boom. iconic ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

So what this does: it sets the node attribute EC_INTERACT_CB_ATTR on the node, and inside that attribute lives a pointer to a function β€” and that function gets invoked on successful parsing. πŸŽ€

fr fr that's it. you're basically telling the node "hey bestie, when someone parses you correctly, run this". main character energy for your grammar tree πŸ‘‘


πŸ‘‘ RETURN VALUE πŸ‘‘

  • 0 on success πŸ’š
  • -1 on error 😭

πŸ’€ SEE ALSO πŸ’€

the whole friend group, obviously:


Copyright (C) 2010-2026 Olivier Matz, Robin Jarry.


and that's the page, bestie!! πŸŽ€ this lil slice of the Libecoli Programmer's Manual is dated 2026-06-11, brought to you by libecoli β€” go forth and callback responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from