Beispiel #1
0
static void DumpHashTable( void )
/*******************************/
{
    if( LinkState & INTERNAL_DEBUG ) {
        DEBUG(( DBG_ALWAYS, "symbol table load" ));
        DumpTable( GlobalSymPtrs, GLOBAL_TABSIZE );
        DumpTable( StaticSymPtrs, STATIC_TABSIZE );
    }
}
Beispiel #2
0
wxString wxLuaCheckStack::DumpTable(const wxString &tablename, const wxString& msg)
{
    wxCHECK_MSG(m_luaState, wxEmptyString, wxT("Invalid lua_State"));

    lua_State* L = m_luaState;
    wxSortedArrayString tableArray;
    wxString s;

    // Allow iteration through table1.table2.table3...
    wxString tname(tablename);
    lua_pushglobaltable(L);

    do {
        lua_pushstring(L, wx2lua(tname.BeforeFirst(wxT('.'))));
        lua_rawget(L, -2);

        if (lua_isnil(L, -1) || !lua_istable(L, -1))
        {
            lua_pop(L, 2);  // remove table and value

            s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) Table: '%s' cannot be found!\n"), L, tablename.c_str());
            OutputMsg(s);
            return s;
        }

        lua_remove(L, -2);  // remove previous table
        tname = tname.AfterFirst(wxT('.'));
    } while (tname.Len() > 0);

    s = DumpTable(lua_gettop(L), tablename, msg, tableArray, 0);
    lua_pop(L, 1);

    return s;
}
Beispiel #3
0
wxString wxLuaCheckStack::DumpTable(int stack_idx, const wxString& msg)
{
    wxCHECK_MSG(m_luaState, wxEmptyString, wxT("Invalid lua_State"));

    wxSortedArrayString tableArray;

    return DumpTable(stack_idx, wxString::Format(wxT("StackIdx=%d"), stack_idx), msg, tableArray, 0);
}
Beispiel #4
0
wxString wxLuaCheckStack::DumpGlobals(const wxString& msg)
{
    wxCHECK_MSG(m_luaState, wxEmptyString, wxT("Invalid lua_State"));

    wxSortedArrayString tableArray;

    return DumpTable(LUA_GLOBALSINDEX, wxT("Globals"), msg, tableArray, 0);
}
Beispiel #5
0
int main(int argc, char *argv[])
{
    Init();
    TopDecls();
    Match('B');
    Fin();
    Block();
    DumpTable();
    return 0;
}
 bool DelayHistogram::
 CheckDumpTable(FILE * of) const
 {
   if (0 == oskip)
     return false;
   ++m_iteration;
   if (0 == (m_iteration % oskip))
     return DumpTable(of);
   return false;
 }
