openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

index.html (3490B)


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