Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:25

0001 /*
0002  * fontconfig/fontconfig/fcprivate.h
0003  *
0004  * Copyright © 2001 Keith Packard
0005  *
0006  * Permission to use, copy, modify, distribute, and sell this software and its
0007  * documentation for any purpose is hereby granted without fee, provided that
0008  * the above copyright notice appear in all copies and that both that
0009  * copyright notice and this permission notice appear in supporting
0010  * documentation, and that the name of the author(s) not be used in
0011  * advertising or publicity pertaining to distribution of the software without
0012  * specific, written prior permission.  The authors make no
0013  * representations about the suitability of this software for any purpose.  It
0014  * is provided "as is" without express or implied warranty.
0015  *
0016  * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
0017  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
0018  * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
0019  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
0020  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
0021  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
0022  * PERFORMANCE OF THIS SOFTWARE.
0023  */
0024 
0025 #ifndef _FCPRIVATE_H_
0026 #define _FCPRIVATE_H_
0027 
0028 /*
0029  * I tried this with functions that took va_list* arguments
0030  * but portability concerns made me change these functions
0031  * into macros (sigh).
0032  */
0033 
0034 #define FcPatternVapBuild(result, orig, va)             \
0035 {                                   \
0036     FcPattern   *__p__ = (orig);                    \
0037     const char  *__o__;                         \
0038     FcValue __v__;                          \
0039                                     \
0040     if (!__p__)                             \
0041     {                                   \
0042     __p__ = FcPatternCreate ();                 \
0043     if (!__p__)                             \
0044         goto _FcPatternVapBuild_bail0;              \
0045     }                                       \
0046     for (;;)                                    \
0047     {                                       \
0048     __o__ = va_arg (va, const char *);              \
0049     if (!__o__)                             \
0050         break;                              \
0051     __v__.type = va_arg (va, int);                  \
0052     switch (__v__.type) {                           \
0053     case FcTypeUnknown:                     \
0054     case FcTypeVoid:                        \
0055         goto _FcPatternVapBuild_bail1;                  \
0056     case FcTypeInteger:                         \
0057         __v__.u.i = va_arg (va, int);               \
0058         break;                          \
0059     case FcTypeDouble:                      \
0060         __v__.u.d = va_arg (va, double);                \
0061         break;                          \
0062     case FcTypeString:                      \
0063         __v__.u.s = va_arg (va, const FcChar8 *);           \
0064         break;                          \
0065     case FcTypeBool:                        \
0066         __v__.u.b = va_arg (va, FcBool);                \
0067         break;                          \
0068     case FcTypeMatrix:                      \
0069         __v__.u.m = va_arg (va, const FcMatrix *);          \
0070         break;                          \
0071     case FcTypeCharSet:                     \
0072         __v__.u.c = va_arg (va, const FcCharSet *);         \
0073         break;                          \
0074     case FcTypeFTFace:                      \
0075         __v__.u.f = va_arg (va, FT_Face);               \
0076         break;                          \
0077     case FcTypeLangSet:                     \
0078         __v__.u.l = va_arg (va, const FcLangSet *);         \
0079         break;                          \
0080     case FcTypeRange:                       \
0081         __v__.u.r = va_arg (va, const FcRange *);           \
0082         break;                          \
0083     }                               \
0084     if (!FcPatternAdd (__p__, __o__, __v__, FcTrue))        \
0085         goto _FcPatternVapBuild_bail1;              \
0086     }                                   \
0087     result = __p__;                         \
0088     goto _FcPatternVapBuild_return;                 \
0089                                     \
0090 _FcPatternVapBuild_bail1:                       \
0091     if (!orig)                              \
0092     FcPatternDestroy (__p__);                   \
0093 _FcPatternVapBuild_bail0:                       \
0094     result = (void*)0;                          \
0095                                     \
0096 _FcPatternVapBuild_return:                      \
0097     ;                                   \
0098 }
0099 
0100 
0101 #define FcObjectSetVapBuild(__ret__, __first__, __va__)         \
0102 {                                   \
0103     FcObjectSet    *__os__;                     \
0104     const char      *__ob__;                        \
0105                                     \
0106     __ret__ = 0;                                \
0107     __os__ = FcObjectSetCreate ();                  \
0108     if (!__os__)                            \
0109     goto _FcObjectSetVapBuild_bail0;                \
0110     __ob__ = __first__;                         \
0111     while (__ob__)                          \
0112     {                                   \
0113     if (!FcObjectSetAdd (__os__, __ob__))               \
0114         goto _FcObjectSetVapBuild_bail1;                \
0115     __ob__ = va_arg (__va__, const char *);             \
0116     }                                   \
0117     __ret__ = __os__;                           \
0118                                     \
0119 _FcObjectSetVapBuild_bail1:                     \
0120     if (!__ret__ && __os__)                         \
0121     FcObjectSetDestroy (__os__);                    \
0122 _FcObjectSetVapBuild_bail0:                     \
0123     ;                                   \
0124 }
0125 
0126 #ifndef FC_ATTRIBUTE_VISIBILITY_HIDDEN
0127 #define FC_ATTRIBUTE_VISIBILITY_HIDDEN __attribute((visibility("hidden")))
0128 #endif
0129 
0130 #ifndef FC_ATTRIBUTE_VISIBILITY_EXPORT
0131 #define FC_ATTRIBUTE_VISIBILITY_EXPORT __attribute((visibility("default")))
0132 #endif
0133 
0134 #endif /* _FCPRIVATE_H_ */