ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs FixCRLF.java
Date Fri, 07 Jul 2000 07:20:17 GMT
bodewig     00/07/07 00:20:17

  Modified:    docs     index.html
               src/main/org/apache/tools/ant/taskdefs FixCRLF.java
  Log:
  Make the length of a TAB customizable.
  
  Suggested by:	Michael B. Allen <Michael_B_Allen@ml.com>
  Submitted by:	Vitaly Stulsky <vitaly_stulsky@yahoo.com>
  Modified by:	James Sieben <EUSJASI@am1.ericsson.se>
  
  Revision  Changes    Path
  1.38      +6 -0      jakarta-ant/docs/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/index.html,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- index.html	2000/07/06 12:30:49	1.37
  +++ index.html	2000/07/07 07:20:16	1.38
  @@ -1230,6 +1230,12 @@
       <td valign="top" align="center">No</td>
     </tr>
     <tr>
  +    <td valign="top">tablength</td>
  +    <td valign="top">The number of characters a TAB stop corresponds to.
  +      Default for this parameter is 8.</td>
  +    <td valign="top" align="center">No</td>
  +  </tr>
  +  <tr>
       <td valign="top">eof</td>
       <td valign="top">Specifies how DOS end of file (control-Z) characters are
         to be handled.  Valid values for this property are:
  
  
  
  1.7       +16 -5     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
  
  Index: FixCRLF.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FixCRLF.java	2000/07/06 16:48:14	1.6
  +++ FixCRLF.java	2000/07/07 07:20:17	1.7
  @@ -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 tlength 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 @@
           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,
               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-1);
               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;
                               };
                           };
  
  
  

Mime
View raw message