UNPKG

codemirror-mode-chapel

Version:
60 lines (48 loc) 1.6 kB
<!DOCTYPE html> <html> <meta charset="utf-8"/> <head> <title>test</title> <script src="./node_modules/codemirror/lib/codemirror.js"></script> <link rel="stylesheet" href="./node_modules/codemirror/lib/codemirror.css"> <script src="./index.js"></script> </head> <body> <div><textarea id="c-code"> /* Chapel demo code */ // This test is intended to ensure that a warning message is emitted when // the specified value of CHPL_RT_NUM_THREADS_PER_LOCALE is higher than the // system supports (256 for gasnet, for example). use Time; config const numThreads = 3000; var total: sync int = 0; var seed = getCurrentTime() : uint(32); proc foo (x) { proc RandomNumber (y) { const multiplier: int(64) = 16807, modulus: int(64) = 2147483647; // The following calculation must be done in at least 46-bit arithmetic! seed = (seed * multiplier % modulus) : uint(32); return (seed-1) / (modulus-2) : real; } var delay = RandomNumber (x) * 4.0; if delay < 2.0 then sleep (delay : uint); else for i in 1..(delay*10000.0) : int do delay = RandomNumber (x) * 4.0; total += x; } coforall i in 1..numThreads do foo (i); writeln ("total is ", total.readFF()); </textarea></div> <script> var cEditor = CodeMirror.fromTextArea(document.getElementById("c-code"), { lineNumbers: true, matchBrackets: true, mode: "text/chapel" }); // var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault; // CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete"; </script> </body> </html>