SOURCES: groff-devutf8.patch (NEW), groff-do_char.patch (NEW), gro...

baggins baggins at pld-linux.org
Tue Nov 7 15:22:08 CET 2006


Author: baggins                      Date: Tue Nov  7 14:22:08 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- full multibyte/unicode input/output support from fedora

---- Files affected:
SOURCES:
   groff-devutf8.patch (NONE -> 1.1)  (NEW), groff-do_char.patch (NONE -> 1.1)  (NEW), groff-fix15.patch (NONE -> 1.1)  (NEW), groff-fixminus.patch (NONE -> 1.1)  (NEW), groff-multibyte.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/groff-devutf8.patch
diff -u /dev/null SOURCES/groff-devutf8.patch:1.1
--- /dev/null	Tue Nov  7 15:22:08 2006
+++ SOURCES/groff-devutf8.patch	Tue Nov  7 15:22:03 2006
@@ -0,0 +1,42 @@
+--- groff-1.18.1/font/devutf8/M.proto.devutf8	2004-03-08 16:25:52.000000000 +0100
++++ groff-1.18.1/font/devutf8/M.proto	2004-03-08 17:02:40.265336984 +0100
+@@ -1,6 +1,6 @@
+ name M
+ internalname 4
+-spacewidth 48
++spacewidth 24
+ charset
+-u2E00..u9FFF 48 0
+-uFF00..uFFEF 48 0
++u0100..u07FF 24 0
++u0800..uFFFF 48 0
+--- groff-1.18.1/font/devutf8/DESC.proto.devutf8	2004-03-08 16:25:52.000000000 +0100
++++ groff-1.18.1/font/devutf8/DESC.proto	2004-03-08 16:25:53.000000000 +0100
+@@ -3,10 +3,7 @@
+ vert 40
+ unitwidth 10
+ sizes 10 0
+-fonts 6 R I B BI M G
+-fontset B G 2E00..9FFF
+-fontset B G FF00..FFEF
+-fontset - M 2E00..9FFF
+-fontset - M FF00..FFEF
++fonts 5 R I B BI M
++fontset - M 0100..FFFF
+ tcommand
+ postpro grotty
+--- groff-1.18.1/font/devutf8/Makefile.sub.devutf8	2004-03-08 16:25:52.000000000 +0100
++++ groff-1.18.1/font/devutf8/Makefile.sub	2004-03-08 17:03:58.858389024 +0100
+@@ -25,11 +25,7 @@
+ M: M.proto
+ 	@echo Making M
+ 	@-rm -f M
+-	(wcharwidth=`expr $(RES) / $(CPI) \* 2` ; \
+-	  spacewidth=`expr $(RES) / $(CPI)` ; \
+-	  sed -e "s/^spacewidth [0-9][0-9]*$$/spacewidth $$spacewidth/" \
+-	      -e "s/^u\\([0-9A-F]*\\)..u\\([0-9A-F]*\\) [0-9][0-9]*/u\\1..u\\2 $$wcharwidth/" \
+-	  $(srcdir)/M.proto > $@)
++	@cp M.proto M
+ 
+ G: M
+ 	@echo Making G

