C-like mode
case 5: p(int) = zmq_getsockopt(p(socket), p(int), (void*)p(string), &p(len)); break;1
/* C demo code */2
3
4
5
6
7
8
9
10
11
typedef struct {12
void* arg_socket;13
zmq_msg_t* arg_msg;14
char* arg_string;15
unsigned long arg_len;16
int arg_int, arg_command;17
18
int signal_fd;19
int pad;20
void* context;21
sem_t sem;22
} acl_zmq_context;23
24
25
26
void* zmq_thread(void* context_pointer) {27
acl_zmq_context* context = (acl_zmq_context*)context_pointer;28
char ok = 'K', err = 'X';29
int res;30
31
while (1) {32
while ((res = sem_wait(&context->sem)) == EINTR);C++ example
39
void Class::Method2(MyType<T, V>* value) {1
2
3
4
namespace {5
enum Enum {6
VAL1, VAL2, VAL37
};8
9
char32_t unicode_string = U"\U0010FFFF";10
string raw_string = R"delim(anything11
you12
want)delim";13
14
int Helper(const MyType& param) {15
return 0;16
}17
} // namespace18
19
class ForwardDec;20
21
template <class T, class V>22
class Class : public BaseClass {23
const MyType<T, V> member_;24
25
public:26
const MyType<T, V>& Method() const {27
return member_;28
}29
30
void Method2(MyType<T, V>* value);31
}32
Java example
28
1
import com.demo.util.MyType;2
import com.demo.util.MyInterface;3
4
public enum Enum {5
VAL1, VAL2, VAL36
}7
8
public class Class<T, V> implements MyInterface {9
public static final MyType<T, V> member;10
11
private class InnerClass {12
public int zero() {13
return 0;14
}15
}16
17
18
public MyType method() {19
return member;20
}21
22
public void method2(MyType<T, V> value) {23
method();24
value.method3();25
member = value;26
}27
}28
Simple mode that tries to handle C-like languages as well as it
can. Takes two configuration parameters: keywords, an
object whose property names are the keywords in the language,
and useCPP, which determines whether C preprocessor
directives are recognized.
MIME types defined: text/x-csrc
(C code), text/x-c++src (C++
code), text/x-java (Java
code), text/x-csharp (C#).
