Example #1
0
        public static void  fSetGlobalVar(string _sVar, string _sValue, bool _bAssingOnEmpty = false)
        {
            /*
             * var _sResult = "";
             * //Remove quotes ... or not??!?
             * for(int i =0; i < _sValue.Length; i++){}
             *          _sValue = _sValue.Replace("\'","" ).Replace("\"","" ).Trim();
             */

            var _sResult = CppCompiler.fExtracQuote(_sValue, false).Trim();

            if (!Data.aVarGlobal.ContainsKey(_sVar))
            {
                Data.aVarGlobal.Add(_sVar, _sResult);
                //	return;
            }
            else
            {
                if (_bAssingOnEmpty)
                {
                    if (aVarGlobal[_sVar] == "")
                    {
                        aVarGlobal[_sVar] = _sResult;
                    }
                }
                else
                {
                    aVarGlobal[_sVar] = _sResult;
                }
            }
            // if(_sVar == "_sPlatform" && _sValue == "") {Output.TraceError("Here ");} //For debugging
            //Output.TraceGood("Set " + _sVar + ":" + _sValue);
        }
Example #2
0
        public void  fExecute()
        {
            if (bLink)
            {
                CppCompiler.CheckAllThreadsHaveFinishedWorking(true);   //Force sequence??
                Console.WriteLine("---linkCmd");
            }
            else    //Compile -> check depandency

            {
                oDepandance = new Depandance(this, sOutputFile);
                bSkip       = !oDepandance.bHaveNewerFile;
            }

            // Console.WriteLine("--------------Skip: " + bSkip.ToString() );

            if (!Program.bNowBuilding)
            {
                return;
            }

            if (!bSkip)
            {
                CppCompiler.fSend2Compiler(sCmd, bLink);
            }
            else
            {
                Output.TraceColored("\f27UpToDate: \f28" + sCmd);
            }
        }
Example #3
0
        static int Main(string[] args)
        {
            // redirect console output to parent process;
            // must be before any calls to Console.WriteLine()
            AttachConsole(ATTACH_PARENT_PROCESS);

            Sys.fGetParentProcess();
            Console.WriteLine("Systeme mode: " + Sys.sParentName);

            if (Sys.sParentName == "cmd")
            {
                Data.bConsoleMode = true;
            }

            Data.fSetDefaultVar(args);
            Data.fCheckUpdate();

            Data.fCreateConfigMng();

            if (Data.bConsoleMode)
            {
                SysAPI.fStartConsole();
            }

            if (!Data.bConsoleMode || SysAPI.bIsLoadedFromAnotherCwcInstance)
            {
                Data.bGUI = false;
                if (!Data.bModeIDE)
                {
                    // Base.bAlive = false; //not work??
                }
            }

            Data.fGetMainArg();
            fCheckForRegistringFiles();

            if (!Data.bConsoleMode)
            {
                GuiManager.fCreateGUI();
            }


            if (Data.sArg == "") //No Argument

            {
                Output.Trace("\f0AVersion " + Data.sVersion + "\fs \n");
                Msg.fShowIntroMessage();
                SysAPI.fSetWorkingDir(PathHelper.ExeWorkDir);
            }
            else
            {
                Console.WriteLine("fBeginBuild ");
                Build.fBeginBuild();
            }

            CppCompiler.CheckAllThreadsHaveFinishedWorking(true);
            Build.fDisableBuild();

            if (Data.oGuiConsole != null)
            {
                if (!Data.oGuiConsole.fCheckForDemos())
                {
                    Program.fCheckForRegistringFiles(true); //Register if first use
                }
            }

            if (!Data.bConsoleMode)
            {
                if (Data.bModeIDE)
                {
                    Base.bAlive = true;
                    // PipeInput.fLaunchPipeInput();
                }
                Build.fStartLoopTestingIdeLinkedClosing();
            }
            Build.fMainLoop();

            //if(Data.bConsoleMode) {SendKeys.SendWait("{ENTER}"); }
            return(0);
        }
Example #4
0
        internal void fRun(ModuleData _oModule = null, bool _bDontExecute = false, bool _bShowInfo = true, bool _bSilent = false)
        {
            bFinalised = false;
            if (!_bDontExecute)
            {
                aExeWaitingList = new List <LaunchTool>();
                fDeletOutput();


                wBuildTime = new Stopwatch();
                wBuildTime.Start();


                //     if(Data.oMainForm != null) {
                Data.oLaunchProject.fSetOutput(aLinkCmdList, sCurr_wTo);
                //    }

                if (!Data.bNowBuilding)
                {
                    return;
                }

                //TODO test if we really use libt

//			    Output.Trace("\f9B>> \f97 " + sAllArg);
            }

            int i = 0;

            foreach (CppSeq _oSeq in aCppSeq)
            {
                i++;

                if (!_bSilent)
                {
                    Output.Trace("\f1B> \f13" + _oSeq.sSeq);
                    //   Output.Trace("\f1B> \f13 " + CppCmd.fExtractVar( _oSeq.sSeq,null) ); //Todo preextract var?
                }
                sCurr_wTo = "";


                foreach (CppCmd _oCmd in _oSeq.aCppCmd)
                {
                    sCurr_wTo = "";
                    _oCmd.fExtract();
                    //	 _oCmd.fExecute();

                    if (!Data.bNowBuilding)
                    {
                        return;
                    }
                    if (CppCompiler.nError > 0)
                    {
                        break;
                    }
                }

                if (i == aCppSeq.Count)  //Only last one?
                {
                    fFinalize();
                }

                if (!_bDontExecute)
                {
                    CppCompiler.CheckAllThreadsHaveFinishedWorking(true);
                    foreach (CppCmd _oCmd in _oSeq.aCppCmd)
                    {
                        _oCmd.fExecute();

                        if (!Data.bNowBuilding)
                        {
                            fShowInfo(_oModule, !_bSilent);
                            return;
                        }
                        if (CppCompiler.nError > 0)
                        {
                            break;
                        }
                        // Thread.Sleep(1);
                    }

                    //  if(Data.oMainForm != null) { //TODO better way?
                    //			 Data.oLaunchProject.fSetOutput(aLinkCmdList,sCurr_wTo);
                    //	}

                    CppCompiler.CheckAllThreadsHaveFinishedWorking(true);
                    fWaitForWaitingList();



                    foreach (CppCmd _oCmd in _oSeq.aCppCmd)
                    {
                        _oCmd.fFinish();
                        if (!Data.bNowBuilding)
                        {
                            fShowInfo(_oModule, !_bSilent);
                            return;
                        }
                        if (CppCompiler.nError > 0)
                        {
                            break;
                        }
                    }

                    Data.oLaunchProject.fSetOutput(aLinkCmdList, sCurr_wTo);

                    if (!Data.bNowBuilding)
                    {
                        fShowInfo(_oModule, !_bSilent);
                        return;
                    }
                    if (CppCompiler.nError > 0)
                    {
                        break;
                    }
                }
            }

            if (_bDontExecute)
            {
                fShowInfo(_oModule, !_bSilent);
                return;
            }

            ///Finalize compiler commands
            ///



            fShowInfo(_oModule, _bShowInfo);
        }