TT_OTYPE_OPNUM_CALLBACK_ADD(3)

πŸ“¦
version 2.5.3 Β· 2 versions
, in nixos 26.05

πŸ’… tt_otype_opnum_callback_add

okay bestie, welcome to the library call section of the manual β€” yes it's a C function page, yes it's about ToolTalk, and yes we're gonna make it make sense 🫢


✨ NAME ✨

tt_otype_opnum_callback_add β€” return a callback if two opnums are equal πŸ”₯

Lowkey the whole vibe: you hand it two opnums, and if they match up, a callback comes back to you. Iconic.


🌸 SYNOPSIS 🌸

#include <Tt/tt_c.h>
Tt_status tt_otype_opnum_callback_add(
const char *otid,
int opnum,
Tt_message_callback f);

Three args, no drama, periodt πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea, bestie: tt_otype_opnum_callback_add adds a callback. And not just any callback β€” one that gets automatically invoked when a message is delivered, because that message matched a pattern derived from a signature in the named otype with an opnum equal to the one you specified. Fr fr. It just goes off on its own, no cap.

The callback is defined in Tt/tt_c.h - Tttt_c(5) β€” go look at that page if you want the full lore, iykyk πŸ‘‘

Now the arguments, one by one, because we don't skip details in this house:

  • otid β€” the identifier of the object type involved in this operation πŸŽ€
  • opnum β€” the opnum of the specified otype. that's it, that's the whole argument ✨
  • f β€” the message callback to be run. the main character of this operation, honestly 🌟

πŸ’– RETURN VALUE πŸ’–

When it works out (and we love when it works out), tt_otype_opnum_callback_add returns the status of the operation as one of these Tt_status values:

  • TT_OK β€” the operation completed successfully. slay πŸ’…πŸŽ‰
  • TT_ERR_OTYPE β€” the specified object type is not the name of an installed object type. sorry babes, that otype isn't installed 😭
  • TT_ERR_POINTER β€” the pointer passed does not point to an object of the correct type for this operation. wrong type of pointer, wrong vibe, vibe check failed πŸ’€
  • TT_ERR_NOMP β€” the ttsession(1) process is not running and the ToolTalk service cannot restart it. the session is literally not there and it can't come back on its own πŸ™ˆ

🌈 APPLICATION USAGE 🌈

Heads up, bestie, this part matters: tt_otype_opnum_callback_add will only be called for messages delivered by virtue of matching handler signatures.

And the callback cannot be called for observer signatures β€” because the observer ptype is not recorded in the incoming message. That's just how it is, no workaround implied here, I'm only telling you what the page says 🧚


⭐ SEE ALSO ⭐


and that's the whole page, bestie πŸ“ this was a library call page, signed off at the bottom as tt_otype_o...allback_add(library call) β€” that's the source/version line the page leaves us with (no date on this one, she's mysterious like that πŸ’œ). now go add those callbacks, you absolute icon πŸ‘‘βœ¨

πŸ“¦ where this page comes from