/* */
/* */
/* */
-/* (C) 2000-2005 Ullrich von Bassewitz */
+/* (C) 2000-2006 Ullrich von Bassewitz */
/* Römerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* Page formatting */
unsigned PageLength = 0; /* Length of a listing page */
+unsigned LBreak = 7; /* Linefeed if labels exceed this limit */
unsigned MIndent = 9; /* Mnemonic indent */
unsigned AIndent = 17; /* Argument indent */
unsigned CIndent = 49; /* Comment indent */
/* */
/* */
/* */
-/* (C) 2000-2005 Ullrich von Bassewitz */
+/* (C) 2000-2006 Ullrich von Bassewitz */
/* Römerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
#define MIN_PAGE_LEN 32
#define MAX_PAGE_LEN 127
extern unsigned PageLength; /* Length of a listing page */
+extern unsigned LBreak; /* Linefeed if labels exceed this limit */
extern unsigned MIndent; /* Mnemonic indent */
extern unsigned AIndent; /* Argument indent */
extern unsigned CIndent; /* Comment indent */
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#if defined(_MSC_VER)
/* Microsoft compiler */
# include <io.h>
{ "INPUTNAME", INFOTOK_INPUTNAME },
{ "INPUTOFFS", INFOTOK_INPUTOFFS },
{ "INPUTSIZE", INFOTOK_INPUTSIZE },
+ { "LABELBREAK", INFOTOK_LABELBREAK },
{ "OUTPUTNAME", INFOTOK_OUTPUTNAME },
{ "PAGELENGTH", INFOTOK_PAGELENGTH },
{ "STARTADDR", INFOTOK_STARTADDR },
InfoNextTok ();
break;
+ case INFOTOK_LABELBREAK:
+ InfoNextTok ();
+ InfoAssureInt ();
+ InfoRangeCheck (0, UCHAR_MAX);
+ LBreak = (unsigned char) InfoIVal;
+ InfoNextTok ();
+ break;
+
case INFOTOK_OUTPUTNAME:
InfoNextTok ();
InfoAssureStr ();
/* */
/* */
/* */
-/* (C) 1998-2005 Ullrich von Bassewitz */
+/* (C) 1998-2006 Ullrich von Bassewitz */
/* Römerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#include <limits.h>
#include <time.h>
/* common */
" --help\t\tHelp (this text)\n"
" --hexoffs\t\tUse hexadecimal label offsets\n"
" --info name\t\tSpecify an info file\n"
+ " --label-break n\tAdd newline if label exceeds length n\n"
" --pagelength n\tSet the page length for the listing\n"
" --start-addr addr\tSet the start/load address\n"
" --verbose\t\tIncrease verbosity\n"
+static void OptLabelBreak (const char* Opt, const char* Arg)
+/* Handle the --label-break option */
+{
+ /* Convert the argument to a number */
+ unsigned long Val = CvtNumber (Opt, Arg);
+
+ /* Check for a valid range */
+ if (Val >= UCHAR_MAX) {
+ Error ("Argument for %s out of valid range (%d)",
+ Opt, UCHAR_MAX);
+ }
+
+ /* Use the value */
+ LBreak = (unsigned char) Val;
+}
+
+
+
static void OptPageLength (const char* Opt attribute ((unused)), const char* Arg)
/* Handle the --pagelength option */
{
{ "--help", 0, OptHelp },
{ "--hexoffs", 0, OptHexOffs },
{ "--info", 1, OptInfo },
+ { "--label-break", 1, OptLabelBreak },
{ "--pagelength", 1, OptPageLength },
{ "--start-addr", 1, OptStartAddr },
{ "--verbose", 0, OptVerbose },
/* */
/* */
/* */
-/* (C) 2000-2005 Ullrich von Bassewitz */
+/* (C) 2000-2006 Ullrich von Bassewitz */
/* Römerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* Define a label with the given name */
{
Output ("%s:", Name);
- /* Don't start a new line if the label is fully in the left column */
- if (Col > MIndent) {
+ /* If the label is longer than the configured maximum, or if it runs into
+ * the opcode column, start a new line.
+ */
+ if (Col > LBreak+2 || Col > MIndent) {
LineFeed ();
}
}
/* */
/* */
/* */
-/* (C) 2000-2005 Ullrich von Bassewitz */
+/* (C) 2000-2006 Ullrich von Bassewitz */
/* Römerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
INFOTOK_INPUTNAME,
INFOTOK_INPUTOFFS,
INFOTOK_INPUTSIZE,
+ INFOTOK_LABELBREAK,
INFOTOK_OUTPUTNAME,
INFOTOK_PAGELENGTH,
INFOTOK_STARTADDR,