HP Pascal/iX Reference Manual (31502-90022)

9- 1
Chapter 9 Standard Routines
HP Pascal supplies
predefined procedures
and
functions
that perform
various commonly used operations. These are listed below, followed by a
description of most in the subsequent pages of this chapter. Any
procedure or function that is followed by an asterisk (*) is discussed in
Chapter 10 .
Procedures:
append * overprint * setstrlen
assert pack strappend
associate * page * strdelete
close * prompt * strinsert
disassociate * put * strmove
dispose read * strread
get * readdir * strwrite
halt readln * unpack
mark release write *
movebyteswhile reset * writedir *
new rewrite * writeln *
open * seek *
Functions:
abs lastpos * sqr
arctan linepos * sqrt
baddress ln statement_number
binary maxpos * str
chr octal strlen
cmpbytes odd strmax
cos ord strltrim
eof * position * strpos
eoln * pred strrpt
exp round strrtrim
fnum * scanuntil succ
get_alignment scanwhile trunc
hex sin waddress
Procedures for Allocation and Deallocation
HP Pascal distinguishes two classes of
variables
. These are
static
and
dynamic
.
A
static variable
is explicitly declared in the declaration part of a
block, and may then be referred to by name in the body. The compiler
allocates storage for this variable when the block is activated. The
system does not deallocate this space until the process closes the scope
of the variable.
A
dynamic variable
is not declared and cannot be referred to by name.
Instead, a declared pointer references this variable. The system
allocates and deallocates storage for a dynamic variable during program
execution as a result of calls to the standard procedures new and
dispose. HP Pascal also supports the standard procedures mark and
release. The area of memory reserved for dynamic variables is called the
heap.
Dynamic variables permit the creation of temporary buffer areas in
memory. Furthermore, since a pointer may be a component of a structured
dynamic variable, it is possible to write programs with dynamic data
structures such as linked lists or trees.