Compiling DMD on MAC OS X

2012-02-19 Thread Tyro[a.c.edwards]
Hi all, I've just installed DMD 2.058 and attempted to compile a little script but was greeted with the following error: gcc: Invalid argument I used the .dmg installer from http://www.dlang.org/download.html and issued the command: dmd average Is there something I'm missing? Thanks,

Re: Compiling DMD on MAC OS X

2012-02-20 Thread Tyro[a.c.edwards]
On Sunday, 19 February 2012 at 11:39:15 UTC, kraybourne wrote: On 2/19/12 09:20 , Tyro[a.c.edwards] wrote: Hi all, I've just installed DMD 2.058 and attempted to compile a little script but was greeted with the following error: gcc: Invalid argument I used the .dmg installer from http

Re: C++ to D: Help please

2011-02-24 Thread Tyro[a.c.edwards]
On 2/25/2011 3:33 AM, Jesse Phillips wrote: Well using one language you aren't familiar with to learn another is probably not the best strategy. For one thing C++ uses namespaces and D uses modules. They are both about name-space but are very different approaches. If you want to learn about

Initializing a class pointer

2011-02-26 Thread Tyro[a.c.edwards]
class Class{} void main() { Class myClass; Class* pClass0 = myClass; // OK Class* pClass1 = new Class; // Error: cannot implicitly convert [8] // expression (new Class) of type t.Class // to test.Class* Class* pClass2 = (new

Re: Initializing a class pointer

2011-02-26 Thread Tyro[a.c.edwards]
On 2/27/2011 8:10 AM, Simen kjaeraas wrote: Tyro[a.c.edwards] nos...@home.com wrote: class Class{} void main() { Class myClass; Class* pClass0 = myClass; // OK Class* pClass1 = new Class; // Error: cannot implicitly convert [8] // expression (new Class) of type t.Class // to test.Class

Re: Initializing a class pointer

2011-02-26 Thread Tyro[a.c.edwards]
On 2/27/2011 8:52 AM, Simen kjaeraas wrote: Tyro[a.c.edwards] nos...@home.com wrote: I'm trying to convert some c++ code that defines T func(par...) { Controller * pCtrl = WinGetLongController * (hwnd); . . . switch(msg) { case FirstMatch: pCtrl = new Controller (hwnd

Re: Initializing a class pointer

2011-02-26 Thread Tyro[a.c.edwards]
On 2/27/2011 9:46 AM, Tyro[a.c.edwards] wrote: On 2/27/2011 8:52 AM, Simen kjaeraas wrote: Tyro[a.c.edwards] nos...@home.com wrote: I'm trying to convert some c++ code that defines T func(par...) { Controller * pCtrl = WinGetLongController * (hwnd); . . . switch(msg) { case FirstMatch: pCtrl

Re: Initializing a class pointer

2011-02-28 Thread Tyro[a.c.edwards]
On 2/27/2011 10:39 PM, Steven Schveighoffer wrote: On Sat, 26 Feb 2011 19:46:18 -0500, Tyro[a.c.edwards] nos...@home.com wrote: On 2/27/2011 8:52 AM, Simen kjaeraas wrote: Tyro[a.c.edwards] nos...@home.com wrote: I'm trying to convert some c++ code that defines T func(par...) { Controller

string vs. w/char*

2011-02-28 Thread Tyro[a.c.edwards]
The bellow code attempts to use LoadStringA() to initialize _buf. However, regardless of what form _buf takes, the body of the if statement is always executed. I've attempted to use every type of string available in D to include char* _buf[MAX_RESSTRING+1] and setting _buf[MAX_RESSTRING] =

Re: string vs. w/char*

2011-02-28 Thread Tyro[a.c.edwards]
On 2/28/2011 9:58 PM, Steven Schveighoffer wrote: On Mon, 28 Feb 2011 07:34:39 -0500, Tyro[a.c.edwards] nos...@home.com wrote: The bellow code attempts to use LoadStringA() to initialize _buf. However, regardless of what form _buf takes, the body of the if statement is always executed. I've

Re: string vs. w/char*

2011-02-28 Thread Tyro[a.c.edwards]
On 2/28/2011 11:08 PM, J Chapman wrote: == Quote from Tyro[a.c.edwards] (nos...@home.com)'s article Both implementations results in error code 1812 being returned from GetLastError. explanation of the code reads: ERROR_RESOURCE_DATA_NOT_FOUND 1812 (0x714) The specified

Re: string vs. w/char*

2011-02-28 Thread Tyro[a.c.edwards]
== Quote from Denis Koroskin (2kor...@gmail.com)'s article On Mon, 28 Feb 2011 19:35:47 +0300, Tyro[a.c.edwards] nos...@home.com wrote: On 2/28/2011 11:08 PM, J Chapman wrote: == Quote from Tyro[a.c.edwards] (nos...@home.com)'s article Both implementations results in error code 1812 being

Re: string vs. w/char*

2011-03-01 Thread Tyro[a.c.edwards]
== Quote from Denis Koroskin (2kor...@gmail.com)'s article On Tue, 01 Mar 2011 02:08:48 +0300, Tyro[a.c.edwards] nos...@home.com wrote: == Quote from Denis Koroskin (2kor...@gmail.com)'s article On Mon, 28 Feb 2011 19:35:47 +0300, Tyro[a.c.edwards] nos...@home.com wrote: On 2/28/2011

Re: Want to help DMD bugfixing? Write a simple utility.

2011-03-20 Thread Tyro[a.c.edwards]
Not very elegant but this should get the job done: 000 module strip; 001 import std.algoritm : countUntil; 002 import std.array: strip; 003 import std.file : read; 004 import std.string : splitlines; 005 import std.stdio: writeln; 006 007 void main(string[] args) 008 { 009 bool

Re: Want to help DMD bugfixing? Write a simple utility.

2011-03-20 Thread Tyro[a.c.edwards]
The following patch addresses the following issues: 1) fixed improper handling of nested and multiline comments that do not take up a complete line. 2) eliminate extra blank lines where unit tests and comments are removed. Replace lines 31 32 with: # auto n = countUntil(line, +/); # if(n !=

Re: Want to help DMD bugfixing? Write a simple utility.

2011-03-20 Thread Tyro[a.c.edwards]
Messed that up again: see embeded change. Wish I could just copy and pase but that's not possible with my current setup. == Quote from Tyro[a.c.edwards] (nos...@home.com)'s article The following patch addresses the following issues: 1) fixed improper handling of nested and multiline comments

