private void ChangeCompilerState(ICompiler sender, PascalABCCompiler.CompilerState State, string FileName)
 {
     switch (State)
     {
         case CompilerState.CompilationFinished:
             if (compiler.ErrorsList.Count > 0)
                 foreach (Errors.Error er in compiler.ErrorsList)
                     SendErrorOrWarning(er);
             if (compiler.Warnings.Count > 0)
                 foreach (Errors.Error er in compiler.Warnings)
                     SendErrorOrWarning(er);
             SendCommand(ConsoleCompilerConstants.LinesCompiled, compiler.LinesCompiled.ToString());
             SendCommand(ConsoleCompilerConstants.BeginOffest, compiler.BeginOffset.ToString());
             SendCommand(ConsoleCompilerConstants.VarBeginOffest, compiler.VarBeginOffset.ToString());
             SendCommand(ConsoleCompilerConstants.CompilerOptionsOutputType, ((int)compiler.CompilerOptions.OutputFileType).ToString());
             sendWorkingSet();
             break;
         case CompilerState.Ready:
             if(compilerReloading)
                 sendWorkingSet();
             break;
     }
     if (FileName != null)
         SendCommand(ConsoleCompilerConstants.CommandStartNumber + (int)State, FileName);
     else
         SendCommand(ConsoleCompilerConstants.CommandStartNumber + (int)State);
 }
 public RunController(IDbContext context, ICompiler compiler, IRunner runner, Participant participant = null)
 {
     _context = context;
     _compiler = compiler;
     _runner = runner;
     _participant = participant == null ? GetCurrentParticipant() : participant;
 }
        public bool Compile(CompilationPass pass, ICompiler compiler, CompileToolContext context)
        {
            var sourceRefs = new SourceReference[] { this._sourceRef };
            var project = (IProjectScope)Parent;

            switch (pass)
            {
                case CompilationPass.Pass1RegisterIdentifiers:
                    IIdentifierScope scope;
                    var existingDef = project.Find(this._labelIdentifier, out scope);
                    if (existingDef != null && scope == project)
                    {
                        context.AddMessage(new BinaryCompileMessage { Filename = this._filename, Line = 0, Message = "Identifier already exists in this scope", MessageLevel = Level.Error });
                        return false;
                    }
                    this._labelInstruction = new LabelInstruction(sourceRefs);
                    project.Add(new BinaryFileLabel(this._labelIdentifier, this._labelInstruction, this._sourceRef));
                    break;

                case CompilationPass.Pass3GenerateCode:
                    compiler.AddInstruction(this._labelInstruction, context);
                    compiler.AddInstruction(new BinaryFileDataInstruction(this._filename, sourceRefs), context);
                    break;
            }

            return true;
        }
        public void Init(ICompiler compiler)
        {
            this.compiler = compiler;

            this.compiler.BeforeConvertCsToJsEntity += Compiler_BeforeConvertCsToJsEntity;
            // Our main Ast Gen...
            this.compiler.AfterConvertCsToJsEntity += Compiler_AfterConvertCsToJsEntity;
            this.compiler.AfterMergeJsFiles += Compiler_AfterMergeJsFiles;
            this.compiler.BeforeSaveJsFiles += Compiler_BeforeSaveJsFiles;

            #region Unused SharpKit Compiler Events
            //Compiler.BeforeParseCs += new Action(Compiler_BeforeParseCs);
            //Compiler.AfterParseCs += new Action(Compiler_AfterParseCs);
            //Compiler.BeforeApplyExternalMetadata += new Action(Compiler_BeforeApplyExternalMetadata);
            //Compiler.AfterApplyExternalMetadata += new Action(Compiler_AfterApplyExternalMetadata);
            //Compiler.BeforeConvertCsToJs += new Action(Compiler_BeforeConvertCsToJs);
            //Compiler.AfterConvertCsToJs += new Action(Compiler_AfterConvertCsToJs);
            //Compiler.BeforeMergeJsFiles += new Action(Compiler_BeforeMergeJsFiles);
            //Compiler.BeforeInjectJsCode += new Action(Compiler_BeforeInjectJsCode);
            //Compiler.AfterInjectJsCode += new Action(Compiler_AfterInjectJsCode);
            //Compiler.BeforeOptimizeJsFiles += new Action(Compiler_BeforeOptimizeJsFiles);
            //Compiler.AfterOptimizeJsFiles += new Action(Compiler_AfterOptimizeJsFiles);
            //Compiler.AfterSaveJsFiles += new Action(Compiler_AfterSaveJsFiles);
            //Compiler.BeforeEmbedResources += new Action(Compiler_BeforeEmbedResources);
            //Compiler.AfterEmbedResources += new Action(Compiler_AfterEmbedResources);
            //Compiler.BeforeSaveNewManifest += new Action(Compiler_BeforeSaveNewManifest);
            //Compiler.AfterSaveNewManifest += new Action(Compiler_AfterSaveNewManifest);
            //Compiler.BeforeExit += new Action(Compiler_BeforeExit);
            #endregion
        }
 public ScoresController(IDbContext context, ICompiler compiler, IRunner runner, Participant participant = null)
 {
     _context = context;
     _compiler = compiler;
     _runner = runner;
     _participant = participant ?? GetCurrentParticipant();
 }
        public void SetUp()
        {
            _contextMock = new Mock<IDbContext>();

            _compiler = new TestCompiler();
            _participant = new Participant{Email = "", Id = 12};
            _controller = new BuildController(_contextMock.Object, _compiler, _participant);
        }
 public LineCoverageCalc(ITestExplorer testExplorer,
     ICompiler compiler,
     ITestRunner testRunner)
 {
     _testExplorer = testExplorer;
     _compiler = compiler;
     _testRunner = testRunner;
 }
        public FieldCompiler(ICompiler compiler, VariableDeclaration variableDeclaration)
        {
            _compiler = compiler;
            _variableDeclaration = variableDeclaration;

            var className = ((ClassType)_compiler.GetPreviousContextFromStack(0)).Name;
            _javaClass = JavaClassMetadata.GetClass(className);
        }
			public void SetUp()
			{
				log = Substitute.For<ILog>();
				loader = Substitute.For<ILoader>();
				compiler = Substitute.For<ICompiler>();
				
				compileCommand = new CompileCommand(log, loader, compiler);
			}
 public JavaCompileDisassemblePlagiarismDetector(
     ICompiler compiler,
     string compilerPath,
     IDisassembler disassembler,
     ISimilarityFinder similarityFinder)
     : base(compiler, compilerPath, disassembler, similarityFinder)
 {
 }
