1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-28 22:30:12 +00:00

Moved verbose output to a shared module in the common/ directory.

git-svn-id: svn://svn.cc65.org/cc65/trunk@619 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2001-03-10 10:21:03 +00:00
parent d10079ccdc
commit 1eff067ff9
28 changed files with 53 additions and 76 deletions

View File

@ -43,7 +43,3 @@
int Verbose = 0; /* Verbose operation flag */

View File

@ -44,10 +44,6 @@
extern int Verbose; /* Verbose operation flag */
/* End of global.h */
#endif

View File

@ -42,6 +42,7 @@
#include "exprdefs.h"
#include "filepos.h"
#include "libdefs.h"
#include "print.h"
#include "symdefs.h"
#include "xmalloc.h"
@ -385,11 +386,9 @@ static void LibCheckExports (ObjData* O)
unsigned Count = GetVar (&Exports);
/* Read the exports */
if (Verbose > 1) {
printf ("Module `%s' (%u exports):\n", O->Name, Count);
}
Print (stdout, 1, "Module `%s' (%u exports):\n", O->Name, Count);
while (Count--) {
unsigned char Tag;
unsigned Len;
char* Name;
@ -420,9 +419,7 @@ static void LibCheckExports (ObjData* O)
SkipFilePos (&Exports);
/* Insert the name into the hash table */
if (Verbose > 1) {
printf (" %s\n", Name);
}
Print (stdout, 1, " %s\n", Name);
ExpInsert (Name, O->Index);
/* Free the name */

View File

@ -40,6 +40,7 @@
/* common */
#include "cmdline.h"
#include "print.h"
#include "version.h"
#include "global.h"
@ -79,7 +80,7 @@ int main (int argc, char* argv [])
int I;
/* Initialize the cmdline module */
InitCmdLine (&argc, &argv, "ar65");
InitCmdLine (&argc, &argv, "ar65");
/* We must have a file name */
if (ArgCount < 2) {
@ -112,7 +113,7 @@ int main (int argc, char* argv [])
break;
case 'v':
++Verbose;
++Verbosity;
break;
case 'x':

View File

@ -38,6 +38,7 @@
/* common */
#include "check.h"
#include "exprdefs.h"
#include "print.h"
#include "tgttrans.h"
#include "xmalloc.h"
@ -1036,7 +1037,7 @@ int IsConstExpr (ExprNode* Root)
case EXPR_SYMBOL:
Sym = Root->V.Sym;
if (SymHasUserMark (Sym)) {
if (Verbose) {
if (Verbosity > 0) {
DumpExpr (Root);
}
PError (GetSymPos (Sym), ERR_CIRCULAR_REFERENCE);
@ -1311,7 +1312,7 @@ static ExprNode* RemoveSyms (ExprNode* Expr, int MustClone)
SymEntry* Sym = Expr->V.Sym;
if (SymHasUserMark (Sym)) {
/* Circular definition */
if (Verbose) {
if (Verbosity) {
DumpExpr (Expr);
}
PError (GetSymPos (Sym), ERR_CIRCULAR_REFERENCE);

View File

@ -56,7 +56,6 @@ char LocalStart = '@'; /* This char starts local symbols */
unsigned char IgnoreCase = 0; /* Ignore case on identifiers? */
unsigned char AutoImport = 0; /* Mark unresolveds as import */
unsigned char Verbose = 0; /* Verbose operation flag */
unsigned char SmartMode = 0; /* Smart mode */
unsigned char DbgSyms = 0; /* Add debug symbols */
unsigned char Listing = 0; /* Create listing file */

View File

@ -57,7 +57,6 @@ extern char LocalStart; /* This char starts local symbols */
extern unsigned char IgnoreCase; /* Ignore case on identifiers? */
extern unsigned char AutoImport; /* Mark unresolveds as import */
extern unsigned char Verbose; /* Verbose operation flag */
extern unsigned char SmartMode; /* Smart mode */
extern unsigned char DbgSyms; /* Add debug symbols */
extern unsigned char Listing; /* Create listing file */

View File

@ -41,6 +41,7 @@
/* common */
#include "chartype.h"
#include "cmdline.h"
#include "print.h"
#include "target.h"
#include "tgttrans.h"
#include "version.h"
@ -313,7 +314,7 @@ static void OptTarget (const char* Opt, const char* Arg)
static void OptVerbose (const char* Opt, const char* Arg)
/* Increase verbosity */
{
++Verbose;
++Verbosity;
}
@ -636,7 +637,7 @@ int main (int argc, char* argv [])
}
/* Dump the data */
if (Verbose >= 2) {
if (Verbosity >= 2) {
SymDump (stdout);
SegDump ();
}

View File

@ -37,6 +37,10 @@
#include <stdlib.h>
#include <stdarg.h>
/* common */
#include "print.h"
/* cc65 */
#include "global.h"
#include "input.h"
#include "scanner.h"
@ -71,9 +75,7 @@ static void IntWarning (const char* Filename, unsigned Line, const char* Msg, va
vfprintf (stderr, Msg, ap);
fprintf (stderr, "\n");
if (Verbose) {
fprintf (stderr, "Line: %s\n", line);
}
Print (stderr, 1, "Line: %s\n", line);
++WarningCount;
}
}
@ -109,9 +111,7 @@ static void IntError (const char* Filename, unsigned Line, const char* Msg, va_l
vfprintf (stderr, Msg, ap);
fprintf (stderr, "\n");
if (Verbose) {
fprintf (stderr, "Line: %s\n", line);
}
Print (stderr, 1, "Line: %s\n", line);
++ErrorCount;
if (ErrorCount > 10) {
Fatal ("Too many errors");
@ -154,9 +154,7 @@ void Fatal (const char* Format, ...)
va_end (ap);
fprintf (stderr, "\n");
if (Verbose) {
fprintf (stderr, "Line: %s\n", line);
}
Print (stderr, 1, "Line: %s\n", line);
exit (EXIT_FAILURE);
}
@ -184,7 +182,7 @@ void Internal (char* Format, ...)
void ErrorReport (void)
/* Report errors (called at end of compile) */
{
if (ErrorCount == 0 && Verbose) {
if (ErrorCount == 0 && Verbosity > 0) {
printf ("No errors.\n");
}
}

View File

@ -54,7 +54,6 @@ unsigned char AllowRegVarAddr = 0; /* Allow taking addresses of register vars */
unsigned char RegVarsToCallStack= 0; /* Save reg variables on call stack */
unsigned char StaticLocals = 0; /* Make local variables static */
unsigned char SignedChars = 0; /* Make characters signed by default */
unsigned char Verbose = 0; /* Verbose flag */
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

@ -55,7 +55,6 @@ extern unsigned char AllowRegVarAddr; /* Allow taking addresses of register vars
extern unsigned char RegVarsToCallStack; /* Save reg variables on call stack */
extern unsigned char StaticLocals; /* Make local variables static */
extern unsigned char SignedChars; /* Make characters signed by default */
extern unsigned char Verbose; /* Verbose flag */
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

@ -43,6 +43,7 @@
#include "chartype.h"
#include "cmdline.h"
#include "fname.h"
#include "print.h"
#include "target.h"
#include "tgttrans.h"
#include "version.h"
@ -410,7 +411,7 @@ static void OptTarget (const char* Opt, const char* Arg)
static void OptVerbose (const char* Opt, const char* Arg)
/* Increase verbosity */
{
++Verbose;
++Verbosity;
}

View File

@ -36,12 +36,12 @@
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
//#include <ctype.h>
/* common */
#include "attrib.h"
#include "chartype.h"
#include "check.h"
#include "print.h"
#include "xmalloc.h"
#include "xsprintf.h"
@ -4627,7 +4627,7 @@ void OptDoOpt (void)
for (I = 0; I < sizeof(OptFuncs)/sizeof(OptFuncs[0]); ++I, Flags <<= 1) {
if ((OptDisable & Flags) == 0) {
OptFuncs[I] ();
} else if (Verbose || Debug) {
} else if (Verbosity > 0 || Debug) {
printf ("Optimizer pass %u skipped\n", I);
}
}

View File

@ -8,6 +8,7 @@
/* common */
#include "chartype.h"
#include "print.h"
#include "xmalloc.h"
/* cc65 */
@ -916,8 +917,6 @@ void Preprocess (void)
Done:
xlateline ();
if (Verbose > 1) {
printf ("line: %s\n", line);
}
Print (stdout, 2, "line: %s\n", line);
}

View File

@ -743,7 +743,7 @@ int main (int argc, char* argv [])
/* Our default target is the C64 instead of "none" */
Target = TGT_C64;
/* Check the parameters */
I = 1;
while (I < ArgCount) {

View File

@ -33,7 +33,6 @@
#include <stdio.h>
#include <stdarg.h>
/* common */
@ -57,7 +56,7 @@ unsigned char Verbosity = 0; /* Verbose operation flag */
void Print (unsigned V, const char* Format, ...)
void Print (FILE* F, unsigned V, const char* Format, ...)
/* Output according to Verbosity */
{
va_list ap;
@ -70,7 +69,7 @@ void Print (unsigned V, const char* Format, ...)
/* Output */
va_start (ap, Format);
vprintf (Format, ap);
vfprintf (F, Format, ap);
va_end (ap);
}

View File

@ -38,13 +38,15 @@
#include <stdio.h>
/* common */
#include "attrib.h"
/*****************************************************************************/
/* Data */
/* Data */
/*****************************************************************************/
@ -59,7 +61,8 @@ extern unsigned char Verbosity; /* Verbose operation flag */
void Print (unsigned V, const char* Format, ...) attribute ((format (printf, 2, 3)));
void Print (FILE* F, unsigned V, const char* Format, ...)
attribute ((format (printf, 3, 4)));
/* Output according to Verbosity */

View File

@ -52,7 +52,6 @@ const char OutExt[] = ".dis"; /* Output file extension */
const char CfgExt[] = ".cfg"; /* Config file extension */
/* Flags and other command line stuff */
unsigned char Verbosity = 4; /* Verbosity of the output file */
unsigned char FormFeeds = 0; /* Add form feeds to the output? */
unsigned char PassCount = 2; /* How many passed do we do? */
unsigned long StartAddr = 0xC000; /* Start/load address of the program */

View File

@ -53,7 +53,6 @@ extern const char OutExt[]; /* Output file extension */
extern const char CfgExt[]; /* Config file extension */
/* Flags and other command line stuff */
extern unsigned char Verbosity; /* Verbosity of the output file */
extern unsigned char FormFeeds; /* Add form feeds to the output? */
extern unsigned char PassCount; /* How many passed do we do? */
extern unsigned long StartAddr; /* Start/load address of the program */

View File

@ -43,6 +43,7 @@
#include "abend.h"
#include "cmdline.h"
#include "fname.h"
#include "print.h"
#include "version.h"
/* da65 */

View File

@ -40,6 +40,7 @@
#include <errno.h>
/* common */
#include "print.h"
#include "version.h"
/* da65 */

View File

@ -38,6 +38,7 @@
#include <errno.h>
/* common */
#include "print.h"
#include "xmalloc.h"
/* ld65 */
@ -133,9 +134,7 @@ static void BinWriteMem (BinDesc* D, Memory* M)
SegDesc* S = N->Seg;
/* Keep the user happy */
if (Verbose) {
printf (" Writing `%s'\n", S->Name);
}
Print (stdout, 1, " Writing `%s'\n", S->Name);
/* Writes do only occur in the load area and not for BSS segments */
DoWrite = (S->Flags & SF_BSS) == 0 && /* No BSS segment */
@ -143,7 +142,7 @@ static void BinWriteMem (BinDesc* D, Memory* M)
S->Seg->Dumped == 0; /* Not already written */
/* Output the DoWrite flag for debugging */
if (Verbose > 1) {
if (Verbosity > 1) {
PrintBoolVal ("bss", S->Flags & SF_BSS);
PrintBoolVal ("LoadArea", S->Load == M);
PrintBoolVal ("Dumped", S->Seg->Dumped);
@ -253,16 +252,12 @@ void BinWriteTarget (BinDesc* D, struct File* F)
}
/* Keep the user happy */
if (Verbose) {
printf ("Opened `%s'...\n", F->Name);
}
Print (stdout, 1, "Opened `%s'...\n", F->Name);
/* Dump all memory areas */
M = F->MemList;
while (M) {
if (Verbose) {
printf (" Dumping `%s'\n", M->Name);
}
Print (stdout, 1, " Dumping `%s'\n", M->Name);
BinWriteMem (D, M);
M = M->FNext;
}

View File

@ -41,6 +41,7 @@
/* common */
#include "check.h"
#include "bitops.h"
#include "print.h"
#include "xmalloc.h"
/* ld65 */
@ -1405,9 +1406,7 @@ void CfgWriteTarget (void)
MemListNode* N;
/* Debugging */
if (Verbose > 1) {
printf ("Skipping `%s'...\n", M->Name);
}
Print (stdout, 2, "Skipping `%s'...\n", M->Name);
/* Walk throught the segments */
N = M->SegList;

View File

@ -47,7 +47,6 @@ const char* OutputName = "a.out"; /* Name of output file */
unsigned long StartAddr = 0x200; /* Start address */
unsigned char Verbose = 0; /* Verbose operation flag */
unsigned char VerboseMap = 0; /* Verbose map file */
const char* MapFileName = 0; /* Name of the map file */
const char* LabelFileName = 0; /* Name of the label file */

View File

@ -48,7 +48,6 @@ extern const char* OutputName; /* Name of output file */
extern unsigned long StartAddr; /* Start address */
extern unsigned char Verbose; /* Verbose operation flag */
extern unsigned char VerboseMap; /* Verbose map file */
extern const char* MapFileName; /* Name of the map file */
extern const char* LabelFileName; /* Name of the label file */

View File

@ -42,6 +42,7 @@
#include "cmdline.h"
#include "libdefs.h"
#include "objdefs.h"
#include "print.h"
#include "target.h"
#include "version.h"
#include "xmalloc.h"
@ -351,7 +352,7 @@ int main (int argc, char* argv [])
case 'v':
switch (Arg [2]) {
case 'm': VerboseMap = 1; break;
case '\0': ++Verbose; break;
case '\0': ++Verbosity; break;
default: UnknownOption (Arg);
}
break;
@ -426,7 +427,7 @@ int main (int argc, char* argv [])
}
/* Dump the data for debugging */
if (Verbose > 1) {
if (Verbosity > 1) {
SegDump ();
ConDesDump ();
}

View File

@ -40,6 +40,7 @@
/* common */
#include "check.h"
#include "print.h"
#include "version.h"
#include "xmalloc.h"
@ -575,9 +576,7 @@ static void O65WriteSeg (O65Desc* D, SegDesc** Seg, unsigned Count, int DoWrite)
S = Seg [I];
/* Keep the user happy */
if (Verbose) {
printf (" Writing `%s'\n", S->Name);
}
Print (stdout, 1, " Writing `%s'\n", S->Name);
/* Write this segment */
if (DoWrite) {
@ -1018,9 +1017,7 @@ void O65WriteTarget (O65Desc* D, File* F)
}
/* Keep the user happy */
if (Verbose) {
printf ("Opened `%s'...\n", F->Name);
}
Print (stdout, 1, "Opened `%s'...\n", F->Name);
/* Define some more options: A timestamp and the linker version */
T = time (0);

View File

@ -40,6 +40,7 @@
#include "check.h"
#include "exprdefs.h"
#include "hashstr.h"
#include "print.h"
#include "segdefs.h"
#include "symdefs.h"
#include "xmalloc.h"
@ -229,10 +230,8 @@ Section* ReadSection (FILE* F, ObjData* O)
Type = Read8 (F);
/* Print some data */
if (Verbose > 1) {
printf ("Module `%s': Found segment `%s', size = %lu, align = %u, type = %u\n",
GetObjFileName (O), Name, Size, Align, Type);
}
Print (stdout, 1, "Module `%s': Found segment `%s', size = %lu, align = %u, type = %u\n",
GetObjFileName (O), Name, Size, Align, Type);
/* Get the segment for this section */
S = GetSegment (Name, Type, GetObjFileName (O));