Re: template instance cannot use local 'f' as parameter to non-global template

2011-07-13 Thread Tyro[a.c.edwards]
On 7/13/2011 11:35 PM, Trass3r wrote: Am 13.07.2011, 16:02 Uhr, schrieb Steven Schveighoffer schvei...@yahoo.com: void h() {} class Bla { mixin wrap!h; } mixin template wrap(alias f) { void blub(alias g = f)() { g(); } } As a workaround, is there a reason you need blub to be

Re: template instance cannot use local 'f' as parameter to non-global template

2011-07-13 Thread Tyro[a.c.edwards]
On 7/14/2011 12:24 AM, Trass3r wrote: Am 13.07.2011, 16:58 Uhr, schrieb Tyro[a.c.edwards] nos...@home.com: Don't know it this is the right answer or a possible bug but it does the trick: void h() { import std.stdio; write(h()); } class Bla { mixin wrap!h; } mixin template wrap(alias f

Re: template instance cannot use local 'f' as parameter to non-global template

2011-07-13 Thread Tyro[a.c.edwards]
On 7/14/2011 12:24 AM, Trass3r wrote: Am 13.07.2011, 16:58 Uhr, schrieb Tyro[a.c.edwards] nos...@home.com: Don't know it this is the right answer or a possible bug but it does the trick: void h() { import std.stdio; write(h()); } class Bla { mixin wrap!h; } mixin template wrap(alias f

How does one correct shadowing (hidden by) errors?

