xpaconvert(7)
π xpaconvert β the glow-up guide π
okay bestie, so this is xpaconvert(7) from the SAORD Documentation collection, and it's literally the "how do I make my old xpa code cute again" doc. sit down, grab a strawberry, we're doing a migration β¨
π NAME π
XPAConvert β converting the XPA API to 2.0, aka the makeover episode πΈ
β¨ SYNOPSIS β¨
This document describes tips for converting from xpa 1.0 (Xt-based xpa) to xpa 2.0 (socket-based xpa). it's giving "old era β new era" π
π¦ DESCRIPTION π¦
The following are tips for converting from xpa 1.0 (Xt-based xpa) to xpa 2.0 (socket-based xpa). The changes are straight-forward and almost can be done automatically (we used editor macros for most of the conversion). no cap, it's lowkey a find-and-replace slay π₯
- The existence of the
cppXPA_VERSIONdirective to distinguish between1.0(where it is not defined) and2.0(where it is defined). π§ - Remove the first widget argument from all send and receive server callbacks. Also change first
2arguments fromXtPointertovoid *. For example:
#ifdef XPA_VERSION
static void XPAReceiveFile(client_data, call_data, paramlist, buf, len)
void *client_data;
void *call_data;
char *paramlist;
char *buf;
int len;
#else
static void XPAReceiveFile(w, client_data, call_data, paramlist, buf, len)
Widget w;
XtPointer client_data;
XtPointer call_data;
char *paramlist;
char *buf;
int len;
#endif
- Server callbacks should be declared as returning
intinstead ofvoid. They now should return0for no errors,-1for error. yes bestie, we report back now π - The mode flags have changed when defining XPA server callbacks. The old
Sflag (save buffer) is replaced byfreebuf=false. The oldEflag (empty buffer is OK) is no longer used (it was an artifact of the X implementation). rip E flag, you will not be missed π - Change
NewXPACommand()toXPAcmdNew(), with the new calling sequence:
xpa = NewXPACommand(toplevel, NULL, prefix, NULL);
is changed to:
xpa = XPACmdNew(xclass, name);
- Change the
AddXPACommand()subroutine name toXPACmdAdd(with the same calling sequence):
AddXPACommand(xpa, "file",
"\tdisplay a new file\n\t\t requires: filename",
NULL, NULL, NULL, XPAReceiveFile, text, NULL);
is changed to:
XPACmdAdd(xpa, "file",
"\tdisplay a new file\n\t\t requires: filename",
NULL, NULL, NULL, XPAReceiveFile, text, NULL);
- The
XPAXtAppInput()routine should be called just beforeXtAppMainLoop()to add xpa fds to the Xt event loop:
/* add the xpas to the Xt loop */
XPAXtAddInput(app, NULL);
/* process events */
XtAppMainLoop(app);
- Change
NewXPA()toXPANew()and callXPAXtAddInput()if theXtAppMainLooproutine already has been entered:
xpa = NewXPA(saotng->xim->toplevel, prefix, xparoot,
"FITS data or image filename\n\t\t options: file type",
XPASendData, new, NULL,
XPAReceiveData, new, "SE");
is changed to:
sprintf(tbuf, "%s.%s", prefix, xparoot);
xpa = XPANew("SAOTNG", tbuf,
"FITS data or image filename\n\t\t options: file type",
XPASendData, new, NULL,
XPAReceiveData, new, "SE");
XPAXtAddInput(XtWidgetToApplicationContext(saotng->xim->toplevel), xpa);
- Change
XPAInternalReceiveCommand()toXPACmdInternalReceive()remove first argument in the calling sequence):
XPAInternalReceiveCommand(im->saotng->xim->toplevel,
im->saotng, im->saotng->commands,
"zoom reset", NULL, 0);
is changed to:
XPACmdInternalReceive(im->saotng, im->saotng->commands,
"zoom reset", NULL, 0);
- Change
DestroyXPAtoXPAFree:
DestroyXPA(im->dataxpa);
is changed to:
XPAFree(im->dataxpa);
π SEE ALSO π
See xpa(n) for a list of XPA help pages π«Ά
and that's the whole migration, bestie β you ate, no crumbs, periodt π
this little love letter is version 2.1.15, dated July 23, 2013, brought to you by the SAORD Documentation girlies. go forth and convert, main character πβ
π¦ where this page comes from
- debian bookworm: libxpa-dev 2.1.20-1 Β· MIT
- debian trixie: libxpa-dev 2.1.20-3 Β· MIT
- ubuntu jammy: libxpa-dev 2.1.20-1 Β· MIT
- ubuntu noble: libxpa-dev 2.1.20-1build1 Β· MIT
- ubuntu questing: libxpa-dev 2.1.20-3
- ubuntu resolute: libxpa-dev 2.1.20-3build1 Β· MIT
- ubuntu stonking: libxpa-dev 2.1.20-3build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms