MCPcopy Create free account
hub / github.com/WheretIB/nullc / WinMain

Function WinMain

SuperCalc.cpp:432–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430#include <io.h>
431
432int APIENTRY WinMain(HINSTANCE hInstance,
433 HINSTANCE hPrevInstance,
434 LPTSTR lpCmdLine,
435 int nCmdShow)
436{
437 (void)lpCmdLine;
438 (void)hPrevInstance;
439
440 MSG msg;
441
442 needTextUpdate = true;
443 lastUpdate = GetTickCount();
444
445#ifdef _DEBUG
446 AllocConsole();
447
448 freopen("CONOUT$", "w", stdout);
449 freopen("CONOUT$", "w", stderr);
450 freopen("CONIN$", "r", stdin);
451
452 _dup2(_dup(_fileno(stdin)), 0);
453 _dup2(_dup(_fileno(stdout)), 1);
454 _dup2(_dup(_fileno(stderr)), 2);
455#endif
456
457//#define NULLC_NO_UNITTESTS
458#ifndef NULLC_NO_UNITTESTS
459 AllocConsole();
460
461 freopen("CONOUT$", "w", stdout);
462 freopen("CONIN$", "r", stdin);
463
464 RunTests(false);
465#endif
466
467 nullcInit("Modules/");
468
469 char modulePath[MAX_PATH];
470 GetModuleFileName(NULL, modulePath, MAX_PATH);
471
472 memset(initError, 0, INIT_BUFFER_SIZE);
473
474 // in possible, load precompiled modules from nullclib.ncm
475 FILE *modulePack = fopen(sizeof(void*) == sizeof(int) ? "nullclib.ncm" : "nullclib_x64.ncm", "rb");
476 if(!modulePack)
477 {
478 strcat(initError, "WARNING: Failed to open precompiled module file ");
479 strcat(initError, sizeof(void*) == sizeof(int) ? "nullclib.ncm\r\n" : "nullclib_x64.ncm\r\n");
480 }else{
481 fseek(modulePack, 0, SEEK_END);
482 unsigned int fileSize = ftell(modulePack);
483 fseek(modulePack, 0, SEEK_SET);
484 char *fileContent = new char[fileSize];
485 fread(fileContent, 1, fileSize, modulePack);
486 fclose(modulePack);
487
488 char *filePos = fileContent;
489 while((unsigned int)(filePos - fileContent) < fileSize)

Callers

nothing calls this directly

Calls 15

RunTestsFunction · 0.85
nullcInitFunction · 0.85
nullcLoadModuleByBinaryFunction · 0.85
nullcInitFileModuleFunction · 0.85
nullcInitIOModuleFunction · 0.85
nullcInitMathModuleFunction · 0.85
nullcInitStringModuleFunction · 0.85
nullcInitCanvasModuleFunction · 0.85
nullcInitWindowModuleFunction · 0.85
nullcInitVectorModuleFunction · 0.85
nullcInitListModuleFunction · 0.85
nullcInitMapModuleFunction · 0.85

Tested by

no test coverage detected