Proposal for a Rosettacode task

Adam D. Ruppe destructionator at gmail.com
Fri Oct 18 19:46:07 PDT 2013


On Saturday, 19 October 2013 at 00:19:34 UTC, bearophile wrote:
> A D solution is welcome.

I implemented one solution:

http://arsdnet.net/dcode/asciiarttable.d

My parser is kinda minimal, it just counts the bits and doesn't 
strictly validate, though there are some asserts there. It also 
supports larger values like:

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                      ID                       |
|                                               |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

is 32 bits. It makes a ubyte[size] to hold the data, ensuring the 
exact layout the diagram proscribes without worrying too much 
about endianness.

It uses property functions for getting and setting everything, 
with asserts to ensure things are in the right range.


Anyway, the make thing is a code generator that spits out an 
anonymous struct. You can just mix it in to a named struct (as I 
did in the file there) to use it.


More information about the Digitalmars-d mailing list