Tk_GetCapStyle(3tk)

πŸ“¦
version 9.0.4 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’… NAME πŸ’…

Tk_GetCapStyle, Tk_NameOfCapStyle β€” bestie, this is your little translator between strings and cap styles. That's it. That's the whole job. ✨

It's from the Tk library, manual page Tk_GetCapStyle(3tk), and we're about to make it make sense.


πŸŽ€ SYNOPSIS πŸŽ€

#include <tk.h>

int
Tk_GetCapStyle(interp, string, capPtr)

const char *
Tk_NameOfCapStyle(cap)

πŸ¦‹ ARGUMENTS πŸ¦‹

  • Tcl_Interp *interp (in) β€” the interpreter we use to report errors. She's the messenger, okay? 🫢
  • const char *string (in) β€” a string holding the name of a cap style, and it's gotta be one of "butt", "projecting", or "round" β€” or a unique abbreviation of one of them. Yes, abbreviating is allowed, we love efficiency. πŸ’…
  • int *capPtr (out) β€” a pointer to the spot where we're gonna stash the X cap style that matches string. ✨
  • int cap (in) β€” a cap style, one of CapButt, CapProjecting, or CapRound. πŸ‘‘

🌸 DESCRIPTION 🌸

So, Tk_GetCapStyle takes your string and drops the matching X cap style into *capPtr. That value is gonna be one of CapButt, CapProjecting, or CapRound β€” no other options, periodt.

Cap styles are typically used in X graphics contexts to say how the end-points of lines should be capped. If you wanna know what each style actually means, go read the X documentation, because that's where that tea lives. 🍡

Under normal circumstances the return value is TCL_OK, and honestly interp just sits there unused like a third wheel. 😭 But if string doesn't hold a valid cap style (or an abbreviation of one of those names), then:

  • an error message gets stored in interpreter interp's result πŸ“
  • TCL_ERROR is returned 🚨
  • and *capPtr is left unmodified β€” like, don't touch her, she's fine πŸ™ˆ

Tk_NameOfCapStyle is the logical inverse of Tk_GetCapStyle. Give her a cap style like CapButt and she hands you back a statically-allocated string corresponding to cap. ✨

Heads up bestie: if cap is not a legal cap style, she returns "unknown cap style". That's it. That's the whole answer. πŸ’€

πŸ‘‘ KEYWORDS πŸ‘‘

butt, cap style, projecting, round


Okay that's the whole page, you ate that 🫢 This one's straight outta the Tk library, page Tk_GetCapStyle(3tk) β€” no date on this queen, she's timeless, and she's been serving the same flawless info the whole time. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from