EXPORT void MESSAGE::PutList( int Begin, int End,BYTE FAR *Inf,WORD NumInform,WORD Num) { char txt[20]; if ( Begin > End ) return; sprintf(txt,"%hu",Num); PutList(Begin,End,Inf,NumInform,txt); memset(&Inf[Begin],0,End-Begin+1); }
void CScript::UpdateList(Ui::CList* list) { CBotVar *var; const char *progName, *funcName; int total, select, level, cursor1, cursor2, rank; if( m_botProg == 0 ) return; total = list->GetTotal(); select = list->GetSelect(); list->Flush(); // empty list m_botProg->GetRunPos(progName, cursor1, cursor2); if ( progName == 0 ) return; level = 0; rank = 0; while ( true ) { var = m_botProg->GetStackVars(funcName, level--); if ( funcName != progName ) break; PutList("", false, var, list, rank); } if ( total == list->GetTotal() ) // same total? { list->SetSelect(select); } list->SetTooltip(""); list->SetState(Ui::STATE_ENABLE); }
/*-----------------------------------------------------------------------*/ static void WritefLL(char * filename, t_LL list, void (*PutList)(t_LL l)) { if('-' == *filename) fileW = stdout; else if (NULL==( fileW = fopen(filename,"wb"))) AbortLL_M("WriteLL","fopen failed"); fprintf(fileW,"#LL"); PutList(list); fclose(fileW); }
EXPORT void MESSAGE::PutList( int Begin, int End,BYTE FAR *Inf,WORD NumInform) { PutList(Begin,End,Inf,NumInform,""); }
void PutList(const char *baseName, bool bArray, CBotVar *var, Ui::CList *list, int &rankList) { CBotString bs; CBotVar *svar, *pStatic; char varName[100]; char buffer[100]; const char *p; int index, type; if ( var == 0 && baseName[0] != 0 ) { sprintf(buffer, "%s = null;", baseName); list->SetItemName(rankList++, buffer); return; } index = 0; while ( var != 0 ) { var->Maj(NULL, false); pStatic = var->GetStaticVar(); // finds the static element bs = pStatic->GetName(); // variable name p = bs; //? if ( strcmp(p, "this") == 0 ) //? { //? var = var->GetNext(); //? continue; //? } if ( baseName[0] == 0 ) { sprintf(varName, "%s", p); } else { if ( bArray ) { sprintf(varName, "%s[%d]", baseName, index); } else { sprintf(varName, "%s.%s", baseName, p); } } type = pStatic->GetType(); if ( type < CBotTypBoolean ) { CBotString value; value = pStatic->GetValString(); p = value; sprintf(buffer, "%s = %s;", varName, p); list->SetItemName(rankList++, buffer); } else if ( type == CBotTypString ) { CBotString value; value = pStatic->GetValString(); p = value; sprintf(buffer, "%s = \"%s\";", varName, p); list->SetItemName(rankList++, buffer); } else if ( type == CBotTypArrayPointer ) { svar = pStatic->GetItemList(); PutList(varName, true, svar, list, rankList); } else if ( type == CBotTypClass || type == CBotTypPointer ) { svar = pStatic->GetItemList(); PutList(varName, false, svar, list, rankList); } else { sprintf(buffer, "%s = ?;", varName); list->SetItemName(rankList++, buffer); } index ++; var = var->GetNext(); } }