You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Built_002dIn-Func_002fProc.html 8.1KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>Built-In Func/Proc (Debugging with GDB)</title>
  17. <meta name="description" content="Built-In Func/Proc (Debugging with GDB)">
  18. <meta name="keywords" content="Built-In Func/Proc (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="Modula_002d2.html#Modula_002d2" rel="up" title="Modula-2">
  26. <link href="M2-Constants.html#M2-Constants" rel="next" title="M2 Constants">
  27. <link href="M2-Operators.html#M2-Operators" rel="prev" title="M2 Operators">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style: oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="Built_002dIn-Func_002fProc"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="M2-Constants.html#M2-Constants" accesskey="n" rel="next">M2 Constants</a>, Previous: <a href="M2-Operators.html#M2-Operators" accesskey="p" rel="prev">M2 Operators</a>, Up: <a href="Modula_002d2.html#Modula_002d2" accesskey="u" rel="up">Modula-2</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="Built_002din-Functions-and-Procedures"></a>
  64. <h4 class="subsubsection">15.4.9.2 Built-in Functions and Procedures</h4>
  65. <a name="index-Modula_002d2-built_002dins"></a>
  66. <p>Modula-2 also makes available several built-in procedures and functions.
  67. In describing these, the following metavariables are used:
  68. </p>
  69. <dl compact="compact">
  70. <dt><var>a</var></dt>
  71. <dd><p>represents an <code>ARRAY</code> variable.
  72. </p>
  73. </dd>
  74. <dt><var>c</var></dt>
  75. <dd><p>represents a <code>CHAR</code> constant or variable.
  76. </p>
  77. </dd>
  78. <dt><var>i</var></dt>
  79. <dd><p>represents a variable or constant of integral type.
  80. </p>
  81. </dd>
  82. <dt><var>m</var></dt>
  83. <dd><p>represents an identifier that belongs to a set. Generally used in the
  84. same function with the metavariable <var>s</var>. The type of <var>s</var> should
  85. be <code>SET OF <var>mtype</var></code> (where <var>mtype</var> is the type of <var>m</var>).
  86. </p>
  87. </dd>
  88. <dt><var>n</var></dt>
  89. <dd><p>represents a variable or constant of integral or floating-point type.
  90. </p>
  91. </dd>
  92. <dt><var>r</var></dt>
  93. <dd><p>represents a variable or constant of floating-point type.
  94. </p>
  95. </dd>
  96. <dt><var>t</var></dt>
  97. <dd><p>represents a type.
  98. </p>
  99. </dd>
  100. <dt><var>v</var></dt>
  101. <dd><p>represents a variable.
  102. </p>
  103. </dd>
  104. <dt><var>x</var></dt>
  105. <dd><p>represents a variable or constant of one of many types. See the
  106. explanation of the function for details.
  107. </p></dd>
  108. </dl>
  109. <p>All Modula-2 built-in procedures also return a result, described below.
  110. </p>
  111. <dl compact="compact">
  112. <dt><code>ABS(<var>n</var>)</code></dt>
  113. <dd><p>Returns the absolute value of <var>n</var>.
  114. </p>
  115. </dd>
  116. <dt><code>CAP(<var>c</var>)</code></dt>
  117. <dd><p>If <var>c</var> is a lower case letter, it returns its upper case
  118. equivalent, otherwise it returns its argument.
  119. </p>
  120. </dd>
  121. <dt><code>CHR(<var>i</var>)</code></dt>
  122. <dd><p>Returns the character whose ordinal value is <var>i</var>.
  123. </p>
  124. </dd>
  125. <dt><code>DEC(<var>v</var>)</code></dt>
  126. <dd><p>Decrements the value in the variable <var>v</var> by one. Returns the new value.
  127. </p>
  128. </dd>
  129. <dt><code>DEC(<var>v</var>,<var>i</var>)</code></dt>
  130. <dd><p>Decrements the value in the variable <var>v</var> by <var>i</var>. Returns the
  131. new value.
  132. </p>
  133. </dd>
  134. <dt><code>EXCL(<var>m</var>,<var>s</var>)</code></dt>
  135. <dd><p>Removes the element <var>m</var> from the set <var>s</var>. Returns the new
  136. set.
  137. </p>
  138. </dd>
  139. <dt><code>FLOAT(<var>i</var>)</code></dt>
  140. <dd><p>Returns the floating point equivalent of the integer <var>i</var>.
  141. </p>
  142. </dd>
  143. <dt><code>HIGH(<var>a</var>)</code></dt>
  144. <dd><p>Returns the index of the last member of <var>a</var>.
  145. </p>
  146. </dd>
  147. <dt><code>INC(<var>v</var>)</code></dt>
  148. <dd><p>Increments the value in the variable <var>v</var> by one. Returns the new value.
  149. </p>
  150. </dd>
  151. <dt><code>INC(<var>v</var>,<var>i</var>)</code></dt>
  152. <dd><p>Increments the value in the variable <var>v</var> by <var>i</var>. Returns the
  153. new value.
  154. </p>
  155. </dd>
  156. <dt><code>INCL(<var>m</var>,<var>s</var>)</code></dt>
  157. <dd><p>Adds the element <var>m</var> to the set <var>s</var> if it is not already
  158. there. Returns the new set.
  159. </p>
  160. </dd>
  161. <dt><code>MAX(<var>t</var>)</code></dt>
  162. <dd><p>Returns the maximum value of the type <var>t</var>.
  163. </p>
  164. </dd>
  165. <dt><code>MIN(<var>t</var>)</code></dt>
  166. <dd><p>Returns the minimum value of the type <var>t</var>.
  167. </p>
  168. </dd>
  169. <dt><code>ODD(<var>i</var>)</code></dt>
  170. <dd><p>Returns boolean TRUE if <var>i</var> is an odd number.
  171. </p>
  172. </dd>
  173. <dt><code>ORD(<var>x</var>)</code></dt>
  174. <dd><p>Returns the ordinal value of its argument. For example, the ordinal
  175. value of a character is its <small>ASCII</small> value (on machines supporting
  176. the <small>ASCII</small> character set). The argument <var>x</var> must be of an
  177. ordered type, which include integral, character and enumerated types.
  178. </p>
  179. </dd>
  180. <dt><code>SIZE(<var>x</var>)</code></dt>
  181. <dd><p>Returns the size of its argument. The argument <var>x</var> can be a
  182. variable or a type.
  183. </p>
  184. </dd>
  185. <dt><code>TRUNC(<var>r</var>)</code></dt>
  186. <dd><p>Returns the integral part of <var>r</var>.
  187. </p>
  188. </dd>
  189. <dt><code>TSIZE(<var>x</var>)</code></dt>
  190. <dd><p>Returns the size of its argument. The argument <var>x</var> can be a
  191. variable or a type.
  192. </p>
  193. </dd>
  194. <dt><code>VAL(<var>t</var>,<var>i</var>)</code></dt>
  195. <dd><p>Returns the member of the type <var>t</var> whose ordinal value is <var>i</var>.
  196. </p></dd>
  197. </dl>
  198. <blockquote>
  199. <p><em>Warning:</em> Sets and their operations are not yet supported, so
  200. <small>GDB</small> treats the use of procedures <code>INCL</code> and <code>EXCL</code> as
  201. an error.
  202. </p></blockquote>
  203. <a name="index-Modula_002d2-constants"></a>
  204. <hr>
  205. <div class="header">
  206. <p>
  207. Next: <a href="M2-Constants.html#M2-Constants" accesskey="n" rel="next">M2 Constants</a>, Previous: <a href="M2-Operators.html#M2-Operators" accesskey="p" rel="prev">M2 Operators</a>, Up: <a href="Modula_002d2.html#Modula_002d2" accesskey="u" rel="up">Modula-2</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  208. </div>
  209. </body>
  210. </html>