aboutsummaryrefslogtreecommitdiffstats
path: root/src/fontset.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-06-28 11:50:27 +0400
committerDmitry Antipov2012-06-28 11:50:27 +0400
commita54e2c050b9cf161cbccc3dd4628f8ef6b64f519 (patch)
tree447eb906b698dee37a17779ea15f448079b8f54b /src/fontset.c
parent1c9bd87017e4b5f7f56e734277ff6e0a0ebb51d6 (diff)
downloademacs-a54e2c050b9cf161cbccc3dd4628f8ef6b64f519.tar.gz
emacs-a54e2c050b9cf161cbccc3dd4628f8ef6b64f519.zip
Generalize run-time debugging checks.
* configure.in (ENABLE_CHECKING): Update comment. * src/dispextern.h (XASSERTS): Remove. * src/fontset.c (xassert): Remove. Convert from xassert to eassert. * src/alloc.c: Convert from xassert to eassert. * src/bidi.c: Likewise. * src/dispnew.c: Likewise. * src/fns.c: Likewise. * src/fringe.c: Likewise. * src/ftfont.c: Likewise. * src/gtkutil.c: Likewise. * src/image.c: Likewise. * src/keyboard.c: Likewise. * src/menu.c: Likewise. * src/process.c: Likewise. * src/scroll.c: Likewise. * src/sound.c: Likewise. * src/term.c: Likewise. * src/w32console.c: Likewise. * src/w32fns.c: Likewise. * src/w32term.c: Likewise. * src/window.c: Likewise. * src/xdisp.c: Likewise. * src/xfaces.c: Likewise. * src/xfns.c: Likewise. * src/xselect.c: Likewise. * src/xterm.c: Likewise.
Diffstat (limited to 'src/fontset.c')
-rw-r--r--src/fontset.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/src/fontset.c b/src/fontset.c
index 1d704a5900e..98ee89070f9 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -24,8 +24,6 @@ GNU General Public License for more details.
24You should have received a copy of the GNU General Public License 24You should have received a copy of the GNU General Public License
25along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 25along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26 26
27/* #define FONTSET_DEBUG */
28
29#include <config.h> 27#include <config.h>
30#include <stdio.h> 28#include <stdio.h>
31#include <setjmp.h> 29#include <setjmp.h>
@@ -55,13 +53,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
55 53
56#include "font.h" 54#include "font.h"
57 55
58#undef xassert
59#ifdef FONTSET_DEBUG
60#define xassert(X) do {if (!(X)) abort ();} while (0)
61#else /* not FONTSET_DEBUG */
62#define xassert(X) (void) 0
63#endif /* not FONTSET_DEBUG */
64
65/* FONTSET 56/* FONTSET
66 57
67 A fontset is a collection of font related information to give 58 A fontset is a collection of font related information to give
@@ -206,7 +197,7 @@ static void accumulate_script_ranges (Lisp_Object, Lisp_Object,
206 Lisp_Object); 197 Lisp_Object);
207static void set_fontset_font (Lisp_Object, Lisp_Object); 198static void set_fontset_font (Lisp_Object, Lisp_Object);
208 199
209#ifdef FONTSET_DEBUG 200#ifdef ENABLE_CHECKING
210 201
211/* Return 1 if ID is a valid fontset id, else return 0. */ 202/* Return 1 if ID is a valid fontset id, else return 0. */
212 203
@@ -459,7 +450,7 @@ fontset_get_font_group (Lisp_Object fontset, int c)
459 Lisp_Object base_fontset; 450 Lisp_Object base_fontset;
460 int from = 0, to = MAX_CHAR, i; 451 int from = 0, to = MAX_CHAR, i;
461 452
462 xassert (! BASE_FONTSET_P (fontset)); 453 eassert (! BASE_FONTSET_P (fontset));
463 if (c >= 0) 454 if (c >= 0)
464 font_group = CHAR_TABLE_REF (fontset, c); 455 font_group = CHAR_TABLE_REF (fontset, c);
465 else 456 else
@@ -848,7 +839,7 @@ free_realized_fontset (FRAME_PTR f, Lisp_Object fontset)
848 if (0) 839 if (0)
849 for (tail = FONTSET_OBJLIST (fontset); CONSP (tail); tail = XCDR (tail)) 840 for (tail = FONTSET_OBJLIST (fontset); CONSP (tail); tail = XCDR (tail))
850 { 841 {
851 xassert (FONT_OBJECT_P (XCAR (tail))); 842 eassert (FONT_OBJECT_P (XCAR (tail)));
852 font_close_object (f, XCAR (tail)); 843 font_close_object (f, XCAR (tail));
853 } 844 }
854#endif 845#endif
@@ -865,8 +856,8 @@ free_face_fontset (FRAME_PTR f, struct face *face)
865 fontset = FONTSET_FROM_ID (face->fontset); 856 fontset = FONTSET_FROM_ID (face->fontset);
866 if (NILP (fontset)) 857 if (NILP (fontset))
867 return; 858 return;
868 xassert (! BASE_FONTSET_P (fontset)); 859 eassert (! BASE_FONTSET_P (fontset));
869 xassert (f == XFRAME (FONTSET_FRAME (fontset))); 860 eassert (f == XFRAME (FONTSET_FRAME (fontset)));
870 free_realized_fontset (f, fontset); 861 free_realized_fontset (f, fontset);
871 ASET (Vfontset_table, face->fontset, Qnil); 862 ASET (Vfontset_table, face->fontset, Qnil);
872 if (face->fontset < next_fontset_id) 863 if (face->fontset < next_fontset_id)
@@ -876,8 +867,8 @@ free_face_fontset (FRAME_PTR f, struct face *face)
876 int id = XINT (FONTSET_ID (FONTSET_DEFAULT (fontset))); 867 int id = XINT (FONTSET_ID (FONTSET_DEFAULT (fontset)));
877 868
878 fontset = AREF (Vfontset_table, id); 869 fontset = AREF (Vfontset_table, id);
879 xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset)); 870 eassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
880 xassert (f == XFRAME (FONTSET_FRAME (fontset))); 871 eassert (f == XFRAME (FONTSET_FRAME (fontset)));
881 free_realized_fontset (f, fontset); 872 free_realized_fontset (f, fontset);
882 ASET (Vfontset_table, id, Qnil); 873 ASET (Vfontset_table, id, Qnil);
883 if (id < next_fontset_id) 874 if (id < next_fontset_id)
@@ -924,9 +915,9 @@ face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object objec
924 if (ASCII_CHAR_P (c) || face->fontset < 0) 915 if (ASCII_CHAR_P (c) || face->fontset < 0)
925 return face->ascii_face->id; 916 return face->ascii_face->id;
926 917
927 xassert (fontset_id_valid_p (face->fontset)); 918 eassert (fontset_id_valid_p (face->fontset));
928 fontset = FONTSET_FROM_ID (face->fontset); 919 fontset = FONTSET_FROM_ID (face->fontset);
929 xassert (!BASE_FONTSET_P (fontset)); 920 eassert (!BASE_FONTSET_P (fontset));
930 921
931 if (pos < 0) 922 if (pos < 0)
932 { 923 {
@@ -973,7 +964,7 @@ face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object objec
973 FONTSET_NOFONT_FACE (fontset) = make_number (face_id); 964 FONTSET_NOFONT_FACE (fontset) = make_number (face_id);
974 } 965 }
975 } 966 }
976 xassert (face_id >= 0); 967 eassert (face_id >= 0);
977 return face_id; 968 return face_id;
978} 969}
979 970
@@ -992,9 +983,9 @@ font_for_char (struct face *face, int c, int pos, Lisp_Object object)
992 return font_object; 983 return font_object;
993 } 984 }
994 985
995 xassert (fontset_id_valid_p (face->fontset)); 986 eassert (fontset_id_valid_p (face->fontset));
996 fontset = FONTSET_FROM_ID (face->fontset); 987 fontset = FONTSET_FROM_ID (face->fontset);
997 xassert (!BASE_FONTSET_P (fontset)); 988 eassert (!BASE_FONTSET_P (fontset));
998 if (pos < 0) 989 if (pos < 0)
999 { 990 {
1000 id = -1; 991 id = -1;
@@ -2104,7 +2095,7 @@ DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0,
2104} 2095}
2105 2096
2106 2097
2107#ifdef FONTSET_DEBUG 2098#ifdef ENABLE_CHECKING
2108 2099
2109Lisp_Object dump_fontset (Lisp_Object) EXTERNALLY_VISIBLE; 2100Lisp_Object dump_fontset (Lisp_Object) EXTERNALLY_VISIBLE;
2110 2101
@@ -2154,7 +2145,7 @@ DEFUN ("fontset-list-all", Ffontset_list_all, Sfontset_list_all, 0, 0, 0,
2154 val = Fcons (dump_fontset (AREF (Vfontset_table, i)), val); 2145 val = Fcons (dump_fontset (AREF (Vfontset_table, i)), val);
2155 return (Fnreverse (val)); 2146 return (Fnreverse (val));
2156} 2147}
2157#endif /* FONTSET_DEBUG */ 2148#endif /* ENABLE_CHECKING */
2158 2149
2159void 2150void
2160syms_of_fontset (void) 2151syms_of_fontset (void)
@@ -2245,7 +2236,7 @@ at the vertical center of lines. */);
2245 defsubr (&Sfontset_info); 2236 defsubr (&Sfontset_info);
2246 defsubr (&Sfontset_font); 2237 defsubr (&Sfontset_font);
2247 defsubr (&Sfontset_list); 2238 defsubr (&Sfontset_list);
2248#ifdef FONTSET_DEBUG 2239#ifdef ENABLE_CHECKING
2249 defsubr (&Sfontset_list_all); 2240 defsubr (&Sfontset_list_all);
2250#endif 2241#endif
2251} 2242}