Add UTF-8 support to textproc/par

2015-12-09 Thread Gregor Best
Hi people,

in line with the current "Add UTF-8 support to everything"-movement, I'd
like to propose the attached patch  for the textproc/par port. I use par
to  format my  email messages  (this one  included), and  I love  to use
umlauts, which can be a bit  cumbersome with regular par. The patch adds
the UTF-8 patch from [0].

I've tested the patch  with the example from [0] and  a few emails, both
with and without umlauts, and it seems to work fine.

If it's okay with everyone, I'd also like to take MAINTAINER of the port
since it currently looks orphaned.

[0]: 
http://sysmic.org/dotclear/index.php?post/2006/06/22/55-add-multibyte-characters-support-in-par

-- 
Gregor
Index: Makefile
===
RCS file: /mnt/media/cvs/ports/textproc/par/Makefile,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile
--- Makefile16 Feb 2015 22:57:13 -  1.20
+++ Makefile9 Dec 2015 17:13:46 -
@@ -5,10 +5,12 @@ COMMENT=  paragraph reflow for email
 VERSION=   1.52
 DISTNAME=  Par${VERSION:S/.//}
 PKGNAME=   par-${VERSION}
-REVISION = 0
+REVISION = 1
 CATEGORIES=textproc
 
 HOMEPAGE=  http://www.nicemice.net/par/
+
+MAINTAINER=Gregor Best 
 
 # custom
 PERMIT_PACKAGE_CDROM=  Yes
Index: patches/patch-utf-8
===
RCS file: patches/patch-utf-8
diff -N patches/patch-utf-8
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-utf-8 9 Dec 2015 17:05:09 -
@@ -0,0 +1,1870 @@
+diff -ur ../Par152.orig/buffer.c ./buffer.c
+--- ../Par152.orig/buffer.cFri Mar  9 00:51:11 2001
 ./buffer.c Wed Dec  9 18:01:22 2015
+@@ -1,9 +1,11 @@
+-/*/
+-/* buffer.c  */
+-/* for Par 1.52  */
+-/* Copyright 2001 by */
+-/* Adam M. Costello  */
+-/*/
++/***/
++/* buffer.c*/
++/* for Par 1.52-i18n.4 */
++/* Copyright 2001 by   */
++/* Adam M. Costello*/
++/* Modified by */
++/* Jérôme Pouiller */
++/***/
+ 
+ /* This is ANSI C code (C89). */
+ 
+@@ -18,6 +20,7 @@
+ 
+ #include 
+ #include 
++#include 
+ 
+ #undef NULL
+ #define NULL ((void *) 0)
+@@ -60,7 +63,7 @@
+   blk = malloc(sizeof (block));
+   items = malloc(maxhere * itemsize);
+   if (!buf || !blk || !items) {
+-strcpy(errmsg,outofmem);
++wcscpy(errmsg,outofmem);
+ goto nberror;
+   }
+ 
+@@ -127,7 +130,7 @@
+   new = malloc(sizeof (block));
+   items = malloc(maxhere * itemsize);
+   if (!new || !items) {
+-strcpy(errmsg,outofmem);
++wcscpy(errmsg,outofmem);
+ goto aierror;
+   }
+   blk->next = new;
+@@ -174,7 +177,7 @@
+ 
+   r = malloc(n * itemsize);
+   if (!r) {
+-strcpy(errmsg,outofmem);
++wcscpy(errmsg,outofmem);
+ return NULL;
+   }
+ 
+diff -ur ../Par152.orig/buffer.h ./buffer.h
+--- ../Par152.orig/buffer.hFri Mar  9 00:51:25 2001
 ./buffer.h Wed Dec  9 18:01:22 2015
+@@ -1,9 +1,11 @@
+-/*/
+-/* buffer.h  */
+-/* for Par 1.52  */
+-/* Copyright 2001 by */
+-/* Adam M. Costello  */
+-/*/
++/***/
++/* buffer.h*/
++/* for Par 1.52-i18n.4 */
++/* Copyright 2001 by   */
++/* Adam M. Costello*/
++/* Modified by */
++/* Jérôme Pouiller */
++/***/
+ 
+ /* This is ANSI C code (C89). */
+ 
+diff -ur ../Par152.orig/charset.c ./charset.c
+--- ../Par152.orig/charset.c   Mon Apr  2 23:51:48 2001
 ./charset.cWed Dec  9 18:01:22 2015
+@@ -1,9 +1,11 @@
+-/*/
+-/* charset.c */
+-/* for Par 1.52  */
+-/* Copyright 2001 by */
+-/* Adam M. Costello  */
+-/*/
++/***/
++/* charset.c   */
++/* for Par 1.52-i18n.4 */
++/* Copyright 2001 by   */
++/* Adam M. Costello*/
++/* Modified by */
++/* Jérôme Pouiller */
++/***/
+ 
+ /* This is ANSI C code (C89). */
+ 
+@@ -18,8 +20,9 @@
+   /* prototypes.  Also includes "errmsg.h". */
+ #include "buffer.h"   /* Also includes .  */
+ 
+-#include 
+ #include 
++#include 
++#include 
+ #include 
+ #include 
+ 
+@@ -39,8 +42,8 @@
+ typedef unsigned char csflag_t;
+ 
+ struct charset {
+-  char *inlist;/* Characters in inlist are in the set.*/
+-  char *outlist;   /* Characters in outlist are not in the set.   */
++  wchar_t *inlist;/* Characters in inlist are in the set.
*/
++  wchar_t *outlist;   /* Characters in outlist are not in the set.   
*/
+/* inlist and outlist must have no common characters.  */
+/* inlist and outlist may be NULL, which acts like "". */
+   csflag_t flags;  /* Characters in neither list are in the set if they   */
+@@ -56,25 +59,25 @@
+   CS_NUL   = 

Re: Add UTF-8 support to textproc/par

2015-12-09 Thread Jérémie Courrèges-Anglas
Gregor Best  writes:

> Hi people,

Hi,

> in line with the current "Add UTF-8 support to everything"-movement, I'd
> like to propose the attached patch  for the textproc/par port. I use par
> to  format my  email messages  (this one  included), and  I love  to use
> umlauts, which can be a bit  cumbersome with regular par. The patch adds
> the UTF-8 patch from [0].
>
> I've tested the patch  with the example from [0] and  a few emails, both
> with and without umlauts, and it seems to work fine.

Sounds fine but see below for an alternative patch.

> If it's okay with everyone, I'd also like to take MAINTAINER of the port
> since it currently looks orphaned.

Same here.

> [0]: 
> http://sysmic.org/dotclear/index.php?post/2006/06/22/55-add-multibyte-characters-support-in-par

bsd.port.mk can fetch and apply external patches as well.  What about
this version?

Index: Makefile
===
RCS file: /cvs/ports/textproc/par/Makefile,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile
--- Makefile16 Feb 2015 22:57:13 -  1.20
+++ Makefile9 Dec 2015 17:51:16 -
@@ -5,16 +5,21 @@ COMMENT=  paragraph reflow for email
 VERSION=   1.52
 DISTNAME=  Par${VERSION:S/.//}
 PKGNAME=   par-${VERSION}
-REVISION = 0
+REVISION = 1
 CATEGORIES=textproc
 
 HOMEPAGE=  http://www.nicemice.net/par/
 
+MAINTAINER=Gregor Best 
+
 # custom
 PERMIT_PACKAGE_CDROM=  Yes
 WANTLIB=   c 
 
 MASTER_SITES=   ${HOMEPAGE}
+
+PATCHFILES=par_1.52-i18n.3.diff.gz
+PATCH_DIST_STRIP=  -p1
 
 ALL_TARGET=
 
Index: distinfo
===
RCS file: /cvs/ports/textproc/par/distinfo,v
retrieving revision 1.4
diff -u -p -r1.4 distinfo
--- distinfo18 Jan 2015 03:15:29 -  1.4
+++ distinfo9 Dec 2015 17:51:16 -
@@ -1,2 +1,4 @@
 SHA256 (Par152.tar.gz) = M9za6QX0tCZ7TcHz77Ay15cFyo0hIuF+/ez9gWIGcII=
+SHA256 (par_1.52-i18n.3.diff.gz) = zC4seUO3PZ6ok3F/Zp7H8WZRiN2L7dRa6soCfDCwVrs=
 SIZE (Par152.tar.gz) = 47999
+SIZE (par_1.52-i18n.3.diff.gz) = 24302


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: Add UTF-8 support to textproc/par

2015-12-09 Thread Gregor Best
On Wed, Dec 09, 2015 at 06:56:06PM +0100, Jérémie Courrèges-Anglas wrote:
> [...]
> bsd.port.mk can fetch and apply external patches as well.  What about
> this version?
> [...]

Cool, I didn't know that. That's obviously way better than my 60k patch.

-- 
Gregor