Skip to content

How to default a file's external format #2452

@rmkaplan

Description

@rmkaplan

There is a discussion in #2290 about the fact that a dribble file in Medley is open in :MCCS and therefore is not necessarily correctly interpretable by non-Medley tools. This led to a larger discussion, in that PR and also in the 1-21-2026 meeting, about different conventions for determining the external format of a file. For example, that files opened on UNIX might default to :UTF-8 but files on DSK would be :MCCS.

Currently, each FDEV holds its DEFAULTEXTERNALFORMAT, and both UNIX and DSK specify :MCCS (which is also the general system default). That's the external format that is selected by default when FORMAT is not specified as a parameter in the call to OPENSTREAM, and is available from the stream (and can be changed after opening) by STREAMPROP.

But the external format of the stream is not available as a property of a file--a file has no explicit marking to say what format was used at its creation and that can therefore be asserted every time the file is opened (unless there is an explicitly specified FORMAT parameter). (I assume that Unix file systems don't allow arbitrary properties to be associated with files).

We could change the default for the UNIX FDEV, as was suggested. In that case, opening a dribble file as {UNIX}... would produce a file that is interpretable externally, and Medley (presumably Tedit, or SEE) would be able to interpret it internally. The characters would look right in both contexts. If opened on {DSK}, it would look right in Medley but maybe not in other programs.

Another possibility, instead of or in addition to the device, is to key this off the extension, with a built-in list that maps extensions to externalformats. Essentially the same way that the TEXT/BINARY TYPE property is implemented. As an example, if (DRIB :UTF-8) was on the extension-to-format list, (GETFILEINFO '{DSK}xxx.DRIB 'EXTERNAL-FORMAT) would return :UTF-8, and that would be the default format when a .DRIB file is created and when it is later opened. But (GETFILEINFO '{DSK}xxx.txt 'EXTERNAL-FORMAT) would return :MCCS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions