<a href="#p_gtR">>R</a>  \r
<a href="#p_Rget">R@</a>  \r
<a href="#p_Rgt">R></a>  \r
-<a href="#p_rsp">R[n]</a>  </p></div>\r
+<a href="#p_rbpn">R[n]</a>  </p></div>\r
<div class="paragraph"><p><a href="#data_stack">DATA-STACK</a>  \r
<a href="#return_stack">RETURN-STACK</a>  \r
 \r
<a href="#p_execute">EXECUTE</a>  \r
<a href="#p_exit">EXIT</a>  </p></div>\r
<div class="paragraph"><p><a href="#p_false">FALSE</a>  \r
+<a href="#p_fdemit">FDEMIT</a>  \r
+<a href="#p_fdtell">FDTELL</a>  \r
<a href="#p_find">FIND</a>  \r
<a href="#p_forth">FORTH</a>  </p></div>\r
<div class="paragraph"><p><a href="#p_here">HERE</a>  \r
<a href="#p_immediate">IMMEDIATE</a>  \r
<a href="#p_input">INPUT</a>  </p></div>\r
<div class="paragraph"><p><a href="#p_literal">LIT</a>  \r
-<a href="#p_load_file_quote">LOAD-FILE"</a>  </p></div>\r
+<a href="#p_load_buffer_size">LOAD-BUFFER-SIZE</a>  \r
+<a href="#p_load_file">LOAD-FILE</a>  </p></div>\r
<div class="paragraph"><p><a href="#p_args">MAIN-ARGS</a>  \r
<a href="#p_malloc">MALLOC</a>  </p></div>\r
<div class="paragraph"><p><a href="#p_negate">NEGATE</a>  \r
<a href="#p_nl">NL</a>  \r
<a href="#p_not">NOT</a>  \r
<a href="#p_number">NUMBER</a>  </p></div>\r
-<div class="paragraph"><p><a href="#p_open_file_quote">OPEN-FILE"</a>  \r
+<div class="paragraph"><p><a href="#p_open_file">OPEN-FILE</a>  \r
<a href="#p_or">OR</a>  \r
<a href="#p_over">OVER</a>  </p></div>\r
<div class="paragraph"><p><a href="#p_pad">PAD</a>  \r
<a href="#p_read_word">READ-WORD</a>  \r
<a href="#p_realloc">REALLOC</a>  \r
<a href="#p_roll">ROLL</a>  \r
-<a href="#p_rot">ROT</a>  </p></div>\r
+<a href="#p_rot">ROT</a>  \r
+<a href="#p_rbp">RSP</a>  </p></div>\r
<div class="paragraph"><p><a href="#p_sp">SP</a>  \r
<a href="#p_state">STATE</a>  \r
<a href="#p_stdin">STDIN</a>  \r
<a href="#p_this_word">THIS-WORD</a>  \r
<a href="#p_true">TRUE</a>  \r
<a href="#p_tuck">TUCK</a>  </p></div>\r
+<div class="paragraph"><p><a href="#p_unstream">UNSTREAM</a>  </p></div>\r
<div class="paragraph"><p><a href="#p_verboseQ">VERBOSE?</a>  </p></div>\r
<div class="paragraph"><p><a href="#p_within">WITHIN</a>  \r
<a href="#p_words">WORDS</a>  </p></div>\r
<div style="text-align:center">\r
_______________________________________________________\r
</div>\r
+<div class="paragraph"><p><a id="p_fdemit"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_fdemit">Word: FDEMIT</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( c fd -- )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"FDEMIT" is a function word that puts the given character code to the\r
+given file descriptor. The character is the least significant byte of\r
+the data stack cell.</p></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
+<div class="paragraph"><p><a id="p_fdtell"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_fdtell">Word: FDTELL</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( char* n fd -- )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"FDTELL" is a function word that prints a string to the given file\r
+descriptor.</p></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
<div class="paragraph"><p><a id="p_find"></a></p></div>\r
</div>\r
<div class="sect2">\r
<div style="text-align:center">\r
_______________________________________________________\r
</div>\r
-<div class="paragraph"><p><a id="p_load_file_quote"></a></p></div>\r
+<div class="paragraph"><p><a id="p_load_buffer_size"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_load_buffer_size">Word: LOAD-BUFFER-SIZE</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>data stack: ( -- a )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"LOAD-BUFFER-SIZE" is a variable word telling the buffer size in bytes\r
+that <a href="#p_load_file">LOAD-FILE</a> should use.</p></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
+<div class="paragraph"><p><a id="p_load_file"></a></p></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_word_load_file">Word: LOAD-FILE"</h3>\r
+<h3 id="_word_load_file">Word: LOAD-FILE</h3>\r
<div class="literalblock">\r
<div class="content">\r
-<pre><code>data stack: ( "name" -- )</code></pre>\r
+<pre><code>data stack: ( chaz* -- * 0/1 )</code></pre>\r
</div></div>\r
-<div class="paragraph"><p>"LOAD-FILE"" is a function word that opens a file via\r
-<a href="#p_open_file_quote">OPEN-FILE"</a>, allocates a stream buffer of 15000\r
-bytes for reading it, saves the stream pointer as value for the newly\r
-created filename variable, and then it invokes\r
-<a href="#p_evaluate_stream">EVALUATE-STREAM</a> for processing the file.</p></div>\r
+<div class="paragraph"><p>"LOAD-FILE" is a function word that evaluates a text file. It opens a\r
+file via <a href="#p_open_file">OPEN-FILE</a> and sets up a stream with a\r
+buffer of <a href="#p_load_buffer_size">LOAD-BUFFER-SIZE</a> bytes for\r
+reading it. The stream is passed to\r
+<a href="#p_evaluate_stream">EVALUATE-STREAM</a> for processing its words. Upon\r
+its return the file is closed and the stream memory is reclaimed, and\r
+then the function returns whatever\r
+<a href="#p_evaluate_stream">EVALUATE-STREAM</a> returns.</p></div>\r
<div style="text-align:center">\r
_______________________________________________________\r
</div>\r
<div style="text-align:center">\r
_______________________________________________________\r
</div>\r
-<div class="paragraph"><p><a id="p_open_file_quote"></a></p></div>\r
+<div class="paragraph"><p><a id="p_open_file"></a></p></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_word_open_file">Word: OPEN-FILE"</h3>\r
+<h3 id="_word_open_file">Word: OPEN-FILE</h3>\r
<div class="literalblock">\r
<div class="content">\r
-<pre><code>Data stack: ( "name" -- fd )</code></pre>\r
+<pre><code>Data stack: ( chaz* -- fd )</code></pre>\r
</div></div>\r
-<div class="paragraph"><p>"OPEN-FILE"" is a function word that reads the intputstream for a\r
-filename, adds that to the dictionary as a no-content variable, opens\r
-that file and returns the input file descriptor.</p></div>\r
+<div class="paragraph"><p>"OPEN-FILE" is a function word that opens the file named by the zero\r
+terminated character string and returns the file descriptor, or if\r
+less than 0, the system call error code.</p></div>\r
<div style="text-align:center">\r
_______________________________________________________\r
</div>\r
<div style="text-align:center">\r
_______________________________________________________\r
</div>\r
+<div class="paragraph"><p><a id="p_rbp"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_rsp">Word: RSP</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( -- a )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"RSP" is a function word that pushes the return stack pointer value\r
+onto the data stack.</p></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
+<div class="paragraph"><p><a id="p_rbpn"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_r_n">Word: R[n]</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( n -- a )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"R[n]" is a function word that pushes the address for the n:th cell on\r
+the top return stack value onto the data stack.</p></div>\r
+<div class="exampleblock">\r
+<div class="content">\r
+<div class="sidebarblock">\r
+<div class="content">\r
+<div class="title">Defintion concept for R[n]</div>\r
+<div class="paragraph"><p>( n — a ) : R[n] 8 * RSP + ;</p></div>\r
+</div></div>\r
+</div></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
<div class="paragraph"><p><a id="p_read_stream_char"></a></p></div>\r
</div>\r
<div class="sect2">\r
cell pointer for it. The characters of the word are copied to\r
<a href="#p_pad">PAD</a>, and there is a limit of 1024 characters.</p></div>\r
<div class="paragraph"><p>At the end of the stream READ-WORD returns 0 length.</p></div>\r
+<div class="exampleblock">\r
+<div class="title">Special syntax 1: Whitespace</div>\r
+<div class="content">\r
+<div class="paragraph"><p>All character codes less or equal to 32 are regarded as "whitespace".</p></div>\r
+</div></div>\r
+<div class="exampleblock">\r
+<div class="title">Special syntax 2: Rest-of-line comment</div>\r
+<div class="content">\r
+<div class="paragraph"><p>The "#" character following whitespace starts a line comment and the\r
+rest of the line is ignored. Note that this is also recognised with\r
+<a href="#p_lparen">parethesis commenting</a>.</p></div>\r
+</div></div>\r
<div style="text-align:center">\r
_______________________________________________________\r
</div>\r
<div style="text-align:center">\r
_______________________________________________________\r
</div>\r
-<div class="paragraph"><p><a id="p_rsp"></a></p></div>\r
-</div>\r
-<div class="sect2">\r
-<h3 id="_word_r_n">Word: R[n]</h3>\r
-<div class="literalblock">\r
-<div class="content">\r
-<pre><code>Data stack: ( n -- a )</code></pre>\r
-</div></div>\r
-<div class="paragraph"><p>"R[n]" is a function word that pushes the address for the n:th cell on\r
-the top return stack value onto the data stack.</p></div>\r
-<div style="text-align:center">\r
-_______________________________________________________\r
-</div>\r
<div class="paragraph"><p><a id="p_semicolon"></a></p></div>\r
</div>\r
<div class="sect2">\r
<div style="text-align:center">\r
_______________________________________________________\r
</div>\r
+<div class="paragraph"><p><a id="p_unstream"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_unstream">Word: UNSTREAM</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( stream* -- )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"UNSTREAM" is a function word that releases the memory allocated for a\r
+stream, and closes the associated file if it’s a file stream.</p></div>\r
+<div class="sect3">\r
+<h4 id="_file_descriptor_backed_stream_2">File descriptor backed stream</h4>\r
+<div class="paragraph"><p>This kind of stream has the stream header as a prefix within the\r
+allocated memory. Thus, stream* is the base address for the memory to\r
+reclaim, and the size of this is determined from the cell at (stream*\r
++ 16) plus the 32 bytes head itself.</p></div>\r
+</div>\r
+<div class="sect3">\r
+<h4 id="_memory_block_backed_stream_2">Memory block backed STREAM</h4>\r
+<div class="paragraph"><p>This kind of stream has a separate header which points at the memory\r
+area to reclaim. The cell at stream* is the base address, and the cell\r
+at (stream* + 16) is its size.</p></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
<div class="paragraph"><p><a id="p_verboseQ"></a></p></div>\r
</div>\r
+</div>\r
<div class="sect2">\r
<h3 id="_word_verbose">Word: VERBOSE?</h3>\r
<div class="literalblock">\r
<div id="footer">\r
<div id="footer-text">\r
Last updated\r
- 2021-06-04 18:26:45 AEST\r
+ 2021-06-05 17:42:39 AEST\r
</div>\r
</div>\r
</body>\r