TTMEDIA_DEPOSIT(3)

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

πŸ’– ttmedia_Deposit(library call) β€” send a Deposit request to checkpoint a document πŸ’–

okay so welcome to the ttmedia_Deposit(library call) page, bestie ✨ this is the one about sending a Deposit request to checkpoint a document. no cap, it's giving β€œeditor sends the new contents back” energy. 🫢


🌸 NAME 🌸

ttmedia_Deposit β€” send a Deposit request to checkpoint a document. that's the whole vibe: checkpoint save request, sent via the ToolTalk service πŸ’…

✨ SYNOPSIS ✨

       #include &<Tt/tttk.h>
       Tt_status ttmedia_Deposit(
       Tt_message load_contract,
       const char *buffer_id,
       const char *media_type,
       const unsigned char *new_contents,
       int new_len,
       const char *pathname,
       XtAppContext app2run,
       int ms_timeout);

πŸ’… DESCRIPTION πŸ’…

okay so here's the tea: ttmedia_Deposit does a checkpoint save on a document that was the subject of a Media Exchange load_contract request β€” think Edit, Compose, or Open. to actually carry out that checkpoint save, the editor has to send the new document contents back to whoever sent load_contract. πŸŽ€

the function creates and sends a Deposit request, then returns the success or failure of that request. load_contract is the request that caused this editor to load the document. buffer_id is the identifier of the buffer this editor created if the document was loaded via an Open request. πŸ‘‘

if buffer_id is NULL, the ToolTalk service gives the Deposit request a Tt_address of TT_HANDLER and sends it directly to the tt_message_sender of load_contract. otherwise, the ToolTalk service will address it as a TT_PROCEDURE and insert buffer_id into the request to match the pattern registered by the sender of the load_contract. πŸ¦‹

ttmedia_Deposit uses media_type as the vtype of the contents argument of the sent request, and new_contents plus new_len as its value. those latter two must be zero if pathname is used to name a temporary file into which the editor will place the checkpointed document. the editor is free to remove that temporary file after the reply to the Deposit request is received β€” that is, after ttmedia_Deposit has returned. πŸ“

after the request is sent, ttmedia_Deposit passes app2run and ms_timeout to tttk_block_while(3) to wait for the reply. literally that's the flow 😌

πŸŽ€ RETURN VALUE πŸŽ€

upon successful completion, ttmedia_Deposit returns the status of the operation as one of these Tt_status values:

  • TT_OK β€” the operation completed successfully. πŸŽ‰
  • TT_DESKTOP_ETIMEDOUT β€” no reply was received within ms_timeout milliseconds. ⏰
  • TT_ERR_NOMEM β€” there is insufficient memory available to perform the function. 😭
  • TT_ERR_NOMP β€” the ttsession(1) process is not running and the ToolTalk service cannot restart it. πŸ’€
  • TT_ERR_OVERFLOW β€” the ToolTalk service has more active messages than it can handle. (the maximum number of active messages is implementation specific, but is at least 2000.) πŸ”₯
  • TT_ERR_POINTER β€” the pathname argument was NULL or was a ToolTalk error pointer. πŸ™ˆ
  • TT_ERR_PROCID β€” the specified process identifier is out of date or invalid. 🚫

πŸ¦‹ SEE ALSO πŸ¦‹

go check these out, bestie: Tt/tttk.h - Tttttk(5), ttmedia_load(3), ttmedia_load_reply(3), ttmedia_ptype_declare(3), ttdt_Save(3), tttk_block_while(3). iykyk πŸ’œ

xoxo, bestie πŸ’– β€” the footer says ttmedia_Deposit(library call) and no date was printed with it, so that's the cute source/version sign-off; imaginary timestamp: sparkle o'clock πŸŽ€βœ¨

πŸ“¦ where this page comes from