Example #1
0
void Oscillator::processOneSample()
{
	// for now we are doing a sine wave.
	// we are given sample rate
	// we want index to go from 0 to 2*PI
	// frequency times per srate samples.
	if (outputs.size() > 0) {
		double output;
		if (isLinked("level")) {
			level = getLinkParameter("level");
		}
		if (isLinked("freq")) {
			freq = getLinkParameter("freq");
		}
		deriveIncrement();
		if (type == WAVE_SINE) {
			output = sin(index);
		} else if (type == WAVE_SQUARE) {
			if (index < PI) {
				output = 1.0;
			} else {
				output = -1.0;
			}
		}
		output *= level;
		for (int i = 0 ; i < outputs.size() ; i++) {
			outputs.at(i)->putData(output);
		}
		index += increment;
		if (index >= (2 * PI)) index -= (2 * PI);
	}
}
Example #2
0
bool PatchView::doUpdate(bool force) {

	const RevFile* files = NULL;
	bool newFiles = false;

	if (st.isChanged(StateInfo::SHA) || force) {

		if (!isLinked()) {
			QString caption(git->getShortLog(st.sha()));
			if (caption.length() > 30)
				caption = caption.left(30 - 3).trimmed().append("...");

			setTabCaption(caption);
		}
		on_updateRevDesc();
	}

	if (st.isChanged(StateInfo::ANY & ~StateInfo::FILE_NAME) || force) {

		updatePatch();
		patchTab->fileList->clear();
		files = git->getFiles(st.sha(), st.diffToSha(), st.allMergeFiles());
		newFiles = true;
	}
	// call always to allow a simple refresh
	patchTab->fileList->update(files, newFiles);

	if (st.isChanged() || force)
		patchTab->textEditDiff->centerOnFileHeader(st);

	return true;
}
Example #3
0
//"ADJP|ADVP < (FW $- (IN=target < in|In) )"
inline const bool &nn4(const unsigned long &cons){
	 if (cons==PENN_CON_ADJP || cons==PENN_CON_ADVP){
		 CStateNodeList* childsAd=node.m_umbinarizedSubNodes;
	     while(childsAd!=0){
	    	 if ((*words)[childsAd->node->lexical_head].tag.code()==PENN_TAG_FW){
	    		 if (childsAd->previous!=0){
	    			 const CStateNode* inTarg=childsAd->previous->node;
	    			 	 if (((*words)[inTarg->lexical_head].tag.code()==PENN_TAG_IN)&&!(isLinked(&node,inTarg))){

	    			 		 CStateNodeList* childsIn=inTarg->m_umbinarizedSubNodes;
	    			 		 //while(childsIn!=0){
	    			 			if ((*words)[inTarg->lexical_head].word==g_word_in||(*words)[inTarg->lexical_head].word==g_word_In){
//	    			 				CDependencyLabel* label=new CDependencyLabel(STANFORD_DEP_NN);
	    			 				if (buildStanfordLink(STANFORD_DEP_NN, inTarg->lexical_head, node.lexical_head)) {
	    			 					addLinked(&node,inTarg);
	    			 				    return true;
	    			 				}
	    			 			}
	    			 			//childsIn=childsIn->next;
	    			 		 //}
	     				 }
	     			}
	     		}
	     		childsAd=childsAd->next;
	     	}
	    }
	 	return false;
}
Example #4
0
void Program::release() const
{
    if (!isLinked())
        return;

    glUseProgram(0);
}
Example #5
0
bool ProgramManager::validate()
{
    if (!isLinked()) return false;

    GLint status;
    glValidateProgram(handle);
    glGetProgramiv(handle, GL_VALIDATE_STATUS, &status);

    if (GL_FALSE == status) {
        int length = 0;
        logString = "";

        glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &length);

        if (length > 0) {
            char * c_log = new char[length + 1];
            int written = 0;
            glGetProgramInfoLog(handle, length, &written, c_log);
            c_log[length] = '\0';
            logString = c_log;
            delete[] c_log;
        }
        return false;
    }
    return true;
}
Example #6
0
 //"/^(?:VP|ADJP|JJP|WHADJP|SQ?|SBARQ?|SINV|XS|RRC|(?:WH)?NP(?:-TMP|-ADV)?)$/ < (RB|RBR|RBS|WRB|ADVP|WHADVP=target !< " + NOT_PAT + ")",
inline const bool &advmod1(const unsigned long &cons){
    	  if (cons==PENN_CON_VP || cons==PENN_CON_ADJP || cons==PENN_CON_S || //S (SBAR) is there because because SQ? (SBARQ?) matches SQ and S, being Q optional
    			  cons==PENN_CON_SQ || cons==PENN_CON_SBAR || cons==PENN_CON_SBARQ ||
    			  cons==PENN_CON_WHNP || cons==PENN_CON_SBARQ ||
    			  cons==PENN_CON_SINV || cons==PENN_CON_RRC || cons==PENN_CON_SBARQ){
    		  CStateNodeList* childs = node.m_umbinarizedSubNodes;
    		  while(childs!=0){
    			  const CStateNode* targ=childs->node;
    			  if (((*words)[targ->lexical_head].tag.code()==PENN_TAG_ADVERB || (*words)[targ->lexical_head].tag.code()==PENN_TAG_ADVERB_COMPARATIVE 
    					  || (*words)[targ->lexical_head].tag.code()==PENN_TAG_ADVERB_SUPERLATIVE || (*words)[targ->lexical_head].tag.code()==PENN_TAG_WRB
    					  || CConstituent::clearTmp(targ->constituent.code())==PENN_CON_WHADVP) && !isLinked(&node,targ)){
    				  
    				  CStateNodeList* childsT=targ->m_umbinarizedSubNodes;
    				  bool notCond=true;
    				  if (((*words)[targ->lexical_head].word==g_word_not) ||((*words)[targ->lexical_head].word==g_word_nt)){
    					  notCond=false;
    				  }
    				  
    				  if (notCond){
//    					  CDependencyLabel* label=new CDependencyLabel(STANFORD_DEP_ADVMOD);
    					  if (buildStanfordLink(STANFORD_DEP_ADVMOD, targ->lexical_head, node.lexical_head)) {
    						  addLinked(&node,targ);
    					      return true;
    					  }
    				  }
    			  }
    			  childs=childs->next;
    		  }
    	  }
    	  return false;
      }
