1
0
mirror of https://github.com/simh/simh.git synced 2026-01-25 19:56:25 +00:00

SCP: Added generic output routine sim_printf to output to stdout and sim_log (and sim_deb when enabled)

The goals here being to simplify calling code while getting consistent output delivered everywhere it may be useful.

Modified most places which explicitly used sim_log or merely called printf to now avoid doing that and merely call sim_printf().
This commit is contained in:
Mark Pizzolato
2014-03-28 08:20:05 -07:00
parent e81de979f6
commit 6ce8d99cd8
46 changed files with 332 additions and 498 deletions

View File

@@ -1499,12 +1499,9 @@ for (i = 0; (dptr = sim_devices[i]) != NULL; i++) { /* add devices */
for (j = 0; j < dibp->num; j++) { /* loop thru disp */
if (dibp->dsp[j]) { /* any dispatch? */
if (dev_tab[dibp->dev + j]) { /* already filled? */
printf ("%s device number conflict at %02o\n",
sim_dname (dptr), dibp->dev + j);
if (sim_log)
fprintf (sim_log, "%s device number conflict at %02o\n",
sim_dname (dptr), dibp->dev + j);
return TRUE;
sim_printf ("%s device number conflict at %02o\n",
sim_dname (dptr), dibp->dev + j);
return TRUE;
}
dev_tab[dibp->dev + j] = dibp->dsp[j]; /* fill */
} /* end if dsp */

View File

@@ -1234,13 +1234,13 @@ if (uptr->filebuf == NULL) { /* can't alloc? */
return SCPE_MEM;
}
fbuf = (uint16 *) uptr->filebuf; /* file buffer */
printf ("%s%d: ", sim_dname (&dt_dev), u);
sim_printf ("%s%d: ", sim_dname (&dt_dev), u);
if (uptr->flags & UNIT_8FMT)
printf ("12b format");
sim_printf ("12b format");
else if (uptr->flags & UNIT_11FMT)
printf ("16b format");
else printf ("18b/36b format");
printf (", buffering file in memory\n");
sim_printf ("16b format");
else sim_printf ("18b/36b format");
sim_printf (", buffering file in memory\n");
uptr->io_flush = dt_flush;
if (uptr->flags & UNIT_8FMT) /* 12b? */
uptr->hwmark = fxread (uptr->filebuf, sizeof (uint16),
@@ -1332,7 +1332,7 @@ if (sim_is_active (uptr)) {
uptr->STATE = uptr->pos = 0;
}
if (uptr->hwmark && ((uptr->flags & UNIT_RO)== 0)) { /* any data? */
printf ("%s%d: writing buffer to file\n", sim_dname (&dt_dev), u);
sim_printf ("%s%d: writing buffer to file\n", sim_dname (&dt_dev), u);
dt_flush (uptr);
} /* end if hwmark */
free (uptr->filebuf); /* release buf */

View File

@@ -196,12 +196,14 @@ int32 sections_read = 0;
for (;;) {
csum = origin = field = newf = 0; /* init */
do { /* skip leader */
if ((hi = sim_bin_getc (fi, &newf)) == EOF)
if ((hi = sim_bin_getc (fi, &newf)) == EOF) {
if (sections_read != 0) {
printf ("%d sections sucessfully read\n\r", sections_read);
sim_printf ("%d sections sucessfully read\n\r", sections_read);
return SCPE_OK;
} else
}
else
return SCPE_FMT;
}
} while ((hi == 0) || (hi >= 0200));
for (;;) { /* data blocks */
if ((lo = sim_bin_getc (fi, &newf)) == EOF) /* low char */
@@ -213,7 +215,7 @@ for (;;) {
if (hi == 0200) { /* end of tape? */
if ((csum - wd) & 07777) { /* valid csum? */
if (sections_read != 0)
printf ("%d sections sucessfully read\n\r", sections_read);
sim_printf ("%d sections sucessfully read\n\r", sections_read);
return SCPE_CSUM;
}
if (!(sim_switches & SWMASK ('A'))) /* Load all sections? */