- simplified setting device prefix for log functions

- implemented unique device prefix for lowlevel cdrom
- minor device prefix changes
- minor coding style changes in cdrom.cc
This commit is contained in:
Volker Ruppert 2009-04-10 08:15:25 +00:00
parent e7a4178b47
commit e4f0de41e3
6 changed files with 30 additions and 35 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// $Id: wx.cc,v 1.99 2009-02-23 11:06:53 vruppert Exp $ // $Id: wx.cc,v 1.100 2009-04-10 08:15:25 vruppert Exp $
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// //
// wxWidgets VGA display for Bochs. wx.cc implements a custom // wxWidgets VGA display for Bochs. wx.cc implements a custom
@ -881,7 +881,7 @@ void bx_wx_gui_c::specific_init(int argc, char **argv, unsigned tilewidth, unsig
int b,i,j; int b,i,j;
unsigned char fc, vc; unsigned char fc, vc;
put("WX "); put("WX");
if (SIM->get_param_bool(BXPN_PRIVATE_COLORMAP)->get()) { if (SIM->get_param_bool(BXPN_PRIVATE_COLORMAP)->get()) {
BX_INFO(("private_colormap option ignored.")); BX_INFO(("private_colormap option ignored."));
} }

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: cdrom.cc,v 1.96 2009-03-09 12:18:40 vruppert Exp $ // $Id: cdrom.cc,v 1.97 2009-04-10 08:15:25 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -432,7 +432,7 @@ bool ReadCDSector(unsigned int hid, unsigned int tid, unsigned int lun, unsigned
DWORD dwStatus; DWORD dwStatus;
hEventSRB = CreateEvent(NULL, TRUE, FALSE, NULL); hEventSRB = CreateEvent(NULL, TRUE, FALSE, NULL);
memset(&srb,0,sizeof(SRB_ExecSCSICmd)); memset(&srb,0,sizeof(SRB_ExecSCSICmd));
srb.SRB_Cmd = SC_EXEC_SCSI_CMD; srb.SRB_Cmd = SC_EXEC_SCSI_CMD;
srb.SRB_HaId = hid; srb.SRB_HaId = hid;
@ -469,7 +469,7 @@ int GetCDCapacity(unsigned int hid, unsigned int tid, unsigned int lun)
unsigned char buf[8]; unsigned char buf[8];
hEventSRB = CreateEvent(NULL, TRUE, FALSE, NULL); hEventSRB = CreateEvent(NULL, TRUE, FALSE, NULL);
memset(&buf, 0, sizeof(buf)); memset(&buf, 0, sizeof(buf));
memset(&srb,0,sizeof(SRB_ExecSCSICmd)); memset(&srb,0,sizeof(SRB_ExecSCSICmd));
srb.SRB_Cmd = SC_EXEC_SCSI_CMD; srb.SRB_Cmd = SC_EXEC_SCSI_CMD;
@ -501,9 +501,14 @@ int GetCDCapacity(unsigned int hid, unsigned int tid, unsigned int lun)
#endif #endif
static unsigned int cdrom_count = 0;
cdrom_interface::cdrom_interface(const char *dev) cdrom_interface::cdrom_interface(const char *dev)
{ {
put("CD"); char prefix[6];
sprintf(prefix, "CD%d", ++cdrom_count);
put(prefix);
fd = -1; // File descriptor not yet allocated fd = -1; // File descriptor not yet allocated
if (dev == NULL) { if (dev == NULL) {
@ -520,9 +525,9 @@ cdrom_interface::cdrom_interface(const char *dev)
#endif #endif
} }
void void cdrom_interface::init(void)
cdrom_interface::init(void) { {
BX_DEBUG(("Init $Id: cdrom.cc,v 1.96 2009-03-09 12:18:40 vruppert Exp $")); BX_DEBUG(("Init $Id: cdrom.cc,v 1.97 2009-04-10 08:15:25 vruppert Exp $"));
BX_INFO(("file = '%s'",path)); BX_INFO(("file = '%s'",path));
} }
@ -538,8 +543,7 @@ cdrom_interface::~cdrom_interface(void)
BX_DEBUG(("Exit")); BX_DEBUG(("Exit"));
} }
bx_bool bx_bool cdrom_interface::insert_cdrom(const char *dev)
cdrom_interface::insert_cdrom(const char *dev)
{ {
unsigned char buffer[BX_CD_FRAMESIZE]; unsigned char buffer[BX_CD_FRAMESIZE];
#ifndef WIN32 #ifndef WIN32
@ -687,7 +691,7 @@ cdrom_interface::insert_cdrom(const char *dev)
} }
if (S_ISREG (stat_buf.st_mode)) { if (S_ISREG (stat_buf.st_mode)) {
using_file = 1; using_file = 1;
BX_INFO (("Opening image file %s as a cd.", path)); BX_INFO (("Opening image file as a cd."));
} else { } else {
using_file = 0; using_file = 0;
BX_INFO (("Using direct access for cdrom.")); BX_INFO (("Using direct access for cdrom."));
@ -699,8 +703,7 @@ cdrom_interface::insert_cdrom(const char *dev)
return read_block(buffer, 0, 2048); return read_block(buffer, 0, 2048);
} }
bx_bool bx_bool cdrom_interface::start_cdrom()
cdrom_interface::start_cdrom()
{ {
// Spin up the cdrom drive. // Spin up the cdrom drive.
@ -717,8 +720,7 @@ cdrom_interface::start_cdrom()
return 0; return 0;
} }
void void cdrom_interface::eject_cdrom()
cdrom_interface::eject_cdrom()
{ {
// Logically eject the CD. I suppose we could stick in // Logically eject the CD. I suppose we could stick in
// some ioctl() calls to really eject the CD as well. // some ioctl() calls to really eject the CD as well.
@ -753,8 +755,7 @@ cdrom_interface::eject_cdrom()
} }
bx_bool bx_bool cdrom_interface::read_toc(Bit8u* buf, int* length, bx_bool msf, int start_track, int format)
cdrom_interface::read_toc(Bit8u* buf, int* length, bx_bool msf, int start_track, int format)
{ {
unsigned i; unsigned i;
// Read CD TOC. Returns 0 if start track is out of bounds. // Read CD TOC. Returns 0 if start track is out of bounds.
@ -1390,8 +1391,7 @@ Bit32u cdrom_interface::capacity()
#endif #endif
} }
bx_bool BX_CPP_AttrRegparmN(3) bx_bool BX_CPP_AttrRegparmN(3) cdrom_interface::read_block(Bit8u* buf, int lba, int blocksize)
cdrom_interface::read_block(Bit8u* buf, int lba, int blocksize)
{ {
// Read a single block from the CD // Read a single block from the CD

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: slowdown_timer.cc,v 1.33 2009-02-08 09:05:52 vruppert Exp $ // $Id: slowdown_timer.cc,v 1.34 2009-04-10 08:15:25 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -55,7 +55,7 @@ bx_slowdown_timer_c bx_slowdown_timer;
bx_slowdown_timer_c::bx_slowdown_timer_c() bx_slowdown_timer_c::bx_slowdown_timer_c()
{ {
put("STIMER"); put("STIME");
s.start_time=0; s.start_time=0;
s.start_emulated_time=0; s.start_emulated_time=0;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: speaker.cc,v 1.14 2009-02-08 09:05:52 vruppert Exp $ // $Id: speaker.cc,v 1.15 2009-04-10 08:15:25 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright 2003 by David N. Welton <davidw@dedasys.com>. // Copyright 2003 by David N. Welton <davidw@dedasys.com>.
@ -54,7 +54,7 @@ void libspeaker_LTX_plugin_fini(void)
bx_speaker_c::bx_speaker_c() bx_speaker_c::bx_speaker_c()
{ {
put("SPEAKER"); put("SPEAK");
beep_frequency = 0.0; // Off beep_frequency = 0.0; // Off

View File

@ -1,5 +1,5 @@
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// $Id: virt_timer.cc,v 1.41 2009-02-08 09:05:52 vruppert Exp $ // $Id: virt_timer.cc,v 1.42 2009-04-10 08:15:25 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -133,7 +133,7 @@ bx_virt_timer_c bx_virt_timer;
bx_virt_timer_c::bx_virt_timer_c() bx_virt_timer_c::bx_virt_timer_c()
{ {
put("VTIMER"); put("VTIME");
setup(); setup();
} }

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: logio.cc,v 1.72 2009-02-20 17:05:03 sshwarts Exp $ // $Id: logio.cc,v 1.73 2009-04-10 08:15:25 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -326,18 +326,13 @@ void logfunctions::put(const char *p)
} }
size_t len=strlen(p); size_t len=strlen(p);
if (len > (strlen(tmpbuf) - 2)) {
len = strlen(tmpbuf) - 2;
}
for(size_t i=1;i <= len;i++) { for(size_t i=1;i <= len;i++) {
tmpbuf[i]=p[i-1]; 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;
}
prefix = tmpbuf; prefix = tmpbuf;
} }