sdksyms.sh (8483B)
1 #!/bin/sh 2 3 cat > sdksyms.c << EOF 4 /* This file is automatically generated by sdksyms.sh. */ 5 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 6 7 #ifdef HAVE_XORG_CONFIG_H 8 #include <xorg-config.h> 9 #endif 10 11 12 /* These must be included first */ 13 #include "misc.h" 14 #include "miscstruct.h" 15 16 17 /* render/Makefile.am */ 18 #include "picture.h" 19 #include "mipict.h" 20 #include "glyphstr.h" 21 #include "picturestr.h" 22 23 24 /* fb/Makefile.am */ 25 #include "fb.h" 26 #include "fbrop.h" 27 #include "fboverlay.h" 28 #include "fbpict.h" 29 /* wfb is still a module 30 #include "wfbrename.h" 31 */ 32 33 34 /* miext/shadow/Makefile.am -- module */ 35 /* 36 #include "shadow.h" 37 */ 38 39 40 /* miext/damage/Makefile.am */ 41 #include "damage.h" 42 #include "damagestr.h" 43 44 /* miext/sync/Makefile.am */ 45 #include "misync.h" 46 #include "misyncstr.h" 47 #if HAVE_XSHMFENCE 48 #include "misyncshm.h" 49 #endif 50 51 /* Xext/Makefile.am -- half is module, half is builtin */ 52 #ifdef XV 53 #include "xvdix.h" 54 #include "xvmcext.h" 55 #endif 56 #include "geext.h" 57 #ifdef MITSHM 58 #include "shmint.h" 59 #endif 60 #include "syncsdk.h" 61 #ifdef XINERAMA 62 # include "panoramiXsrv.h" 63 # include "panoramiX.h" 64 #endif 65 66 /* glx/Makefile.am */ 67 #ifdef GLX 68 #include "vndserver.h" 69 #endif 70 71 /* hw/xfree86/int10/Makefile.am -- module */ 72 /* 73 #include "xf86int10.h" 74 #include "vbe.h" 75 #include "vbeModes.h" 76 */ 77 78 79 /* hw/xfree86/i2c/Makefile.am -- "mostly" modules */ 80 #include "xf86i2c.h" 81 /* 82 #include "bt829.h" 83 #include "fi1236.h" 84 #include "msp3430.h" 85 #include "tda8425.h" 86 #include "tda9850.h" 87 #include "tda9885.h" 88 #include "uda1380.h" 89 #include "i2c_def.h" 90 */ 91 92 93 /* hw/xfree86/modes/Makefile.am */ 94 #include "xf86Crtc.h" 95 #include "xf86Modes.h" 96 #include "xf86RandR12.h" 97 /* #include "xf86Rename.h" */ 98 99 100 /* hw/xfree86/ddc/Makefile.am */ 101 #include "edid.h" 102 #include "xf86DDC.h" 103 104 105 /* hw/xfree86/dri2/Makefile.am -- module */ 106 #ifdef DRI2 107 # include "dri2.h" 108 #endif 109 110 # include "dri3.h" 111 112 /* hw/xfree86/vgahw/Makefile.am -- module */ 113 /* 114 #include "vgaHW.h" 115 */ 116 117 118 /* hw/xfree86/fbdevhw/Makefile.am -- module */ 119 /* 120 #include "fbdevhw.h" 121 */ 122 123 124 /* hw/xfree86/common/Makefile.am */ 125 #include "compiler.h" 126 #include "xf86.h" 127 #include "xf86Module.h" 128 #include "xf86Opt.h" 129 #ifdef XSERVER_LIBPCIACCESS 130 #include "xf86VGAarbiter.h" 131 #endif 132 #include "xf86Priv.h" 133 #include "xf86Privstr.h" 134 #include "xf86cmap.h" 135 #include "xf86fbman.h" 136 #include "xf86str.h" 137 #include "xf86Xinput.h" 138 #include "xisb.h" 139 #ifdef XV 140 # include "xf86xv.h" 141 # include "xf86xvmc.h" 142 # include "xf86xvpriv.h" 143 #endif 144 #include "xorgVersion.h" 145 #if defined(__sparc__) || defined(__sparc) 146 # include "xf86sbusBus.h" 147 #endif 148 149 150 /* hw/xfree86/ramdac/Makefile.am */ 151 #include "xf86Cursor.h" 152 153 154 /* hw/xfree86/shadowfb/Makefile.am -- module */ 155 /* 156 #include "shadowfb.h" 157 */ 158 159 160 /* hw/xfree86/os-support/solaris/Makefile.am */ 161 #if defined(sun386) 162 # include "agpgart.h" 163 #endif 164 165 166 /* hw/xfree86/os-support/Makefile.am */ 167 #include "xf86_OSproc.h" 168 #include "xf86_OSlib.h" 169 170 171 /* hw/xfree86/os-support/bus/Makefile.am */ 172 #ifdef XSERVER_LIBPCIACCESS 173 # include "xf86Pci.h" 174 #endif 175 #if defined(__sparc__) || defined(__sparc) 176 # include "xf86Sbus.h" 177 #endif 178 179 180 /* hw/xfree86/parser/Makefile.am */ 181 #include "xf86Parser.h" 182 #include "xf86Optrec.h" 183 184 185 /* hw/xfree86/dri/Makefile.am -- module */ 186 #ifdef XF86DRI 187 # include "dri.h" 188 # include "sarea.h" 189 # include "dristruct.h" 190 #endif 191 192 193 /* mi/Makefile.am */ 194 #include "micmap.h" 195 #include "miline.h" 196 #include "mipointer.h" 197 #include "mi.h" 198 #include "migc.h" 199 #include "mipointrst.h" 200 #include "mizerarc.h" 201 #include "micoord.h" 202 #include "mifillarc.h" 203 #include "mistruct.h" 204 #include "mioverlay.h" 205 206 207 /* randr/Makefile.am */ 208 #include "randrstr.h" 209 #include "rrtransform.h" 210 211 212 /* dbe/Makefile.am -- module */ 213 #ifdef DBE 214 #include "dbestruct.h" 215 #endif 216 217 218 /* exa/Makefile.am -- module */ 219 /* 220 #include "exa.h" 221 */ 222 223 #ifdef COMPOSITE 224 #include "compositeext.h" 225 #endif 226 227 /* xfixes/Makefile.am */ 228 #include "xfixes.h" 229 230 231 /* include/Makefile.am */ 232 #include "XIstubs.h" 233 #include "Xprintf.h" 234 #include "closestr.h" 235 #include "closure.h" 236 #include "colormap.h" 237 #include "colormapst.h" 238 #include "hotplug.h" 239 #include "client.h" 240 #include "cursor.h" 241 #include "cursorstr.h" 242 #include "dix.h" 243 #include "dixaccess.h" 244 #include "dixevents.h" 245 #define _FONTPROTO_H 246 #include "dixfont.h" 247 #include "dixfontstr.h" 248 #include "dixgrabs.h" 249 #include "dixstruct.h" 250 #include "exevents.h" 251 #include "extension.h" 252 #include "extnsionst.h" 253 #include "fourcc.h" 254 #include "gc.h" 255 #include "gcstruct.h" 256 #include "globals.h" 257 #include "input.h" 258 #include "inputstr.h" 259 /* already included */ 260 /* 261 #include "misc.h" 262 #include "miscstruct.h" 263 */ 264 #include "opaque.h" 265 #include "os.h" 266 #include "pixmap.h" 267 #include "pixmapstr.h" 268 #include "privates.h" 269 #include "property.h" 270 #include "propertyst.h" 271 #include "ptrveloc.h" 272 #include "region.h" 273 #include "regionstr.h" 274 #include "registry.h" 275 #include "resource.h" 276 #include "rgb.h" 277 #include "screenint.h" 278 #include "scrnintstr.h" 279 #include "selection.h" 280 #include "servermd.h" 281 #include "validate.h" 282 #include "window.h" 283 #include "windowstr.h" 284 #include "xace.h" 285 #include "xkbfile.h" 286 #include "xkbsrv.h" 287 #include "xkbstr.h" 288 #include "xkbrules.h" 289 #include "xserver-properties.h" 290 291 EOF 292 293 topdir=$(readlink -f $1) 294 shift 295 LC_ALL=C 296 export LC_ALL 297 ${CPP:-cpp} "$@" sdksyms.c > /dev/null || exit $? 298 ${CPP:-cpp} "$@" sdksyms.c | ${AWK:-awk} -v topdir=$topdir ' 299 function basename(file) { 300 sub(".*/", "", file) 301 return file 302 } 303 BEGIN { 304 sdk = 0; 305 print("/*"); 306 print(" * These symbols are referenced to ensure they"); 307 print(" * will be available in the X Server binary."); 308 print(" */"); 309 print("_X_HIDDEN void *xorg_symbols[] = {"); 310 311 printf("sdksyms.c:") > "sdksyms.dep"; 312 } 313 /^# [0-9]+ "/ { 314 # Match preprocessor linemarkers which have the form: 315 # # linenum "filename" flags 316 # 317 # Only process text for sdk exports where the linemarker filename has a 318 # relative path, or an absolute path matching $top_srcdir. 319 # 320 321 # canonicalize filename 322 if ($3 in canonicalized) { 323 c = canonicalized[$3] 324 } else { 325 cmd = "readlink -f " $3 326 cmd | getline c 327 close(cmd) 328 canonicalized[$3] = c 329 } 330 # note that index() starts at 1; 0 means no match. 331 sdk = $3 !~ /^"\// || index(c, topdir) == 1; 332 333 if (sdk && $3 ~ /\.h"$/) { 334 # remove quotes 335 gsub(/"/, "", $3); 336 line = $2; 337 header = basename($3); 338 if (! headers[$3]) { 339 printf(" \\\n %s", $3) >> "sdksyms.dep"; 340 headers[$3] = 1; 341 } 342 } 343 next; 344 } 345 346 /^extern[ ]/ { 347 if (sdk) { 348 n = 3; 349 350 # skip line numbers GCC 5 adds before __attribute__ 351 while ($n == "" || $0 ~ /^# [0-9]+ "/) { 352 getline; 353 n = 1; 354 } 355 356 # skip attribute, if any 357 while ($n ~ /^(__attribute__|__global)/ || 358 # skip modifiers, if any 359 $n ~ /^\*?(unsigned|const|volatile|struct|_X_EXPORT)$/ || 360 # skip pointer 361 $n ~ /^[a-zA-Z0-9_]*\*$/) { 362 n++; 363 # skip line numbers GCC 5 adds after __attribute__ 364 while ($n == "" || $0 ~ /^# [0-9]+ "/) { 365 getline; 366 n = 1; 367 } 368 } 369 # hack: pid_t becomes __pid_t on NetBSD, same for uint32_t -> __uint32_t. 370 # GCC 5 inserts additional lines around this. 371 if (($1 == "__pid_t" || $1 == "__uint32_t") && NF == 1) { 372 getline; 373 n++; 374 # skip line numbers GCC 5 adds (after typedef return type?) 375 while ($n == "" || $0 ~ /^# [0-9]+ "/) { 376 getline; 377 n = 1; 378 } 379 } 380 381 # type specifier may not be set, as in 382 # extern _X_EXPORT unsigned name(...) 383 if ($n !~ /[^a-zA-Z0-9_]/) 384 n++; 385 386 # go back if we are at the parameter list already 387 if ($n ~ /^[(]([^*].*)?$/) 388 n--; 389 390 # match 391 # extern _X_EXPORT type (* name[])(...) 392 if ($n ~ /^[^a-zA-Z0-9_]+$/) 393 n++; 394 395 # match 396 # extern _X_EXPORT const name *const ... 397 if ($n ~ /^([^a-zA-Z0-9_]+)?const$/) 398 n++; 399 400 # actual name may be in the next line, as in 401 # extern _X_EXPORT type 402 # possibly ending with a * 403 # name(...) 404 if ($n == "" || $n ~ /^\*+$/) { 405 getline; 406 n = 1; 407 # indent may have inserted a blank link 408 if ($0 == "") 409 getline; 410 } 411 412 # dont modify $0 or $n 413 symbol = $n; 414 415 # remove starting non word chars 416 sub(/^[^a-zA-Z0-9_]+/, "",symbol); 417 418 # remove from first non word to end of line 419 sub(/[^a-zA-Z0-9_].*/, "", symbol); 420 421 #print; 422 if (symbol != "") 423 printf(" (void *) &%-50s /* %s:%s */\n", symbol ",", header, line); 424 } 425 } 426 427 { 428 line++; 429 } 430 431 END { 432 print("};"); 433 434 print("") >> "sdksyms.dep"; 435 }' > _sdksyms.c 436 437 STATUS=$? 438 439 cat _sdksyms.c >> sdksyms.c 440 rm _sdksyms.c 441 442 [ $? != 0 ] && exit $? 443 444 exit $STATUS