Jeremie Pelletier Wrote:
> Walter Bright Wrote:
>
> > Jeremie Pelletier wrote:
> > > Well I've decided to get a look at the dmd2 source and see what I can
> > > contribute to it, only to notice it is very VC++ unfriendly. After a
> > > few hours of work, I finally got it to compile, and it works great,
> > > for the most part.
> >
> > Can you send me the diffs?
> >
>
> Sure, as soon as I figure out why my dmd produces different object code than
> yours. I ran a simple hello world executable and the "hello world" string is
> not properly aligned in the resulting executable, causing garbage to be
> appended by printf. The bug is somewhere between the parsing, which works
> fine, and the object generation (the call to obj_bytes() has the proper data
> pointer, but incorrect nbytes count).
Finally found the bug, which was within a change I made in obj_bytes() to get
it to compile under VC++, but didn't take in account the goto statement :x At
least this little debugging session got me familiar with how dmd and dmc works.
Anywho, the patch file is about 1000 lines long, where should I mail it?
I also made a simple D script to rename all c files to cpp:
---
module conv;
import core.stdc.stdlib, core.stdc.stdio, std.file;
int main(string[] args) {
if(args.length != 2) goto Error;
bool isDir = void;
try isDir = isdir(args[1]);
catch(FileException) {}
if(!isDir) goto Error;
char[256] newpath = void;
bool delegate(DirEntry*) dg = void;
bool rename(DirEntry* de) {
if(de.name[$-2 .. $] == ".c") {
newpath[0 .. de.name.length] = de.name[];
newpath[de.name.length .. de.name.length + 2] = "pp";
.rename(de.name, newpath[0 .. de.name.length + 2]);
}
else if(de.isdir() && de.name[$-2 .. $] != "tk")
listdir(de.name, dg);
return true;
}
dg = &rename;
listdir(args[1], dg);
return 0;
Error:
printf("Usage: %.*s <path>", args[0]);
return 1;
}
---