diff src/redisplay-gtk.c @ 4881:a4322ac49e37

break out common separate-into-runs routines into redisplay-xlike-inc.c -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-01-18 Ben Wing <ben@xemacs.org> * redisplay-xlike-inc.c: * redisplay-xlike-inc.c (separate_textual_runs_nomule): * redisplay-xlike-inc.c (separate_textual_runs_xft_nomule): * redisplay-xlike-inc.c (separate_textual_runs_xft_mule): * redisplay-xlike-inc.c (separate_textual_runs_mule): Break separate_textual_runs_* functions from redisplay-x.c. (Code in redisplay-gtk.c should have been identical but was bit-rotted.) * redisplay-gtk.c: * redisplay-x.c: Delete code, replace with include statement. * depend: Regenerate.
author Ben Wing <ben@xemacs.org>
date Mon, 18 Jan 2010 06:21:05 -0600
parents 2b84dd8eb906
children eab9498ecc0e
line wrap: on
line diff
--- a/src/redisplay-gtk.c	Mon Jan 18 06:05:21 2010 -0600
+++ b/src/redisplay-gtk.c	Mon Jan 18 06:21:05 2010 -0600
@@ -87,114 +87,7 @@
 static void __describe_gc (GdkGC *);
 #endif
 
-struct textual_run
-{
-  Lisp_Object charset;
-  unsigned char *ptr;
-  int len;
-  int dimension;
-};
-
-/* Separate out the text in DYN into a series of textual runs of a
-   particular charset.  Also convert the characters as necessary into
-   the format needed by XDrawImageString(), XDrawImageString16(), et
-   al.  (This means converting to one or two byte format, possibly
-   tweaking the high bits, and possibly running a CCL program.) You
-   must pre-allocate the space used and pass it in. (This is done so
-   you can ALLOCA () the space.)  You need to allocate (2 * len) bytes
-   of TEXT_STORAGE and (len * sizeof (struct textual_run)) bytes of
-   RUN_STORAGE, where LEN is the length of the dynarr.
-
-   Returns the number of runs actually used. */
-
-static int
-separate_textual_runs (unsigned char *text_storage,
-		       struct textual_run *run_storage,
-		       CONST Ichar *str, Charcount len)
-{
-  Lisp_Object prev_charset = Qunbound; /* not Qnil because that is a
-					  possible valid charset when
-					  MULE is not defined */
-  int runs_so_far = 0;
-  int i;
-#ifdef MULE
-  struct ccl_program char_converter;
-  int need_ccl_conversion = 0;
-#endif
-
-  for (i = 0; i < len; i++)
-    {
-      Ichar ch = str[i];
-      Lisp_Object charset;
-      int byte1, byte2;
-      int dimension;
-      int graphic;
-
-      BREAKUP_ICHAR (ch, charset, byte1, byte2);
-      dimension = XCHARSET_DIMENSION (charset);
-      graphic   = XCHARSET_GRAPHIC   (charset);
-
-      if (!EQ (charset, prev_charset))
-	{
-	  run_storage[runs_so_far].ptr       = text_storage;
-	  run_storage[runs_so_far].charset   = charset;
-	  run_storage[runs_so_far].dimension = dimension;
-
-	  if (runs_so_far)
-	    {
-	      run_storage[runs_so_far - 1].len =
-		text_storage - run_storage[runs_so_far - 1].ptr;
-	      if (run_storage[runs_so_far - 1].dimension == 2)
-		run_storage[runs_so_far - 1].len >>= 1;
-	    }
-	  runs_so_far++;
-	  prev_charset = charset;
-#ifdef MULE
-	  {
-	    Lisp_Object ccl_prog = XCHARSET_CCL_PROGRAM (charset);
-	    need_ccl_conversion = !NILP (ccl_prog);
-	    if (need_ccl_conversion)
-	      setup_ccl_program (&char_converter, ccl_prog);
-	  }
-#endif
-	}
-
-      if (graphic == 0)
-	{
-	  byte1 &= 0x7F;
-	  byte2 &= 0x7F;
-	}
-      else if (graphic == 1)
-	{
-	  byte1 |= 0x80;
-	  byte2 |= 0x80;
-	}
-#ifdef MULE
-      if (need_ccl_conversion)
-	{
-	  char_converter.reg[0] = XCHARSET_ID (charset);
-	  char_converter.reg[1] = byte1;
-	  char_converter.reg[2] = byte2;
-	  ccl_driver (&char_converter, 0, 0, 0, 0, CCL_MODE_ENCODING);
-	  byte1 = char_converter.reg[1];
-	  byte2 = char_converter.reg[2];
-	}
-#endif
-      *text_storage++ = (unsigned char) byte1;
-      if (dimension == 2)
-	*text_storage++ = (unsigned char) byte2;
-    }
-
-  if (runs_so_far)
-    {
-      run_storage[runs_so_far - 1].len =
-	text_storage - run_storage[runs_so_far - 1].ptr;
-      if (run_storage[runs_so_far - 1].dimension == 2)
-	run_storage[runs_so_far - 1].len >>= 1;
-    }
-
-  return runs_so_far;
-}
+#include "redisplay-xlike-inc.c"
 
 /****************************************************************************/
 /*                                                                          */