Example #7
0
void AdobeDRM::link(const QString& userID, const QString& password)
{
    qDebug() << Q_FUNC_INFO;

    if (isLinked())
    {
        emit linkOK();
        return;
    }

    if (!m_proc)
    {
        emit linkKO(2);
        return;
    }

    m_DRM_ID = userID;
    m_DRM_PW = password;

    #ifdef Q_WS_QWS
    connect(m_client, SIGNAL(workflowDone(unsigned int)),                   this, SLOT(linkWorkflowDone(unsigned int)), Qt::UniqueConnection);
    connect(m_client, SIGNAL(workflowError(int, QString)),                  this, SLOT(linkWorkflowError(int, QString)), Qt::UniqueConnection);
    #endif

    QTimer::singleShot(110, this, SLOT(processLink()));
}
Example #8
0
    //"ADJP < (S=target <, (VP <, TO))",
inline const bool & buildXComp2(const unsigned long &cons) {
       	if (cons==PENN_CON_ADJP){
       		CStateNodeList* childsADJP=node.m_umbinarizedSubNodes;
       		while(childsADJP!=0){
       			const CStateNode* sTarg=childsADJP->node;
       			if (CConstituent::clearTmp(sTarg->constituent.code())==PENN_CON_S && (!isLinked(&node,sTarg))){
       				//A <, B 	B is the first child of A
       				CStateNodeList* childsS=sTarg->m_umbinarizedSubNodes;
       				if (childsS!=0){//only first child
       					const CStateNode* vpChildS=childsS->node;
       					if (CConstituent::clearTmp(vpChildS->constituent.code())==PENN_CON_VP){
       						CStateNodeList* childsVp=vpChildS->m_umbinarizedSubNodes;
       						if (childsVp!=0){//only first child
       							if (((*words)[childsVp->node->lexical_head].tag.code()==PENN_TAG_TO)){
//       								CDependencyLabel* label=new CDependencyLabel(STANFORD_DEP_XCOMP);
       								if (buildStanfordLink(STANFORD_DEP_XCOMP, sTarg->lexical_head, node.lexical_head)) {
       									addLinked(&node,sTarg);
       									return true;
       								}
       							}
       						}
       					}
       				}

       			}
       			childsADJP=childsADJP->next;
       		}
       	}
       	return false;

       }
Example #9
0
void CallLinkInfo::visitWeak(RepatchBuffer& repatchBuffer)
{
    if (isLinked()) {
        if (stub) {
            if (!Heap::isMarked(stub->executable())) {
                if (Options::verboseOSR()) {
                    dataLog(
                        "Clearing closure call from ", *repatchBuffer.codeBlock(), " to ",
                        stub->executable()->hashFor(specializationKind()),
                        ", stub routine ", RawPointer(stub.get()), ".\n");
                }
                unlink(repatchBuffer);
            }
        } else if (!Heap::isMarked(callee.get())) {
            if (Options::verboseOSR()) {
                dataLog(
                    "Clearing call from ", *repatchBuffer.codeBlock(), " to ",
                    RawPointer(callee.get()), " (",
                    callee.get()->executable()->hashFor(specializationKind()),
                    ").\n");
            }
            unlink(repatchBuffer);
        }
    }
    if (!!lastSeenCallee && !Heap::isMarked(lastSeenCallee.get()))
        lastSeenCallee.clear();
}
Example #10
0
//"WHNP|WHNP-TMP|WHNP-ADV|NP|NP-TMP|NP-ADV < PDT=target <- DT"
    inline const bool &predet3(const unsigned long &cons){
   	  if (cons==PENN_CON_WHNP || cons==PENN_CON_NP){
   		  CStateNodeList* childs=node.m_umbinarizedSubNodes;
   		  bool lastCond=false;
   		  while(childs!=0){
   			  if (((*words)[childs->node->lexical_head].tag.code()==PENN_TAG_DT) && childs->next==0){
   				  lastCond=true;
   			  }
   			  childs=childs->next;
   		  }
   		  if (lastCond){
   			  childs=node.m_umbinarizedSubNodes;
   			  while(childs!=0){
   				  const CStateNode* targ=childs->node;
   				  if (((*words)[targ->lexical_head].tag.code()==PENN_TAG_PDT) && !isLinked(&node,targ)){
//   					  CDependencyLabel* label=new CDependencyLabel(STANFORD_DEP_PREDET);
   					  if (buildStanfordLink(STANFORD_DEP_PREDET, targ->lexical_head, node.lexical_head)) {
   						  addLinked(&node,targ);
   					      return true;
   					  }
   				  }
   				  childs=childs->next;
   			  }
   		  }
   	  }	
   	  return false;
     }
