コード例 #1
0
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
0
ファイル: main.cpp プロジェクト: nutti/GameEngine
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
0
ファイル: main.cpp プロジェクト: ndalton57/DirectX-11-Project
int main(int argc, char* argv[])
{
	Compiler comp;

	comp.ParseArguments(argc, argv);
	comp.Compile();

	return gReturnCode;
}
コード例 #4
0
ファイル: Main.cpp プロジェクト: Burrito119/BurritoScript
int main()
{

	VM v;
	Compiler cp;
	vector<char> c;
	c = cp.Compile("./test.burr");

	v.Execute(c, c.size());

	getchar();

	return 0;
}
コード例 #5
0
ファイル: main.cpp プロジェクト: SirJonthe/SWSL
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
0
ファイル: ScriptEdit.cpp プロジェクト: TeoTwawki/dltcep
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;
}