Re: Converting void* to D array

2015-04-14 Thread Craig Dillabaugh via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 04:43:39 UTC, Daniel Kozák wrote: On Wed, 15 Apr 2015 04:24:20 + Craig Dillabaugh via Digitalmars-d-learn wrote: Hi. I want to call a C library function that returns a data buffer as a void*. How do I convert the resulting void* into something I can proce

Re: Converting void* to D array

2015-04-14 Thread Daniel Kozak via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 04:43:39 UTC, Daniel Kozák wrote: On Wed, 15 Apr 2015 04:24:20 + Craig Dillabaugh via Digitalmars-d-learn wrote: Hi. I want to call a C library function that returns a data buffer as a void*. How do I convert the resulting void* into something I can proce

Re: Converting void* to D array

2015-04-14 Thread Daniel Kozák via Digitalmars-d-learn
On Wed, 15 Apr 2015 04:24:20 + Craig Dillabaugh via Digitalmars-d-learn wrote: > Hi. > I want to call a C library function that returns a data buffer as > a void*. How do I convert the resulting void* into something I > can process in D? > > //I have the following function from the GDAL

Re: Converting void* to D array

2015-04-14 Thread Daniel Kozák via Digitalmars-d-learn
On Wed, 15 Apr 2015 04:24:20 + Craig Dillabaugh via Digitalmars-d-learn wrote: > Hi. > I want to call a C library function that returns a data buffer as > a void*. How do I convert the resulting void* into something I > can process in D? > > //I have the following function from the GDAL

Converting void* to D array

2015-04-14 Thread Craig Dillabaugh via Digitalmars-d-learn
Hi. I want to call a C library function that returns a data buffer as a void*. How do I convert the resulting void* into something I can process in D? //I have the following function from the GDAL C library. extern(C) CPLErr GDALReadBlock( GDALRasterBandH, int, int, void* ); So I have (GB

Re: DLangUI: Rendering a generated image

2015-04-14 Thread Alex Parrill via Digitalmars-d-learn
I found the `ImageWidget` class in controls.d, but I'm still having the same issue. Tweaked code (replaced the section between `window.mainWidget = baseLayout;` and `baseLayout.addChild((new Button())...` auto img = Ref!DrawBuf(new ColorDrawBuf(W,H)); draw(cast(ColorDrawBuf) (

Re: Two-dimensional slices in D

