stubs.h revision 0145ab54
123a0898aSmrg#include <stdio.h>
223a0898aSmrg#include <X11/fonts/fntfilst.h>
323a0898aSmrg#include <X11/fonts/font.h>
423a0898aSmrg
523a0898aSmrg#ifndef True
623a0898aSmrg#define True (-1)
723a0898aSmrg#endif
823a0898aSmrg#ifndef False
923a0898aSmrg#define False (0)
1023a0898aSmrg#endif
1123a0898aSmrg
1223a0898aSmrg/* this probably works for Mach-O too, but probably not for PE */
1341c30155Smrg#if (defined(__APPLE__) || defined(__ELF__)) && defined(__GNUC__) && (__GNUC__ >= 3)
1423a0898aSmrg#define weak __attribute__((weak))
1523a0898aSmrg#else
1623a0898aSmrg#define weak
1741c30155Smrg#ifndef __SUNPRO_C /* Sun compilers use #pragma weak in .c files instead */
1841c30155Smrg#define NO_WEAK_SYMBOLS
1941c30155Smrg#endif
2041c30155Smrg#endif
2141c30155Smrg
220145ab54Ssnj#if defined(NO_WEAK_SYMBOLS) && defined(PIC)
230145ab54Ssnj#include <stdarg.h>
240145ab54Ssnjextern int _font_init_stubs(void);
250145ab54Ssnj#define OVERRIDE_DATA(sym) \
260145ab54Ssnj    _font_init_stubs(); \
270145ab54Ssnj    if (__ptr_##sym && __ptr_##sym != &sym) \
280145ab54Ssnj      sym = *__ptr_##sym
290145ab54Ssnj#define OVERRIDE_SYMBOL(sym,...) \
300145ab54Ssnj    _font_init_stubs(); \
310145ab54Ssnj    if (__##sym && __##sym != sym) \
320145ab54Ssnj      return (*__##sym)(__VA_ARGS__)
330145ab54Ssnj#define OVERRIDE_VA_SYMBOL(sym,f) \
340145ab54Ssnj    va_list _args; \
350145ab54Ssnj    _font_init_stubs(); \
360145ab54Ssnj    va_start(_args, f); \
370145ab54Ssnj    if (__##sym) \
380145ab54Ssnj      (*__##sym)(f, _args); \
390145ab54Ssnj    va_end(_args)
400145ab54Ssnj
410145ab54Ssnjint (*__client_auth_generation)(ClientPtr);
420145ab54SsnjBool (*__ClientSignal)(ClientPtr);
430145ab54Ssnjvoid (*__DeleteFontClientID)(Font);
440145ab54Ssnjvoid (*__VErrorF)(const char *, va_list);
450145ab54SsnjFontPtr (*__find_old_font)(FSID);
460145ab54SsnjFontResolutionPtr (*__GetClientResolutions)(int *);
470145ab54Ssnjint (*__GetDefaultPointSize)(void);
480145ab54SsnjFont (*__GetNewFontClientID)(void);
490145ab54Ssnjunsigned long (*__GetTimeInMillis)(void);
500145ab54Ssnjint (*__init_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr);
510145ab54Ssnjint (*__RegisterFPEFunctions)(NameCheckFunc, InitFpeFunc, FreeFpeFunc,
520145ab54Ssnj     ResetFpeFunc, OpenFontFunc, CloseFontFunc, ListFontsFunc,
530145ab54Ssnj     StartLfwiFunc, NextLfwiFunc, WakeupFpeFunc, ClientDiedFunc,
540145ab54Ssnj     LoadGlyphsFunc, StartLaFunc, NextLaFunc, SetPathFunc);
550145ab54Ssnjvoid (*__remove_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr, Bool);
560145ab54Ssnjvoid **__ptr_serverClient;
570145ab54Ssnjint (*__set_font_authorizations)(char **, int *, ClientPtr);
580145ab54Ssnjint (*__StoreFontClientFont)(FontPtr, Font);
590145ab54SsnjAtom (*__MakeAtom)(const char *, unsigned, int);
600145ab54Ssnjint (*__ValidAtom)(Atom);
610145ab54Ssnjchar *(*__NameForAtom)(Atom);
620145ab54Ssnjunsigned long *__ptr_serverGeneration;
630145ab54Ssnjvoid (*__register_fpe_functions)(void);
640145ab54Ssnj#else /* NO_WEAK_SYMBOLS && PIC */
650145ab54Ssnj#define OVERRIDE_DATA(sym)
660145ab54Ssnj#define OVERRIDE_SYMBOL(sym,...)
670145ab54Ssnj#define OVERRIDE_VA_SYMBOL(sym,f)
680145ab54Ssnj#endif
690145ab54Ssnj
7041c30155Smrg/* This is really just a hack for now... __APPLE__ really should be using
7141c30155Smrg * the weak symbols route above, but it's causing an as-yet unresolved issue,
7241c30155Smrg * so we're instead building with flat_namespace.
7341c30155Smrg */
7441c30155Smrg#ifdef __APPLE__
7541c30155Smrg#undef weak
7641c30155Smrg#define weak
7723a0898aSmrg#endif
7823a0898aSmrg
7923a0898aSmrgextern FontPtr find_old_font ( FSID id );
8041c30155Smrgextern int set_font_authorizations ( char **authorizations,
8141c30155Smrg				     int *authlen,
8223a0898aSmrg				     ClientPtr client );
8323a0898aSmrg
8423a0898aSmrgextern unsigned long GetTimeInMillis (void);
8523a0898aSmrg
8623a0898aSmrgextern void ErrorF(const char *format, ...);
8723a0898aSmrg
8823a0898aSmrg/* end of file */
89