Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread sanjayss via Digitalmars-d-learn
On Thursday, 12 May 2016 at 22:51:17 UTC, Andrew Edwards wrote: The following preprocessor directives are frequently encountered in C code, providing a default constant value where the user of the code has not specified one: #ifndef MIN #define MIN 99 #endif

Re: Need help understanding exception...

2016-02-20 Thread sanjayss via Digitalmars-d-learn
On Sunday, 21 February 2016 at 06:24:54 UTC, sanjayss wrote: On Sunday, 21 February 2016 at 01:06:16 UTC, Ali Çehreli wrote: [...] Thanks. That helps. I am making the stdin non-blocking (but reverting it back before doing the readln()) -- maybe that is causing some problems. Will follow this

Re: Need help understanding exception...

2016-02-20 Thread sanjayss via Digitalmars-d-learn
On Sunday, 21 February 2016 at 01:06:16 UTC, Ali Çehreli wrote: On 02/20/2016 04:45 PM, sanjayss wrote: > [...] basically "line > [...] is saying. > [...] ioctls and > [...] this, but > [...] am doing > [...] issue). > [...] std.stdio.readlnImpl(shared(core.stdc.stdio._IO_FILE)*, ref > [...] Jud

Need help understanding exception...

2016-02-20 Thread sanjayss via Digitalmars-d-learn
I got the following exception on a line of code that is basically "line = readln()" and need help in understanding what the exception is saying. (I am playing around with stdio prior to this using unix ioctls and maybe I am messing something up in the process resulting in this, but understandin

Re: Problem with release build.

2016-02-08 Thread sanjayss via Digitalmars-d-learn
Ignore this -- this is probably due to how I am doing the assert(). In the release build, it is getting compiled out and in the process compiling out the tcgetattr and the tcsetattr. On Tuesday, 9 February 2016 at 05:08:20 UTC, sanjayss wrote: In the following sample program (which tries

Problem with release build.

2016-02-08 Thread sanjayss via Digitalmars-d-learn
In the following sample program (which tries to set terminal to raw mode and check for key presses), compiling as usual (dmd t.d), the program works, but compiling in release mode (dmd -release t.d) and the raw mode doesn't seem to work. Where do I start looking to figure this out or if it is o

std.socket question

2016-02-03 Thread sanjayss via Digitalmars-d-learn
Are the functions lastSocketError() and wouldHaveBlocked() from std.socket thread-safe? i.e. can they be reliably used to see the status of the last socket call when sockets are being read/written in multiple threads?

Re: core.sys.posix.sys.ioctl

2016-01-27 Thread sanjayss via Digitalmars-d-learn
On Friday, 15 January 2016 at 21:49:38 UTC, Adam D. Ruppe wrote: On Friday, 15 January 2016 at 21:21:26 UTC, sanjayss wrote: Is the contribution process straightforward. For this, yes. Should be able to just fork druntime and edit the ioctl.d that exists to flesh it out to be more complete.

Re: core.sys.posix.sys.ioctl

2016-01-15 Thread sanjayss via Digitalmars-d-learn
On Friday, 15 January 2016 at 18:34:14 UTC, Adam D. Ruppe wrote: On Friday, 15 January 2016 at 18:32:22 UTC, sanjayss wrote: Is there any reason that this module is not complete for platforms other than Linux Nobody has written it up, except the parts they use. Is the contribution process st

core.sys.posix.sys.ioctl

2016-01-15 Thread sanjayss via Digitalmars-d-learn
Is there any reason that this module is not complete for platforms other than Linux -- the ioctl() system call is common across all Unix-like OSes, so it doesn't make sense that this is only partially supported. (I am using the latest DMD).

concurrency and standard logger of std.experimental.logger

2016-01-09 Thread sanjayss via Digitalmars-d-learn
Is there a way to include some form of thread-id in the standard logger log messages without resorting to the use of the 'f' functions to log this info too?

Re: std.experimental.logger

2016-01-05 Thread sanjayss via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 09:18:21 UTC, Robert burner Schadek wrote: On Tuesday, 5 January 2016 at 02:44:48 UTC, sanjayss wrote: I'm doing the following: import std.experimental.logger; int main(string[] args) { sharedLog = new FileLogger("logfile.log"); log("Test log 1"); log("Test log 2

Re: std.experimental.logger

2016-01-04 Thread sanjayss via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 02:49:01 UTC, Mike wrote: On Tuesday, 5 January 2016 at 02:44:48 UTC, sanjayss wrote: I'm doing the following: import std.experimental.logger; int main(string[] args) { sharedLog = new FileLogger("logfile.log"); log("Test log 1"); log("Test log 2"); log("Test log

std.experimental.logger

2016-01-04 Thread sanjayss via Digitalmars-d-learn
I'm doing the following: import std.experimental.logger; int main(string[] args) { sharedLog = new FileLogger("logfile.log"); log("Test log 1"); log("Test log 2"); log("Test log 3"); } and I expected the logs to be seen in the logfile.log, but it seems like my reading of the docs on this is

Re: socketpair

2015-12-31 Thread sanjayss via Digitalmars-d-learn
On Thursday, 31 December 2015 at 07:48:03 UTC, Vladimir Panteleev wrote: On Thursday, 31 December 2015 at 02:37:07 UTC, sanjayss wrote: OK; one way I realized was to put the network socket select in one thread and the watching for keypress in another thread and then use the concurrency primitiv

Re: socketpair

2015-12-30 Thread sanjayss via Digitalmars-d-learn
On Thursday, 31 December 2015 at 02:31:09 UTC, sanjayss wrote: On Thursday, 31 December 2015 at 02:26:23 UTC, Rikki Cattermole wrote: On 31/12/15 3:22 PM, sanjayss wrote: [...] Wrong tool for the job. You want message passing not sockets to communicate between threads in this case. You're

Re: socketpair

2015-12-30 Thread sanjayss via Digitalmars-d-learn
On Thursday, 31 December 2015 at 02:26:23 UTC, Rikki Cattermole wrote: On 31/12/15 3:22 PM, sanjayss wrote: std.socket supports the socketpair() function, but it seems like this api is not really usable in any of the concurrency primitives supported by D. So what is the purpose of the socketpa

socketpair

2015-12-30 Thread sanjayss via Digitalmars-d-learn
std.socket supports the socketpair() function, but it seems like this api is not really usable in any of the concurrency primitives supported by D. So what is the purpose of the socketpair() support? Basically I am trying to create two threads and am trying to use socketpair() to create two s