Page 1 of 1

The Underscore

Posted: Thu Mar 13, 2014 9:51 am
by Mr_Navigator
:No flaming please:

In principle, the underscore is inherent in QL systems for file attributes

e.g.

You cannot DIR FLP1 you need FLP1_
As an indication filename_BAS, file_EXT, file_TASK, filename_OBJ provide a clue as to their file type

However
File extensions on the QL are cosmetic and provide no other useful function than a aesthetic one.

What I mean is, just because the file extension says _DOC doesn't mean the file is a QUILL formatted document, a text based document, a Microsoft WORD or Office style document. Nothing changes as far as the QL is concerned. Now you could say the same for other systems, a '.exe' file extension doesn't mean that the file is an executable machine code program, true!. Many people use the method of changing the file extension to trick the operating system in to doing something else with the file.

It does trigger (if registered with the operating system) certain things to happen, like allocation to a program or process if the file in question is clicked or double clicked. Even how you see the file being displayed in a file list can change if the extension is changed to that file.

So to my possibly naive question.

At the moment I am doing a lot of cross systems work between the QL emulations and Windows, the bugbear is the compatibility of the extension the _BAS _DOC _EXE etc., viewing the files and the number clicks you have to do in order to open up a file just to glance at the contents. Then I had a possible light bulb moment.

I presume the ROM(s) Minerva, JS HBA etc. (in electronic form obviously) have some form of definition table somewhere that says something along the lines of [treat this as a valid character for filename/folder separation "_" or CHR$(95) HEX 5F ]. So is it feasible to hack the ROM and replace the _ with . so that LOAD flp1.betterbasic.bas would be a valid syntax?

Re: The Underscore

Posted: Thu Mar 13, 2014 11:41 am
by tofro
Mr_Navigator wrote::No flaming please:
Has there ever been here? ;)
Mr_Navigator wrote: In principle, the underscore is inherent in QL systems for file attributes
You cannot DIR FLP1 you need FLP1_
As an indication filename_BAS, file_EXT, file_TASK, filename_OBJ provide a clue as to their file type
Right.
Mr_Navigator wrote: File extensions on the QL are cosmetic and provide no other useful function than a aesthetic one.
That is true for "standard QDOS", users of FileInfo will, however, heavily object. (For users that don't know FileInfo, it is an utility that basically allows a list of actions by applications based on file extension/types, you can, for example tell QPAC2 through this utility to "EX" files with extensions _obj and _exe, "edit" files with extension "_txt" or "load" files with extension "_bas".)
Mr_Navigator wrote: It does trigger (if registered with the operating system) certain things to happen, like allocation to a program or process if the file in question is clicked or double clicked. Even how you see the file being displayed in a file list can change if the extension is changed to that file.
that's exactly what FileInfo does.
Mr_Navigator wrote: I presume the ROM(s) Minerva, JS HBA etc. (in electronic form obviously) have some form of definition table somewhere that says something along the lines of [treat this as a valid character for filename/folder separation "_" or CHR$(95) HEX 5F ]. So is it feasible to hack the ROM and replace the _ with . so that LOAD flp1.betterbasic.bas would be a valid syntax?
why don't you simply do a " LOAD 'flp1_betterbasic.bas' "? That's a perfectly valid syntax. (Your original example does actually work on SMSQ/E if you leave the device name properly formatted))

The underscore has (unfortunately) quite a number of uses in QDOS:
  • Divides device name from path (the ":" in DOS and Windows)
  • Can be a 'real' part of the file name
  • Acts as a path divider character (The "\" in DOS and Windows)
  • Acts as a divider between filename and extension (by convention only, the "." in DOS and Windows)
  • Acts as a wildcard character in TK2 ("?" and "*" in DOS and Windows)
Because of those multiple uses (some mandatory, some just by convention), I would assume it would be very difficult (and in its end result very confusing) if it would simply be replaced by a ".".

Regards,
Tobias

Re: The Underscore

Posted: Fri Mar 14, 2014 3:36 am
by swensont
There is a further question; Why do we use only 3 characters for an extension?

This is a hold over from CP/M and DOS. Unix does not use extentions per say, and almost any file can be set to be an executable. In the early days, a real web page ended with .html. With the limitation of DOS and Windows, it got shortened to .htm.

The extension is a convention that has been utilized by file managers to determine what to do with a file once it is double-clicked on. It is easy to set a file manager to open unzip when a .doc file is double-clicked (not that unzip could do anything with it).