Jump to content

dummzeuch

Members
  • Content Count

    1029
  • Joined

  • Last visited

  • Days Won

    39

Everything posted by dummzeuch

  1. Did you know that this is possible: type TImageConvertOuputConfigEnum = ( IMAGE_CONVERT_OUTPUT_CONFIG_IMAGE_ID = $02, //(1 << 1), //**< output pixels points to a ImageId */ IMAGE_CONVERT_OUTPUT_CONFIG_O0 = $04, //(1 << 2), //**< disable CPU optimizations such as SSSE3 */ IMAGE_CONVERT_OUTPUT_CONFIG_BAYER_METHOD_1 = $10, //(1 << 4), //**< select bayer decoding method 1 (3x3 interpolation, a.k.a. legacy method) */ IMAGE_CONVERT_OUTPUT_CONFIG_BAYER_METHOD_2 = $20, //(2 << 4), //**< select bayer decoding method 2 (3x3 median-based interpolation, a.k.a. advanced method) */ IMAGE_CONVERT_OUTPUT_CONFIG_BAYER_METHOD_3 = $30, //(3 << 4), //**< select bayer decoding method 3 (5x5 gradient-based interpolation) */ IMAGE_CONVERT_OUTPUT_CONFIG_DEFAULT = IMAGE_CONVERT_OUTPUT_CONFIG_BAYER_METHOD_1, IMAGE_CONVERT_OUTPUT_CONFIG_BAYER_ADVANCED = IMAGE_CONVERT_OUTPUT_CONFIG_BAYER_METHOD_2 ); This is a translation of a C header file. I only now noticed that the enum contains duplicate values which I until now thought was impossible. IMAGE_CONVERT_OUTPUT_CONFIG_DEFAULT is a duplicate of IMAGE_CONVERT_OUTPUT_CONFIG_BAYER_METHOD_1, both having the ordinal value $10, and IMAGE_CONVERT_OUTPUT_CONFIG_BAYER_ADVANCED is a duplicate of IMAGE_CONVERT_OUTPUT_CONFIG_BAYER_METHOD_2, both having the ordinal value $20. The Tokyo Docwiki actually has such an example: It compiles with Delphi 2007 so it must have been possible for a long time. "Man wird alt wie 'ne Kuh und lernt immernoch dazu." -- my mother
  2. dummzeuch

    When can Class.Create fail?

    He was talking about the destructor, not the constructor. It's very unlikely that a destructor runs into an out of memory condition. Yes it can happen, but usually it's the constructor that fails due to it, not the destructor.
  3. dummzeuch

    When can Class.Create fail?

    Just one remark here: If the constructor raises an exception, the destructor will be called automatically. You must always be aware that the destructor might run on an only partially initialized instance.
  4. The GExperts PE Information tool just got a small improvement: The Exports list can now be sorted by clicking on the column header and filtered on the export name by simply typing text. Read on in the blog post.
  5. dummzeuch

    ICS v8.64 can't compile on Delphi 7

    I tend to use jedi.inc, which is pretty comprehensive, but I still had to extend it for various compiler specific problems. Lately I have switched from using {$ifdef} to {$if declared() }when it comes to checking if a type or function is already available or has to be implemented in one of my units. But in y not sure I really like that, because it becomes harder to read.
  6. As the page says: 😉
  7. GExperts supports even more laziness I got into programming because I am lazy, I’d rather have the computer do the boring work than doing it myself. So it’s no wonder that I always liked Delphi and GExperts because both support my laziness. Today I added yet another feature to save me a key stroke or mouse click: The “Close Exception Notification” expert. You probably have encountered those libraries that always raise the same exception class on errors, or even worse, raise the generic Exception class instead of bothering to declare their own. And if I should guess, you have probably been guilty of doing that yourself (as I definitely have). Why is that a problem, you ask? Because you can’t easily ignore these exceptions during debugging. You always get this “Debugger Exception Notification” dialog, have to read it and decide whether you want to break and look at the code or ignore the exception. Read on in the blog post.
  8. How to compile GExperts
  9. dummzeuch

    Macro Template Problem with ]

    Please file a bug report on SourceForge for this.
  10. dummzeuch

    question about GPL and Delphi

    Contrary to popular belief, the GPL does not require you to open source your code. You must only give the source to everybody who you give the binaries. But you must not place any restrictions on how that source code can be used by these people / companies. So: It's absolutely OK to use GPL code for internally used programs, as long as these programs stay within the company. (But try to explain that to management...) But if you sell your program or make it available in any other way, you will have to include the source code, not just of your own code but also of all components, which obviously is not possible, unless these components are also open source with a GPL compatible license. Btw: You don't have to put that source code under the GPL, you only need to make it available without any restrictions. So anybody else can use it, even in a GPL program. This applies for statically linking the source code, a lib / obj file or even a DLL. If I remember correctly it does not apply if your program can load a DLL on demand for some special functionality. In that case you might get away with including only some of your source code that is used for that special functionality. It does not apply at all if you call an external executable. There are no restrictions in that case.
  11. I apparently made a mistake while installing RAD Studio 2007 (some time ago) on on PC which now results in the license manager complaining about a missing license for the .NET personality. I can simply skip that wich clicking the correct buttons on several dialogs, but I would really like to get rid of these dialogs since haveing to click those buttons on every IDE start gets tiresome fast. Is there a way to uninstall / disable the .NET personality without reinstalling the whole thing or losing the updates I have already installed? I looked into the registry but could not find anything obvious.
  12. Thanks to @Arnaud Bouchez I just now remembered one of my other Delphi tools: The KnownIdePackagesManager I used that to disabled two packages: Delphi for .NET IDE Personality VCL for .NET designer IDE Package (it's probably not necessary to disable this) That did it. No more prompting for the .NET license.
  13. 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.
  14. 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.
  15. dummzeuch

    TCriticalSection and cache line size

    "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?
  16. 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.
  17. 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?
  18. dummzeuch

    TCriticalSection and cache line size

    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.
  19. (I am giving some background first, there are actually some questions at the end, so please bear with me.) In older Delphi IDEs there is a compiler option called "Reference Info" with a sub option "Definitions only". In newer IDEs it's called "Symbol reference Info" and can have three values "None", "Definitions Only" and "Reference Info". I never really thought about these options but just left them at the default which is both turned on for old Delphi versions and "Reference Info" for newer ones. Today I noticed that they were set differently in some of my projects and I wondered why that was and for the first time ever looked into the documentation on that topic: (These are just the last two paragraphs of the remarks.) "Code browsing" is the Ctrl+Click (or Alt+Up or Search -> Find original symbol, which oddly enough has an additional Hotkey Ctrl+G) feature combined with the Alt+Left / Alt + Right keys and the corresponding arrow buttons in the tool bar (respectively the two menu entries in View -> History). So that probably means that Ctrl+Click only works for units that were compiled with "Reference Info" is turned on. I could not verify this though: I switched a Delphi 10.2 project to "Symbol Reference Info = None", deleted all dcus, rebuilt it and Ctrl+Click still worked for all kinds of symbols: Inside the same unit, in other units of the projects and (less surprising, because these are the debug dcus that come with Delphi) in the RTL and VCL units. But what is "the References page of the Code Browsing feature"? Is that what you get when selecting "Find -> Find References" ? If yes, why is that menu item disabled most of the time, even though the default for newer Delphi versions is "Reference Info"? And what is the "Project Manager References Page"?
  20. dummzeuch

    Just-in-time compiling for Delphi's Regular Expressions

    Easy: Revolutionary Socialist Party 😉
  21. 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.
  22. dummzeuch

    Centered message?

    You'd get used to it. 😉
  23. dummzeuch

    Running Tokyo 10.2.3 dcc32 from the command line

    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
  24. dummzeuch

    Slight Refinement to Component Property Replace

    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.
  25. dummzeuch

    Running Tokyo 10.2.3 dcc32 from the command line

    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]
×