www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6239] New: HTOD: Add support for converting opaque C types to D

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6239

           Summary: HTOD: Add support for converting opaque C types to D
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: htod
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2011-07-01
22:24:57 PDT ---
E.g.:

typedef struct _cairo_device cairo_device_t;

htod translates this incorrectly to:
alias _cairo_device cairo_device_t;

The closest D idiom to this is:
typedef void cairo_device_t;

Or if typedef is ultimately killed maybe alias would work:
alias void cairo_device_t;

There's a ton of this stuff in C header files. :/

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 01 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6239



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2011-07-01
22:27:52 PDT ---
For what it's worth this helps for us porting monkeys:

regex: alias \w+
replace with: typedef void

But you have to do this manually..

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 01 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6239



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2011-07-01
22:33:59 PDT ---
Well crap that's not good, it needs to be:
typedef void cairo_device_t;
typedef void _cairo_device;

Stupid C APIs!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 01 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6239


Mike Parker <aldacron gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldacron gmail.com


--- Comment #3 from Mike Parker <aldacron gmail.com> 2011-07-02 04:05:53 PDT ---
Wouldn't it be more appropriate to translate it as:

struct cairo_device_t {}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 02 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6239


Jacob Carlborg <doob me.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |doob me.com


--- Comment #4 from Jacob Carlborg <doob me.com> 2011-07-02 06:08:47 PDT ---
The most correct translation would be:

struct cairo_device_t;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 02 2011