globals.c revision e9fcaa8a
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#ifdef HAVE_CONFIG_H 36#include <config.h> 37#endif 38#include <X11/Xlibint.h> 39 40 41/* 42 * If possible, it is useful to have the global data default to a null value. 43 * Some shared library implementations are *much* happier if there isn't any 44 * global initialized data. 45 */ 46#ifdef NULL_NOT_ZERO /* then need to initialize */ 47#define SetZero(t,var,z) t var = z 48#else 49#define SetZero(t,var,z) t var 50#endif 51 52#ifdef USL_SHAREDLIB /* then need extra variables */ 53/* 54 * If we need to define extra variables for each global 55 */ 56#if !defined(UNIXCPP) || defined(ANSICPP) 57#define ZEROINIT(t,var,val) SetZero(t,var,val); \ 58 SetZero (long, _libX_##var##Flag, 0); \ 59 SetZero (void *, _libX_##var##Ptr, NULL) 60#else /* else pcc concatenation */ 61#define ZEROINIT(t,var,val) SetZero(t,var,val); \ 62 SetZero (long, _libX_/**/var/**/Flag, 0); \ 63 SetZero (void *, _libX_/**/var/**/Ptr, NULL) 64#endif /* concat ANSI C vs. pcc */ 65 66#else /* else not USL_SHAREDLIB */ 67/* 68 * no extra crud 69 */ 70#define ZEROINIT(t,var,val) SetZero (t, var, val) 71 72#endif /* USL_SHAREDLIB */ 73 74 75/* 76 * Error handlers; used to be in XlibInt.c 77 */ 78ZEROINIT (XErrorHandler, _XErrorFunction, NULL); 79ZEROINIT (XIOErrorHandler, _XIOErrorFunction, NULL); 80ZEROINIT (_XQEvent *, _qfree, NULL); 81 82 83/* 84 * Debugging information and display list; used to be in XOpenDis.c 85 */ 86ZEROINIT (int, _Xdebug, 0); 87ZEROINIT (Display *, _XHeadOfDisplayList, NULL); 88 89 90 91#if 0 92#ifdef STREAMSCONN 93 94 95/* The following are how the Xstream connections are used: */ 96/* 1) Local connections over pseudo-tty ports. */ 97/* 2) SVR4 local connections using named streams or SVR3.2 */ 98/* local connections using streams. */ 99/* 3) SVR4 stream pipe code. This code is proprietary and */ 100/* the actual code is not included in the XC distribution. */ 101/* 4) remote connections using tcp */ 102/* 5) remote connections using StarLan */ 103 104/* 105 * descriptor block for streams connections 106 */ 107 108#include "Xstreams.h" 109 110char _XsTypeOfStream[100] = { 0 }; 111 112extern int write(); 113extern int close(); 114#ifdef SVR4 115extern int _XsSetupSpStream(); 116extern int _XsSetupNamedStream(); 117#endif 118extern int _XsSetupLocalStream(); 119extern int _XsConnectLocalClient(); 120extern int _XsCallLocalServer(); 121extern int _XsReadLocalStream(); 122extern int _XsErrorCall(); 123extern int _XsWriteLocalStream(); 124extern int _XsCloseLocalStream(); 125extern int _XsSetupTliStream(); 126extern int _XsConnectTliClient(); 127extern int _XsCallTliServer(); 128extern int _XsReadTliStream(); 129extern int _XsWriteTliStream(); 130extern int _XsCloseTliStream(); 131 132 133Xstream _XsStream[] = { 134 135 { 136 /* local connections using pseudo-ttys */ 137 138 _XsSetupLocalStream, 139 _XsConnectLocalClient, 140 _XsCallLocalServer, 141 _XsReadLocalStream, 142 _XsErrorCall, 143 write, 144 close, 145 NULL 146 }, 147 { 148#ifdef SVR4 149 /* local connections using named streams */ 150 151 _XsSetupNamedStream, 152#else 153 /* local connections using streams */ 154 _XsSetupLocalStream, 155#endif 156 _XsConnectLocalClient, 157 _XsCallLocalServer, 158 _XsReadLocalStream, 159 _XsErrorCall, 160 write, 161 close, 162 NULL 163 }, 164 /* Enhanced Application Compatibility Support */ 165 { 166#ifdef SVR4 167 /* SVR4 stream pipe code */ 168 _XsSetupSpStream, 169#else 170 _XsSetupLocalStream, 171#endif 172 _XsConnectLocalClient, 173 _XsCallLocalServer, 174 _XsReadLocalStream, 175 _XsErrorCall, 176 write, 177 close, 178 NULL 179 }, 180 /* End Enhanced Application Compatibility Support */ 181 182 { 183 /* remote connections using tcp */ 184 _XsSetupTliStream, 185 _XsConnectTliClient, 186 _XsCallTliServer, 187 _XsReadLocalStream, 188 _XsErrorCall, 189 write, 190 close, 191 NULL 192 }, 193 { 194 /* remote connections using StarLan */ 195 _XsSetupTliStream, 196 _XsConnectTliClient, 197 _XsCallTliServer, 198 _XsReadLocalStream, 199 _XsErrorCall, 200 write, 201 close, 202 NULL 203 } 204}; 205 206 207#endif /* STREAMSCONN */ 208#endif 209 210 211#ifdef XTEST1 212/* 213 * Stuff for input synthesis extension: 214 */ 215/* 216 * Holds the two event type codes for this extension. The event type codes 217 * for this extension may vary depending on how many extensions are installed 218 * already, so the initial values given below will be added to the base event 219 * code that is aquired when this extension is installed. 220 * 221 * These two variables must be available to programs that use this extension. 222 */ 223int XTestInputActionType = 0; 224int XTestFakeAckType = 1; 225#endif 226 227/* 228 * NOTE: any additional external definition NEED 229 * to be inserted BELOW this point!!! 230 */ 231 232/* 233 * NOTE: any additional external definition NEED 234 * to be inserted ABOVE this point!!! 235 */ 236