本文整理汇总了C++中Compiler::Compile方法的典型用法代码示例。如果您正苦于以下问题:C++ Compiler::Compile方法的具体用法?C++ Compiler::Compile怎么用?C++ Compiler::Compile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Compiler
的用法示例。
在下文中一共展示了Compiler::Compile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
if(argc != 3)
{
std::cout << "codegeneratortester.exe <source name> <output file>" << std::endl;
return -1;
}
std::ostringstream outStream;
Compiler compiler;
if (!compiler.Compile(argv[1], outStream))
{
PrintErrors(compiler.GetErrors());
}
else
{
std::ofstream generated(argv[2]);
if (!generated.bad())
{
generated << outStream.str();
generated.close();
}
else
{
generated.close();
std::cout << "Unable to open " << argv[1] << std::endl;
return -1;
}
}
}
示例2: main
int main( int argc, char** argv )
{
if( argc != 3 ){
std::cout << "Usage : ScriptCompiler.exe source_file out_file" << std::endl;
return -1;
}
Compiler compiler;
VM::Data data;
compiler.Compile( argv[ 1 ], data );
std::string str = argv[ 2 ];
char s[ 4 ];
std::fstream fOut( str.c_str(), std::ios::binary | std::ios::out );
MAPIL::TransformInt32IntoChar( data.m_CommandSize, s, MAPIL::BYTE_ORDER_LITTLE );
fOut.write( s, sizeof( s ) );
fOut.write( reinterpret_cast < char* > ( data.m_Command ), sizeof( char ) * data.m_CommandSize );
MAPIL::TransformInt32IntoChar( data.m_EntryPoint, s, MAPIL::BYTE_ORDER_LITTLE );
fOut.write( s, sizeof( s ) );
MAPIL::TransformInt32IntoChar( data.m_TextSize, s, MAPIL::BYTE_ORDER_LITTLE );
fOut.write( s, sizeof( s ) );
fOut.write( data.m_TextBuffer, sizeof( char ) * data.m_TextSize );
MAPIL::TransformInt32IntoChar( data.m_ValueSize, s, MAPIL::BYTE_ORDER_LITTLE );
fOut.write( s, sizeof( s ) );
fOut.close();
return 0;
}
示例3: main
int main(int argc, char* argv[])
{
Compiler comp;
comp.ParseArguments(argc, argv);
comp.Compile();
return gReturnCode;
}
示例4: main
int main()
{
VM v;
Compiler cp;
vector<char> c;
c = cp.Compile("./test.burr");
v.Execute(c, c.size());
getchar();
return 0;
}
示例5: NewCompilerTest
int NewCompilerTest( void )
{
Compiler c;
swsl::Shader s;
if (!c.Compile("../swsl_samples/interactive.swsl", s)) {
const mtlItem<Compiler::Message> *err = c.GetError();
while (err != NULL) {
swsl::print_ch(err->GetItem().err);
swsl::print_ch(": ");
swsl::print_line(err->GetItem().msg);
err = err->GetNext();
}
return 1;
}
return 0;
}
示例6: compile
int CScriptEdit::compile(CString filepath)
{
CString tmpstr;
CString outpath;
CString syscommand;
CString tmpname;
int res;
res=0;
if(editflg&INTERNALCOMPILER)
{
if(weidupath.IsEmpty())
{
MessageBox("Please set up WeiDU before use.","Script editor",MB_OK|MB_ICONSTOP);
return -1;
}
if(!file_exists(weidupath) )
{
MessageBox("WeiDU executable not found.","Script editor",MB_OK|MB_ICONSTOP);
return -1;
}
}
chdir(bgfolder);
outpath.Format("override");
if(!assure_dir_exists(bgfolder+outpath))
{
tmpstr.Format("%s cannot be created as output path.",outpath);
MessageBox(tmpstr,"Dialog editor",MB_OK|MB_ICONSTOP);
return -1;
}
if(editflg&INTERNALCOMPILER)
{
syscommand=AssembleWeiduCommandLine(filepath,outpath, false); //import (compile)
res=RunWeidu(syscommand);
((CChitemDlg *) AfxGetMainWnd())->rescan_dialog(true);
((CChitemDlg *) AfxGetMainWnd())->scan_override();
}
else
{
Compiler *scmp = new Compiler(weiduflg&WEI_LOGGING);
int x = filepath.ReverseFind('\\');
int y = filepath.ReverseFind('/');
if (x>y) y=x;
if (y>=0)
{
tmpname = filepath.Mid(y+1);
}
else
{
tmpname = filepath;
}
y = tmpname.ReverseFind('.');
if (y>0)
{
tmpname=tmpname.Left(y);
}
//setting up compiler with options
res = scmp->Compile(filepath, bgfolder+"\\"+outpath+"\\"+tmpname+".bcs");
//actually this is not needed, delete will close all anyway
delete scmp;
if (res)
{
MessageBox("Compiler error.","Script editor",MB_OK|MB_ICONSTOP);
res = 0;
}
}
return res;
}