Ejemplo n.º 1
0
 protected sunRelocation(sunBinary binary)
 {
     if (binary == null)
     {
         throw new ArgumentNullException("binary");
     }
     mBinary = binary;
     mPoint  = mBinary.Offset;
 }
Ejemplo n.º 2
0
 protected sunSymbolRelocation(sunBinary binary, TSymbol symbol)
     : base(binary)
 {
     if (symbol == null)
     {
         throw new ArgumentNullException("symbol");
     }
     mSymbol = symbol;
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public sunVariableSetSite(sunBinary binary, sunVariableSymbol symbol)
     : base(binary, symbol)
 {
     mBinary.WriteASS(0, 0);
 }
Ejemplo n.º 5
0
 public sunFunctionCallSite(sunBinary binary, sunFunctionSymbol symbol, int argCount)
     : base(binary, symbol)
 {
     mArgCount = argCount;
     mBinary.WriteCALL(0, 0);
 }
Ejemplo n.º 6
0
 public sunBuiltinCallSite(sunBinary binary, sunBuiltinSymbol symbol, int argCount)
     : base(binary, symbol)
 {
     mArgCount = argCount;
     mBinary.WriteFUNC(0, 0);
 }
Ejemplo n.º 7
0
 public sunJumpSite(sunBinary binary)
     : base(binary)
 {
     mBinary.WriteJMP(0);
 }
Ejemplo n.º 8
0
 public sunJumpNotEqualSite(sunBinary binary)
     : base(binary)
 {
     mBinary.WriteJNE(0);
 }
Ejemplo n.º 9
0
 public sunVariableDecSite(sunBinary binary, sunVariableSymbol symbol)
     : base(binary, symbol)
 {
     mBinary.WriteDEC(0, 0);
 }