Jump to content

A.M. Hoornweg

Members
  • Content Count

    473
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by A.M. Hoornweg

  1. function GuessDecimalSeparator(const Value: string): Char; var i,commacount,dotcount,lastsep:integer; c:char; Const DefaultDecimalSeparator='.'; begin commacount:=0; dotcount:=0; lastsep:=0; for i:=1 to length(value) do begin c:=value[i]; if c = '.' then begin inc(dotcount); lastsep:=i; end; if c = ',' then begin inc(commacount); lastsep:=i; end; end; Case (dotcount + commacount) of 0: result:=DefaultDecimalSeparator; //Default 1: Result:=Value[lastsep]; //accept the one separator ELSE //If a separator occurs more than once, it must be the thousand separator Begin if (commacount > dotcount) then result:='.' //multiple commas else if (dotcount > commacount) then result:=',' //multiple dots else //equal amounts, take last separator result:= Value[lastsep]; End; end; end; This function uses the simple assumption that a decimal separator should occur at most one time in the string, but thousand separators may occur multiple times.
  2. Hello all, I would like to re-build Delphi's RTL/VCL without RTTI for a certain project in which the compiled size of the DLL's and executables is important. I'd be very grateful if someone could supply some insight or maybe a script to accomplish it. I have no problem doing so using Delphi XE but Delphi Rio is giving me a hard time.
  3. A.M. Hoornweg

    Recompile Delphi RIO RTL/VCL?

    Hello, that's pretty much how I do it using Delphi XE. I copy all RTL/VCL units into a temporary subdirectory, then reference all these units in a small dummy console program (having the RTTI directives mentioned in the link above) and then perform a full build of this dummy project. The resulting bunch of DCUS can then be used instead of the regular RTL/VCL (just set a project's search path to the directory containing the dcus) and it will produce vastly smaller executables. Unfortunately, in newer Delphi versions these RTTI settings can no longer be specified per-project, they must be set per-unit, requiring a manual change of every unit and that's many hundreds of them. I was hoping there would be a way around that.
  4. A.M. Hoornweg

    Shellexecute cmd.exe with spaces

    ... unless you need to use pipes, environment variables or want to capture the output of a command line program into a file. Then cmd.exe is a real life saver for which there is no real alternative as far as I'm aware. I had precisely that case last week. In an installation routine (inno Setup) I needed to figure out if a set of Microsoft IIS components was installed correctly before allowing the user to continue the installation of my ISAPI webservice. The following one-liner gives that information sorted in a text file. cmd.exe /s /c dism /online /Get-Features /Format:table /English | sort >%tmp%\dismfeatures.txt (Note that on 64-bit systems, this particular example requires calling the 64-bit version of cmd.exe; The 32-bit version of cmd.exe will call the 32-bit version of dism.exe which is totally non-functional on 64-bit operating systems. Google "Wow64DisableWow64FsRedirection" for more info).
×