Textbook Free Pascal Reference Guide Version 3 0 2 Michael Van Canneyt Ebook All Chapter PDF

You might also like

You are on page 1of 53

Free Pascal Reference guide version 3

0 2 Michaël Van Canneyt


Visit to download the full and correct content document:
https://textbookfull.com/product/free-pascal-reference-guide-version-3-0-2-michael-va
n-canneyt/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

MongoDB in Action Covers MongoDB version 3 0 2nd


Edition Kyle Banker

https://textbookfull.com/product/mongodb-in-action-covers-
mongodb-version-3-0-2nd-edition-kyle-banker/

Anti Manual On Street Photography Version 2 0 2nd


Edition Michail Moscholios

https://textbookfull.com/product/anti-manual-on-street-
photography-version-2-0-2nd-edition-michail-moscholios/

The Hitchhiker s Guide to Online Anonymity Version 0 9


4 May 2021 Anonymousplanet

https://textbookfull.com/product/the-hitchhiker-s-guide-to-
online-anonymity-version-0-9-4-may-2021-anonymousplanet/

Interface Zero 3 0 Players Guide to 2095 Aaron Davidson

https://textbookfull.com/product/interface-zero-3-0-players-
guide-to-2095-aaron-davidson/
Information Systems A Manager s Guide to Harnessing
Technology Version 8 0 8th Edition John Gallaugher

https://textbookfull.com/product/information-systems-a-manager-s-
guide-to-harnessing-technology-version-8-0-8th-edition-john-
gallaugher/

Android s Architecture Components Version 0 10 Mark L.


Murphy

https://textbookfull.com/product/android-s-architecture-
components-version-0-10-mark-l-murphy/

Algorithms 2 A Quickstudy Laminated Reference Guide 1st


Edition Babak Ahmadi

https://textbookfull.com/product/algorithms-2-a-quickstudy-
laminated-reference-guide-1st-edition-babak-ahmadi/

C 7 0 Pocket Reference Instant Help for C 7 0


Programmers 1st Edition Joseph Albahari

https://textbookfull.com/product/c-7-0-pocket-reference-instant-
help-for-c-7-0-programmers-1st-edition-joseph-albahari/

Agile Extension to the BABOK® Guide (Agile Extension)


version 2 1st Edition Iiba

https://textbookfull.com/product/agile-extension-to-the-babok-
guide-agile-extension-version-2-1st-edition-iiba/
Free Pascal
Reference guide
Reference guide for Free Pascal, version 3.0.2
Document version 3.0.2
February 2017

Michaël Van Canneyt


Contents

1 Pascal Tokens 11
1.1 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.2 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3 Reserved words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.3.1 Turbo Pascal reserved words . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.3.2 Object Pascal reserved words . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.3.3 Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.5 Hint directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.6 Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.7 Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.8 Character strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

2 Constants 20
2.1 Ordinary constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2 Typed constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.3 Resource strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3 Types 24
3.1 Base types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.1.1 Ordinal types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Boolean types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Enumeration types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Subrange types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.1.2 Real types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.2 Character types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.2.1 Char or AnsiChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.2.2 WideChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.2.3 Other character types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.2.4 Single-byte String types . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

1
CONTENTS

Short strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Ansistrings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Code page conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
RawByteString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
UTF8String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.2.5 Multi-byte String types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
UnicodeStrings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
WideStrings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.2.6 Constant strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.2.7 PChar - Null terminated strings . . . . . . . . . . . . . . . . . . . . . . . . 37
3.2.8 String sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.3 Structured Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Packed structured types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.3.1 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Static arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Dynamic arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Dynamic array Type compatibility . . . . . . . . . . . . . . . . . . . . . . . 44
Dynamic array constructor . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Packing and unpacking an array . . . . . . . . . . . . . . . . . . . . . . . . 46
3.3.2 Record types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Record layout and size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Remarks and examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3.3 Set types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3.4 File types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.4 Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.5 Forward type declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.6 Procedural types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.7 Variant types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.7.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.7.2 Variants in assignments and expressions . . . . . . . . . . . . . . . . . . . . 58
3.7.3 Variants and interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.8 Type aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.9 Managed types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

4 Variables 62
4.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.2 Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.3 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.4 Initialized variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.5 Initializing variables using default . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

2
CONTENTS

4.6 Thread Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66


4.7 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

5 Objects 70
5.1 Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.2 Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.3 Class or Static fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
5.4 Constructors and destructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
5.5 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.5.1 Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.5.2 Method invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Normal static methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Virtual methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Abstract methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Class or static methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.6 Visibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

6 Classes 81
6.1 Class definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
6.2 Normal and static fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.2.1 Normal fields/variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.2.2 Class fields/variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.3 Class instantiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
6.4 Class destruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
6.5 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
6.5.1 Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
6.5.2 Invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
6.5.3 Virtual methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
6.5.4 Class methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
6.5.5 Class constructors and destructors . . . . . . . . . . . . . . . . . . . . . . . 90
6.5.6 Static class methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
6.5.7 Message methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
6.5.8 Using inherited . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
6.6 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
6.6.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
6.6.2 Indexed properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
6.6.3 Array properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
6.6.4 Default properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
6.6.5 Published properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
6.6.6 Storage information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
6.6.7 Overriding properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

3
CONTENTS

6.7 Class properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103


6.8 Nested types, constants and variables . . . . . . . . . . . . . . . . . . . . . . . . . . 103

7 Interfaces 105
7.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
7.2 Interface identification: A GUID . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
7.3 Interface implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
7.4 Interface delegation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
7.5 Interfaces and COM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
7.6 CORBA and other Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
7.7 Reference counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

8 Generics 112
8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
8.2 Generic type definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
8.3 Generic type specialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
8.4 Generic type restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
8.5 Delphi compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
8.5.1 Syntax elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
8.5.2 Record type restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
8.5.3 Type overloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
8.5.4 Name space considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
8.5.5 Scope considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
8.6 Type compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
8.7 Using the default intrinsic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
8.8 A word about scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
8.9 Operator overloading and generics . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

9 Extended records 128


9.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
9.2 Extended record enumerators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

10 Class, Record and Type helpers 133


10.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
10.2 Restrictions on class helpers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
10.3 Restrictions on record helpers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
10.4 Considerations for (simple) type helpers . . . . . . . . . . . . . . . . . . . . . . . . 136
10.5 A note on scope and lifetime for record and type helpers . . . . . . . . . . . . . . . 137
10.6 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
10.7 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

11 Objective-Pascal Classes 143

4
CONTENTS

11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143


11.2 Objective-Pascal class declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
11.3 Formal declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
11.4 Allocating and de-allocating Instances . . . . . . . . . . . . . . . . . . . . . . . . . 147
11.5 Protocol definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
11.6 Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
11.7 Name scope and Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
11.8 Selectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
11.9 The id type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
11.10Enumeration in Objective-C classes . . . . . . . . . . . . . . . . . . . . . . . . . . 151

