SideDiff & 17/01/21 ROM
Frederick Bambrough (1372) 837 posts |
The !Boot obey file in SideDiff is tripping up with an ‘Unknown operand’ error with today’s ROM for the BeagleBoard. SideDiff v 2.44 5/9/2005 |
Julie Stamp (8365) 474 posts |
The error happens on the penultimate line,
but you can strip it down to
The error happens on this ROM because it sets
by default. Does anybody know a reliable way to test if a variable is set? |
Steve Pampling (1551) 8170 posts |
Bottom two lines are giving the error – also on RPCEmu so it’s across the board(all boards) in all likelihood.
The thing is that the LoadType and RunType aren’t null strings, so that shouldn’t actually trigger, should it? |
Steve Pampling (1551) 8170 posts |
both penultimate and ultimate
You mean manually? |
Julie Stamp (8365) 474 posts |
I mean in an obey file, how can those two lines be fixed? They are meant to test whether the variables are set, but that doesn’t work for some string values, so is there a way to do it that works for all values? |
Stuart Painting (5389) 714 posts |
The canonical method is to call XOS_ReadVarVal with R2 bit 31 set (this will return zero in R2 if the system variable does not exist). You’d need to write a small piece of (e.g.) BASIC to do it from an Obey file, though. |
Stuart Swales (1481) 351 posts |
Hmm. Why do the BASIC associations have |“%0|” for the filename bit anyway? We know that it can’t contain spaces. |
Steve Pampling (1551) 8170 posts |
I think the origin of the problem is the behaviour of the Obey module. As you’ve noted the expanded alias has values that break the comparison, IIRC there’s a means of stopping the alias string being expanded which would be one way of avoiding the break. Both of course mean that a fix still requires a change to the actual affected Obey file. |
Stuart Swales (1481) 351 posts |
Or change the ROM so that it doesn’t have |“%0|” And yes, *IfExist would be good. But would have to be part of !Boot for older systems. |
Steve Pampling (1551) 8170 posts |
That would be an addition to this download then Edit: Stuart, you’re right on both points
|
Julie Stamp (8365) 474 posts |
I’d like to be able to write things like
I wonder if there’s a way to extend OS_EvaluateExpression to make that work? |
Stuart Swales (1481) 351 posts |
That has a lot going for it, Julie. Use Sys$ReturnCode. They’d have to be Utility commands I think. |
Rick Murray (539) 13840 posts |
The thing is, this really ought to work…
I think the logic behind having utilities like IfThere is to try to keep Obey “clean”. It wouldn’t be hard to add extra commands (though potentially dodgy for backwards compatibility), but that’s a slippery slope to a hulking mess. Wouldn’t it be nice to have labels and be able to test stuff and Hyperbole, but you get the point, I hope. |
Steve Pampling (1551) 8170 posts |
But I suspect that falls over in the same manner when Obey expands the Alias
Yes, you’re on the if it ain’t broke don’t fix it train. The problem is that people are trying to get an effect (if exist) from a comparison which has an inherent flaw. I’m sure the flaw has been there a long time and people have probably noticed, grumbled quietly and tried to work round it. Oh, BTW.
RMEnsure |
Julie Stamp (8365) 474 posts |
Don’t worry, I don’t expect this would involve changing Obey. *Eval already allows you to sort-of use functions in the form of code variables, but you can’t pass arguments to code variables1. So I’m thinking about ways to introduce functions with arguments into OS_EvaluateExpression. I just had a look at the Select PRM’s, and found this for OS_EvaluateExpression, much to my surprise…
There are several other useful functions built in as well. 1 I guess you have to use assembler for code variables, so this could be an opportunity to look at alternatives. |
Frederick Bambrough (1372) 837 posts |
(Non programmer interrupts) So it’s an OS issue(?)… or should Harriet Bazley be informed? |
Rick Murray (539) 13840 posts |
More like the KISS train.
So, does this mean that any expansion that contains quotes would fail?
Which evaluates the clause if the module is not present (or too old). Can be used in a convoluted way by setting a flag and then unsetting it if the module isn’t present, to then check to see if the flag is set. |
Julie Stamp (8365) 474 posts |
It is an OS issue, and I’ve submitted a patch for it. Until it’s fixed you can comment out the lines from the !Boot with |’s, or remove them. |
Steve Pampling (1551) 8170 posts |
The way I understand it, when your Obey file mentions |
Julie Stamp (8365) 474 posts |
Looking at the Select docs, you could do
Nothing, we’re only testing whether that string is zero-length, we don’t do any replacing of %’s. It goes
But on the left of the equals is
which isn’t a valid expression (as far as *Eval is concerned, it’s two strings separated by gobbledeegook), so it goes No. |
Steve Pampling (1551) 8170 posts |
I’d just got my head to the “string” %0 “string” bit, at which point the answer to Ricks question is pretty much “Yes” unless by some chance you have something valid for joining two strings
As in “computer says No” |
Timothy Baldwin (184) 242 posts |
Whilst this was triggered by my change, OS_EvaluateExpression is clearly broken, PRM Volume 1 page 458 states: Any strings in the evaluation string are passed to OS_GSTrans, so all its operators will No mention of applying GSTrans before parsing the expression, which allow shenanigans such as:
If you use the bare system variable name it works correctly for existing variables:
Unfortunately that doesn’t work for non-existent variables. |
Alan Adams (2486) 1149 posts |
If I understand all this (I don’t) it seems to step from the runtype variable being created with 4 quotes, intended to act as nested quotes, but being evaluated as separate quoted strings. Or possibly the opposite. WHY??? |
Steve Pampling (1551) 8170 posts |
Because Acorn did something broken and no one discovered it (and notified anyone else) before |
Stuart Swales (1481) 351 posts |
It’s there all the way back in RISC OS 2, and maybe before. I must have put that particular alias setting in FileSwitch in 1986 or 87, but am pretty sure that I wouldn’t have put the separate quoted filename argument like that unless someone else specifically requested it (compare with all the other ones thereabouts in FileSwBody). Alas, that’s shrouded in the mists of time… (I do think that it ought not to have quotes now and software authors need to fix any of their borked BASIC command line parsers. Use OS_ReadArgs. You know it makes sense.) |