home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / BEEHIVE / UTILITYS / XWP11SRC.ARC / XWPCAL.C < prev    next >
Text File  |  1990-07-21  |  2KB  |  95 lines

  1.  
  2. #include "a:stdio.h"
  3. #include "b:oxege.h"
  4.  
  5. extern int day, month, year, jdate;
  6. extern int dm[], dpm[];
  7. extern int *FLchain;
  8. char stdate[35], scratch[50], FLcalendar;
  9.  
  10. getstd()
  11.     {
  12.     getdate();
  13.     strcat( stdate, swkday( nwkday( jdate ) ) );
  14.     strcat( stdate, " " );
  15.     itoa( day, scratch );
  16.     strcat( stdate, scratch ); 
  17.     strcat( stdate, " " );
  18.     strcat( stdate, smonth( month ) );
  19.     strcat( stdate, " " );
  20.     itoa( year, scratch );
  21.     strcat( stdate, scratch );
  22.     }
  23.  
  24. #define CLINE    11
  25. #define CCOL    1
  26.  
  27. calendar()
  28.     {
  29.     int line, cday, wday, ly;
  30.     line = 0;
  31.     *(FLchain - 2) = 255;
  32.     outline( CLINE, CCOL, CLINE+10, CCOL+23, 
  33.         OUTBLK, ATTDIM | ATTALT );
  34.     fill( CLINE+1, CCOL+1, CLINE+1, CCOL+22, ' ' | ATTINV,  ATTDIM );
  35.     fill( CLINE+2, CCOL+1, CLINE+9, CCOL+22, ' ', ATTBRT );
  36.     getdate();
  37.     itoa( year, scratch );
  38.     spoke( CLINE+1, CCOL+1+((25-(strlen(smonth(month))+7))/2),
  39.         smonth(month), ATTDIM );
  40.     spoke( CLINE+1, 
  41.       CCOL+2+((25-(strlen(smonth(month))+7))/2)+strlen(smonth(month)),
  42.       scratch, ATTDIM );
  43.     cday = 1;
  44.     day = 1;
  45.     ctoj();            /* Now we have first of month    */
  46.     wday = nwkday( jdate );
  47.     getdate();        /* Restore current date     */
  48.     while ( cday <= dm[ month - 1 ] )
  49.         {
  50.         putnum( cday, CLINE+3 + line, CCOL+2 + (wday * 3) );
  51.         ++wday;
  52.         if (wday == 7) 
  53.             { 
  54.             wday = 0; 
  55.             ++line;
  56.             }
  57.         ++cday;
  58.         }
  59.     }
  60.  
  61. putnum( n, l, c )
  62.     int n, l, c;
  63.     {
  64.     char att1, att2;
  65.     att1 = NULL;
  66.     att2 = ATTBRT;
  67.     if (n == day)
  68.         {    
  69.         att1 = ATTINV;
  70.         att2 = ATTDIM | ATTUND;
  71.         }
  72.     if (n < 10 )    
  73.         { 
  74.         cpoke( l, c, ' ', ATTBRT ); 
  75.         }
  76.     else    
  77.         { 
  78.         cpoke( l, c, ((n / 10) + '0') | att1, att2 ); 
  79.         }
  80.     cpoke( l, c+1, ((n % 10) + '0') | att1, att2 );
  81.     }
  82.  
  83. clrcal()
  84.     {
  85.     *(FLchain - 2) = 0;
  86.     fill( CLINE, CCOL, CLINE+10, CCOL+29, FILL1, ATTDIM | ATTALT );
  87.     }
  88.  
  89. t1, att2 );
  90.     }
  91.  
  92. clrcal()
  93.     {
  94.     *(FLchain - 2) = 0;
  95.     fill( CLINE, CCOL, CLINE+10, CCOL+29, FILL1, ATTDIM |