1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-17 00:29:31 +00:00

New option --add-source

git-svn-id: svn://svn.cc65.org/cc65/trunk@79 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2000-06-14 10:58:52 +00:00
parent 6d33db1291
commit 409d12534b
4 changed files with 33 additions and 24 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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);
}

View File

@ -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));