This document describes tips for converting from xpa 1.0 (Xt-based xpa) to xpa 2.0 (socket-based xpa).
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).
#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
xpa = NewXPACommand(toplevel, NULL, prefix, NULL);is changed to:
xpa = XPACmdNew(xclass, name);
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);
/* add the xpas to the Xt loop */ XPAXtAddInput(app, NULL); /* process events */ XtAppMainLoop(app);
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);
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);
DestroyXPA(im->dataxpa);is changed to:
XPAFree(im->dataxpa);