本文整理汇总了C++中FileScopePtr::pseudoMainName方法的典型用法代码示例。如果您正苦于以下问题:C++ FileScopePtr::pseudoMainName方法的具体用法?C++ FileScopePtr::pseudoMainName怎么用?C++ FileScopePtr::pseudoMainName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileScopePtr
的用法示例。
在下文中一共展示了FileScopePtr::pseudoMainName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outputCPPImpl
void IncludeExpression::outputCPPImpl(CodeGenerator &cg,
AnalysisResultPtr ar) {
bool linemap = outputLineMap(cg, ar, true);
// Includes aren't really supported in system mode
if (cg.getOutput() == CodeGenerator::SystemCPP) {
cg_printf("true");
if (linemap) cg_printf(")");
return;
}
const char *vars = m_privateScope ?
"lvar_ptr(LVariableTable())" : "variables";
bool require = (m_op == T_REQUIRE || m_op == T_REQUIRE_ONCE);
bool once = (m_op == T_INCLUDE_ONCE || m_op == T_REQUIRE_ONCE);
if (!getCurrentInclude(ar).empty()) {
FileScopePtr fs = ar->findFileScope(getCurrentInclude(ar), false);
if (fs) {
cg_printf("%s%s(%s, %s)", Option::PseudoMainPrefix,
fs->pseudoMainName().c_str(),
once ? "true" : "false",
vars);
if (linemap) cg_printf(")");
return;
}
}
// include() and require() need containing file's directory
string currentDir = "NULL";
if (m_loc && m_loc->file && *m_loc->file) {
string file = m_loc->file;
size_t pos = file.rfind('/');
if (pos != string::npos) {
currentDir = '"';
currentDir += file.substr(0, pos + 1);
currentDir += '"';
}
}
// fallback to dynamic include
cg_printf("%s(", require ? "require" : "include");
m_exp->outputCPP(cg, ar);
cg_printf(", %s, %s, %s)",
once ? "true" : "false",
vars,
currentDir.c_str());
if (linemap) cg_printf(")");
}