1#!/bin/sh 2 3cat > 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 -- module */ 25/* 26#include "fb.h" 27#include "fbrop.h" 28#include "fboverlay.h" 29#include "wfbrename.h" 30#include "fbpict.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 48/* Xext/Makefile.am -- half is module, half is builtin */ 49/* 50#include "xvdix.h" 51#include "xvmcext.h" 52 */ 53#include "geext.h" 54#include "geint.h" 55#include "shmint.h" 56#include "syncsdk.h" 57#if XINERAMA 58# include "panoramiXsrv.h" 59# include "panoramiX.h" 60#endif 61 62 63/* hw/xfree86/int10/Makefile.am -- module */ 64/* 65#include "xf86int10.h" 66 */ 67 68 69/* hw/xfree86/i2c/Makefile.am -- "mostly" modules */ 70#include "xf86i2c.h" 71/* 72#include "bt829.h" 73#include "fi1236.h" 74#include "msp3430.h" 75#include "tda8425.h" 76#include "tda9850.h" 77#include "tda9885.h" 78#include "uda1380.h" 79#include "i2c_def.h" 80 */ 81 82 83/* hw/xfree86/modes/Makefile.am */ 84#include "xf86Crtc.h" 85#include "xf86Modes.h" 86#include "xf86RandR12.h" 87/* #include "xf86Rename.h" */ 88 89 90/* hw/xfree86/ddc/Makefile.am */ 91#include "edid.h" 92#include "xf86DDC.h" 93 94 95/* hw/xfree86/dri2/Makefile.am -- module */ 96/* 97#if DRI2 98# include "dri2.h" 99#endif 100 */ 101 102 103/* hw/xfree86/vgahw/Makefile.am -- module */ 104/* 105#include "vgaHW.h" 106 */ 107 108 109/* hw/xfree86/fbdevhw/Makefile.am -- module */ 110/* 111#include "fbdevhw.h" 112 */ 113 114 115/* hw/xfree86/common/Makefile.am */ 116#include "compiler.h" 117#include "fourcc.h" 118#include "xf86.h" 119#include "xf86Module.h" 120#include "xf86Opt.h" 121#include "xf86PciInfo.h" 122#include "xf86Priv.h" 123#include "xf86Privstr.h" 124#include "xf86cmap.h" 125#include "xf86fbman.h" 126#include "xf86str.h" 127#include "xf86Xinput.h" 128#include "xf86VGAarbiter.h" 129#include "xisb.h" 130#if XV 131# include "xf86xv.h" 132# include "xf86xvmc.h" 133# include "xf86xvpriv.h" 134#endif 135/* XF86VidMode code is in libextmod module */ 136/* 137#if XF86VIDMODE 138# include "vidmodeproc.h" 139#endif 140 */ 141#include "xorgVersion.h" 142#if defined(__sparc__) || defined(__sparc) 143# include "xf86sbusBus.h" 144#endif 145 146 147/* hw/xfree86/ramdac/Makefile.am */ 148#include "BT.h" 149#include "IBM.h" 150#include "TI.h" 151#include "xf86Cursor.h" 152#include "xf86RamDac.h" 153 154 155/* hw/xfree86/shadowfb/Makefile.am -- module */ 156/* 157#include "shadowfb.h" 158 */ 159 160 161/* hw/xfree86/os-support/solaris/Makefile.am */ 162#if defined(sun386) 163# include "agpgart.h" 164#endif 165 166 167/* hw/xfree86/os-support/Makefile.am */ 168#include "xf86_OSproc.h" 169#include "xf86_OSlib.h" 170 171 172/* hw/xfree86/os-support/bus/Makefile.am */ 173#include "xf86Pci.h" 174#if defined(__sparc__) || defined(__sparc) 175# include "xf86Sbus.h" 176#endif 177 178 179/* hw/xfree86/xaa/Makefile.am -- module */ 180/* 181#include "xaa.h" 182#include "xaalocal.h" 183#include "xaarop.h" 184 */ 185 186 187/* hw/xfree86/dixmods/extmod/Makefile.am -- module */ 188/* 189#include "dgaproc.h" 190 */ 191 192 193/* hw/xfree86/parser/Makefile.am */ 194#include "xf86Parser.h" 195#include "xf86Optrec.h" 196 197 198/* hw/xfree86/vbe/Makefile.am -- module */ 199/* 200#include "vbe.h" 201#include "vbeModes.h" 202 */ 203 204 205/* hw/xfree86/dri/Makefile.am -- module */ 206/* 207#if XF86DRI 208# include "dri.h" 209# include "sarea.h" 210# include "dristruct.h" 211#endif 212 */ 213 214 215/* mi/Makefile.am */ 216#include "micmap.h" 217#include "miline.h" 218#include "mipointer.h" 219#include "mi.h" 220#include "mibstore.h" 221#include "migc.h" 222#include "mipointrst.h" 223#include "mizerarc.h" 224#include "micoord.h" 225#include "mifillarc.h" 226#include "mispans.h" 227#include "miwideline.h" 228#include "mistruct.h" 229#include "mifpoly.h" 230#include "mioverlay.h" 231 232 233/* randr/Makefile.am */ 234#include "randrstr.h" 235#include "rrtransform.h" 236 237 238/* dbe/Makefile.am -- module */ 239/* 240#include "dbestruct.h" 241 */ 242 243 244/* exa/Makefile.am -- module */ 245/* 246#include "exa.h" 247 */ 248 249 250/* xfixes/Makefile.am */ 251#include "xfixes.h" 252 253 254/* include/Makefile.am */ 255#include "XIstubs.h" 256#include "Xprintf.h" 257#include "closestr.h" 258#include "closure.h" 259#include "colormap.h" 260#include "colormapst.h" 261#include "hotplug.h" 262#include "cursor.h" 263#include "cursorstr.h" 264#include "dix.h" 265#include "dixaccess.h" 266#include "dixevents.h" 267#include "dixfont.h" 268#include "dixfontstr.h" 269#include "dixgrabs.h" 270#include "dixstruct.h" 271#include "exevents.h" 272#include "extension.h" 273#include "extinit.h" 274#include "extnsionst.h" 275#include "gc.h" 276#include "gcstruct.h" 277#include "globals.h" 278#include "input.h" 279#include "inputstr.h" 280/* already included */ 281/* 282#include "misc.h" 283#include "miscstruct.h" 284 */ 285#include "opaque.h" 286#include "os.h" 287#include "pixmap.h" 288#include "pixmapstr.h" 289#include "privates.h" 290#include "property.h" 291#include "propertyst.h" 292#include "ptrveloc.h" 293#include "region.h" 294#include "regionstr.h" 295#include "registry.h" 296#include "resource.h" 297#include "rgb.h" 298#include "screenint.h" 299#include "scrnintstr.h" 300#include "selection.h" 301#include "servermd.h" 302#include "site.h" 303#include "swaprep.h" 304#include "swapreq.h" 305#include "validate.h" 306#include "window.h" 307#include "windowstr.h" 308#include "xace.h" 309#include "xkbfile.h" 310#include "xkbsrv.h" 311#include "xkbstr.h" 312#include "xkbrules.h" 313#include "xserver-properties.h" 314 315EOF 316 317topdir=$1 318shift 319LC_ALL=C 320export LC_ALL 321${CPP:-cpp} "$@" -DXorgLoader sdksyms.c | ${AWK:-awk} -v topdir=$topdir ' 322BEGIN { 323 sdk = 0; 324 print("/*"); 325 print(" * These symbols are referenced to ensure they"); 326 print(" * will be available in the X Server binary."); 327 print(" */"); 328 printf("/* topdir=%s */\n", topdir); 329 print("_X_HIDDEN void *xorg_symbols[] = {"); 330 331 printf("sdksyms.c:") > "sdksyms.dep"; 332} 333/^# [0-9]+ "/ { 334 # Process text after a include in a relative path or when the 335 # processed file has a basename matching $top_srcdir. 336 # Note that indexing starts at 1; 0 means no match, and there 337 # is a starting ". 338 sdk = $3 !~ /^"\// || index($3, topdir) == 2; 339 340 if (sdk && $3 ~ /\.h"$/) { 341 # remove quotes 342 gsub(/"/, "", $3); 343 line = $2; 344 header = $3; 345 if (! headers[$3]) { 346 printf(" \\\n %s", $3) >> "sdksyms.dep"; 347 headers[$3] = 1; 348 } 349 } 350 next; 351} 352 353/^extern[ ]/ { 354 if (sdk) { 355 n = 3; 356 357 # skip attribute, if any 358 while ($n ~ /^(__attribute__|__global)/ || 359 # skip modifiers, if any 360 $n ~ /^\*?(unsigned|const|volatile|struct)$/ || 361 # skip pointer 362 $n ~ /^[a-zA-Z0-9_]*\*$/) 363 n++; 364 365 # type specifier may not be set, as in 366 # extern _X_EXPORT unsigned name(...) 367 if ($n !~ /[^a-zA-Z0-9_]/) 368 n++; 369 370 # go back if we are at the parameter list already 371 if ($n ~ /^[(]([^*].*)?$/) 372 n--; 373 374 # match 375 # extern _X_EXPORT type (* name[])(...) 376 if ($n ~ /^[^a-zA-Z0-9_]+$/) 377 n++; 378 379 # match 380 # extern _X_EXPORT const name *const ... 381 if ($n ~ /^([^a-zA-Z0-9_]+)?const$/) 382 n++; 383 384 # actual name may be in the next line, as in 385 # extern _X_EXPORT type 386 # possibly ending with a * 387 # name(...) 388 if ($n == "" || $n ~ /^\*+$/) { 389 getline; 390 n = 1; 391 } 392 393 # dont modify $0 or $n 394 symbol = $n; 395 396 # remove starting non word chars 397 sub(/^[^a-zA-Z0-9_]+/, "",symbol); 398 399 # remove from first non word to end of line 400 sub(/[^a-zA-Z0-9_].*/, "", symbol); 401 402 #print; 403 printf(" (void *) &%-50s /* %s:%s */\n", symbol ",", header, line); 404 } 405} 406 407{ 408 line++; 409} 410 411END { 412 print("};"); 413 414 print("") >> "sdksyms.dep"; 415}' > _sdksyms.c 416 417STATUS=$? 418 419cat _sdksyms.c >> sdksyms.c 420rm _sdksyms.c 421 422[ $? != 0 ] && exit $? 423 424exit $STATUS 425