all repos — NoPaste @ edb00b0ab136a96023b51a3e1c59d21a807d66a2

Resurrected - The PussTheCat.org fork of NoPaste

scripts/CodeMirror/mode/ttcn/index.html (view raw)

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