From bd2f592918794d1f33cf4fd913c80df4f9d18dea Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Fri, 7 Aug 2015 00:54:23 -0700 Subject: [PATCH] Revert "SCP: Remove ASCII source code character set dependency" This reverts commit 7c7b44e409f05751c960a614dbb1e2abde22da60. The prior commit didn't work for static initializers. There are other ASCII dependencies in simh. They should all be solved together or not at all. --- scp.c | 12 ------------ scp.h | 1 - sim_defs.h | 8 ++++---- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/scp.c b/scp.c index 38153645..c436e984 100644 --- a/scp.c +++ b/scp.c @@ -1845,18 +1845,6 @@ return 0; } #endif -/* Convert switch letter to bit mask */ - -int32 sim_swmask (int switch_ch) -{ -static char *letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -char *index = strchr (letters, switch_ch); - -if (index) - return (1u << (int)(index - letters)); -return 0; /* shouldn't happen */ -} - t_stat process_stdin_commands (t_stat stat, char *argv[]); /* Main command loop */ diff --git a/scp.h b/scp.h index 23d526c7..a205335e 100644 --- a/scp.h +++ b/scp.h @@ -116,7 +116,6 @@ t_stat sim_run_boot_prep (void); double sim_gtime (void); uint32 sim_grtime (void); int32 sim_qcount (void); -int32 sim_swmask (int switch_ch); t_stat attach_unit (UNIT *uptr, char *cptr); t_stat detach_unit (UNIT *uptr); t_stat assign_device (DEVICE *dptr, char *cptr); diff --git a/sim_defs.h b/sim_defs.h index 8c6e6a7d..4e5e28f0 100644 --- a/sim_defs.h +++ b/sim_defs.h @@ -278,10 +278,6 @@ typedef uint32 t_addr; #define SIM_SW_REG (1u << 28) /* register value */ #define SIM_SW_STOP (1u << 29) /* stop message */ -/* Convert switch letter to bit mask */ - -#define SWMASK(x) sim_swmask ((int)x) - /* Simulator status codes 0 ok @@ -362,6 +358,10 @@ typedef uint32 t_addr; #define KBD_LIM_WAIT(x) (((x) > KBD_MAX_WAIT)? KBD_MAX_WAIT: (x)) #define KBD_WAIT(w,s) ((w)? w: KBD_LIM_WAIT (s)) +/* Convert switch letter to bit mask */ + +#define SWMASK(x) (1u << (((int) (x)) - ((int) 'A'))) + /* String match - at least one character required */ #define MATCH_CMD(ptr,cmd) ((NULL == (ptr)) || (!*(ptr)) || strncmp ((ptr), (cmd), strlen (ptr)))