1
0
mirror of https://github.com/simh/simh.git synced 2026-05-05 07:23:34 +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:
Mark Pizzolato
2016-05-15 15:25:33 -07:00
parent 60a8a2d43d
commit 5531ccb175
444 changed files with 4119 additions and 3798 deletions

View File

@@ -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 */