diff src/glyphs.c @ 361:7347b34c275b r21-1-10

Import from CVS: tag r21-1-10
author cvs
date Mon, 13 Aug 2007 10:58:40 +0200
parents 03446687b7cc
children cc15677e0335
line wrap: on
line diff
--- a/src/glyphs.c	Mon Aug 13 10:57:57 2007 +0200
+++ b/src/glyphs.c	Mon Aug 13 10:58:40 2007 +0200
@@ -38,6 +38,8 @@
 #include "objects.h"
 #include "redisplay.h"
 #include "window.h"
+#include "chartab.h"
+#include "rangetab.h"
 
 #ifdef HAVE_XPM
 #include <X11/xpm.h>
@@ -3209,29 +3211,82 @@
  *                              display tables                               *
  *****************************************************************************/
 
-/* Get the display table for use currently on window W with face FACE.
-   Precedence:
-
-   -- FACE's display table
-   -- W's display table (comes from specifier `current-display-table')
-
-   Ignore the specified tables if they are not valid;
-   if no valid table is specified, return 0.  */
-
-struct Lisp_Vector *
-get_display_table (struct window *w, face_index findex)
+/* Get the display tables for use currently on window W with face
+   FACE.  #### This will have to be redone.  */
+
+void
+get_display_tables (struct window *w, face_index findex,
+		    Lisp_Object *face_table, Lisp_Object *window_table)
 {
   Lisp_Object tem;
-
   tem = WINDOW_FACE_CACHEL_DISPLAY_TABLE (w, findex);
-  if (VECTORP (tem) && XVECTOR_LENGTH (tem) == DISP_TABLE_SIZE)
-    return XVECTOR (tem);
-
+  if (UNBOUNDP (tem))
+    tem = Qnil;
+  if (!LISTP (tem))
+    tem = noseeum_cons (tem, Qnil);
+  *face_table = tem;
   tem = w->display_table;
-  if (VECTORP (tem) && XVECTOR_LENGTH (tem) == DISP_TABLE_SIZE)
-    return XVECTOR (tem);
-
-  return 0;
+  if (UNBOUNDP (tem))
+    tem = Qnil;
+  if (!LISTP (tem))
+    tem = noseeum_cons (tem, Qnil);
+  *window_table = tem;
+}
+
+Lisp_Object
+display_table_entry (Emchar ch, Lisp_Object face_table,
+		     Lisp_Object window_table)
+{
+  Lisp_Object tail;
+
+  /* Loop over FACE_TABLE, and then over WINDOW_TABLE. */
+  for (tail = face_table; 1; tail = XCDR (tail))
+    {
+      Lisp_Object table;
+      if (NILP (tail))
+	{
+	  if (!NILP (window_table))
+	    {
+	      tail = window_table;
+	      window_table = Qnil;
+	    }
+	  else
+	    return Qnil;
+	}
+      table = XCAR (tail);
+
+      if (VECTORP (table))
+	{
+	  if (ch < XVECTOR_LENGTH (table) && !NILP (XVECTOR_DATA (table)[ch]))
+	    return XVECTOR_DATA (table)[ch];
+	  else
+	    continue;
+	}
+      else if (CHAR_TABLEP (table)
+	       && XCHAR_TABLE_TYPE (table) == CHAR_TABLE_TYPE_CHAR)
+	{
+	  return get_char_table (ch, XCHAR_TABLE (table));
+	}
+      else if (CHAR_TABLEP (table)
+	       && XCHAR_TABLE_TYPE (table) == CHAR_TABLE_TYPE_GENERIC)
+	{
+	  Lisp_Object gotit = get_char_table (ch, XCHAR_TABLE (table));
+	  if (!NILP (gotit))
+	    return gotit;
+	  else
+	    continue;
+	}
+      else if (RANGE_TABLEP (table))
+	{
+	  Lisp_Object gotit = Fget_range_table (make_char (ch), table, Qnil);
+	  if (!NILP (gotit))
+	    return gotit;
+	  else
+	    continue;
+	}
+      else
+	abort ();
+    }
 }