Page 1 of 1

QPC2 and DEV_NEXT

Posted: Mon Dec 05, 2011 4:10 pm
by JonS
Hi,
Just starting to reacquaint myself with the QL (well QPC/SMSQE) and have hit a problem or a misunderstanding on my part.

After setting up several DEV associations, e.g.

DEV_USE 1,WIN1_SOFTWARE_
DEV_USE 2,WIN1_SOFTWARE_TOOLS_
DEV_USE 3,WIN1_XCHANGE_

I've tried to use DEV_NEXT, which I assumed would return the next dev in the list, so PRINT DEV_NEXT(1) would return 2. However, whatever I pass as a parameter I get zero returned.

What am I missing here?

Regards, Jon

Re: QPC2 and DEV_NEXT

Posted: Mon Dec 05, 2011 7:51 pm
by RWAP
Looking at my SBASIC/SuperBASIC Reference Manual, you have misunderstood how the DEV device works.

Taking your example:
DEV_USE 1,WIN1_SOFTWARE_
DEV_USE 2,WIN1_SOFTWARE_TOOLS_
DEV_USE 3,WIN1_XCHANGE_

DIR DEV1_ will actually perform: DIR win1_SOFTWARE_
DIR DEV2_ will actually perform: DIR win1_SOFTWARE_TOOLS_
DIR DEV3_ will actually perform: DIR win1_XCHANGE_

PRINT DEV_NEXT (1) will return 0 at the moment.

However, if you want to use the DEV device to search for an item, then you need to create a chain. The full syntax is
DEV_USE n,directory [,dev_next]

So to achieve what you want, you need to link DEV1 and DEV2, using:
DEV_USE 1,WIN1_SOFTWARE_,2

OPEN_IN #3,dev1_test
will then try to open WIN1_SOFTWARE_test and if not found, will then look for WIN1_SOFTWARE_TOOLS_test

At this stage
PRINT DEV_NEXT(1) will return 2.

PRINT DEV_NEXT(2) will still return 0 as there is no chain attached to DEV2_

Re: QPC2 and DEV_NEXT

Posted: Tue Dec 06, 2011 10:12 am
by JonS
Thanks....clearly I didn't read the manual properly!