vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit d5199a1f2f5750083c802fae07252d8113ad57b8
parent 9b54976688eed26ec4b1203df5ac84fc51a3a2c4
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat, 23 Aug 2014 11:20:14 +0200

Share common macros in util.h

Diffstat:
Mtext.c | 8+-------
Autil.h | 7+++++++
2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/text.c b/text.c @@ -12,16 +12,10 @@ #include <sys/mman.h> #include "text.h" - -#define MAX(a, b) ((a) < (b) ? (b) : (a)) -#define MIN(a, b) ((a) > (b) ? (b) : (a)) -#define LENGTH(x) ((int)(sizeof (x) / sizeof *(x))) +#include "util.h" #define BUFFER_SIZE (1 << 20) -/* is c the start of a utf8 sequence? */ -#define isutf8(c) (((c)&0xC0)!=0x80) - struct Regex { const char *string; regex_t regex; diff --git a/util.h b/util.h @@ -0,0 +1,7 @@ +#define LENGTH(x) ((int)(sizeof (x) / sizeof *(x))) +#define MIN(a, b) ((a) > (b) ? (b) : (a)) +#define MAX(a, b) ((a) < (b) ? (b) : (a)) + +/* is c the start of a utf8 sequence? */ +#define isutf8(c) (((c)&0xC0)!=0x80) +#define ISASCII(ch) ((unsigned char)ch < 0x80)