Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In writing documentation for the new buffered commands VDU calls, some adjustments and improvements have been made.
The first changes made were to the numbering of the "adjust" command operations. the issue was primarily with the numbering of the "not" and "negate" instructions. they are the only two operations that don't require a separate operand, but they had been placed them at the end of the instruction list. with the current set of operations that's potentially OK, but there are several new adjust instructions that we may wish to add in the future (multiply, shift, etc) - any/all new operations will want a separate operand.
the renumbering in this PR means that it's the first two instructions that don't require a separate operand (rather than the last two). this (now) mirrors the "conditional call" command. this renumbering will make it more straightforward to add in new operations in the future, and makes the documentation slightly simpler.
since all the buffered command operations are new, and the documentation has not yet been published, this feels like a safe thing to do right now, rather than living with the earlier "mistake". (to be honest, I'd already half realised this when I raised the PR with buffered commands, as the logic between "conditional call" and "adjust" was inconsistent.)
This PR also improves how "call" (and "conditional call") operates when a buffer is calling itself. When this is detected, the VDU input stream is now just rewound to the beginning, rather than a new instance of the VDU command processor being created.
Finally there is a small bug fix for the
discardBytes
call.The documentation for the buffered commands API follows the numbering and behaviour of the API as in this PR.