Example #1
0
        static string RunAutoReCompile(string eaFilename)
        {
            if (!File.Exists(eaFilename))
            {
                return("");
            }

            EAUtil ea = new EAUtil(eaFilename);

            foreach (EAUtil.Data d in ea.DataList)
            {
                if (d.Dir == "")
                {
                    continue;
                }

                if (d.DataType == EAUtil.DataEnum.ASM ||
                    d.DataType == EAUtil.DataEnum.LYN)
                {
                    string targetfilename = Path.Combine(d.Dir, d.Name);

                    string sourceCode;
                    if (!IsUpdateSourceCode(targetfilename, out sourceCode))
                    {
                        continue;
                    }

                    MainFormUtil.CompileType compileType = MainFormUtil.CompileType.NONE;
                    if (d.DataType == EAUtil.DataEnum.LYN)
                    {
                        if (targetfilename.IndexOf(".lyn.event") >= 0)
                        {
                            compileType = MainFormUtil.CompileType.CONVERT_LYN;
                        }
                        else
                        {
                            compileType = MainFormUtil.CompileType.KEEP_ELF;
                        }
                    }

                    string error;
                    string symbol;
                    bool   r = MainFormUtil.Compile(sourceCode, out error, out symbol, compileType, checkMissingLabelCheck: true);
                    if (!r)
                    {
                        return(error);
                    }
                    SymbolUtil.ProcessSymbolByComment(sourceCode, symbol, SymbolUtil.DebugSymbol.SaveSymTxt, 0);
                }
            }

            return("");
        }
Example #2
0
        static string RunAutoReCompile(string eaFilename)
        {
            if (!File.Exists(eaFilename))
            {
                return("");
            }

            EAUtil ea = new EAUtil(eaFilename);

            foreach (EAUtil.Data d in ea.DataList)
            {
                if (d.DataType == EAUtil.DataEnum.ASM ||
                    d.DataType == EAUtil.DataEnum.LYN)
                {
                    string targetfilename = Path.Combine(ea.Dir, d.Name);

                    string sourceCode;
                    if (!IsUpdateSourceCode(targetfilename, out sourceCode))
                    {
                        continue;
                    }

                    MainFormUtil.CompileType compileType = MainFormUtil.CompileType.NONE;
                    if (d.DataType == EAUtil.DataEnum.LYN)
                    {
                        string lyn_event = U.ChangeExtFilename(targetfilename, "lyn.event");
                        if (File.Exists(lyn_event))
                        {
                            compileType = MainFormUtil.CompileType.CONVERT_LYN;
                        }
                        else
                        {
                            compileType = MainFormUtil.CompileType.KEEP_ELF;
                        }
                    }

                    string error;
                    string symbol;
                    bool   r = MainFormUtil.Compile(sourceCode, out error, out symbol, compileType);
                    if (!r)
                    {
                        return(error);
                    }
                }
            }

            return("");
        }