Note: This routine will not work in cases where the implementor of a Directory Device Driver does not adhere to the IOD_DNUS/IOD_DNAM standard that was introduced with SMSQ/E. That pertains to some old drivers originally written for Qdos hardware, but implementors of some newer DDDs seem to have disregarded this standard, through choice or ignorance. Setting IOD_DNUS allows the user a standard way to set an alias for the real device name, which is stored in IOD_DNAM; eg WIN_USE MDV. A new driver using the later standard should still be compatible with older systems; an old driver will still work with SMSQ/E, but may cause problems for software expecting the new standard.

IMHO non-standard software, including drivers, are best avoided where possible. The whole point about standards and compatibility is to create a sane and rational interface to the sordid convolutions and compromises that lurk in the undergrowth of the layer below. This so that those who come after, who build on what went before, can concentrate on what they want to achieve, without having to have a detailed understanding of the underlying layer, and having to waste blood and treasure to devise creative work-arounds to cope with it.

100 REMark Given real device name, return usage
110 REMark Given usage, return real device name
120 REMark If neither found, return nothing
130 REMark SMSQ/E 3+
140 REMark V0.06, December 18th 2018 (check length)
150 REMark No PEEK(!! ), No Hex, combined Real and Use
160 :
170 DEFine FuNction DevGet$(dev$)
180 LOCal gdl, l%, p
190 p = PEEK_L(VER$(-2) + 72)
200 REPeat gdl
210 :
220  IF PeekStrg$(p + 42) == dev$ THEN
230   RETurn PeekStrg$(p + 36)
240  ELSE
250   IF PeekStrg$(p + 36) == dev$ THEN
260    RETurn PeekStrg$(p + 42)
270   END IF
280  END IF
290 :
300  p = PEEK_L(p): IF p = 0: EXIT gdl
310 END REPeat gdl
320 RETurn '': REMark Or  RETurn dev$
330 END DEFine DevGet$
340 :
350 DEFine FuNction PeekStrg$(ad)
360 l% = PEEK_W(ad)
370 SELect ON l%: = 1 TO 4: RETurn PEEK$(ad + 2, l%)
380 RETurn ''
390 END DEFine PeekStrg$
400 :
410 :
Generated with sb2htm on 2019 Mar 12
©pjwitte March 2oi9