ddoc - documenting private variables

Charles Hixson charleshixsn at earthlink.net
Mon Oct 8 10:38:54 PDT 2012


On 10/07/2012 12:33 PM, Adam D. Ruppe wrote:
> On Sunday, 7 October 2012 at 19:36:39 UTC, Charles Hixson wrote:
>> FWIW, I have absolutely NO knowledge of JSON, except that it's
>> something to do with web pages (well, and it's a language or possibly
>> a library).
>
>
> I haven't actually used that project (I just saw the link and figured it
> might help) but you can make json with dmd. Run dmd -X -D yourfile.d and
> it spits out yourfile.json.
>
>
> But another option might be to just modify your copy of dmd to output
> private things too. Open the file dmd2/src/dmd/doc.c and search for the
> term PROTprivate. Simply comment that part so it doesn't return. For
> example:
>
>
> void EnumDeclaration::emitComment(Scope *sc)
> {
> if (prot() == PROTprivate)
> return;
>
> Just comment that out and repeat for each time you see it. I count six
> occurrences of that in the dmd source. And then there's this:
>
>
> void Declaration::emitComment(Scope *sc)
> {
> //printf("Declaration::emitComment(%p '%s'), comment = '%s'\n", this,
> toChars(), comment);
> //printf("type = %p\n", type);
>
> if (protection == PROTprivate || !ident ||
> (!type && !isCtorDeclaration() && !isAliasDeclaration()))
> return;
>
>
> And you can probably just comment that protection clause there too.
>
>
> Then recompile the dmd (make -f posix.mak on linux and I think make -f
> win32.mak on windows) and use your customized compiler.

That seems, to me, a much more reasonable solution.  I'm going to flag 
this important.  But I'll probably use DOxygen, because I don't like the 
on-going maintenance, and because ddoc comments are too verbose (more in 
vertical space than in horizontal space).  I'll certainly keep that 
option in mind, however, in case I run into too many limits with DOxygen.


More information about the Digitalmars-d-learn mailing list