Browse Source

Plan 9 from Bell Labs 2013-03-05

David du Colombier 11 years ago
parent
commit
8d74f00378

+ 3 - 0
386/include/ape/math.h

@@ -72,4 +72,7 @@ extern double yn(int, double);
 }
 #endif
 
+#define isnan(x) isNaN(x)
+#define isinf(x) isInf(x, 0)
+
 #endif /* __MATH */

+ 2 - 1
arm/include/ape/math.h

@@ -15,6 +15,7 @@ extern double asin(double);
 extern double atan(double);
 extern double atan2(double, double);
 extern double cos(double);
+extern double hypot(double, double);
 extern double sin(double);
 extern double tan(double);
 extern double cosh(double);
@@ -72,6 +73,6 @@ extern double yn(int, double);
 #endif
 
 #define isnan(x) isNaN(x)
-#define isinf(x) isInf(x)
+#define isinf(x) isInf(x, 0)
 
 #endif /* __MATH */

+ 2 - 1
mips/include/ape/math.h

@@ -15,6 +15,7 @@ extern double asin(double);
 extern double atan(double);
 extern double atan2(double, double);
 extern double cos(double);
+extern double hypot(double, double);
 extern double sin(double);
 extern double tan(double);
 extern double cosh(double);
@@ -72,6 +73,6 @@ extern double yn(int, double);
 #endif
 
 #define isnan(x) isNaN(x)
-#define isinf(x) isInf(x)
+#define isinf(x) isInf(x, 0)
 
 #endif /* __MATH */

+ 2 - 1
power/include/ape/math.h

@@ -15,6 +15,7 @@ extern double asin(double);
 extern double atan(double);
 extern double atan2(double, double);
 extern double cos(double);
+extern double hypot(double, double);
 extern double sin(double);
 extern double tan(double);
 extern double cosh(double);
@@ -72,6 +73,6 @@ extern double yn(int, double);
 #endif
 
 #define isnan(x) isNaN(x)
-#define isinf(x) isInf(x)
+#define isinf(x) isInf(x, 0)
 
 #endif /* __MATH */

+ 2 - 1
sparc/include/ape/math.h

@@ -15,6 +15,7 @@ extern double asin(double);
 extern double atan(double);
 extern double atan2(double, double);
 extern double cos(double);
+extern double hypot(double, double);
 extern double sin(double);
 extern double tan(double);
 extern double cosh(double);
@@ -72,6 +73,6 @@ extern double yn(int, double);
 #endif
 
 #define isnan(x) isNaN(x)
-#define isinf(x) isInf(x)
+#define isinf(x) isInf(x, 0)
 
 #endif /* __MATH */

+ 0 - 1
sys/src/cmd/5c/gc.h

@@ -276,7 +276,6 @@ long	outstring(char*, long);
 int	mulcon(Node*, Node*);
 Multab*	mulcon0(long);
 void	nullwarn(Node*, Node*);
-void	sextern(Sym*, Node*, long, long);
 void	gextern(Sym*, Node*, long, long);
 void	outcode(void);
 void	ieeedtod(Ieee*, double);

+ 4 - 21
sys/src/cmd/5c/swt.c

