예제 #1
0
 protected sunRelocation(sunBinary binary)
 {
     if (binary == null)
     {
         throw new ArgumentNullException("binary");
     }
     mBinary = binary;
     mPoint  = mBinary.Offset;
 }
예제 #2
0
 protected sunSymbolRelocation(sunBinary binary, TSymbol symbol)
     : base(binary)
 {
     if (symbol == null)
     {
         throw new ArgumentNullException("symbol");
     }
     mSymbol = symbol;
 }
예제 #3
0
파일: compiler.cs 프로젝트: RenolY2/ssc
        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);
        }
예제 #4
0
 public sunVariableSetSite(sunBinary binary, sunVariableSymbol symbol)
     : base(binary, symbol)
 {
     mBinary.WriteASS(0, 0);
 }
예제 #5
0
 public sunFunctionCallSite(sunBinary binary, sunFunctionSymbol symbol, int argCount)
     : base(binary, symbol)
 {
     mArgCount = argCount;
     mBinary.WriteCALL(0, 0);
 }
예제 #6
0
 public sunBuiltinCallSite(sunBinary binary, sunBuiltinSymbol symbol, int argCount)
     : base(binary, symbol)
 {
     mArgCount = argCount;
     mBinary.WriteFUNC(0, 0);
 }
예제 #7
0
 public sunJumpSite(sunBinary binary)
     : base(binary)
 {
     mBinary.WriteJMP(0);
 }
예제 #8
0
 public sunJumpNotEqualSite(sunBinary binary)
     : base(binary)
 {
     mBinary.WriteJNE(0);
 }
예제 #9
0
 public sunVariableDecSite(sunBinary binary, sunVariableSymbol symbol)
     : base(binary, symbol)
 {
     mBinary.WriteDEC(0, 0);
 }