1BSD/s6/block.c
#
/*
* block - print characters in block letters
*/
# define HEIGHT 6
# define WIDTH 5
char MATRIX[] {
0,0,0,0,0, /* space */
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
1,1,1,1,1, /* ! */
0,1,1,1,0,
0,0,1,0,0,
0,0,0,0,0,
0,0,1,0,0,
0,0,0,0,0,
1,1,0,1,1, /* " */
0,1,0,0,1,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,1,0,1,0, /* # */
1,1,1,1,1,
0,1,0,1,0,
1,1,1,1,1,
0,1,0,1,0,
0,0,0,0,0,
0,1,1,1,1, /* $ */
1,0,1,0,0,
0,1,1,1,0,
0,0,1,0,1,
1,1,1,1,0,
0,0,0,0,0,
1,1,0,0,1, /* % */
1,1,0,1,0,
0,0,1,0,0,
0,1,0,1,1,
1,0,0,1,1,
0,0,0,0,0,
0,1,1,1,0, /* & */
0,1,0,1,0,
0,0,1,0,0,
0,1,0,1,0,
0,1,1,1,1,
0,0,0,1,0,
0,0,1,1,0, /* ' */
0,0,1,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,1,0,0, /* ( */
0,1,0,0,0,
0,1,0,0,0,
0,1,0,0,0,
0,0,1,0,0,
0,0,0,0,0,
0,0,1,0,0, /* ) */
0,0,0,1,0,
0,0,0,1,0,
0,0,0,1,0,
0,0,1,0,0,
0,0,0,0,0,
0,0,0,0,0, /* * */
0,1,0,1,0,
1,1,1,1,1,
0,1,0,1,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0, /* + */
0,0,1,0,0,
0,1,1,1,0,
0,0,1,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0, /* , */
0,0,0,0,0,
0,0,0,0,0,
0,0,1,1,0,
0,0,1,1,0,
0,1,0,0,0,
0,0,0,0,0, /* - */
0,0,0,0,0,
0,1,1,1,0,
0,0,0,0,0,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
0,1,0,1,0,
0,0,1,0,0,
0,0,1,0,0,
0,0,1,0,0,
0,0,0,0,0,
1,1,1,1,1, /* Z */
0,0,0,1,0,
0,0,1,0,0,
0,1,0,0,0,
1,1,1,1,1,
0,0,0,0,0,
0,1,1,1,0, /* [ */
0,1,0,0,0,
0,1,0,0,0,
0,1,0,0,0,
0,1,1,1,0,
0,0,0,0,0,
1,0,0,0,0, /* \ */
0,1,0,0,0,
0,0,1,0,0,
0,0,0,1,0,
0,0,0,0,1,
0,0,0,0,0,
0,1,1,1,0, /* ] */
0,0,0,1,0,
0,0,0,1,0,
0,0,0,1,0,
0,1,1,1,0,
0,0,0,0,0,
0,0,1,0,0, /* ^ */
0,1,0,1,0,
1,0,0,0,1,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0, /* _ */
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
1,1,1,1,1,
0,1,1,0,0, /* ` */
0,0,1,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,1,0, /* { */
0,0,1,0,0,
0,1,1,1,0,
0,0,1,0,0,
0,0,0,1,0,
0,0,0,0,0,
0,0,1,0,0, /* | */
0,0,1,0,0,
0,0,1,0,0,
0,0,1,0,0,
0,0,1,0,0,
0,0,0,0,0,
0,1,0,0,0, /* } */
0,0,1,0,0,
0,1,1,1,0,
0,0,1,0,0,
0,1,0,0,0,
0,0,0,0,0,
0,0,0,0,0, /* ~ */
0,1,0,0,0,
1,0,1,0,1,
0,0,0,1,0,
0,0,0,0,0,
0,0,0,0,0,
};
/* END OF CHARACTER TABLE --
-- START OF PROGRAM TEXT
( JMF 08/19/75 ) */
int obuf[259];
main(argc,argv)
int argc;
char *argv[];
{
/* ARGV[1] = CHARACTER SPACING
ARGV[2] = PLOTTING CHARACTER
ARGV[3-n] = PLOT LINES */
int input,chr,spacing,length,row,col;
char *word,*ptr,plot;
if (argc < 4) exit(-1);
spacing = atoi(argv[1]);
plot = argv[2][0];
obuf[0] = 1;
for(input=3; input<argc; input++)
{
word = argv[input];
/* NORMALIZE CHARACTERS TO TABLE */
for(length=0; word[length]; length++)
{
if(word[length]>0140 && word[length]<0173) word[length] =- 040;
if(word[length]<040 || word[length]==0177) word[length] = 040;
if(word[length]>037 && word[length]<0141) word[length] =- 040;
if(word[length]>0172 && word[length]<0177) word[length] =- 072;
}
/* PLOT THE LINES */
for(row=0; row<HEIGHT; row++)
{
for(chr=0; chr<length; chr++)
{
ptr = &MATRIX[word[chr]*WIDTH*HEIGHT+row*WIDTH];
for(col=0; col<WIDTH; col++) if(ptr[col]) putchar(plot);
else putchar(' ');
for(col=0; col<spacing; col++) putchar(' ');
}
putchar('\n');
}
putchar('\n');
}
fflush(obuf);
}
putchar(c)
{
putc(c, obuf);
return(c);
}