setprefix now uses a variable length name as a string for an argument

This commit is contained in:
Todd T.Fries 2001-06-19 21:36:09 +00:00
parent 4da5d2fb1a
commit 12985edb26
35 changed files with 59 additions and 43 deletions

@ -9,7 +9,7 @@ bx_generic_apic_c *apic_index[APIC_MAX_ID];
bx_generic_apic_c::bx_generic_apic_c ()
{
id = APIC_UNKNOWN_ID;
setprefix("[APIC?]");
setprefix("APIC?");
settype(APICLOG);
hwreset ();
}
@ -271,10 +271,10 @@ void bx_local_apic_c::set_id (Bit8u newid) {
sprintf (cpu->name, "CPU apicid=%02x", (Bit32u)id);
if (id >= 0 && id <= 15) {
char buffer[16];
sprintf (buffer, "[APIC%x]", id);
sprintf (buffer, "APIC%x", id);
setprefix(buffer);
settype(CPU0LOG + id);
sprintf (buffer, "[CPU%x]", id);
sprintf (buffer, "CPU%x", id);
cpu->setprefix (buffer);
} else {
BX_INFO (("naming convention for apics requires id=0-15 only"));

@ -40,7 +40,7 @@ BX_CPU_C::BX_CPU_C()
// in case of SMF, you cannot reference any member data
// in the constructor because the only access to it is via
// global variables which aren't initialized quite yet.
setprefix("[CPU ]");
setprefix("CPU");
settype (CPU0LOG);
}

@ -35,7 +35,7 @@ bx_disassemble_c bx_disassemble;
bx_disassemble_c::bx_disassemble_c(void)
{
setprefix("[DIS ]");
setprefix("DIS");
settype(DISLOG);
sreg_mod01_rm32[0] = "DS";

@ -198,7 +198,7 @@ bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv,
UNUSED(argc);
UNUSED(argv);
UNUSED(window_name);
th->setprefix("[BGUI]");
th->setprefix("BGUI");
if (bx_options.private_colormap) {
BX_INFO(( "BeOS: private_colormap option not handled yet."));

@ -43,7 +43,7 @@ bx_gui_c bx_gui;
bx_gui_c::bx_gui_c(void)
{
setprefix("[GUI ]"); // Init in specific_init
setprefix("GUI"); // Init in specific_init
settype(GUILOG);
}

@ -324,7 +324,7 @@ void CreateWindows(void)
void bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth, unsigned tileheight,
unsigned headerbar_y)
{
th->setprefix("[MGUI]");
th->setprefix("MGUI");
InitToolbox();
//SouixWin = FrontWindow();

@ -59,7 +59,7 @@
bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth, unsigned tileheight,
unsigned headerbar_y)
{
th->setprefix("[NGUI]");
th->setprefix("NGUI");
UNUSED(th);
UNUSED(argc);
UNUSED(argv);

@ -1,6 +1,6 @@
/*
* gui/siminterface.cc
* $Id: siminterface.cc,v 1.22 2001-06-19 14:20:24 bdenney Exp $
* $Id: siminterface.cc,v 1.23 2001-06-19 21:36:09 fries Exp $
*
* Defines the actual link between bx_simulator_interface_c methods
* and the simulator. This file includes bochs.h because it needs
@ -108,7 +108,7 @@ bx_real_sim_c::get_param_string (bx_id id) {
void init_siminterface ()
{
siminterface_log = new logfunctions ();
siminterface_log->setprefix ("[CTRL]");
siminterface_log->setprefix ("CTRL");
siminterface_log->settype(CTRLLOG);
if (SIM == NULL)
SIM = new bx_real_sim_c();

@ -116,7 +116,7 @@ bx_gui_c::sighandler(int signo)
bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth, unsigned tileheight,
unsigned headerbar_y)
{
th->setprefix("[TGUI]");
th->setprefix("TGUI");
UNUSED(th);
UNUSED(argc);
UNUSED(argv);

@ -262,7 +262,7 @@ void terminateEmul(int reason) {
void bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned
tilewidth, unsigned tileheight,
unsigned headerbar_y) {
th->setprefix("[WGUI]");
th->setprefix("WGUI");
static RGBQUAD black_quad={ 0, 0, 0, 0};
stInfo.kill = 0;
stInfo.UIinited = FALSE;

@ -279,7 +279,7 @@ bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth,
unsigned long plane_masks_return[1];
XColor color;
th->setprefix("[XGUI]");
th->setprefix("XGUI");
UNUSED(th);
if (bx_options.private_colormap) {

@ -81,7 +81,7 @@ HANDLE hFile = NULL;
cdrom_interface::cdrom_interface(char *dev)
{
setprefix("[CD ]");
setprefix("CD");
settype(CDLOG);
fd = -1; // File descriptor not yet allocated

@ -44,7 +44,7 @@ bx_cmos_c bx_cmos;
bx_cmos_c::bx_cmos_c(void)
{
setprefix("[CMOS]");
setprefix("CMOS");
settype(CMOSLOG);
BX_DEBUG(("Init."));
}

@ -44,7 +44,7 @@ bx_devices_c bx_devices;
// constructor for bx_devices_c
bx_devices_c::bx_devices_c(void)
{
setprefix("[DEV ]");
setprefix("DEV");
settype(DEVLOG);
unsigned i;

@ -41,7 +41,7 @@ bx_dma_c bx_dma;
bx_dma_c::bx_dma_c(void)
{
setprefix("[DMA ]");
setprefix("DMA");
settype(DMALOG);
BX_DEBUG(("Init."));
}

@ -67,7 +67,7 @@ bx_floppy_ctrl_c bx_floppy;
bx_floppy_ctrl_c::bx_floppy_ctrl_c(void)
{
setprefix("[FDD ]");
setprefix("FDD");
settype(FDLOG);
BX_DEBUG(("Init."));
}

@ -29,7 +29,7 @@ bx_g2h_c bx_g2h;
bx_g2h_c::bx_g2h_c(void)
{
setprefix("[G2H ]");
setprefix("G2H");
settype(G2HLOG);
unsigned i;

@ -64,7 +64,7 @@ static unsigned curr_multiple_sectors = 0; // was 0x3f
bx_hard_drive_c::bx_hard_drive_c(void)
{
setprefix("[HD ]");
setprefix("HD");
settype(HDLOG);
#if EXTERNAL_DISK_SIMULATOR
s[0].hard_drive = new EXTERNAL_DISK_SIMULATOR_CLASS();

@ -28,7 +28,7 @@ bx_io_redirect_entry_t::sprintf_self (char *buf)
bx_ioapic_c::bx_ioapic_c ()
: bx_generic_apic_c ()
{
setprefix("[IOAP]");
setprefix("IOAP");
settype(IOAPICLOG);
}

@ -55,7 +55,7 @@ bx_keyb_c::bx_keyb_c(void)
// constructor
// should zero out state info here???
memset( &s, 0, sizeof(s) );
BX_KEY_THIS setprefix("[KBD ]");
BX_KEY_THIS setprefix("KBD");
BX_KEY_THIS settype(KBDLOG);
}

@ -35,7 +35,7 @@ bx_ne2k_c bx_ne2k;
bx_ne2k_c::bx_ne2k_c(void)
{
setprefix("[NE2K]");
setprefix("NE2K");
settype(NE2KLOG);
// nothing for now
}

@ -37,7 +37,7 @@ bx_parallel_c bx_parallel;
bx_parallel_c::bx_parallel_c(void)
{
setprefix("[PAR ]");
setprefix("PAR");
settype(PARLOG);
// nothing for now
}

@ -41,7 +41,7 @@ bx_pci_c bx_pci;
bx_pci_c::bx_pci_c(void)
{
setprefix("[PCI ]");
setprefix("PCI");
settype(PCILOG);
}

@ -36,7 +36,7 @@ bx_pic_c bx_pic;
bx_pic_c::bx_pic_c(void)
{
setprefix("[PIC ]");
setprefix("PIC");
settype(PICLOG);
}

@ -135,7 +135,7 @@ bx_pit_c bx_pit;
bx_pit_c::bx_pit_c( void )
{
setprefix("[PIT ]");
setprefix("PIT");
settype(PITLOG);
memset(&s, 0, sizeof(s));

@ -38,7 +38,7 @@ bx_pit2_c bx_pit2;
bx_pit2_c::bx_pit2_c( void )
{
setprefix("[PIT ]");
setprefix("PIT");
settype(PITLOG);
s.speaker_data_on=0;

@ -51,7 +51,7 @@ bx_sb16_c bx_sb16;
bx_sb16_c::bx_sb16_c(void)
{
setprefix("[SB16]");
setprefix("SB16");
settype(SB16LOG);
}

@ -70,10 +70,10 @@ static int tty_id;
bx_serial_c::bx_serial_c(void)
{
setprefix("[SER ]");
setprefix("SER");
settype(SERLOG);
#ifdef SERIAL_ENABLE
tty_id = open("/dev/ptyqf",O_RDWR|O_NONBLOCK,600);
tty_id = open("/tmp/fifo",O_RDWR|O_NONBLOCK,600);
tcgetattr(tty_id, &term_orig);
bcopy((caddr_t) &term_orig, (caddr_t) &term_new, sizeof(struct termios));
cfmakeraw(&term_new);

@ -26,7 +26,7 @@
serial_raw::serial_raw (char *ttypath, int signal)
{
setprefix ("[SERR]");
setprefix ("SERR");
settype (SERRLOG);
}

@ -34,7 +34,7 @@ bx_unmapped_c bx_unmapped;
bx_unmapped_c::bx_unmapped_c(void)
{
setprefix("[UNMP]");
setprefix("UNMP");
settype(UNMAPLOG);
s.port80 = 0x00;
s.port8e = 0x00;

@ -42,7 +42,7 @@ bx_vga_c::bx_vga_c(void)
BX_VGA_THIS s.vga_mem_updated = 0;
BX_VGA_THIS s.x_tilesize = X_TILESIZE;
BX_VGA_THIS s.y_tilesize = Y_TILESIZE;
BX_VGA_THIS setprefix("[VGA ]");
BX_VGA_THIS setprefix("VGA");
}

@ -50,7 +50,7 @@ iofunctions::init(void) {
n_logfn = 0;
init_log(stderr);
log = new logfunc_t(this);
LOG_THIS setprefix("[IO ]");
LOG_THIS setprefix("IO");
LOG_THIS settype(IOLOG);
BX_DEBUG(("Init(log file: '%s').",logfn));
}
@ -183,7 +183,7 @@ iofunctions::~iofunctions(void)
logfunctions::logfunctions(void)
{
setprefix("[ ]");
setprefix(" ");
settype(GENLOG);
if(io == NULL && Allocio == 0) {
Allocio = 1;
@ -198,7 +198,7 @@ logfunctions::logfunctions(void)
logfunctions::logfunctions(iofunc_t *iofunc)
{
setprefix("[ ]");
setprefix(" ");
settype(GENLOG);
setio(iofunc);
// BUG: unfortunately this can be called before the bochsrc is read,
@ -223,7 +223,23 @@ logfunctions::setio(iofunc_t *i)
void
logfunctions::setprefix(char *p)
{
this->prefix=strdup(p);
char *tmpbuf;
tmpbuf=strdup("[ ]");// if we ever have more than 32 chars,
// we need to rethink this
int len=strlen(p);
for(int i=1;i<len+1;i++) {
tmpbuf[i]=p[i-1];
}
switch(len) {
case 1: tmpbuf[2]=' ';
case 2: tmpbuf[3]=' ';
case 3: tmpbuf[4]=' ';
case 4: tmpbuf[5]=' ';
default: tmpbuf[6]=']'; tmpbuf[7]='\0'; break;
}
this->prefix=tmpbuf;
}
void

@ -44,8 +44,8 @@ BX_MEM_C::get_memory_in_k(void)
// BX_MEM_C constructor
BX_MEM_C::BX_MEM_C(void)
{
char mem[8];
snprintf(mem, 8, "[MEM%d]", BX_SIM_ID);
char mem[6];
snprintf(mem, 6, "MEM%d", BX_SIM_ID);
setprefix(mem);
settype(MEMLOG);

@ -45,7 +45,7 @@ const Bit64u bx_pc_system_c::COUNTER_INTERVAL = 100000;
// constructor
bx_pc_system_c::bx_pc_system_c(void)
{
this->setprefix("[SYS ]");
this->setprefix("SYS");
num_timers = 0;
// set ticks period and remaining to max Bit32u value

@ -101,7 +101,7 @@ void
state_file::init(void)
{
log = new class logfunctions();
log->setprefix("[STAT]");
log->setprefix("STAT");
log->settype(GENLOG);
}