Debian Codegraph @

lib_pypy/_syslog_build.py

raw symbols SCIP
1 from cffi import FFI
2
3 ffi = FFI()
4
5 ffi.set_source("_syslog_cffi", """
6 #include <syslog.h>
7
8 #ifndef LOG_NOWAIT
9 #define LOG_NOWAIT -919919
10 #endif
11 #ifndef LOG_PERROR
12 #define LOG_PERROR -919919
13 #endif
14 #ifndef LOG_SYSLOG
15 #define LOG_SYSLOG LOG_DAEMON
16 #endif
17 #ifndef LOG_CRON
18 #define LOG_CRON LOG_DAEMON
19 #endif
20 #ifndef LOG_UUCP
21 #define LOG_UUCP LOG_MAIL
22 #endif
23 #ifndef LOG_NEWS
24 #define LOG_NEWS LOG_MAIL
25 #endif
26 """)
27
28 ffi.cdef("""
29 /* mandatory constants */
30 #define LOG_EMERG ...
31 #define LOG_ALERT ...
32 #define LOG_CRIT ...
33 #define LOG_ERR ...
34 #define LOG_WARNING ...
35 #define LOG_NOTICE ...
36 #define LOG_INFO ...
37 #define LOG_DEBUG ...
38
39 #define LOG_PID ...
40 #define LOG_CONS ...
41 #define LOG_NDELAY ...
42
43 #define LOG_KERN ...
44 #define LOG_USER ...
45 #define LOG_MAIL ...
46 #define LOG_DAEMON ...
47 #define LOG_AUTH ...
48 #define LOG_LPR ...
49 #define LOG_LOCAL0 ...
50 #define LOG_LOCAL1 ...
51 #define LOG_LOCAL2 ...
52 #define LOG_LOCAL3 ...
53 #define LOG_LOCAL4 ...
54 #define LOG_LOCAL5 ...
55 #define LOG_LOCAL6 ...
56 #define LOG_LOCAL7 ...
57
58 /* optional constants, gets defined to -919919 if missing */
59 #define LOG_NOWAIT ...
60 #define LOG_PERROR ...
61
62 /* aliased constants, gets defined as some other constant if missing */
63 #define LOG_SYSLOG ...
64 #define LOG_CRON ...
65 #define LOG_UUCP ...
66 #define LOG_NEWS ...
67
68 /* functions */
69 void openlog(const char *ident, int option, int facility);
70 void syslog(int priority, const char *format, const char *string);
71 // NB. the signature of syslog() is specialized to the only case we use
72 void closelog(void);
73 int setlogmask(int mask);
74 """)
75
76 if __name__ == "__main__":
77 ffi.compile()