diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2015-01-16 15:15:32 +0300 |
---|---|---|
committer | Dmitry Antipov <dmantipov@yandex.ru> | 2015-01-16 15:15:32 +0300 |
commit | 4303d11029cf204cbf4ddf917ee0d37b08130570 (patch) | |
tree | 5781c5e151aed74b7757a475de32190fdb58afcf /src/font.h | |
parent | 7ee2733f1ecd3d4f2bd782aa802b090c77fbb135 (diff) | |
download | emacs-4303d11029cf204cbf4ddf917ee0d37b08130570.tar.gz |
Prefer INLINE functions in font.h to match style used in lisp.h
* font.h (FONTP, FONT_SPEC_P, FONT_ENTITY_P, FONT_OBJECT_P)
(CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY, CHECK_FONT_OBJECT)
(XFONT_SPEC, XFONT_ENTITY, XFONT_OBJECT, CHECK_FONT_GET_OBJECT):
Now functions.
* font.c (Ffont_otf_alternates, Fquery_font, Ffont_get_glyphs):
* ftfont.c (ftfont_shape):
* macfont.m (macfont_shape):
* w32uniscribe.c (uniscribe_shape):
* xftfont.c (xftfont_shape): Adjust CHECK_FONT_GET_OBJECT users.
Diffstat (limited to 'src/font.h')
-rw-r--r-- | src/font.h | 113 |
1 files changed, 79 insertions, 34 deletions
diff --git a/src/font.h b/src/font.h index 5a3e38a2a6e..efc184eef77 100644 --- a/src/font.h +++ b/src/font.h @@ -413,46 +413,91 @@ struct font_bitmap /* Predicates to check various font-related objects. */ /* True iff X is one of font-spec, font-entity, and font-object. */ -#define FONTP(x) PSEUDOVECTORP (x, PVEC_FONT) +INLINE bool +FONTP (Lisp_Object x) +{ + return PSEUDOVECTORP (x, PVEC_FONT); +} + /* True iff X is font-spec. */ -#define FONT_SPEC_P(x) \ - (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX) +INLINE bool +FONT_SPEC_P (Lisp_Object x) +{ + return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX; +} + /* True iff X is font-entity. */ -#define FONT_ENTITY_P(x) \ - (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX) +INLINE bool +FONT_ENTITY_P (Lisp_Object x) +{ + return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX; +} + /* True iff X is font-object. */ -#define FONT_OBJECT_P(x) \ - (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX) - -/* Check macros for various font-related objects. */ - -#define CHECK_FONT(x) \ - do { if (! FONTP (x)) wrong_type_argument (Qfont, x); } while (false) -#define CHECK_FONT_SPEC(x) \ - do { if (! FONT_SPEC_P (x)) wrong_type_argument (Qfont_spec, x); } \ - while (false) -#define CHECK_FONT_ENTITY(x) \ - do { if (! FONT_ENTITY_P (x)) wrong_type_argument (Qfont_entity, x); } \ - while (false) -#define CHECK_FONT_OBJECT(x) \ - do { if (! FONT_OBJECT_P (x)) wrong_type_argument (Qfont_object, x); } \ - while (false) - -#define CHECK_FONT_GET_OBJECT(x, font) \ - do { \ - CHECK_FONT_OBJECT (x); \ - font = XFONT_OBJECT (x); \ - } while (false) +INLINE bool +FONT_OBJECT_P (Lisp_Object x) +{ + return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX; +} + +/* Type checking functions for various font-related objects. */ + +INLINE void +CHECK_FONT (Lisp_Object x) +{ + CHECK_TYPE (FONTP (x), Qfont, x); +} + +INLINE void +CHECK_FONT_SPEC (Lisp_Object x) +{ + CHECK_TYPE (FONT_SPEC_P (x), Qfont_spec, x); +} + +INLINE void +CHECK_FONT_ENTITY (Lisp_Object x) +{ + CHECK_TYPE (FONT_ENTITY_P (x), Qfont_entity, x); +} + +INLINE void +CHECK_FONT_OBJECT (Lisp_Object x) +{ + CHECK_TYPE (FONT_OBJECT_P (x), Qfont_object, x); +} + +/* C pointer extraction functions for various font-related objects. */ + +INLINE struct font_spec * +XFONT_SPEC (Lisp_Object p) +{ + eassert (FONT_SPEC_P (p)); + return XUNTAG (p, Lisp_Vectorlike); +} + +INLINE struct font_entity * +XFONT_ENTITY (Lisp_Object p) +{ + eassert (FONT_ENTITY_P (p)); + return XUNTAG (p, Lisp_Vectorlike); +} + +INLINE struct font * +XFONT_OBJECT (Lisp_Object p) +{ + eassert (FONT_OBJECT_P (p)); + return XUNTAG (p, Lisp_Vectorlike); +} -#define XFONT_SPEC(p) \ - (eassert (FONT_SPEC_P (p)), (struct font_spec *) XUNTAG (p, Lisp_Vectorlike)) -#define XFONT_ENTITY(p) \ - (eassert (FONT_ENTITY_P (p)), \ - (struct font_entity *) XUNTAG (p, Lisp_Vectorlike)) -#define XFONT_OBJECT(p) \ - (eassert (FONT_OBJECT_P (p)), (struct font *) XUNTAG (p, Lisp_Vectorlike)) #define XSETFONT(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FONT)) +INLINE struct font * +CHECK_FONT_GET_OBJECT (Lisp_Object x) +{ + CHECK_FONT_OBJECT (x); + return XFONT_OBJECT (x); +} + /* Number of pt per inch (from the TeXbook). */ #define PT_PER_INCH 72.27 |