Please enable JavaScript to view this site.

 

This topic covers the implementation details of TGenTokensRec.

 

The linked internal-structure entry uses the XML identifier TGenTokensOptions; the implementing Pascal type is TGenTokensRec.

 

Scope: TypeDefinitions.pas; record. Prepared from the curated implementation supplied for this review on 2 October 2026.

 

In XML, this record uses rec_type="TGenTokensOptions" and occupies a GenToken slot with an ID from 1 to 18. ReadFromXML initializes the record before checking the supplied node. If that node is absent or has no child nodes, reading stops and the record keeps the initialization values listed below.

 

MaxType=0 uses NumMonths; all other modes use MaxDay. MaxType ordinals are documented below. GenTokens Grid Options explains the behavior of each mode, including modes 4 and 5. The supplied serializer and editor code establish the stored values and UI mapping; they do not independently verify the generator’s boundary handling.

 

LineEndingOptions slots 0–15 are independently looked up. Slot 0 is the default ending; 1–15 are special cases. Only enabled or previously enabled slots are exported, after the outer DoesSomething gate.

 

DoesSomething checks slot 0’s ending type but not all of its payload. Default-slot-only changes should be checked against the UI/generator invariants. LineSeparator uses ten Char storage slots; effective text capacity awaits the buffer helper.

 

Notation and shared helper rules: Reading this reference.

 

Practical editing guide: Modifying GenTokens in an XML script.

 

GenTokens editor mapping (v3 source)

 

Displayed generation mode

MaxType stored value

Numeric XML element

End of the Month(s)

0

NumMonths

Relative DayValue

1

MaxDay

Day of Month

2

MaxDay

Number of Lines

3

MaxDay

Min of Nbr of Lines or EOM

4

MaxDay

Nbr of Lines / EOM

5

MaxDay

 

The same spinMaxDay control edits MaxDay in memory. SaveToXML names that value NumMonths for mode 0 and MaxDay for all other modes. Changing mode may therefore require renaming that XML element. The editor allows 1–9999 in this control; these are UI bounds, not proof of sensible values for every mode or XML-reader validation.

 

StepSize is taken from spinStepSize (UI range 1–84). Its control is visible for modes 0, 3, 4 and 5. GetOptionsRec still copies the value when hidden; visibility alone does not establish runtime behavior.

 

Control

Record member / XML element

edLineContents

LineContents

cbBlankLinesOnOutsideDays

BlankLinesOnOutsideDays

cbBeginOnWeekStart

BeginOnWeekStart

cbNoLineEndingIfBlankLine

NoLineEndingIfBlankLine

 

frmGenTokensEditor.GetOptionsRec and SetOptionsRec provide the UI mapping. LineSeparator is serialized but is not assigned by these editor transfer routines; preserve it in a targeted XML edit. The old commented-out mode-dependent disabling of BeginOnWeekStart is not active behavior.

 

XML identity and composition

 

Literal rec_type values emitted within these routines: TGenTokensOptions. Nested values may belong to child wrappers rather than this owner itself; the attribute entries below give their exact locations.

 

Structures used directly by this XML implementation:

 

TLineEndingOptionsRec

 

Exact XML fields and attributes

 

The paths below start at this record or property node. A slash identifies a child element; @ identifies an attribute. Curly braces mark a variable index or expression, not literal XML text. Initial values describe initialization; they do not establish what an omitted individual element does. The Implementation toggle below contains the supplied routines for exact branch order and conversions.

 

LineContents

 

The text used to generate each line, including any tokens it contains.

 

XML representation: The text of the LineContents element.

 

Initial value: an empty string. Initialize establishes this value before the reader processes the record.

 

Reading: If the supplied GenTokens node exists and has child elements, the reader reads LineContents into the corresponding setting. Otherwise, the record retains its initialized values.

 

