Next Index Doc Set Home


Pascal User's Guide


Contents

Preface

1. Introduction

Standards

Pascal Compiler

Features

Compatibility

Text Editors

Debuggers

Native Language Support
Internationalization
Locale

Licensing

2. Pascal Programs

A Simple Pascal Program
Compiling the Program
Running the Program
Renaming the Executable File

An Interactive Pascal Program
Compiling the Program
Running the Program
Redirecting I/O
Using a File Name as a File Variable

Where Did My Program Fail?
Using Pascal Traceback
Using a Sample Program with Segmentation Violation
Compiling and Running the Program
Using the -g Option

3. The Pascal Compiler

pc Version Number

Compile and Link Sequence

Language Preprocessor

File Name Extensions Accepted By pc

Option-Passing on the Command-Line

Option-Passing in the Program Text

Options
-a
-Bbinding
-b
-C
-c
-calign
-cg89
-cg92
-cond
-config
-Dname[=def]
-dalign
-dn
-dryrun
-dy
-fast
-flags
-fnonstd
-fns
-fround=r
-ftrap=t
-G
-g
-H
-hname
-help
-Ipathname
-i name
-keeptmp
-L
-l
-Ldirectory
-libmieee
-libmil
-llib
-misalign
-mt
-native
-nolib
-nolibmil
-non_init[=yes|no]
Use With -Rw
Lack of Effect of -non_init
-noqueue
-notrace
-O[level]
-o filename
-P
-p and -pg
Using the -p Option
Using the -pg Option
-pic, -Kpic and -PIC, -KPIC
-Qoption
-Qpath pathname
-Qproduce
-qp
-R path[:dir]
-Rw
-S
-s[level]
-sb
-sbfast
-tc
-temp=dir
-time
-U name
-V
-V0 and -V1
-v
-w
-xa
-xarch=a
-xcache=c
-xchip=c
-xcg89
-xcg92
-xF
-xildoff
-xildon
-xl
-xlibmieee
-xlibmil
-xlibmopt
-xlicinfo
-xMerge
-xnolib
-xnolibmopt
-xO5
-xpg
-xprofile=p
-xregs=r
-xs
-xsafe=mem
-xsb
-xsbfast
-xspace
-xtarget=t
-Z
-ztext

4. Program Construction and Management

Units
Using Program Units and Module Units
Compiling with Units
Using Units and Header Files
Sharing Variables Between Units

Libraries

5. Separate Compilation

Working with Units
Using Program Units
Using Module Units

Sharing Variables and Routines Across Multiple Units
Compiling without the -xl Option
Sharing Public Variables
Using extern Option to Share Routines
Using include Files to Share Variables and Routines
Using the -xl Option
Using public var Declarations
Using the define Variable Attribute
Using the define Declaration
Using include Files
Using extern

Sharing Declarations in Multiple Units

6. The C-Pascal Interface

Compilation of Mixed-Language Programs

Compatibility of Types for C and Pascal
Precautions with Compatible Types
The shortreal Type
Character Strings
Array Indexes
Aggregate Types
Incompatibilities
Enumerated Types
Pascal Set Types

General Parameter Passing in C and Pascal

Procedure Calls: C-Pascal
Variable Parameters
Simple Types without -xl
Simple Types with -xl
Strings of Characters
Fixed Arrays
The univ Arrays
Conformant Arrays
Records and Structures
Variant Records
Pascal Set Type
Pascal intset Type
Value Parameters
Simple Types without -xl
Simple Types with -xl
Arrays
Conformant Arrays
Function Return Values
Simple Types
Input and Output

Procedure Calls: Pascal-C
Variable Parameters
Simple Types
Strings of Characters
Fixed Arrays
The univ Arrays
Conformant Arrays
Records and Structures
Variant Records
Non-Pascal Procedures
Value Parameters
Simple Types
Function Return Values
Parameters That Are Pointers to Procedures

