本文整理汇总了C++中compiler函数的典型用法代码示例。如果您正苦于以下问题:C++ compiler函数的具体用法?C++ compiler怎么用?C++ compiler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了compiler函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gccFile
bool CompilerLocatorGCC::Locate()
{
// Locate GCC under /usr/bin
m_compilers.clear();
wxArrayString gcc_versions;
gcc_versions.Add(""); // Default gcc
gcc_versions.Add("4.2");
gcc_versions.Add("4.3");
gcc_versions.Add("4.4");
gcc_versions.Add("4.5");
gcc_versions.Add("4.6");
gcc_versions.Add("4.7");
gcc_versions.Add("4.8");
gcc_versions.Add("4.9");
for(size_t i=0; i<gcc_versions.GetCount(); ++i) {
wxString suffix = gcc_versions.Item(i);
if ( !suffix.IsEmpty() ) {
suffix.Prepend("-");
}
wxFileName gccFile("/usr/bin", "gcc" + suffix);
if ( gccFile.FileExists() ) {
// add this compiler
CompilerPtr compiler( new Compiler(NULL) );
wxString toolchainName;
toolchainName << "GCC";
if ( !gcc_versions.Item(i).IsEmpty() ) {
toolchainName << " ( " << gcc_versions.Item(i) << " )";
}
compiler->SetName( toolchainName );
compiler->SetGenerateDependeciesFile(true);
compiler->SetCompilerFamily(COMPILER_FAMILY_GCC);
m_compilers.push_back( compiler );
AddTools(compiler, "/usr/bin", gcc_versions.Item(i));
}
}
// XCode GCC is installed under /Applications/Xcode.app/Contents/Developer/usr/bin
wxFileName xcodeGcc("/Applications/Xcode.app/Contents/Developer/usr/bin", "gcc");
if ( xcodeGcc.FileExists() ) {
// add this compiler
CompilerPtr compiler( new Compiler(NULL) );
compiler->SetCompilerFamily(COMPILER_FAMILY_GCC);
compiler->SetName("GCC ( XCode )");
m_compilers.push_back( compiler );
AddTools(compiler, xcodeGcc.GetPath());
}
return !m_compilers.empty();
}
开发者ID:blitz-research,项目名称:codelite,代码行数:52,代码来源:CompilerLocatorGCC.cpp
示例2: test_dynamic
///////////////////////////////////////////////////////////////////////////////
// test_dynamic
void test_dynamic()
{
typedef std::vector<UChar>::const_iterator uchar_iterator;
typedef basic_regex<uchar_iterator> uregex;
typedef match_results<uchar_iterator> umatch;
typedef regex_compiler<uchar_iterator, UChar_traits> uregex_compiler;
std::string pattern_("b.*r"), str_("foobarboo");
std::vector<UChar> pattern(pattern_.begin(), pattern_.end());
std::vector<UChar> str(str_.begin(), str_.end());
UChar_traits tr;
uregex_compiler compiler(tr);
uregex urx = compiler.compile(pattern);
umatch what;
if(!regex_search(str, what, urx))
{
BOOST_ERROR("regex_search on UChar failed");
}
else
{
BOOST_CHECK_EQUAL(3, what.position());
BOOST_CHECK_EQUAL(3, what.length());
}
// test for range-based regex_replace
std::vector<UChar> output = regex_replace(str, urx, pattern_);
std::string output_(output.begin(), output.end());
std::string expected("foob.*rboo");
BOOST_CHECK_EQUAL(output_, expected);
}
开发者ID:OggYiu,项目名称:rag-engine,代码行数:34,代码来源:test_non_char.cpp
示例3: test_compiler
/* Compiler */
void test_compiler(char *expr, long eval) {
initialize();
compiler(expr,TESTFILE);
loadFile(TESTFILE);
run();
assert(loadWord(SP) == eval);
}
开发者ID:matsimon,项目名称:RA,代码行数:8,代码来源:test.c
示例4: compiler
fint nmethod::nsends(bool includeAll) {
// add up the inlinable sends of the nmethod (i.e. those sent by inline
// caches with comparing stubs); if includeAll, also count non-inlinable
// sends
fint nsends = 0;
bool isNIC = compiler() == NIC;
for (addrDesc* a = locs(), *aend = locsEnd(); a < aend; a++) {
if (a->isSendDesc()) {
sendDesc* sd = a->asSendDesc(this);
if (!sd->isUninlinable()) {
nsends += sd->nsends();
} else if (isNIC && sd->countType() == Counting) {
// must be a method containing _Restart
nsends += sd->nsends();
} else if (isNIC) {
// NIC methods have no count stubs (to save space) but count the
// # of invocations; assume all sends in NIC method are executed
// once per execution of the method
nsends += useCount[id];
} else if (includeAll) {
nsends += sd->nsends();
}
}
}
return nsends;
}
开发者ID:AaronNGray,项目名称:self,代码行数:26,代码来源:nmethod.cpp
示例5: highlight
// Builds an overlay subgraph to project down onto the scene. This is the highlighting
// geometry for the selected feature.
void highlight( osgGIS::FeatureCursor& cursor )
{
osgGIS::FilterGraph* graph = new osgGIS::FilterGraph();
osgGIS::ChangeShapeTypeFilter* change = new osgGIS::ChangeShapeTypeFilter();
change->setNewShapeType( osgGIS::GeoShape::TYPE_POLYGON );
graph->appendFilter( change );
osgGIS::BufferFilter* buffer = new osgGIS::BufferFilter( 1.25 ); //meters
graph->appendFilter( buffer );
osgGIS::TransformFilter* xform = new osgGIS::TransformFilter();
xform->setSRS( terrain_srs.get() );
xform->setLocalize( true );
graph->appendFilter( xform );
osgGIS::BuildGeomFilter* geom = new osgGIS::BuildGeomFilter();
geom->setColorScript( new osgGIS::Script( "vec4(1,1,0,.4)" ) );
graph->appendFilter( geom );
graph->appendFilter( new osgGIS::CollectionFilter() );
osgGIS::BuildNodesFilter* nodes = new osgGIS::BuildNodesFilter();
nodes->setDisableLighting( true );
graph->appendFilter( nodes );
osgGIS::SimpleLayerCompiler compiler( graph );
osg::Node* result = compiler.compile( layer.get(), cursor );
overlay->setOverlaySubgraph( result );
overlay->dirtyOverlayTexture();
}
开发者ID:aarnchng,项目名称:osggis,代码行数:34,代码来源:osggis_mapper.cpp
示例6: BOOST_AUTO_TEST_CASE_TEMPLATE
BOOST_AUTO_TEST_CASE_TEMPLATE( stableInsert, SorterT, sorter_types )
{
// simulating permutation
std::vector<std::pair<std::string, std::string>> test_data = {
{ "aa", "\"{1:2}\"" },
{ "ab", "\"{2:44}\""},
{ "bb", "\"{33:23}\"" },
{ "cc", "\"{3:24}\"" },
{ "aa", "\"{2:27}\"" },
{ "zz", "\"{3:21}\"" },
{ "zz", "\"{5:22}\"" },
{ "aa", "\"{3:24}\"" },
};
keyvi::dictionary::compiler_param_t params = {{STABLE_INSERTS, "true"}};
keyvi::dictionary::DictionaryCompiler<
fsa::internal::SparseArrayPersistence<uint16_t>,
fsa::internal::JsonValueStore,
SorterT> compiler(10485760, params);
for (auto p: test_data){
compiler.Add(p.first, p.second);
}
// test delete
compiler.Delete("ab");
compiler.Compile();
boost::filesystem::path temp_path =
boost::filesystem::temp_directory_path();
temp_path /= boost::filesystem::unique_path(
"dictionary-unit-test-dictionarycompiler-%%%%-%%%%-%%%%-%%%%");
std::string file_name = temp_path.native();
compiler.WriteToFile(file_name);
Dictionary d(file_name.c_str());
fsa::automata_t f(d.GetFsa());
fsa::EntryIterator it(f);
fsa::EntryIterator end_it;
BOOST_CHECK_EQUAL("aa", it.GetKey());
BOOST_CHECK_EQUAL("\"{3:24}\"", it.GetValueAsString());
++it;
BOOST_CHECK_EQUAL("bb", it.GetKey());
BOOST_CHECK_EQUAL("\"{33:23}\"", it.GetValueAsString());
++it;
BOOST_CHECK_EQUAL("cc", it.GetKey());
BOOST_CHECK_EQUAL("\"{3:24}\"", it.GetValueAsString());
++it;
BOOST_CHECK_EQUAL("zz", it.GetKey());
BOOST_CHECK_EQUAL("\"{5:22}\"", it.GetValueAsString());
++it;
BOOST_CHECK(it == end_it);
}
开发者ID:hendrik-cliqz,项目名称:keyvi,代码行数:60,代码来源:dictionary_compiler_test.cpp
示例7: compiler
void Program::Compile( const char *filename )
{
char *src;
Compiler compiler( *this );
int filenum;
str oldfile( s_file );
s_file = filename;
if ( gi.FS_ReadFile( filename, ( void ** )&src, true ) < 0 )
{
s_file = oldfile;
gi.WPrintf( "***\n***\n***\n*** Couldn't load %s\n***\n***\n***\n", filename );
throw "Error";
}
filenum = filenames.AddObject( s_file );
//if ( !compiler.CompileFile( src, filename, filenum ) )
if ( !compiler.CompileFile( src, filenum ) )
{
s_file = oldfile;
gi.FS_FreeFile( src );
gi.WPrintf( "Compile failed.\n" );
throw "Error";
}
gi.FS_FreeFile( src );
s_file = oldfile;
}
开发者ID:UberGames,项目名称:EF2GameSource,代码行数:29,代码来源:program.cpp
示例8: fnFolder
CompilerPtr CompilerLocatorCrossGCC::Locate(const wxString& folder, bool clear)
{
if(clear) {
m_compilers.clear();
}
wxArrayString matches;
wxFileName fnFolder(folder, "");
// We collect "*-gcc" files
wxString pattern = "*-gcc";
#ifdef __WXMSW__
pattern << ".exe";
#endif
int count = wxDir::GetAllFiles(fnFolder.GetPath(), &matches, pattern, wxDIR_FILES);
if(count == 0) {
// try to see if we have a 'bin' folder under 'folder'
fnFolder.AppendDir("bin");
if(wxDir::Exists(fnFolder.GetPath())) {
count = wxDir::GetAllFiles(fnFolder.GetPath(), &matches, pattern, wxDIR_FILES);
}
}
if(count == 0) return NULL;
for(int i = 0; i < count; ++i) {
#ifndef __WXMSW__
// Check if this is a script
char sha[2];
wxFile(matches[i]).Read(sha, 2);
if(strncmp(sha, "#!", 2) == 0) {
continue;
}
#endif
wxFileName filename(matches.Item(i));
if(filename.GetName() == "mingw32-gcc" || filename.GetName() == "x86_64-w64-mingw32-gcc") {
// Don't include standard mingw32-gcc (32 and 64 bit) binaries
// they will be picked up later by the MinGW locator
continue;
}
CompilerPtr compiler(new Compiler(NULL));
compiler->SetCompilerFamily(COMPILER_FAMILY_GCC);
// get the compiler version
compiler->SetName(filename.GetName());
compiler->SetGenerateDependeciesFile(true);
m_compilers.push_back(compiler);
// we path the bin folder
AddTools(compiler, filename.GetPath(), filename.GetName().BeforeLast('-'), filename.GetExt());
}
if(m_compilers.empty()) {
return NULL;
} else {
return *m_compilers.begin();
}
}
开发者ID:LoviPanda,项目名称:codelite,代码行数:60,代码来源:CompilerLocatorCrossGCC.cpp
示例9: main
int main(int argc, char ** argv) {
std::vector<std::string> args(argv, argv + argc);
#if defined(TILEK_ACCELERATOR)
# if defined(TILEK_TARGET_OPENCL)
args.push_back("-DSKIP_OPENCL_SPECIFIC_DEFINITION");
# endif
#endif
SgProject * project = new SgProject(args);
assert(project->numberOfFiles() == 1);
SgSourceFile * source_file = isSgSourceFile(project->get_fileList()[0]);
assert(source_file != NULL);
std::string filename = source_file->get_sourceFileNameWithoutPath();
std::string basename = filename.substr(0, filename.find_last_of('.'));
KLT::DLX::Compiler< ::DLX::TileK::language_t, ::KLT::TileK::Generator> compiler(project, KLT_PATH, TILEK_PATH, basename);
// MFB::api_t * api = compiler.getDriver().getAPI();
// dump_api(api);
compiler.compile(project);
project->unparse();
return 0;
}
开发者ID:8l,项目名称:rose,代码行数:29,代码来源:tilek.cpp
示例10: compile_integer
void compile_integer(std::vector<std::string>& input, std::string& output, size_t memory_limit,
size_t partition_size = 0) {
keyvi::dictionary::DictionaryCompiler<
keyvi::dictionary::fsa::internal::SparseArrayPersistence<BucketT>,
keyvi::dictionary::fsa::internal::IntValueStoreWithInnerWeights> compiler(
memory_limit);
std::function<std::pair<std::string, uint32_t>(std::string)> parser = [] (std::string line) {
size_t tab = line.find('\t');
if (tab == std::string::npos)
return std::pair<std::string, uint32_t>();
std::string key = line.substr(0, tab);
std::string value_as_string = line.substr(tab + 1);
uint32_t value;
try {
value = boost::lexical_cast<uint32_t>(value_as_string);
} catch (boost::bad_lexical_cast const&) {
std::cout << "Error: value was not valid: " << line << std::endl;
return std::pair<std::string, uint32_t>();
}
return std::pair<std::string, uint32_t>(key, value);
};
compile_multiple(compiler, parser, input);
finalize_compile(compiler, output, partition_size);
}
开发者ID:Wajih-O,项目名称:keyvi,代码行数:29,代码来源:keyvicompiler.cpp
示例11: SetCurrentProcessSandbox
// Common code for sandbox startup.
static void
SetCurrentProcessSandbox(UniquePtr<sandbox::bpf_dsl::Policy> aPolicy)
{
MOZ_ASSERT(gSandboxCrashFunc);
// Note: PolicyCompiler borrows the policy and registry for its
// lifetime, but does not take ownership of them.
sandbox::bpf_dsl::PolicyCompiler compiler(aPolicy.get(),
sandbox::Trap::Registry());
auto program = compiler.Compile();
if (SandboxInfo::Get().Test(SandboxInfo::kVerbose)) {
sandbox::bpf_dsl::DumpBPF::PrintProgram(*program);
}
InstallSigSysHandler();
#ifdef MOZ_ASAN
__sanitizer_sandbox_arguments asanArgs;
asanArgs.coverage_sandboxed = 1;
asanArgs.coverage_fd = -1;
asanArgs.coverage_max_block_size = 0;
__sanitizer_sandbox_on_notify(&asanArgs);
#endif
// The syscall takes a C-style array, so copy the vector into one.
UniquePtr<sock_filter[]> flatProgram(new sock_filter[program->size()]);
for (auto i = program->begin(); i != program->end(); ++i) {
flatProgram[i - program->begin()] = *i;
}
BroadcastSetThreadSandbox(Move(flatProgram), program->size());
}
开发者ID:paulmadore,项目名称:luckyde,代码行数:33,代码来源:Sandbox.cpp
示例12: _eval
//! (static)
ObjRef _eval(Runtime & runtime, const CodeFragment & code){
Compiler compiler(runtime.getLogger());
ERef<UserFunction> script = compiler.compile(code);
if(script.isNull())
return nullptr;
return runtime.executeFunction(script.get(),nullptr,ParameterValues());
}
开发者ID:BackupTheBerlios,项目名称:escript-svn,代码行数:8,代码来源:RuntimeHelper.cpp
示例13: DeviceLinked
ShaderModuleBase::ShaderModuleBase(DevicePtr dptr, const SpirVData& data) : DeviceLinked(dptr), _module(create_shader_module(dptr, data)) {
spirv_cross::Compiler compiler(std::vector<u32>(data.data(), data.data() + data.size() / 4));
_type = module_type(compiler);
auto resources = compiler.get_shader_resources();
merge(_bindings, create_bindings(compiler, resources.uniform_buffers, _type, vk::DescriptorType::eUniformBuffer));
merge(_bindings, create_bindings(compiler, resources.storage_buffers, _type, vk::DescriptorType::eStorageBuffer));
merge(_bindings, create_bindings(compiler, resources.sampled_images, _type, vk::DescriptorType::eCombinedImageSampler));
merge(_bindings, create_bindings(compiler, resources.storage_images, _type, vk::DescriptorType::eStorageImage));
_push_constants = create_push_constants(compiler, resources.push_constant_buffers, _type);
_attribs = create_attribs(compiler, resources.stage_inputs);
// these are attribs & other stages stuff
fail_not_empty(resources.atomic_counters);
fail_not_empty(resources.separate_images);
fail_not_empty(resources.separate_samplers);
u32 spec_offset = 0;
for(const auto& cst : compiler.get_specialization_constants()) {
const auto& type = compiler.get_type(compiler.get_constant(cst.id).constant_type);
u32 size = type.width / 8;
_spec_constants << vk::SpecializationMapEntry(cst.constant_id, spec_offset, size);
spec_offset += size;
}
for(usize i = 0; i != 3; ++i) {
_local_size[i] = compiler.get_execution_mode_argument(spv::ExecutionMode::ExecutionModeLocalSize, i);
}
}
开发者ID:gan74,项目名称:Yave,代码行数:32,代码来源:ShaderModuleBase.cpp
示例14: compiler
inline void z::CmakeGenerator::Impl::generateConfig(const z::Ast::Config& config) {
z::Compiler compiler(_project, config);
compiler.compile();
z::dir::mkpath(config.srcdir() + "/");
z::ofile osPro(config.srcdir() + "/" + "CMakeLists.txt");
generateProject(config, osPro);
}
开发者ID:renjipanicker,项目名称:zenlang,代码行数:7,代码来源:CmakeGenerator.cpp
示例15: parse
void parse(std::vector<Instruction> &insns, FILE *input) {
Compiler compiler(&insns);
int ch = 0;
while ((ch=getc(input)) != EOF) {
switch (ch) {
case '+':
compiler.push_simple(INC);
break;
case '-':
compiler.push_simple(DEC);
break;
case '>':
compiler.push_simple(NEXT);
break;
case '<':
compiler.push_simple(PREV);
break;
case ',':
compiler.push_simple(GET);
break;
case '.':
compiler.push_simple(PUT);
break;
case '[':
compiler.push_open();
break;
case ']':
compiler.push_close();
break;
}
}
compiler.push_simple(END);
}
开发者ID:hogelog,项目名称:sample-code,代码行数:33,代码来源:bf-vm2.cpp
示例16: rMessage
void Doom3MapCompiler::generateProc(const scene::INodePtr& root)
{
rMessage() << "=== DMAP: GenerateProc ===" << std::endl;
ProcCompiler compiler(root);
_procFile = compiler.generateProcFile();
}
开发者ID:OpenTechEngine,项目名称:DarkRadiant,代码行数:8,代码来源:Doom3MapCompiler.cpp
示例17: tokenizer
void GssEngine::compile(string code)
{
instruction_pointer = 0;
locals_stack_position = 0;
try
{
GssTokenizer tokenizer(code);
GssCompiler compiler(tokenizer);
compiler.setNativeFunctions(native_functions);
compiler.compile();
LOG(INFO) << "----------------";
int idx = 0;
for(const GssInstruction& i : compiler.instructions)
{
LOG(INFO) << idx << ": " << i.toString();
idx++;
}
LOG(INFO) << "----------------";
instructions = compiler.instructions;
string_table = compiler.string_table;
}catch(GssTokenizerException e)
{
LOG(ERROR) << e.message;
return;
}catch(GssCompilerException e)
{
LOG(ERROR) << e.message;
return;
}
memory = new GssMemory(1024*1024);
for(unsigned int index=0; index<native_functions.size(); index++)
{
GssVariant* v = memory->getGlobal(index);
v->type = GssVariant::Type::native_function;
v->data.i = index;
}
try
{
while(instruction_pointer < instructions.size())
{
step();
}
LOG(INFO) << "Finished";
}catch(GssRuntimeException e)
{
LOG(ERROR) << e.message;
}catch(GssMemoryException e)
{
LOG(ERROR) << e.message;
}
LOG(INFO) << "Free memory: " << memory->getFreeMemoryAmount();
}
开发者ID:daid,项目名称:GruesomeSpace,代码行数:56,代码来源:gss.cpp
示例18: compiler
void tst_QDjangoCompiler::fieldNames()
{
QDjangoCompiler compiler("Owner", QDjango::database());
QCOMPARE(compiler.fieldNames(false), QStringList()
<< "\"owner\".\"id\""
<< "\"owner\".\"name\""
<< "\"owner\".\"item1_id\""
<< "\"owner\".\"item2_id\"");
QCOMPARE(compiler.fromSql(), QLatin1String("\"owner\""));
}
开发者ID:explicitcall,项目名称:qdjango,代码行数:10,代码来源:main.cpp
示例19: compiler
void Compiler::compileExpression(VM& vm, ErrorReporter& reporter,
gc<Expr> expr, Module* module)
{
Compiler compiler(vm, reporter);
compiler.declareTopLevel(expr, module);
gc<Chunk> code = ExprCompiler(compiler).compileBody(module, expr);
module->setBody(code);
}
开发者ID:DawidvC,项目名称:magpie,代码行数:10,代码来源:Compiler.cpp
示例20: masterPath
void CompilerLocatorCygwin::AddTools(const wxString& binFolder, const wxString& name, const wxString& suffix)
{
wxFileName masterPath(binFolder, "");
masterPath.RemoveLastDir();
// Create an empty compiler
CompilerPtr compiler( new Compiler(NULL) );
compiler->SetCompilerFamily(COMPILER_FAMILY_CYGWIN);
compiler->SetGenerateDependeciesFile(true);
compiler->SetName( name );
compiler->SetInstallationPath( masterPath.GetPath() );
m_compilers.push_back( compiler );
CL_DEBUG("Found Cygwin compiler under: %s. \"%s\"", masterPath.GetPath(), compiler->GetName());
wxFileName toolFile(binFolder, "");
toolFile.SetFullName( "g++-" + suffix + ".exe" );
AddTool(compiler, "CXX", toolFile.GetFullPath());
AddTool(compiler, "LinkerName", toolFile.GetFullPath());
AddTool(compiler, "SharedObjectLinkerName", toolFile.GetFullPath(), "-shared -fPIC");
toolFile.SetFullName( "gcc-" + suffix + ".exe" );
AddTool(compiler, "CC", toolFile.GetFullPath());
toolFile.SetFullName("ar.exe");
AddTool(compiler, "AR", toolFile.GetFullPath(), "rcu");
toolFile.SetFullName("windres.exe");
AddTool(compiler, "ResourceCompiler", toolFile.GetFullPath());
toolFile.SetFullName("as.exe");
AddTool(compiler, "AS", toolFile.GetFullPath());
toolFile.SetFullName("make.exe");
wxString makeExtraArgs;
if ( wxThread::GetCPUCount() > 1 ) {
makeExtraArgs << "-j" << wxThread::GetCPUCount();
}
if ( toolFile.FileExists() ) {
AddTool(compiler, "MAKE", toolFile.GetFullPath(), makeExtraArgs);
} else {
toolFile.SetFullName("mingw32-make.exe");
if ( toolFile.FileExists() ) {
AddTool(compiler, "MAKE", toolFile.GetFullPath(), makeExtraArgs);
}
}
AddTool(compiler, "MakeDirCommand", "mkdir", "-p");
toolFile.SetFullName("gdb.exe");
if ( toolFile.FileExists() ) {
AddTool(compiler, "Debugger", toolFile.GetFullPath());
}
}
开发者ID:292388900,项目名称:codelite,代码行数:55,代码来源:CompilerLocatorCygwin.cpp
注:本文中的compiler函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论