Exemplo n.º 1
0
		public void BuildStandAloneAsync(SourceModule Module)
		{
			if (Module == null)
				return;

			var dir=Path.GetDirectoryName(Module.AbsoluteFileName);
			BuildModuleAsync(Module, dir, dir, true, true);
		}
Exemplo n.º 2
0
		public BuildResult BuildStandAlone(string file)
		{
			var sm = new SourceModule();
			sm.FileName = file;

			BuildStandAlone(sm);

			return sm.LastBuildResult;
		}
Exemplo n.º 3
0
		public void BuildModuleAsync(SourceModule Module, string OutputDirectory, string ExecDirectory, bool Debug, bool LinkToStandAlone)
		{
			if (Module == null)
				return;

			StopBuilding();

			buildThread = new Thread(delegate()
			{
				BuildModule(Module, OutputDirectory,ExecDirectory,Debug, LinkToStandAlone);
				OnBuildFinished(Module.LastBuildResult);
			});

			buildThread.IsBackground = true;
			buildThread.Start();
		}
Exemplo n.º 4
0
        public static void AppendDissassembly(StringBuilder sb, out int hiStart, out int hiEnd, SourceModule module, SourceFileSegment segment)
        {
            hiStart = 0;
            hiEnd   = 0;
            int lineCount = 0;

            if (module == null)
            {
                return;
            }

            sb.Append("Disassembly of ");
            sb.AppendLine(module.Name);
            sb.AppendLine();

            foreach (var section in module.Sections)
            {
                int sectionHiStart, sectionHiEnd;
                AppendDissassembly(sb, out sectionHiStart, out sectionHiEnd, section, segment, module, ref lineCount);
                if (sectionHiEnd > sectionHiStart)
                {
                    hiStart = sectionHiStart;
                    hiEnd   = sectionHiEnd;
                }
            }
        }
Exemplo n.º 5
0
 public override double GetWrapped(double x, double y, int wrap)
 {
     return(SourceModule.GetWrapped(-x, -y, wrap));
 }
Exemplo n.º 6
0
        public override double GetValue(double x, double y, double z)
        {
            double value = SourceModule.GetValue(x, y, z);

            return(value < LowerBound ? LowerBound : (value > UpperBound ? UpperBound : value));
        }
Exemplo n.º 7
0
 public override double GetWrapped(double x, double y, int wrap)
 {
     // Read:
     return(SourceModule.GetColour(x, y).a);
 }
Exemplo n.º 8
0
 public override double GetValue(double x, double y)
 {
     return(1.0 - SourceModule.GetValue(x, y));
 }
Exemplo n.º 9
0
 public override double GetValue(double x, double y)
 {
     return(SourceModule.GetColour(x, y).r);
 }
Exemplo n.º 10
0
 public override UnityEngine.Color GetColour(double x, double y)
 {
     return(SourceModule.GetColour(x, y));
 }
Exemplo n.º 11
0
		public void BuildStandAlone(SourceModule Module)
		{
			BuildModule(Module, Path.GetDirectoryName(Module.FileName), Path.GetDirectoryName(Module.FileName), true, true);
		}
Exemplo n.º 12
0
		public abstract void BuildModule(SourceModule Module, string OutputDirectory, string ExecDirectory, bool DebugCompile, bool LinkToStandAlone);
Exemplo n.º 13
0
		public override void BuildModule(SourceModule Module, string OutputDirectory,string ExecDir, bool DebugCompile, bool Link)
		{
			var dmd = CurrentDMDConfig;
			var dmd_exe = dmd.SoureCompiler;
			var src = Module.AbsoluteFileName;

			var outputDir = Path.IsPathRooted(OutputDirectory) ? OutputDirectory : Path.Combine(Path.GetDirectoryName(src), OutputDirectory);

			// Ensure that target directory exists
			Util.CreateDirectoryRecursively(outputDir);
			
			// Compile .d source file to obj
			var obj = Path.Combine(outputDir, Path.GetFileNameWithoutExtension(src) + ".obj");

			// Check if creation can be skipped
			if (GlobalProperties.Instance.EnableIncrementalBuild &&  !Link && !Module.Modified && File.Exists(obj))
			{
				Module.LastBuildResult = new BuildResult() { SourceFile=src, TargetFile=obj,Successful = true, NoBuildNeeded=true};
				return;
			}

			var br =Module.LastBuildResult= CompileSource(Module,dmd,DebugCompile,obj,ExecDir);

			if (br.Successful)
				Module.ResetModifiedTime();

			if (Link && br.Successful)
			{
				br.Successful = false;

				#region Link To StandAlone executable
				var exe = OutputDirectory + "\\" + Path.GetFileNameWithoutExtension(src) + ".exe";
				br.TargetFile = exe;

				if (GlobalProperties.Instance.EnableIncrementalBuild && br.NoBuildNeeded && File.Exists(br.TargetFile))
				{
					return;
				}

				var br_ = LinkFiles(dmd,dmd.ExeLinker, dmd.BuildArguments(DebugCompile).ExeLinker, Path.GetDirectoryName(obj), exe, DebugCompile, obj);
				
				br.BuildErrors.AddRange(br_.BuildErrors);
				br.AdditionalFiles = br_.AdditionalFiles;
				br.Successful = br_.Successful;
				#endregion
			}		
		}
Exemplo n.º 14
0
		public BuildResult CompileSource(SourceModule Module,DMDConfig dmd,bool DebugCompile, string objFile, string execDirectory)
		{
			var obj = Path.ChangeExtension(objFile, ".obj");
			var br = new BuildResult() { SourceFile = Module.AbsoluteFileName,TargetFile=obj,Successful=true };

			ErrorLogger.Log("Compile " + (Module.Project!=null?Module.Project.ToRelativeFileName( Module.FileName):Module.FileName),ErrorType.Information,ErrorOrigin.Build);

			var dmd_exe = dmd.SoureCompiler;

			// Always enable it to use environment paths to find dmd.exe
			if (!Path.IsPathRooted(dmd_exe) && Directory.Exists(dmd.BaseDirectory))
				dmd_exe = Path.Combine(dmd.BaseDirectory, dmd.SoureCompiler);

			TempPrc = FileExecution.ExecuteSilentlyAsync(dmd_exe,
					BuildDSourceCompileArgumentString(dmd.BuildArguments(DebugCompile).SoureCompiler, Module.AbsoluteFileName, obj,dmd.ImportDirectories), // Compile our program always in debug mode
					execDirectory,
					OnOutput, delegate(string s) {
						var err = ParseErrorMessage(s);
						if (Module.Project != null && Module.Project.ContainsFile(err.FileName))
							err.Project = Module.Project;
						if (err.Type == GenericError.ErrorType.Error)
							br.Successful = false;
						br.BuildErrors.Add(err);
					}, OnExit);

			if (TempPrc != null && !TempPrc.HasExited)
				TempPrc.WaitForExit(MaxCompilationTime);

			br.Successful = br.Successful && TempPrc!=null && TempPrc.ExitCode==0 && File.Exists(obj);
			return br;
		}
Exemplo n.º 15
0
 public override double GetValue(double x, double y)
 {
     return(SourceModule.GetValue(-x, -y));
 }
Exemplo n.º 16
0
        public static void AppendDissassembly(StringBuilder sb, out int hiStart, out int hiEnd, AssemblySection section, SourceFileSegment segment, SourceModule module, ref int lineCount)
        {
            sb.AppendLine();
            sb.AppendLine(section.FunctionName);
            sb.AppendLine();

            hiStart = 0;
            hiEnd   = 0;

            foreach (var s in section.Segments)
            {
                if (section.FunctionName == segment.Function.Name && lineCount == segment.LineNumber)
                {
                    hiStart = sb.Length;
                    hiEnd   = hiStart + s.Length;
                }

                sb.AppendLine(s);

                if (section.FunctionName == segment.Function.Name)
                {
                    lineCount++;
                }
            }
        }
Exemplo n.º 17
0
 /// <summary>
 /// Returns the output of the two source modules added together.
 /// </summary>
 public override double GetValue(double x, double y)
 {
     return(SourceModule.GetValue(x, y) + AlphaModule.GetValue(x, y));
 }
Exemplo n.º 18
0
        public override void BuildModule(SourceModule Module,
                                         string OutputDirectory,
                                         string ExecDirectory,
                                         bool DebugCompile,
                                         bool LinkToStandAlone)
        {
            var src = Module.AbsoluteFileName;

            var outputDir = Path.IsPathRooted(OutputDirectory) ? OutputDirectory : Path.Combine(Path.GetDirectoryName(src), OutputDirectory);

            // Ensure that target directory exists
            Util.CreateDirectoryRecursively(outputDir);

            // Compile .rc source file to res
            var res = Path.Combine(outputDir, Path.GetFileNameWithoutExtension(src) + ".res");

            // Check if creation can be skipped
            if (GlobalProperties.Instance.EnableIncrementalBuild && !Module.Modified && File.Exists(res))
            {
                Module.LastBuildResult = new BuildResult()
                {
                    SourceFile = src, TargetFile = res, Successful = true, NoBuildNeeded = true
                };
                return;
            }

            // Init returned BuildResult-object
            var br = new BuildResult()
            {
                SourceFile = src, TargetFile = res, Successful = true
            };

            // Print verbose information message
            ErrorLogger.Log("Compile " + (Module.Project != null ? Module.Project.ToRelativeFileName(Module.FileName) : Module.FileName), ErrorType.Information, ErrorOrigin.Build);

            var resourceCompiler = ResConfig.Instance.ResourceCompilerPath;

            // Prefer the resource compiler located in D-IDE's bin root
            // Otherwise let the system search along the %PATH% environment variable to find the resource compiler
            if (!Path.IsPathRooted(resourceCompiler) &&
                File.Exists(Path.Combine(Util.ApplicationStartUpPath, resourceCompiler)))
            {
                resourceCompiler = Path.Combine(Util.ApplicationStartUpPath, resourceCompiler);
            }

            TempPrc = FileExecution.ExecuteSilentlyAsync(resourceCompiler,
                                                         BuildResArgumentString(
                                                             ResConfig.Instance.ResourceCompilerArguments,
                                                             src, res, outputDir),
                                                         ExecDirectory,
                                                         // Output handling
                                                         delegate(string s)
            {
                var err = ParseErrorMessage(s);
                if (Module.Project != null && Module.Project.ContainsFile(err.FileName))
                {
                    err.Project = Module.Project;
                }
                br.BuildErrors.Add(err);
                br.Successful = false;

                if (!GlobalProperties.Instance.VerboseBuildOutput)
                {
                    ErrorLogger.Log(s, ErrorType.Message, ErrorOrigin.Build);
                }
            },
                                                         // Error handling
                                                         delegate(string s)
            {
                br.Successful = false;

                ErrorLogger.Log(s, ErrorType.Error, ErrorOrigin.Build);
            },
                                                         OnExit);

            if (TempPrc != null && !TempPrc.HasExited)
            {
                TempPrc.WaitForExit(MaxCompilationTime);
            }

            br.Successful = br.Successful && TempPrc != null && TempPrc.ExitCode == 0 && File.Exists(res);

            if (br.Successful)
            {
                Module.ResetModifiedTime();
            }

            Module.LastBuildResult = br;
        }
Exemplo n.º 19
0
 public override double GetValue(double x, double y, double z)
 {
     return(SourceModule.GetValue(x, y, z));
 }
Exemplo n.º 20
0
        public override double GetWrapped(double x, double y, int wrap)
        {
            double baseValue = SourceModule.GetWrapped(x, y, wrap);

            return(baseValue);
        }
Exemplo n.º 21
0
 public override double GetWrapped(double x, double y, int wrap)
 {
     return(1.0 - SourceModule.GetWrapped(x, y, wrap));
 }
Exemplo n.º 22
0
        public override double GetValue(double x, double y)
        {
            double baseValue = SourceModule.GetValue(x, y);

            return(baseValue);
        }
Exemplo n.º 23
0
 public override double GetValue(double t)
 {
     return(1.0 - SourceModule.GetValue(t));
 }
Exemplo n.º 24
0
 /// <summary>
 /// Returns the absolute value of noise from the source module at the given coordinates.
 /// </summary>
 public override double GetValue(double x, double y)
 {
     return(System.Math.Abs(SourceModule.GetValue(x, y)));
 }
Exemplo n.º 25
0
 public override double GetValue(double x, double y)
 {
     // Read:
     return(SourceModule.GetColour(x, y).a);
 }
Exemplo n.º 26
0
		public override void BuildModule(SourceModule Module, 
			string OutputDirectory, 
			string ExecDirectory,
			bool DebugCompile,
			bool LinkToStandAlone)
		{
			var src = Module.AbsoluteFileName;

			var outputDir = Path.IsPathRooted(OutputDirectory) ? OutputDirectory : Path.Combine(Path.GetDirectoryName(src), OutputDirectory);
			
			// Ensure that target directory exists
			Util.CreateDirectoryRecursively(outputDir);

			// Compile .rc source file to res
			var res = Path.Combine(outputDir, Path.GetFileNameWithoutExtension(src) + ".res");

			// Check if creation can be skipped
			if (GlobalProperties.Instance.EnableIncrementalBuild && !Module.Modified && File.Exists(res))
			{
				Module.LastBuildResult = new BuildResult() { SourceFile = src, TargetFile = res, Successful = true, NoBuildNeeded = true };
				return;
			}

			// Init returned BuildResult-object
			var br = new BuildResult() { SourceFile = src, TargetFile = res, Successful = true };

			// Print verbose information message
			ErrorLogger.Log("Compile " + (Module.Project != null ? Module.Project.ToRelativeFileName(Module.FileName) : Module.FileName), ErrorType.Information, ErrorOrigin.Build);

			var resourceCompiler = ResConfig.Instance.ResourceCompilerPath;

			// Prefer the resource compiler located in D-IDE's bin root 
			// Otherwise let the system search along the %PATH% environment variable to find the resource compiler
			if (!Path.IsPathRooted(resourceCompiler) && 
				File.Exists(Path.Combine(Util.ApplicationStartUpPath,resourceCompiler)))
				resourceCompiler = Path.Combine(Util.ApplicationStartUpPath, resourceCompiler);

			TempPrc = FileExecution.ExecuteSilentlyAsync(resourceCompiler,
					BuildResArgumentString(
						ResConfig.Instance.ResourceCompilerArguments, 
						src, res, outputDir),
					ExecDirectory,
					// Output handling
					delegate(string s)
					{
						var err = ParseErrorMessage(s);
						if (Module.Project != null && Module.Project.ContainsFile(err.FileName))
							err.Project = Module.Project;
						br.BuildErrors.Add(err);
						br.Successful = false;

						if (!GlobalProperties.Instance.VerboseBuildOutput)
							ErrorLogger.Log(s, ErrorType.Message, ErrorOrigin.Build);
					}, 
					// Error handling
					delegate(string s)
					{
						br.Successful = false;

						ErrorLogger.Log(s, ErrorType.Error, ErrorOrigin.Build);
					}, 
					OnExit);

			if (TempPrc != null && !TempPrc.HasExited)
				TempPrc.WaitForExit(MaxCompilationTime);

			br.Successful = br.Successful && TempPrc != null && TempPrc.ExitCode == 0 && File.Exists(res);

			if (br.Successful)
				Module.ResetModifiedTime();

			Module.LastBuildResult = br;
		}
Exemplo n.º 27
0
 public override double GetWrapped(double x, double y, int wrap)
 {
     return(System.Math.Tan(SourceModule.GetWrapped(x, y, wrap)));
 }
Exemplo n.º 28
0
 public override double GetValue(double x, double y, double z)
 {
     return(System.Math.Log(SourceModule.GetValue(x, y, z), BaseModule.GetValue(x, y, z)));
 }