aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-08-21 16:09:01 -0700
committerPaul Eggert2012-08-21 16:09:01 -0700
commitd0d2d26fba3df1121108fcf80e4a26549d7736a3 (patch)
tree21499df347b127f7bec73ebcc6c086c0ba14f37b /src
parentc6cc78b86d48ba3d40a6bfb6d6a510554eddfde5 (diff)
downloademacs-d0d2d26fba3df1121108fcf80e4a26549d7736a3.tar.gz
emacs-d0d2d26fba3df1121108fcf80e4a26549d7736a3.zip
Make recently-introduced setters macros.
* fontset.c (set_fontset_id, set_fontset_name, set_fontset_ascii) (set_fontset_base, set_fontset_frame, set_fontset_nofont_face) (set_fontset_default, set_fontset_fallback): Rename from their upper-case counterparts, and make them functions rather than macros. This is more consistent with the other recently-introduced setters. These don't need to be inline, since they're local.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/fontset.c92
2 files changed, 68 insertions, 34 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 79406894a58..3e7b64becb1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12012-08-21 Paul Eggert <eggert@cs.ucla.edu>
2
3 Make recently-introduced setters macros.
4 * fontset.c (set_fontset_id, set_fontset_name, set_fontset_ascii)
5 (set_fontset_base, set_fontset_frame, set_fontset_nofont_face)
6 (set_fontset_default, set_fontset_fallback): Rename from their
7 upper-case counterparts, and make them functions rather than macros.
8 This is more consistent with the other recently-introduced setters.
9 These don't need to be inline, since they're local.
10
12012-08-21 Jan Djärv <jan.h.d@swipnet.se> 112012-08-21 Jan Djärv <jan.h.d@swipnet.se>
2 12
3 * nsterm.m (fd_handler:): Alloc and release a NSAutoreleasePool in 13 * nsterm.m (fd_handler:): Alloc and release a NSAutoreleasePool in
diff --git a/src/fontset.c b/src/fontset.c
index f9b6e8139ef..f5eae58a01e 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -213,45 +213,69 @@ fontset_id_valid_p (int id)
213/* Return the fontset with ID. No check of ID's validness. */ 213/* Return the fontset with ID. No check of ID's validness. */
214#define FONTSET_FROM_ID(id) AREF (Vfontset_table, id) 214#define FONTSET_FROM_ID(id) AREF (Vfontset_table, id)
215 215
216/* Macros to access special values of FONTSET. */ 216/* Access special values of FONTSET. */
217 217
218#define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0] 218#define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0]
219#define SET_FONTSET_ID(fontset, id) \ 219static void
220 set_char_table_extras ((fontset), 0, (id)) 220set_fontset_id (Lisp_Object fontset, Lisp_Object id)
221{
222 set_char_table_extras (fontset, 0, id);
223}
221 224
222/* Macros to access special values of (base) FONTSET. */ 225/* Access special values of (base) FONTSET. */
223 226
224#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1] 227#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1]
225#define SET_FONTSET_NAME(fontset, name) \ 228static void
226 set_char_table_extras ((fontset), 1, (name)) 229set_fontset_name (Lisp_Object fontset, Lisp_Object name)
230{
231 set_char_table_extras (fontset, 1, name);
232}
227 233
228#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4] 234#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4]
229#define SET_FONTSET_ASCII(fontset, ascii) \ 235static void
230 set_char_table_extras ((fontset), 4, (ascii)) 236set_fontset_ascii (Lisp_Object fontset, Lisp_Object ascii)
237{
238 set_char_table_extras (fontset, 4, ascii);
239}
231 240
232/* Macros to access special values of (realized) FONTSET. */ 241/* Access special values of (realized) FONTSET. */
233 242
234#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2] 243#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
235#define SET_FONTSET_BASE(fontset, base) \ 244static void
236 set_char_table_extras ((fontset), 2, (base)) 245set_fontset_base (Lisp_Object fontset, Lisp_Object base)
246{
247 set_char_table_extras (fontset, 2, base);
248}
237 249
238#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3] 250#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
239#define SET_FONTSET_FRAME(fontset, frame) \ 251static void
240 set_char_table_extras ((fontset), 3, (frame)) 252set_fontset_frame (Lisp_Object fontset, Lisp_Object frame)
253{
254 set_char_table_extras (fontset, 3, frame);
255}
241 256
242#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5] 257#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5]
243#define SET_FONTSET_NOFONT_FACE(fontset, face) \ 258static void
244 set_char_table_extras ((fontset), 5, (face)) 259set_fontset_nofont_face (Lisp_Object fontset, Lisp_Object face)
260{
261 set_char_table_extras (fontset, 5, face);
262}
245 263
246#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7] 264#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7]
247#define SET_FONTSET_DEFAULT(fontset, def) \ 265static void
248 set_char_table_extras ((fontset), 7, (def)) 266set_fontset_default (Lisp_Object fontset, Lisp_Object def)
267{
268 set_char_table_extras (fontset, 7, def);
269}
249 270
250/* For both base and realized fontset. */ 271/* For both base and realized fontset. */
251 272
252#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8] 273#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8]
253#define SET_FONTSET_FALLBACK(fontset, fallback) \ 274static void
254 set_char_table_extras ((fontset), 8, (fallback)) 275set_fontset_fallback (Lisp_Object fontset, Lisp_Object fallback)
276{
277 set_char_table_extras (fontset, 8, fallback);
278}
255 279
256#define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset))) 280#define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset)))
257 281
@@ -330,7 +354,7 @@ fontset_ref (Lisp_Object fontset, int c)
330#define FONTSET_ADD(fontset, range, elt, add) \ 354#define FONTSET_ADD(fontset, range, elt, add) \
331 (NILP (add) \ 355 (NILP (add) \
332 ? (NILP (range) \ 356 ? (NILP (range) \
333 ? (SET_FONTSET_FALLBACK \ 357 ? (set_fontset_fallback \
334 (fontset, Fmake_vector (make_number (1), (elt)))) \ 358 (fontset, Fmake_vector (make_number (1), (elt)))) \
335 : Fset_char_table_range ((fontset), (range), \ 359 : Fset_char_table_range ((fontset), (range), \
336 Fmake_vector (make_number (1), (elt)))) \ 360 Fmake_vector (make_number (1), (elt)))) \
@@ -362,7 +386,7 @@ fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Objec
362 else 386 else
363 { 387 {
364 args[idx] = FONTSET_FALLBACK (fontset); 388 args[idx] = FONTSET_FALLBACK (fontset);
365 SET_FONTSET_FALLBACK 389 set_fontset_fallback
366 (fontset, NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args)); 390 (fontset, NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args));
367 } 391 }
368 return Qnil; 392 return Qnil;
@@ -506,7 +530,7 @@ fontset_get_font_group (Lisp_Object fontset, int c)
506 if (c >= 0) 530 if (c >= 0)
507 char_table_set_range (fontset, from, to, font_group); 531 char_table_set_range (fontset, from, to, font_group);
508 else 532 else
509 SET_FONTSET_FALLBACK (fontset, font_group); 533 set_fontset_fallback (fontset, font_group);
510 return font_group; 534 return font_group;
511} 535}
512 536
@@ -741,7 +765,7 @@ fontset_font (Lisp_Object fontset, int c, struct face *face, int id)
741 if (! EQ (base_fontset, Vdefault_fontset)) 765 if (! EQ (base_fontset, Vdefault_fontset))
742 { 766 {
743 if (NILP (FONTSET_DEFAULT (fontset))) 767 if (NILP (FONTSET_DEFAULT (fontset)))
744 SET_FONTSET_DEFAULT 768 set_fontset_default
745 (fontset, 769 (fontset,
746 make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset)); 770 make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset));
747 FONT_DEFERRED_LOG ("default fontset: font for", make_number (c), Qnil); 771 FONT_DEFERRED_LOG ("default fontset: font for", make_number (c), Qnil);
@@ -803,14 +827,14 @@ make_fontset (Lisp_Object frame, Lisp_Object name, Lisp_Object base)
803 827
804 fontset = Fmake_char_table (Qfontset, Qnil); 828 fontset = Fmake_char_table (Qfontset, Qnil);
805 829
806 SET_FONTSET_ID (fontset, make_number (id)); 830 set_fontset_id (fontset, make_number (id));
807 if (NILP (base)) 831 if (NILP (base))
808 SET_FONTSET_NAME (fontset, name); 832 set_fontset_name (fontset, name);
809 else 833 else
810 { 834 {
811 SET_FONTSET_NAME (fontset, Qnil); 835 set_fontset_name (fontset, Qnil);
812 SET_FONTSET_FRAME (fontset, frame); 836 set_fontset_frame (fontset, frame);
813 SET_FONTSET_BASE (fontset, base); 837 set_fontset_base (fontset, base);
814 } 838 }
815 839
816 ASET (Vfontset_table, id, fontset); 840 ASET (Vfontset_table, id, fontset);
@@ -978,7 +1002,7 @@ face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object objec
978 else 1002 else
979 { 1003 {
980 face_id = face_for_font (f, Qnil, face); 1004 face_id = face_for_font (f, Qnil, face);
981 SET_FONTSET_NOFONT_FACE (fontset, make_number (face_id)); 1005 set_fontset_nofont_face (fontset, make_number (face_id));
982 } 1006 }
983 } 1007 }
984 eassert (face_id >= 0); 1008 eassert (face_id >= 0);
@@ -1600,7 +1624,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
1600 Lisp_Object tail, fr, alist; 1624 Lisp_Object tail, fr, alist;
1601 int fontset_id = XINT (FONTSET_ID (fontset)); 1625 int fontset_id = XINT (FONTSET_ID (fontset));
1602 1626
1603 SET_FONTSET_ASCII (fontset, fontname); 1627 set_fontset_ascii (fontset, fontname);
1604 name = FONTSET_NAME (fontset); 1628 name = FONTSET_NAME (fontset);
1605 FOR_EACH_FRAME (tail, fr) 1629 FOR_EACH_FRAME (tail, fr)
1606 { 1630 {
@@ -1678,7 +1702,7 @@ FONT-SPEC is a vector, a cons, or a string. See the documentation of
1678 len = font_unparse_xlfd (font_spec, 0, xlfd, 256); 1702 len = font_unparse_xlfd (font_spec, 0, xlfd, 256);
1679 if (len < 0) 1703 if (len < 0)
1680 error ("Invalid fontset name (perhaps too long): %s", SDATA (name)); 1704 error ("Invalid fontset name (perhaps too long): %s", SDATA (name));
1681 SET_FONTSET_ASCII (fontset, make_unibyte_string (xlfd, len)); 1705 set_fontset_ascii (fontset, make_unibyte_string (xlfd, len));
1682 } 1706 }
1683 else 1707 else
1684 { 1708 {
@@ -1764,7 +1788,7 @@ fontset_from_font (Lisp_Object font_object)
1764 Fset_fontset_font (name, Qnil, font_spec, Qnil, Qnil); 1788 Fset_fontset_font (name, Qnil, font_spec, Qnil, Qnil);
1765 } 1789 }
1766 1790
1767 SET_FONTSET_ASCII (fontset, font_name); 1791 set_fontset_ascii (fontset, font_name);
1768 1792
1769 return XINT (FONTSET_ID (fontset)); 1793 return XINT (FONTSET_ID (fontset));
1770} 1794}
@@ -2181,8 +2205,8 @@ syms_of_fontset (void)
2181 2205
2182 Vdefault_fontset = Fmake_char_table (Qfontset, Qnil); 2206 Vdefault_fontset = Fmake_char_table (Qfontset, Qnil);
2183 staticpro (&Vdefault_fontset); 2207 staticpro (&Vdefault_fontset);
2184 SET_FONTSET_ID (Vdefault_fontset, make_number (0)); 2208 set_fontset_id (Vdefault_fontset, make_number (0));
2185 SET_FONTSET_NAME 2209 set_fontset_name
2186 (Vdefault_fontset, 2210 (Vdefault_fontset,
2187 build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default")); 2211 build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"));
2188 ASET (Vfontset_table, 0, Vdefault_fontset); 2212 ASET (Vfontset_table, 0, Vdefault_fontset);