Annotation of 43BSD/contrib/X/Xlib/XAppendVertex.c, revision 1.1.1.1

1.1       root        1: #include <X/mit-copyright.h>
                      2: 
                      3: /* $Header: XAppendVertex.c,v 10.5 86/02/01 15:29:28 tony Rel $ */
                      4: /* Copyright    Massachusetts Institute of Technology    1985  */
                      5: 
                      6: #include "XlibInternal.h"
                      7: XAppendVertex (vertices, nvert)
                      8:     Vertex vertices[];
                      9:     int nvert;
                     10:     {
                     11:     register Display *dpy = _XlibCurrentDisplay;
                     12:     register XReq *lastdraw;
                     13:     register char *old_bufptr, *new_bufptr;
                     14:     int nbytes;
                     15: 
                     16:     if ((lastdraw = (XReq*)(dpy->lastdraw)) == NULL)
                     17:        return (0);  /* no draw command in output buffer */
                     18: 
                     19:     old_bufptr = dpy->bufptr;
                     20:     /* subtract off any padding */
                     21:     if (lastdraw->param.s[0] & 1)
                     22:        old_bufptr -= 2;
                     23:     new_bufptr = old_bufptr + (nbytes = nvert*sizeof(Vertex));
                     24:     if (new_bufptr >= dpy->bufmax)
                     25:        return (-1); /* vertices don't fit */
                     26:     
                     27:     /* increment number of vertices in XDraw packet */
                     28:     lastdraw->param.s[0] += nvert;
                     29:     bcopy (vertices, old_bufptr, nbytes);
                     30:     /* add in padding if needed */
                     31:     if (lastdraw->param.s[0] & 1)
                     32:        new_bufptr += 2;
                     33:     dpy->bufptr = new_bufptr;
                     34:     return (nvert);
                     35:     }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.