MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / main

Function main

System/FTerm/main.cpp:441–488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439}
440
441int main(int argc, char** argv){
442 CreateFramebufferSurface(fbSurface);
443 renderSurface = fbSurface;
444 renderSurface.buffer = new uint8_t[fbSurface.width * fbSurface.height * 4];
445
446 wSize.ws_xpixel = renderSurface.width;
447 wSize.ws_ypixel = renderSurface.height;
448
449 terminalFont = Lemon::Graphics::LoadFont("/initrd/sourcecodepro.ttf", "termmonospace");
450 if(!terminalFont){
451 terminalFont = Lemon::Graphics::GetFont("default");
452 }
453
454 wSize.ws_col = renderSurface.width / 8;
455 wSize.ws_row = renderSurface.height / terminalFont->height;
456
457 InputManager input;
458
459 for(int i = 0; i < wSize.ws_row; i++){
460 screenBuffer.push_back(std::vector<TerminalChar>(wSize.ws_col));
461 }
462
463 syscall(SYS_GRANT_PTY, (uintptr_t)&masterPTYFd, 0, 0, 0, 0);
464
465 setenv("TERM", "xterm-256color", 1);
466 ioctl(masterPTYFd, TIOCSWINSZ, &wSize);
467
468 char* const args[] = {"/initrd/lsh.lef"};
469 lemon_spawn(*args, 1, args, 1);
470
471 char _buf[512];
472 bool paint = true;
473
474 for(;;){
475 input.Poll();
476
477 while(int len = read(masterPTYFd, _buf, 512)){
478 for(int i = 0; i < len; i++){
479 PrintChar(_buf[i]);
480 }
481 paint = true;
482 }
483
484 if(paint){
485 Paint();
486 }
487 }
488}

Callers

nothing calls this directly

Calls 7

CreateFramebufferSurfaceFunction · 0.85
LoadFontFunction · 0.85
GetFontFunction · 0.85
lemon_spawnFunction · 0.85
PaintFunction · 0.85
PrintCharFunction · 0.70
PollMethod · 0.45

Tested by

no test coverage detected