12 Expressions 153
12.1 Expression syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
12.2 Function calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
12.3 Set constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
12.4 Value typecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
12.5 Variable typecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
12.6 Unaligned typecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
12.7 The @ operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
12.8 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
12.8.1 Arithmetic operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
12.8.2 Logical operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
12.8.3 Boolean operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
12.8.4 String operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
12.8.5 Set operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
12.8.6 Relational operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
12.8.7 Class operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

13 Statements 168
13.1 Simple statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
13.1.1 Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
13.1.2 Procedure statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
13.1.3 Goto statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
13.2 Structured statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
13.2.1 Compound statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
13.2.2 The Case statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
13.2.3 The If..then..else statement . . . . . . . . . . . . . . . . . . . . . . 173
13.2.4 The For..to/downto..do statement . . . . . . . . . . . . . . . . . . . 175
13.2.5 The For..in..do statement . . . . . . . . . . . . . . . . . . . . . . . . . 176
13.2.6 The Repeat..until statement . . . . . . . . . . . . . . . . . . . . . . . 183
13.2.7 The While..do statement . . . . . . . . . . . . . . . . . . . . . . . . . . 183

5
CONTENTS

13.2.8 The With statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184


13.2.9 Exception Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
13.3 Assembler statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186

14 Using functions and procedures 187


14.1 Procedure declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
14.2 Function declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
14.3 Function results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
14.4 Parameter lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
14.4.1 Value parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
14.4.2 Variable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
14.4.3 Out parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
14.4.4 Constant parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
14.4.5 Open array parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
14.4.6 Array of const . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
14.5 Managed types and reference counts . . . . . . . . . . . . . . . . . . . . . . . . . . 196
14.6 Function overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
14.7 Forward declared functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
14.8 External functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
14.9 Assembler functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
14.10Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
14.10.1 alias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
14.10.2 cdecl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
14.10.3 export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
14.10.4 inline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
14.10.5 interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
14.10.6 iocheck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
14.10.7 local . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
14.10.8 noreturn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
14.10.9 nostackframe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
14.10.10overload . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
14.10.11pascal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
14.10.12public . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
14.10.13register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
14.10.14safecall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
14.10.15saveregisters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
14.10.16softfloat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
14.10.17stdcall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
14.10.18varargs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
14.11Unsupported Turbo Pascal modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . 210

6
CONTENTS

15 Operator overloading 211


15.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
15.2 Operator declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
15.3 Assignment operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
15.4 Arithmetic operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
15.5 Comparison operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
15.6 In operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

16 Programs, units, blocks 221


16.1 Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
16.2 Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
16.3 Namespaces: Dotted Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
16.4 Unit dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
16.5 Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
16.6 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
16.6.1 Block scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
16.6.2 Record scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
16.6.3 Class scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
16.6.4 Unit scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
16.7 Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

17 Exceptions 232
17.1 The raise statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
17.2 The try...except statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
17.3 The try...finally statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
17.4 Exception handling nesting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
17.5 Exception classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236

18 Using assembler 238


18.1 Assembler statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
18.2 Assembler procedures and functions . . . . . . . . . . . . . . . . . . . . . . . . . . 238

7
List of Tables

3.1 Predefined integer types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25


3.2 Predefined integer types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3 Boolean types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.4 Supported Real types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.5 PChar pointer arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.6 String memory sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

12.1 Precedence of operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153


12.2 Binary arithmetic operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
12.3 Unary arithmetic operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
12.4 Logical operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
12.5 Boolean operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
12.6 Set operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
12.7 Relational operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
12.8 Class operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

13.1 Allowed C constructs in Free Pascal . . . . . . . . . . . . . . . . . . . . . . . . . . 169

14.1 Unsupported modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

8
LIST OF TABLES

About this guide


This document serves as the reference for the Pascal language as implemented by the Free Pascal
compiler. It describes all Pascal constructs supported by Free Pascal, and lists all supported data
types. It does not, however, give a detailed explanation of the Pascal language: it is not a tuto-
rial. The aim is to list which Pascal constructs are supported, and to show where the Free Pascal
implementation differs from the Turbo Pascal or Delphi implementations.
The Turbo Pascal and Delphi Pascal compilers introduced various features in the Pascal language.
The Free Pascal compiler emulates these compilers in the appropriate mode of the compiler: certain
features are available only if the compiler is switched to the appropriate mode. When required for
a certain feature, the use of the -M command-line switch or {$MODE } directive will be indicated
in the text. More information about the various modes can be found in the user’s manual and the
programmer’s manual.
Earlier versions of this document also contained the reference documentation of the system unit and
objpas unit. This has been moved to the RTL reference guide.

Notations
Throughout this document, we will refer to functions, types and variables with typewriter font.
Files are referred to with a sans font: filename.

Syntax diagrams
All elements of the Pascal language are explained in syntax diagrams. Syntax diagrams are like flow
charts. Reading a syntax diagram means getting from the left side to the right side, following the
arrows. When the right side of a syntax diagram is reached, and it ends with a single arrow, this
means the syntax diagram is continued on the next line. If the line ends on 2 arrows pointing to each
other, then the diagram is ended.
Syntactical elements are written like this
-
- syntactical elements are like this -

Keywords which must be typed exactly as in the diagram:


-
- keywords are like this -

When something can be repeated, there is an arrow around it:


-
- this can be repeated -
6

When there are different possibilities, they are listed in rows:


-
- First possibility -
Second possibility

Note, that one of the possibilities can be empty:


-
- -
First possibility
Second possibility

This means that both the first or second possibility are optional. Of course, all these elements can be
combined and nested.

9
LIST OF TABLES

About the Pascal language


The language Pascal was originally designed by Niklaus Wirth around 1970. It has evolved sig-
nificantly since that day, with a lot of contributions by the various compiler constructors (Notably:
Borland). The basic elements have been kept throughout the years:

• Easy syntax, rather verbose, yet easy to read. Ideal for teaching.
• Strongly typed.
• Procedural.
• Case insensitive.

• Allows nested procedures.


• Easy input/output routines built-in.

The Turbo Pascal and Delphi Pascal compilers introduced various features in the Pascal language,
most notably easier string handling and object orientedness. The Free Pascal compiler initially emu-
lated most of Turbo Pascal and later on Delphi. It emulates these compilers in the appropriate mode
of the compiler: certain features are available only if the compiler is switched to the appropriate
mode. When required for a certain feature, the use of the -M command-line switch or {$MODE }
directive will be indicated in the text. More information about the various modes can be found in the
user’s manual and the programmer’s manual.

10
Chapter 1

Pascal Tokens

Tokens are the basic lexical building blocks of source code: they are the ’words’ of the language:
characters are combined into tokens according to the rules of the programming language. There are
five classes of tokens:

reserved words These are words which have a fixed meaning in the language. They cannot be
changed or redefined.
identifiers These are names of symbols that the programmer defines. They can be changed and
re-used. They are subject to the scope rules of the language.
operators These are usually symbols for mathematical or other operations: +, -, * and so on.
separators This is usually white-space.
constants Numerical or character constants are used to denote actual values in the source code, such
as 1 (integer constant) or 2.3 (float constant) or ’String constant’ (a string: a piece of text).