Example #11
0
   //"__ < /^(?:\\.|:|,|''|``|\\*|-LRB-|-RRB-|HYPH)$/=target"
     inline const bool & buildPunct1(const unsigned long &cons) {
    	 CStateNodeList* childs=node.m_umbinarizedSubNodes;
    	 while(childs!=0){
    		 const CStateNode* child=childs->node;
    		 if ((((*words)[child->lexical_head].word==g_word_order)
    				 || ((*words)[child->lexical_head].word==g_word_two_dots)
    				 || ((*words)[child->lexical_head].word==g_word_dot)
    				 || ((*words)[child->lexical_head].tag.code()==PENN_TAG_R_QUOTE)
    				 || ((*words)[child->lexical_head].word==g_word_comma)
    				 || ((*words)[child->lexical_head].tag.code()==PENN_TAG_L_QUOTE)
    				 || ((*words)[child->lexical_head].word==g_word_asterisc)
    				 || ((*words)[child->lexical_head].word==g_word_hyphen)
    				 || ((*words)[child->lexical_head].word==g_word_hyphen2)
    				 || ((*words)[child->lexical_head].word==g_word_lowhyphen)
    				 || ((*words)[child->lexical_head].tag.code()==PENN_TAG_L_BRACKET)
    				 || ((*words)[child->lexical_head].tag.code()==PENN_TAG_R_BRACKET)
    				 || ((*words)[child->lexical_head].word==g_word_order))
    				 && (!isLinked(&node,child))){

//    			 CDependencyLabel* label=new CDependencyLabel(STANFORD_DEP_PUNCT);
    			 if (buildStanfordLink(STANFORD_DEP_PUNCT, child->lexical_head, node.lexical_head)) {
    				 addLinked(&node,child);
    			     return true;
    			 }

    		 }
    		 childs=childs->next;
    	 }

     }
Example #12
0
      /*
      *"SQ|SINV < (/^(?:VB|MD|AUX)/=target $++ /^(?:VP|ADJP)/)",
      * 
      * 
      */
inline const bool &buildAux2(const unsigned long &cons){
    	  if (cons==PENN_CON_SQ || cons==PENN_CON_SINV) {
    		  CStateNodeList* childs=node.m_umbinarizedSubNodes;
    		  while (childs!=0) {
    		  const CStateNode* targ=childs->node;
    	      if ((((*words)[targ->lexical_head].tag.code()==PENN_TAG_VERB) ||
    	      		((*words)[targ->lexical_head].tag.code()==PENN_TAG_MD)) 
    	      			  && (!isLinked(&node, targ))) { 
    	      		  	
    	    	  		CStateNodeList* rightSisters=childs;
    	    	  		while(rightSisters!=0){
    	    	  			const CStateNode* rSis=rightSisters->node;
    	    	  			if ((CConstituent::clearTmp(rSis->constituent.code())==PENN_CON_VP) || (CConstituent::clearTmp(rSis->constituent.code())==PENN_CON_ADJP)) {
//    	    	  				CDependencyLabel* label=new CDependencyLabel(STANFORD_DEP_AUX);
    	    	  				if (buildStanfordLink(STANFORD_DEP_AUX, targ->lexical_head, node.lexical_head)){
    	    	  					addLinked(&node,targ);
    	    	  				    //std::cout<<"nSubj13"<<" (head: "<<node.lexical_head<<")"<<"(npTarg->lexical_head<<")\n";
    	    	  				    return true;
    	    	  			}	
    	    	  		}
    	    	  		rightSisters=rightSisters->next;
    	    	  	}
    	      	}
    	      childs=childs->next;
    		  }
    	  }
    	  return false;
      }
