1xpaconvert(n)                 SAORD Documentation                xpaconvert(n)
2
3
4

NAME

6       XPAConvert: Converting the XPA API to 2.0
7

SYNOPSIS

9       This document describes tips for converting from xpa 1.0 (Xt-based xpa)
10       to xpa 2.0 (socket-based xpa).
11

DESCRIPTION

13       The following are tips for converting from xpa 1.0 (Xt-based xpa) to
14       xpa 2.0 (socket-based xpa). The changes are straight-forward and almost
15       can be done automatically (we used editor macros for most of the
16       conversion).
17
18       ·   The existence of the cpp XPA_VERSION directive to distinguish
19           between 1.0 (where it is not defined) and 2.0 (where it is
20           defined).
21
22       ·   Remove the first widget argument from all send and receive server
23           callbacks.  Also change first 2 arguments from XtPointer to void *.
24           For example:
25
26           #ifdef XPA_VERSION static void XPAReceiveFile(client_data,
27           call_data, paramlist, buf, len)
28                void *client_data;
29                void *call_data;
30                char *paramlist;
31                char *buf;
32                int len; #else static void XPAReceiveFile(w, client_data,
33           call_data, paramlist, buf, len)
34                Widget w;
35                XtPointer client_data;
36                XtPointer call_data;
37                char *paramlist;
38                char *buf;
39                int len; #endif
40
41       ·   Server callbacks should be declared as returning int instead of
42           void. They now should return 0 for no errors, -1 for error.
43
44       ·   The mode flags have changed when defining XPA server callbacks.
45           The old S flag (save buffer) is replaced by freebuf=false.  The old
46           E flag (empty buffer is OK) is no longer used (it was an artifact
47           of the X implementation).
48
49       ·   Change NewXPACommand() to XPAcmdNew(), with the new calling
50           sequence:
51
52             xpa = NewXPACommand(toplevel, NULL, prefix, NULL);
53
54           is changed to:
55
56             xpa = XPACmdNew(xclass, name);
57
58       ·   Change the AddXPACommand() subroutine name to XPACmdAdd (with the
59           same calling sequence):
60
61             AddXPACommand(xpa, "file",
62               "\tdisplay a new file\n\t\t  requires: filename",
63               NULL, NULL, NULL, XPAReceiveFile, text, NULL);
64
65           is changed to:
66
67             XPACmdAdd(xpa, "file",
68               "\tdisplay a new file\n\t\t  requires: filename",
69               NULL, NULL, NULL, XPAReceiveFile, text, NULL);
70
71       ·   The XPAXtAppInput() routine should be called just before
72           XtAppMainLoop() to add xpa fds to the Xt event loop:
73
74             /* add the xpas to the Xt loop */
75             XPAXtAddInput(app, NULL);
76
77             /* process events */
78             XtAppMainLoop(app);
79
80       ·   Change NewXPA() to XPANew() and call XPAXtAddInput() if the
81           XtAppMainLoop routine already has been entered:
82
83             xpa = NewXPA(saotng->xim->toplevel, prefix, xparoot,
84                          "FITS data or image filename\n\t\t  options: file type",
85                          XPASendData, new, NULL,
86                          XPAReceiveData, new, "SE");
87
88           is changed to:
89
90             sprintf(tbuf, "%s.%s", prefix, xparoot);
91             xpa = XPANew("SAOTNG", tbuf,
92                          "FITS data or image filename\n\t\t  options: file type",
93                          XPASendData, new, NULL,
94                          XPAReceiveData, new, "SE");
95             XPAXtAddInput(XtWidgetToApplicationContext(saotng->xim->toplevel), xpa);
96
97       ·   Change XPAInternalReceiveCommand() to XPACmdInternalReceive()
98           remove first argument in the calling sequence):
99
100             XPAInternalReceiveCommand(im->saotng->xim->toplevel,
101                                       im->saotng, im->saotng->commands,
102                                       "zoom reset", NULL, 0);
103
104           is changed to:
105
106             XPACmdInternalReceive(im->saotng, im->saotng->commands,
107                                   "zoom reset", NULL, 0);
108
109       ·   Change DestroyXPA to XPAFree:
110
111             DestroyXPA(im->dataxpa);
112
113           is changed to:
114
115             XPAFree(im->dataxpa);
116

SEE ALSO

118       See xpa(n) for a list of XPA help pages
119
120
121
122version 2.1.15                   July 23, 2013                   xpaconvert(n)
Impressum