Beispiel #7
0
CScriptVal CProfileViewer::SaveToJS(ScriptInterface& scriptInterface)
{
    CScriptVal root;
    scriptInterface.Eval("({})", root);

    std::vector<AbstractProfileTable*> tables = m->rootTables;
    sort(tables.begin(), tables.end(), SortByName);
    for_each(tables.begin(), tables.end(), DumpTable(scriptInterface, root));

    return root;
}
Beispiel #8
0
std::string PlayerDumpWriter::GetDump(uint32 guid)
{
    std::string dump;
    for(int i = 0; i < DUMP_TABLE_COUNT; i++)
        DumpTable(dump, guid, dumpTables[i].name, dumpTables[i].name, dumpTables[i].type);

    // TODO: Add instance/group..
    // TODO: Add a dump level option to skip some non-important tables

    return dump;
}
Beispiel #9
0
bool PlayerDumpWriter::GetDump(uint32 guid, std::string &dump)
{
    dump =  "IMPORTANT NOTE: THIS DUMPFILE IS MADE FOR USE WITH THE 'PDUMP' COMMAND ONLY - EITHER THROUGH INGAME CHAT OR ON CONSOLE!\n";
    dump += "IMPORTANT NOTE: DO NOT apply it directly - it will irreversibly DAMAGE and CORRUPT your database! You have been warned!\n\n";

    for (int i = 0; i < DUMP_TABLE_COUNT; ++i)
        if (!DumpTable(dump, guid, dumpTables[i].name, dumpTables[i].name, dumpTables[i].type))
            return false;

    /// @todo Add instance/group..
    /// @todo Add a dump level option to skip some non-important tables

    return true;
}
Beispiel #10
0
JS::Value CProfileViewer::SaveToJS(ScriptInterface& scriptInterface)
{
	JSContext* cx = scriptInterface.GetContext();
	JSAutoRequest rq(cx);
		
	JS::RootedValue root(cx);
	scriptInterface.Eval("({})", &root);

	std::vector<AbstractProfileTable*> tables = m->rootTables;
	sort(tables.begin(), tables.end(), SortByName);
	for_each(tables.begin(), tables.end(), DumpTable(scriptInterface, root));

	return root;
}
Beispiel #11
0
	// function: dumpTable
	//		This function will dump a specific table.
	//
	// Parameters:
	//
	//		std::string - The filename to dump to
	//		std::string - The table to dump
	//		int - The bitflags of things to dump. See the global DUMP table.
	//
	// Returns:
	//		None
	static int GM_CDECL gmfDumpTable( gmThread *a_thread )
	{
		if ( GM_NUM_PARAMS > 3 )
		{
			GM_EXCEPTION_MSG( "expecting 2 - 3 parameters" );
			return GM_EXCEPTION;
		}

		GM_CHECK_STRING_PARAM( filename, 0 );
		GM_CHECK_STRING_PARAM( tablename, 1 );
		int iFlags = a_thread->ParamInt( 2, gmUtility::DUMP_ALL );
		DumpTable( a_thread->GetMachine(), filename, tablename, iFlags );

		return GM_OK;
	}
