This is something I have wanted to know for 15 years, and I was, for lack of better terms, steered away, but I still need to do some work in this area ... If someone has knowledge, could you please give a summary of the various layers that can be utilized to get data into a terminal display buffer?
For example ...
1. At the lowest level, I suppose there is a way to do a memmove(3) beginning at some pointer in memory, directly into the terminal display buffer, but I was never able to find out how to locate these terminal display buffers, and I would like to know the simple mechanics of how changes in the buffer notify the system of a need for an update - or perhaps the terminal display is updated fully after every "pass" which checks the buffer? Or perhaps there is a flag that signals a need for a display update - does anyone know about these things? I presume this would be the fastest, but least portable method.
2. I am just guessing all this, so feel free to correct me. I would presume the next layer up would be some kind of system call to the kernel to get data into the terminal display buffer and/or update the display. Something lower then write(2) but higher than memmove(3).
3. I guess the next layer up would be a write(2) call using the C library.
4. And finally, I guess the next layer up would be a printf(3) or similar.
I am ignorant about this, but would really appreciate and value any reply that could expand on this topic, so that I may dive into necessary areas I need to study. Please don't ask me why I want to know these things or tell me to just use ncurses - which derailed my attempt to learn 15 years ago. I do have a serious need to understand and utilize this information, but I don't want that to become the topic ...
Also, a final question: using ncurses based applications, I would guess that ncurses utilizes ANSI escape sequences to perform some display manipulations, because the supported ANSI sequences do not support horizontal scrolling (at least, last time I studied them), and ncurses applications also seem to have extremely slow horizontal scrolling - is there some relationship there? I would guess that if ncurses was manipulating the display without ANSI escape sequences, there would be very little difference between vertical and horizontal scroll speeds.
For example ...
1. At the lowest level, I suppose there is a way to do a memmove(3) beginning at some pointer in memory, directly into the terminal display buffer, but I was never able to find out how to locate these terminal display buffers, and I would like to know the simple mechanics of how changes in the buffer notify the system of a need for an update - or perhaps the terminal display is updated fully after every "pass" which checks the buffer? Or perhaps there is a flag that signals a need for a display update - does anyone know about these things? I presume this would be the fastest, but least portable method.
2. I am just guessing all this, so feel free to correct me. I would presume the next layer up would be some kind of system call to the kernel to get data into the terminal display buffer and/or update the display. Something lower then write(2) but higher than memmove(3).
3. I guess the next layer up would be a write(2) call using the C library.
4. And finally, I guess the next layer up would be a printf(3) or similar.
I am ignorant about this, but would really appreciate and value any reply that could expand on this topic, so that I may dive into necessary areas I need to study. Please don't ask me why I want to know these things or tell me to just use ncurses - which derailed my attempt to learn 15 years ago. I do have a serious need to understand and utilize this information, but I don't want that to become the topic ...
Also, a final question: using ncurses based applications, I would guess that ncurses utilizes ANSI escape sequences to perform some display manipulations, because the supported ANSI sequences do not support horizontal scrolling (at least, last time I studied them), and ncurses applications also seem to have extremely slow horizontal scrolling - is there some relationship there? I would guess that if ncurses was manipulating the display without ANSI escape sequences, there would be very little difference between vertical and horizontal scroll speeds.