Message files
Jon Abbott (1421) 2651 posts |
I’ve been looking at using Message files for Module Help/Syntax text and am thoroughly confused. PRM5a-36 states the Messages file format is: token:text null-byte linefeed Looking at a sample of Messages files from OS Modules, none have the null byte, so is PRM5a incorrect? I also can’t figure out how to convert text to a tokenised version using the kernel dictionary. Is there a tool or SWI for this? |
Steve Drain (222) 1620 posts |
The null is required, but just for the Help/Syntax. You should see it in the Messages files in ResourceFS. I have assumed the the kemal dictionary is only for the files in rom and is constructed anew with each compilation. You cannot rely on it for other Messages and it is not really necessary to save memory, except in the rom. |
Jon Abbott (1421) 2651 posts |
As I mentioed, I looked at a sample of Message files from Modules. For example Resources:Resources.BASIC.Messages, the null isn’t there, just the linefeed.
The PRM implies the Kernel dictionary is used for all Module message files. To quote PRM5a-36: The text is output by OS_PrettyPrint (page 1-536)– but in this case, rather than Admittedly, it starts by saying its not using the Kernel dictionary and then quotes Kernel.Dictionary, which to any casual gamer is the Kernel dictionary! |
Julie Stamp (8365) 474 posts |
As Steve says, the dictionary isn’t obligatory (and doesn’t make sense outside of a ROM build) – if you don’t put in an escape sequence (&1B), the text will be read normally.
That’s because there’s two sorts of messages, ones a module looks up itself using MessageTrans, and ones that are looked up by *Help etc. The syntax for a general message is
and the syntax for a help/syntax message is
I believe the reason for the difference is that a help or syntax message could have a newline in it. You can see this in Resources:$.Resources.RAMFS.Messages: SizeErr is linefeed terminated, but HRFSRAM and SRFSRAM are zero – linefeed terminated. In the OS source, a module’s messages are generated from two files, Messages which are looked up by the module itself, and CmdHelp which has the help and syntax strings. |
Jon Abbott (1421) 2651 posts |
The only reason I’m looking at using a Messages file is to compress the Help/Syntax text.
Ah..now I understand. How confusing. I’m not going to ask why Messages don’t have their own FileType, given they’re not standard text files. |
Julie Stamp (8365) 474 posts |
From what I can see there’s three options
|
Charles Ferguson (8243) 427 posts |
It’s 2021. Memory is cheap and optimisation to save bytes is a complete waste of your valuable time. The compression in the messages file has been utterly redundant for many years, even in the ROM. Don’t bother. |
Steve Drain (222) 1620 posts |
However, do use Messages files, because they make internationalisation much simpler. ;-) |