XMSTRINGGETNEXTCOMPONENT(3)

πŸ“¦
version 2.3.8 Β· 3 versions
, in arch rolling, centos-stream 9, epel 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

πŸ’– XmStringGetNextComponent πŸ’–

okay bestie, welcome to the library call manual page for XmStringGetNextComponent β€” a compound string function that returns the type and value of the next component in a compound string. yes it's a mouthful, no we are not skipping any of it 🫢


🌸 NAME 🌸

XmStringGetNextComponent β€” A compound string function that returns the type and value of the next component in a compound string


✨ SYNOPSIS ✨

#include <Xm/Xm.h>
XmStringComponentType XmStringGetNextComponent(
XmStringContext context,
char **text,
XmStringTag *tag,
XmStringDirection *direction,
XmStringComponentType *unknown_tag,
unsigned short *unknown_length,
unsigned char **unknown_value);

πŸŽ€ DESCRIPTION πŸŽ€

ngl, first thing's first and it's a little sad: this function is obsolete and it only exists for compatibility with previous releases. it has been replaced by XmStringGetNextTriple. periodt. 😭

XmStringGetNextComponent returns the type and value of the next component in the compound string identified by context. Components come back one at a time, like a lil conga line πŸ’ƒ. And here's the tea: on return, only some of the output parameters will actually be valid. which ones? you gotta look at the returned component type to figure that out. it's giving "mystery box, but make it C" πŸ™ˆ

so here's the vibe check on which fields are valid for which component type πŸ‘‡

  • tag β€” valid for XmSTRING_COMPONENT_LOCALE and XmSTRING_COMPONENT_TAG
  • text β€” valid for XmSTRING_COMPONENT_LOCALE_TEXT, XmSTRING_COMPONENT_TEXT, and XmSTRING_COMPONENT_WIDECHAR_TEXT
  • direction β€” valid for XmSTRING_COMPONENT_DIRECTION
  • unknown_tag, unknown_length, unknown_value β€” valid for XmSTRING_COMPONENT_LAYOUT_POP, XmSTRING_COMPONENT_LAYOUT_PUSH, XmSTRING_COMPONENT_TAB, XmSTRING_COMPONENT_RENDITION_BEGIN, and XmSTRING_COMPONENT_RENDITION_END
  • no valid field β€” for XmSTRING_COMPONENT_SEPARATOR, XmSTRING_COMPONENT_END, and XmSTRING_COMPONENT_UNKNOWN
okay so lowkey a bunch of components produce a return value of XmSTRING_COMPONENT_UNKNOWN. the data from those comes back in the unknown_tag, unknown_length, and unknown_value fields instead. this apparent inconsistency is designed to accomodate older applications that may not be equipped to handle the newer component types of Motif version 2.0 and beyond. so yeah β€” the use of this procedure is not recommended. instead, use the XmStringGetNextTriple procedure, which provides all the functionality of XmStringGetNextComponent and is fully compatible with the newer component types. the more you know ✨

and now the memory-management part, pay attention bestie, this one's important πŸ’…:

if the function return value is XmSTRING_COMPONENT_LOCALE_TEXT or XmSTRING_COMPONENT_TEXT, then the function allocates space to hold the returned text. and if the function return value is XmSTRING_COMPONENT_FONTLIST_ELEMENT_TAG, or XmSTRING_COMPONENT_TAG, then the function allocates space to hold the returned tag. the application is responsible for managing that allocated space. you can recover it by calling XtFree. don't just leave it floating there, that's not main character energy 🧚

πŸ¦‹ the parameters πŸ¦‹

  • context β€” Specifies the string context structure that was allocated by the XmStringInitContext function.
  • text β€” Specifies a pointer to a NULL terminated string.
  • tag β€” Specifies a pointer to the tag component associated with the text. The value XmFONTLIST_DEFAULT_TAG identifies a locale text segment.
  • direction β€” Specifies a pointer to the direction of the text.
  • unknown_tag β€” Specifies a pointer to the tag of an unknown component.
  • unknown_length β€” Specifies a pointer to the length of an unknown component.
  • unknown_value β€” Specifies a pointer to the value of an unknown component.

πŸ’« RETURN πŸ’«

Returns the type of component found. Refer to the XmStringComponentType(3) reference page for a list of component types. slay πŸŽ€


XmStringComponentType(3), XmStringCreate(3), and XmStringInitContext(3).


and that's the whole page babes, no cap πŸ’– straight from the library call manual β€” the XmStringGetNextComponent(library call) source and version, as printed on the page itself. go forth and XtFree responsibly πŸ‘‘πŸŒˆ