code: 9ferno

Download patch

ref: 8fd174a0ce2e6bd4af629653d256c16f608c0165
parent: 57d990a50a4f8479689deb8a70e0dda1975d63b2
author: joe9 <joe9mail@gmail.com>
date: Sat Jul 3 00:49:58 EDT 2021

more changes from ulong to u32int

--- a/limbo/asm.c
+++ b/limbo/asm.c
@@ -5,7 +5,7 @@
 {
 	if(e == nil)
 		return;
-	Bprint(bout, "\tentry\t%ld, %d\n", e->pc->pc, e->desc->id);
+	Bprint(bout, "\tentry\t%zd, %d\n", e->pc->pc, e->desc->id);
 }
 
 void
@@ -16,10 +16,10 @@
 	for(m = m->ty->tof->ids; m != nil; m = m->next){
 		switch(m->store){
 		case Dglobal:
-			Bprint(bout, "\tlink\t-1,-1,0x%lux,\".mp\"\n", sign(m));
+			Bprint(bout, "\tlink\t-1,-1,0x%ux,\".mp\"\n", sign(m));
 			break;
 		case Dfn:
-			Bprint(bout, "\tlink\t%d,%ld,0x%lux,\"",
+			Bprint(bout, "\tlink\t%d,%zd,0x%ux,\"",
 				m->desc->id, m->pc->pc, sign(m));
 			if(m->dot->ty->kind == Tadt)
 				Bprint(bout, "%s.", m->dot->sym->name);
@@ -81,17 +81,17 @@
 	Case *c;
 	Label *lab;
 	Decl *id;
-	ulong dv[2];
-	long e, last, esz, dotlen, idlen;
+	u32int dv[2];
+	s32int e, last, esz, dotlen, idlen;
 	int i;
 
 	switch(n->ty->kind){
 	case Tbyte:
-		Bprint(bout, "\tbyte\t@mp+%ld,%ld\n", offset, (long)n->val & 0xff);
+		Bprint(bout, "\tbyte\t@mp+%ld,%d\n", offset, (s32int)n->val & 0xff);
 		break;
 	case Tint:
 	case Tfix:
-		Bprint(bout, "\tword\t@mp+%ld,%ld\n", offset, (long)n->val);
+		Bprint(bout, "\tword\t@mp+%ld,%d\n", offset, (s32int)n->val);
 		break;
 	case Tbig:
 		Bprint(bout, "\tlong\t@mp+%ld,%lld # %.16llux\n", offset, n->val, n->val);
@@ -101,7 +101,7 @@
 		break;
 	case Treal:
 		dtocanon(n->rval, dv);
-		Bprint(bout, "\treal\t@mp+%ld,%g # %.8lux%.8lux\n", offset, n->rval, dv[0], dv[1]);
+		Bprint(bout, "\treal\t@mp+%ld,%g # %.8ux%.8ux\n", offset, n->rval, dv[0], dv[1]);
 		break;
 	case Tadt:
 	case Tadtpick:
@@ -117,9 +117,9 @@
 		Bprint(bout, "\tword\t@mp+%ld,%d", offset, c->nlab);
 		for(i = 0; i < c->nlab; i++){
 			lab = &c->labs[i];
-			Bprint(bout, ",%ld,%ld,%ld", (long)lab->start->val, (long)lab->stop->val+1, lab->inst->pc);
+			Bprint(bout, ",%d,%d,%zd", (s32int)lab->start->val, (s32int)lab->stop->val+1, lab->inst->pc);
 		}
-		Bprint(bout, ",%ld\n", c->iwild ? c->iwild->pc : -1);
+		Bprint(bout, ",%zd\n", c->iwild ? c->iwild->pc : -1);
 		break;
 	case Tcasel:
 		c = n->ty->cse;
@@ -126,9 +126,9 @@
 		Bprint(bout, "\tword\t@mp+%ld,%d", offset, c->nlab);
 		for(i = 0; i < c->nlab; i++){
 			lab = &c->labs[i];
-			Bprint(bout, ",%lld,%lld,%ld", lab->start->val, lab->stop->val+1, lab->inst->pc);
+			Bprint(bout, ",%lld,%lld,%zd", lab->start->val, lab->stop->val+1, lab->inst->pc);
 		}
-		Bprint(bout, ",%ld\n", c->iwild ? c->iwild->pc : -1);
+		Bprint(bout, ",%zd\n", c->iwild ? c->iwild->pc : -1);
 		break;
 	case Tcasec:
 		c = n->ty->cse;
@@ -141,10 +141,10 @@
 			if(lab->stop != lab->start)
 				asmstring(offset, lab->stop->decl->sym);
 			offset += IBY2WD;
-			Bprint(bout, "\tword\t@mp+%ld,%ld\n", offset, lab->inst->pc);
+			Bprint(bout, "\tword\t@mp+%ld,%zd\n", offset, lab->inst->pc);
 			offset += IBY2WD;
 		}
-		Bprint(bout, "\tword\t@mp+%ld,%ld\n", offset, c->iwild ? c->iwild->pc : -1);
+		Bprint(bout, "\tword\t@mp+%ld,%zd\n", offset, c->iwild ? c->iwild->pc : -1);
 		break;
 	case Tgoto:
 		c = n->ty->cse;
@@ -151,15 +151,15 @@
 		Bprint(bout, "\tword\t@mp+%ld", offset);
 		Bprint(bout, ",%ld", n->ty->size/IBY2WD-1);
 		for(i = 0; i < c->nlab; i++)
-			Bprint(bout, ",%ld", c->labs[i].inst->pc);
+			Bprint(bout, ",%zd", c->labs[i].inst->pc);
 		if(c->iwild != nil)
-			Bprint(bout, ",%ld", c->iwild->pc);
+			Bprint(bout, ",%zd", c->iwild->pc);
 		Bprint(bout, "\n");
 		break;
 	case Tany:
 		break;
 	case Tarray:
-		Bprint(bout, "\tarray\t@mp+%ld,$%d,%ld\n", offset, n->ty->tof->decl->desc->id, (long)n->left->val);
+		Bprint(bout, "\tarray\t@mp+%ld,$%d,%d\n", offset, n->ty->tof->decl->desc->id, (s32int)n->left->val);
 		if(n->right == nil)
 			break;
 		Bprint(bout, "\tindir\t@mp+%ld,0\n", offset);
@@ -188,16 +188,16 @@
 		break;
 	case Tiface:
 		if(LDT)
-			Bprint(bout, "\tword\t@ldt+%ld,%ld\n", offset, (long)n->val);
+			Bprint(bout, "\tword\t@ldt+%ld,%d\n", offset, (s32int)n->val);
 		else
-			Bprint(bout, "\tword\t@mp+%ld,%ld\n", offset, (long)n->val);
+			Bprint(bout, "\tword\t@mp+%ld,%d\n", offset, (s32int)n->val);
 		offset += IBY2WD;
 		for(id = n->decl->ty->ids; id != nil; id = id->next){
 			offset = align(offset, IBY2WD);
 			if(LDT)
-				Bprint(bout, "\text\t@ldt+%ld,0x%lux,\"", offset, sign(id));
+				Bprint(bout, "\text\t@ldt+%ld,0x%ux,\"", offset, sign(id));
 			else
-				Bprint(bout, "\text\t@mp+%ld,0x%lux,\"", offset, sign(id));
+				Bprint(bout, "\text\t@mp+%ld,0x%ux,\"", offset, sign(id));
 			dotlen = 0;
 			idlen = id->sym->len + 1;
 			if(id->dot->ty->kind == Tadt){
@@ -242,12 +242,12 @@
 			d = lab->start->decl;
 			if(lab->start->ty->kind == Texception)
 				d = d->init->decl;
-			Bprint(bout, "\texctab\t\"%s\", %ld\n", d->sym->name, lab->inst->pc);
+			Bprint(bout, "\texctab\t\"%s\", %zd\n", d->sym->name, lab->inst->pc);
 		}
 		if(c->iwild == nil)
 			Bprint(bout, "\texctab\t*, %d\n", -1);
 		else
-			Bprint(bout, "\texctab\t*, %ld\n", c->iwild->pc);
+			Bprint(bout, "\texctab\t*, %zd\n", c->iwild->pc);
 	}
 }
 
@@ -283,7 +283,7 @@
 		if(in->op == INOOP)
 			continue;
 		if(in->pc % 10 == 0)
-			Bprint(bout, "#%ld\n", in->pc);
+			Bprint(bout, "#%zd\n", in->pc);
 		Bprint(bout, "%I\n", in);
 	}
 }
--- a/limbo/ecom.c
+++ b/limbo/ecom.c
@@ -2458,10 +2458,10 @@
 	Decl *d;
 	Sym *s;
 	char buf[32];
-	ulong dv[2];
+	u32int dv[2];
 
 	dtocanon(n->rval, dv);
-	seprint(buf, buf+sizeof(buf), ".f.%.8lux.%8lux", dv[0], dv[1]);
+	seprint(buf, buf+sizeof(buf), ".f.%.8ux.%8ux", dv[0], dv[1]);
 	s = enter(buf, 0);
 	d = s->decl;
 	if(d == nil){
--- a/limbo/limbo.y
+++ b/limbo/limbo.y
@@ -1604,7 +1604,7 @@
 
 static	int	dosym;
 static	int	toterrors;
-static	ulong	canonnanbits[] = { 0x7fffffff, 0xffffffff};
+static	u32int	canonnanbits[] = { 0x7fffffff, 0xffffffff};
 static	char*	infile;
 
 #define SLASHMOD	"/module"