# XML:Error

### Import List

        Channel
        Msg

Class List
Context |
List |
Mapping |

Class Summary: Context [Detail]

      +---Msg.Context
           |
           +--XML:Error.Context

Inherited Fields
From Msg.Context: id
Constructor Summary
InitContext(Context, String)
NewContext(String): Context Creates a new error context, using the id id.
Method Summary
GetTemplate(Msg, VAR LString) Returns a template string for the message msg.
SetString(Code, String) Maps the error code code onto the error text str.
WriteTemplate(Msg, LString, VAR LString)
Inherited Methods
From Msg.Context: GetTemplate

Class Summary: List [Detail]

      +---Msg.MsgList
           |
           +--XML:Error.List

Inherited Fields
From Msg.MsgList: msgCount, msgList
Constructor Summary
NewList(): List Creates new error list.
Method Summary
Write(Channel) Writes the list of error messages to the ouput channel ch.
Inherited Methods
From Msg.MsgList: Append, AppendList

Class Summary: Mapping [Detail]

      +--XML:Error.Mapping

Type Summary
Char = Char
Code = Code
LChar = LChar
LString = LString
LStringPtr = LStringPtr
Msg = Msg
String = String
StringPtr = StringPtr

Procedure Summary
New(Context, Code): Msg

Variable Summary
errMsgCharPosBase: LONGINT Character position used to refer to the first character of a file in an error message.
errMsgColumnBase: LONGINT Column number used to refer to the first character of a line in an error message.
errMsgLineBase: LONGINT Line number used to refer to the first line in a file in an error message.

Class Detail: Context

Constructor Detail

### InitContext

    PROCEDURE InitContext(c: Context;
                          id: String)

### NewContext

    PROCEDURE NewContext(id: String): Context

> Creates a new error context, using the id id. id should be a module name.

Method Detail

### GetTemplate

    PROCEDURE (context: Context) GetTemplate(msg: Msg;
                          VAR templ: LString)

> Returns a template string for the message msg. The string may contain attribute references. Instead of the reference ``${foo}`', the procedure Msg.GetText will insert the textual representation of the attribute with the name ``foo`'. The special reference ``${MSG_CONTEXT}`' is replaced by the value of context.id, and ``${MSG_CODE}`' with msg.code.

> The default implementation returns this string:

> >     MSG_CONTEXT: ${MSG_CONTEXT}
> >     MSG_CODE: ${MSG_CODE}
> >     attribute_name: ${attribute_name}

> The last line is repeated for every attribute name. The lines are separated by CharClass.eol.

> Pre-condition: msg is not NIL.

> [Description inherited from GetTemplate]

> Redefines: GetTemplate

### SetString

    PROCEDURE (context: Context) SetString(code: Code;
                        str: String)

> Maps the error code code onto the error text str. If a mapping for code exists, it is replaced with the new one.

### WriteTemplate

    PROCEDURE (context: Context) WriteTemplate(msg: Msg;
                            msgText: LString;
                            VAR templ: LString)

Class Detail: List

Constructor Detail

### NewList

    PROCEDURE NewList(): List

> Creates new error list.

Method Detail

### Write

    PROCEDURE (errList: List) Write(ch: Channel)

> Writes the list of error messages to the ouput channel ch. The channel must be writable. The generated list is prefixed by the name of the file to which the errors refer. File names relative to the current working directory are rewritten to relative path names, using the list's `cwdURI' as base.

Class Detail: Mapping

Type Detail

### Char

    TYPE Char = Char

### Code

    TYPE Code = Code

### LChar

    TYPE LChar = LChar

### LString

    TYPE LString = LString

### LStringPtr

    TYPE LStringPtr = LStringPtr

### Msg

    TYPE Msg = Msg

### String

    TYPE String = String

### StringPtr

    TYPE StringPtr = StringPtr

Procedure Detail

### New

    PROCEDURE New(context: Context;
                  code: Code): Msg

Variable Detail

### errMsgCharPosBase

    VAR errMsgCharPosBase: LONGINT

> Character position used to refer to the first character of a file in an error message. The default is ``0`'.

### errMsgColumnBase

    VAR errMsgColumnBase: LONGINT

> Column number used to refer to the first character of a line in an error message. The default is ``0`'.

### errMsgLineBase

    VAR errMsgLineBase: LONGINT

> Line number used to refer to the first line in a file in an error message. The default is ``0`'. Most programs count lines beginning at ``1`', so you might want to change this before calling the XML parser.