source cleanup, gnuindent

This commit is contained in:
Egan Ford 2017-04-16 10:38:06 -06:00
parent f3b1afb67b
commit 373c4ea6c6
5 changed files with 37 additions and 39 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -6,29 +6,28 @@ int main()
char screen[24][40];
// build table
for(j=0,i=0;i<8;i++) {
linemap[0+3*j]=j;
linemap[1+3*j]=j+8;
linemap[2+3*j]=j+16;
j++;
for (j = 0, i = 0; i < 8; i++, j++) {
linemap[0 + 3 * j] = j;
linemap[1 + 3 * j] = j + 8;
linemap[2 + 3 * j] = j + 16;
}
// clear screen
for(i=0;i<24;i++)
for(j=0;j<40;j++)
for (i = 0; i < 24; i++)
for (j = 0; j < 40; j++)
screen[linemap[i]][j] = ' ';
for(i=0;i<24;i++) {
for(j=0;j<40;j++)
for (i = 0; i < 24; i++) {
for (j = 0; j < 40; j++)
screen[linemap[i]][j] = getchar() & 0x7F;
if((i + 1) % 3 == 0)
for(k=0;k<8;k++)
if ((i + 1) % 3 == 0)
for (k = 0; k < 8; k++)
getchar();
}
// dump to stdout
for(i=0;i<24;i++) {
for(j=0;j<40;j++)
for (i = 0; i < 24; i++) {
for (j = 0; j < 40; j++)
putchar(screen[i][j]);
printf("\n");
}

View File

@ -1,14 +1,14 @@
#include <stdio.h>
unsigned char holes[] = {
0x37,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
0xff,0xff,0x00,0xff,0xff,0xff,0x00,0x00,
0xff,0xff,0x00,0xff,0xff,0xff,0x00,0x00,
0xff,0xff,0x00,0x17,0xff,0xff,0x00,0x00,
0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
0xff,0xff,0x00,0xd0,0xff,0xff,0x00,0x00,
0xc6,0xff,0x00,0x07,0xff,0xff,0x00,0x00
0x37, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00,
0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00,
0xff, 0xff, 0x00, 0x17, 0xff, 0xff, 0x00, 0x00,
0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
0xff, 0xff, 0x00, 0xd0, 0xff, 0xff, 0x00, 0x00,
0xc6, 0xff, 0x00, 0x07, 0xff, 0xff, 0x00, 0x00
};
int main()
@ -18,29 +18,28 @@ int main()
unsigned char screen[24][40];
// build table
for(j=0,i=0;i<8;i++) {
linemap[ 0 + j]=0+3*j;
linemap[ 8 + j]=1+3*j;
linemap[16 + j]=2+3*j;
j++;
for (j = 0, i = 0; i < 8; i++, j++) {
linemap[0 + j] = 0 + 3 * j;
linemap[8 + j] = 1 + 3 * j;
linemap[16 + j] = 2 + 3 * j;
}
// clear screen
for(i=0;i<24;i++)
for(j=0;j<40;j++)
for (i = 0; i < 24; i++)
for (j = 0; j < 40; j++)
screen[linemap[i]][j] = ' ' | highbit;
while((c = getchar()) != EOF) {
if(c == '\r') // windows trash
while ((c = getchar()) != EOF) {
if (c == '\r') // windows trash
continue;
if(c == '\n') { // end of line
column=0;
if (c == '\n') { // end of line
column = 0;
line++;
continue;
}
if(column > 39) // user didn't read the docs
if (column > 39) // user didn't read the docs
continue;
if(line > 23) // ditto
if (line > 23) // ditto
break;
screen[linemap[line]][column] = c | highbit;
@ -48,12 +47,12 @@ int main()
}
// dump to stdout
for(i=0;i<24;i++) {
for(j=0;j<40;j++)
for (i = 0; i < 24; i++) {
for (j = 0; j < 40; j++)
putchar(screen[i][j]);
if((i + 1) % 3 == 0)
for(k=0;k<8;k++)
putchar(holes[(i/3)*8+k]);
if ((i + 1) % 3 == 0)
for (k = 0; k < 8; k++)
putchar(holes[(i / 3) * 8 + k]);
}
return 0;