1

enable c++17 and use if constexpr for debug toggle

This commit is contained in:
churl
2022-05-23 12:31:10 +02:00
parent f6980edb3c
commit 60fe069650
6 changed files with 44 additions and 43 deletions

View File

@ -8,12 +8,12 @@ void BufferedCGA::init(unsigned int pages) {
this->screen_buffer = new CGA::cga_page_t;
if (this->scrollback_buffer == NULL || this->screen_buffer == NULL) {
if (DEBUG) kout << "Error initializing scrollback buffer" << endl;
if constexpr (DEBUG) kout << "Error initializing scrollback buffer" << endl;
return;
}
this->initialized = true;
if (DEBUG) kout << "Initialized scrollback buffer" << endl;
if constexpr (DEBUG) kout << "Initialized scrollback buffer" << endl;
}
void BufferedCGA::display_scrollback() {
@ -26,7 +26,7 @@ void BufferedCGA::display_scrollback() {
this->scrollback_buffer->get((cga_line_t*)CGA_START, this->scrollback - 1);
}
} else {
if (DEBUG) kout << "ScrollbackBuffer not initialized" << endl;
if constexpr (DEBUG) kout << "ScrollbackBuffer not initialized" << endl;
}
}
@ -45,7 +45,7 @@ void BufferedCGA::scrollup() {
if (this->initialized) {
this->scrollback_buffer->put((cga_line_t*)CGA_START);
} else {
if (DEBUG) kout << "ScrollbackBuffer not initialized" << endl;
if constexpr (DEBUG) kout << "ScrollbackBuffer not initialized" << endl;
}
CGA::scrollup();
@ -59,7 +59,7 @@ void BufferedCGA::clear() {
this->scrollback_buffer->clear();
mmem::zero<CGA::cga_page_t>(this->screen_buffer);
} else {
if (DEBUG) kout << "ScrollbackBuffer not initialized" << endl;
if constexpr (DEBUG) kout << "ScrollbackBuffer not initialized" << endl;
}
}
@ -78,7 +78,7 @@ void BufferedCGA::scroll_page_backward() {
}
this->display_scrollback();
} else {
if (DEBUG) kout << "ScrollbackBuffer not initialized" << endl;
if constexpr (DEBUG) kout << "ScrollbackBuffer not initialized" << endl;
}
}
@ -90,6 +90,6 @@ void BufferedCGA::scroll_page_forward() {
}
this->display_scrollback();
} else {
if (DEBUG) kout << "ScrollbackBuffer not initialized" << endl;
if constexpr (DEBUG) kout << "ScrollbackBuffer not initialized" << endl;
}
}