Re: OpenCL bindings

2013-03-20 Thread Mike Parker
On Tuesday, 19 March 2013 at 15:03:11 UTC, Lemonfiend wrote: I see. That's a larger project than I'd hoped. Considering I've never created a binding before, is there some kind of tutorial/recommended reading available? There's a page at dlang.org[1], and I have a series of 5 blog posts

Re: OpenCL bindings

2013-03-20 Thread Andrea Fontana
On Wednesday, 20 March 2013 at 08:13:45 UTC, Mike Parker wrote: On Tuesday, 19 March 2013 at 15:03:11 UTC, Lemonfiend wrote: I see. That's a larger project than I'd hoped. Considering I've never created a binding before, is there some kind of tutorial/recommended reading available?

Re: recursive equal, and firstDifference functions

2013-03-20 Thread Dan
On Wednesday, 20 March 2013 at 03:10:41 UTC, Jonathan M Davis wrote: The way == is defined is very clean and straightforward. There _are_ bugs which complicate things (e.g. http://d.puremagic.com/issues/show_bug.cgi?id=3789 ), but those can and will be fixed. The design itself is solid.

Re: OpenCL bindings

2013-03-20 Thread Jacob Carlborg
On 2013-03-20 12:09, Andrea Fontana wrote: You're missing dstep. Using dstep I converted some c-libraries in short time. It's quite easy to use and usually just some minor modification are needed to adjust auto-generated d interface. I was just about to suggest to use dstep. I'm glad to see

Re: OpenCL bindings

2013-03-20 Thread Mike Parker
On Wednesday, 20 March 2013 at 12:43:13 UTC, Jacob Carlborg wrote: On 2013-03-20 12:09, Andrea Fontana wrote: You're missing dstep. Using dstep I converted some c-libraries in short time. It's quite easy to use and usually just some minor modification are needed to adjust auto-generated d

Re: OpenCL bindings

2013-03-20 Thread Andrea Fontana
On Wednesday, 20 March 2013 at 12:43:13 UTC, Jacob Carlborg wrote: On 2013-03-20 12:09, Andrea Fontana wrote: You're missing dstep. Using dstep I converted some c-libraries in short time. It's quite easy to use and usually just some minor modification are needed to adjust auto-generated d

looking for V[string] workarounds

2013-03-20 Thread Dan
Can the following be made to build and run, but keep the intent of what is shown. I realize it touches on several bugs related to const, postblit, and map - but I'm having trouble finding the magic combination. The idea is simply have assets store multiple series of data in a map indexed by

Re: SocketStream and weird 0xA character

2013-03-20 Thread Regan Heath
On Sun, 17 Feb 2013 16:53:23 -, Lubos Pintes lubos.pin...@gmail.com wrote: I am writing little program which downloads simple data file from server through HTTP. The file is static, but updated regularly, so I am using Range: bytes header to optimize the traffic a bit. After I analyzed

Re: looking for V[string] workarounds

2013-03-20 Thread Ali Çehreli
On 03/20/2013 07:34 AM, Dan wrote: Can the following be made to build and run, but keep the intent of what is shown. I realize it touches on several bugs related to const, postblit, and map - but I'm having trouble finding the magic combination. The idea is simply have assets store multiple

Re: looking for V[string] workarounds

2013-03-20 Thread Dan
On Wednesday, 20 March 2013 at 17:11:02 UTC, Ali Çehreli wrote: The code compiles with 2.062 and an earlier version of 2.063 if you accept letting go of const-correctness there: this(Series[string] source) { Thanks Ali. But, removing const there then requires non-const instances to be

Re: looking for V[string] workarounds

2013-03-20 Thread Ali Çehreli
On 03/20/2013 10:24 AM, Dan wrote: On Wednesday, 20 March 2013 at 17:11:02 UTC, Ali Çehreli wrote: The code compiles with 2.062 and an earlier version of 2.063 if you accept letting go of const-correctness there: this(Series[string] source) { Thanks Ali. But, removing const there then

Re: recursive equal, and firstDifference functions

2013-03-20 Thread Jonathan M Davis
On Wednesday, March 20, 2013 12:47:38 Dan wrote: I would imagine by now there is a fair amount of code that might rely on a false result from opEquals if the members (slices, associative arrays) are not bitwise the same. I think that it's more likely that there's a lot of code that expects

initializing const maps with value types having aliasing

2013-03-20 Thread Dan
The following works and is the only way I have found to initialize m. Unfortunately it requires the cast. Is this safe to do? Is there a better way? Is this a bug or are future features coming to clean it up? Thanks Dan -- import std.stdio; struct S {

Re: A little of coordination for Rosettacode

2013-03-20 Thread ixid
On Tuesday, 19 March 2013 at 18:53:21 UTC, bearophile wrote: Small changes on your version: http://codepad.org/E9KHKvAi It's now on Rosettacode. I have added more changes to make it able to deal with immutable input. Bye, bearophile Another issue to consider as the question I was

Re: initializing const maps with value types having aliasing

2013-03-20 Thread Jonathan M Davis
On Wednesday, March 20, 2013 19:41:00 Dan wrote: The following works and is the only way I have found to initialize m. Unfortunately it requires the cast. Is this safe to do? Is there a better way? Is this a bug or are future features coming to clean it up? Thanks Dan

Re: A little of coordination for Rosettacode

2013-03-20 Thread bearophile
ixid: The prime factorization of 1 is an empty set, so surely to be correct it should return [] when given 1 and not throw an exception. The Task says that the input can't be 1, so the input 1 needs to be a pre-condition violation: Write a function which returns an array or collection

Re: OpenCL bindings

2013-03-20 Thread Jacob Carlborg
On 2013-03-20 14:25, Mike Parker wrote: Can dstep output function declarations as aliased function pointers in the format I use in Derelict? I guess I could make an option for that. -- /Jacob Carlborg

Re: OpenCL bindings

2013-03-20 Thread Jacob Carlborg
On 2013-03-20 14:59, Andrea Fontana wrote: *Very* useful. I hope it will be updated with some small changes (like anonymous struct alias replacement and d keyword replacement) :) It should already to D keyword replacement, if not, please report an issue with a test case:

Re: initializing const maps with value types having aliasing

2013-03-20 Thread bearophile
Dan: this(this) { x = x.dup; } I think this(this) doesn't work well with const. cast(S[string])m = [ foo : S(['a']) ]; I think I have never seen code like that. What's the meaning? :-) (Also if you remove that cast then dmd gives bad error messages with no line numbers: Error:

Re: initializing const maps with value types having aliasing

2013-03-20 Thread Dan
On Wednesday, 20 March 2013 at 19:01:27 UTC, Jonathan M Davis wrote: Why are you casting? The cast shouldn't be necessary, because you're doing the initialization inside a static constructor. Without it I get: Error: mutable method cmap.S.__postblit is not callable using a const object

Re: Trying to implement a reference counting mechanism

2013-03-20 Thread Mike Wey
On 03/19/2013 11:06 PM, Martin wrote: http://pastebin.com/8M2EuyfT I'm fairly new to D, but would this work? Obviously I would need to make my own kind of associative array that uses manual memory management to completely circumvent the GC, but besides that? It looks like your refCount is off

Re: Trying to implement a reference counting mechanism

2013-03-20 Thread Martin
On Wednesday, 20 March 2013 at 19:19:09 UTC, Mike Wey wrote: On 03/19/2013 11:06 PM, Martin wrote: http://pastebin.com/8M2EuyfT I'm fairly new to D, but would this work? Obviously I would need to make my own kind of associative array that uses manual memory management to completely

Re: looking for V[string] workarounds

2013-03-20 Thread Dan
On Wednesday, 20 March 2013 at 17:44:16 UTC, Ali Çehreli wrote: In that case, brute force to the rescue (nc stands for non-const): :) this(const(Series[string]) source) { auto nc_source = cast(Series[string])source; itemToSeries = nc_source.dup; } Wow - that worked. Thanks! I

Re: initializing const maps with value types having aliasing

2013-03-20 Thread Jonathan M Davis
On Wednesday, March 20, 2013 20:15:46 Dan wrote: On Wednesday, 20 March 2013 at 19:01:27 UTC, Jonathan M Davis wrote: Why are you casting? The cast shouldn't be necessary, because you're doing the initialization inside a static constructor. Without it I get: Error: mutable method

Re: OpenCL bindings

2013-03-20 Thread Jacob Carlborg
On 2013-03-20 14:25, Mike Parker wrote: Can dstep output function declarations as aliased function pointers in the format I use in Derelict? BTW, why does it uses aliases and not declare a function pointer directly? -- /Jacob Carlborg

getChar() vs. getChar!true()

2013-03-20 Thread Peter Sommerfeld
In std.json is a function getchar() with this signature: dchar getChar(bool SkipWhitespace = false); But it is called differently: getChar(); // obviously SkipWhitespace = true; getChar!true(); // probably getchar(true) What is the reason for the different notation ? Peter

Re: getChar() vs. getChar!true()

2013-03-20 Thread cal
On Wednesday, 20 March 2013 at 20:11:47 UTC, Peter Sommerfeld wrote: In std.json is a function getchar() with this signature: dchar getChar(bool SkipWhitespace = false); It looks like the signature (line 115) is: dchar getChar(bool SkipWhitespace = false)() Note the extra set of parens at

Re: getChar() vs. getChar!true()

2013-03-20 Thread Ali Çehreli
On 03/20/2013 01:11 PM, Peter Sommerfeld wrote: In std.json is a function getchar() with this signature: dchar getChar(bool SkipWhitespace = false); That 'false' up there is the default value of SkipWhitespace. But it is called differently: getChar(); // obviously SkipWhitespace = true;

Re: getChar() vs. getChar!true()

2013-03-20 Thread Ali Çehreli
On 03/20/2013 01:27 PM, Ali Çehreli wrote: getChar(); // obviously SkipWhitespace = true; No, in that case SkipWhitespace==true. I said No but kept your value. :) I meant No, in that case SkipWhiteSpace==false. Ali

Re: getChar() vs. getChar!true()

2013-03-20 Thread Peter Sommerfeld
cal wrote: On Wednesday, 20 March 2013 at 20:11:47 UTC, Peter Sommerfeld wrote: In std.json is a function getchar() with this signature: dchar getChar(bool SkipWhitespace = false); It looks like the signature (line 115) is: dchar getChar(bool SkipWhitespace = false)() Note the extra set of

Re: OpenCL bindings

2013-03-20 Thread Andrea Fontana
On Wednesday, 20 March 2013 at 19:10:28 UTC, Jacob Carlborg wrote: On 2013-03-20 14:59, Andrea Fontana wrote: *Very* useful. I hope it will be updated with some small changes (like anonymous struct alias replacement and d keyword replacement) :) It should already to D keyword replacement,

Re: getChar() vs. getChar!true()

2013-03-20 Thread Peter Sommerfeld
Ali Çehreli: Aside: bool parameters (regular or template) hurt readability. It would be better to have defined a type similar to std.stdio.KeepTerminator and its use with byLine(): http://dlang.org/phobos/std_stdio.html#.File.byLine I see. On the other hand: For an internal function

Re: OpenCL bindings

2013-03-20 Thread Jacob Carlborg
On 2013-03-20 22:02, Andrea Fontana wrote: Maybe I have a old (binary) version for linux. For example params named out are not replaced with something else (f.e. _out) I checked the history and see that I added a fixed for this for function parameters just after the release. I'm pretty sure

Are there D bindings for Win7's Core Audio anywhere?

2013-03-20 Thread Andrej Mitrovic
It seems to be COM-based, so it should be usable from D.

Re: Are there D bindings for Win7's Core Audio anywhere?

2013-03-20 Thread Andrej Mitrovic
On 3/20/13, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: It seems to be COM-based, so it should be usable from D. Actually slight correction, for example the endpointvolume.h header in the Windows SDK defines both a COM and a C API, but the COM API is probably easier to use.

Re: OpenCL bindings

2013-03-20 Thread Mike Parker
On Wednesday, 20 March 2013 at 19:54:42 UTC, Jacob Carlborg wrote: On 2013-03-20 14:25, Mike Parker wrote: Can dstep output function declarations as aliased function pointers in the format I use in Derelict? BTW, why does it uses aliases and not declare a function pointer directly?