www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - wxWidgets good news

reply bls <bizprac orange.fr> writes:
Hi, it seems that the idea of using doxygen xml output to generate D 
bindings was not that bad. I am pretty happy to see that exactly this 
happens in wxWidgets 2.9.4,
https://github.com/wxWidgets/wxWidgets/blob/master/docs/doxygen/scripts/make_bindings.py

Generating C functional wrappers is already pretty cool, but the 
fantastic news is SWIG output! As you may have noticed, SWIG has D 
support. Means :  No need to manually re-create C++ classes in D.

Holy crap.
Jan 20 2012
next sibling parent Andrea Fontana <advmail katamail.com> writes:
!!!

Il giorno ven, 20/01/2012 alle 03.24 -0800, bls ha scritto:

 Hi, it seems that the idea of using doxygen xml output to generate D=20
 bindings was not that bad. I am pretty happy to see that exactly this=20
 happens in wxWidgets 2.9.4,
 https://github.com/wxWidgets/wxWidgets/blob/master/docs/doxygen/scripts/m=
ake_bindings.py
=20
 Generating C functional wrappers is already pretty cool, but the=20
 fantastic news is SWIG output! As you may have noticed, SWIG has D=20
 support. Means :  No need to manually re-create C++ classes in D.
=20
 Holy crap.
=20
Jan 20 2012
prev sibling next sibling parent reply Trass3r <un known.com> writes:
 Generating C functional wrappers is already pretty cool, but the  
 fantastic news is SWIG output! As you may have noticed, SWIG has D  
 support. Means :  No need to manually re-create C++ classes in D.
Does SWIG D support static linking by now?
Jan 20 2012
next sibling parent Andrea Fontana <advmail katamail.com> writes:

shared libraries.

Il giorno ven, 20/01/2012 alle 13.51 +0100, Trass3r ha scritto:

 Generating C functional wrappers is already pretty cool, but the =20
 fantastic news is SWIG output! As you may have noticed, SWIG has D =20
 support. Means :  No need to manually re-create C++ classes in D.
=20 Does SWIG D support static linking by now?
Jan 20 2012
prev sibling parent bls <bizprac orange.fr> writes:
On 01/20/2012 04:51 AM, Trass3r wrote:
 Generating C functional wrappers is already pretty cool, but the
 fantastic news is SWIG output! As you may have noticed, SWIG has D
 support. Means : No need to manually re-create C++ classes in D.
Does SWIG D support static linking by now?
From the docs 20.10 Work in progress and planned features There are a couple of features which are not implemented yet, but would be very useful and might be added in the near future: Static linking: Currently, the C wrapper code is compiled into a dynamic library, out of which the symbol addresses are looked up at runtime by the D part. If statically linking the different languages into one binary was supported, a tool-chain capable of performing IPO at link time could inline the wrapping code, effectively reducing the overhead for simple calls to zero. Maybe someone should send David some cookies :)
Jan 20 2012
prev sibling next sibling parent Gour <gour atmarama.net> writes:
On Fri, 20 Jan 2012 03:24:19 -0800
bls <bizprac orange.fr> wrote:

 Hi, it seems that the idea of using doxygen xml output to generate D=20
 bindings was not that bad. I am pretty happy to see that exactly this=20
 happens in wxWidgets 2.9.4,
Thank you very much for the news!!
 Generating C functional wrappers is already pretty cool, but the=20
 fantastic news is SWIG output! As you may have noticed, SWIG has D=20
 support. Means :  No need to manually re-create C++ classes in D.
Let's see how it would influence wxD. ;) Sincerely, Gour --=20 Those who are on this path are resolute in purpose,=20 and their aim is one. O beloved child of the Kurus,=20 the intelligence of those who are irresolute is many-branched. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Jan 20 2012
prev sibling next sibling parent reply Jimmy Cao <jcao219 gmail.com> writes:
2012/1/20 bls <bizprac orange.fr>

  As you may have noticed, SWIG has D support. Means :  No need to manually
 re-create C++ classes in D.

 Holy crap.
Ah, kudos to David Nadlinger.
Jan 20 2012
parent bls <bizprac orange.fr> writes:
On 01/20/2012 05:33 AM, Jimmy Cao wrote:
 2012/1/20 bls <bizprac orange.fr <mailto:bizprac orange.fr>>

       As you may have noticed, SWIG has D support. Means :  No need to
     manually re-create C++ classes in D.

     Holy crap.


 Ah, kudos to David Nadlinger.
