Browse Source

libc: C++ header guards

K. Lange 4 years ago
parent
commit
f40f8b7197
66 changed files with 336 additions and 50 deletions
  1. 9 0
      base/usr/include/_cheader.h
  2. 0 1
      base/usr/include/_xlog.h
  3. 5 0
      base/usr/include/alloca.h
  4. 8 0
      base/usr/include/assert.h
  5. 4 0
      base/usr/include/bits/dirent.h
  6. 5 0
      base/usr/include/ctype.h
  7. 5 0
      base/usr/include/dlfcn.h
  8. 6 0
      base/usr/include/errno.h
  9. 5 0
      base/usr/include/fcntl.h
  10. 6 0
      base/usr/include/getopt.h
  11. 4 0
      base/usr/include/iconv.h
  12. 3 0
      base/usr/include/inttypes.h
  13. 6 0
      base/usr/include/locale.h
  14. 8 0
      base/usr/include/math.h
  15. 6 0
      base/usr/include/poll.h
  16. 4 0
      base/usr/include/pthread.h
  17. 4 0
      base/usr/include/pty.h
  18. 5 0
      base/usr/include/pwd.h
  19. 4 0
      base/usr/include/sched.h
  20. 6 0
      base/usr/include/setjmp.h
  21. 5 0
      base/usr/include/signal.h
  22. 4 0
      base/usr/include/stdio.h
  23. 4 0
      base/usr/include/stdlib.h
  24. 7 0
      base/usr/include/string.h
  25. 3 0
      base/usr/include/strings.h
  26. 4 0
      base/usr/include/sys/fswait.h
  27. 4 0
      base/usr/include/sys/mount.h
  28. 3 0
      base/usr/include/sys/signal.h
  29. 1 0
      base/usr/include/sys/signal_defs.h
  30. 19 22
      base/usr/include/sys/socket.h
  31. 4 0
      base/usr/include/sys/stat.h
  32. 17 12
      base/usr/include/sys/termios.h
  33. 5 0
      base/usr/include/sys/time.h
  34. 5 0
      base/usr/include/sys/types.h
  35. 5 0
      base/usr/include/sys/utsname.h
  36. 5 0
      base/usr/include/sys/wait.h
  37. 6 5
      base/usr/include/syscall.h
  38. 2 0
      base/usr/include/syscall_nums.h
  39. 2 6
      base/usr/include/termios.h
  40. 5 0
      base/usr/include/time.h
  41. 5 0
      base/usr/include/toaru/auth.h
  42. 4 0
      base/usr/include/toaru/confreader.h
  43. 0 2
      base/usr/include/toaru/decodeutf8.h
  44. 5 0
      base/usr/include/toaru/decorations.h
  45. 6 0
      base/usr/include/toaru/drawstring.h
  46. 5 0
      base/usr/include/toaru/graphics.h
  47. 4 0
      base/usr/include/toaru/hashmap.h
  48. 5 0
      base/usr/include/toaru/icon_cache.h
  49. 5 0
      base/usr/include/toaru/kbd.h
  50. 5 0
      base/usr/include/toaru/list.h
  51. 5 0
      base/usr/include/toaru/menu.h
  52. 5 0
      base/usr/include/toaru/mouse.h
  53. 4 0
      base/usr/include/toaru/pex.h
  54. 5 0
      base/usr/include/toaru/rline.h
  55. 5 0
      base/usr/include/toaru/rline_exp.h
  56. 7 0
      base/usr/include/toaru/sdf.h
  57. 6 0
      base/usr/include/toaru/termemu.h
  58. 4 0
      base/usr/include/toaru/textregion.h
  59. 4 1
      base/usr/include/toaru/tree.h
  60. 6 1
      base/usr/include/toaru/yutani-internal.h
  61. 5 0
      base/usr/include/toaru/yutani-server.h
  62. 5 0
      base/usr/include/toaru/yutani.h
  63. 5 0
      base/usr/include/unistd.h
  64. 6 0
      base/usr/include/va_list.h
  65. 4 0
      base/usr/include/wait.h
  66. 3 0
      base/usr/include/wchar.h

+ 9 - 0
base/usr/include/_cheader.h

@@ -0,0 +1,9 @@
+#pragma once
+
+#ifdef __cplusplus
+#   define _Begin_C_Header extern "C" {
+#   define _End_C_Header }
+#else
+#   define _Begin_C_Header
+#   define _End_C_Header
+#endif

+ 0 - 1
base/usr/include/_xlog.h

@@ -1,6 +1,5 @@
 #include <stdint.h>
 #include <stddef.h>
-
 #include <syscall.h>
 
 #define _XLOG(_msg) do { \

+ 5 - 0
base/usr/include/alloca.h

@@ -1,8 +1,13 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
+
 #ifdef __GNUC__
 #define alloca(size) __builtin_alloca(size)
 #else
 #error alloca requested but this isn't gcc
 #endif
 
+_End_C_Header

+ 8 - 0
base/usr/include/assert.h

@@ -1,6 +1,14 @@
+#pragma once
+
+#include <_cheader.h>
+
+_Begin_C_Header
+
 #ifndef NDEBUG
 extern void __assert_func(const char * file, int line, const char * func, const char * failedexpr);
 #define assert(statement) ((statement) ? (void)0 : __assert_func(__FILE__, __LINE__, __FUNCTION__, #statement))
 #else
 #define assert(statement) ((void)0)
 #endif
+
+_End_C_Header

+ 4 - 0
base/usr/include/bits/dirent.h

@@ -1,7 +1,10 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stdint.h>
 
+_Begin_C_Header
+
 typedef struct dirent {
 	uint32_t d_ino;
 	char d_name[256];
@@ -16,3 +19,4 @@ DIR * opendir (const char * dirname);
 int closedir (DIR * dir);
 struct dirent * readdir (DIR * dirp);
 
+_End_C_Header

+ 5 - 0
base/usr/include/ctype.h

@@ -1,5 +1,9 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
+
 extern int isalnum(int c);
 extern int isalpha(int c);
 extern int isdigit(int c);
@@ -30,3 +34,4 @@ extern int toupper(int c);
 
 extern char _ctype_[256];
 
+_End_C_Header

+ 5 - 0
base/usr/include/dlfcn.h

@@ -1,5 +1,9 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
+
 /* Currently unused... */
 #define RTLD_LAZY   (1 << 0)
 #define RTLD_NOW    (1 << 1)
@@ -13,3 +17,4 @@ extern int dlclose(void *);
 extern void * dlsym(void *, const char *);
 extern char * dlerror(void);
 
+_End_C_Header

+ 6 - 0
base/usr/include/errno.h

@@ -1,10 +1,14 @@
 #pragma once
 
+#include <_cheader.h>
+
 /*
  * The bulk of these match Linux.
  * Descriptions come from newlib.
  */
 
+_Begin_C_Header
+
 #define EPERM 1               /* Not super-user */
 #define ENOENT 2              /* No such file or directory */
 #define ESRCH 3               /* No such process */
@@ -133,3 +137,5 @@
 extern int errno;
 #define __sets_errno(...) int ret = __VA_ARGS__; if (ret < 0) { errno = -ret; ret = -1; } return ret
 #endif
+
+_End_C_Header

+ 5 - 0
base/usr/include/fcntl.h

@@ -1,7 +1,10 @@
 #pragma once
 
+#include <_cheader.h>
 #include <sys/types.h>
 
+_Begin_C_Header
+
 #define O_RDONLY     0x0000
 #define O_WRONLY     0x0001
 #define O_RDWR       0x0002
@@ -47,3 +50,5 @@ struct flock {
 extern int open (const char *, int, ...);
 extern int chmod(const char *path, mode_t mode);
 extern int fcntl(int fd, int cmd, ...);
+
+_End_C_Header

+ 6 - 0
base/usr/include/getopt.h

@@ -1,5 +1,9 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
+
 struct option {
     const char *name;
     int has_arg;
@@ -15,3 +19,5 @@ extern int getopt_long(int argc, char * const argv[], const char *optstring, con
 #define no_argument 0
 #define required_argument 1
 #define optional_argument 2 /* Unsupported */
+
+_End_C_Header

+ 4 - 0
base/usr/include/iconv.h

@@ -1,10 +1,14 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stddef.h>
 
+_Begin_C_Header
+
 typedef void * iconv_t;
 
 extern iconv_t iconv_open(const char *tocode, const char *fromcode);
 extern int iconv_close(iconv_t cd);
 extern size_t iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
 
+_End_C_Header;

+ 3 - 0
base/usr/include/inttypes.h

@@ -1,8 +1,11 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stdint.h>
 #include <stddef.h>
 
+_Begin_C_Header
 #define PRIi8 "i"
 #define PRIi16 "i"
 #define PRIi32 "i"
+_End_C_Header

+ 6 - 0
base/usr/include/locale.h

@@ -1,5 +1,9 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
+
 #define LC_ALL      0
 #define LC_COLLATE  1
 #define LC_CTYPE    2
@@ -31,3 +35,5 @@ struct lconv {
 
 extern struct lconv * localeconv(void);
 extern char * setlocale(int category, const char *locale);
+
+_End_C_Header

+ 8 - 0
base/usr/include/math.h

@@ -1,3 +1,9 @@
+#pragma once
+
+#include <_cheader.h>
+
+_Begin_C_Header
+
 #define M_PI 3.1415926
 
 extern double floor(double x);
@@ -34,3 +40,5 @@ extern double atan(double x);
 extern double modf(double x, double *iptr);
 
 extern double hypot(double x, double y);
+
+_End_C_Header

+ 6 - 0
base/usr/include/poll.h

@@ -1,5 +1,9 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
+
 #define POLLIN    0x0001
 #define POLLOUT   0x0002
 #define POLLRDHUP 0x0004
@@ -17,3 +21,5 @@ struct pollfd {
 };
 
 extern int poll(struct pollfd * fds, nfds_t nfds, int timeout);
+
+_End_C_Header

+ 4 - 0
base/usr/include/pthread.h

@@ -1,8 +1,11 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stdint.h>
 #include <syscall.h>
 
+_Begin_C_Header
+
 typedef struct {
 	uint32_t id;
 	char * stack;
@@ -17,3 +20,4 @@ extern int pthread_kill(pthread_t thread, int sig);
 extern int clone(uintptr_t,uintptr_t,void*);
 extern int gettid();
 
+_End_C_Header

+ 4 - 0
base/usr/include/pty.h

@@ -1,4 +1,8 @@
 #pragma once
+
+#include <_cheader.h>
 #include <sys/ioctl.h>
 
+_Begin_C_Header
 extern int openpty(int * amaster, int * aslave, char * name, const struct termios *termp, const struct winsize * winp);
+_End_C_Header

+ 5 - 0
base/usr/include/pwd.h

@@ -1,8 +1,11 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stdio.h>
 #include <sys/types.h>
 
+_Begin_C_Header
+
 struct passwd {
 	char * pw_name;    // username
 	char * pw_passwd;  // password (not meaningful)
@@ -21,3 +24,5 @@ void setpwent(void);
 void endpwent(void);
 struct passwd * getpwnam(const char * name);
 struct passwd * getpwuid(uid_t uid);
+
+_End_C_Header

+ 4 - 0
base/usr/include/sched.h

@@ -1,3 +1,7 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
 extern int sched_yield(void);
+_End_C_Header

+ 6 - 0
base/usr/include/setjmp.h

@@ -1,5 +1,9 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
+
 /* i386 */
 #define _JBLEN 9
 
@@ -7,3 +11,5 @@ typedef int jmp_buf[_JBLEN];
 
 extern void longjmp(jmp_buf j, int r);
 extern int setjmp(jmp_buf j);
+
+_End_C_Header

+ 5 - 0
base/usr/include/signal.h

@@ -1,8 +1,11 @@
 #pragma once
 
+#include <_cheader.h>
 #include <sys/signal.h>
 #include <sys/signal_defs.h>
 
+_Begin_C_Header
+
 typedef _sig_func_ptr sighandler_t;
 
 #define SIG_DFL ((_sig_func_ptr)0)/* Default action */
@@ -13,3 +16,5 @@ typedef int sig_atomic_t;
 
 extern sighandler_t signal(int signum, sighandler_t handler);
 extern int raise(int sig);
+
+_End_C_Header

+ 4 - 0
base/usr/include/stdio.h

@@ -1,8 +1,11 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stddef.h>
 #include <va_list.h>
 
+_Begin_C_Header
+
 typedef struct _FILE FILE;
 
 #define BUFSIZ 8192
@@ -90,3 +93,4 @@ typedef long fpos_t;
 extern int fgetpos(FILE *stream, fpos_t *pos);
 extern int fsetpos(FILE *stream, const fpos_t *pos);
 
+_End_C_Header;

+ 4 - 0
base/usr/include/stdlib.h

@@ -1,7 +1,10 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stddef.h>
 
+_Begin_C_Header
+
 extern void exit(int status);
 extern char * getenv(const char *name);
 
@@ -61,3 +64,4 @@ typedef struct { long int quot; long int rem; } ldiv_t;
 extern div_t div(int numerator, int denominator);
 extern ldiv_t ldiv(long numerator, long denominator);
 
+_End_C_Header

+ 7 - 0
base/usr/include/string.h

@@ -1,6 +1,11 @@
+#pragma once
+
+#include <_cheader.h>
 #include <stdint.h>
 #include <stddef.h>
 
+_Begin_C_Header
+
 extern void * memset(void * dest, int c, size_t n);
 extern void * memcpy(void * dest, const void * src, size_t n);
 extern void * memmove(void * dest, const void * src, size_t n);
@@ -47,4 +52,6 @@ extern char * strncpy(char *dest, const char *src, size_t n);
 extern char * strerror(int errnum);
 extern size_t strxfrm(char *dest, const char *src, size_t n);
 
+_End_C_Header
+
 #include <strings.h>

+ 3 - 0
base/usr/include/strings.h

@@ -1,7 +1,10 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stdlib.h>
 
+_Begin_C_Header
 extern int strcasecmp(const char *s1, const char *s2);
 extern int strncasecmp(const char *s1, const char *s2, size_t n);
+_End_C_Header
 

+ 4 - 0
base/usr/include/sys/fswait.h

@@ -1,4 +1,8 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
 extern int fswait(int count, int * fds);
 extern int fswait2(int count, int * fds, int timeout);
+_End_C_Header

+ 4 - 0
base/usr/include/sys/mount.h

@@ -1,3 +1,7 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
 extern int mount(char * source, char * target, char * type, unsigned long flags, void * data);
+_End_C_Header

+ 3 - 0
base/usr/include/sys/signal.h

@@ -1,7 +1,9 @@
 #pragma once
 
+#include <_cheader.h>
 #include <sys/types.h>
 
+_Begin_C_Header
 #define SIGEV_NONE   1
 #define SIGEV_SIGNAL 2
 #define SIGEV_THREAD 3
@@ -55,3 +57,4 @@ struct sigaction {
 
 
 extern int kill(pid_t, int);
+_End_C_Header

+ 1 - 0
base/usr/include/sys/signal_defs.h

@@ -1,3 +1,4 @@
+#pragma once
 
 /* Signal names (from the Unix specification on signals) */
 #define SIGHUP      1  /* Hangup */

+ 19 - 22
base/usr/include/sys/socket.h

@@ -1,11 +1,10 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stdint.h>
 #include <sys/types.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+_Begin_C_Header
 
 #define AF_INET 1
 #define AF_UNSPEC 0
@@ -28,7 +27,7 @@ struct hostent {
 	char **h_addr_list;       /* list of addresses */
 };
 
-struct hostent * gethostbyname(const char * name);
+extern struct hostent * gethostbyname(const char * name);
 
 typedef size_t socklen_t;
 
@@ -78,31 +77,29 @@ struct msghdr {
 typedef uint32_t in_addr_t;
 typedef uint16_t in_port_t;
 
-ssize_t recv(int sockfd, void *buf, size_t len, int flags);
-ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen);
-ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
+extern ssize_t recv(int sockfd, void *buf, size_t len, int flags);
+extern ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen);
+extern ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
 
 ssize_t send(int sockfd, const void *buf, size_t len, int flags);
 ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen);
 ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags);
 
-int socket(int domain, int type, int protocol);
+extern int socket(int domain, int type, int protocol);
 
-uint32_t htonl(uint32_t hostlong);
-uint16_t htons(uint16_t hostshort);
-uint32_t ntohl(uint32_t netlong);
-uint16_t ntohs(uint16_t netshort);
+extern uint32_t htonl(uint32_t hostlong);
+extern uint16_t htons(uint16_t hostshort);
+extern uint32_t ntohl(uint32_t netlong);
+extern uint16_t ntohs(uint16_t netshort);
 
-int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
-int accept(int sockfd, struct sockaddr * addr, socklen_t * addrlen);
-int listen(int sockfd, int backlog);
-int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
-int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
-int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
-int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
+extern int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
+extern int accept(int sockfd, struct sockaddr * addr, socklen_t * addrlen);
+extern int listen(int sockfd, int backlog);
+extern int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
+extern int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
+extern int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
+extern int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
 
-#ifdef __cplusplus
-}
-#endif
+_End_C_Header
 
 

+ 4 - 0
base/usr/include/sys/stat.h

@@ -1,8 +1,11 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stddef.h>
 #include <stdint.h>
 
+_Begin_C_Header
+
 typedef int mode_t;
 
 struct stat  {
@@ -79,3 +82,4 @@ extern int fstat(int fd, struct stat *st);
 extern int mkdir(const char *pathname, mode_t mode);
 extern mode_t umask(mode_t mask);
 
+_End_C_Header

+ 17 - 12
base/usr/include/sys/termios.h

@@ -1,11 +1,15 @@
 #pragma once
 
+#include <_cheader.h>
+
 #ifndef _KERNEL_
 #include <sys/types.h>
 #else
 #include <kernel/types.h>
 #endif
 
+_Begin_C_Header
+
 /* Technically part of ioctl */
 struct winsize {
 	unsigned short ws_row;
@@ -179,17 +183,18 @@ struct termios {
 
 /* termios functions */
 #ifndef _KERNEL_
-speed_t cfgetispeed(const struct termios *);
-speed_t cfgetospeed(const struct termios *);
-int     cfsetispeed(struct termios *, speed_t);
-int     cfsetospeed(struct termios *, speed_t);
-int     tcdrain(int);
-int     tcflow(int, int);
-int     tcflush(int, int);
-int     tcgetattr(int, struct termios *);
-pid_t   tcgetsid(int);
-int     tcsendbreak(int, int);
-int     tcsetattr(int, int, struct termios *);
-int     ioctl(int, int, void*);
+extern speed_t cfgetispeed(const struct termios *);
+extern speed_t cfgetospeed(const struct termios *);
+extern int     cfsetispeed(struct termios *, speed_t);
+extern int     cfsetospeed(struct termios *, speed_t);
+extern int     tcdrain(int);
+extern int     tcflow(int, int);
+extern int     tcflush(int, int);
+extern int     tcgetattr(int, struct termios *);
+extern pid_t   tcgetsid(int);
+extern int     tcsendbreak(int, int);
+extern int     tcsetattr(int, int, struct termios *);
+extern int     ioctl(int, int, void*);
 #endif /* ndef _KERNEL_ */
 
+_End_C_Header

+ 5 - 0
base/usr/include/sys/time.h

@@ -1,7 +1,10 @@
 #pragma once
 
+#include <_cheader.h>
 #include <sys/types.h>
 
+_Begin_C_Header
+
 struct timeval {
 	time_t      tv_sec;     /* seconds */
 	suseconds_t tv_usec;    /* microseconds */
@@ -13,3 +16,5 @@ struct timezone {
 };
 
 extern int gettimeofday(struct timeval *p, void *z);
+
+_End_C_Header

+ 5 - 0
base/usr/include/sys/types.h

@@ -1,7 +1,10 @@
 #pragma once
 
+#include <_cheader.h>
 #include <limits.h>
 
+_Begin_C_Header
+
 typedef int gid_t;
 typedef int uid_t;
 typedef int dev_t;
@@ -29,3 +32,5 @@ typedef long fd_mask;
 typedef struct _fd_set {
     fd_mask fds_bits[2]; /* should be 64 bits */
 } fd_set;
+
+_End_C_Header

+ 5 - 0
base/usr/include/sys/utsname.h

@@ -1,5 +1,8 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
 #define _UTSNAME_LENGTH 256
 
 struct utsname {
@@ -15,3 +18,5 @@ struct utsname {
 #ifndef _KERNEL_
 extern int uname(struct utsname *__name);
 #endif
+
+_End_C_Header

+ 5 - 0
base/usr/include/sys/wait.h

@@ -1,7 +1,10 @@
 #pragma once
 
+#include <_cheader.h>
 #include <sys/types.h>
 
+_Begin_C_Header
+
 #define WNOHANG   0x0001
 #define WUNTRACED 0x0002
 #define WNOKERN   0x0010
@@ -19,3 +22,5 @@
 extern pid_t wait(int*);
 extern pid_t waitpid(pid_t, int *, int);
 #endif
+
+_End_C_Header

+ 6 - 5
base/usr/include/syscall.h

@@ -1,8 +1,11 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stdint.h>
 #include <stddef.h>
 
+_Begin_C_Header
+
 #define DECL_SYSCALL0(fn)                int syscall_##fn()
 #define DECL_SYSCALL1(fn,p1)             int syscall_##fn(p1)
 #define DECL_SYSCALL2(fn,p1,p2)          int syscall_##fn(p1,p2)
@@ -114,8 +117,6 @@ DECL_SYSCALL3(waitpid, int, int *, int);
 DECL_SYSCALL5(mount, char *, char *, char *, unsigned long, void *);
 DECL_SYSCALL1(pipe,  int *);
 DECL_SYSCALL3(readlink, char *, char *, int);
-/*
- * vim:tabstop=4
- * vim:noexpandtab
- * vim:shiftwidth=4
- */
+
+_End_C_Header
+

+ 2 - 0
base/usr/include/syscall_nums.h

@@ -1,3 +1,5 @@
+#pragma once
+
 #define SYS_EXT 0
 #define SYS_OPEN 2
 #define SYS_READ 3

+ 2 - 6
base/usr/include/termios.h

@@ -1,7 +1,3 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
+#pragma once
+
 #include <sys/termios.h>
-#ifdef __cplusplus
-}
-#endif

+ 5 - 0
base/usr/include/time.h

@@ -1,8 +1,11 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stddef.h>
 #include <sys/types.h>
 
+_Begin_C_Header
+
 struct tm {
     int tm_sec;    /* Seconds (0-60) */
     int tm_min;    /* Minutes (0-59) */
@@ -33,3 +36,5 @@ typedef int clock_t;
 
 extern clock_t clock(void);
 #define CLOCKS_PER_SEC 1
+
+_End_C_Header

+ 5 - 0
base/usr/include/toaru/auth.h

@@ -6,6 +6,11 @@
 
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
+
 extern int toaru_auth_check_pass(char * user, char * pass);
 extern void toaru_auth_set_vars(void);
 
+_End_C_Header

+ 4 - 0
base/usr/include/toaru/confreader.h

@@ -3,8 +3,11 @@
 
 #pragma once
 
+#include <_cheader.h>
 #include <toaru/hashmap.h>
 
+_Begin_C_Header
+
 typedef struct {
 	hashmap_t * sections;
 } confreader_t;
@@ -16,3 +19,4 @@ int confreader_int(confreader_t * ctx, char * section, char * value);
 int confreader_intd(confreader_t * ctx, char * section, char * value, int def);
 void confreader_free(confreader_t * conf);
 
+_End_C_Header

+ 0 - 2
base/usr/include/toaru/decodeutf8.h

@@ -1,13 +1,11 @@
 /*
  * Stateful UTF-8 decoder
  */
-
 #include <stdint.h>
 
 #define UTF8_ACCEPT 0
 #define UTF8_REJECT 1
 
-
 static inline uint32_t decode(uint32_t* state, uint32_t* codep, uint32_t byte) {
 	static int state_table[32] = {
 		0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xxxxxxx */

+ 5 - 0
base/usr/include/toaru/decorations.h

@@ -6,9 +6,12 @@
 
 #pragma once
 
+#include <_cheader.h>
 #include <toaru/graphics.h>
 #include <toaru/yutani.h>
 
+_Begin_C_Header
+
 /*
  * Render decorations to a window. A buffer pointer is
  * provided so that you may render in double-buffered mode.
@@ -70,3 +73,5 @@ extern yutani_window_t * decor_show_default_menu(yutani_window_t * window, int y
 #define DECOR_FLAG_TILE_RIGHT  (0x2 << 2)
 #define DECOR_FLAG_TILE_UP     (0x4 << 2)
 #define DECOR_FLAG_TILE_DOWN   (0x8 << 2)
+
+_End_C_Header

+ 6 - 0
base/usr/include/toaru/drawstring.h

@@ -1,5 +1,11 @@
 #pragma once
+
+#include <_cheader.h>
 #include <toaru/graphics.h>
 
+_Begin_C_Header
+
 void draw_string(gfx_context_t * ctx, int x, int y, uint32_t _fg, char * str);
 int draw_string_width(char * str);
+
+_End_C_Header

+ 5 - 0
base/usr/include/toaru/graphics.h

@@ -2,9 +2,12 @@
  */
 #pragma once
 
+#include <_cheader.h>
 #include <stdint.h>
 #include <stddef.h>
 
+_Begin_C_Header
+
 #define GFX_W(ctx)  ((ctx)->width)			/* Display width */
 #define GFX_H(ctx)  ((ctx)->height)			/* Display height */
 #define GFX_B(ctx)  ((ctx)->depth / 8)		/* Display byte depth */
@@ -111,3 +114,5 @@ extern float gfx_line_distance(struct gfx_point * p, struct gfx_point * v, struc
 extern void draw_line_aa(gfx_context_t * ctx, int x_1, int x_2, int y_1, int y_2, uint32_t color, float thickness);
 
 extern void draw_sprite_rotate(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y, float rotation, float alpha);
+
+_End_C_Header

+ 4 - 0
base/usr/include/toaru/hashmap.h

@@ -1,5 +1,6 @@
 #pragma once
 
+#include <_cheader.h>
 
 #ifdef _KERNEL_
 #	include <kernel/system.h>
@@ -11,6 +12,8 @@
 
 #include <toaru/list.h>
 
+_Begin_C_Header
+
 typedef unsigned int (*hashmap_hash_t) (void * key);
 typedef int (*hashmap_comp_t) (void * a, void * b);
 typedef void (*hashmap_free_t) (void *);
@@ -47,3 +50,4 @@ extern int hashmap_string_comp(void * a, void * b);
 extern void * hashmap_string_dupe(void * key);
 extern int hashmap_is_empty(hashmap_t * map);
 
+_End_C_Header

+ 5 - 0
base/usr/include/toaru/icon_cache.h

@@ -1,7 +1,12 @@
 #pragma once
 
+#include <_cheader.h>
 #include <toaru/graphics.h>
 
+_Begin_C_Header
+
 extern sprite_t * icon_get_16(const char * name);
 extern sprite_t * icon_get_48(const char * name);
 
+_End_C_Header
+

+ 5 - 0
base/usr/include/toaru/kbd.h

@@ -1,5 +1,9 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
+
 #define KBD_NORMAL 0
 #define KBD_ESC_A  1
 #define KBD_ESC_B  2
@@ -183,3 +187,4 @@ typedef struct {
 extern kbd_key_t kbd_key(key_event_state_t * state, unsigned char c);
 extern int kbd_scancode(key_event_state_t * state, unsigned char c, key_event_t * event);
 
+_End_C_Header

+ 5 - 0
base/usr/include/toaru/list.h

@@ -4,6 +4,8 @@
  */
 #pragma once
 
+#include <_cheader.h>
+
 #ifdef _KERNEL_
 #	include <kernel/types.h>
 #else
@@ -12,6 +14,8 @@
 #	include <assert.h>
 #endif
 
+_Begin_C_Header
+
 typedef struct node {
 	struct node * next;
 	struct node * prev;
@@ -48,3 +52,4 @@ extern node_t * list_insert_before(list_t * list, node_t * after, void * item);
 #define foreach(i, list) for (node_t * i = (list)->head; i != NULL; i = i->next)
 #define foreachr(i, list) for (node_t * i = (list)->tail; i != NULL; i = i->prev)
 
+_End_C_Header

+ 5 - 0
base/usr/include/toaru/menu.h

@@ -1,9 +1,12 @@
 #pragma once
 
+#include <_cheader.h>
 #include <toaru/graphics.h>
 #include <toaru/hashmap.h>
 #include <toaru/list.h>
 
+_Begin_C_Header
+
 enum MenuEntry_Type {
 	MenuEntry_Unknown,
 	MenuEntry_Normal,
@@ -116,3 +119,5 @@ struct menu_bar {
 extern void menu_bar_render(struct menu_bar * self, gfx_context_t * ctx);
 extern int menu_bar_mouse_event(yutani_t * yctx, yutani_window_t * window, struct menu_bar * self, struct yutani_msg_window_mouse_event * me, int x, int y);
 extern void menu_bar_show_menu(yutani_t * yctx, yutani_window_t * window, struct menu_bar * self, int offset, struct menu_bar_entries * _entries);
+
+_End_C_Header

+ 5 - 0
base/usr/include/toaru/mouse.h

@@ -1,5 +1,9 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
+
 typedef enum {
 	LEFT_CLICK   = 0x01,
 	RIGHT_CLICK  = 0x02,
@@ -18,3 +22,4 @@ typedef struct {
 
 #define MOUSE_MAGIC 0xFEED1234
 
+_End_C_Header

+ 4 - 0
base/usr/include/toaru/pex.h

@@ -1,8 +1,11 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stdint.h>
 #include <stdio.h>
 
+_Begin_C_Header
+
 typedef struct pex_packet {
 	uintptr_t source;
 	size_t      size;
@@ -27,3 +30,4 @@ extern size_t pex_query(FILE * sock);
 extern FILE * pex_bind(char * target);
 extern FILE * pex_connect(char * target);
 
+_End_C_Header

+ 5 - 0
base/usr/include/toaru/rline.h

@@ -1,5 +1,8 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
 struct rline_callback;
 
 typedef struct {
@@ -45,3 +48,5 @@ extern int rline_history_offset;
 extern int rline_scroll;
 extern char * rline_exit_string;
 
+_End_C_Header
+

+ 5 - 0
base/usr/include/toaru/rline_exp.h

@@ -1,9 +1,14 @@
 #pragma once
 
+#include <_cheader.h>
 #include <toaru/rline.h>
 
+_Begin_C_Header
+
 extern int rline_experimental(char * buffer, int buf_size);
 extern int rline_exp_set_prompts(char * left, char * right, int left_width, int right_width);
 extern int rline_exp_set_shell_commands(char ** cmds, int len);
 extern int rline_exp_set_tab_complete_func(rline_callback_t func);
 extern int rline_exp_set_syntax(char * name);
+
+_End_C_Header

+ 7 - 0
base/usr/include/toaru/sdf.h

@@ -1,4 +1,9 @@
 #pragma once
+#include <_cheader.h>
+#include <stdint.h>
+#include <toaru/graphics.h>
+
+_Begin_C_Header
 
 enum sdf_font {
     SDF_FONT_THIN,
@@ -12,3 +17,5 @@ enum sdf_font {
 extern int draw_sdf_string(gfx_context_t * ctx, int32_t x, int32_t y, const char * str, int size, uint32_t color, int font);
 extern int draw_sdf_string_width(const char * str, int size, int font);
 extern int draw_sdf_string_gamma(gfx_context_t * ctx, int32_t x, int32_t y, const char * str, int size, uint32_t color, int font, double _gamma);
+
+_End_C_Header

+ 6 - 0
base/usr/include/toaru/termemu.h

@@ -1,11 +1,15 @@
 #pragma once
 
+#include <_cheader.h>
+
 #ifdef _KERNEL_
 #	include <kernel/types.h>
 #else
 #	include <stdint.h>
 #endif
 
+_Begin_C_Header
+
 #define TERM_BUF_LEN 128
 
 /* A terminal cell represents a single character on screen */
@@ -108,3 +112,5 @@ typedef struct {
 extern term_state_t * ansi_init(term_state_t * s, int w, int y, term_callbacks_t * callbacks_in);
 extern void ansi_put(term_state_t * s, char c);
 
+_End_C_Header
+

+ 4 - 0
base/usr/include/toaru/textregion.h

@@ -1,11 +1,14 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stdint.h>
 #include <stdbool.h>
 
 #include <toaru/hashmap.h>
 #include <toaru/graphics.h>
 
+_Begin_C_Header
+
 struct TR_Font {
 	int typeface; /* Should probably be more flexible than int, but tough luck for now. */
 	int size;
@@ -86,3 +89,4 @@ extern void tr_textregion_pick(struct TR_TextRegion * self, int x, int y, struct
 extern struct TR_TextUnit * tr_textregion_click(struct TR_TextRegion * self, int x, int y);
 extern void tr_textregion_draw(struct TR_TextRegion * self, gfx_context_t * ctx);
 
+_End_C_Header

+ 4 - 1
base/usr/include/toaru/tree.h

@@ -4,8 +4,11 @@
  */
 #pragma once
 
+#include <_cheader.h>
 #include <toaru/list.h>
 
+_Begin_C_Header
+
 typedef struct tree_node {
 	void * value;
 	list_t * children;
@@ -34,4 +37,4 @@ extern void tree_remove(tree_t * tree, tree_node_t * node);
 extern tree_node_t * tree_find(tree_t * tree, void * value, tree_comparator_t comparator);
 extern void tree_break_off(tree_t * tree, tree_node_t * node);
 
-
+_End_C_Header

+ 6 - 1
base/usr/include/toaru/yutani-internal.h

@@ -1,5 +1,10 @@
+#pragma once
+
+#include <_cheader.h>
 #include <toaru/yutani.h>
 
+_Begin_C_Header
+
 #define YUTANI_SHMKEY(server_ident,buf,sz,win) sprintf(buf, "sys.%s.%d", server_ident, win->bufid);
 #define YUTANI_SHMKEY_EXP(server_ident,buf,sz,bufid) sprintf(buf, "sys.%s.%d", server_ident, bufid);
 
@@ -65,4 +70,4 @@ extern void yutani_msg_buildx_window_resize_start(yutani_msg_t * msg, yutani_wid
 extern void yutani_msg_buildx_special_request(yutani_msg_t * msg, yutani_wid_t wid, uint32_t request);
 extern void yutani_msg_buildx_clipboard(yutani_msg_t * msg, char * content);
 
-
+_End_C_Header

+ 5 - 0
base/usr/include/toaru/yutani-server.h

@@ -8,10 +8,13 @@
  */
 #pragma once
 
+#include <_cheader.h>
 #include <stdint.h>
 #include <sys/time.h>
 #include <toaru/yutani.h>
 
+_Begin_C_Header
+
 /* Mouse resolution scaling */
 #define MOUSE_SCALE 3
 #define YUTANI_INCOMING_MOUSE_SCALE * 3
@@ -298,3 +301,5 @@ extern uint32_t yutani_time_since(yutani_globals_t * yg, uint32_t start_time);
 extern void yutani_window_to_device(yutani_server_window_t * window, int32_t x, int32_t y, int32_t * out_x, int32_t * out_y);
 extern void yutani_device_to_window(yutani_server_window_t * window, int32_t x, int32_t y, int32_t * out_x, int32_t * out_y);
 extern uint32_t yutani_color_for_wid(yutani_wid_t wid);
+
+_End_C_Header

+ 5 - 0
base/usr/include/toaru/yutani.h

@@ -9,6 +9,7 @@
  */
 #pragma once
 
+#include <_cheader.h>
 #include <stdio.h>
 #include <stdint.h>
 #include <stdbool.h>
@@ -19,6 +20,8 @@
 #include <toaru/mouse.h>
 #include <toaru/list.h>
 
+_Begin_C_Header
+
 typedef unsigned int yutani_wid_t;
 
 /*
@@ -508,3 +511,5 @@ extern gfx_context_t *  init_graphics_yutani_double_buffer(yutani_window_t * win
 extern void reinit_graphics_yutani(gfx_context_t * out, yutani_window_t * window);
 extern void release_graphics_yutani(gfx_context_t * gfx);
 
+_End_C_Header
+

+ 5 - 0
base/usr/include/unistd.h

@@ -1,8 +1,11 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stddef.h>
 #include <sys/types.h>
 
+_Begin_C_Header
+
 extern char **environ;
 
 extern pid_t getpid(void);
@@ -79,3 +82,5 @@ extern char * getlogin(void);
 
 extern int gethostname(char * name, size_t len);
 extern int sethostname(const char * name, size_t len);
+
+_End_C_Header

+ 6 - 0
base/usr/include/va_list.h

@@ -1,8 +1,14 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
+
 typedef __builtin_va_list va_list;
 #define va_start(ap,last) __builtin_va_start(ap, last)
 #define va_end(ap) __builtin_va_end(ap)
 #define va_arg(ap,type) __builtin_va_arg(ap,type)
 #define va_copy(dest, src) __builtin_va_copy(dest,src)
 
+_End_C_Header
+

+ 4 - 0
base/usr/include/wait.h

@@ -1,4 +1,8 @@
 #pragma once
 
+#include <_cheader.h>
+
+_Begin_C_Header
 int waitpid(int pid, int *status, int options);
 int wait(int *status);
+_End_C_Header

+ 3 - 0
base/usr/include/wchar.h

@@ -1,7 +1,9 @@
 #pragma once
 
+#include <_cheader.h>
 #include <stddef.h>
 
+_Begin_C_Header
 extern int wcwidth(wchar_t c);
 extern wchar_t * wcsncpy(wchar_t * dest, const wchar_t * src, size_t n);
 extern size_t wcslen(const wchar_t * s);
@@ -15,3 +17,4 @@ extern wchar_t * wcsrchr(const wchar_t *wcs, wchar_t wc);
 extern wchar_t * wcsncat(wchar_t *dest, const wchar_t * src, size_t n);
 
 typedef unsigned int wint_t;
+_End_C_Header