On Saturday, 19 October 2013 at 10:58:11 UTC, bearophile wrote:
Adam D. Ruppe:

sure. I didn't format it but if you convert my tabs to spaces and maybe break up some long lines it should be good.

Good, I have reformatted the code (I have chosen a narrow 72/73 line width for the code in that site, to see it well on smaller screens or larger fonts), and I have tried to improve it a little in many details:

http://rosettacode.org/wiki/ASCII_art_diagram_converter

The signature of the nested routine now takes all the variables it works on. I think this code makes it more clear that this routine needs to modify all those variables:

    static void commitCurrent(ref uint anonCount,
                              ref uint totalBits,
                              ref uint currentBits,
                              ref string code,
ref string currentName) pure @safe {

If you want to modify code I suggest you to modify it directly on that site.

Bye,
bearophile

I get following errors when trying to run:

STDERR| asciiart.d(17): Error: pure function 'commitCurrent' cannot call impure function 'text' STDERR| asciiart.d(17): Error: safe function 'asciiart.makeStructFromDiagram.commitCurrent' cannot call system function 'std.conv.text!(uint).text'

Thanks
Dan

Reply via email to