XtConvertAndStore(3)
β¨ XtConvertAndStore β from the XT FUNCTIONS manual, section 3 π
okay bestie, gather round, because this one is literally the resource converter page and it's giving plumbing that makes the whole toolkit work. Two functions, one job: make the converter go brrr. π
πΈ NAME πΈ
XtConvertAndStore, XtCallConverter β invoke resource converters π
β¨ SYNTAX β¨
#include <X11/Intrinsic.h>
Boolean XtConvertAndStore(Widget widget, const char *from_type,
XrmValuePtr from, const char *to_type, XrmValuePtr to_in_out);
Boolean XtCallConverter(Display* dpy, XtTypeConverter converter,
XrmValuePtr args, Cardinal num_args, XrmValuePtr from,
XrmValuePtr to_in_out, XtCacheRef* cache_ref_return);
no cap, that's the whole vibe right there π (copy it exactly, do not freestyle it, the compiler will find out)
π¦ ARGUMENTS π¦
argsβ the argument list holding all the extra lil arguments you need to actually pull off the conversion, orNULLif you're not about that life. π«Άconverterβ the conversion procedure that's getting called. the main character of this operation, fr fr.fromβ the value you're converting. the before picture. πfrom_typeβ the source type. where we're coming from, literally.num_argsβ how many extra arguments there are (often zero, because sometimes simplicity ate). β¨to_typeβ the destination type. where we're going, glow-up pending. πto_in_outβ returns the converted value. the after picture. πΈwidgetβ the widget you use for extra arguments if any are needed, plus the destroy callback list. she's holding the context, iconic behaviour.dpyβ the display this conversion is associated with. gotta know which screen we're serving. π₯οΈ
π DESCRIPTION π
so. the tea. β
π§ XtConvertAndStore
XtConvertAndStore looks up the type converter registered to convert from_type to to_type, computes any additional arguments that are needed, and then calls XtCallConverter β (or XtDirectConvert if an old-style converter was registered with XtAddConverter or XtAppAddConverter) β handing it the from and to_in_out arguments. she's the project manager. she delegates. she slays. π
π XtCallConverter
XtCallConverter looks up the specified type converter in the application context associated with the display and, if the converter was not registered or was registered with cache type XtCacheAll or XtCacheByDisplay, it peeks in the conversion cache to see if this conversion procedure has already been called with the specified conversion arguments. π
if it has, it checks the success status of the prior call:
- if the conversion failed,
XtCallConverterreturnsFalseimmediately β no second chances, she's done. π - otherwise it checks the size specified in the
toargument and, if that size is greater than or equal to the size stored in the cache, it copies the info stored in the cache into the location specified byto->addr, stores the cache size intoto->size, and returnsTrue. π₯³ - but if the size specified in the
toargument is smaller than the size stored in the cache,XtCallConvertercopies the cache size intoto->sizeand returnsFalse. bestie, the buffer was not big enough, tragic. π
and if the converter was registered with cache type XtCacheNone, or no value was found in the conversion cache at all, XtCallConverter calls the converter and β as long as it was not registered with cache type XtCacheNone β enters the result into the cache. then XtCallConverter returns whatever the converter returned. π«‘
π the cache_ref_return field
the cache_ref_return field specifies storage allocated by the caller in which an opaque value will be stored.
if the type converter has been registered with the XtCacheRefCount modifier and the value returned in cache_ref_return is non-NULL, then the call should store the cache_ref_return value so it can decrement the reference count when the converted value is no longer required. π₯
β οΈ andcache_ref_returnshould beNULLif the caller is unwilling or unable to store the value. no pretending. be honest with her. π
π SEE ALSO π
XtAppReleaseCacheRefs(3)X Toolkit Intrinsics - C Language InterfaceXlib - C Language X Interface
okay that's the whole page, you ate that, go convert something π
this was brought to you by X Version 11 and libXt 1.3.1 β mwah, drink your water, and remember that XtConvertAndStore(3) is always in your corner πβ¨π¦π
π¦ where this page comes from
- alpine 3.22: libxt-doc 1.3.1-r0 Β· MIT
- alpine 3.23: libxt-doc 1.3.1-r0 Β· MIT
- alpine 3.24: libxt-doc 1.3.1-r0 Β· MIT
- arch rolling: libxt 1.3.1-1 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 43: libXt-devel 1.3.1-3.fc43 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 43: libXt-devel 1.3.1-3.fc43 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 44: libXt-devel 1.3.1-4.fc44 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 44: libXt-devel 1.3.1-4.fc44 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- Copyright (c) 1993, 1994 X Consortium
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms