Add the #goo to allow use in C++.
Silence a few more warnings.
Strip down the mkfiles more.
Fix bug in X11 mouse handling, note groups.
diff --git a/include/bin.h b/include/bin.h
index 6b9f2bd..dc738f1 100644
--- a/include/bin.h
+++ b/include/bin.h
@@ -1,3 +1,9 @@
+#ifndef _BIN_H_
+#define _BIN_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
/*
#pragma lib "libbin.a"
#pragma src "/sys/src/libbin"
@@ -11,3 +17,8 @@
void *binalloc(Bin **, ulong size, int zero);
void *bingrow(Bin **, void *op, ulong osize, ulong size, int zero);
void binfree(Bin **);
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/bio.h b/include/bio.h
index 600f094..473389a 100644
--- a/include/bio.h
+++ b/include/bio.h
@@ -1,5 +1,8 @@
-#ifndef _BIOH_
-#define _BIOH_ 1
+#ifndef _BIO_H_
+#define _BIO_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
#include <sys/types.h> /* for off_t */
#include <fcntl.h> /* for O_RDONLY, O_WRONLY */
@@ -78,4 +81,7 @@
long Bgetrune(Biobuf*);
int Bputrune(Biobuf*, long);
+#if defined(__cplusplus)
+}
+#endif
#endif
diff --git a/include/cursor.h b/include/cursor.h
index 105cd0e..d53baf8 100644
--- a/include/cursor.h
+++ b/include/cursor.h
@@ -1,3 +1,9 @@
+#ifndef _CURSOR_H_
+#define _CURSOR_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
typedef struct Cursor Cursor;
struct Cursor
{
@@ -5,3 +11,8 @@
uchar clr[2*16];
uchar set[2*16];
};
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/draw.h b/include/draw.h
index 029f0ae..54a566a 100644
--- a/include/draw.h
+++ b/include/draw.h
@@ -1,3 +1,9 @@
+#ifndef _DRAW_H_
+#define _DRAW_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
typedef struct Cachefont Cachefont;
typedef struct Cacheinfo Cacheinfo;
typedef struct Cachesubf Cachesubf;
@@ -531,3 +537,8 @@
int _drawmsgread(Display*, void*, int);
int _drawmsgwrite(Display*, void*, int);
int _latin1(Rune*, int);
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/event.h b/include/event.h
index e74183d..56c1b1c 100644
--- a/include/event.h
+++ b/include/event.h
@@ -1,3 +1,9 @@
+#ifndef _EVENT_H_
+#define _EVENT_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
typedef struct Event Event;
typedef struct Menu Menu;
@@ -61,3 +67,8 @@
extern void edrawgetrect(Rectangle, int);
extern int ereadmouse(Mouse*);
extern int eatomouse(Mouse*, char*, int);
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/fcall.h b/include/fcall.h
index 93f46d4..20ffe38 100644
--- a/include/fcall.h
+++ b/include/fcall.h
@@ -1,3 +1,8 @@
+#ifndef _FCALL_H_
+#define _FCALL_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
/*
#pragma src "/sys/src/libc/9sys"
#pragma lib "libc.a"
@@ -118,3 +123,7 @@
#pragma varargck type "M" ulong
#pragma varargck type "D" Dir*
*/
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/flate.h b/include/flate.h
index 79c888c..bbd0b3d 100644
--- a/include/flate.h
+++ b/include/flate.h
@@ -1,3 +1,8 @@
+#ifndef _FLATE_H_
+#define _FLATE_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
/*
#pragma lib "libflate.a"
#pragma src "/sys/src/libflate"
@@ -39,3 +44,7 @@
ulong blockcrc(ulong *tab, ulong crc, void *buf, int n);
ulong adler32(ulong adler, void *buf, int n);
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/fmt.h b/include/fmt.h
index c913e14..befea2e 100644
--- a/include/fmt.h
+++ b/include/fmt.h
@@ -1,3 +1,8 @@
+#ifndef _FMT_H_
+#define _FMT_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
/*
* The authors of this software are Rob Pike and Ken Thompson.
@@ -13,14 +18,8 @@
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
-#ifndef _FMTH_
-#define _FMTH_ 1
-
#include <stdarg.h>
-
-#ifndef _UTFH_
#include <utf.h>
-#endif
typedef struct Fmt Fmt;
struct Fmt{
@@ -97,4 +96,7 @@
extern double fmtstrtod(const char *, char **);
extern double fmtcharstod(int(*)(void*), void*);
+#if defined(__cplusplus)
+}
+#endif
#endif
diff --git a/include/frame.h b/include/frame.h
index 9b8194b..47d808c 100644
--- a/include/frame.h
+++ b/include/frame.h
@@ -1,3 +1,9 @@
+#ifndef _FRAME_H_
+#define _FRAME_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
typedef struct Frbox Frbox;
typedef struct Frame Frame;
@@ -83,3 +89,7 @@
#define NRUNE(b) ((b)->nrune<0? 1 : (b)->nrune)
#define NBYTE(b) strlen((char*)(b)->ptr)
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/httpd.h b/include/httpd.h
index d75c580..03b48ad 100644
--- a/include/httpd.h
+++ b/include/httpd.h
@@ -1,3 +1,8 @@
+#ifndef _HTTPD_H_
+#define _HTTPD_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
/*
#pragma lib "libhttpd.a"
#pragma src "/sys/src/libhttpd"
@@ -278,3 +283,8 @@
#pragma varargck type "U" char*
#pragma varargck type "H" char*
*/
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/ip.h b/include/ip.h
index af82c99..6fbf394 100644
--- a/include/ip.h
+++ b/include/ip.h
@@ -1,3 +1,8 @@
+#ifndef _IP_H_
+#define _IP_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
/*
#pragma src "/sys/src/libip"
#pragma lib "libip.a"
@@ -121,3 +126,7 @@
#define CLASS(p) ((*(uchar*)(p))>>6)
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/keyboard.h b/include/keyboard.h
index a6d99bf..588600a 100644
--- a/include/keyboard.h
+++ b/include/keyboard.h
@@ -1,3 +1,8 @@
+#ifndef _KEYBOARD_H_
+#define _KEYBOARD_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
typedef struct Keyboardctl Keyboardctl;
struct Keyboardctl
@@ -34,3 +39,8 @@
Kshift= KF|0x16,
Kctl= KF|0x17,
};
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/lib9.h b/include/lib9.h
index 8f15ce6..21490e6 100644
--- a/include/lib9.h
+++ b/include/lib9.h
@@ -3,9 +3,8 @@
* fit into libutf or into libfmt, but is still missing from traditional
* Unix C libraries.
*/
-#ifndef _LIB9H_
-#define _LIB9H_ 1
-
+#ifndef _LIB9_H_
+#define _LIB9_H_ 1
#if defined(__cplusplus)
extern "C" {
#endif
@@ -861,5 +860,4 @@
#if defined(__cplusplus)
}
#endif
-
-#endif /* _LIB9H_ */
+#endif /* _LIB9_H_ */
diff --git a/include/libsec.h b/include/libsec.h
index 17b2b65..e65b7f9 100644
--- a/include/libsec.h
+++ b/include/libsec.h
@@ -1,3 +1,8 @@
+#ifndef _LIBSEC_H_
+#define _LIBSEC_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
/*
#pragma lib "libsec.a"
#pragma src "/sys/src/libsec"
@@ -338,3 +343,8 @@
// readcert.c
extern uchar *readcert(char *filename, int *pcertlen);
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/memdraw.h b/include/memdraw.h
index 2d4f54f..93f34a0 100644
--- a/include/memdraw.h
+++ b/include/memdraw.h
@@ -1,3 +1,8 @@
+#ifndef _MEMDRAW_H_
+#define _MEMDRAW_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
typedef struct Memimage Memimage;
typedef struct Memdata Memdata;
typedef struct Memsubfont Memsubfont;
@@ -208,3 +213,8 @@
Point, int);
extern void _memimagedraw(Memdrawparam*);
extern void _drawreplacescreenimage(Memimage*);
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/memlayer.h b/include/memlayer.h
index 36d8776..f0b01d0 100644
--- a/include/memlayer.h
+++ b/include/memlayer.h
@@ -1,3 +1,9 @@
+#ifndef _MEMLAYER_H_
+#define _MEMLAYER_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
typedef struct Memscreen Memscreen;
typedef void (*Refreshfn)(Memimage*, Rectangle, void*);
@@ -46,3 +52,9 @@
void _memlsetclear(Memscreen*);
int memlorigin(Memimage*, Point, Point);
void memlnorefresh(Memimage*, Rectangle, void*);
+
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/mouse.h b/include/mouse.h
index f0a0f69..2c190b2 100644
--- a/include/mouse.h
+++ b/include/mouse.h
@@ -1,3 +1,8 @@
+#ifndef _MOUSE_H_
+#define _MOUSE_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
typedef struct Menu Menu;
typedef struct Mousectl Mousectl;
@@ -42,3 +47,9 @@
extern void drawgetrect(Rectangle, int);
extern Rectangle getrect(int, Mousectl*);
extern int menuhit(int, Mousectl*, Menu*, Screen*);
+
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/plumb.h b/include/plumb.h
index e0b1132..4a31546 100644
--- a/include/plumb.h
+++ b/include/plumb.h
@@ -1,3 +1,8 @@
+#ifndef _LIBPLUMB_H_
+#define _LIBPLUMB_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
/*
#pragma lib "libplumb.a"
#pragma src "/sys/src/libplumb"
@@ -48,3 +53,8 @@
char* plumblookup(Plumbattr*, char*);
int plumbopen(char*, int);
int eplumb(int, char*);
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/include/regexp9.h b/include/regexp9.h
index 745a6d7..382d246 100644
--- a/include/regexp9.h
+++ b/include/regexp9.h
@@ -1,6 +1,9 @@
-#ifndef _REGEXP9H_
+#ifndef _REGEXP9_H_
+#define _REGEXP9_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
-#define _REGEXP9H_ 1
#include <utf.h>
typedef struct Resub Resub;
@@ -83,4 +86,7 @@
#define rregsub rregsub9
#endif
+#if defined(__cplusplus)
+}
+#endif
#endif
diff --git a/include/thread.h b/include/thread.h
index 10aac28..9c5d2d0 100644
--- a/include/thread.h
+++ b/include/thread.h
@@ -1,5 +1,8 @@
-#ifndef _THREADH_
-#define _THREADH_ 1
+#ifndef _THREAD_H_
+#define _THREAD_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
/* avoid conflicts with socket library */
#undef send
@@ -129,4 +132,7 @@
long iocall(Ioproc*, long (*)(va_list*), ...);
void ioret(Ioproc*, int);
+#if defined(__cplusplus)
+}
+#endif
#endif /* _THREADH_ */
diff --git a/include/utf.h b/include/utf.h
index 623bfda..11b016d 100644
--- a/include/utf.h
+++ b/include/utf.h
@@ -1,5 +1,8 @@
-#ifndef _UTFH_
-#define _UTFH_ 1
+#ifndef _UTF_H_
+#define _UTF_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
typedef unsigned short Rune; /* 16 bits */
@@ -48,4 +51,7 @@
extern int istitlerune(Rune);
extern int isupperrune(Rune);
+#if defined(__cplusplus)
+}
+#endif
#endif
diff --git a/include/venti.h b/include/venti.h
index 5f8ef0a..a828101 100644
--- a/include/venti.h
+++ b/include/venti.h
@@ -1,3 +1,8 @@
+#ifndef _VENTI_H_
+#define _VENTI_H_ 1
+#if defined(__cplusplus)
+extern "C" {
+#endif
/* XXX should be own library? */
/*
* Packets
@@ -413,3 +418,7 @@
int vtfilelock2(VtFile*, VtFile*, int);
int vtfileflushbefore(VtFile*, u64int);
+#if defined(__cplusplus)
+}
+#endif
+#endif