This is ../p/doc/info/gpc.info, produced by makeinfo version 4.0 from
gpc.texi.

INFO-DIR-SECTION GNU programming tools
START-INFO-DIR-ENTRY
* GPC: (gpc).                   The GNU Pascal Compiler.
END-INFO-DIR-ENTRY
INFO-DIR-SECTION Individual utilities
START-INFO-DIR-ENTRY
* GPC: (gpc)Invoking GPC.       The GNU Pascal Compiler.
END-INFO-DIR-ENTRY

   This file documents the GNU Pascal Compiler.

   Copyright (C) 1988-2002 Free Software Foundation, Inc.

   Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

   Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the sections entitled "GNU General Public License", "The GNU
Project", "The GNU Manifesto" and "Funding for Free Software" are
included exactly as in the original, and provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.

   Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the sections entitled "GNU General Public
License", "The GNU Project", "The GNU Manifesto" and "Funding for Free
Software" and this permission notice, may be included in translations
approved by the Free Software Foundation instead of in the original
English.


File: gpc.info,  Node: SetLength,  Next: SetType,  Prev: SetFileTime,  Up: Reference

SetLength
=========

Synopsis
--------

     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_.

Conforming to
-------------

   `SetLength' is a Borland Delphi 2.0 extension.

Example
-------

     program SetLengthDemo;
     
     var
       S: String (26);
     
     begin
       S := 'Hello, world!';
       SetLength (S, Length ('Hello'));
       WriteLn (S);                                           { 'Hello' }
     
       SetLength (S, 26);
       WriteLn (S);                     { 'Hello, world!(%$xy"!#&~+(/]' }
                                 { undefined characters ^^^^^^^^^^^^^^  }
     
       SetLength (S, 42);       { The overflow is *not* (yet) detected. }
       WriteLn (S);        { This might cause a runtime error or crash. }
     end.

See also
--------

   *Note Length::, *Note String::.


File: gpc.info,  Node: SetType,  Next: shl,  Prev: SetLength,  Up: Reference

SetType
=======

Synopsis
--------

     procedure SetType (var SomeObject; VMT: PObjectType);

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.

   The only values you should assign to an object via `SetType' are
actual VMT pointers that were obtained via `TypeOf'. In particular,
declaring a record like the one shown in the description of
`PObjectType' and assigning a pointer to it to an object via `SetType'
will usually not work because the virtual method pointers are missing.

   Since `SetType' is a dangerous feature, it yields a warning unless
`{$X+}' is given.