2011-07-22 Thread Tyro[a.c.edwards]
While attempting to build the DFL libraries, I encountered the following three errors: [1] tabcontrol.d(18): Error: class dfl.tabcontrol.TabPage use of dfl.control.Control.opEquals(Control ctrl) hidden by TabPage is deprecated [2] tabcontrol.d(18): Error: class dfl.tabcontrol.TabPage use of

Re: How does one correct shadowing (hidden by) errors?

2011-07-23 Thread Tyro[a.c.edwards]
On 7/23/2011 7:49 PM, bearophile wrote: Tyro[a.c.edwards]: [3] imagelist.d(22): Error: class dfl.imagelist.ImageList.ImageCollection use of dfl.imagelist.ImageList.ImageCollection.ListWrapArray!(Image,_images,_adding,_added,_blankListCallback,_removed,false,false,false).insert(int index, Image

ftp connection with socket

2009-04-12 Thread Tyro[a.c.edwards]
Hi, I hoping someone could whip up an example of how to check if it's possible to connect to a given site: eg. ftp.digitalmars.com and display a message if unsuccessful. If one is already available, could someone please point me to it? Thanks, Andrew

Re: ftp connection with socket

2009-04-12 Thread Tyro[a.c.edwards]
Per Jarrett Billingsley's advice, the following is provided: I am using DMD v2.028 w/Phobos 2 Thanks again. Tyro[a.c.edwards] Wrote: Hi, I hoping someone could whip up an example of how to check if it's possible to connect to a given site: eg. ftp.digitalmars.com and display a message

Re: When asking for help on how to do something...

2009-04-12 Thread Tyro[a.c.edwards]
Jarrett Billingsley Wrote: Please, *please* indicate whether you are using Phobos 1, Phobos 2, or Tango. It's hard enough trying to read your mind about what you're trying to do. It's even harder when there are two or three completely different solutions to it. Jarrett, I've always used

Re: When asking for help on how to do something...

2009-04-12 Thread Tyro[a.c.edwards]
Jarrett Billingsley Wrote: Please, *please* indicate whether you are using Phobos 1, Phobos 2, or Tango. It's hard enough trying to read your mind about what you're trying to do. It's even harder when there are two or three completely different solutions to it. Jarrett, I've always used

static initialization of associative arrays

2009-04-15 Thread Tyro[a.c.edwards]
Is it yet possible to statically initialize an associative array? If so, please point me to the documentation. I am using DMD v2.028. Thanks, Andrew

static initialization of associative arrays

2009-04-15 Thread Tyro[a.c.edwards]
Is it yet possible to statically initialize an associative array? If so, please point me to the documentation. I am using DMD v2.028. Currently I'm able to do this: import std.stdio; string[string] types; static this(){ types = [ void:void, bool:bool ]; } void main(){ writeln(types);

std.range this._input.opIndex(index) error

2009-04-22 Thread Tyro[a.c.edwards]
Attempting to compile the following from snippet auto r = iota(0, 10, 1); assert(equal(r, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9][])); from the documentation, I encountered following error range.d(1184): Error: this._input.opIndex(index) is not an lvalue Looking at the code I find

std.range this._input.opIndex(index) error

2009-04-22 Thread Tyro[a.c.edwards]
Attempting to compile the following from snippet auto r = iota(0, 10, 1); assert(equal(r, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9][])); from the documentation, I encountered following error range.d(1184): Error: this._input.opIndex(index) is not an lvalue Looking at the code I find return

How to check for internet connectivity and download file?

2009-04-26 Thread Tyro[a.c.edwards]
I've used Burton Radons' urllib in the past to get download files from the internet, however the library has atrophied and can no longer be used with DMD v2.029 (not how long it's been this way because I haven't tried to compile it since 2006). I'm wondering if someone could point me to an

Re: How to check for internet connectivity and download file?

