General cleanup migrate to using sim_printf vs separate calls to printf and fprintf(sim_log).
This commit is contained in:
parent
593a5950d1
commit
3256c10c77
12 changed files with 34 additions and 89 deletions
|
@ -1652,21 +1652,15 @@ return SCPE_OK;
|
|||
t_bool set_chanmap (DEVICE *dptr, DIB *dibp, uint32 dno, uint32 chan)
|
||||
{
|
||||
if ((chan < DMC_V_DMC1) && (chan >= dma_nch)) {
|
||||
printf ("%s configured for DMA channel %d\n", sim_dname (dptr), chan + 1);
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "%s configured for DMA channel %d\n", sim_dname (dptr), chan + 1);
|
||||
sim_printf ("%s configured for DMA channel %d\n", sim_dname (dptr), chan + 1);
|
||||
return TRUE;
|
||||
}
|
||||
if ((chan >= DMC_V_DMC1) && !(cpu_unit.flags & UNIT_DMC)) {
|
||||
printf ("%s configured for DMC, option disabled\n", sim_dname (dptr));
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "%s configured for DMC, option disabled\n", sim_dname (dptr));
|
||||
sim_printf ("%s configured for DMC, option disabled\n", sim_dname (dptr));
|
||||
return TRUE;
|
||||
}
|
||||
if (chan_map[chan]) { /* channel conflict? */
|
||||
printf ("%s DMA/DMC channel conflict, devno = %02o\n", sim_dname (dptr), dno);
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "%s DMA/DMC channel conflict, devno = %02o\n", sim_dname (dptr), dno);
|
||||
sim_printf ("%s DMA/DMC channel conflict, devno = %02o\n", sim_dname (dptr), dno);
|
||||
return TRUE;
|
||||
}
|
||||
chan_map[chan] = dno; /* channel back map */
|
||||
|
@ -1690,10 +1684,7 @@ for (i = 0; (dptr = sim_devices[i]); i++) { /* loop thru devices */
|
|||
dno = dibp->dev; /* device number */
|
||||
for (j = 0; j < dibp->num; j++) { /* repeat for slots */
|
||||
if (iotab[dno + j]) { /* conflict? */
|
||||
printf ("%s device number conflict, devno = %02o\n",
|
||||
sim_dname (dptr), dno + j);
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "%s device number conflict, devno = %02o\n",
|
||||
sim_printf ("%s device number conflict, devno = %02o\n",
|
||||
sim_dname (dptr), dno + j);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1706,9 +1697,7 @@ for (i = 0; (dptr = sim_devices[i]); i++) { /* loop thru devices */
|
|||
if (set_chanmap(dptr, dibp, dno, dibp->chan2-1)) return TRUE;
|
||||
// [RLA] If the device uses extended interrupts, check that they're enabled.
|
||||
if ((dibp->inum != INT_V_NONE) && (dibp->inum >= INT_V_EXTD) && (ext_ints == 0)) {
|
||||
printf ("%s uses extended interrupts but that option is disabled\n", sim_dname (dptr));
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "%s uses extended interrupts but that option is disabled\n", sim_dname (dptr));
|
||||
sim_printf ("%s uses extended interrupts but that option is disabled\n", sim_dname (dptr));
|
||||
return TRUE;
|
||||
}
|
||||
} /* end for */
|
||||
|
|
|
@ -2108,9 +2108,7 @@ return SCPE_OK;
|
|||
t_stat cpu_set_opt1 (UNIT *uptr, int32 val, char *cptr, void *desc)
|
||||
{
|
||||
if (cpu_unit.flags & IF_MII) {
|
||||
printf ("Feature is standard on 1620 Model 2\n");
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "Feature is standard on 1620 Model 2\n");
|
||||
sim_printf ("Feature is standard on 1620 Model 2\n");
|
||||
return SCPE_NOFNC;
|
||||
}
|
||||
return SCPE_OK;
|
||||
|
@ -2121,9 +2119,7 @@ return SCPE_OK;
|
|||
t_stat cpu_set_opt2 (UNIT *uptr, int32 val, char *cptr, void *desc)
|
||||
{
|
||||
if (!(cpu_unit.flags & IF_MII)) {
|
||||
printf ("Feature is not available on 1620 Model 1\n");
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "Feature is not available on 1620 Model 1\n");
|
||||
sim_printf ("Feature is not available on 1620 Model 1\n");
|
||||
return SCPE_NOFNC;
|
||||
}
|
||||
return SCPE_OK;
|
||||
|
|
|
@ -112,7 +112,7 @@ extern UNIT prt_unit;
|
|||
void stuff_cmd (char *cmd) {}
|
||||
t_bool stuff_and_wait (char *cmd, int timeout, int delay) {return FALSE;}
|
||||
char *read_cmdline (char *ptr, int size, FILE *stream) {return read_line(ptr, size, stream);}
|
||||
void remark_cmd (char *remark) {printf("%s\n", remark); if (sim_log) fprintf(sim_log, "%s\n", remark);}
|
||||
void remark_cmd (char *remark) sim_printf("%s\n", remark)
|
||||
#else
|
||||
|
||||
t_stat console_reset (DEVICE *dptr)
|
||||
|
@ -1563,8 +1563,7 @@ char *read_cmdline (char *ptr, int size, FILE *stream)
|
|||
;
|
||||
|
||||
if (scp_stuffed) { /* stuffed command needs to be echoed */
|
||||
printf("%s\n", cptr);
|
||||
if (sim_log) fprintf(sim_log, "%s\n", cptr);
|
||||
sim_printf("%s\n", cptr);
|
||||
}
|
||||
|
||||
return cptr;
|
||||
|
@ -1641,13 +1640,10 @@ void remark_cmd (char *remark)
|
|||
if (sim_log) putc('\n', sim_log);
|
||||
}
|
||||
|
||||
printf("%s\n", remark);
|
||||
if (sim_log) fprintf(sim_log, "%s\n", remark);
|
||||
sim_printf("%s\n", remark);
|
||||
|
||||
if (scp_reading) {
|
||||
printf("%s", sim_prompt);
|
||||
if (sim_log) fprintf(sim_log, "%s", sim_prompt);
|
||||
}
|
||||
if (scp_reading)
|
||||
sim_printf("%s", sim_prompt);
|
||||
}
|
||||
|
||||
#endif /* _WIN32 defined */
|
||||
|
|
|
@ -359,10 +359,7 @@ if (newmax < sch_max) { /* reducing? */
|
|||
for (i = 0; (dptr = sim_devices[i]); i++) { /* loop thru dev */
|
||||
dibp = (DIB *) dptr->ctxt; /* get DIB */
|
||||
if (dibp && (dibp->sch >= (int32) newmax)) { /* dev using chan? */
|
||||
printf ("Device %02X uses channel %d\n",
|
||||
dibp->dno, dibp->sch);
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "Device %02X uses channel %d\n",
|
||||
sim_printf ("Device %02X uses channel %d\n",
|
||||
dibp->dno, dibp->sch);
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
@ -643,9 +640,7 @@ for (i = 0; (dptr = sim_devices[i]); i++) { /* loop thru devices *
|
|||
dmsk = 1u << (t & 0x1F); /* bit to test */
|
||||
doff = t / 32; /* word to test */
|
||||
if (dmap[doff] & dmsk) { /* in use? */
|
||||
printf ("Device number conflict, devno = %02X\n", t);
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "Device number conflict, devno = %02X\n", t);
|
||||
sim_printf ("Device number conflict, devno = %02X\n", t);
|
||||
return TRUE;
|
||||
}
|
||||
dmap[doff] = dmap[doff] | dmsk;
|
||||
|
|
|
@ -489,13 +489,11 @@ t_stat qty_attach( UNIT * unitp, char * cptr )
|
|||
if ( sim_switches & SWMASK('M') ) /* modem control? */
|
||||
{
|
||||
qty_mdm = 1;
|
||||
printf( "Modem control activated\n" ) ;
|
||||
if ( sim_log ) fprintf( sim_log, "Modem control activated\n" ) ;
|
||||
sim_printf( "Modem control activated\n" ) ;
|
||||
if ( sim_switches & SWMASK ('A') ) /* autodisconnect? */
|
||||
{
|
||||
qty_auto = 1 ;
|
||||
printf( "Auto disconnect activated\n" ) ;
|
||||
if ( sim_log ) fprintf( sim_log, "Auto disconnect activated\n" ) ;
|
||||
sim_printf( "Auto disconnect activated\n" ) ;
|
||||
}
|
||||
}
|
||||
qty_polls = 0 ;
|
||||
|
|
|
@ -2384,9 +2384,7 @@ int32 xr, ac;
|
|||
|
||||
if (!caveats_displayed) {
|
||||
caveats_displayed = TRUE;
|
||||
printf ("%s", cpu_next_caveats);
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "%s", cpu_next_caveats);
|
||||
sim_printf ("%s", cpu_next_caveats);
|
||||
}
|
||||
if (SCPE_OK != get_aval ((saved_PC & AMASK), &cpu_dev, &cpu_unit)) /* get data */
|
||||
return FALSE;
|
||||
|
|
|
@ -3044,9 +3044,7 @@ static t_bool caveats_displayed = FALSE;
|
|||
|
||||
if (!caveats_displayed) {
|
||||
caveats_displayed = TRUE;
|
||||
printf ("%s", cpu_next_caveats);
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "%s", cpu_next_caveats);
|
||||
sim_printf ("%s", cpu_next_caveats);
|
||||
}
|
||||
if (SCPE_OK != get_aval (PC, &cpu_dev, &cpu_unit)) /* get data */
|
||||
return FALSE;
|
||||
|
|
|
@ -2588,25 +2588,19 @@ BUFFER *dmc_buffer_allocate(CTLR *controller)
|
|||
BUFFER *buffer = (BUFFER *)remqueue (controller->free_queue->hdr.next);
|
||||
|
||||
if (!buffer) {
|
||||
fprintf (stdout, "DDCMP Buffer allocation failure.\n");
|
||||
fprintf (stdout, "This is a fatal error which should never happen.\n");
|
||||
fprintf (stdout, "Please submit this output when you report this bug.\n");
|
||||
sim_printf ("DDCMP Buffer allocation failure.\n");
|
||||
sim_printf ("This is a fatal error which should never happen.\n");
|
||||
sim_printf ("Please submit this output when you report this bug.\n");
|
||||
dmc_showqueues (stdout, controller->unit, 0, NULL);
|
||||
dmc_showstats (stdout, controller->unit, 0, NULL);
|
||||
dmc_showddcmp (stdout, controller->unit, 0, NULL);
|
||||
if (sim_log) {
|
||||
fprintf (sim_log, "DDCMP Buffer allocation failure.\n");
|
||||
fprintf (sim_log, "This is a fatal error which should never happen.\n");
|
||||
fprintf (sim_log, "Please submit this output when you report this bug.\n");
|
||||
dmc_showqueues (sim_log, controller->unit, 0, NULL);
|
||||
dmc_showstats (sim_log, controller->unit, 0, NULL);
|
||||
dmc_showddcmp (sim_log, controller->unit, 0, NULL);
|
||||
fflush (sim_log);
|
||||
}
|
||||
if (sim_deb) {
|
||||
fprintf (sim_deb, "DDCMP Buffer allocation failure.\n");
|
||||
fprintf (sim_deb, "This is a fatal error which should never happen.\n");
|
||||
fprintf (sim_deb, "Please submit this output when you report this bug.\n");
|
||||
dmc_showqueues (sim_deb, controller->unit, 0, NULL);
|
||||
dmc_showstats (sim_deb, controller->unit, 0, NULL);
|
||||
dmc_showddcmp (sim_deb, controller->unit, 0, NULL);
|
||||
|
|
|
@ -3245,9 +3245,7 @@ int i;
|
|||
|
||||
if (!caveats_displayed) {
|
||||
caveats_displayed = TRUE;
|
||||
printf ("%s", cpu_next_caveats);
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "%s", cpu_next_caveats);
|
||||
sim_printf ("%s", cpu_next_caveats);
|
||||
}
|
||||
if (SCPE_OK != get_aval (PC, &cpu_dev, &cpu_unit)) /* get data */
|
||||
return FALSE;
|
||||
|
|
|
@ -866,14 +866,11 @@ if (!vid_active) {
|
|||
vid_close ();
|
||||
return SCPE_MEM;
|
||||
}
|
||||
printf ("QVSS Display Created. ");
|
||||
sim_printf ("QVSS Display Created. ");
|
||||
vid_show_release_key (stdout, NULL, 0, NULL);
|
||||
printf ("\n");
|
||||
if (sim_log) {
|
||||
fprintf (sim_log, "QVSS Display Created. ");
|
||||
if (sim_log)
|
||||
vid_show_release_key (sim_log, NULL, 0, NULL);
|
||||
fprintf (sim_log, "\n");
|
||||
}
|
||||
sim_printf ("\n");
|
||||
}
|
||||
sim_activate_abs (&vc_unit, tmxr_poll);
|
||||
return auto_config (NULL, 0); /* run autoconfig */
|
||||
|
|
15
scp.c
15
scp.c
|
@ -5605,14 +5605,11 @@ for ( ;; ) { /* device loop */
|
|||
return SCPE_INCOMP;
|
||||
}
|
||||
uptr->capac = high; /* new memory size */
|
||||
printf ("Memory size changed: %s%d = ", sim_dname (dptr), unitno);
|
||||
sim_printf ("Memory size changed: %s%d = ", sim_dname (dptr), unitno);
|
||||
fprint_capac (stdout, dptr, uptr);
|
||||
printf ("\n");
|
||||
if (sim_log) {
|
||||
fprintf (sim_log, "Memory size changed: %s%d = ", sim_dname (dptr), unitno);
|
||||
if (sim_log)
|
||||
fprint_capac (sim_log, dptr, uptr);
|
||||
fprintf (sim_log, "\n");
|
||||
}
|
||||
sim_printf ("\n");
|
||||
}
|
||||
sz = SZ_D (dptr); /* allocate buffer */
|
||||
if ((mbuf = calloc (SRBSIZ, sz)) == NULL)
|
||||
|
@ -6648,16 +6645,14 @@ if ((r = parse_sym (cptr, 0, dptr->units, sim_eval, sim_switches)) > 0) {
|
|||
}
|
||||
lim = 1 - r;
|
||||
for (i = a = 0; a < lim; ) {
|
||||
printf ("%d:\t", a);
|
||||
sim_printf ("%d:\t", a);
|
||||
if ((r = fprint_sym (stdout, a, &sim_eval[i], dptr->units, sim_switches)) > 0)
|
||||
r = fprint_val (stdout, sim_eval[i], rdx, dptr->dwidth, PV_RZRO);
|
||||
printf ("\n");
|
||||
if (sim_log) {
|
||||
fprintf (sim_log, "%d\t", i);
|
||||
if ((r = fprint_sym (sim_log, a, &sim_eval[i], dptr->units, sim_switches)) > 0)
|
||||
r = fprint_val (sim_log, sim_eval[i], rdx, dptr->dwidth, PV_RZRO);
|
||||
fprintf (sim_log, "\n");
|
||||
}
|
||||
sim_printf ("\n");
|
||||
if (r < 0)
|
||||
a = a + 1 - r;
|
||||
else a = a + dptr->aincr;
|
||||
|
|
|
@ -1290,26 +1290,17 @@ for (i = 0; (dptr = sim_devices[i]) != NULL; i++) {
|
|||
if ((ch >= chan_num) ||
|
||||
(dev >= CHAN_N_DEV) ||
|
||||
(dio >= DIO_N_MOD)) {
|
||||
printf ("%s: invalid device address, chan = %d, dev = %X, dio = %X\n",
|
||||
sim_dname (dptr), ch, DVA_GETDEV (dibp->dva), dio);
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "%s: invalid device address, chan = %d, dev = %X, dio = %X\n",
|
||||
sim_printf ("%s: invalid device address, chan = %d, dev = %X, dio = %X\n",
|
||||
sim_dname (dptr), ch, DVA_GETDEV (dibp->dva), dio);
|
||||
return SCPE_STOP;
|
||||
}
|
||||
if ((dibp->disp != NULL) && (chan[ch].disp[dev] != NULL)) {
|
||||
printf ("%s: device address conflict, chan = %d, dev = %X\n",
|
||||
sim_dname (dptr), ch, DVA_GETDEV (dibp->dva));
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "%s: device address conflict, chan = %d, dev = %X\n",
|
||||
sim_printf ("%s: device address conflict, chan = %d, dev = %X\n",
|
||||
sim_dname (dptr), ch, DVA_GETDEV (dibp->dva));
|
||||
return SCPE_STOP;
|
||||
}
|
||||
if ((dibp->dio_disp != NULL) && (dio_disp[dio] != NULL)) {
|
||||
printf ("%s: direct I/O address conflict, dio = %X\n",
|
||||
sim_dname (dptr), dio);
|
||||
if (sim_log)
|
||||
fprintf (sim_log, "%s: direct I/O address conflict, dio = %X\n",
|
||||
sim_printf ("%s: direct I/O address conflict, dio = %X\n",
|
||||
sim_dname (dptr), dio);
|
||||
return SCPE_STOP;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue