home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / prof_c / 12sbuf / sb_new.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  696 b   |  31 lines

  1. /*
  2.  *    sb_new -- prepare a new window (rectangular region)
  3.  *    and return a pointer to it
  4.  */
  5.  
  6. #include <stdio.h>
  7. #include <malloc.h>
  8. #include <local\sbuf.h>
  9.  
  10. struct REGION *
  11. sb_new(top, left, height, width)
  12. int top;    /* top row */
  13. int left;    /* left column */
  14. int height;    /* total rows */
  15. int width;    /* total columns */
  16. {
  17.     struct REGION *new;
  18.  
  19.     /* allocate the control data structure */
  20.     new = (struct REGION *)malloc(sizeof (struct REGION));
  21.     if (new != NULL) {
  22.         new->r0 = new->sr0 = top;
  23.         new->r1 = new->sr1 = top + height - 1;
  24.         new->c0 = new->sc0 = left;
  25.         new->c1 = new->sc1 = left + width - 1;
  26.         new->row = new->col = 0;
  27.         new->wflags = 0;
  28.     }
  29.     return (new);
  30. }
  31.