XDF_ADD_EVTTYPE(3)

✨ XDF_ADD_EVTTYPE(3) ✨

okay bestie, so this is a page from the xdffileio library manual and it's literally all about one tiny lil function that adds a type of event πŸ’… buckle up


πŸŽ€ NAME πŸŽ€

xdf_add_evttype β€” adds a type of event ✨


🌸 SYNOPSIS 🌸

#include <xdfio.h>

int xdf_add_evttype(struct xdf* xdf, int code, const char* desc);

like. that's it. that's the whole thing. short king πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

okay so xdf_add_evttype() adds an event type to the file referenced by the handle xdf, and no cap, that file has to be opened for writing β€” we do not do read-only situations here πŸ™…β™€οΈ

the event type it adds is specified by a combination of:

  • code β€” the event code, iconic
  • desc β€” the event description

and if there's, like, no description associated with the event type? then desc should be set to NULL. easy. NULL it. don't overthink it bestie 🫢

now here's the tea β˜• β€” if an event type with the same combination has already been added, then no new type will be added. instead, the previous type gets returned. so it's not a duplicate, it's a "hey girl, you already have this one" situation πŸ’€ and that's actually good, it's giving efficiency ✨


πŸ‘‘ RETURN VALUE πŸ‘‘

the function returns the event type when things go well πŸŽ‰

otherwise it returns -1 and errno is set appropriately. yeah. the classic -1. 😭


πŸ¦‹ ERRORS πŸ¦‹

here's the vibe check on what can go wrong, fr fr:

  • EINVAL β€” xdf is NULL πŸ™ˆ like bestie... you gave me nothing
  • ENOMEM β€” the system is unable to allocate resources. the system said "no memory for you" πŸ’€
  • EPERM β€” the file referenced by xdf has not been opened for writing, OR its file format does not support events. permission denied energy, we hate to see it 😀

⭐ SEE ALSO ⭐


and that's the whole page bestie!! this lil beauty came from the EPFL era, dated 2010, and it lives in the xdffileio library manual πŸ’œ periodt. go add some event types, you've got this πŸŒˆπŸ¦‹βœ¨