commit 7a42c33

Devine Lu Linvega  ·  2024-08-29 15:32:31 +0000 UTC
parent 36dd15a
Silenced errors, thanks Sigrid
5 files changed,  +29, -28
+11, -10
 1@@ -49,11 +49,11 @@ static pid_t child_pid;
 2  * (other bits ignored for now )
 3  */
 4 
 5-#define CMD_LIVE 0x15 // 0x00 not started, 0x01 running, 0xff dead
 6-#define CMD_EXIT 0x16 // if dead, exit code of process
 7-#define CMD_ADDR 0x1c // address to read command args from
 8-#define CMD_MODE 0x1e // mode to execute, 0x00 to 0x07
 9-#define CMD_EXEC 0x1f // write to execute programs, etc
10+#define CMD_LIVE 0x15 /* 0x00 not started, 0x01 running, 0xff dead */
11+#define CMD_EXIT 0x16 /* if dead, exit code of process */
12+#define CMD_ADDR 0x1c /* address to read command args from */
13+#define CMD_MODE 0x1e /* mode to execute, 0x00 to 0x07 */
14+#define CMD_EXEC 0x1f /* write to execute programs, etc */
15 
16 /* call after we're sure the process has exited */
17 static void
18@@ -76,10 +76,10 @@ clean_after_child(void)
19 static void
20 start_fork_pipe(void)
21 {
22-	fflush(stdout);
23 	pid_t pid;
24 	pid_t parent_pid = getpid();
25 	int addr = PEEK2(&uxn.dev[CMD_ADDR]);
26+	fflush(stdout);
27 	if(child_mode & 0x08) {
28 		uxn.dev[CMD_EXIT] = uxn.dev[CMD_LIVE] = 0x00;
29 		return;
30@@ -110,10 +110,11 @@ start_fork_pipe(void)
31 
32 #ifdef __linux__
33 		int r = prctl(PR_SET_PDEATHSIG, SIGTERM);
34-		if (r == -1) { perror(0); exit(6); }
35-		// test in case the original parent exited just
36-		// before the prctl() call
37-		if (getppid() != parent_pid) exit(13);
38+		if(r == -1) {
39+			perror(0);
40+			exit(6);
41+		}
42+		if(getppid() != parent_pid) exit(13);
43 #endif
44 
45 		if(child_mode & 0x01) {
+9, -9
 1@@ -12,14 +12,14 @@ WITH REGARD TO THIS SOFTWARE.
 2 */
 3 
 4 #define OPC(opc, init, body) {\
 5-	case 0x00|opc: {enum{_2=0,_r=0};init body;} break;\
 6-	case 0x20|opc: {enum{_2=1,_r=0};init body;} break;\
 7-	case 0x40|opc: {enum{_2=0,_r=1};init body;} break;\
 8-	case 0x60|opc: {enum{_2=1,_r=1};init body;} break;\
 9-	case 0x80|opc: {enum{_2=0,_r=0};int k=uxn.wst.ptr;init uxn.wst.ptr= k;body;} break;\
10-	case 0xa0|opc: {enum{_2=1,_r=0};int k=uxn.wst.ptr;init uxn.wst.ptr= k;body;} break;\
11-	case 0xc0|opc: {enum{_2=0,_r=1};int k=uxn.rst.ptr;init uxn.rst.ptr= k;body;} break;\
12-	case 0xe0|opc: {enum{_2=1,_r=1};int k=uxn.rst.ptr;init uxn.rst.ptr= k;body;} break;\
13+	case 0x00|opc: {const int _2=0,_r=0;init body;} break;\
14+	case 0x20|opc: {const int _2=1,_r=0;init body;} break;\
15+	case 0x40|opc: {const int _2=0,_r=1;init body;} break;\
16+	case 0x60|opc: {const int _2=1,_r=1;init body;} break;\
17+	case 0x80|opc: {const int _2=0,_r=0;int k=uxn.wst.ptr;init uxn.wst.ptr= k;body;} break;\
18+	case 0xa0|opc: {const int _2=1,_r=0;int k=uxn.wst.ptr;init uxn.wst.ptr= k;body;} break;\
19+	case 0xc0|opc: {const int _2=0,_r=1;int k=uxn.rst.ptr;init uxn.rst.ptr= k;body;} break;\
20+	case 0xe0|opc: {const int _2=1,_r=1;int k=uxn.rst.ptr;init uxn.rst.ptr= k;body;} break;\
21 }
22 
23 /* Microcode */
24@@ -58,7 +58,7 @@ uxn_eval(Uint16 pc)
25 		/* L2r */ case 0xe0: INC(rst) = uxn.ram[pc++];
26 		/* LIr */ case 0xc0: INC(rst) = uxn.ram[pc++]; break;
27 		/* INC */ OPC(0x01, POx(a), PUx(a + 1))
28-		/* POP */ OPC(0x02, REM, 0)
29+		/* POP */ OPC(0x02, REM, {})
30 		/* NIP */ OPC(0x03, GET(x) REM,PUT(x))
31 		/* SWP */ OPC(0x04, GET(x) GET(y),PUT(x) PUT(y))
32 		/* ROT */ OPC(0x05, GET(x) GET(y) GET(z),PUT(y) PUT(x) PUT(z))
+2, -2
 1@@ -200,7 +200,7 @@ display_init(void)
 2 	char empty[] = {0};
 3 	Pixmap bitmap;
 4 	Cursor blank;
 5-	XClassHint class = { "uxn11", "Uxn" };
 6+	XClassHint class = {"uxn11", "Uxn"};
 7 	display = XOpenDisplay(NULL);
 8 	if(!display)
 9 		return system_error("init", "Display failed");
10@@ -271,7 +271,7 @@ main(int argc, char **argv)
11 	int i = 1;
12 	char *rom;
13 	if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
14-		fprintf(stdout, "Uxn11 - Varvara Emulator, 25 Aug 2024.\n");
15+		fprintf(stdout, "Uxn11 - Varvara Emulator, 29 Aug 2024.\n");
16 		exit(0);
17 	}
18 	rom = i == argc ? "boot.rom" : argv[i++];
+6, -6
 1@@ -61,7 +61,7 @@ static int parse(char *w, FILE *f, Context *ctx);
 2 static char *
 3 push(char *s, char c)
 4 {
 5-	char *d = dict;
 6+	char *d;
 7 	for(d = dict; d < dictnext; d++) {
 8 		char *ss = s, *dd = d, a, b;
 9 		while((a = *dd++) == (b = *ss++))
10@@ -126,7 +126,7 @@ walkmacro(Item *m, Context *ctx)
11 	char *dataptr = m->data, *_token = token;
12 	while((c = *dataptr++)) {
13 		if(c < 0x21) {
14-			*_token++ = 0x00;
15+			*_token = 0x00;
16 			if(token[0] && !parse(token, NULL, ctx)) return 0;
17 			_token = token;
18 		} else if(_token - token < 0x2f)
19@@ -144,7 +144,7 @@ walkfile(FILE *f, Context *ctx)
20 	char *_token = token;
21 	while(f && fread(&c, 1, 1, f)) {
22 		if(c < 0x21) {
23-			*_token++ = 0x00;
24+			*_token = 0x00;
25 			if(token[0] && !parse(token, f, ctx)) return 0;
26 			if(c == 0xa) ctx->line++;
27 			_token = token;
28@@ -153,7 +153,7 @@ walkfile(FILE *f, Context *ctx)
29 		else
30 			return error_asm("Token size exceeded");
31 	}
32-	*_token++ = 0;
33+	*_token = 0;
34 	return parse(token, f, ctx);
35 }
36 
37@@ -293,7 +293,7 @@ static int
38 assemble(char *filename)
39 {
40 	FILE *f;
41-	int res = 0;
42+	int res;
43 	Context ctx;
44 	ctx.line = 1;
45 	ctx.path = push(filename, 0);
46@@ -415,7 +415,7 @@ main(int argc, char *argv[])
47 {
48 	ptr = PAGE;
49 	copy("on-reset", scope, 0);
50-	if(argc == 2 && scmp(argv[1], "-v", 2)) return !printf("Uxnasm - Uxntal Assembler, 25 Aug 2024.\n");
51+	if(argc == 2 && scmp(argv[1], "-v", 2)) return !printf("Uxnasm - Uxntal Assembler, 29 Aug 2024.\n");
52 	if(argc != 3) return error_top("usage", "uxnasm [-v] input.tal output.rom");
53 	if(!assemble(argv[1])) return 1;
54 	if(!resolve(argv[2])) return 1;
+1, -1
1@@ -69,7 +69,7 @@ main(int argc, char **argv)
2 	int i = 1;
3 	char *rom;
4 	if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
5-		fprintf(stdout, "Uxncli - Console Varvara Emulator, 25 Aug 2024.\n");
6+		fprintf(stdout, "Uxncli - Console Varvara Emulator, 29 Aug 2024.\n");
7 		exit(0);
8 	}
9 	rom = i == argc ? "boot.rom" : argv[i++];