Re: Startup files for STM32F4xx

2015-04-24 Thread tom via Digitalmars-d-learn
On Thursday, 23 April 2015 at 15:30:18 UTC, Jens Bauer wrote: The most important thing, though, is that D-programmers now have a starting point for the STM32F4xx. It should be easy to adapt the same sources to other MCUs. I'm planning on adding support for some of the LPC microcontrollers mysel

Re: Fibers and async io stuff for beginners

2015-04-24 Thread Chris via Digitalmars-d-learn
On Thursday, 23 April 2015 at 22:26:28 UTC, Jens Bauer wrote: On Thursday, 23 April 2015 at 19:24:31 UTC, Chris wrote: On Thursday, 23 April 2015 at 16:57:30 UTC, Jens Bauer wrote: 3: Audio mixing and playback (eg. a MOD player for instance). 5: Queueing up a bunch of different jobs; At the m

Re: Download DDMD?

2015-04-24 Thread Joakim via Digitalmars-d-learn
On Wednesday, 22 April 2015 at 07:57:40 UTC, Jeremiah DeHaan wrote: Just curious, but I was wondering if there was a 2.067 DDMD available for download somewhere for Windows. If not, then are there any special build instructions I need to build it? I kind of just want to try a couple of things,

Re: Fibers and async io stuff for beginners

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Friday, 24 April 2015 at 09:15:21 UTC, Chris wrote: I was more thinking of the audio thread. But the audio is probably better off in a separate thread. I think you could do this too. In fact, this is very similar to how the audio from a MOD file is decoded. (I only mentioned an interrupt,

Re: Startup files for STM32F4xx

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Friday, 24 April 2015 at 07:34:55 UTC, tom wrote: On Thursday, 23 April 2015 at 15:30:18 UTC, Jens Bauer wrote: The most important thing, though, is that D-programmers now have a starting point for the STM32F4xx. It should be easy to adapt the same sources to other MCUs. I'm planning on addi

Re: Startup files for STM32F4xx

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/23/15 11:30 AM, Jens Bauer wrote: On Thursday, 23 April 2015 at 12:14:59 UTC, Steven Schveighoffer wrote: You can't use something like this? http://www.floodgap.com/software/tenfourfox/ Wow, I thought they stopped making builds at v20! -I'm pretty sure they said on the Web-site that v20

Re: Startup files for STM32F4xx

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Friday, 24 April 2015 at 07:34:55 UTC, tom wrote: would something like a STM32 NUCLEO-F401RE work? I forgot to give you a proper answer on this one: I think it should work, as it's a STM32F401 microcontroller. -So basically you get a 'bare metal' setup with no drivers. However, as you kno

function ref param vs pointer param

2015-04-24 Thread ref2401 via Digitalmars-d-learn
What advantages do ref params give over pointer params? struct MyStruct { string str; this(string str) { this.str = str; } } void processRef(ref MyStruct ms) { writeln("processRef: ", ms); } void processPointer(MyStruct* ms) { writeln("processPointer: ", *ms); }

Re: function ref param vs pointer param

2015-04-24 Thread bearophile via Digitalmars-d-learn
ref2401: void processRef(ref MyStruct ms) { writeln("processRef: ", ms); } void processPointer(MyStruct* ms) { writeln("processPointer: ", *ms); ref params don't need the "*" every time you use them inside the function, and don't need the "&" when you call the function. Bye

Re: function ref param vs pointer param

2015-04-24 Thread ref2401 via Digitalmars-d-learn
processPointer(&ms); I think doing this way is more descriptive. Now all readers know that ms might be changed inside the function.

Re: function ref param vs pointer param

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/15 9:23 AM, ref2401 wrote: What advantages do ref params give over pointer params? struct MyStruct { string str; this(string str) { this.str = str; } } void processRef(ref MyStruct ms) { writeln("processRef: ", ms); } void processPointer(MyStruct* ms) { writeln("pr

Re: function ref param vs pointer param

2015-04-24 Thread bearophile via Digitalmars-d-learn
On Friday, 24 April 2015 at 13:39:35 UTC, ref2401 wrote: processPointer(&ms); I think doing this way is more descriptive. Now all readers know that ms might be changed inside the function. C# avoids that problem requiring (in most cases) the usage of "ref" at the calling point too. But this i

Re: function ref param vs pointer param

2015-04-24 Thread Ali Çehreli via Digitalmars-d-learn
On 04/24/2015 06:23 AM, ref2401 wrote: > What advantages do ref params give over pointer params? Another difference is that a ref parameter is not null and what is referred to is not an rvalue. However, it is possible to break that expectation if a pointer is dereferenced and passed to a ref

Re: function ref param vs pointer param

2015-04-24 Thread ref2401 via Digitalmars-d-learn
Thank you

Re: Fibers and async io stuff for beginners

2015-04-24 Thread Chris via Digitalmars-d-learn
On Friday, 24 April 2015 at 12:38:39 UTC, Jens Bauer wrote: On Friday, 24 April 2015 at 09:15:21 UTC, Chris wrote: I was more thinking of the audio thread. But the audio is probably better off in a separate thread. I think you could do this too. In fact, this is very similar to how the audio

How to output ascii character using terminal.d

2015-04-24 Thread Paul via Digitalmars-d-learn
How do I output a single ascii character specified numerically, via terminal.d's writef() function which expects a string? Bound to be something obvious but I just can't see it atm! Paul

Re: How to output ascii character using terminal.d

2015-04-24 Thread Adam D. Ruppe via Digitalmars-d-learn
Try terminal.writef("%s", cast(char) your_ascii_character); it should work.

No line numbers in compiler error messages

2015-04-24 Thread John Nixon via Digitalmars-d-learn
I am using dmd v2.067.0 on Mac OSX with Terminal and I found the lack of line numbers surprising. Is there something simple I am doing wrong? Do any of the switches on the command line do this? BTW I only found out about D a couple of weeks back. It seems to be very impressive! John Nixon

__gshared static

2015-04-24 Thread via Digitalmars-d-learn
Hi! I just stumbled across what seems like a misunderstanding on my side about these keywords. Can someone help clarify these for me? ``` __gshared static int foo; __gshared int foo; ``` What are the storage and semantic differences between those two, if any? Cheers, -M

Re: No line numbers in compiler error messages

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/15 1:20 PM, John Nixon wrote: I am using dmd v2.067.0 on Mac OSX with Terminal and I found the lack of line numbers surprising. Is there something simple I am doing wrong? Do any of the switches on the command line do this? It does post line numbers. Please post source and compile line

md5 return toHexString

2015-04-24 Thread AndyC via Digitalmars-d-learn
Hi All, I cannot seem to understand whats wrong with this: // main.d import std.stdio; import std.digest.md; import std.file; string md5sum(const string fname) { MD5 hash; File f = File(fname, "rb"); foreach( ubyte[] buf; f.byChunk(4096)) { hash.put(buf); } str

Re: md5 return toHexString

2015-04-24 Thread tcak via Digitalmars-d-learn
On Friday, 24 April 2015 at 17:50:03 UTC, AndyC wrote: Hi All, I cannot seem to understand whats wrong with this: // main.d import std.stdio; import std.digest.md; import std.file; string md5sum(const string fname) { MD5 hash; File f = File(fname, "rb"); foreach( ubyte[] buf; f.by

Re: md5 return toHexString

2015-04-24 Thread AndyC via Digitalmars-d-learn
On Friday, 24 April 2015 at 17:56:59 UTC, tcak wrote: On Friday, 24 April 2015 at 17:50:03 UTC, AndyC wrote: Hi All, I cannot seem to understand whats wrong with this: // main.d import std.stdio; import std.digest.md; import std.file; string md5sum(const string fname) { MD5 hash; File

Re: __gshared static

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/15 1:22 PM, "=?UTF-8?B?Ik3DoXJjaW8=?= Martins\" \"" wrote: Hi! I just stumbled across what seems like a misunderstanding on my side about these keywords. Can someone help clarify these for me? ``` __gshared static int foo; __gshared int foo; ``` What are the storage and semantic differ

Convert hex to binary

2015-04-24 Thread nrgyzer via Digitalmars-d-learn
Hi, I'm looking for a function that converts my hex-string to a binary representation. In Python I write the following: myHex = "123456789ABCDEF" myBin = myHex.decode('hex') But how to do the same in D? Is there any function? Thanks for suggestions!

Re: No line numbers in compiler error messages

2015-04-24 Thread John Nixon via Digitalmars-d-learn
On Friday, 24 April 2015 at 17:45:49 UTC, Steven Schveighoffer wrote: On 4/24/15 1:20 PM, John Nixon wrote: I am using dmd v2.067.0 on Mac OSX with Terminal and I found the lack of line numbers surprising. Is there something simple I am doing wrong? Do any of the switches on the command line

Re: No line numbers in compiler error messages

2015-04-24 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 24 April 2015 at 17:20:12 UTC, John Nixon wrote: I am using dmd v2.067.0 on Mac OSX with Terminal and I found the lack of line numbers surprising. Is there something simple I am doing wrong? Do any of the switches on the command line do this? BTW I only found out about D a couple of

Re: Convert hex to binary

2015-04-24 Thread Ali Çehreli via Digitalmars-d-learn
On 04/24/2015 11:14 AM, nrgyzer wrote: Hi, I'm looking for a function that converts my hex-string to a binary representation. In Python I write the following: myHex = "123456789ABCDEF" myBin = myHex.decode('hex') But how to do the same in D? Is there any function? Thanks for suggestions! He

Degenerate Regex Case

2015-04-24 Thread Guillaume via Digitalmars-d-learn
Hello, I'm trying to make a regex comparison with D, based off of this article: https://swtch.com/~rsc/regexp/regexp1.html I've written my code like so: import std.stdio, std.regex; void main(string argv[]) { string m = argv[1]; auto p = ctRegex!("a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a

Weird OSX issue

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
OK, so I think I found a bug, but I have no idea how to "reproduce" it. It seems to be dependent on environment. Here is an annotated (using # for comments) session to show you the weirdness. All versions are 2.067, and I did use dmd -v to make sure rogue dmd.conf or library files are not play

Re: No line numbers in compiler error messages

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/15 2:24 PM, Jesse Phillips wrote: On Friday, 24 April 2015 at 17:20:12 UTC, John Nixon wrote: I am using dmd v2.067.0 on Mac OSX with Terminal and I found the lack of line numbers surprising. Is there something simple I am doing wrong? Do any of the switches on the command line do this?

Re: Convert hex to binary

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/15 2:14 PM, nrgyzer wrote: Hi, I'm looking for a function that converts my hex-string to a binary representation. In Python I write the following: myHex = "123456789ABCDEF" myBin = myHex.decode('hex') But how to do the same in D? Is there any function? Thanks for suggestions! import

Re: __gshared static

2015-04-24 Thread bearophile via Digitalmars-d-learn
Steven Schveighoffer: These are the same, __gshared overrides static. Isn't forbidding "__gshared static" a good idea then, to avoid user confusion? Bye, bearophile

Re: Convert hex to binary

2015-04-24 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 24 April 2015 at 18:14:07 UTC, nrgyzer wrote: Hi, I'm looking for a function that converts my hex-string to a binary representation. In Python I write the following: myHex = "123456789ABCDEF" myBin = myHex.decode('hex') But how to do the same in D? Is there any function? Thanks f

Re: Convert hex to binary

2015-04-24 Thread nrgyzer via Digitalmars-d-learn
On Friday, 24 April 2015 at 18:45:55 UTC, Jesse Phillips wrote: On Friday, 24 April 2015 at 18:14:07 UTC, nrgyzer wrote: Hi, I'm looking for a function that converts my hex-string to a binary representation. In Python I write the following: myHex = "123456789ABCDEF" myBin = myHex.decode('hex

Re: __gshared static

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/15 2:47 PM, bearophile wrote: Steven Schveighoffer: These are the same, __gshared overrides static. Isn't forbidding "__gshared static" a good idea then, to avoid user confusion? Surely, prohibiting non-functioning attributes is good when it's obvious that they do nothing. BUT...

Re: Convert hex to binary

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/15 2:50 PM, nrgyzer wrote: On Friday, 24 April 2015 at 18:45:55 UTC, Jesse Phillips wrote: On Friday, 24 April 2015 at 18:14:07 UTC, nrgyzer wrote: Hi, I'm looking for a function that converts my hex-string to a binary representation. In Python I write the following: myHex = "12345678

Re: __gshared static

2015-04-24 Thread via Digitalmars-d-learn
On Friday, 24 April 2015 at 18:05:22 UTC, Steven Schveighoffer wrote: On 4/24/15 1:22 PM, "=?UTF-8?B?Ik3DoXJjaW8=?= Martins\" \"" wrote: Hi! I just stumbled across what seems like a misunderstanding on my side about these keywords. Can someone help clarify these for me? ``` __gshared static

Re: Convert hex to binary

2015-04-24 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 24 April 2015 at 18:55:07 UTC, Steven Schveighoffer wrote: On 4/24/15 2:50 PM, nrgyzer wrote: On Friday, 24 April 2015 at 18:45:55 UTC, Jesse Phillips wrote: On Friday, 24 April 2015 at 18:14:07 UTC, nrgyzer wrote: Hi, I'm looking for a function that converts my hex-string to a bi

Re: Convert hex to binary

2015-04-24 Thread Ivan Kazmenko via Digitalmars-d-learn
On Friday, 24 April 2015 at 18:55:07 UTC, Steven Schveighoffer wrote: Thanks to all of you for the solutions, but what if the hex-string exceeds the limit of ulong, for instance "123456789ABCDEF0123456789ABCDEF1234". How to convert them to a ulong-array? Well, technically, a hex string can be

Re: Convert hex to binary

2015-04-24 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 24 April 2015 at 19:15:04 UTC, Ivan Kazmenko wrote: On Friday, 24 April 2015 at 18:55:07 UTC, Steven Schveighoffer wrote: Thanks to all of you for the solutions, but what if the hex-string exceeds the limit of ulong, for instance "123456789ABCDEF0123456789ABCDEF1234". How to convert

Re: Weird OSX issue

2015-04-24 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-24 20:37, Steven Schveighoffer wrote: So am I going crazy? Or is dmd doing things differently depending on where its environment is? Any compiler gurus out there understand why the symbol is different? I don't want to file a bug with this, because it seems dependent on installation l

Re: How to output ascii character using terminal.d

2015-04-24 Thread Paul via Digitalmars-d-learn
On Friday, 24 April 2015 at 15:46:15 UTC, Adam D. Ruppe wrote: Try terminal.writef("%s", cast(char) your_ascii_character); it should work. Thank you, it works for the standard ascii characters but not the extended set - maybe that has something to do with my terminal settings...? (not that I

Re: md5 return toHexString

2015-04-24 Thread Johannes Pfau via Digitalmars-d-learn
Am Fri, 24 Apr 2015 18:02:57 + schrieb "AndyC" : > On Friday, 24 April 2015 at 17:56:59 UTC, tcak wrote: > > On Friday, 24 April 2015 at 17:50:03 UTC, AndyC wrote: > >> Hi All, I cannot seem to understand whats wrong with this: > >> > >> // main.d > >> import std.stdio; > >> import std.digest.

Re: Startup files for STM32F4xx

2015-04-24 Thread tom via Digitalmars-d-learn
On Friday, 24 April 2015 at 13:12:56 UTC, Jens Bauer wrote: On Friday, 24 April 2015 at 07:34:55 UTC, tom wrote: would something like a STM32 NUCLEO-F401RE work? I forgot to give you a proper answer on this one: I think it should work, as it's a STM32F401 microcontroller. ill order a disc

Re: How to output ascii character using terminal.d

2015-04-24 Thread Adam D. Ruppe via Digitalmars-d-learn
Also try cast(dchar) instead of cast(char), that might do what you need.

Re: Startup files for STM32F4xx

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Friday, 24 April 2015 at 12:55:46 UTC, Steven Schveighoffer wrote: I was hoping that github access would be possible now with a more modern browser, no? Actually I was getting sleepy and had to do something else the next day, so I couldn't start right away. But I'll have to learn using Gi

Re: Startup files for STM32F4xx

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Friday, 24 April 2015 at 22:18:22 UTC, tom wrote: ill order a discover, i have to try this out. http://www.digikey.com/product-detail/en/STM32F4DISCOVERY/497-11455-ND/2711743 this one right? This board will do nicely, but you may want to get a STM32F29 discovery board, because the STM32F42

Re: Degenerate Regex Case

2015-04-24 Thread TheFlyingFiddle via Digitalmars-d-learn
On Friday, 24 April 2015 at 18:28:16 UTC, Guillaume wrote: Hello, I'm trying to make a regex comparison with D, based off of this article: https://swtch.com/~rsc/regexp/regexp1.html I've written my code like so: import std.stdio, std.regex; void main(string argv[]) { string m = argv[

Re: Startup files for STM32F4xx

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/15 7:42 PM, Jens Bauer wrote: On Friday, 24 April 2015 at 22:18:22 UTC, tom wrote: ill order a discover, i have to try this out. http://www.digikey.com/product-detail/en/STM32F4DISCOVERY/497-11455-ND/2711743 this one right? This board will do nicely, but you may want to get a STM32F2

Re: Startup files for STM32F4xx

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Saturday, 25 April 2015 at 00:33:26 UTC, Steven Schveighoffer wrote: On 4/24/15 7:42 PM, Jens Bauer wrote: http://www.digikey.com/product-search/en?x=0&y=0&lang=en&site=us&keywords=stm32f429+discovery This is super tempting @ $24. As someone who is not used to tinkering with raw hardware,

Re: Startup files for STM32F4xx

2015-04-24 Thread Mike via Digitalmars-d-learn
On Saturday, 25 April 2015 at 00:33:26 UTC, Steven Schveighoffer wrote: http://www.digikey.com/product-search/en?x=0&y=0&lang=en&site=us&keywords=stm32f429+discovery This is super tempting @ $24. As someone who is not used to tinkering with raw hardware, how does one power this thing? I've

Re: Startup files for STM32F4xx

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Saturday, 25 April 2015 at 01:06:16 UTC, Mike wrote: On Saturday, 25 April 2015 at 00:33:26 UTC, Steven Schveighoffer wrote: Due to its large number of pins, and the way they are arranged, they don't plug into breadboards, but you can easily use jumper wires for that: https://www.adafruit.com

Re: Startup files for STM32F4xx

2015-04-24 Thread Rikki Cattermole via Digitalmars-d-learn
On 25/04/2015 12:54 p.m., Jens Bauer wrote: ... I now succeeded in making a mirror on GitHub: https://github.com/jens-gpio/STM32F4xx (It was absolutely tedious, because the tutorial on GitHub didn't work for me; I haven't yet added automatic mirroring; hopefully I'll be able to figure it out).

Re: How to output ascii character using terminal.d

2015-04-24 Thread Cassio Butrico via Digitalmars-d-learn
On Friday, 24 April 2015 at 22:21:16 UTC, Adam D. Ruppe wrote: Also try cast(dchar) instead of cast(char), that might do what you need. a look at this https://github.com/cassio2014/DIC

Re: Startup files for STM32F4xx

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Saturday, 25 April 2015 at 02:02:35 UTC, Rikki Cattermole wrote: Congrats! Thank you. :) Also I found this, https://github.com/defunkt/github-gem Looks interesting. Maybe this can make things easier. I created a repository for people who work with LPC17xx: https://github.com/jens-gpio/L

Re: Startup files for STM32F4xx

2015-04-24 Thread Martin Nowak via Digitalmars-d-learn
On Saturday, 25 April 2015 at 01:32:16 UTC, Jens Bauer wrote: This is most likely where the egg cracks open. i'm pretty sure we willl see people migrating to using D (at first a mixture between D and C, because of the libraries from the vendors), but later, there'll surely be projects which are

Re: Startup files for STM32F4xx

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Saturday, 25 April 2015 at 04:21:06 UTC, Martin Nowak wrote: The STM peripheral library really sux, verbose boilerplate for the simplest stuff and no type safety for the enums (find the difference of GPIO_PIN4 and GPIO_PinSource4 via debugging). I couldn't agree more. I especially hate the

Re: Startup files for STM32F4xx

2015-04-24 Thread Rikki Cattermole via Digitalmars-d-learn
On 25/04/2015 5:07 p.m., Jens Bauer wrote: On Saturday, 25 April 2015 at 04:21:06 UTC, Martin Nowak wrote: The STM peripheral library really sux, verbose boilerplate for the simplest stuff and no type safety for the enums (find the difference of GPIO_PIN4 and GPIO_PinSource4 via debugging). I

Re: Startup files for STM32F4xx

2015-04-24 Thread tom via Digitalmars-d-learn
On Saturday, 25 April 2015 at 04:01:47 UTC, Jens Bauer wrote: (still no automatic mirroring, though I've installed https://github.com/miracle2k/gitolite-simple-mirror) it should be fairly simple, check the logs. most probably something failing with authentication. (btw, for those who don't know

Re: Startup files for STM32F4xx

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Saturday, 25 April 2015 at 06:25:08 UTC, tom wrote: On Saturday, 25 April 2015 at 04:01:47 UTC, Jens Bauer wrote: (still no automatic mirroring, though I've installed https://github.com/miracle2k/gitolite-simple-mirror) it should be fairly simple, check the logs. It's probably something si