problem with byLine

2012-05-14 Thread Christian Köstlin
Hi, i wanted to output an ascii-file line by line, but reversed. the idea was to open the file, use byLine to read it line-by-line, make this range an array, and retro this array. But when i convert byLine to an array, the result is already trash. Please see this snippet. import std.stdio;

Re: problem with byLine

2012-05-14 Thread simendsjo
On Mon, 14 May 2012 10:41:54 +0200, Christian Köstlin christian.koest...@gmail.com wrote: Hi, i wanted to output an ascii-file line by line, but reversed. the idea was to open the file, use byLine to read it line-by-line, make this range an array, and retro this array. But when i convert

Re: problem with byLine

2012-05-14 Thread Christian Köstlin
On 05/14/2012 11:00 AM, simendsjo wrote: I believe byLine reuses the internal buffer. Try duping the lines: auto i = f.byLine().map!a.idup().array(); Thanks a lot ... that's it! regards christian

Re: D Dll injection problem

2012-05-14 Thread Kagamin
Try to make C dll, which loads D dll, and inject the C dll :)

Problem using Interfce

2012-05-14 Thread Stephen Jones
I have a Widget interface which I was hoping would allow me to subsume a set of classes {Button, Cursor, etc} as being Widgets so I could keep an array of buttons, cursors, etc by initializing them as Widgets. private Widget[] widgets; ... widgets[widx++]=new Button(fmt, unitw, unith, count);

Re: Problem using Interfce

2012-05-14 Thread John Chapman
On Monday, 14 May 2012 at 11:08:09 UTC, Stephen Jones wrote: I have a Widget interface which I was hoping would allow me to subsume a set of classes {Button, Cursor, etc} as being Widgets so I could keep an array of buttons, cursors, etc by initializing them as Widgets. private Widget[]

Re: Problem using Interfce

2012-05-14 Thread simendsjo
On Mon, 14 May 2012 13:08:06 +0200, Stephen Jones siwe...@gmail.com wrote: I have a Widget interface which I was hoping would allow me to subsume a set of classes {Button, Cursor, etc} as being Widgets so I could keep an array of buttons, cursors, etc by initializing them as Widgets. private

Re: Reading ASCII file with some codes above 127 (exten ascii)

2012-05-14 Thread Graham Fawcett
On Sunday, 13 May 2012 at 21:03:45 UTC, Paul wrote: I am reading a file that has a few extended ASCII codes (e.g. degree symdol). Depending on how I read the file in and what I do with it the error shows up at different points. I'm pretty sure it all boils down to the these extended ascii

struct vs class for a simple token in my d lexer