In this chapter we describe all the Pascal reserved words, as well as the various ways to denote
strings, numbers, identifiers etc.

1.1 Symbols
Free Pascal allows all characters, digits and some special character symbols in a Pascal source file.

Recognised symbols

-
- letter A...Z -
a...z

-
- digit 0...9 -

-
- hex digit 0...9 -
A...F
a...f

The following characters have a special meaning:

11
CHAPTER 1. PASCAL TOKENS

+ - * / = < > [ ] . , ( ) : ^ @ { } $ # & %

and the following character pairs too:

<< >> ** <> >< <= >= := += -= *= /= (* *) (. .) //

When used in a range specifier, the character pair (. is equivalent to the left square bracket [.
Likewise, the character pair .) is equivalent to the right square bracket ]. When used for comment
delimiters, the character pair (* is equivalent to the left brace { and the character pair *) is equiva-
lent to the right brace }. These character pairs retain their normal meaning in string expressions.

1.2 Comments
Comments are pieces of the source code which are completely discarded by the compiler. They exist
only for the benefit of the programmer, so he can explain certain pieces of code. For the compiler, it
is as if the comments were not present.
The following piece of code demonstrates a comment:

(* My beautiful function returns an interesting result *)


Function Beautiful : Integer;

The use of (* and *) as comment delimiters dates from the very first days of the Pascal language. It
has been replaced mostly by the use of { and } as comment delimiters, as in the following example:

{ My beautiful function returns an interesting result }


Function Beautiful : Integer;

The comment can also span multiple lines:

{
My beautiful function returns an interesting result,
but only if the argument A is less than B.
}
Function Beautiful (A,B : Integer): Integer;

Single line comments can also be made with the // delimiter:

// My beautiful function returns an interesting result


Function Beautiful : Integer;

The comment extends from the // character till the end of the line. This kind of comment was
introduced by Borland in the Delphi Pascal compiler.
Free Pascal supports the use of nested comments. The following constructs are valid comments:

(* This is an old style comment *)


{ This is a Turbo Pascal comment }
// This is a Delphi comment. All is ignored till the end of the line.

12
CHAPTER 1. PASCAL TOKENS

The following are valid ways of nesting comments:

{ Comment 1 (* comment 2 *) }
(* Comment 1 { comment 2 } *)
{ comment 1 // Comment 2 }
(* comment 1 // Comment 2 *)
// comment 1 (* comment 2 *)
// comment 1 { comment 2 }

The last two comments must be on one line. The following two will give errors:

// Valid comment { No longer valid comment !!


}

and

// Valid comment (* No longer valid comment !!


*)

The compiler will react with a ’invalid character’ error when it encounters such constructs, regardless
of the -Mtp switch.
Remark: In TP and Delphi mode, nested comments are not allowed, for maximum compatibility with
existing code for those compilers.

1.3 Reserved words


Reserved words are part of the Pascal language, and as such, cannot be redefined by the programmer.
Throughout the syntax diagrams they will be denoted using a bold typeface. Pascal is not case
sensitive so the compiler will accept any combination of upper or lower case letters for reserved
words.
We make a distinction between Turbo Pascal and Delphi reserved words. In TP mode, only the Turbo
Pascal reserved words are recognised, but the Delphi ones can be redefined. By default, Free Pascal
recognises the Delphi reserved words.

1.3.1 Turbo Pascal reserved words


The following keywords exist in Turbo Pascal mode

absolute file object string


and for of then
array function operator to
asm goto or type
begin if packed unit
case implementation procedure until
const in program uses
constructor inherited record var
destructor inline reintroduce while
div interface repeat with
do label self xor
downto mod set
else nil shl
end not shr

13
CHAPTER 1. PASCAL TOKENS

1.3.2 Object Pascal reserved words


The reserved words of Object Pascal (used in Delphi or Objfpc mode) are the same as the Turbo
Pascal ones, with the following additional keywords:

as finalization library raise


class finally on resourcestring
dispinterface initialization out threadvar
except inline packed try
exports is property

1.3.3 Modifiers
The following is a list of all modifiers. They are not exactly reserved words in the sense that they can
be used as identifiers, but in specific places, they have a special meaning for the compiler, i.e., the
compiler considers them as part of the Pascal language.

absolute export nodefault reintroduce


abstract external noreturn result
alias far nostackframe safecall
assembler far16 oldfpccall saveregisters
bitpacked forward otherwise softfloat
break generic overload specialize
cdecl helper override static
continue implements pascal stdcall
cppdecl index platform stored
cvar interrupt private strict
default iocheck protected unaligned
deprecated local public unimplemented
dynamic message published varargs
enumerator name read virtual
experimental near register write

Remark: Predefined types such as Byte, Boolean and constants such as maxint are not reserved words.
They are identifiers, declared in the system unit. This means that these types can be redefined in
other units. The programmer is however not encouraged to do this, as it will cause a lot of confusion.
Remark: As of version 2.5.1 it is possible to use reserved words as identifiers by escaping them with a & sign.
This means that the following is possible

var
&var : integer;

begin
&var:=1;
Writeln(&var);
end.

however, it is not recommended to use this feature in new code, as it makes code less readable. It
is mainly intended to fix old code when the list of reserved words changes and encompasses a word
that was not yet reserved (See also section 1.4, page 15).

14
CHAPTER 1. PASCAL TOKENS

1.4 Identifiers
Identifiers denote programmer defined names for specific constants, types, variables, procedures
and functions, units, and programs. All programmer defined names in the source code –excluding
reserved words– are designated as identifiers.
Identifiers consist of between 1 and 127 significant characters (letters, digits and the underscore
character), of which the first must be a letter (a-z or A-Z), or an underscore (_). The following
diagram gives the basic syntax for identifiers.

Identifiers

-
- identifier letter -
_ 6 letter
digit
_

Like Pascal reserved words, identifiers are case insensitive, that is, both

myprocedure;

and

MyProcedure;

refer to the same procedure.


Remark: As of version 2.5.1 it is possible to specify a reserved word as an identifier by prepending it with an
ampersand (&). This means that the following is possible:

program testdo;

procedure &do;

begin
end;

begin
&do;
end.

The reserved word do is used as an identifier for the declaration as well as the invocation of the
procedure ’do’.

1.5 Hint directives


Most identifiers (constants, variables, functions or methods, properties) can have a hint directive
appended to their definition:

Hint directives

15
CHAPTER 1. PASCAL TOKENS

-
- hint directive -
Deprecated
string constant
Experimental
Platform
Unimplemented

Whenever an identifier marked with a hint directive is later encountered by the compiler, then a
warning will be displayed, corresponding to the specified hint.

deprecated The use of this identifier is deprecated, use an alternative instead. The deprecated key-
word can be followed by a string constant with a message. The compiler will show this mes-
sage whenever the identifier is encountered.
experimental The use of this identifier is experimental: this can be used to flag new features that
should be used with caution.
platform This is a platform-dependent identifier: it may not be defined on all platforms.
unimplemented This should be used on functions and procedures only. It should be used to signal
that a particular feature has not yet been implemented.

The following are examples:

Const
AConst = 12 deprecated;

var
p : integer platform;

Function Something : Integer; experimental;

begin
Something:=P+AConst;
end;

