Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Get rid of some compiler warnings. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | ams/sdl |
Files: | files | file ages | folders |
SHA3-256: |
affdaf69ecf21dd272c68b9e0a3c91aa |
User & Date: | ams 2024-06-26 08:37:10 |
Context
2024-06-26
| ||
08:37 | Makefile: Add note that SDL1 with SDL12-compat is mostly broken. check-in: 7f3fbc4e82 user: ams tags: ams/sdl | |
08:37 | Get rid of some compiler warnings. check-in: affdaf69ec user: ams tags: ams/sdl | |
08:17 | Bunch of minor cleanups. check-in: 2d70efbcc9 user: ams tags: ams/sdl | |
Changes
Changes to misc.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* misc.c --- random utilities */ #include <ctype.h> #include <err.h> #include <stdbool.h> #include <stdio.h> #include <string.h> #include "misc.h" bool streq(const char *a, const char *b) { return strcmp(a, b) == 0; } | > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | /* misc.c --- random utilities */ #include <errno.h> #include <ctype.h> #include <err.h> #include <stdbool.h> #include <stdio.h> #include <string.h> #include "misc.h" ssize_t xgetline(char **l, size_t *n, FILE *f) { int old_errno = errno; size_t ret; old_errno = errno; errno = 0; ret = getline (l, n, f); if (!feof (f) && ferror (f)) { perror("getline failed"); exit(EXIT_FAILURE); } errno = old_errno; return ret; } bool streq(const char *a, const char *b) { return strcmp(a, b) == 0; } |
︙ | ︙ |
Changes to misc.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #pragma once #include <stdbool.h> #include <stdint.h> #include <unistd.h> #ifndef O_BINARY #define O_BINARY 0 #endif #define BLOCKSZ (256 * 4) #define _STRINGIFY(s) #s #define STRINGIFY(s) _STRINGIFY(s) #define NELEM(x) (sizeof(x)/sizeof(*x)) extern bool streq(const char *, const char *); extern char *strlwr(char *); extern void dumpmem(char *, int); extern uint16_t read16le(int); | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #pragma once #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #ifndef O_BINARY #define O_BINARY 0 #endif #define BLOCKSZ (256 * 4) #define _STRINGIFY(s) #s #define STRINGIFY(s) _STRINGIFY(s) #define NELEM(x) (sizeof(x)/sizeof(*x)) extern ssize_t xgetline(char **, size_t *, FILE *); extern bool streq(const char *, const char *); extern char *strlwr(char *); extern void dumpmem(char *, int); extern uint16_t read16le(int); |
︙ | ︙ |
Changes to sdl2.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* sdl2.c --- SDL2 routines used by the TV and KBD interfaces */ #include <signal.h> #include <SDL.h> #include "tv.h" #include "kbd.h" #include "mouse.h" #include "utrace.h" #include "idle.h" #include <X11/keysym.h> // for XK_FOO meh #include <X11/X.h> // for FOOMapIndex meh SDL_Window *window; SDL_Renderer *renderer; SDL_Texture *texture; | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | /* sdl2.c --- SDL2 routines used by the TV and KBD interfaces */ #include <signal.h> #include <SDL.h> #include "tv.h" #include "kbd.h" #include "cadet.h" #include "knight.h" #include "mouse.h" #include "utrace.h" #include "idle.h" #include "misc.h" #include <X11/keysym.h> // for XK_FOO meh #include <X11/X.h> // for FOOMapIndex meh SDL_Window *window; SDL_Renderer *renderer; SDL_Texture *texture; |
︙ | ︙ |
Changes to uexec.c.
︙ | ︙ | |||
250 251 252 253 254 255 256 257 258 259 260 261 262 263 | return res; case 025: DEBUG(TRACE_MICROCODE, "reading pdl[%o] -> %o\n", mfmem[014], pdl[mfmem[014]]); res = pdl[mfmem[014]]; trace_pdlptr_read(mdata); return res; } } void mfwrite(int dest, uint64_t data) { switch (dest >> 5) { case 1: /* LOCATION-COUNTER LC (location counter) 26 bits. */ | > | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | return res; case 025: DEBUG(TRACE_MICROCODE, "reading pdl[%o] -> %o\n", mfmem[014], pdl[mfmem[014]]); res = pdl[mfmem[014]]; trace_pdlptr_read(mdata); return res; } err(1, "unknown MF register (%o) read\n", addr); } void mfwrite(int dest, uint64_t data) { switch (dest >> 5) { case 1: /* LOCATION-COUNTER LC (location counter) 26 bits. */ |
︙ | ︙ | |||
366 367 368 369 370 371 372 373 374 375 376 377 378 379 | break; case 033: /* MEMORY-DATA-WRITE-MAP MD register, write map (like 23). */ mfmem[030] = data; DEBUG(TRACE_UCODE, "memory-data-write-map md=%o, vma=%o (addr %o)\n", mfmem[030], mfmem[020], mfmem[030] >> 13); mapWrite(); break; } } /* * Write value to decoded destination. */ void writeDest(int dest) | > | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | break; case 033: /* MEMORY-DATA-WRITE-MAP MD register, write map (like 23). */ mfmem[030] = data; DEBUG(TRACE_UCODE, "memory-data-write-map md=%o, vma=%o (addr %o)\n", mfmem[030], mfmem[020], mfmem[030] >> 13); mapWrite(); break; } err(1, "unknown MF register (%o) write (%lo)\n", dest, data); } /* * Write value to decoded destination. */ void writeDest(int dest) |
︙ | ︙ | |||
789 790 791 792 793 794 795 796 797 798 799 800 801 802 | case 6: DEBUG(TRACE_MICROCODE, "jump i|pf|sb\n"); /* pgf.or.int.sb */ return page_fault_flag | (interrupt_control & (1 << 27) ? interrupt_pending_flag : 0) | (interrupt_control & (1 << 26)); case 7: return 1; } } void jmp(void) { int target = ir(12, 14); int r = ir(9, 1); | > | 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | case 6: DEBUG(TRACE_MICROCODE, "jump i|pf|sb\n"); /* pgf.or.int.sb */ return page_fault_flag | (interrupt_control & (1 << 27) ? interrupt_pending_flag : 0) | (interrupt_control & (1 << 26)); case 7: return 1; } err(1, "unknown jump (%lo) condition", ir(0, 4)); } void jmp(void) { int target = ir(12, 14); int r = ir(9, 1); |
︙ | ︙ |
Changes to usym.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* syms.c --- routines for handling CADRLP symbol tables */ #include <sys/queue.h> #include <err.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "ucode.h" static void sym_add(symtab_t *tab, int memory, char *name, uint32_t v) { sym_t *s; s = malloc(sizeof(sym_t)); | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* syms.c --- routines for handling CADRLP symbol tables */ #include <sys/queue.h> #include <err.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "ucode.h" #include "misc.h" static void sym_add(symtab_t *tab, int memory, char *name, uint32_t v) { sym_t *s; s = malloc(sizeof(sym_t)); |
︙ | ︙ | |||
132 133 134 135 136 137 138 | f = fopen(filename, "r"); if (f == NULL) { warn("failed to open: %s", filename); return -1; } LIST_INIT(&tab->symbols); tab->name = strdup(filename); | | | | | | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | f = fopen(filename, "r"); if (f == NULL) { warn("failed to open: %s", filename); return -1; } LIST_INIT(&tab->symbols); tab->name = strdup(filename); xgetline(&l, &lsz, f); xgetline(&l, &lsz, f); /* -4 assembler state info. */ if (strcmp(l, "-4 \n") != 0) errx(1, "sym_read_file: failed to find assembler state info section (-4)"); xgetline(&l, &lsz, f); xgetline(&l, &lsz, f); /* -2 symbol dump start. */ /* * First symbol is handled specially, since directly after the * -2 marker the symbol, type and address follows. */ n = sscanf(l, "-2 %s %s %o \n", sym, symtype, &loc); if (n != 3) errx(1, "sym_read_file: failed to find symbol dump section (-2)"); sym_add(tab, sym_typeno(symtype), sym, loc); while (xgetline(&l, &lsz, f) != -1) { if (strcmp(l, "-1 ") == 0) { /* -1 EOF. */ fclose(f); return 0; } n = sscanf(l, "%s %s %o \n", sym, symtype, &loc); if (n != 3) continue; sym_add(tab, sym_typeno(symtype), sym, loc); } fclose(f); warnx("sym_read_file: failed to eof section marker (-1)"); return 1; } |