std::string SFUtils::ZeroInit( SFC::DT dt, std::string argDeclBaseName, std::string indent ) {

    std::string zeroInitStatement;

    if ( dt.type() == SFC::BasicType::meta ) {

        zeroInitStatement = indent + argDeclBaseName + " = 0\n";

    } else if ( dt.type() == SFC::Struct::meta ) {

        SFC::Struct sfcStruct = SFC::Struct::Cast( dt );
        DeclarationSet declarationSet = sfcStruct.Declaration_kind_children_sorted( StatementSorter() );
        for(
            DeclarationSet::iterator dcsItr = declarationSet.begin() ;
            dcsItr != declarationSet.end() ;
            (void)++dcsItr
        ) {
            SFC::Declaration declaration = *dcsItr;
            std::string memberName = declaration.name();
            zeroInitStatement += ZeroInit( declaration.dt(), argDeclBaseName + "." + memberName, indent );
        }

    } else { // dt.type == SFC::Array::meta

        int ix = 0;
        while( dt.type() == SFC::Array::meta ) {
            SFC::Array sfcArray = SFC::Array::Cast( dt );
            int noelem = sfcArray.noelem();

            std::string indexVarName = std::string( "ix" ) + "_" + boost::lexical_cast< std::string >( ix );
            zeroInitStatement +=
                indent + indexVarName + " = 0\n" +
                indent + "while " + indexVarName + " < " + boost::lexical_cast< std::string >( noelem ) + "\n";

            indent += std::string( "  " );

            argDeclBaseName += ix == 0 ? std::string( "( " ) : std::string( ", " );
            argDeclBaseName += indexVarName;

            dt = sfcArray.dt();
            (void)++ix;
        }

        argDeclBaseName += std::string( " )" );

        zeroInitStatement += ZeroInit( dt, argDeclBaseName, indent );

        while( ix > 0 ) {
            (void)--ix;
            std::string indexVarName = std::string( "ix" ) + "_" + boost::lexical_cast< std::string >( ix );
            zeroInitStatement += indent + indexVarName + " = " + indexVarName + " + 1\n";
            indent = indent.substr( 2 );
            zeroInitStatement += indent + "end\n";
        }
    }

    return zeroInitStatement;
}
示例#2
0
CHXString::operator const FSRef(void)
{
    FSRef ref;
    ZeroInit(&ref);
    (void) FSRefFromPath((const char*)(*this), &ref);

    return ref;
}
void SFUtils::ZeroInit( SFC::Function function, SFC::ArgDeclBase argDeclBase ) {
    std::string argDeclBaseName = argDeclBase.name();

    getSFCSymbolTable().push( argDeclBaseName, argDeclBase );

    std::string zeroInitStatement = ZeroInit( argDeclBase.dt(), argDeclBaseName, "" );
    mstat2SFC( function, zeroInitStatement, true );

    getSFCSymbolTable().clear();
}
示例#4
0
Mod::Mod( const wxString& _name )
{
	name = _name;
	wxString t;
	config->Read(wxT("/Mod/") + name +wxT("/dirData"), &t );
	dirData = t;
	
	ZeroInit();
	Load_Video_txt();
}
void SFUtils::ZeroInit( SFC::Function function, SFC::ArgDeclBase argDeclBase ) {
	std::string argDeclBaseName = argDeclBase.name();

	getSFCSymbolTable().push( argDeclBaseName, argDeclBase );

	SFC::DT sdt = argDeclBase.dt();
	if(!sdt)
		throw udm_exception("SFC::DT is null");

	std::string zeroInitStatement = ZeroInit( argDeclBase.dt(), argDeclBaseName, "" );
	mstat2SFC( function, zeroInitStatement, true );

	getSFCSymbolTable().clear();
}
示例#6
0
void
PokerHandHistory::ClearHistory(){
	ZeroInit();
	m_cDealer			= -1;
	m_cSmallBlind		= -1;
	m_cBigBlind			= -1;

	m_cTableCard1		= -1;
	m_cTableCard2		= -1;
	m_cTableCard3		= -1;
	m_cTableCard4		= -1;
	m_cTableCard5		= -1;

	m_pCurrentRound		= NULL;

	m_listSeats			.RemoveAll();
	m_listRounds		.RemoveAll();
	m_listWinners		.RemoveAll();
	}
