DeCAL – the Delphi container and algorithm library

From http://decal.sourceforge.net/:

The Delphi Container and Algorithm Library (DeCAL) is a powerful library of reusable container classes, generic algorithms, and an easy to use persistence mechanism. It is similar to and based on Stepanov’s STL.

An STL clone for Delphi? Very, very useful. I haven’t tried this library out yet but I am in the middle of making optimisations to a huge Kylix codebase at work and this will make life simpler. If it’s well unit-tested then I can see myself using the Map and Set classes a lot.

Just looking at the supplied documentation for this and the library also has a persistence mechanism for saving arbitrary objects. Not sure how that’ll work in a language that doesn’t have introspection but let’s see – sounds cool.

Kylix project files

Kylix Project Files

A Kylix project is made out of a number of files, some of which are very important (and so should not be deleted) and some of which are recreated during the save or compile process. The files are given names based either on the actual project name, or on the source module (or unit, to use the correct term) to which they relate.

When you start Kylix, it uses a default project name of Project1 and a default unit name of Unit1. The project file represents the whole application, whereas the unit typically contains the source code for an individual form. However, a unit can also be made that is unrelated to a form, containing (for example) reusable library code.

Here is a list of the more common files you will see, based on the default Kylix naming scheme:

  • Project1.dpr – The project source file
  • Project1.res – The project resource file, which is unused in Kylix (Delphi uses it for storing the application icon and version information)
  • Project1.kof – The Kylix Options File, which is a textual configuration file maintained and used by the IDE to store settings from the project options dialog
  • Project1.conf – The equivalent of the .kof file for the command-line compiler (dcc). You can readily generate Kylix applications from script files using the command-line tools, e.g.: dcc Project1.dpr
  • Unit1.pas – A Delphi PAScal unit
  • Unit1.xfm – The form file whose associated source code
  • Unit1.dcu – A compiled version of Unit1.pas (Delphi compiled unit)
  • Project1.~dpr – A backup of the project file. Unit1.~pas – A backup of the form unit
  • Unit1.~xfm – A backup of the form file
  • Project1 – The resultant executable compiled from your project and associated files

Delphi / Kylix runtime error codes

1 Invalid function number
2 File not found
3 Path not found
4 Too many open files
5 File access denied
6 Invalid file handle
12 Invalid file access code
15 Invalid drive number
16 Cannot remove current directory
17 Cannot rename across drives
100 Disk read error
101 Disk write error
102 File not assigned
103 File not open
104 File not open for input
105 File not open for output
106 Invalid numeric format
200 Division by zero
201 Range check error
202 Stack overflow error
203 Heap overflow error
204 Invalid pointer operation
205 Floating point overflow
206 Floating point underflow
207 Invalid floating point operation
210 Object not initialized
211 Call to abstract method
212 Stream registration error
213 Collection index out of range
214 Collection overflow error
215 Arithmetic overflow error
216 General protection fault
217 reControlBreak
218 rePrivInstruction
219 reInvalidCast
220 reVarTypeCast
221 reVarInvalidOp
222 reVarDispatch
223 reVarArrayCreate
224 reVarNotArray
225 reVarArrayBounds
227 reAssertionFailed
228 reIntfCastError
229 reSafeCallError

230 Reserved by the compiler for unhandled exceptions
231 Too many nested exceptions
232 Fatal signal raised on a non-Delphi thread
234 reCodesetConversion

Codes 230, 231, 232 and 234 are Linux only.

Free pascal 2.2.0 command line options

Free Pascal Compiler version 2.2.0 [2007/11/06] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
/usr/lib/fpc/2.2.0/ppc386 [options] <inputfile> [options]
put + after a boolean switch option to enable it, – to disable it
-a the compiler doesn’t delete the generated assembler file
-al list sourcecode lines in assembler file
-an list node info in assembler file
-ap use pipes instead of creating temporary assembler files
-ar list register allocation/release info in assembler file
-at list temp allocation/release info in assembler file
-A<x> output format:
-Adefault use default assembler
-Aas assemble using GNU AS
-Anasmcoff coff (Go32v2) file using Nasm
-Anasmelf elf32 (Linux) file using Nasm
-Anasmwin32Win32 object file using Nasm
-AnasmwdosxWin32/WDOSX object file using Nasm
-Awasm obj file using Wasm (Watcom)
-Anasmobj obj file using Nasm
-Amasm obj file using Masm (Microsoft)
-Atasm obj file using Tasm (Borland)
-Aelf elf32 (Linux) using internal writer
-Acoff coff (Go32v2) using internal writer
-Apecoff pecoff (Win32) using internal writer
-b generate browser info
-bl generate local symbol info
-B build all modules
-C<x> code generation options:
-Cc<x> set default calling convention to <x>
-CD create also dynamic library (not supported)
-Ce Compilation with emulated floating point opcodes
-Cf<x> Select fpu instruction set to use, see fpc -i for possible values
-Cg Generate PIC code
-Ch<n> <n> bytes heap (between 1023 and 67107840)
-Ci IO-checking
-Cn omit linking stage
-Co check overflow of integer operations
-Cp<x> select instruction set, see fpc -i for possible values
-CP<x>=<y> packing settings
-CPPACKSET=<y> <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 and 8
-Cr range checking
-CR verify object method call validity
-Cs<n> set stack size to <n>
-Ct stack checking
-CX create also smartlinked library
-d<x> defines the symbol <x>
-D generate a DEF file
-Dd<x> set description to <x>
-Dv<x> set DLL version to <x>
-e<x> set path to executable
-E same as -Cn
-fPIC same as -Cg
-F<x> set file names and paths:
-Fa<x>[,y] for a program load first units <x> and [y] before uses is parsed
-Fc<x> sets input codepage to <x>
-FD<x> sets the directory where to search for compiler utilities
-Fe<x> redirect error output to <x>
-FE<x> set exe/unit output path to <x>
-Fi<x> adds <x> to include path
-Fl<x> adds <x> to library path
-FL<x> uses <x> as dynamic linker
-Fo<x> adds <x> to object path
-Fr<x> load error message file <x>
-Fu<x> adds <x> to unit path
-FU<x> set unit output path to <x>, overrides -FE
-g generate debugger information:
-gc generate checks for pointers
-gd use dbx
-gg use gsym
-gh use heap trace unit (for memory leak debugging)
-gl use line info unit to show more info for backtraces
-gp preserve case in stabs symbol names
-gt trash local variables (to detect uninitialized uses)
-gv generates programs traceable with valgrind
-gw generate dwarf debugging info
-i information
-iD return compiler date
-iV return compiler version
-iW return full compiler version
-iSO return compiler OS
-iSP return compiler processor
-iTO return target OS
-iTP return target processor
-I<x> adds <x> to include path
-k<x> Pass <x> to the linker
-l write logo
-M<x> set language mode to <x>
-Mfpc free pascal dialect (default)
-Mobjfpc switch some Delphi 2 extensions on
-Mdelphi tries to be Delphi compatible
-Mtp tries to be TP/BP 7.0 compatible
-Mgpc tries to be gpc compatible
-Mmacpas tries to be compatible to the macintosh pascal dialects
-n don’t read the default config file
-N<x> node tree optimizations
-Nu unroll loops
-o<x> change the name of the executable produced to <x>
-O<x> optimizations:
-O- disable optimizations
-O1 level 1 optimizations (quick and debugger friendly)
-O2 level 2 optimizations (-O1 + quick optimizations)
-O3 level 3 optimizations (-O2 + slow optimizations)
-Oa<x>=<y> set alignment
-Oo[NO]<x> enable or disable optimizations, see fpc -i for possible values
-Op<x> set target cpu for optimizing, see fpc -i for possible values
-Os generate smaller code
-pg generate profile code for gprof (defines FPC_PROFILE)
-R<x> assembler reading style:
-Rdefault use default assembler
-Ratt read AT&T style assembler
-Rintel read Intel style assembler
-S<x> syntax options:
-S2 same as -Mobjfpc
-Sc supports operators like C (*=,+=,/= and -=)
-Sa include assertion code.
-Sd same as -Mdelphi
-Se<x> error options. <x> is a combination of the following:
<n> : compiler stops after the <n> errors (default is 1)
w : compiler stops also after warnings
n : compiler stops also after notes
h : compiler stops also after hints
-Sg allow LABEL and GOTO
-Sh Use ansistrings
-Si support C++ styled INLINE
-Sk load fpcylix unit
-SI<x> set interface style to <x>
-SIcom COM compatible interface (default)
-SIcorba CORBA compatible interface
-Sm support macros like C (global)
-So same as -Mtp
-Sp same as -Mgpc
-Ss constructor name must be init (destructor must be done)
-St allow static keyword in objects
-Sx enable exception keywords (default in Delphi/ObjFPC modes)
-s don’t call assembler and linker
-sh Generate script to link on host
-st Generate script to link on target
-sr Skip register allocation phase (use with -alr)
-T<x> Target operating system:
-Temx OS/2 via EMX (including EMX/RSX extender)
-Tfreebsd FreeBSD
-Tgo32v2 Version 2 of DJ Delorie DOS extender
-Tlinux Linux
-Tnetbsd NetBSD
-Tnetware Novell Netware Module (clib)
-Tnetwlibc Novell Netware Module (libc)
-Topenbsd OpenBSD
-Tos2 OS/2 / eComStation
-Tsunos SunOS/Solaris
-Twatcom Watcom compatible DOS extender
-Twdosx WDOSX DOS extender
-Twin32 Windows 32 Bit
-Twince Windows CE
-u<x> undefines the symbol <x>
-U unit options:
-Un don’t check the unit name
-Ur generate release unit files
-Us compile a system unit
-v<x> Be verbose. <x> is a combination of the following letters:
e : Show errors (default) 0 : Show nothing (except errors)
w : Show warnings u : Show unit info
n : Show notes t : Show tried/used files
h : Show hints c : Show conditionals
i : Show general info d : Show debug info
l : Show linenumbers r : Rhide/GCC compatibility mode
a : Show everything x : Executable info (Win32 only)
b : Write file names messages with full path
v : write fpcdebug.txt with p : Write tree.log with parse tree
lots of debugging info
-W<x> Win32-like target options
-WB Create a relocatable image
-WB<x> Set Image base to Hexadecimal <x> value
-WC Specify console type application
-WD Use DEFFILE to export functions of DLL or EXE
-WF Specify full-screen type application (OS/2 only)
-WG Specify graphic type application
-WN Do not generate relocation code (necessary for debugging)
-WR Generate relocation code
-X executable options:
-Xc pass –shared to the linker (Unix only)
-Xd don’t use standard library search path (needed for cross compile)
-Xe use external linker
-XD try to link units dynamic (defines FPC_LINK_DYNAMIC)
-Xi use internal linker
-Xm generate link map
-XM<x> set the name of the ‘main’ program routine (default is ‘main’)
-XP<x> prepend the binutils names with the prefix <x>
-Xr<x> set library search path to <x> (needed for cross compile)
-Xs strip all symbols from executable
-XS try to link units static (default) (defines FPC_LINK_STATIC)
-Xt link with static libraries (-static is passed to linker)
-XX try to link units smart (defines FPC_LINK_SMART)

-? shows this help
-h shows this help without waiting

Free Pascal 2.0.4 command line options

fpc [options] <inputfile> [options]

put + after a boolean switch option to enable it, – to disable it
-a the compiler doesn’t delete the generated assembler file
-al list sourcecode lines in assembler file
-an list node info in assembler file
-ap use pipes instead of creating temporary assembler files
-ar list register allocation/release info in assembler file
-at list temp allocation/release info in assembler file
-A<x> output format:
-Adefault use default assembler
-Aas assemble using GNU AS
-b generate browser info
-bl generate local symbol info
-B build all modules
-C<x> code generation options:
-Cc<x> set default calling convention to <x>
-CD create also dynamic library (not supported)
-Ce Compilation with emulated floating point opcodes
-Cf<x> Select fpu instruction set to use, see fpc -i for possible values
-Cg Generate PIC code
-Ch<n> <n> bytes heap (between 1023 and 67107840)
-Ci IO-checking
-Cn omit linking stage
-Co check overflow of integer operations
-Cp<x> select instruction set, see fpc -i for possible values
-Cr range checking
-CR verify object method call validity
-Cs<n> set stack size to <n>
-Ct stack checking
-CX create also smartlinked library
-d<x> defines the symbol <x>
-D generate a DEF file
-Dd<x> set description to <x>
-Dv<x> set DLL version to <x>
-e<x> set path to executable
-E same as -Cn
-F<x> set file names and paths:
-Fa<x>[,y] for a program load first units <x> and [y] before uses is parsed
-Fc<x> sets input codepage to <x>
-FD<x> sets the directory where to search for compiler utilities
-Fe<x> redirect error output to <x>
-FE<x> set exe/unit output path to <x>
-Fi<x> adds <x> to include path
-Fl<x> adds <x> to library path
-FL<x> uses <x> as dynamic linker
-Fo<x> adds <x> to object path
-Fr<x> load error message file <x>
-Fu<x> adds <x> to unit path
-FU<x> set unit output path to <x>, overrides -FE
-g generate debugger information:
-gc generate checks for pointers
-gd use dbx
-gg use gsym
-gh use heap trace unit (for memory leak debugging)
-gl use line info unit to show more info for backtraces
-gv generates programs traceable with valgrind
-gw generate dwarf debugging info
-i information
-iD return compiler date
-iV return compiler version
-iW return full compiler version
-iSO return compiler OS
-iSP return compiler processor
-iTO return target OS
-iTP return target processor
-I<x> adds <x> to include path
-k<x> Pass <x> to the linker
-l write logo
-M<x> set language mode to <x>
-Mfpc free pascal dialect (default)
-Mobjfpc switch some Delphi 2 extensions on
-Mdelphi tries to be Delphi compatible
-Mtp tries to be TP/BP 7.0 compatible
-Mgpc tries to be gpc compatible
-Mmacpas tries to be compatible to the macintosh pascal dialects
-n don’t read the default config file
-o<x> change the name of the executable produced to <x>
-O<x> optimizations:
-Or keep certain variables in registers
-pg generate profile code for gprof (defines FPC_PROFILE)
-R<x> assembler reading style:
-Rdefault use default assembler
-S<x> syntax options:
-S2 same as -Mobjfpc
-Sc supports operators like C (*=,+=,/= and -=)
-Sa include assertion code.
-Sd same as -Mdelphi
-Se<x> error options. <x> is a combination of the following:
<n> : compiler stops after the <n> errors (default is 1)
w : compiler stops also after warnings
n : compiler stops also after notes
h : compiler stops also after hints
-Sg allow LABEL and GOTO
-Sh Use ansistrings
-Si support C++ styled INLINE
-Sk load fpcylix unit
-SI<x> set interface style to <x>
-SIcom COM compatible interface (default)
-SIcorba CORBA compatible interface
-Sm support macros like C (global)
-So same as -Mtp
-Sp same as -Mgpc
-Ss constructor name must be init (destructor must be done)
-St allow static keyword in objects
-s don’t call assembler and linker
-sh Generate script to link on host
-st Generate script to link on target
-sr Skip register allocation phase (use with -alr)
-T<x> Target operating system:
-Tlinux Linux
-u<x> undefines the symbol <x>
-U unit options:
-Un don’t check the unit name
-Ur generate release unit files
-Us compile a system unit
-v<x> Be verbose. <x> is a combination of the following letters:
e : Show errors (default) 0 : Show nothing (except errors)
w : Show warnings u : Show unit info
n : Show notes t : Show tried/used files
h : Show hints c : Show conditionals
i : Show general info d : Show debug info
l : Show linenumbers r : Rhide/GCC compatibility mode
a : Show everything x : Executable info (Win32 only)
b : Write file names messages with full path
v : write fpcdebug.txt with p : Write tree.log with parse tree
lots of debugging info
-X executable options:
-Xc pass –shared to the linker (Unix only)
-Xd don’t use standard library search path (needed for cross compile)
-XD try to link units dynamic (defines FPC_LINK_DYNAMIC)
-Xm generate link map
-XM<x> set the name of the ‘main’ program routine (default is ‘main’)
-XP<x> prepend the binutils names with the prefix <x>
-Xr<x> set library search path to <x> (needed for cross compile)
-Xs strip all symbols from executable
-XS try to link units static (default) (defines FPC_LINK_STATIC)
-Xt link with static libraries (-static is passed to linker)
-XX try to link units smart (defines FPC_LINK_SMART)

-? shows this help
-h shows this help without waiting