| 776 |
lars |
1 |
<!doctype html>
|
|
|
2 |
<title>CodeMirror: TTCN mode</title>
|
|
|
3 |
<meta charset="utf-8" />
|
|
|
4 |
<link rel=stylesheet href="../../doc/docs.css">
|
|
|
5 |
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
|
6 |
<script src="../../lib/codemirror.js"></script>
|
|
|
7 |
<script src="ttcn.js"></script>
|
|
|
8 |
<style type="text/css">
|
|
|
9 |
.CodeMirror {
|
|
|
10 |
border-top: 1px solid black;
|
|
|
11 |
border-bottom: 1px solid black;
|
|
|
12 |
}
|
|
|
13 |
</style>
|
|
|
14 |
<div id=nav>
|
|
|
15 |
<a href="http://codemirror.net">
|
|
|
16 |
<h1>CodeMirror</h1>
|
|
|
17 |
<img id=logo src="../../doc/logo.png"> </a>
|
|
|
18 |
<ul>
|
|
|
19 |
<li>
|
|
|
20 |
<a href="../../index.html">Home</a>
|
|
|
21 |
<li>
|
|
|
22 |
<a href="../../doc/manual.html">Manual</a>
|
|
|
23 |
<li>
|
|
|
24 |
<a href="https://github.com/codemirror/codemirror">Code</a>
|
|
|
25 |
</ul>
|
|
|
26 |
<ul>
|
|
|
27 |
<li>
|
|
|
28 |
<a href="../index.html">Language modes</a>
|
|
|
29 |
<li>
|
|
|
30 |
<a class=active href="http://en.wikipedia.org/wiki/TTCN">TTCN</a>
|
|
|
31 |
</ul>
|
|
|
32 |
</div>
|
|
|
33 |
<article>
|
|
|
34 |
<h2>TTCN example</h2>
|
|
|
35 |
<div>
|
|
|
36 |
<textarea id="ttcn-code"> module Templates { /* import types from ASN.1 */ import from Types language "ASN.1:1997" all; /* During the conversion phase from ASN.1 to TTCN-3 */ /* - the minus sign (Message-Type) within the identifiers will be replaced by underscore (Message_Type)*/
|
|
|
37 |
/* - the ASN.1 identifiers matching a TTCN-3 keyword (objid) will be postfixed with an underscore (objid_)*/ // simple types template SenderID localObjid := objid {itu_t(0) identified_organization(4) etsi(0)}; // complex types /* ASN.1 Message-Type
|
|
|
38 |
mapped to TTCN-3 Message_Type */ template Message receiveMsg(template (present) Message_Type p_messageType) := { header := p_messageType, body := ? } /* ASN.1 objid mapped to TTCN-3 objid_ */ template Message sendInviteMsg := { header := inviteType,
|
|
|
39 |
body := { /* optional fields may be assigned by omit or may be ignored/skipped */ description := "Invite Message", data := 'FF'O, objid_ := localObjid } } template Message sendAcceptMsg modifies sendInviteMsg := { header := acceptType, body
|
|
|
40 |
:= { description := "Accept Message" } }; template Message sendErrorMsg modifies sendInviteMsg := { header := errorType, body := { description := "Error Message" } }; template Message expectedErrorMsg := { header := errorType, body := ? };
|
|
|
41 |
template Message expectedInviteMsg modifies expectedErrorMsg := { header := inviteType }; template Message expectedAcceptMsg modifies expectedErrorMsg := { header := acceptType }; } with { encode "BER:1997" } </textarea>
|
|
|
42 |
</div>
|
|
|
43 |
<script>
|
|
|
44 |
var ttcnEditor = CodeMirror.fromTextArea(document.getElementById("ttcn-code"),
|
|
|
45 |
{
|
|
|
46 |
lineNumbers: true,
|
|
|
47 |
matchBrackets: true,
|
|
|
48 |
mode: "text/x-ttcn"
|
|
|
49 |
});
|
|
|
50 |
ttcnEditor.setSize(600, 860);
|
|
|
51 |
var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
|
|
|
52 |
CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
|
|
|
53 |
</script>
|
|
|
54 |
<br/>
|
|
|
55 |
<p>
|
|
|
56 |
<strong>Language:</strong> Testing and Test Control Notation (
|
|
|
57 |
<a href="http://en.wikipedia.org/wiki/TTCN">TTCN</a>) </p>
|
|
|
58 |
<p>
|
|
|
59 |
<strong>MIME types defined:</strong> <code>text/x-ttcn,
|
|
|
60 |
text/x-ttcn3, text/x-ttcnpp</code>.</p>
|
|
|
61 |
<br/>
|
|
|
62 |
<p>The development of this mode has been sponsored by
|
|
|
63 |
<a href="http://www.ericsson.com/">Ericsson </a>.</p>
|
|
|
64 |
<p>Coded by Asmelash Tsegay Gebretsadkan </p>
|
|
|
65 |
</article>
|