1. Copyright
Original Source code remains on following copyright:
Copyright (c) 1988, 2001 Borland Software Corporation
A.Bouchez disclaims copyright to the modifications made to the
original code.
In place of a legal notice, here is a blessing (from SQLite3
licence):
May you do good and not evil.
May you find forgiveness for yourself and forgive
others.
May you share freely, never taking more than you
give.
2. Installation
These files are hacked low-level source code, extracted from the original Delphi 7 run time libray and VCL.In order to install them, you MUST have a true Delphi 7 installation in your
PC (or at least the original Delphi 7 installation CD), then launch the
SynopseRTL.EXE file. This file will check for the original Delphi 7 source
files and ask for a destination folder. Keep the destination Directory name
short (aka D:\Dev\Lib) for easy maintenability. Then launch syscomp.bat to
compile the enhanced special System.dcu and SysInit.dcu files.
The expected file and date of the Delphi 7 Source files are September 2002,
October 2002, or April 2004.
According to Borland/CodeGear/Embarcadero copyright, the original
source files are needed: these installation packages only contain the diffs
made to these files.
- for the IDE, make sure that the new directory (e.g. D:\Dev\Lib) is the
FIRST in all paths ("Library" tab of the global Options), before $(DELPHI)\Lib:
a valid parameter is "d:\dev\lib;$(DELPHI)\Lib;$(DELPHI)\Bin;...." or
"d:\Dev\Lib;$(DELPHI)\source\vcl;$(DELPHI)\Source\Rtl;...."
- for the command line compiler, change the dcc32.cfg -u flag content in the
C:\Program Files\Borland\Delphi7\Bin directory into this:
-ud:\dev\lib;"C:\Program Files\Borland\Delphi7\lib" or use a custom bat file
file the proper -ud:\dev\lib command line to dcc32.exe
These files could be modified to enhance also newer version of Delphi, since the RTL files didn't change a lot until Delphi 2009 compiler version.
These files are not needed for the Synopse SQLite3 framework to compile. But with these modified files, the framework works even better.
If you don't want to hack your compiler, copy System.dcu and SysInit.dcu files into the source code directory of your project: the IDE will use it to build the executable.
Update: now the files were modified to run with Delphi 2007.
3. System.pas enhancements
- included John O'Harrow version of move() fillchar() Pos() Val() and Int64 math- included Pierre Le Riche fast _LStrCmp() implementation
- deprecated Japan Nec computer bug prevention under Win95 is removed
- shortstring delete() copy() now use move() and not slow "rep movsb/movsd"
- borland memory manager is removed and replaced with windows heap manager: we recommend using FastMM4 explicitely for VCL applications (as Delphi 2009), and leave as it is for smaller executables (e.g. for LVCL; the windows heap manager is slower than FastMM4, but sufficient for GUI small apps)
- there is an optional integrated FastMM4 memory manager inside our getmem.inc, which can be enabled by undefining HEAPMEMMANAGER conditional in getmem.inc: this FastMM4 shares its memory for the same process with external .DLL (if both EXE and DLL are compiled with undefined HEAPMEMMANAGER conditional)
- some common functions implemented in asm: _Getmem, _Freemem, IOResult...
- very common internal basic methods rewritten or improved: TObject.NewInstance, TObject.InitInstance, TObject.InheritsFrom, TObject._AfterConstruction, TObject.GetDynaMethod (used a lot in the VCL), TObject.ClassName...
- on new multi-core CPU, avoid LOCK asm usage for strings and dynamic arrays if no TThread is used (default $define AVOIDLOCK): faster with high-end PC, since such a LOCK freezes all the cores and delay the code execution a lot
- record and object initialization and finalization rewritten for speed: _InitializeArray, _FinalizeArray, _InitializeRecord, _FinalizeRecord functions
- cached resourcestring (default $define LOADRESSTRINGCACHED)
- resourcestring can be translated on the fly with the global LoadResStringTranslate procedure pointer (this feature is used in the SQLite3i18n unit)
- cached widestring allocation (if the conditional $define CACHE_WIDESTRINGS is set): with Vista, the caching is always disabled, since this OS is much faster than the previous) but you must call explicitly InitWideStringOptimize to launch caching, in order to use the right heap manager (if you intend to use FastMM4 e.g.
- asm code: 'rep ret' optimization avoid modern CPU pipeline branch misprediction; see AMD64 document § '6.2 Two-Byte Near-Return RET Instruction', page 128
- asm code XOR reg32,reg32 + MOV reg8,* is changed to faster MOVZX reg32,*
- a special version is compiled with the LVCL define flag, for even smaller code; you can download the LVCL framework in LVCL.zip
- Linux/Kylix compatibility:
. can be compiled with the command-line compiler (tested with crosskylix)
. system codepage is fixed to ISO-8859-1: widestring is available with
configuration like LANG=*.UTF-8, which is the standard nowadays for modern
distros
4. SysUtils.pas enhancements
- NormToLower[] and NormToUpper[] tables to fast character case conversion- TwoDigitLookup[] table for fast 0..99 to '00'..'99' conversion
- HexChars[] for fast 0..15 to '0'..'f' conversion
- Ansi*() functions use NormToLower[] and NormToUpper[]: call i18n unit and i18n*() functions for using current locale
- some common functions are faster than default Borland's implementation: CompareText() SameText() UpperCase() IntToStr() DecodeTime() DecodeDate() StrLen() StrComp() StrIComp() StrEnd()
- avoid use of slow PIC specific code or lodsb/stosb asm opcodes in asm for format() and such
5. Classes.pas enhancements
- faster TReader.Read() and TCustomMemoryStream.Seek()- faster TList.Get(), TCollection.GetItem() and TStringList.Get()
- under Linux, avoid variants usage for speed up and code size
6. Contnrs.pas enhancements
- faster TObjectList TComponentList TClassList Items[] read property7. ComCtrls.pas enhancements
- fix the VCL TDateTimePicker checkbox handling bug for Windows Vista8. Grids.pas enhancements
- fix Grid flickers with active theming- can use XP Themes for fixed cells if enabled
9. Printer.pas enhancements
- allows raw customization of low level parameters:. create a TPrinterNew instance instead of a TPrinter
. access to color/black&white or duplex mode e.g. with PrinterNew function
. we have to subclass TPrinter inside this unit, because Borland made the key properties and methods of the class private
10. IniFiles.pas enhancements
- faster hash implementation (in asm)- round Hash buffer Size to a power of two (faster hashing calculation)
6 reactions
1 From tueddy - 07/01/2010, 14:08
Hi,
the application reports "System.pas: CRC error 2 (extract source"
even if i use the path to original (german) installation CD.
System.pas is 476 KB (487.814 Bytes) and date is 23.08.2002
Any suggestions?
Thanks and best regards
Dirk Carstensen
2 From A.Bouchez - 08/01/2010, 10:47
The German VCL should not be exactly the same as the English one, or your CD version is an updated one.
There should be a VCL US folder in the CD: try this one!
Email me if you want more details.
3 From A.Bouchez - 15/01/2010, 10:17
If you have some problem with the patcher reporting a CRC problem, you don't have the same "original" VCL source files as the patcher expects. See this article.
4 From Tohang - 22/01/2010, 08:01
SynopseRTL.exe Install Ok.
SynopseRTL042004.exe
When files are installed there message "Open File - Security Warning". On click Run
Delphi Source File : C:\Borland\Delphi7\Source
Destination Directory : D:\Dev\Lib "Create folders in the previous"
There was an error with the message "Clasess.pas: CRC Error 2 (extract source), whether the source is damaged. Can be made with a new Install for SynopseRTL.exe like system.pas 04/2004. Thank you.
5 From Doug - 09/02/2010, 22:11
Hi Arnaud,
This is an interesting project, but I can't install it.
I have the full Delphi 7 Architect version, patched to 7.1 (7.0 build 8.1) and my System.pas file is dated 09/08/2002. When I run SynopseRTL082002 I get the CRC error for IniFiles.pas, when I run SynopseRTL042004 the error is reported for System.pas.
I even tried putting in the original Borland installation CD, but they both report the error for ComCtrls.pas.
Any suggestion?
6 From A. Bouchez - 10/02/2010, 09:01
I'll try to create a patch for this particular version of Delphi 7...
I really enjoy the Open Source approach, which share code source without any licensing issue. At least, Borland provided us with the full source code of the Delphi's VCL/RTL: that made Delphi a great product. That was a good start...
I hope Embarcadero could release some part of Delphi source code as Open Source: not the whole IDE, but the VCL/RTL at least! Big companies are making big money with Open Source, so why not a mix approach: some low level Open Source part, and some closed tools? If the Delphi command line compiler, together with the VCL/RTL should have been made free of use, it could have been great. Free Pascal is up and rising! And already Cross-Platform, multi-CPU and 64 bits! Is FPC the future of Delphi? (Troll mode ON)