Example #13
0
void Shader::validate() const
{
    if (!isLinked())
    {
        throw ShaderException("Program is not linked");
    }

    GLint success;
    glValidateProgram(id_);
    glGetProgramiv(id_, GL_VALIDATE_STATUS, &success);

    if (!success)
    {
        int length = 0;
        std::string logString;

        glGetProgramiv(id_, GL_INFO_LOG_LENGTH, &length);

        if (length > 0)
        {
            char *c_log = new char[length];
            int written = 0;
            glGetProgramInfoLog(id_, length, &written, c_log);
            logString = c_log;
            delete[] c_log;
        }

        throw ShaderException(std::string("Program failed to validate\n") + logString);
    }
}
Example #14
0
bool Tree::link(Planet* target) {
	if(target == planet)
		return false;
	if(isLinked(target))
		return false;
	links.push_back( new Link(this, target) );
	planet->playFX(SND_NEW_ROOTLET);
	return true;
}
Example #15
0
void Program::use() const
{
	checkDirty();

    if (!isLinked())
        return;

    glUseProgram(id());
}
Example #16
0
//"WHNP|WHNP-TMP|WHNP-ADV|NP|NP-TMP|NP-ADV < (PDT|DT=target $+ DT $++ (/^JJ/ !$+ /^NN/)) !$++ CC",
    inline const bool &predet2(const unsigned long &cons){
  	  CStateNodeList* childsN=node.m_umbinarizedSubNodes;
  	  while(childsN!=0){
  		  const CStateNode* head=childsN->node;
  		  if (CConstituent::clearTmp(head->constituent.code())==PENN_CON_WHNP || CConstituent::clearTmp(head->constituent.code())==PENN_CON_NP){
  			  bool rightSisCond=true;
  			  CStateNodeList* rightSisters=childsN->next;
  			  while(rightSisters!=0){
  				  if (((*words)[rightSisters->node->lexical_head].tag.code()==PENN_TAG_CC)){
  					  rightSisCond=false;
  				  }
  				  rightSisters=rightSisters->next;
  			  }
  			  if (rightSisCond){
  				  CStateNodeList* childs=head->m_umbinarizedSubNodes;
  				  while(childs!=0){
  					  const CStateNode* targ=childs->node;
  					  if (((*words)[targ->lexical_head].tag.code()==PENN_TAG_DT)
  							  ||((*words)[targ->lexical_head].tag.code()==PENN_TAG_PDT) && !isLinked(&node,targ)){
  						  CStateNodeList* rightSis=childs->next;
  						  bool firstCond=false;
  						  bool secCond=false;
  						  if (rightSis!=0){
  							  if (((*words)[rightSis->node->lexical_head].tag.code()==PENN_TAG_ADJECTIVE)
  								  ||((*words)[rightSis->node->lexical_head].tag.code()==PENN_TAG_ADJECTIVE_COMPARATIVE)
  							      ||((*words)[rightSis->node->lexical_head].tag.code()==PENN_TAG_ADJECTIVE_SUPERLATIVE)){
  							  firstCond=true;
  						  }
  						  if (firstCond){
  							  while(rightSis!=0){
  								  //PENN_TAG_NOUN, PENN_TAG_NOUN_PROPER, PENN_TAG_NOUN_PROPER_PLURAL, PENN_TAG_NOUN_PLURAL,
  								  if (((*words)[rightSis->node->lexical_head].tag.code()==PENN_TAG_NOUN)
  								      ||((*words)[rightSis->node->lexical_head].tag.code()==PENN_TAG_NOUN_PROPER)
  								      ||((*words)[rightSis->node->lexical_head].tag.code()==PENN_TAG_NOUN_PROPER_PLURAL)
  								      ||((*words)[rightSis->node->lexical_head].tag.code()==PENN_TAG_NOUN_PLURAL)){
  									  secCond=true;
  								  }
  								  rightSis=rightSis->next;
  							  }
  							  if (firstCond && secCond){
//  								  CDependencyLabel* label=new CDependencyLabel(STANFORD_DEP_PREDET);
  								  if (buildStanfordLink(STANFORD_DEP_PREDET, targ->lexical_head, head->lexical_head)) {
  									  addLinked(&node,targ);
  								      return true;
  								  }
  							  }
  						  }
  					  }
  						  }
  					  childs=childs->next;
  				  }
  			  }
  		  }
  		  childsN=childsN->next;
  	  }
  	  return false;
    }
Example #17
0
//"__ [ < INTJ=target | < (PRN=target <1 /^(?:,|-LRB-)$/ <2 INTJ [ !<3 __ | <3 /^(?:,|-RRB-)$/ ] ) ]"
inline const bool & discourse3(const unsigned long &cons){
    	  bool cond1=false;
    	  bool cond2=false;
    	  CStateNodeList* childs=node.m_umbinarizedSubNodes;
    	  while(childs!=0){
    		  const CStateNode* targ=childs->node;
    		  if (CConstituent::clearTmp(targ->constituent.code())==PENN_CON_INTJ && !isLinked(&node,targ)){
    			  cond1=true;
    		  }
    		  else if (CConstituent::clearTmp(targ->constituent.code())==PENN_CON_PRN && !isLinked(&node,targ)){
    			  bool child1=false;
    			  bool child2=false;
    			  bool child3=false;
    			  CStateNodeList* childsT=targ->m_umbinarizedSubNodes;
    			  if (childsT!=0){
    				  if ((*words)[childsT->node->lexical_head].word==g_word_comma || (*words)[childsT->node->lexical_head].tag.code()==PENN_TAG_L_BRACKET){
    					  child1=true;
    				  }
    				  if (child1 && childsT->next!=0){
    					  if (CConstituent::clearTmp(childsT->next->node->constituent.code())==PENN_CON_INTJ){
    						  child2=true;
    					  }
    					  if (child2 && childsT->next->next!=0){
    						  if ((*words)[childsT->next->next->node->lexical_head].word==g_word_comma || (*words)[childsT->next->next->node->lexical_head].tag.code()==PENN_TAG_R_BRACKET){
    							  child3=true;
    						  }
    					  }
    				  }
    			  }
    			  cond2=child1 && child2 && child3;  
    		  }
    		  
    		  if (cond1||cond2){
//    			  CDependencyLabel* label=new CDependencyLabel(0);
    			  if (buildStanfordLink(0, targ->lexical_head, node.lexical_head)) {
    				  addLinked(&node,targ);
    			      return true;
    			  }
    		  }
    		  
    		  childs=childs->next;
    	  }
   
      }
