1995 Sun Microsystems, Inc. 2550 Garcia Avenue, Mountain View, California 94043-1 100 U.S.A.
All rights reserved. This product or document is protected by copyright and distributed under licenses r estricting its use,
copying, distribution and decompilation. No part of this product or document may be reproduced in any form by any means
without prior written authorization of Sun and its licensors, if any .
Portions of this product may be derived from the UNIX
®
system and from the Berkeley 4.3 BSD system, licensed from the
University of California. Third-party software, including font technology in this product, is pr otected by copyright and licensed
from Sun’s Suppliers.
RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the government is subject to restrictions as set forth in
subparagraph (c)(1)(ii) of the Rights in T echnical Data and Computer Software clause at DFARS 252.227-7013 and F AR 52.227-19.
The product described in this manual may be protected by one or more U.S. patents, foreign patents, or pending applications.
TRADEMARKS
Sun, the Sun logo, Sun Microsystems, Sun Microsystems Computer Corporation, Solaris, the Sun Microsystems Computer
Corporation logo, SunSoft, the SunSoft logo, ProW orks, ProWorks/T eamWare, ProCompiler, Sun-4, SunOS, ONC, ONC+, NFS,
OpenWindows, DeskSet, ToolT alk, SunV iew, XV iew , X1 1/NeWS, AnswerBook, and Magnify Help are trademarks or register ed
trademarks of Sun Microsystems, Inc. in the United States and may be protected as trademarks in other countries. UNIX is a
registered trademark in the United States and other countries, exclusively licensed through X/Open Company, Ltd. OPEN
LOOK is a registered trademark of Novell, Inc. PostScript and Display PostScript are trademarks of Adobe Systems, Inc.
PowerPC™ is a trademark of International Business Machines Corporation. HP
®
and HP-UX® are registered trademarks of
Hewlett-Packard Company . All other pr oduct names mentioned herein are the trademarks of their r espective owners.
All SP ARC trademarks, including the SCD Compliant Logo, are trademarks or register ed trademarks of SP ARC International,
Inc. in the United States and may be protected as trademarks in other countries. SP ARCcenter , SPARCcluster , SP ARCompiler,
SP ARCdesign, SP ARC81 1, SPARCengine, SP ARCprinter , SPARCserver , SPARCstation, SP ARCstorage, SPARCworks,
microSP ARC, microSPARC-II, SP ARCware, and UltraSPARC are licensed exclusively to Sun Microsystems, Inc. Pr oducts bearing
SP ARC trademarks are based upon an architectur e developed by Sun Microsystems, Inc.
Please
Recycle
The OPEN LOOK™ and Sun™ Graphical User Interfaces were developed by Sun Microsystems, Inc. for its users and licensees.
Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user
interfaces for the computer industry . Sun holds a non-exclusive license from Xer ox to the Xerox Graphical User Interface, which
license also covers Sun’s licensees who implement OPEN LOOK GUI’s and otherwise comply with Sun’s written license
agreements.
X Window System is a product of X Consortium, Inc.
THIS PUBLICATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
THIS PUBLICATION COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE
PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BE INCORPORATED IN NEW
EDITIONS OF THE PUBLICATION. SUN MICROSYSTEMS, INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN
THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THIS PUBLICATION AT ANY TIME.
This manual describes the Pascal 4.0 compiler from SunSoft™. The purpose of
this manual is to help you begin writing and compiling Pascal programs on a
SPARCstation™.
In a previous major release, this Pascal compiler also ran on Solaris 1.x. Some
features remain in the documentation as being for Solaris 1.x only.
The README file that accompanies the product contains other release-specific
information,
Note – All references to Pascal in this manual refer to the Pascal 4.0 compiler
unless otherwise indicated.
For information on the operating environment, see the README file.
For instructions on how to install Pascal, refer to the Installing SunSoftDeveloper Products (SPARC/Solaris) manual.
xix
Audience
Organization
This guide was prepared for software engineers who write Pascal programs on
a SPARCstation. It assumes you are familiar with ISO standard Pascal and the
Solaris™ operating system.
This guide contains the following chapters:
• Chapter 1, “Introduction,” gives basic information about the Pascal
compiler and related program development tools.
• Chapter 2, “Pascal Programs,” describes how to write, compile, and run a
Pascal program.
• Chapter 3, “The Pascal Compiler,” describes the pc command and its
options.
• Chapter 4, “Program Construction and Management,” is an introduction to
how complex programs are built in Pascal.
• Chapter 5, “Separate Compilation,” describes how programs can be
divided into several units, and how they are compiled and linked.
• Chapter 6, “The C–Pascal Interface,” describes how to write programs that
are partly in C and partly in Pascal.
• Chapter 7, “The C++–Pascal Interface,” describes how to write programs
that are partly in C++ and partly in Pascal.
• Chapter 8, “The FORTRAN–Pascal Interface,” describes how to write
programs that are partly in FORTRAN and partly in Pascal.
• Chapter 9, “Error Diagnostics,” describes the errors you may encounter
while writing programs with Pascal.
• Chapter 10, “The XView Toolkit,” describes how to use the XView toolkit
with Pascal.
• Chapter 11, “Math Libraries,” describes how to use the libm and
libsunmath functions in Pascal programs.
• Appendix A, “Pascal Preprocessor,” describes the Pascal preprocessors,
with emphasis on the nonstandard preprocessor, cppas.
xxPascal 4.0 User’s Guide
• Appendix B, “Error Messages,” lists all the error messages the compiler
produces.
This guide concludes with an index.
Conventions Used in This Guide
This guide contains syntax diagrams of the Pascal language in extended
Backus-Naur Formalism (BNF) notation. Here are the meta symbols:
Table P-1 BNF Meta Symbols
Meta SymbolDescription
::=Defined as
|Can be used as an alternative
(a | b)Either a or b
[ a ]Zero or one instance of
{ a }Zero or more instances of a'abc'The characters abc
The following table describes the type styles and symbols used in this guide:
Table P-2 Typographic Conventions
a
Typeface or
SymbolMeaningExample
AaBbCc123 The names of commands, files, and
directories; on-screen computer output
AaBbCc123 What you type, contrasted with on-
screen computer output
AaBbCc123Command-line placeholder:
replace with a real name or value
AaBbCc123Book titles, new words or terms, or
words to be emphasized
Prefacexxi
Edit your .login file.
Use ls -a to list all files.
hostname% You have mail.
hostname% su
Password:
To delete a file, type rm filename.
Read the User’s Guide.
These are called class options.
You must be root to do this.
Shell Prompts in Command Examples
The following table shows the default system prompt and superuser prompt
for the C shell, Bourne shell, and Korn shell.
Table P-3 Shell Prompts
ShellPrompt
C shell promptmachine_name%
C shell superuser promptmachine_name#
Bourne shell and Korn shell prompt$
Bourne shell and Korn shell superuser prompt#
Related Documentation
This manual is designed to accompany the following documents:
• The Pascal 4.0 Reference Manual, which describes extensions to standard
Pascal
• The Pascal 4.0 Quick Reference, which summarizes the compiler options
Both this manual and the Pascal 4.0 Reference Manual are available in the
AnswerBook® system, an on-line documentation viewing tool that takes
advantage of dynamically linked headings and cross-references. The InstallingSunSoft Developer Products (SPARC/Solaris) manual shows you how to install
AnswerBook.
Manual Page
Pascal 4.0 provides an on-line manual page (also known as man page), on
pc(1), that describes the Pascal compiler. This document is included in the
Pascal package and must be installed with the rest of the software
Once you install the documentation, you can read about pc by entering the
man command followed by the command name, as in:
hostname% man pc
xxiiPascal 4.0 User’s Guide
README Files
The README default directory is: /opt/SUNWspro/READMEs.
This directory contains the following files:
• A Pascal 4.0 README, called pascal, that describes the new features,
software incompatibilities, and software bugs
• A floating-point white paper, “What Every Scientist Should Know About
Floating-Point Arithmetic,” by David Goldberg, in PostScript™ format. The
file is called floating-point.ps, and can be printed on any PostScriptcompatible printer that has Palatino font. It can be viewed on-line by using
the imagetool command:
hostname% imagetool floating-point.ps
This paper is also available in the AnswerBook system.
Other Related Documentation
Other reference material includes:
Profiling Tools
Numerical Computation Guide
Documents in Hard Copy and in AnswerBook
The following table shows what documents are on-line, in hard copy, or both:
Table P-4 Documents in Hard Copy and in AnswerBook
Table P-4 Documents in Hard Copy and in AnswerBook (Continued)
TitleHard CopyOn-Line
Numerical Computation GuideX (AnswerBook)
READMEX (CD-ROM)
What Every Scientist Should Know About Floating-Point ArithmeticX (AnswerBook and CD-ROM)
xxivPascal 4.0 User’s Guide
Standards
Introduction
This chapter gives an overview of the features of Pascal, including
compatibility, internationalization, and licensing. It contains the following
sections:
Pascal is a derivative of the Berkeley Pascal system distributed with UNIX® 4.2
BSD. It complies with FIPS PUB 109 ANSI/IEEE 770 X3.97-1983 and
BS6192/ISO7185 at both level 0 and level 1.
1
1
1
Pascal Compiler
Features
The name of the Pascal compiler is pc. If given an argument file name ending
with .p or .pas, pc compiles the file and leaves the result in an executable
file, called a.out by default.
Pascal includes many extensions to the standard, including the following:
• Separate compilation of programs and modules
• dbx (symbolic debugger) support
• Optimizer support
• Multiple label, const, type, and var declarations
• Variable-length character strings
• Compile-time initializations
• static and extern declarations
• Different sizes of integer and real data types
• Integer constants in any base, from 2 to 16
• Extended input/output facilities
• Extended library of built-in functions and procedures
• Universal and function and procedure pointer types
• Direction of parameter passing: into a routine, out of a routine, or both
• Functions that return structured-type results
Note – For other release-specific information, please refer to the README file
that accompanies the product release.
Compatibility
In general, Pascal 4.0 runs in the Solaris 2.x or above operating environment.
This product is not compatible with /usr/ucblib/libucb.a on the Solaris
2.x environment.
2Pascal 4.0 User’s Guide
Text Editors
Debuggers
1
The operating system provides two main editors:
• Text Editor—A window-based text editor that runs in the OpenWindows
environment. Start this tool by typing textedit at the system prompt.
• vi—The standard visual display editor that offers the capabilities of both a
line and a screen editor. It also provides several commands for editing
programs. For example:
• The autoindent option provides white space at the beginning of a line.
• The showmatch option shows matching parentheses.
SunSoft offers a variety of programming tools that run in the Solaris operating
environment. For debugging, the following tools are available:
• dbx—A symbolic debugger
• debugger—A window- and mouse-based version of the symbolic debugger
You can use Pascal with fix-and-continue, a debugger functionality. See the
debugger documentation for details of this feature.
XV iew Toolkit
The XView application programmer ’s interface (API) is an object-oriented and
server-based user-interface toolkit for the X Window System Version 11 (X11).
It is designed for manipulating XView windows and other XView objects.
Chapter 10, “The XView Toolkit,” describes how to use XView with Pascal.
Native Language Support
Sun supports the development of applications in languages other than English.
These languages include most European languages and Japanese. As a result,
you can easily switch your application from one native language to another.
This feature is known as internationalization.
Introduction3
1
Internationalization
A product can support up to four levels of internationalization:
• Level 1—Allows native-language characters (such as the a-umlaut). This is
referred to as the 8-bit clean model because the eighth bit in each byte is
used to represent native-language characters.
• Level 2—Recognizes and displays international date and time formats, such
as 26.07.90 in Italian; international decimal units, such as 1.234.567,89 in
French; and international monetary units, such as 1.234,56 Pts in Spanish.
• Level 3—Contains support for localized messages and text presentation.
• Level 4—Contains Asian language support.
Pascal supports all four levels. See the Pascal 4.0 Reference Manual for a
description of the date and time functions in internationalized formats.
Pascal does not allow input and output in the various international formats. If
it does, it does not comply with the Pascal language standard, ANSI/IEEE
770 X3.97-1983.
For example, the standard specifies a period (.) as the decimal unit in the
floating-point representation. Consider the following program, which prints a
floating-point value:
program sample(output);
var r : real := 1.2;
begin
writeln(r);
end.
When you compile and run the program on the internationalized Pascal
compiler, the output is:
1.20000000000000e+00
4Pascal 4.0 User’s Guide
Licensing
1
If you reset your system locale to, for example, France, and rerun the program,
the output is the same. Pascal does not replace the period with a comma, the
French decimal unit.
Locale
You can change your application from one native language to another by
setting the locale. For information on this and other native language support
features, see the Solaris documentation on internationalization.
This compiler uses network licensing, as described in the manual, InstallingSunSoft Developer Products (SPARC/Solaris).
When you invoke the compiler, if a license is available, the compiler starts. If
no license is available, your request for a license is put on a queue, and your
compile job continues when a license becomes available. A single license can
be used for any number of simultaneous compiles by a single user on a single
machine. There are two licensing-related options:
• -noqueue—Does not queue request if no license is available.
• -xlicinfo—Returns information on the status of licensing.
The -xlicinfo option does not check out a license.
For details on how to obtain a license—where to call, what information to have
ready—refer to the manual, Installing SunSoft Developer Products
(SPARC/Solaris).
Introduction5
1
6Pascal 4.0 User’s Guide
Loading...
+ 303 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.