Delphi in a Nutshell coverDelphi 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.

Convert a color from RGB to HSV and back again. Convert a color to a gray scale.
Use the Pentium CPUID instruction to get information about a processor chip. This is a demonstration of using ASM in Delphi.
Use the Int64 type instead of Currency to avoid its problems and limitations.
Convert dates and times between local & UTC date/times and between UTC and UNIX-style times.
A variety of routines for working with files, directories, file names, and I/O.
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).
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.
Create a gray-scale palette. Demonstration of using Delphi and dynamic memory to use C-style arrays.
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.
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.
Demonstration of how a class can override NewInstance and FreeInstance to change how its memory is allocated.
Transpose a Variant matrix. Demonstration of how to access a locked array.
Declare the IPrintable interface, used by VmtImpl.pas. Use IPrintable whenever you need to print complex structures.
Simple class to demonstrate method overloading, properties, and other aspects of Delphi class definitions.
Convert almost any type to a string, demonstrating the use of variant open arrays (array of const).
Functions to swap bytes in a longword or quadword (Int64), instead of the bizarre and useless Swap function in Delphi.
Demonstration component that displays a bitmap, tiled to fill its bounds.
Replacements for the Trim, TrimLeft, and TrimRight functions. The replacements work with multibyte strings, unlike their Delphi counterparts.
Implementation of the interfaces in the VmtInfo unit.
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 ]