Previous: 2.2.16. User Defined Operators To the Table of Contents Next: 2.2.18. User Defined Writer Procedure
2.2.16. User Defined Operators Table of Contents 2.2.18. User Defined Writer Procedure

- 2.2.17. -
Table of Contents
2. TMT Pascal Language Description
2.2. Pascal Language Structure
2.2.17. User Defined Reader Procedure


2.2.17. User Defined Reader Procedure


TMT Pascal compiler allows one to define a reader procedure for ones own types including objects and structures by means of the __reader reserved word. The syntax of the custom reader procedure is the following:
procedure __reader (var f: text; const value: <Custom Type>);
begin
  ...
end;
The __reader example below showed the use of a DateTime structure defined in the DOS unit. This code reads a date using the Read procedure:
{$ifdef __GUI__}
  uses DOS, WinCRT;
{$else}
  uses DOS;
{$endif}

procedure __reader (var f: text; const value: DateTime);
begin
  Read(f, value.Month, value.Day, value.Year);
end;
 
var
  date: DateTime;

begin
  Read(date);
end.
See also:
User Defined Writer Procedure


Previous: 2.2.16. User Defined Operators To the Table of Contents Next: 2.2.18. User Defined Writer Procedure
2.2.16. User Defined Operators Table of Contents 2.2.18. User Defined Writer Procedure

- 2.2.17. -