ref: e3b8f25509de4ce8991f7610db8a7938765f4170
parent: 98631784ffd6f9a1f303314cf75e09e54febe4a2
author: Yaroslav Kolomiiets <yarikos@gmail.com>
date: Mon Sep 12 17:35:20 EDT 2016
enable 'mk o.thread' under plan9port
--- a/audio.c
+++ b/audio.c
@@ -47,10 +47,11 @@
void
-audiovcfn(Rdp*, uchar* a, uint nb)
+audiovcfn(Rdp* c, uchar* a, uint nb)
{
Audiomsg r;
+ USED(c);
fprint(2, " A ");
if(getaudiomsg(&r, a, nb) < 0){
fprint(2, "audio: %r\n");
--- a/cap.c
+++ b/cap.c
@@ -98,10 +98,11 @@
}
int
-sizecaps(Caps*)
+sizecaps(Caps* caps)
{
int i, n;
+ USED(caps);
n = 0;
for(i = 0; i < nelem(ctab); i++)
n += ctab[i].size;
@@ -127,10 +128,11 @@
}
static int
-putncap(uchar *p, uint nb, Caps*)
+putncap(uchar *p, uint nb, Caps* caps)
{
int ncap;
-
+
+ USED(caps);
ncap = 8;
if(nb<4){
@@ -144,10 +146,11 @@
/* 2.2.7.1.1 General Capability Set (TS_GENERAL_CAPABILITYSET) */
static int
-putgencaps(uchar *p, uint nb, Caps*)
+putgencaps(uchar *p, uint nb, Caps* caps)
{
int extraFlags;
-
+
+ USED(caps);
extraFlags = 0
| CanFastpath
| NoBitcomphdr
@@ -201,7 +204,7 @@
/* 2.2.7.1.3 Order Capability Set (TS_ORDER_CAPABILITYSET) */
static int
-putordcaps(uchar *p, uint nb, Caps*)
+putordcaps(uchar *p, uint nb, Caps* caps)
{
ushort orderFlags;
enum
@@ -211,7 +214,8 @@
COLORINDEXSUPPORT= 0x20,
SOLIDPATTERNBRUSHONLY= 0x40,
};
-
+
+ USED(caps);
orderFlags = 0
| NEGOTIATEORDERSUPPORT
| ZEROBOUNDSDELTASSUPPORT
@@ -247,8 +251,9 @@
/* 2.2.7.1.4 Bitmap Cache Capability Set (TS_BITMAPCACHE_CAPABILITYSET) */
/* 2.2.7.1.4.2 Revision 2 (TS_BITMAPCACHE_CAPABILITYSET_REV2) */
static int
-putbc2caps(uchar *p, uint nb, Caps*)
+putbc2caps(uchar *p, uint nb, Caps* caps)
{
+ USED(caps);
if(nb<40){
werrstr(Eshort);
return -1;
@@ -269,8 +274,9 @@
/* 2.2.7.1.5 Pointer Capability Set (TS_POINTER_CAPABILITYSET) */
static int
-putptrcaps(uchar *p, uint nb, Caps*)
+putptrcaps(uchar *p, uint nb, Caps* caps)
{
+ USED(caps);
if(nb<8){
werrstr(Eshort);
return -1;
@@ -284,9 +290,10 @@
/* 2.2.7.1.6 Input Capability Set (TS_INPUT_CAPABILITYSET) */
static int
-putinpcaps(uchar *p, uint nb, Caps*)
+putinpcaps(uchar *p, uint nb, Caps* caps)
{
long inputFlags;
+ USED(caps);
enum
{
INPUT_FLAG_SCANCODES= 0x0001,
@@ -320,11 +327,12 @@
/* 2.2.7.1.8 Glyph Cache Capability Set (TS_GLYPHCACHE_CAPABILITYSET) */
static int
-putglycaps(uchar *p, uint nb, Caps*)
+putglycaps(uchar *p, uint nb, Caps* caps)
{
enum {
GLYPH_SUPPORT_NONE= 0,
};
+ USED(caps);
if(nb<52){
werrstr(Eshort);
@@ -350,8 +358,9 @@
/* 2.2.7.1.11 Sound Capability Set (TS_SOUND_CAPABILITYSET) */
static int
-putsndcaps(uchar *p, uint nb, Caps*)
+putsndcaps(uchar *p, uint nb, Caps* caps)
{
+ USED(caps);
if(nb<8){
werrstr(Eshort);
return -1;
--- a/dat.h
+++ b/dat.h
@@ -9,10 +9,10 @@
#define GSHORTB(p) ((p)[0]<<8|((p)[1]))
#define GLONG(p) ((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24))
#define GLONGB(p) (((p)[0]<<24)|((p)[1]<<16)|((p)[2]<<8)|(p)[3])
-#define PSHORT(p,v) (p)[0]=(v);(p)[1]=(v)>>8
-#define PSHORTB(p,v) (p)[0]=(v)>>8;(p)[1]=(v)
-#define PLONG(p,v) (p)[0]=(v);(p)[1]=(v)>>8;(p)[2]=(v)>>16;(p)[3]=(v)>>24
-#define PLONGB(p,v) (p)[0]=(v)>>24;(p)[1]=(v)>>16;(p)[2]=(v)>>8;(p)[3]=(v)
+#define PSHORT(p,v) (p)[0]=(uchar)(v);(p)[1]=(uchar)(v)>>8
+#define PSHORTB(p,v) (p)[0]=(uchar)(v)>>8;(p)[1]=(uchar)(v)
+#define PLONG(p,v) (p)[0]=(uchar)(v);(p)[1]=(uchar)(v)>>8;(p)[2]=(uchar)(v)>>16;(p)[3]=(uchar)(v)>>24
+#define PLONGB(p,v) (p)[0]=(uchar)(v)>>24;(p)[1]=(uchar)(v)>>16;(p)[2]=(uchar)(v)>>8;(p)[3]=(uchar)(v)
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
--- a/draw.c
+++ b/draw.c
@@ -85,11 +85,12 @@
}
static void
-scrblt(Rdp*, Imgupd* up)
+scrblt(Rdp* c, Imgupd* up)
{
Rectangle r;
Point p;
+ USED(c);
r = rectaddpt(Rect(up->x, up->y, up->x+up->xsz, up->y+up->ysz), screen->r.min);
p = addpt(Pt(up->sx, up->sy), screen->r.min);
draw(screen, r, screen, nil, p);
@@ -96,12 +97,13 @@
}
static void
-memblt(Rdp*, Imgupd* up)
+memblt(Rdp* c, Imgupd* up)
{
Image* img;
Rectangle clipr, r;
Point pt;
+ USED(c);
if(up->cid >= nelem(icache) || up->coff >= nelem(*icache)){
fprint(2, "drawmemimg: bad cache spec [%d %d]\n", up->cid, up->coff);
return;
@@ -156,9 +158,11 @@
}
static void
-cachecmap(Rdp*, Imgupd*)
+cachecmap(Rdp* c, Imgupd* up)
{
/* BUG: who cares? */
+ USED(c);
+ USED(up);
}
static void
--- a/eclip.c
+++ b/eclip.c
@@ -102,8 +102,9 @@
}
static void
-clipattached(Rdp* c, Clipmsg*)
+clipattached(Rdp* c, Clipmsg *m)
{
+ USED(m);
clipannounce(c);
}
@@ -143,7 +144,7 @@
goto Respond;
}
- s = getsnarf(&ns);
+ s = getsnarfn(&ns);
if(s == nil)
goto Respond;
nb = ns*4;
@@ -160,15 +161,16 @@
}
static void
-clipprovided(Rdp*, Clipmsg *m)
+clipprovided(Rdp* c, Clipmsg *m)
{
char *s;
int n, ns;
+ USED(c);
ns = m->ndata*UTFmax/2;
s = emalloc(ns);
n = fromutf16(s, ns, m->data, m->ndata);
- putsnarf(s, n);
+ putsnarfn(s, n);
free(s);
return;
}
--- a/egdi.c
+++ b/egdi.c
@@ -109,8 +109,8 @@
uchar
orderSupport[NumOrders] =
{
- [CanScrBlt] 1,
- [CanMemBlt] 1,
+ [CanScrBlt]= 1,
+ [CanMemBlt]= 1,
};
static struct GdiContext
@@ -453,10 +453,12 @@
/* 2.2.2.2.1.2.4 Cache Color Table (CACHE_COLOR_TABLE_ORDER) */
static int
-getcmapcache(Imgupd* up, uchar* a, uint nb, int, int)
+getcmapcache(Imgupd* up, uchar* a, uint nb, int xorder, int opt)
{
int cid, n;
DBG fprint(2, "getcmapcache...");
+ USED(xorder);
+ USED(opt);
cid = a[6];
n = GSHORT(a+7);
--- a/fns.h
+++ b/fns.h
@@ -14,8 +14,8 @@
/* snarf.c */
void initsnarf(void);
-char* getsnarf(int*);
-void putsnarf(char*,int);
+char* getsnarfn(int*);
+void putsnarfn(char*,int);
/* mouse.c */
void warpmouse(int,int);
--- a/kbd.c
+++ b/kbd.c
@@ -7,7 +7,7 @@
enum
{
- Kbrk= Spec|0x61,
+ Kbrk= KF|0x861,
KeyEx= 0x0100,
KeyUp= 0x8000,
};
--- a/mkfile
+++ b/mkfile
@@ -1,9 +1,10 @@
+
</$objtype/mkfile
+<$PLAN9/src/mkhdr
TARG=rd
BIN=/$objtype/bin
-CLEANFILES=$O.thread
HFILES=fns.h dat.h
OFILES=\
alloc.$O\
@@ -29,31 +30,11 @@
wsys.$O\
x224.$O\
-THREADOFILES=\
- alloc.$O\
- audio.$O\
- cap.$O\
- draw.$O\
- eclip.$O\
- egdi.$O\
- ele.$O\
- kbd.$O\
- rle.$O\
- load.$O\
- mcs.$O\
- mouse.$O\
- mpas.$O\
- mppc.$O\
- msg.$O\
- rd-thread.$O\
- rpc.$O\
- tls.$O\
- utf16.$O\
- vchan.$O\
- wsys.$O\
- x224.$O\
+THREADOFILES=${OFILES:rd.$O=rd-thread.$O}
+CLEANFILES=$O.thread
</sys/src/cmd/mkone
+<$PLAN9/src/mkone
$TARG: mkfile
--- a/rd-thread.c
+++ b/rd-thread.c
@@ -88,7 +88,7 @@
c->local = getenv("sysname");
c->user = getenv("user");
if(c->local == nil)
- sysfatal("set $sysname or use -n\n");
+ sysfatal("set $sysname\n");
if(c->user == nil)
sysfatal("set $user");
if(doauth){
@@ -119,12 +119,12 @@
mousectl = initmouse(nil, screen);
if(mousectl == nil){
fprint(2, "rd: can't initialize mouse: %r\n");
- exits("mouse");
+ threadexitsall("mouse");
}
keyboardctl = initkeyboard(nil);
if(keyboardctl == nil){
fprint(2, "rd: can't initialize keyboard: %r\n");
- exits("keyboard");
+ threadexitsall("keyboard");
}
proccreate(keyboardthread, c, STACK);
@@ -173,6 +173,7 @@
Rdp* c;
enum { MResize, MMouse, NMALT };
static Alt alts[NMALT+1];
+ Mouse m;
c = v;
threadsetname("mousethread");
@@ -180,7 +181,7 @@
alts[MResize].v = nil;
alts[MResize].op = CHANRCV;
alts[MMouse].c = mousectl->c;
- alts[MMouse].v = &mousectl->Mouse;
+ alts[MMouse].v = &m;
alts[MMouse].op = CHANRCV;
for(;;){
@@ -189,7 +190,7 @@
eresized(c, 1);
break;
case MMouse:
- sendmouse(c, mousectl->Mouse);
+ sendmouse(c, m);
break;
}
}
--- a/rd.c
+++ b/rd.c
@@ -165,7 +165,7 @@
c->local = getenv("sysname");
c->user = getenv("user");
if(c->local == nil)
- sysfatal("set $sysname or use -n\n");
+ sysfatal("set $sysname\n");
if(c->user == nil)
sysfatal("set $user");
if(doauth){
--- a/rle.c
+++ b/rle.c
@@ -46,11 +46,11 @@
static int
decode[2][16] =
{
-[Std] {
+[Std]={
Bg, Bg, Fg, Fg, Mix, Mix, Fill, Fill,
Lit, Lit, -1, -1, FgS, MixS, Dith, -1,
},
-[Ext] {
+[Ext]={
Bg, Fg, Mix, Fill, Lit, -1, FgS, MixS,
Dith, Mix3, Mix5, -1, -1, Wpix, Bpix, -1,
}
--- a/rpc.c
+++ b/rpc.c
@@ -221,8 +221,9 @@
}
void
-deactivate(Rdp* c, Share*)
+deactivate(Rdp* c, Share* as)
{
+ USED(as);
c->active = 0;
}
--- a/vchan.c
+++ b/vchan.c
@@ -68,11 +68,12 @@
}
int
-defragvc(Rdp*, Msg* m)
+defragvc(Rdp* c, Msg* m)
{
Vchan* vc;
int n;
-
+
+ USED(c);
vc = lookupvc(m->chanid);
if(vc == nil){
fprint(2, "defragvc: bad chanid\n");
--- a/wsys.c
+++ b/wsys.c
@@ -35,11 +35,12 @@
}
void
-eresized(Rdp* c, int)
+eresized(Rdp* c, int refresh)
{
int fd;
Point d;
+ USED(refresh);
if(display->locking)
lockdisplay(display);
if(getwindow(display, Refnone) < 0)
@@ -70,7 +71,7 @@
* fd here rather than use snarffd
*/
void
-putsnarf(char* s, int nb)
+putsnarfn(char* s, int nb)
{
int fd, i;
@@ -91,7 +92,7 @@
}
char*
-getsnarf(int *pnb)
+getsnarfn(int *pnb)
{
int i, n;
char *s, buf[BUFSIZE];