blob: 9bded323e475971552ff23c38078f49728678200 [file] [log] [blame]
<html lang="en">
<head>
<title>Built-In Func/Proc - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Modula_002d2.html#Modula_002d2" title="Modula-2">
<link rel="prev" href="M2-Operators.html#M2-Operators" title="M2 Operators">
<link rel="next" href="M2-Constants.html#M2-Constants" title="M2 Constants">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Built-In-Func%2fProc"></a>
<a name="Built_002dIn-Func_002fProc"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="M2-Constants.html#M2-Constants">M2 Constants</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="M2-Operators.html#M2-Operators">M2 Operators</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Modula_002d2.html#Modula_002d2">Modula-2</a>
<hr>
</div>
<h5 class="subsubsection">15.4.9.2 Built-in Functions and Procedures</h5>
<p><a name="index-Modula_002d2-built_002dins-1045"></a>
Modula-2 also makes available several built-in procedures and functions.
In describing these, the following metavariables are used:
<dl>
<dt><var>a</var><dd>represents an <code>ARRAY</code> variable.
<br><dt><var>c</var><dd>represents a <code>CHAR</code> constant or variable.
<br><dt><var>i</var><dd>represents a variable or constant of integral type.
<br><dt><var>m</var><dd>represents an identifier that belongs to a set. Generally used in the
same function with the metavariable <var>s</var>. The type of <var>s</var> should
be <code>SET OF </code><var>mtype</var> (where <var>mtype</var> is the type of <var>m</var>).
<br><dt><var>n</var><dd>represents a variable or constant of integral or floating-point type.
<br><dt><var>r</var><dd>represents a variable or constant of floating-point type.
<br><dt><var>t</var><dd>represents a type.
<br><dt><var>v</var><dd>represents a variable.
<br><dt><var>x</var><dd>represents a variable or constant of one of many types. See the
explanation of the function for details.
</dl>
<p>All Modula-2 built-in procedures also return a result, described below.
<dl>
<dt><code>ABS(</code><var>n</var><code>)</code><dd>Returns the absolute value of <var>n</var>.
<br><dt><code>CAP(</code><var>c</var><code>)</code><dd>If <var>c</var> is a lower case letter, it returns its upper case
equivalent, otherwise it returns its argument.
<br><dt><code>CHR(</code><var>i</var><code>)</code><dd>Returns the character whose ordinal value is <var>i</var>.
<br><dt><code>DEC(</code><var>v</var><code>)</code><dd>Decrements the value in the variable <var>v</var> by one. Returns the new value.
<br><dt><code>DEC(</code><var>v</var><code>,</code><var>i</var><code>)</code><dd>Decrements the value in the variable <var>v</var> by <var>i</var>. Returns the
new value.
<br><dt><code>EXCL(</code><var>m</var><code>,</code><var>s</var><code>)</code><dd>Removes the element <var>m</var> from the set <var>s</var>. Returns the new
set.
<br><dt><code>FLOAT(</code><var>i</var><code>)</code><dd>Returns the floating point equivalent of the integer <var>i</var>.
<br><dt><code>HIGH(</code><var>a</var><code>)</code><dd>Returns the index of the last member of <var>a</var>.
<br><dt><code>INC(</code><var>v</var><code>)</code><dd>Increments the value in the variable <var>v</var> by one. Returns the new value.
<br><dt><code>INC(</code><var>v</var><code>,</code><var>i</var><code>)</code><dd>Increments the value in the variable <var>v</var> by <var>i</var>. Returns the
new value.
<br><dt><code>INCL(</code><var>m</var><code>,</code><var>s</var><code>)</code><dd>Adds the element <var>m</var> to the set <var>s</var> if it is not already
there. Returns the new set.
<br><dt><code>MAX(</code><var>t</var><code>)</code><dd>Returns the maximum value of the type <var>t</var>.
<br><dt><code>MIN(</code><var>t</var><code>)</code><dd>Returns the minimum value of the type <var>t</var>.
<br><dt><code>ODD(</code><var>i</var><code>)</code><dd>Returns boolean TRUE if <var>i</var> is an odd number.
<br><dt><code>ORD(</code><var>x</var><code>)</code><dd>Returns the ordinal value of its argument. For example, the ordinal
value of a character is its <span class="sc">ascii</span> value (on machines supporting
the <span class="sc">ascii</span> character set). The argument <var>x</var> must be of an
ordered type, which include integral, character and enumerated types.
<br><dt><code>SIZE(</code><var>x</var><code>)</code><dd>Returns the size of its argument. The argument <var>x</var> can be a
variable or a type.
<br><dt><code>TRUNC(</code><var>r</var><code>)</code><dd>Returns the integral part of <var>r</var>.
<br><dt><code>TSIZE(</code><var>x</var><code>)</code><dd>Returns the size of its argument. The argument <var>x</var> can be a
variable or a type.
<br><dt><code>VAL(</code><var>t</var><code>,</code><var>i</var><code>)</code><dd>Returns the member of the type <var>t</var> whose ordinal value is <var>i</var>.
</dl>
<blockquote>
<em>Warning:</em> Sets and their operations are not yet supported, so
<span class="sc">gdb</span> treats the use of procedures <code>INCL</code> and <code>EXCL</code> as
an error.
</blockquote>
<p><a name="index-Modula_002d2-constants-1046"></a>
</body></html>