Go to the first, previous, next, last section, table of contents.

The Alphabetical GPC Language Reference

This chapter is under development, so don't be too excited about the paragraph below!

This chapter contains an alphabetical list of all built-in identifiers of the GNU Pascal compiler. It does not cover extensions provided by external libraries which are supposed to come with their own documentation.

abs

Syntax

  Function abs ( i: integer type ): integer type;

or

  Function abs ( x: real type ): real type;

or

  Function abs ( z: complex type ): real type;

Description

Returns the absolute value of the argument. For integer or real values of `x', the definition is

  Function abs ( x: integer or real type ): integer or real type;

  begin (* abs *)
    if x < 0 then
      abs:= -x
    else
      abs:= x;
  end (* abs *);

whereas for complex values it is

  Function abs ( x: Complex ): Complex;

  begin (* abs *)
    abs:= sqrt ( x * conjugate ( x ) );
  end (* abs *);

Standards

The function `abs' is defined in ISO-7185 Standard Pascal; its application to complex values is defined in ISO-10206 Extended Pascal.

Example

  Program TestAbs;

  Var
    i1: Complex;

  begin
    writeln ( abs ( 42 ) );             (* 42    *);
    writeln ( abs ( -42 ) );            (* 42    *);
    writeln ( abs ( -12.1 ) : 0 : 1 );  (* 12.1  *);
    i1:= cmplx ( 1, 1 );                (* 1 + i *)
    writeln ( abs ( i1 ) : 0 : 3 );     (* 1.414, i.e. sqrt ( 2 ) *)
  end.

See also

section sqr.

absolute

Syntax

  Var
    variable name: data type absolute variable reference;

or

  Var
    variable name: data type absolute integer expression;

Description

The first meaning of the `absolute' directive allows to put a variable to the address of another one and thus provides a type-casting mechanism.

In most cases, variable reference will be just a variable name, but GPC also allows arbitrary expressions here. If variable reference has neither a constant address nor is a variable parameter, GPC prints a warning. This warning is suppressed in "extended syntax" mode which is switched on by the `--extended-syntax' option or the `(*$X+*)' compiler directive.

Other type-casting mechanisms in GPC are variant records (which are valid in ISO-7185 Standard Pascal) and explicit type casts.

The second meaning of `absolute' places a variable at a specified address. This is useful on machines without virtual memory addressing for doing certain low-level operations, but should be avoided on systems with memory protection such as UNIX-like systems. GPC does not check whether the specified virtual address makes any sense and does not provide a built-in mechanism to map it to a real address.

GPC warns about this second use of `absolute' unless "extended syntax" has been requested.

Standards

ISO Pascal does not define `absolute'.

Borland Pascal does define `absolute' but has a slightly different syntax for the second meaning related to the addressing scheme of Intel X86 processors working in real mode.

Allowing arbitrary memory references instead of just variable names in the first meaning of `absolute' is a GNU extension.

Example

  Program TestAbsolute;

  (*$X+*)

  Const
    IOmemory = $F0000000;

  Var
    Mem: array [ 0..MaxInt ] of Byte absolute 0;
    SomeIOport: Byte absolute IOmemory + $C030;

  (* Beware:  Using any of the variables above will crash    *)
  (* your program unless you know exactly what you do!       *)
  (* That's why GPC warns about it without the X+ directive. *)

  Var
    x: Real;
    a: array [ 1..SizeOf ( Real ) ] of Byte absolute x;
    i: Integer;

    b: Byte absolute a [ i ];
    (* GNU extension: non-constant memory reference. *)

  begin
    x:= 3.14;
    (* Gather at the internal representation of a real variable. *)
    for i:= 1 to SizeOf ( Real ) do
      write ( a [ i ] : 4 );   (* Or (kind of abuse): `write ( b );' *)
    writeln;      
  end.

See also

section record, section Type Casts.

AlignOf

Syntax

  Function AlignOf ( Var x ): Integer;

Description

Returns the alignment of a type or variable in bytes.

Standards

