Here is a pathfile.txt with the spelling of length corrected in a couple
spots :)
-----Original Message-----
From: Vitaly Stulsky [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 06, 2000 1:50 PM
To: [EMAIL PROTECTED]
Subject: Re: enhancements?
Here is a little fix for that little problem.
Vitaly
----- Original Message -----
From: Stefan Bodewig <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 06, 2000 12:26 AM
Subject: Re: enhancements?
> MA> 4) FixCRLF task converts tabs to 8 spaces. Can I specify 4?
>
> This could easily become a religious question - TABs *are* 8 spaces
> wide you know? OK, let's avoid a flame war, send a patch to make that
> an attribute and I'll commit it.
>
> Stefan
Index: FixCRLF.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java,v
retrieving revision 1.5
diff -u -r1.5 FixCRLF.java
--- FixCRLF.java 2000/02/27 01:47:46 1.5
+++ FixCRLF.java 2000/07/06 18:45:06
@@ -94,6 +94,7 @@
private int addcr; // cr: -1 => remove, 0 => asis, +1 => add
private int addtab; // tab: -1 => remove, 0 => asis, +1 => add
private int ctrlz; // eof: -1 => remove, 0 => asis, +1 => add
+ private int tablength = 8; // length of tab in spaces
private File srcDir;
private File destDir = null;
@@ -177,6 +178,15 @@
}
/**
+ * Specify tab length in characters
+ *
+ * @param tabLength specify the length of tab in spaces, has to be a power
of 2
+ */
+ public void setTabLength(String tlength) {
+ tablength = Integer.parseInt(tlength);
+ }
+
+ /**
* Specify how DOS EOF (control-z) charaters are to be handled
*
* @param option valid values:
@@ -226,7 +236,8 @@
project.log("options:" +
" cr=" + (addcr==-1 ? "add" : addcr==0 ? "asis" : "remove") +
" tab=" + (addtab==-1 ? "add" : addtab==0 ? "asis" : "remove") +
- " eof=" + (ctrlz==-1 ? "add" : ctrlz==0 ? "asis" : "remove"),
+ " eof=" + (ctrlz==-1 ? "add" : ctrlz==0 ? "asis" : "remove") +
+ " tablength=" + tablength,
"fixcrlf", project.MSG_VERBOSE);
DirectoryScanner ds = super.getDirectoryScanner(srcDir);
@@ -270,7 +281,7 @@
int outsize = count;
if (addcr != 0) outsize-=cr;
if (addcr == +1) outsize+=lf;
- if (addtab == -1) outsize+=tab*7;
+ if (addtab == -1) outsize+=tab*tablength;
if (ctrlz == +1) outsize+=1;
// copy the data
@@ -294,7 +305,7 @@
col++;
} else {
// advance column to next tab stop
- col = (col|7)+1;
+ col = (col|(tablength-1))+1;
}
break;
@@ -322,9 +333,9 @@
// add tabs until this column would be passed
// note: the start of line is adjusted to match
- while ((diff|7)<col) {
+ while ((diff|(tablength-1))<col) {
outdata[o++]=(byte)'\t';
- line-=7-(diff&7);
+ line-=(tablength-1)-(diff&(tablength-1));
diff=o-line;
};
};