1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +00:00

The assembler options -l and --listing will now take the name of the listing

file as an argument.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4967 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2011-02-06 20:10:19 +00:00
parent 3b9032a7c4
commit a6389e6406
7 changed files with 51 additions and 52 deletions

View File

@ -95,7 +95,7 @@ Short options:
-g Add debug info to object file
-h Help (this text)
-i Ignore case of symbols
-l Create a listing if assembly was ok
-l name Create a listing file if assembly was ok
-mm model Set the memory model
-o name Name the output file
-s Enable smart mode
@ -114,7 +114,7 @@ Long options:
--help Help (this text)
--ignore-case Ignore case of symbols
--include-dir dir Set an include directory search path
--listing Create a listing if assembly was ok
--listing name Create a listing file if assembly was ok
--list-bytes n Maximum number of bytes per listing line
--macpack-dir dir Set a macro package directory
--memory-model model Set the memory model
@ -219,11 +219,10 @@ Here is a description of all the command line options:
<label id="option-l">
<tag><tt>-l, --listing</tt></tag>
<tag><tt>-l name, --listing name</tt></tag>
Generate an assembler listing. The listing file will always have the
name of the main input file with the extension replaced by ".lst". This
may change in future versions.
Generate an assembler listing with the given name. A listing file will
never be generated in case of assembly errors.
<label id="option--list-bytes">

View File

@ -38,7 +38,7 @@ Short options:
-d Debug mode
-g Add debug info
-h Help (this text)
-l Create an assembler listing
-l name Create an assembler listing file
-m name Create a map file
-mm model Set the memory model
-o name Name the output file
@ -94,7 +94,7 @@ Long options:
--lib file Link this library
--lib-path path Specify a library search path
--list-targets List all available targets
--listing Create an assembler listing
--listing name Create an assembler listing file
--list-bytes n Number of bytes per assembler listing line
--mapfile name Create a map file
--memory-model model Set the memory model

View File

@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 1998-2010, Ullrich von Bassewitz */
/* (C) 1998-2011, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
@ -50,13 +50,12 @@
/* File names */
const char* InFile = 0; /* Name of input file */
const char* OutFile = 0; /* Name of output file */
const char* ListFile = 0; /* Name of listing file */
StrBuf ListingName = STATIC_STRBUF_INITIALIZER; /* Name of listing file */
StrBuf DepName = STATIC_STRBUF_INITIALIZER; /* Dependency file */
StrBuf FullDepName = STATIC_STRBUF_INITIALIZER; /* Full dependency file */
/* Default extensions */
const char ObjExt[] = ".o";/* Default object extension */
const char ListExt[] = ".lst"; /* Default listing extension */
char LocalStart = '@'; /* This char starts local symbols */
@ -64,7 +63,6 @@ unsigned char IgnoreCase = 0; /* Ignore case on identifiers? */
unsigned char AutoImport = 0; /* Mark unresolveds as import */
unsigned char SmartMode = 0; /* Smart mode */
unsigned char DbgSyms = 0; /* Add debug symbols */
unsigned char Listing = 0; /* Create listing file */
unsigned char LineCont = 0; /* Allow line continuation */
/* Emulation features */
@ -82,7 +80,7 @@ unsigned char OrgPerSeg = 0; /* Make .org local to current seg */
unsigned char CComments = 0; /* Allow C like comments */
/* Misc stuff */
const char Copyright[] = "(C) Copyright 1998-2010 Ullrich von Bassewitz";
const char Copyright[] = "(C) Copyright 1998-2011 Ullrich von Bassewitz";

View File

@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 1998-2010, Ullrich von Bassewitz */
/* (C) 1998-2011, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
@ -52,13 +52,12 @@
/* File names */
extern const char* InFile; /* Name of input file */
extern const char* OutFile; /* Name of output file */
extern const char* ListFile; /* Name of listing file */
extern StrBuf ListingName; /* Name of listing file */
extern StrBuf DepName; /* Name of dependencies file */
extern StrBuf FullDepName; /* Name of full dependencies file */
/* Default extensions */
extern const char ObjExt[]; /* Default object extension */
extern const char ListExt[]; /* Default listing extension */
extern char LocalStart; /* This char starts local symbols */
@ -66,7 +65,6 @@ extern unsigned char IgnoreCase; /* Ignore case on identifiers? */
extern unsigned char AutoImport; /* Mark unresolveds as import */
extern unsigned char SmartMode; /* Smart mode */
extern unsigned char DbgSyms; /* Add debug symbols */
extern unsigned char Listing; /* Create listing file */
extern unsigned char LineCont; /* Allow line continuation */
/* Emulation features */

