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