MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / MAIN_FUNC_NAME

Function MAIN_FUNC_NAME

utils/daScript/main.cpp:491–806  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489}
490
491int MAIN_FUNC_NAME ( int argc, char * argv[] ) {
492#if defined(_WIN32) && defined(_DEBUG)
493 // Suppress all CRT assertion/error dialogs — print to stderr instead
494 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
495 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
496 _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
497 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
498 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
499 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
500 _set_error_mode(_OUT_TO_STDERR);
501#endif
502 install_das_crash_handler();
503 das::arm_alloc_tracking();
504 bool isArgAot = false;
505 if (argc > 1) {
506 isArgAot = strcmp(argv[1],"-aot")==0;
507 isAotLib = !isArgAot && strcmp(argv[1],"-aotlib")==0;
508 }
509
510 if ( argc>2 && (isArgAot || isAotLib) ) {
511 return das_aot_main(argc, argv);
512 }
513 use_utf8();
514 if ( argc==2 && (strcmp(argv[1],"--version")==0 || strcmp(argv[1],"-version")==0) ) {
515 tout << DAS_VERSION_MAJOR << "." << DAS_VERSION_MINOR << "." << DAS_VERSION_PATCH << "\n";
516 return 0;
517 }
518 if ( argc<=1 ) {
519 print_help();
520 return -1;
521 }
522 setCommandLineArguments(argc,argv);
523 das::vector<string> files;
524 string mainName = "main";
525 bool scriptArgs = false;
526 bool outputProgramCode = false;
527 bool pauseAfterDone = false;
528 bool dryRun = false;
529 bool compileOnly = false;
530 bool dumpLeaks = true;
531 string project_root;
532 vector<string> load_modules;
533 optional<format::FormatOptions> formatter;
534 for ( int i=1; i < argc; ++i ) {
535 if ( argv[i][0]=='-' ) {
536 string cmd(argv[i]+1);
537 if ( cmd=="-" ) {
538 scriptArgs = true;
539 }
540 if ( cmd=="main" ) {
541 if ( i+1 > argc ) {
542 printf("main requires argument\n");
543 print_help();
544 return -1;
545 }
546 mainName = argv[i+1];
547 i += 1;
548 } else if ( cmd=="dasroot" ) {

Callers

nothing calls this directly

Calls 15

das_aot_mainFunction · 0.85
use_utf8Function · 0.85
setCommandLineArgumentsFunction · 0.85
printfFunction · 0.85
setDasRootFunction · 0.85
stringClass · 0.85
register_builtin_modulesFunction · 0.85
deduce_project_rootFunction · 0.85
require_dynamic_modulesFunction · 0.85
getDasRootFunction · 0.85

Tested by

no test coverage detected