示例#1
0
BOOL
print_ndas_device_info(
	const NDASCOMM_CONNECTION_INFO* pci)
{
	BOOL success = FALSE;
	HNDAS hNdas = NULL;
	NDAS_DEVICE_HARDWARE_INFO di;

	API_CALL_JMP(fail, hNdas = NdasCommConnect(pci));

	/* NDAS device information */

	ZeroMemory(&di, sizeof(NDAS_DEVICE_HARDWARE_INFO));
	di.Size = sizeof(NDAS_DEVICE_HARDWARE_INFO);
	API_CALL_JMP(fail, NdasCommGetDeviceHardwareInfo(hNdas, &di) );

	_tprintf(_T(" Hardware type : %d\n"), di.HardwareType);
	_tprintf(_T(" Hardware version : %d\n"), di.HardwareVersion);
	_tprintf(_T(" Hardware protocol type : %d\n"), di.ProtocolType);
	_tprintf(_T(" Hardware protocol version : %d\n"), di.ProtocolVersion);
	_tprintf(_T(" Number of command processing slots : %d\n"), di.NumberOfCommandProcessingSlots);
	_tprintf(_T(" Maximum transfer blocks : %d\n"), di.MaximumTransferBlocks);
	_tprintf(_T(" Maximum targets : %d\n"), di.MaximumNumberOfTargets);
	_tprintf(_T(" Maximum LUs : %d\n"), di.MaximumNumberOfLUs);
	_tprintf(_T(" Header encryption : %s\n"), bool_string(di.HeaderEncryptionMode));
	_tprintf(_T(" Header digest : %s\n"), bool_string(di.HeaderDigestMode));
	_tprintf(_T(" Data encryption : %s\n"), bool_string(di.DataEncryptionMode));
	_tprintf(_T(" Data Digest : %s\n"), bool_string(di.DataDigestMode));

	_tprintf(_T("\n"));

	success = TRUE;

fail:

	if (NULL != hNdas)
	{
		API_CALL(NdasCommDisconnect(hNdas));
	}

	return success;
}
inline std::string typedef_string(int type, bool clockwise, bool open)
{
    std::ostringstream out;
    switch(type)
    {
        case point : return "P";
        case linestring : return "bg::model::linestring<P>";
        case box : return "bg::model::box<P>";
        case segment : return "bg::model::segment<P>";
        case ring :
            out << "bg::model::ring<P, "
                << bool_string(clockwise) << ", " << bool_string(open) << ">";
            break;
        case polygon : 
            out << "bg::model::polygon<P, "
                << bool_string(clockwise) << ", " << bool_string(open) << ">";
            break;
        case multi_point : return "bg::model::multi_point<P>";
        case multi_linestring : 
            out << "bg::model::multi_linestring<bg::model::linestring<P> >";
            break;
        case multi_polygon : 
            out << "bg::model::multi_polygon<bg::model::polygon<P, "
                << bool_string(clockwise) << ", " << bool_string(open) << "> >";
            break;
    }
    return out.str();
}
示例#3
0
BOOL
print_ndas_unitdevice_stat(
	const NDASCOMM_CONNECTION_INFO* pci)
{
	BOOL success = FALSE;
	int i;

	NDAS_UNITDEVICE_STAT ustat;

	/* NdasCommGetUnitDeviceStat requires DISCOVER login type */
	_ASSERTE(NDASCOMM_LOGIN_TYPE_DISCOVER == pci->LoginType);

	ZeroMemory(&ustat, sizeof(NDAS_UNITDEVICE_STAT));
	ustat.Size = sizeof(NDAS_UNITDEVICE_STAT);

	API_CALL_JMP(fail, NdasCommGetUnitDeviceStat(pci, &ustat));

	_tprintf(_T("  Present: %s\n"), bool_string(ustat.IsPresent));

	if (NDAS_HOST_COUNT_UNKNOWN == ustat.RoHostCount)
	{
		_tprintf(_T("  NDAS hosts with RO access: N/A\n"));
	}
	else
	{
		_tprintf(_T("  NDAS hosts with RO access: %d\n"), ustat.RoHostCount);
	}

	if (NDAS_HOST_COUNT_UNKNOWN == ustat.RwHostCount)
	{
		_tprintf(_T("  NDAS hosts with RW access: N/A\n"));
	}
	else
	{
		_tprintf(_T("  NDAS hosts with RW access: %d\n"), ustat.RwHostCount);
	}

	_tprintf(_T("  Target data : "));
	for (i = 0; i < 8; i++)
	{
		_tprintf(_T("%02X "), ustat.TargetData[i]);
	}
	_tprintf(_T("\n"));

	success = TRUE;

fail:

	return success;
}
示例#4
0
void
triggers::print (const std::string & seqname) const
{
    printf("sequence '%s' triggers:\n", seqname.c_str());
    for (List::const_iterator i = m_triggers.begin(); i != m_triggers.end(); ++i)
    {
        printf
        (
            "  tick_start = %ld; tick_end = %ld; offset = %ld; selected = %s\n",
            i->tick_start(), i->tick_end(), i->offset(),
            bool_string(i->selected())
        );
    }
}
示例#5
0
void
triggers::add
(
    midipulse tick, midipulse len, midipulse offset, bool fixoffset
)
{
    trigger t;
    t.offset(fixoffset ? adjust_offset(offset) : offset);
    t.selected(false);
    t.tick_start(tick);
    t.tick_end(tick + len - 1);

#ifdef SEQ64_USE_DEBUG_OUTPUT
    printf
    (
        "triggers::add(): tick = %ld; len = %ld; offset = %ld; fix = %s\n",
        tick, len, offset, bool_string(fixoffset)
    );
#endif

    for (List::iterator i = m_triggers.begin(); i != m_triggers.end(); ++i)
    {
        if (i->tick_start() >= t.tick_start() && i->tick_end() <= t.tick_end())
        {
            m_triggers.erase(i);                /* inside the new one? erase  */
            i = m_triggers.begin();             /* THERE IS A BETTER WAY      */
            continue;
        }
        else if (i->tick_end() >= t.tick_end() && i->tick_start() <= t.tick_end())
        {
            i->tick_start(t.tick_end() + 1);    /* is the event's end inside? */
        }
        else if
        (
            i->tick_end() >= t.tick_start() && i->tick_start() <= t.tick_start()
        )
        {
            i->tick_end(t.tick_start() - 1);    /* last start inside new end? */
        }
    }
    m_triggers.push_front(t);
    m_triggers.sort();                          /* hmmm, another sort       */
}
示例#6
0
BOOL
print_ndas_unitdevice_info(
	const NDASCOMM_CONNECTION_INFO* pci)
{
	BOOL success;
	int i;
	HNDAS hNdas = NULL;
	NDAS_UNITDEVICE_HARDWARE_INFO uinfo;
	NDASCOMM_IDE_REGISTER idereg;
	struct hd_driveid ideInfo;
	UINT64 sectors;
	TCHAR szBuffer[100];
	const DWORD cchBuffer = sizeof(szBuffer) / sizeof(szBuffer[0]);

	/* NdasCommGetUnitDeviceStat requires NORMAL login type */
	_ASSERTE(NDASCOMM_LOGIN_TYPE_NORMAL == pci->LoginType);

	API_CALL_JMP(fail, hNdas = NdasCommConnect(pci));

	/* Unit Device Information */
	ZeroMemory(&uinfo, sizeof(NDAS_UNITDEVICE_HARDWARE_INFO));
	uinfo.Size = sizeof(NDAS_UNITDEVICE_HARDWARE_INFO);
	API_CALL_JMP(fail, NdasCommGetUnitDeviceHardwareInfo(hNdas, &uinfo));

	sectors = 
	_tprintf(_T("  Sector count : %I64d\n"), uinfo.SectorCount.QuadPart);
	_tprintf(_T("  Supports LBA : %s\n"), bool_string(uinfo.LBA));
	_tprintf(_T("  Supports LBA48 : %s\n"), bool_string(uinfo.LBA48));
	_tprintf(_T("  Supports PIO : %s\n"), bool_string(uinfo.PIO));
	_tprintf(_T("  Supports DMA : %s\n"), bool_string(uinfo.DMA));
	_tprintf(_T("  Supports UDMA : %s\n"), bool_string(uinfo.UDMA));

	_tprintf(_T("  Model : %s\n"), uinfo.Model);
	_tprintf(_T("  Firmware Rev : %s\n"), uinfo.FirmwareRevision);
	_tprintf(_T("  Serial number : %s\n"), uinfo.SerialNumber);

	_tprintf(_T("  Media type : %s\n"), media_type_string(uinfo.MediaType));
	_tprintf(_T("\n"));

	/* Additional IDE information using WIN_IDENTIFY command */

	idereg.device.lba_head_nr = 0;
	idereg.device.dev = (0 == pci->UnitNo) ? 0 : 1;
	idereg.device.lba = 0;
	idereg.command.command = WIN_IDENTIFY;

	API_CALL_JMP(fail,
	NdasCommIdeCommand(hNdas, &idereg, NULL, 0, (PBYTE)&ideInfo, sizeof(ideInfo)));

	_tprintf(_T("  FLUSH CACHE : Supports - %s, Enabled - %s\n"), 
		bool_string(ideInfo.command_set_2 & 0x1000), 
		bool_string(ideInfo.cfs_enable_2 & 0x1000));

	_tprintf(_T("  FLUSH CACHE EXT : Supports - %s, Enabled - %s\n"), 
		bool_string(ideInfo.command_set_2 & 0x2000),
		bool_string(ideInfo.cfs_enable_2 & 0x2000));

	/* Check Ultra DMA mode */
	for (i = 7; i >= 0; i--)
	{
		if (ideInfo.dma_ultra & (0x01 << i))
		{
			_tprintf(_T("  Ultra DMA mode: supports up to UDMA mode %d\n"), i);
			break;
		}
	}
	for (i = 7; i >= 0; i--)
	{
		if (ideInfo.dma_ultra & (0x01 << (i + 8)))
		{
			_tprintf(_T("  Current Ultra DMA mode: %d\n"), i);
			break;
		}
	}
	if (i < 0)
	{
		_tprintf(_T("  Ultra DMA mode is not selected\n"));
	}

	/* Check DMA mode */
	for (i = 2; i >= 0; i--)
	{
		if (ideInfo.dma_mword & (0x01 << i))
		{
			_tprintf(_T("  DMA mode: supports up to DMA mode %d\n"), i);
			break;
		}
	}
	for (i = 2; i >= 0; i--)
	{
		if (ideInfo.dma_mword & (0x01 << (i + 8)))
		{
			_tprintf(_T("  DMA mode %d selected\n"), i);
			break;
		}
	}
	if (i < 0)
	{
		_tprintf(_T("  DMA mode is not selected\n"));
	}
	_tprintf(_T("\n"));

	success = TRUE;

fail:

	if (hNdas)
	{
		API_CALL(NdasCommDisconnect(hNdas));
	}

	return success;
}
int report_library(CompilePolicy& compile_policy,
                   int type, algorithm const& algo, bool clockwise,
                   bool open, int dimensions, std::string const& cs,
                   int type2 = -1)
{
    std::string lit;
    {
        std::ostringstream out;
        out << geometry_string(type);
        if (type2 != -1)
        {
            out << "_" << geometry_string(type2);
        }
        out 
            << "_" << algo.name
            << "_" << bool_string(clockwise) 
            << "_" << bool_string(open)
            << "_" << boost::replace_all_copy
                        (
                            boost::replace_all_copy
                                (
                                    boost::replace_all_copy(cs, "bg::", "")
                                , "<", "_"
                                )
                            , ">", "_"
                        );
        lit = out.str();
    }

    std::cout << lit;

    {
        std::ofstream out("tmp/t.cpp");

        out
            << "#include <implementation_status.hpp>" << std::endl
            << "template <typename P>" << std::endl
            << "inline void test()" << std::endl
            << "{" << std::endl
            << "  namespace bg = boost::geometry;" << std::endl
            << "  " << typedef_string(type, clockwise, open) << " geometry;" << std::endl
            << "  bg::read_wkt(\"" << wkt_string(type) << "\", geometry);" << std::endl;

        
        if (algo.arity > 1)
        {
            out 
                << "  " << typedef_string(type2, clockwise, open) << " geometry2;" << std::endl
                << "  bg::read_wkt(\"" << wkt_string(type2) << "\", geometry2);" << std::endl;
        }

        switch(algo.arity)
        {
            case 1 : 
                out << "  bg::" << algo.name << "(geometry);" << std::endl; 
                break;
            case 2 : 
                out << "  bg::" << algo.name << "(geometry, geometry2);" << std::endl; 
                break;
        }

        out
            << "}" << std::endl
            << std::endl
            ;

        out
            << "int main()" << std::endl
            << "{" << std::endl
            << "  namespace bg = boost::geometry;" << std::endl
            << "  test<bg::model::point< double, " << dimensions << ", bg::cs::" << cs << " > >();" << std::endl
            << "  return 0;" << std::endl
            << "}" << std::endl
            << std::endl
            ;
    }

    bool result = compile_policy.apply(type, type2);
    if (! result)
    {
        std::cout << " ERROR";
    }
    std::cout << std::endl;
    return result;
}
示例#8
0
int main(int argc, char* argv[])
{
	GPU_Target* screen;

	screen = initialize_demo(argc, argv, 800, 600);
	if(screen == NULL)
		return -1;
	
	GPU_LogError("Supports GPU_FEATURE_ALL_BASE: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_ALL_BASE)));
	GPU_LogError("Supports GPU_FEATURE_ALL_BLEND_PRESETS: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_ALL_BLEND_PRESETS)));
	GPU_LogError("Supports GPU_FEATURE_ALL_GL_FORMATS: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_ALL_GL_FORMATS)));
	
	GPU_LogError("Supports GPU_FEATURE_NON_POWER_OF_TWO: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_NON_POWER_OF_TWO)));
	GPU_LogError("Supports GPU_FEATURE_RENDER_TARGETS: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_RENDER_TARGETS)));
	GPU_LogError("Supports GPU_FEATURE_BLEND_EQUATIONS: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_BLEND_EQUATIONS)));
	GPU_LogError("Supports GPU_FEATURE_BLEND_FUNC_SEPARATE: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_BLEND_FUNC_SEPARATE)));
	GPU_LogError("Supports GPU_FEATURE_GL_BGR: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_GL_BGR)));
	GPU_LogError("Supports GPU_FEATURE_GL_BGRA: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_GL_BGRA)));
	GPU_LogError("Supports GPU_FEATURE_GL_ABGR: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_GL_ABGR)));
	
	GPU_LogError("Supports GPU_FEATURE_VERTEX_SHADER: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_VERTEX_SHADER)));
	GPU_LogError("Supports GPU_FEATURE_FRAGMENT_SHADER: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_FRAGMENT_SHADER)));
	GPU_LogError("Supports GPU_FEATURE_GEOMETRY_SHADER: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_GEOMETRY_SHADER)));
	
	GPU_LogError("Supports GPU_FEATURE_WRAP_REPEAT_MIRRORED: %s\n", bool_string(GPU_IsFeatureEnabled(GPU_FEATURE_WRAP_REPEAT_MIRRORED)));
	
	GPU_Quit();
	
	return 0;
}
int report_library(CompilePolicy& compile_policy,
                   int type, algorithm const& algo, bool clockwise,
                   bool open, int dimensions, std::string const& cs,
                   int type2 = -1)
{
    std::string lit;
    {
        std::ostringstream out;
        out << geometry_string(type);
        if (type2 != -1)
        {
            out << "_" << geometry_string(type2);
        }
        out
            << "_" << algo.name
            << "_" << bool_string(clockwise)
            << "_" << bool_string(open)
            << "_" << boost::replace_all_copy
                        (
                            boost::replace_all_copy
                                (
                                    boost::replace_all_copy(cs, "bg::", "")
                                , "<", "_"
                                )
                            , ">", "_"
                        );
        lit = out.str();
    }

    std::cout << lit;

    {
        std::ofstream out("tmp/t.cpp");

        std::string name = "geometry";

        if (type == variant)
        {
            name = "source";
        }

        out << "#include <implementation_status.hpp>" << std::endl;

        if (type == variant)
        {
            out << "#include <boost/variant/variant.hpp>" << std::endl;
        }

        out
            << "template <typename P>" << std::endl
            << "inline void test()" << std::endl
            << "{" << std::endl
            << "  namespace bg = boost::geometry;" << std::endl
            << "  " << typedef_string(type, clockwise, open) << " " << name << ";" << std::endl
            << "  bg::read_wkt(\"" << wkt_string(type) << "\", " << name << ");" << std::endl;

        if (type == variant)
        {
            out
                << "  typedef " << typedef_string(polygon, clockwise, open) << " type1;" << std::endl
                << "  typedef " << typedef_string(box, clockwise, open) << " type2;" << std::endl
                << "  boost::variant<type1, type2> geometry;" << std::endl
                << "  geometry = source;"
                << std::endl;
        }

        if (algo.arity > 1)
        {
            out
                << "  " << typedef_string(type2, clockwise, open) << " geometry2;" << std::endl
                << "  bg::read_wkt(\"" << wkt_string(type2) << "\", geometry2);" << std::endl;
        }

        if (algo.name == std::string("centroid"))
        {
            out << "  P point;";
            out << "  bg::" << algo.name << "(geometry, point);" << std::endl;
        }
        else if (algo.name == std::string("envelope"))
        {
            out << "  bg::model::box<P> box;";
            out << "  bg::" << algo.name << "(geometry, box);" << std::endl;
        }
        else
        {
            switch(algo.arity)
            {
                case 1 :
                    out << "  bg::" << algo.name << "(geometry);" << std::endl;
                    break;
                case 2 :
                    // For cases as point-in-polygon, take first geometry 2 (point), then geometry (polygon) such that
                    // it is listed as column:point in row:polygon
                    out << "  bg::" << algo.name << "(geometry2, geometry);" << std::endl;
                    break;
            }
        }

        out
            << "}" << std::endl
            << std::endl
            ;

        out
            << "int main()" << std::endl
            << "{" << std::endl
            << "  namespace bg = boost::geometry;" << std::endl
            << "  test<bg::model::point< double, " << dimensions << ", bg::cs::" << cs << " > >();" << std::endl
            << "  return 0;" << std::endl
            << "}" << std::endl
            << std::endl
            ;
    }

    bool result = compile_policy.apply(lit);
    if (! result)
    {
        std::cout << " ERROR";
    }
    std::cout << std::endl;
    return result;
}