DATA_USE

Anything QL Software or Programming Related.
User avatar
Andrew
Aurora
Posts: 793
Joined: Tue Jul 17, 2018 9:10 pm

DATA_USE

Post by Andrew »

The Super Basic Manual states for DATA_USE
Sub-directories can be nested but the complete filename, including prefix must not be longer than 41 characters (note that if you are using a network device, for example n1_win1_proggy_bas, the maximum permitted filename length is reduced to 39 in current versions of the QL device drivers).
In reality the maximum path cannot be longer than 32 characters only !
DATA_USE win1_1234567890_1234567890_12345
is a valid command
But
DATA_USE win1_1234567890_1234567890_123456
or
DATA_USE win1_1234567890_1234567890_12345_
will return "bad parameter"

Tested on QPC2, QEmulator, QL+SGC, QL+tetroid GC


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: DATA_USE

Post by mk79 »

Yes, there is a hardcoded limit of 32 for these. But then the 39 character limit is for the whole filename and DATAD$ is only the directory, which when used to the max doesn’t leave much space for the filename. But yes, the manual is wrong in this case.

Marcel


RWAP
RWAP Master
Posts: 2836
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: DATA_USE

Post by RWAP »

mk79 wrote:Yes, there is a hardcoded limit of 32 for these. But then the 39 character limit is for the whole filename and DATAD$ is only the directory, which when used to the max doesn’t leave much space for the filename. But yes, the manual is wrong in this case.

Marcel
The 32 character limit is mentioned in note 6 to the command - https://superbasic-manual.readthedocs.i ... a-use.html


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: DATA_USE

Post by mk79 »

RWAP wrote:The 32 character limit is mentioned in note 6 to the command - https://superbasic-manual.readthedocs.i ... a-use.html
Ah, I haven't checked the source myself. Well done then!


User avatar
Andrew
Aurora
Posts: 793
Joined: Tue Jul 17, 2018 9:10 pm

Re: DATA_USE

Post by Andrew »

RWAP wrote:The 32 character limit is mentioned in note 6 to the command - https://superbasic-manual.readthedocs.i ... a-use.html
I missed that note.
But it should write "The default devices cannot exceed 32 characters (including a final underscore)

Nevertheless, as long as the path can be 41 characters it is a pain in the back that default devices can only be 32 characters. There is a 9 chars difference which could be a 4 chars directory name + '_' + a 4 chars file :(
(I had some unexpected errors in my QLCommander and this was the cause)


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: DATA_USE

Post by mk79 »

Andrew wrote:But it should write "The default devices cannot exceed 32 characters (including a final underscore)
No, you can leave the final underscore off and it will be added automatically, thus adding a 33rd character.
(I had some unexpected errors in my QLCommander and this was the cause)
I don't think the data default was intended to be altered by programs, it's more of a user setting as it's global and that doesn't play well in a multitasking world. Ideally it should have been per-job, but that ship has sailed long ago.


User avatar
Andrew
Aurora
Posts: 793
Joined: Tue Jul 17, 2018 9:10 pm

Re: DATA_USE

Post by Andrew »

mk79 wrote:
Andrew wrote:But it should write "The default devices cannot exceed 32 characters (including a final underscore)
No, you can leave the final underscore off and it will be added automatically, thus adding a 33rd character.
yes - but if you add it than it returns bad command
DATA_USE win1_1234567890_1234567890_12345_
will return "bad parameter"
(I had some unexpected errors in my QLCommander and this was the cause)
I don't think the data default was intended to be altered by programs, it's more of a user setting as it's global and that doesn't play well in a multitasking world. Ideally it should have been per-job, but that ship has sailed long ago.[/quote]
I agree - but as DUP relies on DATAD$, I had to use it - I could not find any other reliable, simple and fast way to find the parent of a directory. The only other way I could think of was to search backwards for '_" , slice the directory name before that underscore and check if that directory exists and if not then repeat the process. It's simple, but not fast


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: DATA_USE

Post by mk79 »

Andrew wrote:I agree - but as DUP relies on DATAD$, I had to use it - I could not find any other reliable, simple and fast way to find the parent of a directory.
Hmm, I see, but DUP doesn't find the parent directory either, it also just backtracks to the next underscore?


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: DATA_USE

Post by mk79 »

A quick&dirty little sketch of how you can find the parent directory:

Code: Select all

100 MAKE_DIR ram1_test
110 MAKE_DIR ram1_test_abc_xyz
120 dir$ = "ram1_test_abc_xyz"
130 :
140 FOR i = LEN(dir$) TO 5 STEP -1
150   IF dir$(i) = "_" THEN
160     IF FTEST(dir$(1 TO i)) = 0 THEN
170       IF FTYP(\dir$(1 TO i)) = 255 THEN EXIT i
180     END IF
190   END IF
200 END FOR
210 dir$ = dir$(1 TO i)
220 :
230 PRINT dir$


User avatar
dinox
ROM Dongle
Posts: 28
Joined: Tue Dec 20, 2016 4:59 pm

Re: DATA_USE

Post by dinox »

Cheers. I hadn't realized there was a limit. That explains some of the problems I've had with my long SuperBasic commands.


Post Reply