www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [patch] Phobos without print/printf

reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Modified the Phobos library to
remove Object.print method, and
to move printf back into std.c.stdio...
(based on earlier Phobos patches from
Thomas Kuehne, updated for DMD 0.118
and other D wishlists from last year)


http://www.algonet.se/~afb/d/dmd-0.118-print.patch
 Removes Object.print method, uses Object.toString() now

http://www.algonet.se/~afb/d/dmd-0.118-printf.patch
 Removes global printf, uses writef or std.c.stdio.printf

To use printf now, first "import std.c.stdio;" Or do "import std.stdio;" and just use writef? I did not change the unittest and debugging code, just the ones that were always on... Compiles without warnings, and passes Phobos unittest : http://www.algonet.se/~afb/d/dmd.spec http://www.algonet.se/~afb/d/dmd-0.118-11.nosrc.rpm Tested on Linux (Fedora Core 1), not tested on Windows. --anders
Mar 14 2005
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Anders F Björklund wrote:
<snip>
 To use printf now, first "import std.c.stdio;"
 Or do "import std.stdio;" and just use writef?

Do we have a consensus on the idea of making std.stdio or at least writef/writefln implicitly imported? Just looking at this - printf("Error: %.*s\n", o.toString()); + writefln("Error: %s", o.toString()); how about figuring out how to get these going to the right place (i.e. stderr) while we're at it? (_Is_ this the code that main is implicitly wrapped in, or does that only apply when you start a thread other than the main one?) Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Mar 14 2005
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Stewart Gordon wrote:

 Do we have a consensus on the idea of making std.stdio or at least 
 writef/writefln implicitly imported?

Not that I've heard of. (Theoretically you can still use std.c.stdio) I think you still need to "import std.stdio;"
 how about figuring out how to get these going to the right place (i.e. 
 stderr) while we're at it?  (_Is_ this the code that main is implicitly 
 wrapped in, or does that only apply when you start a thread other than 
 the main one?)

This was not that patch, but it would be something like fwritefln... fwritefln(stderr, "Error: %s", o.toString()); --anders
Mar 14 2005
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
 how about figuring out how to get these going to the right place (i.e. 
 stderr) while we're at it? 

This was not that patch, but it would be something like fwritefln...

Here is the exact patch to reroute exceptions to standard error stream: http://www.algonet.se/~afb/d/dmd-0.118-stderr.patch (it assumes that the print and printf patches have been applied first) --anders
Mar 14 2005