@@ -25,7 +25,7 @@ swit2(C1 *q, int nc, long def, Node *n, Node *tn)
 	}
 	if(nc < 5) {
 		for(i=0; i<nc; i++) {
-			if(debug['W'])
+			if(debug['K'])
 				print("case = %.8llux\n", q->val);
 			gopcode(OEQ, nodconst(q->val), n, Z);
 			patch(p, q->label);
@@ -38,7 +38,7 @@ swit2(C1 *q, int nc, long def, Node *n, Node *tn)
 
 	i = nc / 2;
 	r = q+i;
-	if(debug['W'])
+	if(debug['K'])
 		print("case > %.8llux\n", r->val);
 	gopcode(OGT, nodconst(r->val), n, Z);
 	sp = p;
@@ -46,7 +46,7 @@ swit2(C1 *q, int nc, long def, Node *n, Node *tn)
 	patch(p, r->label);
 	swit2(q, i, def, n, tn);
 
-	if(debug['W'])
+	if(debug['K'])
 		print("case < %.8llux\n", r->val);
 	patch(sp, pc);
 	swit2(r+1, nc-i-1, def, n, tn);
@@ -59,7 +59,7 @@ direct:
 	gopcode(OCASE, nodconst((q+nc-1)->val - v), n, Z);
 	patch(p, def);
 	for(i=0; i<nc; i++) {
-		if(debug['W'])
+		if(debug['K'])
 			print("case = %.8llux\n", q->val);
 		while(q->val != v) {
 			nextpc();
@@ -268,23 +268,6 @@ loop:
 	goto loop;
 }
 
-void
-sextern(Sym *s, Node *a, long o, long w)
-{
-	long e, lw;
-
-	for(e=0; e<w; e+=NSNAME) {
-		lw = NSNAME;
-		if(w-e < lw)
-			lw = w-e;
-		gpseudo(ADATA, s, nodconst(0));
-		p->from.offset += o+e;
-		p->reg = lw;
-		p->to.type = D_SCONST;
-		memmove(p->to.sval, a->cstring+e, lw);
-	}
-}
-
 void
 gextern(Sym *s, Node *a, long o, long w)
 {

+ 0 - 1
sys/src/cmd/6c/gc.h

@@ -278,7 +278,6 @@ void	bitload(Node*, Node*, Node*, Node*, Node*);
 void	bitstore(Node*, Node*, Node*, Node*, Node*);
 long	outstring(char*, long);
 void	nullwarn(Node*, Node*);
-void	sextern(Sym*, Node*, long, long);
 void	gextern(Sym*, Node*, long, long);
 void	outcode(void);
 void	ieeedtod(Ieee*, double);

+ 3 - 20
sys/src/cmd/6c/swt.c

@@ -9,7 +9,7 @@ swit1(C1 *q, int nc, long def, Node *n)
 
 	if(nc < 5) {
 		for(i=0; i<nc; i++) {
-			if(debug['W'])
+			if(debug['K'])
 				print("case = %.8llux\n", q->val);
 			gcmp(OEQ, n, q->val);
 			patch(p, q->label);
@@ -21,7 +21,7 @@ swit1(C1 *q, int nc, long def, Node *n)
 	}
 	i = nc / 2;
 	r = q+i;
-	if(debug['W'])
+	if(debug['K'])
 		print("case > %.8llux\n", r->val);
 	gcmp(OGT, n, r->val);
 	sp = p;
@@ -30,7 +30,7 @@ swit1(C1 *q, int nc, long def, Node *n)
 	patch(p, r->label);
 	swit1(q, i, def, n);
 
-	if(debug['W'])
+	if(debug['K'])
 		print("case < %.8llux\n", r->val);
 	patch(sp, pc);
 	swit1(r+1, nc-i-1, def, n);
@@ -127,23 +127,6 @@ outstring(char *s, long n)
 	return r;
 }
 
-void
-sextern(Sym *s, Node *a, long o, long w)
-{
-	long e, lw;
-
-	for(e=0; e<w; e+=NSNAME) {
-		lw = NSNAME;
-		if(w-e < lw)
-			lw = w-e;
-		gpseudo(ADATA, s, nodconst(0L));
-		p->from.offset += o+e;
-		p->from.scale = lw;
-		p->to.type = D_SCONST;
-		memmove(p->to.sval, a->cstring+e, lw);
-	}
-}
-
 void
 gextern(Sym *s, Node *a, long o, long w)
 {

+ 0 - 1
sys/src/cmd/8c/gc.h

@@ -275,7 +275,6 @@ void	bitload(Node*, Node*, Node*, Node*, Node*);
 void	bitstore(Node*, Node*, Node*, Node*, Node*);
 long	outstring(char*, long);
 void	nullwarn(Node*, Node*);
-void	sextern(Sym*, Node*, long, long);
 void	gextern(Sym*, Node*, long, long);
 void	outcode(void);
 void	ieeedtod(Ieee*, double);

+ 3 - 20
sys/src/cmd/8c/swt.c

@@ -9,7 +9,7 @@ swit1(C1 *q, int nc, long def, Node *n)
 
 	if(nc < 5) {
 		for(i=0; i<nc; i++) {
-			if(debug['W'])
+			if(debug['K'])
 				print("case = %.8llux\n", q->val);
 			gopcode(OEQ, n->type, n, nodconst(q->val));
 			patch(p, q->label);
@@ -21,7 +21,7 @@ swit1(C1 *q, int nc, long def, Node *n)
 	}
 	i = nc / 2;
 	r = q+i;
-	if(debug['W'])
+	if(debug['K'])
 		print("case > %.8llux\n", r->val);
 	gopcode(OGT, n->type, n, nodconst(r->val));
 	sp = p;
@@ -30,7 +30,7 @@ swit1(C1 *q, int nc, long def, Node *n)
 	patch(p, r->label);
 	swit1(q, i, def, n);
 
-	if(debug['W'])
+	if(debug['K'])
 		print("case < %.8llux\n", r->val);
 	patch(sp, pc);
 	swit1(r+1, nc-i-1, def, n);
@@ -127,23 +127,6 @@ outstring(char *s, long n)
 	return r;
 }
 
-void
-sextern(Sym *s, Node *a, long o, long w)
-{
-	long e, lw;
-
-	for(e=0; e<w; e+=NSNAME) {
-		lw = NSNAME;
-		if(w-e < lw)
-			lw = w-e;
-		gpseudo(ADATA, s, nodconst(0L));
-		p->from.offset += o+e;
-		p->from.scale = lw;
-		p->to.type = D_SCONST;
-		memmove(p->to.sval, a->cstring+e, lw);
-	}
-}
-
 void
 gextern(Sym *s, Node *a, long o, long w)
 {

+ 0 - 1
sys/src/cmd/cc/cc.h

@@ -741,7 +741,6 @@ void	gextern(Sym*, Node*, long, long);
 void	ginit(void);
 long	outstring(char*, long);
 long	outlstring(ushort*, long);
-void	sextern(Sym*, Node*, long, long);
 void	xcom(Node*);
 long	exreg(Type*);
 long	align(long, Type*, int);

+ 6 - 3
sys/src/cmd/cc/sub.c

@@ -1187,12 +1187,15 @@ warn(Node *n, char *fmt, ...)
 	char buf[STRINGSZ];
 	va_list arg;
 
-	if(debug['w']) {
-		Bprint(&diagbuf, "warning: ");
+	if(debug['w'] || debug['W']) {
 		va_start(arg, fmt);
 		vseprint(buf, buf+sizeof(buf), fmt, arg);
 		va_end(arg);
-		Bprint(&diagbuf, "%L %s\n", (n==Z)? nearln: n->lineno, buf);
+		if(debug['W']) {
+			diag(n, "%s", buf);
+			return;
+		}
+		Bprint(&diagbuf, "warning: %L %s\n", (n==Z)? nearln: n->lineno, buf);
 
 		if(n != Z)
 		if(debug['v'])

+ 0 - 1
sys/src/cmd/kc/gc.h

@@ -267,7 +267,6 @@ int	mulcon(Node*, Node*);
 Multab*	mulcon0(Node*, long);
 int	mulcon1(Node*, long, Node*);
 void	nullwarn(Node*, Node*);
-void	sextern(Sym*, Node*, long, long);
 void	gextern(Sym*, Node*, long, long);
 void	outcode(void);
 void	ieeedtod(Ieee*, double);

+ 0 - 17
sys/src/cmd/kc/swt.c

@@ -235,23 +235,6 @@ loop:
 	goto loop;
 }
 
-void
-sextern(Sym *s, Node *a, long o, long w)
-{
-	long e, lw;
-
-	for(e=0; e<w; e+=NSNAME) {
-		lw = NSNAME;
-		if(w-e < lw)
-			lw = w-e;
-		gpseudo(ADATA, s, nodconst(0));
-		p->from.offset += o+e;
-		p->reg = lw;
-		p->to.type = D_SCONST;
-		memmove(p->to.sval, a->cstring+e, lw);
-	}
-}
-
 void
 gextern(Sym *s, Node *a, long o, long w)
 {

+ 0 - 1
sys/src/cmd/qc/gc.h

@@ -283,7 +283,6 @@ int	mulcon(Node*, Node*);
 Multab*	mulcon0(Node*, long);
 int	mulcon1(Node*, long, Node*);
 void	nullwarn(Node*, Node*);
-void	sextern(Sym*, Node*, long, long);
 void	gextern(Sym*, Node*, long, long);
 void	outcode(void);
 void	ieeedtod(Ieee*, double);

+ 0 - 17
sys/src/cmd/qc/swt.c

@@ -239,23 +239,6 @@ loop:
 	goto loop;
 }
 
-void
-sextern(Sym *s, Node *a, long o, long w)
-{
-	long e, lw;
-
-	for(e=0; e<w; e+=NSNAME) {
-		lw = NSNAME;
-		if(w-e < lw)
-			lw = w-e;
-		gpseudo(ADATA, s, nodconst(0));
-		p->from.offset += o+e;
-		p->reg = lw;
-		p->to.type = D_SCONST;
-		memmove(p->to.sval, a->cstring+e, lw);
-	}
-}
-
 void
 gextern(Sym *s, Node *a, long o, long w)
 {

+ 0 - 1
sys/src/cmd/vc/gc.h

@@ -267,7 +267,6 @@ long	outstring(char*, long);
 int	mulcon(Node*, Node*);
 Multab*	mulcon0(long);
 void	nullwarn(Node*, Node*);
-void	sextern(Sym*, Node*, long, long);
 void	gextern(Sym*, Node*, long, long);
 void	outcode(void);
 void	ieeedtod(Ieee*, double);

+ 3 - 20
sys/src/cmd/vc/swt.c

@@ -19,7 +19,7 @@ swit2(C1 *q, int nc, long def, Node *n, Node *tn)
 
 	if(nc < 5) {
 		for(i=0; i<nc; i++) {
-			if(debug['W'])
+			if(debug['K'])
 				print("case = %.8llux\n", q->val);
 			gmove(nodconst(q->val), tn);
 			gopcode(OEQ, n, tn, Z);
@@ -32,7 +32,7 @@ swit2(C1 *q, int nc, long def, Node *n, Node *tn)
 	}
 	i = nc / 2;
 	r = q+i;
-	if(debug['W'])
+	if(debug['K'])
 		print("case > %.8llux\n", r->val);
 	gmove(nodconst(r->val), tn);
 	gopcode(OLT, tn, n, Z);
@@ -41,7 +41,7 @@ swit2(C1 *q, int nc, long def, Node *n, Node *tn)
 	patch(p, r->label);
 	swit2(q, i, def, n, tn);
 
-	if(debug['W'])
+	if(debug['K'])
 		print("case < %.8llux\n", r->val);
 	patch(sp, pc);
 	swit2(r+1, nc-i-1, def, n, tn);
@@ -233,23 +233,6 @@ loop:
 	goto loop;
 }
 
-void
-sextern(Sym *s, Node *a, long o, long w)
-{
-	long e, lw;
-
-	for(e=0; e<w; e+=NSNAME) {
-		lw = NSNAME;
-		if(w-e < lw)
-			lw = w-e;
-		gpseudo(ADATA, s, nodconst(0));
-		p->from.offset += o+e;
-		p->reg = lw;
-		p->to.type = D_SCONST;
-		memmove(p->to.sval, a->cstring+e, lw);
-	}
-}
-
 void
 gextern(Sym *s, Node *a, long o, long w)
 {