[Kde-bindings] Re: [Kde-java] Re: GCJ (Re: Build system for KDE4)

Richard Dale Richard_Dale at tipitina.demon.co.uk
Sat Jun 18 04:52:16 UTC 2005

On Saturday 18 June 2005 04:35, Ashley Winters wrote:
> Richard,
> I looked at the KDE source and got an idea how to grab the comments
> without parsing. I'm already fiddling with the pre-processor output
> using perl (from my last e-mail), so how about we get it to convert the
> javadoc comments into C strings for gcc?
> Example:
>     /**
>      * The same as the above constructor, but with a KGuiItem providing
>      * the text and icon.
>      *
>      * @param item The KGuiItem with the label and (optional) icon.
>      */
>      void func(...);
> Becomes:
>     // we need to encode spaces, or else the -fdump parser dies
>     void __SMOKE_COMMENT_123(const char *comment = "/**%0A"
> "%20%20%20%20%20%20*%20the%20text%20and%20icon.%0A"
> .....*/");
>     void func(...);
> GCC dumps the value of default arguments, and I could save the default
> argument to __SMOKE_COMMENT.XXX() functions and attach them to the next
> function declared (in document order).
> The only parsing required would be m,/\*\*.*?\*/, match.
OK, that sounds as though it would work. I was thinking of extracting the 
comments and reconciling with the xml generated from the translation unit in 
a seperate phase. 

The only other problem I can think of at the moment is that this solution 
depends on gcc, and maybe not every machine has that compiler. Perhaps that 
would mean we would need to check the generated Smoke sources into the svn, 
rather than generate them as part of a make command to build the lib.

> Also, the XML output includes all the argument names. We could
> implement named args!
> $foo->method(-arg => "value");  # perl5
> foo.method(:arg => "value");    # ruby
> foo.method(arg:"value");        # python
> $foo.method(:arg<value>);       $ perl6
> foo at method ~arg:"value"         # ocaml
> We just need to prod the trolls to provide names for all the arguments
> we want to use. :)
Yes good, named args are essential for Squeak Smalltalk or Objective-C 
bindings, and it's nice they're included in the Qt4 moc format. Otherwise you 
have to make up a name based on the type of the arg.

-- Richard

More information about the Kde-bindings mailing list