Beispiel #11
0
        public virtual void EmitWriteValue(ICompiler<ObjectWriter> c, int stream, int fieldValue, int session)
        {
            var converted = c.Convert<object>(fieldValue);
            var method = typeof(ValueSerializer).GetTypeInfo().GetMethod(nameof(WriteValue));

            //write it to the value serializer
            var vs = c.Constant(this);
            c.EmitCall(method, vs, stream, converted, session);
        }
 private async Task<CompilationResult> CompileWith(ICompiler compiler, string contentId, IFile file)
 {
     CompilationResult result = await compiler.Compile(file);
     if (result.Success)
     {
         Cache[contentId] = new WeakReference<Type>(result.GetCompiledType());
     }
     return result;
 }
Beispiel #13
0
        // -------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------
        public Main(IFactory factory)
            : base(factory)
        {
            this.compiler = factory.Resolve<ICompiler>();
            this.compilerState = factory.Resolve<ICompilationState>();

            this.includes = new List<CarbonDirectory>();
            this.jobs = new Dictionary<CompilationJob, int>();
            this.includeJobDictionary = new Dictionary<string, CompilationJob>();
        }
        public ConstructorCompiler(ICompiler compiler, IList<MethodDeclaration> constructors, ClassType classType)
        {
            _compiler = compiler;
            _constructors = constructors;
            _classType = classType;
            _classIsExtending = !string.IsNullOrEmpty(_classType.Extends);
            _classMetadata = JavaClassMetadata.GetClass(_classType.Name);

            _targetMethodName = string.Format("{0}Constructor_", _classType.Name);
        }