Example #18
0
bool AdobeDRM::init()
{
    done();

    qDebug() << Q_FUNC_INFO;

    dpdev::DeviceProvider* dev_provider = dpdev::DeviceProvider::getProvider(0);
    if (!dev_provider) return false;

    qDebug() << Q_FUNC_INFO << "DeviceProvider created.";

    // getDevice will force generating device.xml. It's written inside the constructor of a static variable, hence it's created only once.
    m_device = dev_provider->getDevice(0);
    if (!m_device) return false;

    qDebug() << Q_FUNC_INFO << "Device created" << m_device->getDeviceName().utf8()
             << ", fingerprint: " << dp::String::base64Encode(m_device->getFingerprint()).utf8()
//             << ", activation record: " << dp::String::base64Encode(m_device->getActivationRecord()).utf8()
             << ", devicekey: " << dp::String::base64Encode(m_device->getDeviceKey()).utf8();

    dpdrm::DRMProvider* drm_provider = dpdrm::DRMProvider::getProvider();
    if (!drm_provider) return false;

    qDebug() << Q_FUNC_INFO << "DRM Provider created";

    m_client = new AdobeDRMProcessorClient();
    m_proc = drm_provider->createDRMProcessor(m_client, m_device);
    if(!m_proc) return false;

    qDebug() << Q_FUNC_INFO << "m_proc created";

    // TODO: Establecer las descargas en /mnt/public
//    char tmp[2048];
//    ::strcpy( tmp, "file://");
//    ::strcat( tmp, qgetenv("ADEPT_ACTIVATION_FILE"));
//    dp::String url = dp::String(tmp);
//    qDebug() << Q_FUNC_INFO << "Setting AdobeDRM partition: " << url.utf8();
//    dpio::Partition* partition = dpio::Partition::findPartitionForURL(url);
//    if( partition != NULL )
//    {
//        qDebug() << Q_FUNC_INFO << "Setting AdobeDRM partition: " << partition->getPartitionName().utf8();
//        m_proc->setPartition(partition);
//    }

    m_netProvider = new NETPROVIDERIMPL(0);
    dpnet::NetProvider::setProvider(m_netProvider);

#ifdef Q_WS_QWS
    if( isLinked() )
    {
        gatherCredentials();
    }
#endif

    return true;
}
Example #19
0
void tskNTP(void const * argument)
{
	/*
	* Wait Signal(from Ethernet manager)
	* DNS request.
	* 	NTP Run() -> X: N Retry using the other NTP Server(DNS retry) || O: Time Update();
	*/
	time_t now;
	uint8_t NTPServerNum;
	uint8_t temp;
#if defined(NTP_SERVER_LIST)
	NTPServerNum = NTP_SERVER_NUM;
	uint8_t* NTPServerList[] = NTP_SERVER_LIST;
#else
	NTPServerNum = NTP_SERVER_NUM_DEFAULT;
	uint8_t* NTPServerList[] = NTP_SERVER_LIST_DEFAULT;
#endif

	while(1)
	{
		if(!isLinked() || (NetInfo.dhcp == NETINFO_DHCP && leaseTime == 0))
			continue;
		temp = 0;
		do{
			now = NTPTimeOut(NTPServerList[temp],NETINFO_NTP_TIMEOUT);
			if(now > 0)
			{
				DHCPLeasedTime = now - 2208988800 - time(NULL) + DHCPLeasedTime;
				time_dat = now - 2208988800;
				srand(now^randomKey);
#if WIZSYSTEM_DEBUG
				printf("NTP Time updated.\r\n");
				printfTime(9);
#endif
				osSignalSet(userTaskId,0x0001);
				osDelay(1000*60);//NETINFO_NTP_PERIODIC);
				break;
			}
			else
			{
#if WIZSYSTEM_DEBUG
				printf("Retry update time using other NTP Server. Retry Count = %d\r\n",temp);
#endif
				if(++temp == NETINFO_NTP_RETRY)
				{
				/*todo*/
				//Signal transmit to ethernet manager?
#if WIZSYSTEM_DEBUG
					printf("NTP Failed. Retry NTP time update after 10 minutes.\r\n");
#endif
					osDelay(600000);//Retry NTP time update after 10 minutes.
				}
			}
		}while(temp < NTPServerNum);
	}
}
Example #20
0
void PluggableWare::initializeWare(const WareID_t& ID)
{
  if (!isLinked())
    throw openfluid::base::FrameworkException(
        openfluid::base::FrameworkException::computeContext(OPENFLUID_CODE_LOCATION)
        .addInfos({{"wareid",ID}}),
        "initialized ware that is not fully linked");

  m_WareID = ID;
};
Example #21
0
void tskEthernetManager(void const * argument)
{
	uint8_t preLinkStatus;
	uint8_t curLinkStatus;
	int8_t ret;
	sockMutexId = osMutexCreate(osMutex(sockMutex));
	spiMutexId = osMutexCreate(osMutex(spiMutex));
	NetMemPoolId = osPoolCreate(osPool(NetMemPool));

#if NETINFO_NTP_USE
	
	osThreadDef(ntptask, tskNTP, osPriorityBelowNormal, 0, 512);
	tskNTPId = osThreadCreate(osThread(ntptask), NULL);
#endif //NETINFO_NTP_USE

	wizSystemInit();
#if WIZSYSTEM_DEBUG
	printf("TASK: Ethernet manager start.\r\n");
#endif
	while(1)
	{
		osDelay(1000);// Every sec
		curLinkStatus = isLinked();
		if(preLinkStatus != curLinkStatus)
		{
			preLinkStatus = curLinkStatus;
			if(curLinkStatus)
			{
				leaseTime = 0;
			}
			else
			{
#if WIZSYSTEM_DEBUG
				printf("Ethernet Unliked. W5500 Reinitialize.\r\n");
				wizSystemInit(); //W5500 initialize
#endif
			}
		}
		if(NetInfo.dhcp == NETINFO_DHCP && DHCPLeasedTime+leaseTime < time(NULL))
		{
			ret = DHCPTimeOut(NETINFO_DHCP_TIMEOUT);
			if(ret == DHCP_IP_LEASED)
			{
				DHCPLeasedTime = time(NULL);
				return;
			}
			else
			{
				leaseTime = 0;
			}
		}
	}
}
Example #22
0
//"@NP <1 (@NP <<# /^%$/) <2 (@NP=target <<# days|month|months) !<3 __",
     inline const bool &npadvmod4(const unsigned long &cons){
   	  if (cons==PENN_CON_NP){
   		  CStateNodeList* childsNp=node.m_umbinarizedSubNodes;
   		  if (childsNp!=0){
   			  bool firstCond=false;
   			  if (CConstituent::clearTmp(childsNp->node->constituent.code())==PENN_CON_NP){
   				  //
   				  CStateNodeList* desc=new CStateNodeList();
   				  listDescendants(childsNp->node->m_umbinarizedSubNodes, desc);
   				  if (desc->node==0) {
   					desc->clear();
   				    desc=0;
   				  }
   				  while(desc!=0){
   					  if (((*words)[desc->node->lexical_head].word==g_word_perc) && (childsNp->node->lexical_head==desc->node->lexical_head)){
   						  firstCond=true;
   					  }
   					  desc=desc->next;
   				  }
   			  }
   			  childsNp=childsNp->next;
   			  if (childsNp!=0 && firstCond){
   				  bool secCond=false;
   				  const CStateNode* targ=childsNp->node;
   				  if (CConstituent::clearTmp(targ->constituent.code())==PENN_CON_NP && !isLinked(&node,targ)){
   					  CStateNodeList* desc2=new CStateNodeList();
   					  listDescendants(targ->m_umbinarizedSubNodes, desc2);
   					  if (desc2->node==0) {
   						  desc2->clear();
   						  desc2=0;
   					  }
   					  while(desc2!=0){
   						  if (((*words)[desc2->node->lexical_head].word==g_word_days || (*words)[desc2->node->lexical_head].word==g_word_month || (*words)[desc2->node->lexical_head].word==g_word_months)
   								  && (targ->lexical_head==desc2->node->lexical_head)){
   							  secCond=true;
   					      }
   						  desc2=desc2->next;
   					  }
   				  }

   				  childsNp=childsNp->next;
   				  if (childsNp==0 && secCond){ //there is no 3rd child
//   					  CDependencyLabel* label=new CDependencyLabel(STANFORD_DEP_NPADVMOD);
   					  if (buildStanfordLink(STANFORD_DEP_NPADVMOD, targ->lexical_head, node.lexical_head)) {
   						  addLinked(&node,targ);
   						  return true;
   					  }
   				  }
   			  }
   		  }
   	  }
   	  return false;
     }
