public sunCompilerResults Compile(string name, sunBinary binary, sunImportResolver resolver) { if (name == null) { throw new ArgumentNullException("name"); } if (binary == null) { throw new ArgumentNullException("binary"); } if (resolver == null) { throw new ArgumentNullException("resolver"); } var results = new sunCompilerResults(); var timer = Stopwatch.StartNew(); try { mBinary = binary; mResolver = resolver; mContext.Clear(); mBinary.Open(); mBinary.BeginText(); CompileBody(name); CompileFunctions(); #if SSC_CLEAN_SYMBOLS CleanSymbols(); #endif CompileRelocations(); mBinary.EndText(); mBinary.BeginData(); CompileData(); mBinary.EndData(); mBinary.BeginSymbol(); CompileSymbols(); mBinary.EndSymbol(); mBinary.Close(); results.Data = mContext.DataTable.ToArray(); results.Symbols = mContext.SymbolTable.Select(i => new sunSymbolInfo(i.Type, i.Name)).ToArray(); } catch (sunCompilerException ex) { results.Error = ex; } timer.Stop(); results.CompileTime = timer.Elapsed; return(results); }
public sunCompilerResults Compile(string name, Stream output, sunImportResolver resolver) { return(Compile(name, new sunSpcBinary(output), resolver)); }