コード例 #1
0
 public virtual string[] GetReferencesCommand(string[] references, IIntermediateCompilerOptions options)
 {
     return(Tweaks.ProcessArray(references, delegate(string r)
     {
         return GetReferenceCommand(r, options);
     }));
 }
コード例 #2
0
 public virtual string[] GetSourcesCommand(string[] files, IIntermediateCompilerOptions options)
 {
     return(Tweaks.ProcessArray(files, delegate(string f)
     {
         return GetSourceCommand(f, options);
     }));
 }
コード例 #3
0
 /// <summary>
 /// Creates a new <see cref="IntermediateCompilerBase"/> with the <paramref name="project"/> and
 /// <paramref name="translator"/> provided.
 /// </summary>
 /// <param name="project">The <see cref="IIntermediateProject"/> that needs compiled.</param>
 /// <param name="translator">The <see cref="IIntermediateCodeTranslator"/> root to
 /// translate the intermediate code into a proper langauge for compilation.</param>
 /// <param name="options">The <see cref="IIntermediateCompilerOptions"/> which guides the <see cref="Compile()"/> process.</param>
 internal IntermediateCompilerBase(IIntermediateProject project, IIntermediateCodeTranslator translator, IIntermediateCompilerOptions options, IIntermediateCompilerModule module)
 {
     this.translator = translator;
     this.project    = project;
     this.options    = options;
     this.module     = module;
 }
コード例 #4
0
 public override string GetEntryPointCommand(IMethodMember entrypointMethod, IIntermediateCompilerOptions options)
 {
     if (entrypointMethod == null)
     {
         throw new ArgumentNullException("entrypointMethod");
     }
     return(string.Format(EntryPointCommand, ((IDeclaredType)entrypointMethod.ParentTarget).GetTypeName(CodeGeneratorHelper.DefaultTranslatorOptions)));
 }
コード例 #5
0
 public override string GetOptimizationCommand(bool optimize, IIntermediateCompilerOptions options)
 {
     if (optimize)
     {
         return(string.Format(OptimizeCommand, "+"));
     }
     else
     {
         return(string.Format(OptimizeCommand, "-"));
     }
 }
コード例 #6
0
        public override string GetDebugCommand(DebugSupport support, IIntermediateCompilerOptions options)
        {
            switch (support)
            {
            case DebugSupport.None:
                return(DebugNone);

            case DebugSupport.PDB:
                return(DebugPDBOnly);

            case DebugSupport.Full:
                return(DebugFull);
            }
            return(string.Empty);
        }
コード例 #7
0
        public override string GetTypeCommand(ProjectOutputType outputType, IIntermediateCompilerOptions options)
        {
            switch (outputType)
            {
            case ProjectOutputType.ClassLibrary:
                return(OutputClassLibrary);

            case ProjectOutputType.ConsoleApplication:
                return(OutputConsoleApp);

            case ProjectOutputType.Module:
                return(OutputModule);

            case ProjectOutputType.WindowsApplication:
                return(OutputWindowsApp);
            }
            return(string.Empty);
        }
コード例 #8
0
        public override string GetXMLDocumentationCommand(bool generateDocs, IIntermediateCompilerOptions options)
        {
            if (!generateDocs)
            {
                return(string.Empty);
            }
            string output = options.Target;

            if (output.Contains("."))
            {
                output = string.Format("{0}.xml", output.Substring(0, output.LastIndexOf('.')));
            }
            else
            {
                output = string.Format("{0}.xml", output);
            }
            return(string.Format(XMLDocCommand, output));
        }
コード例 #9
0
        public override string GetSetWarningLevel(CompilerWarnLevel warnLevel, IIntermediateCompilerOptions options)
        {
            byte warnID = 0;

            switch (warnLevel)
            {
            case CompilerWarnLevel.Level1:
                warnID = 1;
                break;

            case CompilerWarnLevel.Level2:
                warnID = 2;
                break;

            case CompilerWarnLevel.Level3:
                warnID = 3;
                break;

            case CompilerWarnLevel.Level4:
                warnID = 4;
                break;
            }
            return(string.Format(WarnLevelCommand, warnID.ToString()));
        }
コード例 #10
0
 public override string GetSourceCommand(string file, IIntermediateCompilerOptions options)
 {
     return(string.Format("\"{0}\"", file));
 }
コード例 #11
0
 public override string GetBaseAddressCommand(uint baseAddress, IIntermediateCompilerOptions options)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #12
0
 public abstract string GetTypeCommand(ProjectOutputType outputType, IIntermediateCompilerOptions options);
コード例 #13
0
        public override IIntermediateCompilerResults Compile(string[] commandSequences, string responseFile, TempFileCollection temporaryFiles, IIntermediateCompilerOptions options)
        {
            IntermediateCompilerResults results = new IntermediateCompilerResults();

            results.TemporaryFiles = temporaryFiles;
            results.CommandLine    = string.Join(" ", commandSequences);
            string outputText = string.Empty;
            string errorText  = string.Empty;

            results.NativeReturnValue = Executor.ExecWaitWithCapture(string.Format("{0}csc.exe /noconfig @\"{1}\"", _OIL._Core.GetRuntimeDirectory(), responseFile), temporaryFiles, ref outputText, ref errorText);
            return(results);
        }
コード例 #14
0
 public abstract string GetOutputCommand(string target, IIntermediateCompilerOptions options);
