* [PATCH] ape: add libplumb
@ 2020-05-29 15:07 telephil9
2020-05-29 15:33 ` [9front] " ori
0 siblings, 1 reply; 2+ messages in thread
From: telephil9 @ 2020-05-29 15:07 UTC (permalink / raw)
To: 9front; +Cc: telephil9
[-- Attachment #1: Type: text/plain, Size: 246 bytes --]
Hi,
Here is a patch to add libplumb to APE.
I also had sent another APE patch on 05/24 (add eenter to ape/libdraw) that might have gone unnoticed due to the ongoing release.
These two patches are needed for the netsurf port.
Regards,
Philippe
[-- Attachment #2: Type: text/plain, Size: 2946 bytes --]
diff -r 318eaf3a920f sys/include/ape/plumb.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/include/ape/plumb.h Fri May 29 16:58:58 2020 +0200
@@ -0,0 +1,57 @@
+#ifndef _PLAN9_SOURCE
+ This header file is an extension to ANSI/POSIX
+#endif
+
+#ifndef __PLUMB_H_
+#define __PLUMB_H_
+#pragma src "/sys/src/ape/lib/plumb"
+#pragma lib "/$M/lib/ape/libplumb.a"
+
+/*
+ * Message format:
+ * source application\n
+ * destination port\n
+ * working directory\n
+ * type\n
+ * attributes\n
+ * nbytes\n
+ * n bytes of data
+ */
+
+typedef struct Plumbattr Plumbattr;
+typedef struct Plumbmsg Plumbmsg;
+
+struct Plumbmsg
+{
+ char *src;
+ char *dst;
+ char *wdir;
+ char *type;
+ Plumbattr *attr;
+ int ndata;
+ char *data;
+};
+
+struct Plumbattr
+{
+ char *name;
+ char *value;
+ Plumbattr *next;
+};
+
+int plumbsend(int, Plumbmsg*);
+int plumbsendtext(int, char*, char*, char*, char*);
+Plumbmsg* plumbrecv(int);
+char* plumbpack(Plumbmsg*, int*);
+Plumbmsg* plumbunpack(char*, int);
+Plumbmsg* plumbunpackpartial(char*, int, int*);
+char* plumbpackattr(Plumbattr*);
+Plumbattr* plumbunpackattr(char*);
+Plumbattr* plumbaddattr(Plumbattr*, Plumbattr*);
+Plumbattr* plumbdelattr(Plumbattr*, char*);
+void plumbfree(Plumbmsg*);
+char* plumblookup(Plumbattr*, char*);
+int plumbopen(char*, int);
+int eplumb(int, char*);
+
+#endif
diff -r 318eaf3a920f sys/src/ape/lib/9/libc.h
--- a/sys/src/ape/lib/9/libc.h Sun May 17 23:46:09 2020 +0200
+++ b/sys/src/ape/lib/9/libc.h Fri May 29 16:58:58 2020 +0200
@@ -159,6 +159,7 @@
#define ERRMAX 128
int errstr(char*, unsigned int);
+void rerrstr(char*, unsigned int);
extern void sysfatal(char*, ...);
extern void setmalloctag(void*, uintptr_t);
diff -r 318eaf3a920f sys/src/ape/lib/9/mkfile
--- a/sys/src/ape/lib/9/mkfile Sun May 17 23:46:09 2020 +0200
+++ b/sys/src/ape/lib/9/mkfile Fri May 29 16:58:58 2020 +0200
@@ -8,6 +8,7 @@
crypt.$O\
ctime.$O\
errstr.$O\
+ rerrstr.$O\
getcallerpc.$O\
getfcr.$O\
getfields.$O\
diff -r 318eaf3a920f sys/src/ape/lib/9/rerrstr.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/src/ape/lib/9/rerrstr.c Fri May 29 16:58:58 2020 +0200
@@ -0,0 +1,12 @@
+#include "libc.h"
+
+void
+rerrstr(char *buf, uint nbuf)
+{
+ char tmp[ERRMAX];
+
+ tmp[0] = 0;
+ errstr(tmp, sizeof tmp);
+ utfecpy(buf, buf+nbuf, tmp);
+ errstr(tmp, sizeof tmp);
+}
diff -r 318eaf3a920f sys/src/ape/lib/plumb/mkfile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/src/ape/lib/plumb/mkfile Fri May 29 16:58:58 2020 +0200
@@ -0,0 +1,25 @@
+APE=/sys/src/ape
+<$APE/config
+
+LIB=/$objtype/lib/ape/libplumb.a
+
+OFILES=\
+ event.$O\
+ mesg.$O\
+ plumbsendtext.$O
+
+HFILES=\
+ /sys/include/ape/plumb.h\
+
+UPDATE=\
+ mkfile\
+ $HFILES\
+ ${OFILES:%.$O=%.c}\
+ ${LIB:/$objtype/%=/386/%}\
+
+</sys/src/cmd/mksyslib
+
+CFLAGS=-c $CFLAGS -D_POSIX_SOURCE -D_PLAN9_SOURCE -I../9
+
+%.$O: /sys/src/libplumb/%.c
+ $CC $CFLAGS /sys/src/libplumb/$stem.c
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-29 15:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 15:07 [PATCH] ape: add libplumb telephil9
2020-05-29 15:33 ` [9front] " ori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).