D bindings for Shapefile C Library
Gary Willoughby
dev at nomad.so
Wed Jan 29 06:34:55 PST 2014
A few things i tend to do when porting headers:
1).
https://github.com/craig-dillabaugh/shplib.d/blob/master/source/shapefil.d#L267
'const char *filename' should usually be translated to
'const(char)* filename',
'const double * padfX' => 'const(double)* padfX'
etc..
Reference:
http://forum.dlang.org/thread/qvjjzoxoufxnxzokywgq@forum.dlang.org
2).
https://github.com/craig-dillabaugh/shplib.d/blob/master/source/shapefil.d#L275
Underscores on identifiers that match keywords are usually added
to the end.
Reference:
http://dlang.org/dstyle.html
3).
https://github.com/craig-dillabaugh/shplib.d/blob/master/source/shapefil.d#L263
longs/ulongs tend to be substituted for c_long/c_ulong from
core.stdc.config.
Reference:
http://dlang.org/interfaceToC.html
4).
https://github.com/craig-dillabaugh/shplib.d/blob/master/source/shapefil.d#L721
I tend to add const to all char* types as above.
In general, add 'nothrow' to all functions and move the '*' to be
part of the type. e.g.:
'const(char)* text' instead of 'const(char) *text', this is my
own personal preference though. :p
More information about the Digitalmars-d-announce
mailing list