コード例 #15
0
 /// <summary>
 /// Creates a new <see cref="CSharpIntermediateCompiler"/> with the <paramref name="project"/> provided.
 /// </summary>
 /// <param name="project">The <see cref="IIntermediateProject"/> that needs compiled.</param>
 /// <param name="options">The <see cref="IIntermediateCompilerOptions"/> which guides the <see cref="Compile()"/> process.</param>
 public CSharpIntermediateCompiler(IIntermediateProject project, IIntermediateCompilerOptions options)
     : base(project, _OIL._Core.DefaultCSharpCodeTranslator, options, _OIL._Core.DefaultCSharpCompilerModule)
 {
 }
コード例 #16
0
 public abstract string GetBaseAddressCommand(uint baseAddress, IIntermediateCompilerOptions options);
コード例 #17
0
 public override string GetResourceCommand(string resourceFile, IIntermediateCompilerOptions options)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #18
0
 public abstract string GetSetWarningLevel(CompilerWarnLevel warnLevel, IIntermediateCompilerOptions options);
コード例 #19
0
 public abstract string GetEntryPointCommand(IMethodMember entrypointMethod, IIntermediateCompilerOptions options);
コード例 #20
0
 public abstract IIntermediateCompilerResults Compile(string[] commandSequences, string responseFile, TempFileCollection tempFiles, IIntermediateCompilerOptions options);
コード例 #21
0
 public abstract string GetReferenceCommand(string reference, IIntermediateCompilerOptions options);
コード例 #22
0
 public abstract string GetResourceCommand(string resourceFile, IIntermediateCompilerOptions options);
コード例 #23
0
 public abstract string GetXMLDocumentationCommand(bool generateDocs, IIntermediateCompilerOptions options);
コード例 #24
0
 public abstract string[] GetModuleCommand(IIntermediateModule module, string[] sourceFiles, string[] resourceFiles, IIntermediateCompilerOptions options);
コード例 #25
0
 public override string GetReferenceCommand(string reference, IIntermediateCompilerOptions options)
 {
     return(string.Format(ReferenceCommand, reference));
 }
コード例 #26
0
 /// <summary>
 /// Creates a new <see cref="IntermediateCompiler"/> with the <paramref name="project"/> and
 /// <paramref name="translator"/>
 /// </summary>
 /// <param name="project">The <see cref="IIntermediateProject"/> that needs compiled.</param>
 /// <param name="translator">The <see cref="IIntermediateCodeTranslator"/> root to
 /// translate the intermediate code into a proper langauge for compilation.</param>
 /// <param name="options">The <see cref="IIntermediateCompilerOptions"/> which guides the <see cref="Compile()"/> process.</param>
 public IntermediateCompiler(IIntermediateProject project, IIntermediateCodeTranslator translator, IIntermediateCompilerOptions options, IIntermediateCompilerModule module)
     : base(project, translator, options, module)
 {
 }
コード例 #27
0
        public override string[] GetModuleCommand(IIntermediateModule module, string[] sourceFiles, string[] resourceFiles, IIntermediateCompilerOptions options)
        {
            string target = options.Target;

            if (module != module.Project.RootModule)
            {
                target = string.Format("{0}.{1}.part", target.Substring(0, target.LastIndexOf('.')), module.Name);
            }
            return(Tweaks.MergeArrays <string>(new string[] { GetTypeCommand(module != module.Project.RootModule ? ProjectOutputType.Module : module.Project.OutputType, options), GetOutputCommand(target, options) }, GetSourcesCommand(sourceFiles, options)));
            //return string.Format("{0} {1} {2}", , string.Join(" ", ));
        }
コード例 #28
0
 /// <summary>
 /// Creates a new <see cref="IntermediateCompiler"/> instance with the <paramref name="project"/>,
 /// <paramref name="translator"/> and <paramref name="fileRegulationDelegate"/> provided.
 /// </summary>
 /// <param name="project">The <see cref="IIntermediateProject"/> that needs compiled.</param>
 /// <param name="translator">The <see cref="IIntermediateProject"/> root to translate
 /// the intermediate code into a proper langauge for compilation.</param>
 /// <param name="fileRegulationDelegate">The <see cref="Predicate{T}"/> which determines
 /// whether to translate any given <see cref="IIntermediateProject"/> partial
 /// into code.</param>
 /// <param name="options">The <see cref="IIntermediateCompilerOptions"/> which guides the <see cref="Compile()"/> process.</param>
 public IntermediateCompiler(IIntermediateProject project, IIntermediateCodeTranslator translator, IIntermediateCompilerOptions options, IIntermediateCompilerModule module, Predicate <IIntermediateProject> fileRegulationDelegate)
     : base(project, translator, options, module, fileRegulationDelegate)
 {
 }
コード例 #29
0
 /// <summary>
 /// Creates a new <see cref="CSharpIntermediateCompiler"/> instance with the <paramref name="project"/> and
 /// <paramref name="fileRegulationDelegate"/> provided.
 /// </summary>
 /// <param name="project">The <see cref="IIntermediateProject"/> that needs compiled.</param>
 /// <param name="fileRegulationDelegate">The <see cref="Predicate{T}"/> which determines
 /// whether to translate any given <see cref="IIntermediateProject"/> partial
 /// into code.</param>
 /// <param name="options">The <see cref="IIntermediateCompilerOptions"/> which guides the <see cref="Compile()"/> process.</param>
 public CSharpIntermediateCompiler(IIntermediateProject project, IIntermediateCompilerOptions options, Predicate <IIntermediateProject> fileRegulationDelegate)
     : base(project, _OIL._Core.DefaultCSharpCodeTranslator, options, _OIL._Core.DefaultCSharpCompilerModule, fileRegulationDelegate)
 {
 }
コード例 #30
0
 public override string GetOutputCommand(string target, IIntermediateCompilerOptions options)
 {
     return(string.Format(OutputCommand, target));
 }