Silenced errors, thanks Sigrid

This commit is contained in:
Devine Lu Linvega 2024-08-29 08:32:31 -07:00
parent 36dd15a244
commit 7a42c338a8
5 changed files with 29 additions and 28 deletions

View File

@ -49,11 +49,11 @@ static pid_t child_pid;
* (other bits ignored for now ) * (other bits ignored for now )
*/ */
#define CMD_LIVE 0x15 // 0x00 not started, 0x01 running, 0xff dead #define CMD_LIVE 0x15 /* 0x00 not started, 0x01 running, 0xff dead */
#define CMD_EXIT 0x16 // if dead, exit code of process #define CMD_EXIT 0x16 /* if dead, exit code of process */
#define CMD_ADDR 0x1c // address to read command args from #define CMD_ADDR 0x1c /* address to read command args from */
#define CMD_MODE 0x1e // mode to execute, 0x00 to 0x07 #define CMD_MODE 0x1e /* mode to execute, 0x00 to 0x07 */
#define CMD_EXEC 0x1f // write to execute programs, etc #define CMD_EXEC 0x1f /* write to execute programs, etc */
/* call after we're sure the process has exited */ /* call after we're sure the process has exited */
static void static void
@ -76,10 +76,10 @@ clean_after_child(void)
static void static void
start_fork_pipe(void) start_fork_pipe(void)
{ {
fflush(stdout);
pid_t pid; pid_t pid;
pid_t parent_pid = getpid(); pid_t parent_pid = getpid();
int addr = PEEK2(&uxn.dev[CMD_ADDR]); int addr = PEEK2(&uxn.dev[CMD_ADDR]);
fflush(stdout);
if(child_mode & 0x08) { if(child_mode & 0x08) {
uxn.dev[CMD_EXIT] = uxn.dev[CMD_LIVE] = 0x00; uxn.dev[CMD_EXIT] = uxn.dev[CMD_LIVE] = 0x00;
return; return;
@ -110,9 +110,10 @@ start_fork_pipe(void)
#ifdef __linux__ #ifdef __linux__
int r = prctl(PR_SET_PDEATHSIG, SIGTERM); int r = prctl(PR_SET_PDEATHSIG, SIGTERM);
if (r == -1) { perror(0); exit(6); } if(r == -1) {
// test in case the original parent exited just perror(0);
// before the prctl() call exit(6);
}
if(getppid() != parent_pid) exit(13); if(getppid() != parent_pid) exit(13);
#endif #endif

View File

@ -12,14 +12,14 @@ WITH REGARD TO THIS SOFTWARE.
*/ */
#define OPC(opc, init, body) {\ #define OPC(opc, init, body) {\
case 0x00|opc: {enum{_2=0,_r=0};init body;} break;\ case 0x00|opc: {const int _2=0,_r=0;init body;} break;\
case 0x20|opc: {enum{_2=1,_r=0};init body;} break;\ case 0x20|opc: {const int _2=1,_r=0;init body;} break;\
case 0x40|opc: {enum{_2=0,_r=1};init body;} break;\ case 0x40|opc: {const int _2=0,_r=1;init body;} break;\
case 0x60|opc: {enum{_2=1,_r=1};init body;} break;\ case 0x60|opc: {const int _2=1,_r=1;init body;} break;\
case 0x80|opc: {enum{_2=0,_r=0};int k=uxn.wst.ptr;init uxn.wst.ptr= k;body;} break;\ case 0x80|opc: {const int _2=0,_r=0;int k=uxn.wst.ptr;init uxn.wst.ptr= k;body;} break;\
case 0xa0|opc: {enum{_2=1,_r=0};int k=uxn.wst.ptr;init uxn.wst.ptr= k;body;} break;\ case 0xa0|opc: {const int _2=1,_r=0;int k=uxn.wst.ptr;init uxn.wst.ptr= k;body;} break;\
case 0xc0|opc: {enum{_2=0,_r=1};int k=uxn.rst.ptr;init uxn.rst.ptr= k;body;} break;\ case 0xc0|opc: {const int _2=0,_r=1;int k=uxn.rst.ptr;init uxn.rst.ptr= k;body;} break;\
case 0xe0|opc: {enum{_2=1,_r=1};int k=uxn.rst.ptr;init uxn.rst.ptr= k;body;} break;\ case 0xe0|opc: {const int _2=1,_r=1;int k=uxn.rst.ptr;init uxn.rst.ptr= k;body;} break;\
} }
/* Microcode */ /* Microcode */
@ -58,7 +58,7 @@ uxn_eval(Uint16 pc)
/* L2r */ case 0xe0: INC(rst) = uxn.ram[pc++]; /* L2r */ case 0xe0: INC(rst) = uxn.ram[pc++];
/* LIr */ case 0xc0: INC(rst) = uxn.ram[pc++]; break; /* LIr */ case 0xc0: INC(rst) = uxn.ram[pc++]; break;
/* INC */ OPC(0x01, POx(a), PUx(a + 1)) /* INC */ OPC(0x01, POx(a), PUx(a + 1))
/* POP */ OPC(0x02, REM, 0) /* POP */ OPC(0x02, REM, {})
/* NIP */ OPC(0x03, GET(x) REM,PUT(x)) /* NIP */ OPC(0x03, GET(x) REM,PUT(x))
/* SWP */ OPC(0x04, GET(x) GET(y),PUT(x) PUT(y)) /* SWP */ OPC(0x04, GET(x) GET(y),PUT(x) PUT(y))
/* ROT */ OPC(0x05, GET(x) GET(y) GET(z),PUT(y) PUT(x) PUT(z)) /* ROT */ OPC(0x05, GET(x) GET(y) GET(z),PUT(y) PUT(x) PUT(z))

View File

@ -271,7 +271,7 @@ main(int argc, char **argv)
int i = 1; int i = 1;
char *rom; char *rom;
if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') { if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
fprintf(stdout, "Uxn11 - Varvara Emulator, 25 Aug 2024.\n"); fprintf(stdout, "Uxn11 - Varvara Emulator, 29 Aug 2024.\n");
exit(0); exit(0);
} }
rom = i == argc ? "boot.rom" : argv[i++]; rom = i == argc ? "boot.rom" : argv[i++];