begin
Something;
end.

This would result in the following output:

testhd.pp(11,15) Warning: Symbol "p" is not portable


testhd.pp(11,22) Warning: Symbol "AConst" is deprecated
testhd.pp(15,3) Warning: Symbol "Something" is experimental

Hint directives can follow all kinds of identifiers: units, constants, types, variables, functions, proce-
dures and methods.

1.6 Numbers
Numbers are by default denoted in decimal notation. Real (or decimal) numbers are written using
engineering or scientific notation (e.g. 0.314E1).
For integer type constants, Free Pascal supports 4 formats:

16
CHAPTER 1. PASCAL TOKENS

1. Normal, decimal format (base 10). This is the standard format.


2. Hexadecimal format (base 16), in the same way as Turbo Pascal does. To specify a constant
value in hexadecimal format, prepend it with a dollar sign ($). Thus, the hexadecimal $FF
equals 255 decimal. Note that case is insignificant when using hexadecimal constants.

3. As of version 1.0.7, Octal format (base 8) is also supported. To specify a constant in octal
format, prepend it with an ampersand (&). For instance 15 is specified in octal notation as
&17.
4. Binary notation (base 2). A binary number can be specified by preceding it with a percent sign
(%). Thus, 255 can be specified in binary notation as %11111111.

The following diagrams show the syntax for numbers.

Numbers

-
- hex digit sequence hex digit -
6

-
- octal digit sequence octal digit -
6

-
- bin digit sequence 1 -
60

-
- digit sequence digit -
6

-
- unsigned integer digit sequence -
$ hex digit sequence
& octal digit sequence
% bin digit sequence

- sign +
- -
-

-
- unsigned real digit sequence -
. digit sequence scale factor

-
- scale factor E digit sequence -
e sign

-
- unsigned number unsigned real -
unsigned integer

-
- signed number unsigned number -
sign

Remark: Octal and Binary notation are not supported in TP or Delphi compatibility mode.

17
CHAPTER 1. PASCAL TOKENS

1.7 Labels
A label is a name for a location in the source code to which can be jumped to from another location
with a goto statement. A Label is a standard identifier or a digit sequence.

Label

-
- label digit sequence -
identifier

Remark: The -Sg or -Mtp switches must be specified before labels can be used. By default, Free Pascal
doesn’t support label and goto statements. The {$GOTO ON} directive can also be used to allow
use of labels and the goto statement.
The following are examples of valid labels:

Label
123,
abc;

1.8 Character strings


A character string (or string for short) is a sequence of zero or more characters (byte sized), enclosed
in single quotes, and on a single line of the program source code: no literal carriage return or linefeed
characters can appear in the string.
A character set with nothing between the quotes (’’) is an empty string.

Character strings

-
- character string quoted string -
6 control string

-
- quoted string ’ string character ’ -
6

-
- string character Any character except ’ or CR -

-
- control string # unsigned integer -
6

The string consists of standard, 8-bit ASCII characters or Unicode (normally UTF-8 encoded) char-
acters. The control string can be used to specify characters which cannot be typed on a
keyboard, such as #27 for the escape character.
The single quote character can be embedded in the string by typing it twice. The C construct of
escaping characters in the string (using a backslash) is not supported in Pascal.
The following are valid string constants:

18
CHAPTER 1. PASCAL TOKENS

’This is a pascal string’


’’
’a’
’A tabulator character: ’#9’ is easy to embed’

The following is an invalid string:

’the string starts here


and continues here’

The above string must be typed as:

’the string starts here’#13#10’ and continues here’

or

’the string starts here’#10’ and continues here’

on unices (including Mac OS X), and as

’the string starts here’#13’ and continues here’

on a classic Mac-like operating system.


It is possible to use other character sets in strings: in that case the codepage of the source file must
be specified with the {$CODEPAGE XXX} directive or with the -Fc command line option for the
compiler. In that case the characters in a string will be interpreted as characters from the specified
codepage.

19
Chapter 2

Constants

Just as in Turbo Pascal, Free Pascal supports both ordinary and typed constants. They are declared
in a constant declaration block in a unit, program or class, function or procedure declaration (section
16.5, page 227).

2.1 Ordinary constants


Ordinary constants declarations are constructed using an identifier name followed by an "=" token,
and followed by an optional expression consisting of legal combinations of numbers, characters,
boolean values or enumerated values as appropriate. The following syntax diagram shows how to
construct a legal declaration of an ordinary constant.

Constant declaration

-
- constant declaration identifier = expression hintdirectives ; -
6

The compiler must be able to evaluate the expression in a constant declaration at compile time. This
means that most of the functions in the Run-Time library cannot be used in a constant declaration.
Operators such as +, -, *, /, not, and, or, div, mod, ord, chr, sizeof, pi,
int, trunc, round, frac, odd can be used, however. For more information on expres-
sions, see chapter 12, page 153.
When a previously declared ordinary constant is used in the code, the compiler will insert the actual
value of the constant instead of the constant name. That is, the following 2 pieces of code are entirely
equivalent:

Const
One = 1;

begin
Writeln(One);
end.

The above will produce the same code as if one had written:

20
CHAPTER 2. CONSTANTS

begin
Writeln(1);
end.

Only constants of the following types can be declared:

• Ordinal types
• Set types
• Pointer types (but the only allowed value is Nil).

• Real types
• Char,
• String

The following are all valid constant declarations:

Const
e = 2.7182818; { Real type constant. }
a = 2; { Ordinal (Integer) type constant. }
c = ’4’; { Character type constant. }
s = ’This is a constant string’; {String type constant.}
sc = chr(32)
ls = SizeOf(Longint);
P = Nil;
Ss = [1,2];

Assigning a value to an ordinary constant is not permitted. Thus, given the previous declaration, the
following will result in a compiler error:

s := ’some other string’;

For string constants, the type of the string is dependent on some compiler switches. If a specific type
is desired, a typed constant should be used, as explained in the following section.
Prior to version 1.9, Free Pascal did not correctly support 64-bit constants. As of version 1.9, 64-bit
constants can be specified.

2.2 Typed constants


Sometimes it is necessary to specify the type of a constant, for instance for constants of complex
structures (defined later in the manual). Their definition is quite simple.

Typed constant declaration

- typed constant declaration


- identifier : type = typed constant hintdirective ; -
6
- -

21
CHAPTER 2. CONSTANTS

-
- typed constant constant -
address constant
array constant
record constant
procedural constant

Contrary to ordinary constants, a value can be assigned to them at run-time. This is an old concept
from Turbo Pascal, which has been replaced with support for initialized variables: For a detailed
description, see section 4.4, page 64.
Support for assigning values to typed constants is controlled by the {$J} directive: it can be switched
off, but is on by default (for Turbo Pascal compatibility). Initialized variables are always allowed.
Remark: It should be stressed that typed constants are automatically initialized at program start. This is also
true for local typed constants and initialized variables. Local typed constants are also initialized at
program start. If their value was changed during previous invocations of the function, they will retain
their changed value, i.e. they are not initialized each time the function is invoked.

2.3 Resource strings


A special kind of constant declaration block is the Resourcestring block. Resourcestring dec-
larations are much like constant string declarations: resource strings act as constant strings, but they
can be localized by means of a set of special routines in the objpas unit. A resource string declaration
block is only allowed in the Delphi or Objfpc modes.
The following is an example of a resourcestring definition:

Resourcestring

FileMenu = ’&File...’;
EditMenu = ’&Edit...’;

All string constants defined in the resourcestring section are stored in special tables. The strings in
these tables can be manipulated at runtime with some special mechanisms in the objpas unit.
Semantically, the strings act like ordinary constants; It is not allowed to assign values to them (except
through the special mechanisms in the objpas unit). However, they can be used in assignments or
expressions as ordinary string constants. The main use of the resourcestring section is to provide an
easy means of internationalization.
More on the subject of resourcestrings can be found in the Programmer’s Guide, and in the objpas
unit reference.
Remark: Note that a resource string which is given as an expression will not change if the parts of the expres-
sion are changed:

resourcestring
Part1 = ’First part of a long string.’;
Part2 = ’Second part of a long string.’;
Sentence = Part1+’ ’+Part2;

If the localization routines translate Part1 and Part2, the Sentence constant will not be trans-
lated automatically: it has a separate entry in the resource string tables, and must therefor be trans-
lated separately. The above construct simply says that the initial value of Sentence equals Part1+’
’+Part2.

22
CHAPTER 2. CONSTANTS

Remark: Likewise, when using resource strings in a constant array, only the initial values of the resource
strings will be used in the array: when the individual constants are translated, the elements in the
array will retain their original value.

resourcestring
Yes = ’Yes.’;
No = ’No.’;

Var
YesNo : Array[Boolean] of string = (No,Yes);
B : Boolean;

begin
Writeln(YesNo[B]);
end.

This will print ’Yes.’ or ’No.’ depending on the value of B, even if the constants Yes and No have
been localized by some localization mechanism.

23
Chapter 3

Types

All variables have a type. Free Pascal supports the same basic types as Turbo Pascal, with some extra
types from Delphi as well as some of its own.
The programmer can declare his own types, which is in essence defining an identifier that can be
used to denote this custom type when declaring variables further in the source code. Declaring a
type happens in a Type block (section 16.5, page 227), which is a collection of type declarations,
separated by semicolons:

Type declaration

-
- type declaration identifier = type ; -
hint directives

There are 8 major kinds of types :

Types

-
- type simple type -
string type
structured type
pointer type
procedural type
generic type
specialized type
type alias

Each of these cases will be examined separately.

3.1 Base types


The base or simple types of Free Pascal are the Delphi types. We will discuss each type separately.

24
CHAPTER 3. TYPES

Simple types

-
- simple type ordinal type -
real type

-
- real type real type identifier -

3.1.1 Ordinal types


With the exception of floating point value types, all base types are ordinal types. Ordinal types have
the following characteristics:

1. Ordinal types are countable and ordered, i.e. it is, in principle, possible to start counting them
one by one, in a specified order. This property allows the operation of functions as Inc, Ord,
Dec on ordinal types to be defined.
2. Ordinal values have a smallest possible value. Trying to apply the Pred function on the
smallest possible value will generate a range check error if range checking is enabled.
3. Ordinal values have a largest possible value. Trying to apply the Succ function on the largest
possible value will generate a range check error if range checking is enabled.

Remark: Int64 and QWord are considered ordinal types on 64-bit CPUs. On 32-bit types they have some
of the characteristics of ordinals, but they cannot be used e.g. in for loops.

Integers

A list of pre-defined integer types is presented in table (3.1).

Table 3.1: Predefined integer types

Name
Integer
Shortint
SmallInt
Longint
Longword
Int64
Byte
Word
Cardinal
QWord
Boolean
ByteBool
WordBool
LongBool
Char

25
CHAPTER 3. TYPES

The integer types, and their ranges and sizes, that are predefined in Free Pascal are listed in table
(3.2). Please note that the qword and int64 types are not true ordinals, so some Pascal constructs
will not work with these two integer types.

Table 3.2: Predefined integer types

Type Range Size in bytes


Byte 0 .. 255 1
Shortint -128 .. 127 1
Smallint -32768 .. 32767 2
Word 0 .. 65535 2
Integer either smallint or longint size 2 or 4
Cardinal longword 4
Longint -2147483648 .. 2147483647 4
Longword 0 .. 4294967295 4
Int64 -9223372036854775808 .. 9223372036854775807 8
QWord 0 .. 18446744073709551615 8

The integer type maps to the smallint type in the default Free Pascal mode. It maps to either a
longint in either Delphi or ObjFPC mode. The cardinal type is currently always mapped to the
longword type.
Remark: All decimal constants which do no fit within the -2147483648..2147483647 range are silently and
automatically parsed as 64-bit integer constants as of version 1.9.0. Earlier versions would convert it
to a real-typed constant.
As a pascal compiler, Free Pascal does automatic type conversion and upgrading in expressions
where different kinds of integer types are used:

1. Every platform has a "native" integer size, depending on whether the platform is 8-bit, 16-bit,
32-bit or 64-bit. e.g. On AVR this is 8-bit.
2. Every integer smaller than the "native" size is promoted to a signed version of the "native" size.
Integers equal to the "native" size keep their signedness.
3. The result of binary arithmetic operators (+, -, *, etc.) is determined in the following way:
(a) If at least one of the operands is larger than the native integer size, the result is chosen
to be the smallest type that encompasses the ranges of the types of both operands. This
means that mixing an unsigned with a smaller or equal in size signed will produce a
signed type that is larger than both of them.
(b) If both operands have the same signedness, the result is the same type as them. The
only exception is subtracting (-): in the case of unsigned-unsigned subtracting produces
a signed result in FPC (as in Delphi, but not in TP7).
(c) Mixing signed and unsigned operands of the "native" int size produces a larger signed
result. This means that mixing longint and longword on 32-bit platforms will produce
an int64. Similarly, mixing byte and shortint on 8-bit platforms (AVR) will produce a
smallint.

Boolean types

Free Pascal supports the Boolean type, with its two pre-defined possible values True and False.
These are the only two values that can be assigned to a Boolean type. Of course, any expression
that resolves to a boolean value, can also be assigned to a boolean type.

26
CHAPTER 3. TYPES

Table 3.3: Boolean types

Name Size Ord(True)


Boolean 1 1
ByteBool 1 Any nonzero value
WordBool 2 Any nonzero value
LongBool 4 Any nonzero value

Free Pascal also supports the ByteBool, WordBool and LongBool types. These are of type
Byte, Word or Longint, but are assignment compatible with a Boolean: the value False is
equivalent to 0 (zero) and any nonzero value is considered True when converting to a boolean value.
A boolean value of True is converted to -1 in case it is assigned to a variable of type LongBool.
Assuming B to be of type Boolean, the following are valid assignments:

B := True;
B := False;
B := 1<>2; { Results in B := True }

Boolean expressions are also used in conditions.


Remark: In Free Pascal, boolean expressions are by default always evaluated in such a way that when the
result is known, the rest of the expression will no longer be evaluated: this is called short-cut boolean
evaluation.
In the following example, the function Func will never be called, which may have strange side-
effects.

...
B := False;
A := B and Func;

