Range ('TO') in SELECT CASE ignored.

DOS specific questions.
Post Reply
BasicJan
Posts: 46
Joined: Aug 30, 2005 20:09
Location: Netherlands

Range ('TO') in SELECT CASE ignored.

Post by BasicJan »

SELECT CASE Kbd$
CASE "A"
'This expression-list is recognised
CASE "B" TO "Z"
'This expression-list is ignored
END SELECT

Is this a documentation error or am I doing something wrong?
I just started migrating a number of applications from Quickbasic to FREEBasic.
jofers
Posts: 1525
Joined: May 27, 2005 17:18

Post by jofers »

Your example works fine for me.

Please understand that the documentation is fan-made, the only really "official" parts of it are the ones Lillo made himself for the graphics functions he wrote. The rest is sort of a work in progress.

However, your finding errors, typos and missing info is very much appreciated.
mjs
Site Admin
Posts: 842
Joined: Jun 16, 2005 19:50
Location: Germany

Post by mjs »

Works here in my local copy of the DOS version ... however, I built my DOS version from CVS so it might've been a bug that's fixed in CVS HEAD.

Regards,
Mark
BasicJan
Posts: 46
Joined: Aug 30, 2005 20:09
Location: Netherlands

Post by BasicJan »

My representation of a part of my program wasn't fully correct.

This works fine:
TmpText$="G"
SELECT CASE TmpText$
CASE CHR$(32) TO CHR$(122)
PRINT TmpText$;" recognised!"
CASE ELSE
PRINT TmpText$;" not recognised!"
END SELECT

This doesn't work (Works well in QuickBasic)
TmpText$="G"
SELECT CASE TmpText$
CASE CHR$(32) TO CHR$(254)
PRINT TmpText$;" recognised!"
CASE ELSE
PRINT TmpText$;" not recognised!"
END SELECT

So whether or not the TO-clause works depends on the range?!?!
mjs
Site Admin
Posts: 842
Joined: Jun 16, 2005 19:50
Location: Germany

Post by mjs »

Hmm ... I guess that the problem is that there is a problem with (un)signed comparation for strings ...

IOW: It stops working when CHR$(128) and above are used ...

Regards,
Mark
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

Fixed in CVS.. the inline-asm MEMCMP function was doing a signed check, my bad..
Post Reply