globals.c revision 61b2299d
1/* $Xorg: globals.c,v 1.4 2001/02/09 02:03:39 xorgcvs Exp $ */
2/*
3
4Copyright 1989, 1998  The Open Group
5
6Permission to use, copy, modify, distribute, and sell this software and its
7documentation for any purpose is hereby granted without fee, provided that
8the above copyright notice appear in all copies and that both that
9copyright notice and this permission notice appear in supporting
10documentation.
11
12The above copyright notice and this permission notice shall be included
13in all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
19OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21OTHER DEALINGS IN THE SOFTWARE.
22
23Except as contained in this notice, the name of The Open Group shall
24not be used in advertising or otherwise to promote the sale, use or
25other dealings in this Software without prior written authorization
26from The Open Group.
27
28*/
29/* $XFree86: xc/lib/X11/globals.c,v 3.4 2001/07/29 05:01:11 tsi Exp $ */
30
31/*
32 *
33 *                                 Global data
34 *
35 * This file should contain only those objects which must be predefined.
36 */
37#define NEED_EVENTS
38#ifdef HAVE_CONFIG_H
39#include <config.h>
40#endif
41#include <X11/Xlibint.h>
42
43
44/*
45 * If possible, it is useful to have the global data default to a null value.
46 * Some shared library implementations are *much* happier if there isn't any
47 * global initialized data.
48 */
49#ifdef NULL_NOT_ZERO			/* then need to initialize */
50#define SetZero(t,var,z) t var = z
51#else
52#define SetZero(t,var,z) t var
53#endif
54
55#ifdef USL_SHAREDLIB			/* then need extra variables */
56/*
57 * If we need to define extra variables for each global
58 */
59#if !defined(UNIXCPP) || defined(ANSICPP)
60#define ZEROINIT(t,var,val) SetZero(t,var,val); \
61  SetZero (long, _libX_##var##Flag, 0); \
62  SetZero (void *, _libX_##var##Ptr, NULL)
63#else /* else pcc concatenation */
64#define ZEROINIT(t,var,val) SetZero(t,var,val); \
65  SetZero (long, _libX_/**/var/**/Flag, 0); \
66  SetZero (void *, _libX_/**/var/**/Ptr, NULL)
67#endif /* concat ANSI C vs. pcc */
68
69#else /* else not USL_SHAREDLIB */
70/*
71 * no extra crud
72 */
73#define ZEROINIT(t,var,val) SetZero (t, var, val)
74
75#endif /* USL_SHAREDLIB */
76
77
78/*
79 * Error handlers; used to be in XlibInt.c
80 */
81ZEROINIT (XErrorHandler, _XErrorFunction, NULL);
82ZEROINIT (XIOErrorHandler, _XIOErrorFunction, NULL);
83ZEROINIT (_XQEvent *, _qfree, NULL);
84
85
86/*
87 * Debugging information and display list; used to be in XOpenDis.c
88 */
89ZEROINIT (int, _Xdebug, 0);
90ZEROINIT (Display *, _XHeadOfDisplayList, NULL);
91
92
93
94#if 0
95#ifdef STREAMSCONN
96
97
98/* The following are how the Xstream connections are used:              */
99/*      1)      Local connections over pseudo-tty ports.                */
100/*      2)      SVR4 local connections using named streams or SVR3.2    */
101/*              local connections using streams.                        */
102/*      3)      SVR4 stream pipe code. This code is proprietary and     */
103/*              the actual code is not included in the XC distribution. */
104/*      4)      remote connections using tcp                            */
105/*      5)      remote connections using StarLan                        */
106
107/*
108 * descriptor block for streams connections
109 */
110
111#include "Xstreams.h"
112
113char _XsTypeOfStream[100] = { 0 };
114
115extern int write();
116extern int close();
117#ifdef SVR4
118extern int _XsSetupSpStream();
119extern int _XsSetupNamedStream();
120#endif
121extern int _XsSetupLocalStream();
122extern int _XsConnectLocalClient();
123extern int _XsCallLocalServer();
124extern int _XsReadLocalStream();
125extern int _XsErrorCall();
126extern int _XsWriteLocalStream();
127extern int _XsCloseLocalStream();
128extern int _XsSetupTliStream();
129extern int _XsConnectTliClient();
130extern int _XsCallTliServer();
131extern int _XsReadTliStream();
132extern int _XsWriteTliStream();
133extern int _XsCloseTliStream();
134
135
136Xstream _XsStream[] = {
137
138    {
139	/* local connections using pseudo-ttys */
140
141	_XsSetupLocalStream,
142	_XsConnectLocalClient,
143	_XsCallLocalServer,
144	_XsReadLocalStream,
145	_XsErrorCall,
146	write,
147	close,
148	NULL
149    },
150    {
151#ifdef SVR4
152	/* local connections using named streams */
153
154        _XsSetupNamedStream,
155#else
156	/* local connections using streams */
157        _XsSetupLocalStream,
158#endif
159        _XsConnectLocalClient,
160        _XsCallLocalServer,
161        _XsReadLocalStream,
162        _XsErrorCall,
163        write,
164        close,
165        NULL
166    },
167    /* Enhanced Application Compatibility Support */
168    {
169#ifdef SVR4
170	/* SVR4 stream pipe code */
171	_XsSetupSpStream,
172#else
173	_XsSetupLocalStream,
174#endif
175	_XsConnectLocalClient,
176	_XsCallLocalServer,
177	_XsReadLocalStream,
178	_XsErrorCall,
179	write,
180	close,
181	NULL
182    },
183    /* End Enhanced Application Compatibility Support */
184
185    {
186	/* remote connections using tcp */
187        _XsSetupTliStream,
188        _XsConnectTliClient,
189        _XsCallTliServer,
190        _XsReadLocalStream,
191        _XsErrorCall,
192	write,
193	close,
194	NULL
195    },
196    {
197	/* remote connections using StarLan */
198        _XsSetupTliStream,
199        _XsConnectTliClient,
200        _XsCallTliServer,
201        _XsReadLocalStream,
202        _XsErrorCall,
203        write,
204        close,
205        NULL
206    }
207};
208
209
210#endif /* STREAMSCONN */
211#endif
212
213
214#ifdef XTEST1
215/*
216 * Stuff for input synthesis extension:
217 */
218/*
219 * Holds the two event type codes for this extension.  The event type codes
220 * for this extension may vary depending on how many extensions are installed
221 * already, so the initial values given below will be added to the base event
222 * code that is aquired when this extension is installed.
223 *
224 * These two variables must be available to programs that use this extension.
225 */
226int			XTestInputActionType = 0;
227int			XTestFakeAckType   = 1;
228#endif
229
230/*
231 * NOTE: any additional external definition NEED
232 * to be inserted BELOW this point!!!
233 */
234
235/*
236 * NOTE: any additional external definition NEED
237 * to be inserted ABOVE this point!!!
238 */
239