Beispiel #15
0
 public void Process(ChunkReader reader, Machine machine, ICompiler compiler)
 {
     if (this.count > 0)
         for (int k = 0; k < this.count; k++)
             this.process(machine, compiler, reader.GetChunk());
     else
         for (string text = reader.GetChunk(); text != null; text = reader.GetChunk())
             if (string.IsNullOrEmpty(text.Trim()))
                 return;
             else
                 this.process(machine, compiler, text);
 }
 protected CompileDisassemblePlagiarismDetector(
     ICompiler compiler,
     string compilerPath,
     IDisassembler disassembler,
     ISimilarityFinder similarityFinder)
 {
     this.Compiler = compiler;
     this.CompilerPath = compilerPath;
     this.Disassembler = disassembler;
     this.similarityFinder = similarityFinder;
     this.sourcesCache = new Dictionary<string, string>();
 }
        public MethodCallExpressionCompiler(ICompiler compiler, MethodCallExpression methodCallExpression, IList<InnerExpressionProcessingListItem> list)
        {
            var itemIndex = list == null ? 0 : list.IndexOf(list.First(x => x.AstNode == methodCallExpression));

            _compiler = compiler;
            _methodCallExpression = methodCallExpression;

            if (itemIndex > 0)
            {
                _previousExpression = list[itemIndex - 1].AstNode;
            }
        }
Beispiel #18
0
        public static void Apply(ICompiler<SyntaxToken, SyntaxNode, SemanticModel> compiler)
        {
            var lexical = compiler.Lexical();

            //aca se hacen los cambios antes de llegar a Roslyn, o sea, aca no hay nada compilado
            lexical
                .match() //le dices que vas a buscar un patron
                    .token("repository", named: "keyword")  //algo que diga repository
                    .identifier()                           //seguido de un identificador
                    .token('{')                             //seguido de un {
                    .then(compiler.Lexical().transform()    //cuando lo encuentre
                        .replace("keyword", "class ")        //cambia repository por class
                        .then(Repository));                 //y cuando se compile te llama a esta funcion con la clase
        }
        public void SetUp()
        {
            _contextMock = new Mock<IDbContext>();

            _compiler = new TestCompiler();
            _runner = new TestRunner();
            var scores = new Collection<Score> { };
            scores.Add(new Score { Assignment = new Assignment { Id = 1 } });
            _participant = new Participant { Id = 1, Email = "", Scores = scores, UserSetting = null };
            Progress progress = new Progress { Assignment = new Assignment { Id = 1, MaxSolveTime = 1000, RunCodeInput = "test", RunCodeOuput = "test" }, Id = 1, StartTime = DateTime.Now, Participant = _participant };
            _participant.Progress = progress;
            _controller = new ScoresController(_contextMock.Object, _compiler, _runner, _participant);
            MapperConfig.Configure();
        }
Beispiel #20
0
        public static void Apply(ICompiler<SyntaxToken, SyntaxNode, SemanticModel> compiler)
        {
            compiler.Environment()
                .dependency<IVector>("Excess.Extensions.R");

            compiler.Lexical()
                .grammar<RGrammar, ParserRuleContext>("R", ExtensionKind.Code)
                    .transform<RParser.ProgContext>(Program)
                    .transform<RParser.Expr_or_assignContext>(EitherOr)
                    .transform<RParser.ExpressionStatementContext>(ExpressionStatement)
                    .transform<RParser.AssignmentContext>(AssignmentStatement)
                    .transform<RParser.RightAssignmentContext>(RightAssignment)
                    .transform<RParser.SignContext>(UnaryOperator)
                    .transform<RParser.NegationContext>(UnaryOperator)
                    .transform<RParser.MultiplicationContext>(BinaryOperator)
                    .transform<RParser.AdditionContext>(BinaryOperator)
                    .transform<RParser.ComparisonContext>(BinaryOperator)
                    .transform<RParser.LogicalAndContext>(BinaryOperator)
                    .transform<RParser.LogicalOrContext>(BinaryOperator)
                    .transform<RParser.FunctionContext>(Function)
                    .transform<RParser.FunctionCallContext>(FunctionCall)
                    .transform<RParser.CompoundContext>(Compound)
                    .transform<RParser.IfStatementContext>(IfStatement)
                    .transform<RParser.IfElseStatementContext>(IfElseStatement)
                    .transform<RParser.ForEachStatementContext>(ForEachStatement)
                    .transform<RParser.WhileStatementContext>(WhileStatement)
                    .transform<RParser.RepeatStatementContext>(RepeatStatement)
                    .transform<RParser.BreakStatementContext>(BreakStatement)
                    .transform<RParser.ParenthesizedContext>(Parenthesized)
                    .transform<RParser.IdentifierContext>(Identifier)
                    .transform<RParser.StringLiteralContext>(StringLiteral)
                    .transform<RParser.HexLiteralContext>(HexLiteral)
                    .transform<RParser.IntLiteralContext>(IntLiteral)
                    .transform<RParser.FloatLiteralContext>(FloatLiteral)
                    .transform<RParser.ComplexLiteralContext>(ComplexLiteral)
                    .transform<RParser.NullLiteralContext>(NullLiteral)
                    .transform<RParser.NAContext>(NA)
                    .transform<RParser.InfLiteralContext>(InfLiteral)
                    .transform<RParser.NanLiteralContext>(NanLiteral)
                    .transform<RParser.TrueLiteralContext>(TrueLiteral)
                    .transform<RParser.FalseLiteralContext>(FalseLiteral)
                    .transform<RParser.SublistContext>(ArgumentList)
                    .transform<RParser.IndexContext>(Index)
                    .transform<RParser.SequenceContext>(LinearSequence)

                    .then(Transform)
            ;
        }
        public ICompilerConfiguration CompilerFor(string extension, ICompiler compiler)
        {
            var possible = _compilers.SingleOrDefault(c => string.Compare(c.Key, extension, StringComparison.OrdinalIgnoreCase) == 0);

            var newComp = new KeyValuePair<string, ICompiler>(extension, compiler);
            if (possible.Key != null)
            {
                var index = _compilers.IndexOf(possible);
                _compilers.Remove(possible);
                _compilers.Insert(index, newComp);
            }
            else
            {
                _compilers.Add(newComp);
            }

            return this;
        }
		public GeneralOptionsPanel ()
		{
			this.Build ();
			
			object[] compilers = AddinManager.GetExtensionObjects ("/ValaBinding/Compilers");
		
			foreach (ICompiler compiler in compilers) {
				vala_compilers.Add (compiler);
			}
			
			foreach (ICompiler compiler in vala_compilers)
				valaCombo.AppendText (compiler.Name);
			
			string vala_compiler = PropertyService.Get<string> ("ValaBinding.DefaultValaCompiler", new ValaCompiler ().Name);
			
			foreach (ICompiler compiler in vala_compilers) {
				if (compiler.Name == vala_compiler) {
					default_vala_compiler = compiler;
				}
			}
			
			if (default_vala_compiler == null)
				default_vala_compiler = new ValaCompiler ();
			
			int active;
			Gtk.TreeIter iter;
			Gtk.ListStore store;
			
			active = 0;
			store = (Gtk.ListStore)valaCombo.Model;
			store.GetIterFirst (out iter);
			
			while (store.IterIsValid (iter)) {
				if ((string)store.GetValue (iter, 0) == default_vala_compiler.Name) {
					break;
				}
				store.IterNext (ref iter);
				active++;
			}

			valaCombo.Active = active;
		}
Beispiel #23
0
        public static ICompilerCache Get(bool direct, string cachedir, string compiler, string workdir, Dictionary<string,string> envs, out ICompiler comp )
        {
            comp = null;
            ICompilerCache rv = null;
            if (Settings.ServiceMode) {
                try {
                    rv = new CClashServerClient(cachedir);
                } catch (CClashWarningException) {
                    rv = new NullCompilerCache(cachedir);
                }
            }

            if ( rv == null )
            {
                if (direct) {
                    Logging.Emit("use direct mode");
                    rv = new DirectCompilerCache(cachedir);
                } else {
                    throw new NotSupportedException("ppmode is not supported yet");
                }
            }
            comp = rv.SetCompiler(compiler, workdir, envs);
            return rv;
        }
Beispiel #24
0
		public override void Compile (ICompiler cmp, bool reverse)
		{
			if (CapturingGroup != null)
				base.Compile (cmp, reverse);
			if (literal != null)
				Literal.CompileLiteral (literal, cmp, IgnoreCase, reverse);
		}
Beispiel #25
0
        public static ICompilerCache Get(bool direct, string cachedir, string compiler, string workdir, Dictionary <string, string> envs, out ICompiler comp)
        {
            comp = null;
            ICompilerCache rv = null;

            if (Settings.ServiceMode)
            {
                try {
                    rv = new CClashServerClient(cachedir);
                } catch (CClashWarningException) {
                    rv = new NullCompilerCache(cachedir);
                }
            }

            if (rv == null)
            {
                if (direct)
                {
                    Logging.Emit("use direct mode");
                    rv = new DirectCompilerCache(cachedir);
                }
                else
                {
                    throw new NotSupportedException("ppmode is not supported yet");
                }
            }
            comp = rv.SetCompiler(compiler, workdir, envs);
            return(rv);
        }
Beispiel #26
0
 public CompileLess(ICompiler lessCompiler)
 {
     this.lessCompiler = lessCompiler;
 }
Beispiel #27
0
 protected abstract int OnCacheMissLocked(ICompiler comp, DataHash hc, IEnumerable <string> args, CClashRequest req);
Beispiel #28
0
 public override void Configure(ICompiler compiler)
 {
     new CMakeGenerator(compiler.Environment).Configure();
 }
Beispiel #29
0
 public CompileCoffeeScript(ICompiler coffeeScriptCompiler)
 {
     this.coffeeScriptCompiler = coffeeScriptCompiler;
 }
Beispiel #30
0
 public static ICompiler AddParameters(this ICompiler compiler, IEnumerable <String> parameterNames)
 {
     return(parameterNames.Aggregate(compiler, (current, parameterName) => current.AddParameter(parameterName)));
 }
 private static void ChangeCompilerState(ICompiler sender, PascalABCCompiler.CompilerState State, string FileName)
 {
     switch (State)
     {
         case CompilerState.ParserConnected:
             Console.WriteLine(string.Format(StringResourcesGet("CONNECTED_PARSER{0}"),sender.ParsersController.LastParser));
             return;
     }
     if (DetailOut)
     {
         Console.ForegroundColor = ConsoleColor.Gray;
         if (FileName != null)
         {
             FileName = string.Format("[{0}]{1} {2}...", Math.Round((DateTime.Now - StartTime).TotalMilliseconds), State, System.IO.Path.GetFileName(FileName));
             StartTime = DateTime.Now;
             Console.WriteLine(FileName);
             //Console.Title = FileName;
         }
         else
         {
             Console.WriteLine(string.Format("{0}.", State));
             //Console.Title = State.ToString();
         }
     }
 }
 public static T CompileAndCreateObject <T>(this ICompiler compiler, ICompilerInstructions instructions, params object[] constructorParameters)
 {
     return((T)compiler.CompileAndCreateObject(instructions, constructorParameters));
 }
        public static object RunProducer(this ICompiler compiler, ICompilerInstructions instructions, params object[] constructorParameters)
        {
            var scriptObject = CompileAndCreateObject <IProducer>(compiler, instructions, constructorParameters);

            return(scriptObject.Run());
        }
Beispiel #34
0
        /// <summary>
        /// When this returns, we will hold the output cache mutex.
        /// </summary>
        /// <param name="commonkey"></param>
        /// <param name="manifest"></param>
        /// <returns></returns>
        public override bool CheckCache(ICompiler comp, IEnumerable <string> args, DataHash commonkey, out CacheManifest manifest)
        {
            manifest = null;
            Lock(CacheLockType.Read);
            manifest = GetCachedManifestLocked(commonkey);
            if (manifest != null)
            {
                #region build missed before
                if (manifest.Disable)
                {
                    Logging.Emit("disabled by manifest");
                    return(false);
                }
                #region check includes
                foreach (var f in manifest.PotentialNewIncludes)
                {
                    if (!FileUtils.FileMissing(f))
                    {
                        Logging.Emit("detected added include file {0}", f);
                        Logging.Miss(commonkey.SessionHash, DataHashResult.FileAdded, Directory.GetCurrentDirectory(), comp.SingleSourceFile, f);
                        return(false);
                    }
                }
                var files = new List <string>();
                files.AddRange(manifest.IncludeFiles.Keys);
                var hashes = GetHashes(files);

                foreach (var h in hashes)
                {
                    if (h.Value.Result == DataHashResult.Ok)
                    {
                        string mhash;
                        if (manifest.IncludeFiles.TryGetValue(h.Key, out mhash))
                        {
                            if (mhash != h.Value.Hash)
                            {
                                Logging.Emit("include file hash changed {0}", h.Key);
                                Logging.Miss(commonkey.SessionHash, DataHashResult.FileChanged, Directory.GetCurrentDirectory(), comp.SingleSourceFile, h.Key);
                                return(false);
                            }
                        }
                        else
                        {
                            Logging.Emit("include file added {0}", h.Key);
                            Logging.Miss(commonkey.SessionHash, DataHashResult.FileAdded, Directory.GetCurrentDirectory(), comp.SingleSourceFile, h.Key);
                            return(false);
                        }
                    }
                    else
                    {
                        Logging.Emit("include file hash error {0} {1}", h.Key, h.Value.Result);
                        Logging.Miss(commonkey.SessionHash, h.Value.Result, Directory.GetCurrentDirectory(), comp.SingleSourceFile, h.Key);
                        return(false);
                    }
                }
                #endregion

                #region check pdb
                if (comp.AttemptPdb)
                {
                    if (comp.PdbExistsAlready)
                    {
                        var pdbhash = hasher.DigestBinaryFile(comp.PdbFile);
                        if (pdbhash.Hash != manifest.EarlierPdbHash)
                        {
                            outputCache.Remove(commonkey.Hash);
                            Logging.Miss(commonkey.Hash, DataHashResult.FileChanged, commonkey.Hash, comp.PdbFile, "");
                            return(false);
                        }
                    }
                }
                #endregion

                #region check cached data exists
                foreach (var f in new string[] { F_Manifest, F_Object })
                {
                    if (!outputCache.ContainsEntry(commonkey.SessionHash, f))
                    {
                        outputCache.Remove(commonkey.SessionHash);
                        Logging.Miss(commonkey.SessionHash, DataHashResult.CacheCorrupt, commonkey.SessionHash, comp.SingleSourceFile, "");
                        return(false);
                    }
                }
                #endregion
                if (Settings.MissLogEnabled)
                {
                    Logging.Emit("hit hc={0},dir={1},src={2}", commonkey.Hash, comp.WorkingDirectory, comp.SingleSourceFile);
                }
                return(true); // cache hit, all includes match and no new files added

                #endregion
            }

            Logging.Miss(commonkey.Hash, DataHashResult.NoPreviousBuild, comp.WorkingDirectory, comp.SingleSourceFile, "");
            return(false);
        }
Beispiel #35
0
        protected virtual void DoCacheMiss(ICompiler c, DataHash hc, IEnumerable <string> args, CacheManifest m, List <string> ifiles)
        {
            bool good = true;

            try
            {
                var idirs = c.GetUsedIncludeDirs(ifiles);
                if (idirs.Count < 1)
                {
                    throw new InvalidDataException(
                              string.Format("could not find any include folders?! [{0}]",
                                            string.Join(" ", args)));
                }
                #region process includes folders
                // save manifest and other things to cache
                var others = c.GetPotentialIncludeFiles(idirs, ifiles);
                m = new CacheManifest();
                m.PotentialNewIncludes = others;
                m.IncludeFiles         = new Dictionary <string, string>();
                m.TimeStamp            = DateTime.Now.ToString("s");
                m.SessionHash          = hc.SessionHash;

                #endregion

                var hashes = GetHashes(ifiles);

                #region check include files

                foreach (var x in hashes)
                {
                    if (x.Value.Result == DataHashResult.Ok)
                    {
                        m.IncludeFiles[x.Key] = x.Value.Hash;
                    }
                    else
                    {
                        Logging.Emit("input hash error {0} {1}", x.Key, x.Value.Result);
                        Logging.Miss(hc.SessionHash, x.Value.Result, c.WorkingDirectory, c.SingleSourceFile, x.Key);
                        good      = false;
                        m.Disable = true;
                        break;
                    }
                }

                #endregion
            }
            finally
            {
                Unlock(CacheLockType.Read);
                if (good)
                {
                    Lock(CacheLockType.ReadWrite);
                    try
                    {
                        SaveOutputsLocked(m, c);
                    }
                    finally
                    {
                        Unlock(CacheLockType.ReadWrite);
                    }
                }
            }
        }
 public ConcreteCollectionCompiler(ICompiler scalars, ICompiler nonScalars)
 {
     _scalars    = scalars;
     _nonScalars = nonScalars;
 }
Beispiel #37
0
        public void RegionLoaded(Scene scene)
        {
            if (!m_Enabled)
                return;

            m_EventManager = new EventManager(this);

            m_Compiler = new Compiler(this);

            m_Scene.EventManager.OnRemoveScript += OnRemoveScript;
            m_Scene.EventManager.OnScriptReset += OnScriptReset;
            m_Scene.EventManager.OnStartScript += OnStartScript;
            m_Scene.EventManager.OnStopScript += OnStopScript;
            m_Scene.EventManager.OnGetScriptRunning += OnGetScriptRunning;
            m_Scene.EventManager.OnShutdown += OnShutdown;

            // If region ready has been triggered, then the region had no scripts to compile and completed its other
            // work.
            m_Scene.EventManager.OnRegionReadyStatusChange += s => { if (s.Ready) m_InitialStartup = false; };

            if (m_SleepTime > 0)
            {
                m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoMaintenance),
                                           new Object[]{ m_SleepTime });
            }

            if (m_SaveTime > 0)
            {
                m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoBackup),
                                           new Object[] { m_SaveTime });
            }
        }
 public static object CompileAndCreateObject(this ICompiler compiler, ICompilerInstructions instructions, params object[] constructorParameters)
 {
     return(Activator.CreateInstance(instructions.ClassType, constructorParameters));
 }
 /// <summary>
 /// Constructor. The goal of this constructor is to make
 /// it easy to test the task.
 /// </summary>
 public IronPythonCompilerTask(ICompiler compilerToUse)
 {
     compiler = compilerToUse;
 }
Beispiel #40
0
 public override void Configure(ICompiler compiler)
 {
     XcodeGenerator.Configure(compiler.Environment, compiler.Data.Extensions.BundleFiles);
 }
Beispiel #41
0
 public static ICompiler AddModules(this ICompiler compiler, IEnumerable <Type> modules)
 {
     return(modules.Aggregate(compiler, (current, module) => current.AddModule(module)));
 }
Beispiel #42
0
 public bool IsSupported(ICompiler comp, IEnumerable <string> args)
 {
     return(true);
 }
Beispiel #43
0
 public void apply(ICompiler <TToken, TNode, TModel> compiler)
 {
     _delegate(compiler);
 }
Beispiel #44
0
 public bool CheckCache(ICompiler comp, IEnumerable <string> args, DataHash commonkey, out CacheManifest manifest)
 {
     manifest = null;
     return(false);
 }
Beispiel #45
0
 public CompileController(ICompiler compilerService)
 {
     this._compilerService = compilerService;
 }
Beispiel #46
0
 public void SetCaptureCallback(ICompiler comp, Action <string> onOutput, Action <string> onError)
 {
     stdOutCallback = onOutput;
     stdErrCallback = onError;
 }
Beispiel #47
0
 public int CompileOnly(ICompiler comp, IEnumerable <string> args)
 {
     {
         return(comp.InvokeCompiler(args, null, null, false, null));
     }
 }
 /// <summary>
 /// Compiles or interprets this statement.
 /// </summary>
 /// <param name="compiler">The compiler or interpreter</param>
 public override void AcceptCompiler(ICompiler compiler)
 {
     compiler.CompileParentConstructorCall(this);
 }
Beispiel #49
0
 public abstract bool CheckCache(ICompiler comp, IEnumerable <string> args, DataHash commonkey, out CacheManifest manifest);
Beispiel #50
0
 public DynamicallyCompiledAppAssemblyProvider(ICompiler compiler)
 {
     _compiler = compiler;
 }
Beispiel #51
0
		public override void Compile (ICompiler cmp, bool reverse) {
			// create the meta-collection
			IntervalCollection meta =
				intervals.GetMetaCollection (new IntervalCollection.CostDelegate (GetIntervalCost));

			// count ops
			int count = meta.Count;
			for (int i = 0; i < pos_cats.Length; ++ i) {
				if (pos_cats[i] || neg_cats [i])
					++ count;
			}

			if (count == 0)
				return;

			// emit in op for |meta| > 1
			LinkRef tail = cmp.NewLink ();
			if (count > 1)
				cmp.EmitIn (tail);

			// emit character/range/sets from meta-collection
			// we emit these first so that any 'ignore' flags will be noticed by the evaluator
			foreach (Interval a in meta) {
				if (a.IsDiscontiguous) {			// Set
					BitArray bits = new BitArray (a.Size);
					foreach (Interval b in intervals) {
						if (a.Contains (b)) {
							for (int i = b.low; i <= b.high; ++ i)
								bits[i - a.low] = true;
						}
					}

					cmp.EmitSet ((char)a.low, bits, negate, ignore, reverse);
				}
				else if (a.IsSingleton)				// Character
					cmp.EmitCharacter ((char)a.low, negate, ignore, reverse);
				else						// Range
					cmp.EmitRange ((char)a.low, (char)a.high, negate, ignore, reverse);
			}

			// emit categories
			for (int i = 0; i < pos_cats.Length; ++ i) {
				if (pos_cats[i]) {
					if (neg_cats [i])
						cmp.EmitCategory (Category.AnySingleline, negate, reverse);
					else
						cmp.EmitCategory ((Category)i, negate, reverse);
				} else if (neg_cats[i]) {
					cmp.EmitNotCategory ((Category)i, negate, reverse);
				}
			}

			// finish up
			if (count > 1) {
				if (negate)
					cmp.EmitTrue ();
				else
					cmp.EmitFalse ();

				cmp.ResolveLink (tail);
			}
		}
Beispiel #52
0
 public override void EmitWriteValue(ICompiler <ObjectWriter> c, int stream, int fieldValue, int session)
 {
     throw new UnsupportedTypeException(_invalidType, _errorMessage);
 }
		protected virtual void OnValaComboChanged (object sender, System.EventArgs e)
		{
			 string activeCompiler = valaCombo.ActiveText;
			
			foreach (ICompiler compiler in vala_compilers) {
				if (compiler.Name == activeCompiler) {
					 default_vala_compiler = compiler;
				}
			}
			
			if (default_vala_compiler == null)
				default_vala_compiler = new ValaCompiler ();
		}
Beispiel #54
0
 public override int EmitReadValue([NotNull] ICompiler <ObjectReader> c, int stream, int session,
                                   [NotNull] FieldInfo field)
 {
     throw new UnsupportedTypeException(_invalidType, _errorMessage);
 }
        /// <summary>
        /// Main entry point for the task
        /// </summary>
        /// <returns></returns>
        public override bool Execute()
        {
            Log.LogMessage(MessageImportance.Normal, "Iron Python Compilation Task");

            // Create the compiler if it does not already exist
            CompilerErrorSink errorSink = new CompilerErrorSink(this.Log);
            errorSink.ProjectDirectory = ProjectPath;
            if (compiler == null)
            {
                if (UseExperimentalCompiler)
                    compiler = new ExperimentalCompiler(new List<string>(this.SourceFiles), this.OutputAssembly, errorSink);
                else
                    compiler = new Compiler(new List<string>(this.SourceFiles), this.OutputAssembly, errorSink);
            }

            if (!InitializeCompiler())
                return false;

            // Call the compiler and report errors and warnings
            compiler.Compile();

            return errorSink.BuildSucceeded;
        }
Beispiel #56
0
 /// <summary>
 /// Compiles or interprets this statement.
 /// </summary>
 /// <param name="compiler">The compiler or interpreter</param>
 public override void AcceptCompiler(ICompiler compiler)
 {
     compiler.CompileItemRef(this);
 }
 public override int CompileOrCache(ICompiler comp, IEnumerable <string> args)
 {
     return(base.CompileOrCache(comp, args));
 }
Beispiel #58
0
        private void GenerateWithCalculatedVariable(byte variableIndex, ILBuilder il, ICompiler compiler)
        {
            using (var calculatedVariableIndex = il.NewLocal <byte>())
            {
                compiler.EmitLoadVariable(variableIndex);
                calculatedVariableIndex.Store();

                compiler.EmitLoadVariable(calculatedVariableIndex, indirect: true);

                using (var result = il.NewLocal <ushort>())
                {
                    result.Store();
                    compiler.EmitStoreVariable(store, result);
                }
            }
        }
        public static void RunScript(this ICompiler compiler, ICompilerInstructions instructions, params object[] constructorParameters)
        {
            var scriptObject = CompileAndCreateObject <IScript>(compiler, instructions, constructorParameters);

            scriptObject.Run();
        }
Beispiel #60
0
 public static ICompiler AddMathModule(this ICompiler compiler)
 {
     compiler = compiler.AddModule(typeof(Math));
     return(compiler);
 }