Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 2744

Show
Ignore:
Timestamp:
11/03/07 00:05:41 (4 years ago)
Author:
kris
Message:

fixes #679 :: Stdout cannot print large numbers of objects using varargs

(thanks to dhasenan)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tango/io/Print.d

    r2720 r2744  
    8080        auto print = new Print!(char) (locale, ...); 
    8181        --- 
     82 
     83        Note that Print is *not* intended to be thread-safe. Use either 
     84        tango.util.log.Trace or the standard logging facilities in order  
     85        to enable atomic console I/O 
    8286         
    8387*******************************************************************************/ 
     
    140144        /********************************************************************** 
    141145 
    142                 Unformatted layout, with commas inserted between args 
     146                Unformatted layout, with commas inserted between args.  
     147                Currently supports a maximum of 24 arguments 
    143148 
    144149        **********************************************************************/ 
     
    146151        final Print print (...) 
    147152        { 
    148                 static  T[][] fmt = 
    149                         [ 
    150                         "{}", 
    151                         "{}, {}", 
    152                         "{}, {}, {}", 
    153                         "{}, {}, {}, {}", 
    154                         "{}, {}, {}, {}, {}", 
    155                         "{}, {}, {}, {}, {}, {}", 
    156                         "{}, {}, {}, {}, {}, {}, {}", 
    157                         "{}, {}, {}, {}, {}, {}, {}, {}", 
    158                         "{}, {}, {}, {}, {}, {}, {}, {}, {}", 
    159                         "{}, {}, {}, {}, {}, {}, {}, {}, {}, {}", 
    160                         "{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}", 
    161                         "{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}", 
    162                         ]; 
    163                 
    164                 assert (_arguments.length <= fmt.length); 
     153                static  T[] slice =  "{}, {}, {}, {}, {}, {}, {}, {}, " 
     154                                     "{}, {}, {}, {}, {}, {}, {}, {}, " 
     155                                     "{}, {}, {}, {}, {}, {}, {}, {}, "; 
     156 
     157                assert (_arguments.length <= slice.length/4, "Print :: too many arguments"); 
    165158 
    166159                if (_arguments.length is 0) 
    167160                    output.flush; 
    168161                else 
    169                    convert (&sink, _arguments, _argptr, fmt[_arguments.length - 1]); 
     162                   convert (&sink, _arguments, _argptr, slice[0 .. _arguments.length * 4 - 2]); 
    170163                          
    171164                return this;