Another try in normalizing C coding style.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5363 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
ol.sc 2012-01-02 12:01:43 +00:00
parent 8abedd2bae
commit 2bac717dee

View file

@ -105,8 +105,8 @@ char outputCMode[2] = "w";
char outputSMode[2] = "w"; char outputSMode[2] = "w";
static void Usage (void) { static void Usage (void)
{
printf ("Usage: %s [options] file\n" printf ("Usage: %s [options] file\n"
"Short options:\n" "Short options:\n"
" -V\t\t\tPrint the version number\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) static void OptTarget (const char* Opt attribute ((unused)), const char* Arg)
/* Set the target system */ /* 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)), static void OptVersion (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused))) const char* Arg attribute ((unused)))
/* Print the assembler version */ /* 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, fprintf (outputCFile,
"//\n" "//\n"
"//\tThis file was generated by the GEOS Resource Compiler\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, fprintf (outputSFile,
";\n" ";\n"
";\tThis file was generated by the GEOS Resource Compiler\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) { if ((outputCFile = fopen (outputCName,outputCMode)) == 0) {
AbEnd ("Can't open file %s for writing: %s", outputCName, strerror (errno)); 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) { if ((outputSFile = fopen (outputSName, outputSMode)) == 0) {
AbEnd ("Can't open file %s for writing: %s", outputSName, strerror (errno)); 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 */ /* takes as input table of tokens and token, returns position in table or -1 if not found */
int a = 0; 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, "\""); return strtok (NULL, "\"");
} }
static char *nextWord (void) { static char *nextWord (void)
{
return strtok (NULL, " "); return strtok (NULL, " ");
} }
static void setLen (char *name, unsigned len) { static void setLen (char *name, unsigned len)
{
if (strlen (name) > len) if (strlen (name) > len)
name[len] = '\0'; name[len] = '\0';
} }
static void fillOut (char *name, int len, char *filler) { static void fillOut (char *name, int len, char *filler)
{
int a; int a;
setLen(name, len); 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; int i=0;
for (; i < 8; i++) { 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 */ /* count length of a word using BSW 9 font table */
int a = 0, i = 0; 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; int a, size, tmpsize, item = 0;
char *token; char *token;
char namebuff[255] = ""; char namebuff[255] = "";
@ -328,7 +329,7 @@ static void DoMenu (void) {
strcat (namebuff, " "); strcat (namebuff, " ");
strcat (namebuff, token); strcat (namebuff, token);
} while (token[strlen(token) - 1] != '"'); } while (token[strlen(token) - 1] != '"');
token = xmalloc (strlen(namebuff)); token = xmalloc (strlen (namebuff));
strcpy (token, namebuff); strcpy (token, namebuff);
} }
curItem->name = token; curItem->name = token;
@ -402,12 +403,12 @@ static void DoMenu (void) {
"};\n\n"); "};\n\n");
if (fclose (outputCFile) != 0) 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; time_t t;
struct tm *my_tm; struct tm *my_tm;
@ -636,12 +637,12 @@ static void DoHeader (void) {
myHead.info); myHead.info);
if (fclose (outputSFile) != 0) 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; char *token;
int record, lastrecord; int record, lastrecord;
int vlirsize, vlirtable[127]; int vlirsize, vlirtable[127];
@ -714,7 +715,7 @@ static void DoVLIR (void) {
"\n"); "\n");
if (fclose (outputSFile) != 0) if (fclose (outputSFile) != 0)
AbEnd ("Error closing %s: %s", outputSName, strerror(errno)); AbEnd ("Error closing %s: %s", outputSName, strerror (errno));
openCFile (); openCFile ();
@ -725,12 +726,12 @@ static void DoVLIR (void) {
"#define OVERLAY_SIZE (unsigned)&_OVERLAYSIZE__\n\n"); "#define OVERLAY_SIZE (unsigned)&_OVERLAYSIZE__\n\n");
if (fclose (outputCFile) != 0) 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 */ /* loads file into buffer filtering it out */
int a, prevchar = -1, i = 0, bracket = 0, quote = 1; 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; FILE *F;
char *str; 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 */ /* Program long options */
static const LongOpt OptTab[] = { static const LongOpt OptTab[] = {
{ "--help", 0, OptHelp}, { "--help", 0, OptHelp},
@ -834,7 +835,6 @@ int main (int argc, char *argv[]) {
unsigned ffile = 0; unsigned ffile = 0;
unsigned I; unsigned I;
/* Initialize the cmdline module */ /* Initialize the cmdline module */
InitCmdLine (&argc, &argv, "grc65"); InitCmdLine (&argc, &argv, "grc65");