Writing: The writer includes LineContents whenever the GenTokens record passes its DoesSomething check. This check applies to the whole record: LineContents can therefore be written as an empty element when some other setting makes the record worth saving.

 

LineSeparator

 

The separator text stored for generated lines.

 

XML representation: The text of the LineSeparator element.

 

Initial value: an empty string. Initialize establishes this value before the reader processes the record.

 

Reading: Reads the element into LineSeparator when the record node exists and contains child elements.

 

Writing: Stores LineSeparator when the record’s DoesSomething check succeeds.

 

BlankLinesOnOutsideDays

 

Controls whether generated lines for outside days are blank.

 

XML representation: The text of the BlankLinesOnOutsideDays element.

 

Initial value: true. Initialize establishes this value before the reader processes the record.

 

Reading: Reads the element into BlankLinesOnOutsideDays when the record node exists and contains child elements.

 

Writing: Stores true or false according to BlankLinesOnOutsideDays when the record’s DoesSomething check succeeds.

 

BeginOnWeekStart

 

Controls whether generation begins on the start of the week.

 

XML representation: The text of the BeginOnWeekStart element.

 

Initial value: false. Initialize establishes this value before the reader processes the record.

 

Reading: Reads the element into BeginOnWeekStart when the record node exists and contains child elements.

 

Writing: Stores true or false according to BeginOnWeekStart when the record’s DoesSomething check succeeds.

 

MaxType

 

Selects how the end of the generated sequence is determined. The numeric choices are listed below.

 

XML representation: The text of the MaxType element.

 

Initial value: gtmEndOfMonth (0). Initialize establishes this value before the reader processes the record.

 

Reading: Reads the element into MaxType when the record node exists and contains child elements.

 

Writing: Stores the numeric value of MaxType (see the value table below) when the record’s DoesSomething check succeeds.

 

NumMonths

 

The number of months used when MaxType is 0 (gtmEndOfMonth). This XML element stores the record’s MaxDay member in that mode.

 

XML representation: The text of the NumMonths element.

 

Initial value: 1. Initialize establishes this value before the reader processes the record.

 

Reading: Reads the element into MaxDay when the record node exists and contains child elements; MaxType is gtmEndOfMonth (0).

 

Writing: Stores the numeric value of MaxDay when the record’s DoesSomething check succeeds; MaxType is gtmEndOfMonth (0).

 

MaxDay

 

The limit used by the modes other than gtmEndOfMonth. Its interpretation depends on MaxType; a fixed line count uses MaxType=3.

 

XML representation: The text of the MaxDay element.

 

Initial value: 1. Initialize establishes this value before the reader processes the record.

 

Reading: Reads the element into MaxDay when the record node exists and contains child elements; MaxType is not gtmEndOfMonth (0).

 

Writing: Stores the numeric value of MaxDay when the record’s DoesSomething check succeeds; MaxType is not gtmEndOfMonth (0).

 

StepSize

 

The step between successive generated dates.

 

XML representation: The text of the StepSize element.

 

Initial value: 1. Initialize establishes this value before the reader processes the record.

 

Reading: Reads the element into StepSize when the record node exists and contains child elements.

 

Writing: Stores the numeric value of StepSize when the record’s DoesSomething check succeeds.

 

NoLineEndingIfBlankLine

 

Controls whether a blank generated line omits its line ending.

 

XML representation: The text of the NoLineEndingIfBlankLine element.

 

Initial value: false. Initialize establishes this value before the reader processes the record.

 

Reading: Reads the element into NoLineEndingIfBlankLine when the record node exists and contains child elements.

 

Writing: Stores true or false according to NoLineEndingIfBlankLine when the record’s DoesSomething check succeeds.

 

@rec_type

 

Identifies this XML record as TGenTokensOptions, although the implementing Pascal record is named TGenTokensRec.

 

XML representation: The rec_type attribute.

 

Writing: Stores the literal text “TGenTokensOptions” whenever the writer reaches this field.

 

