Пример #1
0
void nglWindowInfo::Dump (uint Level) const
{
  NGL_LOG(_T("window"), Level, _T("Window info :"));

  NGL_LOG(_T("window"), Level, _T("  title     : '%ls'"), Title.GetChars());

  const nglChar* pos = _T("");
  switch (Pos)
  {
    case ePosUser  : pos = _T("user defined"); break;
    case ePosCenter: pos = _T("centered on screen"); break;
    case ePosMouse : pos = _T("centered on mouse pointer"); break;
    case ePosAuto  : pos = _T("auto"); break;
  }
  NGL_LOG(_T("window"), Level, _T("  pos       : %d,%d (creation hint: %ls)"), XPos, YPos, pos);
  NGL_LOG(_T("window"), Level, _T("  size      : %dx%d"), Width, Height);

  nglString buffer(_T(""));
  if (Flags & nglWindow::NoResize)   buffer += _T(" NoResize");
  if (Flags & nglWindow::NoBorder)   buffer += _T(" NoBorder");
  if (Flags & nglWindow::FullScreen) buffer += _T(" FullScreen");
  NGL_LOG(_T("window"), Level, _T("  flags     :%ls"), buffer.IsEmpty() ? _T(" none") : buffer.GetChars());

  buffer.Wipe();
  if (Events & nglWindow::MouseEvents) buffer += _T(" mouse");
  if (Events & nglWindow::KeyEvents) buffer += _T(" keyboard");
  NGL_LOG(_T("window"), Level, _T("  events    :%ls"), buffer.IsEmpty() ? _T(" none") : buffer.GetChars());

  NGL_LOG(_T("window"), Level, _T("  mouse mode: %ls"), MouseMode == nglMouseInfo::eAbsolute ? _T("absolute") : _T("relative"));
  NGL_LOG(_T("window"), Level, _T("  key repeat: %ls"), YESNO(KeyRepeat));
}
Пример #2
0
void nuiFontManager::ScanFolders(bool rescanAllFolders /* = false */)
{
  NGL_LOG("font", NGL_LOG_INFO, "Scan font folders (rescanAllFolders: %s)", YESNO(rescanAllFolders));

  nuiContextInfo ContextInfo(nuiContextInfo::StandardContext3D);
  nglWindowInfo Info;
  
  Info.Flags = nglWindow::NoBorder | nglWindow::NoResize;
  Info.Width = 320;
  Info.Height = 60;
  Info.Pos = nglWindowInfo::ePosCenter;
  Info.Title = _T("nui test");
  Info.XPos = 0;
  Info.YPos = 0;

#if 0
#ifndef _UIKIT_
  gpWin = new nuiMainWindow(ContextInfo, Info);
  nuiVBox* pBox = new nuiVBox();
  pBox->SetPosition(nuiCenter);
  nuiLabel* pLabel = new nuiLabel(_T("Please wait. Scaning fonts..."));
  gpFontPathLabel = new nuiLabel(_T("...searching..."));
  //pLabel->SetTextColor(nuiColor(255, 255, 255));
  pBox->AddCell(pLabel, nuiCenter);
  pBox->AddCell(gpFontPathLabel, nuiCenter);
  gpWin->AddChild(pBox);
  gpWin->SetState(nglWindow::eShow);
#endif  
#endif  
  
  NGL_DEBUG( NGL_LOG("font", NGL_LOG_INFO, "Scan system fonts....\n"); )
Пример #3
0
void Iec101driverCommand::OkClicked()
{
	if(!YESNO(tr("Command confirmation"),tr("Send the command - Are You Sure?")))
	{
		QString cmd = "select UNIT from SAMPLE where NAME='"+ QString(samplePointName) +"';";
		GetConfigureDb()->DoExec(this,cmd,tUnit); // kick it off
	}
}
Пример #4
0
// ConsolePrint the device caps...
void CD3D_Device::ListDeviceCaps()
{
	if (!m_pD3DDevice)
		return;
	if (!m_pAdapter)
		return;
	if (!m_pMode)
		return;

	PFormat PixFormat;
	if(!d3d_D3DFormatToPFormat(m_pMode->Format,&PixFormat))
		return;

	g_pStruct->ConsolePrint("---------------------------------------------------------------");
	g_pStruct->ConsolePrint("Driver: %s", m_pAdapter->AdapterID.Driver);
	g_pStruct->ConsolePrint("Description: %s", m_pAdapter->AdapterID.Description);
	g_pStruct->ConsolePrint("Version: %x", m_pAdapter->AdapterID.DriverVersion);
	g_pStruct->ConsolePrint("VendorID: 0x%x, DeviceID: 0x%x, SubSysID: 0x%x, Revision: 0x%x",
		m_pAdapter->AdapterID.VendorId, m_pAdapter->AdapterID.DeviceId,
		m_pAdapter->AdapterID.SubSysId, m_pAdapter->AdapterID.Revision);
	g_pStruct->ConsolePrint("Width: %d, Height: %d, BitDepth: %d",
		m_pMode->Width,m_pMode->Height,PixFormat.GetBitsPerPixel());
	g_pStruct->ConsolePrint("---------------------------------------------------------------");

	g_pStruct->ConsolePrint("Portals: %s", YESNO(CanDrawPortals()));
	g_pStruct->ConsolePrint("Light add poly: %s", YESNO(m_ExtraDevCaps.m_bLightAddPolyCapable));
	g_pStruct->ConsolePrint("MipMap supported: %s", YESNO(m_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_MIPMAP));
	g_pStruct->ConsolePrint("Square textures only: %s", YESNO(m_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY));
	g_pStruct->ConsolePrint("Approx Texture Memory: %d", m_pD3DDevice->GetAvailableTextureMem());
	uint32 iZDepth,iStencilDepth; d3d_GetDepthStencilBits(m_ExtraDevCaps.m_DepthStencilBufferFormat,iZDepth,iStencilDepth);
	g_pStruct->ConsolePrint("ZBuffer Depth: %d, Device Depth: %d", iZDepth, iStencilDepth);
	g_pStruct->ConsolePrint("Z-test: %s, Table fog: %s, Palette alpha: %s", YESNO(m_DeviceCaps.RasterCaps  & D3DPRASTERCAPS_ZTEST),
		YESNO(m_DeviceCaps.RasterCaps  & D3DPRASTERCAPS_FOGTABLE), YESNO(m_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_ALPHAPALETTE));
	g_pStruct->ConsolePrint("Max texture size: (%d x %d)",m_DeviceCaps.MaxTextureWidth, m_DeviceCaps.MaxTextureHeight);
}
Пример #5
0
void InfoPoint::dump() const
{
	StringBuffer buffer;
	switch (Type) {
		case ST_TRIGGER:
			buffer.appendFormatted( "Debugdump of InfoPoint Region %s:\n", GetScriptName() );
			break;
		case ST_PROXIMITY:
			buffer.appendFormatted( "Debugdump of Trap Region %s:\n", GetScriptName() );
			break;
		case ST_TRAVEL:
			buffer.appendFormatted( "Debugdump of Travel Region %s:\n", GetScriptName() );
			break;
		default:
			buffer.appendFormatted( "Debugdump of Unsupported Region %s:\n", GetScriptName() );
			break;
	}
	buffer.appendFormatted( "Region Global ID: %d\n", GetGlobalID());
	buffer.appendFormatted( "Position: %d.%d\n", Pos.x, Pos.y);
	buffer.appendFormatted( "TalkPos: %d.%d\n", TalkPos.x, TalkPos.y);
	buffer.appendFormatted( "UsePoint: %d.%d  (on: %s)\n", UsePoint.x, UsePoint.y, YESNO(GetUsePoint()));
	switch(Type) {
	case ST_TRAVEL:
		buffer.appendFormatted( "Destination Area: %s Entrance: %s\n", Destination, EntranceName);
		break;
	case ST_PROXIMITY:
		buffer.appendFormatted( "TrapDetected: %d, Trapped: %s\n", TrapDetected, YESNO(Trapped));
		buffer.appendFormatted( "Trap detection: %d%%, Trap removal: %d%%\n", TrapDetectionDiff,
			TrapRemovalDiff );
		break;
	case ST_TRIGGER:
		buffer.appendFormatted ( "InfoString: %ls\n", OverheadText.c_str() );
		break;
	default:;
	}
	const char *name = "NONE";
	if (Scripts[0]) {
		name = Scripts[0]->GetName();
	}
	buffer.appendFormatted( "Script: %s, Key: %s, Dialog: %s\n", name, KeyResRef, Dialog );
	buffer.appendFormatted( "Deactivated: %s\n", YESNO(Flags&TRAP_DEACTIVATED));
	buffer.appendFormatted( "Active: %s\n", YESNO(InternalFlags&IF_ACTIVE));
	Log(DEBUG, "InfoPoint", buffer);
}
Пример #6
0
void UnitCfg::Delete ()
{
	if (!YESNO ("Delete Unit", "Delete the Unit - Are You Sure ?"))
	{
		QString cmd =
		GetConfigureDb ()->Delete ("UNITS", "NAME", Name->currentText ());
		GetConfigureDb ()->DoExec (this, cmd, tDelete);
		//
		DOAUDIT(tr("Delete:") + Name->currentText());
		//
		// Delete all associated sample points
		// 
		if (!YESNO ("Delete Unit Sample Points", "Delete the Sample Points As Well - Are You Sure ?"))
		{
			DOAUDIT(tr("Delete Sample Points For:") + Name->currentText());

			GetConfigureDb ()->DoExec (this, "select NAME from SAMPLE where UNIT='" + Name->currentText() + "';", tDrop);

			QString USelect = "(select NAME from SAMPLE where UNIT='" + Name->currentText() + "');";
			
			// delete the sample point tags
			cmd = "delete from TAGS where NAME in " + USelect;
			GetConfigureDb()->DoExec(0,cmd,0);
			// delete the sample point properties
			cmd = "delete from PROPS where IKEY in " + USelect;
			GetConfigureDb()->DoExec(0,cmd,0);
			//
			cmd = "delete from SAMPLE where UNIT='" + Name->currentText() + "';";
			GetConfigureDb()->DoExec(0,cmd,0);
		};
		//
		// delete the properties for specific configurations
		GetConfigureDb()->DoExec(0,"delete from PROPS where SKEY='"+Name->currentText()+"';",0);
		//
		Name->removeItem(Name->currentItem());
		Name->setCurrentItem (0);
		SelChanged (0);
		Name->setFocus ();
		//
	};
}
Пример #7
0
/*! log the options with which discofs will be run 
 * @param loglevel logging level
 * @param opt  options */
static void log_options(int loglevel, struct options opt)
{
    const char *tmp;
#define YESNO(x) (x) ? "yes" : "no"
    LOG_PRINT(loglevel, "discofs options:\n");
    LOG_PRINT(loglevel, "mount point: %s\n", opt.discofs_mp);
    LOG_PRINT(loglevel, "remote fs: %s\n", opt.remote_root);
    LOG_PRINT(loglevel, "cache root: %s\n", opt.cache_root);
    LOG_PRINT(loglevel, "debug: %s\n", YESNO(opt.clear));
    LOG_PRINT(loglevel, "remote host: %s\n", opt.host);
    LOG_PRINT(loglevel, "uid: %d\n", opt.uid);
    LOG_PRINT(loglevel, "gid: %d\n", opt.gid);
    LOG_PRINT(loglevel, "pid file: %s\n", opt.pid_file);
    LOG_PRINT(loglevel, "backup prefix: %s\n", opt.backup_prefix);
    LOG_PRINT(loglevel, "backup suffix: %s\n", opt.backup_suffix);
    LOG_PRINT(loglevel, "clear: %s\n", YESNO(opt.clear));

    switch (opt.conflict) {
        case CONFLICT_NEWER:
            tmp = "newer";
            break;
        case CONFLICT_THEIRS:
            tmp = "theirs";
            break;
        case CONFLICT_MINE:
            tmp = "mine";
            break;
        default:
            FATAL("invalid \"conflict\" option!\n");
    }
    LOG_PRINT(loglevel, "conflict: %s\n", tmp);

    LOG_PRINT(loglevel, "no-mode: %s\n", YESNO((opt.copyattr & COPYATTR_NO_MODE)));
    LOG_PRINT(loglevel, "no-owner: %s\n", YESNO((opt.copyattr & COPYATTR_NO_OWNER)));
    LOG_PRINT(loglevel, "no-group: %s\n", YESNO((opt.copyattr & COPYATTR_NO_GROUP)));
#if HAVE_SETXATTR
    LOG_PRINT(loglevel, "no-xattr: %s\n", YESNO((opt.copyattr & COPYATTR_NO_XATTR)));
#endif

    LOG_PRINT(loglevel, "remote fs features:\n");
    LOG_PRINT(loglevel, "nanosecond timestamps: %s\n", YESNO((discofs_options.fs_features & FEAT_NS)));
    LOG_PRINT(loglevel, "hardlinks: %s\n", YESNO((discofs_options.fs_features & FEAT_HARDLINKS)));
#if HAVE_SETXATTR
    LOG_PRINT(loglevel, "extended attributes: %s\n", YESNO((discofs_options.fs_features & FEAT_XATTR)));
#endif
}
Пример #8
0
static void print_video_info(const SDL_VideoInfo *info, FILE *file) {
  fprintf(file, "****** Video mode info ********\n");
  fprintf(file, "Hardware surface available? %s\n", YESNO(info->hw_available));
  fprintf(file, "Window Manager available? %s\n", YESNO(info->wm_available));
  fprintf(file, "Accelerated blits:\n");
  fprintf(file, "  * Hardware-to-hardware? %s\n", YESNO(info->blit_hw));
  fprintf(file, "  * Hardware colorkey? %s\n", YESNO(info->blit_hw_CC));
  fprintf(file, "  * Hardware alpha? %s\n", YESNO(info->blit_hw_A));
  fprintf(file, "  * Software-to-hardware? %s\n", YESNO(info->blit_sw));
  fprintf(file, "  * Software colorkey? %s\n", YESNO(info->blit_sw_CC));
  fprintf(file, "  * Software alpha? %s\n", YESNO(info->blit_sw_A));
  fprintf(file, "  * Color fill? %s\n", YESNO(info->blit_fill));
  fprintf(file, "Video memory: %d kB\n", info->video_mem);
  fprintf(file, "Resolution: %d x %d\n", info->current_w, info->current_h);
  fprintf(file, "Pixel format:\n");
  print_pixel_format(info->vfmt, file);
  fprintf(file, "*******************************\n");
}
Пример #9
0
/*
 * Display main menu.
 */
void hedit_disp_menu(struct descriptor_data *d)
{
	struct house_data *house;
	char *name;

	house = OLC_HOUSE(d);
	get_char_colors(d->character);

	if ((name = get_name_by_id(H_OWNER(house))) == NULL)
		name = str_dup("nobody");
	else
		name = str_dup(get_name_by_id(H_OWNER(house)));

	clear_screen(d);
	write_to_output(d, TRUE,
		"-- House Number : [%s%d%s]\r\n"
		"%s0%s) Owner                 : %s%s\r\n"
		"%s1%s) Atrium                : [%s%d%s] %s%s\r\n"
		"%s2%s) Exit                  : [%s%d%s] %s%s\r\n"
		"%s3%s) House type            : %s%s\r\n"
		"%s4%s) Prune-safe            : %s%s\r\n"
		"%s5%s) Cost                  : [%s%d%s]\r\n"
		"%s6%s) Max Secure containers : [%s%d%s]\r\n"
		"%s7%s) Max Locked-down objs  : [%s%d%s]\r\n"
		"%sR%s) Rooms Menu\r\n"
		"%sC%s) Co-Owners Menu\r\n"
		"%sG%s) Guests Menu\r\n"
		"%sD%s) Delete this house\r\n"
		"%sQ%s) Quit\r\n"
		"Enter Choice : ",
		cyn, OLC_NUM(d), nrm,
		grn, nrm, yel, CAP(name),
		grn, nrm, cyn, real_room(H_ATRIUM(house)) == NOWHERE ? -1 : world[real_room(H_ATRIUM(house))].number,
		nrm, yel, real_room(H_ATRIUM(house)) == NOWHERE ? "Nowhere" : world[real_room(H_ATRIUM(house))].name,
		grn, nrm, cyn, H_EXIT(house) < 0 || H_EXIT(house) >= NUM_OF_DIRS ? -1 : H_EXIT(house),
		nrm, yel, H_EXIT(house) < 0 || H_EXIT(house) >= NUM_OF_DIRS ? "Nowhere" : dirs[H_EXIT(house)],
		grn, nrm, cyn, house_types[H_MODE(house)],
		grn, nrm, cyn, YESNO(H_PRUNE_SAFE(house)),
		grn, nrm, cyn, H_COST(house), nrm,
		grn, nrm, cyn, H_MAX_SECURE(house), nrm,
		grn, nrm, cyn, H_MAX_LOCKED(house), nrm,
		grn, nrm,
		grn, nrm,
		grn, nrm,
		grn, nrm,
		grn, nrm
	);

	release_buffer(name);

	OLC_MODE(d) = HEDIT_MAIN_MENU;
}
Пример #10
0
void SampleCfg::Delete ()
{
	IT_IT("SampleCfg::Delete");
	
	if (!YESNO
	(tr("Delete Sample Point"), tr("Delete the Sample Point - Are You Sure ?")))
	{
		//
		QString cmd = GetConfigureDb ()->Delete ("SAMPLE", "NAME", Name->text ());
		GetConfigureDb ()->DoExec (0,cmd,0);
		// delete the tag configuration
		cmd ="delete from TAGS where NAME='" + Name->text () + "';";
		GetConfigureDb ()->DoExec (0,cmd,0);
		//
		// delete any properties
		cmd ="delete from PROPS where SKEY='SAMPLEPROPS' and IKEY='" + Name->text () + "';";
		GetConfigureDb ()->DoExec (this,cmd,tDelete);
		//
		// clean up the current values database
		cmd ="delete from TAGS_DB where NAME='" + Name->text () + "';";
		GetCurrentDb ()->DoExec (0,cmd,0);
		//
		cmd ="delete from CVAL_DB where NAME='" + Name->text () + "';";
		GetCurrentDb ()->DoExec (0,cmd,0);
		//
		cmd ="drop table " + Name->text () + ";";
		GetResultDb ()->DoExec (0,cmd,0);

		if(pCfgDriver)
		{
			DOAUDIT(tr("Drop Unit Table:") + Name->text ());
			pCfgDriver->DropOneSpecTable(Name->text()); 
		}
		//
		cmd ="delete from ACTIONS where NAME='" + Name->text () + "';";
		GetConfigureDb ()->DoExec (this,cmd,tDelete);
		//

		DOAUDIT(tr("Delete:") + Name->text());
		//
		if((List->childCount() > 0) && List->currentItem())
		{
			QListViewItem* p = List->currentItem();
			List->takeItem(p);
			delete p;
			List->setCurrentItem (List->firstChild());
			SelChanged (0);
			//Name->setFocus ();
		};
		//
	};
}
Пример #11
0
void hedit_prune_safe_menu(struct descriptor_data *d)
{
	struct house_data *house;
	int i;

	house = OLC_HOUSE(d);
	get_char_colors(d->character);

	clear_screen(d);
	for (i = 0; i < 2; i++)
		write_to_output(d, TRUE, "%s%2d%s) %s%s%s\r\n", grn, i, nrm, cyn, YESNO(i), nrm);
	write_to_output(d, TRUE, "\r\nShould the house be prune-safe? : ");
}
Пример #12
0
void UserCfgDlg::Delete ()
{
	if (!YESNO ("Delete User", "Delete the User - Are You Sure ?"))
	{
		QString cmd = GetConfigureDb ()->Delete ("USERS", "NAME", Name->currentText ());
		GetConfigureDb ()->DoExec (this,  cmd, tDelete);
		DOAUDIT(tr("Delete:") + Name->currentText());
		Name->removeItem(Name->currentItem());
		Name->setCurrentItem (0);
		SelChanged (0);
		Name->setFocus ();
	};
}
Пример #13
0
static void print_pixel_format(const SDL_PixelFormat *format, FILE *file) {
  fprintf(file, "== Pixel Format ==\n");
  fprintf(file, "Has palette? %s\n", YESNO(format->palette));
  fprintf(file, "Bits per pixel: %d\n", format->BitsPerPixel);
  fprintf(file, "Bytes per pixel: %d\n", format->BytesPerPixel);
  fprintf(file, "Loss RGBA: %d/%d/%d/%d\n", format->Rloss, format->Gloss,
	  format->Bloss, format->Aloss);
  fprintf(file, "Shift RGBA: %d/%d/%d/%d\n", format->Rshift, format->Gshift,
	  format->Bshift, format->Ashift);
  fprintf(file, "Mask RGBA: 0x%08x/0x%08x/0x%08x/0x%08x\n", format->Rmask,
	  format->Gmask, format->Bmask, format->Amask);
  fprintf(file, "Colorkey: %d == 0x%08x\n", format->colorkey, format->colorkey);
  fprintf(file, "Alpha: %d\n", format->alpha);
  fprintf(file, "==================\n");
}
Пример #14
0
static BOOL DebugDumpParam(LPCSTR lpName, DWORD dwValue)
{
    void 		* p;

    p = (void *)dwValue;
    if (!hexstrm) return FALSE;
    fprintf (hexstrm,"%s: 0x%08X write:%s ",lpName,dwValue,\
             YESNO(!(IsBadWritePtr(p,sizeof(int)))));
    if (!IsBadReadPtr(p,sizeof(int))) {
        fprintf(hexstrm,"*%s=0x%08X\n",lpName,*(int *)p);
    } else fprintf(hexstrm,"\n");
    if (!IsBadReadPtr(p, DEBUG_DUMPSIZE)) {
        hexdump(p, DEBUG_DUMPSIZE);
    }
    return TRUE;
}
Пример #15
0
void Door::DebugDump() const
{
	print( "Debugdump of Door %s:\n", GetScriptName() );
	print( "Door Global ID: %d\n", GetGlobalID());
	print( "Position: %d.%d\n", Pos.x, Pos.y);
	print( "Door Open: %s\n", YESNO(IsOpen()));
	print( "Door Locked: %s\n", YESNO(Flags&DOOR_LOCKED));
	print( "Door Trapped: %s	Difficulty: %d\n", YESNO(Trapped), TrapRemovalDiff);
	if (Trapped) {
		print( "Trap Permanent: %s Detectable: %s\n", YESNO(Flags&DOOR_RESET), YESNO(Flags&DOOR_DETECTABLE) );
	}
	print( "Secret door: %s (Found: %s)\n", YESNO(Flags&DOOR_SECRET),YESNO(Flags&DOOR_FOUND));
	const char *Key = GetKey();
	const char *name = "NONE";
	if (Scripts[0]) {
		name = Scripts[0]->GetName();
	}
	print( "Script: %s, Key (%s) removed: %s, Dialog: %s\n", name, Key?Key:"NONE", YESNO(Flags&DOOR_KEY), Dialog );
}
Пример #16
0
void AlarmGroupCfg::Delete ()
{
	if (!YESNO ("Delete Alarm Group", "Delete the Alarm Group - Are You Sure ?"))
	{
		QString cmd = "delete from ALARMGROUP where NAME='"+Name->currentText()+"';";
		GetConfigureDb ()->DoExec (this,cmd,tDelete);	// lock the db and action the request
		//
		cmd = "delete from ALM_GRP_STATE where NAME ='" + Name->currentText() + "';"; 
		GetCurrentDb()->DoExec(0,cmd,0);
		//
		DOAUDIT(tr("Delete:") + Name->currentText());
		Name->removeItem(Name->currentItem());
		Name->setCurrentItem (0);
		SelChanged (0);
		//
		Name->setFocus ();
	};
}
Пример #17
0
void ScheduleCfg::Delete ()
{
	if(Name->count() > 0)
	{
		if (!YESNO
		("Delete Schedules Event",
		"Delete the Scheduled Event - Are You Sure ?"))
		{
			//
			DOAUDIT(tr("Delete:") + Name->currentText());
			//
			QString cmd =
			GetConfigureDb ()->Delete ("SCHEDULE", "NAME",
			Name->currentText ());
			GetConfigureDb ()->DoExec (this,  cmd,tDelete);
			Name->removeItem(Name->currentItem());
			Name->setCurrentItem (0);
			SelChanged (0);
			Name->setFocus ();
		};
	};
}
Пример #18
0
void nglContextInfo::Dump(uint Level) const
{
  const nglChar* human_readable[5] = { _T("none"), _T("single"), _T("double"), _T("triple"), _T(">3 (waw!)") };
  uint fbcount = (FrameCnt <= 4) ? FrameCnt : 4;

  NGL_LOG(_T("context"), Level, _T("GL Context description :"));
  NGL_LOG(_T("context"), Level, _T("  Frame buffer : %s"), human_readable[fbcount]);
  NGL_LOG(_T("context"), Level, _T("  Frame bits   : %d:%d:%d:%d\n"), FrameBitsR, FrameBitsG, FrameBitsB, FrameBitsA);
  NGL_LOG(_T("context"), Level, _T("  Depth bits   : %d\n"), DepthBits);
  NGL_LOG(_T("context"), Level, _T("  Stencil bits : %d\n"), StencilBits);
  NGL_LOG(_T("context"), Level, _T("  Accum bits   : %d:%d:%d:%d\n"), AccumBitsR, AccumBitsG, AccumBitsB, AccumBitsA);
  NGL_LOG(_T("context"), Level, _T("  Aux buffer   : %d\n"), AuxCnt);
  NGL_LOG(_T("context"), Level, _T("  Multisample  : %d buffer%s, %d sample%s\n"), AABufferCnt, PLURAL(AABufferCnt), AASampleCnt, PLURAL(AASampleCnt));
  NGL_LOG(_T("context"), Level, _T("  Stereo       : %s\n"), YESNO(Stereo));
  NGL_LOG(_T("context"), Level, _T("  Offscreen    : %s\n"), YESNO(Offscreen));
  NGL_LOG(_T("context"), Level, _T("  Copy On Swap : %s\n"), YESNO(CopyOnSwap));
  NGL_LOG(_T("context"), Level, _T("  Vertical Sync: %s\n"), YESNO(VerticalSync));
  NGL_LOG(_T("context"), Level, _T("  CopyOnSwap  : %s\n"), YESNO(CopyOnSwap));
  NGL_LOG(_T("context"), Level, _T("  VerticalSync: %s\n"), YESNO(VerticalSync));
}
Пример #19
0
void vl_print_host_info ()
{
  char const *arch = 0, *endian = 0, *comp = 0, *dm = 0 ;
  int compver ;
#ifdef VL_ARCH_IA6
  arch = "IA64" ;
#endif
#ifdef VL_ARCH_IX86
  arch = "IX86" ;
#endif
#ifdef VL_ARCH_PPC
  arch = "PPC" ;
#endif
  
#ifdef VL_ARCH_BIN_ENDIAN
  endian = "big endian" ;
#endif
#ifdef VL_ARCH_LITTLE_ENDIAN
  endian = "little endian" ;
#endif
  
#ifdef VL_COMPILER_MSC
  comp = "Microsoft Visual C++" ;
  compver = VL_COMPILER_MSC ;
#endif
#ifdef VL_COMPILER_GNUC
  comp = "GNU C" ;
  compver = VL_COMPILER_GNUC ;
#endif

#ifdef VL_COMPILER_LP64
  dm = "LP64" ;
#endif
#ifdef VL_COMPILER_LLP64
  dm = "LP64" ;
#endif
#ifdef VL_COMPILER_ILP32
  dm = "ILP32" ;
#endif
  
#define YESNO(x) ((x)?"yes":"no")

  VL_PRINTF("Host: Compiler: %s %d\n", comp, compver) ;
  VL_PRINTF("      Compiler data model: %s\n", dm) ;
  VL_PRINTF("      CPU architecture: %s\n", arch) ;
  VL_PRINTF("      CPU endianness: %s\n", endian) ;
  
#ifdef HAS_CPUID
  {
    struct x86cpu_ const* c = _vl_x86cpu_get() ;
    VL_PRINTF("      CPU vendor string: %s\n", c->vendor_string) ;
    VL_PRINTF("      CPU has MMX: %s\n",    YESNO(c->has_mmx)) ;
    VL_PRINTF("      CPU has SSE: %s\n",    YESNO(c->has_sse)) ;
    VL_PRINTF("      CPU has SSE2: %s\n",   YESNO(c->has_sse2)) ;
    VL_PRINTF("      CPU has SSE3: %s\n",   YESNO(c->has_sse3)) ;
    VL_PRINTF("      CPU has SSE4.1: %s\n", YESNO(c->has_sse41)) ;
    VL_PRINTF("      CPU has SSE4.2: %s\n", YESNO(c->has_sse42)) ;
    VL_PRINTF("VLFeat uses SIMD: %s\n", YESNO(vl_get_simd_enabled())) ;
  }        
#endif
}
Пример #20
0
/*****************************************************************************
 *
 *					dump_gemalto_firmware_features
 *
 ****************************************************************************/
static void dump_gemalto_firmware_features(struct GEMALTO_FIRMWARE_FEATURES *gff)
{
	DEBUG_INFO2("Dumping Gemalto firmware features (%zd bytes):",
		sizeof(struct GEMALTO_FIRMWARE_FEATURES));

#define YESNO(x) (x) ? "yes" : "no"

	DEBUG_INFO2(" bLogicalLCDLineNumber: %d", gff->bLogicalLCDLineNumber);
	DEBUG_INFO2(" bLogicalLCDRowNumber: %d", gff->bLogicalLCDRowNumber);
	DEBUG_INFO2(" bLcdInfo: 0x%02X", gff->bLcdInfo);
	DEBUG_INFO2(" bEntryValidationCondition: 0x%02X",
		gff->bEntryValidationCondition);

	DEBUG_INFO1(" Reader supports PC/SCv2 features:");
	DEBUG_INFO2("  VerifyPinStart: %s", YESNO(gff->VerifyPinStart));
	DEBUG_INFO2("  VerifyPinFinish: %s", YESNO(gff->VerifyPinFinish));
	DEBUG_INFO2("  ModifyPinStart: %s", YESNO(gff->ModifyPinStart));
	DEBUG_INFO2("  ModifyPinFinish: %s", YESNO(gff->ModifyPinFinish));
	DEBUG_INFO2("  GetKeyPressed: %s", YESNO(gff->GetKeyPressed));
	DEBUG_INFO2("  VerifyPinDirect: %s", YESNO(gff->VerifyPinDirect));
	DEBUG_INFO2("  ModifyPinDirect: %s", YESNO(gff->ModifyPinDirect));
	DEBUG_INFO2("  Abort: %s", YESNO(gff->Abort));
	DEBUG_INFO2("  GetKey: %s", YESNO(gff->GetKey));
	DEBUG_INFO2("  WriteDisplay: %s", YESNO(gff->WriteDisplay));
	DEBUG_INFO2("  SetSpeMessage: %s", YESNO(gff->SetSpeMessage));
	DEBUG_INFO2("  bTimeOut2: %s", YESNO(gff->bTimeOut2));
	DEBUG_INFO2("  bPPDUSupportOverXferBlock: %s",
		YESNO(gff->bPPDUSupportOverXferBlock));
	DEBUG_INFO2("  bPPDUSupportOverEscape: %s",
		YESNO(gff->bPPDUSupportOverEscape));

	DEBUG_INFO2(" bListSupportedLanguages: %s",
		YESNO(gff->bListSupportedLanguages));
	DEBUG_INFO2(" bNumberMessageFix: %s", YESNO(gff->bNumberMessageFix));

	DEBUG_INFO2(" VersionNumber: 0x%02X", gff->VersionNumber);
	DEBUG_INFO2(" MinimumPINSize: %d", gff->MinimumPINSize);
	DEBUG_INFO2(" MaximumPINSize: %d", gff->MaximumPINSize);
	DEBUG_INFO2(" Firewall: %s", YESNO(gff->Firewall));
	if (gff->Firewall && gff->FirewalledCommand_SW1
		&& gff->FirewalledCommand_SW2)
	{
		DEBUG_INFO2("  FirewalledCommand_SW1: 0x%02X",
			gff->FirewalledCommand_SW1);
		DEBUG_INFO2("  FirewalledCommand_SW2: 0x%02X",
			gff->FirewalledCommand_SW2);
	}

} /* dump_gemalto_firmware_features */
Пример #21
0
void do_obj_report (struct char_data *ch)
{
	struct obj_data *obj, *key;
	int i=0, j=0, found=0;

	FILE *reportfile; 

	if (!(reportfile = fopen("report.obj", "w"))) {
		mlog("SYSERR:  Object report file unavailable.");
		send_to_char ("Report.obj could not be generated.\r\n",ch);
		return;
	}
	sprintf(buf, "OBJECTS\n-------\n");
	for (i=0; i<top_of_objt;i++) {
		obj=read_object(i, REAL);
		sprintf(buf+strlen(buf), "[%5d] %s\nSpec Proc: ",
		GET_OBJ_VNUM(obj), obj->short_description);

		if (obj_index[GET_OBJ_RNUM(obj)].func!=NULL)
			get_spec_name(GET_OBJ_RNUM(obj), buf2,'o');
		else sprintf(buf2, "none");

		sprintf(buf+strlen(buf), "%s  Aliases:  %s\n", buf2, GET_OBJ_NAME(obj));

		sprinttype(GET_OBJ_TYPE(obj), item_types, buf2, sizeof(buf2));
		sprintf (buf+strlen(buf),"Type:  %s    Worn on: ",buf2); 
		sprintbit(obj->obj_flags.wear_flags, wear_bits, buf2, sizeof(buf2));
		sprintf(buf+strlen(buf), "%s\n", buf2); 

		sprintf(buf+strlen(buf), "Weight: %d, Value: %d, Cost/day: %d, Timer: %d\n",
		GET_OBJ_WEIGHT(obj), GET_OBJ_COST(obj), GET_OBJ_RENT(obj), GET_OBJ_TIMER(obj));

		sprintbit(obj->obj_flags.bitvector, affected_bits, buf2, sizeof(buf2));
		sprintf(buf+strlen(buf), "Affects player: %s\n",buf2);

		sprintbit(obj->obj_flags.bitvector, affected_bits, buf2, sizeof(buf2));
		sprintf(buf+strlen(buf), "Extra bits:  %s\n",buf2); 


		switch (GET_OBJ_TYPE(obj)) {
		case ITEM_LIGHT:
			if (GET_OBJ_VAL(obj, 2) == -1) strcpy(buf, "Hours left: Infinite\n");
			else sprintf(buf+strlen(buf), "Hours left: [%d]\n", GET_OBJ_VAL(obj, 2));
			break;
		case ITEM_SCROLL:
		case ITEM_POTION:
			sprintf(buf+strlen(buf), "Spells: (Level %d) %s, %s, %s\n", GET_OBJ_VAL(obj, 0),
			skill_name(GET_OBJ_VAL(obj, 1)), skill_name(GET_OBJ_VAL(obj, 2)),
			skill_name(GET_OBJ_VAL(obj, 3)));
			break;
		case ITEM_WAND:
		case ITEM_STAFF:
			sprintf(buf+strlen(buf), "Spell: %s at level %d, %d (of %d) charges remaining\n",
			skill_name(GET_OBJ_VAL(obj, 3)), GET_OBJ_VAL(obj, 0),
			GET_OBJ_VAL(obj, 2), GET_OBJ_VAL(obj, 1));
			break;
		case ITEM_WEAPON:
			sprintf(buf+strlen(buf), "Ave. Dam: %d, Message type: %d\n",
			get_weapon_dam(obj), GET_OBJ_VAL(obj, 3));
			break;
		case ITEM_ARMOR:
			sprintf(buf+strlen(buf), "Passive Defense: [%d]\n", GET_OBJ_VAL(obj, 0));
			sprintf(buf+strlen(buf), "Damage Reduction: [%d]\n", GET_OBJ_VAL(obj, 1));
			break;
		case ITEM_TRAP:
			sprintf(buf+strlen(buf), "Spell: %d, - Hitpoints: %d\n",
			GET_OBJ_VAL(obj, 0), GET_OBJ_VAL(obj, 1));
			break;
		case ITEM_CONTAINER:
			sprintbit(GET_OBJ_VAL(obj, 1), container_bits, buf2, sizeof(buf2));
			sprintf(buf+strlen(buf), "Weight capacity: %d, Lock Type: %s, Key Num: %d ",
			GET_OBJ_VAL(obj, 0), buf2, GET_OBJ_VAL(obj, 2)); 
			if (GET_OBJ_VAL(obj, 2) > 0) {
				key=read_object(GET_OBJ_VAL(obj,2), VIRTUAL);
				if (key) {
					sprintf(buf+strlen(buf), "(%s)", GET_OBJ_NAME(key));
					extract_obj(key); 
				}
				else
					sprintf(buf+strlen(buf), "(Error: Key does not exist!)");
			}
			sprintf(buf+strlen(buf), "\n");
			break;
		case ITEM_DRINKCON:
		case ITEM_FOUNTAIN:
			sprinttype(GET_OBJ_VAL(obj, 2), drinks, buf2, sizeof(buf2));
			sprintf(buf+strlen(buf), "Capacity: %d, Contains: %d, Poisoned: %s, Liquid: %s\n",
			GET_OBJ_VAL(obj, 0), GET_OBJ_VAL(obj, 1), YESNO(GET_OBJ_VAL(obj, 3)),buf2);
			break; 
		case ITEM_FOOD:
			sprintf(buf+strlen(buf), "Makes full: %d, Poisoned: %s\n", 
			GET_OBJ_VAL(obj, 0),YESNO(GET_OBJ_VAL(obj, 3)));
			break;
		case ITEM_MONEY:
			sprintf(buf, "Coins: %d\n", GET_OBJ_VAL(obj, 0));
			break;
		case ITEM_PORTAL:
			sprintf(buf, "To room: %d\n", GET_OBJ_VAL(obj, 0));
			break;
		default:
			sprintf(buf+strlen(buf), "Values 0-3: [%d] [%d] [%d] [%d]\n",
			GET_OBJ_VAL(obj, 0), GET_OBJ_VAL(obj, 1),
			GET_OBJ_VAL(obj, 2), GET_OBJ_VAL(obj, 3));
			break;
		}

		found = 0;
		sprintf(buf+strlen(buf), "Affects on player stats:\n");
		for (j = 0; j < MAX_OBJ_AFFECT; j++)
			if (obj->affected[j].modifier) {
				sprinttype(obj->affected[j].location, apply_types, buf2, sizeof(buf2));
				sprintf(buf+strlen(buf), "    %+d to %s\n",obj->affected[j].modifier, buf2); 
				found=1;
			}
		if (!found)
			sprintf(buf+strlen(buf),"    None\n"); 
		sprintf(buf+strlen(buf), "\n--------\n");
		extract_obj(obj);
		fprintf(reportfile, buf);
		buf[0]='\0';
	}/*for i=0...*/
	fclose (reportfile);
	send_to_char ("report.obj printed\r\n",ch);
}
Пример #22
0
/*
 * Print the core fields in an nca_io2_t.  With the "-v" argument,
 * provide more verbose output.  With the "-p" argument, print payload
 * information.
 */
static int
nca_io2(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
	unsigned int	i;
	unsigned int	payload_len;
	uint64_t	payload_output_max = 0;
	unsigned int	verbose = FALSE;
	const int	IO2_ADVDELT = NCA_ADDR_WIDTH + 1;
	boolean_t	arm;
	nca_io2_t	io2;
	uint8_t		*buf;
	namedmem_t	area[3];

	if (!(flags & DCMD_ADDRSPEC))
		return (DCMD_USAGE);

	if (mdb_getopts(argc, argv, 'v', MDB_OPT_SETBITS, TRUE, &verbose,
	    'p', MDB_OPT_UINT64, &payload_output_max, NULL) != argc)
		return (DCMD_USAGE);

	if (!DCMD_HDRSPEC(flags) && verbose)
		mdb_printf("\n\n");

	if (DCMD_HDRSPEC(flags) || verbose) {
		mdb_printf("%<u>%-*s %2s %4s %8s %*s %8s %16s %-12s%</u>\n",
		    NCA_ADDR_WIDTH, "ADDR", "AV", "MFNP", "TID",
		    NCA_ADDR_WIDTH, "CONN", "CONN_TAG", "CACHE_TAG",
		    "OPERATION");
	}

	if (mdb_vread(&io2, sizeof (nca_io2_t), addr) == -1) {
		mdb_warn("cannot read nca_io2_t at %p", addr);
		return (DCMD_ERR);
	}

	if (io2.version != NCA_HTTP_VERSION2)
		mdb_warn("nca_io2_t at %p has incorrect version `%u'\n", addr,
		    io2.version);

	mdb_printf("%0*p %02x %c%c%c%c %08x %0*llx %08x %016llx %s\n",
	    NCA_ADDR_WIDTH, addr, io2.advisory, YESNO(io2.more),
	    YESNO(io2.first), YESNO(io2.nocache), YESNO(io2.preempt),
	    (uint32_t)io2.tid, NCA_ADDR_WIDTH, io2.cid, io2.tag, io2.ctag,
	    op2name(io2.op));

	if (verbose) {
		arm = B_TRUE;
		for (i = 0; advise_types[i].bit_name != NULL; i++) {
			if ((io2.advisory & (1 << i)) == 0)
				continue;

			if (arm) {
				mdb_printf("%*s|\n", IO2_ADVDELT, "");
				mdb_printf("%*s+-->  ", IO2_ADVDELT, "");
				arm = B_FALSE;
			} else
				mdb_printf("%*s      ", IO2_ADVDELT, "");

			mdb_printf("%-15s %s\n", advise_types[i].bit_name,
			    advise_types[i].bit_descr);
		}
	}

	payload_len = io2.data_len + io2.direct_len + io2.trailer_len;

	if (payload_output_max == 0 || payload_len == 0)
		return (DCMD_OK);

	mdb_inc_indent(4);
	mdb_printf("\n%u byte payload consists of:\n", payload_len);
	mdb_inc_indent(4);

	buf = mdb_alloc(payload_output_max, UM_SLEEP);

	area[0].nm_name = "data";
	area[0].nm_addr = addr + io2.data;
	area[0].nm_len  = io2.data_len;

	area[1].nm_name = direct2name(io2.direct_type);
	area[1].nm_addr = addr + io2.direct;
	area[1].nm_len  = io2.direct_len;

	area[2].nm_name = "trailer";
	area[2].nm_addr = addr + io2.trailer;
	area[2].nm_len  = io2.trailer_len;

	for (i = 0; i < sizeof (area) / sizeof (area[0]); i++) {
		if (area[i].nm_len <= 0)
			continue;

		mdb_printf("%d byte %s area at %p (", area[i].nm_len,
		    area[i].nm_name, area[i].nm_addr);

		if (area[i].nm_len > payload_output_max) {
			mdb_printf("first");
			area[i].nm_len = (int)payload_output_max;
		} else
			mdb_printf("all");

		mdb_printf(" %u bytes follow):\n", area[i].nm_len);
		if (mdb_vread(buf, area[i].nm_len, area[i].nm_addr) == -1)
			mdb_warn("cannot read %s area at %p", area[i].nm_name,
			    area[i].nm_addr);
		else {
			mdb_inc_indent(4);
			printbuf(buf, area[i].nm_len);
			mdb_dec_indent(4);
		}
	}
	mdb_dec_indent(4);
	mdb_dec_indent(4);

	mdb_free(buf, payload_output_max);

	return (DCMD_OK);
}
Пример #23
0
static int port_detect \
(unsigned long port_base, unsigned int j, struct scsi_host_template *tpnt) {
    unsigned char irq, dma_channel, subversion, i;
    unsigned char in_byte;
    char *bus_type, dma_name[16];

    /* Allowed BIOS base addresses (NULL indicates reserved) */
    unsigned long bios_segment_table[8] = {
        0,
        0xc4000, 0xc8000, 0xcc000, 0xd0000,
        0xd4000, 0xd8000, 0xdc000
    };

    /* Allowed IRQs */
    unsigned char interrupt_table[4] = { 15, 14, 11, 10 };

    /* Allowed DMA channels for ISA (0 indicates reserved) */
    unsigned char dma_channel_table[4] = { 5, 6, 7, 0 };

    /* Head/sector mappings */
    struct {
        unsigned char heads;
        unsigned char sectors;
    } mapping_table[4] = {
        { 16, 63 }, { 64, 32 }, { 64, 63 }, { 64, 32 }
    };

    struct config_1 {

#if defined(__BIG_ENDIAN_BITFIELD)
        unsigned char dma_channel: 2, interrupt:2,
            removable_disks_as_fixed:1, bios_segment: 3;
#else
        unsigned char bios_segment: 3, removable_disks_as_fixed: 1,
                 interrupt: 2, dma_channel: 2;
#endif

        } config_1;

        struct config_2 {

#if defined(__BIG_ENDIAN_BITFIELD)
        unsigned char tfr_port: 2, bios_drive_number: 1,
                 mapping_mode: 2, ha_scsi_id: 3;
#else
        unsigned char ha_scsi_id: 3, mapping_mode: 2,
                 bios_drive_number: 1, tfr_port: 2;
#endif

    } config_2;

    char name[16];

    sprintf(name, "%s%d", driver_name, j);

    if (!request_region(port_base, REGION_SIZE, driver_name)) {
#if defined(DEBUG_DETECT)
        printk("%s: address 0x%03lx in use, skipping probe.\n", name, port_base);
#endif
        goto fail;
    }

    spin_lock_irq(&driver_lock);

    if (inb(port_base + REG_PRODUCT_ID1) != PRODUCT_ID1) goto freelock;

    in_byte = inb(port_base + REG_PRODUCT_ID2);

    if ((in_byte & 0xf0) != PRODUCT_ID2) goto freelock;

    *(char *)&config_1 = inb(port_base + REG_CONFIG1);
    *(char *)&config_2 = inb(port_base + REG_CONFIG2);

    irq = interrupt_table[config_1.interrupt];
    dma_channel = dma_channel_table[config_1.dma_channel];
    subversion = (in_byte & 0x0f);

    /* Board detected, allocate its IRQ */
    if (request_irq(irq, do_interrupt_handler,
                    IRQF_DISABLED | ((subversion == ESA) ? IRQF_SHARED : 0),
                    driver_name, (void *) &sha[j])) {
        printk("%s: unable to allocate IRQ %u, detaching.\n", name, irq);
        goto freelock;
    }

    if (subversion == ISA && request_dma(dma_channel, driver_name)) {
        printk("%s: unable to allocate DMA channel %u, detaching.\n",
               name, dma_channel);
        goto freeirq;
    }

    if (have_old_firmware) tpnt->use_clustering = DISABLE_CLUSTERING;

    spin_unlock_irq(&driver_lock);
    sh[j] = scsi_register(tpnt, sizeof(struct hostdata));
    spin_lock_irq(&driver_lock);

    if (sh[j] == NULL) {
        printk("%s: unable to register host, detaching.\n", name);
        goto freedma;
    }

    sh[j]->io_port = port_base;
    sh[j]->unique_id = port_base;
    sh[j]->n_io_port = REGION_SIZE;
    sh[j]->base = bios_segment_table[config_1.bios_segment];
    sh[j]->irq = irq;
    sh[j]->sg_tablesize = MAX_SGLIST;
    sh[j]->this_id = config_2.ha_scsi_id;
    sh[j]->can_queue = MAX_MAILBOXES;
    sh[j]->cmd_per_lun = MAX_CMD_PER_LUN;

#if defined(DEBUG_DETECT)
    {
        unsigned char sys_mask, lcl_mask;

        sys_mask = inb(sh[j]->io_port + REG_SYS_MASK);
        lcl_mask = inb(sh[j]->io_port + REG_LCL_MASK);
        printk("SYS_MASK 0x%x, LCL_MASK 0x%x.\n", sys_mask, lcl_mask);
    }
#endif

    /* Probably a bogus host scsi id, set it to the dummy value */
    if (sh[j]->this_id == 0) sh[j]->this_id = -1;

    /* If BIOS is disabled, force enable interrupts */
    if (sh[j]->base == 0) outb(CMD_ENA_INTR, sh[j]->io_port + REG_SYS_MASK);

    memset(HD(j), 0, sizeof(struct hostdata));
    HD(j)->heads = mapping_table[config_2.mapping_mode].heads;
    HD(j)->sectors = mapping_table[config_2.mapping_mode].sectors;
    HD(j)->subversion = subversion;
    HD(j)->pdev = NULL;
    HD(j)->board_number = j;

    if (have_old_firmware) sh[j]->sg_tablesize = MAX_SAFE_SGLIST;

    if (HD(j)->subversion == ESA) {
        sh[j]->unchecked_isa_dma = FALSE;
        sh[j]->dma_channel = NO_DMA;
        sprintf(BN(j), "U34F%d", j);
        bus_type = "VESA";
    }
    else {
        unsigned long flags;
        sh[j]->unchecked_isa_dma = TRUE;

        flags=claim_dma_lock();
        disable_dma(dma_channel);
        clear_dma_ff(dma_channel);
        set_dma_mode(dma_channel, DMA_MODE_CASCADE);
        enable_dma(dma_channel);
        release_dma_lock(flags);

        sh[j]->dma_channel = dma_channel;
        sprintf(BN(j), "U14F%d", j);
        bus_type = "ISA";
    }

    sh[j]->max_channel = MAX_CHANNEL - 1;
    sh[j]->max_id = MAX_TARGET;
    sh[j]->max_lun = MAX_LUN;

    if (HD(j)->subversion == ISA && !board_inquiry(j)) {
        HD(j)->board_id[40] = 0;

        if (strcmp(&HD(j)->board_id[32], "06000600")) {
            printk("%s: %s.\n", BN(j), &HD(j)->board_id[8]);
            printk("%s: firmware %s is outdated, FW PROM should be 28004-006.\n",
                   BN(j), &HD(j)->board_id[32]);
            sh[j]->hostt->use_clustering = DISABLE_CLUSTERING;
            sh[j]->sg_tablesize = MAX_SAFE_SGLIST;
        }
    }

    if (dma_channel == NO_DMA) sprintf(dma_name, "%s", "BMST");
    else                       sprintf(dma_name, "DMA %u", dma_channel);

    spin_unlock_irq(&driver_lock);

    for (i = 0; i < sh[j]->can_queue; i++)
        HD(j)->cp[i].cp_dma_addr = pci_map_single(HD(j)->pdev,
                                   &HD(j)->cp[i], sizeof(struct mscp), PCI_DMA_BIDIRECTIONAL);

    for (i = 0; i < sh[j]->can_queue; i++)
        if (! ((&HD(j)->cp[i])->sglist = kmalloc(
                                             sh[j]->sg_tablesize * sizeof(struct sg_list),
                                             (sh[j]->unchecked_isa_dma ? GFP_DMA : 0) | GFP_ATOMIC))) {
            printk("%s: kmalloc SGlist failed, mbox %d, detaching.\n", BN(j), i);
            goto release;
        }

    if (max_queue_depth > MAX_TAGGED_CMD_PER_LUN)
        max_queue_depth = MAX_TAGGED_CMD_PER_LUN;

    if (max_queue_depth < MAX_CMD_PER_LUN) max_queue_depth = MAX_CMD_PER_LUN;

    if (tag_mode != TAG_DISABLED && tag_mode != TAG_SIMPLE)
        tag_mode = TAG_ORDERED;

    if (j == 0) {
        printk("UltraStor 14F/34F: Copyright (C) 1994-2003 Dario Ballabio.\n");
        printk("%s config options -> of:%c, tm:%d, lc:%c, mq:%d, et:%c.\n",
               driver_name, YESNO(have_old_firmware), tag_mode,
               YESNO(linked_comm), max_queue_depth, YESNO(ext_tran));
    }

    printk("%s: %s 0x%03lx, BIOS 0x%05x, IRQ %u, %s, SG %d, MB %d.\n",
           BN(j), bus_type, (unsigned long)sh[j]->io_port, (int)sh[j]->base,
           sh[j]->irq, dma_name, sh[j]->sg_tablesize, sh[j]->can_queue);

    if (sh[j]->max_id > 8 || sh[j]->max_lun > 8)
        printk("%s: wide SCSI support enabled, max_id %u, max_lun %u.\n",
               BN(j), sh[j]->max_id, sh[j]->max_lun);

    for (i = 0; i <= sh[j]->max_channel; i++)
        printk("%s: SCSI channel %u enabled, host target ID %d.\n",
               BN(j), i, sh[j]->this_id);

    return TRUE;

freedma:
    if (subversion == ISA) free_dma(dma_channel);
freeirq:
    free_irq(irq, &sha[j]);
freelock:
    spin_unlock_irq(&driver_lock);
    release_region(port_base, REGION_SIZE);
fail:
    return FALSE;

release:
    u14_34f_release(sh[j]);
    return FALSE;
}
Пример #24
0
static void
show_dyntext(struct creature *ch, dynamic_text_file * dyntext, char *argument)
{
    int i;

    if (dyntext) {

        if (!*argument) {
            send_to_char(ch,
                "DYNTEXT: filename: '%s'\r\n"
                "             last: %s (%d) @ %s\r"
                "            level: %d\r\n"
                "             lock: %s (%d)\r\n"
                "              old: %-3s (Len: %zd)\r\n"
                "              new: %-3s (Len: %zd)\r\n",
                dyntext->filename,
                player_name_by_idnum(dyntext->last_edit[0].idnum),
                dyntext->last_edit[0].idnum,
                ctime(&(dyntext->last_edit[0].tEdit)),
                dyntext->level,
                player_name_by_idnum(dyntext->lock),
                dyntext->lock,
                YESNO(dyntext->buffer),
                dyntext->buffer ? strlen(dyntext->buffer) : 0,
                YESNO(dyntext->tmp_buffer),
                dyntext->tmp_buffer ? strlen(dyntext->tmp_buffer) : 0);
            return;
        }
        // there was an argument, parse it
        if (is_abbrev(argument, "old")) {
            if (!dyntext->buffer) {
                send_to_char(ch, "There is no old text buffer.\r\n");
            } else {
                page_string(ch->desc, dyntext->buffer);
            }
        } else if (is_abbrev(argument, "new")) {
            if (!dyntext->tmp_buffer) {
                send_to_char(ch, "There is no new text buffer.\r\n");
            } else {
                page_string(ch->desc, dyntext->tmp_buffer);
            }
        } else if (is_abbrev(argument, "perms")) {
            send_to_char(ch, "Permissions defined:\r\n");
            for (i = 0; i < DYN_TEXT_PERM_SIZE; i++) {
                send_to_char(ch, "%3d.] (%5d) %s\r\n",
                    i, dyntext->perms[i],
                    player_name_by_idnum(dyntext->perms[i]));
            }
        } else if (is_abbrev(argument, "last")) {
            send_to_char(ch, "Last edits:\r\n");
            for (i = 0; i < DYN_TEXT_HIST_SIZE; i++) {
                send_to_char(ch, "%3d.] (%5d) %30s @ %s\r",
                    i, dyntext->last_edit[i].idnum,
                    player_name_by_idnum(dyntext->last_edit[i].idnum),
                    ctime(&(dyntext->last_edit[i].tEdit)));
            }

        } else {
            send_to_char(ch, "Unknown argument for show.\r\n");
            show_dynedit_options(ch);
        }
        return;
    }
    send_to_char(ch, "DYNTEXT LIST:\r\n");
    for (dyntext = dyntext_list; dyntext; dyntext = dyntext->next)
        send_to_char(ch, "%s\r\n", dyntext->filename);

}
Пример #25
0
static Config *
set_option (Config * conf, char *option, char *value)
{
	char *p;
	if (!strcasecmp (option, "mpgpath"))
		strncpy (conf->mpgpath, value, sizeof (conf->mpgpath) - 1);
	else if (!strcasecmp (option, "mp3dir")) {
		strncpy (conf->mp3path, value, sizeof (conf->mp3path) - 1);
		if (conf->mp3path[strlen(conf->mp3path)-1] != '/')
			strcat(conf->mp3path,"/\0");
	} else if (!strcasecmp (option, "statefile"))
		strncpy (conf->statefile, value, sizeof (conf->statefile) - 1);
	else if (!strcasecmp (option, "logfile"))
		strncpy (conf->logfile, value, sizeof (conf->logfile) - 1);
	else if (!strcasecmp (option, "resultsfile"))
		strncpy (conf->resultsfile, value, sizeof (conf->resultsfile) - 1);
	else if (!strcasecmp (option, "playlistpath"))
		strncpy (conf->playlistpath, value, sizeof (conf->playlistpath) - 1);
	else if (!strcasecmp (option, "output_device"))
		strncpy (conf->output, value, sizeof (conf->playlistpath) - 1);
	else if (!strcasecmp (option, "file_advance"))
		conf->c_flags |= YESNO (value) * C_FADVANCE;
	else if (!strcasecmp (option, "playlist_advance"))
		conf->c_flags |= YESNO (value) * C_PADVANCE;
	else if (!strcasecmp (option, "loop"))
		conf->c_flags |= YESNO (value) * C_LOOP;
	else if (!strcasecmp (option, "playlists_to_files"))
		conf->c_flags |= YESNO (value) * C_P_TO_F;
	else if (!strcasecmp (option, "mono_output"))
		conf->c_flags |= YESNO (value) * C_MONO;
	else if (!strcasecmp (option, "allow_playlist_saving"))
		conf->c_flags |= YESNO (value) * C_ALLOW_P_SAVE;
	else if (!strcasecmp (option, "keep_playlist_at_exit"))
		conf->c_flags |= YESNO (value) * C_P_SAVE_EXIT;
	else if (!strcasecmp (option, "show_track_numbers"))
		conf->c_flags |= YESNO (value) * C_TRACK_NUMBERS;
	else if (!strcasecmp (option, "use_genre"))
		conf->c_flags |= YESNO (value) * C_USE_GENRE;
	else if (!strcasecmp (option, "screensaver"))
		conf->c_flags |= YESNO (value) * C_SCREENSAVER;
	else if (!strcasecmp (option, "delete_played_songs"))
		conf->c_flags |= YESNO (value) * C_RM_AFTER_PLAY;
	else if (!strcasecmp (option, "fix_window_borders"))
	{
		switch (value[0]) {
			case 'A' :
			case 'a' :
				if ((p = getenv ("TERM")))
					if (!strncasecmp(p,"xterm",5))
						conf->c_flags |= C_FIX_BORDERS;
				break;
			case 'Y' :
			case 'y' :
			case 'T' :
			case 't' :
				conf->c_flags |= C_FIX_BORDERS;
				break;
		}
	}
	else if (!strcasecmp (option, "buffer"))
	{
		errno = 0;
		conf->buffer = strtoul (value, NULL, 10);
		if (errno)
			conf->buffer = 0;
	}
	else if (!strcasecmp (option, "jump"))
	{
		errno = 0;
		conf->jump = strtoul (value, NULL, 10);
		if (errno)
			conf->jump = 1000;
	}
	
	conf->pathlen = strlen (conf->mp3path);
	if (conf->c_flags & C_USE_GENRE) {
		char *t = strdup (conf->mp3path);
		*strrchr(t,'/')='\0';
		*strrchr(t,'/')='\0';
		conf->basepathlen = strlen(t);
	}

	return conf;
}
Пример #26
0
static void sirf_update(void)
{
    int i, j, ch, sv;
    unsigned char *buf;
    size_t len;
    uint8_t dgps;
    char tbuf[JSON_DATE_MAX+1];

    buf = session.lexer.outbuffer + 4;
    len = session.lexer.outbuflen - 8;
    switch (buf[0]) {
    case 0x02:			/* Measured Navigation Data */
	(void)wmove(mid2win, 1, 6);	/* ECEF position */
	(void)wprintw(mid2win, "%8d %8d %8d", getbes32(buf, 1),
		      getbes32(buf, 5), getbes32(buf, 9));
	(void)wmove(mid2win, 2, 6);	/* ECEF velocity */
	(void)wprintw(mid2win, "%8.1f %8.1f %8.1f",
		      (double)getbes16(buf, 13) / 8, (double)getbes16(buf,
								    15) / 8,
		      (double)getbes16(buf, 17) / 8);
	decode_ecef((double)getbes32(buf, 1), (double)getbes32(buf, 5),
		    (double)getbes32(buf, 9), (double)getbes16(buf, 13) / 8,
		    (double)getbes16(buf, 15) / 8, (double)getbes16(buf,
								  17) / 8);
	/* line 3 */
	(void)wmove(mid2win, 3, 7);
	(void)wprintw(mid2win, "%-24s",
			unix_to_iso8601(session.gpsdata.fix.time, tbuf, sizeof(tbuf))
			);
	(void)wmove(mid2win, 3, 38);
	(void)wattrset(mid2win, A_UNDERLINE);
	if (ppstime_enabled)
	   (void)wprintw(mid2win, "%02d", leapseconds);
	else
	   (void)wprintw(mid2win, "??");
	(void)wattrset(mid2win, A_NORMAL);
	/* line 4 */
	/* HDOP */
	(void)wmove(mid2win, 4, 59);
	(void)wprintw(mid2win, "%4.1f", (double)getub(buf, 20) / 5);
	/* Mode 1 */
	(void)wmove(mid2win, 4, 69);
	(void)wprintw(mid2win, "%02x", getub(buf, 19));
	/* Mode 2 */
	(void)wmove(mid2win, 4, 77);
	(void)wprintw(mid2win, "%02x", getub(buf, 21));
	/* SVs in fix */
	(void)wmove(mid2win, 4, 6);
	(void)wprintw(mid2win, "%2d =                                     ",
		      (int)getub(buf, 28));
	/* SV list */
	(void)wmove(mid2win, 4, 10);
	/* coverity_submit[tainted_data] */
	for (i = 0; i < (int)getub(buf, 28); i++)
	   (void)wprintw(mid2win, " %2d", (int)getub(buf, 29 + i));
	monitor_log("MND 0x02=");
	break;

    case 0x04:			/* Measured Tracking Data */
	ch = (int)getub(buf, 7);
	for (i = 0; i < ch; i++) {
	    int az, el, state, off;
	    double cn;

	    off = 8 + 15 * i;
	    (void)wmove(mid4win, i + 2, 3);

	    sv = (int)getub(buf, off);
	    az = (int)getub(buf, off + 1) * 3 / 2;
	    el = (int)getub(buf, off + 2) / 2;
	    state = (int)getbeu16(buf, off + 3);
	    cn = 0;
	    for (j = 0; j < 10; j++)
		cn += (int)getub(buf, off + 5 + j);
	    cn /= 10;

	    (void)wprintw(mid4win, " %3d %3d %2d %04x %4.1f %c",
			   sv, az, el, state, cn, state == 0xbf ? 'T' : ' ');
	}
	monitor_log("MTD 0x04=");
	break;

#ifdef __UNUSED__
    case 0x05:			/* raw track data */
	for (off = 1; off < len; off += 51) {
	    ch = getbeu32(buf, off);
	    (void)wmove(mid4win, ch + 2, 19);
	    cn = 0;

	    for (j = 0; j < 10; j++)
		cn += getub(buf, off + 34 + j);

	    printw("%5.1f", (double)cn / 10);

	    printw("%9d%3d%5d", getbeu32(buf, off + 8),
		   (int)getbeu16(buf, off + 12), (int)getbeu16(buf, off + 14));
	    printw("%8.5f %10.5f", (double)getbeu32(buf, off + 16) / 65536,
		   (double)getbeu32(buf, off + 20) / 1024);
	}
	monitor_log("RTD 0x05=");
	break;
#endif /* __UNUSED */

    case 0x06:			/* firmware version */
	display(mid6win, 1, 1, "%s", buf + 1);
	monitor_log("FV  0x06=");
	break;

    case 0x07:			/* Response - Clock Status Data */
	display(mid7win, 1, 5, "%2d", getub(buf, 7));	/* SVs */
	display(mid7win, 1, 16, "%lu", getbeu32(buf, 8));	/* Clock ppstimes */
	display(mid7win, 1, 29, "%lu", getbeu32(buf, 12));	/* Clock Bias */
	display(mid7win, 2, 11, "%lu", getbeu32(buf, 16));	/* Estimated Time */
	monitor_log("CSD 0x07=");
	break;

    case 0x08:			/* 50 BPS data */
	ch = (int)getub(buf, 1);
	sv = (int)getub(buf, 2);
	display(mid4win, ch + 2, 27, "%2d", sv);
	subframe_enabled = true;
	monitor_log("50B 0x08=");
	break;

    case 0x09:			/* Throughput */
	display(mid9win, 1, 6, "%.3f", (double)getbeu16(buf, 1) / 186);	/*SegStatMax */
	display(mid9win, 1, 18, "%.3f", (double)getbeu16(buf, 3) / 186);	/*SegStatLat */
	display(mid9win, 1, 31, "%.3f", (double)getbeu16(buf, 5) / 186);	/*SegStatTime */
	display(mid9win, 1, 42, "%3d", (int)getbeu16(buf, 7));	/* Last Millisecond */
	monitor_log("THR 0x09=");
	break;

    case 0x0b:			/* Command Acknowledgement */
	monitor_log("ACK 0x0b=");
	break;

    case 0x0c:			/* Command NAcknowledgement */
	monitor_log("NAK 0x0c=");
	break;

    case 0x0d:			/* Visible List */
	display(mid13win, 1, 1, "%02d =                                            ",
				 getub(buf, 1));
	(void)wmove(mid13win, 1, 5);
	for (i = 0; i < (int)getub(buf, 1); i++)
	    (void)wprintw(mid13win, " %d", getub(buf, 2 + 5 * i));
	monitor_log("VL  0x0d=");
	break;

    case 0x13:
#define YESNO(n)	(((int)getub(buf, n) != 0)?'Y':'N')
	display(mid19win, 1, 20, "%d", getub(buf, 5));	/* Alt. hold mode */
	display(mid19win, 2, 20, "%d", getub(buf, 6));	/* Alt. hold source */
	display(mid19win, 3, 20, "%dm", (int)getbeu16(buf, 7));	/* Alt. source input */
	if (getub(buf, 9) != (uint8_t) '\0')
	    display(mid19win, 4, 20, "%dsec", getub(buf, 10));	/* Degraded timeout */
	else
	    display(mid19win, 4, 20, "N/A   ");
	display(mid19win, 5, 20, "%dsec", getub(buf, 11));	/* DR timeout */
	display(mid19win, 6, 20, "%c", YESNO(12));	/* Track smooth mode */
	display(mid19win, 7, 20, "%c", YESNO(13));	/* Static Nav. */
	display(mid19win, 8, 20, "0x%x", getub(buf, 14));	/* 3SV Least Squares */
	display(mid19win, 9, 20, "0x%x", getub(buf, 19));	/* DOP Mask mode */
	display(mid19win, 10, 20, "0x%x", (int)getbeu16(buf, 20));	/* Nav. Elev. mask */
	display(mid19win, 11, 20, "0x%x", getub(buf, 22));	/* Nav. Power mask */
	display(mid19win, 12, 20, "0x%x", getub(buf, 27));	/* DGPS Source */
	display(mid19win, 13, 20, "0x%x", getub(buf, 28));	/* DGPS Mode */
	display(mid19win, 14, 20, "%dsec", getub(buf, 29));	/* DGPS Timeout */
	display(mid19win, 1, 42, "%c", YESNO(34));	/* LP Push-to-Fix */
	display(mid19win, 2, 42, "%dms", getbeu32(buf, 35));	/* LP On Time */
	display(mid19win, 3, 42, "%d", getbeu32(buf, 39));	/* LP Interval */
	display(mid19win, 4, 42, "%c", YESNO(43));	/* User Tasks enabled */
	display(mid19win, 5, 42, "%d", getbeu32(buf, 44));	/* User Task Interval */
	display(mid19win, 6, 42, "%c", YESNO(48));	/* LP Power Cycling Enabled */
	display(mid19win, 7, 42, "%d", getbeu32(buf, 49));	/* LP Max Acq Search Time */
	display(mid19win, 8, 42, "%d", getbeu32(buf, 53));	/* LP Max Off Time */
	display(mid19win, 9, 42, "%c", YESNO(57));	/* APM Enabled */
	display(mid19win, 10, 42, "%d", (int)getbeu16(buf, 58));	/* # of fixes */
	display(mid19win, 11, 42, "%d", (int)getbeu16(buf, 60));	/* Time Between fixes */
	display(mid19win, 12, 42, "%d", getub(buf, 62));	/* H/V Error Max */
	display(mid19win, 13, 42, "%d", getub(buf, 63));	/* Response Time Max */
	display(mid19win, 14, 42, "%d", getub(buf, 64));	/* Time/Accu & Duty Cycle Priority */
#undef YESNO
	monitor_log("NP  0x13=");
	break;

    case 0x1b:
	/******************************************************************
	 Not actually documented in any published materials before the
	 1.6 version of the SiRF binary protocol manual.
	 Here is what Chris Kuethe got from the SiRF folks,
	 (plus some corrections from the GpsPaSsion forums):

	Start of message
	----------------
	Message ID          1 byte    27
	Correction Source   1 byte    0=None, 1=SBAS, 2=Serial, 3=Beacon,
	4=Software

	total:              2 bytes

	Middle part of message varies if using beacon or other:
	-------------------------------------------------------
	If Beacon:
	Receiver Freq Hz    4 bytes
	Bit rate BPS        1 byte
	Status bit map      1 byte    01=Signal Valid,
				      02=Auto frequency detect
				      04=Auto bit rate detect
	Signal Magnitude    4 bytes   Note: in internal units
	Signal Strength dB  2 bytes   derived from Signal Magnitude
	SNR  dB             2 bytes

	total:             14 bytes

	If Not Beacon:
	Correction Age[12]  1 byte x 12  Age in seconds in same order as follows
	Reserved            2 bytes

	total:             14 bytes

	End of Message
	--------------
	Repeated 12 times (pad with 0 if less than 12 SV corrections):
	SVID                1 byte
	Correction (cm)     2 bytes (signed short)

	total               3 x 12 = 36 bytes
	******************************************************************/
	dgps = getub(buf, 1);
	display(mid27win, 1, 1, "%8s =                                      ",
		(CHECK_RANGE(dgpsvec, dgps) ? dgpsvec[dgps] : "???"));
	(void)wmove(mid27win, 1, 11);
	for (ch = 0; ch < SIRF_CHANNELS; ch++)
	    if (getub(buf, 16 + 3 * ch) != '\0')
		(void)wprintw(mid27win, " %d", getub(buf, 16 + 3 * ch));
	monitor_log("DST 0x1b=");
	break;

    case 0x1c:			/* NL Measurement Data */
    case 0x1d:			/* NL DGPS Data */
    case 0x1e:			/* NL SV State Data */
    case 0x1f:			/* NL Initialized Data */
	subframe_enabled = true;
	monitor_log("NL  0x%02x=", buf[0]);
	break;

    case 0x29:			/* Geodetic Navigation Data */
	monitor_log("GND 0x29=");
	break;

    case 0x32:			/* SBAS Parameters */
	monitor_log("SBP 0x32=");
	break;

    case 0x34:			/* PPS Time */
	ppstime_enabled = true;
	leapseconds = (int)getbeu16(buf, 8);
	monitor_log("PPS 0x34=");
	break;

    case 0xff:			/* Development Data */
	while (len > 0 && buf[len - 1] == '\n')
	    len--;
	while (len > 0 && buf[len - 1] == ' ')
	    len--;
	buf[len] = '\0';
	j = 1;
	for (i = 0; verbpat[i] != NULL; i++)
	    if (str_starts_with((char *)(buf + 1), verbpat[i])) {
		j = 0;
		break;
	    }
	if (j != 0)
	    monitor_log("%s\n", buf + 1);
	monitor_log("DD  0xff=");
	break;

    default:
	monitor_log("UNK 0x%02x=", buf[0]);
	break;
    }

#ifdef CONTROLSEND_ENABLE
    /* elicit navigation parameters */
    if (dispmode && (time(NULL) % 10 == 0)) {
	(void)monitor_control_send((unsigned char *)"\x98\x00", 2);
    }
#endif /* CONTROLSEND_ENABLE */

    /* clear the 50bps data field every 6 seconds */
    if (subframe_enabled && (time(NULL) % 6 == 0)) {
	for (ch = 0; ch < SIRF_CHANNELS; ch++)
	   display(mid4win, ch + 2, 27, "  ");
    }

    if (dispmode) {
	(void)touchwin(mid19win);
	(void)wnoutrefresh(mid19win);
    }

#ifdef PPS_ENABLE
    pps_update(mid7win, 2, 32);
#endif /* PPS_ENABLE */
}