Here Func is a function which returns a Boolean type.


This behaviour is controllable by the {$B } compiler directive.

Enumeration types

Enumeration types are supported in Free Pascal. On top of the Turbo Pascal implementation, Free
Pascal allows also a C-style extension of the enumeration type, where a value is assigned to a partic-
ular element of the enumeration list.

Enumerated types

-
- enumerated type ( identifier list ) -
6 assigned enum list
,

-
- identifier list identifier -
6 ,

-
- assigned enum list identifier := expression -
6 ,

27
CHAPTER 3. TYPES

(see chapter 12, page 153 for how to use expressions) When using assigned enumerated types, the
assigned elements must be in ascending numerical order in the list, or the compiler will complain.
The expressions used in assigned enumerated elements must be known at compile time. So the
following is a correct enumerated type declaration:

Type
Direction = ( North, East, South, West );

A C-style enumeration type looks as follows:

Type
EnumType = (one, two, three, forty := 40,fortyone);

As a result, the ordinal number of forty is 40, and not 3, as it would be when the ’:= 40’ wasn’t
present. The ordinal value of fortyone is then 41, and not 4, as it would be when the assignment
wasn’t present. After an assignment in an enumerated definition the compiler adds 1 to the assigned
value to assign to the next enumerated value.
When specifying such an enumeration type, it is important to keep in mind that the enumerated
elements should be kept in ascending order. The following will produce a compiler error:

Type
EnumType = (one, two, three, forty := 40, thirty := 30);

It is necessary to keep forty and thirty in the correct order. When using enumeration types it is
important to keep the following points in mind:

1. The Pred and Succ functions cannot be used on this kind of enumeration types. Trying to
do this anyhow will result in a compiler error.
2. Enumeration types are stored using a default, independent of the actual number of values:
the compiler does not try to optimize for space. This behaviour can be changed with the
{$PACKENUM n} compiler directive, which tells the compiler the minimal number of bytes
to be used for enumeration types. For instance

Type
{$PACKENUM 4}
LargeEnum = ( BigOne, BigTwo, BigThree );
{$PACKENUM 1}
SmallEnum = ( one, two, three );
Var S : SmallEnum;
L : LargeEnum;
begin
WriteLn (’Small enum : ’,SizeOf(S));
WriteLn (’Large enum : ’,SizeOf(L));
end.

will, when run, print the following:

Small enum : 1
Large enum : 4

More information can be found in the Programmer’s Guide, in the compiler directives section.

28
Another random document with
no related content on Scribd:
Wolf swivelled his chair around and stared out of the window onto the
hospital lawn. "We thought that the deep therapy method was
something perfect. Something that would make a patient tell the
absolute truth as he saw it. But our patient is making hash out of it."
He lifted his coffee cup and tasted the black liquid tentatively.
"Follow it through. The first story he gave us was conscious. He said
he couldn't remember exactly what happened to him. Okay. This
could be a fabrication. The next story he gave under therapy
conditions. He said that he killed Glover in a fit of rage because of an
argument. Okay again. We could have accepted that at face value,
and he would have gotten away with it, except that we got curious
about a couple of things. We wondered how the paranoid tinge got
into his thoughts, and we wondered exactly what it was that he and
Glover were on the verge of discovering. So we tried again. Now we
find that he deliberately plotted to kill Glover, and the paranoid
symptoms are now so intense that he gives us a completely phony
story about making millions of dollars out of the discovery, when
everybody knows that you can't patent anything for personal profit
when you invent it in a government laboratory."
Alma Heller lifted her hand, making a one with her forefinger. "So, our
friend Jim Britten is doing two things—both of which we did not
believe him capable of doing. First, he is lying and inventing stories
under deep therapy. Second, he is withholding information. For notice
that he is still avoiding specific mention of the result which his
experiment was aiming at."
Her voice became flat, precise, and probing.
"Now, could our young physicist, Jim Britten, do this thing? No. Not
unless he is an unsuspected superman type. Or—unless he has had
special training and conditioning for resistance against deep therapy.
How does a young physics student obtain such training? And
where?"
She looked across the desk at Morris Wolf, who chewed savagely on
his pipe bit.
"If I had any sense," he growled, "I'd call up the AEC and throw Jim
Britten right back in their faces. If they give me a problem to solve
they should at least tell me how hot they think it is. And my viscera
are beginning to tell me that this is going to be a very, very warm
baby. Maybe I should holler for help. I have a wife and two kids at
home. I don't want to get hurt."
"Who you kidding?" Alma wanted to know. "You wouldn't let a juicy
problem like this escape you just when you have it clutched about the
middle. Besides, our two undercover friends from the FBI will be
keeping their eyes on things. Let them earn their pay."
"Okay." Wolf came to a decision. "We'll give it one more try, and then
we'll call for help. First thing tomorrow morning. In the meantime,
there are two things I want. First I want Britten to have a complete
physical examination. The works. Inside and outside. Blood tests,
electro-encephalograph, tissue specimens, complete x-rays—
everything they can think of. Then I'll spend tonight keeping company
with Britten while the technicians pull down some overtime pay
analyzing the examination results."
"You have an idea?"
He nodded. "At least one idea. But it needs feeding."

That evening Morris Wolf walked down the hospital corridor past the
door of Britten's room. He entered the next door and found himself in
a tiny chamber already occupied by Bill Grady. This was no surprise,
for he knew that Grady and Jones kept Britten under constant
surveillance. He motioned for Grady to keep his seat, and made
himself comfortable in another chair, which he placed so that he could
watch Britten through the one-way window set in the wall. Through
this window he could see every move which Britten made, and
through a loudspeaker he could hear every sound.
It was not clear in Wolf's mind precisely what he expected to find by
watching Britten, but he knew that if he was to unravel his puzzle, he
must know everything about the boy, including the way he walked
and talked and combed his hair.
For a time Britten sat and read, then paced the floor restlessly, as if
waiting for something. Finally he picked his guitar up from the bed
and sat down on his chair, tuning the instrument. When he began to
sing, it was quietly, as though to himself. Wolf had heard him sing
before, generally folk songs from the Southern and Midwestern
states.
Now there intruded into Wolf's mind a thought which had previously
been on the edge of consciousness, and simultaneously his hand
reached out to touch the start button on his tape recorder. The
manner in which a person sings should reveal a great deal about his
early life—about the kind of language he grew up with, down to the
very vocal structure which has developed in his body since childhood.
As a result there are many types of voices: French voices, Tennessee
voices, Italian voices, Texas voices, each with its own flavor caused
by the way in which the vocal muscles have been trained by the
native language, and also by the way in which people are
accustomed to singing in those places.
When Wolf went home that night he carried a tape of Britten's song
with him. It was convenient that he did not have to go far for an expert
opinion to corroborate what he had already decided as an amateur.
He entered his house, the pleasant place with the warm colors, the
rows of books, the grand piano, and of course his wife.
"Sorry I had to stay late, dear, but there's something important going
on. Something really important. And you can be a big help to me right
now."
"Me?" asked Lynne. "You're going back to musical therapy?"
"Not exactly," he said, dryly. "More like musical detection. I'm going to
play a tape recording of a song or two, and I want your professional
opinion as to what part of the world the singer came from."
He walked over to the recorder and began threading the tape. "Now
pay no attention to the song itself," he instructed. "I'm interested only
in the voice quality."
The tape spool unrolled slowly, and Britten's voice filled the room.
"Not bad for an amateur," Lynne commented, listening closely. For
several minutes she remained silent, until finally the tape was
completed.
"Well," she said, finally, "I don't think it's an American. A bit too rich. It
doesn't have the French quality, nor the Italian. More chesty, kind of
ripe and fruity. Central European. Hungarian, Russian, or something
of that order."
Wolf kissed her solemnly. "You win first prize, girl. That's the answer I
wanted, and that's the answer that fits."

