mirror of
https://github.com/simh/simh.git
synced 2026-01-25 19:56:25 +00:00
ALL: Massive 'const' cleanup
These changes facilitate more robust parameter type checking and helps to identify unexpected coding errors. Most simulators can now also be compiled with a C++ compiler without warnings. Additionally, these changes have also been configured to facilitate easier backporting of simulator and device simulation modules to run under the simh v3.9+ SCP framework.
This commit is contained in:
@@ -190,7 +190,7 @@ REG *scq_r = NULL; /* PC queue reg ptr */
|
||||
t_stat cpu_ex (t_value *vptr, t_addr addr, UNIT *uptr, int32 sw);
|
||||
t_stat cpu_dep (t_value val, t_addr addr, UNIT *uptr, int32 sw);
|
||||
t_stat cpu_reset (DEVICE *dptr);
|
||||
t_stat cpu_set_size (UNIT *uptr, int32 val, char *cptr, void *desc);
|
||||
t_stat cpu_set_size (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
|
||||
t_stat bus_op (uint32 src, uint32 op, uint32 dst);
|
||||
|
||||
/* Dispatch tables for source, dest, function out, skip on function */
|
||||
@@ -1087,7 +1087,7 @@ M[addr] = val & DMASK;
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
t_stat cpu_set_size (UNIT *uptr, int32 val, char *cptr, void *desc)
|
||||
t_stat cpu_set_size (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
||||
{
|
||||
int32 mc = 0;
|
||||
uint32 i;
|
||||
|
||||
@@ -53,7 +53,7 @@ t_stat tti_svc (UNIT *uhsr);
|
||||
t_stat tto_svc (UNIT *uhsr);
|
||||
t_stat tti_reset (DEVICE *dhsr);
|
||||
t_stat tto_reset (DEVICE *dhsr);
|
||||
t_stat tty_set_mode (UNIT *uptr, int32 val, char *cptr, void *desc);
|
||||
t_stat tty_set_mode (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
|
||||
t_stat hsr_svc (UNIT *uhsr);
|
||||
t_stat hsp_svc (UNIT *uhsr);
|
||||
t_stat hsr_reset (DEVICE *dhsr);
|
||||
@@ -295,7 +295,7 @@ sim_cancel (&tto_unit); /* deactivate unit */
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
t_stat tty_set_mode (UNIT *uptr, int32 val, char *cptr, void *desc)
|
||||
t_stat tty_set_mode (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
||||
{
|
||||
tti_unit.flags = (tti_unit.flags & ~TT_MODE) | val;
|
||||
tto_unit.flags = (tto_unit.flags & ~TT_MODE) | val;
|
||||
|
||||
@@ -82,7 +82,7 @@ const char *sim_stop_messages[] = {
|
||||
continue and load all blocks until end of tape.
|
||||
*/
|
||||
|
||||
t_stat sim_load (FILE *fileref, char *cptr, char *fnam, int flag)
|
||||
t_stat sim_load (FILE *fileref, CONST char *cptr, CONST char *fnam, int flag)
|
||||
{
|
||||
int32 c;
|
||||
uint32 org;
|
||||
@@ -472,7 +472,7 @@ return SCPE_ARG;
|
||||
get_op get optional bus operator
|
||||
*/
|
||||
|
||||
char *get_fnc (char *cptr, t_value *val)
|
||||
CONST char *get_fnc (CONST char *cptr, t_value *val)
|
||||
{
|
||||
char gbuf[CBUFSIZE];
|
||||
int32 i;
|
||||
@@ -509,7 +509,7 @@ val[0] = val[0] | (fncv << I_V_OP); /* store fnc */
|
||||
return cptr;
|
||||
}
|
||||
|
||||
char *get_ma (char *cptr, t_value *val, char term)
|
||||
CONST char *get_ma (CONST char *cptr, t_value *val, char term)
|
||||
{
|
||||
char gbuf[CBUFSIZE];
|
||||
t_value d;
|
||||
@@ -525,7 +525,7 @@ val[1] = d; /* second wd */
|
||||
return cptr;
|
||||
}
|
||||
|
||||
char *get_sd (char *cptr, t_value *val, char term, t_bool src)
|
||||
CONST char *get_sd (CONST char *cptr, t_value *val, char term, t_bool src)
|
||||
{
|
||||
char gbuf[CBUFSIZE];
|
||||
int32 d;
|
||||
@@ -546,9 +546,10 @@ val[0] = val[0] | (d << (src? I_V_SRC: I_V_DST)); /* or to inst */
|
||||
return cptr;
|
||||
}
|
||||
|
||||
char *get_op (char *cptr, t_value *val, char term)
|
||||
CONST char *get_op (CONST char *cptr, t_value *val, char term)
|
||||
{
|
||||
char gbuf[CBUFSIZE], *tptr;
|
||||
char gbuf[CBUFSIZE];
|
||||
CONST char *tptr;
|
||||
int32 i;
|
||||
|
||||
tptr = get_glyph (cptr, gbuf, term); /* get glyph */
|
||||
@@ -573,10 +574,10 @@ return cptr; /* original ptr */
|
||||
status = error status
|
||||
*/
|
||||
|
||||
t_stat parse_sym (char *cptr, t_addr addr, UNIT *uptr, t_value *val, int32 sw)
|
||||
t_stat parse_sym (CONST char *cptr, t_addr addr, UNIT *uptr, t_value *val, int32 sw)
|
||||
{
|
||||
int32 i, j, k;
|
||||
char *tptr, gbuf[CBUFSIZE];
|
||||
char gbuf[CBUFSIZE];
|
||||
|
||||
while (isspace (*cptr)) cptr++; /* absorb spaces */
|
||||
if ((sw & SWMASK ('A')) || ((*cptr == '\'') && cptr++)) { /* ASCII char? */
|
||||
@@ -604,14 +605,11 @@ j = (opc_val[i] >> F_V_FL) & F_M_FL; /* get class */
|
||||
switch (j) { /* case on class */
|
||||
|
||||
case F_V_FO: /* func out */
|
||||
tptr = strchr (cptr, ','); /* find dst */
|
||||
if (!tptr) /* none? */
|
||||
cptr = get_glyph (cptr, gbuf, ','); /* fo # */
|
||||
if ((!cptr) || (!*cptr)) /* none? */
|
||||
return SCPE_ARG;
|
||||
*tptr = 0; /* split fields */
|
||||
cptr = get_fnc (cptr, val); /* fo # */
|
||||
if (!cptr)
|
||||
return SCPE_ARG;
|
||||
cptr = get_sd (tptr + 1, val, 0, FALSE); /* dst */
|
||||
get_fnc (gbuf, val); /* fo # */
|
||||
cptr = get_sd (cptr, val, 0, FALSE); /* dst */
|
||||
break;
|
||||
|
||||
case F_V_FOI: /* func out impl */
|
||||
|
||||
Reference in New Issue
Block a user