Re: Single-Allocation Variable-Sized Array
On Wednesday, 18 May 2016 at 21:28:56 UTC, Nordlöw wrote: What's the preferred way in D to implement single-allocation variable-sized arrays such as /** Single-Allocation Array. */ struct ArrayN { ubyte length; // <= maxLength size room; // allocated length ubyte[0] data; // `room` number of bytes follows } where insertion/deletion typically is done via ArrayN* pushBack(ArrayN*, ubyte element); ArrayN* popBack(ArrayN*); which, when needed, will reallocate a new larger/smaller `ArrayN` ? Further, what's the official name for this structure? In C it's called a variable-length struct or object. I don't think D implements them, but this could probably work: struct Foo { size_t len; ubyte[] data() @property { auto thisptr = cast(ubyte*)(); return thisptr[Foo.sizeof..(Foo.sizeof+len)]; } }
Single-Allocation Variable-Sized Array
What's the preferred way in D to implement single-allocation variable-sized arrays such as /** Single-Allocation Array. */ struct ArrayN { ubyte length; // <= maxLength size room; // allocated length ubyte[0] data; // `room` number of bytes follows } where insertion/deletion typically is done via ArrayN* pushBack(ArrayN*, ubyte element); ArrayN* popBack(ArrayN*); which, when needed, will reallocate a new larger/smaller `ArrayN` ? Further, what's the official name for this structure?
Re: Compile Tango for DMD2 - Any instructions how to do it?
On Wednesday, 18 May 2016 at 19:49:04 UTC, Edwin van Leeuwen wrote: That does mention Windows as supported. It is quite old though, the latest github activity is from a year ago. Got it working, thanks a lot!
Re: Compile Tango for DMD2 - Any instructions how to do it?
On Wednesday, 18 May 2016 at 20:41:13 UTC, TheDGuy wrote: C:\Users\Standardbenutzer\Downloads\DUB>dub build Fetching serial-port 1.1.0 (getting selected version)... Placing serial-port 1.1.0 to C:\Users\Standardbenutzer\AppData\Roaming\dub\packages\... Performing "debug" build using dmd for x86. serial-port 1.1.0: building configuration "library"... test ~master: building configuration "application"... Linking... C:\Users\Standardbenutzer\Downloads\DUB>cd .dub C:\Users\Standardbenutzer\Downloads\DUB\.dub>cd build Oh i am sorry, i see the link now where it was placed.
Re: Compile Tango for DMD2 - Any instructions how to do it?
On Wednesday, 18 May 2016 at 19:49:04 UTC, Edwin van Leeuwen wrote: The onyx README seems to suggest it only works for POSIX. Did you try serial-port by any chance: http://code.dlang.org/packages/serial-port That does mention Windows as supported. It is quite old though, the latest github activity is from a year ago. Thanks a lot for your answer. I built serial-port successfully with Dub but the only thing i got is a 'test.exe' and a 'test.obj' file. I don't see any library files even though: C:\Users\Standardbenutzer\Downloads\DUB>dub build Fetching serial-port 1.1.0 (getting selected version)... Placing serial-port 1.1.0 to C:\Users\Standardbenutzer\AppData\Roaming\dub\packages\... Performing "debug" build using dmd for x86. serial-port 1.1.0: building configuration "library"... test ~master: building configuration "application"... Linking... C:\Users\Standardbenutzer\Downloads\DUB>cd .dub C:\Users\Standardbenutzer\Downloads\DUB\.dub>cd build
Re: Small-Size-Optimized Array
On Tuesday, 17 May 2016 at 00:50:53 UTC, Vladimir Panteleev wrote: Have a look at tempCString, but it's for internal use only at the moment. Thanks, Vladimir.
Re: Compile Tango for DMD2 - Any instructions how to do it?
On Wednesday, 18 May 2016 at 16:37:48 UTC, TheDGuy wrote: On Wednesday, 18 May 2016 at 16:13:35 UTC, Seb wrote: May I ask why you need to get tango working? It has been deprecated a long time ago and phobos (the standard library) or alternatively other packages on dub have a look of features :) Okay, it looks like 'onyx' is a library which handles serial communication in D. So tried to create a new project with DUB and add onyx as dependency but there are still some errors: http://pastebin.com/4eRBt6XX Any idea what i do wrong? The onyx README seems to suggest it only works for POSIX. Did you try serial-port by any chance: http://code.dlang.org/packages/serial-port That does mention Windows as supported. It is quite old though, the latest github activity is from a year ago.
Re: Compile Tango for DMD2 - Any instructions how to do it?
On Wednesday, 18 May 2016 at 16:13:35 UTC, Seb wrote: May I ask why you need to get tango working? It has been deprecated a long time ago and phobos (the standard library) or alternatively other packages on dub have a look of features :) Okay, it looks like 'onyx' is a library which handles serial communication in D. So tried to create a new project with DUB and add onyx as dependency but there are still some errors: http://pastebin.com/4eRBt6XX Any idea what i do wrong?
Re: Compile Tango for DMD2 - Any instructions how to do it?
On Wednesday, 18 May 2016 at 16:13:35 UTC, Seb wrote: On Wednesday, 18 May 2016 at 14:59:52 UTC, TheDGuy wrote: On Wednesday, 18 May 2016 at 14:19:48 UTC, Jacob Carlborg wrote: [1] https://github.com/SiegeLord/Tango-D2/blob/d2port/dub.json#L32 How can i get that line working? May I ask why you need to get tango working? It has been deprecated a long time ago and phobos (the standard library) or alternatively other packages on dub have a look of features :) Because the only result google gave me when i searched for "dlang serial read" was tango. If there is another library out there i don't know about and which can do serial communication as well i am looking forward to it.
Re: Compile Tango for DMD2 - Any instructions how to do it?
On Wednesday, 18 May 2016 at 14:59:52 UTC, TheDGuy wrote: On Wednesday, 18 May 2016 at 14:19:48 UTC, Jacob Carlborg wrote: [1] https://github.com/SiegeLord/Tango-D2/blob/d2port/dub.json#L32 How can i get that line working? May I ask why you need to get tango working? It has been deprecated a long time ago and phobos (the standard library) or alternatively other packages on dub have a look of features :)
Re: Compile Tango for DMD2 - Any instructions how to do it?
On Wednesday, 18 May 2016 at 14:19:48 UTC, Jacob Carlborg wrote: [1] https://github.com/SiegeLord/Tango-D2/blob/d2port/dub.json#L32 How can i get that line working?
Re: Compile Tango for DMD2 - Any instructions how to do it?
On Wednesday, 18 May 2016 at 14:19:48 UTC, Jacob Carlborg wrote: Everything in tango/stdc/posix should be ignored when compiling on Windows. Seems like this line isn't working [1], fore some reason. So what should i do? Delete the file?
Re: Compile Tango for DMD2 - Any instructions how to do it?
On 2016-05-18 14:32, TheDGuy wrote: Okay, now i get this: Performing "debug" build using dmd for x86. tango ~master: building configuration "static"... tango\sys\win32\WsaSock.d(31,14): Warning: instead of C-style syntax, use D-style syntax 'char[WSADESCRIPTION_LEN + 1] szDescription' tango\sys\win32\WsaSock.d(32,14): Warning: instead of C-style syntax, use D-style syntax 'char[WSASYS_STATUS_LEN + 1] szSystemStatus' tango\stdc\posix\unistd.d(31,9): Error: undefined identifier 'uid_t' dmd failed with exit code 1. Everything in tango/stdc/posix should be ignored when compiling on Windows. Seems like this line isn't working [1], fore some reason. I think that the developers that are using Tango are mostly using Linux or Posix. [1] https://github.com/SiegeLord/Tango-D2/blob/d2port/dub.json#L32 -- /Jacob Carlborg
Re: Compile Tango for DMD2 - Any instructions how to do it?
On Wednesday, 18 May 2016 at 12:25:47 UTC, John Colvin wrote: http://code.dlang.org/download Okay, now i get this: Performing "debug" build using dmd for x86. tango ~master: building configuration "static"... tango\sys\win32\WsaSock.d(31,14): Warning: instead of C-style syntax, use D-style syntax 'char[WSADESCRIPTION_LEN + 1] szDescription' tango\sys\win32\WsaSock.d(32,14): Warning: instead of C-style syntax, use D-style syntax 'char[WSASYS_STATUS_LEN + 1] szSystemStatus' tango\stdc\posix\unistd.d(31,9): Error: undefined identifier 'uid_t' tango\stdc\posix\unistd.d(31,9): Error: undefined identifier 'gid_t' tango\stdc\posix\unistd.d(43,9): Error: undefined identifier 'uid_t' tango\stdc\posix\unistd.d(43,9): Error: undefined identifier 'gid_t' tango\stdc\posix\unistd.d(44,9): Error: undefined identifier 'pid_t' tango\stdc\posix\unistd.d(48,9): Error: undefined identifier 'gid_t' tango\stdc\posix\unistd.d(49,9): Error: undefined identifier 'uid_t' tango\stdc\posix\unistd.d(50,9): Error: undefined identifier 'gid_t' tango\stdc\posix\unistd.d(51,9): Error: undefined identifier 'gid_t' tango\stdc\posix\unistd.d(56,9): Error: undefined identifier 'pid_t' tango\stdc\posix\unistd.d(57,9): Error: undefined identifier 'pid_t' tango\stdc\posix\unistd.d(58,9): Error: undefined identifier 'pid_t' tango\stdc\posix\unistd.d(59,9): Error: undefined identifier 'uid_t' tango\stdc\posix\unistd.d(66,9): Error: undefined identifier 'ssize_t', did you mean alias 'size_t'? tango\stdc\posix\unistd.d(67,9): Error: undefined identifier 'ssize_t', did you mean alias 'size_t'? tango\stdc\posix\unistd.d(69,9): Error: undefined identifier 'gid_t' tango\stdc\posix\unistd.d(70,9): Error: undefined identifier 'uid_t' tango\stdc\posix\unistd.d(71,9): Error: undefined identifier 'gid_t' tango\stdc\posix\unistd.d(72,9): Error: undefined identifier 'pid_t' tango\stdc\posix\unistd.d(72,9): Error: undefined identifier 'pid_t' dmd failed with exit code 1.
Re: import("dir/file") does not work
On Wednesday, 18 May 2016 at 12:20:14 UTC, Andrew Chamberlain wrote: Thank you! It looks like it's not yet included into recent DMD beta available for download. in nightly perhaps ? https://dlang.org/download.html#dmd-nightly the latest beta is always for a "point" release so it only includes regressions fixed from the previous "discrete" (.0) release, not the bug fixed since the "discrete" release to the "point" release. Thank you! Working on nightly build.
Re: Compile Tango for DMD2 - Any instructions how to do it?
Oh it looks like Dub is a program i have to install ^^
Re: Compile Tango for DMD2 - Any instructions how to do it?
On Wednesday, 18 May 2016 at 12:24:06 UTC, TheDGuy wrote: On Wednesday, 18 May 2016 at 03:15:25 UTC, Mike Parker wrote: That should get your library. Thanks for your answer. I tried that on my windows console and i got the error that the command 'dub' can't be found. http://code.dlang.org/download
Re: Compile Tango for DMD2 - Any instructions how to do it?
On Wednesday, 18 May 2016 at 03:15:25 UTC, Mike Parker wrote: That should get your library. Thanks for your answer. I tried that on my windows console and i got the error that the command 'dub' can't be found. If i try: 'dub.json build' it just opens the dub.json file in my default .json program. The only reason i want to use Tango is that i would like to read and send data from/to a serial COM port and i don't want to mess around with importing C libraries.
Re: import("dir/file") does not work
On Wednesday, 18 May 2016 at 12:16:47 UTC, Andrew Chamberlain wrote: On Wednesday, 18 May 2016 at 11:58:46 UTC, Vadim Lopatin wrote: On Wednesday, 18 May 2016 at 06:47:08 UTC, Atila Neves wrote: On Wednesday, 18 May 2016 at 05:11:51 UTC, Vadim Lopatin wrote: [...] That was a bug that was recently fixed. Atila Thank you! It looks like it's not yet included into recent DMD beta available for download. in nightly perhaps ? https://dlang.org/download.html#dmd-nightly the latest beta is always for a "point" release so it only includes regressions fixed from the previous "discrete" (.0) release, not the bug fixed since the "discrete" release to the "point" release.
Re: import("dir/file") does not work
On Wednesday, 18 May 2016 at 11:58:46 UTC, Vadim Lopatin wrote: On Wednesday, 18 May 2016 at 06:47:08 UTC, Atila Neves wrote: On Wednesday, 18 May 2016 at 05:11:51 UTC, Vadim Lopatin wrote: [...] That was a bug that was recently fixed. Atila Thank you! It looks like it's not yet included into recent DMD beta available for download. in nightly perhaps ? https://dlang.org/download.html#dmd-nightly
Re: import("dir/file") does not work
On Wednesday, 18 May 2016 at 06:47:08 UTC, Atila Neves wrote: On Wednesday, 18 May 2016 at 05:11:51 UTC, Vadim Lopatin wrote: Hello, Is it intended that import of file as array does not work if path is specified for import file name? import("dir/file.ext"); // does not work import("file.ext"); // works if dir is added to -J list I believe it would be convenient if I could just specify one -J path (e.g. -Jviews) and import any file from nested directories just by providing relative path from one of -J dirs. (checked on latest DMD under Windows; replacing / with \\ does not help) Best regards, Vadim That was a bug that was recently fixed. Atila Thank you! It looks like it's not yet included into recent DMD beta available for download.
Re: Compile Tango for DMD2 - Any instructions how to do it?
On Wednesday, 18 May 2016 at 03:13:18 UTC, Mike Parker wrote: All of dsource.org is outdated. It's a long dead site, maintained now only in read-only mode because it still has some stuff worth keeping around. I remember trying to read through an in-depth manual to how to use Tango, and I felt it had an over-emphasis on templates without having/showing simple examples of how to use the libraries (or users not wanting to use templates). It eventually made me drop from trying to use any of the Tango library. Much like the Java documentation where I recall similar issues (but with java with some of the libraries I wanted to use, it was referencing abstract classes). Although it's been several years since I looked much into either of those very closely, and I can't recall exact examples to show what I mean.
Re: import("dir/file") does not work
On Wednesday, 18 May 2016 at 05:11:51 UTC, Vadim Lopatin wrote: Hello, Is it intended that import of file as array does not work if path is specified for import file name? import("dir/file.ext"); // does not work import("file.ext"); // works if dir is added to -J list I believe it would be convenient if I could just specify one -J path (e.g. -Jviews) and import any file from nested directories just by providing relative path from one of -J dirs. (checked on latest DMD under Windows; replacing / with \\ does not help) Best regards, Vadim That was a bug that was recently fixed. Atila