Re: How create Win32api Thread in Dlang?

2020-09-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 26 September 2020 at 03:08:56 UTC, Marcone wrote: #include import core.sys.windows.windows WINAPI extern(Windows) int main(int argc, char *argv[]) { int main(string[] args) CreateThread(NULL, 0, threadFunc, NULL, 0, NULL); CreateThread(null, 0, , null, 0, null);

How create Win32api Thread in Dlang?

2020-09-25 Thread Marcone via Digitalmars-d-learn
This is C++ code: #include WINAPI DWORD threadFunc(LPVOID x) { while (true) { try { throw 1; } catch (...) { } } return 0; } int main(int argc, char *argv[]) { CreateThread(NULL, 0, threadFunc, NULL, 0, NULL); CreateThread(NULL, 0, threadFunc, NULL, 0, NULL);

Re: I need "windowsx.d" Someone can send It to me?

2020-09-25 Thread Marcone via Digitalmars-d-learn
On Saturday, 26 September 2020 at 01:43:00 UTC, Denis Feklushkin wrote: On Saturday, 26 September 2020 at 00:40:21 UTC, Marcone wrote: On Friday, 25 September 2020 at 17:00:04 UTC, Denis Feklushkin wrote: On Friday, 25 September 2020 at 15:03:56 UTC, Marcone wrote: I need windowsx.d but for I

Re: I need "windowsx.d" Someone can send It to me?

2020-09-25 Thread Denis Feklushkin via Digitalmars-d-learn
On Saturday, 26 September 2020 at 00:40:21 UTC, Marcone wrote: On Friday, 25 September 2020 at 17:00:04 UTC, Denis Feklushkin wrote: On Friday, 25 September 2020 at 15:03:56 UTC, Marcone wrote: I need windowsx.d but for I don't know the reason is not in dmd. Someone that have it can send to

Re: I need "windowsx.d" Someone can send It to me?

2020-09-25 Thread Marcone via Digitalmars-d-learn
On Friday, 25 September 2020 at 17:00:04 UTC, Denis Feklushkin wrote: On Friday, 25 September 2020 at 15:03:56 UTC, Marcone wrote: I need windowsx.d but for I don't know the reason is not in dmd. Someone that have it can send to me? I don't know convert windowsx.h to windowsx.d Try to

Re: Capture offset of matches in std.regex.matchAll?

2020-09-25 Thread Lewis via Digitalmars-d-learn
On Monday, 7 July 2014 at 21:32:30 UTC, JD wrote: I'm using a compile time regex to find some tags in an input string. Is it possible to capture the offset of the matches in some way? Otherwise I have to "calculate" the offsets myself by iterating over the results of matchAll. Thanks, Jeroen

Re: Is it possible to "overload" based on visibility?

2020-09-25 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Sep 25, 2020 at 05:58:08PM +, 60rntogo via Digitalmars-d-learn wrote: > On Friday, 25 September 2020 at 15:21:22 UTC, Steven Schveighoffer wrote: > > If the input is not ref, you should not return by ref, because then > > you would be returning a reference to local stack data that is

Re: Is it possible to "overload" based on visibility?

2020-09-25 Thread 60rntogo via Digitalmars-d-learn
On Friday, 25 September 2020 at 15:21:22 UTC, Steven Schveighoffer wrote: If the input is not ref, you should not return by ref, because then you would be returning a reference to local stack data that is about to be destroyed. Yes, I understand that. What I'm really after at this point is

Re: I need "windowsx.d" Someone can send It to me?

2020-09-25 Thread Denis Feklushkin via Digitalmars-d-learn
On Friday, 25 September 2020 at 15:03:56 UTC, Marcone wrote: I need windowsx.d but for I don't know the reason is not in dmd. Someone that have it can send to me? I don't know convert windowsx.h to windowsx.d Try to convert C header into D file by dpp tool.

Re: Is it possible to "overload" based on visibility?

2020-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/20 11:21 AM, Steven Schveighoffer wrote: I wouldn't depend on that mechanism yes. *yet*. -Steve

Re: Is it possible to "overload" based on visibility?

2020-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/20 11:13 AM, 60rntogo wrote: On Friday, 25 September 2020 at 14:21:59 UTC, Steven Schveighoffer wrote: in does not mean "take by reference", it means "scope const" I'm not sure that I really understand scope, but I read https://dlang.org/spec/function.html#param-storage as saying "in

Re: Is it possible to "overload" based on visibility?

2020-09-25 Thread 60rntogo via Digitalmars-d-learn
On Friday, 25 September 2020 at 14:21:59 UTC, Steven Schveighoffer wrote: in does not mean "take by reference", it means "scope const" I'm not sure that I really understand scope, but I read https://dlang.org/spec/function.html#param-storage as saying "in means take by value or reference

Re: Compile and run in Win10-VSCode

2020-09-25 Thread Aldo via Digitalmars-d-learn
On Friday, 25 September 2020 at 13:38:56 UTC, Paul wrote: Hi Community, I'm Win10: I have VSCode installed. I have DMD installed and can compile examples from a Win CMD console. 1) How do I compile and run from within VSCode? 2) VSCode Extensions: Do I need them? One kept

I need "windowsx.d" Someone can send It to me?

