DPANS16.HTM (13437B)
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=dpans15.htm><img src=left.gif 12 width=26 height=26 align=ALIGN border=0></a> 13 <a href=dpans17.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=16.>Table of Contents</a> 20 </td> 21 </tr> 22 </table> 23 <p> 24 <hr size=4> 25 26 <H1>16. The optional Search-Order word set</H1> 27 28 <p> 29 <code> 30 See: 31 <a href=dpansa16.htm>A.16</a> The optional Search-Order word set 32 </code> 33 <p> 34 35 <hr> 36 <A name=16.1> 37 <H2>16.1 Introduction</H2> 38 </a> 39 40 <hr> 41 <A name=16.2> 42 <H2>16.2 Additional terms and notation</H2> 43 </a> 44 45 <DL><DT><B>compilation word list:</B> 46 <DD>The word list into which new definition names are 47 placed. 48 49 <DT><B>search order:</B> 50 <DD>A list of word lists specifying the order in which the 51 dictionary will be searched.</DL> 52 53 <p> 54 <code> 55 See: 56 <a href=dpansa16.htm#A.16.2>A.16.2</a> Additional terms 57 </code> 58 <p> 59 60 <hr> 61 <A name=16.3> 62 <H2>16.3 Additional usage requirements</H2> 63 </a> 64 65 <hr> 66 <A name=16.3.1> 67 <H3>16.3.1 Data types</H3> 68 </a> 69 70 Word list identifiers are implementation-dependent single-cell values 71 that identify word lists. 72 <P> 73 74 Append table 16.1 to 75 <a href=dpans3.htm#table.3.1>table 3.1</a>. 76 <P> 77 78 Table 16.1 - Data types 79 <P> 80 81 <PRE> 82 Symbol Data type Size on stack 83 ------ --------- ------------- 84 wid word list identifiers 1 cell 85 </PRE> 86 <P> 87 88 <code> 89 See: 90 <A href=dpans3.htm#3.1>3.1</a> Data types, 91 <A href=dpans3.htm#3.4.2>3.4.2</a> Finding definition names, 92 <A href=dpans3.htm#3.4>3.4</a> The Forth text interpreter. 93 </code> 94 <P> 95 96 <hr> 97 <A name=16.3.2> 98 <H3>16.3.2 Environmental queries</H3> 99 </a> 100 101 Append table 16.2 to table 3.5. 102 <P> 103 104 <code> 105 See: 106 <A href=dpans3.htm#3.2.6>3.2.6</a> Environmental queries 107 </code> 108 <P> 109 110 Table 16.2 - Environmental query strings 111 <P> 112 113 <PRE> 114 String Value data type Constant? Meaning 115 ------ --------------- --------- ------- 116 SEARCH-ORDER flag no search-order word set present 117 SEARCH-ORDER-EXT flag no search-order extensions word set present 118 WORDLISTS n yes maximum number of word lists usable 119 in the search order 120 121 </PRE> 122 123 <P> 124 125 <hr> 126 <A name=16.3.3> 127 <H3>16.3.3 Finding definition names</H3> 128 </a> 129 130 When searching a word list for a definition name, the system shall 131 search each word list from its last definition to its first. The search 132 may encompass only a single word list, as with 133 <a href=dpans16.htm#16.6.1.2192>SEARCH-WORDLIST</a>, or all 134 the word lists in the search order, as with the text interpreter and 135 <a href=dpans6.htm#6.1.1550>FIND</a>. 136 137 <P> 138 139 Changing the search order shall only affect the subsequent finding of 140 definition names in the dictionary. 141 142 <P> 143 144 A system with the Search-Order word set shall allow at least eight word 145 lists in the search order. 146 147 <P> 148 149 An ambiguous condition exists if a program changes the compilation word 150 list during the compilation of a definition or before modification of 151 the behavior of the most recently compiled definition with 152 <a href=dpans15.htm#15.6.2.0470>;CODE</a>, 153 <a href=dpans6.htm#6.1.1250>DOES></a>, 154 or 155 <a href=dpans6.htm#6.1.1710>IMMEDIATE</a>. 156 157 <P> 158 159 A program that requires more than eight word lists in the search order 160 has an environmental dependency. 161 162 <P> 163 164 <code> 165 See: 166 <A href=dpans3.htm#3.4.2>3.4.2</a> Finding definition names, 167 <a href=dpansa16.htm#A.16.3.3>A.16.3.3</a> Finding definition names. 168 </code> 169 <P> 170 171 <hr> 172 <A name=16.3.4> 173 <H3>16.3.4 Contiguous regions</H3> 174 </a> 175 176 The regions of data space produced by the operations described in 177 <a href=dpans3.htm#3.3.3.2>3.3.3.2</a> 178 Contiguous regions may be non-contiguous if 179 <a href=dpans16.htm#16.6.1.2460>WORDLIST</a> is executed 180 between allocations. 181 182 <P> 183 184 <hr> 185 <A name=16.4> 186 <H2>16.4 Additional documentation requirements</H2> 187 </a> 188 189 <hr> 190 <A name=16.4.1> 191 <H3>16.4.1 System documentation</H3> 192 </a> 193 194 <hr> 195 <A name=16.4.1.1> 196 <H4>16.4.1.1 Implementation-defined options</H4> 197 </a> 198 199 <UL> 200 <LI>maximum number of word lists in the search order 201 (<a href=dpans16.htm#16.3.3>16.3.3</a> Finding definition names, 202 <a href=dpans16.htm#16.6.1.2197>16.6.1.2197</a> SET-ORDER); 203 <LI>minimum search order 204 (<a href=dpans16.htm#16.6.1.2197>16.6.1.2197</a> SET-ORDER, 205 <a href=dpans16.htm#16.6.2.1965>16.6.2.1965</a> ONLY). 206 </UL> 207 <P> 208 209 <hr> 210 <A name=16.4.1.2> 211 <H4>16.4.1.2 Ambiguous conditions</H4> 212 </a> 213 214 <UL> 215 <LI>changing the compilation word list 216 (<a href=dpans16.htm#16.3.3>16.3.3</a> Finding definition names); 217 <LI>search order empty 218 (<a href=dpans16.htm#16.6.2.2037>16.6.2.2037</a> PREVIOUS); 219 <LI>too many word lists in search order 220 (<a href=dpans16.htm#16.6.2.0715>16.6.2.0715</a> ALSO). 221 </ul> 222 223 <hr> 224 <a name=16.4.1.3> 225 <h4>16.4.1.3 Other system documentation</h4> 226 </a> 227 <ul> 228 <li>no additional requirements. 229 </ul> 230 231 232 <hr> 233 <a name=16.4.2> 234 <h3>16.4.2 Program documentation</h3> 235 </a> 236 237 238 <hr> 239 <A name=16.4.2.1> 240 <H4>16.4.2.1 Environmental dependencies</H4> 241 </a> 242 243 <UL> 244 <LI>requiring more than eight word-lists in the search order 245 (<a href=dpans16.htm#16.3.3>16.3.3</a> Finding definition names). 246 </UL> 247 248 249 <hr> 250 <A name=16.4.2.2> 251 <H4>16.4.2.2 Other program documentation</H4> 252 </a> 253 254 <UL> 255 <LI>no additional requirements. 256 </UL> 257 258 <hr> 259 <A name=16.5> 260 <H2>16.5 Compliance and labeling</H2> 261 </a> 262 263 <hr> 264 <A name=16.5.1> 265 <H3>16.5.1 ANS Forth systems</H3> 266 </a> 267 268 The phrase <B>Providing the Search-Order word set</B> shall be appended 269 to the label of any Standard System that provides all of the 270 Search-Order word set. 271 272 <P> 273 274 The phrase <B>Providing name(s) from the Search-Order Extensions word 275 set</B> shall be appended to the label of any Standard System that 276 provides portions of the Search-Order Extensions word set. 277 278 <P> 279 280 The phrase <B>Providing the Search-Order Extensions word set</B> shall 281 be appended to the label of any Standard System that provides all of the 282 Search-Order and Search-Order Extensions word sets. 283 284 <P> 285 286 <hr> 287 <A name=16.5.2> 288 <H3>16.5.2 ANS Forth programs</H3> 289 </a> 290 291 The phrase <B>Requiring the Search-Order word set</B> shall be appended 292 to the label of Standard Programs that require the system to provide the 293 Search-Order word set. 294 295 <P> 296 297 The phrase <B>Requiring name(s) from the Search-Order Extensions word 298 set</B> shall be appended to the label of Standard Programs that require 299 the system to provide portions of the Search-Order Extensions word set. 300 301 <P> 302 303 The phrase <B>Requiring the Search-Order Extensions word set</B> shall 304 be appended to the label of Standard Programs that require the system to 305 provide all of the Search-Order and Search-Order Extensions word sets. 306 307 <P> 308 309 <hr> 310 <A name=16.6> 311 <H2>16.6 Glossary</H2> 312 </a> 313 314 <hr> 315 <A name=16.6.1> 316 <H3>16.6.1 Search-Order words</H3> 317 </a> 318 319 <hr> 320 <A name=16.6.1.1180> 321 <code> 322 16.6.1.1180 <b>DEFINITIONS</b> 323 </code> 324 </a> 325 <BR> 326 SEARCH 327 <BR> 328 <pre> 329 ( -- ) 330 </pre> 331 <P> 332 333 Make the compilation word list the same as the first word list in the 334 search order. Specifies that the names of subsequent definitions will 335 be placed in the compilation word list. Subsequent changes in the 336 search order will not affect the compilation word list. 337 338 <P> 339 340 <code> 341 See: 342 <A href=dpans16.htm#16.3.3>16.3.3</a> Finding Definition Names 343 </code> 344 345 <P> 346 347 <hr> 348 <A name=16.6.1.1550> 349 <code> 350 16.6.1.1550 <b>FIND</b> 351 </code> 352 </a> 353 <BR> 354 SEARCH 355 <BR> 356 <P> 357 358 Extend the semantics of 359 <a href=dpans6.htm#6.1.1550>6.1.1550</a> FIND to be: 360 <P> 361 362 <pre> 363 ( c-addr -- c-addr 0 | xt 1 | xt -1 ) 364 </pre> 365 <P> 366 367 Find the definition named in the counted string at c-addr. If the 368 definition is not found after searching all the word lists in the search 369 order, return c-addr and zero. If the definition is found, return xt. 370 If the definition is immediate, also return one (1); otherwise also 371 return minus-one (-1). For a given string, the values returned by FIND 372 while compiling may differ from those returned while not compiling. 373 374 <P> 375 376 <code> 377 See: 378 <A href=dpans3.htm#3.4.2>3.4.2</a> Finding definition names, 379 <A href=dpans6.htm#6.1.0070>6.1.0070 '</a> , 380 <A href=dpans6.htm#6.1.2033>6.1.2033 POSTPONE</a> , 381 <A href=dpans6.htm#6.1.2510>6.1.2510 [']</a> , 382 <A href=dpansd.htm#D.6.7>D.6.7</a> Immediacy. 383 </code> 384 385 <P> 386 387 <hr> 388 <A name=16.6.1.1595> 389 <code> 390 16.6.1.1595 <b>FORTH-WORDLIST</b> 391 </code> 392 </a> 393 <BR> 394 SEARCH 395 <BR> 396 <pre> 397 ( -- wid ) 398 </pre> 399 <P> 400 401 Return wid, the identifier of the word list that includes all standard 402 words provided by the implementation. This word list is initially the 403 compilation word list and is part of the initial search order. 404 405 <P> 406 407 <hr> 408 <A name=16.6.1.1643> 409 <code> 410 16.6.1.1643 <b>GET-CURRENT</b> 411 </code> 412 </a> 413 <BR> 414 SEARCH 415 <BR> 416 <pre> 417 ( -- wid ) 418 </pre> 419 <P> 420 421 Return wid, the identifier of the compilation word list. 422 <P> 423 424 <hr> 425 <A name=16.6.1.1647> 426 <code> 427 16.6.1.1647 <b>GET-ORDER</b> 428 </code> 429 </a> 430 <BR> 431 SEARCH 432 <BR> 433 <pre> 434 ( -- widn ... wid1 n ) 435 </pre> 436 <P> 437 438 Returns the number of word lists n in the search order and the word list 439 identifiers widn ... wid1 identifying these word lists. wid1 440 identifies the word list that is searched first, and widn the word list 441 that is searched last. The search order is unaffected. 442 443 <P> 444 <code> 445 See: 446 <a href=a0002.htm>RFI 0002</a> 447 </code> 448 <p> 449 450 <hr> 451 <A name=16.6.1.2192> 452 <code> 453 16.6.1.2192 <b>SEARCH-WORDLIST</b> 454 </code> 455 </a> 456 <BR> 457 SEARCH 458 <BR> 459 <pre> 460 ( c-addr u wid -- 0 | xt 1 | xt -1 ) 461 </pre> 462 <P> 463 464 Find the definition identified by the string c-addr u in the word list 465 identified by wid. If the definition is not found, return zero. If the 466 definition is found, return its execution token xt and one (1) if the 467 definition is immediate, minus-one (-1) otherwise. 468 469 <p> 470 <code> 471 See: 472 <a href=dpansa16.htm#A.16.6.1.2192>A.16.6.1.2192 SEARCH-WORDLIST</a> 473 </code> 474 <p> 475 476 <hr> 477 <A name=16.6.1.2195> 478 <code> 479 16.6.1.2195 <b>SET-CURRENT</b> 480 </code> 481 </a> 482 <BR> 483 SEARCH 484 <BR> 485 <pre> 486 ( wid -- ) 487 </pre> 488 <P> 489 490 Set the compilation word list to the word list identified by wid. 491 492 <P> 493 494 <hr> 495 <A name=16.6.1.2197> 496 <code> 497 16.6.1.2197 <b>SET-ORDER</b> 498 </code> 499 </a> 500 <BR> 501 SEARCH 502 <BR> 503 <pre> 504 ( widn ... wid1 n -- ) 505 </pre> 506 <P> 507 508 Set the search order to the word lists identified by widn ... wid1. 509 Subsequently, word list wid1 will be searched first, and word list widn 510 searched last. If n is zero, empty the search order. If n is minus 511 one, set the search order to the implementation-defined minimum search 512 order. The minimum search order shall include the words 513 <a href=dpans16.htm#16.6.1.1595>FORTH-WORDLIST</a> 514 and SET-ORDER. A system shall allow n to be at least eight. 515 516 <P> 517 <code> 518 See: 519 <a href=a0002.htm>RFI 0002</a> 520 </code> 521 <P> 522 523 <hr> 524 <A name=16.6.1.2460> 525 <code> 526 16.6.1.2460 <b>WORDLIST</b> 527 </code> 528 </a> 529 <BR> 530 SEARCH 531 <BR> 532 <pre> 533 ( -- wid ) 534 </pre> 535 <P> 536 537 Create a new empty word list, returning its word list identifier wid. 538 The new word list may be returned from a pool of preallocated word lists 539 or may be dynamically allocated in data space. A system shall allow the 540 creation of at least 8 new word lists in addition to any provided as 541 part of the system. 542 543 <P> 544 545 <hr> 546 <A name=16.6.2> 547 <H3>16.6.2 Search-Order extension words</H3> 548 </a> 549 550 551 <hr> 552 <A name=16.6.2.0715> 553 <code> 554 16.6.2.0715 <b>ALSO</b> 555 </code> 556 </a> 557 <BR> 558 SEARCH EXT 559 <BR> 560 <pre> 561 ( -- ) 562 </pre> 563 <P> 564 565 Transform the search order consisting of widn, ... wid2, wid1 (where 566 wid1 is searched first) into widn, ... wid2, wid1, wid1. An ambiguous 567 condition exists if there are too many word lists in the search order. 568 569 <p> 570 <code> 571 See: 572 <a href=dpansa16.htm#A.16.6.2.0715>A.16.6.2.0715 ALSO</a> , 573 <a href=a0002.htm>RFI 0002</a> 574 </code> 575 <p> 576 577 578 <hr> 579 <A name=16.6.2.1590> 580 <code> 581 16.6.2.1590 <b>FORTH</b> 582 </code> 583 </a> 584 <BR> 585 SEARCH EXT 586 <BR> 587 <pre> 588 ( -- ) 589 </pre> 590 <P> 591 592 Transform the search order consisting of widn, ... wid2, wid1 (where 593 wid1 is searched first) into widn, ... wid2, 594 wid <a href=dpans16.htm#16.6.1.1595>FORTH-WORDLIST</a>. 595 596 <P> 597 598 <hr> 599 <A name=16.6.2.1965> 600 <code> 601 16.6.2.1965 <b>ONLY</b> 602 </code> 603 </a> 604 <BR> 605 SEARCH EXT 606 <BR> 607 <pre> 608 ( -- ) 609 </pre> 610 <P> 611 612 Set the search order to the implementation-defined minimum search order. 613 The minimum search order shall include the words 614 <a href=dpans16.htm#16.6.1.1595>FORTH-WORDLIST</a> and 615 <a href=dpans16.htm#16.6.1.2197>SET-ORDER</a>. 616 617 <P> 618 <code> 619 See: 620 <a href=a0002.htm>RFI 0002</a> 621 </code> 622 <p> 623 624 <hr> 625 <A name=16.6.2.1985> 626 <code> 627 16.6.2.1985 <b>ORDER</b> 628 </code> 629 </a> 630 <BR> 631 SEARCH EXT 632 <BR> 633 <pre> 634 ( -- ) 635 </pre> 636 <P> 637 638 Display the word lists in the search order in their search order 639 sequence, from first searched to last searched. Also display the word 640 list into which new definitions will be placed. The display format is 641 implementation dependent. 642 643 <P> 644 645 ORDER may be implemented using pictured numeric output words. 646 Consequently, its use may corrupt the transient region identified by 647 <a href=dpans6.htm#6.1.0040>#></a>. 648 <P> 649 650 <code> 651 See: 652 <A href=dpans3.htm#3.3.3.6>3.3.3.6</a> Other Transient Regions 653 </code> 654 <P> 655 656 <hr> 657 <A name=16.6.2.2037> 658 <code> 659 16.6.2.2037 <b>PREVIOUS</b> 660 </code> 661 </a> 662 <BR> 663 SEARCH EXT 664 <BR> 665 <pre> 666 ( -- ) 667 </pre> 668 <P> 669 670 Transform the search order consisting of widn, ... wid2, wid1 (where 671 wid1 is searched first) into widn, ... wid2. An ambiguous condition 672 exists if the search order was empty before PREVIOUS was executed. 673 674 <P> 675 676 <hr> 677 <A href=dpans.htm#toc><IMG src="up.gif" ></A> Table of Contents 678 <BR> 679 <A href=dpans17.htm><IMG src="right.gif" ></A> 680 Next Section 681 <P> 682 </BODY> 683 </HTML>