From 540caa5873bcc3bc2a0e1896119f5b53a0e8e630 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 7 Jan 2020 15:31:01 -0500 Subject: lib9: remove getcallerpc implementations These make no sense and are not really needed at all. Add a best-effort attempt to get at the gcc/clang macro in lib9.h, but if it fails, no big deal. Fixes #324. --- include/libc.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/libc.h b/include/libc.h index 45b22b69..94d5b5ca 100644 --- a/include/libc.h +++ b/include/libc.h @@ -11,13 +11,13 @@ #define _LIBC_H_ 1 #if defined(__cplusplus) extern "C" { -#endif +#endif #include #include /* - * Begin usual libc.h + * Begin usual libc.h */ #ifndef nil @@ -361,7 +361,7 @@ enum extern int p9atexit(void(*)(void)); extern void p9atexitdont(void(*)(void)); extern int atnotify(int(*)(void*, char*), int); -/* +/* * extern double atof(char*); */ @@ -385,6 +385,9 @@ extern int exitcode(char*); extern void exits(char*); extern double frexp(double, int*); extern ulong getcallerpc(void*); +#if defined(__GNUC__) || defined(__clang__) +#define getcallerpc(x) ((ulong)__builtin_return_address(0)) +#endif extern char* p9getenv(char*); extern int p9putenv(char*, char*); extern int getfields(char*, char**, int, int, char*); @@ -479,7 +482,7 @@ extern void lock(Lock*); extern void unlock(Lock*); extern int canlock(Lock*); extern int (*_lock)(Lock*, int, ulong); -extern void (*_unlock)(Lock*, ulong); +extern void (*_unlock)(Lock*, ulong); typedef struct QLock QLock; struct QLock @@ -670,15 +673,15 @@ extern void freenetconninfo(NetConnInfo*); enum { - RFNAMEG = (1<<0), - RFENVG = (1<<1), + RFNAMEG = (1<<0), + RFENVG = (1<<1), RFFDG = (1<<2), RFNOTEG = (1<<3), RFPROC = (1<<4), RFMEM = (1<<5), RFNOWAIT = (1<<6), - RFCNAMEG = (1<<10), - RFCENVG = (1<<11), + RFCNAMEG = (1<<10), + RFCENVG = (1<<11), RFCFDG = (1<<12) /* RFREND = (1<<13), */ /* RFNOMNT = (1<<14) */ @@ -707,7 +710,7 @@ struct Dir { char *uid; /* owner name */ char *gid; /* group name */ char *muid; /* last modifier name */ - + /* 9P2000.u extensions */ uint uidnum; /* numeric uid */ uint gidnum; /* numeric gid */ @@ -750,7 +753,7 @@ extern int p9exec(char*, char*[]); extern int p9execl(char*, ...); /* extern int p9fork(void); */ extern int p9rfork(int); -/* not implemented +/* not implemented extern int fauth(int, char*); extern int fstat(int, uchar*, int); extern int fwstat(int, uchar*, int); @@ -767,7 +770,7 @@ extern int notifyoff(char*); extern int p9open(char*, int); extern int fd2path(int, char*, int); extern int p9pipe(int*); -/* +/* * use defs from extern long pread(int, void*, long, vlong); extern long preadv(int, IOchunk*, int, vlong); -- cgit v1.2.3 From e0c4896ed41faa71445d9e0b1751aba5157343c9 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 8 Jan 2020 22:28:44 -0500 Subject: lib9: make a p9frexp function wrapping system frexp Under certain conditions it looks like frexp gets #defined to something else on macOS during system headers, which then breaks the declaration in libc.h. --- include/libc.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libc.h b/include/libc.h index 94d5b5ca..4fa86b22 100644 --- a/include/libc.h +++ b/include/libc.h @@ -383,7 +383,7 @@ extern int encodefmt(Fmt*); extern int dirmodefmt(Fmt*); extern int exitcode(char*); extern void exits(char*); -extern double frexp(double, int*); +extern double p9frexp(double, int*); extern ulong getcallerpc(void*); #if defined(__GNUC__) || defined(__clang__) #define getcallerpc(x) ((ulong)__builtin_return_address(0)) @@ -436,6 +436,8 @@ extern void (*_unpin)(void); #define atoll p9atoll #define encrypt p9encrypt #define decrypt p9decrypt +#undef frexp +#define frexp p9frexp #define getenv p9getenv #define getwd p9getwd #define longjmp p9longjmp -- cgit v1.2.3 From 88ed92aa40ab5aa0f563624c488ba2a120990329 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 8 Jan 2020 20:28:17 -0500 Subject: devdraw: move Client into devdraw.h and move global state in --- include/memdraw.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/memdraw.h b/include/memdraw.h index a22dbe2b..dc0e0b72 100644 --- a/include/memdraw.h +++ b/include/memdraw.h @@ -216,7 +216,6 @@ extern Memdrawparam* _memimagedrawsetup(Memimage*, Rectangle, Memimage*, Point, Memimage*, Point, int); extern void _memimagedraw(Memdrawparam*); -extern void _drawreplacescreenimage(Memimage*); #if defined(__cplusplus) } -- cgit v1.2.3 From dbf57689c45611b8da9e269c24e409ee33a877d5 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Sat, 11 Jan 2020 05:52:59 -0500 Subject: libdraw: connect to devdraw via $wsysid when set --- include/drawfcall.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/drawfcall.h b/include/drawfcall.h index acab98c5..8b9656d5 100644 --- a/include/drawfcall.h +++ b/include/drawfcall.h @@ -25,6 +25,9 @@ tag[1] Rrdkbd rune[2] tag[1] Tlabel label[s] tag[1] Rlabel +tag[1] Tctxt wsysid[s] +tag[1] Rctxt + tag[1] Tinit winsize[s] label[s] font[s] tag[1] Rinit @@ -94,6 +97,8 @@ enum { Rresize, Tcursor2 = 28, Rcursor2, + Tctxt = 30, + Rctxt, Tmax, }; @@ -116,6 +121,7 @@ struct Wsysmsg char *label; char *snarf; char *error; + char *id; uchar *data; uint count; Rectangle rect; -- cgit v1.2.3