LineEndingOptions[@id={i.toString}]/@id

 

Identifies the line-ending slot: 0 is the default; 1–15 are special cases.

 

XML representation: The id attribute.

 

Writing: If the GenTokens record passes the DoesSomething check, the writer examines slots 0–15. It writes a LineEndingOptions element only for a slot whose Enabled or WasOnceEnabled value is true, and stores that slot number in the id attribute.

 

Nested records and repeated elements

 

Operation

XML location

When it is processed

Read LineEndingOptions[i]

LineEndingOptions[@id={i.toString}]

the record node exists and contains child elements; for each i from 0 through MAX_SPECIAL_CASE_INDEX

Write LineEndingOptions[i]

LineEndingOptions[@id={i.toString}]

the record’s DoesSomething check succeeds; for each i from 0 through MAX_SPECIAL_CASE_INDEX; (LineEndingOptions[i].WasOnceEnabled is true or LineEndingOptions[i].Enabled is true); i is 0

Write LineEndingOptions[i]

LineEndingOptions[@id={i.toString}]

the record’s DoesSomething check succeeds; for each i from 0 through MAX_SPECIAL_CASE_INDEX; (LineEndingOptions[i].WasOnceEnabled is true or LineEndingOptions[i].Enabled is true); i is not 0

 

Initialization and reset values

 

TGenTokensRec.Initialize

 

Setting or temporary variable

Initial value

When it is assigned

MaxType

gtmEndOfMonth (0)

Always

MaxDay

1

Always

StepSize

1

Always

LineContents

an empty string

Always

BlankLinesOnOutsideDays

true

Always

BeginOnWeekStart

false

Always

LineSeparator

an empty string

Always

LineEndingOptions[iSpCa]

DefaultLineEndingOptions

for each iSpCa from 0 through MAX_SPECIAL_CASE_INDEX

NoLineEndingIfBlankLine

false

Always

 

This routine also calls DefaultLineEndingOptions.Initialize. See Implementation for their order and any conditional calls.

 

Value namespaces used by this implementation

 

These are declared Pascal ordinal values. Use the ordinal only where the field serializer actually writes ord(...), an integer cast or an equivalent value. Set-marker strings and local option lists have their own representation; sentinel members in an enum are not automatically legal XML choices.

 

TLineEndingType

 

Ordinal

Declared member

0

letSoft

1

letHard

2

letTab

3

letMacro

4

letFormatting

5

letXtags

6

letNothing

7

letNextBox

8

letNextColumn

9

letSkipLine

 

TGenTokMaxType

 

Ordinal

Declared member

0

gtmEndOfMonth

1

gtmDayvalue

2

gtmDayOfMonth

3

gtmFixedNumLines

4

gtmMinOfFixedNumLinesOrEOM

5

gtmNumLinesOrEOM

 

Storage declarations relevant to interpretation

 

These are in-memory member and property types, not a list of mandatory XML children. They retain array bounds, fixed buffers and selector types. The field reference above defines what is actually serialized.

 

Name

Declared type / bounds

Kind

MaxType

TGenTokMaxType

member

MaxDay

integer

member

StepSize

integer

member

LineContents

string

member

BlankLinesOnOutsideDays

Boolean

member

BeginOnWeekStart

Boolean

member

FLineSeparator

array [1..10] of Char

member

LineEndingOptions

array [0..MAX_SPECIAL_CASE_INDEX] of TLineEndingOptionsRec

member

NoLineEndingIfBlankLine

Boolean

member

test

string

member

LineSeparator

string

property/accessor

 

Implementation details

 

The Implementation toggle contains only TGenTokensRec methods. Initializers and helpers belonging to other types are identified separately below. Shared XML-helper limitations are explained in Reading this reference.

 

Declaration reproduces this record’s complete declaration from the supplied source, including its fields, properties and method signatures.

 

Declaration

 

Implementation