Example #23
0
inline const bool & buildXComp6(const unsigned long &cons) {
	if (cons==PENN_CON_VP){
		CStateNodeList* childsfstVp=node.m_umbinarizedSubNodes;
		while(childsfstVp!=0){
			const CStateNode* vpNode=childsfstVp->node;
			if (CConstituent::clearTmp(vpNode->constituent.code())==PENN_CON_VP){
				CStateNodeList* childsVp=vpNode->m_umbinarizedSubNodes;
				while(childsVp!=0){
					const CStateNode* sTarg=childsVp->node;
					if (CConstituent::clearTmp(sTarg->constituent.code())==PENN_CON_S && (!isLinked(vpNode,sTarg))) {
						bool firstCondition=true;
						//A $- B 	A is the immediate right sister of B
						if (childsVp->previous!=0){
							const CStateNode* leftSisterS=childsVp->previous->node;
							if (((*words)[leftSisterS->lexical_head].tag.code()==PENN_TAG_NOUN)) {
								//CStateNodeList* childsNN=leftSisterS->m_umbinarizedSubNodes;
								//while(childsNN!=0){
									//const CStateNode* orderChild=childsNN->node;
									if ((*words)[leftSisterS->lexical_head].word==g_word_order){
										firstCondition=false;
									}
									//childsNN=childsNN->next;
								 //}
							 }
						}
						if (firstCondition){
							//S=target <: NP
							//A <: B 	B is the only child of A
							CStateNodeList* childsS=sTarg->m_umbinarizedSubNodes;
							if (childsS!=0){
								if ((CConstituent::clearTmp(childsS->node->constituent.code())==PENN_CON_NP) && (childsS->next ==0)){
//									CDependencyLabel* label=new CDependencyLabel(STANFORD_DEP_XCOMP);
									if (buildStanfordLink(STANFORD_DEP_XCOMP, sTarg->lexical_head, vpNode->lexical_head)) {
										//addLinked(vpNode,sTarg);
										addLinked(&node,sTarg); //I think this is not correct, in this specific case.
										return true;
									}
								}
							}
						}

					}
					childsVp=childsVp->next;
				}
			}
			childsfstVp=childsfstVp->next;
		}
	}
	return false;

}
Example #24
0
void GLSLShader::initialize()
{
    //#0 PREPARE SHADER
    GLuint vertexShader;
    GLuint fragmentShader;
    vertexShader    =  prepareShader("basicNew.vert", GLSL::VERTEX);
    fragmentShader  = prepareShader("basicNew.frag", GLSL::FRAGMENT);

    //#1 CREATE PROGRAM HANDLER
    programHandle = glCreateProgram();
    //programHandle = glCreateProgram();
    if(0 == programHandle)
    {
        logString +=  "Error creating program object\n";
        exit(1);
    }

    //#2 ATTACH SHADER TO PROGRAM
    glAttachShader( programHandle, fragmentShader );
    glAttachShader( programHandle, vertexShader );

/////////////////////////////////////////////////////////////////////////////////////////////////////

    std::vector<Eigen::Vector4f> vdata;
    vdata.push_back(Eigen::Vector4f(-1, -1, 0, 1));
    vdata.push_back(Eigen::Vector4f(1, -1, 0, 1));
    vdata.push_back(Eigen::Vector4f(0, 1, 0, 1));

    std::vector<Eigen::Vector4f> vdataColor;
    vdataColor.push_back(Eigen::Vector4f(1, 0, 0, 1));
    vdataColor.push_back(Eigen::Vector4f(0, 1, 0, 1));
    vdataColor.push_back(Eigen::Vector4f(0, 0, 1, 1));

    createVertexAttribute(0, "in_Vertex_Position", vdata);
//    createVertexTFAttribute(0, "in_Vertex_Position", vdata);
    size = vdata.size() * 4;
    createVertexTFAttribute2("Color");
//    createVertexAttribute(1, "in_Vertex_Color", vdataColor);


//////////////////////////////////////////////////////////////////////


    //#3 LINK PROGRAM
    link();

    //#4 USE PROGRAM
    if(isLinked())use();

    printActiveAttribs();
}
Example #25
0
void ShaderProgram::deleteProgram(void)
{
	// Don't do anything if we haven't linked the shader program.
	if(!isLinked())
	{
		glDeleteProgram(programID);
		return;
	}

	// If we have, reset the variable...
	linked = false;
	// ... and tell OpenGL to delete the program.
	glDeleteProgram(programID);
}
Example #26
0
   //"@ADVP|ADJP|WHADJP|WHADVP|PP|WHPP <# (JJ|JJR|IN|RB|RBR !< notwithstanding $- (@NP=target !< NNP|NNPS))",
     inline const bool &npadvmod1(const unsigned long &cons){
    	  if (cons==PENN_CON_ADVP||cons==PENN_CON_ADJP||cons==PENN_CON_WHADJP||cons==PENN_CON_WHADJP||cons==PENN_CON_PP||cons==PENN_CON_WHPP) {
    		  CStateNodeList* childs=node.m_umbinarizedSubNodes;
    		  while(childs!=0){
    			  if (((*words)[childs->node->lexical_head].tag.code()==PENN_TAG_ADJECTIVE
    					  || (*words)[childs->node->lexical_head].tag.code()==PENN_TAG_ADJECTIVE_COMPARATIVE
    					  || (*words)[childs->node->lexical_head].tag.code()==PENN_TAG_IN
    					  || (*words)[childs->node->lexical_head].tag.code()==PENN_TAG_ADVERB
    					  || (*words)[childs->node->lexical_head].tag.code()==PENN_TAG_ADVERB_COMPARATIVE) 
    					  && childs->node->lexical_head==node.lexical_head) {

    				  bool inCond=true;
    				  //CStateNodeList* childsJ=childs->node->m_umbinarizedSubNodes;
    				  //while(childsJ!=0){
    					  if ((*words)[childs->node->lexical_head].word==g_word_notwithstanding){
    						  inCond=false;
    					  }
    					//  childsJ=childsJ->next;
    				  //}
    				  
    				  if (inCond){
    					  if (childs->previous!=0){
    						  const CStateNode* npTarg=childs->previous->node;
    						  if (CConstituent::clearTmp(npTarg->constituent.code())==PENN_CON_NP && !isLinked(&node,npTarg)){
    							  bool lastCond=true;
    							  CStateNodeList* childsNp=npTarg->m_umbinarizedSubNodes;
    							  while(childsNp!=0){
    								  if ((*words)[childsNp->node->lexical_head].tag.code()==PENN_TAG_NOUN_PROPER 
    										  || (*words)[childsNp->node->lexical_head].tag.code()==PENN_TAG_NOUN_PLURAL){
    									  lastCond=false;
    								  }
    								  childsNp=childsNp->next;
    							  }
    							  
    							  if (lastCond){
//    								  CDependencyLabel* label=new CDependencyLabel(STANFORD_DEP_NPADVMOD);
    								  if (buildStanfordLink(STANFORD_DEP_NPADVMOD, npTarg->lexical_head, node.lexical_head)) {
    									  addLinked(&node,npTarg);
    								      return true;
    								  }
    							  }
    						  }
    					  }
    				  }
    			  }
    			  childs=childs->next;
    		  }
    	  }
    	  return false;
      }
