Date: Wed, 23 Jun 2010 00:56:53 GMT From: Benjamin Fiedler <bfiedler@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 180136 for review Message-ID: <201006230056.o5N0urs3015191@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@180136?ac=10 Change 180136 by bfiedler@freebsd-7803 on 2010/06/23 00:56:51 Add Eflag Affected files ... .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#4 edit .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.h#4 edit .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#4 edit Differences ... ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#4 (text+ko) ==== @@ -48,7 +48,7 @@ int aflag, bflag, Bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag; int sflag, tflag, Tflag, wflag, uniflag, yflag, strip_cr, tabsize=8; -int horizon; +int horizon, Eflag; int format, status; int fcase_behave = FCASE_SENSITIVE; unsigned long long context; @@ -76,11 +76,11 @@ LLF_OPT, TSIZE_OPT, HLINES_OPT, - OPT_LFILES, + LFILES_OPT, }; -#define OPTIONS "0123456789abBC:cdD:efhI:iL:lnNPpqrS:sTtU:uvwX:x:y" +#define OPTIONS "0123456789abBC:cdD:eEfhI:iL:lnNPpqrS:sTtU:uvwX:x:y" static struct option longopts[] = { { "ignore-file-name-case", no_argument, NULL, FCASE_IGNORE_OPT }, { "no-ignore-file-name-case", no_argument, NULL, FCASE_SENSITIVE_OPT }, @@ -91,15 +91,15 @@ { "from-file", required_argument, NULL, FROMFILE_OPT }, { "to-file", required_argument, NULL, TOFILE_OPT }, { "help", no_argument, NULL, HELP_OPT }, - { "horizon-lines", required_argument, NULL, HORIZ_OPT}, + { "horizon-lines", required_argument, NULL, HORIZ_OPT }, { "text", no_argument, NULL, 'a' }, { "ignore-blank-lines", no_argument, NULL, 'B' }, { "ignore-space-change", no_argument, NULL, 'b' }, { "context", optional_argument, NULL, 'C' }, { "ifdef", required_argument, NULL, 'D' }, { "minimal", no_argument, NULL, 'd' }, -/* XXX: UNIMPLEMENTED - { "ignore-tab-expansion", no_argument, NULL, 'E' }, */ +/* XXX: UNIMPLEMENTED */ + { "ignore-tab-expansion", no_argument, NULL, 'E' }, { "ed", no_argument, NULL, 'e' }, { "forward-ed", no_argument, NULL, 'f' }, { "ignore-matching-lines", required_argument, NULL, 'I' }, @@ -123,16 +123,17 @@ { "exclude", required_argument, NULL, 'x' }, { "speed-large-files", no_argument, NULL, NOOP_OPT }, +/* options to be forwarded to sdiff */ { "side-by-side", no_argument, NULL, 'y' }, + { "width", optional_argument, NULL, 'W' }, + { "left-column", no_argument, NULL, LEFTC_OPT }, + { "suppress-common-lines", no_argument, NULL, SUPCL_OPT }, + /* XXX: the following are not very well documented and rarely used. If we need them at all, we will need to dig into the code to see what do they do actually. - { "left-column", no_argument, NULL, NOOP_OPT }, { "line-format", required_argument, NULL, NOOP_OPT }, { "show-function-line", required_argument, NULL, 'F' }, - { "side-by-side", no_argument, NULL, 'y' }, - { "suppress-common-lines", no_argument, NULL, NOOP_OPT }, - { "width", optional_argument, NULL, 'W' }, { "unchanged-group-format", required_argument, NULL, NOOP_OPT }, { "old-group-format", required_argument, NULL, NOOP_OPT }, { "new-group-format", required_argument, NULL, NOOP_OPT }, @@ -212,6 +213,9 @@ case 'd': dflag = 1; break; + case 'E': + Eflag = 1; + break; case 'e': format = D_EDIT; break; ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.h#4 (text+ko) ==== @@ -83,7 +83,7 @@ }; extern int aflag, bflag, Bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, - sflag, tflag, Tflag, wflag, uniflag, strip_cr, tabsize; + sflag, tflag, Tflag, wflag, uniflag, strip_cr, tabsize, Eflag; extern int format, status, horizon; extern int fcase_behave; extern unsigned long long context; ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#4 (text+ko) ==== @@ -694,7 +694,7 @@ static void check(FILE *f1, FILE *f2) { - int i, j, jackpot, a, b; + int i, j, jackpot, a, b, newcol; wint_t c, d; long ctold, ctnew; wchar_t *strc, *strd; @@ -762,7 +762,20 @@ ctnew++; } } + newcol = ((b/8)+1)*8; + while ((Eflag) && (c == L'\t') && (d == L' ') && b <= newcol ) + d = strd[++b]; + + newcol = ((a/8)+1)*8; + while ((Eflag) && (d == L'\t') && (c == L' ') && a <= newcol ) + c = strc[++a]; + if (Eflag && d == L'\t') + d = strd[++b]; + if (Eflag && c == L'\t') + c = strc[++a]; + + if (c != d) { // jackpot++; J[i] = 0; @@ -1166,7 +1179,7 @@ static int readhash(FILE *f) { - int i, space; + int i, space, newcol; wint_t t; int sum; @@ -1176,6 +1189,12 @@ for (i = 0; (t = getwc(f)) != L'\n'; i++) { if (t == L'\r' && strip_cr) continue; + if (t == L'\t' && Eflag) + newcol = ((i/8)+1)*8; + do { + sum = sum * 127 + (int) L' '; + } while (++i < newcol); + if (t == EOF) { if (i == 0) return (0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006230056.o5N0urs3015191>