Commit ddddc660 authored by Matthias Simon's avatar Matthias Simon
Browse files

Update log and Annex A

parent 2a6dcc46
Loading
Loading
Loading
Loading
+42 −12
Original line number Diff line number Diff line
@@ -12,9 +12,10 @@ function log(in any args...);
**Semantic Description**

Given _arguments_ shall be evaluated according to the rules specified in
[parameterization]. Their values are passed to the `log` function, their
[string representation] is logged to the logging stream associated with the
current component.
[parameterization].

The resulting values are passed to the `log` function, their [string representation] is
logged to the logging stream associated with the current component.

> NOTE: The implementation of the logging stream is outside the scope of
> this document.
@@ -24,15 +25,44 @@ current component.
> statement should not (explicitly or implicitly) change component variable
> values, port or timer status.

The following string representations are recommended:
The recommended representation is TTCN-3 syntax representation as described in
[Annex A].

- an uninitialized value is logged as `-`.
- a value of `record of`, `set of` and array types should be represented using 
  [value list notation] (e.g. `{1,2,3}`)
- A value of `map`, `record`, `set` and `union` types should be represented
  using [field assignment list notation] (e.g. `{ field1 := 23, field2 :=
  {1,2,3}}`) 
- A value of an enumerated types should log the qualified enumerated label. If the
  enumerated label has a concrete value it should be logged in parentheses.
- A timer reference should log its state: `inactive`, `running` or `expired`.
- A port reference should log its state: `started` or `stopped`.
- A default reference should log its state: `activated` or `deactivated`
- A component reference should log its name, if available followed by its state (`inactive`, `running`, `stopped` or `killed`).

```ttcne example="arguments are evaluated"
control {
    log(1+2); // expected output: 3
}
```

| Language Element | What is logged |
|------------------|----------------|
|Concrete value| the value itself|
|Uninitialized value| "UNINITIALIZED"|
|Component reference|actual state and, if available, component instance name|
|Port reference|actual port state|
|Timer reference|actual time state|
|Default reference|actual default state|
```ttcn3 example="log enumerated values"
type enumerated E {
    A(1),
    B(2..10),
}

control {
    log(E.A) // expected output: E.A
    log(E.B(2)) // exptected output: E.B(2)
}
```

```ttcn3 example="log component reference"
type component C {}
testcase tc() {
    log(mtc); // expected output: `running`
    log(C.create("ptc")) // expected output: `ptc:running`
}
```
+1 −1
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ matching_symbol ::= "?" | "*".

### Other literals

`-` may be used as a placeholder for an omitted value.
`-` may be used as a placeholder for an uninitialized value

```ebnf
omitted ::= "-".