Module Name: othersrc
Committed By: dyoung
Date: Mon Sep 14 02:58:17 UTC 2015
Modified Files:
othersrc/external/bsd/arfe/dt: README dt.c dt.h hex.c hex.h ipv4.c
ipv4.h macaddr.c
othersrc/external/bsd/arfe/it: README
othersrc/external/bsd/arfe/tt: README
Log Message:
Make some changes that let this build and run properly on 64-bit hosts
and on Mac OS X.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 othersrc/external/bsd/arfe/dt/README
cvs rdiff -u -r1.11 -r1.12 othersrc/external/bsd/arfe/dt/dt.c
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/arfe/dt/dt.h \
othersrc/external/bsd/arfe/dt/hex.c othersrc/external/bsd/arfe/dt/hex.h \
othersrc/external/bsd/arfe/dt/ipv4.c othersrc/external/bsd/arfe/dt/ipv4.h
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/arfe/dt/macaddr.c
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/arfe/it/README
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/arfe/tt/README
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: othersrc/external/bsd/arfe/dt/README
diff -u othersrc/external/bsd/arfe/dt/README:1.7 othersrc/external/bsd/arfe/dt/README:1.8
--- othersrc/external/bsd/arfe/dt/README:1.7 Fri Sep 11 02:12:57 2015
+++ othersrc/external/bsd/arfe/dt/README Mon Sep 14 02:58:17 2015
@@ -1,5 +1,5 @@
-$ARFE: README 243 2015-09-11 01:57:04Z dyoung $
-$NetBSD: README,v 1.7 2015/09/11 02:12:57 dyoung Exp $
+$ARFE: README 245 2015-09-11 02:13:21Z dyoung $
+$NetBSD: README,v 1.8 2015/09/14 02:58:17 dyoung Exp $
DT---(d)ifferentiate (t)ext---finds a longest common subsequence (LCS)
of two texts where the numbers and IPv4 addresses are "wild": a span
Index: othersrc/external/bsd/arfe/dt/dt.c
diff -u othersrc/external/bsd/arfe/dt/dt.c:1.11 othersrc/external/bsd/arfe/dt/dt.c:1.12
--- othersrc/external/bsd/arfe/dt/dt.c:1.11 Fri Sep 11 02:12:57 2015
+++ othersrc/external/bsd/arfe/dt/dt.c Mon Sep 14 02:58:17 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: dt.c,v 1.11 2015/09/11 02:12:57 dyoung Exp $ */
-/* $ARFE: dt.c 243 2015-09-11 01:57:04Z dyoung $ */
+/* $NetBSD: dt.c,v 1.12 2015/09/14 02:58:17 dyoung Exp $ */
+/* $ARFE: dt.c 247 2015-09-14 02:52:57Z dyoung $ */
/*-
* Copyright (c) 2014,2015 David Young <[email protected]>
@@ -253,7 +253,7 @@ file_to_slice(const char *fn)
return newslice(p, st.st_size);
}
-static size_t
+static ssize_t
length(const slice_t *s)
{
if (s->first > s->last)
@@ -275,17 +275,17 @@ ispresent(const slice_t *s, char c)
}
static inline char
-get(const slice_t *s, unsigned int i)
+get(const slice_t *s, int i)
{
- dbg_assert(i < length(s));
+ dbg_assert(0 <= i && i < length(s));
return (s->backward) ? s->last[-i] : s->first[i];
}
static inline const char *
-getp(const slice_t *s, unsigned int i)
+getp(const slice_t *s, int i)
{
- dbg_assert(i < length(s));
+ dbg_assert(0 <= i && i < length(s));
return (s->backward) ? &s->last[-i] : &s->first[i];
}
@@ -309,7 +309,7 @@ extract(const slice_t *s, unsigned int i
}
static slice_t *
-subslice(const slice_t *s, unsigned int i, unsigned int j)
+subslice(const slice_t *s, int i, int j)
{
slice_t *ss;
const char *first, *last;
@@ -338,7 +338,8 @@ subslice(const slice_t *s, unsigned int
}
static bool
-clocc_starts_at(const cloccs_t *o, int first, size_t *wlenp, clocc_kind_t *kindp)
+clocc_starts_at(const cloccs_t *o, int first, ssize_t *wlenp,
+ clocc_kind_t *kindp)
{
const clocc_t *occ;
int l, m, r;
@@ -367,7 +368,7 @@ found:
}
static bool
-clocc_ends_at(const cloccs_t *o, int last, size_t *wlenp, clocc_kind_t *kindp)
+clocc_ends_at(const cloccs_t *o, int last, ssize_t *wlenp, clocc_kind_t *kindp)
{
const clocc_t *occ;
int l, m, r;
@@ -415,7 +416,7 @@ clocc_starts_in_slice_at(const cloccs_t
static bool
clocc_ends_in_slice_at(const cloccs_t *o, const slice_t *basis,
- const slice_t *s, int i, size_t *wlenp, size_t *kindp)
+ const slice_t *s, int i, ssize_t *wlenp, clocc_kind_t *kindp)
{
const int iprime = index_versus_basis(basis, s, i);
@@ -708,15 +709,15 @@ static void
algb(const slice_t *A, const slice_t *B, scratch_t *scratch, size_t *LL,
bool do_clocc)
{
- const size_t m = length(A);
- const size_t n = length(B);
- unsigned int i, j;
+ const ssize_t m = length(A);
+ const ssize_t n = length(B);
+ ssize_t i, j;
size_t *K[2], *Kclocc, *Kcur, *Kprev, *Ktmp;
struct {
clocc_kind_t A, B;
} kind;
struct {
- size_t A, B;
+ ssize_t A, B;
} wlen;
bool inside_clocc = false;
@@ -741,7 +742,7 @@ algb(const slice_t *A, const slice_t *B,
if (clocc_starts_this_row) {
assert(!inside_clocc);
- dbg_printf("%s: row %d, clocc starts\n", __func__, i);
+ dbg_printf("%s: row %zd, clocc starts\n", __func__, i);
memcpy(&Kclocc[-1], &Kprev[-1],
sizeof(Kclocc[0]) * (n + 1));
inside_clocc = true;
@@ -775,11 +776,11 @@ algb(const slice_t *A, const slice_t *B,
MAX(ul, nscore));
} else
Kcur[j] = MAX(MAX(u, ul), l);
- dbg_printf("%s set K[%d][%d] to %zu%s\n",
+ dbg_printf("%s set K[%zd][%zd] to %zu%s\n",
__func__, i, j, Kcur[j], inside_clocc ? "*" : "");
}
if (clocc_ends_this_row) {
- dbg_printf("%s: row %d, clocc ends\n", __func__, i);
+ dbg_printf("%s: row %zd, clocc ends\n", __func__, i);
inside_clocc = false;
}
@@ -920,7 +921,7 @@ algc_return(const size_t m, const size_t
size_t *lcsp, size_t lcs, chain_t *c)
{
if (lcsp != NULL) {
- dbg_printf("%s([%d, %d], [%d, %d]) -> %zu\n", __func__,
+ dbg_printf("%s([%d, %zu], [%d, %zu]) -> %zu\n", __func__,
origin.i, origin.i + m - 1,
origin.j, origin.j + n - 1, lcs);
*lcsp = lcs;
@@ -978,7 +979,7 @@ algc(const slice_t *A, const slice_t *B,
slice_t *A1i, *Amip1, *Bn1;
slice_t *B1k, *Aip1m, *Bkp1n;
- dbg_printf("%s([%d, %d], [%d, %d])\n", __func__,
+ dbg_printf("%s([%d, %zu], [%d, %zu])\n", __func__,
origin.i, origin.i + m - 1,
origin.j, origin.j + n - 1);
@@ -1051,7 +1052,7 @@ algc(const slice_t *A, const slice_t *B,
bctx = {.l = "12345.12345", .r = "12345.12345"};
dbg_printf("%s expected lcs %zu, got %zu + %zu = %zu at "
- "[%d | %d + %d | %d + %d, %d | %d + %d | %d + %d]\n",
+ "[%d | %d + %u | %d + %zu, %d | %d + %u | %d + %zu]\n",
__func__, expected_lcs, lcs.topl, lcs.botr, lcs.tot,
origin.i, origin.i, i - 1, origin.i, m - 1,
origin.j, origin.j, k, origin.j, n - 1);
@@ -1136,7 +1137,7 @@ scratch_init(scratch_t *scratch, size_t
static int
slicestr(const slice_t *s, const char *t)
{
- unsigned int i;
+ ssize_t i;
const char *p;
p = t;
Index: othersrc/external/bsd/arfe/dt/dt.h
diff -u othersrc/external/bsd/arfe/dt/dt.h:1.3 othersrc/external/bsd/arfe/dt/dt.h:1.4
--- othersrc/external/bsd/arfe/dt/dt.h:1.3 Fri Sep 11 02:12:57 2015
+++ othersrc/external/bsd/arfe/dt/dt.h Mon Sep 14 02:58:17 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: dt.h,v 1.3 2015/09/11 02:12:57 dyoung Exp $ */
-/* $ARFE: dt.h 243 2015-09-11 01:57:04Z dyoung $ */
+/* $NetBSD: dt.h,v 1.4 2015/09/14 02:58:17 dyoung Exp $ */
+/* $ARFE: dt.h 247 2015-09-14 02:52:57Z dyoung $ */
/*-
* Copyright (c) 2014,2015 David Young <[email protected]>
@@ -29,6 +29,8 @@
#include <stdarg.h> /* for va_list, va_start, va_end */
#include <stdio.h>
+#include "portability.h"
+
static int dbg_printf(const char *, ...) __printflike(1, 2);
static int dbg2_printf(const char *, ...) __printflike(1, 2);
Index: othersrc/external/bsd/arfe/dt/hex.c
diff -u othersrc/external/bsd/arfe/dt/hex.c:1.3 othersrc/external/bsd/arfe/dt/hex.c:1.4
--- othersrc/external/bsd/arfe/dt/hex.c:1.3 Fri Sep 11 02:12:57 2015
+++ othersrc/external/bsd/arfe/dt/hex.c Mon Sep 14 02:58:17 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: hex.c,v 1.3 2015/09/11 02:12:57 dyoung Exp $ */
-/* $ARFE: hex.c 243 2015-09-11 01:57:04Z dyoung $ */
+/* $NetBSD: hex.c,v 1.4 2015/09/14 02:58:17 dyoung Exp $ */
+/* $ARFE: hex.c 245 2015-09-11 02:13:21Z dyoung $ */
/*-
* Copyright (c) 2014,2015 David Young <[email protected]>
Index: othersrc/external/bsd/arfe/dt/hex.h
diff -u othersrc/external/bsd/arfe/dt/hex.h:1.3 othersrc/external/bsd/arfe/dt/hex.h:1.4
--- othersrc/external/bsd/arfe/dt/hex.h:1.3 Fri Sep 11 02:12:57 2015
+++ othersrc/external/bsd/arfe/dt/hex.h Mon Sep 14 02:58:17 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: hex.h,v 1.3 2015/09/11 02:12:57 dyoung Exp $ */
-/* $ARFE: hex.h 243 2015-09-11 01:57:04Z dyoung $ */
+/* $NetBSD: hex.h,v 1.4 2015/09/14 02:58:17 dyoung Exp $ */
+/* $ARFE: hex.h 245 2015-09-11 02:13:21Z dyoung $ */
/*-
* Copyright (c) 2014,2015 David Young <[email protected]>
Index: othersrc/external/bsd/arfe/dt/ipv4.c
diff -u othersrc/external/bsd/arfe/dt/ipv4.c:1.3 othersrc/external/bsd/arfe/dt/ipv4.c:1.4
--- othersrc/external/bsd/arfe/dt/ipv4.c:1.3 Fri Sep 11 02:12:57 2015
+++ othersrc/external/bsd/arfe/dt/ipv4.c Mon Sep 14 02:58:17 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: ipv4.c,v 1.3 2015/09/11 02:12:57 dyoung Exp $ */
-/* $ARFE: ipv4.c 243 2015-09-11 01:57:04Z dyoung $ */
+/* $NetBSD: ipv4.c,v 1.4 2015/09/14 02:58:17 dyoung Exp $ */
+/* $ARFE: ipv4.c 247 2015-09-14 02:52:57Z dyoung $ */
/*-
* Copyright (c) 2014,2015 David Young <[email protected]>
@@ -93,8 +93,6 @@ enum ipv4_state_idxs {
, SECOND_NUMBER
};
-__CTASSERT(SECOND_NUMBER > FIRST_NUMBER)
-
#define __skip(__n) ((SECOND_NUMBER - FIRST_NUMBER) * ((__n) - 1))
#define expecting_dot(__n) ipv4_states[EXPECTING_DOT + __skip(__n)]
Index: othersrc/external/bsd/arfe/dt/ipv4.h
diff -u othersrc/external/bsd/arfe/dt/ipv4.h:1.3 othersrc/external/bsd/arfe/dt/ipv4.h:1.4
--- othersrc/external/bsd/arfe/dt/ipv4.h:1.3 Fri Sep 11 02:12:57 2015
+++ othersrc/external/bsd/arfe/dt/ipv4.h Mon Sep 14 02:58:17 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: ipv4.h,v 1.3 2015/09/11 02:12:57 dyoung Exp $ */
-/* $ARFE: ipv4.h 243 2015-09-11 01:57:04Z dyoung $ */
+/* $NetBSD: ipv4.h,v 1.4 2015/09/14 02:58:17 dyoung Exp $ */
+/* $ARFE: ipv4.h 245 2015-09-11 02:13:21Z dyoung $ */
/*-
* Copyright (c) 2014,2015 David Young <[email protected]>
Index: othersrc/external/bsd/arfe/dt/macaddr.c
diff -u othersrc/external/bsd/arfe/dt/macaddr.c:1.1 othersrc/external/bsd/arfe/dt/macaddr.c:1.2
--- othersrc/external/bsd/arfe/dt/macaddr.c:1.1 Fri Sep 11 01:50:42 2015
+++ othersrc/external/bsd/arfe/dt/macaddr.c Mon Sep 14 02:58:17 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: macaddr.c,v 1.1 2015/09/11 01:50:42 dyoung Exp $ */
+/* $NetBSD: macaddr.c,v 1.2 2015/09/14 02:58:17 dyoung Exp $ */
/* $ARFE:47:33Z dyoung $ */
/*-
@@ -73,8 +73,6 @@ enum mac_state_idxs {
, SECOND_NUMBER
};
-__CTASSERT(SECOND_NUMBER > FIRST_NUMBER)
-
#define __skip(__n) ((SECOND_NUMBER - FIRST_NUMBER) * ((__n) - 1))
#define read_colon(__n) mac_states[READ_COLON + __skip(__n)]
Index: othersrc/external/bsd/arfe/it/README
diff -u othersrc/external/bsd/arfe/it/README:1.5 othersrc/external/bsd/arfe/it/README:1.6
--- othersrc/external/bsd/arfe/it/README:1.5 Fri Sep 11 02:12:57 2015
+++ othersrc/external/bsd/arfe/it/README Mon Sep 14 02:58:17 2015
@@ -1,5 +1,5 @@
-$ARFE: README 243 2015-09-11 01:57:04Z dyoung $
-$NetBSD: README,v 1.5 2015/09/11 02:12:57 dyoung Exp $
+$ARFE: README 245 2015-09-11 02:13:21Z dyoung $
+$NetBSD: README,v 1.6 2015/09/14 02:58:17 dyoung Exp $
IT---(i)ntegrate (t)ext---is a variation on DT that adds decimal numbers
instead of subtracts, and bitwise-ORs hexadecimal numbers instead of
Index: othersrc/external/bsd/arfe/tt/README
diff -u othersrc/external/bsd/arfe/tt/README:1.2 othersrc/external/bsd/arfe/tt/README:1.3
--- othersrc/external/bsd/arfe/tt/README:1.2 Fri Sep 11 02:12:57 2015
+++ othersrc/external/bsd/arfe/tt/README Mon Sep 14 02:58:17 2015
@@ -1,5 +1,5 @@
-$ARFE: README 243 2015-09-11 01:57:04Z dyoung $
-$NetBSD: README,v 1.2 2015/09/11 02:12:57 dyoung Exp $
+$ARFE: README 245 2015-09-11 02:13:21Z dyoung $
+$NetBSD: README,v 1.3 2015/09/14 02:58:17 dyoung Exp $
TT---(t)ransform (t)ext---transforms its input based on a
match/transform-template pair that exemplifies the changes that should