DIRECTORY NSString USING [String], Rope USING [ROPE], XMessage USING [MsgID, MsgType]; Message: CEDAR DEFINITIONS = BEGIN Services: TYPE = -- One for each range of messages, used by Message/XMessage layering implementation { scs, -- Services Common Software chs, -- Clearinghouse Service ecs, -- External Commmunication Service fs, -- File Service gws, -- Gateway Service irs, -- Internetwork Router Service its, -- Interactive Terminal Service ps, -- Print Service ms, -- Mail Service mch, -- MCH common rbs, -- Remote Batch Service svm, -- Server Monitor grtr, -- TTY Greeter cmsv, -- Communication Services Area distr, -- Distributed Services area basic, --Basic Services area rxdev}; -- Rank Xerox development Msgkey: TYPE = CARDINAL; MsgkeyList: TYPE = RECORD [ data: SEQUENCE length: CARDINAL OF Msgkey]; StringArray: TYPE = RECORD [ data: SEQUENCE length: CARDINAL OF NSString.String]; Messages: TYPE = RECORD [ data: SEQUENCE length: CARDINAL OF MsgEntry]; MsgEntry: TYPE = RECORD [ msgKey: Msgkey, -- runtime mesage access handle msg: NSString.String, -- message body translationNote: NSString.String _ NIL, -- special instructions to the translators translatable: BOOLEAN _ TRUE, -- IF FALSE do not translate type: XMessage.MsgType _ userMsg, -- assertion as to who the client is id: XMessage.MsgID]; -- unique handle for the life time of message]; Error: ERROR [type: ErrorType]; ErrorType: TYPE = {arrayMismatch, invalidMsgkeyList, invalidStringArray, invalidString, notEnoughArguments}; Get: PROCEDURE [msgkey: Msgkey] RETURNS [msg: NSString.String]; GetList: PROCEDURE [msgkeys: REF MsgkeyList, msgs: REF StringArray]; GetTime: PROCEDURE [] RETURNS [msg: NSString.String]; Expand: PROCEDURE [source: NSString.String, args: REF StringArray] RETURNS [msg: NSString.String]; SetMsgfile: PROCEDURE [file: Rope.ROPE, offset: CARDINAL _ 0]; SetMessages: PROCEDURE [messages: REF Messages]; UnloadMessages: PROCEDURE [service: Services]; END. -- of Message LOG ( time - person - action ) 21-Jan-82 12:11:36 - CKabcenell - Created. 1-Feb-82 10:32:28 - CKabcenell - Redefined Messages TYPE. 12-Feb-82 17:25:51 - CKabcenell - Redefined SetMsgfile. 9-Jun-82 10:08:07 - CKabcenell - Converted to Filing 5.0. - - - - Services 8.0 - - - - 2-Aug-83 10:07:06 - Ciccone - Replaced File.Capability with File.File for Klamath. 27-Oct-83 15:59:49 - McManis - Added zone parameter to Expand and GetTime - - - - Services 10.0 - - - - 9-Apr-85 9:37:04 - Balcon - Added XMessage required changes, redefined MsgEntry, redefined SetMsgfile, added UnloadMessages 29-Apr-85 15:49:27 - McManis - Changed SetMsgfile back to previous definition. Fixed up comments. €Message.mesa Copyright (C) 1982, 1983, 1984, 1985, 1986 by Xerox Corporation. All rights reserved. Revised by: McManis 29-Apr-85 15:49:30 Revised by: Balcon 9-Apr-85 9:49:31 Tim Diebert: October 28, 1986 12:19:56 pm PST << Overview: This interface allows Services existing before Services 10.0 to access messages stored in a message file. The messages are stored as string bodies. The NSStrings that are returned by the Get and GetList operations use the actual pointers to these messages and should not be deallocated. Some of the messages stored in the message file are actually message "templates" which have fields called "diamonds" that need to be replaced with the appropriate arguments. An example of a message containing diamonds is "This <1> cannot be <2>." Possible arguments for <1> would be "file drawer" and "folder". The Expand operation is used to form the desired message, given the message template and an array containing the required number of arguments. The array of string arguments should be arranged in an order corresponding to the diamonds they replace, i.e. <1> will be replaced with array[0], <2> with array[1], etc. The NSStrings that are returned by the GetTime and Expand operations should be deallocated by the client when they are no longer needed. NSString.FreeString should be used to free the strings with the client zone as the zone parameter, or Heap.systemZone if the client used the default zone. Clients are responsible for providing the message data via the SetMessages operation. Calls to SetMessages will be ignored if a message file is available, but clients should ALWAYS include their call to SetMessages in their respective start-up routines. There should be only one SetMessages invocation for each Service. Services which have called SetMessages should call UnloadMessages when they are unloaded to deallocate all space allocated by the message facilities. >> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- TYPES: -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- The following is derived from XMessage.MsgEntry -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- SIGNALS, ERRORS: -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- OPERATIONS: -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Operations for obtaining messages: Returns message corresponding to the given msgkey. Fills the client-supplied array with the requested messages. Returns time of day message. Storage for msg is allocated from z. The client is responsible for deallocating the string with NSString.FreeString. Inserts arguments into a message template: Returns a message consisting of the given template and inserted arguments. Allocates necessary storage from z. The client is responsible for deallocating the string with NSString.FreeString. Start-up Operations: Tells the implementation where to look for the message file. A page offset parameter is provided in case the client wants to use an NSFile. NOTE: SetMsgfile is now obsolete. Clients who need to use a message file should use XMessage. Initializes a set of messages. If a message file is available, then the messages are taken from that file and "messages" are ignored. Otherwise "messages" becomes the client's runtime messages. Unload operations Unload the messages when the Service who are clients of this interface are unloaded. Κ ˜codešœ ™ KšœU™UKšœ&™&Kšœ%™%K™-—K˜K™ K™K™ K™K™τK™K™¦K™Kšœ―Οkœ™ΒK™K™™K˜K˜š ˜ Kšœ œ ˜Kšœœœ˜Kšœ œ˜ —K˜KšΠlnœœ œ˜"˜Kšœ9™9Kšœ™Kšœ9™9—˜šœ œΟcS˜eK˜KšœŸ˜!KšœŸ˜KšœŸ"˜(KšœŸ˜KšœŸ˜KšœŸ˜$KšœŸ˜%KšœŸ˜KšœŸ˜KšœŸ ˜KšœŸ˜KšœŸ˜KšœŸ˜KšœŸ˜%KšœŸ˜$KšœŸ˜Kšœ Ÿ˜"——˜Kšœœœ˜—˜Kš œ œœ œ œœ ˜G—˜Kš œ œœ œ œœ˜Q—˜Kš œ œœ œ œœ ˜G—˜Kšœ/™/—˜šœ œœ˜KšœŸ˜0KšœŸ˜&Kšœ#œŸ*˜SKšœœœŸ˜;Kšœ#Ÿ$˜GKšœŸ/˜E——˜Kšœ9™9Kšœ™Kšœ9™9—˜KšΟnœœ˜—˜Kšœ œ]˜l—˜Kšœ9™9Kšœ ™ Kšœ9™9—˜Kšœ"™"—˜š œ œœ˜?Kšœ2™2——˜š œ œ œœ˜DKšœ<™<——˜š œ œœ˜5Kšœ“™“——K˜˜Kšœ*™*—˜š œ œ!œœ˜bKšœΐ™ΐ——K˜˜Kšœ™—˜š  œ œ œ œ˜>KšœŒ™ŒKšœ^™^——˜š  œ œ œ ˜0KšœΓ™Γ——˜Kšœ™—˜š œ œ˜.KšœU™U——K˜˜KšœŸ ˜—K˜K˜Kšœ˜˜*Kšœ4œ˜9—˜7K˜9—˜K˜R—K˜I˜K˜|—K˜bK˜—…— š%