Amiga.org

Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: carls on December 06, 2004, 02:22:32 AM

Title: Bug in ARexx + datatypes.library?
Post by: carls on December 06, 2004, 02:22:32 AM
When using datatypes.library's ExamineDT() to a stem, the stem.DataType char can't be used correctly in in comparisons!

For example, if the DataType is "ILBM" I can't do
if stem.DataType="ILBM" then
  say "Hello!"

Has anyone else experienced this?

I'm running WB 3.1 on kick 3.0 (yes, I own a 3.1 ROM too but it's in my unused A1200T currently), maybe this has something to do with it?

Here's the complete test code with comments on the output I get: http://gonzo.1av10.nu/testdt.rx

Any help would be greatly appreciated!
Title: Re: Bug in ARexx + datatypes.library?
Post by: patrik on December 06, 2004, 04:34:17 AM
@carls:

I ran the script on an iff-picture on my 3.1/3.1 system and the results were the same as yours - it neither said "Hello" nor "Hello 2".


/Patrik
Title: Re: Bug in ARexx + datatypes.library?
Post by: nOw2 on December 06, 2004, 06:33:35 AM
OS 3.9:
> rx testdt.rx
[ILBM]
CHAR
Hello
CHAR
AILBMA
Hello 2


--

Perhaps it's putting spaces in incorrectly under 3.1? Try:

say "("|| dt_string || ")"
if left(dt_string,6)="AILBMA" ...
Title: Re: Bug in ARexx + datatypes.library?
Post by: carls on December 06, 2004, 09:36:24 AM
Thanks for testing it guys!

nOw2:
I don't think so; I'm adding "A" to both sides of the value and no spaces appear, when I print the value encapsulated by brackets there no extra spaces appear either. I'll try using left() though, that should at least return a proper variable. I hope. :)

I should probably test it using datatypes.library from Workbench 3.0 and see what happens. Perhaps there's a bug in the 3.1 version.

Title: Re: Bug in ARexx + datatypes.library?
Post by: Thomas on December 06, 2004, 12:49:37 PM

Well, what you didn't do is to look what is really in this string. A say c2x(dt.datatype) revealed that there is a trailing binary zero: 494C424D00

The command dt.datatype = strip(dt.datatype,,'00'x) corrects the error (and it still runs on OS3.9).

Bye,
Thomas
Title: Re: Bug in ARexx + datatypes.library?
Post by: carls on December 06, 2004, 02:02:42 PM
Thomas: Thanks!
I would never have thought of that.
Title: Re: Bug in ARexx + datatypes.library?
Post by: nOw2 on December 06, 2004, 06:30:45 PM
Oops, how did I miss the line with the A's in?
I know, it was 7am :)
Title: Re: Bug in ARexx + datatypes.library?
Post by: carls on December 06, 2004, 10:22:40 PM
Waddaya know, it works! :)