CHAPTER III
In the morning, the act of going to the hospital produced within him a
sensation as of marching to the front line of battle.
Whitehead, the laboratory chief, was prowling about his office when
he arrived.
"Morning," Wolf greeted him. "Got something for me?"
"I have a strangeness," Whitehead said. "A very great strangeness."
"We all do," Wolf replied. "What's yours?"
"This Britten of yours. How old is he?"
"By appearance, and according to the records, about twenty-one."
"Uh-huh. And by cellular structure and metabolism he is at least
forty!"
"So."
Wolf sank down in his chair and cocked an eye at Alma Heller, who
came into the room at that moment.
"Did you hear that, Alma? In more ways than one our boy isn't what
he seems to be. By last night I was certain that he is not a native of
Louisville, Kentucky. Now we are told that he is twice as old as we
thought he was."
Alma stared for a moment.
"We do seem to get in deeper and deeper. Have any ideas?"
Wolf ran his hand worriedly through his hair. "One. But I'm afraid of it.
At any rate, we're in too far to back out. This morning we're going to
dig for more information, and we're not going to stop until we have
Britten squeezed dry."
He reached onto his desk for his tobacco can and began filling a pipe,
meanwhile organizing his thoughts.
"Somehow or other," he resumed, "Britten has received conditioning
to resist giving information under deep therapy."
"And not only that," Alma interposed, "but he has the ability to retain
consciousness under deep therapy and fabricate a story to replace
the true facts."
"Correct. So, since the ordinary deep therapy method is useless, we
have to get tough. We have to eliminate his present set of
conditioned reactions and replace them by a new set. In other words,
we must reset the controls so that he responds to a new set of
orders."
Alma pursed her lips for a soundless whistle. "Fisher's method! Do
you know how much of that a nervous system can take?"
Wolf shrugged. "Who knows? This is very new stuff. I've played
around with a little of it, but ... who knows? At any rate, we're going to
assume that Britten has a fairly tough mind in order to get as far as
he has. We'll assume this not only for his own sake, but for ours,
because we are going to shake him loose from his present set of
memories, and we want enough of his original memories left for us to
assemble. Now suppose we begin."
Whitehead excused himself. There was work waiting in his laboratory,
he said, and watched wistfully as the two disappeared into the
therapy room.
Alma began switching on the apparatus, while Wolf called for Jim
Britten to be brought in.
"Still going digging in my mind?" Britten wisecracked as he walked in,
flanked by the ubiquitous Grady and Jones.
"With a steam shovel," Wolf replied, and motioned that Britten be
strapped onto the table.
This time Wolf wasted no explanations. Without pausing he slipped
Britten a preliminary shot and began fitting electrodes onto his head
and arms.
"We're going back a long time, now," he said, quietly. "Remember
back to the days before you started college. How old are you?"
Britten began dreaming off. "Sixteen years old. It was a hot summer.
Kentucky in summer. Hot. Hot as a solar cycle ... hot as a bicycle
down the road ... a tricycle down the toad ... doctor you look like a big
pimply warty green-eyed toad...."
Morris Wolf waited until the drug-induced schizophrenic symptoms
were well under way, then motioned for Alma Heller to send a
sequence of high-frequency pulses through Britten's nervous system,
breaking down synapses and destroying memory patterns. This, in
combination with the drug, was intended to clear the mind of
memories involving the period of time to which Britten's attention had
been directed. In this period, Wolf guessed, the conditioning had
taken place. If not, then he must try another period.
Britten's body stiffened under the onslaught and perspiration rolled
out on his brow. His mouth twisted and his eyebrows writhed. Morris
Wolf himself felt perspiration starting out on his face, while in the back
of the room the two "attendants" stared in amazement.
After enough time of this, Wolf switched the controls so that a
rhythmic pattern of pulses went through Britten's system in such a
manner as to aid the triggering of synapses and the formation of
memory patterns. The slate having been wiped clean, new writing
had to be placed on it.
"Now," he said, tensely, leaning over the patient and speaking close
to his ears. "Cooperation means obey. Cooperation means obey.
Cooperation means you do what I say. Cooperation means you do
what I tell you to do, say what I tell you to say, remember what I tell
you to remember. Cooperation is the key word."
The words went from Wolf's mouth to Britten's ears in the form of
sound waves, were converted into neuro-electrical impulses, and
under the influence of the rhythmically repeating pulses, from the
machine, circulated around and around through Britten's system,
tracing a deeply etched path.
Finally Wolf ceased the talking, and Alma handed him the needle with
the antidote to the first drug.
"Now we see how successful we are," he said.
He gave the shot and several minutes went by while they waited for it
to take effect. They remained silent, as though to say a word would
break the spell.
Then: "Cooperation," Wolf said.
Britten lay still.
"Open your eyes."
Britten's eyelids struggled open, but the eyes stared blankly.
Wolf thought: what question is most basic?
Then he asked: "What is your name?"
The mouth writhed, and then whispered, "Pyotr Fermineyev."

There was a small roaring in Morris Wolf's ears, and beside him he
heard the intake of Alma Heller's breath. The FBI agents, Grady and
Jones, had moved up until they were leaning over Wolf's shoulder.
Then: "Where were you born?"
Again the whisper from the blank face: "In Leningrad."
Then: "Who sent you to America?"
"The Society for the Restoration of the Revolution."
"What is the nature of this organization?"
"It is an underground group pledged to return the Soviet Union to its
status as the leader of the world revolution and to overthrow the
present appeasers of the capitalist governments."
Wolf glowed with triumph. "Get that, Alma?" he gloated, and he
turned around half way and winked at the two men behind him.
Alma Heller shook a strand of hair back from her eyes. "The fanatical
revolutionaries—now they're trying to overthrow their own
government because the Soviet is too friendly to the Western
governments!"
"This is no comic underground group," Wolf said. "There are some
big people in it who know how to do things that we're just barely
starting to learn about."
He paused, and considered his next questions. The time had come to
dig in.
He phrased his query: "What was your task on the satellite?"
Britten's face writhed. Perspiration rolled down his cheeks in a steady
stream. Obviously some of the original conditioning remained,
causing interference with Wolf's orders.
Alma Heller's knuckles showed white and her clenched hands
trembled. The FBI agents inched forward, their bodies stiff with
impatience.
Between hard breaths the words came: "... was on the satellite to
watch ... new developments in nuclear power ... complete conversion
... matter to energy...."
Understanding grew in Wolf's mind with a brilliant glare. Glover had
been on the verge of taming the ultimate source of energy—the total
and complete conversion of matter—a source of power over 130
times more potent than the hydrogen-helium reaction. No wonder the
project had been put under wraps!
"So you killed Glover to prevent him from continuing his work. What
did you intend to gain by that? Somebody else will take it over. How
are you going to develop this power source yourself?"
Britten groaned audibly. His back arched and his arms strained
against the table straps.
Through clenched teeth: "Ruppert ... next man in line for Glover's job
... one of us."
Wolf's eyes opened wide, and he whirled to the telephone.
"I'm calling Washington—" he began, then stopped in horror.
Behind him, Britten's voice said, in a strangely firm tone: "Now is the
time."

