Pascal basics / PDF


Pascal basics / PDF







Pascal basics / PDF







Table of Contents


Introduction...
Note to the Second Edition....
Copyright.........
Donations....
The Book Structure........
Source Code..
Feedback.....
Acknowledgments....
About the Author..

Chapter 1: A Short History of the Pascal Language .
Wirth’s Pascal..
Turbo Pascal...
Delphi’s Pascal..




Chapter 2: Coding in Pascal ............................................................................................9
Comments....................................................................................................................9
Use of Uppercase.........................................................................................................10
Pretty-Printing...............................................................................................................11
Syntax Highlighting........................................................................................................11
Using Code Templates...................................................................................................12
Language Statements....................................................................................................13
Keywords....................................................................................................................13
Expressions and Operators..............................................................................................16
Conclusion...................................................................................................................17

Chapter 3: Types, Variables, and Constants....................................................................18
Variables.....................................................................................................................18
Constants....................................................................................................................19
Resource String Constants..............................................................................................19
Data Types.................................................................................................................20
Ordinal Types...............................................................................................................20
Real Types..................................................................................................................24
Date and Time.............................................................................................................25
Specific Windows Types..................................................................................................27
Typecasting and Type Conversions...................................................................................27
Conclusion...................................................................................................................29

Chapter 4:User-Defined Data Types..............................................................................................30
Named and Unnamed Types...........................................................................................30
Subrange Types...........................................................................................................31
Enumerated Types........................................................................................................31
Set Types...................................................................................................................33
Array Types................................................................................................................34
Record Types..............................................................................................................35
Pointers......................................................................................................................36
File Types...................................................................................................................38
Conclusion...................................................................................................................38

Chapter 5: Statements .................................................................................................39
Simple and Compound Statements....................................................................................39
Assignment Statements..................................................................................................39
Conditional Statements...................................................................................................40
Essential Pascal [Copyright 1995-2003 Marco Cantù] www.marcocantu.com/epascal 3
Loops in Pascal.............................................................................................................42
The With Statement......................................................................................................45
Conclusion...................................................................................................................46

Chapter 6: Procedures and Functions.............................................................................47
Pascal Procedures and Functions......................................................................................47
Reference Parameters...................................................................................................48
Constant Parameters.....................................................................................................49
Open Array Parameters..................................................................................................49
Delphi Calling Conventions...............................................................................................52
What Is a Method?.......................................................................................................53
Forward Declarations......................................................................................................53
Procedural Types..........................................................................................................54
Function Overloading......................................................................................................56
Default Parameters.......................................................................................................58
Conclusion...................................................................................................................59

Chapter 7: Handling Strings..........................................................................................60
Types of Strings...........................................................................................................60
Using Long Strings.........................................................................................................60
Looking at Strings in Memory...........................................................................................61
Delphi Strings and Windows PChars...................................................................................62
Formatting Strings.........................................................................................................64
Conclusion...................................................................................................................66

Chapter 8: Memory.......................................................................................................67
Dynamic Arrays............................................................................................................67
Conclusion...................................................................................................................69

Chapter 9: Windows Programming.................................................................................70
Windows Handles..........................................................................................................70
External Declarations......................................................................................................71
A Windows Callback Function...........................................................................................72
A Minimal Windows Program...........................................................................................74
Conclusion...................................................................................................................75

Chapter 10: Variants.....................................................................................................76
Variants Have No Type..................................................................................................76
Variants in Depth..........................................................................................................77
Variants Are Slow!.........................................................................................................78
Conclusion...................................................................................................................79

Chapter 11: Program and Units......................................................................................80
Units..........................................................................................................................80
Units and Scope............................................................................................................81
Units as Namespaces....................................................................................................82
Units and Programs.......................................................................................................83
Conclusion...................................................................................................................83

Chapter 12: Files in the Pascal Language.......................................................................84
Routines for Working with Files.........................................................................................84
Handling Text Files........................................................................................................85
A Text File Converter.....................................................................................................86
Saving Generic Data......................................................................................................87
From Files to Streams....................................................................................................88
Conclusion...................................................................................................................88








Download Pascal basics / PDF








Pascal basics / PDF

0 commentaires: