On 17/07/16 20:34, Segher Boessenkool wrote:
On Sun, Jul 17, 2016 at 08:10:27PM +0100, Mark Cave-Ayland wrote:
It might be better without the DO loop (it blocks the R stack). Probably it is best to break out a natural factor (like, find the length of a string until the first line break -- isn't there a word like it already, like "left-split" but splitting on any line break char instead of on one delim).
Actually I did experiment without the do loop, but like you I found that the slight ease of the code within the if didn't seem to justify the complexity outside of it which is why I decided to stick with what was there.
If you use a BEGIN loop (instead of a DO loop) it becomes easier to factor the word (because you do not have to deal with I using the return stack).
The other reason, of course, is that the code is fairly well tested in its current form and so if we want to get this in for 2.7 I'd much prefer to minimise the changes in this particular patchset :)
That is of course a good reason.
It seems that left-split does exist in OpenBIOS, but according to the IEEE1275 standard it takes only a single character to split upon so I'm not convinced it would make things more sane in this particular case where we want to split on more than one character.
My suggestion was to make a word like it, something that takes everything smaller than BL as delimiter, like BL FINDCHAR and BL PARSE and SKIPWS etc. I probably wasn't very clear, sorry :-/
No worries, I really appreciate all the advice. I'm just really conscious of the time this would take, so unless you can see an absolute blocker then I'd be inclined to go with the patch in its current form and then figure out a better strategy moving forward.
ATB,
Mark.