View File

@ -61,7 +61,7 @@ static int parse(char *w, FILE *f, Context *ctx);
static char * static char *
push(char *s, char c) push(char *s, char c)
{ {
char *d = dict; char *d;
for(d = dict; d < dictnext; d++) { for(d = dict; d < dictnext; d++) {
char *ss = s, *dd = d, a, b; char *ss = s, *dd = d, a, b;
while((a = *dd++) == (b = *ss++)) while((a = *dd++) == (b = *ss++))
@ -126,7 +126,7 @@ walkmacro(Item *m, Context *ctx)
char *dataptr = m->data, *_token = token; char *dataptr = m->data, *_token = token;
while((c = *dataptr++)) { while((c = *dataptr++)) {
if(c < 0x21) { if(c < 0x21) {
*_token++ = 0x00; *_token = 0x00;
if(token[0] && !parse(token, NULL, ctx)) return 0; if(token[0] && !parse(token, NULL, ctx)) return 0;
_token = token; _token = token;
} else if(_token - token < 0x2f) } else if(_token - token < 0x2f)
@ -144,7 +144,7 @@ walkfile(FILE *f, Context *ctx)
char *_token = token; char *_token = token;
while(f && fread(&c, 1, 1, f)) { while(f && fread(&c, 1, 1, f)) {
if(c < 0x21) { if(c < 0x21) {
*_token++ = 0x00; *_token = 0x00;
if(token[0] && !parse(token, f, ctx)) return 0; if(token[0] && !parse(token, f, ctx)) return 0;
if(c == 0xa) ctx->line++; if(c == 0xa) ctx->line++;
_token = token; _token = token;
@ -153,7 +153,7 @@ walkfile(FILE *f, Context *ctx)
else else
return error_asm("Token size exceeded"); return error_asm("Token size exceeded");
} }
*_token++ = 0; *_token = 0;
return parse(token, f, ctx); return parse(token, f, ctx);
} }
@ -293,7 +293,7 @@ static int
assemble(char *filename) assemble(char *filename)
{ {
FILE *f; FILE *f;
int res = 0; int res;
Context ctx; Context ctx;
ctx.line = 1; ctx.line = 1;
ctx.path = push(filename, 0); ctx.path = push(filename, 0);
@ -415,7 +415,7 @@ main(int argc, char *argv[])
{ {
ptr = PAGE; ptr = PAGE;
copy("on-reset", scope, 0); copy("on-reset", scope, 0);
if(argc == 2 && scmp(argv[1], "-v", 2)) return !printf("Uxnasm - Uxntal Assembler, 25 Aug 2024.\n"); if(argc == 2 && scmp(argv[1], "-v", 2)) return !printf("Uxnasm - Uxntal Assembler, 29 Aug 2024.\n");
if(argc != 3) return error_top("usage", "uxnasm [-v] input.tal output.rom"); if(argc != 3) return error_top("usage", "uxnasm [-v] input.tal output.rom");
if(!assemble(argv[1])) return 1; if(!assemble(argv[1])) return 1;
if(!resolve(argv[2])) return 1; if(!resolve(argv[2])) return 1;

View File

@ -69,7 +69,7 @@ main(int argc, char **argv)
int i = 1; int i = 1;
char *rom; char *rom;
if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') { if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
fprintf(stdout, "Uxncli - Console Varvara Emulator, 25 Aug 2024.\n"); fprintf(stdout, "Uxncli - Console Varvara Emulator, 29 Aug 2024.\n");
exit(0); exit(0);
} }
rom = i == argc ? "boot.rom" : argv[i++]; rom = i == argc ? "boot.rom" : argv[i++];