Annotation of researchv9/jtools/src/cip/space.c, revision 1.1.1.1

1.1       root        1: /*
                      2:        %Z%  %M%  version %I% %Q%of %H% %T%
                      3:        Last Delta:  %G% %U% to %P%
                      4: */
                      5: 
                      6: #define SETUP_OWN
                      7: #include "cip.h"
                      8: 
                      9: extern short noSpace;
                     10: extern Point PtCurrent;
                     11: 
                     12: #define INT long
                     13: #define ALIGN int
                     14: #define NALIGN 1
                     15: #undef BUSY
                     16: #define BUSY 1
                     17: 
                     18: /* This routine clears the message area and sets a pointer to */
                     19: /* the beginning of it. */
                     20: 
                     21: void
                     22: initMessage ()
                     23: {
                     24:   PtCurrent.x = Xtext+LW+1;
                     25:   PtCurrent.y = Ytext+LW+1;
                     26:   xtipple (&display, inset(Rect (Xmin, Ybut, XeditD-LW, Ymax),LW));
                     27: }
                     28: 
                     29: /* This routine displays a string at 'PtCurrent'. */
                     30: 
                     31: void
                     32: putMessage (str)
                     33: char *str;
                     34: {
                     35:   char c;
                     36: 
                     37:   while (*str != '\0') {
                     38:     jchar (*str++);
                     39:     if ((PtCurrent.x) > XeditD-fontwidth(&defont)-LW-1) {
                     40:       PtCurrent.x = Xtext+LW+1;
                     41:       PtCurrent.y += fontheight(&defont);
                     42:     }
                     43:   }
                     44: }
                     45: 
                     46: /* This routine displays a message at the bottom of the cip layer */
                     47: 
                     48: void
                     49: message (str)
                     50: char *str;
                     51: {
                     52:   initMessage ();
                     53:   putMessage (str);
                     54: }
                     55: 
                     56: /* This routine allocates memory and then displays the estimated */
                     57: /* number of this that can be drawn. */
                     58: 
                     59: char *
                     60: getSpace (numbytes)
                     61: short numbytes;
                     62: {
                     63:   char *b;             /* Pointer to allocated memory */
                     64: 
                     65:   if ((b = alloc (numbytes)) == (char *) NULL)
                     66:     outOfSpace ();
                     67:   return (b);
                     68: }
                     69: 
                     70: /* This routine prints an error message */
                     71: /* telling the user cip is out of space. */
                     72: 
                     73: outOfSpace()
                     74: {
                     75:   beep();
                     76:   message("Out of Storage - PUT and QUIT");
                     77:   sleep(240);
                     78:   noSpace = 1;
                     79: }

unix.superglobalmegacorp.com

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