-
Content Count
2857 -
Joined
-
Last visited
-
Days Won
101
Everything posted by dummzeuch
-
Remove/disable .NET personality from RAD Studio 2007
dummzeuch replied to dummzeuch's topic in Delphi IDE and APIs
Actually, this is not for developing "my IDE plugin" but developing a pre-Unicode application on a computer with specialized hardware. But yes, this won't help for that either. Thanks anyway. -
In 2011 Eric Grange blogged about a problem with the then current implementation of TCriticalSection and TMonitor: According to Allen Bauer this was fixed for TMonitor in Delphi XE2: I just looked at the code, it indeed has been done. But apparently nothing has been changed in TCriticalSection. Is this still relevant? If yes, is there a way to change the allocated memory of an object instance dynamically? I just found that David Millington blogged about Custom object memory allocation in Delphi which seems to fit the bill.
-
TCriticalSection and cache line size
dummzeuch replied to dummzeuch's topic in RTL and Delphi Object Pascal
"In a raw"? Did yo mean "in a row", as in "initialize all the objects in one go, so many are positioned sequentially in the same memory block" ? Or is there a meaning of "raw" that I don't know? -
GExperts supports even more laziness
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
I got it to work for Delphi 2005 and later. There was one version which did not support the new methed even though it is not restricted to Win32. I think it was XE2, but I am not sure any more. I made too many changes this weekend. I need to go back to that case and test it again. I have committed my changes to svn last night, if you want to have a look. -
GExperts supports even more laziness
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
One question: { when a system fires a debug event, it blocks all process(process being debugged) threads. and only ContinueDebugEvent function resumes the suspended threads. However, DoShowException is called from another Delphi IDE thread(not the thread that is debugging) meaning, you need to sync access using monitor/ccritical_section. moreover, implementing a stack of TDebugEvent in a way you push here and you pop DoShowException so you don't miss any event. } FDebugEvent := lpDebugEvent^; I understand why I should protect access to FDebugEvent for multithreading. What I don't get is why a stack should be necessary. Could you please give an example? -
TCriticalSection and cache line size
dummzeuch replied to dummzeuch's topic in RTL and Delphi Object Pascal
Unfortunately unlikely does not mean impossible. And if there is an easy fix, why not implement it? (I'm on my own time now, so I don't have to account for the time spent to my employer.) Eric Grange proposed an array of byte that increases the size of a TCriticalSection instance to 128 bytes. This probably still works for all processors currently available (on my current computer apparently it's 64 bytes), but CPUs evolve. This should do the trick: unit u_dzCriticalSection; interface uses Windows, SyncObjs; type TdzCriticalSection = class(TCriticalSection) public class function NewInstance: TObject; override; end; implementation function GetCacheLineSize: Integer; var ProcInfo, CurInfo: PSystemLogicalProcessorInformation; Len: DWORD; begin Len := 0; if (GetProcAddress(GetModuleHandle(kernel32), 'GetLogicalProcessorInformation') <> nil) and not GetLogicalProcessorInformation(nil, Len) and (GetLastError = ERROR_INSUFFICIENT_BUFFER) then begin GetMem(ProcInfo, Len); try GetLogicalProcessorInformation(ProcInfo, Len); CurInfo := ProcInfo; while Len > 0 do begin if (CurInfo.Relationship = RelationCache) and (CurInfo.Cache.Level = 1) then begin Result := CurInfo.Cache.LineSize; Exit; end; Inc(CurInfo); Dec(Len, SizeOf(CurInfo^)); end; finally FreeMem(ProcInfo); end; end; Result := 64; end; var CacheLineSize: Integer; { TdzCriticalSection } class function TdzCriticalSection.NewInstance: TObject; // see // http://delphitools.info/2011/11/30/fixing-tcriticalsection/ // for an explanation why this could speed up execution on multi core systems var InstSize: Integer; begin InstSize := InstanceSize; if InstSize < CacheLineSize then InstSize := CacheLineSize; Result := InitInstance(GetMemory(InstSize)); end; initialization CacheLineSize := GetCacheLineSize; end. -
Just-in-time compiling for Delphi's Regular Expressions
dummzeuch replied to pyscripter's topic in I made this
Easy: Revolutionary Socialist Party 😉 -
This code (from a 3rd party library) compiles fine in Delphi XE2 but does not in Delhi 10.2 (both compiling for Win32): type TWordArray = array of Word; function SomeFunction(segment_ptr: Pointer; segment_count: Integer ): TSmallintArray; var i: Integer; p : TWordArray; begin SetLength(Result, segment_count); p := segment_ptr; i := 0; while ((i < segment_count)) do begin Result[i] := SwapInt16(p[i]); inc(i) end; end; I get an error in the line that assigns segment_ptr to p: [dcc32 Error] test.pas(197): E2010 Incompatible types: 'TWordArray' and 'Pointer' Is there a compiler setting which allows that kind of assignment? (I didn't even know that this is possible). How else could that be resolved? My first attempt is this: function SomeFunction(segment_ptr: Pointer; segment_count: Integer): TSmallintArray; type TWordArray0 = array[0..0] of Word; PWordArray = ^TWordArray0; var i: Integer; p: PWordArray; begin SetLength(Result, segment_count); p := segment_ptr; i := 0; while ((i < segment_count)) do begin Result[i] := SwapInt16(p^[i]); inc(i) end; end; This compiles and probably should work fine (haven't tried it), but it feels so 1990ies.
-
You'd get used to it. 😉
-
Running Tokyo 10.2.3 dcc32 from the command line
dummzeuch replied to David Schwartz's topic in Delphi IDE and APIs
Yes. Or you copy the code from the rsvars.bat file and append the msbuild line. Note that you need to check where the user actually installed his Delphi. E.g. I didn't install to %ProgramFiles%. You can get that information from the registry: HKEY_CURRENT_USER\Software\Embarcadero\BDS\21.0 -> RootDir -
Slight Refinement to Component Property Replace
dummzeuch replied to Gary Mugford's topic in GExperts
Wouldn't opening the database and tables in the data module's constructor solve this problem? I've never been a fan of leaving anything active in the designer. I must admit that I currently have no idea how this particular expert works. And I'm currently too busy with other stuff to invest much time in it. If you think it's worth the effort, please file a feature request on SourceForge for it. A few screen shots would go a long way to make a bit clearer what you mean. Or even better: An example project, which could then also be used to test the changes, if I or anybody else ever comes around doing it. -
Running Tokyo 10.2.3 dcc32 from the command line
dummzeuch replied to David Schwartz's topic in Delphi IDE and APIs
I somehow doubt that, even assuming that you skipped or at least dropped Delphi 8 like every sane person. Delphi 2005 and 2006 didn't use msbuild. [/smartass mode] -
Assign a pointer to a dynamic array
dummzeuch replied to dummzeuch's topic in RTL and Delphi Object Pascal
Sh*t I forgot to replace the function name. I guess they have, but that code is from a release a few years old, way before Delphi 10.x. Maybe we should have updated, but given the "fun" I just had with another component update, I decided to simply try and compile the sources. -
Running Tokyo 10.2.3 dcc32 from the command line
dummzeuch replied to David Schwartz's topic in Delphi IDE and APIs
https://delphi.fandom.com/wiki/Compile_from_Commandline It doesn't explicitly mention anything newer than Delphi 2007, but since the process has not changed, why should it? -
Assign a pointer to a dynamic array
dummzeuch replied to dummzeuch's topic in RTL and Delphi Object Pascal
Why didn't I think of that? -
This is an assertion message in synedit. It only happens if there was another exception before that which prevents that call.
-
GExperts supports even more laziness
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
This is awesome! I have tried it with Delphi 10.2 so far (no optOSX64 there) and it worked as advertised. Now I need a break, my head is smoking! (had a bad day on top of that) -
GExperts supports even more laziness
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
By popular request of a single gentleman (*) there is now a button "Ignore All this Session". The exception class name is now also a regex. Empty matches any exception. (* I'm not sure this really carries the meaning of the German joke "Auf vielfachen Wunsch eines einzelnen Herrn ..." ) -
GExperts supports even more laziness
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
I'm definitely a bit slow today. I can't make out what the screenshot is supposed to tell me. -
GExperts supports even more laziness
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
From the description I gather that I would have to implement IOTAProcessNotifier90 and hope that CurrentThreadChanged is called often and timely enough to provide the information on time. Might be worth a try. -
GExperts supports even more laziness
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
In that case: Did you file a feature request with Embarcadero? I'm sure I'm not the only one who would vote on it. -
GExperts supports even more laziness
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
If you have got a suggestion on how that could be implemented, I'll give it a try. So far I don't see a way to get information about the thread in which the exception has been raised. -
GExperts supports even more laziness
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
Subclass checks would be very difficult to implement because all the expert knows is the exception name and the message. I know of no way to query the class inheritance in that context. But a regex for the name would be possible. -
GExperts supports even more laziness
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
This particular problem was Delphi 2005 specific. It resulted in an error message on every start of the IDE, when the GExperts DLL was compiled with optimization on. That's why I never encountered it in my tests before, because all my test builds are compiled with optimization turned off. I don't remember why I changed that this time. Maybe I just forgot to uncheck that option. Delphi 2005 did not have separate configurations for Release and Debug builds, that came with Delphi 2007. As for older versions: Those did not support the inline keyword. -
GExperts supports even more laziness
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
You have definitely earned it. Without your help, I wouldn't have been able to add this functionality and track down all those bugs.