// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ GetCellHeight
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Returns the height of the cell
SInt32 CHierarchicalElement::GetCellHeight()
{
	if (IsInTable())
	{
		STableCell			cell;
		
		GetElementCell(cell);
		
		return GetTable()->GetRowHeight(cell.row);		
	}
	else
		SignalPStr_("\pCan't get cell height - not in a table.");

	return 0;
}
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ SetCellHeight
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Changes the height in the table of this cell
void CHierarchicalElement::SetCellHeight(
	SInt32			inNewRowHeight,
	bool			inRefresh)
{
	if (IsInTable())
	{
		SignalIf_(inNewRowHeight>0xFFFF);		// Row heights are measured as UInt16's from here on
		
		STableCell			cell;
		
		GetElementCell(cell);
		
		if (inNewRowHeight!=GetCellHeight())
			GetTable()->SetRowHeight(inNewRowHeight,cell.row,cell.row);
	}
}
bool CompilerMain::AddEntry(QString name, SymbolType type)
{
	if(IsInTable(name))
	{
		SetTempType(name,type);
		return false;
	}
	nextIDIndex++;
	qDebug()<<("Entry " + name + " is added to index " )<<nextIDIndex;
	//qDebug()<<("Next Token is " + name);

	SymbolEntry* entry = new SymbolEntry;
	entry->index = nextIDIndex;
	entry->name = name;
	entry->type = type;
	currentScope->AddEntry(entry);
	return true;
}
std::widestring CChainTraverser_CreateSummary::GetParaText()
{
	if (IsInTable())
	{
		if (HasContent(m_sTableParaText))
		{
			return m_sTableParaText;
		}
	}

	if ((x64_int_cast)m_sParaText.size()>0)
	{
		if (HasContent(m_sParaText))
		{
			return m_sParaText;
		}
	}

	return m_sPrevParaText;
}
void CommandPs(int ProcCount)
{
  int pid,pipefds[2]; 		// pole pre pipu
  int index;			// index v tabulke 			
  FILE *f;
  char line[150]; 		
  char UserName[25];  		

  if(pipe(pipefds) < 0){
    printf("Error: 'Nastala chyba pri vytvarani pipy.'\n");
    exit(1);
    }
    
  if((pid = fork()) < 0){
    printf("Error: 'Nastala chyba pri vytvarani dcerskeho procesu.'\n");
    exit(1);
    }
   
  // Nasleduje if pre dcersky proces
  if(pid == 0){				// child process
    close(1); 				// uzatvorenie standardneho vystupu
    if(dup(pipefds[1]) < 0){		// zduplikovanie citania rury
      printf("Error: 'Nastala chyba pri duplikovani handle.'\n");
      exit(1);
      }
    close(pipefds[1]);			// zatvorenie zapisu rury
    close(pipefds[0]);			// zatvorenia citania rury

    // spustenie prikazu ps
    execl("/bin/ps","ps","-aux",NULL);
      printf("Error: 'Nastala chyba pri spracovani prikazu 'ps'.'\n");
      exit(1);
    }
 
  // kod pre rodicovsky proces
 
  // printf("Debug: 'Pocet procesov: %d.\n",ProcCount);
  close(pipefds[1]);
  
  if((f= fdopen(pipefds[0],"r")) == NULL){  // prekonvertovanie handla (int) na (FILE *)
    printf("Error: 'Nastala chyba pri prekonvertovavani handle z int na FILE *.'\n");
    exit(1);
    }
  
  do{
    if(fgets(line,150,f) == NULL){
      if(feof(f) == 0){
        printf("Error: 'Nastala chyba pri nacitavani z rury.'\n");
        exit(0);
        }
      else{
        break;
	}
      }
           
    if (strstr(line,"USER")){		// odstranevie prveho riadku vypisu ps
      continue;
      }
    
    sscanf(line,"%s",UserName);		// meno pouzivatela
    
    if((index= IsInTable(UserName)) >= 0){	// ak je v tabulke  
//      printf("Debug: User '%s' je v tabulke pod indexom '%d'.\n",UserName,index);
      UserTab[index].ProcNo++;			// zvys pocet procesov
//      printf("Debug: Stav user %s - %d.\n",UserTab[index].UserName,UserTab[index].ProcNo);
      }
    else{
//      printf("Debug: User '%s' nie je v tabulke.\n",UserName);
      if((index= AddUser(UserName)) == -1){
        printf("Error: 'Tabulka uzivatelov je plna!!!'\n");
        exit(1);
        }
      // UserTab[index].ProcNo++;		// zvys pocet procesov
//      printf("Debug: Pridal sa novy user '%s' s indexom '%d' (%s,%d) (Last: %d).\n",UserName,index,UserTab[index].UserName,UserTab[index].ProcNo,LastUserIndex);
      }
    }while(! feof(f));
 
  fclose(f);			// uzavretie jednej strany rury

  // vypis pouzivatelov podla kriteria min poctu procesov
  for(index= 0; index < LastUserIndex; index++){
    if(UserTab[index].ProcNo > ProcCount){
      printf("Output: '<%s> <%d>'\n",UserTab[index].UserName,UserTab[index].ProcNo); 
      }
    }  
}