`AlignOf' is a GNU extension.

Example

  Var
    a: Integer;
    b: array [ 1..8 ] of Char;

  ...

  writeln ( AlignOf ( a ) );  (* Alignment of `Integer'; usually 4 bytes. *)
  writeln ( AlignOf ( b ) );  (* Alignment of `Char'; usually 1 byte. *)

Although the array is bigger than a single char, it is accessed char by char, so there usually is no need to align it on a 4 byte boundary or such. (This may be false on some platforms.)

See also

section SizeOf, section BitSizeOf, section TypeOf.

all

Description

`all' is a predefined export interface for Extended Pascal modules. You can use it to export all identifiers declared in an interface module automatically.

Standards

`all' is a GNU extension.

Example

  Module TestAll Interface;

  export
    foo = all;  (* Same as `foo = ( a, b, bar );' *)

  Var
    a, b: Integer;

  Procedure bar;

  end.

See also

section The Source Structure of ISO-10206 Extended Pascal Modules.

and

Syntax

  Operator and ( operand1, operand2: Boolean ) = result: Boolean;

or

  Operator and ( operand1, operand2: integer type ) = result: integer type;

or

  Procedure and ( Var operand1: integer type; operand2: integer type );

Description

In GNU Pascal, `and' has three built-in meanings:

  1. Logical "and" between two `Boolean'-type expressions. The result of the operation is of `Boolean' type. By default, `and' acts as a short-circuit operator in GPC: If the first operand is `false', the second operand is not evaluated because the result is already known to be `false'. You can change this to complete evaluation using the `--no-short-circuit' command-line option or the `(*$B+*)' compiler directive.
  2. Bitwise "and" between two integer-type expressions. The result is of the common integer type of both expressions.
  3. Use as a "procedure": `operand1' is "and"ed bitwise with `operand2'; the result is stored in `operand1'.

Standards

The logical `and' operator is defined in ISO-7185 Standard Pascal.

According to ISO, you cannot rely on `and' being a short-circuit operator. On the other hand, GPC's default behaviour does not contradict the ISO standard. (See section and_then.) However, since it seems to be a de-facto standard among ISO Pascal compilers to evaluate both operands of `and', GPC switches to `--no-short-circuit' mode if one of the language dialect options selecting ISO Pascal, for instance `--extended-pascal', is given. Use `--short-circuit' to override.

ISO Pascal does not define the bitwise `and' operator; Borland Pascal and Delphi do.

Use of `and' as a "procedure" is a GNU extension.

Example

  Var
    a, b, c: Integer;

  ...

  if ( a = 0 ) and ( b = 0 ) then  (* logical `and' *)
    c:= 1
  else if a and b = 0 then  (* bitwise `and' *)
    c:= 2
  else
    and ( c, a );  (* same as `c:= c and a' *)

Note the difference between the logical `and' and the bitwise `and': When `a' is 2 and `b' is 4, then `a and b' is 0. Beware: `a and b = 0' has nothing to do with `( a = 0 ) and ( b = 0 )'!

Since bitwise `and' has a higher priority than the `=' operator, parentheses are needed in `if ( a = 0 ) and ( b = 0 )' because otherwise `0 and b' would be calculated first, and the remainder would cause a parse error.

See also

section and_then, section and then, section or, section xor, section Operators.

and then

Description

`and then' is an alias for the short-circuit logical operator `and_then'.

Standards

While `and_then' is defined in ISO-10206 Extended Pascal, `and then' is a GNU Extension.

Example

  Var
    p: ^Integer;

  [...]

  if ( p <> Nil ) and then ( p^ < 42 ) then  (* This is safe. *)
    [...];

See also

section and_then, section and, section or else.

and_then

Syntax

  Operator and_then ( operand1, operand2: Boolean ) = result: Boolean;

Description

The `and_then' short-circuit logical operator performs the same operation as the logical operator `and'. But while the ISO standard does not specify anything about the evaluation of the operands of `and'---they may be evaluated in any order, or not at all---`and_then' has a well-defined behaviour: It evaluates the first operand. If the result is `false', `and_then' returns `false' without evaluating the second operand. If it is `true', the second operand is evaluated and returned.

Since the behaviour described above is the most effective way to implement `and', GPC by default treats `and' and `and_then' exactly the same. If you want, for some reason, to have both operands of `and' evaluated completely, you can specify the `--no-short-circuit' command-line option, but this is not portable. The portable way to have both operands evaluated is to assign both to temporary variables and then use `and'---or `and_then', it does not matter.

Standards

ISO-7185 Standard Pascal does not define `and_then'; ISO-10206 Extended Pascal does.

Some people think that the ISO standard requires both operands of `and' to be evaluated. This is false. What the ISO standard does say is that you cannot rely on a certain order of evaluation of the operands of `and'; in particular things like

  Var
    p: ^Integer;

  [...]

  if ( p <> Nil ) and ( p^ < 42 ) then
    [...];

can crash according to ISO Pascal, although they cannot crash when compiled with GNU Pascal running in default mode.

If you want to write portable and efficient code in ISO-10206 Extended Pascal, always use `and_then'; never use `and'.

Example

  Var
    p: ^Integer;

  [...]

  if ( p <> Nil ) and_then ( p^ < 42 ) then  (* This is safe. *)
    [...];

See also

section and then, section and, section or_else.

AnsiChar

Syntax

  Type
    AnsiChar = Char;

Description

`AnsiChar' is an 8 bit char type. Currently, it is the same as `Char', but this might change in the future, once `wide chars' (16 bit chars) will be introduced into GPC. Depending on the platform, `Char' might be either `AnsiChar' or `WideChar' then.

Standards

ISO Pascal does not define `AnsiChar'; Delphi does.

Example

  Var
    A: AnsiChar;  (* There is nothing special with `AnsiChar'. *)
    B: Char;

  [...]

  A:= 'A';
  A:= B;

See also

section pAnsiChar, section Char.

append

Syntax

  Procedure append ( Var F: any file );

Description

Standards

`append' is a Borland Pascal extension. ISO-10206 Extended Pascal has section extend instead.

Example

See also

section Assign, section reset, section rewrite, section update, section extend.

arctan

Syntax

  Function arctan ( x: Real ): Real;

or

  Function arctan ( z: Complex ): Complex;

Description

`arctan' returns the (principal value of the) arcus tangent of the argument. The result is in the range `-pi / 2 < arctan ( x ) < pi / 2' for real arguments.

Standards

The function `arctan' is defined in ISO-7185 Standard Pascal; its application to complex values is defined in ISO-10206 Extended Pascal.

Example

  writeln ( 4 * arctan ( 1 ) : 0 : 5 );
  (* yields 3.14159; arctan ( 1 ) = pi / 4. *)

See also

section sin, section cos, section ln, section arg.

arg

Syntax

  Function arg ( z: Complex ): Real;

Description

`arg' returns the complex "argument", i.e. the angle (in radian) in the complex plane with respect to the real axis, of its parameter `z'. The result is in the range of `-pi < arg ( z ) <= pi'.

Standards

ISO-7185 Standard Pascal does not define `arg'; ISO-10206 Extended Pascal does.

Example

  Program TestArg;

  Var
    z: Complex;

  begin
    z:= cmplx ( 1, 1 );  (* 1 + i *)
    writeln ( arg ( z ) : 0 : 5 );
    (* yields 0.78540, i.e. pi / 4. *)
  end.

See also

section arctan, section ln, section polar.

array

(Under construction.)

Syntax

Description

Standards

Example

See also

asm

(Under construction.)

Syntax

Description

Standards

Example

See also

asmname

(Under construction.)

Syntax

Description

Standards

Example

See also

Assign

Syntax

  Procedure Assign ( Var F: any file; FileName: String );

Description

Standards

`Assign' is a Borland Pascal extension.

Example

See also

section reset, section rewrite, section update, section extend, section append.

attribute

(Under construction.)

Syntax

Description

Standards

Example

See also

begin

(Under construction.)

Syntax

Description

Standards

Example

See also

Bind

(Under construction.)

Syntax

  Procedure Bind ( Var F: any file; B: BindingType );

Description

Standards

Example

See also

bindable

(Under construction.)

Syntax

Description

Standards

Example

See also

Binding

(Under construction.)

Syntax

  Function Binding ( F: any file ): BindingType;

Description

Standards

Example

See also

BindingType

(Under construction.)

Syntax

  Type
    BindingType = packed record
      Bound, Extensions_valid,
        Readable, Writable, Existing: Boolean;
      Error, Size: Integer;
      CFile: Pointer;
      Name: String [ binding name length ];
    end (* BindingType *);

Description

Standards

Example

See also

BitSizeOf

Syntax

  Function BitSizeOf ( Var x ): Integer;

Description

Returns the size of a type or variable in bits.

Standards

`BitSizeOf' is a GNU extension.

Example

  Var
    a: Integer;
    b: array [ 1..8 ] of Char;
    c: Integer ( 12 );

    d: packed record
      x: Integer ( 12 );
      y: 0..3;
    end (* d *);

  ...

  writeln ( BitSizeOf ( a ) );  (* Size of an `Integer'; usually 32 bits.  *)
  writeln ( BitSizeOf ( b ) );  (* Size of eight `Char's; usually 64 bits. *)
  writeln ( BitSizeOf ( c ) );  (* 16 bits (smallest addressable space).   *)

  writeln ( BitSizeOf ( d ) );    (* 16 *)
  writeln ( BitSizeOf ( d.x ) );  (* 12 *)
  writeln ( BitSizeOf ( d.y ) );  (*  2 *)

See also

section SizeOf, section AlignOf, section TypeOf.

BlockRead

(Under construction.)

Syntax

  Procedure BlockRead ( Var F: File; Var Buffer; Blocks: Integer );

or

  Procedure BlockRead ( Var F: File; Var Buffer; Blocks: Integer;
                        Var BlocksRead: Integer );

Description

Standards

Example

See also

BlockWrite

(Under construction.)

Syntax

  Procedure BlockWrite ( Var F: File; Const Buffer; Blocks: Integer );

or

  Procedure BlockWrite ( Var F: File; Const Buffer; Blocks: Integer;
                         Var BlocksWritten: Integer );

Description

Standards

Example

See also

Boolean

(Under construction.)

Syntax

Description

Standards

Example

See also

break

(Under construction.)

Syntax

Description

Standards

Example

See also

Byte

Description

`Byte' is an unsigned integer type which is one "unit" wide. On most platforms one unit has 8 bits, therefore the type is named "byte" and usually has a range of `0..255'. (It is the same as section ByteCard.)

`Byte' in GNU Pascal is compatible to `unsigned char' in GNU C.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `Byte'. (However see section Subrange Types.)

The `Byte' type appears in Borland Pascal and Delphi, too, where it is an unsigned 8-bit integer type.

See also

section Integer Types, section Subrange Types.

ByteBool

(Under construction.)

Syntax

Description

Standards

Example

See also

ByteCard

Description

`ByteCard' is an unsigned integer type which is one "unit" wide. On most platforms one unit has 8 bits, therefore the type is prefixed "byte-" and usually has a range of `0..255'.

`ByteCard' in GNU Pascal is compatible to `unsigned char' in GNU C.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `ByteCard'. (However see section Subrange Types.)

See also

section Integer Types, section Subrange Types.

ByteInt

Description

`ByteInt' is a signed integer type which is one "unit" wide. On most platforms one unit has 8 bits, therefore the type is prefixed "byte-" and usually has a range of `-128..127'.

`ByteInt' in GNU Pascal is compatible to `signed char' in GNU C.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `ShortInt'. (However see section Subrange Types.)

`ByteInt' in GNU Pascal corresponds to section ShortInt in Borland Pascal and Delphi.

See also

section Integer Types, section Subrange Types.

C

(Under construction.)

Syntax

Description

Standards

Example

See also

C_Language

(Under construction.)

Syntax

Description

Standards

Example

See also

Card

(Under construction.)

Syntax

  Function Card ( S: any set ): Integer;

Description

Standards

Example

See also

Cardinal

Description

`Cardinal' is the "natural" unsigned integer type in GNU Pascal. On most platforms it is 32 bits wide and thus has a range of `0..4294967295'. Use it whenever you need a general-purpose unsigned integer type and don't need to care about compatibility to other Pascal dialects.

As an extension, GPC allows to use `Cardinal' as a pseudo-schema to produce types with a specified size in bits; for example

  Type
    Card16 = Cardinal ( 16 );

defines an unsigned integer type with 16 bits. The same mechanism works for `Integer' and `Word', too.

`Cardinal' in GNU Pascal is compatible to `unsigned int' in GNU C.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `Cardinal'. (However see section Subrange Types.)

The `Cardinal' type appears in Delphi, too, where it has 16 bits in version 1.0, 32 from version 2.0 on.

See also

section Integer Types, section Subrange Types.

case

(Under construction.)

Syntax

Description

Standards

Example

See also

Char

(Under construction.)

Syntax

Description

Standards

Example

See also

ChDir

(Under construction.)

Syntax

  Procedure ChDir ( Directory: String );

Description

Standards

Example

See also

chr

(Under construction.)

Syntax

  Function chr ( AsciiCode: Integer ): Char;

Description

Standards

Example

See also

close

(Under construction.)

Syntax

  Procedure Close ( Var F: any file );

Description

Standards

Example

See also

cmplx

(Under construction.)

Syntax

  Function cmplx ( RealPart, ImaginaryPart: Real ): Complex;

Description

Standards

Example

See also

Comp

Description

`Comp' is a signed integer type which is longer than `Integer'. On most platforms it is 64 bits wide and thus has a range of `-9223372036854775808..9223372036854775807'.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `Comp'.

Borland Pascal and Delphi also define `Comp' as a 64-bit signed integer type. This compatibility is the reason why GPC supports `Comp'. In some contexts, the Borland compilers treat `Comp' as a "real" type--this behaviour is not supported by GPC.

See also

section Integer Types, section Subrange Types.

Complex

(Under construction.)

Syntax

Description

Standards

Example

See also

Concat

(Under construction.)

Syntax

  Function Concat ( S1, S2: String ): String;

or

  Function Concat ( S1, S2, S3: String ): String;

or

  ...

Description

Standards

Example

See also

conjugate

(Under construction.)

Syntax

  Function conjugate ( z: Complex ): Complex;

Description

Standards

Example

See also

Const

(Under construction.)

Syntax

Description

Standards

Example

See also

Constructor

(Under construction.)

Syntax

Description

Standards

Example

See also

continue

(Under construction.)

Syntax

Description

Standards

Example

See also

Copy

(Under construction.)

Syntax

  Function Copy ( S: String; FirstChar, Count: Integer ): String;

Description

Standards

Example

See also

cos

(Under construction.)

Syntax

  Function cos ( x: Real ): Real;

or

  Function cos ( z: Complex ): Complex;

Description

Standards

Example

See also

CString

(Under construction.)

Syntax

Description

Standards

Example

See also

CString2String

(Under construction.)

Syntax

  Function CString2String ( S: CString ): String;

Description

Standards

Example

See also

Date

(Under construction.)

Syntax

  Function Date ( T: TimeStamp ):
      packed array [ 1..date length ] of Char;

Description

Standards

Example

See also

dec

(Under construction.)

Syntax

  Procedure dec ( Var x: ordinal type );

or

  Procedure dec ( Var x: ordinal type; amount: Integer );

Description

Standards

Example

See also

default

(Under construction.)

Syntax

Description

Standards

Example

See also

DefineSize

(Under construction.)

Syntax

  Procedure DefineSize ( Var F: any file; NewSize: Integer );

Description

Standards

Example

See also

Delete

(Under construction.)

Syntax

  Procedure Delete ( Var S: String; FirstChar, Count: Integer );

Description

Standards

Example

See also

Destructor

(Under construction.)

Syntax

Description

Standards

Example

See also

Dispose

(Under construction.)

Syntax

  Dispose ( PointerVar: Pointer );

or

  Dispose ( PointerVar: Pointer; tag field values );

or

  Dispose ( ObjectPointerVar: Pointer; destructor call );

Description

Standards

Example

See also

div

(Under construction.)

Syntax

  Operator div ( p, q: Integer ) = r: Integer;

Description

Standards

Example

See also

do

Description

The `do' reserved word is used in combination with other Pascal keywords in many ways. For description and examples see the relevant reference sections: `for', `while', `with', `to begin', `to end'.

Standards

`do' is defined in the ISO-7185 Standard Pascal and supported by all known Pascal variants.

See also

section for, section while, section with, section to begin, section to end.

Double

(Under construction.)

Syntax

  Type
    Double = Real;

Description

Standards

Example

See also

downto

(Under construction.)

Syntax

Description

Standards

Example

See also

else

(Under construction.)

Syntax

Description

Standards

Example

See also

empty

(Under construction.)

Syntax

  Function empty ( Var F: any file ): Boolean;

Description

Standards

Example

See also

end

(Under construction.)

Syntax

Description

Standards

Example

See also

eof

(Under construction.)

Syntax

  Function eof ( Var F: any file ): Boolean;

or

  Function eof: Boolean;

Description

Standards

Example

See also

eoln

(Under construction.)

Syntax

  Function eoln ( Var F: any file ): Boolean;

or

  Function eoln: Boolean;

Description

Standards

Example

See also

EpsReal

(Under construction.)

Syntax

Description

Standards

Example

See also

eq

(Under construction.)

Syntax

  Function eq ( S1, S2: String ): Boolean;

Description

Standards

Example

See also

erase

(Under construction.)

Syntax

  Procedure erase ( Var F: any file );

Description

Standards

Example

See also

Exit

(Under construction.)

Syntax

Description

Standards

Example

See also

exp

(Under construction.)

Syntax

  Function exp ( x: Real ): Real;

or

  Function exp ( z: Complex ): Complex;

Description

Standards

Example

See also

Export

(Under construction.)

Syntax

Description

Standards

Example

See also

extend

(Under construction.)

Syntax

  Procedure extend ( Var F: any file );

Description

Standards

Example

See also

Extended

(Under construction.)

Syntax

  Type
    Extended = LongReal;

Description

Standards

Example

See also

extern

(Under construction.)

Syntax

Description

Standards

Example

See also

external

(Under construction.)

Syntax

Description

Standards

Example

See also

false

(Under construction.)

Syntax

Description

Standards

Example

See also

far

Description

The `far' directive can be appended to a procedure or function heading but is ignored by GPC. It is there for Borland compatibility, only. (Since the GNU compilers provide a flat memory model, the distinction between `near' and `far' pointers is void.)

Standards

ISO Pascal does not define `far', Borland Pascal does.

Example

  Var
    p: Procedure;

  Procedure Foo; far;  (* `far' has no effect in GPC *)

  begin (* Foo *)
    [...]
  end (* Foo *);

  [...]

  p:= Foo;  (* Would also work without `far' in GPC. *)

See also

section near.

FileMode

(Under construction.)

Syntax

  Var
    FileMode: Integer;

Description

Standards

Example

See also

File

(Under construction.)

Syntax

Description

Standards

Example

See also

FilePos

(Under construction.)

Syntax

  Function FilePos ( Var F: any file ): Integer;

Description

Standards

Example

See also

FileSize

(Under construction.)

Syntax

  Function FileSize ( Var F: any file ): Integer;

Description

Standards

Example

See also

FillChar

(Under construction.)

Syntax

  Procedure FillChar ( Var Dest; Count: Integer; Value: Char );

or

  Procedure FillChar ( Var Dest; Count: Integer; Value: Byte );

Description

Standards

Example

See also

flush

(Under construction.)

Syntax

  Procedure flush ( Var F: any file );

Description

Standards

Example

See also

for

(Under construction.)

Syntax

  for ordinal variable := initial value to final value do
    statement

or

  for ordinal variable := initial value downto final value do
    statement

or

  for ordinal variable in some set do
    statement

Description

Standards

Example

See also

forward

(Under construction.)

Syntax

Description

Standards

Example

See also

frac

(Under construction.)

Syntax

  Function frac ( x: Real ): Real;

Description

Standards

Example

See also

FreeMem

Syntax

  Procedure FreeMem ( Var p: Pointer; Size: Cardinal );

or

  Procedure FreeMem ( Var p: Pointer );

Description

Releases a chunk of memory previously allocated using `GetMem'. The parameter Size is optional, and its value is ignored.

Since Extended Pascal's schemata provide a cleaner way to implement dynamical arrays and such, we recommend using `GetMem' and `FreeMem' only for low-level applications or for interfacing with other languages.

Standards

ISO Pascal does not define `FreeMem', Borland Pascal does and requires two parameters. `FreeMem' with only one parameter is a GNU extension.

Example

See section GetMem

See also

section GetMem, section Schema Types, section Dispose, section Mark, section Release.

Function

(Under construction.)

Syntax

Description

Standards

Example

See also

ge

(Under construction.)

Syntax

  Function ge ( S1, S2: String ): Boolean;

Description

Standards

Example

See also

Get

(Under construction.)

Syntax

  Procedure Get ( Var F: typed file );

Description

Standards

Example

See also

GetFile

Syntax

  Function GetFile ( F: file type ): Pointer;

Description

GNU Pascal files internally contain a C `FILE' descriptor. `GetFile' returns a pointer to this, so you can pass it to external procedures or functions, perhaps written in C, that cannot handle Pascal files.

Standards

`GetFile' is a GNU extension.

Example

  Program Hello;

  Procedure fputs ( S: CString; someFile: Pointer ); C;

  begin
    fputs ( 'Hello, world!'^J, GetFile ( Output ) );
  end.

See also

section C, section CString, section Interfacing with Other Languages.

GetMem

Syntax

  Procedure GetMem ( Var p: Pointeger; Size: Cardinal );

or

  Function GetMem ( Size: Cardinal ): Pointer;

Description

Allocates dynamical storage on the heap and returns a pointer to it in `p' or as the function result.

Since Extended Pascal's schemata provide a cleaner way to implement dynamical arrays and such, we recommend using `GetMem' and `FreeMem' only for low-level applications.

Standards

ISO Pascal does not define `GetMem', Borland Pascal does, but only as a procedure. `GetMem' as a function is a GNU extension.

Example

The Borland-comatibility Unit `Graph' from the `BPcompat' package supports a `GetImage' and a `PutImage' procedure which need a variable of size `ImageSize' as a buffer. Since these are "black box" routines, the buffer can't reasonably be a schema providing a dynamical array. Instead, we have to use `GetMem' and `FreeMem' for dynamical memory allocation.

  Program TestGetMem;

  uses
    Graph;

  Var
    Buffer: Pointer;
    Size: Cardinal;

  begin
    [...]
    Size:= ImageSize ( 10, 10, 60, 30 );
    Buffer:= GetMem ( Size );  (* or: GetMem ( Buffer, Size ); *)
    GetImage ( 10, 10, 60, 30, Buffer^ );
    [...]
    FreeMem ( Buffer );  (* or: FreeMem ( Buffer, Size ); *)
    [...]
  end.

See also

section FreeMem, section New, section Schema Types.

GetTimeStamp

(Under construction.)

Syntax

  Procedure GetTimeStamp ( Var T: TimeStamp );

Description

Standards

Example

See also

goto

(Under construction.)

Syntax

Description

Standards

Example

See also

gt

(Under construction.)

Syntax

  Function gt ( S1, S2: String ): Boolean;

Description

Standards

Example

See also

Halt

(Under construction.)

Syntax

  Procedure Halt;

or

  Procedure Halt ( ExitCode: Integer );

Description

Standards

Example

See also

high

(Under construction.)

Syntax

  Function high ( ordinal type or variable ): Integer;

or

  Function high ( array type or variable ): Integer;

Description

Standards

Example

See also

if

(Under construction.)

Syntax

Description

Standards

Example

See also

Im

(Under construction.)

Syntax

  Function Im ( z: Complex ): Real;

Description

Standards

Example

See also

import

Description

The reserved word `import' in the import part of a program makes the program import an interface. The syntax is

  Program foo;

  import
    bar1;
    bar3 ( baz1 => glork1 ) in 'baz.pas';
    bar2 only ( baz2, baz3 => glork2 );

  [...]

The `in' above tells GPC to look for the `Module' in the specified file; otherwise the file name is derived from the name of the interface by adding first `.p', then `.pas'---which only works if the name of the exported interface coincides with the file name.

The symbol `=>' denotes import renaming: The entity which is exported under the name `baz1' by the interface `bar3' will be known under the new name `glork1' in the program.

The `only' qualifier means that only the listed identifiers will be imported from the interface. Renaming works together with `only', too.

There must be at most one import part in a program.

The interfaces needn't be exported by Extended Pascal Modules but may be UCSD/Borland Pascal Units as well.

Standards

ISO-7185 Standard Pascal does not define `import' and Modules in general. These are defined in the ISO-10206 Extended Pascal standard.

GNU Pascal does not yet support `qualified' import.

See also

section Module, section Unit, section uses.

Implementation

(Under construction.)

Syntax

Description

Standards

Example

See also

in

(Under construction.)

Syntax

Description

Standards

Example

See also

inc

(Under construction.)

Syntax

  Procedure inc ( Var x: ordinal type );

or

  Procedure inc ( Var x: ordinal type; amount: Integer );

Description

Standards

Example

See also

Index

(Under construction.)

Syntax

Description

Standards

Example

See also

inherited

(Under construction.)

Syntax

Description

Standards

Example

See also

inline

(Under construction.)

Syntax

Description

Standards

Example

See also

InOutRes

(Under construction.)

Syntax

  Var
    InOutRes: Integer;

Description

Standards

Example

See also

InOutResStr

(Under construction.)

Syntax

  Var
    InOutResStr: CString;

Description

Standards

Example

See also

Input

(Under construction.)

Syntax

  Var
    Input: Text;

Description

Standards

Example

See also

Insert

(Under construction.)

Syntax

  Procedure Insert ( Source: String; Var Dest: String; Position: Integer );

Description

Standards

Example

See also

int

(Under construction.)

Syntax

  Function int ( x: Real ): Real;

Description

Standards

Example

See also

Integer

Description

`Integer' is the "natural" signed integer type in GNU Pascal. On most platforms it is 32 bits wide and thus has a range of `-2147483648..2147483647'. Use it whenever you need a general-purpose signed integer type.

As an extension, GPC allows to use `Integer' as a pseudo-schema to produce types with a specified size in bits; for example

  Type
    Int16 = Integer ( 16 );

defines an integer type with 16 bits. The same mechanism works for `Cardinal' and `Word', too.

`Integer' in GNU Pascal is compatible to `int' in GNU C.

There are lots of other integer types in GPC, see section Integer Types.

Standards

In ISO Pascal, `Integer' is the only built-in integer type. (However see section Subrange Types.)

See also

section Integer Types, section Subrange Types.

Interface

(Under construction.)

Syntax

Description

Standards

Example

See also

IOresult

(Under construction.)

Syntax

  Function IOresult: Integer;

Description

Standards

Example

See also

Label

(Under construction.)

Syntax

Description

Standards

Example

See also

LastPosition

(Under construction.)

Syntax

  Function LastPosition ( Var F: typed file ): Integer;

Description

Standards

Example

See also

le

(Under construction.)

Syntax

  Function le ( S1, S2: String ): Boolean;

Description

Standards

Example

See also

length

(Under construction.)

Syntax

  Function length ( S: String ): Integer;

Description

Standards

Example

See also

ln

(Under construction.)

Syntax

  Function ln ( x: Real ): Real;

or

  Function ln ( z: Complex ): Complex;

Description

Standards

Example

See also

LoCase

(Under construction.)

Syntax

  Function LoCase ( Ch: Char ): Char;

Description

Standards

Example

See also

LongCard

Description

`LongCard' is an unsigned integer type which is longer than `Cardinal'. On most platforms it is 64 bits wide and thus has a range of `0..18446744073709551615'.

`LongCard' in GNU Pascal is compatible to `long long unsigned int' in GNU C.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `LongCard'.

See also

section Integer Types, section Subrange Types.

LongInt

Description

`LongInt' is a signed integer type which is longer than `Integer'. On most platforms it is 64 bits wide and thus has a range of `-9223372036854775808..9223372036854775807'.

`LongInt' in GNU Pascal is compatible to `long long int' in GNU C.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `LongInt'.

Borland Pascal and Delphi also define `LongInt', but it is a 32-bit signed integer type there (section Integer in GNU Pascal). Both Borland languages define section Comp as a 64-bit signed integer type which is also supported by GPC for compatibility.

See also

section Integer Types, section Subrange Types.

LongestCard

Description

`LongestCard' is GPC's longest-possible unsigned integer type. Currently, this is the same as section LongCard. On most platforms it is 64 bits wide and thus has a range of `0..18446744073709551615'.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `LongestCard'.

See also

section Integer Types, section Subrange Types.

LongestInt

Description

`LongestInt' is GPC's longest-possible signed integer type. Currently, this is the same as section LongInt. On most platforms it is 64 bits wide and thus has a range of `-9223372036854775808..9223372036854775807'.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `LongestInt'.

See also

section Integer Types, section Subrange Types.

LongestReal

(Under construction.)

Syntax

Description

Standards

Example

See also

LongestWord

Description

`LongestWord' is GPC's longest-possible unsigned integer type. Currently, this is the same as section LongWord. On most platforms it is 64 bits wide and thus has a range of `0..18446744073709551615'. (It is the same as section LongestCard.)

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `LongestWord'.

See also

section Integer Types, section Subrange Types.

LongReal

(Under construction.)

Syntax

Description

Standards

Example

See also

LongWord

Description

`LongWord' is an unsigned integer type which is larger than `Word'. On most platforms it is 64 bits wide and thus has a range of `0..18446744073709551615'. It is the same as section LongCard.

`LongWord' in GNU Pascal is compatible to `long long unsigned int' in GNU C.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `LongWord'.

See also

section Integer Types, section Subrange Types.

low

(Under construction.)

Syntax

Syntax

  Function low ( ordinal type or variable ): Integer;

or

  Function low ( array type or variable ): Integer;

Description

Standards

Example

See also

lt

(Under construction.)

Syntax

  Function lt ( S1, S2: String ): Boolean;

Description

Standards

Example

See also

Mark

(Under construction.)

Syntax

  Procedure Mark ( Var P: Pointer );

Description

Standards

Example

See also

max

(Under construction.)

Syntax

  Function max ( x1, x2: ordinal or real type ): same type;

Description

Standards

Example

See also

MaxChar

(Under construction.)

Syntax

Description

Standards

Example

See also

MaxInt

(Under construction.)

Syntax

Description

Standards

Example

See also

MaxReal

(Under construction.)

Syntax

Description

Standards

Example

See also

MedCard

Description

`MedCard' is an unsigned integer type which is not smaller than `Cardinal'. On most platforms it actually is the same as `Cardinal' and 32 bits wide and thus has a range of `0..4294967295'.

`MedCard' in GNU Pascal is compatible to `long unsigned int' in GNU C. This compatibility is the reason why `MedCard' exists.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `MedCard'.

See also

section Integer Types, section Subrange Types.

MedInt

Description

`MedInt' is a signed integer type which is not smaller than `Integer'. On most platforms it actually is the same as `Integer' and 32 bits wide and thus has a range of `-2147483648..2147483647'.

`MedInt' in GNU Pascal is compatible to `long int' in GNU C. This compatibility is the reason why `MedInt' exists.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `MedInt'.

See also

section Integer Types, section Subrange Types.

MedReal

(Under construction.)

Syntax

Description

Standards

Example

See also

MedWord

Description

`MedWord' is an unsigned integer type which is not smaller than `Word'. On most platforms it actually is the same as `Word' and 32 bits wide and thus has a range of `0..4294967295'. It is the same as section MedCard.

`MedWord' in GNU Pascal is compatible to `long unsigned int' in GNU C. This compatibility is the reason why `MedWord' exists.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `MedWord'.

See also

section Integer Types, section Subrange Types.

min

(Under construction.)

Syntax

  Function min ( x1, x2: ordinal or real type ): same type;

Description

Standards

Example

See also

MinReal

(Under construction.)

Syntax

Description

Standards

Example

See also

MkDir

(Under construction.)

Syntax

  Procedure MkDir ( Directory: String );

Description

Standards

Example

See also

mod

(Under construction.)

Syntax

  Operator mod ( p, q: Integer ) = r: Integer;

Description

Standards

Example

See also

Module

(Under construction.)

Syntax

Description

Standards

Example

See also

move

(Under construction.)

Syntax

  Procedure move ( Const Source; Var Dest; Count: Integer );

Description

Standards

Example

See also

MoveLeft

(Under construction.)

Syntax

  Procedure MoveLeft ( Const Source; Var Dest; Count: Integer );

Description

Standards

Example

See also

MoveRight

(Under construction.)

Syntax

  Procedure MoveRight ( Const Source; Var Dest; Count: Integer );

Description

Standards

Example

See also

near

Description

The `near' directive can be appended to a procedure or function heading but is ignored by GPC. It is there for Borland compatibility, only. (Since the GNU compilers provide a flat memory model, the distinction between `near' and `near' pointers is void.)

Standards

ISO Pascal does not define `near', Borland Pascal does.

Example

  Var
    p: Procedure;

  Procedure Foo; near;  (* `near' has no effect in GPC *)

  begin (* Foo *)
    [...]
  end (* Foo *);

  [...]

  p:= Foo;  (* Works, despite the `near'. *)

See also

section far.

ne

(Under construction.)

Syntax

  Function ne ( S1, S2: String ): Boolean;

Description

Standards

Example

See also

New

(Under construction.)

Syntax

  Procedure New ( Var P: any pointer );

or

  Procedure New ( Var P: pointer to a variant record; tag fields);

or

  Procedure New ( Var P: pointer to a schema; discriminants);

or

  Procedure New ( Var P: pointer to an object; constructor call);

or

  Function New ( any pointer type ): same type;

or

  Function New ( variant record pointer type;
                 tag fields): same type;

or

  Function New ( schema pointer type;
                 discriminants): same type;

or

  Function New ( object pointer type;
                 constructor call): same type;

Description

Standards

Example

See also

NewCString

(Under construction.)

Syntax

  Function NewCString ( Const S: String ): CString;

Description

Standards

Example

See also

Nil

(Under construction.)

Syntax

Description

Standards

Example

See also

not

(Under construction.)

Syntax

  Operator not ( b1, b2: Boolean ) = result: Boolean;

or

  Operator not ( i1, i2: integer type ) = result: integer type;

Description

Standards

Example

See also

object

Description

The keyword `object' is used to declare a new object type:

  Type
    foo = object
      a: Integer;
      Constructor Init;
      Procedure bar ( x: Integer ); virtual;
    end (* foo *);

(For a longer example, see section Object-orientated Programming.)

Standards

GNU Pascal follows the Borland Pascal 7.0 object model.

ISO Pascal does not support Object-orientated programming. There is an ANSI draft for an "Object Pascal" language which is not yet supported by GPC, but planned. The Delphi language, also called "Object Pascal" by Borland, is currently not supported by GPC either.

See also

section Object-orientated Programming, section record.

odd

(Under construction.)

Syntax

  Function odd ( i: Integer ): Boolean;

Description

Standards

Example

See also

of

(Under construction.)

Syntax

Description

Standards

Example

See also

only

(Under construction.)

Syntax

Description

Standards

Example

See also

Operator

(Under construction.)

Syntax

Description

Standards

Example

See also

or

Syntax

  Operator or ( operand1, operand2: Boolean ) = result: Boolean;

or

  Operator or ( operand1, operand2: integer type ) = result: integer type;

or

  Procedure or ( Var operand1: integer type; operand2: integer type );

Description

In GNU Pascal, `or' has three built-in meanings:

  1. Logical "or" between two `Boolean'-type expressions. The result of the operation is of `Boolean' type. By default, `or' acts as a short-circuit operator in GPC: If the first operand is `true', the second operand is not evaluated because the result is already known to be `true'. You can change this to complete evaluation using the `--no-short-circuit' command-line option or the `(*$B+*)' compiler directive.
  2. Bitwise "or" between two integer-type expressions. The result is of the common integer type of both expressions.
  3. Use as a "procedure": `operand1' is "or"ed bitwise with `operand2'; the result is stored in `operand1'.

Standards

The logical `or' operator is defined in ISO-7185 Standard Pascal.

According to ISO, you cannot rely on `or' being a short-circuit operator. On the other hand, GPC's default behaviour does not contradict the ISO standard. (See section or_else.) However, since it seems to be a de-facto standard among ISO Pascal compilers to evaluate both operands of `or', GPC switches to `--no-short-circuit' mode if one of the language dialect options selecting ISO Pascal, for instance `--extended-pascal', is given. Use `--short-circuit' to override.

ISO Pascal does not define the bitwise `or' operator; Borland Pascal and Delphi do.

Use of `or' as a "procedure" is a GNU extension.

Example

  Var
    a, b, c: Integer;

  ...

  if ( a = 0 ) or ( b = 0 ) then  (* logical `or' *)
    c:= 1
  else if a or b = 0 then  (* bitwise `or' *)
    c:= 2
  else
    or ( c, a );  (* same as `c:= c or a' *)

Note the difference between the logical `or' and the bitwise `or': When `a' is 2 and `b' is 4, then `a or b' is 6. Beware: `a or b = 0' happens to mean the same as `( a = 0 ) and ( b = 0 )'. (Note the `and'!)

Since bitwise `or' has a higher priority than the `=' operator, parentheses are needed in `if ( a = 0 ) or ( b = 0 )' because otherwise `0 or b' would be calculated first, and the remainder would cause a parse error.

See also

section and, section xor, section Operators.

or else

Description

`or else' is an alias for the short-circuit logical operator `or_else'.

Standards

While `or_else' is defined in ISO-10206 Extended Pascal, `or else' is a GNU Extension.

Example

  Var
    a: Integer;

  [...]

  if ( a = 0 ) or else ( 100 div a > 42 ) then  (* This is safe. *)
    [...];

See also

section or_else, section or, section and then.

or_else

Syntax

  Operator or_else ( operand1, operand2: Boolean ) = result: Boolean;

Description

The `or_else' short-circuit logical operator performs the same operation as the logical operator `or'. But while the ISO standard does not specify anything about the evaluation of the operands of `or'---they may be evaluated in any order, or not at all---`or_else' has a well-defined behaviour: It evaluates the first operand. If the result is `true', `or_else' returns `true' without evaluating the second operand. If it is `false', the second operand is evaluated and returned.

Since the behaviour described above is the most effective way to implement `or', GPC by default treats `or' and `or_else' exactly the same. If you want, for some reason, to have both operands of `or' evaluated completely, you can specify the `--no-short-circuit' command-line option, but this is not portable. The portable way to have both operands evaluated is to assign both to temporary variables and then use `or'---or `or_else', it does not matter.

Standards

ISO-7185 Standard Pascal does not define `or_else'; ISO-10206 Extended Pascal does.

Some people think that the ISO standard requires both operands of `or' to be evaluated. This is false. What the ISO standard does say is that you cannot rely on a certain order of evaluation of the operands of `or'; in particular things like

  Var
    a: Integer;

  [...]

  if ( a = 0 ) or ( 100 div a > 42 ) then
    [...];

can crash according to ISO Pascal, although they cannot crash when compiled with GNU Pascal running in default mode.

If you want to write portable and efficient code in ISO-10206 Extended Pascal, always use `or_else'; never use `or'.

Example

  Var
    a: Integer;

  [...]

  if ( a = 0 ) or_else ( 100 div a > 42 ) then  (* This is safe. *)
    [...];

See also

section or else, section or, section and_then.

ord

(Under construction.)

Syntax

  Function ord ( Ch: Char ): Integer;

Description

Standards

Example

See also

others

(Under construction.)

Syntax

Description

Standards

Example

See also

otherwise

(Under construction.)

Syntax

Description

Standards

Example

See also

Output

(Under construction.)

Syntax

  Var
    Output: Text;

Description

Standards

Example

See also

pack

(Under construction.)

Syntax

Description

  Procedure pack ( Source: unpacked array;
                   FirstElement: index type;
                   Var Dest: packed array );

Standards

Example

See also

packed

Description

`packed' is a reserved word. According to ISO-7185 Standard Pascal it can preceed `array' and `record' type definitions to indicate that memory usage should be minimized for variables of this type, possibly at the expense of loss of speed.

As a GNU extension, `packed' can also be applied to section Subrange Types.

Standards

The reserved word `packed' is defined in ISO-7185 Standard Pascal.

According to ISO standard, only packed arrays of char with lower bound 1 qualify as strings of fixed length. GNU Pascal neither requires `packed' nor the lower bound of 1 here.

Example

  Type
    MonthInt = packed 1..12;  (* needs one byte   *)
    FastMonthInt = 1..12;     (* needs four bytes *)

    FixString10 = packed array [ 1..10 ] of Char;
    FoxyString10 = array [ 0..9 ] of Char;

    Flags = packed array [ 1..32 ] of Boolean;  (* needs four Bytes *)

    DateRec = packed record
      day: 1..31;            (* five bits *)
      month: MonthInt;       (* four bits *)
      year: Integer ( 15 );  (* 15 bits = -16384..16383 *)
    end (* DateRec *);

    Dates = array [ 1..1000 ] of DateRec;

  Var
    S: FixString10;
    T: FoxyString10;

  [...]

  S:= 'Hello!';   (* blank padded *)
  writeln ( S );

  T:= 'GNU Pascal';  (* GPC extension: this also works. *)
  writeln ( T );

`DateRec' has 24 bits = 3 bytes in total; `Dates' has 3000 bytes.

See also

section pack, section unpack, section SizeOf, section AlignOf, section BitSizeOf.

page

(Under construction.)

Syntax

  Procedure Page ( Var F: Text );

or

  Procedure Page;

Description

Standards

Example

See also

pAnsiChar

(Under construction.)

Syntax

  Type
    pAnsiChar = ^AnsiChar;

Description

Standards

Example

See also

ParamCount

Syntax

  Function ParamCount: Integer;

Description

`ParamCount' returns the number of command-line arguments given to the program. `ParamCount' returns 0 if no arguments have been given to the program; the name of the program as an implicit argument is not counted.

Standards

`ParamCount' is a Borland Pascal extension.

Example

  Program Test;

  Var
    i: Integer;

  begin
    writeln ( 'You have invoked this program with ',
              ParamCount, ' arguments.' );
    writeln ( 'These are:' );
    for i:= 1 to ParamCount do
      writeln ( ParamStr ( i ) );
  end.

See also

section ParamStr.

ParamStr

(Under construction.)

Syntax

  Function ParamStr ( ParmNumber: Integer ): String;

Description

Standards

Example

See also

pChar

(Under construction.)

Syntax

  Type
    pChar = ^Char;

or

  Type
    pChar = CString;

Description

Standards

Example

See also

Pointer

(Under construction.)

Syntax

Description

Standards

Example

See also

polar

(Under construction.)

Syntax

  Function polar ( rho, phi: Real ): Complex;

Description

Standards

Example

See also

pos

(Under construction.)

Syntax

  Function pos ( SearchPattern, Source: String ): Integer;

Description

Standards

Example

See also

Position

(Under construction.)

Syntax

  Function Position ( Var F: typed file );

Description

Standards

Example

See also

pow

(Under construction.)

Syntax

  Operator pow ( base: Real; exponent: Integer ) = power: Real;

or

  Operator pow ( base: Complex; exponent: Integer ) = power: Complex;

Description

Standards

Example

See also

pred

Syntax

  Function pred ( i: ordinal type ): ordinal type;

or

  Function pred ( i: ordinal type; j: Integer ): ordinal type;

or, with extended syntax (`--extended-syntax' or `(*$X+*)'),

  Function pred ( p: pointer type ): pointer type;

or

  Function pred ( p: pointer type; j: Integer ): pointer type;

Description

Returns the predecessor of the ordinal type value `i', or, if the second argument `j' is given, its `j'th predecessor. For integer values `i', this is `i - 1' (or `i - j'). (No, `pred' does not work faster than plain subtraction. Both are optimized to a single machine instruction or even expanded by the compiler, if possible.)

If extended syntax is on, the argument may also be a pointer value. In this case, the address is decremented by the size of the variable pointed to, or, if `j' is given, by `j' times the size of the variable pointed to. If `p' points to an element of an array, the returned pointer will point to the (`j'th) previous element of the array.

Standards

The `pred' function is defined in ISO-7185 Standard Pascal. The optional second parameter is defined in ISO-10206 Extended Pascal. Application of `pred' to pointers is defined in Borland Pascal. The combination of the second argument with application to pointers is a GNU extension.

Example

  Program PredTest;

  Type
    Metasyntactical = ( foo, bar, baz );

  Var
    m: Metasyntactical;
    c: Char;
    a: array [ 1..7 ] of Integer;
    p: ^Integer;

  begin
    m:= pred ( bar );     (* foo *)
    c:= pred ( 'Z', 2 );  (* 'X' *)
    a [ 1 ]:= 42;
    a [ 4 ]:= pred ( a [ 1 ] );     (* 41 *)
    a [ 5 ]:= pred ( a [ 4 ], 3 );  (* 38 *)
    (*$X+*)
    p:= @a [ 5 ];
    p:= pred ( p );     (* now points to `a [ 4 ]' *)
    p:= pred ( p, 3 );  (* now points to `a [ 1 ]' *)
  end.

See also

section succ, section dec, section Pointer Arithmetics.

Procedure

(Under construction.)

Syntax

Description

Standards

Example

See also

Program

(Under construction.)

Syntax

Description

Standards

Example

See also

protected

(Under construction.)

Syntax

Description

Standards

Example

See also

PtrCard

(Under construction.)

Syntax

Description

Standards

Example

See also

PtrInt

(Under construction.)

Syntax

Description

Standards

Example

See also

PtrWord

(Under construction.)

Syntax

Description

Standards

Example

See also

Put

(Under construction.)

Syntax

  Procedure Put ( Var F: typed file );

Description

Standards

Example

See also

Re

(Under construction.)

Syntax

  Function Re ( z: Complex ): Real;

Description

Standards

Example

See also

read

(Under construction.)

Syntax

  Procedure read ( Var F: typed file; variable );

or

  Procedure read ( Var F: Text; variables );

or

  Procedure read ( variables );

Description

Standards

Example

See also

readln

(Under construction.)

Syntax

  Procedure readln ( Var F: Text; variables );

or

  Procedure readln ( variables );

Description

Standards

Example

See also

ReadStr

(Under construction.)

Syntax

  Procedure ReadStr ( Const S: String; variables );

Description

Standards

Example

See also

Real

(Under construction.)

Syntax

Description

Standards

Example

See also

record

Description

The reserved word `record' starts the definition of a new record type. The syntax is

  foo = record
    field declarations
  end (* foo *);

or, with a variant part,

  foo = record
    field declarations
    case bar: variant type of
      selector: ( field declarations );
      selector: ( field declarations );
      ...
  end (* foo *);

or, without a variant selector field,

  foo = record
    field declarations
    case variant type of
      selector: ( field declarations );
      selector: ( field declarations );
      ...
  end (* foo *);

Records can be `packed' to save memory usage at the expense of speed.

The variants of a variant record share one location in memory (inside the record) and thus can be used to emulate type casting without violating ISO-7185 Standard Pascal.

Standards

The reserved word `record' and record types are defined in ISO-7185 Standard Pascal.

According to ISO Pascal, the variant type must be an identifier. GNU Pascal, like UCSD and Borland Pascal, also allows a subrange here.

Example

  Type
    fooPtr = ^foo;

    foo = record
      bar: Integer;
      nextFoo: fooPtr;
      case choice: 1..3 of
        1: ( a: Integer );   (* These three choices share *)
	2: ( b: Real );      (* one location in memory.   *)
	3: ( c: Char;
	     d: Boolean );
    end (* foo *);

    smallFoo = packed record
      b: 0..3;
      a: Integer ( 5 );
      r: Boolean;
    end (* smallFoo *);   (* needs 1 byte *)

  Var
    f: foo;

  [...]

  f.b:= 3.14;
  writeln ( f.a );  (* yields some strange number which is part of the   *)
                    (* internal representation of the real number `f.b'. *)

See also

section packed, section array, section object.

Release

(Under construction.)

Syntax

  Procedure Release ( P: Pointer );

Description

Standards

Example

See also

rename

(Under construction.)

Syntax

  Procedure Rename ( Var F: any file; NewName: String );

Description

Standards

Example

See also

repeat

(Under construction.)

Syntax

Description

Standards

Example

See also

reset

(Under construction.)

Syntax

  Procedure reset ( Var F: any file );

or

  Procedure reset ( Var F: any file; FileName: String );

Description

Standards

Example

See also

restricted

(Under construction.)

Syntax

Description

Standards

Example

See also

Result

(Under construction.)

Syntax

Description

Standards

Example

See also

return

(Under construction.)

Syntax

Description

Standards

Example

See also

rewrite

(Under construction.)

Syntax

  Procedure rewrite ( Var F: any file );

or

  Procedure rewrite ( Var F: any file; FileName: String );

Description

Standards

Example

See also

RmDir

(Under construction.)

Syntax

  Procedure RmDir ( Directory: String );

Description

Standards

Example

See also

round

(Under construction.)

Syntax

  Function round ( x: Real ): Integer;

Description

Standards

Example

See also

RunError

(Under construction.)

Syntax

  Procedure RunError ( ErrorCode: Integer );

Description

Standards

Example

See also

Seek

(Under construction.)

Syntax

  Procedure Seek ( Var F: typed file; NewPosition: Integer );

Description

Standards

Example

See also

SeekRead

(Under construction.)

Syntax

  Procedure SeekRead ( Var F: typed file; NewPosition: Integer );

Description

Standards

Example

See also

SeekUpdate

(Under construction.)

Syntax

  Procedure SeekUpdate ( Var F: typed file; NewPosition: Integer );

Description

Standards

Example

See also

SeekWrite

(Under construction.)

Syntax

  Procedure SeekWrite ( Var F: typed file; NewPosition: Integer );

Description

Standards

Example

See also

Self

(Under construction.)

Syntax

Description

Standards

Example

See also

set

(Under construction.)

Syntax

Description

Standards

Example

See also

SetLength

Syntax

  Procedure SetLength ( Var S: String; NewLength: Integer );

Description

`SetLength' explicitly assigns a new length `NewLength' to the string parameter S. The contents of the string is not changed; if the operation increases the length of the string, the characters appended at the end are undefined.

If you want to use `SetLength', please enable "extended syntax" (`--extended-syntax' or `(*$X+*)').

Standards

`SetLength' is a Borland Delphi 2.0 extension.

Example

Program TestSetLength;

(*$X+*)  (* Enable "dangerous" features *)

Var
  S: String ( 26 );

begin
  S:= 'Hello, world!';
  SetLength ( S, length ( 'Hello' ) );
  writeln ( S );                                     (* 'Hello' *)
  SetLength ( S, 26 );
  writeln ( S );               (* 'Hello, world!(%$@ާ"!"ާ$ާ"$'  *)
			(* undefined characters ^^^^^^^^^^^^^   *)

  SetLength ( S, 42 );  (* The overflow is *not* (yet) detected *)
  writeln ( S );        (* This might cause a runtime error.    *)
end.

See also

section length, section String, section SetType.

SetType

Syntax

  Procedure SetType ( Var SomeObject; VMT: Pointer );

Description

The procedure `SetType' explicitly assigns a value to the implicit VMT field of an object. This is normally done implicitly when a constructor is called.

You can use this to write a polymorphic I/O routine which reads an object from a file. In this case, you cannot reasonably use `New' to allocate the storage, but you `GetMem' it and initialize the object manually using `SetType' before calling the constructor explicitly.

This is a dangerous feature which yields a warning unless `(*$X+*)' is given.

Standards

`SetType' is a GNU extension.

Example

  (*$X+*)

  Type
    BasePtr = ^BaseObj;

    BaseObj = object
      Constructor Load;
    end (* BaseObj *)

    [Successor objects ...]

  [...]

  Function GetObject = Result: BasePtr;

  Var
    Size: Cardinal;
    VMT: Pointer;

  begin (* GetObject *)
    [Read the size of the object from some file and store it in `Size'.]
    GetMem ( Result, Size );
    [Read some ID from some file and look up the `VMT' from some table.]
    SetType ( Result^, VMT );
    (* Now the object is ready, and the constructor can be called. *)
    [Look up the correct constructor from some table and call it.]
  end (* GetObject *);

See also

section TypeOf, section Object-orientated Programming.

ShortCard

Description

`ShortCard' is an unsigned integer type which is not larger than `Cardinal'. On most platforms it is 16 bits wide and thus has a range of `0..65535'.

`ShortCard' in GNU Pascal is compatible to `short unsigned int' in GNU C.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `ShortCard'. (However see section Subrange Types.)

See also

section Integer Types, section Subrange Types.

ShortInt

Description

`ShortInt' is a signed integer type which is not larger than `Integer'. On most platforms it is 16 bits wide and thus has a range of `-32768..32767'.

`ShortInt' in GNU Pascal is compatible to `short int' in GNU C.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `ShortInt'. (However see section Subrange Types.)

`ShortInt' in GNU Pascal corresponds to `Integer' in Borland Pascal and Delphi 1.0. Both Borland languages also define `ShortInt', but it is an 8-bit signed integer type there (`ByteInt' in GNU Pascal).

See also

section Integer Types, section Subrange Types.

ShortReal

(Under construction.)

Syntax

Description

Standards

Example

See also

ShortWord

Description

`ShortWord' is an unsigned integer type which is not larger than `Word'. On most platforms it is 16 bits wide and thus has a range of of `0..65535'. It is the same as section ShortCard.

`ShortWord' in GNU Pascal is compatible to `short unsigned int' in GNU C.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `ShortWord'. (However see section Subrange Types.)

`ShortWord' in GNU Pascal essentially corresponds to `Word' in Borland Pascal and Delphi where it is a 16-bit unsigned integer type.

See also

section Integer Types, section Subrange Types.

Single

(Under construction.)

Syntax

  Type
    Single = ShortReal;

Description

Standards

Example

See also

shl

Syntax

  Operator shl ( operand1, operand2: integer type ) = result: integer type;

or

  Procedure shl ( Var operand1: integer type; operand2: integer type );

Description

In GNU Pascal, `shl' has two built-in meanings:

  1. Bitwise shift left of an integer-type expression by another integer value. The result is of the type of the first operand.
  2. Use as a "procedure": `operand1' is shifted left by `operand2'; the result is stored in `operand1'.

Standards

ISO Pascal does not define the `shl' operator; Borland Pascal and Delphi do.

Use of `shl' as a "procedure" is a GNU extension.

Example

  Var
    a: Integer;

  ...

  a:= 1 shl 7;  (* yields 128 = 2 pow 7 *)
  shl ( a, 4 );  (* same as `a:= a shl 4' *)

See also

section shr, section Operators.

shr

Syntax

  Operator shr ( operand1, operand2: integer type ) = result: integer type;

or

  Procedure shr ( Var operand1: integer type; operand2: integer type );

Description

In GNU Pascal, `shr' has two built-in meanings:

  1. Bitwise shift right of an integer-type expression by another integer value. The result is of the type of the first operand.
  2. Use as a "procedure": `operand1' is shifted right by `operand2'; the result is stored in `operand1'.

Standards

ISO Pascal does not define the bitwise `shr' operator; Borland Pascal and Delphi do.

Unlike the Borland compilers, GNU Pascal cares about the signedness of the first operand: If a signed integer with a negative value is shifted right, "one" bits are filled in from the left.

Use of `shr' as a "procedure" is a GNU extension.

Example

  Var
    a: Integer;

  ...

  a:= 1024 shr 4;  (* yields 64 *)
  a:= -127 shr 4;  (* yields -7 *)
  shr ( a, 2 );  (* same as `a:= a shr 2' *)

See also

section shl, section Operators.

sin

(Under construction.)

Syntax

  Function sin ( x: Real ): Real;

or

  Function sin ( z: Complex ): Complex;

Description

Standards

Example

See also

SizeOf

Syntax

  Function SizeOf ( Var x ): Integer;

Description

Returns the size of a type or variable in bytes.

Standards

ISO Pascal does not define `SizeOf'; UCSD and Borland Pascal do.

Example

  Var
    a: Integer;
    b: array [ 1..8 ] of Char;

  ...

  writeln ( SizeOf ( a ) );  (* Size of an `Integer'; usually 4 bytes. *)
  writeln ( SizeOf ( b ) );  (* Size of eight `Char's; usually 8 bytes. *)

See also

section BitSizeOf, section AlignOf, section TypeOf.

SmallInt

Description

`SmallInt' is a signed integer type which is not larger than `Integer'. On most platforms it is 16 bits wide and thus has a range of `-32768..32767'. It is the same as `ShortInt' (see section ShortInt).

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `SmallInt'. (However see section Subrange Types.)

`SmallInt' also appears in Delphi 2.0. This compatibility is the reason why GPC supports the synonym `SmallInt' for `ShortInt'.

See also

section Integer Types, section Subrange Types.

sqr

Syntax

  Function sqr ( i: integer type ): integer type;

or

  Function sqr ( x: real type ): real type;

or

  Function sqr ( z: complex type ): complex type;

Description

Returns the square of the argument:

  Function sqr ( x: some type ): some type;

  begin (* sqr *)
    sqr:= x * x;  (* or: x pow 2 *)
  end (* sqr *);

Standards

The function `sqr' is defined in ISO-7185 Standard Pascal; its application to complex values is defined in ISO-10206 Extended Pascal.

Example

  Program TestSqr;

  Var
    i: Complex;

  begin
    i:= cmplx ( 0, 1 );
    writeln ( Re ( sqr ( i ) : 0 : 3 );
    (* yields -1.000 *)
  end.

See also

section pow, section sqrt, section abs, section Operators.

sqrt

Syntax

  Function sqrt ( x: real type ): real type;

or

  Function sqrt ( z: complex type ): complex type;

Description

Returns the positive square root of the argument.

For real arguments, it is an error if the argument is negative.

For complex arguments, `sqrt' returns the principal value of the root of the argument, i.e. the root with positive real part, or, if the real part is zero, that one with positive imaginary part.

Standards

The function `sqrt' is defined in ISO-7185 Standard Pascal; its application to complex values is defined in ISO-10206 Extended Pascal.

Example

  Program TestSqrt;

  Var
    m1: Complex;

  begin
    m1:= cmplx ( -1, 0 );  (* -1 *)
    writeln ( Re ( sqrt ( m1 ) ) : 6 : 3, Im ( sqrt ( m1 ) ) : 6 : 3 );
    (* yields 1.000 -1.000, i.e. the imaginary unit, i *)
  end.

See also

section pow, section sqr, section Operators.

StandardError

(Under construction.)

Syntax

Description

Standards

Example

See also

StandardInput

(Under construction.)

Syntax

Description

Standards

Example

See also

StandardOutput

(Under construction.)

Syntax

Description

Standards

Example

See also

static

(Under construction.)

Syntax

Description

Standards

Example

See also

StdErr

(Under construction.)

Syntax

  Var
    StdErr: Text;

Description

Standards

Example

See also

Str

(Under construction.)

Syntax

  Procedure Str ( x: integer or real; Var Dest: String );

or

  Procedure Str ( x: integer or real : field width; Var Dest: String );

or

  Procedure Str ( x: Real : field width : precision; Var Dest: String );

or

  Procedure Str ( repeated constructs as described above; Var Dest: String );

Description

Standards

Example

See also

StrPCopy

(Under construction.)

Syntax

  Function StrPCopy ( Dest: CString; Const Source: String ): CString;

Description

Standards

Example

See also

String

(Under construction.)

Syntax

Description

Standards

Example

See also

String2CString

(Under construction.)

Syntax

  Function String2CString ( Const S: String ): CString;

Description

Standards

Example

See also

SubStr

(Under construction.)

Syntax

  Function SubStr ( S: String; FirstChar: Integer ): String;

or

  Function SubStr ( S: String; FirstChar, Count: Integer ): String;

Description

Standards

Example

See also

succ

Syntax

  Function succ ( i: ordinal type ): ordinal type;

or

  Function succ ( i: ordinal type; j: Integer ): ordinal type;

or, with extended syntax (`--extended-syntax' or `(*$X+*)'),

  Function succ ( p: pointer type ): pointer type;

or

  Function succ ( p: pointer type; j: Integer ): pointer type;

Description

Returns the successor of the ordinal type value `i', or, if the second argument `j' is given, its `j'th successor. For integer values `i', this is `i + 1' (or `i + j'). (No, `succ' does not work faster than plain addition. Both are optimized to a single machine instruction or even expanded by the compiler, if possible.)

If extended syntax is on, the argument may also be a pointer value. In this case, the address is incremented by the size of the variable pointed to, or, if `j' is given, by `j' times the size of the variable pointed to. If `p' points to an element of an array, the returned pointer will point to the (`j'th) next element of the array.

Standards

The `succ' function is defined in ISO-7185 Standard Pascal. The optional second parameter is defined in ISO-10206 Extended Pascal. Application of `succ' to pointers is defined in Borland Pascal. The combination of the second argument with application to pointers is a GNU extension.

Example

  Program SuccTest;

  Type
    Metasyntactical = ( foo, bar, baz );

  Var
    m: Metasyntactical;
    c: Char;
    a: array [ 1..7 ] of Integer;
    p: ^Integer;

  begin
    m:= succ ( foo );     (* bar *)
    c:= succ ( 'A', 4 );  (* 'E' *)
    a [ 1 ]:= 42;
    a [ 2 ]:= succ ( a [ 1 ] );     (* 43 *)
    a [ 5 ]:= succ ( a [ 2 ], 7 );  (* 50 *)
    (*$X+*)
    p:= @a [ 1 ];
    p:= succ ( p );     (* now points to `a [ 2 ]' *)
    p:= succ ( p, 3 );  (* now points to `a [ 5 ]' *)
  end.

See also

section pred, section inc, section Pointer Arithmetics.

Text

(Under construction.)

Syntax

Description

Standards

Example

See also

then

(Under construction.)

Syntax

Description

Standards

Example

See also

Time

(Under construction.)

Syntax

  Function Time ( T: TimeStamp ):
      packed array [ 1..time length ] of Char;

Description

Standards

Example

See also

TimeStamp

(Under construction.)

Syntax

  Type
    TimeStamp = record
      DateValid, TimeValid: Boolean;
      Year: Integer;
      Month: 1..12;
      Day: 1..31;
      Hour: 0..23;
      Minute, Second: 0..59;
      MicroSecond: Integer;
    end (* TimeStamp *);

Description

Standards

Example

See also

to

(Under construction.)

Syntax

Description

Standards

Example

See also

to begin

(Under construction.)

Syntax

Description

Standards

Example

See also

to end

(Under construction.)

Syntax

Description

Standards

Example

See also

Trim

(Under construction.)

Syntax

  Function Trim ( S: String ): String;

Description

Standards

Example

See also

true

(Under construction.)

Syntax

Description

Standards

Example

See also

trunc

(Under construction.)

Syntax

  Function trunc ( x: Real ): Integer;

Description

Standards

Example

See also

Truncate

(Under construction.)

Syntax

  Procedure Truncate ( Var F: any file );

Description

Standards

Example

See also

Type

(Under construction.)

Syntax

Description

Standards

Example

See also

TypeOf

Syntax

  Function TypeOf ( Var x ): Pointer;

Description

Returns a pointer to the VMT of an object type or variable. This pointer can be used to identify the type of an object.

Standards

ISO Pascal does not define `TypeOf', Borland Pascal does.

Example

  Type
    fooPtr = ^foo;
    barPtr = ^bar;

    foo = object        (* Has a VMT, though it doesn't *)
      x: Integer;       (* contain virtual methods.     *)
      Constructor Init;
    end (* foo *);

    bar = object ( foo )
      y: Integer;
    end (* bar *);

  Var
    MyFoo: fooPtr;

  [...]

  MyFoo:= New ( barPtr, Init );

  if TypeOf ( MyFoo^ ) = TypeOf ( bar ) then  (* true *)
    writeln ( 'OK' );

See also

section BitSizeOf, section AlignOf, section TypeOf, section SetType, section Object-orientated Programming.

UnBind

(Under construction.)

Syntax

  Procedure UnBind ( Var F: any file );

Description

Standards

Example

See also

Unit

(Under construction.)

Syntax

Description

Standards

Example

See also

unpack

(Under construction.)

Syntax

  Procedure unpack ( Source: packed array;
                     Var Dest: unpacked array;
                     FirstElement: index type );

Description

Standards

Example

See also

until

(Under construction.)

Syntax

Description

Standards

Example

See also

UpCase

(Under construction.)

Syntax

  Function UpCase ( Ch: Char ): Char;

Description

Standards

Example

See also

update

(Under construction.)

Syntax

  Procedure update ( Var F: any file );

or

  Procedure update ( Var F: any file; FileName: String );

Description

Standards

Example

See also

uses

Description

The reserved word `uses' in the import part of a program makes the program import an interface. The syntax is

  Program foo;

  uses
    bar1,
    bar2 in 'baz.pas',
    bar3;

  [...]

or, in a Unit,

  Unit Bar3;

  Interface

  uses
    bar1,
    bar2 in 'baz.pas';

  [...]

The `in' above tells GPC to look for the `Unit' in the specified file; otherwise the file name is derived from the name of the interface by adding first `.p', then `.pas'.

There must be at most one import part in a program.

In a Unit, there is only one import part in the interface part; GPC currently does not support a second import part in the implementation part.

The imported interface needn't be an UCSD/Borland Pascal Unit, it may be an interface exported by an Extended Pascal Module as well.

Standards

ISO Pascal does not define `uses' and Units in general. UCSD and Borland Pascal do, but without the `in' extension. Delphi supports `uses' like described above.

See also

section Unit, section Module, section import.

Val

(Under construction.)

Syntax

  Procedure Val ( Const Source: String; Var x: integer or real );

or

  Procedure Val ( Const Source: String; Var x: integer or real;
                  Var ErrorCode: Integer );

Description

Standards

Example

See also

value

(Under construction.)

Syntax

Description

Standards

Example

See also

Var

(Under construction.)

Syntax

Description

Standards

Example

See also

virtual

(Under construction.)

Syntax

Description

Standards

Example

See also

Void

(Under construction.)

Syntax

Description

Standards

Example

See also

while

(Under construction.)

Syntax

Description

Standards

Example

See also

with

(Under construction.)

Syntax

Description

Standards

Example

See also

Word

Description

`Word' is the "natural" unsigned integer type in GNU Pascal. On most platforms it is 32 bits wide and thus has a range of `0..4294967295'. It is the same as section Cardinal, introduced for compatibility with other Pascal compilers.

As an extension, GPC allows to use `Word' as a pseudo-schema to produce types with a specified size in bits; for example

  Type
    Word16 = Cardinal ( 16 );

defines an unsigned integer type with 16 bits. The same mechanism works for `Cardinal' and `Integer', too.

`Word' in GNU Pascal is compatible to `unsigned int' in GNU C.

There are lots of other integer types in GPC, see section Integer Types.

Standards

ISO Pascal does not define `Cardinal'. (However see section Subrange Types.)

The `Word' type appears in Borland Pascal and Delphi, too, where it is a 16-bit unsigned integer type.

See also

section Integer Types, section Subrange Types.

write

(Under construction.)

Syntax

  Procedure write ( Var F: typed file; variable );

or

  Procedure write ( Var F: Text; values and format specifications );

or

  Procedure write ( values and format specifications );

Description

Standards

Example

See also

writeln

(Under construction.)

Syntax

  Procedure writeln ( Var F: Text; values and format specifications );

or

  Procedure writeln ( values and format specifications );

Description

Standards

Example

See also

WriteStr

(Under construction.)

Syntax

  Procedure WriteStr ( Var Dest: String; values and format specifications );

Description

Standards

Example

See also

xor

Syntax

  Operator xor ( operand1, operand2: Boolean ) = result: Boolean;

or

  Operator xor ( operand1, operand2: integer type ) = result: integer type;

or

  Procedure xor ( Var operand1: integer type; operand2: integer type );

Description

In GNU Pascal, `xor' has three built-in meanings:

  1. Logical "exclusive or" between two `Boolean'-type expressions. The result of the operation is of `Boolean' type. (Logical `foo xor bar' in fact has the same effect as `foo <> bar'.)
  2. Bitwise "exclusive or" between two integer-type expressions. The result is of the common integer type of both expressions.
  3. Use as a "procedure": `operand1' is "xor"ed bitwise with `operand2'; the result is stored in `operand1'.

Standards

ISO Pascal does not define the `xor' operator; Borland Pascal and Delphi do.

Use of `xor' as a "procedure" is a GNU extension.

Example

  Var
    a, b, c: Integer;

  ...

  if ( a = 0 ) xor ( b = 0 ) then
    c:= 1  (* happens if either `a' or `b' is zero,    *)
           (* but not if both are zero or both nonzero *)

  else if a xor b = 0 then  (* bitwise `xor': `a' must be the bitwise *)
    c:= 2                   (* complement of `b' to fullfill this     *)
  else
    xor ( c, a );  (* same as `c:= c xor a' *)

See also

section and, section or, section Operators.


Go to the first, previous, next, last section, table of contents.