1
0
mirror of https://github.com/simh/simh.git synced 2026-04-13 23:44:44 +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

@@ -190,17 +190,17 @@ t_stat cpu_svc (UNIT *uptr);
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_type (UNIT *uptr, int32 val, char *cptr, void *desc);
t_stat cpu_set_opt (UNIT *uptr, int32 val, char *cptr, void *desc);
t_stat cpu_clr_opt (UNIT *uptr, int32 val, char *cptr, void *desc);
t_stat cpu_set_rblks (UNIT *uptr, int32 val, char *cptr, void *desc);
t_stat cpu_show_rblks (FILE *st, UNIT *uptr, int32 val, void *desc);
t_stat cpu_set_hist (UNIT *uptr, int32 val, char *cptr, void *desc);
t_stat cpu_show_hist (FILE *st, UNIT *uptr, int32 val, void *desc);
t_stat cpu_set_alarm (UNIT *uptr, int32 val, char *cptr, void *desc);
t_stat cpu_show_alarm (FILE *st, UNIT *uptr, int32 val, void *desc);
t_stat cpu_show_addr (FILE *st, UNIT *uptr, int32 val, void *desc);
t_stat cpu_set_size (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
t_stat cpu_set_type (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
t_stat cpu_set_opt (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
t_stat cpu_clr_opt (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
t_stat cpu_set_rblks (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
t_stat cpu_show_rblks (FILE *st, UNIT *uptr, int32 val, CONST void *desc);
t_stat cpu_set_hist (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
t_stat cpu_show_hist (FILE *st, UNIT *uptr, int32 val, CONST void *desc);
t_stat cpu_set_alarm (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
t_stat cpu_show_alarm (FILE *st, UNIT *uptr, int32 val, CONST void *desc);
t_stat cpu_show_addr (FILE *st, UNIT *uptr, int32 val, CONST void *desc);
void set_rf_display (uint32 *rfbase);
void inst_hist (uint32 ir, uint32 pc, uint32 typ);
uint32 cpu_one_inst (uint32 real_pc, uint32 IR);
@@ -248,12 +248,12 @@ extern uint32 io_tio (uint32 rn, uint32 bva);
extern uint32 io_tdv (uint32 rn, uint32 bva);
extern uint32 io_hio (uint32 rn, uint32 bva);
extern uint32 io_aio (uint32 rn, uint32 bva);
extern uint32 int_reset (DEVICE *dev);
extern t_stat int_reset (DEVICE *dev);
extern void io_set_eimax (uint32 lnt);
extern void io_sclr_req (uint32 inum, uint32 val);
extern void io_sclr_arm (uint32 inum, uint32 val);
extern t_stat io_set_nchan (UNIT *uptr, int32 val, char *cptr, void *desc);
extern t_stat io_show_nchan (FILE *st, UNIT *uptr, int32 val, void *desc);
extern t_stat io_set_nchan (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
extern t_stat io_show_nchan (FILE *st, UNIT *uptr, int32 val, CONST void *desc);
/* CPU data structures
@@ -433,7 +433,7 @@ while (reason == 0) { /* loop until stop */
}
if (sim_interval <= 0) { /* event queue? */
if (reason = sim_process_event ()) /* process */
if ((reason = sim_process_event ())) /* process */
break;
int_hireq = io_eval_int (); /* re-evaluate intr */
}
@@ -2570,7 +2570,7 @@ return SCPE_OK;
/* Set CPU type */
t_stat cpu_set_type (UNIT *uptr, int32 val, char *cptr, void *desc)
t_stat cpu_set_type (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
{
uint32 model = CPUF_GETMOD (val);
@@ -2588,7 +2588,7 @@ return SCPE_OK;
/* Set memory size */
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)
{
uint32 mc = 0;
uint32 i;
@@ -2609,7 +2609,7 @@ return SCPE_OK;
/* Set and clear options */
t_stat cpu_set_opt (UNIT *uptr, int32 val, char *cptr, void *desc)
t_stat cpu_set_opt (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
{
if ((val & (cpu_tab[cpu_model].std | cpu_tab[cpu_model].opt)) == 0)
return SCPE_NOFNC;
@@ -2617,7 +2617,7 @@ cpu_unit.flags |= val;
return SCPE_OK;
}
t_stat cpu_clr_opt (UNIT *uptr, int32 val, char *cptr, void *desc)
t_stat cpu_clr_opt (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
{
if (val & cpu_tab[cpu_model].std)
return SCPE_NOFNC;
@@ -2627,7 +2627,7 @@ return SCPE_OK;
/* Set/show register blocks */
t_stat cpu_set_rblks (UNIT *uptr, int32 val, char *cptr, void *desc)
t_stat cpu_set_rblks (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
{
int32 invmask, lnt, i, j;
t_stat r;
@@ -2651,7 +2651,7 @@ for (i = rf_bmax; i < RF_NBLK; i++) { /* zero unused */
return SCPE_OK;
}
t_stat cpu_show_rblks (FILE *st, UNIT *uptr, int32 val, void *desc)
t_stat cpu_show_rblks (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
{
fprintf (st, "register blocks=%d", rf_bmax);
return SCPE_OK;
@@ -2673,13 +2673,13 @@ return;
/* Front panael alarm */
t_stat cpu_set_alarm (UNIT *uptr, int32 val, char *cptr, void *desc)
t_stat cpu_set_alarm (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
{
cons_alarm_enb = val;
return SCPE_OK;
}
t_stat cpu_show_alarm (FILE *st, UNIT *uptr, int32 val, void *desc)
t_stat cpu_show_alarm (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
{
fputs (cons_alarm_enb? "alarm enabled\n": "alarm disabled\n", st);
return SCPE_OK;
@@ -2696,10 +2696,10 @@ return SCPE_OK;
/* Virtual address translation */
t_stat cpu_show_addr (FILE *of, UNIT *uptr, int32 val, void *desc)
t_stat cpu_show_addr (FILE *of, UNIT *uptr, int32 val, CONST void *desc)
{
t_stat r;
char *cptr = (char *) desc;
const char *cptr = (const char *) desc;
uint32 ad, bpa, dlnt, virt;
static const char *lnt_str[] = {
"byte",
@@ -2752,7 +2752,7 @@ return;
/* Set history */
t_stat cpu_set_hist (UNIT *uptr, int32 val, char *cptr, void *desc)
t_stat cpu_set_hist (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
{
int32 i, lnt;
t_stat r;
@@ -2815,11 +2815,11 @@ return;
/* Show history */
t_stat cpu_show_hist (FILE *st, UNIT *uptr, int32 val, void *desc)
t_stat cpu_show_hist (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
{
int32 k, di, lnt;
t_stat r;
char *cptr = (char *) desc;
const char *cptr = (const char *) desc;
InstHistory *h;
if (hst_lnt == 0) /* enabled? */