示例#7
0
HXBOOL BrowserOpenURL(const char* pszUrl, const char* pszTarget, const char* pszDefBrowser) 
{
    HX_TRACE("BrowserOpenURL()\r\n");

    HXBOOL	result = TRUE;
    DWORD	dwResult = 0;
    HDDEDATA	hOpenRetVal = NULL;
    HSZ		hszOpenTopic = NULL;
    HSZ		hszOpenItem = NULL;
    HCONV	hOpenConv = NULL;
    HDDEDATA	hActivateRetVal = NULL;
    HSZ		hszActivateTopic = NULL;
    HSZ		hszActivateItem = NULL;
    HCONV	hActivateConv = NULL;
    UINT16	i = 0;
    UINT16	nNumberOfBrowsers = 0;
    char*	pMessage = NULL;
    DWORD	dwWindowID = 0xFFFFFFFF;	    // -1 = last active window
    DWORD	dwLockTimeout = 0;
    HXBOOL	bForceBroswserToForeground = FALSE;
    HXVERSIONINFO versionInfo;

    if (!pszUrl)
    {
	result = FALSE;
	goto cleanup;
    }

    pMessage = new char[strlen(pszUrl)+48];
    if (!pMessage)
    {
	result = FALSE;
	goto cleanup;
    }

    // handle pszTarget parameter according to:
    // https://common.helixcommunity.org/nonav/2003/HCS_SDK_r5/htmfiles/HyperNavigate.htm
    if (pszTarget && (0 == strcmp(pszTarget, "_new") || 0 == strcmp(pszTarget, "_blank")))
    {
        dwWindowID = 0;
    }

    ZeroInit(&versionInfo);
    HXGetWinVer(&versionInfo);
    bForceBroswserToForeground = ((versionInfo.dwPlatformId == HX_PLATFORM_WIN98) || (versionInfo.dwPlatformId == HX_PLATFORM_WINNT && versionInfo.wMajorVersion > 4));
    
    DDEStartup();

    // establish browser
    if (NULL == g_hszWWWService)
    {
	hszOpenTopic = DdeCreateStringHandle(g_dwIdInst, "WWW_OpenURL", CP_WINANSI);
	if (hszOpenTopic)
	{
	    nNumberOfBrowsers = sizeof(g_BrowsersSupportingDDE)/sizeof(DDE_Browsers);

	    // Look for a browser that supports DDE???
	    while (i < nNumberOfBrowsers)
	    {
		g_hszWWWService = DdeCreateStringHandle(g_dwIdInst,
						        g_BrowsersSupportingDDE[i].szDDEName,
							CP_WINANSI);

		hOpenConv = DdeConnect(g_dwIdInst, g_hszWWWService, hszOpenTopic, NULL);
		if (hOpenConv)
		{
		    break;
		}

		if(g_hszWWWService)
		{
		    DdeFreeStringHandle(g_dwIdInst, g_hszWWWService);
		    g_hszWWWService = NULL;  
		}

		i++;
	    }
	}

	if (NULL == g_hszWWWService)
	{
	    result = FALSE;
	    goto cleanup;
	}
    }
    else
    {
	hszOpenTopic = DdeCreateStringHandle(g_dwIdInst,"WWW_OpenURL", CP_WINANSI);
	hOpenConv = DdeConnect(g_dwIdInst, g_hszWWWService, hszOpenTopic, NULL);
    }

    if (!hOpenConv)
    {
	HX_TRACE("Conversation failed to start...\r\n");
	
	DdeFreeStringHandle(g_dwIdInst, g_hszWWWService);
	g_hszWWWService = NULL;

	result = FALSE;
	goto cleanup;
    }

    wsprintf(pMessage,"\"%s\",,%lu,0,,,,", pszUrl, dwWindowID); 
    hszOpenItem = DdeCreateStringHandle(g_dwIdInst, pMessage, CP_WINANSI);

    HX_TRACE("Conversation started, sending URL command...\r\n");

    // Request
    hOpenRetVal = DdeClientTransaction(NULL, 0, hOpenConv, hszOpenItem, CF_TEXT, XTYP_REQUEST, 60000, NULL);
    if (DDE_FNOTPROCESSED != hOpenRetVal)
    {
	DdeGetData(hOpenRetVal, (LPBYTE)&dwResult, sizeof(dwResult), 0);
	if (!dwResult)
	{
	    result = FALSE;
	    goto cleanup;
	}
    }

    // force the browser to the foreground then do it here.  This does not actually put the browser
    // in the foreground instead it enables the browser's call to SetForegroundWindow to bring the window to the
    // front instead of flashing it on the taskbar
    if (bForceBroswserToForeground)
    {
	// These are new flags that work on Win98 and WinNT5 ONLY.  First get the current foreground lock timeout and save
	// it off and then set it to 0.
	::SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT,0,&dwLockTimeout,0);
	::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,0,0);
    }

    // activate the browser
    wsprintf(pMessage, "%lu,0", dwWindowID); 
    hszActivateItem = DdeCreateStringHandle(g_dwIdInst, pMessage, CP_WINANSI);
    hszActivateTopic = DdeCreateStringHandle(g_dwIdInst,"WWW_Activate", CP_WINANSI);

    // Connect to server
    if (hszActivateTopic && hszActivateItem)
    {
	hActivateConv = DdeConnect(g_dwIdInst, g_hszWWWService, hszActivateTopic, NULL);
	if (hActivateConv)
	{
	    hActivateRetVal = DdeClientTransaction(NULL, 0, hActivateConv, hszActivateItem, CF_TEXT, XTYP_REQUEST, 10000, NULL);
	}
    }

    if (bForceBroswserToForeground)
    {
	// Restore the old foreground lock timeout
	::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,(PVOID)dwLockTimeout,0);
    }

cleanup:

    if (hOpenRetVal)
	DdeFreeDataHandle(hOpenRetVal);
    if (hActivateRetVal)
	DdeFreeDataHandle(hActivateRetVal);

    if (hszOpenTopic)
	DdeFreeStringHandle(g_dwIdInst, hszOpenTopic);    
    if (hszActivateTopic)
	DdeFreeStringHandle(g_dwIdInst, hszActivateTopic);    

    if (hszOpenItem)    
	DdeFreeStringHandle(g_dwIdInst, hszOpenItem);
    if (hszActivateItem)    
	DdeFreeStringHandle(g_dwIdInst, hszActivateItem);

    if (hOpenConv)
	DdeDisconnect(hOpenConv);
    if (hActivateConv)
	DdeDisconnect(hActivateConv);

    HX_VECTOR_DELETE(pMessage);
    
    DDEShutdown();

    return result;
}
示例#8
0
//-----------------------------------------------
Mod::Mod( const wxString& _name, const wxString& _dataDir )
{
	name = _name;
	dirData = _dataDir;
	ZeroInit();
}
示例#9
0
PokerBotInfo::PokerBotInfo(){
	ZeroInit();
	}