BeefBoot.cpp 1.9 KB

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