diff options
Diffstat (limited to 'js/codemirror/mode/clike/index.html')
-rw-r--r-- | js/codemirror/mode/clike/index.html | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/js/codemirror/mode/clike/index.html b/js/codemirror/mode/clike/index.html deleted file mode 100644 index 89241c08..00000000 --- a/js/codemirror/mode/clike/index.html +++ /dev/null | |||
@@ -1,102 +0,0 @@ | |||
1 | <!doctype html> | ||
2 | <html> | ||
3 | <head> | ||
4 | <title>CodeMirror 2: C-like mode</title> | ||
5 | <link rel="stylesheet" href="../../lib/codemirror.css"> | ||
6 | <script src="../../lib/codemirror.js"></script> | ||
7 | <script src="clike.js"></script> | ||
8 | <link rel="stylesheet" href="../../theme/default.css"> | ||
9 | <link rel="stylesheet" href="../../css/docs.css"> | ||
10 | <style>.CodeMirror {border: 2px inset #dee;}</style> | ||
11 | </head> | ||
12 | <body> | ||
13 | <h1>CodeMirror 2: C-like mode</h1> | ||
14 | |||
15 | <form><textarea id="code" name="code"> | ||
16 | /* C demo code */ | ||
17 | |||
18 | #include <zmq.h> | ||
19 | #include <pthread.h> | ||
20 | #include <semaphore.h> | ||
21 | #include <time.h> | ||
22 | #include <stdio.h> | ||
23 | #include <fcntl.h> | ||
24 | #include <malloc.h> | ||
25 | |||
26 | typedef struct { | ||
27 | void* arg_socket; | ||
28 | zmq_msg_t* arg_msg; | ||
29 | char* arg_string; | ||
30 | unsigned long arg_len; | ||
31 | int arg_int, arg_command; | ||
32 | |||
33 | int signal_fd; | ||
34 | int pad; | ||
35 | void* context; | ||
36 | sem_t sem; | ||
37 | } acl_zmq_context; | ||
38 | |||
39 | #define p(X) (context->arg_##X) | ||
40 | |||
41 | void* zmq_thread(void* context_pointer) { | ||
42 | acl_zmq_context* context = (acl_zmq_context*)context_pointer; | ||
43 | char ok = 'K', err = 'X'; | ||
44 | int res; | ||
45 | |||
46 | while (1) { | ||
47 | while ((res = sem_wait(&context->sem)) == EINTR); | ||
48 | if (res) {write(context->signal_fd, &err, 1); goto cleanup;} | ||
49 | switch(p(command)) { | ||
50 | case 0: goto cleanup; | ||
51 | case 1: p(socket) = zmq_socket(context->context, p(int)); break; | ||
52 | case 2: p(int) = zmq_close(p(socket)); break; | ||
53 | case 3: p(int) = zmq_bind(p(socket), p(string)); break; | ||
54 | case 4: p(int) = zmq_connect(p(socket), p(string)); break; | ||
55 | case 5: p(int) = zmq_getsockopt(p(socket), p(int), (void*)p(string), &p(len)); break; | ||
56 | case 6: p(int) = zmq_setsockopt(p(socket), p(int), (void*)p(string), p(len)); break; | ||
57 | case 7: p(int) = zmq_send(p(socket), p(msg), p(int)); break; | ||
58 | case 8: p(int) = zmq_recv(p(socket), p(msg), p(int)); break; | ||
59 | case 9: p(int) = zmq_poll(p(socket), p(int), p(len)); break; | ||
60 | } | ||
61 | p(command) = errno; | ||
62 | write(context->signal_fd, &ok, 1); | ||
63 | } | ||
64 | cleanup: | ||
65 | close(context->signal_fd); | ||
66 | free(context_pointer); | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | void* zmq_thread_init(void* zmq_context, int signal_fd) { | ||
71 | acl_zmq_context* context = malloc(sizeof(acl_zmq_context)); | ||
72 | pthread_t thread; | ||
73 | |||
74 | context->context = zmq_context; | ||
75 | context->signal_fd = signal_fd; | ||
76 | sem_init(&context->sem, 1, 0); | ||
77 | pthread_create(&thread, 0, &zmq_thread, context); | ||
78 | pthread_detach(thread); | ||
79 | return context; | ||
80 | } | ||
81 | </textarea></form> | ||
82 | |||
83 | <script> | ||
84 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { | ||
85 | lineNumbers: true, | ||
86 | matchBrackets: true, | ||
87 | mode: "text/x-csrc" | ||
88 | }); | ||
89 | </script> | ||
90 | |||
91 | <p>Simple mode that tries to handle C-like languages as well as it | ||
92 | can. Takes two configuration parameters: <code>keywords</code>, an | ||
93 | object whose property names are the keywords in the language, | ||
94 | and <code>useCPP</code>, which determines whether C preprocessor | ||
95 | directives are recognized.</p> | ||
96 | |||
97 | <p><strong>MIME types defined:</strong> <code>text/x-csrc</code> | ||
98 | (C code), <code>text/x-c++src</code> (C++ | ||
99 | code), <code>text/x-java</code> (Java | ||
100 | code), <code>text/x-groovy</code> (Groovy code).</p> | ||
101 | </body> | ||
102 | </html> | ||