Method of forming a message file in a computer

Abstract: A method for forming a file of messages in a computer includes the step of first forming a first file portion as a message word table having entries corresponding to the message words, said entries ordered in the table by their frequency of occurrence in the messages. Then, a second portion as a message token string table containing a token string for each message is formed, where each token string includes several tokens, each representing a word or variable in the message. The tokens are located in the string according to the location of the corresponding words in the message. Each token has a value that represents the location of its corresponding word in the message word table. The third step includes forming a third file portion as a message look-up table that contains a unique identifier for each message and a corresponding pointer that indicates the address of a token in the token string table. In addition, the messages are retrieved by first locating the identifier in a message look-up table portion of a message file, and then retrieving a pointer that corresponds to the identifier. The pointer is used to locate the first token of a token string that represents the words and variables of a message. Each of the tokens is then used to access the message word table or is decoded to represent the variables, the words and variables are assembled in a buffer in the order of occurrence in the message token string to form an assembled or formatted message.

Description: This invention relates to forming message files in a computer. In order for a computer to communicate with an operator, a computer program often includes messages that are selectively displayed to the operator to communicate the requirement for further inputs or the results of some process. As computer programs tend to become more "user friendly", the number of messages employed by the program will increase in order to facilitate communications with the user. As the number of messages increase, the memory storage required by the computer program also increases. Therefore, there exists a need to efficiently provide messages to the user without overburdening the computer storage facilities. A technique used for efficiently employing memory storage is data or text compression. One method of text compression is disclosed in the IBM Technical Disclosure Bulletin, Vol. 24, No. 1B, June, 1981, entitled "Text Compaction by Word Mapping", which discusses Huffman coding and a word mapping technique that is used to access letters or symbols efficiently when retrieving text. A second technique is disclosed in the IBM Technical Disclosure Bulletin, Vol. 24, No. 9, February, 1982, entitled "Message and Menu Tables Compaction/Compression", that discloses a technique for accessing messages using character symbolic names. This technique uses several tables that define different attributes of each message. Compaction of the text is accomplished by recognizing redundancy of data in the messages and then providing the data only once in a table. The redundant data is represented by variable length code words. Another message compression technique is disclosed in IBM Technical Disclosure Bulletin, Vol. 23, No. 9, February, 1981, entitled "Message Compression Method" that discusses the use of local memory to store portions of compressed message symbol strings wherein special commands in the compressed message string provide an address to a pointer that points to a local memory location including the often used symbol or symbols. A further message compression technique is disclosed in IBM Technical Disclosure Bulletin, Vol. 27, No. 12, May, 1985, entitled "Vocabulary-Based Memory Compression". This disclosure discusses the use of a read-only memory (or read-only storage) to store several universally used words. Additionally, the computer will include a random access memory (RAM) that is used to store words that are unique to a document to be provided by the computer. By providing the universally used words in ROM. These often used words do not have to be stored in RAM but may be recalled by the their ROM address. When a document is processed, this universal word memory is used to allow coding of the commonly used words. These codes require much less memory space than do the words themselves. Therefore, by using the universal word ROM, messages can be stored in less memory space than if the words were not encoded. A further aspect of message file structure includes the requirement that the message file be easily accessible for translation when a program is to be used in foreign countries. In other words, the messages contained in the computer program should be easily accessible so that these words may be translated into corresponding words of a foreign language enabling computer operators in a foreign country to use the program. The Article "Message Generator" in IBM Technical Disclosure Bulletin, Vol 17, No 11, April 1975, page 3402 and WO -A- 85/0184 disclose in general terms apparatus and methods for forming, in a computer system, a data file of a plurality of messages to be used in the computer system. In each case the method involves forming first, second and third file portions. The first file portion is a message word table having entries corresponding to message words. The second file portion is a message token string table containing a token string for each message. The third file portion is a message table containing an identifier for each message indicating the address of the corresponding token string. The methods disclosed do not define the ordering of the message word entries or the message tokens in any particular way. The object of the present invention is to provide an improved method and apparatus for forming, in a computer system, a data file of a plurality of messages to be used in the computer system. The present invention relates to a method for forming, in a computer system, a data file of a plurality of messages comprising the steps of: forming a first file portion as a message word table having unique entries corresponding to the message words, forming a second file portion as a message token string table containing a token string for each message, each token string including a plurality of tokens each representing a word in the corresponding message, and forming a third file portion as a message table containing a unique identifier for each message and a corresponding pointer indicating the address of the token string in the message token string table for the corresponding message. According to the invention the method is characterised in that the message word entries in the message word table are ordered in the table by the frequency of occurrence of their corresponding words in the messages, and the message tokens in the message token string table are ordered in each string by the location of their corresponding words in the corresponding message, each token having a value representing the location of its corresponding word in the message word table. The invention also relates to a computer system comprising a data file for a plurality of messages comprising: a first storage device for storing a first file portion as a message word table having unique entries corresponding to the message words, a second storage device for storing a second file portion as a message token string table containing a token string for each message, each token string including a plurality of tokens each representing a word in the corresponding message, and a third storage device for storing a third file portion as a message table containing a unique identifier for each message and a corresponding pointer indicating the address of the token string in the message token string table for the corresponding message. According to the invention the computer system is characterised in that the first storage device comprises means for ordering the message word entries in the message word table by their frequency of occurrence of their corresponding words in the messages, and the second storage device comprises means for ordering the message tokens in the message token string table by the location of their corresponding words in the corresponding message, each token having a value representing the location of its corresponding word in the message word table. In the preferred embodiment of the invention described in detail later, a unique method for building a compressed message file is provided. A message is defined as a sequence of words comprising information to be communicated from a program to a human operator. The unique method here described consists of building the compressed message file in three distinct parts. The first part of the message consists of a table of words, (symbol table), comprising a single instance of each word contained in the file of message text. These words are ordered according to their frequency of occurrence in the message file. The second part consists of a series of tokens for each message. This series of tokens is ordered in the same way as the words in the message that they represent. Besides showing the order of words in the message, a word token (representing a message word) also indicates whether the word is followed by a space or a non-space in the message, and a value that represents the location of the corresponding word in the symbol table described above. In addition to representing words in the message, a token may also be used as a placeholder for variable information to be inserted into a message immediately before a using program displays the message to the program user. This type of token indicates whether the variable is followed by a space or non-space in the message and what type of variable is to be provided by the program for insertion into the message. Allowable variable types are character string (i.e. a text word), an integer that must be converted from its computer internal form into a character string, or a ring, which is a set of predefined words, one of which will be selected by the program for insertion into the message immediately prior to displaying the message to the user. A special token is placed at the end of the message token string indicating the end of message has been reached. The third part of the compressed message file consists of a table of entries (one for each message in the message file) each of which contains the message number of its corresponding message and the location in the compressed message file of the set of tokens describing the message. All messages to be used by the program for display to an operator are initially placed in a source message file in a form easily used and modified by a human (i.e. in English or another country's language). This source message file can be easily translated from one language to another for use in countries other than those using the language in which the messages were originally written. When the source message file is completed (in the correct language), the source message file is processed by a program (message compiler) that builds a compressed message file in the form described above. This compressed message file (computer friendly rather than user friendly) is then distributed with the program for use in the country corresponding to the language used in the source message file. The source file can be translated into multiple languages, compiled for the respective language and distributed with the programs in the using country. Only the source message file need be modified and recompiled for different languages. Keeping all language dependent information in the message file obviates the need for modifying programs for use in multiple countries. In the message word table (or symbol table), each series of word characters includes a special terminating character to indicate the end of the word. The tokens in the token string indicate the location of the words in the message word table by containing a value which is the offset location of the word in the message word table. This value signifies the location of the corresponding word in double byte increments. Further, certain tokens contain only single bytes of information and correspond to the location of the more frequently used words in the message word table (i.e. those near the front of the table). Another aspect of the preferred embodiment is the use of tokens to indicate the location of variables in the message string. These variables are defined by their tokens as being one of several different types. One type of token is termed a ring variable which is a variable that indicates one of a plurality of words. The ring variable token is contained in the token string and the words to be indicated by the ring variable are contained in the message word table and indicated by the corresponding word tokens in the token string adjacent to the ring variable token. Also in the preferred embodiment is a method of retrieving a message having a unique identifier including the steps of locating the identifier in the message look-up table portion of the file and retrieving a pointer corresponding to the identifier. The pointer is then used to access the token string table to access the specific token string representing the message. Each token is then used to locate each word of the message in the message word table. The words are assembled in a buffer in the order of their corresponding token appearance in the token string. The assembled words in the buffers are then passed as the assembled message. The preferred embodiment will now be described, by way of example, with reference to the accompanying figures, wherein: Fig. 1 is a block diagram illustrating the compilation of a message source file into a compressed message object file; Fig. 2 is a block diagram illustrating the formatting of a message from the message object file; Fig. 3 is a block flow chart illustrating the formation or compilation of a message object file; Fig. 4 is a block flow chart illustrating the formatting of a message from the message object file; Fig. 5 is a block diagram illustrating the internal contents of a message object file; Fig. 6 is a diagram illustrating the contents of the message symbol table; Fig. 7 is a diagram illustrating the contents of the message token string table; Fig. 8 is a diagram illustrating the interrelationship between the message look-up table, the message token string table, and the message symbol table; and Fig. 9 is a diagram illustrating a message containing a ring variable. The present arrangement addresses the problem of providing efficient storage of messages used by computer programs. It does this by providing a mechanism to generate a message object file in a compact or compressed manner to save computer memory while still providing easy access to the words in the messages. Figure 1 is a block diagram illustrating the compilation of a message source file. All the messages are in a file labelled message source file 10. The message source file 10 is then compiled by a compiler 12 to provide object code in a message object file 14. Figure 2 illustrates the formatting of a message during the run-time execution of a program using the message object file. Specifically, the application program is referred to in Figure 2 as the run-time execution program 16. This run-time execution program 16 issues a message call 18 to a message service routine 20. The message service routine accesses the message object file 14. The message service routine 20 then provides the formatted message 24 back to the run-time execution program 16. As previously discussed, this formatted message would often appear on a display or some output to an operator to communicate either a request for further input or the result of some process to this operator. Figure 3 illustrates the process of forming the message object file 14 through use of a compiler 12. First, all messages and their associated message numbers are input in block 26. The messages are assembled from their source code. Table 2 set out hereinafter illustrates an example of source code that defines a message and variable. The message source reads "Device number %1 is %2". %1 is an integer as illustrated. This integer defines the integer number for the device in the message. %2 defines the second variable which, from the source code, is a ring variable that is to specify either "on-line" or "off-line". A message symbol table is then constructed in step 30. The construction of the message symbol table includes the forming of a table of one instance of each word contained in all messages in order starting with the most frequently used word in the messages to the least frequently used word in the messages. The Message Source File is available for translation to any foreign language. Each of these messages is translated and assembled to form a new Message Source File of messages for that foreign language. This new Message Source File can then be compiled by compiler 12 (Figure 1) to form a new message object file optimized for that foreign language. Figure 6 illustrates a diagram of a message symbol table. In portion 66 of the message symbol table 62, the word "DEVICE" is contained. Note that the table is organized in double byte increments containing one letter for each byte. Additionally, the end of the word is terminated with a blank. Since the table includes double byte increments, and since the word "DEVICE" contains an even number of letters, the entry of the word device in table 62 requires that it be terminated by two blank bytes as illustrated. The words in the message symbol table are accessed by their byte offset as shown. Therefore, a single byte (from 0 to 127) will locate words contained in the first 128 double byte locations in the message symbol table. After all of the words have been placed in the message symbol table 62, the tokens for the words and variables are then formed in step 32 of Figure 3. Table 1 set out hereinafter illustrates the tokens. A word may be represented by either a short word token or a long word token. A short word token provides the offset of a word within the first 128 double byte locations in the message symbol table. A long word token is required for accessing all words in an offset position beyond 128 double byte positions in the message symbol table. The long word token includes a 13 bit half-word offset plus a code bit S that indicates whether there is a trailing space or no trailing space. Note that in the short word token, a trailing space is mandatory. In other words, if a word in a message is not followed by a space, it cannot be represented by a short word token. Variables contained in the messages are also designated with tokens. A short variable token includes the indication of the variable type and the variable number. The variable type represents an indication of whether the variable is an integer, a string of data, the time, the date, or a ring variable. Note that a ring variable cannot be represented by a short variable token. It can only be represented by a long variable token. The long variable token further includes an indication of trailing space and, for a ring variable, the number of ring members. The contents of a ring variable will be explained later. Also note, that if the variable is not followed by a space, it cannot be represented by a short variable token. The last type of token in Table 1 is the end-of-message token. This token designates the end of the token string. Note that the bit values of all short and long tokens and the end-of-message token are unique. By using the tokens, the words in a message can be encoded in a manner that provides the efficient use of computer memory. Returning to Figure 3, in step 34 the token string table is built. This is accomplished by taking each message and encoding the words and variables of the message as tokens and assembling these tokens in an order that represents the corresponding order of the words and variables in the message. These token strings are then assembled into the token string table. The location of the first token in each token string of the token string table is then combined with the message number. The combination of message numbers and their corresponding message token string pointers are then assembled into the message look-up table in step 36. In step 38, three pointers 52, 54 and 56 (Figure 5) are provided. In Figure 5, the message object file 14 is illustrated as including the message token string table 60, the message symbol table 62 and the message look-up table 64. These three tables are pointed to by pointers 52, 54 and 56 which each represent the first location of each table in memory. These pointers are assigned in step 38 and stored accordingly. Additionally, the length of the message look-up table 64 is stored in location 58 in memory. In step 40, the pointers 52, 54, and 56, the look-up table length 58, and the message token string table 60, message symbol table 62, and the message look-up table 64 are assembled to form the message object file. Figure 4 is a flow chart illustrating the process of Figure 2, formatting a message. In Figure 4, the message service routine 20 first receives the message number through a message call. Table 3 illustrates the message call statement in the program source code. Note that the message call statement requires that the program provide the name of the message object file, the message number, the variable pointers, the buffer where the formatted message is to be placed, and the length of the caller's message buffer. In step 43, the message number is used to access the message token string pointer in the message look-up table 64. The message service routine 20 (Figure 2) then accesses the words of the message symbol table 62 using the tokens pointed to by the message token string pointer. In step 48, the accessed words and variables are then assembled in order in a buffer specified by the executing program 16. These words are assembled in the order that is dictated by the order of their corresponding tokens of the token string. The assembled words in the buffer are then sent in step 50 to the run-time execution program 16 as a formatted message. Figure 8 illustrates in a symbolic form the accessing of the words in the message symbol table 62 through a message string in table 60 from the message look-up table 64. In Figure 8, the message pointer 70 in the message look-up table 64 is used to access the first word of the token string in the message token string table 60. Each token is used to access words in the message symbol table 62. Figure 7 illustrates the content of a token string in the message token string table 60. In Figure 7, the message token pointer 70 indicates the address of the first word token 72 in the message token string of the message token string table 60. Each token is arranged in the sequence of its corresponding word or variable in the message. In Figure 7, the order is ascending from word token 72 through variable token 76 to the end token 86. The end token designates the end of the token string. Figure 9 illustrates the message of Table 2. Figure 9 contains reference numbers that correspond to the token table illustrated in Figure 8. Therefore, token 72 references the word "DEVICE" and the message symbol table 62 (Figure 5) likewise token 74 references the word "NUMBER". Token 76 is a variable token that is defined in table 2 as an integer number. The word "IS" is represented by word token 78. Token 80 is a variable number 2 that is defined as a ring variable in Table 2. The ring variable has two possible values, "ON-LINE", and "OFF-LINE". These two words are represented by tokens 82 and 84 in the token string of Figure 7. Note that these are word tokens, even though referenced by a ring variable and will reference words stored in the message symbol table 62. The value of the ring variable represented by token 80 will be furnished by the run-time execution program 16 (Figure 2) during run-time execution through the message call statement (Table 3) and will specify which of the ring words is to be provided in the assembled message (either 1 or 2).

Claims: A method for forming, in a computer system, a data file (10) of a plurality of messages comprising the steps of: forming a first file portion as a message word table (62) having unique entries corresponding to the message words, forming a second file portion as a message token string table (60) containing a token string for each message, each token string including a plurality of tokens each representing a word in the corresponding message, and forming a third file portion as a message table (64) containing a unique identifier for each message and a corresponding pointer indicating the address of the token string in said message token string table (60) for the corresponding message, characterised in that said message word entries in said message word table (62) are ordered in said table by the frequency of occurrence of their corresponding words in said messages, and said message tokens in said message token string table (60) are ordered in each string by the location of their corresponding words in the corresponding message, each token having a value representing the location of its corresponding word in the message word table. A method according to Claim 1 wherein each of said token strings is terminated by a token indicating the end of the token string. A method according to Claims 1 or Claim 2 wherein said tokens include an indication of a terminating space for the word in the message word table. A method according to any of Claims 1 to 3 wherein said word entries each include a terminating user specified character. A method according to any of Claims 1 to 4 wherein said tokens include information indicating an offset location of their corresponding words in the message word table. A method according to any of Claims 1 to 5 wherein said words are stored in two byte increments in the message word table. A method according to any of Claims 1 to 6 wherein said tokens have single byte and double byte lengths, said single byte lengths indicating words within double byte locations in the message word table. A method according to any of Claims 1 to 7 wherein said tokens include tokens to indicate the location of variables in a message. A method according to Claim 8 wherein said variables include a ring variable type indicating one of a plurality of values, said values being stored as words in the message word table and indicated in said token string as a plurality of corresponding tokens following a token representing the ring variable, the specific value of the variable selected being provided when the message is retrieved. A computer system comprising a data file (10) for forming a plurality of messages comprising: a first storage device for storing a first file portion as a message word table (62) having unique entries corresponding to the message words, a second storage device for storing a second file portion as a message token string table (60) containing a token string for each message, each token string including a plurality of tokens each representing a word in the corresponding message, and a third storage device for storing a third file portion as a message table (64) containing a unique identifier for each message and a corresponding pointer indicating the address of the token string in said message token string table (60) for the corresponding message, characterised in that said first storage device comprises means for ordering said message word entries in said message word table (62) by their frequency of occurrence of their corresponding words in said messages, and said second storage device comprises means for ordering said message tokens in said message token string table (60) by the location of their corresponding words in the corresponding message, each token having a value representing the location of its corresponding word in the message word table.

Inventors: ARNOLD HUGH HUMPHRIES, HINTZ THOMAS EDWARD, ARNOLD, HUGH HUMPHRIES, HINTZ, THOMAS EDWARD
Applicants: IBM, INTERNATIONAL BUSINESS MACHINES CORPORATION
Application year: 1987
Main classification: G06F15
IPC codes: H03M7, G06F9