// Print a description of the token to f. void JS::Token::print(Formatter &f, bool debug) const { switch (getKind()) { case end: f << "[end]"; break; case number: if (debug) f << "[number " << /* getValue() << */ ']'; f << getChars(); break; case unit: if (debug) f << "[unit]"; /* no break */ case string: quoteString(f, getChars(), '"'); break; case regExp: f << '/' << getIdentifier() << '/' << getChars(); break; case identifier: if (debug) f << "[identifier]"; f << getIdentifier(); break; default: f << getKind(); } }
void UmlClass::write(QCString target) { if (known) { QCString s = stereotype(); if ((s != "stereotype") && (s != "metaclass")) s = "class"; if (flat) fw.write("<a href=\"index"); else { fw.write("<a href=\""); fw.write(s); fw.write((unsigned) getIdentifier()); } fw.write(".html#ref"); fw.write(s); fw.write((unsigned) getIdentifier()); fw.write("\" target = \""); fw.write(target); fw.write("\"><b>"); writeq(name()); fw.write("</b></a>"); } else writeq(name()); }
void UmlClass::write() { if (!known) writeq(name()); else { QByteArray s = stereotype(); if ((s != "stereotype") && (s != "metaclass")) s = "class"; if (flat) fw.write("<a href=\"index"); else { fw.write("<a href=\""); fw.write(s); fw.write((unsigned) getIdentifier()); } fw.write(".html#ref"); fw.write(s); fw.write((unsigned) getIdentifier()); fw.write("\"><b>"); writeq(name()); fw.write("</b></a>"); } }
void Sema::ActOnENDTYPE(ASTContext &C, SourceLocation Loc, SourceLocation IDLoc, const IdentifierInfo* IDInfo) { auto Record = dyn_cast<RecordDecl>(CurContext); if(IDInfo && IDInfo != Record->getIdentifier()) { Diags.Report(IDLoc, diag::err_expected_type_name) << Record->getIdentifier() << /*Kind=*/ 0 << getTokenRange(IDLoc); } }
void FunctionNode::generateCCode(ostream &out) { switch(getReturnType()) { case DATA_TYPE_INTEGER: out << "int"; break; case DATA_TYPE_BOOLEAN: out << "char"; break; case DATA_TYPE_VOID: out << "void"; break; default: break; } out << " "; const char *str = getIdentifier(); while(*str) { out << (char)tolower(*str); str++; } this->declarations_->generateCCode(out); this->statements_->generateCCode(out); out << "}" << endl; }
ConfigResource::ConfigResource() { SemIoTResource::uri = "/config"; ap_ssid = "SMT_" + getIdentifier(); basicAuthString = sha1(configUserName+configPassword); // begin(); }
std::string Iwa_TiledParticlesFx::getAlias(double frame, const TRenderSettings &info) const { std::string alias = getFxType(); alias += "["; // alias degli effetti connessi alle porte di input separati da virgole // una porta non connessa da luogo a un alias vuoto (stringa vuota) for (int i = 0; i < getInputPortCount(); ++i) { TFxPort *port = getInputPort(i); if (port->isConnected()) { TRasterFxP ifx = port->getFx(); assert(ifx); alias += ifx->getAlias(frame, info); } alias += ","; } std::string paramalias(""); for (int i = 0; i < getParams()->getParamCount(); ++i) { TParam *param = getParams()->getParam(i); paramalias += param->getName() + "=" + param->getValueAlias(frame, 3); } return alias + toString(frame) + "," + toString(getIdentifier()) + paramalias + "]"; }
bool Entity::operator==(const Entity& entity) const { if (isValid() && entity.isValid()) { if ((getIdentifier() == entity.getIdentifier()) && (getType() == src.getType())) ; } else return (isValid() == entity.isValid()); }
void FSDefineImage::encodeToStream(FSOutputStream* aStream) { aStream->startEncoding(className()); aStream->setContext(FSStream::Type, type); int word = (getType() << 6) | 0x3F; aStream->write(word, FSStream::UnsignedWord, 16); aStream->write(length, FSStream::UnsignedWord, 32); aStream->write(getIdentifier(), FSStream::UnsignedWord, 16); switch (pixelSize) { case 8: aStream->write(3, FSStream::UnsignedWord, 8); break; case 16: aStream->write(4, FSStream::UnsignedWord, 8); break; case 24: aStream->write(5, FSStream::UnsignedWord, 8); break; } aStream->write(width, FSStream::UnsignedWord, 16); aStream->write(height, FSStream::UnsignedWord, 16); if (pixelSize == 8) aStream->write(tableSize-1, FSStream::UnsignedWord, 8); aStream->write(image, imageLength); aStream->endEncoding(className()); }
long Error:: getErrorKey (char *pErrorClassName, long *plErrorIdentifier) { if (getClassName (pErrorClassName)) { #ifdef __MOSYNC__ #else std:: cerr << "Error:: getClassName failed" << std:: endl; #endif return 1; } if (getIdentifier (plErrorIdentifier)) { #ifdef __MOSYNC__ #else std:: cerr << "Error:: getIdentifier failed" << std:: endl; #endif return 1; } return 0; }
bool InfoObjectCommon::isEqual(const InfoObjectCommon& other, bool similar) const { if (getInfoObjectType() != other.getInfoObjectType()) return false; if (m_sampleRate != other.m_sampleRate) return false; if (!similar && getIdentifier().trim() != other.getIdentifier().trim()) return false; return checkEqual(other, similar); }
bool XMLStack::consumeXMLHeader(char **stream) { int check = 0; NSString token, value; if(*(*stream + 0) == '<' && *(*stream + 1) == '?' && *(*stream + 2) == 'x' && *(*stream + 3) == 'm' && *(*stream + 4) == 'l') { (*stream)+=5; if(!moveAndCheckProgress(5)) return false; while(**stream != '?') { getIdentifier(stream, token); getStringValue(stream, value); if((const NSString &)token == "version") XMLVersion = float(atof(value)); if((const NSString &)token == "encoding") encoding = value; } } else return false; (*stream)+=2; consumeWhiteSpaces(stream); return true; }
void UmlClass::html() { QCString s; UmlCom::message(name()); if (stereotype() == "stereotype") start_file("stereotype" + s.setNum((unsigned) getIdentifier()), "Stereotype " + name(), TRUE); else if (stereotype() == "metaclass") start_file("metaclass" + s.setNum((unsigned) getIdentifier()), "Metaclass " + name(), TRUE); else start_file("class" + s.setNum((unsigned) getIdentifier()), "Class " + name(), TRUE); define(); gen_html("", 0, 0); end_file(); unload(FALSE, FALSE); }
std::vector<std::string> CompositeProperty::getPath() const { std::vector<std::string> path; if (const auto owner = getOwner()) { path = owner->getPath(); } path.push_back(getIdentifier()); return path; }
Node<MemberNode>::Link TypeParser::member(Visibility vis, bool isStatic) { Trace mbTrace = current().trace; auto parsedAsDecl = declaration(); auto mbNode = Node<MemberNode>::make(parsedAsDecl->getIdentifier(), parsedAsDecl->getTypeInfo().getEvalTypeList(), isStatic, vis == INVALID ? PRIVATE : vis); mbNode->setTrace(mbTrace); if (parsedAsDecl->getChildren().size() > 0) mbNode->setInit(Node<ExpressionNode>::staticPtrCast(parsedAsDecl->removeChild(0))); return mbNode; }
/** * Find a feature by its name, possibly loading a plugin. * @param name Name of the looked feature. * @return Found feature or null. */ AbstractFeature *ProcessorPlugin::getFeature(cstring name) { AbstractIdentifier *id = getIdentifier(name); if(!id) return 0; else if(IS_FEATURE(id)) return (AbstractFeature *)id; else return 0; }
// writeIPDOMToFile: // This functions looks for the immediate post-dominator (IPD) of every basic // block of every basic block of every function, and writes it to _ipdom_file void ControlFlowIntegrity::writeIPDOMToFile(CFIModulePass* cfi) { std::fstream IPDOMFS; IPDOMFS.open(_ipdom_file, std::fstream::out | std::fstream::app); if (!IPDOMFS.is_open()) { std::cerr << strerror(errno) << std::endl; assert(0 && "Can't open file to write ipdom!"); } for (auto &it : _FunctionMap) { CFIFct cfi_f = it.second; llvm::Function &F = *cfi_f.fun; std::map<llvm::BasicBlock*, uint32_t> &bb_map = cfi_f.bb_map; if (F.isDeclaration()) continue ; if (isIgnoredFunction(F.getName())) continue; if (isIgnoredBlocksFunction(F.getName())) continue; PostDominatorTree &PDT = cfi->getAnalysis<PostDominatorTree>(F); for (BasicBlock &bb : F) { TerminatorInst* term = (bb).getTerminator(); if (isa<InvokeInst>(term)) { report_fatal_error("Invoke Instruction detected!", false); continue; } BasicBlock* posdom = NULL; if (term->getNumSuccessors() >= 1) { succ_iterator si = succ_begin(&bb); posdom = *si; si++; for (succ_iterator se = succ_end(&bb); si != se; si++) { BasicBlock* su2 = *si; posdom = PDT.findNearestCommonDominator(posdom, su2); if (posdom == NULL) break; } } IPDOMFS << getIdentifier(&F) << " "; IPDOMFS << bb_map[&(bb)] << " "; if (posdom != NULL) { IPDOMFS << bb_map[posdom] << " "; } else { IPDOMFS << "0 "; } IPDOMFS << bb_map[&F.back()] << "\n"; } } IPDOMFS.close(); }
Node<MethodNode>::Link TypeParser::method(Visibility vis, bool isStatic, bool isForeign) { Trace methTrace = current().trace; auto parsedAsFunc = function(isForeign); auto methNode = Node<MethodNode>::make(parsedAsFunc->getIdentifier(), parsedAsFunc->getSignature(), vis, isStatic); methNode->setTrace(methTrace); if (isForeign) { expectSemi(); } else { methNode->setCode(Node<BlockNode>::staticPtrCast(parsedAsFunc->removeChild(0))); } return methNode; }
void FunctionCallNode::generateCCode(ostream &out) { const char *str = getIdentifier(); while(*str) { out << (char)tolower(*str); str++; } out << "("; actualParameterList_->generateCCode(out); out << ")"; }
void FunctionCallNode::debug(ASTDebugger *astDebugger, int nodeLevel) { string functionIdentifier = "Identifier: "; functionIdentifier += getIdentifier(); astDebugger->openParentNode("Function Call", nodeLevel); astDebugger->insertLeafNode(functionIdentifier.c_str(), nodeLevel + 1); this->actualParameterList_->debug(astDebugger, nodeLevel + 1); astDebugger->closeParentNode("Function Call", nodeLevel); }
ostream& OnMoving::operator<<(ostream &out) const { // Serializer super class. StartType::operator<<(out); odcore::serialization::SerializationFactory& sf=odcore::serialization::SerializationFactory::getInstance(); std::shared_ptr<odcore::serialization::Serializer> s = sf.getQueryableNetstringsSerializer(out); s->write(1, getIdentifier()); return out; }
ostream& OnMoving::operator<<(ostream &out) const { // Serializer super class. StartType::operator<<(out); SerializationFactory& sf=SerializationFactory::getInstance(); std::shared_ptr<Serializer> s = sf.getSerializer(out); s->write(CRC32 < OPENDAVINCI_CORE_STRINGLITERAL2('i', 'd') >::RESULT, getIdentifier()); return out; }
void ListChunk::toPrettyString(std::ostream &o, size_t indent) const{ o << std::string(indent, ' ') << "[" << getType() << "] " << getIdentifier() << " (" << (getPayloadSize() + 8) << "b):" << std::endl; indent += 2; uint32_t i = 12; uint32_t len = getPayloadSize() + 8; while (i + 8 <= len){ const Chunk C(p + i); C.toPrettyString(o, indent); i += C.getPayloadSize() + 8; if (!C){return;} } }
bool DataStmtEngine::CheckVar(VarExpr *E) { auto VD = E->getVarDecl(); if(VD->isArgument() || VD->isParameter() || VD->isFunctionResult()) { Diags.Report(E->getLocation(), diag::err_data_stmt_invalid_var) << (VD->isParameter()? 0 : VD->isArgument()? 1 : 2) << VD->getIdentifier() << E->getSourceRange(); getValueOnError(); return true; } if(VD->isUnusedSymbol()) const_cast<VarDecl*>(VD)->MarkUsedAsVariable(E->getLocation()); return false; }
ExprResult Parser::ParseRecursiveCallExpression(SourceRange IDRange) { auto Func = Actions.CurrentContextAsFunction(); auto IDLoc = IDRange.Start; if(Func->isSubroutine()) { Diag.Report(IDLoc, diag::err_invalid_subroutine_use) << Func->getIdentifier() << getTokenRange(IDLoc); return ExprError(); } if(!Actions.CheckRecursiveFunction(IDLoc)) return ExprError(); if(!IsPresent(tok::l_paren)) return FunctionRefExpr::Create(Context, IDRange, Func); return ParseCallExpression(IDLoc, Func); }
lineStruct* readLine(FILE *fp, uint numberOfAlgorithms) { lineStruct *line; line = (lineStruct*) malloc(sizeof(lineStruct)); char *distribution; distribution = (char *) malloc(100 * sizeof(char)); char* lineText; char *ptr; uint i; lineText = (char*) malloc(5000 * sizeof(char)); char *tempName; //set the number of algorithms line->numAlgorithms = numberOfAlgorithms; //read in the line fgets(lineText, 5000, fp); //get the size ptr =strtok(lineText, ","); sscanf(ptr,"%u", &line->size); //get the K value ptr =strtok(NULL, ","); sscanf(ptr,"%u", &line->k); ptr =strtok(NULL, ","); //get the distribution sscanf(ptr,"%[^,]s", &line->distribution); //do a dummy strtok to skip the seed ptr =strtok(NULL, ","); for(i =0; i < numberOfAlgorithms; i++) { ptr =strtok(NULL, ","); tempName = (char*) malloc(100 * sizeof(char)); strcpy(tempName, ptr); line->names[i] = tempName; line->identifier[i] = getIdentifier(tempName); //do an extra strtok to get past the result as we do not care about this ptr =strtok(NULL, ","); ptr =strtok(NULL, ","); sscanf(ptr,"%f", &line->times[i]); } for(i = 0; i < numberOfAlgorithms; i++) { line->ratios[i] = line->times[i]/ line->times[2]; } ptr =strtok(NULL, ","); sscanf(ptr, "%u", &line->errorFlag); free(distribution); free(lineText); return line; }
void Object::_remove(const TypeIdentifier& i_trait_name) { if (m_deleting) { return ; } InternalMessage("Kernel","removed trait " + i_trait_name.toString() + " to objectid=" + toString(getIdentifier())) ; Trait* trait = traits[i_trait_name] ; trait->_close() ; TraitFormula::removeTrait(this,i_trait_name) ; this->traits.erase(i_trait_name) ; delete trait ; }
void device_t<CUDA>::cacheKernelInLibrary(const std::string &filename, const std::string &functionName, const kernelInfo &info_){ //---[ Creating shared library ]---- kernel tmpK = dev->buildKernelFromSource(filename, functionName, info_); tmpK.free(); kernelInfo info = info_; info.addDefine("OCCA_USING_GPU" , 1); info.addDefine("OCCA_USING_CUDA", 1); info.addOCCAKeywords(occaCUDADefines); std::stringstream salt; salt << "CUDA" << info.salt() << parser::version << dev->dHandle->compilerEnvScript << dev->dHandle->compiler << dev->dHandle->compilerFlags; std::string cachedBinary = getCachedName(filename, salt.str()); std::string contents = readFile(cachedBinary); //================================== library::infoID_t infoID; infoID.modelID = dev->modelID_; infoID.kernelName = functionName; library::infoHeader_t &header = library::headerMap[infoID]; header.fileID = -1; header.mode = CUDA; const std::string flatDevID = getIdentifier().flattenFlagMap(); header.flagsOffset = library::addToScratchPad(flatDevID); header.flagsBytes = flatDevID.size(); header.contentOffset = library::addToScratchPad(contents); header.contentBytes = contents.size(); header.kernelNameOffset = library::addToScratchPad(functionName); header.kernelNameBytes = functionName.size(); }
void Relay::nextContainer(odcore::data::Container &a_container) { if (a_container.getDataType() == opendlv::proxy::RelayRequest::ID()) { opendlv::proxy::RelayRequest request = a_container.getData<opendlv::proxy::RelayRequest>(); std::string deviceId = request.getDeviceId(); if (deviceId != getIdentifier()) { return; } bool relayValue = request.getRelayValue(); uint8_t relayIndex = request.getRelayIndex(); m_device->SetValue(relayIndex, relayValue); } }
void FunctionNode::debug(ASTDebugger * astDebugger, int nodeLevel) { astDebugger->openParentNode("Function/Procedure", nodeLevel); string functionIdentifier = "Identifier: "; functionIdentifier += getIdentifier(); string functionReturnType = "Return Type: "; functionReturnType += getDataTypeName( getReturnType() ); astDebugger->insertLeafNode(functionIdentifier.c_str(), nodeLevel + 1); astDebugger->insertLeafNode(functionReturnType.c_str(), nodeLevel + 1); this->declarations_->debug(astDebugger, nodeLevel + 1); this->statements_->debug(astDebugger, nodeLevel + 1); astDebugger->closeParentNode("Function/Procedure", nodeLevel); }