Previous: Record Types To the Table of Content Next: Sample Program for TFileRec Structure

- 2.2.6.14 -
TMT Pascal Language Description
Pascal Language Structure
Types

File Types

File types are structures that contain components of any type except another file type. File types are defined as follows:
  File [of Componenttype];
If of is not specified and component types are not indicated then the file is untyped.

Untyped files are used to access files regardless of their structure. Text file types refer to a file of ASCII characters grouped in lines. Text is a predefined type.

The record definitions used internally by TMT Pascal are also declared in the System unit.

TFileRec is used for both typed and untyped files.
type
  TFileRec = object
    magic   : ^TFileRec;
    name    : string;
    handle  : Longint;
    rec_len : Longint;
    state   : flags;
    rd_proc,
    wr_proc : function (F: Longint; Buf: Pointer; Len: Longint;
                        var Act: Longint): Longint;
    procedure check_magic;
    procedure check_opened;
    procedure check_readable;
    procedure check_writeable;
    procedure io_error(code: Integer);
  end;
  PFileRec = ^TFileRec;
TTextRec is the internal format of a variable of type text.
type
  TTextRec = object (TFileRec)
    buffer  : array [0..63] of Char;
    index   : Longint;
    len_buf : Longint;
    max_buf : Longint;
    buf_adr : Pointer;
    function Eof: Boolean;
    procedure init;
    procedure fill_buf;
    procedure fill_chr;
    procedure skip_spaces;
    procedure get_n_char(n: Integer);
  end;
  PTextRec = ^TTextRec;
Internal Type flags is declared as:
type
  flags = set of file_state;
where file_state is:
type
  file_state = (
     file_readable,   //00h
     file_writeable,  //01h
     file_opened,     //02h
     file_assigned,   //03h
     file_eof,        //04h
     file_text,       //05h
     file_file,       //06h
     file_fileof,     //07h
     file_tty,        //08h
     file_special,    //09h
     file_settextbuf  //0Ah
  );
Sample:
  Look the TFileRec sample code.


Previous: Record Types To the Table of Content Next: Sample Program for TFileRec Structure
Record Types Table of Content Sample Program for TFileRec Structure

- 2.2.6.14 -