2009-04-27 Thread Tyro[a.c.edwards]
in 2007. -[Unknown] Tyro[a.c.edwards] wrote: I've used Burton Radons' urllib in the past to get download files from the internet, however the library has atrophied and can no longer be used with DMD v2.029 (not how long it's been this way because I haven't tried to compile it since

Re: How to check for internet connectivity and download file?

2009-04-27 Thread Tyro[a.c.edwards]
On 4/27/2009 5:14 PM, Unknown W. Brackets wrote: If you want both HTTP and FTP, it's definitely worth using a library for it. There are a lot of options, but almost all of them are out of date I suppose for 2.x... I've always hated curl, but you might look at how hard it is to get/make d

How-to: input/output Japanese Characters?

2009-05-02 Thread Tyro[a.c.edwards]
I'm on a Japanese system attempting to input/output Japanese Characters and cannot seem to accomplish it. How would I read 憲法記念日 理念と現実、広がる格差 from stdin/file and output the same to stdout/file? Thanks, Andrew

Re: How-to: input/output Japanese Characters?

2009-05-02 Thread Tyro[a.c.edwards]
On 5/3/2009 7:41 AM, Georg Wrede wrote: Tyro[a.c.edwards] wrote: I'm on a Japanese system attempting to input/output Japanese Characters and cannot seem to accomplish it. How would I read 憲法記念日 理念と現実、広がる格差 from stdin/file and output the same to stdout/file? import std.stdio; void main

Re: Resource availability: fonts

2009-05-06 Thread Tyro[a.c.edwards]
On 5/6/2009 1:39 PM, grauzone wrote: Use ubyte[] fontbytes = cast(ubyte[])import(yourfont.ttf); This will take care of making sure the font is available. How do you instruct the library (DFL in this case) that this variable contains the font or that after you write it back to the hard drive

Re: Resource availability: fonts

2009-05-06 Thread Tyro[a.c.edwards]
On 5/6/2009 9:50 PM, John C wrote: Tyro[a.c.edwards] Wrote: When I do this, how do I ensure that the program is able to locate the font after extraction without installing it? I think AddFontResource from the SDK will do that. http://msdn.microsoft.com/en-us/library/dd183326(VS.85).aspx

std.random:uniform - uncompilable example from docs

2009-05-09 Thread Tyro[a.c.edwards]
http://www.digitalmars.com/d/2.0/phobos/std_random.html#uniform Above documentation provides the following example: Random gen(unpredictableSeed); // Generate an integer in [0, 1023] auto a = uniform(0, 1024, gen); // Generate a float in [0, 1) auto a =

Re: D input: how-to (RFC)

2009-05-11 Thread Tyro[a.c.edwards]
On 5/11/2009 2:35 PM, grauzone wrote: Tyro[a.c.edwards] wrote: I am looking for a D version of scanf() but I'm sure there is no such thing so I tried contrived one. I am sure I missed a slew of obvious There's readf() in std.stream. I think you have to use std.cstream : din to use

Re: Simple file manipulation

2009-05-20 Thread Tyro[a.c.edwards]
On 5/20/2009 6:19 PM, BLS wrote: Sam Hu wrote: I looked up in D2 in std.stdio,std.file,std.cstream and std.stream and try to find a very simple method which can read from a file once a value other than once an entire row.I just can not find it maybe this idea is wrong.Say how to simply read

problems playing audio with mciSendString

2010-11-02 Thread Tyro[a.c.edwards]
Hello all, I would really appreciate some assistance on this. The intent is to create a vocabulary/flashcard program with proper pronunciations. Pronunciations are saved as individual mp3 files which I want to play whenever a new term is displayed. My current attempt is simply to get the the file

Re: problems playing audio with mciSendString

2010-11-02 Thread Tyro[a.c.edwards]
Thanks, The problem was that mciSendString was immediately returning control to the caller after being called. This simple change fixed the problem: mciSendString(play myFile wait);

Re: Unicode: how to properly read and display directory entries?

2010-11-05 Thread Tyro[a.c.edwards]
On 11/6/2010 2:10 AM, Dmitry Olshansky wrote: On 05.11.2010 18:25, Tyro[a.c.edwards] wrote: On 11/5/2010 10:51 PM, Kagamin wrote: Tyro[a.c.edwards] Wrote: Hello, What is the proper way to read a directory such that file names are not garbled? Here is the example I borrowed form the std.file