Delphi in a Nutshell
by Ray Lischner
NutShl50 package
[ Tempest Software | Delphi in a Nutshell | Examples
| Nut50 package ]
The NutShl50 runtime package contains the following units. Note that its options are set to save
the nutshl50.bpl package in your Windows system directory.
- Colors.pas
- Convert a color from RGB to HSV and back again. Convert a color to a gray scale.
- CpuID.pas
- Use the Pentium CPUID instruction to get information about a processor chip. This is a demonstration of using
ASM in Delphi.
- Curr64.pas
- Use the
Int64
type instead of Currency to avoid its problems and limitations.
- Dates.pas
- Convert dates and times between local & UTC date/times and between UTC and UNIX-style times.
- FileIO.pas
- A variety of routines for working with files, directories, file names, and I/O.
- Fpu.pas
- Useful routines for working with the floating point unit. Get or set the rounding mode, precision mode, or
exception masks. Determine the floating point class of a number (that is, if the number is finite, infinite, or
NaN).
- Futures.pas
- The
TFuture
class computes a value in a thread and provides the value at some future time. An
application uses futures to compute values that are not needed immediately. See the Threaditor project for an example
of using futures.
- GrayPal.pas
- Create a gray-scale palette. Demonstration of using Delphi and dynamic memory to use C-style arrays.
- Helper.pas
- Demonstration of how a class can be made off-limits and inaccessible except to other classes in the same unit,
despite being declared in the unit's interface section. Use this example as a template for writing your own helper
classes.
THelper
is just a template, not a useful class so it is not part of the nutshl50
package.
- IOStream.pas
- Example of writing a custom
TextFile
driver. A TextFile
driver lets you redefine
how Delphi's standard I/O routines (WriteLn
, ReadLn
, etc.) work. This example reads from
and writes to a stream. See the CpuID project for an example of its use.
- LinkedList.pas
- Demonstration of how a class can override
NewInstance
and FreeInstance
to change
how its memory is allocated.
- Matrix.pas
- Transpose a
Variant
matrix. Demonstration of how to access a locked array.
- Printable.pas
- Declare the
IPrintable
interface, used by VmtImpl.pas. Use IPrintable
whenever you need to print complex structures.
- Rect.pas
- Simple class to demonstrate method overloading, properties, and other aspects of Delphi class definitions.
- Str.pas
- Convert almost any type to a string, demonstrating the use of variant open arrays (
array of const
).
- Swap.pas
- Functions to swap bytes in a longword or quadword (
Int64
), instead of the bizarre and useless
Swap
function in Delphi.
- Tile.pas
- Demonstration component that displays a bitmap, tiled to fill its bounds.
- TrimStrings.pas
- Replacements for the
Trim
, TrimLeft
, and TrimRight
functions. The replacements
work with multibyte strings, unlike their Delphi counterparts.
- VmtImpl.pas
- Implementation of the interfaces in the
VmtInfo
unit.
- VmtInfo.pas
- Interfaces for accessing runtime type information (RTTI) and a class's virtual method table (VMT). Provides
much more functionality than Delphi's
TypInfo
unit, with the added benefit of type safety.
[ Tempest Software | Delphi in a Nutshell | Examples
| Nut50 package ]