Wolf whirled again. He saw Britten, still strapped to the table, his eyes
unglazed, and his facial expression commanding.
The FBI men had stiffened, and were standing in place, motionless.
"Cover them, and untie me," Britten rapped out, in a voice that was
greatly different from the youthful, uncertain tone he had previously
used.
Grady pulled his gun, backed Wolf and Alma Heller against the wall,
while Jones loosened Britten's straps.
"So you're one of them, too, Grady," Wolf growled. "And you, Jones.
May you burn in hell."
"Don't malign them," said Britten, sitting up and rubbing his arms.
"They are good, loyal G-men. But they sat outside my door too long,
and now they do what I tell them to do."
Wolf narrowed his eyes and stared at Britten. "Just what are you?" he
demanded.
Britten met his gaze, bleakly, and ignored the question.
"We have a rendezvous to make. The two of you will escort me to a
helicopter that Grady will order. I need not repeat that we are
prepared to blast our way out of this place. You'll save lives all around
by being as inconspicuous as possible."
He indicated that Wolf and Alma Heller would go ahead, while the two
agents took up the rear. Out in the main corridor they merged into the
confused traffic of the busy hospital, two doctors and two attendants
conducting a patient out.
Grady took the controls of the helicopter that waited for them out on
the parking lot. As they climbed to a high traffic lane, Jones took care
of tying the hands of the two doctors behind their seats.
Britten sat beside the pilot, staring through the windshield. "Head due
west one hundred miles," he said. "Then I'll give you further
directions."
Wolf looked down through the port next to him and felt his heart
constrict as he saw the houses below grow smaller and smaller. One
of those houses was his; there was a small figure beside it that could
have been his little boy. That was the thought that set his heart
beating violently and the adrenalin pumping swiftly through his veins.
For himself he didn't care so much, but his son needed a father to
come home.
He looked at Alma sitting beside him, her face pale and frightened.
He wondered how much time there was before the rendezvous. For
this was all the time he had. Beyond that were too many unknown
factors to consider.
He leaned over sideways.
"Alma," he said, in a voice not loud enough to carry forward over the
roar of the motor. "Tell me exactly what happened when Britten said,
'Now is the time.' My back was turned then. Just what did he look
like?"
Alma swallowed. She composed her face and turned her thoughts
inward, remembering.
"There was a sudden change," she said. "One moment he was in the
trance state, the next moment he was fully aware of his surroundings
and in charge of the situation. As though he received a signal at that
instant."
A signal, Wolf thought. From where? The implication was shocking.
Look at what we have, he continued to himself. Britten comes to me,
under conditioning, ready to act out his part to the hilt. We question
him under deep hypnotherapy and he comes forth with a plausible
story. We might have stopped right there, but we got curious and
began to ask more questions. He brings out another story. Why?
Obviously, red herrings to confuse the issue. To stall for time. We
apply more pressure, blank out his original conditioning so that he
gives us straight answers to questions, and we are getting along fine.
Then, suddenly he snaps out of it and into his original, pre-Britten
character, all forty years of him. Therefore there must have been
another, deeper level to the control over his mind which we did not
even touch. A level activated by a new signal which we did not even
detect, a signal which came at a crucial time.
"Now is the time" meant that the stalling was over, that the
preparations for Britten's escape were completed.
There were still questions to be answered, many blank spaces to be
filled in, but at the present instant there was only one question that
mattered. The treatment which Wolf had given Britten—had it been at
all effective?
Was it still effective?
There was one way to find out.

Morris Wolf leaned forward and called in a loud voice: "Pyotr


Fermineyev!"
The man's head snapped around.
"Cooperation is the key word!" Wolf shouted.
Confusion passed over Britten's face as conflict once more knotted
his nervous system.
Wolf threw his second punch immediately. "Tell Jones to cut me
loose," he demanded.
"Cut him loose," Britten echoed, in bewilderment.
After an interminable interval, Jones laid down his gun, found his
knife, opened it, and slashed the cords from Wolf's arms. Wolf's
muscles were already tensed. He snatched Jones' gun, lurched
forward, and even as Britten's mouth opened to countermand his
order, he slugged Britten with the butt of the pistol, hitting him
viciously and hard until he lay unconscious on the floor.
Then he said to Grady, "You'd better get us back to the hospital,"
keeping the gun in his hand.
But Grady and Jones made no trouble. With Britten out of the picture
they obeyed the one obviously in command. Poor boys, Wolf thought.
Now they were in need of therapy.
As the hospital hove into view, he said to Alma Heller, "We have just
seen the real beginning of psychological warfare. Where it took us a
whole roomful of equipment to condition Britten's responses to a
trigger word, he was able to do it to Jones and Brady single-handed.
His method is something we'd like to know. But more than that,
Britten himself was conditioned to respond to a signal unknown to us
and undetected by us. My God, it could only have been telepathic!"
Alma Heller's eyes closed for a moment.
"I think," she said, "that psychiatrists are going to reach the same
position that physicists did during World War II."
Morris Wolf looked dourly out of the window, watching the hospital
balloon up under the helicopter.
"That's the most unpleasant thing anybody has said all day," he
replied.
*** END OF THE PROJECT GUTENBERG EBOOK FORMULA FOR
MURDER ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying copyright
royalties. Special rules, set forth in the General Terms of Use part of
this license, apply to copying and distributing Project Gutenberg™
electronic works to protect the PROJECT GUTENBERG™ concept
and trademark. Project Gutenberg is a registered trademark, and
may not be used if you charge for an eBook, except by following the
terms of the trademark license, including paying royalties for use of
the Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is very
easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund from
the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law in
the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name
associated with the work. You can easily comply with the terms of
this agreement by keeping this work in the same format with its
attached full Project Gutenberg™ License when you share it without
charge with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the terms
of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears, or
with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning of
this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1 with
active links or immediate access to the full terms of the Project
Gutenberg™ License.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or expense
to the user, provide a copy, a means of exporting a copy, or a means
of obtaining a copy upon request, of the work in its original “Plain
Vanilla ASCII” or other form. Any alternate format must include the
full Project Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt that
s/he does not agree to the terms of the full Project Gutenberg™
License. You must require such a user to return or destroy all
copies of the works possessed in a physical medium and
discontinue all use of and all access to other copies of Project
Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except


for the “Right of Replacement or Refund” described in paragraph
1.F.3, the Project Gutenberg Literary Archive Foundation, the owner
of the Project Gutenberg™ trademark, and any other party
distributing a Project Gutenberg™ electronic work under this
agreement, disclaim all liability to you for damages, costs and

You might also like