Re: parallelism with delegate

2023-09-21 Thread user1234 via Digitalmars-d-learn
On Friday, 22 September 2023 at 04:33:44 UTC, Vitaliy Fadeev wrote: On Friday, 22 September 2023 at 04:24:19 UTC, Vitaliy Fadeev wrote: ... Skip this thread. I see solution. How to delete missed posts on this forum ? It's there forever, you have to live with that error ;) See

Re: parallelism with delegate

2023-09-21 Thread Vitaliy Fadeev via Digitalmars-d-learn
On Friday, 22 September 2023 at 04:24:19 UTC, Vitaliy Fadeev wrote: ... Skip this thread. I see solution. How to delete missed posts on this forum ?

parallelism with delegate

2023-09-21 Thread Vitaliy Fadeev via Digitalmars-d-learn
able ? how to use correctly? ```d import std.parallelism; auto async_task = task!fn( args ); // error // Error: no property `opCall` for type `app.A`, did you mean `new A`? async_task.executeInNewThread(); ``` where ```d auto a = new A(); auto

Re: change object class

2023-09-21 Thread Vitaliy Fadeev via Digitalmars-d-learn
On Friday, 22 September 2023 at 03:33:08 UTC, Vitaliy Fadeev wrote: On Friday, 22 September 2023 at 02:51:10 UTC, Vitaliy Fadeev wrote: ... the most correct ``` chip __vtbl ---+ // one of __monitor | id| name | |-> Chip // init |

Re: change object class

2023-09-21 Thread Vitaliy Fadeev via Digitalmars-d-learn
On Friday, 22 September 2023 at 02:51:10 UTC, Vitaliy Fadeev wrote: ... ``` Chip id name Sense() Draw() ``` instance ``` chip = new Chip(); ``` compiled to ``` chip __vtbl -> Chip __monitor Sense() idDraw()

Re: change object class

2023-09-21 Thread Vitaliy Fadeev via Digitalmars-d-learn
On Thursday, 21 September 2023 at 18:19:47 UTC, Imperatorn wrote: On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev wrote: Hi! I want to change a method ```Draw``` on a custom object when the ```MouseIn``` event occurs. This is known as "Change State" of the object: ```Init``` ->

Re: std.file: read, readText and UTF-8 decoding

2023-09-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, September 21, 2023 9:29:17 AM MDT Uranuz via Digitalmars-d-learn wrote: > Hello! > I have some strange problem. I am trying to parse XML files and > extract some information from it. > I use library dxml for it by Jonathan M Davis. But I have a > probleme that I have multiple XML

Re: change object class

2023-09-21 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev wrote: Hi! I want to change a method ```Draw``` on a custom object when the ```MouseIn``` event occurs. This is known as "Change State" of the object: ```Init``` -> ```Hovered```. [...] Interesting, but why would you want to do

Re: Detect 8-bit alligned type TXY by TX,TY.

2023-09-21 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 19 September 2023 at 06:41:49 UTC, Vitaliy Fadeev wrote: On Tuesday, 19 September 2023 at 06:33:25 UTC, Richard (Rikki) Andrew Cattermole wrote: [...] Thank, Richard. ```.offsetof...``` mmm... May be exists some like: ```d // TXYXY = Detect!(TX,TX) // Detect!(uint,uint) ==

Re: C to D: please help translate this weird macro

2023-09-21 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 20 September 2023 at 13:53:08 UTC, Ki Rill wrote: Here is the macro: ```C #define NK_CONTAINER_OF(ptr,type,member)\ (type*)((void*)((char*)(1 ? (ptr): &((type*)0)->member) - NK_OFFSETOF(type, member))) ``` I'm trying to translate the Nuklear GUI library to D

Re: C to D: please help translate this weird macro

2023-09-21 Thread user1234 via Digitalmars-d-learn
On Thursday, 21 September 2023 at 16:28:25 UTC, Nick Treleaven wrote: (Untested) There might be a `need this` error

Re: C to D: please help translate this weird macro

2023-09-21 Thread Nick Treleaven via Digitalmars-d-learn
On Thursday, 21 September 2023 at 16:28:25 UTC, Nick Treleaven wrote: return cast(T*)(cast(void*)(cast(char*)ptr - __traits(getMember, T, member).offsetof))); There's a trailing `)` that needs removing. Also pretty sure it can be simplified to: return cast(T*)(cast(char*)ptr

Re: C to D: please help translate this weird macro

2023-09-21 Thread Nick Treleaven via Digitalmars-d-learn
On Thursday, 21 September 2023 at 02:57:07 UTC, Ki Rill wrote: On Thursday, 21 September 2023 at 02:23:32 UTC, Ki Rill wrote: wrote: [...] Translated it to this eventually: ```D auto nk_container_of(P, T)(P ptr, T type, const(char)* member) { return cast(T*)(cast(void*)(cast(char*)

Re: std.file: read, readText and UTF-8 decoding

2023-09-21 Thread Uranuz via Digitalmars-d-learn
Addition: Current solution to this problemme that I was found is: So I just check for BOM manually. Get length of bom.sequence and remove that count of items from beginning. But I dont' think that it's convenient solution, because `who knows` how much else issues with UTF could happend. And I

std.file: read, readText and UTF-8 decoding

2023-09-21 Thread Uranuz via Digitalmars-d-learn
Hello! I have some strange problem. I am trying to parse XML files and extract some information from it. I use library dxml for it by Jonathan M Davis. But I have a probleme that I have multiple XML files made by different people around the world. Some of these files was created with Byte

Re: "readln" after "readf"

2023-09-21 Thread pascal111 via Digitalmars-d-learn
On Thursday, 21 September 2023 at 11:30:02 UTC, Steven Schveighoffer wrote: On Thursday, 21 September 2023 at 09:14:14 UTC, pascal111 wrote: [...] Your readfs are not consuming the newline at the end. Add `\n` to the end of the format text. -Steve It works fine now, thanks!

Re: "readln" after "readf"

2023-09-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On Thursday, 21 September 2023 at 09:14:14 UTC, pascal111 wrote: I've a problem when I'm using "readln" after "readf" that I couldn't see my program rest and the lines of the execution ran fast: module main; import std.stdio; import std.string; import std.conv; int main(string[] args) {

"readln" after "readf"

2023-09-21 Thread pascal111 via Digitalmars-d-learn
I've a problem when I'm using "readln" after "readf" that I couldn't see my program rest and the lines of the execution ran fast: module main; import std.stdio; import std.string; import std.conv; int main(string[] args) { char[] yy; int x,y,z; writef("Enter a