Procedures and Functions as Parameters

Global Variables in C and Pascal

File-Passing Between Pascal and C

7. The C++-Pascal Interface

Sample Interface

Compatibility of Types for C++ and Pascal

C++ Name Encoding

Procedure Calls: C++-Pascal
Arguments Passed by Reference
Simple Types without the -xl Option
Simple Types with the -xl Option
Strings of Characters
Fixed Arrays
Records and Structures
Arguments Passed by Value
Simple Types without the -xl Option
Function Return Values
Simple Types
Type shortreal
Input and Output

Procedure Calls: Pascal-C++
Arguments Passed by Reference
Simple Types Passed by Reference
Arguments Passed by Value
Simple Types
Function Return Values

Global Variables in C++ and Pascal

Pascal File Pointers to C++

8. The FORTRAN-Pascal Interface

Compiler Mixed-Language Programs

Compatibility of Types for FORTRAN and Pascal
Precautions with Compatible Types
Character Strings
Array Indexes
Incompatibilities
Variant Records
Enumerated Types
Pascal Set Types
Multidimensional Arrays

General Parameter-Passing in FORTRAN and Pascal

Procedure Calls: FORTRAN-Pascal
Variable Parameters
Simple Types without the -xl Option
Simple Types with the -xl Option
Strings of Characters
Fixed Arrays
The univ Arrays
Conformant Arrays
Records and Structures
Variant Records
Pascal Set Type
Pascal intset Type
Value Parameters
Simple Types without the -xl Option
Simple Types with the -xl Option
Type shortreal
Arrays
Conformant Arrays
Pointers
Function Return Values
Simple Types
Type shortreal

Procedure Calls: Pascal-FORTRAN
Variable Parameters
Simple Types
Strings of Characters
Character Dummy Arguments
Fixed Arrays
The univ Arrays
Conformant Arrays
Records and Structures
Variant Records
Value Parameters
Simple Types
Pointers
Function Return Values
Simple Types
Type shortreal

Routines as Parameters

9. Error Diagnostics

Compiler Syntax Errors
Illegal Characters
String Errors
Digits in Real Numbers
Replacements, Insertions, and Deletions
Undefined or Improper Identifiers
Expected Symbols and Malformed Constructs
Expected and Unexpected End-of-file

Compiler Semantic Errors
Format of the Error Diagnostics
Incompatible Types
The scalar Class
Procedure and Function Type Errors
Scalar Error Messages
Expression Diagnostics
Type Equivalence
Unreachable Statements
The goto Statement
Uninitialized Variables
Unused Variables, Constants, Types, Labels, and Routines

Compiler Panics, I/O Errors

Runtime Errors

10. Math Libraries

Contents of the Math Libraries

libm Functions

IEEE Support Functions
ieee_functions()
ieee_values()
ieee_retrospective()

SPARC Libraries

Arithmetic Exceptions

Math Library Exception-Handling Function: matherr()

libsunmath Support for IEEE Modes and Exceptions

11. The Multithread Library

Multithread Environment for Pascal
Compiling Multithreaded Programs

Introduction to Multithreading
Thread Resources
Thread Creation Functions
Lightweight Processes
Process Control
Synchronization
Conditional Variables
Semaphores
Readers/Writer Lock

Parallel Matrix-Multiplication Example
Improving Time Efficiency With Two Threads

Use of Many Threads

Debugging Multithreaded Pascal Programs

Sample dbx Session

A. Pascal Preprocessor

cpp-
cppas-
Conditional Variables
Compiler Directives
The %config Directive
The %debug Directive
The %else Directive
The %elseif Directive
The %elseifdef Directive
The %enable Directive
The %endif Directive
The %error Directive
The %exit Directive
The %if Directive
The %ifdef Directive
The %include Directive
The %list Directive
The %nolist Directive
The %slibrary Directive
The %var Directive
The %warning Directive

B. Error Messages

Index


Next Index Doc Set Home