1: #define nchars 64   /*number of chars in char set*/
   2: #define nlines  6   /*number of lines in a banner character*/
   3: #define pposs  85   /*number of print positions on a line (must be multiple of 4)*/
   4:             /*followed by end of string character*/
   5: #define pospch 8    /*number of char positions per banner char*/
   6: #define chpln  10   /*number of banner characters per line*/
   7: 
   8: struct bann{
   9:       char alpha[nlines][pposs];
  10: };
  11: struct bann buffer,*bp buffer;
  12: char ctbl[nchars][nlines]{
  13:     036,041,046,051,046,035,    /*@*/
  14:     014,022,041,077,041,041,    /*A*/
  15:     076,041,076,041,041,076,    /*B*/
  16:     036,041,040,040,041,036,    /*C*/
  17:     076,041,041,041,041,076,    /*D*/
  18:     077,040,076,040,040,077,    /*E*/
  19:     077,040,076,040,040,040,    /*F*/
  20:     036,041,040,047,041,036,    /*G*/
  21:     041,041,077,041,041,041,    /*H*/
  22:     004,004,004,004,004,004,    /*I*/
  23:     001,001,001,001,041,036,    /*J*/
  24:     041,042,074,044,042,041,    /*K*/
  25:     040,040,040,040,040,077,    /*L*/
  26:     041,063,055,041,041,041,    /*M*/
  27:     041,061,051,045,043,041,    /*N*/
  28:     036,041,041,041,041,036,    /*O*/
  29:     076,041,041,076,040,040,    /*P*/
  30:     036,041,041,045,042,035,    /*Q*/
  31:     076,041,041,076,042,041,    /*R*/
  32:     036,040,036,001,041,036,    /*S*/
  33:     037,004,004,004,004,004,    /*T*/
  34:     041,041,041,041,041,036,    /*U*/
  35:     041,041,041,041,022,014,    /*V*/
  36:     041,041,041,055,063,041,    /*W*/
  37:     041,022,014,014,022,041,    /*X*/
  38:     021,012,004,004,004,004,    /*Y*/
  39:     077,002,004,010,020,077,    /*Z*/
  40:     016,010,010,010,010,016,    /*[*/
  41:     040,020,010,004,002,001,    /*\*/
  42:     034,004,004,004,004,034,    /*]*/
  43:     004,012,000,000,000,000,    /*^*/
  44:     000,000,000,000,000,077,    /*_*/
  45:     000,000,000,000,000,000,    /* */
  46:     010,010,010,010,000,010,    /*!*/
  47:     022,022,000,000,000,000,    /*"*/
  48:     022,077,022,022,077,022,    /*#*/
  49:     036,054,036,015,055,036,    /*$*/
  50:     001,062,064,013,023,040,    /*%*/
  51:     014,022,014,024,042,035,    /*&*/
  52:     010,010,000,000,000,000,    /*'*/
  53:     004,010,010,010,010,004,    /*(*/
  54:     010,004,004,004,004,010,    /*)*/
  55:     000,022,014,014,022,000 /***/
  56: };
  57: char blank ' ';
  58: char plot 'X';
  59: int msk 040;    /*mask at sixth bit*/
  60: 
  61: main(argc,argp)
  62: char **argp;int argc;
  63: {
  64:     int i;
  65: 
  66:     /*if invoked with no arguments, prints error comment;
  67: 	  if invoked with an argument, prints it in banner form.
  68: 	*/
  69: 
  70:     if(argc<2){
  71:       printf("missing argument\n");
  72:       exit();
  73:     }
  74:     banner(argp[1],bp);
  75:     banprt(bp);
  76: }
  77: 
  78: banner(s,bufp)
  79: char *s;struct bann *bufp;
  80: {
  81:     char c,*p,*q,*r;
  82:     p=s;
  83:     r=bufp;
  84:     banset(blank,bufp);
  85: 
  86:     while((c= *s++)!=0){
  87:       if((s-p)>chpln)return(s-p);
  88:       if(c>='`')c =- ' ';   /*map lower to upper case*/
  89:       if(c<' ')c='#';
  90:       if(c>'?')c=- 0100;
  91:       q=ctbl[c];
  92:       banfil(q,r);
  93:       r=+pospch;
  94:     }
  95: }
  96: 
  97: banfil(c,p)
  98: char *c;
  99: struct bann *p;
 100: {
 101:     int i,j;
 102:     for(i=0;i<nlines;i++){
 103:       for(j=0;j<pospch;j++){
 104:         if(((c[i]<<j)&msk)!=0)p->alpha[i][j] = plot;
 105:       }
 106:     }
 107:     return(0);
 108: }
 109: 
 110: banset(c,p)
 111: char c;
 112: struct bann *p;
 113: {
 114:     int i,j;
 115:     for(i=0;i<nlines;i++)
 116:       for(j=0;j<pposs-1;j++)
 117:         p->alpha[i][j] = c;
 118: }
 119: 
 120: banprt(ptr)
 121: struct bann *ptr;
 122: {
 123:     int i,j;
 124:     for(i=0;i<nlines;i++){
 125:       ptr->alpha[i][pposs-1]='\0';
 126:       for(j=pposs-2;j>=0;j--){
 127:         if(ptr->alpha[i][j]!=blank)break;
 128:         ptr->alpha[i][j]='\0';
 129:       }
 130:     printf("%s\n",ptr->alpha[i]);
 131:     }
 132: }

Defined functions

banfil defined in line 97; used 1 times
  • in line 92
banner defined in line 78; used 1 times
  • in line 74
banprt defined in line 120; used 1 times
  • in line 75
banset defined in line 110; used 1 times
  • in line 84
main defined in line 61; never used

Defined variables

blank defined in line 57; used 2 times
bp defined in line 11; used 2 times
buffer defined in line 11; never used
ctbl defined in line 12; used 1 times
  • in line 91
msk defined in line 59; used 1 times
plot defined in line 58; used 1 times

Defined struct's

bann defined in line 8; used 10 times

Defined macros

chpln defined in line 6; used 1 times
  • in line 87
nchars defined in line 1; used 1 times
  • in line 12
nlines defined in line 2; used 5 times
pospch defined in line 5; used 2 times
pposs defined in line 3; used 4 times
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 940
Valid CSS Valid XHTML 1.0 Strict