Binding to GSL library

2015-11-25 Thread Radek via Digitalmars-d-learn
Hi, I'm making a trying to bind a gsl library http://www.gnu.org/software/gsl/ so far it was working but when i started binding complex numbers some functions won't work, like trigonometric functions - called they return null. in gsl code complex struct looks like: typedef struct {

Exit with code xx

2015-11-25 Thread Ozan via Digitalmars-d-learn
Hi Is there any overview, list, wiki about what's behind runtime errors like "Program exited with code -11"? Okay, I made a mistake...but it's better to know where and what kind? Thanks & Regards, Ozan

Re: Binding to GSL library

2015-11-25 Thread drug via Digitalmars-d-learn
On 25.11.2015 19:11, Radek wrote: Hi, I'm making a trying to bind a gsl library http://www.gnu.org/software/gsl/ so far it was working but when i started binding complex numbers some functions won't work, like trigonometric functions - called they return null. in gsl code complex struct looks

Re: Binding to GSL library

2015-11-25 Thread Radek via Digitalmars-d-learn
i have found bug. It shoul be alias gsl_complex = _gsl_complex; not alias gsl_complex = _gsl_complex*; On Wednesday, 25 November 2015 at 16:35:06 UTC, drug wrote: A little bit offtopic but do you know about https://github.com/abrown25/gsld? It would be nice to join efforts. Sure, I'll share

Re: Exit with code xx

2015-11-25 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 16:11:09 UTC, Ozan wrote: Hi Is there any overview, list, wiki about what's behind runtime errors like "Program exited with code -11"? Okay, I made a mistake...but it's better to know where and what kind? Thanks & Regards, Ozan That's just normal

Re: Exit with code xx

2015-11-25 Thread Alex Parrill via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 16:11:09 UTC, Ozan wrote: Hi Is there any overview, list, wiki about what's behind runtime errors like "Program exited with code -11"? Okay, I made a mistake...but it's better to know where and what kind? Thanks & Regards, Ozan You know about process

Re: Something about Chinese Disorder Code

2015-11-25 Thread magicdmer via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 12:33:00 UTC, Marc Schütz wrote: On Wednesday, 25 November 2015 at 04:09:29 UTC, magicdmer wrote: On Tuesday, 24 November 2015 at 19:41:12 UTC, Marco Leise wrote: Am Tue, 24 Nov 2015 17:08:33 + schrieb BLM768 : [...] thank you for your

Re: switch with enum

2015-11-25 Thread Meta via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 03:51:48 UTC, tcak wrote: I have seen a code a while ago, but even by looking at documentation, I couldn't have found anything about it. Let's say I have defined an enum; enum Status: ubyte{ Busy = 1, Active = 2 } and received a ubyte value from user.

Re: Creating D bindings for a C library

2015-11-25 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 23:49:26 UTC, cym13 wrote: There are some binding generator the most two famous being htod and dstep: http://wiki.dlang.org/List_of_Bindings#Binding_generators Is htod maintained any more? I had the impression it had kind of fallen by the wayside. I'll give

Re: Creating D bindings for a C library

2015-11-25 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 17:45:48 UTC, ponce wrote: If doing it by hand, some tips here: http://p0nce.github.io/d-idioms/#Porting-from-C-gotchas Cool, thanks. The stuff about using c_long and c_ulong is particularly useful/relevant to my use-case, so it's good to be reminded of

Re: Creating D bindings for a C library

2015-11-25 Thread ponce via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 23:22:24 UTC, Joseph Rushton Wakeling wrote: On Tuesday, 24 November 2015 at 23:14:14 UTC, Joseph Rushton Wakeling wrote: I'm considering creating some D bindings for a C library. I should probably clarify that I know what to do assuming I have to write all

dstep problem: "fatal error: 'limits.h' file not found"

2015-11-25 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
I've just built and installed dstep (on Ubuntu 15.10, using libclang-3.7) but whenever I try to run it on a header file, I run into the error message: File(8AC8E0, "")/usr/include/limits.h:123:16: fatal error: 'limits.h' file not found I suspect this is a libclang problem, but does anyone

AA deterministic order ?

2015-11-25 Thread user-6431 via Digitalmars-d-learn
I know that AA items order does not follow the additions but is the order deterministic ? For example for a given set of items, will they always be ordered in the same way ? (I mean whatever is the way I append them to the AA).

Re: switch with enum

2015-11-25 Thread anonymous via Digitalmars-d-learn
On 25.11.2015 21:06, Meta wrote: ...Which doesn't work because it won't compile without a default case. Is this a recent change? I don't remember D doing this before. Use `final switch`. Ordinary `switch`es need an explicit default case. `final switch`es have to cover all possibilities

Re: Creating D bindings for a C library

2015-11-25 Thread Andy Smith via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 19:40:28 UTC, Joseph Rushton Wakeling wrote: On Wednesday, 25 November 2015 at 17:45:48 UTC, ponce wrote: If doing it by hand, some tips here: http://p0nce.github.io/d-idioms/#Porting-from-C-gotchas Cool, thanks. The stuff about using c_long and c_ulong is

Re: switch with enum

2015-11-25 Thread Meta via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 20:47:35 UTC, anonymous wrote: Use `final switch`. Ordinary `switch`es need an explicit default case. `final switch`es have to cover all possibilities individually. Implicit default cases are not allowed. Ordinary `switch`es need an explicit default case

Re: Creating D bindings for a C library

2015-11-25 Thread Andy Smith via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 21:19:51 UTC, Andy Smith wrote: On Wednesday, 25 November 2015 at 19:40:28 UTC, Joseph Rushton Wakeling wrote: On Wednesday, 25 November 2015 at 17:45:48 UTC, ponce wrote: If doing it by hand, some tips here:

Re: switch with enum

2015-11-25 Thread Anon via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 21:26:09 UTC, Meta wrote: On Wednesday, 25 November 2015 at 20:47:35 UTC, anonymous wrote: Use `final switch`. Ordinary `switch`es need an explicit default case. `final switch`es have to cover all possibilities individually. Implicit default cases are not

Re: switch with enum

2015-11-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 21:26:09 UTC, Meta wrote: Since when? A long time, at least with the -w switch turned on when compiling.

Re: AA deterministic order ?

2015-11-25 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Nov 25, 2015 at 08:24:24PM +, user-6431 via Digitalmars-d-learn wrote: > I know that AA items order does not follow the additions but is the > order deterministic ? > > For example for a given set of items, will they always be ordered in > the same way ? (I mean whatever is the way I

Re: AA deterministic order ?

2015-11-25 Thread cym13 via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 20:24:25 UTC, user-6431 wrote: I know that AA items order does not follow the additions but is the order deterministic ? For example for a given set of items, will they always be ordered in the same way ? (I mean whatever is the way I append them to the AA).

Re: switch with enum

2015-11-25 Thread Meta via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 20:00:01 UTC, Meta wrote: One way you could do it: import std.conv: to; try { switch (userValue.to!Status) { ... } } catch (ConvException c) { //Default case } ...Which doesn't work because it won't compile without a default case. Is

Re: AA deterministic order ?

2015-11-25 Thread cym13 via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 20:24:25 UTC, user-6431 wrote: I know that AA items order does not follow the additions but is the order deterministic ? For example for a given set of items, will they always be ordered in the same way ? (I mean whatever is the way I append them to the AA).

Re: Exit with code xx

2015-11-25 Thread Ozan via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 16:11:09 UTC, Ozan wrote: Hi Is there any overview, list, wiki about what's behind runtime errors like "Program exited with code -11"? Okay, I made a mistake...but it's better to know where and what kind? Thanks & Regards, Ozan Okay, I found my little

Converting a list of words or array of values to variables at compile time

2015-11-25 Thread Louie F via Digitalmars-d-learn
I found out that compile time optimization is quite useful specially for database queries, instead of it being generated at every call, it can be generated like I typed it using compile time optimizations... so I thought, Is it possible to convert an array of values or a list from a file to

Re: Binding to GSL library

2015-11-25 Thread lobo via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 16:11:56 UTC, Radek wrote: Hi, I'm making a trying to bind a gsl library http://www.gnu.org/software/gsl/ so far it was working but when i started binding complex numbers some functions won't work, like trigonometric functions - called they return null. in

Re: Converting a list of words or array of values to variables at compile time

2015-11-25 Thread drug via Digitalmars-d-learn
On 26.11.2015 09:33, Louie F wrote: I found out that compile time optimization is quite useful specially for database queries, instead of it being generated at every call, it can be generated like I typed it using compile time optimizations... so I thought, Is it possible to convert an array of

Re: dstep problem: "fatal error: 'limits.h' file not found"

2015-11-25 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-11-25 20:52, Joseph Rushton Wakeling wrote: I've just built and installed dstep (on Ubuntu 15.10, using libclang-3.7) but whenever I try to run it on a header file, I run into the error message: File(8AC8E0, "")/usr/include/limits.h:123:16: fatal error: 'limits.h' file not found I

Re: Is it a bug?

2015-11-25 Thread Jack Applegame via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 09:31:15 UTC, John Colvin wrote: import std.range; import std.algorithm; import std.utf; void main() { char[64] arr; copy(chain("test1", "test2").byCodeUnit, arr[0..10].byCodeUnit); } I'll use byCodeUnit. Thanks.

Re: Is it a bug?

2015-11-25 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 08:10:03 UTC, Jack Applegame wrote: This doesn't compile: import std.range; import std.algorithm; void main() { char[64] arr; copy(chain("test1", "test2"), arr[0..10]); } http://dpaste.dzfl.pl/24230ac02e6e Essentially this comes down to the

Re: Something about Chinese Disorder Code

2015-11-25 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 04:09:29 UTC, magicdmer wrote: fwide(core.stdc.stdio.stdout, 1); setlocale(0, cast(char*)"china"); auto str = "你好,世界"; writeln(str); Is it for microsoft runtime or for snn?

Is it a bug?

2015-11-25 Thread Jack Applegame via Digitalmars-d-learn
This doesn't compile: import std.range; import std.algorithm; void main() { char[64] arr; copy(chain("test1", "test2"), arr[0..10]); } http://dpaste.dzfl.pl/24230ac02e6e

Re: Something about Chinese Disorder Code

2015-11-25 Thread Marc Schütz via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 04:09:29 UTC, magicdmer wrote: On Tuesday, 24 November 2015 at 19:41:12 UTC, Marco Leise wrote: Am Tue, 24 Nov 2015 17:08:33 + schrieb BLM768 : [...] thank you for your answers. I solved it. windows console like: