This contains a general purpose pascal library coded by us for different purposes. All these utilities are freeware or free software and come under no guarantee whatsoever.
Generic common code for porting source on
different pascal compilers. Currently supported compilers are
Virtual Pascal, Delphi, Kylix, Free Pascal and Turbo Pascal. This
includes objects
, dos
and strings
units for Delphi.
Generic unicode handling routines, defined
as pascal strings (ucs2string
, ucs4string
).
Handling routines for these strings types as well as their null
terminated counterparts. Also includes conversion to/from other
string types are present.
Generic routines related to standards such as ISO 8601 date-time routines, ISO 639 language codes and ISO 3166 country codes.
Standard type definitions are a real mess between compiler versions, so these different units try to clean up the entire type mess and defines (or redefines some standard types), so that they are common across compilers. The following portable types are defined:
Integer:
The integer type is
the base signed type that is optimized for the underlying machine
architecture. So if the base machine architecture is 16-bit this
value will be a signed 16-bit value. This is the type that should
be used for counters, and internal variables.
Cardinal:
The cardinal type
is the base unsigned type that is optimized for the underlying
machine architecture. So if the base machine architecture is
16-bit this value will be an unsigned 16-bit value.
Shortstring:
This represents
a string type composed of bytes followed preceded by a length
byte. This is equivalent to the old string[255]
or
string
type of Turbo Pascal.
big_integer_t
: The biggest
integer size available for the compiler (usually equal to longint
or int64)
ptrint
: This is the type to
use when declaring an ordinal value that will be used to store
the value of a pointer (typecasting between to/from a pointer to
an ordinal).
The following defines the pre-defined types that have specific sizes and which are available on all supported compilers (some are defined by the compiler, others are defined by one of the units herein):
These constants are used to represent information related to the operating system. They should be used instead of hard coding file system information. This will make the code more portable.
LineEnding
: String indicating
the characters ending a text line in a text file.
DirectorySeparator
: This is
the character or characters that separate the directories in a
complete path specification.
DriveSeparator
: This is the
character or characters that separate the directories from the
drive specification in a complete path specification.
PathSeparator:
This is the
character or characters that separate the directories from the
drive specification in a complete path specification.
FileNameCaseSensitive
: This
indicates if the filenames are case senstivie or not (this is a
boolean value)
These are the defines that should be used to make your code more portable, they should be defined while compiling as they are used within these units, as well as help making the code clearer (most of these defines are supported by Freepascal);
ENDIAN_LITTLE
if the target
is a little endian machine and the compiler is vp,bp,tp,delphi or
kylix. ENDIAN_BIG
if the target is a big endian
machine.
TP
if the compiler is Borland
Pascal or Turbo Pascal
CPU32
if the target is a
32-bit compiler; this is true for Turbo Pascal, Virtual Pascal,
Kylix, Delphi and most versions of Freepascal. Otherwise define
CPU64
.
All these utilities are freeware or free software and come under no guarantee whatsoever.
Download current version (1.4.7) : common1.4.7src.zip
You can submit bug reports and view current known bugs on this web page