================================================================
Index: SOURCES/groff-do_char.patch
diff -u /dev/null SOURCES/groff-do_char.patch:1.1
--- /dev/null	Tue Nov  7 15:22:08 2006
+++ SOURCES/groff-do_char.patch	Tue Nov  7 15:22:03 2006
@@ -0,0 +1,27 @@
+--- groff-1.18.1.1/src/xditview/draw.c.do_char	2004-09-15 17:42:34.221596494 +0200
++++ groff-1.18.1.1/src/xditview/draw.c	2004-09-15 17:42:35.880369335 +0200
+@@ -418,7 +418,11 @@
+ 				   dw->dvi.state->font_size, c, &wid))
+ 		return;
+ 	if (dw->dvi.native) {
++#ifdef ENABLE_MULTIBYTE
++		DoCharacter (dw, c, wid, map->char2XChar2b);
++#else
+ 		DoCharacter (dw, c, wid);
++#endif
+ 		return;
+ 	}
+ 	map = QueryFontMap (dw, dw->dvi.state->font_number);
+@@ -429,7 +433,11 @@
+ 	     name = device_name_for_code ((DeviceFont *)0, c)) {
+ 		int code = DviCharIndex (map, name);
+ 		if (code >= 0) {
+-			DoCharacter (dw, code, wid);
++#ifdef ENABLE_MULTIBYTE
++			DoCharacter (dw, code, wid, map->char2XChar2b);
++#else		
++			DoCharacter (dw, code, wid);
++#endif
+ 			break;
+ 		}
+ 		if (FakeCharacter (dw, name, wid))

================================================================
Index: SOURCES/groff-fix15.patch
diff -u /dev/null SOURCES/groff-fix15.patch:1.1
--- /dev/null	Tue Nov  7 15:22:08 2006
+++ SOURCES/groff-fix15.patch	Tue Nov  7 15:22:03 2006
@@ -0,0 +1,27 @@
+--- groff-1.18.1/src/libs/libgroff/encoding.cc.fix15	2004-03-08 16:13:15.825000416 +0100
++++ groff-1.18.1/src/libs/libgroff/encoding.cc	2004-03-08 16:14:41.451983136 +0100
+@@ -384,21 +384,10 @@
+   }
+   /* otherwise */
+ #if HAVE_LANGINFO_CODESET
+-  charset = nl_langinfo(CODESET);
+-#else
+-  charset = strchr(locale, '.');
+-  if (charset)
+-    ++charset;
+-  else
+-    charset = "";
++  locale = nl_langinfo(CODESET);
+ #endif
+-  if (strncmp(locale, "ja", 2) == 0) {
+-    select_input_encoding_handler(charset);
+-    select_output_encoding_handler(charset);
+-  } else if ((!device || strcmp(device, "ascii8") == 0)) {
+-    select_input_encoding_handler(NULL);
+-    select_output_encoding_handler(NULL);
+-  }
++  select_input_encoding_handler(locale);
++  select_output_encoding_handler(locale);
+ #endif
+   return;
+ }

================================================================
Index: SOURCES/groff-fixminus.patch
diff -u /dev/null SOURCES/groff-fixminus.patch:1.1
--- /dev/null	Tue Nov  7 15:22:08 2006
+++ SOURCES/groff-fixminus.patch	Tue Nov  7 15:22:03 2006
@@ -0,0 +1,11 @@
+--- groff-1.18.1/font/devutf8/R.proto.fixminus	2003-02-03 14:19:47.000000000 +0100
++++ groff-1.18.1/font/devutf8/R.proto	2003-02-03 14:20:06.000000000 +0100
+@@ -285,7 +285,7 @@
+ +h	24	0	0x03D1
+ +f	24	0	0x03D5
+ +p	24	0	0x03D6
+--	24	0	0x2010
++-	24	0	0x002D
+ hy	"
+ en	24	0	0x2013
+ em	24	0	0x2014

