home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / MESSGE.ZIP / MESSGEN.TXT < prev   
Text File  |  1990-08-02  |  5KB  |  159 lines

  1.             OS/2 Message Table Generator     May 1988
  2.             (A quick 'n dirty production)
  3.  
  4.  
  5. Introduction
  6. ------------
  7. OS/2 provides support for maintaining messages in
  8. in a separate file from the program. Keeping all
  9. messages in a separate file facilitates the
  10. translation of these messages into other languages.
  11.  
  12. Using OS/2 message facility
  13. ---------------------------
  14. To use this facility, the programmer uses OS/2
  15. calls (eg., DosGetMessage) to refer to messages
  16. in a file. Each message must have a unique number
  17. and the message tables have a very precise format.
  18. The programmer has the bookkeeping burden and must
  19. generally keep track of the mapping of message codes
  20. into messages in the table. This is a PITA.
  21.  
  22. Purpose of MESSGEN
  23. ------------------
  24. MESSGEN allows you to keep a file of mnemonics and messages
  25. using GML tags (thanks to Jim Thatcher for suggesting
  26. that format). It generates the two files needed by
  27. OS/2's MakeMessageFacility.
  28.  
  29. It also generates files for C, MASM and Pascal
  30. that map the mnemonics to integer numbers. These numbers
  31. match the corresponding messages in the message files.
  32. The numbers are generated in sequence and no bookkeeping
  33. is required.
  34.  
  35.  
  36. Example
  37. -------
  38. The file EXAM.TAG contains the following definitions
  39.  
  40. .*Definitions for the EXAM program
  41. :name.DiskSlow
  42. :type.W
  43. :msg.Your floppy disk is running slowly
  44. :emsg.
  45. :help.Try putting a new battery in it
  46. :ehelp
  47. :ename.
  48. :name.FileLost
  49. :type.E
  50. :bind
  51. :msg.This file has been erased. Sorry
  52. :emsg.
  53. :help.That will teach you not to keep backups
  54. :ename.
  55.  
  56. Tags MUST start in column 1.
  57.  
  58. The meaning of the tags are as follows:
  59.    .*         A comment. The line is ignored
  60.    :name.     The mnemonic that you will use to refer to the message
  61.    :type.     OS/2 defines 4 types. They are I, W, E and P.
  62.    :msg.      The message text corresponding to the mnemonic
  63.    :emsg.     Signifies end of msg text
  64.    :help.     Extra help that the user gets on request
  65.    :ehelp.    End of help text
  66.    :ename.    End of this definition
  67.    :bind.     Specifies that this message will be bound
  68.               to an executable file. The sequence number
  69.               is appended to a .PRO file.
  70.  
  71.  
  72. The :msg. and :help. sections are optional. If they are not
  73. defined, then empty messages will be generated. You can
  74. define one without the other. The text of messages and extra
  75. help text can span multiple lines.
  76. The :bind. tag is inserted ahead of a :msg. or :help. tag.
  77.  
  78.  
  79. Run MESSGEN with the following parameters on the command line
  80.  
  81. MESSGEN /c exam.tag
  82.  
  83. The first parameter tells MESSGEN to generate a file suitable
  84. for inclusion in a C program. The second parameter is
  85. the name of the tagged file.
  86.  
  87.  
  88. Output from MESSGEN
  89. -------------------
  90.  
  91. The following files are generated by MESSGEN:
  92.  
  93. exa.h  (For C)
  94. -----
  95. #define DiskSlow 1
  96. #define FileLost 2
  97.  
  98. exa.txt (For input to MkMsgF)
  99. -------
  100. EXA
  101. EXA0001W: Your floppy disk is running slowly
  102. EXA0002E: This file has been erased. Sorry
  103.  
  104. exah.txt (For input to MkMsgF)
  105. --------
  106. EXA
  107. EXA0001H: Try putting a new battery in it
  108. EXA0002H: That will teach you not to keep backups
  109.  
  110.  
  111. The mnemonic names can be used in the DosGetMessage calls.
  112.  
  113.  
  114.  
  115. Controlling the output of MESSGEN
  116. ---------------------------------
  117.  
  118. MESSGEN can accept multiple sets of tagged files and can
  119. generate output for several languages.
  120.  
  121. The general command line format for MESSGEN is:
  122.  
  123. MESSGEN  ╒/p■ ╒/c■ ╒/m■ ╒/b <file>■ ╒/i■ <source files>
  124.  
  125.  
  126.    Switch       Meaning
  127.    --------------------
  128.    /p           Generate constants for Pascal
  129.    /c           Generate #define macros for C
  130.    /m           Generate EQU statements for Masm
  131.    /i           Ignore case when checking for duplicates
  132.    /b           Generate a .PRO file which specifies binding
  133.                 information. <file> should be the name of the
  134.                 executable file to which messages will be bound
  135.                 with the MSGBIND program (See the toolkit for more
  136.                 details on the subject of binding)
  137.  
  138. At least one language switch must be used. Ignoring the case
  139. of names is useful when generating output for Pascal. It's also
  140. useful for Masm if you use Masm's case sensitivity option.
  141. You can then specify a list of one or more files that contain
  142. tagged definitions for processing. Seperate file names with
  143. spaces. Each file may contain a set of definitions. You must
  144. not spread one definition over multiple files.
  145.  
  146. Typing MESSGEN by itself on the command line will generate the
  147. usage message showing the format of parameters.
  148.  
  149.  
  150. Duplicate names
  151. ---------------
  152. MESSGEN will detect duplicate names in the definitions. It will
  153. display the filename and line number of the previous definition.
  154. Upper and lower case names are distinct unless you use the /i
  155. option.
  156.  
  157.  
  158. David Jameson
  159.