2012-05-14 Thread Roman D. Boiko
(Subj.) I'm in doubt which to choose for my case, but this is a generic question. http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org Cross-posting here. I would appreciate any feedback. (Whether to reply in this or that thread is up to you.) Thanks

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Tobias Pankrath
On Monday, 14 May 2012 at 15:10:25 UTC, Roman D. Boiko wrote: (Subj.) I'm in doubt which to choose for my case, but this is a generic question. http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org Cross-posting here. I would appreciate any feedback. (Whether to reply in this or

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Tobias Pankrath
Quoting your post in another thread: On Monday, 14 May 2012 at 15:10:25 UTC, Roman D. Boiko wrote: Making it a class would give several benefits: * allow not to worry about allocating a big array of tokens. E.g., on 64-bit OS the largest module in Phobos (IIRC, the std.datetime) consumes

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Roman D. Boiko
On Monday, 14 May 2012 at 15:44:54 UTC, Tobias Pankrath wrote: On Monday, 14 May 2012 at 15:10:25 UTC, Roman D. Boiko wrote: (Subj.) I'm in doubt which to choose for my case, but this is a generic question. http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org Cross-posting here.

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Jonathan M Davis
On Monday, May 14, 2012 17:10:23 Roman D. Boiko wrote: (Subj.) I'm in doubt which to choose for my case, but this is a generic question. http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org Cross-posting here. I would appreciate any feedback. (Whether to reply in this or that

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Roman D. Boiko
On Monday, 14 May 2012 at 15:53:34 UTC, Tobias Pankrath wrote: Quoting your post in another thread: On Monday, 14 May 2012 at 15:10:25 UTC, Roman D. Boiko wrote: Making it a class would give several benefits: * allow not to worry about allocating a big array of tokens. E.g., on 64-bit OS

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Dmitry Olshansky
On 14.05.2012 19:10, Roman D. Boiko wrote: (Subj.) I'm in doubt which to choose for my case, but this is a generic question. http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org Cross-posting here. I would appreciate any feedback. (Whether to reply in this or that thread is up to

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Tobias Pankrath
struct Token{ uint col, line; uint flags;//indicated info about token, serves as both type tag and flag set; //indicates proper type once token was cooked (like 31.415926 - 3.145926e1) i.e. values are calculated union { string chars; float f_val;

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Roman D. Boiko
On Monday, 14 May 2012 at 16:41:39 UTC, Jonathan M Davis wrote: On Monday, May 14, 2012 17:10:23 Roman D. Boiko wrote: (Subj.) I'm in doubt which to choose for my case, but this is a generic question. http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org Cross-posting here. I would

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Dmitry Olshansky
On 14.05.2012 21:16, Tobias Pankrath wrote: struct Token{ uint col, line; uint flags;//indicated info about token, serves as both type tag and flag set; //indicates proper type once token was cooked (like 31.415926 - 3.145926e1) i.e. values are calculated union { string chars; float f_val;

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Roman D. Boiko
On Monday, 14 May 2012 at 17:05:17 UTC, Dmitry Olshansky wrote: On 14.05.2012 19:10, Roman D. Boiko wrote: (Subj.) I'm in doubt which to choose for my case, but this is a generic question. http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org Cross-posting here. I would appreciate

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Dmitry Olshansky
On 14.05.2012 21:20, Roman D. Boiko wrote: On Monday, 14 May 2012 at 16:41:39 UTC, Jonathan M Davis wrote: On Monday, May 14, 2012 17:10:23 Roman D. Boiko wrote: (Subj.) I'm in doubt which to choose for my case, but this is a generic question.

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Dmitry Olshansky
On 14.05.2012 21:33, Dmitry Olshansky wrote: On 14.05.2012 21:20, Roman D. Boiko wrote: On Monday, 14 May 2012 at 16:41:39 UTC, Jonathan M Davis wrote: On Monday, May 14, 2012 17:10:23 Roman D. Boiko wrote: (Subj.) I'm in doubt which to choose for my case, but this is a generic question.

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Roman D. Boiko
On Monday, 14 May 2012 at 17:37:02 UTC, Dmitry Olshansky wrote: But hopefully you get the idea. See something simillar in std.regex, though pointer in there also serves for intrusive linked-list. Thanks, most likely I'll go your way.

Re: std.mmfile issues

2012-05-14 Thread Ondrej Pokorny
On Monday, 14 May 2012 at 05:57:49 UTC, Ondrej Pokorny wrote: Hi all, I am trying to use std.mmfile on Win 7 64 bit, compiler dmd 32 2.059 MmFile memoryFile = new MmFile(test); I receive this error: std.exception.ErrnoException@std\mmfile.d(270): (No error) which is a little bit confusing

Re: std.mmfile issues

2012-05-14 Thread Trass3r
I found out that OpenFileMapping is not needed and CreateFileMapping is sufficient. I managed to code this with std.c.windows only however MmFile is not working even with simplest examlple maybe a bug under win 7? Possible. Feel free to file a bug report or create a pull request.

Re: Problem using Interfce

2012-05-14 Thread Stephen Jones
On Monday, 14 May 2012 at 11:49:21 UTC, simendsjo wrote: On Mon, 14 May 2012 13:08:06 +0200, Stephen Jones siwe...@gmail.com wrote: I have a Widget interface which I was hoping would allow me to subsume a set of classes {Button, Cursor, etc} as being Widgets so I could keep an array of

void pointer syntax

2012-05-14 Thread Stephen Jones
I want an array of different classes of objects. I tried to subsume the differences by extending the classes under a single interface/abstract class/super class (3 different approaches) all to no avail as I could not access the public variables of the instantiated classes while storing them in an

Re: Problem using Interfce

2012-05-14 Thread Stephen Jones
On Monday, 14 May 2012 at 18:39:13 UTC, Stephen Jones wrote: On Monday, 14 May 2012 at 11:49:21 UTC, simendsjo wrote: On Mon, 14 May 2012 13:08:06 +0200, Stephen Jones siwe...@gmail.com wrote: I have a Widget interface which I was hoping would allow me to subsume a set of classes {Button,

Re: void pointer syntax

2012-05-14 Thread H. S. Teoh
On Mon, May 14, 2012 at 08:40:30PM +0200, Stephen Jones wrote: I want an array of different classes of objects. I tried to subsume the differences by extending the classes under a single interface/abstract class/super class (3 different approaches) all to no avail as I could not access the

Re: void pointer syntax

2012-05-14 Thread H. S. Teoh
On Mon, May 14, 2012 at 12:05:53PM -0700, H. S. Teoh wrote: On Mon, May 14, 2012 at 08:40:30PM +0200, Stephen Jones wrote: I want an array of different classes of objects. I tried to subsume the differences by extending the classes under a single interface/abstract class/super class (3

Re: Problem using Interfce

2012-05-14 Thread Ali Çehreli
On 05/14/2012 11:40 AM, Stephen Jones wrote: I want an array of different classes of objects. So far, Object[] makes sense. I tried to subsume the differences by extending the classes under a single interface/abstract class/super class (3 different approaches) all to no avail Yeah, that

Re: Problem using Interfce

2012-05-14 Thread H. S. Teoh
On Mon, May 14, 2012 at 12:15:32PM -0700, Ali Çehreli wrote: On 05/14/2012 11:40 AM, Stephen Jones wrote: I want an array of different classes of objects. So far, Object[] makes sense. I tried to subsume the differences by extending the classes under a single interface/abstract

Re: What is a good strategy for finding undefined symbols...

2012-05-14 Thread WhatMeWorry
Linking happens when you build an executable. If you are building just the libraries, there is no linking done at all. To compile DerelictGL, you do not need to link anything. It appears you are compiling Derelict 2, in which case the supplied makefiles should do everything necessary to

Re: Problem using Interfce

2012-05-14 Thread Ali Çehreli
On 05/14/2012 11:49 AM, Stephen Jones wrote: My understanding is that c# getter setters were simply syntactic sugar which under the hood called standard functions incurring the standard function overhead. Is this the same with D, or does D implement properties using pointers to the required

Re: struct vs class for a simple token in my d lexer

2012-05-14 Thread Era Scarecrow
On Monday, 14 May 2012 at 18:00:42 UTC, Roman D. Boiko wrote: On Monday, 14 May 2012 at 17:37:02 UTC, Dmitry Olshansky wrote: But hopefully you get the idea. See something simillar in std.regex, though pointer in there also serves for intrusive linked-list. Thanks, most likely I'll go your

Re: What is a good strategy for finding undefined symbols...

2012-05-14 Thread Michael Parker
On 5/15/2012 4:23 AM, WhatMeWorry wrote: Linking happens when you build an executable. If you are building just the libraries, there is no linking done at all. To compile DerelictGL, you do not need to link anything. It appears you are compiling Derelict 2, in which case the supplied