Ya sorry David , I couldn't remember your name. Guess David's help is needed anyway to make wxWidgets 4D a success.
Jan 20 2012
prev sibling next sibling parent reply bls <bizprac orange.fr> writes:
On 01/20/2012 03:24 AM, bls wrote:
 Hi, it seems that the idea of using doxygen xml output to generate D
 bindings was not that bad. I am pretty happy to see that exactly this
 happens in wxWidgets 2.9.4,
 https://github.com/wxWidgets/wxWidgets/blob/master/docs/doxygen/scripts/make_bindings.py


 Generating C functional wrappers is already pretty cool, but the
 fantastic news is SWIG output! As you may have noticed, SWIG has D
 support. Means : No need to manually re-create C++ classes in D.

 Holy crap.
Random thoughts. I think the challege will be to create a reasonable message system. The old WxD projects mimics the MESSAGEMAP() thing. I think a better solution would be to use wxWidgets connect() and to design a D-ish NET like message system. The cleanest D implementation I have seen so far is part of the DGUI project. SWIG : I think we have to modify : https://github.com/wxWidgets/wxWidgets/blob/master/docs/doxygen/s ripts/swig_tools.py a bit, in order to enable SWIG to generate D2 code. Which wxWidget Version ? IMO at least 2.9x to avoid the UNICODE - non UNICODE stress. Probably 2.9.4 is the best choice (doxygen wise) which will arrive AFAIK in February. How to setup the project ? just the modified Python scripts and some docs? Dunno. Thoughts ?
Jan 20 2012
parent Gour <gour atmarama.net> writes:
On Fri, 20 Jan 2012 06:10:20 -0800
bls <bizprac orange.fr> wrote:

 Which wxWidget Version ?
 IMO at least 2.9x to avoid the UNICODE - non UNICODE stress. Probably=20
 2.9.4 is the best choice (doxygen wise) which will arrive AFAIK in
 February.
I agree.
 How to setup the project ? just the modified Python scripts and some=20
 docs?  Dunno.
wxD is now at github, so there is possibility to fork it...personally I prefer hg over git, but can try to use hg-git for the sake of wxD. :-) Sincerely, Gour --=20 Bewildered by the modes of material nature, the ignorant fully=20 engage themselves in material activities and become attached. But=20 the wise should not unsettle them, although these duties are inferior=20 due to the performers' lack of knowledge. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Jan 20 2012
prev sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 1/20/12, bls <bizprac orange.fr> wrote:
 Hi, it seems that the idea of using doxygen xml output to generate D
 bindings was not that bad. I am pretty happy to see that exactly this
 happens in wxWidgets 2.9.4,
 https://github.com/wxWidgets/wxWidgets/blob/master/docs/doxygen/scripts/make_bindings.py
All files in that folder are dated July 2009. Is there some newer script you were referring to? Btw, wxPhp uses doxygen to generate its bindings but it has its own set of parser scripts. They seem to be up to date compared to these python scripts from 2009.
Jan 20 2012
parent reply bls <bizprac orange.fr> writes:
On 01/20/2012 09:02 AM, Andrej Mitrovic wrote:
 On 1/20/12, bls<bizprac orange.fr>  wrote:
 Hi, it seems that the idea of using doxygen xml output to generate D
 bindings was not that bad. I am pretty happy to see that exactly this
 happens in wxWidgets 2.9.4,
 https://github.com/wxWidgets/wxWidgets/blob/master/docs/doxygen/scripts/make_bindings.py
