aboutsummaryrefslogtreecommitdiff
path: root/libk/stdlib/console.cc
blob: c0762977af6bc4b790226baf7503a57b35abff6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "stdlib.h"

constexpr size_t max_consoles = 4;
static Console* global_console[max_consoles] = {nullptr};
static size_t last_console = 0;

void Console::set(Console* ptr) {
  if (ptr != nullptr && last_console < max_consoles) {
    global_console[last_console++] = ptr;
  }
}

Iterator<Console*> Console::begin() {
  return Iterator<Console*>(global_console, last_console);
}