From 2bac717deef077982f8d419415c060f4d76c76ca Mon Sep 17 00:00:00 2001 From: "ol.sc" Date: Mon, 2 Jan 2012 12:01:43 +0000 Subject: [PATCH] Another try in normalizing C coding style. git-svn-id: svn://svn.cc65.org/cc65/trunk@5363 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/grc65/main.c | 82 ++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/grc65/main.c b/src/grc65/main.c index b862e221b..2bbdc0352 100644 --- a/src/grc65/main.c +++ b/src/grc65/main.c @@ -105,8 +105,8 @@ char outputCMode[2] = "w"; char outputSMode[2] = "w"; -static void Usage (void) { - +static void Usage (void) +{ printf ("Usage: %s [options] file\n" "Short options:\n" " -V\t\t\tPrint the version number\n" @@ -132,7 +132,6 @@ static void OptHelp (const char* Opt attribute ((unused)), } - static void OptTarget (const char* Opt attribute ((unused)), const char* Arg) /* Set the target system */ { @@ -159,7 +158,6 @@ static void OptTarget (const char* Opt attribute ((unused)), const char* Arg) } - static void OptVersion (const char* Opt attribute ((unused)), const char* Arg attribute ((unused))) /* Print the assembler version */ @@ -171,8 +169,8 @@ static void OptVersion (const char* Opt attribute ((unused)), -static void printCHeader (void) { - +static void printCHeader (void) +{ fprintf (outputCFile, "//\n" "//\tThis file was generated by the GEOS Resource Compiler\n" @@ -184,8 +182,8 @@ static void printCHeader (void) { } -static void printSHeader (void) { - +static void printSHeader (void) +{ fprintf (outputSFile, ";\n" ";\tThis file was generated by the GEOS Resource Compiler\n" @@ -197,8 +195,8 @@ static void printSHeader (void) { } -static void openCFile (void) { - +static void openCFile (void) +{ if ((outputCFile = fopen (outputCName,outputCMode)) == 0) { AbEnd ("Can't open file %s for writing: %s", outputCName, strerror (errno)); } @@ -211,8 +209,8 @@ static void openCFile (void) { } -static void openSFile (void) { - +static void openSFile (void) +{ if ((outputSFile = fopen (outputSName, outputSMode)) == 0) { AbEnd ("Can't open file %s for writing: %s", outputSName, strerror (errno)); } @@ -225,8 +223,8 @@ static void openSFile (void) { } -static int findToken (const char **tokenTbl, const char *token) { - +static int findToken (const char **tokenTbl, const char *token) +{ /* takes as input table of tokens and token, returns position in table or -1 if not found */ int a = 0; @@ -240,24 +238,27 @@ static int findToken (const char **tokenTbl, const char *token) { } -static char *nextPhrase (void) { +static char *nextPhrase (void) +{ return strtok (NULL, "\""); } -static char *nextWord (void) { +static char *nextWord (void) +{ return strtok (NULL, " "); } -static void setLen (char *name, unsigned len) { +static void setLen (char *name, unsigned len) +{ if (strlen (name) > len) name[len] = '\0'; } -static void fillOut (char *name, int len, char *filler) { - +static void fillOut (char *name, int len, char *filler) +{ int a; setLen(name, len); @@ -270,8 +271,8 @@ static void fillOut (char *name, int len, char *filler) { } -static char *bintos (unsigned char a, char out[7]) { - +static char *bintos (unsigned char a, char out[7]) +{ int i=0; for (; i < 8; i++) { @@ -284,8 +285,8 @@ static char *bintos (unsigned char a, char out[7]) { } -static int getNameSize (const char *word) { - +static int getNameSize (const char *word) +{ /* count length of a word using BSW 9 font table */ int a = 0, i = 0; @@ -298,8 +299,8 @@ static int getNameSize (const char *word) { } -static void DoMenu (void) { - +static void DoMenu (void) +{ int a, size, tmpsize, item = 0; char *token; char namebuff[255] = ""; @@ -328,7 +329,7 @@ static void DoMenu (void) { strcat (namebuff, " "); strcat (namebuff, token); } while (token[strlen(token) - 1] != '"'); - token = xmalloc (strlen(namebuff)); + token = xmalloc (strlen (namebuff)); strcpy (token, namebuff); } curItem->name = token; @@ -402,12 +403,12 @@ static void DoMenu (void) { "};\n\n"); if (fclose (outputCFile) != 0) - AbEnd ("Error closing %s: %s", outputCName, strerror(errno)); + AbEnd ("Error closing %s: %s", outputCName, strerror (errno)); } -static void DoHeader (void) { - +static void DoHeader (void) +{ time_t t; struct tm *my_tm; @@ -636,12 +637,12 @@ static void DoHeader (void) { myHead.info); if (fclose (outputSFile) != 0) - AbEnd ("Error closing %s: %s", outputSName, strerror(errno)); + AbEnd ("Error closing %s: %s", outputSName, strerror (errno)); } -static void DoVLIR (void) { - +static void DoVLIR (void) +{ char *token; int record, lastrecord; int vlirsize, vlirtable[127]; @@ -714,7 +715,7 @@ static void DoVLIR (void) { "\n"); if (fclose (outputSFile) != 0) - AbEnd ("Error closing %s: %s", outputSName, strerror(errno)); + AbEnd ("Error closing %s: %s", outputSName, strerror (errno)); openCFile (); @@ -725,12 +726,12 @@ static void DoVLIR (void) { "#define OVERLAY_SIZE (unsigned)&_OVERLAYSIZE__\n\n"); if (fclose (outputCFile) != 0) - AbEnd ("Error closing %s: %s", outputCName, strerror(errno)); + AbEnd ("Error closing %s: %s", outputCName, strerror (errno)); } -static char *filterInput (FILE *F, char *tbl) { - +static char *filterInput (FILE *F, char *tbl) +{ /* loads file into buffer filtering it out */ int a, prevchar = -1, i = 0, bracket = 0, quote = 1; @@ -772,8 +773,8 @@ static char *filterInput (FILE *F, char *tbl) { } -static void processFile (const char *filename) { - +static void processFile (const char *filename) +{ FILE *F; char *str; @@ -822,8 +823,8 @@ static void processFile (const char *filename) { } -int main (int argc, char *argv[]) { - +int main (int argc, char *argv[]) +{ /* Program long options */ static const LongOpt OptTab[] = { { "--help", 0, OptHelp}, @@ -834,7 +835,6 @@ int main (int argc, char *argv[]) { unsigned ffile = 0; unsigned I; - /* Initialize the cmdline module */ InitCmdLine (&argc, &argv, "grc65"); -- 2.39.5