umouse

umouse.git
git clone git://git.lenczewski.org/umouse.git
Log | Files | Refs | Submodules | README

DPANS9.HTM (13075B)


      1 <HTML><HEAD>
      2 <TITLE>DPANS94</TITLE>
      3 <link disabled rel="stylesheet" href="mpexc6.css">
      4 <style>@import url(mpexc6.css);</style>
      5 </head>
      6 
      7 <BODY>
      8 <table width=100%>
      9 <tr>
     10 <td align=left>
     11 <a href=dpans8.htm><img src=left.gif
     12  width=26 height=26 align=ALIGN border=0></a>
     13 <a href=dpans10.htm><img src=right.gif
     14  width=26 height=26 align=ALIGN border=0></a>
     15 </td>
     16 <td align=right>
     17 <a href=dpans.htm#toc><img src=up.gif 
     18  width=26 height=26 align=ALIGN border=0></a>
     19 <a name=9.>Table of Contents</a>
     20 </td>
     21 </tr>
     22 </table>
     23 <p>
     24 <hr size=4>
     25 
     26 <H1>9. The optional Exception word set</H1>
     27 
     28 
     29 <p>
     30 <code>
     31 See:
     32 <a href=dpansa9.htm#A.9>A.9</a> The optional Exception word set
     33 </code>
     34 <p>
     35 
     36 
     37 <hr>
     38 <A name=9.1>
     39 <H2>9.1 Introduction</H2>
     40 </a>
     41 
     42 
     43 <hr>
     44 <A name=9.2>
     45 <H2>9.2 Additional terms and notation</H2>
     46 </a>
     47 
     48 None.
     49 
     50 
     51 <hr>
     52 <A name=9.3>
     53 <H2>9.3 Additional usage requirements</H2>
     54 </a>
     55 
     56 <p>
     57 <code>
     58 See:
     59 <a href=dpansa9.htm#A.9.3>A.9.3</a> Additional usage requirements
     60 </code>
     61 <p>
     62 
     63 <hr>
     64 <A name=9.3.1>
     65 <H3>9.3.1 THROW values</H3>
     66 </a>
     67 
     68 The 
     69 <a href=dpans9.htm#9.6.1.2275>THROW</a> 
     70 values {-255...-1} shall be used only as assigned by this
     71 Standard.  The values {-4095...-256} shall be used only as assigned by a
     72 system.
     73 <P>
     74 
     75 If the 
     76 <a href=dpans11.htm>File-Access</a> or 
     77 <a href=dpans14.htm>Memory-Allocation</a> word sets are implemented, it is
     78 recommended that the non-zero values of ior lie within the range of
     79 system THROW values, as defined above.  In an operating-system
     80 environment, this can sometimes be accomplished by <B>biasing</B> the
     81 range of operating-system exception-codes to fall within the THROW
     82 range.
     83 <P>
     84 
     85 Programs shall not define values for use with THROW in the range
     86 {-4095...-1}.
     87 
     88 <P>
     89 
     90 <hr>
     91 <A name=9.3.2>
     92 <H3>9.3.2 Exception frame</H3>
     93 </a>
     94 
     95 An exception frame is the implementation-dependent set of information
     96 recording the current execution state necessary for the proper
     97 functioning of 
     98 <a href=dpans9.htm#9.6.1.0875>CATCH</a> and 
     99 <a href=dpans9.htm#9.6.1.2275>THROW</a>.  It often includes the depths of the
    100 data stack and return stack.
    101 <P>
    102 
    103 
    104 <hr>
    105 <A name=9.3.3>
    106 <H3>9.3.3 Exception stack</H3>
    107 </a>
    108 
    109 A stack used for the nesting of exception frames by 
    110 <a href=dpans9.htm#9.6.1.0875>CATCH</a> and 
    111 <a href=dpans9.htm#9.6.1.2275>THROW</a>.  It
    112 may be, but need not be, implemented using the return stack.
    113 <P>
    114 
    115 
    116 <hr>
    117 <A name=9.3.4>
    118 <H3>9.3.4 Environmental queries</H3>
    119 </a>
    120 
    121 Append table 9.1
    122 to table 3.5.
    123 <P>
    124 
    125 <code>
    126 See:
    127 <A href=dpans3.htm#3.2.6>3.2.6</a> Environmental queries
    128 </code>
    129 <P>
    130 
    131 Table 9.1 - Environmental query strings
    132 <P>
    133 
    134 
    135 <PRE>
    136 String          Value data type  Constant?   Meaning
    137 ------          ---------------  ---------   -------
    138 EXCEPTION       flag             no          Exception word set present
    139 EXCEPTION-EXT   flag             no          Exception extensions word set present
    140 
    141 </PRE>
    142 
    143 <P>
    144 
    145 <hr>
    146 <A name=9.3.5>
    147 <H3>9.3.5 Possible actions on an ambiguous condition</H3>
    148 </a>
    149 
    150 A system choosing to execute 
    151 <a href=dpans9.htm#9.6.1.2275>THROW</a> when detecting one of the ambiguous
    152 conditions listed in table 9.3.6 shall use the throw code listed there.
    153 <P>
    154 
    155 <code>
    156 See:
    157 <A href=dpans3.htm#3.4.4>3.4.4</a> Possible actions on an ambiguous
    158 condition
    159 </code>
    160 
    161 <P>
    162 
    163 Table 9.2 - THROW code assignments
    164 <P>
    165 
    166 
    167 <PRE>
    168        Code     Reserved for
    169        ----     ------------
    170         -1      <a href=dpans6.htm#6.1.0670>ABORT</a>
    171         -2      <a href=dpans6.htm#6.1.0680>ABORT"</a>
    172         -3      stack overflow
    173         -4      stack underflow
    174         -5      return stack overflow
    175         -6      return stack underflow
    176         -7      do-loops nested too deeply during execution
    177         -8      dictionary overflow
    178         -9      invalid memory address
    179         -10     division by zero
    180         -11     result out of range
    181         -12     argument type mismatch
    182         -13     undefined word
    183         -14     interpreting a compile-only word
    184         -15     invalid <a href=dpans15.htm#15.6.2.1580>FORGET</a>
    185         -16     attempt to use zero-length string as a name
    186         -17     pictured numeric output string overflow
    187         -18     parsed string overflow
    188         -19     definition name too long
    189         -20     write to a read-only location
    190         -21     unsupported operation (e.g., <a href=dpans10.htm#10.6.1.0742>AT-XY</a> on a
    191                 too-dumb terminal)
    192         -22     control structure mismatch
    193         -23     address alignment exception
    194         -24     invalid numeric argument
    195         -25     return stack imbalance
    196         -26     loop parameters unavailable
    197         -27     invalid recursion
    198         -28     user interrupt
    199         -29     compiler nesting
    200         -30     obsolescent feature
    201         -31     <a href=dpans6.htm#6.1.0550>>BODY</a> used on non-<a href=dpans6.htm#6.1.1000>CREATE</a>d definition
    202         -32     invalid name argument (e.g., <a href=dpans6.htm#6.2.2295>TO</a> xxx)
    203         -33     block read exception
    204         -34     block write exception
    205         -35     invalid block number
    206         -36     invalid file position
    207         -37     file I/O exception
    208         -38     non-existent file
    209         -39     unexpected end of file
    210         -40     invalid <a href=dpans6.htm#6.1.0750>BASE</a> for floating point conversion
    211         -41     loss of precision
    212         -42     floating-point divide by zero
    213         -43     floating-point result out of range
    214         -44     floating-point stack overflow
    215         -45     floating-point stack underflow
    216         -46     floating-point invalid argument
    217         -47     compilation word list deleted
    218         -48     invalid <a href=dpans6.htm#6.1.2033>POSTPONE</a>
    219         -49     search-order overflow
    220         -50     search-order underflow
    221         -51     compilation word list changed
    222         -52     control-flow stack overflow
    223         -53     exception stack overflow
    224         -54     floating-point underflow
    225         -55     floating-point unidentified fault
    226         -56     <a href=dpans6.htm#6.1.2050>QUIT</a>
    227         -57     exception in sending or receiving a character
    228         -58     <a href=dpans15.htm#15.6.2.2532>[IF]</a>, <a href=dpans15.htm#15.6.2.2531>[ELSE]</a>, or <a href=dpans15.htm#15.6.2.2533>[THEN]</a> exception
    229 </PRE>
    230 
    231 <P>
    232 
    233 <hr>
    234 <A name=9.3.6>
    235 <H3>9.3.6 Exception handling</H3>
    236 </a>
    237 
    238 There are several methods of coupling 
    239 <a href=dpans9.htm#9.6.1.0875>CATCH</a> and 
    240 <a href=dpans9.htm#9.6.1.2275>THROW</a> to other
    241 procedural nestings.  The usual nestings are the execution of
    242 definitions, use of the return stack, use of loops, instantiation of
    243 locals and nesting of input sources (i.e., with 
    244 <a href=dpans7.htm#7.6.1.1790>LOAD</a>, 
    245 <a href=dpans6.htm#6.1.1360>EVALUATE</a>, or
    246 <a href=dpans11.htm#11.6.1.1717>INCLUDE-FILE</a>).
    247 <P>
    248 
    249 When a THROW returns control to a CATCH, the system shall un-nest not
    250 only definitions, but also, if present, locals and input source
    251 specifications, to return the system to its proper state for continued
    252 execution past the CATCH.
    253 <P>
    254 <code>
    255 See:
    256 <a href=dpansa9.htm#A.9.3.6>A.9.3.6</a> Exception handling
    257 </code>
    258 <p>
    259 
    260 
    261 <hr>
    262 <A name=9.4>
    263 <H2>9.4 Additional documentation requirements</H2>
    264 </a>
    265 
    266 
    267 
    268 <hr>
    269 <A name=9.4.1>
    270 <H3>9.4.1 System documentation</H3>
    271 </a>
    272 
    273 
    274 
    275 <hr>
    276 <A name=9.4.1.1>
    277 <H3>9.4.1.1 Implementation-defined options</H3>
    278 </a>
    279 
    280 <UL>
    281 <LI>Values used in the system by 
    282 <a href=dpans9.htm#9.6.1.0875>9.6.1.0875</a> CATCH and 
    283 <a href=dpans9.htm#9.6.1.2275>9.6.1.2275</a> THROW
    284 (<a href=dpans9.htm#9.3.1>9.3.1</a> THROW values, 
    285 <a href=dpans9.htm#9.3.5>9.3.5</a> 
    286 Possible actions on an ambiguous condition).
    287 </UL>
    288 <P>
    289 
    290 
    291 <hr>
    292 <A name=9.4.1.2>
    293 <H3>9.4.1.2 Ambiguous conditions</H3>
    294 </a>
    295 
    296 <UL>
    297 <LI>no additional requirements.
    298 </UL>
    299 <P>
    300 
    301 
    302 <hr>
    303 <A name=9.4.1.3>
    304 <H3>9.4.1.3 Other system documentation</H3>
    305 </a>
    306 
    307 <UL>
    308 <LI>no additional requirements.
    309 </UL>
    310 
    311 <P>
    312 
    313 
    314 <hr>
    315 <A name=9.4.2>
    316 <H3>9.4.2 Program documentation</H3>
    317 </a>
    318 
    319 <UL>
    320 <LI>no additional requirements.
    321 </UL>
    322 
    323 
    324 <hr>
    325 <A name=9.5>
    326 <H2>9.5 Compliance and labeling</H2>
    327 </a>
    328 
    329 
    330 
    331 <hr>
    332 <A name=9.5.1>
    333 <H3>9.5.1 ANS Forth systems</H3>
    334 </a>
    335 
    336 The phrase <B>Providing the Exception word set</B> shall be appended to
    337 the label of any Standard System that provides all of the Exception word
    338 set.
    339 <P>
    340 
    341 The phrase <B>Providing name(s) from the Exception Extensions word
    342 set</B> shall be appended to the label of any Standard System that
    343 provides portions of the Exception Extensions word set.
    344 <P>
    345 
    346 The phrase <B>Providing the Exception Extensions word set</B> shall be
    347 appended to the label of any Standard System that provides all of the
    348 Exception and Exception Extensions word sets.
    349 <P>
    350 
    351 
    352 
    353 <hr>
    354 <A name=9.5.2>
    355 <H3>9.5.2 ANS Forth programs</H3>
    356 </a>
    357 
    358 The phrase <B>Requiring the Exception word set</B> shall be appended to
    359 the label of Standard Programs that require the system to provide the
    360 Exception word set.
    361 <P>
    362 
    363 The phrase <B>Requiring name(s) from the Exception Extensions word
    364 set</B> shall be appended to the label of Standard Programs that require
    365 the system to provide portions of the Exception Extensions word set.
    366 <P>
    367 
    368 The phrase <B>Requiring the Exception Extensions word set</B> shall be
    369 appended to the label of Standard Programs that require the system to
    370 provide all of the Exception and Exception Extensions word sets.
    371 
    372 <P>
    373 
    374 
    375 <hr>
    376 <A name=9.6>
    377 <H2>9.6 Glossary</H2>
    378 </a>
    379 
    380 
    381 <hr>
    382 <A name=9.6.1>
    383 <H3>9.6.1 Exception words</H3>
    384 </a>
    385 
    386 
    387 
    388 <hr>
    389 <A name=9.6.1.0875>
    390 <code>
    391 9.6.1.0875 <b>CATCH</b>
    392 </code>
    393 </a>
    394 <BR>
    395 EXCEPTION
    396 <BR>
    397 <pre>
    398 	( i*x xt -- j*x 0 | i*x n )
    399 </pre>
    400 <P>
    401 
    402 Push an exception frame on the exception stack and then execute the
    403 execution token xt (as with 
    404 <a href=dpans6.htm#6.1.1370>EXECUTE</a>) 
    405 in such a way that control can be
    406 transferred to a point just after CATCH if 
    407 <a href=dpans9.htm#9.6.1.2275>THROW</a> is executed during the
    408 execution of xt.
    409 <P>
    410 
    411 If the execution of xt completes normally (i.e., the exception frame
    412 pushed by this CATCH is not popped by an execution of THROW) pop the
    413 exception frame and return zero on top of the data stack, above whatever
    414 stack items would have been returned by xt EXECUTE.  Otherwise, the
    415 remainder of the execution semantics are given by THROW.
    416 
    417 <P>
    418 
    419 <hr>
    420 <A name=9.6.1.2275>
    421 <code>
    422 9.6.1.2275 <b>THROW</b>
    423 </code>
    424 </a>
    425 <BR>
    426 EXCEPTION
    427 <BR>
    428 <pre>
    429 	( k*x n -- k*x | i*x n )
    430 </pre>
    431 <P>
    432 
    433 If any bits of n are non-zero, pop the topmost exception frame from the
    434 exception stack, along with everything on the return stack above that
    435 frame.  Then restore the input source specification in use before the
    436 corresponding 
    437 <a href=dpans9.htm#9.6.1.0875>CATCH</a> 
    438 and adjust the depths of all stacks defined by this
    439 Standard so that they are the same as the depths saved in the exception
    440 frame (i is the same number as the i in the input arguments to the
    441 corresponding CATCH), put n on top of the data stack, and transfer
    442 control to a point just after the CATCH that pushed that exception
    443 frame.
    444 <P>
    445 
    446 If the top of the stack is non zero and there is no exception frame on
    447 the exception stack, the behavior is as follows:
    448 <P>
    449 
    450 If n is minus-one (-1), perform the function of 
    451 <a href=dpans6.htm#6.1.0670>6.1.0670</a> ABORT (the
    452 version of ABORT in the Core word set), displaying no message.
    453 <P>
    454 
    455 If n is minus-two, perform the function of 
    456 <a href=dpans6.htm#6.1.0680>6.1.0680</a> ABORT" (the version
    457 of ABORT" in the Core word set), displaying the characters ccc
    458 associated with the ABORT" that generated the THROW.
    459 <P>
    460 
    461 Otherwise, the system may display an implementation-dependent message
    462 giving information about the condition associated with the THROW code n.
    463 Subsequently, the system shall perform the function of 
    464 <a href=dpans6.htm#6.1.0670>6.1.0670</a> ABORT
    465 (the version of ABORT in the Core word set).
    466 <P>
    467 
    468 <p>
    469 <code>
    470 See:
    471 <a href=dpansa9.htm#A.9.6.1.2275>A.9.6.1.2275 THROW</a>
    472 </code>
    473 <p>
    474 
    475 <hr>
    476 <A name=9.6.2>
    477 <H3>9.6.2 Exception extension words</H3>
    478 </a>
    479 
    480 <hr>
    481 <A name=9.6.2.0670>
    482 <code>
    483 9.6.2.0670 <b>ABORT</b>
    484 </code>
    485 </a>
    486 <br>
    487 EXCEPTION EXT
    488 <P>
    489 
    490 Extend the semantics of 
    491 <a href=dpans6.htm#6.1.0670>6.1.0670</a> ABORT to be:
    492 <P>
    493 
    494 <pre>
    495 	( i*x -- ) ( R: j*x -- )
    496 </pre>
    497 <P>
    498 
    499 Perform the function of -1 
    500 <a href=dpans9.htm#9.6.1.2275>THROW</a> .
    501 <P>
    502 
    503 
    504 <hr>
    505 <A name=9.6.2.0680>
    506 <code>
    507 9.6.2.0680 <b>ABORT"</b>
    508 </code>
    509 </a>
    510 <br>
    511 <B>abort-quote</B>   EXCEPTION EXT
    512 <P>
    513 Extend the semantics of 
    514 <a href=dpans6.htm#6.1.0680>6.1.0680</a> ABORT" to be:
    515 <P>
    516 <pre>
    517         Interpretation: Interpretation semantics for this word are undefined.
    518 </pre>
    519 <P>
    520 <pre>
    521         Compilation: ( <B>"ccc&lt;quote&gt;"</B> -- )
    522 </pre>
    523 <P>
    524 
    525 Parse ccc delimited by a " (double-quote).  Append the run-time semantics
    526 given below to the current definition.
    527 <P>
    528 
    529 <pre>
    530         Run-time:       ( i*x x1 --  | i*x ) ( R: j*x --  | j*x )
    531 </pre>
    532 <P>
    533 
    534 Remove x1 from the stack.  If any bit of x1 is not zero, perform the function
    535 of -2 
    536 <a href=dpans9.htm#9.6.1.2275>THROW</a>, 
    537 displaying ccc if there is no exception frame on the exception
    538 stack.
    539 <P>
    540 
    541 <code>
    542 See:
    543 <A href=dpans3.htm#3.4.1>3.4.1</a> Parsing
    544 </code>
    545 <P>
    546 
    547 
    548 <hr>
    549 <A href=dpans.htm#toc><IMG   src="up.gif" ></A>    Table of Contents 
    550 <BR>
    551 <A href=dpans10.htm><IMG   src="right.gif" ></A>
    552 Next Section
    553 <P>
    554 </BODY>
    555 </HTML>