All files in that folder are dated July 2009. Is there some newer script you were referring to?
Wish I am able to send you more recent code :( I have been a bit confused due to the "last changes information" on GIT. Inspiration comes from The wxDesigner Blog "Documentation in Doxygen" http://www.wxdesigner-software.de/WoWoW30.html 2.9.3 changes.txt - Documentation for wxWidgets has been converted from LaTex to C++ headers with Doxygen comments and significantly improved in the process. SORRY !!!
 Btw, wxPhp uses doxygen to generate its bindings but it has its own
 set of parser scripts. They seem to be up to date compared to these
 python scripts from 2009.
Unti version 2.8 x wxPHP is using GCCXML Output. The author is THINKING about using Doxygen's XML ouput. Except a small PHP script there is nothing concrete atm. *Update*---- Just had a look at http://wxphp.org/wxphp/blog/commit-of-new-version. This means wxWidgets doxygen xml output is reality. And the old Python scripts are sill useful. Again, sorry for being not careful enough. Bjoern
Jan 20 2012
next sibling parent Marianne gagnon <auria..mg gmail.com> writes:
Hi,

 All files in that folder are dated July 2009. Is there some newer
 script you were referring to?
Wish I am able to send you more recent code :(
check the Phoenix project in wxWidgets SVN. It doesn't generate SWIG though, it generates SIP. But the infrastructure could be reused -- Auria
Jan 20 2012
prev sibling parent reply bls <bizprac orange.fr> writes:
Hi Andrej,
 From : http://wxphp.org/wxphp/blog/commit-of-new-version
"
Theres a new xml parser as I wrote in some older news that extract the 
details of wxWidgets *doxoygen* documentation.
"

-> The doxygen xml files can be used to create D bindings .
Jan 20 2012
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
I began porting those php scripts to D since yesterday. They are well
documented and modularized so I think it's worth having a go at it.
Oddly enough I've cloned the wxPhp svn repo yesterday without even
knowing they've just merged these new changes in at the same time.
Cool.

You've mentioned those python swig generators. I don't know the state
of those, but I really doubt that SWIG support for D is mature enough
for such a huge project. Additionally wxPython uses SWIG, and SWIG
supports Python for many years now, but even so the wxPython author
wants to move away from SWIG and use doxygen or some other alternative
instead. See: http://wiki.wxpython.org/ProjectPhoenix/ProjectGoals I
also took a look at wxPython's SWIG interface files and it's *a lot*
of code and workarounds.

So I'm trying to port those php scripts and see if it's usable for D.
When I have some scripts done I'll put them on github somewhere. Of
course I'm not stopping anyone else from doing the same..
Jan 20 2012
next sibling parent reply Gour <gour atmarama.net> writes:
On Fri, 20 Jan 2012 22:09:48 +0100
Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:

 I began porting those php scripts to D since yesterday. They are well
 documented and modularized so I think it's worth having a go at it.
 Oddly enough I've cloned the wxPhp svn repo yesterday without even
 knowing they've just merged these new changes in at the same time.
Thank you for this work...I must admit I wasn't eve naware there is wxPhp project since this thread today.
 You've mentioned those python swig generators. I don't know the state
 of those, but I really doubt that SWIG support for D is mature enough
 for such a huge project.=20
Still, it would be worth exploring that route, right?...and ask for more D support?
 Additionally wxPython uses SWIG, and SWIG
 supports Python for many years now, but even so the wxPython author
 wants to move away from SWIG and use doxygen or some other alternative
 instead. See: http://wiki.wxpython.org/ProjectPhoenix/ProjectGoals I
 also took a look at wxPython's SWIG interface files and it's *a lot*
 of code and workarounds.
Yeah, that's true. Robert wants to use SIP and he told me there is lot of hand-written code for SWIG. However, let's not forget that wxPython is also,afaik, offering higher-level (aka Pythonic) interface to wx, so I bet we would like to have same with wxD, right?
 So I'm trying to port those php scripts and see if it's usable for D.
 When I have some scripts done I'll put them on github somewhere.=20
Thank you very much!
 Of course I'm not stopping anyone else from doing the same..
At the moment, I do not have much time to do anything with (wx)D, even not much with computers, but we hope it will change in a few weeks. Sincerely, Gour --=20 As a strong wind sweeps away a boat on the water,=20 even one of the roaming senses on which the mind=20 focuses can carry away a man's intelligence. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Jan 20 2012
parent reply Brad Anderson <eco gnuk.net> writes:
On Fri, Jan 20, 2012 at 2:43 PM, Gour <gour atmarama.net> wrote:

 On Fri, 20 Jan 2012 22:09:48 +0100
 Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:

 I began porting those php scripts to D since yesterday. They are well
 documented and modularized so I think it's worth having a go at it.
 Oddly enough I've cloned the wxPhp svn repo yesterday without even
 knowing they've just merged these new changes in at the same time.
Thank you for this work...I must admit I wasn't eve naware there is wxPhp project since this thread today.
 You've mentioned those python swig generators. I don't know the state
 of those, but I really doubt that SWIG support for D is mature enough
 for such a huge project.
Still, it would be worth exploring that route, right?...and ask for more D support?
 Additionally wxPython uses SWIG, and SWIG
 supports Python for many years now, but even so the wxPython author
 wants to move away from SWIG and use doxygen or some other alternative
 instead. See: http://wiki.wxpython.org/ProjectPhoenix/ProjectGoals I
 also took a look at wxPython's SWIG interface files and it's *a lot*
 of code and workarounds.
Yeah, that's true. Robert wants to use SIP and he told me there is lot of hand-written code for SWIG. However, let's not forget that wxPython is also,afaik, offering higher-level (aka Pythonic) interface to wx, so I bet we would like to have same with wxD, right?
I occasionally try to think about what sort of changes would be made to the wxWidgets interface to be more idiomatic to D. Signals come to mind (along with delegates wherever possible). Range-based access to the items in certain containers is something that would be useful (wxWidget's container item accessing is a particularly bad part of its API). Probably use D's date/time functionality rather than wxWidget's (or both). There are some stream classes in wxWidgets which could probably be replaced with a range based interface (which would just serve as an adapter between ranges and the streams). It's a shame D doesn't have named parameters because wxWidget's usage would benefit greatly from them (wxWindow and subclasses of it often have 4 or more default parameters that I often need to specify to get to the one parameter I actually want to set). wxSizer's Add method is confusing enough that they added a named parameter idiom version so you could actually read the method call and figure out what is going on. Regards, Brad Anderson
 So I'm trying to port those php scripts and see if it's usable for D.
 When I have some scripts done I'll put them on github somewhere.
Thank you very much!
 Of course I'm not stopping anyone else from doing the same..
At the moment, I do not have much time to do anything with (wx)D, even not much with computers, but we hope it will change in a few weeks. Sincerely, Gour -- As a strong wind sweeps away a boat on the water, even one of the roaming senses on which the mind focuses can carry away a man's intelligence. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Jan 20 2012
parent reply torhu <no spam.invalid> writes:
On 20.01.2012 23:17, Brad Anderson wrote:
 I occasionally try to think about what sort of changes would be made to the
 wxWidgets interface to be more idiomatic to D.  Signals come to mind (along
 with delegates wherever possible).  Range-based access to the items in
 certain containers is something that would be useful (wxWidget's container
 item accessing is a particularly bad part of its API).  Probably use D's
 date/time functionality rather than wxWidget's (or both).  There are some
 stream classes in wxWidgets which could probably be replaced with a range
 based interface (which would just serve as an adapter between ranges and
 the streams).

 It's a shame D doesn't have named parameters because wxWidget's usage would
 benefit greatly from them (wxWindow and subclasses of it often have 4 or
 more default parameters that I often need to specify to get to the one
 parameter I actually want to set).  wxSizer's Add method is confusing
 enough that they added a named parameter idiom version so you could
 actually read the method call and figure out what is going on.
It's also a great benefit to be able to rely on wxWidgets' available examples and documentation, which might outweigh most benefits you can get by improving or D-ifying the API. Adding more convenient ways of doing things on top of the existing API should be fine, though. DWT doesn't add much on top of SWT, but if I recall correctly, the SWT API is already a lot nicer than wxWidgets.
Jan 22 2012
next sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-01-22 20:00, torhu wrote:
 On 20.01.2012 23:17, Brad Anderson wrote:
 I occasionally try to think about what sort of changes would be made
 to the
 wxWidgets interface to be more idiomatic to D. Signals come to mind
 (along
 with delegates wherever possible). Range-based access to the items in
 certain containers is something that would be useful (wxWidget's
 container
 item accessing is a particularly bad part of its API). Probably use D's
 date/time functionality rather than wxWidget's (or both). There are some
 stream classes in wxWidgets which could probably be replaced with a range
 based interface (which would just serve as an adapter between ranges and
 the streams).

 It's a shame D doesn't have named parameters because wxWidget's usage
 would
 benefit greatly from them (wxWindow and subclasses of it often have 4 or
 more default parameters that I often need to specify to get to the one
 parameter I actually want to set). wxSizer's Add method is confusing
 enough that they added a named parameter idiom version so you could
 actually read the method call and figure out what is going on.
It's also a great benefit to be able to rely on wxWidgets' available examples and documentation, which might outweigh most benefits you can get by improving or D-ifying the API. Adding more convenient ways of doing things on top of the existing API should be fine, though. DWT doesn't add much on top of SWT, but if I recall correctly, the SWT API is already a lot nicer than wxWidgets.
The only thing DWT adds is using delegates instead of listeners. -- /Jacob Carlborg
Jan 22 2012
prev sibling parent Gour <gour atmarama.net> writes:
On Sun, 22 Jan 2012 20:00:06 +0100
torhu <no spam.invalid> wrote:

 It's also a great benefit to be able to rely on wxWidgets' available=20
 examples and documentation, which might outweigh most benefits you
 can get by improving or D-ifying the API.  Adding more convenient
 ways of doing things on top of the existing API should be fine,
 though. =20
I believe it's possible to D-ify C++ API so that it's still easy to consult original wx docs as well as have nice higher-level API. At least, it is possible in e.g. wxhaskell... Sincerely, Gour --=20 It is far better to discharge one's prescribed duties, even though=20 faultily, than another's duties perfectly. Destruction in the course=20 of performing one's own duty is better than engaging in another's duties, for to follow another's path is dangerous. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Jan 22 2012
prev sibling parent reply bls <bizprac orange.fr> writes:
On 01/20/2012 01:09 PM, Andrej Mitrovic wrote:
 So I'm trying to port those php scripts and see if it's usable for D.
 When I have some scripts done I'll put them on github somewhere. Of
 course I'm not stopping anyone else from doing the same..
Cool!! Out of curiosity. libxml2 for XPath ? -- I agree with you. Using the doxygen xml files to create the binding is for sure less problematic than using SWIG. Bjoern
Jan 20 2012
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 1/20/12, bls <bizprac orange.fr> wrote:
 Out of curiosity. libxml2 for XPath ?
I'm porting the JSON scripts first. There are already JSON dumps that the php script makes, so I'd like to take advantage of that. Making a 1to1 port is crucial so I don't introduce any bugs (that php scripts creates 500_000 lines of php!). Then I could start tweaking with the code generator functions to see how D code can be generated instead of php code.
Jan 21 2012
next sibling parent reply Gour <gour atmarama.net> writes:
On Sat, 21 Jan 2012 22:29:51 +0100
Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:

Hello Andrej,

 I'm porting the JSON scripts first. There are already JSON dumps that
 the php script makes, so I'd like to take advantage of that. Making a
 1to1 port is crucial so I don't introduce any bugs (that php scripts
 creates 500_000 lines of php!). Then I could start tweaking with the
 code generator functions to see how D code can be generated instead of
 php code.
What do you think or feel, in general, is this approach doable and can produce good-quality wxD bindings? Using Doxygen output, probably takes care of wrapping C API only, while there would still be work to produce higher-level bindings in the sporit of D language, right? Sincerely, Gour --=20 But a person free from all attachment and aversion and able=20 to control his senses through regulative principles of=20 freedom can obtain the complete mercy of the Lord. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Jan 21 2012
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 1/22/12, Gour <gour atmarama.net> wrote:
 Using Doxygen output, probably takes care of wrapping C API only, while
 there would still be work to produce higher-level bindings in the
 sporit of D language, right?
The php generator creates a C API that's built into a DLL and a php OOP wrapper. This is what some sample php code looks like: http://paste.pocoo.org/show/538858/
Jan 22 2012
parent Gour <gour atmarama.net> writes:
On Sun, 22 Jan 2012 19:38:42 +0100
Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:

 The php generator creates a C API that's built into a DLL and a php
 OOP wrapper.=20
It looks as wonderful base to build upon it in 'phase-2'. ;) Sincerely, Gour --=20 One who is not connected with the Supreme can have neither=20 transcendental intelligence nor a steady mind, without which=20 there is no possibility of peace. And how can there be any=20 happiness without peace? http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Jan 23 2012
prev sibling parent bls <bizprac orange.fr> writes:
On 01/21/2012 01:29 PM, Andrej Mitrovic wrote:
 I'm porting the JSON scripts first. There are already JSON dumps that
 the php script makes, so I'd like to take advantage of that........
Porting the JSON output to ... [please insert target here ] Back to XML :) Well, I am not sure about how usable std.json is. Can you tell about your progress, trouble, doubts etc, please ? Bjoern -------------------------------------------------------------------------- IMHO it should be a straight forward task to create constants, enums, globals, and the extern C {} wxWidgets wrapper library. Creating the wxWidgets D class wrappers, well I think it is not exactly rocket science. But heck, maybe it's more difficult than it looks from a first view. ------ Just a few hours ago I found this : http://wxnet.sourceforge.net/apiref/ Move to :Related pages/Notes for contributors... stuff is nevertheless interesting.
Jan 23 2012