Friday, January 18, 2019

Calling PutStr inxchars

int DrawRect(char * ptr){
int base=0;
XYString s; 
s.ptr=ptr;
s.y=-1;
s.cmd ="PutStr";
s.rect =IO_Rect;
while(s.ptr) {
NextXY(&s);
if(s.x) 
IO_Return(&base,(void **) &s);
}
}

 What we have is IO manager, it has a large string of chars and needs to put them on a specified rectangle. using the universal interface.  The universal interface is an array of void * but this routine calls xchars over the Bus with a structure called XYString.  XYString is laid out inexactly the form expected by xchars, all long, defined in the structure the way xchars expects.
But, now I can carry XY string around and prep the string for output, and in this case NextXY finds the next single line to put onto the rectangle.

This trick can be dangerous once yowe remember, universal interface calls careful duplex, the actual variable stack is args. So a called party may write back, unknowingly, the call semantics changed  bit.

I changed the name to IO_Return, which is supplied by console loop on init.  The console loop may intercept calls to xchars, for some reason, mainly because it wants to intercept all the calls from IO manager, and this related to thread control.  This will come up in the future, not now.

Simple stuff once we learn to abuse our 64 bit computers.  This is an easy rectangle fill of chars that io manager can do, and xchars has the responsibility to convert x y  char counts s to x y  pixels, as it is called xchars for a reason.

So, I march along, and the editor looks fine. I will try and post code tomorrow before integration testing, everything seems complete.

No comments: