<feed xmlns='http://www.w3.org/2005/Atom'>
<title>dwarvish.git/src/poem/recite, branch v0.0.1</title>
<subtitle>a (mostly) posix compliant shell and tiny functional programming language
</subtitle>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/'/>
<entry>
<title>Handle STDERR, in addition to STDOUT</title>
<updated>2024-05-20T00:50:06+00:00</updated>
<author>
<name>Rory Dudley</name>
</author>
<published>2024-05-20T00:50:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/commit/?id=4b1b8061e79b42128df4f06fd1e439549bf9696b'/>
<id>4b1b8061e79b42128df4f06fd1e439549bf9696b</id>
<content type='text'>
This patch overhauls the reading and reciting of verses, such that the
redirection of STDERR (in addition to STDOUT, which was already a
feature), is now possible.

Removed the 'stdout' argument from recite(), since it is no longer
needed with how incantations function.

A verse's couplet indicator is now a u8, instead of a bool, with certain
values corresponding to types of couplets, for instance:

  ls | grep Ca | lolcat
  ^    ^         ^
  |    |         2: right side of a couplet
  |    3: both sides of a couplet
  1: left side of a couplet

Incantions are no longer hanlded in rune.rs, and the task macros have
been removed. Now, a verse incants itself, matching on its own meter to
determine how to handle the next verse.

The following runes were added to help with handling STDERR:
  Write2 -&gt; 2&gt;
  WriteAll -&gt; &amp;&gt;
  Addendum2 -&gt; 2&gt;&gt;
  AddendumAll -&gt; &amp;&gt;&gt;

The 'io' field in verse was changed from an Option&lt;Rune&gt;, to an array of
Runes, since a single verse might have multiple IO operations.

The following fields were added to Verse, to assist with handling
STDERR:
  ip -&gt; List of filenames to read into STDIN
  op -&gt; List of filenames to send STDOUT to
  ep -&gt; List of filenames to send STDERR to

Keep track of channels when reading a poem. Channels are relating to IO
operations. If channel is None, words get pushed to the verse's primary
stanza (i.e. the verb or the clause). If a channel is selected, words
are pushed to one of the aforementioned new fields in Verse.
  Read -&gt; ip
  Write/Addedum -&gt; op
  Write2/Addedum2 -&gt; ep
  WriteAll/AddendumAll -&gt; op and ep
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch overhauls the reading and reciting of verses, such that the
redirection of STDERR (in addition to STDOUT, which was already a
feature), is now possible.

Removed the 'stdout' argument from recite(), since it is no longer
needed with how incantations function.

A verse's couplet indicator is now a u8, instead of a bool, with certain
values corresponding to types of couplets, for instance:

  ls | grep Ca | lolcat
  ^    ^         ^
  |    |         2: right side of a couplet
  |    3: both sides of a couplet
  1: left side of a couplet

Incantions are no longer hanlded in rune.rs, and the task macros have
been removed. Now, a verse incants itself, matching on its own meter to
determine how to handle the next verse.

The following runes were added to help with handling STDERR:
  Write2 -&gt; 2&gt;
  WriteAll -&gt; &amp;&gt;
  Addendum2 -&gt; 2&gt;&gt;
  AddendumAll -&gt; &amp;&gt;&gt;

The 'io' field in verse was changed from an Option&lt;Rune&gt;, to an array of
Runes, since a single verse might have multiple IO operations.

The following fields were added to Verse, to assist with handling
STDERR:
  ip -&gt; List of filenames to read into STDIN
  op -&gt; List of filenames to send STDOUT to
  ep -&gt; List of filenames to send STDERR to

Keep track of channels when reading a poem. Channels are relating to IO
operations. If channel is None, words get pushed to the verse's primary
stanza (i.e. the verb or the clause). If a channel is selected, words
are pushed to one of the aforementioned new fields in Verse.
  Read -&gt; ip
  Write/Addedum -&gt; op
  Write2/Addedum2 -&gt; ep
  WriteAll/AddendumAll -&gt; op and ep
</pre>
</div>
</content>
</entry>
<entry>
<title>Capture STDOUT as bytes, and convert to string when necessary</title>
<updated>2024-04-07T05:32:30+00:00</updated>
<author>
<name>Rory Dudley</name>
</author>
<published>2024-04-07T05:32:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/commit/?id=f5db8d64828db756b80b6022322265a2b4f1c11b'/>
<id>f5db8d64828db756b80b6022322265a2b4f1c11b</id>
<content type='text'>
Previously, the recite() function created the 'out' variable, which was
a String, that got passed to the various incant functions, in order to
capture STDOUT in certain situations. In cases where STDOUT was
captured, it was first converted to a String, and then appended to the
'out' variable, by means of String::from_utf8_lossy(). This works for
basic text, however, does NOT work for binary data. This becomes
problematic, when for example, downling a tar file with curl/wget, that
is then piped ('|') to the tar program. Using from_utf8_lossy() in this
case can corrupt the tar file. This patch makes it so that out is stored
as bytes by default, and only converted to a String when necessary.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, the recite() function created the 'out' variable, which was
a String, that got passed to the various incant functions, in order to
capture STDOUT in certain situations. In cases where STDOUT was
captured, it was first converted to a String, and then appended to the
'out' variable, by means of String::from_utf8_lossy(). This works for
basic text, however, does NOT work for binary data. This becomes
problematic, when for example, downling a tar file with curl/wget, that
is then piped ('|') to the tar program. Using from_utf8_lossy() in this
case can corrupt the tar file. This patch makes it so that out is stored
as bytes by default, and only converted to a String when necessary.
</pre>
</div>
</content>
</entry>
<entry>
<title>read() and recite() overhaul</title>
<updated>2024-03-23T08:45:54+00:00</updated>
<author>
<name>Rory Dudley</name>
</author>
<published>2024-03-23T08:45:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/commit/?id=5a7718698373d07a29fffcb792acdb81aa7712d7'/>
<id>5a7718698373d07a29fffcb792acdb81aa7712d7</id>
<content type='text'>
Rebuilt the LR parser (i.e. read()) from the ground up. This required
that some changes be made to recite(), in order to accomodate the new
data structures. These data structures were each split out into their
own file, in order to make working with each component a bit easier.

In addition to reworking the parts of the parser already present, some
new features were also added, such as:
  - Support for strings (' and ")
  - Support for environment variables ($)
  - Support for interpreting tild as $HOME (~)
  - Support for sub-reading and sub-reciting (`)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rebuilt the LR parser (i.e. read()) from the ground up. This required
that some changes be made to recite(), in order to accomodate the new
data structures. These data structures were each split out into their
own file, in order to make working with each component a bit easier.

In addition to reworking the parts of the parser already present, some
new features were also added, such as:
  - Support for strings (' and ")
  - Support for environment variables ($)
  - Support for interpreting tild as $HOME (~)
  - Support for sub-reading and sub-reciting (`)
</pre>
</div>
</content>
</entry>
</feed>
