ETHZ_Logo RAMSES_Logo_Right   RAMSES   RAMSES_Logo_Left Systems Ecology  
Start    search button      Modules:   A-Z   Function   Layer        QuickRefs:   DM   AuxLib   AuxLibE   SciLib   EasyMW   MW   ISIS   RMSLib

DEFINITION MODULE MsgFile;

  (*******************************************************************

    Module  MsgFile     (DM_V2.2)

      Copyright (c) 1991-2006 by Andreas Fischlin and ETH Zurich.

    Purpose   Retrieval of numbered textual messages from a
              text file.

    Remarks   Typically an error number is associated with
              a particular message text and can be easily
              retrieved from a file for subsequent display.

              Each message must be stored on a single line and
              be written according to the following excerpt
              from such a message file:
                ...
                Reserved for Dialog Machine internal use:
                ========================================
                -   0 , 0 : Not enough memory available! Δ
                -   1 , 0 : The computed value exceeds the INTEGER-range!
                ...
              The first number indicates the message number, the
              second the language of the message. Note that it is
              possible to have several message texts beeing
              associated with the same message number.  This design
              allows to formulate the same meaning of a particular
              message in different languages. The languages
              English, German, French, Italian and a few custom
              definable languages are supported.

              Otherwise texts may be added freely into the file,
              e.g. to document reserved number ranges etc.

              More formally:

              EBNF (start symbol = messages):
                messages = {message|text}.
                message = ['-'] number ['-' number] ',' number [':'] text.
                number = digit {digit}.
                text = {character} EOL.
                EOL = 15C.

              Semantics:  If a number range, e.g. 1 - 4, is
              present, the following text is used for all of the
              messages within the range.

              Implementation restriction:
              There is for each supported language a maximum of 300
              messages available.
              For speed-up reasons, the file is opened and analyzed
              upon the retrieval of the very first message.  The
              file remains open until another is opened or the
              module is quit. Hence do not attempt to access the
              message file from another program (e.g. an editor)
              while it is in use by a running client program.


    Programming

      o Design
        Andreas Fischlin          18/04/1991

      o Implementation
        Andreas Fischlin          18/04/1991


    ETH Zurich
    Systems Ecology
    CHN E 35.1
    Universitaetstrasse 16
    8092 Zurich
    SWITZERLAND

    URLs:
        <mailto:RAMSES@env.ethz.ch>
        <http://www.sysecol.ethz.ch>
        <http://www.sysecol.ethz.ch/SimSoftware/RAMSES>


    Last revision of definition:  29/04/1991  AF

  *******************************************************************)


  CONST
    english = 0; german = 1; french = 2; italian = 3;
    myLanguage1 = 4; myLanguage2 = 5;

    undefMsgNr = -1;


  PROCEDURE SetMessageLanguage(l: INTEGER);
    (*
      Can be called inbetween calls to GetMessage to switch
      from one language to another.
    *)

  PROCEDURE SetAsMessageFile(fn: ARRAY OF CHAR; VAR done: BOOLEAN);
    (*
      Prepare message file with name fn. An eventually currently
      already open message file will first be closed before the new
      one is opened and analyzed for any of above languages.
    *)


  PROCEDURE GetMessage(msgnr: INTEGER; VAR msg: ARRAY OF CHAR);
  PROCEDURE GetNumberedMessage(msgnr: INTEGER; VAR msg: ARRAY OF CHAR);
    (*
      Retrieve message with number msgnr and the associated text
      msg in the currently set language. GetNumberedMessage inserts at
      the begin of msg the number msgnr followed by a ': ', GetMessage
      will omit such a number and retrieve only the text.
    *)


END MsgFile.

  Contact RAMSES@env.ethz.ch Last updated: 25-Jul-2011 [Top of page]