From 409d12534b7d874fef3356d28c1379685fb0e7b5 Mon Sep 17 00:00:00 2001 From: cuz Date: Wed, 14 Jun 2000 10:58:52 +0000 Subject: [PATCH] New option --add-source git-svn-id: svn://svn.cc65.org/cc65/trunk@79 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/global.c | 4 ++-- src/cc65/global.h | 2 +- src/cc65/io.c | 2 +- src/cc65/main.c | 49 ++++++++++++++++++++++++++++------------------- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/cc65/global.c b/src/cc65/global.c index 81d26b8e6..42e90431d 100644 --- a/src/cc65/global.c +++ b/src/cc65/global.c @@ -56,11 +56,11 @@ unsigned char RegVarsToCallStack= 0; /* Save reg variables on call stack unsigned char LocalsAreStatic = 0; /* Make local variables static */ unsigned char SignedChars = 0; /* Make characters signed by default */ unsigned char Verbose = 0; /* Verbose flag */ -unsigned char IncSource = 0; /* Include source as comments */ +unsigned char AddSource = 0; /* Add source lines as comments */ unsigned char DebugInfo = 0; /* Add debug info to the obj */ unsigned char Debug = 0; /* Debug mode */ - + diff --git a/src/cc65/global.h b/src/cc65/global.h index c6eaef7c7..f4d6f8f31 100644 --- a/src/cc65/global.h +++ b/src/cc65/global.h @@ -73,7 +73,7 @@ extern unsigned char RegVarsToCallStack; /* Save reg variables on call stack */ extern unsigned char LocalsAreStatic; /* Make local variables static */ extern unsigned char SignedChars; /* Make characters signed by default */ extern unsigned char Verbose; /* Verbose flag */ -extern unsigned char IncSource; /* Include source as comments */ +extern unsigned char AddSource; /* Add source lines as comments */ extern unsigned char DebugInfo; /* Add debug info to the obj */ extern unsigned char Debug; /* Debug mode */ diff --git a/src/cc65/io.c b/src/cc65/io.c index c94d8b863..3572dd7c6 100644 --- a/src/cc65/io.c +++ b/src/cc65/io.c @@ -162,7 +162,7 @@ int NextLine (void) /* Output the source line in the generated assembler file * if requested. */ - if (IncSource && line[Start] != '\0') { + if (AddSource && line[Start] != '\0') { AddCodeLine ("; %s", line+Start); } diff --git a/src/cc65/main.c b/src/cc65/main.c index 134ae7e8f..bc0d763b1 100644 --- a/src/cc65/main.c +++ b/src/cc65/main.c @@ -260,6 +260,14 @@ static void DefineSym (const char* Def) +static void OptAddSource (const char* Opt, const char* Arg) +/* Add source lines as comments in generated assembler file */ +{ + AddSource = 1; +} + + + static void OptAnsi (const char* Opt, const char* Arg) /* Compile in strict ANSI mode */ { @@ -355,6 +363,7 @@ int main (int argc, char* argv[]) { /* Program long options */ static const LongOpt OptTab[] = { + { "--add-source", 0, OptAddSource }, { "--ansi", 0, OptAnsi }, { "--cpu", 1, OptCPU }, { "--debug-info", 0, OptDebugInfo }, @@ -394,7 +403,7 @@ int main (int argc, char* argv[]) LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); break; - case 'd': /* debug mode */ + case 'd': /* debug mode */ Debug = 1; break; @@ -432,8 +441,8 @@ int main (int argc, char* argv[]) while (*P) { switch (*P++) { case 'l': - LocalsAreStatic = 1; - break; + LocalsAreStatic = 1; + break; } } break; @@ -442,7 +451,7 @@ int main (int argc, char* argv[]) DefineSym (GetArg (&I, 2)); break; - case 'I': + case 'I': OptIncludeDir (Arg, GetArg (&I, 2)); break; @@ -468,26 +477,26 @@ int main (int argc, char* argv[]) break; case 'T': - IncSource = 1; - break; + OptAddSource (Arg, 0); + break; - case 'V': - OptVersion (Arg, 0); - break; + case 'V': + OptVersion (Arg, 0); + break; - case 'W': - NoWarn = 1; - break; + case 'W': + NoWarn = 1; + break; - default: + default: UnknownOption (Arg); - break; - } - } else { - if (fin) { - fprintf (stderr, "additional file specs ignored\n"); - } else { - fin = xstrdup (Arg); + break; + } + } else { + if (fin) { + fprintf (stderr, "additional file specs ignored\n"); + } else { + fin = xstrdup (Arg); inp = fopen (fin, "r"); if (inp == 0) { Fatal (FAT_CANNOT_OPEN_INPUT, strerror (errno));