Example #27
0
    //"VP < (S=target !$- (NN < order) < (VP < TO))",    // used to have !> (VP < (VB|AUX < be))
inline const bool & buildXComp1(const unsigned long &cons) {
    	if (cons==PENN_CON_VP){

    		CStateNodeList* childsVp=node.m_umbinarizedSubNodes;
    		while(childsVp!=0){
    			const CStateNode* sTarg=childsVp->node;
    			if (CConstituent::clearTmp(sTarg->constituent.code())==PENN_CON_S && (!isLinked(&node,sTarg))){
    				//A $- B: A is the immediate right sister of B
    	//			std::cerr<<"S"<<((*words)[sTarg->lexical_head].word)<<"\n";
    				bool sisterCondition=false;
    				if (childsVp->previous!=0){
    					const CStateNode* leftSisterS=childsVp->previous->node;
    					if (((*words)[leftSisterS->lexical_head].tag.code()==PENN_TAG_NOUN)) {
    							if ((*words)[leftSisterS->lexical_head].word==g_word_order){
    								sisterCondition=true;
    	//							std::cerr<<"NN order"<<((*words)[leftSisterS->lexical_head].word)<<"\n";
    							}

    					}
    				}
    	//			std::cerr<<"-->"<<sisterCondition<<"\n";
    				if (!sisterCondition){
    					CStateNodeList* childsS=sTarg->m_umbinarizedSubNodes;
    					while(childsS!=0){
    						const CStateNode* vpChild=childsS->node;
    						if (CConstituent::clearTmp(vpChild->constituent.code())==PENN_CON_VP){
    	//						std::cerr<<"VP"<<((*words)[vpChild->lexical_head].word)<<"\n";
    							CStateNodeList* childsVps=vpChild->m_umbinarizedSubNodes;
    							while(childsVps!=0){
    								if ((*words)[childsVps->node->lexical_head].tag.code()==PENN_TAG_TO) {
//    									CDependencyLabel* label=new CDependencyLabel(STANFORD_DEP_XCOMP);
    	//								std::cerr<<"TO"<<((*words)[childsVps->node->lexical_head].word)<<"\n";
    									if (buildStanfordLink(STANFORD_DEP_XCOMP, sTarg->lexical_head, node.lexical_head)) {
    										addLinked(&node,sTarg);
    									    return true;
    									}
    								}
    								childsVps=childsVps->next;
    							}
    						}
    						childsS=childsS->next;
    					}
    				}
    			}
    			childsVp=childsVp->next;
    		}
    	}
    	return false;

    }
