Thread overview
Conditional compilation and DDoc
Aug 17, 2006
Derek Parnell
Aug 17, 2006
Lutger
Aug 17, 2006
Lutger
Aug 17, 2006
Derek Parnell
Aug 18, 2006
Derek Parnell
Aug 18, 2006
Lutger
August 17, 2006
I'm having trouble producing conditional documentation.

Here's what I'm doing ...

 version(XYZZY)
 {
    /**
    * macros:
    *   Extra = If you access this when the value is not set,
    *           an exception is thrown.
    */
 }
 module foo_m;
 /**
 *   Defines the capabilities and attributes of a Foo.
 *
 *   $(Extra)
 */
 class Foo
 {
    . . .
 }

This doesn't work because the 'module' statement must be the first statement and the earlier version statement messes that up.

If I move the module to above the version statement, the macro doesn't get defined.

Anyone got any ideas about how to produce conditional DDoc documentation without duplicating a lot of source code?

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
17/08/2006 6:10:04 PM
August 17, 2006
Derek Parnell wrote:
> I'm having trouble producing conditional documentation.
> 
> Here's what I'm doing ...
> 
>  version(XYZZY)
>  {
>     /**
>     * macros:
>     *   Extra = If you access this when the value is not set,
>     *           an exception is thrown.
>     */
>  }
>  module foo_m;
>  /**
>  *   Defines the capabilities and attributes of a Foo.
>  *
>  *   $(Extra)
>  */
>  class Foo
>  {
>     . . .
>  }
> 
> This doesn't work because the 'module' statement must be the first
> statement and the earlier version statement messes that up.
> 
> If I move the module to above the version statement, the macro doesn't get
> defined.
> 
> Anyone got any ideas about how to produce conditional DDoc documentation
> without duplicating a lot of source code?
> 

I can't get this to work either. I can think of one, less than ideal workaround (haven't tried it yet): using build, move the macro's to ddoc files and then use something like this:
version (Foo)
{
	version (build) { pragma(include, macros\foo.ddoc); }
	else pragma(msg, "warning, foo doc macro not included, use build");
}
August 17, 2006
Lutger wrote:
> Derek Parnell wrote:
>> I'm having trouble producing conditional documentation.
>>
>> Here's what I'm doing ...
>>
>>  version(XYZZY)
>>  {
>>     /**
>>     * macros:
>>     *   Extra = If you access this when the value is not set,
>>     *           an exception is thrown.
>>     */
>>  }
>>  module foo_m;
>>  /**
>>  *   Defines the capabilities and attributes of a Foo.
>>  *
>>  *   $(Extra)
>>  */
>>  class Foo
>>  {
>>     . . .
>>  }
>>
>> This doesn't work because the 'module' statement must be the first
>> statement and the earlier version statement messes that up.
>>
>> If I move the module to above the version statement, the macro doesn't get
>> defined.
>>
>> Anyone got any ideas about how to produce conditional DDoc documentation
>> without duplicating a lot of source code?
>>
> 
> I can't get this to work either. I can think of one, less than ideal workaround (haven't tried it yet): using build, move the macro's to ddoc files and then use something like this:
> version (Foo)
> {
>     version (build) { pragma(include, macros\foo.ddoc); }
>     else pragma(msg, "warning, foo doc macro not included, use build");
> }

It works, thanks to build.
August 17, 2006
On Thu, 17 Aug 2006 13:21:32 +0200, Lutger wrote:
>> I can think of one, less than ideal
>> workaround (haven't tried it yet): using build, move the macro's to ddoc
>> files and then use something like this:
>> version (Foo)
>> {
>>     version (build) { pragma(include, macros\foo.ddoc); }
>>     else pragma(msg, "warning, foo doc macro not included, use build");
>> }
> 
> It works, thanks to build.

LOL ... nice little tool, that ;-)

-- 
Derek Parnell
Melbourne, Australia
"Down with mediocrity!"
August 18, 2006
On Thu, 17 Aug 2006 13:21:32 +0200, Lutger wrote:

> Lutger wrote:
>> Derek Parnell wrote:
>>> I'm having trouble producing conditional documentation.
>>>
>>> Here's what I'm doing ...
>>>
>>>  version(XYZZY)
>>>  {
>>>     /**
>>>     * macros:
>>>     *   Extra = If you access this when the value is not set,
>>>     *           an exception is thrown.
>>>     */
>>>  }
>>>  module foo_m;
>>>  /**
>>>  *   Defines the capabilities and attributes of a Foo.
>>>  *
>>>  *   $(Extra)
>>>  */
>>>  class Foo
>>>  {
>>>     . . .
>>>  }
>>>
>>> This doesn't work because the 'module' statement must be the first statement and the earlier version statement messes that up.
>>>
>>> If I move the module to above the version statement, the macro doesn't
>>> get
>>> defined.
>>>
>>> Anyone got any ideas about how to produce conditional DDoc documentation without duplicating a lot of source code?
>>>
>> 
>> I can't get this to work either. I can think of one, less than ideal
>> workaround (haven't tried it yet): using build, move the macro's to ddoc
>> files and then use something like this:
>> version (Foo)
>> {
>>     version (build) { pragma(include, macros\foo.ddoc); }
>>     else pragma(msg, "warning, foo doc macro not included, use build");
>> }
> 
> It works, thanks to build.

Confirmed. Using Build to include the macro Ddoc file works.
-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
18/08/2006 10:08:51 AM
August 18, 2006
Derek Parnell wrote:
> On Thu, 17 Aug 2006 13:21:32 +0200, Lutger wrote:
> 
>> Lutger wrote:
>>> Derek Parnell wrote:
>>>> I'm having trouble producing conditional documentation.
>>>>
>>>> Here's what I'm doing ...
>>>>
>>>>  version(XYZZY)
>>>>  {
>>>>     /**
>>>>     * macros:
>>>>     *   Extra = If you access this when the value is not set,
>>>>     *           an exception is thrown.
>>>>     */
>>>>  }
>>>>  module foo_m;
>>>>  /**
>>>>  *   Defines the capabilities and attributes of a Foo.
>>>>  *
>>>>  *   $(Extra)
>>>>  */
>>>>  class Foo
>>>>  {
>>>>     . . .
>>>>  }
>>>>
>>>> This doesn't work because the 'module' statement must be the first
>>>> statement and the earlier version statement messes that up.
>>>>
>>>> If I move the module to above the version statement, the macro doesn't get
>>>> defined.
>>>>
>>>> Anyone got any ideas about how to produce conditional DDoc documentation
>>>> without duplicating a lot of source code?
>>>>
>>> I can't get this to work either. I can think of one, less than ideal workaround (haven't tried it yet): using build, move the macro's to ddoc files and then use something like this:
>>> version (Foo)
>>> {
>>>     version (build) { pragma(include, macros\foo.ddoc); }
>>>     else pragma(msg, "warning, foo doc macro not included, use build");
>>> }
>> It works, thanks to build.
> 
> Confirmed. Using Build to include the macro Ddoc file works. 

Well aren't you lucky somebody wrote that fine little app...