Dear Werner,

On Sat, 10 Dec 2005, Werner LEMBERG wrote:


In short - I proposed a simple hack to accept UTF8 input encoding,
triggered by -mutf8 on the command line,

This is not possible, I think.  `-m' only handles macro stuff.


I thought to make -mutf8 a special case.

But, as you have mentioned in the omitted part,
it requires too much knowledge of groff internals for me.

you wanted patches - here they are!

1 The encoding issue.

I have failed to find a place in troff code
to plug utf decoder in.
Thus let us do in the UNIX way - since groff already lives off a pipeline,
one more preprocessor for dealing with encodings will
not hurt.
What the patch does:
If groff has a -k command line option,
a converter called gconv is called.
If "-K arg" is present, the "arg" is passed
to "gconv".

A sample gconv script is included:
UTF8 is converted to \[uXXXX],
if an optional argument is present - text is iconv'ed to UTF first.

If the sample gconv is too simple,
 gpreconv may be used instead of iconv,
or merged with uni2groff to make gcov a binary.

Test case at http://www.iaas.msu.ru/tmp/encodinstest.tgz

2 makeinfo version not found by configure

I have compiled groff-current on MacOS X 10.4.3 and stepped over the following bug:
my makeinfo reports its version this way:

makeinfo (GNU texinfo) 4.8

configure does not parse the version string correctly
and complains that version is too old
(instead of admitting the error).

The attached patch solved the problem for me.

3 There is an OS called Darwin

It would be nice to include Darwin in the list of known OS'es:

                   Sincerely, Michail
PS. Where do the enriched URW fonts live?
--- configure.org       2005-12-10 18:44:53.000000000 +0300
+++ configure   2005-12-10 19:10:58.000000000 +0300
@@ -5512,13 +5512,13 @@
 echo "${ECHO_T}$makeinfo_version" >&6
      # Consider only the first two numbers in version number string.
      makeinfo_version_major=`echo $makeinfo_version \
-       | sed 's/^\([0-9]*\).*$/\1/'`
+       | sed 's/^.* \([0-9]*\)\.\([0-9]*\).*$/\1/'`
      if test -z "$makeinfo_version_major"; then
        makeinfo_version_major=0
        makeinfo_version_minor=0
      else
        makeinfo_version_minor=`echo $makeinfo_version \
-        | sed 's/^[^.]\+\(.*\)$/\1/'`
+         | sed 's/^.* \([0-9]*\)\.\([0-9]*\).*$/\2/'`
        # No minor version number at all?
        if test -z "$makeinfo_version_minor"; then
         makeinfo_version_minor=0
--- src/roff/groff/pipeline.h.org       2005-12-10 18:26:48.000000000 +0300
+++ src/roff/groff/pipeline.h   2005-12-10 16:03:33.000000000 +0300
@@ -25,7 +25,7 @@
 #endif
 
 /* run_pipeline can handle at most this many commands */
-#define MAX_COMMANDS 12
+#define MAX_COMMANDS 13
 
 /* Children exit with this status if execvp fails. */
 #define EXEC_FAILED_EXIT_STATUS 0xff
--- tmac/doc-common     Thu Apr 15 08:09:22 2004
+++ tmac/doc-common     Wed Jun  2 12:53:58 2004
@@ -512,6 +512,9 @@
 .      el \
 .        tm mdoc warning: .Os: Unknown NetBSD version `\$2' (#\n[.c])
 .  \}\}
+.  el \{ .ie "\$1"Darwin" \{\
+.    ds doc-operating-system Darwin
+.  \}\}
 .  el \{\
 .    ds doc-operating-system \$1
 .    if !"\$2"" \
--- src/roff/groff/groff.cpp.org        2005-12-10 15:51:38.000000000 +0300
+++ src/roff/groff/groff.cpp    2005-12-10 19:51:49.000000000 +0300
@@ -51,7 +51,8 @@
 #endif /* NEED_DECLARATION_PUTENV */
 
 // The number of commands must be in sync with MAX_COMMANDS in pipeline.h
-const int SOELIM_INDEX = 0;
+const int GCONV_INDEX = 0;
+const int SOELIM_INDEX = GCONV_INDEX + 1;
 const int REFER_INDEX = SOELIM_INDEX + 1;
 const int GRAP_INDEX = REFER_INDEX + 1;
 const int PIC_INDEX = GRAP_INDEX + 1;
@@ -128,7 +129,7 @@
     { NULL, 0, 0, 0 }
   };
   while ((opt = getopt_long(argc, argv,
-                           
"abcCd:eEf:F:gGhiI:lL:m:M:n:No:pP:r:RsStT:UvVw:W:XzZ",
+                           
"abcCd:eEf:F:gGhiI:kK:lL:m:M:n:No:pP:r:RsStT:UvVw:W:XzZ",
                            long_options, NULL))
         != EOF) {
     char buf[3];
@@ -149,6 +150,9 @@
       Pargs += optarg;
       Pargs += '\0';
       break;
+    case 'k':
+      commands[GCONV_INDEX].set_name(command_prefix, "gconv");
+      break;
     case 't':
       commands[TBL_INDEX].set_name(command_prefix, "tbl");
       break;
@@ -272,6 +276,9 @@
     case 'L':
       append_arg_to_string(optarg, Largs);
       break;
+    case 'K':
+      commands[GCONV_INDEX].append_arg(optarg);
+      break;
     case 'X':
       Xflag++;
       break;
@@ -690,9 +697,9 @@
 void synopsis(FILE *stream)
 {
   fprintf(stream,
-"usage: %s [-abceghilpstvzCENRSUVXZ] [-Fdir] [-mname] [-Tdev] [-ffam]\n"
+"usage: %s [-abceghiklpstvzCENRSUVXZ] [-Fdir] [-mname] [-Tdev] [-ffam]\n"
 "       [-wname] [-Wname] [-Mdir] [-dcs] [-rcn] [-nnum] [-olist] [-Parg]\n"
-"       [-Larg] [-Idir] [files...]\n",
+"       [-Karg] [-Larg] [-Idir] [files...]\n",
          program_name);
 }
 
_______________________________________________
Groff mailing list
Groff@gnu.org
http://lists.gnu.org/mailman/listinfo/groff

Reply via email to