Conforming to
-------------

   `SetType' is a GNU extension.

Example
-------

     program SetTypeDemo;
     
     type
       BasePtr = ^BaseObj;
     
       BaseObj = object
         constructor Load;
       end;
     
       ChildObj = object (BaseObj)
         constructor Load;
       end;
     
     constructor BaseObj.Load;
     begin
     end;
     
     constructor ChildObj.Load;
     begin
     end;
     
     {$X+}
     
     { This is somewhat fragmentary code. }
     function GetObject (var InputFile: File) = Result: BasePtr;
     const
       VMTTable: array [1 .. 2] of PObjectType =
         (TypeOf (BaseObj), TypeOf (ChildObj));
     var
       Size: Cardinal;
       TypeID: Integer;
       VMT: PObjectType;
     begin
       { Read the size of the object from some file and store it in `Size'. }
       BlockRead (InputFile, Size, SizeOf (Size));
     
       { Allocate memory for the object. }
       GetMem (Result, Size);
     
       { Read some ID from some file. }
       BlockRead (InputFile, TypeID, SizeOf (TypeID));
     
       { Look up the `VMT' from some table. }
       { Range checking wouldn't be a bad idea here ... }
       VMT := VMTTable[TypeID];
     
       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;
     
     begin
     end.

See also
--------

   *Note PObjectType::, *Note TypeOf::, *Note OOP::.


File: gpc.info,  Node: shl,  Next: ShortBool,  Prev: SetType,  Up: Reference

shl
===

Synopsis
--------

     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'.


Conforming to
-------------

   `shl' is a Borland Pascal extension.

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

Example
-------

     program ShlDemo;
     var
       a: Integer;
     begin
       a := 1 shl 7;  { yields 128 = 2 pow 7 }
       shl (a, 4)  { same as `a := a shl 4' }
     end.

See also
--------

   *Note shr::, *Note Operators::.


File: gpc.info,  Node: ShortBool,  Next: ShortCard,  Prev: shl,  Up: Reference

ShortBool
=========

   (Under construction.)

Synopsis
--------

     type
       ShortBool = Boolean (BitSizeOf (ShortInt));

Description
-----------

Conforming to
-------------

Example
-------

     program ShortBoolDemo;
     var
       a: ShortBool;
     begin
       ShortInt (a) := 1;
       if a then WriteLn ('Ord (True) = 1')
     end.

See also
--------


File: gpc.info,  Node: ShortCard,  Next: ShortInt,  Prev: ShortBool,  Up: Reference

ShortCard
=========

Synopsis
--------

     type
       ShortCard = Cardinal (BitSizeOf (ShortInt));

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 *Note Integer
Types::.

Conforming to
-------------

   `ShortCard' is a GNU Pascal extension.

Example
-------

     program ShortCardDemo;
     var
       a: ShortCard;
     begin
       a := 42;
       WriteLn (a)
     end.

See also
--------

   *Note Integer Types::, *Note Subrange Types::.


File: gpc.info,  Node: ShortInt,  Next: ShortReal,  Prev: ShortCard,  Up: Reference

ShortInt
========

Synopsis
--------

     type
       ShortInt  { built-in type }

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 *Note Integer
Types::.

Conforming to
-------------

   `ShortInt' is a Borland Pascal extension. In Borland Pascal,
`ShortInt' is an 8-bit signed integer type (`ByteInt' in GNU Pascal).

Example
-------

     program ShortIntDemo;
     var
       a: ShortInt;
     begin
       a := 42;
       WriteLn (a)
     end.

See also
--------

   *Note Integer Types::, *Note Subrange Types::.


File: gpc.info,  Node: ShortReal,  Next: ShortWord,  Prev: ShortInt,  Up: Reference

ShortReal
=========

   (Under construction.)

Synopsis
--------

     type
       ShortReal  { built-in type }

Description
-----------

Conforming to
-------------

Example
-------

     program ShortRealDemo;
     var
       a: ShortReal;
     begin
       a := 42;
       WriteLn (a)
     end.

See also
--------


File: gpc.info,  Node: ShortWord,  Next: shr,  Prev: ShortReal,  Up: Reference

ShortWord
=========

Synopsis
--------

     type
       ShortWord = ShortCard;

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 *Note ShortCard::.

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

   There are lots of other integer types in GPC, see *Note Integer
Types::.

Conforming to
-------------

   `ShortWord' is a GNU Pascal extension.

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

Example
-------

     program ShortWordDemo;
     var
       a: ShortWord;
     begin
       a := 42;
       WriteLn (a)
     end.

See also
--------

   *Note Integer Types::, *Note Subrange Types::.


File: gpc.info,  Node: shr,  Next: Sin,  Prev: ShortWord,  Up: Reference

shr
===

Synopsis
--------

     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'.


Conforming to
-------------

   `shr' is a Borland Pascal extension.

   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 Pascal extension.

Example
-------

     program ShrDemo;
     var
       a: Integer;
     begin
       a := 1024 shr 4;  { yields 64 }
       a := -127 shr 4;  { yields -8 }
       shr (a, 2)  { same as `a := a shr 2' }
     end.

See also
--------

   *Note shl::, *Note Operators::.


File: gpc.info,  Node: Sin,  Next: Single,  Prev: shr,  Up: Reference

Sin
===

Synopsis
--------

     function Sin (x: Real): Real;
   or
     function Sin (z: Complex): Complex;

Description
-----------

   `Sin' returns the sine of the argument.  The result is in the range
`-1 <= Sin (x) <= 1' for real arguments.

Conforming to
-------------

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

Example
-------

     program SinDemo;
     begin
       WriteLn (Sin (SqRt (2) / 2) : 0 : 5)
       { yields 0.5 since Sin (SqRt (2) /2) = 0.5 }
     end.

See also
--------

   *Note ArcTan::, *Note Cos::, *Note Ln::, *Note Arg::.


File: gpc.info,  Node: Single,  Next: SizeOf,  Prev: Sin,  Up: Reference

Single
======

   (Under construction.)

Synopsis
--------

     type
       Single = ShortReal;

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: SizeOf,  Next: SizeType,  Prev: Single,  Up: Reference

SizeOf
======

Synopsis
--------

     function SizeOf (var x): SizeType;

Description
-----------

   Returns the size of a type or variable in bytes.

   `SizeOf' can be applied to expressions and type names. If the
argument is a polymorphic object, the size of its actual type is
returned.

Conforming to
-------------

   `SizeOf' is a UCSD Pascal extension.

Example
-------

     program SizeOfDemo;
     var
       a: Integer;
       b: array [1 .. 8] of Char;
     begin
       WriteLn (SizeOf (a));        { Size of an `Integer'; often 4 bytes. }
       WriteLn (SizeOf (Integer));  { The same. }
       WriteLn (SizeOf (b))         { Size of eight `Char's; usually 8 bytes. }
     end.

See also
--------

   *Note BitSizeOf::, *Note AlignOf::, *Note TypeOf::.


File: gpc.info,  Node: SizeType,  Next: SmallInt,  Prev: SizeOf,  Up: Reference

SizeType
========

Synopsis
--------

     type
       SizeType  { built-in type }

Description
-----------

   `SizeType' is an integer type (usually unsigned) to represent the
size of objects in memory.

Conforming to
-------------

Example
-------

     program SizeTypeDemo;
     var
       a: array [1 .. 10] of Integer;
       Size: SizeType;
     begin
       Size := SizeOf (a);
       WriteLn (Size)
     end.

See also
--------


File: gpc.info,  Node: SmallInt,  Next: Sqr,  Prev: SizeType,  Up: Reference

SmallInt
========

Synopsis
--------

     type
       SmallInt = ShortInt;

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 *Note ShortInt::).

   There are lots of other integer types in GPC, see *Note Integer
Types::.

Conforming to
-------------

   `SmallInt' is a Delphi 2.0 extension.

Example
-------

     program SmallIntDemo;
     var
       a: SmallInt;
     begin
       a := 42;
       WriteLn (a)
     end.

See also
--------

   *Note ShortInt::, *Note Integer Types::, *Note Subrange Types::.


File: gpc.info,  Node: Sqr,  Next: SqRt,  Prev: SmallInt,  Up: Reference

Sqr
===

Synopsis
--------

     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 := x * x  { or: x pow 2 }
     end;

Conforming to
-------------

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

Example
-------

     program SqrDemo;
     
     var
       i: Complex;
     
     begin
       i := Cmplx (0, 1);
       WriteLn (Re (Sqr (i)) : 0 : 3)  { yields -1.000 }
     end.

See also
--------

   *Note pow::, *Note SqRt::, *Note Abs::, *Note Operators::.


File: gpc.info,  Node: SqRt,  Next: StandardError,  Prev: Sqr,  Up: Reference

SqRt
====

Synopsis
--------

     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.

Conforming to
-------------

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

Example
-------

     program SqRtDemo;
     
     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
--------

   *Note pow::, *Note Sqr::, *Note Operators::.


File: gpc.info,  Node: StandardError,  Next: StandardInput,  Prev: SqRt,  Up: Reference

StandardError
=============

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: StandardInput,  Next: StandardOutput,  Prev: StandardError,  Up: Reference

StandardInput
=============

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: StandardOutput,  Next: static,  Prev: StandardInput,  Up: Reference

StandardOutput
==============

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: static,  Next: StdErr,  Prev: StandardOutput,  Up: Reference

static
======

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: StdErr,  Next: Str,  Prev: static,  Up: Reference

StdErr
======

Synopsis
--------

     var
       StdErr: Text;

Description
-----------

   The `StdErr' variable is connected to the standard error file
handle. To report errors, you should prefer `WriteLn (StdErr,
'everything wrong')' over `WriteLn ('everything wrong')'.

Conforming to
-------------

   `StdErr' is a GNU Pascal extension.

Example
-------

     program StdErrDemo;
     var
       Denominator: Integer;
     begin
       ReadLn (Denominator);
       if Denominator = 0 then
         WriteLn (StdErr, ParamStr (0), ': division by zero')
       else
         WriteLn ('1 / ', Denominator, ' = ', 1 / Denominator)
     end.

See also
--------

   *Note StandardError::, *Note Output::, *Note Input::.


File: gpc.info,  Node: Str,  Next: String,  Prev: StdErr,  Up: Reference

Str
===

   (Under construction.)

Synopsis
--------

     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
-----------

Conforming to
-------------

   `Str' is a UCSD Pascal extension, generalized by Borland Pascal.
The possibility to handle more than one variable with one call to `Str'
is a GNU Pascal extension.

   ISO-10206 Extended Pascal defines `WriteStr' instead of `Str'.

Example
-------

See also
--------

   *Note WriteStr::.


File: gpc.info,  Node: String,  Next: String2CString,  Prev: Str,  Up: Reference

String
======

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: String2CString,  Next: SubStr,  Prev: String,  Up: Reference

String2CString
==============

   (Under construction.)

Synopsis
--------

     function String2CString (const S: String): CString;

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: SubStr,  Next: Succ,  Prev: String2CString,  Up: Reference

SubStr
======

Synopsis
--------

     function SubStr (S: String; FirstChar: Integer): String;
   or
     function SubStr (S: String; FirstChar, Count: Integer): String;

Description
-----------

   `SubStr' returns a sub-string of S starting with the character at
position FIRSTCHAR.  If COUNT is given, such many characters will be
copied into the sub-string.  If COUNT is omitted, the sub-string will
will range to the end of S.

   If `Count' is too large for the sub-string to fit in S or if
`FirstChar' exceeds the length of S, `SubStr' triggers a runtime error.
(For a function returning the empty string instead, see *Note Copy::.)

Conforming to
-------------

   `SubStr' is a ISO 10206 Extended Pascal extension.

Example
-------

     program SubStrDemo;
     var
       S: String (42);
     begin
       S := 'Hello';
       WriteLn (SubStr (S, 2, 3));   { yields `ell' }
       WriteLn (SubStr (S, 3));      { yields `llo' }
       WriteLn (SubStr (S, 4, 7));   { yields a runtime error }
       WriteLn (SubStr (S, 42));     { yields a runtime error }
     end.

See also
--------

   *Note Copy::, *Note String Slice Access::.


File: gpc.info,  Node: Succ,  Next: Text,  Prev: SubStr,  Up: Reference

Succ
====

Synopsis
--------

     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.

Conforming to
-------------

   The `Succ' function is defined in ISO-7185 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 SuccDemo;
     
     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);     { points to `a[2]' now }
       p := Succ (p, 3);  { points to `a[5]' now }
     end.

See also
--------

   *Note Pred::, *Note Inc::, *Note Pointer Arithmetics::.


File: gpc.info,  Node: Text,  Next: TextWritable,  Prev: Succ,  Up: Reference

Text
====

   (Under construction.)

Synopsis
--------

     type
       Text  { built-in type }

Description
-----------

Conforming to
-------------

Example
-------

     program TextDemo;
     var
       t: Text;
     begin
       Rewrite (t, 'hello.txt');
       WriteLn (t, 'Hello, world!')
     end.

See also
--------


File: gpc.info,  Node: TextWritable,  Next: then,  Prev: Text,  Up: Reference

TextWritable
============

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: then,  Next: Time,  Prev: TextWritable,  Up: Reference

then
====

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

     program ThenDemo;
     var
       i: Integer;
     begin
       Write ('Enter a number: ');
       ReadLn (i);
       if i > 42 then
         WriteLn ('The number is greater than 42')
     end.

See also
--------


File: gpc.info,  Node: Time,  Next: TimeStamp,  Prev: then,  Up: Reference

Time
====

   (Under construction.)

Synopsis
--------

     function Time (T: TimeStamp): packed array [1 .. TIME LENGTH] of Char;

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: TimeStamp,  Next: to,  Prev: Time,  Up: Reference

TimeStamp
=========

   (Under construction.)

Synopsis
--------

     type
       TimeStamp = {@@packed} record
         DateValid,
         TimeValid  : Boolean;
         Year       : Integer;
         Month      : 1 .. 12;
         Day        : 1 .. 31;
         DayOfWeek  : 0 .. 6;  { 0 means Sunday }
         Hour       : 0 .. 23;
         Minute     : 0 .. 59;
         Second     : 0 .. 61; { to allow for leap seconds }
         MicroSecond: 0 .. 999999;
         TimeZone   : Integer; { in seconds }
         DST        : Boolean;
         TZName1,
         TZName2    : String (32);
       end;

   (@@ Currently, in GPC, TimeStamp is not actually packed.)

   The fields `DateValid', `TimeValid', `Year', `Month', `Day', `Hour',
`Minute', `Second' are required by Extended Pascal, the other ones are
extensions.

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: to,  Next: to begin do,  Prev: TimeStamp,  Up: Reference

to
==

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: to begin do,  Next: to end do,  Prev: to,  Up: Reference

to begin do
===========

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: to end do,  Next: Trim,  Prev: to begin do,  Up: Reference

to end do
=========

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: Trim,  Next: True,  Prev: to end do,  Up: Reference

Trim
====

   (Under construction.)

Synopsis
--------

     function Trim (S: String): String;

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: True,  Next: Trunc,  Prev: Trim,  Up: Reference

True
====

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: Trunc,  Next: Truncate,  Prev: True,  Up: Reference

Trunc
=====

Synopsis
--------

     function Trunc (x: Real): Integer;

Description
-----------

   `Trunc' converts `x' to the next integer below its argument (i.e.
truncates the numbers after the point).

Conforming to
-------------

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

Example
-------

     program TruncDemo;
     var
       Foo: Real;
     begin
       Foo := 9.876;
       WriteLn (Trunc (Foo))  { Prints 9 }
     end.

See also
--------

   *Note Round::.


File: gpc.info,  Node: Truncate,  Next: type,  Prev: Trunc,  Up: Reference

Truncate
========

   (Under construction.)

Synopsis
--------

     procedure Truncate (var F: ANY FILE);

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: type,  Next: type of,  Prev: Truncate,  Up: Reference

type
====

Synopsis
--------

   As a type declaration:
     type
       TYPE INDENTIFIER = TYPE DEFINITION;
   or with initialization:
     type
       TYPE INDENTIFIER = TYPE DEFINITION value CONSTANT EXPRESSION;

Description
-----------

   The reserved word `type' starts the declaration of a TYPE IDENTIFIER
which is defined by TYPE DEFINITION.  For further description see *Note
Type Declaration::, *Note Type Declaration::, *Note Type Definition::,
*Note Data Types::.

Conforming to
-------------

   `type' is defined in ISO-7185 Pascal and supported by all known
Pascal variants. Initializers are an ISO-10206 Extended Pascal
extension.

Example
-------

     program TypeDemo;
     type
       { This side is the }    { That side is the }
       { type declaration }    { type definition  }
     
       { array type }
       ArrayType                  = array [0 .. 9] of Integer;
     
       { record type }
       RecordType                 = record
                                      Bar: Integer
                                    end;
     
       { subrange type }
       SubrangeType               = -123 .. 456;
     
       { enumeration type }
       EnumeratedType             = (Mon, Tue, Wed, Thu, Fri,  Sat, Sun);
     
       { set type }
       CharSetType                = set of Char;
     
       { object type }
       ObjectType                 = object
                                      constructor Init;
                                      procedure Method;
                                      destructor Done
                                    end;
     
       { pointer type to another type identifier }
       PArrayType                 = ^ArrayType;
     
       { an alias name for another type identifier }
       IntegerType                = Integer;
     
       { an integer which is initialized by 123 }
       InitializedInt             = Integer value 123;
     
       { a schema with discriminants x and y of type Integer }
       SchemaType (x, y: Integer) = array [x .. y] of Integer;
     
     begin
     end.

See also
--------

   *Note Type Declaration::, *Note Type Definition::, *Note Data
Types::, *Note Variable Declaration::, *Note array::, *Note record::,
*Note object::, *Note set::, *Note Pointer::, *Note value::.


File: gpc.info,  Node: type of,  Next: TypeOf,  Prev: type,  Up: Reference

type of
=======

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: TypeOf,  Next: Unbind,  Prev: type of,  Up: Reference

TypeOf
======

Synopsis
--------

     function TypeOf (var x): PObjectType;

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.

   `TypeOf' can be applied to expressions of object type and to object
type names. In the former case, the actual type of polymorphic objects
is returned.

Conforming to
-------------

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

Example
-------

     program TypeOfDemo;
     type
       FooPtr = ^Foo;
       BarPtr = ^Bar;
     
       Foo = object         { Has a VMT, though it doesn't }
         x: Integer;        { contain virtual methods.     }
         constructor Init;
       end;
     
       Bar = object (Foo)
         y: Integer;
       end;
     
     constructor Foo.Init;
     begin
     end;
     
     var
       MyFoo: FooPtr;
     
     begin
       MyFoo := New (BarPtr, Init);
       if TypeOf (MyFoo^) = TypeOf (Bar) then  { True }
         WriteLn ('OK')
     end.

See also
--------

   *Note BitSizeOf::, *Note AlignOf::, *Note PObjectType::, *Note
SetType::, *Note SizeOf::, *Note OOP::.


File: gpc.info,  Node: Unbind,  Next: unit,  Prev: TypeOf,  Up: Reference

Unbind
======

   (Under construction.)

Synopsis
--------

     procedure Unbind (var F: ANY FILE);

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: unit,  Next: Unpack,  Prev: Unbind,  Up: Reference

unit
====

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: Unpack,  Next: until,  Prev: unit,  Up: Reference

Unpack
======

   (Under construction.)

Synopsis
--------

     procedure Unpack (Source: PACKED ARRAY;
                       var Dest: UNPACKED ARRAY;
                       FirstElement: INDEX TYPE);

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: until,  Next: UpCase,  Prev: Unpack,  Up: Reference

until
=====

   (Under construction.)

Synopsis
--------

Description
-----------

   `until' is part of the `repeat ... until' loop statement.

Conforming to
-------------

Example
-------

See also
--------

   *Note repeat::, *Note while::, *Note for::.


File: gpc.info,  Node: UpCase,  Next: Update,  Prev: until,  Up: Reference

UpCase
======

   (Under construction.)

Synopsis
--------

     function UpCase (Ch: Char): Char;

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: Update,  Next: uses,  Prev: UpCase,  Up: Reference

Update
======

   (Under construction.)

Synopsis
--------

     procedure Update (var F: ANY FILE);

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: uses,  Next: Val,  Prev: Update,  Up: Reference

uses
====

Synopsis
--------

   In a program:

     program @@fragment foo;
     
     uses
       bar1,
       bar2 in 'baz.pas',
       bar3;
     
     [...]

   In a unit:

     unit @@fragment Bar3;
     
     interface
     
     uses
       bar1,
       bar2 in 'baz.pas';
     
     [...]
     
     implementation
     
     uses
       bar3,
       bar4 in 'qux.pas';
     
     [...]

Description
-----------

   The reserved word `uses' in the _import part_ of a program or unit
makes the program or unit import an interface.

   The keyword `in' 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 can be one import part in the interface part and
one in the implementation part.

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

Conforming to
-------------

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

Example
-------

See also
--------

   *Note unit::, *Note module::, *Note import::.


File: gpc.info,  Node: Val,  Next: value,  Prev: uses,  Up: Reference

Val
===

   (Under construction.)

Synopsis
--------

     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
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: value,  Next: var,  Prev: Val,  Up: Reference

value
=====

Synopsis
--------

Description
-----------

   The reserved word `value' is part of a type or var declaration.  It
can be replaced by `:=' or `='.

Conforming to
-------------

   `value' is an ISO-10206 Extended Pascal extension. `:=' in this
context is a VAX Pascal extension, and `=' is a Borland Delphi
extension.

Example
-------

See also
--------

   *Note var::, *Note type::, *Note Variable Declaration::, *Note Type
Declaration::.


File: gpc.info,  Node: var,  Next: view,  Prev: value,  Up: Reference

var
===

Synopsis
--------

   As part of a variable declaration part or in a statement block:
     var VARIABLE IDENTIFIER: TYPE IDENTIFIER;
   or
     var VARIABLE IDENTIFIER: TYPE DEFINITION;
   and with initializing value:
     var VARIABLE IDENTIFIER: TYPE IDENTIFIER value CONSTANT EXPRESSION;
   or
     var VARIABLE IDENTIFIER: TYPE DEFINITION value CONSTANT EXPRESSION;

As part of a parameter list (passing by reference):
     var VAR PARAMETER: TYPE IDENTIFIER;
   or without type declaration
     var VAR PARAMETER;

or protected (i.e., the called routine can't modify the parameter):
     protected var VAR PARAMETER: TYPE IDENTIFIER;
   or without type declaration
     protected var VAR PARAMETER;

Description
-----------

   In a declaration part: The reserved word `var' declares a VARIABLE
IDENTIFIER whose type is of TYPE IDENTIFIER or which is defined by TYPE
DEFINITION.  For further description see *Note Variable Declaration::,
*Note Type Declaration::, *Note Type Definition::, *Note Data Types::.

   In a parameter list: see *Note Subroutine Parameter List
Declaration::.

Conforming to
-------------

   `var' is defined in ISO-7185 Pascal and supported by all known
Pascal variants. Untyped `var' parameters in parameter lists are a UCSD
Pascal extension. The ability to do `var' declarations in a statement
block is a GNU Pascal extension.

Example
-------

     program VarDemo;
     
     type
       FooType = Integer;
     
     var
       Bar: FooType;
       ArrayFoo: array [0 .. 9] of Integer;   { array var definition }
       FecordFoo: record                      { record var definition }
                    Bar: Integer
                  end;
       CharsetFoo: set of Char;               { set var }
       SubrangeFoo: -123 .. 456;              { subrange var }
       EnumeratedFoo: (Mon, Tue, Wed, Thu, Fri, Sat, Sun);  {enumerated var }
       PointerBar: ^FooType;                  { pointer var }
     
     procedure ReadFoo (var Foo: FooType);
     begin
       ReadLn (Foo)
     end;
     
     begin
       var Bar: Integer;  { GNU Pascal extension }
       Bar := 42
     end.

See also
--------

   *Note type::, *Note array::, *Note record::, *Note set::, *Note
Subrange Types::, *Note Pointer::, *Note protected::.


File: gpc.info,  Node: view,  Next: virtual,  Prev: var,  Up: Reference

view
====

   Not yet implemented.

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: virtual,  Next: Void,  Prev: view,  Up: Reference

virtual
=======

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: Void,  Next: volatile,  Prev: virtual,  Up: Reference

Void
====

   (Under construction.)

Synopsis
--------

     type
       Void  { built-in type }

Description
-----------

Conforming to
-------------

Example
-------

     program VoidDemo;
     
     procedure p (var x: Void);
     begin
     end;
     
     var
       i: Integer;
       s: String (42);
     
     begin
       p (i);
       p (s)
     end.

See also
--------


File: gpc.info,  Node: volatile,  Next: while,  Prev: Void,  Up: Reference

volatile
========

   (Under construction.)

Synopsis
--------

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: while,  Next: with,  Prev: volatile,  Up: Reference

while
=====

Synopsis
--------

     while BOOLEAN EXPRESSION do
       STATEMENT

Description
-----------

   The `while' statement declares a loop. For further description see
*Note while Statement::.

Conforming to
-------------

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

Example
-------

     program WhileDemo;
     var
       Foo, Bar: Integer;
     begin
       WriteLn ('Enter an descending series of integer numbers.');
       WriteLn ('Terminate by breaking this rule.');
       WriteLn ('Enter start number: ');
       Bar := MaxInt;
       ReadLn (Foo);
       while Foo < Bar do
         begin
           Bar := Foo;
           ReadLn (Foo)
         end;
       WriteLn ('The last number of your series was: ', Bar)
     end.

See also
--------

   *Note repeat Statement::, *Note for Statement::


File: gpc.info,  Node: with,  Next: Word,  Prev: while,  Up: Reference

with
====

   (Under construction.)

Synopsis
--------

Description
-----------

   _Note_: `with' statement overwrites program namespace.

Conforming to
-------------

Example
-------

   ...

   { Note bar is overwritten by foo.bar }  ...

See also
--------


File: gpc.info,  Node: Word,  Next: WordBool,  Prev: with,  Up: Reference

Word
====

Synopsis
--------

     type
       Word = Cardinal;
   or
     type
       Word (n) = Cardinal (n);

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 *Note 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 *Note Integer
Types::.

Conforming to
-------------

   ISO Pascal does not define `Cardinal'.  (However see *Note Subrange
Types::.)

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

Example
-------

     program WordDemo;
     var
       a: Word;
     begin
       a := 42;
       WriteLn (a)
     end.

See also
--------

   *Note Integer Types::, *Note Subrange Types::.


File: gpc.info,  Node: WordBool,  Next: Write,  Prev: Word,  Up: Reference

WordBool
========

   (Under construction.)

Synopsis
--------

     type
       WordBool = Boolean (BitSizeOf (Word));

Description
-----------

Conforming to
-------------

Example
-------

     program WordBoolDemo;
     var
       a: WordBool;
     begin
       Word (a) := 1;
       if a then WriteLn ('Ord (True) = 1')
     end.

See also
--------


File: gpc.info,  Node: Write,  Next: WriteLn,  Prev: WordBool,  Up: Reference

Write
=====

   (Under construction.)

Synopsis
--------

     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
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: WriteLn,  Next: WriteStr,  Prev: Write,  Up: Reference

WriteLn
=======

   (Under construction.)

Synopsis
--------

     procedure WriteLn (var F: Text; VALUES AND FORMAT SPECIFICATIONS);
   or
     procedure WriteLn (VALUES AND FORMAT SPECIFICATIONS);

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: WriteStr,  Next: xor,  Prev: WriteLn,  Up: Reference

WriteStr
========

   (Under construction.)

Synopsis
--------

     procedure WriteStr (var Dest: String; VALUES AND FORMAT SPECIFICATIONS);

Description
-----------

Conforming to
-------------

Example
-------

See also
--------


File: gpc.info,  Node: xor,  Prev: WriteStr,  Up: Reference

xor
===

Synopsis
--------

     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'.


Conforming to
-------------

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

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

Example
-------

     program XorDemo;
     var
       a, b, c: Integer;
     begin
       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 }
         c := 2  { happens if a = b }
       else
         xor (c, a)  { same as `c := c xor a' }
     end.

See also
--------

   *Note and::, *Note or::, *Note Operators::.

