hgr-utils: shape-table: clean up whitespace, fix compiler warning

This commit is contained in:
Vince Weaver 2016-03-11 15:31:09 -05:00
parent 4f18bff2bd
commit 9efa352160

View File

@ -11,7 +11,7 @@
static unsigned char table[MAX_SIZE];
void set_offset(current_shape,current_offset) {
static void set_offset(int current_shape,int current_offset) {
table[2+(current_shape*2)]=current_offset&0xff;
table[2+(current_shape*2)+1]=(current_offset>>8)&0xff;
@ -25,18 +25,20 @@ static void warn_if_zero(unsigned char byte, int line) {
/* Check to see if we're accidentally ignoring bytes */
if (byte==0) {
fprintf(stderr,"Warning, all-0 byte will be ignored on line %d!\n",
fprintf(stderr,
"Warning, all-0 byte will be ignored on line %d!\n",
line);
}
if ((byte&0xf8)==0) {
fprintf(stderr,"Warning, ignoring C and B due to 0 on line %d!\n",
fprintf(stderr,
"Warning, ignoring C and B due to 0 on line %d!\n",
line);
}
}
void print_usage(char *exe) {
static void print_usage(char *exe) {
printf("Usage:\t%s [-h] [-a] [-b]\n\n",exe);
printf("\t-h\tprint this help message\n");
printf("\t-a\toutput shape table in applesoft BASIC format\n");
@ -61,18 +63,22 @@ int main(int argc, char **argv) {
if (argc<2) {
output_binary=0;
}
else {
if (argv[1][0]=='-') {
switch(argv[1][1]) {
case 'h': print_usage(argv[0]);
case 'b': output_binary=1;
case 'h':
print_usage(argv[0]);
break;
case 'a': output_binary=0;
case 'b':
output_binary=1;
break;
default: printf("Unknown options %s\n",argv[1]);
case 'a':
output_binary=0;
break;
default:
printf("Unknown options %s\n",argv[1]);
print_usage(argv[0]);
}
}
@ -117,7 +123,6 @@ int main(int argc, char **argv) {
}
/* READ DATA */
sub_pointer=LOC_A;
@ -131,7 +136,6 @@ int main(int argc, char **argv) {
if (strstr(string,"STOP")) break;
/* yes, this is inefficient... */
if (strstr(string,"NUP")) command=0;
@ -166,7 +170,6 @@ int main(int argc, char **argv) {
sub_pointer=LOC_B;
}
else {
/* write to LOC_C */
table[current_offset]|=((command&0x3)<<6);
@ -175,7 +178,6 @@ int main(int argc, char **argv) {
current_offset++;
sub_pointer=LOC_A;
}
}
}