135c4bbdfSmrg#!/bin/sh 235c4bbdfSmrg 335c4bbdfSmrgcat > sdksyms.c << EOF 435c4bbdfSmrg/* This file is automatically generated by sdksyms.sh. */ 535c4bbdfSmrg#pragma GCC diagnostic ignored "-Wdeprecated-declarations" 635c4bbdfSmrg 735c4bbdfSmrg#ifdef HAVE_XORG_CONFIG_H 835c4bbdfSmrg#include <xorg-config.h> 935c4bbdfSmrg#endif 1035c4bbdfSmrg 1135c4bbdfSmrg 1235c4bbdfSmrg/* These must be included first */ 1335c4bbdfSmrg#include "misc.h" 1435c4bbdfSmrg#include "miscstruct.h" 1535c4bbdfSmrg 1635c4bbdfSmrg 1735c4bbdfSmrg/* render/Makefile.am */ 1835c4bbdfSmrg#include "picture.h" 1935c4bbdfSmrg#include "mipict.h" 2035c4bbdfSmrg#include "glyphstr.h" 2135c4bbdfSmrg#include "picturestr.h" 2235c4bbdfSmrg 2335c4bbdfSmrg 24ed6184dfSmrg/* fb/Makefile.am */ 2535c4bbdfSmrg#include "fb.h" 2635c4bbdfSmrg#include "fbrop.h" 2735c4bbdfSmrg#include "fboverlay.h" 2835c4bbdfSmrg#include "fbpict.h" 29ed6184dfSmrg/* wfb is still a module 30ed6184dfSmrg#include "wfbrename.h" 3135c4bbdfSmrg */ 3235c4bbdfSmrg 3335c4bbdfSmrg 3435c4bbdfSmrg/* miext/shadow/Makefile.am -- module */ 3535c4bbdfSmrg/* 3635c4bbdfSmrg#include "shadow.h" 3735c4bbdfSmrg */ 3835c4bbdfSmrg 3935c4bbdfSmrg 4035c4bbdfSmrg/* miext/damage/Makefile.am */ 4135c4bbdfSmrg#include "damage.h" 4235c4bbdfSmrg#include "damagestr.h" 4335c4bbdfSmrg 4435c4bbdfSmrg/* miext/sync/Makefile.am */ 4535c4bbdfSmrg#include "misync.h" 4635c4bbdfSmrg#include "misyncstr.h" 4735c4bbdfSmrg#if HAVE_XSHMFENCE 4835c4bbdfSmrg#include "misyncshm.h" 4935c4bbdfSmrg#endif 5035c4bbdfSmrg 5135c4bbdfSmrg/* Xext/Makefile.am -- half is module, half is builtin */ 5235c4bbdfSmrg#ifdef XV 5335c4bbdfSmrg#include "xvdix.h" 5435c4bbdfSmrg#include "xvmcext.h" 5535c4bbdfSmrg#endif 5635c4bbdfSmrg#include "geext.h" 5735c4bbdfSmrg#ifdef MITSHM 5835c4bbdfSmrg#include "shmint.h" 5935c4bbdfSmrg#endif 6035c4bbdfSmrg#include "syncsdk.h" 611b5d61b8Smrg#ifdef XINERAMA 6235c4bbdfSmrg# include "panoramiXsrv.h" 6335c4bbdfSmrg# include "panoramiX.h" 6435c4bbdfSmrg#endif 6535c4bbdfSmrg 661b5d61b8Smrg/* glx/Makefile.am */ 671b5d61b8Smrg#ifdef GLX 681b5d61b8Smrg#include "vndserver.h" 691b5d61b8Smrg#endif 7035c4bbdfSmrg 7135c4bbdfSmrg/* hw/xfree86/int10/Makefile.am -- module */ 7235c4bbdfSmrg/* 7335c4bbdfSmrg#include "xf86int10.h" 74ed6184dfSmrg#include "vbe.h" 75ed6184dfSmrg#include "vbeModes.h" 7635c4bbdfSmrg */ 7735c4bbdfSmrg 7835c4bbdfSmrg 7935c4bbdfSmrg/* hw/xfree86/i2c/Makefile.am -- "mostly" modules */ 8035c4bbdfSmrg#include "xf86i2c.h" 8135c4bbdfSmrg/* 8235c4bbdfSmrg#include "bt829.h" 8335c4bbdfSmrg#include "fi1236.h" 8435c4bbdfSmrg#include "msp3430.h" 8535c4bbdfSmrg#include "tda8425.h" 8635c4bbdfSmrg#include "tda9850.h" 8735c4bbdfSmrg#include "tda9885.h" 8835c4bbdfSmrg#include "uda1380.h" 8935c4bbdfSmrg#include "i2c_def.h" 9035c4bbdfSmrg */ 9135c4bbdfSmrg 9235c4bbdfSmrg 9335c4bbdfSmrg/* hw/xfree86/modes/Makefile.am */ 9435c4bbdfSmrg#include "xf86Crtc.h" 9535c4bbdfSmrg#include "xf86Modes.h" 9635c4bbdfSmrg#include "xf86RandR12.h" 9735c4bbdfSmrg/* #include "xf86Rename.h" */ 9835c4bbdfSmrg 9935c4bbdfSmrg 10035c4bbdfSmrg/* hw/xfree86/ddc/Makefile.am */ 10135c4bbdfSmrg#include "edid.h" 10235c4bbdfSmrg#include "xf86DDC.h" 10335c4bbdfSmrg 10435c4bbdfSmrg 10535c4bbdfSmrg/* hw/xfree86/dri2/Makefile.am -- module */ 1061b5d61b8Smrg#ifdef DRI2 10735c4bbdfSmrg# include "dri2.h" 10835c4bbdfSmrg#endif 10935c4bbdfSmrg 11035c4bbdfSmrg# include "dri3.h" 11135c4bbdfSmrg 11235c4bbdfSmrg/* hw/xfree86/vgahw/Makefile.am -- module */ 11335c4bbdfSmrg/* 11435c4bbdfSmrg#include "vgaHW.h" 11535c4bbdfSmrg */ 11635c4bbdfSmrg 11735c4bbdfSmrg 11835c4bbdfSmrg/* hw/xfree86/fbdevhw/Makefile.am -- module */ 11935c4bbdfSmrg/* 12035c4bbdfSmrg#include "fbdevhw.h" 12135c4bbdfSmrg */ 12235c4bbdfSmrg 12335c4bbdfSmrg 12435c4bbdfSmrg/* hw/xfree86/common/Makefile.am */ 12535c4bbdfSmrg#include "compiler.h" 12635c4bbdfSmrg#include "xf86.h" 12735c4bbdfSmrg#include "xf86Module.h" 12835c4bbdfSmrg#include "xf86Opt.h" 12935c4bbdfSmrg#ifdef XSERVER_LIBPCIACCESS 13035c4bbdfSmrg #include "xf86VGAarbiter.h" 13135c4bbdfSmrg#endif 13235c4bbdfSmrg#include "xf86Priv.h" 13335c4bbdfSmrg#include "xf86Privstr.h" 13435c4bbdfSmrg#include "xf86cmap.h" 13535c4bbdfSmrg#include "xf86fbman.h" 13635c4bbdfSmrg#include "xf86str.h" 13735c4bbdfSmrg#include "xf86Xinput.h" 13835c4bbdfSmrg#include "xisb.h" 1391b5d61b8Smrg#ifdef XV 14035c4bbdfSmrg# include "xf86xv.h" 14135c4bbdfSmrg# include "xf86xvmc.h" 14235c4bbdfSmrg# include "xf86xvpriv.h" 14335c4bbdfSmrg#endif 14435c4bbdfSmrg#include "xorgVersion.h" 14535c4bbdfSmrg#if defined(__sparc__) || defined(__sparc) 14635c4bbdfSmrg# include "xf86sbusBus.h" 14735c4bbdfSmrg#endif 14835c4bbdfSmrg 14935c4bbdfSmrg 15035c4bbdfSmrg/* hw/xfree86/ramdac/Makefile.am */ 15135c4bbdfSmrg#include "xf86Cursor.h" 15235c4bbdfSmrg 15335c4bbdfSmrg 15435c4bbdfSmrg/* hw/xfree86/shadowfb/Makefile.am -- module */ 15535c4bbdfSmrg/* 15635c4bbdfSmrg#include "shadowfb.h" 15735c4bbdfSmrg */ 15835c4bbdfSmrg 15935c4bbdfSmrg 16035c4bbdfSmrg/* hw/xfree86/os-support/solaris/Makefile.am */ 16135c4bbdfSmrg#if defined(sun386) 16235c4bbdfSmrg# include "agpgart.h" 16335c4bbdfSmrg#endif 16435c4bbdfSmrg 16535c4bbdfSmrg 16635c4bbdfSmrg/* hw/xfree86/os-support/Makefile.am */ 16735c4bbdfSmrg#include "xf86_OSproc.h" 16835c4bbdfSmrg#include "xf86_OSlib.h" 16935c4bbdfSmrg 17035c4bbdfSmrg 17135c4bbdfSmrg/* hw/xfree86/os-support/bus/Makefile.am */ 17235c4bbdfSmrg#ifdef XSERVER_LIBPCIACCESS 17335c4bbdfSmrg# include "xf86Pci.h" 17435c4bbdfSmrg#endif 17535c4bbdfSmrg#if defined(__sparc__) || defined(__sparc) 17635c4bbdfSmrg# include "xf86Sbus.h" 17735c4bbdfSmrg#endif 17835c4bbdfSmrg 17935c4bbdfSmrg 18035c4bbdfSmrg/* hw/xfree86/parser/Makefile.am */ 18135c4bbdfSmrg#include "xf86Parser.h" 18235c4bbdfSmrg#include "xf86Optrec.h" 18335c4bbdfSmrg 18435c4bbdfSmrg 18535c4bbdfSmrg/* hw/xfree86/dri/Makefile.am -- module */ 1861b5d61b8Smrg#ifdef XF86DRI 18735c4bbdfSmrg# include "dri.h" 18835c4bbdfSmrg# include "sarea.h" 18935c4bbdfSmrg# include "dristruct.h" 19035c4bbdfSmrg#endif 19135c4bbdfSmrg 19235c4bbdfSmrg 19335c4bbdfSmrg/* mi/Makefile.am */ 19435c4bbdfSmrg#include "micmap.h" 19535c4bbdfSmrg#include "miline.h" 19635c4bbdfSmrg#include "mipointer.h" 19735c4bbdfSmrg#include "mi.h" 19835c4bbdfSmrg#include "migc.h" 19935c4bbdfSmrg#include "mipointrst.h" 20035c4bbdfSmrg#include "mizerarc.h" 20135c4bbdfSmrg#include "micoord.h" 20235c4bbdfSmrg#include "mifillarc.h" 20335c4bbdfSmrg#include "mistruct.h" 20435c4bbdfSmrg#include "mioverlay.h" 20535c4bbdfSmrg 20635c4bbdfSmrg 20735c4bbdfSmrg/* randr/Makefile.am */ 20835c4bbdfSmrg#include "randrstr.h" 20935c4bbdfSmrg#include "rrtransform.h" 21035c4bbdfSmrg 21135c4bbdfSmrg 21235c4bbdfSmrg/* dbe/Makefile.am -- module */ 21335c4bbdfSmrg#ifdef DBE 21435c4bbdfSmrg#include "dbestruct.h" 21535c4bbdfSmrg#endif 21635c4bbdfSmrg 21735c4bbdfSmrg 21835c4bbdfSmrg/* exa/Makefile.am -- module */ 21935c4bbdfSmrg/* 22035c4bbdfSmrg#include "exa.h" 22135c4bbdfSmrg */ 22235c4bbdfSmrg 22335c4bbdfSmrg#ifdef COMPOSITE 22435c4bbdfSmrg#include "compositeext.h" 22535c4bbdfSmrg#endif 22635c4bbdfSmrg 22735c4bbdfSmrg/* xfixes/Makefile.am */ 22835c4bbdfSmrg#include "xfixes.h" 22935c4bbdfSmrg 23035c4bbdfSmrg 23135c4bbdfSmrg/* include/Makefile.am */ 23235c4bbdfSmrg#include "XIstubs.h" 23335c4bbdfSmrg#include "Xprintf.h" 23435c4bbdfSmrg#include "closestr.h" 23535c4bbdfSmrg#include "closure.h" 23635c4bbdfSmrg#include "colormap.h" 23735c4bbdfSmrg#include "colormapst.h" 23835c4bbdfSmrg#include "hotplug.h" 23935c4bbdfSmrg#include "client.h" 24035c4bbdfSmrg#include "cursor.h" 24135c4bbdfSmrg#include "cursorstr.h" 24235c4bbdfSmrg#include "dix.h" 24335c4bbdfSmrg#include "dixaccess.h" 24435c4bbdfSmrg#include "dixevents.h" 24535c4bbdfSmrg#define _FONTPROTO_H 24635c4bbdfSmrg#include "dixfont.h" 24735c4bbdfSmrg#include "dixfontstr.h" 24835c4bbdfSmrg#include "dixgrabs.h" 24935c4bbdfSmrg#include "dixstruct.h" 25035c4bbdfSmrg#include "exevents.h" 25135c4bbdfSmrg#include "extension.h" 25235c4bbdfSmrg#include "extnsionst.h" 253ed6184dfSmrg#include "fourcc.h" 25435c4bbdfSmrg#include "gc.h" 25535c4bbdfSmrg#include "gcstruct.h" 25635c4bbdfSmrg#include "globals.h" 25735c4bbdfSmrg#include "input.h" 25835c4bbdfSmrg#include "inputstr.h" 25935c4bbdfSmrg/* already included */ 26035c4bbdfSmrg/* 26135c4bbdfSmrg#include "misc.h" 26235c4bbdfSmrg#include "miscstruct.h" 26335c4bbdfSmrg */ 26435c4bbdfSmrg#include "opaque.h" 26535c4bbdfSmrg#include "os.h" 26635c4bbdfSmrg#include "pixmap.h" 26735c4bbdfSmrg#include "pixmapstr.h" 26835c4bbdfSmrg#include "privates.h" 26935c4bbdfSmrg#include "property.h" 27035c4bbdfSmrg#include "propertyst.h" 27135c4bbdfSmrg#include "ptrveloc.h" 27235c4bbdfSmrg#include "region.h" 27335c4bbdfSmrg#include "regionstr.h" 27435c4bbdfSmrg#include "registry.h" 27535c4bbdfSmrg#include "resource.h" 27635c4bbdfSmrg#include "rgb.h" 27735c4bbdfSmrg#include "screenint.h" 27835c4bbdfSmrg#include "scrnintstr.h" 27935c4bbdfSmrg#include "selection.h" 28035c4bbdfSmrg#include "servermd.h" 28135c4bbdfSmrg#include "validate.h" 28235c4bbdfSmrg#include "window.h" 28335c4bbdfSmrg#include "windowstr.h" 28435c4bbdfSmrg#include "xace.h" 28535c4bbdfSmrg#include "xkbfile.h" 28635c4bbdfSmrg#include "xkbsrv.h" 28735c4bbdfSmrg#include "xkbstr.h" 28835c4bbdfSmrg#include "xkbrules.h" 28935c4bbdfSmrg#include "xserver-properties.h" 29035c4bbdfSmrg 29135c4bbdfSmrgEOF 29235c4bbdfSmrg 2931b5d61b8Smrgtopdir=$(readlink -f $1) 29435c4bbdfSmrgshift 29535c4bbdfSmrgLC_ALL=C 29635c4bbdfSmrgexport LC_ALL 29735c4bbdfSmrg${CPP:-cpp} "$@" sdksyms.c > /dev/null || exit $? 29835c4bbdfSmrg${CPP:-cpp} "$@" sdksyms.c | ${AWK:-awk} -v topdir=$topdir ' 299ed6184dfSmrgfunction basename(file) { 300ed6184dfSmrg sub(".*/", "", file) 301ed6184dfSmrg return file 302ed6184dfSmrg} 30335c4bbdfSmrgBEGIN { 30435c4bbdfSmrg sdk = 0; 30535c4bbdfSmrg print("/*"); 30635c4bbdfSmrg print(" * These symbols are referenced to ensure they"); 30735c4bbdfSmrg print(" * will be available in the X Server binary."); 30835c4bbdfSmrg print(" */"); 30935c4bbdfSmrg print("_X_HIDDEN void *xorg_symbols[] = {"); 31035c4bbdfSmrg 31135c4bbdfSmrg printf("sdksyms.c:") > "sdksyms.dep"; 31235c4bbdfSmrg} 31335c4bbdfSmrg/^# [0-9]+ "/ { 3141b5d61b8Smrg # Match preprocessor linemarkers which have the form: 3151b5d61b8Smrg # # linenum "filename" flags 3161b5d61b8Smrg # 3171b5d61b8Smrg # Only process text for sdk exports where the linemarker filename has a 3181b5d61b8Smrg # relative path, or an absolute path matching $top_srcdir. 3191b5d61b8Smrg # 3201b5d61b8Smrg 3211b5d61b8Smrg # canonicalize filename 3221b5d61b8Smrg if ($3 in canonicalized) { 3231b5d61b8Smrg c = canonicalized[$3] 3241b5d61b8Smrg } else { 3251b5d61b8Smrg cmd = "readlink -f " $3 3261b5d61b8Smrg cmd | getline c 3271b5d61b8Smrg close(cmd) 3281b5d61b8Smrg canonicalized[$3] = c 3291b5d61b8Smrg } 3301b5d61b8Smrg # note that index() starts at 1; 0 means no match. 3311b5d61b8Smrg sdk = $3 !~ /^"\// || index(c, topdir) == 1; 33235c4bbdfSmrg 33335c4bbdfSmrg if (sdk && $3 ~ /\.h"$/) { 33435c4bbdfSmrg # remove quotes 33535c4bbdfSmrg gsub(/"/, "", $3); 33635c4bbdfSmrg line = $2; 337ed6184dfSmrg header = basename($3); 33835c4bbdfSmrg if (! headers[$3]) { 33935c4bbdfSmrg printf(" \\\n %s", $3) >> "sdksyms.dep"; 34035c4bbdfSmrg headers[$3] = 1; 34135c4bbdfSmrg } 34235c4bbdfSmrg } 34335c4bbdfSmrg next; 34435c4bbdfSmrg} 34535c4bbdfSmrg 34635c4bbdfSmrg/^extern[ ]/ { 34735c4bbdfSmrg if (sdk) { 34835c4bbdfSmrg n = 3; 34935c4bbdfSmrg 35035c4bbdfSmrg # skip line numbers GCC 5 adds before __attribute__ 35135c4bbdfSmrg while ($n == "" || $0 ~ /^# [0-9]+ "/) { 35235c4bbdfSmrg getline; 35335c4bbdfSmrg n = 1; 35435c4bbdfSmrg } 35535c4bbdfSmrg 35635c4bbdfSmrg # skip attribute, if any 35735c4bbdfSmrg while ($n ~ /^(__attribute__|__global)/ || 35835c4bbdfSmrg # skip modifiers, if any 35935c4bbdfSmrg $n ~ /^\*?(unsigned|const|volatile|struct|_X_EXPORT)$/ || 36035c4bbdfSmrg # skip pointer 36135c4bbdfSmrg $n ~ /^[a-zA-Z0-9_]*\*$/) { 36235c4bbdfSmrg n++; 36335c4bbdfSmrg # skip line numbers GCC 5 adds after __attribute__ 36435c4bbdfSmrg while ($n == "" || $0 ~ /^# [0-9]+ "/) { 36535c4bbdfSmrg getline; 36635c4bbdfSmrg n = 1; 36735c4bbdfSmrg } 36835c4bbdfSmrg } 3691b5d61b8Smrg # hack: pid_t becomes __pid_t on NetBSD, same for uint32_t -> __uint32_t. 3701b5d61b8Smrg # GCC 5 inserts additional lines around this. 3711b5d61b8Smrg if (($1 == "__pid_t" || $1 == "__uint32_t") && NF == 1) { 3721b5d61b8Smrg getline; 3731b5d61b8Smrg n++; 3741b5d61b8Smrg # skip line numbers GCC 5 adds (after typedef return type?) 3751b5d61b8Smrg while ($n == "" || $0 ~ /^# [0-9]+ "/) { 3761b5d61b8Smrg getline; 3771b5d61b8Smrg n = 1; 3781b5d61b8Smrg } 3791b5d61b8Smrg } 38035c4bbdfSmrg 38135c4bbdfSmrg # type specifier may not be set, as in 38235c4bbdfSmrg # extern _X_EXPORT unsigned name(...) 38335c4bbdfSmrg if ($n !~ /[^a-zA-Z0-9_]/) 38435c4bbdfSmrg n++; 38535c4bbdfSmrg 38635c4bbdfSmrg # go back if we are at the parameter list already 38735c4bbdfSmrg if ($n ~ /^[(]([^*].*)?$/) 38835c4bbdfSmrg n--; 38935c4bbdfSmrg 39035c4bbdfSmrg # match 39135c4bbdfSmrg # extern _X_EXPORT type (* name[])(...) 39235c4bbdfSmrg if ($n ~ /^[^a-zA-Z0-9_]+$/) 39335c4bbdfSmrg n++; 39435c4bbdfSmrg 39535c4bbdfSmrg # match 39635c4bbdfSmrg # extern _X_EXPORT const name *const ... 39735c4bbdfSmrg if ($n ~ /^([^a-zA-Z0-9_]+)?const$/) 39835c4bbdfSmrg n++; 39935c4bbdfSmrg 40035c4bbdfSmrg # actual name may be in the next line, as in 40135c4bbdfSmrg # extern _X_EXPORT type 40235c4bbdfSmrg # possibly ending with a * 40335c4bbdfSmrg # name(...) 40435c4bbdfSmrg if ($n == "" || $n ~ /^\*+$/) { 40535c4bbdfSmrg getline; 40635c4bbdfSmrg n = 1; 40735c4bbdfSmrg # indent may have inserted a blank link 40835c4bbdfSmrg if ($0 == "") 40935c4bbdfSmrg getline; 41035c4bbdfSmrg } 41135c4bbdfSmrg 41235c4bbdfSmrg # dont modify $0 or $n 41335c4bbdfSmrg symbol = $n; 41435c4bbdfSmrg 41535c4bbdfSmrg # remove starting non word chars 41635c4bbdfSmrg sub(/^[^a-zA-Z0-9_]+/, "",symbol); 41735c4bbdfSmrg 41835c4bbdfSmrg # remove from first non word to end of line 41935c4bbdfSmrg sub(/[^a-zA-Z0-9_].*/, "", symbol); 42035c4bbdfSmrg 42135c4bbdfSmrg #print; 4221b5d61b8Smrg if (symbol != "") 4231b5d61b8Smrg printf(" (void *) &%-50s /* %s:%s */\n", symbol ",", header, line); 42435c4bbdfSmrg } 42535c4bbdfSmrg} 42635c4bbdfSmrg 42735c4bbdfSmrg{ 42835c4bbdfSmrg line++; 42935c4bbdfSmrg} 43035c4bbdfSmrg 43135c4bbdfSmrgEND { 43235c4bbdfSmrg print("};"); 43335c4bbdfSmrg 43435c4bbdfSmrg print("") >> "sdksyms.dep"; 43535c4bbdfSmrg}' > _sdksyms.c 43635c4bbdfSmrg 43735c4bbdfSmrgSTATUS=$? 43835c4bbdfSmrg 43935c4bbdfSmrgcat _sdksyms.c >> sdksyms.c 44035c4bbdfSmrgrm _sdksyms.c 44135c4bbdfSmrg 44235c4bbdfSmrg[ $? != 0 ] && exit $? 44335c4bbdfSmrg 44435c4bbdfSmrgexit $STATUS 445