[DDMD] Const-ify the ddoc code

Fairly straightforward, introduced a few casts to call c functions that don't understand const.