Exemple #1
0
void electromagnetica::draw(){
        //
    
    ofBackground(0);
    
    ofEnableAlphaBlending();
    ofEnableBlendMode(OF_BLENDMODE_SCREEN);
    ofPushMatrix(); //colocamos el canvas en su posicion centrada
    //post.begin();
        ofTranslate((ofGetWidth()-W_WIDTH)/2, 0);
       // drawNoise();
    
        ofNoFill();
        //ofEllipse(W_WIDTH/2, W_WIDTH/2, W_WIDTH, W_WIDTH);
       //
        ofPushMatrix();

            meshParticles.setMode(OF_PRIMITIVE_POINTS);
                meshAux.setMode(OF_PRIMITIVE_POINTS);
            glPointSize(2);
            glEnable(GL_POINT_SMOOTH);	// Para que sean puntos redondos
            ofEnableDepthTest();

            meshParticles.draw();
            meshAux.draw();

            ofDisableDepthTest();
            ofSetColor(255,0,0);
            ofFill();
        if(drawlines) wavesm.draw();

        ofPopMatrix();
        hands.draw();
    
        ofPushMatrix();
            //ofTranslate(200,200);
       // drawEM();
        ofPopMatrix();
    //post.end();
    ofPopMatrix();
  

    ofDisableBlendMode();
    ofDisableAlphaBlending();
    borde.draw();
    if(bdrawDebug)    showDebug();
    
  /*  //wavesm.debugInfo();
    ofPushStyle();
	ofSetColor(255,255,255);
	ofDrawBitmapString("fr: " + ofToString(ofGetFrameRate()), 50, ofGetHeight()-90);
	ofPopStyle();
   
   
*/
}
// =======================================================
int CSaveOptWindow::getValues(COptions *options)
{
  BEGIN;

  // get options
  options->bAskDesc = (newtCheckboxGetValue(m_checkAskDesc) == 'X');
  options->bCheckBeforeSaving = (newtCheckboxGetValue(m_checkCheckBeforeSaving) == 'X');
  options->bOverwrite = (newtCheckboxGetValue(m_checkOverwrite) == 'X');
  options->bSplitWait = (newtCheckboxGetValue(m_checkSplitWait) == 'X');
  
  // get compression level
  if (newtRadioGetCurrent(m_radioCompNone) == m_radioCompNone)
    options->dwCompression = COMPRESS_NONE;
  else if (newtRadioGetCurrent(m_radioCompNone) == m_radioCompGzip)
    options->dwCompression = COMPRESS_GZIP;
  else if (newtRadioGetCurrent(m_radioCompNone) == m_radioCompBzip2)
    options->dwCompression = COMPRESS_BZIP2;
  
  // get finish level
  if (newtRadioGetCurrent(m_radioFinishWait) == m_radioFinishWait)
    options->dwFinish = FINISH_WAIT;
  else if (newtRadioGetCurrent(m_radioFinishWait) == m_radioFinishHalt)
    options->dwFinish = FINISH_HALT;
  else if (newtRadioGetCurrent(m_radioFinishWait) == m_radioFinishReboot)
    options->dwFinish = FINISH_REBOOT;
  else if (newtRadioGetCurrent(m_radioFinishWait) == m_radioFinishQuit)
    options->dwFinish = FINISH_QUIT;
  else if (newtRadioGetCurrent(m_radioFinishWait) == m_radioFinishLast)
    options->dwFinish = FINISH_LAST;
  
  // get split mode
  if (newtRadioGetCurrent(m_radioSplitAuto) == m_radioSplitAuto)
    options->qwSplitSize = 0LL;//options->dwSplitMode = SPLIT_AUTO;
  else if (newtRadioGetCurrent(m_radioSplitAuto) == m_radioSplitSize)
    {	
      //options->dwSplitMode = SPLIT_SIZE;
#ifdef HAVE_ATOLL
      options->qwSplitSize = atoll(newtEntryGetValue(m_editSplitSize)) * 1024 * 1024;
#else
  #ifdef HAVE_STRTOLL
      options->qwSplitSize = strtoll(newtEntryGetValue(m_editSplitSize), 
         NULL, 10) * 1024 * 1024;
  #else
    #error "no function to convert string to long long int"
  #endif // HAVE_STRTOLL
#endif // HAVE_ATOLL
      showDebug(1, "qwSplitSize = %llu\n", options->qwSplitSize);
    }
  /*else if (newtRadioGetCurrent(m_radioSplitNone) == m_radioSplitAuto)
    {
      options->dwSplitMode = SPLIT_AUTO;
      options->dwSplitSize = 0;
    }*/
  
  RETURN_int(0);
}
// =======================================================
void CPartimagedClients::Release(unsigned int client)
{
  pthread_mutex_lock(&mClients);
  showDebug(1, "%d released\n", client);
  shutdown(Clients[client].Sock, SHUT_RDWR);
  Clients[client].Sock = 0;
  Clients[client].Present = false;
  Clients[client].MyPid = 0;
  pthread_mutex_unlock(&mClients);
}
/*
  Properties and methods
*/
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accDoDefaultAction(VARIANT varID)
{
    showDebug(__FUNCTION__, accessible);
    if (!accessible->isValid())
        return E_FAIL;

    AccessibleElement elem(varID.lVal, accessible);
    const bool res = elem.iface ? elem.iface->doAction(DefaultAction, elem.entry, QVariantList()) : false;
    return res ? S_OK : S_FALSE;
}
/*
  Properties and methods
*/
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accDoDefaultAction(VARIANT varID)
{
#ifdef DEBUG_SHOW_ATCLIENT_COMMANDS
    showDebug(__FUNCTION__, accessible);
#endif //DEBUG_SHOW_ATCLIENT_COMMANDS
    if (!accessible->isValid())
        return E_FAIL;

    return accessible->doAction(DefaultAction, varID.lVal, QVariantList()) ? S_OK : S_FALSE;
}
Exemple #6
0
// =======================================================
int CImageDisk::destroySpaceFile() // [Main-Thread]
{
  int nRes;

  showDebug(1, "DESTROY SPACE FILE [%s]\n", m_szSpaceFilename);

  //newtWinMessage("before","b","erase %s", m_szSpaceFilename);
  nRes = unlink(m_szSpaceFilename);
  //newtWinMessage("after","b","erase %s", m_szSpaceFilename);
  return nRes;
}
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accState(VARIANT varID, VARIANT *pvarState)
{
    showDebug(__FUNCTION__, accessible);
    if (!accessible->isValid())
        return E_FAIL;

    (*pvarState).vt = VT_I4;
    AccessibleElement elem(varID.lVal, accessible);
    (*pvarState).lVal = elem.iface ? elem.iface->state(elem.entry) : State(Normal);
    return S_OK;
}
// =======================================================
unsigned int CPartimagedClients::New()
{
  unsigned int next = 0;
  bool found = false;

  showDebug(1, "create new clients\n");
  pthread_mutex_lock(&mClients);
  while (!found && next < g_uiNbClients)
    {
      if (!Clients[next].Present)
        found = true;
      else
        next++;
    }

  Clients[next].Present = true;
  pthread_mutex_unlock(&mClients);
  showDebug(1, "new clients created : %d\n", next);
  return found ? next : g_uiNbClients;
}
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accChildCount(long* pcountChildren)
{
#ifdef DEBUG_SHOW_ATCLIENT_COMMANDS
    showDebug(__FUNCTION__, accessible);
#endif //DEBUG_SHOW_ATCLIENT_COMMANDS
    if (!accessible->isValid())
        return E_FAIL;

    *pcountChildren = accessible->childCount();
    return S_OK;
}
Exemple #10
0
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accState(VARIANT varID, VARIANT *pvarState)
{
#ifdef DEBUG_SHOW_ATCLIENT_COMMANDS
    showDebug(__FUNCTION__, accessible);
#endif //DEBUG_SHOW_ATCLIENT_COMMANDS
    if (!accessible->isValid())
        return E_FAIL;

    (*pvarState).vt = VT_I4;
    (*pvarState).lVal = accessible->state(varID.lVal);
    return S_OK;
}
Exemple #11
0
// =======================================================
// flag = LOCK_SH | LOCK_EX if called when restoring or saving 
int CImageDisk::lockImage(int flag, int nFd, char *szFilename) // [Main-Thread]
{
#ifndef DEVEL_SUPPORT
  int nRes;

  errno = 0;

  if (flag != LOCK_SH && flag != LOCK_EX)
    {
      showDebug(1, "LOCK flag is %d\n", flag);
      RETURN_int(-1);
    }

  nRes = flock(m_nImageFd, flag | LOCK_NB);
  if (nRes == -1)
    RETURN_int(-1);
  showDebug(4, "LOCK file %s\n", m_szImageFilename);
#endif // DEVEL_SUPPORT

  return 0;
}
Exemple #12
0
TERMINAL_ACT_INFO* GetNextNameClass::GetName(const FN_STATE_ACT_LIST* period_info,
										TERMINAL_ACT_LIST* act_list,int &current_pos,int time_pos)
{
	FNDWORD k = 0;//
	if (period_info == NULL)
	{
		showWarning("时间表为空,请检查时间表\n");
		return NULL;
	}
	
	if (act_list == NULL)
	{
		showWarning("节目表为空,请检查节目表\n");
		return NULL;
	}
	
	if(period_info->dwSectionCnt == 0)
	{
		showWarning("节目表时段数量为0\n");
		return NULL;
	}
	
	if(time_pos >= (int)period_info->dwSectionCnt && time_pos < 0)
	{
		showWarning("当前时间在时间表时段内越界\n");
		return NULL;
	}

	current_pos = current_pos + 1;
	if(current_pos >= (int)period_info->SectionList[time_pos].dwActCnt)//循环播放
	{
		current_pos=0;
	}
	 showDebug("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-40\n");
	//获取到一个播放的节目号,还要通过这个号码在节目表中找到具体的节目
	k = period_info->SectionList[time_pos].dwActList[current_pos];

	for(FNDWORD i=0;i<act_list->dwActNum;i++)
	{
	
		if(act_list->ActList[i].sActInfo.dwActID == k)
		{
			act_endtime = period_info->SectionList[time_pos].dwEndTime;
			return &act_list->ActList[i];
		
		}

	}
	
	showWarning("获取节目%u失败,当前时段为%u\n",k,time_pos );
	act_endtime = 0;
	return NULL;
}
Exemple #13
0
// =======================================================
static void catch_sigchild(int signal_number)
{
  int status;
  int iClientPid;

  while( (iClientPid = waitpid (-1, &status, WNOHANG)) > 0)
    {
	  showDebug(1, "Releasing client by pid : %d\n", iClientPid);
      g_Server->ReleaseClientByPid(iClientPid);
      // Save last child exit status in global variable
      child_exit_status = status;
	}
}
Exemple #14
0
// =======================================================
void CImageDisk::get_qwCurrentVolumeSize(QWORD *qwSize) // [Main-Thread]
{
  //struct stat fStat;

  if (m_bIsOpened == false)
    {
      showDebug(3, "Failed: m_bIsOpened == false\n");
      THROW( ERR_OPENED);
    }

  errno = 0;
  *qwSize = m_qwVolSize;
}
Exemple #15
0
// =======================================================
void CImageNet::Connect(COptions * options, char * login, char * passwd,
   char * server, int port)
{
  int nRes;
  lock(__LINE__);
  try { netcl -> Connect(server, port); }
  catch ( CExceptions * excep )
    {
      unlock();
      throw excep;
    }
  nRes = netcl -> SendPass(login, passwd);
  if (nRes)
    {
      unlock();
      showDebug(1, "return from SendPass: failed (%d)\n", nRes);
      THROW(ERR_PASSWD);
    }
  netcl -> Send(options, sizeof(COptions));
  unlock();
  showDebug(9, "return from SendPass: success\n");
}
Exemple #16
0
// =======================================================
void CXfsPart::readBitmap(COptions *options)
{
  BEGIN;

  int nRes;
  DWORD i;
  QWORD j;
  xfs_agf agf;

  // init bitmap -> all blocks marked as used (1)
  m_bitmap.init(m_header.qwBitmapSize+1024);
  for (j=0; j < m_header.qwBlocksCount; j++)
    m_bitmap.setBit(j, true);

  // ---- process allocation groups
  
  // 1. go to the beginning of the disk
  nRes = fseek(m_fDeviceFile, 0, SEEK_SET);
  if (nRes == -1)
    THROW(ERR_ERRNO, errno);

  // 2. loop for each AG of the file system
  for (i=0; i < m_info.dwAgCount; i++)
    {
      nRes = readData(&agf, convertAgToDaddr(i, XFS_AGF_DADDR), sizeof(xfs_agf));
      if (nRes == -1)
	THROW(ERR_ERRNO, errno);

      if (((DWORD)BeToCpu(agf.agf_magicnum)) != XFS_AGF_MAGIC)
	{
	  g_interface -> ErrorReadingSuperblock(errno);
	  THROW(ERR_READING, (DWORD)0, errno);
	}

      showDebug(3, "\n\n== ALLOCATION GROUP %lu ===\nagf_flfirst=%lu\nagf_fllast=%lu\nagf_flcount=%lu\nagf_freeblks=%lu\nagf_longest=%lu\n"
		"agf_roots[0]=%lu and agf_roots[1]=%lu\nagf_levels[0]=%lu and agf_levels[1]=%lu\n", (DWORD)i, 
		(DWORD)BeToCpu(agf.agf_flfirst), (DWORD)BeToCpu(agf.agf_fllast), 
		(DWORD)BeToCpu(agf.agf_flcount), (DWORD)BeToCpu(agf.agf_freeblks), 
		(DWORD)BeToCpu(agf.agf_longest), (DWORD)BeToCpu(agf.agf_roots[0]), 
		(DWORD)BeToCpu(agf.agf_roots[1]), (DWORD)BeToCpu(agf.agf_levels[0]), 
		(DWORD)BeToCpu(agf.agf_levels[1]));

      scanFreelist(&agf);
      scanSbtree(&agf, BeToCpu(agf.agf_roots[XFS_BTNUM_BNO]), BeToCpu(agf.agf_levels[XFS_BTNUM_BNO]));
    }
  
  // fill informations about free/used clusters count
  calculateSpaceFromBitmap();

  RETURN;
}			
Exemple #17
0
// ================================================
CNetServer::~CNetServer()
{
  showDebug(1, "cns detroyed\n");
  delete Clients;
/*
#ifdef HAVE_SSL
  for (unsigned int i = 0; i < nb_clients; i++)
    if (idf_clients[i].ssl)
      SSL_free(idf_clients[i].ssl);
  if (ctx)
    SSL_CTX_free(ctx);
#endif
*/
}
Exemple #18
0
// =======================================================
// may raise ERR_OPENED, ERR_EOF
DWORD CImageDisk::read(void *buf, DWORD dwLength) // [Buffer-Thread]
{
  if (m_bIsOpened == false)
    THROW(ERR_OPENED);

  DWORD dwRes;
  errno = 0;
  
  // ****************************************

  //clearerr(m_fImageFile);
  dwRes = fread(buf, 1, dwLength, m_fImageFile);

  if (dwRes < dwLength)
    {
      showDebug(1, "EOF: dwRes=%lu and dwLength=%lu: MISSING: %lu\n", dwRes, dwLength, dwLength-dwRes);
    }

  m_qwTotal += (QWORD) dwRes; //dwLength;
  showDebug(1, "cid: %ld ; m_qwTotal = %lld\n", dwRes, m_qwTotal);

  return dwRes; // important: must return dwRes even if EOF reached
}
// =======================================================
unsigned int CPartimagedClients::SetClientPid(unsigned int client, unsigned int client_pid)
{
  unsigned int ret = 0; 
  
  pthread_mutex_lock(&mClients);
  showDebug(1, "client %d pid = %d set\n", client, client_pid);
  if (Clients[client].Present)
    {
      Clients[client].MyPid = client_pid;
	  ret = 1;
    }
  pthread_mutex_unlock(&mClients);
  return ret;
}
Exemple #20
0
Light::Light(const string &entityName):Entity()
{
	LOG(FORMAT("Loading new entity `%1%` of type `%2%`", entityName % type()));

	mEntityName = entityName;

	// TODO: Load not Error mesh in Light class (get some other mesh type)
	mLight = graphicSystem.getSceneMgr()->createLight("Light:" + entityName);
	mDebugEntity = graphicSystem.getSceneMgr()->createEntity("LightMesh:" + entityName, CONFIG("resorces.LightMesh", string, "Engine/Light.mesh"));
	mNode = graphicSystem.getSceneMgr()->getRootSceneNode()->createChildSceneNode("Node:" + entityName);

	showDebug(true);
    mNode->attachObject(mLight);
}
Exemple #21
0
// =======================================================
QWORD generateIdentificator()
{
  QWORD qwResult;
  int i;
  unsigned char *ptr;

  ptr = (unsigned char *) &qwResult;
  qwResult = time(NULL);
  
  for (i=0; i < (int)sizeof(qwResult); i++)
    ptr[i] ^= getpid();

  showDebug(3, "generateIdentificator() = %llu = %Xh\n", qwResult, qwResult);
  return qwResult;
}
Exemple #22
0
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accDefaultAction(VARIANT varID, BSTR* pszDefaultAction)
{
    Q_UNUSED(varID);
    showDebug(__FUNCTION__, accessible);
    if (!accessible->isValid())
        return E_FAIL;

    *pszDefaultAction = 0;
    if (QAccessibleActionInterface *actionIface = accessible->actionInterface()) {
        const QString def = actionIface->actionNames().value(0);
        if (!def.isEmpty())
            *pszDefaultAction = QStringToBSTR(def);
    }
    return *pszDefaultAction ? S_OK : S_FALSE;
}
Exemple #23
0
// =======================================================
void CXfsPart::addToHist(DWORD dwAgNo, DWORD dwAgBlockNo, QWORD qwLen)
{
  BEGIN;

  QWORD i;
  QWORD qwBase;

  showDebug(3, "%8d %8d %8llu\n", dwAgNo, dwAgBlockNo, qwLen);
  qwBase = (((QWORD)dwAgNo) * ((QWORD)m_info.dwAgBlocksCount)) + ((QWORD)dwAgBlockNo);

  for (i=0; i < qwLen; i++)
    m_bitmap.setBit(qwBase+i, false);

  RETURN;
}
Exemple #24
0
// =======================================================
void CInterface::showError(signed int nErr, char *szFormat, ...)
{
  va_list args;
  char szText[4096];

  // format text
  va_start(args, szFormat);
  vsnprintf(szText, sizeof(szText), szFormat, args);
  va_end(args);

  showDebug(1, "showError: [%s]\n", szText);

  if (!m_bBatchMode)
    msgBoxCancel(i18n("Error"), "%s", szText);
}
Exemple #25
0
/*
  Properties and methods
*/
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accDoDefaultAction(VARIANT varID)
{
    Q_UNUSED(varID);
    showDebug(__FUNCTION__, accessible);
    if (!accessible->isValid())
        return E_FAIL;

    if (QAccessibleActionInterface *actionIface = accessible->actionInterface()) {
        const QString def = actionIface->actionNames().value(0);
        if (!def.isEmpty()) {
            actionIface->doAction(def);
            return S_OK;
        }
    }
    return S_FALSE;
}
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accDescription(VARIANT varID, BSTR* pszDescription)
{
    showDebug(__FUNCTION__, accessible);
    if (!accessible->isValid())
        return E_FAIL;

    AccessibleElement elem(varID.lVal, accessible);
    QString descr = elem.text(Description);
    if (descr.size()) {
        *pszDescription = QStringToBSTR(descr);
        return S_OK;
    }

    *pszDescription = 0;
    return S_FALSE;
}
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accHelp(VARIANT varID, BSTR *pszHelp)
{
    showDebug(__FUNCTION__, accessible);
    if (!accessible->isValid())
        return E_FAIL;

    AccessibleElement elem(varID.lVal, accessible);
    QString help = elem.text(Help);
    if (help.size()) {
        *pszHelp = QStringToBSTR(help);
        return S_OK;
    }

    *pszHelp = 0;
    return S_FALSE;
}
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accValue(VARIANT varID, BSTR* pszValue)
{
    showDebug(__FUNCTION__, accessible);
    if (!accessible->isValid())
        return E_FAIL;

    AccessibleElement elem(varID.lVal, accessible);
    QString value = elem.text(Value);
    if (!value.isNull()) {
        *pszValue = QStringToBSTR(value);
        return S_OK;
    }

    *pszValue = 0;
    return S_FALSE;
}
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accKeyboardShortcut(VARIANT varID, BSTR *pszKeyboardShortcut)
{
    showDebug(__FUNCTION__, accessible);
    if (!accessible->isValid())
        return E_FAIL;

    AccessibleElement elem(varID.lVal, accessible);
    QString sc = elem.text(Accelerator);
    if (sc.size()) {
        *pszKeyboardShortcut = QStringToBSTR(sc);
        return S_OK;
    }

    *pszKeyboardShortcut = 0;
    return S_FALSE;
}
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accName(VARIANT varID, BSTR* pszName)
{
    showDebug(__FUNCTION__, accessible);
    if (!accessible->isValid())
        return E_FAIL;

    AccessibleElement elem(varID.lVal, accessible);
    QString n = elem.text(Name);
    if (n.size()) {
        *pszName = QStringToBSTR(n);
        return S_OK;
    }

    *pszName = 0;
    return S_FALSE;
}