Debian Codegraph @

xpa/doc/convert.html

raw symbols SCIP
1 <!-- =defdoc xpaconvert xpaconvert n -->
2 <HTML>
3 <HEAD>
4 <TITLE>Converting the XPA API to 2.0</TITLE>
5 </HEAD>
6 <BODY>
7
8 <!-- =section xpaconvert NAME -->
9 <H2><A NAME="xpaconvert">XPAConvert: Converting the XPA API to 2.0</A></H2>
10
11 <!-- =section xpaconvert SYNOPSIS -->
12 <H2>Summary</H2>
13 <P>
14 This document describes tips for converting from xpa 1.0 (Xt-based
15 xpa) to xpa 2.0 (socket-based xpa).
16
17 <!-- =section xpaconvert DESCRIPTION -->
18 <H2>Description</H2>
19 <P>
20 The following are tips for converting from xpa 1.0 (Xt-based xpa) to
21 xpa 2.0 (socket-based xpa). The changes are straight-forward and
22 almost can be done automatically (we used editor macros for most of
23 the conversion).
24 <UL>
25 <P>
26 <LI>The existence of the cpp XPA_VERSION directive to distinguish between 1.0
27 (where it is not defined) and 2.0 (where it is defined).
28
29 <P>
30 <LI>Remove the first widget argument from all send and receive server
31 callbacks. Also change first 2 arguments from XtPointer to void
32 *. For example:
33 <PRE>
34 #ifdef XPA_VERSION
35 static void XPAReceiveFile(client_data, call_data, paramlist, buf, len)
36 void *client_data;
37 void *call_data;
38 char *paramlist;
39 char *buf;
40 int len;
41 #else
42 static void XPAReceiveFile(w, client_data, call_data, paramlist, buf, len)
43 Widget w;
44 XtPointer client_data;
45 XtPointer call_data;
46 char *paramlist;
47 char *buf;
48 int len;
49 #endif
50 </PRE>
51 <P>
52 <LI>Server callbacks should be declared as returning int instead
53 of void. They now should return 0 for no errors, -1 for error.
54
55 <P>
56 <LI> The mode flags have changed when defining XPA server callbacks.
57 The old <EM>S</EM> flag (save buffer) is replaced by <EM>freebuf=false</EM>.
58 The old <EM>E</EM> flag (empty buffer is OK) is no longer used (it
59 was an artifact of the X implementation).
60
61 <P>
62 <LI>Change NewXPACommand() to XPAcmdNew(), with the new calling sequence:
63 <PRE>
64 xpa = NewXPACommand(toplevel, NULL, prefix, NULL);
65 </PRE>
66 is changed to:
67 <PRE>
68 xpa = XPACmdNew(xclass, name);
69 </PRE>
70 <P>
71 <LI>Change the AddXPACommand() subroutine name to XPACmdAdd (with the same
72 calling sequence):
73 <PRE>
74 AddXPACommand(xpa, "file",
75 "\tdisplay a new file\n\t\t requires: filename",
76 NULL, NULL, NULL, XPAReceiveFile, text, NULL);
77 </PRE>
78 is changed to:
79 <PRE>
80 XPACmdAdd(xpa, "file",
81 "\tdisplay a new file\n\t\t requires: filename",
82 NULL, NULL, NULL, XPAReceiveFile, text, NULL);
83 </PRE>
84 <P>
85 <LI>The XPAXtAppInput() routine should be called just before XtAppMainLoop()
86 to add xpa fds to the Xt event loop:
87 <PRE>
88 /* add the xpas to the Xt loop */
89 XPAXtAddInput(app, NULL);
90
91 /* process events */
92 XtAppMainLoop(app);
93 </PRE>
94 <P>
95 <LI>Change NewXPA() to XPANew() and call XPAXtAddInput() if the XtAppMainLoop
96 routine already has been entered:
97 <PRE>
98 xpa = NewXPA(saotng->xim->toplevel, prefix, xparoot,
99 "FITS data or image filename\n\t\t options: file type",
100 XPASendData, new, NULL,
101 XPAReceiveData, new, "SE");
102 </PRE>
103 is changed to:
104 <PRE>
105 sprintf(tbuf, "%s.%s", prefix, xparoot);
106 xpa = XPANew("SAOTNG", tbuf,
107 "FITS data or image filename\n\t\t options: file type",
108 XPASendData, new, NULL,
109 XPAReceiveData, new, "SE");
110 XPAXtAddInput(XtWidgetToApplicationContext(saotng->xim->toplevel), xpa);
111 </PRE>
112 <P>
113 <LI>Change XPAInternalReceiveCommand() to XPACmdInternalReceive()
114 remove first argument in the calling sequence):
115 <PRE>
116 XPAInternalReceiveCommand(im->saotng->xim->toplevel,
117 im->saotng, im->saotng->commands,
118 "zoom reset", NULL, 0);
119 </PRE>
120 is changed to:
121 <PRE>
122 XPACmdInternalReceive(im->saotng, im->saotng->commands,
123 "zoom reset", NULL, 0);
124 </PRE>
125 <P>
126 <LI>Change DestroyXPA to XPAFree:
127 <PRE>
128 DestroyXPA(im->dataxpa);
129 </PRE>
130 is changed to:
131 <PRE>
132 XPAFree(im->dataxpa);
133 </PRE>
134 </UL>
135
136 <!-- =section xpaconvert SEE ALSO -->
137 <!-- =text See xpa(n) for a list of XPA help pages -->
138 <!-- =stop -->
139
140 <P>
141 <A HREF="./help.html">Go to XPA Help Index</A>
142
143 <H5>Last updated: September 10, 2003</H5>
144
145 </BODY>
146 </HTML>