2015-04-14 Thread Dennis Ritchie via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 15:16:10 UTC, Ivan Kazmenko wrote: On Tuesday, 14 April 2015 at 14:21:41 UTC, Dennis Ritchie wrote: writefln("[%([%(%s, %)]%|\n %)]", [a[4][4 .. $], a[5][4 .. $], a[6][4 .. $], a[7][4 .. $]]); At least this can be done as - writefln("[%([%(%s, %)]%|\n %)]", a[4

DLangUI: Rendering a generated image

2015-04-14 Thread Alex Parrill via Digitalmars-d-learn
What is the simplest way of rendering an application-generated image using DLangUI? I'm trying to render the outputs of some noise-generating functions, along with some controls to alter the parameters of that function. I didn't see an ImageWidget anywhere, so I tried making my own that takes

Re: DMD 64 bit on Windows

2015-04-14 Thread Etienne via Digitalmars-d-learn
On 4/14/2015 3:47 PM, Kai Nacke wrote: Short recipe: Download & VisualStudio 2013 Community Edition Download the DMD source OR clone from GitHub repository. Start VS 2013. Open solution dmd_msc_vs10.sln (in folser src) Right click solution dmd_msc_vs10 and select Properties. Change Configuration

Re: DMD 64 bit on Windows

2015-04-14 Thread Kai Nacke via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 01:31:27 UTC, Etienne wrote: I'm currently experiencing Out Of Memory errors when compiling in DMD on Windows Has anyone found a way to compile a DMD x86_64 compiler on Windows? Short recipe: Download & VisualStudio 2013 Community Edition Download the DMD source

String Index Support for IndexedBy

2015-04-14 Thread Nordlöw
I have implemented a type constructor [Ii]ndexedBy at https://github.com/nordlow/justd/blob/master/typecons_ex.d#L97 restricted by https://github.com/nordlow/justd/blob/master/typecons_ex.d#L78 See unittests below for usage. I would now like to extend this to enable a variant usage as au

Re: Two-dimensional slices in D

2015-04-14 Thread Ali Çehreli via Digitalmars-d-learn
On 04/14/2015 07:21 AM, Dennis Ritchie wrote: F#: - printfn "%A" xs.[4 .. 7, 4 .. 9] - D supports that syntax as well: http://dlang.org/operatoroverloading.html#slice I have a simple example here: http://ddili.org/ders/d.en/templates_more.html#ix_templates_more.multi-dimensional%

Re: CTFE UFCs?

2015-04-14 Thread anonymous via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 15:20:37 UTC, bitwise wrote: When I uncomment the nicer syntax, I get the errors below: [1] Error: variable refl cannot be read at compile time [2] Error: CTFE failed because of previous errors in base class Base { double d = 0.4; } class Test : Base { int

Re: CTFE UFCs?

2015-04-14 Thread ketmar via Digitalmars-d-learn
On Tue, 14 Apr 2015 11:20:38 -0400, bitwise wrote: i believe that you can't do what you want in a way you want, 'cause UFCS is not working for template args. but you can do this: alias base(alias CC) = reflect!(CC.baseName()); ... static const(Refl) baseRefl = base!refl; signature.asc Descripti

[dub] Release build fails with 2.067.0

2015-04-14 Thread Chris via Digitalmars-d-learn
Sorry, I forgot the title the first time around! I get the following message from dub when using "--build=release": Linking... .dub/build/myprogram-release-linux.posix-x86_64-dmd_2067-C1A5273464ACE9961E3F3BA6AC04084B/abairtts.o:(.data._D65TypeInfo_xC3std5range10interfaces18__T10InputRangeTiZ10In

CTFE UFCs?

2015-04-14 Thread bitwise via Digitalmars-d-learn
Hi. I've been building a reflection library for D, but I've hit a snag. If anyone can help out, it would be much appreciated =D In the example below, the second line of main() retrieves the reflection of a base class. Everything is well and good. Now, I am trying to come up with a more pl

[dub]

2015-04-14 Thread Chris via Digitalmars-d-learn
I get the following message from dub when using "--build=release": Linking... .dub/build/myprogram-release-linux.posix-x86_64-dmd_2067-C1A5273464ACE9961E3F3BA6AC04084B/abairtts.o:(.data._D65TypeInfo_xC3std5range10interfaces18__T10InputRangeTiZ10InputRange6__initZ+0x10): undefined reference to `

Re: Two-dimensional slices in D

2015-04-14 Thread Ivan Kazmenko via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 14:21:41 UTC, Dennis Ritchie wrote: writefln("[%([%(%s, %)]%|\n %)]", [a[4][4 .. $], a[5][4 .. $], a[6][4 .. $], a[7][4 .. $]]); At least this can be done as - writefln("[%([%(%s, %)]%|\n %)]", a[4..8].map !(b => b[4 .. $])); -

Two-dimensional slices in D

2015-04-14 Thread Dennis Ritchie via Digitalmars-d-learn
Hi, Is it possible to somehow shorter turn to slice on D? Maybe you can use tuples? F#: - printfn "%A" xs.[4 .. 7, 4 .. 9] - D: - writeln([a[4][4 .. $], a[5][4 .. $], a[6][4 .. $], a[7][4 .. $]]); - F#: - let xs = Array2D.init 10 10 (fun x y -> x * 10 + y) printfn "[4 .. 7

Re: IMAP library

2015-04-14 Thread D Denizen since a year via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 14:01:10 UTC, Jens Bauer wrote: On Tuesday, 14 April 2015 at 02:28:40 UTC, Laeeth Isharc wrote: My first 'open source' contribution was to a data structure in his BBS system a few years later. Those were the days. I wrote my own BBS for Atari ST in 1988 (which w

Re: IMAP library

2015-04-14 Thread Jens Bauer via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 02:31:23 UTC, Adam D. Ruppe wrote: You might like my email.d too https://github.com/adamdruppe/arsd/blob/master/email.d It is able to help construct emails and also read an mbox format - part of that code might help your imap library too. This looks very nice. I

Re: IMAP library

2015-04-14 Thread Jens Bauer via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 02:28:40 UTC, Laeeth Isharc wrote: My first 'open source' contribution was to a data structure in his BBS system a few years later. Those were the days. I wrote my own BBS for Atari ST in 1988 (which was never released to the public) - and I started writing a ma

Re: Traits question and compiler crash

2015-04-14 Thread Filippo Fantini via Digitalmars-d-learn
correct link: https://issues.dlang.org/show_bug.cgi?id=14448

Re: Traits question and compiler crash

2015-04-14 Thread Filippo Fantini via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 10:43:16 UTC, anonymous wrote: On Tuesday, 14 April 2015 at 09:24:04 UTC, Filippo Fantini wrote: Hello everyone! I'm new to D. While playing with around with traits, I ended up writing this short example: module test; class Foo { private int _value = 21; v

Re: DMD 64 bit on Windows

2015-04-14 Thread Etienne via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 09:57:55 UTC, wobbles wrote: On Tuesday, 14 April 2015 at 01:31:27 UTC, Etienne wrote: I'm currently experiencing Out Of Memory errors when compiling in DMD on Windows Has anyone found a way to compile a DMD x86_64 compiler on Windows? I've been having this same

Re: Traits question and compiler crash

2015-04-14 Thread anonymous via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 09:24:04 UTC, Filippo Fantini wrote: Hello everyone! I'm new to D. While playing with around with traits, I ended up writing this short example: module test; class Foo { private int _value = 21; void foo() { import std.traits; alias f

Re: DMD 64 bit on Windows

2015-04-14 Thread wobbles via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 01:31:27 UTC, Etienne wrote: I'm currently experiencing Out Of Memory errors when compiling in DMD on Windows Has anyone found a way to compile a DMD x86_64 compiler on Windows? I've been having this same issue. Over-use of CTFE is what's causing it on my part, t

Re: DMD 64 bit on Windows

2015-04-14 Thread Kagamin via Digitalmars-d-learn
Memory overuse is usually reported as a bug in the compiler.

Traits question and compiler crash

2015-04-14 Thread Filippo Fantini via Digitalmars-d-learn
Hello everyone! I'm new to D. While playing with around with traits, I ended up writing this short example: module test; class Foo { private int _value = 21; void foo() { import std.traits; alias funs = MemberFunctionsTuple!( typeof( this ), "bar" ); ve