View File

@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 2000-2009, Ullrich von Bassewitz */
/* (C) 2000-2011, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
@ -85,7 +85,7 @@ void NewListingLine (const char* Line, unsigned char File, unsigned char Depth)
/* Create a new ListLine struct and insert it */
{
/* Store only if listing is enabled */
if (Listing) {
if (SB_GetLen (&ListingName) > 0) {
ListLine* L;
@ -128,7 +128,7 @@ void NewListingLine (const char* Line, unsigned char File, unsigned char Depth)
void EnableListing (void)
/* Enable output of lines to the listing */
{
if (Listing) {
if (SB_GetLen (&ListingName) > 0) {
/* If we're about to enable the listing, do this for the current line
* also, so we will see the source line that did this.
*/
@ -143,7 +143,7 @@ void EnableListing (void)
void DisableListing (void)
/* Disable output of lines to the listing */
{
if (Listing) {
if (SB_GetLen (&ListingName) > 0) {
if (ListingEnabled == 0) {
/* Cannot switch the listing off once more */
Error ("Counter underflow");
@ -169,7 +169,7 @@ void SetListBytes (int Bytes)
void InitListingLine (void)
/* Initialize the current listing line */
{
if (Listing) {
if (SB_GetLen (&ListingName) > 0) {
/* Make the last loaded line the current line */
/* ###### This code is a hack! We really need to do it right
* as soon as we know, how:-(
@ -300,15 +300,12 @@ void CreateListing (void)
ListLine* L;
char HeaderBuf [LINE_HEADER_LEN+1];
/* Create the name of the listing file if needed */
if (ListFile == 0) {
ListFile = MakeFilename (InFile, ListExt);
}
/* Open the real listing file */
F = fopen (ListFile, "w");
F = fopen (SB_GetConstBuf (&ListingName), "w");
if (F == 0) {
Fatal ("Cannot open listing file: %s", strerror (errno));
Fatal ("Cannot open listing file `%s': %s",
SB_GetConstBuf (&ListingName),
strerror (errno));
}
/* Reset variables, print the header for the first page */

View File

@ -97,7 +97,7 @@ static void Usage (void)
" -g\t\t\t\tAdd debug info to object file\n"
" -h\t\t\t\tHelp (this text)\n"
" -i\t\t\t\tIgnore case of symbols\n"
" -l\t\t\t\tCreate a listing if assembly was ok\n"
" -l name\t\t\tCreate a listing file if assembly was ok\n"
" -mm model\t\t\tSet the memory model\n"
" -o name\t\t\tName the output file\n"
" -s\t\t\t\tEnable smart mode\n"
@ -116,7 +116,7 @@ static void Usage (void)
" --help\t\t\tHelp (this text)\n"
" --ignore-case\t\t\tIgnore case of symbols\n"
" --include-dir dir\t\tSet an include directory search path\n"
" --listing\t\t\tCreate a listing if assembly was ok\n"
" --listing name\t\tCreate a listing file if assembly was ok\n"
" --list-bytes n\t\tMaximum number of bytes per listing line\n"
" --macpack-dir dir\t\tSet a macro package directory\n"
" --memory-model model\t\tSet the memory model\n"
@ -388,7 +388,7 @@ static void OptCreateDep (const char* Opt, const char* Arg)
static void OptCreateFullDep (const char* Opt attribute ((unused)),
const char* Arg)
const char* Arg)
/* Handle the --create-full-dep option */
{
FileNameOption (Opt, Arg, &FullDepName);
@ -477,11 +477,19 @@ static void OptListBytes (const char* Opt, const char* Arg)
static void OptListing (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
static void OptListing (const char* Opt, const char* Arg)
/* Create a listing file */
{
Listing = 1;
/* Since the meaning of -l and --listing has changed, print an error if
* the filename is empty or begins with the option char.
*/
if (Arg == 0 || *Arg == '\0' || *Arg == '-') {
Fatal ("The meaning of `%s' has changed. It does now "
"expect a file name as argument.", Opt);
}
/* Get the file name */
FileNameOption (Opt, Arg, &ListingName);
}
@ -836,7 +844,7 @@ int main (int argc, char* argv [])
{ "--ignore-case", 0, OptIgnoreCase },
{ "--include-dir", 1, OptIncludeDir },
{ "--list-bytes", 1, OptListBytes },
{ "--listing", 0, OptListing },
{ "--listing", 1, OptListing },
{ "--macpack-dir", 1, OptMacPackDir },
{ "--memory-model", 1, OptMemoryModel },
{ "--pagelength", 1, OptPageLength },
@ -895,7 +903,7 @@ int main (int argc, char* argv [])
break;
case 'l':
OptListing (Arg, 0);
OptListing (Arg, GetArg (&I, 2));
break;
case 'm':
@ -1033,7 +1041,7 @@ int main (int argc, char* argv [])
*/
if (ErrorCount == 0) {
CreateObjFile ();
if (Listing) {
if (SB_GetLen (&ListingName) > 0) {
CreateListing ();
}
CreateDependencies ();

View File

@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 1999-2010, Ullrich von Bassewitz */
/* (C) 1999-2011, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
@ -668,7 +668,7 @@ static void Usage (void)
" -d\t\t\t\tDebug mode\n"
" -g\t\t\t\tAdd debug info\n"
" -h\t\t\t\tHelp (this text)\n"
" -l\t\t\t\tCreate an assembler listing\n"
" -l name\t\t\tCreate an assembler listing file\n"
" -m name\t\t\tCreate a map file\n"
" -mm model\t\t\tSet the memory model\n"
" -o name\t\t\tName the output file\n"
@ -724,7 +724,7 @@ static void Usage (void)
" --lib file\t\t\tLink this library\n"
" --lib-path path\t\tSpecify a library search path\n"
" --list-targets\t\tList all available targets\n"
" --listing\t\t\tCreate an assembler listing\n"
" --listing name\t\tCreate an assembler listing file\n"
" --list-bytes n\t\tNumber of bytes per assembler listing line\n"
" --mapfile name\t\tCreate a map file\n"
" --memory-model model\t\tSet the memory model\n"
@ -1009,17 +1009,16 @@ static void OptListBytes (const char* Opt attribute ((unused)), const char* Arg)
static void OptListing (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
static void OptListing (const char* Opt attribute ((unused)), const char* Arg)
/* Create an assembler listing */
{
CmdAddArg (&CA65, "-l");
CmdAddArg2 (&CA65, "-l", Arg);
}
static void OptListTargets (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
const char* Arg attribute ((unused)))
/* List all targets */
{
unsigned I;
@ -1191,7 +1190,7 @@ static void OptVersion (const char* Opt attribute ((unused)),
/* Print version number */
{
fprintf (stderr,
"cl65 V%s - (C) Copyright 1998-2009 Ullrich von Bassewitz\n",
"cl65 V%s - (C) Copyright 1998-2011 Ullrich von Bassewitz\n",
GetVersionAsString ());
}
@ -1247,7 +1246,7 @@ int main (int argc, char* argv [])
{ "--lib", 1, OptLib },
{ "--lib-path", 1, OptLibPath },
{ "--list-targets", 0, OptListTargets },
{ "--listing", 0, OptListing },
{ "--listing", 1, OptListing },
{ "--list-bytes", 1, OptListBytes },
{ "--mapfile", 1, OptMapFile },
{ "--memory-model", 1, OptMemoryModel },
@ -1403,7 +1402,7 @@ int main (int argc, char* argv [])
case 'l':
/* Create an assembler listing */
OptListing (Arg, 0);
OptListing (Arg, GetArg (&I, 2));
break;
case 'm':