public RcInstruction(CustomInstruction customInstr)
     : base(customInstr)
 {
     rcScript  = "";
     RcOptions = new Dictionary <string, string>();
     analyzeCommands();
 }
 public MidlInstruction(CustomInstruction customInstr)
     : base(customInstr)
 {
     sourceFiles = new List <string>();
     outputFile  = "";
     MidlFlags   = new List <string>();
     analyzeCommands();
 }
 public CustomInstruction(CustomInstruction customInstr)
 {
     instruction_literal = customInstr.instruction_literal;
     words            = customInstr.words;
     commands         = customInstr.commands;
     delims           = customInstr.delims;
     validInstruction = customInstr.validInstruction;
     validCommands    = customInstr.validCommands;
 }
 public NmakeInstruction(CustomInstruction customInstr, string sourceDirectory)
     : base(customInstr)
 {
     target = "";
     setSourceDirectory(sourceDirectory);
     nmakeOptions = new List <string>();
     parseNmakeCommand(instruction_literal);
     preInstructions  = new List <CustomInstruction>();
     postInstructions = new List <CustomInstruction>();
 }
Example #5
0
        /*
         * Input: A Component, and a CustomInstruction that needs to be attached to this Component.
         * Output: True if the instruction was identified and we attempted to take action, False if we do not know how to carry out the merge.
         * */
        public static bool MergeInstructionWithComponent(Component cp, CustomInstruction cinstr, Makefile mkfile)
        {
            if (cinstr.isCl())
            {
                ClInstruction clInstr = (ClInstruction)cinstr;
                string target = "";
                foreach (string clFile in clInstr.clFiles)
                {
                    if (clFile.EndsWith(".c", StringComparison.CurrentCultureIgnoreCase) || clFile.EndsWith(".cpp", StringComparison.CurrentCultureIgnoreCase))
                    {
                        cp.SourceFiles.Add(Path.GetFileNameWithoutExtension(clFile));
                    }
                    if (clFile.Contains(".obj"))
                        target = clFile;
                }
                foreach (string clLib in clInstr.clLibs)
                {
                    cp.Link.Libs.Add(clLib);
                }

                if (cp.CompilerFlags == null)
                    cp.CompilerFlags = new CompileFlags(mkfile);
                cp.CompilerFlags.ParseString(clInstr.clOptionsLiteral);

                foreach (string linkOption in clInstr.linkerOptions)
                {
                    cp.Link.Options.Add(new KeyValuePair<string, string>(target, linkOption));
                }

                mkfile.GenerateSourceFileNames(cp);
                return true;
            }
            else if (cinstr.isRc())
            {
                RcInstruction rcInstr = (RcInstruction)cinstr;
                cp.SourceFiles.Add(rcInstr.rcScript);
                RcFlags rcFlags = new RcFlags(mkfile);
                rcFlags.ParseString(rcInstr.instruction_literal);
                cp.CustomFlags.Add(rcInstr.rcScript, rcFlags);

                mkfile.GenerateSourceFileNames(cp);
            }
            else
            {
                //We cannot identify the instruction, we will assume that it must be added as a prebuild step to the component.
                cp.PostBuildInstructions.Add(cinstr);
            }
            return false;
        }
 public ClInstruction(CustomInstruction customInstr)
     : base(customInstr)
 {
     clFiles                  = new List <string>();
     clLibs                   = new List <string>();
     clOptions                = new List <string>();
     linkerOptions            = new SortedSet <string>();
     clDefines                = new SortedSet <string>();
     unidentified             = new List <string>();
     containsLinkFlags        = false;
     clOptionsLiteral         = "";
     LinkOptionsLiteral       = "";
     LinkOptionsLiteral_Words = new List <string>();
     analyzeCommands();
 }
 public LinkInstruction(CustomInstruction customInstr)
     : base(customInstr)
 {
     Objs                     = new List <string>();
     Libs                     = new List <string>();
     Options                  = new List <KeyValuePair <string, string> >();
     LinkOptionsLiteral       = "";
     LinkOptionsLiteral_Words = new List <string>();
     Output                   = "";
     Def   = "";
     Entry = "";
     isDll = false;
     isExe = false;
     analyzeCommands();
 }
