Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jun 2010 01:36:15 GMT
From:      Benjamin Fiedler <bfiedler@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 180087 for review
Message-ID:  <201006220136.o5M1aFr8022025@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@180087?ac=10

Change 180087 by bfiedler@freebsd-7803 on 2010/06/22 01:36:13

	Add --horizon-lines option

Affected files ...

.. //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#3 edit
.. //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.h#3 edit
.. //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#3 edit

Differences ...

==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#3 (text+ko) ====

@@ -48,6 +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	 format, status;
 int	 fcase_behave = FCASE_SENSITIVE;
 unsigned long long context;
@@ -65,6 +66,7 @@
 	TOFILE_OPT,
 	UNIDIR_OPT,
 	STRIPCR_OPT,
+	HORIZ_OPT,
 	NOOP_OPT,
 
 	LEFTC_OPT,
@@ -89,6 +91,7 @@
 	{ "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},
 	{ "text",			no_argument,		NULL,	'a' },
 	{ "ignore-blank-lines",		no_argument,		NULL,	'B' },
 	{ "ignore-space-change",	no_argument,		NULL,	'b' },
@@ -124,7 +127,6 @@
 /* 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.
-	{ "horizon-lines",		required_argument,	NULL,	NOOP_OPT },
 	{ "left-column",		no_argument,		NULL,	NOOP_OPT },
 	{ "line-format",                required_argument,      NULL,   NOOP_OPT },
 	{ "show-function-line",		required_argument,	NULL,	'F' },
@@ -323,6 +325,15 @@
                         } else 
                                 tabsize = 8;
                         break; 
+		case HORIZ_OPT:
+                        if (optarg != NULL) {
+                                context = strtol(optarg, &ep, 10);
+                                if (*ep != '\0' || context < 1 || context >=ULLONG_MAX)
+                                        err(2, "context out of range\n");
+                                horizon= (int)context;
+                        } 
+                        break; 
+
 		case NOOP_OPT:
 			/* noop, compatibility */
 			break;

==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.h#3 (text+ko) ====

@@ -84,7 +84,7 @@
 
 extern int	 aflag, bflag, Bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag,
 		 sflag, tflag, Tflag, wflag, uniflag, strip_cr, tabsize;
-extern int	 format, status;
+extern int	 format, status, horizon;
 extern int	 fcase_behave;
 extern unsigned long long context;
 extern char	*start, *ifdefname, *diffargs, *label[2], *ignore_pats;

==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#3 (text+ko) ====

@@ -529,6 +529,12 @@
 	    file[0][len[0] - suff].value == file[1][len[1] - suff].value;
 	    suff++)
 		;
+
+	if(horizon) {
+		suff = (suff - horizon) < 0 ? 0 : suff - horizon;
+		pref = (pref - horizon) < 0 ? 0 : pref - horizon;
+	}
+	
 	for (j = 0; j < 2; j++) {
 		sfile[j] = file[j] + pref;
 		slen[j] = len[j] - pref - suff;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006220136.o5M1aFr8022025>