umouse

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

DPANS7.HTM (14931B)


      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=dpans6.htm><img src=left.gif
     12  width=26 height=26 align=ALIGN border=0></a>
     13 <a href=dpans8.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=7.>Table of Contents</a>
     20 </td>
     21 </tr>
     22 </table>
     23 <p>
     24 <hr size=4>
     25 
     26 <H1>7. The optional Block word set</H1>
     27 
     28 <code>
     29 See:
     30 <a href=dpansa7.htm#A.7>A.7</a> The optional Block word set
     31 </code>
     32 
     33 <hr>
     34 <A name=7.1>
     35 <H2>7.1 Introduction</H2>
     36 </a>
     37 
     38 
     39 <hr>
     40 <A name=7.2>
     41 <H2>7.2 Additional terms</H2>
     42 </a>
     43 
     44 <DL><DT><B>block:</B>  <DD>1024 characters of data on mass
     45 storage, designated by a block number.
     46 <DT><B>block buffer:</B> <DD>A block-sized region of data space where a block
     47 is
     48 made temporarily available for use.  The current block buffer is the
     49 block buffer most recently accessed by 
     50 <a href=dpans7.htm#7.6.1.0800>BLOCK</a>, 
     51 <a href=dpans7.htm#7.6.1.0820>BUFFER</a>, 
     52 <a href=dpans7.htm#7.6.1.1790>LOAD</a>, 
     53 <a href=dpans7.htm#7.6.2.1770>LIST</a>, or
     54 <a href=dpans7.htm#7.6.2.2280>THRU</a>.
     55 </DL>
     56 
     57 <P>
     58 <code>
     59 See:
     60 <a href=dpansa7.htm#A.7.2>A.7.2</a> Additional terms
     61 </code>
     62 
     63 <hr>
     64 <A name=7.3>
     65 <H2>7.3 Additional usage requirements</H2>
     66 </a>
     67 
     68 
     69 <hr>
     70 <A name=7.3.1>
     71 <H3>7.3.1 Environmental queries</H3>
     72 </a>
     73 
     74 Append table 7.1
     75 to table 3.5.
     76 <P>
     77 <code>
     78 See:
     79 <A href=dpans3.htm#3.2.6>3.2.6</a> Environmental queries
     80 </code>
     81 <P>
     82 
     83 Table 7.1 - Environmental Query Strings
     84 
     85 
     86 <PRE>
     87 String          Value data type  Constant?       Meaning
     88 ------          ---------------  ---------       -------
     89 BLOCK           flag             no              block word set present
     90 BLOCK-EXT       flag             no              block extensions word set present
     91 
     92 </PRE>
     93 <P>
     94 
     95 <hr>
     96 <A name=7.3.2>
     97 <H3>7.3.2 Data space</H3>
     98 </a>
     99 
    100 A program may access memory
    101 within a valid block buffer.
    102 <P>
    103 <code>
    104 See:
    105 <A href=dpans3.htm#3.3.3>3.3.3</a> Data Space
    106 </code>
    107 
    108 <P>
    109 
    110 <hr>
    111 <A name=7.3.3>
    112 <H3>7.3.3 Block buffer regions</H3>
    113 </a>
    114 
    115 The address of a block buffer returned by 
    116 <a href=dpans7.htm#7.6.1.0800>BLOCK</a> or 
    117 <a href=dpans7.htm#7.6.1.0820>BUFFER</a> is transient.
    118 A call to BLOCK or BUFFER may render a previously-obtained block-buffer
    119 address invalid, as may a call to any word that:
    120 <P>
    121 
    122 <UL>
    123 <LI>parses:
    124 <LI>displays characters on the user output device, such as 
    125 <a href=dpans6.htm#6.1.2310>TYPE</a> or 
    126 <a href=dpans6.htm#6.1.1320>EMIT</a>;
    127 <LI>controls the user output device, such as 
    128 <a href=dpans6.htm#6.1.0990>CR</a> or 
    129 <a href=dpans10.htm#10.6.1.0742>AT-XY</a>;
    130 <LI>receives or tests for the presence of characters from the user input
    131 device such as 
    132 <a href=dpans6.htm#6.1.0695>ACCEPT</a> or 
    133 <a href=dpans6.htm#6.1.1750>KEY</a>;
    134 <LI>waits for a condition or event, such as 
    135 <a href=dpans10.htm#10.6.2.1905>MS</a> or 
    136 <a href=dpans10.htm#10.6.2.1305>EKEY</a>;
    137 <LI>manages the block buffers, such as 
    138 <a href=dpans7.htm#7.6.1.1559>FLUSH</a>, 
    139 <a href=dpans7.htm#7.6.1.2180>SAVE-BUFFERS</a>, or
    140 <a href=dpans7.htm#7.6.2.1330>EMPTY-BUFFERS</a>;
    141 <LI>performs any operation on a file or file-name directory that implies
    142 I/O, such as 
    143 <a href=dpans6.htm#6.2.2125>REFILL</a> or any word that returns an ior;
    144 <LI>implicitly performs I/O, such as text interpreter nesting and
    145 un-nesting when files are being used (including un-nesting implied by 
    146 <a href=dpans9.htm#9.6.1.2275>THROW</a>).
    147 </UL>
    148 <P>
    149 
    150 If the input source is a block, these restrictions also apply to the address
    151 returned by 
    152 <a href=dpans6.htm#6.1.2216>SOURCE</a>.
    153 <P>
    154 
    155 Block buffers are
    156 uniquely assigned to blocks.
    157 
    158 <P>
    159 
    160 
    161 <hr>
    162 <A name=7.3.4>
    163 <H3>7.3.4 Parsing</H3>
    164 </a>
    165 
    166 The Block word set implements an alternative input source for the text
    167 interpreter.  When the input source is a block, 
    168 <a href=dpans7.htm#7.6.1.0790>BLK</a> shall contain the
    169 non-zero block number and the input buffer is the 1024-character buffer
    170 containing that block.
    171 <P>
    172 
    173 A block is conventionally displayed
    174 as 16 lines of 64 characters.
    175 <P>
    176 
    177 A program may switch the input source to a block by using 
    178 <a href=dpans7.htm#7.6.1.1790>LOAD</a> or 
    179 <a href=dpans7.htm#7.6.2.2280>THRU</a>.
    180 Input sources may be nested using LOAD and 
    181 <a href=dpans6.htm#6.1.1360>EVALUATE</a> in any order.
    182 <P>
    183 
    184 A program may reposition the parse area within a block by manipulating
    185 <a href=dpans6.htm#6.1.0560>&gt;IN</a>.  
    186 More extensive repositioning can be accomplished using 
    187 <a href=dpans6.htm#6.2.2182>SAVE-INPUT</a>
    188 and 
    189 <a href=dpans6.htm#6.2.2148>RESTORE-INPUT</a>.
    190 <P>
    191 <code>
    192 See:
    193 <A href=dpans3.htm#3.4.1>3.4.1</a> Parsing
    194 </code>
    195 <P>
    196 
    197 
    198 <hr>
    199 <A name=7.3.5>
    200 <H3>7.3.5 Possible action on an ambiguous condition</H3>
    201 </a>
    202 <p>
    203 <UL>
    204 <LI>A system with the Block word set may set interpretation state and interpret
    205 a block.
    206 </UL>
    207 
    208 <code>
    209 See:
    210 <A href=dpans3.htm#3.4.4>3.4.4</a> Possible action on an ambiguous
    211 condition
    212 </code>
    213 <P>
    214 
    215 <hr>
    216 <A name=7.4>
    217 <H2>7.4 Additional documentation requirements</H2>
    218 </a>
    219 
    220 
    221 <hr>
    222 <A name=7.4.1>
    223 <H3>7.4.1 System documentation</H3>
    224 </a>
    225 
    226 
    227 <hr>
    228 <A name=7.4.1.1>
    229 <H4>7.4.1.1 Implementation-defined options</H4>
    230 </a>
    231 
    232 <UL>
    233 <LI>the format used for display by 
    234 <a href=dpans7.htm#7.6.2.1770>7.6.2.1770</a> LIST (if implemented);
    235 <LI>the length of a line affected by 
    236 <a href=dpans7.htm#7.6.2.2535>7.6.2.2535</a> \ (if implemented).
    237 </UL>
    238 <P>
    239 
    240 
    241 <hr>
    242 <A name=7.4.1.2>
    243 <H4>7.4.1.2 Ambiguous conditions</H4>
    244 </a>
    245 
    246 <UL>
    247 <LI>Correct block read was not possible;
    248 <LI>I/O exception in block transfer;
    249 <LI>Invalid block number 
    250 (<a href=dpans7.htm#7.6.1.0800>7.6.1.0800</a> BLOCK, 
    251 <a href=dpans7.htm#7.6.1.0820>7.6.1.0820</a> BUFFER, 
    252 <a href=dpans7.htm#7.6.1.1790>7.6.1.1790</a> LOAD);
    253 <LI>A program directly alters the contents of 
    254 <a href=dpans7.htm#7.6.1.0790>7.6.1.0790</a> BLK;
    255 <LI>No current block buffer for 
    256 <a href=dpans7.htm#7.6.1.2400>7.6.1.2400</a> UPDATE.
    257 </UL>
    258 
    259 <P>
    260 
    261 
    262 <hr>
    263 <A name=7.4.1.3>
    264 <H4>7.4.1.3 Other system documentation</H4>
    265 </a>
    266 
    267 <UL>
    268 <LI>any restrictions a multiprogramming system places on the use of buffer
    269 addresses;
    270 <LI>the number of blocks available for source text and data.
    271 </UL>
    272 <P>
    273 
    274 
    275 <hr>
    276 <A name=7.4.2>
    277 <H3>7.4.2 Program documentation</H3>
    278 </a>
    279 
    280 <UL>
    281 <LI>the number of blocks required by the program.
    282 </UL>
    283 <P>
    284 
    285 
    286 <hr>
    287 <A name=7.5>
    288 <H2>7.5 Compliance and labeling</H2>
    289 </a>
    290 
    291 
    292 <hr>
    293 <A name=7.5.1>
    294 <H3>7.5.1 ANS Forth systems</H3>
    295 </a>
    296 
    297 The phrase <B>Providing the Block word set</B> shall be appended to the
    298 label of any Standard System that provides all of the Block word set.
    299 <P>
    300 
    301 The phrase <B>Providing name(s) from the Block Extensions word set</B>
    302 shall be appended to the label of any Standard System that provides
    303 portions of the Block Extensions word set.
    304 <P>
    305 
    306 The phrase <B>Providing the Block Extensions word set</B> shall be
    307 appended to the label of any Standard System that provides all of the
    308 Block and Block Extensions word sets.
    309 <P>
    310 
    311 
    312 <hr>
    313 <A name=7.5.2>
    314 <H3>7.5.2 ANS Forth programs</H3>
    315 </a>
    316 
    317 The phrase <B>Requiring the Block word set</B> shall be appended to the
    318 label of Standard Programs that require the system to provide the Block
    319 word set.
    320 <P>
    321 
    322 The phrase <B>Requiring name(s) from the Block Extensions word set</B>
    323 shall be appended to the label of Standard Programs that require the
    324 system to provide portions of the Block Extensions word set.
    325 <P>
    326 
    327 The phrase <B>Requiring the Block Extensions word set</B> shall be
    328 appended to the label of Standard Programs that require the system to
    329 provide all of the Block and Block Extensions word sets.
    330 <P>
    331 
    332 
    333 <hr>
    334 <A name=7.6>
    335 <H2>7.6 Glossary</H2>
    336 </a>
    337 
    338 
    339 <hr>
    340 <A name=7.6.1>
    341 <H3>7.6.1 Block words</H3>
    342 </a>
    343 
    344 
    345 <hr>
    346 <A name=7.6.1.0790>
    347 <code>
    348 7.6.1.0790 <b>BLK</b>
    349 </code>
    350 </a>
    351 <BR>
    352 <B>b-l-k</B> BLOCK
    353 <BR>
    354 <pre>
    355 	( -- a-addr )
    356 </pre>
    357 
    358 <P>
    359 
    360 a-addr is the address of a cell containing zero or the number of the
    361 mass-storage block being interpreted.  If BLK contains zero, the input
    362 source is not a block and can be identified by 
    363 <a href=dpans6.htm#6.2.2218>SOURCE-ID</a>, if SOURCE-ID
    364 is available.  An ambiguous condition exists if a program directly
    365 alters the contents of BLK.
    366 
    367 <p>
    368 <code>
    369 See:
    370 <A href=dpans7.htm#7.3.3>7.3.3</a> Block buffer regions
    371 </code>
    372 <p>
    373 
    374 <hr>
    375 <A name=7.6.1.0800>
    376 <code>
    377 7.6.1.0800 <b>BLOCK</b>
    378 </code>
    379 </a>
    380 <BR>
    381 BLOCK
    382 <BR>
    383 <pre>
    384 	( u -- a-addr )
    385 </pre>
    386 
    387 <P>
    388 
    389 a-addr is the address of the first character of the block buffer assigned to
    390 mass-storage block u.  An ambiguous condition exists if u is not an available
    391 block number.
    392 <P>
    393 
    394 If block u is already in a block buffer, a-addr is the address of that block
    395 buffer.
    396 <P>
    397 
    398 If block u is not already in memory and there is an unassigned block buffer,
    399 transfer block u from mass storage to an unassigned block buffer.  a-addr is
    400 the address of that block buffer.
    401 <P>
    402 
    403 If block u is not already in memory and there are no unassigned block buffers,
    404 unassign a block buffer.  If the block in that buffer has been 
    405 <a href=dpans7.htm#7.6.1.2400>UPDATE</a>d,
    406 transfer the block to mass storage and transfer block u from mass storage into
    407 that buffer.  a-addr is the address of that block buffer.
    408 <P>
    409 
    410 At the conclusion of the operation, the block buffer pointed to by a-addr is
    411 the current block buffer and is assigned to u.
    412 
    413 <P>
    414 
    415 <hr>
    416 <A name=7.6.1.0820>
    417 <code>
    418 7.6.1.0820 <b>BUFFER</b>
    419 </code>
    420 </a>
    421 <BR>
    422 BLOCK
    423 <BR>
    424 <pre>
    425 	( u -- a-addr )
    426 </pre>
    427 
    428 <P>
    429 
    430 a-addr is the address of the first character of the block buffer
    431 assigned to block u.  The contents of the block are unspecified.  An
    432 ambiguous condition exists if u is not an available block number.
    433 <P>
    434 
    435 If block u is already in a block buffer, a-addr is the address of that
    436 block buffer.
    437 <P>
    438 
    439 If block u is not already in memory and there is an unassigned buffer,
    440 a-addr is the address of that block buffer.
    441 <P>
    442 
    443 If block u is not already in memory and there are no unassigned block
    444 buffers, unassign a block buffer.  If the block in that buffer has been
    445 <a href=dpans7.htm#7.6.1.2400>UPDATE</a>d, 
    446 transfer the block to mass storage.  a-addr is the address of
    447 that block buffer.
    448 <P>
    449 
    450 At the conclusion of the operation, the block buffer pointed to by
    451 a-addr is the current block buffer and is assigned to u.
    452 <P>
    453 
    454 <code>
    455 See:    
    456 <A href=dpans7.htm#7.6.1.0800>7.6.1.0800 BLOCK</a>
    457 </code>
    458 
    459 <P>
    460 
    461 <hr>
    462 <A name=7.6.1.1360>
    463 <code>
    464 7.6.1.1360E <b>EVALUATE</b>
    465 </code>
    466 </a>
    467 <BR>
    468 BLOCK
    469 <BR>
    470 <P>
    471 
    472 Extend the semantics of 
    473 <a href=dpans6.htm#6.1.1360>6.1.1360</a> EVALUATE to include:
    474 <P>
    475 
    476 	Store zero in BLK.
    477 
    478 <P>
    479 
    480 <hr>
    481 <A name=7.6.1.1559>
    482 <code>
    483 7.6.1.1559 <b>FLUSH</b>
    484 </code>
    485 </a>
    486 <BR>
    487 BLOCK
    488 <BR>
    489 <pre>
    490 	( -- )
    491 </pre>
    492 
    493 <P>
    494 
    495 Perform the function of 
    496 <a href=dpans7.htm#7.6.1.2180>SAVE-BUFFERS</a>,
    497 then unassign all block buffers.
    498 
    499 <P>
    500 
    501 <hr>
    502 <A name=7.6.1.1790>
    503 <code>
    504 7.6.1.1790 <b>LOAD</b>
    505 </code>
    506 </a>
    507 <BR>
    508 BLOCK
    509 <BR>
    510 <pre>
    511 	( i*x u -- j*x )
    512 </pre>
    513 
    514 <P>
    515 
    516 Save the current input-source specification.  Store u in 
    517 <a href=dpans7.htm#7.6.1.0790>BLK</a> (thus
    518 making block u the input source and setting the input buffer to
    519 encompass its contents), set 
    520 <a href=dpans6.htm#6.1.0560>&gt;IN</a> 
    521 to zero, and interpret.  When the parse
    522 area is exhausted, restore the prior input source specification.  Other
    523 stack effects are due to the words LOADed.
    524 <P>
    525 
    526 An ambiguous condition exists if u is zero or is not a valid block
    527 number.
    528 <P>
    529 
    530 <code>
    531 See:
    532 <A href=dpans3.htm#3.4>3.4</a> The Forth text interpreter
    533 </code>
    534 
    535 <P>
    536 
    537 <hr>
    538 <A name=7.6.1.2180>
    539 <code>
    540 7.6.1.2180 <b>SAVE-BUFFERS</b>
    541 </code>
    542 </a>
    543 <BR>
    544 BLOCK
    545 <BR>
    546 <pre>
    547 	( -- )
    548 </pre>
    549 
    550 <P>
    551 
    552 Transfer the contents of each 
    553 <a href=dpans7.htm#7.6.1.2400>UPDATE</a>d block buffer to mass storage.
    554 Mark all buffers as unmodified.
    555 
    556 <P>
    557 
    558 <hr>
    559 <A name=7.6.1.2400>
    560 <code>
    561 7.6.1.2400 <b>UPDATE</b>
    562 </code>
    563 </a>
    564 <BR>
    565 BLOCK
    566 <BR>
    567 <pre>
    568 	( -- )
    569 </pre>
    570 
    571 <P>
    572 
    573 Mark the current block buffer as modified.  An ambiguous condition
    574 exists if there is no current block buffer.
    575 <P>
    576 
    577 UPDATE does not immediately cause I/O.
    578 <P>
    579 
    580 <code>
    581 See:    
    582 <A href=dpans7.htm#7.6.1.0800>7.6.1.0800 BLOCK</a> ,
    583 <A href=dpans7.htm#7.6.1.0820>7.6.1.0820 BUFFER</a> ,
    584 <A href=dpans7.htm#7.6.1.1559>7.6.1.1559 FLUSH</a> ,
    585 <A href=dpans7.htm#7.6.1.2180>7.6.1.2180 SAVE-BUFFERS</a>
    586 </code>
    587 
    588 <P>
    589 
    590 <hr>
    591 <A name=7.6.2>
    592 <H3>7.6.2 Block extension words</H3>
    593 </a>
    594 
    595 <hr>
    596 <A name=7.6.2.1330>
    597 <code>
    598 7.6.2.1330 <b>EMPTY-BUFFERS</b>
    599 </code>
    600 </a>
    601 <BR>
    602 BLOCK EXT
    603 <BR>
    604 <pre>
    605 	( -- )
    606 </pre>
    607 
    608 <P>
    609 
    610 Unassign all block buffers.  Do not transfer the contents of any 
    611 <a href=dpans7.htm#7.6.1.2400>UPDATE</a>d
    612 block buffer to mass storage.
    613 <P>
    614 
    615 <code>
    616 See:    
    617 <A href=dpans7.htm#7.6.1.0800>7.6.1.0800 BLOCK</a>
    618 </code>
    619 
    620 <P>
    621 
    622 <hr>
    623 <A name=7.6.2.1770>
    624 <code>
    625 7.6.2.1770 <b>LIST</b>
    626 </code>
    627 </a>
    628 <BR>
    629 BLOCK EXT
    630 <BR>
    631 <pre>
    632 	( u -- )
    633 </pre>
    634 
    635 <P>
    636 
    637 Display block u in an
    638 implementation-defined format.  Store u in 
    639 <a href=dpans7.htm#7.6.2.2190>SCR</a>.
    640 <P>
    641 
    642 <code>
    643 See:    
    644 <A href=dpans7.htm#7.6.1.0800>7.6.1.0800 BLOCK</a>
    645 </code>
    646 
    647 <P>
    648 
    649 <hr>
    650 <A name=7.6.2.2125>
    651 <code>
    652 7.6.2.2125 <b>REFILL</b>
    653 </code>
    654 </a>
    655 <BR>
    656 BLOCK EXT
    657 <BR>
    658 <pre>
    659 	( -- flag )
    660 </pre>
    661 
    662 <P>
    663 
    664 Extend the execution semantics of 
    665 <a href=dpans6.htm#6.2.2125>6.2.2125</a> REFILL with the following:
    666 <P>
    667 
    668 When the input source is a block, make the next block the input source
    669 and current input buffer by adding one to the value of 
    670 <a href=dpans7.htm#7.6.1.0790>BLK</a> and setting
    671 <a href=dpans6.htm#6.1.0560>&gt;IN</a> to zero.  Return true if the new value of BLK is a valid block
    672 number, otherwise false.
    673 <P>
    674 
    675 <code>
    676 See:    
    677 <A href=dpans11.htm#11.6.2.2125>11.6.2.2125 REFILL</a>
    678 </code>
    679 
    680 <P>
    681 
    682 <hr>
    683 <A name=7.6.2.2190>
    684 <code>
    685 7.6.2.2190 <b>SCR</b>
    686 </code>
    687 </a>
    688 <BR>
    689 <B>s-c-r</B> BLOCK EXT
    690 <BR>
    691 <pre>
    692 	( -- a-addr )
    693 </pre>
    694 
    695 <P>
    696 
    697 a-addr is the address of a cell containing the block number of the block
    698 most recently 
    699 <a href=dpans7.htm#7.6.2.1770>LIST</a>ed.
    700 
    701 <P>
    702 <code>
    703 See:
    704 <a href=dpansa7.htm#A.7.6.2.2190>A.7.6.2.2190 SCR</a>
    705 </code>
    706 <p>
    707 
    708 <hr>
    709 <A name=7.6.2.2280>
    710 <code>
    711 7.6.2.2280 <b>THRU</b>
    712 </code>
    713 </a>
    714 <BR>
    715 BLOCK EXT
    716 <BR>
    717 <pre>
    718 	( i*x u1 u2 -- j*x )
    719 </pre>
    720 
    721 <P>
    722 
    723 <a href=dpans7.htm#7.6.1.1790>LOAD</a> 
    724 the mass storage blocks numbered u1 through u2 in sequence.  Other
    725 stack effects are due to the words LOADed.
    726 
    727 <P>
    728 
    729 <hr>
    730 <A name=7.6.2.2535>
    731 <code>
    732 7.6.2.2535 <b>\</b>
    733 </code>
    734 </a>
    735 <BR>
    736 <B>backslash</B>     BLOCK EXT
    737 <BR>
    738 <P>
    739 
    740 Extend the semantics of 
    741 <a href=dpans6.htm#6.2.2535>6.2.2535</a> \ to be:
    742 <P>
    743 <pre>
    744         Compilation: Perform the execution semantics given below.
    745 </pre>
    746 <P>
    747 <pre>
    748         Execution: ( <B>ccc&lt;eol&gt;</B>-- )
    749 </pre>
    750 <P>
    751 
    752 If 
    753 <a href=dpans7.htm#7.6.1.0790>BLK</a> 
    754 contains zero, parse and discard the remainder of the parse area;
    755 otherwise parse and discard the portion of the parse area corresponding
    756 to the remainder of the current line.  \ is an immediate word.
    757 
    758 
    759 <hr>
    760 <A href=dpans.htm#toc><IMG   src="up.gif" ></A>    Table of Contents 
    761 <BR>
    762 <A href=dpans8.htm><IMG   src="right.gif" ></A>
    763 Next Section
    764 <P>
    765 </BODY>
    766 </HTML>