Quick start manual

11-10
Delphi Language Guide
Internal data formats
where fmClosed indicates that the file is closed, fmInput and fmOutput indicate a text
file that has been reset (fmInput) or rewritten (fmOutput), fmInOut indicates a typed or
untyped file that has been reset or rewritten. Any other value indicates that the file
variable is not assigned (and hence not initialized).
The UserData field is available for user-written routines to store data in.
Name contains the file name, which is a sequence of characters terminated by a null
character (#0).
For typed files and untyped files, RecSize contains the record length in bytes, and the
Private field is unused but reserved.
For text files, BufPtr is a pointer to a buffer of BufSize bytes, BufPos is the index of the
next character in the buffer to read or write, and BufEnd is a count of valid characters
in the buffer. OpenFunc, InOutFunc, FlushFunc, and CloseFunc are pointers to the I/O
routines that control the file; see “Device functions” on page 8-5. Flags determines
the line break style as follows:
All other Flags bits are reserved for future use. See also DefaultTextLineBreakStyle and
SetLineBreakStyle.
Procedural types
A procedure pointer is stored as a 32-bit pointer to the entry point of a procedure or
function. A method pointer is stored as a 32-bit pointer to the entry point of a
method, followed by a 32-bit pointer to an object.
Class types
A class-type value is stored as a 32-bit pointer to an instance of the class, which is
called an object. The internal data format of an object resembles that of a record. The
object’s fields are stored in order of declaration as a sequence of contiguous variables.
Fields are always aligned, corresponding to an unpacked record type. Any fields
inherited from an ancestor class are stored before the new fields defined in the
descendant class.
The first 4-byte field of every object is a pointer to the virtual method table (VMT) of the
class. There is exactly one VMT per class (not one per object); distinct class types, no
matter how similar, never share a VMT. VMT’s are built automatically by the
compiler, and are never directly manipulated by a program. Pointers to VMT’s,
which are automatically stored by constructor methods in the objects they create, are
also never directly manipulated by a program.
The layout of a VMT is shown in the following table. At positive offsets, a VMT
consists of a list of 32-bit method pointers—one per user-defined virtual method in
the class type—in order of declaration. Each slot contains the address of the
bit 0 clear LF line breaks
bit 0 set CRLF line breaks