Saturday, January 19, 2019

The core routines for flush

int NextXY(XYString * s) {
char ch = scroll_buff[start_index];
s->x=0;
while(ch && ch != '\n') {
s->x++;
incr(start_index);
ch = scroll_buff[start_index];
}
if(ch) 
s->y++;
return(SUCCESS);
}
int FlushText(char * ptr){
int base=0;
int line_index=start_index;
XYString s; 
s.y=-1;
s.cmd ="PutStr";
s.rect =Flush_Rect;
do {
NextXY(&s);
s.ptr=scroll_buff+line_index;
line_index=start_index;
if(s.x && Flush_Return); 
Flush_Return(&base,(void **) &s);
}while(s.ptr[0] && (s.y < 20));
return(SUCCESS);

The idea is that flush cleared out the fifo, line by line, into the scroll buffer.  This is the scroll buffer action after flushing the flush file deice. Processing here is read only regardless of who writes to it. In my case it is the general purpose printf window.

Each line is presented to PutStr, a method on the assigned return call back given in Flush_Return. PutStr is generic, the call back could be a logger, it could be a message API. it could be sql lite, it could be sq rectangles, it could be xchars, Whoever gets it should now, it is identifies by an x y position in a scroll buffer, if that matters. It matters for xchars, which computes pixel position and puts the fonts onto screen.

So, flush remains a standalone loadable, having reuse capability, iti s really just another shuffler of strings and values, like hardly, lisp and default. Use it for general purpose inter process communications.

Take Hardly, for example,the 64 bit stacking engine.It will have a PutStr, the name is familiar. But hardly is a valid entry and can be on the flush call back, allowing flush to stack the line for later processing. Hardly might shunt sort them on a priority word.

No comments: