BeefBoot.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //#define USE_OLD_BEEFBUILD
  2. #pragma warning(disable:4996)
  3. #include <iostream>
  4. #include "BeefySysLib/Common.h"
  5. #include "BeefySysLib/util/Array.h"
  6. #include "BeefySysLib/util/SizedArray.h"
  7. #include "BeefySysLib/util/Dictionary.h"
  8. #include "BeefySysLib/util/CabUtil.h"
  9. #include "BeefySysLib/util/BeefPerf.h"
  10. #include "BeefySysLib/util/Deque.h"
  11. #include "BeefySysLib/util/HashSet.h"
  12. #include "BeefySysLib/util/MultiHashSet.h"
  13. //#include <mmsystem.h>
  14. //#include <shellapi.h>
  15. //#include <Objbase.h>
  16. #define BF_DBG_64
  17. #include "IDEHelper/StrHashMap.h"
  18. using namespace Beefy;
  19. #include "BootApp.h"
  20. BF_IMPORT void BF_CALLTYPE Debugger_ProgramDone();
  21. int main(int argc, char* argv[])
  22. {
  23. BfpSystem_SetCommandLine(argc, argv);
  24. BfpThread_SetName(NULL, "MainThread", NULL);
  25. BfpSystem_Init(BFP_VERSION, BfpSystemInitFlag_InstallCrashCatcher);
  26. gApp = new BootApp();
  27. bool success = true;
  28. for (int i = 1; i < argc; i++)
  29. {
  30. std::string arg = argv[i];
  31. if (arg[0] == '"')
  32. {
  33. arg.erase(0, 1);
  34. if ((arg.length() > 1) && (arg[arg.length() - 1] == '"'))
  35. arg.erase(arg.length() - 1);
  36. success &= gApp->HandleCmdLine(arg, "");
  37. continue;
  38. }
  39. int eqPos = (int)arg.find('=');
  40. if (eqPos == -1)
  41. {
  42. success &= gApp->HandleCmdLine(arg, "");
  43. continue;
  44. }
  45. std::string cmd = arg.substr(0, eqPos);
  46. std::string param = arg.substr(eqPos + 1);
  47. if ((param.length() > 1) && (param[0] == '"'))
  48. {
  49. param.erase(0, 1);
  50. if ((param.length() > 1) && (param[param.length() - 1] == '"'))
  51. param.erase(param.length() - 1);
  52. }
  53. success &= gApp->HandleCmdLine(cmd, param);
  54. }
  55. if (!gApp->mShowedHelp)
  56. {
  57. if (success)
  58. success = gApp->Init();
  59. if (success)
  60. success = gApp->Compile();
  61. if (success)
  62. gApp->OutputLine("SUCCESS", OutputPri_Critical);
  63. else
  64. gApp->OutputLine("FAILED", OutputPri_Critical);
  65. }
  66. delete gApp;
  67. Debugger_ProgramDone();
  68. BfpSystem_Shutdown();
  69. BP_SHUTDOWN();
  70. return success ? 0 : 1;
  71. }