2020-09-25 Thread Marcone via Digitalmars-d-learn
I need windowsx.d but for I don't know the reason is not in dmd. Someone that have it can send to me? I don't know convert windowsx.h to windowsx.d

Re: Is it possible to "overload" based on visibility?

2020-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/20 10:12 AM, 60rntogo wrote: On Friday, 25 September 2020 at 13:15:27 UTC, Steven Schveighoffer wrote: ou can use auto ref to alleviate that: int x()(auto ref Foo f) // needs to be a template for auto ref to work That's a good point, thanks. Since we are on that topic, how would

Re: Is it possible to "overload" based on visibility?

2020-09-25 Thread 60rntogo via Digitalmars-d-learn
On Friday, 25 September 2020 at 13:15:27 UTC, Steven Schveighoffer wrote: I don't know, you can search for and report it here: https://issues.dlang.org I find it quite hard to search for anything here, but I couldn't find anything similar so I submitted a bug report. You can use auto ref

Re: Compile and run in Win10-VSCode

2020-09-25 Thread Imperatorn via Digitalmars-d-learn
On Friday, 25 September 2020 at 13:38:56 UTC, Paul wrote: Hi Community, I'm Win10: I have VSCode installed. I have DMD installed and can compile examples from a Win CMD console. 1) How do I compile and run from within VSCode? 2) VSCode Extensions: Do I need them? One kept

Compile and run in Win10-VSCode

2020-09-25 Thread Paul via Digitalmars-d-learn
Hi Community, I'm Win10: I have VSCode installed. I have DMD installed and can compile examples from a Win CMD console. 1) How do I compile and run from within VSCode? 2) VSCode Extensions: Do I need them? One kept generating errors and a note said it was not under active

Re: A scheduled control signal with fibers?

2020-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/20 9:16 AM, Ferhat Kurtulmuş wrote: On Friday, 25 September 2020 at 13:08:16 UTC, Sebastiaan Koppe wrote: On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş wrote: [...] No need for fibers per se. You can run 2 threads. One that produces {time: now + 1500.msecs, value:

Re: A scheduled control signal with fibers?

2020-09-25 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 25 September 2020 at 13:13:50 UTC, Sebastiaan Koppe wrote: On Friday, 25 September 2020 at 13:08:16 UTC, Sebastiaan Koppe wrote: On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş How can I implement schedulePWMSignalToValve(pwmval, afterNmilliseconds ) using fibers?

Re: A scheduled control signal with fibers?

2020-09-25 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 25 September 2020 at 13:08:16 UTC, Sebastiaan Koppe wrote: On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş wrote: [...] No need for fibers per se. You can run 2 threads. One that produces {time: now + 1500.msecs, value: getFlameIntensityViaImageProcessing} objects

Re: A scheduled control signal with fibers?

2020-09-25 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 25 September 2020 at 13:08:16 UTC, Sebastiaan Koppe wrote: On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş How can I implement schedulePWMSignalToValve(pwmval, afterNmilliseconds ) using fibers? No need for fibers per se. Can also use

Re: Is it possible to "overload" based on visibility?

2020-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/20 3:43 AM, 60rntogo wrote: On Wednesday, 23 September 2020 at 19:27:13 UTC, Steven Schveighoffer wrote: This is a bug in the language. Is this a known bug? If not, it should be reported. I don't know, you can search for and report it here: https://issues.dlang.org I came up

Re: A scheduled control signal with fibers?

2020-09-25 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş wrote: int main(){ ... while(true){ int pwmval = getFlameIntensityViaImageProcessing(); sendPWMSignalToValfe(pwmval); // I need this streamed ctrl signal to the valfe with a delayed time shift //

Re: A scheduled control signal with fibers?

2020-09-25 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 25 September 2020 at 12:43:41 UTC, Imperatorn wrote: On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş wrote: [...] A naive implementation would be to store 1500 ms worth of data with the pwm values, like a buffer. I guess memory is not a problem if you're using a

Re: A scheduled control signal with fibers?

2020-09-25 Thread Imperatorn via Digitalmars-d-learn
On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş wrote: Hi, I have a problem to solve that may be solved using fibers. I have no previous experience with fibers. We are working on a variable-rate weeder. A camera is installed in front of a tractor. A flame weeder is connected

Re: what's the best way to convert a sysTime to local machine's time (zone)?

2020-09-25 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 24 September 2020 at 22:22:13 UTC, mw wrote: Hi, I'm just wondering what's the best way to convert sysTime to local machine's time (zone)? Is there any library function does this already? https://dlang.org/phobos/std_datetime_systime.html#SysTime (The time in SysTime is kept

A scheduled control signal with fibers?

2020-09-25 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
Hi, I have a problem to solve that may be solved using fibers. I have no previous experience with fibers. We are working on a variable-rate weeder. A camera is installed in front of a tractor. A flame weeder is connected to the behind of a tractor. Doing image processing (on RP3), we

Re: Is it possible to "overload" based on visibility?

2020-09-25 Thread 60rntogo via Digitalmars-d-learn
On Wednesday, 23 September 2020 at 19:27:13 UTC, Steven Schveighoffer wrote: This is a bug in the language. Is this a known bug? If not, it should be reported. I came up with an answer to my original question that sort of works: --- module foo; struct Foo { private int x; } int x(Foo