You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
3.4 KiB

  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"><h1>CodeMirror</h1>
  16. <img id=logo src="../../doc/logo.png">
  17. </a>
  18. <ul>
  19. <li><a href="../../index.html">Home</a>
  20. <li><a href="../../doc/manual.html">Manual</a>
  21. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  22. </ul>
  23. <ul>
  24. <li><a href="../index.html">Language modes</a>
  25. <li><a class=active href="http://en.wikipedia.org/wiki/TTCN">TTCN</a>
  26. </ul>
  27. </div>
  28. <article>
  29. <h2>TTCN example</h2>
  30. <div>
  31. <textarea id="ttcn-code">
  32. module Templates {
  33. /* import types from ASN.1 */
  34. import from Types language "ASN.1:1997" all;
  35. /* During the conversion phase from ASN.1 to TTCN-3 */
  36. /* - 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_)*/
  38. // simple types
  39. template SenderID localObjid := objid {itu_t(0) identified_organization(4) etsi(0)};
  40. // complex types
  41. /* ASN.1 Message-Type mapped to TTCN-3 Message_Type */
  42. template Message receiveMsg(template (present) Message_Type p_messageType) := {
  43. header := p_messageType,
  44. body := ?
  45. }
  46. /* ASN.1 objid mapped to TTCN-3 objid_ */
  47. template Message sendInviteMsg := {
  48. header := inviteType,
  49. body := {
  50. /* optional fields may be assigned by omit or may be ignored/skipped */
  51. description := "Invite Message",
  52. data := 'FF'O,
  53. objid_ := localObjid
  54. }
  55. }
  56. template Message sendAcceptMsg modifies sendInviteMsg := {
  57. header := acceptType,
  58. body := {
  59. description := "Accept Message"
  60. }
  61. };
  62. template Message sendErrorMsg modifies sendInviteMsg := {
  63. header := errorType,
  64. body := {
  65. description := "Error Message"
  66. }
  67. };
  68. template Message expectedErrorMsg := {
  69. header := errorType,
  70. body := ?
  71. };
  72. template Message expectedInviteMsg modifies expectedErrorMsg := {
  73. header := inviteType
  74. };
  75. template Message expectedAcceptMsg modifies expectedErrorMsg := {
  76. header := acceptType
  77. };
  78. } with { encode "BER:1997" }
  79. </textarea>
  80. </div>
  81. <script>
  82. var ttcnEditor = CodeMirror.fromTextArea(document.getElementById("ttcn-code"), {
  83. lineNumbers: true,
  84. matchBrackets: true,
  85. mode: "text/x-ttcn"
  86. });
  87. ttcnEditor.setSize(600, 860);
  88. var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
  89. CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
  90. </script>
  91. <br/>
  92. <p><strong>Language:</strong> Testing and Test Control Notation
  93. (<a href="http://en.wikipedia.org/wiki/TTCN">TTCN</a>)
  94. </p>
  95. <p><strong>MIME types defined:</strong> <code>text/x-ttcn,
  96. text/x-ttcn3, text/x-ttcnpp</code>.</p>
  97. <br/>
  98. <p>The development of this mode has been sponsored by <a href="http://www.ericsson.com/">Ericsson
  99. </a>.</p>
  100. <p>Coded by Asmelash Tsegay Gebretsadkan </p>
  101. </article>