How to generate non-empty html documentation / invoke ddoc?
Hi, Whatever I have tried so far, no documentation is generated from my .d stuff. Guess my (doxygen biassed) expectation is wrong and (probably that is why) http://www.digitalmars.com/d/2.0/ddoc.html does not ring the bell here. What do I miss? $ cat hello.d /// This program cries hello /* The above line is expected in my documentation */ import std.stio; void main() { writeln( Goeiendag! ); } $ dmd -D -Dd. -Dfhello.html hello.d The html file produced only contains a h1Hello/h1 title and a small footer with the generated-by disclaimer. The in-between part is empty. Should I provide a (.dd??) template somehow? Any advice appreciated. Cheers, Joost.
Re: How to generate non-empty html documentation / invoke ddoc?
On 12/21/2010 05:28 PM, Stanislav Blinov wrote: 21.12.2010 19:16, Joost 't Hart пишет: Hi, Whatever I have tried so far, no documentation is generated from my .d stuff. Guess my (doxygen biassed) expectation is wrong and (probably that is why) http://www.digitalmars.com/d/2.0/ddoc.html does not ring the bell here. What do I miss? $ cat hello.d /// This program cries hello /* The above line is expected in my documentation */ import std.stio; void main() { writeln( Goeiendag! ); } $ dmd -D -Dd. -Dfhello.html hello.d The html file produced only contains a h1Hello/h1 title and a small footer with the generated-by disclaimer. The in-between part is empty. Should I provide a (.dd??) template somehow? Any advice appreciated. If I'm not mistaken, documentation applies to declarations that follow. If you put module hello; after your doc line, you should get it in the documentation. Right! Thanks. Found out additionally that ddoc is sort-of scope aware: If you want to see the doc text attached to some class method, the class itself must also have some documentation. There is some logic in there... yet would be nice to find an overview of all the tricks involved. Cheers, Joost.
Re: sleepy receiveTimeout?
On 12/19/2010 09:56 AM, Nick Voronin wrote: On Sat, 18 Dec 2010 23:19:47 +0100 Joost 't Hartjoost.t.h...@planet.nl wrote: Quoting the documentation: /Suspends the calling thread for at least the supplied period./ What does at least mean here? Is there also an at most? I do not want my friend to end up in cyberspace. :-) Nope, there isn't :) In ordinary multitasking environment there is no guarantee on upper bound. Surely got that bit, but I guess it makes sense to refer a bit more to some good old thread state names: After (exactly!) the given period of suspension the thread returns into ready state. When (if ever) it will become the running thread again depends ... Cheers, Joost
Re: Classes or stucts :: Newbie
On 12/20/2010 04:00 PM, David Currie wrote: I am new to D (like many have done C++ , Java ). Me too. Let's see what we can figure out together :-) Can a class be instantiated on the stack ? eg class C { private int _I1; private int _I2; public: this(int pI) // constructor { _I1 = pI; _I2 = pI + 1; } // ... other methods etc } void f() // just a function { C myC(3); // C++ syntax BUT is there a d equivalent } It appears that D ASSUMES myC is really a myC*(in C++) It is not so much a *, but reference semantics (like T param in C++). and therefore requires C myC = new C(3); // but this ALWAYS requires calling the memory allocator // this is what Java does (forces your Class instance onto the Heap) Is there any way in D to instantiate a stack object ? Not a class object. Only values are on the stack. The reference semantics requires a living entity to refer to. Will a struct do? Yes, if you so wish, but new also works. Structs have value semantics. Does a struct have a constructor (as opposed to an opcall?) You can define one, but you cannot redefine the default this() constructor. Because structs have value semantics, D wants to make sure that T.init member values are slotted in by default. Note that T.init for a class type is the null reference. I would be very grateful for a response. Hope this helps a bit. Cheers, Joost. David Currie
sleepy receiveTimeout?
Hi, (also posted on news.gmane.org, but does not seem to appear there) New to this group and to D, but getting into it fast. Came across a problem. 2.050 / Linux 1) On windows we can get any (std.concurrency, which is what I use in my project) thread to sleep using Sleep() from core.sys.windows.windows. I cannot find the alternative under Linux... Is there one? 2) So I wrote one myself using receiveTimeout( time, (something unused){} ); Now begins the fun. For values of time = 500 this workaround is fine. For values 500 it does not work. Where does this magic number sit? Cheers, Joost. $ cat time.d import std.concurrency; import std.conv; void run( long tim ) { foreach( dum; 0 .. 100 ) { receiveTimeout( tim, (int x){} ); } } void main( string[] args ) { run( to!long( args[1] ) ); } $ time ./time 500 real0m49.673s user0m0.000s sys0m0.000s $ time ./time 499 real0m0.972s user0m0.000s sys0m0.000s $
Re: sleepy receiveTimeout?
On 12/18/2010 10:46 PM, Jonathan M Davis wrote: On Saturday 18 December 2010 13:22:52 Joost 't Hart wrote: Hi, (also posted on news.gmane.org, but does not seem to appear there) New to this group and to D, but getting into it fast. Welcome! Came across a problem. 2.050 / Linux 1) On windows we can get any (std.concurrency, which is what I use in my project) thread to sleep using Sleep() from core.sys.windows.windows. I cannot find the alternative under Linux... Is there one? You're using the wrong function (see http://is.gd/iYySf ). The correct function is core.Thread.sleep(). It works on both Windows and Linux. It's a static function which should work just fine regardless of whether you're using Thread directly or using spawn(). Thanks Jonathan! After another minute of eyebrowing I got it working: import core.thread; void mySleep( long tim_in_millisecs ) { // No, not a simple ::sleep, and please do care about those numbers! Thread.sleep( tim_in_millisecs * 10_000 ); } Quoting the documentation: /Suspends the calling thread for at least the supplied period./ What does at least mean here? Is there also an at most? I do not want my friend to end up in cyberspace. :-) I guess part (2) of my original posting still stands as a candidate bug? Cheers, Joost. - Jonathan M Davis