Beispiel #12
0
std::string PlayerDumpWriter::GetDump(uint32 guid)
{
    std::string dump;

    dump += "IMPORTANT NOTE: This sql queries not created for apply directly, use '.pdump load' command in console or client chat instead.\n";
    dump += "IMPORTANT NOTE: NOT APPLY ITS DIRECTLY to character DB or you will DAMAGE and CORRUPT character DB\n\n";

    for (int i = 0; i < DUMP_TABLE_COUNT; ++i)
        DumpTable(dump, guid, dumpTables[i].name, dumpTables[i].name, dumpTables[i].type);

    // @todo Add instance/group..
    // @todo Add a dump level option to skip some non-important tables

    return dump;
}
Beispiel #13
0
std::string PlayerDumpWriter::GetDump(uint32 guid)
{
    std::string dump;

    dump += "IMPORTANT NOTE: This sql queries not created for apply directly, use '.pdump load' command in console or client chat instead.\n";
    dump += "IMPORTANT NOTE: NOT APPLY ITS DIRECTLY to character DB or you will DAMAGE and CORRUPT character DB\n\n";

    // revision check guard
    /*
    QueryNamedResult* result = CharacterDatabase.QueryNamed("SELECT * FROM character_db_version LIMIT 1");
    if (result)
    {
        QueryFieldNames const& namesMap = result->GetFieldNames();
        std::string reqName;
        for (QueryFieldNames::const_iterator itr = namesMap.begin(); itr != namesMap.end(); ++itr)
        {
            if (itr->substr(0,9)=="required_")
            {
                reqName = *itr;
                break;
            }
        }

        if (!reqName.empty())
        {
            // this will fail at wrong character DB version
            dump += "UPDATE character_db_version SET "+reqName+" = 1 WHERE FALSE;\n\n";
        }
        else
            sLog.outError("Table 'character_db_version' not have revision guard field, revision guard query not added to pdump.");

        delete result;
    }
    else
        sLog.outError("Character DB not have 'character_db_version' table, revision guard query not added to pdump.");
    */
    for (int i = 0; i < DUMP_TABLE_COUNT; ++i)
        DumpTable(dump, guid, dumpTables[i].name, dumpTables[i].name, dumpTables[i].type);

    // TODO: Add instance/group..
    // TODO: Add a dump level option to skip some non-important tables

    return dump;
}
Beispiel #14
0
/*************************************************************************
*   Scatter plot
*/
int NumstatHandleSplotI(NUMSTAT *nsPO)
{
    int i,r,c,nrow,ncol;
    DOUB fD,sD;
    char labS[DEF_BS],numS[DEF_BS],formS[DEF_BS];
    HISTOGRAM *fhisPO, *shisPO;
    TABLE *tabPO;

    NumlistToHistogramI(nsPO->vals, -1.0, BAD_D, BAD_D, &fhisPO);
    NumlistToHistogramI(nsPO->svals, -1.0, BAD_D, BAD_D, &shisPO);
    ncol = GetHistogramNumBinsI(fhisPO);
    nrow = GetHistogramNumBinsI(shisPO);
    tabPO = CreateTablePO(nrow, ncol);
    if(!tabPO) {
        CHECK_HISTOGRAM(fhisPO); CHECK_HISTOGRAM(shisPO);
        return(FALSE);
    }
    /***
    *   Set lables
    */
    HistogramAutoFormatStringI(fhisPO,formS);
    for(c=0;c<ncol;c++) 
    {
        HistogramValuesForBinI(fhisPO, c, NULL, &fD, NULL);
        sprintf(numS,formS,fD);
        sprintf(labS,"C_%s",numS);
        ReplaceChars(' ',labS,'_',labS);
        SetTableColLabI(tabPO,c,labS);
    }
    HistogramAutoFormatStringI(shisPO,formS);
    for(r=0; r<nrow; r++)
    {
        HistogramValuesForBinI(shisPO, r, NULL, &fD, NULL);
        sprintf(numS,formS,fD);
        sprintf(labS,"Row_%s",numS);
        ReplaceChars(' ',labS,'_',labS);
        /* HAM? Why -2  *
        SetTableRowLabI(tabPO,nrow - r -2,labS);
        */
        SetTableRowLabI(tabPO,nrow - r -1,labS);
    }
    /***
    *   Fill table values
    */
    for(i=0; i<nsPO->num; i++)
    {
        GetNumlistDoubI(nsPO->vals,i,&fD);
        GetNumlistDoubI(nsPO->svals,i,&sD);
        HistogramBinForValueI(fhisPO, fD, &c, NULL,NULL);
        HistogramBinForValueI(shisPO, sD, &r, NULL,NULL);
        /* HAM? Why -2  *
        r = nrow - r - 2;
        */
        r = nrow - r - 1;
        GetTableValI(tabPO,r,c,&fD);
        fD += 1.0;
        SetTableValI(tabPO,r,c,fD);
    }
    fprintf(nsPO->out,"%s#\n",nsPO->echo);
    AutoTableOutFormattingI(tabPO, TRUE, FALSE);
    DumpTable(tabPO,FALSE,FALSE,nsPO->out);
    /***
    *   Clean up 
    */
    CHECK_TABLE(tabPO);
    CHECK_HISTOGRAM(fhisPO); CHECK_HISTOGRAM(shisPO);
    return(TRUE);
}
Beispiel #15
0
wxString wxLuaCheckStack::DumpTable(int stack_idx, const wxString& tablename, const wxString& msg, wxSortedArrayString& tableArray, int indent)
{
    wxCHECK_MSG(m_luaState, wxEmptyString, wxT("Invalid lua_State"));

    lua_State* L = m_luaState;
    wxLuaState wxlState(L);
    wxString indentStr;
    wxString s;

    // We only do tables, return error message
    if (!lua_istable(L, stack_idx))
    {
        s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) stack idx %d is not a table.\n"), L, stack_idx);
        OutputMsg(s);
        return s;
    }

    if (indent == 0)
    {
        // First time through print header
        s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) Table: '%s'\n"), L, tablename.c_str());
        OutputMsg(s);
    }
    else if (indent > 10)
    {
        // Don't let things get out of hand...
        s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) Table depth > 10! Truncating: '%s'\n"), L, tablename.c_str());
        OutputMsg(s);
        return s;
    }
    else
    {
        indentStr = wxString(wxT(' '), indent*2) + wxT(">");
    }

    wxString title = wxString::Format(wxT("%sTable Level %d : name '%s'\n"), indentStr.c_str(), indent, tablename.c_str());
    s += title;
    OutputMsg(title);

    lua_pushvalue(L, stack_idx); // push the table to read the top of the stack

    lua_pushnil(L);
    while (lua_next(L, -2) != 0)
    {
        int keyType = 0, valueType = 0;
        wxString key, value;

        wxLuaDebugData::GetTypeValue(L, -2, &keyType,   key);
        wxLuaDebugData::GetTypeValue(L, -1, &valueType, value);

        wxString info = wxString::Format(wxT("%s%-32s\t%-16s\t%-20s\t%-16s\n"),
                indentStr.c_str(), key.c_str(), wxluaT_typename(L, keyType).c_str(), value.c_str(), wxluaT_typename(L, valueType).c_str());
        s += info;
        OutputMsg(info);

        if (tableArray.Index(value) == wxNOT_FOUND)
        {
            if (valueType == WXLUA_TTABLE)
            {
                tableArray.Add(value);
                s += DumpTable(lua_gettop(L), tablename + wxT(".") + key, msg, tableArray, indent+1);
            }
            else
            {
                tableArray.Add(value);
            }
        }

        lua_pop(L, 1); // pop value
    }

    lua_pop(L, 1); // pop pushed table

    return s;
}
Beispiel #16
0
int NumlistMutInfoI(NUMLIST *nums1PO, NUMLIST *nums2PO, int maxb, DOUB *minfPD, 
    int *nb1PI, int *nb2PI)
{
    int i,r,c,n,nrow,ncol,dis_bin;
    DOUB vD, bin1D, bin2D, st1D, st2D, en1D, en2D, infoD;
    HISTOGRAM *his1PO, *his2PO;
    TABLE *tabPO;

    DB_MINF DB_PrI(">> NumlistMutInfoI maxb=%d\n",maxb);
    VALIDATE(nums1PO,NUMLIST_ID);
    VALIDATE(nums2PO,NUMLIST_ID);
    if( !NumlistSameLenI(nums1PO,nums2PO) ) {
        DB_MINF DB_PrI("<< NumlistMutInfoI not same len FALSE\n");
        return(FALSE);
    }
    n = GetNumlistLengthI(nums1PO);
    DB_MINF DB_PrI("+ number lists %d long\n",n);
    /***
    *   Get histograms from number lists
    */
    dis_bin = FALSE;
    NumlistNaturalHistBinI(nums1PO, maxb, dis_bin, &bin1D, &st1D, &en1D);
    NumlistNaturalHistBinI(nums2PO, maxb, dis_bin, &bin2D, &st2D, &en2D);
    DB_MINF DB_PrI("+ Hist1 bin=%f st=%f en=%f\n",bin1D,st1D,en1D);
    DB_MINF DB_PrI("+ Hist2 bin=%f st=%f en=%f\n",bin2D,st2D,en2D);
    his1PO = his2PO = NULL;
    NumlistToHistogramI(nums1PO, bin1D, st1D, en1D, &his1PO);
    NumlistToHistogramI(nums2PO, bin2D, st2D, en2D, &his2PO);
    if( (!his1PO) || (!his2PO) ) {
        CHECK_HISTOGRAM(his1PO);
        CHECK_HISTOGRAM(his2PO);
        DB_MINF DB_PrI("<< NumlistMutInfoI nums to histograms %p %p FALSE\n",his1PO,his2PO);
        return(FALSE);
    }
    nrow = GetHistogramNumBinsI(his1PO);
    ncol = GetHistogramNumBinsI(his2PO);
    DB_MINF DB_PrI("+ histogram bins nrow=%d ncol=%d\n",nrow,ncol);
    if( (nrow < 2) || (ncol < 2) ) {
        CHECK_HISTOGRAM(his1PO);
        CHECK_HISTOGRAM(his2PO);
        DB_MINF DB_PrI("<< NumlistMutInfoI not enough bins FALSE\n");
        return(FALSE);
    }
    /***
    *   Allocate space
    */
    tabPO = CreateTablePO(nrow, ncol);
    if( !tabPO ) {
        CHECK_HISTOGRAM(his1PO);
        CHECK_HISTOGRAM(his2PO);
        DB_MINF DB_PrI("<< NumlistMutInfoI failed table space FALSE\n");
        return(FALSE);
    }
    /***
    *   Fill joint probabilities from pairwise screen of input data
    */
    for(i=0;i<n;i++)
    {
        GetNumlistIntDoubI(nums1PO,i,NULL,&vD);
        HistogramBinForValueI(his1PO, vD, &r, NULL,NULL);
        GetNumlistIntDoubI(nums2PO,i,NULL,&vD);
        HistogramBinForValueI(his2PO, vD, &c, NULL,NULL);
        GetTableValI(tabPO,r,c,&vD);
        vD += 1.0;
        SetTableValI(tabPO,r,c,vD);
    }

    DB_MINF {
        printf("\n xxxxxxxxxxxxxxxxxxxxxx\n");
        DumpNumlist(his1PO->bins,-1,-1, NULL, NULL);
        DumpNumlist(his2PO->bins,-1,-1, NULL, NULL);
        AutoTableOutFormattingI(tabPO,TRUE,TRUE);
        DumpTable(tabPO,TRUE,FALSE,NULL);
    }

    /***
    *   Now the info
    */
    infoD = 0.0;
    for(r=0;r<nrow;r++)
    {
        GetNumlistIntDoubI(his1PO->bins,r,NULL,&bin1D);
        bin1D = bin1D / DNUM(n);
        for(c=0;c<ncol;c++)
        {
            GetTableValI(tabPO,r,c,&vD);
            if(vD == 0.0) {
                continue;
            }
            vD = vD / DNUM(n);

            GetNumlistIntDoubI(his2PO->bins,c,NULL,&bin2D);
            bin2D = bin2D / DNUM(n);

/*
printf("[%d][%d]\tbin1=%f\tbin2=%f\tv=%f",r,c,bin1D,bin2D,vD);
*/
            vD = vD * LOG_2(vD / (bin1D * bin2D));
            infoD += vD;
/*
printf("\tV=%f\tinfo=%f\n",vD,infoD);
*/

            SetTableValI(tabPO,r,c,vD);
        }
    }

    DB_MINF {
        AutoTableOutFormattingI(tabPO,TRUE,TRUE);
        DumpTable(tabPO,TRUE,FALSE,NULL);
    }

    DB_MINF DB_PrI("+ info = %f\n",infoD);
    /***
    *   Set values and clean up
    */
    if(nb1PI) {
        *nb1PI = nrow;
    }
    if(nb2PI) {
        *nb2PI = ncol;
    }
    if(minfPD) {
        *minfPD = infoD;
    }
    CHECK_TABLE(tabPO);
    CHECK_HISTOGRAM(his1PO);
    CHECK_HISTOGRAM(his2PO);
    DB_MINF DB_PrI("<< NumlistMutInfoI TRUE\n");
    return(TRUE);
}