本站源代码
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.

211 lines
7.9KB

  1. <!doctype html>
  2. <title>CodeMirror: COBOL mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel="stylesheet" href="../../lib/codemirror.css">
  6. <link rel="stylesheet" href="../../theme/neat.css">
  7. <link rel="stylesheet" href="../../theme/elegant.css">
  8. <link rel="stylesheet" href="../../theme/erlang-dark.css">
  9. <link rel="stylesheet" href="../../theme/night.css">
  10. <link rel="stylesheet" href="../../theme/monokai.css">
  11. <link rel="stylesheet" href="../../theme/cobalt.css">
  12. <link rel="stylesheet" href="../../theme/eclipse.css">
  13. <link rel="stylesheet" href="../../theme/rubyblue.css">
  14. <link rel="stylesheet" href="../../theme/lesser-dark.css">
  15. <link rel="stylesheet" href="../../theme/xq-dark.css">
  16. <link rel="stylesheet" href="../../theme/xq-light.css">
  17. <link rel="stylesheet" href="../../theme/ambiance.css">
  18. <link rel="stylesheet" href="../../theme/blackboard.css">
  19. <link rel="stylesheet" href="../../theme/vibrant-ink.css">
  20. <link rel="stylesheet" href="../../theme/solarized.css">
  21. <link rel="stylesheet" href="../../theme/twilight.css">
  22. <link rel="stylesheet" href="../../theme/midnight.css">
  23. <link rel="stylesheet" href="../../addon/dialog/dialog.css">
  24. <script src="../../lib/codemirror.js"></script>
  25. <script src="../../addon/edit/matchbrackets.js"></script>
  26. <script src="cobol.js"></script>
  27. <script src="../../addon/selection/active-line.js"></script>
  28. <script src="../../addon/search/search.js"></script>
  29. <script src="../../addon/dialog/dialog.js"></script>
  30. <script src="../../addon/search/searchcursor.js"></script>
  31. <style>
  32. .CodeMirror {
  33. border: 1px solid #eee;
  34. font-size : 20px;
  35. height : auto !important;
  36. }
  37. .CodeMirror-activeline-background {background: #555555 !important;}
  38. </style>
  39. <div id=nav>
  40. <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  41. <ul>
  42. <li><a href="../../index.html">Home</a>
  43. <li><a href="../../doc/manual.html">Manual</a>
  44. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  45. </ul>
  46. <ul>
  47. <li><a href="../index.html">Language modes</a>
  48. <li><a class=active href="#">COBOL</a>
  49. </ul>
  50. </div>
  51. <article>
  52. <h2>COBOL mode</h2>
  53. <p> Select Theme <select onchange="selectTheme()" id="selectTheme">
  54. <option>default</option>
  55. <option>ambiance</option>
  56. <option>blackboard</option>
  57. <option>cobalt</option>
  58. <option>eclipse</option>
  59. <option>elegant</option>
  60. <option>erlang-dark</option>
  61. <option>lesser-dark</option>
  62. <option>midnight</option>
  63. <option>monokai</option>
  64. <option>neat</option>
  65. <option>night</option>
  66. <option>rubyblue</option>
  67. <option>solarized dark</option>
  68. <option>solarized light</option>
  69. <option selected>twilight</option>
  70. <option>vibrant-ink</option>
  71. <option>xq-dark</option>
  72. <option>xq-light</option>
  73. </select> Select Font Size <select onchange="selectFontsize()" id="selectFontSize">
  74. <option value="13px">13px</option>
  75. <option value="14px">14px</option>
  76. <option value="16px">16px</option>
  77. <option value="18px">18px</option>
  78. <option value="20px" selected="selected">20px</option>
  79. <option value="24px">24px</option>
  80. <option value="26px">26px</option>
  81. <option value="28px">28px</option>
  82. <option value="30px">30px</option>
  83. <option value="32px">32px</option>
  84. <option value="34px">34px</option>
  85. <option value="36px">36px</option>
  86. </select>
  87. <label for="checkBoxReadOnly">Read-only</label>
  88. <input type="checkbox" id="checkBoxReadOnly" onchange="selectReadOnly()">
  89. <label for="id_tabToIndentSpace">Insert Spaces on Tab</label>
  90. <input type="checkbox" id="id_tabToIndentSpace" onchange="tabToIndentSpace()">
  91. </p>
  92. <textarea id="code" name="code">
  93. ---------1---------2---------3---------4---------5---------6---------7---------8
  94. 12345678911234567892123456789312345678941234567895123456789612345678971234567898
  95. 000010 IDENTIFICATION DIVISION. MODTGHERE
  96. 000020 PROGRAM-ID. SAMPLE.
  97. 000030 AUTHOR. TEST SAM.
  98. 000040 DATE-WRITTEN. 5 February 2013
  99. 000041
  100. 000042* A sample program just to show the form.
  101. 000043* The program copies its input to the output,
  102. 000044* and counts the number of records.
  103. 000045* At the end this number is printed.
  104. 000046
  105. 000050 ENVIRONMENT DIVISION.
  106. 000060 INPUT-OUTPUT SECTION.
  107. 000070 FILE-CONTROL.
  108. 000080 SELECT STUDENT-FILE ASSIGN TO SYSIN
  109. 000090 ORGANIZATION IS LINE SEQUENTIAL.
  110. 000100 SELECT PRINT-FILE ASSIGN TO SYSOUT
  111. 000110 ORGANIZATION IS LINE SEQUENTIAL.
  112. 000120
  113. 000130 DATA DIVISION.
  114. 000140 FILE SECTION.
  115. 000150 FD STUDENT-FILE
  116. 000160 RECORD CONTAINS 43 CHARACTERS
  117. 000170 DATA RECORD IS STUDENT-IN.
  118. 000180 01 STUDENT-IN PIC X(43).
  119. 000190
  120. 000200 FD PRINT-FILE
  121. 000210 RECORD CONTAINS 80 CHARACTERS
  122. 000220 DATA RECORD IS PRINT-LINE.
  123. 000230 01 PRINT-LINE PIC X(80).
  124. 000240
  125. 000250 WORKING-STORAGE SECTION.
  126. 000260 01 DATA-REMAINS-SWITCH PIC X(2) VALUE SPACES.
  127. 000261 01 RECORDS-WRITTEN PIC 99.
  128. 000270
  129. 000280 01 DETAIL-LINE.
  130. 000290 05 FILLER PIC X(7) VALUE SPACES.
  131. 000300 05 RECORD-IMAGE PIC X(43).
  132. 000310 05 FILLER PIC X(30) VALUE SPACES.
  133. 000311
  134. 000312 01 SUMMARY-LINE.
  135. 000313 05 FILLER PIC X(7) VALUE SPACES.
  136. 000314 05 TOTAL-READ PIC 99.
  137. 000315 05 FILLER PIC X VALUE SPACE.
  138. 000316 05 FILLER PIC X(17)
  139. 000317 VALUE 'Records were read'.
  140. 000318 05 FILLER PIC X(53) VALUE SPACES.
  141. 000319
  142. 000320 PROCEDURE DIVISION.
  143. 000321
  144. 000330 PREPARE-SENIOR-REPORT.
  145. 000340 OPEN INPUT STUDENT-FILE
  146. 000350 OUTPUT PRINT-FILE.
  147. 000351 MOVE ZERO TO RECORDS-WRITTEN.
  148. 000360 READ STUDENT-FILE
  149. 000370 AT END MOVE 'NO' TO DATA-REMAINS-SWITCH
  150. 000380 END-READ.
  151. 000390 PERFORM PROCESS-RECORDS
  152. 000410 UNTIL DATA-REMAINS-SWITCH = 'NO'.
  153. 000411 PERFORM PRINT-SUMMARY.
  154. 000420 CLOSE STUDENT-FILE
  155. 000430 PRINT-FILE.
  156. 000440 STOP RUN.
  157. 000450
  158. 000460 PROCESS-RECORDS.
  159. 000470 MOVE STUDENT-IN TO RECORD-IMAGE.
  160. 000480 MOVE DETAIL-LINE TO PRINT-LINE.
  161. 000490 WRITE PRINT-LINE.
  162. 000500 ADD 1 TO RECORDS-WRITTEN.
  163. 000510 READ STUDENT-FILE
  164. 000520 AT END MOVE 'NO' TO DATA-REMAINS-SWITCH
  165. 000530 END-READ.
  166. 000540
  167. 000550 PRINT-SUMMARY.
  168. 000560 MOVE RECORDS-WRITTEN TO TOTAL-READ.
  169. 000570 MOVE SUMMARY-LINE TO PRINT-LINE.
  170. 000571 WRITE PRINT-LINE.
  171. 000572
  172. 000580
  173. </textarea>
  174. <script>
  175. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  176. lineNumbers: true,
  177. matchBrackets: true,
  178. mode: "text/x-cobol",
  179. theme : "twilight",
  180. styleActiveLine: true,
  181. showCursorWhenSelecting : true,
  182. });
  183. function selectTheme() {
  184. var themeInput = document.getElementById("selectTheme");
  185. var theme = themeInput.options[themeInput.selectedIndex].innerHTML;
  186. editor.setOption("theme", theme);
  187. }
  188. function selectFontsize() {
  189. var fontSizeInput = document.getElementById("selectFontSize");
  190. var fontSize = fontSizeInput.options[fontSizeInput.selectedIndex].innerHTML;
  191. editor.getWrapperElement().style.fontSize = fontSize;
  192. editor.refresh();
  193. }
  194. function selectReadOnly() {
  195. editor.setOption("readOnly", document.getElementById("checkBoxReadOnly").checked);
  196. }
  197. function tabToIndentSpace() {
  198. if (document.getElementById("id_tabToIndentSpace").checked) {
  199. editor.setOption("extraKeys", {Tab: function(cm) { cm.replaceSelection(" ", "end"); }});
  200. } else {
  201. editor.setOption("extraKeys", {Tab: function(cm) { cm.replaceSelection(" ", "end"); }});
  202. }
  203. }
  204. </script>
  205. </article>
上海开阖软件有限公司 沪ICP备12045867号-1