[Coco] a new problem with decode

Bob Devries devries.bob at gmail.com
Wed Apr 16 18:26:50 EDT 2014


Hi Wayne,

I would think that there is no way for Shell to know that what you're 
using as a parameter is string, integer, float or boolean.

In fact, on page 1-6 of the Microware C manual it says:

QOUTE:
The startup routine for C programs ensures that the parameter string 
passed to it by the parent process is converted to nul-terminated 
STRINGS as expected by the program. In adition, it will run together as 
a single argument any strings enclosed between single or double quotes 
("'"or '"').
/QUOTE

Regards, Bob Devries
Dalby, QLD, Australia

On 17/04/2014 7:28 AM, Wayne Campbell wrote:
> The fix is done. It turned out to be a boolean not set properly. To
> elaborate, I use booleans to determine which files are open and which are
> closed. When a file gets opened, the corresponding boolean is set TRUE.
> When the file is closed, the boolean gets set to FALSE. In this case, I set
> the boolean FALSE, but in the wrongf place, so as far as the error trap was
> concerned, that file should have been open and it was repeatedly erroring
> when trying to close the file.
>
> In addition, I was able to solve the 67 error that ErrorCodes has been
> returning from within decode. I had neglected to change the parameters to
> strings when calling ErrorCodes from the shell. I learned some time ago
> that, when the shell passes parameters to Basic09, it makes them all
> strings. When you would think that:
>
> OS9:errorcodes 216 1
>
> (216 and 1 being INTEGERS) would work, but the shell turns them into "216"
> "1". BOOLEANs also are affected. You would think TRUE or FALSE could be
> passed and B09 would resolve which token to use, but no. The shell turns
> them into "TRUE" and "FALSE". If you want to pass numbers or booleans, you
> *MUST* use the syntax:
>
> OS9:procedure("string",integer,TRUE)
>
> and it should work. This defeats the purpose of the shell being able to
> pass parameters using the form:
>
> OS9:procedure string integer TRUE
>
> I started using only string parameters when calling from the shell, and
> errorcodes and decode are no exception. However, this means that if I want
> to pass those types, I have to do so using some other delimiter between
> types and accepting it as one big string, then parse the string for its
> contents.
>
> Wayne
>




More information about the Coco mailing list