btw, have we seen any indication of how the compiler managed this?
There is a tool that extracts quoted strings into a text file, which was then presumably processed in to a text resource. Ok, so that gets them into the text resource.
But then how did the compiler handle turning the text strings into tuples? I don't recall seeing anything that differentiated {} strings from "" strings, or that performed that functionality. And it was certainly never mentioned in any of the docs we have.
Here's what I was able to gather:
A special SCI file with a .TC extension was used. It contained named arrays of text messages. Each file was assigned a unique script #.
The TC files were compiled using the TC.EXE tool (text compiler?).
This tool generated header *.TH files, and the TEXT.* resources.
The generated TH file defined 3 symbols for each array:
- ArrayName.FILE: The file #
- ArrayName.FIRST: The index of the first text message
- ArrayName.LAST: The index of the last text message
Here's an example from
MSG254.TC in QfG2:
; msg254.tc -- Text messages for QG2 Keapon Laffin (compile with tc)
;Note:
; compile using "tc filename"
; filename must end in .TC
; include filename.TH in your .SC file
; Names have max length of 9 characters
; do not use parens or quotes in comments
; does not support includes or defines
; must have quotes around sentence
(script# 254) ; msgKeapon
(KeaponHi
"Buon giorno!__Good and tag!__Buenas Dias, Senor Caws.__I haven't seen
you in so long."
"Hello!__Bone Jar!__Hi, guy!__Set a spell, take your shoes off!__What
may I do to you?"
"Konnichiwa!__Come and tell me who!__Hola!__How now, brown cow?"
)
(KeaponHi2
"Top o' the morning to ya!__Mar Haba!__What's New, Pussycat?"
"Hail, fellow, well met!__What da ya know, Joe?"
"Ahoy, Goy!__Howdy, Duty.__What's up, Doc?"
)
The resulting
MSG254.TH looked like this:
(define KeaponHi.FILE 254)
(define KeaponHi.FIRST 0)
(define KeaponHi.LAST 2)
(define KeaponHi2.FILE 254)
(define KeaponHi2.FIRST 3)
(define KeaponHi2.LAST 5)
The TH file was included by the dependent script, for example in
RM250.SC we have:
(include msg254.th)
The included definitions allowed the SC script to refer to the text resource.
The Talker class used a
msgFile property to construct the text tuple. It was assigned for example in the
keapon Talker instance, like that:
(instance keapon of Talker
(properties
; ...
msgFile KeaponGNR.FILE
; ...
)
KeaponGNR is one of the text arrays in
MSG254.TC. All of them had a
FILE symbol with value of 254, so any of them could be used to initialize the
msgFile property.
The
keapon::showText method was called with the text index like this:
(keapon showText: KeaponSpells.FIRST)
The
keapon::showText method called the base
Talker::showText with the text index.
Talker::showText used the
msgFile property to build the complete text tuple:
(method (showText what)
(self messages: msgFile what)
)