Example #28
0
bool eFBCTunerManager::isLinkedByIndex(int fe_idx)
{
	bool linked = false;
	eSmartPtrList<eDVBRegisteredFrontend> &frontends = m_res_mgr->m_frontend;

	for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(frontends.begin()); it != frontends.end(); ++it)
	{
		if (FE_SLOT_ID(it) == fe_idx)
		{
			linked = isLinked(*it);
			break;
		}
	}
	return linked;
}
Example #29
0
void CallLinkInfo::unlink(VM& vm)
{
    if (!isLinked()) {
        // We could be called even if we're not linked anymore because of how polymorphic calls
        // work. Each callsite within the polymorphic call stub may separately ask us to unlink().
        RELEASE_ASSERT(!isOnList());
        return;
    }
    
    unlinkFor(vm, *this);

    // It will be on a list if the callee has a code block.
    if (isOnList())
        remove();
}
Example #30
0
//"VP < (S=target !$- (NN < order) < (NP $+ NP|ADJP))",
inline const bool &buildXComp3(const unsigned long &cons) {
	if (cons==PENN_CON_VP){
		CStateNodeList* childsVp=node.m_umbinarizedSubNodes;
		while(childsVp!=0){
			const CStateNode* sTarg=childsVp->node;
			if (CConstituent::clearTmp(sTarg->constituent.code())==PENN_CON_S && (!isLinked(&node,sTarg))){
				//A $- B: A is the immediate right sister of B
				bool sisterCondition=false;
				if (childsVp->previous!=0){
					const CStateNode* leftSisterS=childsVp->previous->node;
					if (((*words)[leftSisterS->lexical_head].tag.code()==PENN_TAG_NOUN)) {
						//CStateNodeList* childsNN=leftSisterS->m_umbinarizedSubNodes;
						//while(childsNN!=0){
							//const CStateNode* orderChild=childsNN->node;
							if ((*words)[leftSisterS->lexical_head].word==g_word_order){
								sisterCondition=true;
							}
							//childsNN=childsNN->next;
						//}
					}
				}
				if (sisterCondition){
					CStateNodeList* childsS=sTarg->m_umbinarizedSubNodes;
					while(childsS!=0){
						const CStateNode* npChildS=childsS->node;
						if (CConstituent::clearTmp(npChildS->constituent.code())==PENN_CON_NP){
							//A $+ B 	A is the immediate left sister of B
							if (childsS->next!=0){
								if (CConstituent::clearTmp(childsS->next->node->constituent.code())==PENN_CON_NP
										||CConstituent::clearTmp(childsS->next->node->constituent.code())==PENN_CON_ADJP){
//									CDependencyLabel* label=new CDependencyLabel(STANFORD_DEP_XCOMP);
									if (buildStanfordLink(STANFORD_DEP_XCOMP, sTarg->lexical_head, node.lexical_head)) {
										addLinked(&node,sTarg);
									    return true;
									}
								}
							}
						}
						childsS=childsS->next;
					}
				}
			}
			childsVp=childsVp->next;
		}
	}
	return false;

}