int SSIEngine::executeComponent(HttpSession *pSession, SSIComponent *pComponent) { AutoBuf *pBuf; int ret; LS_DBG_H(pSession->getLogSession(), "SSI Process component: %d", pComponent->getType()); switch (pComponent->getType()) { case SSIComponent::SSI_String: pBuf = pComponent->getContentBuf(); pSession->appendDynBody(pBuf->begin(), pBuf->size()); break; case SSIComponent::SSI_Config: updateSSIConfig(pSession, pComponent, pSession->getReq()->getSSIRuntime()); break; case SSIComponent::SSI_Echo: processEcho(pSession, pComponent); break; case SSIComponent::SSI_Exec: ret = processExec(pSession, pComponent); return ret; break; case SSIComponent::SSI_FSize: case SSIComponent::SSI_Flastmod: processFileAttr(pSession, pComponent); break; case SSIComponent::SSI_Include: ret = processInclude(pSession, pComponent); return ret; break; case SSIComponent::SSI_Printenv: processPrintEnv(pSession); break; case SSIComponent::SSI_Set: processSet(pSession, pComponent); break; case SSIComponent::SSI_If: case SSIComponent::SSI_Elif: processIf(pSession, (SSI_If *)pComponent); break; //SSI_Else, //SSI_Elif, //SSI_Endif, } return 0; }
void ActivationSequenceContextProcessor::process() { goBackToStartOfName(); processActivationSequence(); if (m_completionKind != CPlusPlus::T_EOF_SYMBOL) { processStringLiteral(); processComma(); generateTokens(); processDoxygenComment(); processComment(); processInclude(); processSlashOutsideOfAString(); processLeftParen(); processPreprocessorInclude(); } resetPositionsForEOFCompletionKind(); }
void Templateiser::processTemplate ( std::string &code, const std::string &templateText ) { std::string::const_iterator templateItr = templateText.begin(); while ( templateItr != templateText.end() ) { if ( *templateItr != '[' ) { code += *templateItr; templateItr++; } else { templateItr++; if (templateItr == templateText.end()) { code += '['; } else { switch(*templateItr) { default: // it's not a code, so just let the next loop hit it and output it break; case '$': replaceVar(code,++templateItr,templateText); break; case '*': processLoop(code,++templateItr,templateText); break; case '?': processIF(code,++templateItr,templateText); break; case '-': case '#': // treat metadata as comments when parsing processComment(code,++templateItr,templateText); break; case '!': processInclude(code,++templateItr,templateText); break; } } } } }
void SourceFileInfo::processInclude(std::string absolutePath) { // Dont want to reprocess file if already in list for(int i = 0; i < dependencies.size(); i++) { if(absolutePath == dependencies.at(i)->getAbsolutePath()) { return; } } // Dont add initial cpp unit to list of depends if(absolutePath != this->absolutePath) { dependencies.push_back(FileInfo::create(absolutePath)); } //std::cout << "Processing: " << absolutePath << std::endl; std::ifstream file(absolutePath.c_str()); if(file.is_open() == false) { std::cout << "Warning: Failed to open: " << absolutePath << std::endl; throw std::exception(); } while(file.eof() == false) { std::string token; file >> token; if(token == "") continue; if(token.substr(0, 1) == "#") { if(token == "#") { std::string tmp; file >> tmp; token = token + tmp; } if(token.substr(0, 8) == "#include") { if(token == "#include") { std::string tmp; file >> tmp; token = token + tmp; } std::string dep = token.substr(8); if(dep.at(0) == '"') { dep = Util::trimLeft(dep, '"'); dep = Util::trimRight(dep, '"'); dep = Util::fixPath(getFolderPath(absolutePath) + DIR_CHAR + dep); try { //std::cout << "Processing: " << dep << std::endl; processInclude(dep); } catch(std::exception& e){} } else if(dep.at(0) == '<') { dep = Util::trimLeft(dep, '<'); dep = Util::trimRight(dep, '>'); for(int i = 0; i < additionalIncludeDirectories.size(); i++) { try { //std::cout << "Additional: " << additionalIncludeDirectories.at(i) << DIR_CHAR << dep << std::endl; processInclude(additionalIncludeDirectories.at(i) + DIR_CHAR + dep); } catch(std::exception& e){} } } } }