SCP: Migrate all stdio writes to pass through SCP provided Fprintf()

This commit is contained in:
Mark Pizzolato 2017-01-14 20:48:09 -08:00
parent 861d9c8d9c
commit d8dbc7e6b5
31 changed files with 6 additions and 146 deletions

View file

@ -180,11 +180,6 @@ return (SCPE_OK);
status = error code
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_sym (FILE *of, t_addr addr, t_value *val,
UNIT *uptr, int32 sw)
{

View file

@ -489,11 +489,6 @@ static int32 DAsm(char *S, const uint32 *val, const int32 useZ80Mnemonics, const
status = error code
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_sym(FILE *of, t_addr addr, t_value *val, UNIT *uptr, int32 sw) {
char disasm_result[128];
int32 ch = val[0] & 0x7f;

View file

@ -418,10 +418,6 @@ t_stat parse_instruction_word (CONST char *cptr, t_value *val)
/*
* Печать машинной инструкции с мнемоникой.
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
void besm6_fprint_cmd (FILE *of, uint32 cmd)
{
int reg, opcode, addr;

View file

@ -289,11 +289,6 @@ static const struct fnc_op fop[] = {
/* Print opcode field for FO, SF */
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
void fprint_op (FILE *of, uint32 inst, uint32 op)
{
int32 i, nfirst;

View file

@ -227,11 +227,6 @@ static const int32 opc_val[] = {
status = space needed
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
void fprint_opr (FILE *of, int32 inst, int32 Class)
{
int32 i, j, sp;

View file

@ -1,6 +1,7 @@
/* hp2100_sys.c: HP 2100 simulator interface
Copyright (c) 1993-2016, Robert M. Supnik
Copyright (c) 2017 J. David Bryan
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@ -23,6 +24,7 @@
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Robert M Supnik.
14-Jan-17 JDB Removed use of Fprintf functions for version 4.x and on
30-Dec-16 JDB Corrected parsing of memory reference instructions
13-May-16 JDB Modified for revised SCP API function parameter types
19-Jun-15 JDB Conditionally use Fprintf function for version 4.x and on
@ -71,13 +73,6 @@
#include "hp2100_cpu.h"
#if (SIM_MAJOR >= 4)
#define fprintf Fprintf
#define fputs(_s,_f) Fprintf (_f, "%s", _s)
#define fputc(_c,_f) Fprintf (_f, "%c", _c)
#endif
extern DEVICE mp_dev;
extern DEVICE dma1_dev, dma2_dev;
extern DEVICE ptr_dev, ptp_dev;

View file

@ -180,11 +180,6 @@ const char *opcode[64] = {
/* Print an address from three characters */
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
void fprint_addr (FILE *of, t_value *dig)
{
int32 addr, xa;

View file

@ -278,11 +278,6 @@ struct opc opcode[] = {
/* Print an address from five characters */
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
void fprint_addr (FILE *of, int32 spc, t_value *dig, t_bool flg)
{
int32 i, idx;

View file

@ -590,11 +590,6 @@ static const t_uint64 opc_v[] = {
return = status code
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_sym (FILE *of, t_addr addr, t_value *val,
UNIT *uptr, int32 sw)
{

View file

@ -289,11 +289,6 @@ static int ebcdic_to_ascii (int ch)
return '?';
}
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_sym (FILE *of, t_addr addr, t_value *val, UNIT *uptr, int32 sw)
{
int32 ch, OP, F, TAG, INDIR, DSPLC, IR, eaddr;

View file

@ -278,11 +278,6 @@ static const uint32 opc_val[] = {
if < 0, number of extra bytes retired
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_sym (FILE *of, t_addr addr, t_value *val,
UNIT *uptr, int32 sw)
{

View file

@ -300,11 +300,6 @@ static const uint32 opc_val[] = {
/* Print an RX specifier */
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_addr (FILE *of, t_addr addr, uint32 rx, uint32 ea1,
uint32 ea2)
{

View file

@ -221,11 +221,6 @@ static const char opcode[] = "ZBYRIDNMPEUTHCAS";
static const char hex_decode[] = "0123456789FGJKQW";
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
void lgp_sprint_addr (char *buf, DEVICE *dptr, t_addr addr)
{
if ((dptr == sim_devices[0]) &&

View file

@ -637,11 +637,6 @@ static const int32 dev_val[] = {
Outputs:
return = error code
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_addr (FILE *of, t_addr addr, int32 ind, int32 mode,
int32 disp, t_bool ext, int32 cflag)
{

View file

@ -414,11 +414,6 @@ static const int32 opc_val[] = {
status = space needed?
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
int32 fprint_opr (FILE *of, int32 inst, int32 Class, int32 sp)
{
int32 i, j;

View file

@ -698,10 +698,6 @@ static const char *devnam[NUMDEV] = {
#define FMTASC(x) ((x) < 040)? "<%03o>": "%c", (x)
#define SIXTOASC(x) ((x) + 040)
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_sym (FILE *of, t_addr addr, t_value *val,
UNIT *uptr, int32 sw)

View file

@ -497,11 +497,6 @@ static const char r50_to_asc[] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ$._0123456789";
count = -number of extra words retired
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
int32 fprint_spec (FILE *of, t_addr addr, int32 spec, t_value nval,
int32 flag, int32 iflag)
{

View file

@ -905,11 +905,6 @@ static const int32 opc_val[] = {
status = space needed?
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
int32 fprint_opr (FILE *of, int32 inst, int32 clss, int32 sp)
{
int32 i, j;

View file

@ -525,11 +525,6 @@ static const int32 fop_val[] = {
status = space needed
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
int32 fprint_opr (FILE *of, int32 inst, int32 Class, int32 sp)
{
int32 i, j;

View file

@ -137,10 +137,6 @@ t_stat sim_load (FILE *fi, CONST char *cptr, CONST char *fnam, int flag)
* The t_addr type must be 32 bit, the upper half contains the segment, the lower
* half contains the offset. If the upper half is NIL, it is a word address
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
void pdq3_sprint_addr (char *buf, DEVICE *dptr, t_addr addr)
{
*buf = '\0';

View file

@ -252,11 +252,6 @@ return (SCPE_OK);
status = error code
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_sym (FILE *of, t_addr addr, t_value *val,
UNIT *uptr, int32 sw)
{

View file

@ -301,11 +301,6 @@ const char *sim_stop_messages[] = {
#define DATA_B(x) (x&0xff)
#define DATA_W(x) (x&0xffff)
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
static t_stat _fsymea(FILE* of,t_addr addr,int ea, int oplen,t_value* rest)
{
int eamod = EAMOD_FIELD(ea);

View file

@ -475,8 +475,6 @@ static const char *chname[] = {
inst = mask bits
*/
#define fprintf Fprintf /* Use scp.c provided fprintf function */
void fprint_reg (FILE *of, int32 inst)
{
int32 i, j, sp;

View file

@ -117,11 +117,6 @@ if (flag == 1) return ssem_dump(fi);
return ssem_load_dmp(fi);
}
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
/* Utility routine - prints number in decimal */
t_stat ssem_fprint_decimal (FILE *of, uint32 inst)

View file

@ -98,11 +98,6 @@ const OPMAP opmap_orig [] = {
{ 0000000, NULL, NULL }
};
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_sym_orig (FILE *of, t_addr addr, t_value *val,
UNIT *uptr, int32 sw)
{

View file

@ -730,11 +730,6 @@ const char* regname[] = {
if < 0, number of extra bytes retired
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_sym (FILE *of, t_addr exta, t_value *val,
UNIT *uptr, int32 sw)
{

View file

@ -201,11 +201,6 @@ static const char r50_to_asc[] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ$._0123456789";
count = -number of extra words retired
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
int32 fprint_spec (FILE *of, t_addr addr, int32 spec, int32 nval)
{
int32 reg, mode;

View file

@ -494,11 +494,6 @@ const uint32 opval[] = {
if < 0, number of extra bytes retired
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_sym (FILE *of, t_addr addr, t_value *val,
UNIT *uptr, int32 sw)
{

4
scp.h
View file

@ -166,6 +166,10 @@ char *sim_encode_quoted_string (const uint8 *iptr, uint32 size);
void fprint_buffer_string (FILE *st, const uint8 *buf, uint32 size);
t_value strtotv (CONST char *cptr, CONST char **endptr, uint32 radix);
int Fprintf (FILE *f, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,_f) Fprintf(_f,"%s",_s)
#define fputc(_c,_f) Fprintf(_f,"%c",_c)
t_stat sim_set_memory_load_file (const unsigned char *data, size_t size);
int Fgetc (FILE *f);
t_stat fprint_val (FILE *stream, t_value val, uint32 rdx, uint32 wid, uint32 fmt);

View file

@ -337,11 +337,6 @@ static const char *opcode[] = {
return = status code
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_sym (FILE *of, t_addr addr, t_value *val,
UNIT *uptr, int32 sw)
{

View file

@ -1952,11 +1952,6 @@ t_stat sim_load (FILE *fileref, CONST char *cptr, CONST char *fnam, int flag)
status = error code
for M6800
*/
/* Use scp.c provided fprintf function */
#define fprintf Fprintf
#define fputs(_s,f) Fprintf(f,"%s",_s)
#define fputc(_c,f) Fprintf(f,"%c",_c)
t_stat fprint_sym (FILE *of, t_addr addr, t_value *val, UNIT *uptr, int32 sw)
{
int32 i, inst, inst1;