Example #8
0
 public ClInstruction(CustomInstruction customInstr)
     : base(customInstr)
 {
     clFiles = new List<string>();
     clLibs = new List<string>();
     clOptions = new List<string>();
     linkerOptions = new SortedSet<string>();
     clDefines = new SortedSet<string>();
     unidentified = new List<string>();
     containsLinkFlags = false;
     clOptionsLiteral = "";
     LinkOptionsLiteral = "";
     LinkOptionsLiteral_Words = new List<string>();
     analyzeCommands();
 }
Example #9
0
        /*
         * Given:
         *   A CustomComponent that creates a .dll. This CustomComponent should have a link instruction.
         * Output:
         *   A Component that can be used to generate a project for this .dll
         *
         * */
        public static Component generateComponentFromRule(CustomComponent rule, Makefile mkfile)
        {
            Component result = new Component(rule.Name);
            result.Owner = mkfile;
            List<CustomInstruction> preBuildInstrs = new List<CustomInstruction>();
            List<CustomInstruction> postBuildInstrs = new List<CustomInstruction>();

            bool afterLinkInstruction = false;

            foreach (string instr in rule.CustomInstructions)
            {
                CustomInstruction cinstr = new CustomInstruction(instr);
                if (cinstr.isNmake())
                {
                    LinkInstruction linkInstr = new LinkInstruction(cinstr);
                    result = resolveLinkInstruction(linkInstr,rule,mkfile);
                    afterLinkInstruction = true;
                }
                else if (cinstr.isCl())
                {
                    ClInstruction compileInstruction = new ClInstruction(cinstr);
                    foreach (string sourceFile in compileInstruction.clFiles)
                        result.SourceFileNames.Add(sourceFile);

                }
                else if (!afterLinkInstruction)
                {
                    preBuildInstrs.Add(cinstr);
                }
                else
                {
                    postBuildInstrs.Add(cinstr);
                }

            }
            result.PreBuildInstructions = preBuildInstrs;
            result.PostBuildInstructions = postBuildInstrs;
            return result;
        }
Example #10
0
 public RcInstruction(CustomInstruction customInstr)
     : base(customInstr)
 {
     rcScript = "";
     RcOptions = new Dictionary<string,string>();
     analyzeCommands();
 }
Example #11
0
 public NmakeInstruction(CustomInstruction customInstr, string sourceDirectory)
     : base(customInstr)
 {
     target = "";
     setSourceDirectory(sourceDirectory);
     nmakeOptions = new List<string>();
     parseNmakeCommand(instruction_literal);
     preInstructions = new List<CustomInstruction>();
     postInstructions = new List<CustomInstruction>();
 }
Example #12
0
 public MidlInstruction(CustomInstruction customInstr)
     : base(customInstr)
 {
     sourceFiles = new List<string>();
     outputFile = "";
     MidlFlags = new List<string>();
     analyzeCommands();
 }
Example #13
0
 public LinkInstruction(CustomInstruction customInstr)
     : base(customInstr)
 {
     Objs = new List<string>();
     Libs = new List<string>();
     Options = new List<KeyValuePair<string, string>>();
     LinkOptionsLiteral = "";
     LinkOptionsLiteral_Words = new List<string>();
     Output = "";
     Def = "";
     Entry = "";
     isDll = false;
     isExe = false;
     analyzeCommands();
 }
Example #14
0
 public CustomInstruction(CustomInstruction customInstr)
 {
     instruction_literal = customInstr.instruction_literal;
     words = customInstr.words;
     commands = customInstr.commands;
     delims = customInstr.delims;
     validInstruction = customInstr.validInstruction;
     validCommands = customInstr.validCommands;
 }