================================================================
Index: SOURCES/groff-multibyte.patch
diff -u /dev/null SOURCES/groff-multibyte.patch:1.1
--- /dev/null	Tue Nov  7 15:22:08 2006
+++ SOURCES/groff-multibyte.patch	Tue Nov  7 15:22:03 2006
@@ -0,0 +1,20101 @@
+--- groff-1.18.1.orig/src/include/config.hin
++++ groff-1.18.1/src/include/config.hin
+@@ -1,84 +1,96 @@
+-/* src/include/config.hin.  Generated automatically from configure.ac by autoheader.  */
++/* src/include/config.hin.  Generated from configure.ac by autoheader.  */
+ 
+ /* Define if your C++ doesn't understand `delete []'. */
+ #undef ARRAY_DELETE_NEEDS_SIZE
+ 
++/* Define if you want to use multibyte extension. */
++#undef ENABLE_MULTIBYTE
++
+ /* Define if you have a C++ <limits.h>. */
+ #undef HAVE_CC_LIMITS_H
+ 
+ /* Define if you have a C++ <osfcn.h>. */
+ #undef HAVE_CC_OSFCN_H
+ 
+-/* Define if you have the <dirent.h> header file. */
++/* Define to 1 if you have the <dirent.h> header file. */
+ #undef HAVE_DIRENT_H
+ 
+-/* Define if you have the `fmod' function. */
++/* Define to 1 if you have the `fmod' function. */
+ #undef HAVE_FMOD
+ 
+-/* Define if you have the `getcwd' function. */
++/* Define to 1 if you have the `getcwd' function. */
+ #undef HAVE_GETCWD
+ 
+-/* Define if you have the `getpagesize' function. */
++/* Define to 1 if you have the `getpagesize' function. */
+ #undef HAVE_GETPAGESIZE
+ 
+-/* Define if you have the `gettimeofday' function. */
++/* Define to 1 if you have the `gettimeofday' function. */
+ #undef HAVE_GETTIMEOFDAY
+ 
+-/* Define if you have the <limits.h> header file. */
++/* Define to 1 if you have the <inttypes.h> header file. */
++#undef HAVE_INTTYPES_H
++
++/* Define to 1 if you have the `isatty' function. */
++#undef HAVE_ISATTY
++
++/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
++#undef HAVE_LANGINFO_CODESET
++
++/* Define to 1 if you have the <limits.h> header file. */
+ #undef HAVE_LIMITS_H
+ 
+-/* Define if you have the <math.h> header file. */
++/* Define to 1 if you have the <math.h> header file. */
+ #undef HAVE_MATH_H
+ 
++/* Define to 1 if you have the <memory.h> header file. */
++#undef HAVE_MEMORY_H
++
+ /* Define if you have mkstemp(). */
+ #undef HAVE_MKSTEMP
+ 
+-/* Define if you have a working `mmap' system call. */
++/* Define to 1 if you have a working `mmap' system call. */
+ #undef HAVE_MMAP
+ 
+-/* Define if you have the `putenv' function. */
++/* Define to 1 if you have the `putenv' function. */
+ #undef HAVE_PUTENV
+ 
+-/* Define if you have the `rename' function. */
++/* Define to 1 if you have the `rename' function. */
+ #undef HAVE_RENAME
+ 
+-/* Define if you have the `snprintf' function. */
++/* Define to 1 if you have the `snprintf' function. */
+ #undef HAVE_SNPRINTF
+ 
+-/* Define if you have the `isatty' function. */
+-#undef HAVE_ISATTY
+-
+-/* Define if you have the <stdint.h> header file. */
++/* Define to 1 if you have the <stdint.h> header file. */
+ #undef HAVE_STDINT_H
+ 
+-/* Define if you have the <stdlib.h> header file. */
++/* Define to 1 if you have the <stdlib.h> header file. */
+ #undef HAVE_STDLIB_H
+ 
+-/* Define if you have the `strcasecmp' function. */
++/* Define to 1 if you have the `strcasecmp' function. */
+ #undef HAVE_STRCASECMP
+ 
+-/* Define if you have the `strerror' function. */
++/* Define to 1 if you have the `strerror' function. */
+ #undef HAVE_STRERROR
+ 
+-/* Define if you have the <strings.h> header file. */
++/* Define to 1 if you have the <strings.h> header file. */
+ #undef HAVE_STRINGS_H
+ 
+-/* Define if you have the <string.h> header file. */
++/* Define to 1 if you have the <string.h> header file. */
+ #undef HAVE_STRING_H
+ 
+-/* Define if you have the `strncasecmp' function. */
++/* Define to 1 if you have the `strncasecmp' function. */
+ #undef HAVE_STRNCASECMP
+ 
+-/* Define if you have the `strsep' function. */
++/* Define to 1 if you have the `strsep' function. */
+ #undef HAVE_STRSEP
+ 
+-/* Define if you have the `strtol' function. */
++/* Define to 1 if you have the `strtol' function. */
+ #undef HAVE_STRTOL
+ 
+ /* Define if <math.h> defines struct exception. */
+ #undef HAVE_STRUCT_EXCEPTION
+ 
+-/* Define if you have the <sys/dir.h> header file. */
++/* Define to 1 if you have the <sys/dir.h> header file. */
+ #undef HAVE_SYS_DIR_H
+ 
+ /* Define if you have sys_errlist in <errno.h> or in <stdio.h>. */
+@@ -87,10 +99,16 @@
+ /* Define if you have sysnerr in <errno.h> or <stdio.h>. */
+ #undef HAVE_SYS_NERR
+ 
+-/* Define if you have the <sys/time.h> header file. */
++/* Define to 1 if you have the <sys/stat.h> header file. */
++#undef HAVE_SYS_STAT_H
++
++/* Define to 1 if you have the <sys/time.h> header file. */
+ #undef HAVE_SYS_TIME_H
+ 
+-/* Define if you have the <unistd.h> header file. */
++/* Define to 1 if you have the <sys/types.h> header file. */
++#undef HAVE_SYS_TYPES_H
++
++/* Define to 1 if you have the <unistd.h> header file. */
+ #undef HAVE_UNISTD_H
+ 
+ /* Define if the host's encoding is EBCDIC. */
+@@ -120,6 +138,21 @@
+ /* Define if your C++ doesn't declare strncasecmp(). */
+ #undef NEED_DECLARATION_STRNCASECMP
+ 
++/* Define to the address where bug reports for this package should be sent. */
++#undef PACKAGE_BUGREPORT
++
++/* Define to the full name of this package. */
++#undef PACKAGE_NAME
++
++/* Define to the full name and version of this package. */
++#undef PACKAGE_STRING
++
++/* Define to the one symbol short name of this package. */
++#undef PACKAGE_TARNAME
++
++/* Define to the version of this package. */
++#undef PACKAGE_VERSION
++
+ /* Define if the printer's page size is A4. */
+ #undef PAGEA4
+ 
+@@ -129,7 +162,10 @@
+ /* Define if srand() returns void not int. */
+ #undef RET_TYPE_SRAND_IS_VOID
+ 
+-/* Define if `sys_siglist' is declared by <signal.h> or <unistd.h>. */
++/* Define to 1 if you have the ANSI C header files. */
++#undef STDC_HEADERS
++
++/* Define to 1 if `sys_siglist' is declared by <signal.h> or <unistd.h>. */
+ #undef SYS_SIGLIST_DECLARED
+ 
+ /* Define if your C++ compiler uses a traditional (Reiser) preprocessor. */
+--- groff-1.18.1.orig/src/include/device.h
++++ groff-1.18.1/src/include/device.h
+@@ -18,4 +18,9 @@
+ with groff; see the file COPYING.  If not, write to the Free Software
+ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ 
++#ifndef _DEVICE_H
++#define _DEVICE_H
++
+ extern const char *device;
++
++#endif /* _DEVICE_H */
+--- groff-1.18.1.orig/src/include/driver.h
++++ groff-1.18.1/src/include/driver.h
+@@ -27,6 +27,7 @@
+ #include <errno.h>
+ #include <assert.h>
+ #include <math.h>
++#include "encoding.h" // XXX: ukai
+ #include "errarg.h"
+ #include "error.h"
+ #include "font.h"
+--- groff-1.18.1.orig/src/include/font.h
++++ groff-1.18.1/src/include/font.h
+@@ -18,11 +18,17 @@
+ with groff; see the file COPYING.  If not, write to the Free Software
+ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ 
++#include "encoding.h"
++
+ typedef void (*FONT_COMMAND_HANDLER)(const char *, const char *,
+ 				     const char *, int);
+ 
+ struct font_kern_list;
+ struct font_char_metric;
++#ifdef ENABLE_MULTIBYTE
++struct fontset_list;
++struct font_wchar_metric;
++#endif
+ struct font_widths_cache;
+ 
+ class font {
+@@ -53,6 +59,9 @@
+   const char *get_special_device_encoding(int index);
+   const char *get_name();
+   const char *get_internal_name();
++#ifdef	ENABLE_MULTIBYTE
++  const char *get_subfont_name(int index);
++#endif
+ 
+   static int scan_papersize(const char *, const char **, double *, double *);
+ 
+@@ -62,6 +71,9 @@
+   static int load_desc();
+   static int name_to_index(const char *);
+   static int number_to_index(int);
++#ifdef	ENABLE_MULTIBYTE
++  static int wchar_index(wchar);
++#endif
+   static FONT_COMMAND_HANDLER
+     set_unknown_desc_command_handler(FONT_COMMAND_HANDLER);
+ 
+@@ -76,6 +88,11 @@
+   static int spare2;
+   static int sizescale;
+   static int tcommand;
++#ifdef	ENABLE_MULTIBYTE
++  // XXX: should be in charinfo or font_wchar_metric?
++  static int lowerwchar;
++  static int wcharkern;
++#endif
+   static int pass_filenames;
+   static int use_charnames_in_special;
+ 
+@@ -83,13 +100,27 @@
+   static const char **style_table;
+   static const char *family;
+   static int *sizes;
++#ifdef	ENABLE_MULTIBYTE
++  // fontsets - sub font list
++  static fontset_list *fontsets;
++  // get fontset for `wc' in current font `fname'
++  static int get_fontset_font(const char *fname, wchar wc);
++  // is the fontno's font load on demand?
++  static int is_on_demand(int fontno);
++#endif
+ private:
+   unsigned ligatures;
+   font_kern_list **kern_hash_table;
+   int space_width;
+-  short *ch_index;
++  short *ch_index;	/* XXX: this is used unless font_wchar_metric. */
+   int nindices;
+   font_char_metric *ch;
++#ifdef ENABLE_MULTIBYTE
++  // font metric for wchar
++  font_wchar_metric *wch;
++  // get font metric for wchar indexed by c
++  font_wchar_metric *get_font_wchar_metric(int c);
++#endif
+   int ch_used;
+   int ch_size;
+   int special;
+--- groff-1.18.1.orig/src/include/lib.h
++++ groff-1.18.1/src/include/lib.h
+@@ -88,8 +88,15 @@
+ 
+ extern char invalid_char_table[];
+ 
++#include "encoding.h" /* XXX: ukai */
++
+ inline int invalid_input_char(int c)
+ {
++#ifdef ENABLE_MULTIBYTE
++  if (input_encoding->is_wchar_byte(c))
++      return 0;
++  else
++#endif
+   return c >= 0 && invalid_char_table[c];
+ }
+ 
+--- groff-1.18.1.orig/src/include/printer.h
++++ groff-1.18.1/src/include/printer.h
+@@ -38,6 +38,8 @@
+ 
+ #include "color.h"
+ 
++#include "encoding.h"
++
+ struct environment {
+   int fontno;
+   int size;
+@@ -63,6 +65,9 @@
+   printer();
+   virtual ~printer();
+   void load_font(int i, const char *name);
++#ifdef	ENABLE_MULTIBYTE
++  void set_wchar_char(wchar c, char *s, int i0, int len, const environment *env, int *widthp = 0);
++#endif
+   void set_ascii_char(unsigned char c, const environment *env,
+ 		      int *widthp = 0);
+   void set_special_char(const char *nm, const environment *env,
+--- groff-1.18.1.orig/src/include/encoding.h
++++ groff-1.18.1/src/include/encoding.h
+@@ -0,0 +1,175 @@
++// -*- C++ -*-
++/* Copyright (c) 2001 Fumitoshi UKAI <ukai at debian.or.jp>
++
++This file is part of groff.
++
++groff is free software; you can redistribute it and/or modify it under
++the terms of the GNU General Public License as published by the Free
++Software Foundation; either version 2, or (at your option) any later
++version.
++
++groff is distributed in the hope that it will be useful, but WITHOUT ANY
++WARRANTY; without even the implied warranty of MERCHANTABILITY or
++FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
++
++#ifndef ENCODING_H
++#define ENCODING_H
++
++#include <config.h>
++
++#ifdef ENABLE_MULTIBYTE
++typedef int wchar;	// negative is used for charcode & index
++#else
++typedef char wchar;
++#endif
++
++#include <stdio.h>
++
++#ifdef __cplusplus
++class encoding_istream {
++public:
++  encoding_istream() {};
++  virtual ~encoding_istream() {};
++  virtual int getbyte() = 0;
++  virtual int peekbyte() = 0;
++  virtual void ungetbyte(int ch) = 0;
++};
++
++class encoding_istream_str: public encoding_istream {
++private:
++  const unsigned char *s;
++  int *i;
++  encoding_istream_str() {};
++public:
++  encoding_istream_str(const unsigned char *s0, int *i0) : s(s0), i(i0) {};
++  ~encoding_istream_str() {};
++  inline int getbyte() { return s[(*i)++]; };
++  inline int peekbyte() { return s[(*i)]; };
++  inline void ungetbyte(int ch) { --(*i); };
++};
++
++class encoding_istream_fp: public encoding_istream {
++private:
++  FILE *fp;
++public:
++  encoding_istream_fp(FILE *fp0) : fp(fp0) {};
++  ~encoding_istream_fp() {};
++  inline int getbyte() { return fgetc(fp); };
++  inline int peekbyte() { int ch = fgetc(fp); ungetc(ch, fp); return ch; };
++  inline void ungetbyte(int ch) { ungetc(ch, fp); };
++};
++
++class encoding_ostream {
++public:
++  encoding_ostream() {};
++  virtual ~encoding_ostream() {};
++  virtual void putbyte(unsigned char ch) = 0;
++};
++
++class encoding_ostream_str: public encoding_ostream {
++private:
++  unsigned char *s;
++  int *i;
++  int len;
++  encoding_ostream_str() {};
++public:
++  encoding_ostream_str(unsigned char *s0, int *i0, int max) : s(s0), i(i0), len(max) {};
++  ~encoding_ostream_str() {};
++  inline void putbyte(unsigned char ch) {
++    if (*i < len)
++      s[(*i)++] = ch;
++  }
++};
++
++class encoding_ostream_fp: public encoding_ostream {
++private:
++  FILE *fp;
++  const char *format;
++public:
++  encoding_ostream_fp(FILE *ofp, const char *fmt = "%c") : fp(ofp), format(fmt) {};
++  ~encoding_ostream_fp() {};
++  inline void putbyte(unsigned char ch) {
++    fprintf(fp, format, ch);
++  }
++};
++
++class encoding_handler {
++public:
++  encoding_handler() {};
++  virtual ~encoding_handler() {};
++
++  // name of this encoding_handler
++  virtual const char *name() { return ""; };
++
++  // check if this byte is byte in multibyte character in this encoding?
++  virtual int is_wchar_byte(unsigned char c) { return 0; };
++
++  // make new wchar from c0 (beginning of multibytes) and rest from `in'
++  virtual wchar make_wchar(unsigned char c0, encoding_istream& in) { 
++    return wchar(c0);
++  }
++  // make new wchar from c0 (beginning of multibytes) and rest from `fp'
++  virtual wchar make_wchar(unsigned char c0, FILE *fp) {
++    encoding_istream_fp in(fp);
++    return make_wchar(c0, in);
++  }
++  // make new wchar from c0 (beginning of multibtyes) and rest from
++  // s[*i], *i will be changed to point the byte of next character.
++  virtual wchar make_wchar(unsigned char c0, const unsigned char *s, int *i) {
++    encoding_istream_str in(s, i);
++    return make_wchar(c0, in);
++  }
++
++  // put wchar to outputstream
++  // returns number of bytes written
++  virtual int put_wchar(wchar wc, encoding_ostream& eos) {
++    eos.putbyte((unsigned char)wc);
++    return 1;
++  }
++  // put wchar to `fp' using `fmt'
++  // returns number of bytes written
++  virtual int put_wchar(wchar wc, FILE *fp, const char *fmt = "%c") {
++    encoding_ostream_fp out(fp, fmt);
++    return put_wchar(wc, out);
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list