Move the Debug flag into a new module "debugflag" in the common directory.
Remove the const qualifier from the argument of xfree(). git-svn-id: svn://svn.cc65.org/cc65/trunk@1877 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Predefined packages */
|
/* Predefined packages */
|
||||||
static const char MacGeneric [] = /* Generic macros */
|
static char MacGeneric [] = /* Generic macros */
|
||||||
".macro add Arg1, Arg2\n"
|
".macro add Arg1, Arg2\n"
|
||||||
" clc\n"
|
" clc\n"
|
||||||
" .if .paramcount = 2\n"
|
" .if .paramcount = 2\n"
|
||||||
@@ -70,7 +70,7 @@ static const char MacGeneric [] = /* Generic macros */
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static const char MacLongBranch [] = /* Long branch macros */
|
static char MacLongBranch [] = /* Long branch macros */
|
||||||
".macro jeq Target\n"
|
".macro jeq Target\n"
|
||||||
" .if .match(Target, 0)\n"
|
" .if .match(Target, 0)\n"
|
||||||
" bne *+5\n"
|
" bne *+5\n"
|
||||||
@@ -163,7 +163,7 @@ static const char MacLongBranch [] = /* Long branch macros */
|
|||||||
|
|
||||||
|
|
||||||
/* Table with pointers to the different packages */
|
/* Table with pointers to the different packages */
|
||||||
static const char* MacPackages [] = {
|
static char* MacPackages [] = {
|
||||||
MacGeneric,
|
MacGeneric,
|
||||||
MacLongBranch,
|
MacLongBranch,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ struct InputFile_ {
|
|||||||
/* Struct to handle textual input data */
|
/* Struct to handle textual input data */
|
||||||
typedef struct InputData_ InputData;
|
typedef struct InputData_ InputData;
|
||||||
struct InputData_ {
|
struct InputData_ {
|
||||||
const char* Data; /* Pointer to the data */
|
char* Data; /* Pointer to the data */
|
||||||
const char* Pos; /* Pointer to current position */
|
const char* Pos; /* Pointer to current position */
|
||||||
int Malloced; /* Memory was malloced */
|
int Malloced; /* Memory was malloced */
|
||||||
enum Token Tok; /* Last token */
|
enum Token Tok; /* Last token */
|
||||||
@@ -370,7 +370,7 @@ void DoneInputFile (void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void NewInputData (const char* Data, int Malloced)
|
void NewInputData (char* Data, int Malloced)
|
||||||
/* Add a chunk of input data to the input stream */
|
/* Add a chunk of input data to the input stream */
|
||||||
{
|
{
|
||||||
InputData* I;
|
InputData* I;
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ void NewInputFile (const char* Name);
|
|||||||
void DoneInputFile (void);
|
void DoneInputFile (void);
|
||||||
/* Close the current input file */
|
/* Close the current input file */
|
||||||
|
|
||||||
void NewInputData (const char* Data, int Malloced);
|
void NewInputData (char* Data, int Malloced);
|
||||||
/* Add a chunk of input data to the input stream */
|
/* Add a chunk of input data to the input stream */
|
||||||
|
|
||||||
void LocaseSVal (void);
|
void LocaseSVal (void);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
/* common */
|
/* common */
|
||||||
#include "chartype.h"
|
#include "chartype.h"
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
#include "debugflag.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "xsprintf.h"
|
#include "xsprintf.h"
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
/* common */
|
/* common */
|
||||||
#include "chartype.h"
|
#include "chartype.h"
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
#include "debugflag.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "hashstr.h"
|
#include "hashstr.h"
|
||||||
#include "strutil.h"
|
#include "strutil.h"
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
|
#include "debugflag.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "xsprintf.h"
|
#include "xsprintf.h"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
#include "debugflag.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
/* cc65 */
|
/* cc65 */
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ unsigned char StaticLocals = 0; /* Make local variables static */
|
|||||||
unsigned char SignedChars = 0; /* Make characters signed by default */
|
unsigned char SignedChars = 0; /* Make characters signed by default */
|
||||||
unsigned char AddSource = 0; /* Add source lines as comments */
|
unsigned char AddSource = 0; /* Add source lines as comments */
|
||||||
unsigned char DebugInfo = 0; /* Add debug info to the obj */
|
unsigned char DebugInfo = 0; /* Add debug info to the obj */
|
||||||
unsigned char Debug = 0; /* Debug mode */
|
|
||||||
unsigned char CreateDep = 0; /* Create a dependency file */
|
unsigned char CreateDep = 0; /* Create a dependency file */
|
||||||
unsigned char CheckStack = 0; /* Generate stack overflow checks */
|
unsigned char CheckStack = 0; /* Generate stack overflow checks */
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ extern unsigned char StaticLocals; /* Make local variables static */
|
|||||||
extern unsigned char SignedChars; /* Make characters signed by default */
|
extern unsigned char SignedChars; /* Make characters signed by default */
|
||||||
extern unsigned char AddSource; /* Add source lines as comments */
|
extern unsigned char AddSource; /* Add source lines as comments */
|
||||||
extern unsigned char DebugInfo; /* Add debug info to the obj */
|
extern unsigned char DebugInfo; /* Add debug info to the obj */
|
||||||
extern unsigned char Debug; /* Debug mode */
|
|
||||||
extern unsigned char CreateDep; /* Create a dependency file */
|
extern unsigned char CreateDep; /* Create a dependency file */
|
||||||
extern unsigned char CheckStack; /* Generate stack overflow checks */
|
extern unsigned char CheckStack; /* Generate stack overflow checks */
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
#include "abend.h"
|
#include "abend.h"
|
||||||
#include "chartype.h"
|
#include "chartype.h"
|
||||||
#include "cmdline.h"
|
#include "cmdline.h"
|
||||||
|
#include "debugflag.h"
|
||||||
#include "fname.h"
|
#include "fname.h"
|
||||||
#include "print.h"
|
#include "print.h"
|
||||||
#include "segdefs.h"
|
#include "segdefs.h"
|
||||||
@@ -401,10 +402,10 @@ static void OptDataName (const char* Opt attribute ((unused)), const char* Arg)
|
|||||||
|
|
||||||
|
|
||||||
static void OptDebug (const char* Opt attribute ((unused)),
|
static void OptDebug (const char* Opt attribute ((unused)),
|
||||||
const char* Arg attribute ((unused)))
|
const char* Arg attribute ((unused)))
|
||||||
/* Compiler debug mode */
|
/* Compiler debug mode */
|
||||||
{
|
{
|
||||||
Debug = 1;
|
++Debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
#include "debugflag.h"
|
||||||
#include "hashstr.h"
|
#include "hashstr.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
|
|||||||
50
src/common/debugflag.c
Normal file
50
src/common/debugflag.c
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*****************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* debugflag.c */
|
||||||
|
/* */
|
||||||
|
/* Global debug flag */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* (C) 2002 Ullrich von Bassewitz */
|
||||||
|
/* Wacholderweg 14 */
|
||||||
|
/* D-70597 Stuttgart */
|
||||||
|
/* EMail: uz@cc65.org */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
|
/* warranty. In no event will the authors be held liable for any damages */
|
||||||
|
/* arising from the use of this software. */
|
||||||
|
/* */
|
||||||
|
/* Permission is granted to anyone to use this software for any purpose, */
|
||||||
|
/* including commercial applications, and to alter it and redistribute it */
|
||||||
|
/* freely, subject to the following restrictions: */
|
||||||
|
/* */
|
||||||
|
/* 1. The origin of this software must not be misrepresented; you must not */
|
||||||
|
/* claim that you wrote the original software. If you use this software */
|
||||||
|
/* in a product, an acknowledgment in the product documentation would be */
|
||||||
|
/* appreciated but is not required. */
|
||||||
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
||||||
|
/* be misrepresented as being the original software. */
|
||||||
|
/* 3. This notice may not be removed or altered from any source */
|
||||||
|
/* distribution. */
|
||||||
|
/* */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* common */
|
||||||
|
#include "debugflag.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Data */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
unsigned char Debug = 0; /* Debug mode */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
55
src/common/debugflag.h
Normal file
55
src/common/debugflag.h
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*****************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* debugflag.h */
|
||||||
|
/* */
|
||||||
|
/* Global debug flag */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* (C) 2002 Ullrich von Bassewitz */
|
||||||
|
/* Wacholderweg 14 */
|
||||||
|
/* D-70597 Stuttgart */
|
||||||
|
/* EMail: uz@cc65.org */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
|
/* warranty. In no event will the authors be held liable for any damages */
|
||||||
|
/* arising from the use of this software. */
|
||||||
|
/* */
|
||||||
|
/* Permission is granted to anyone to use this software for any purpose, */
|
||||||
|
/* including commercial applications, and to alter it and redistribute it */
|
||||||
|
/* freely, subject to the following restrictions: */
|
||||||
|
/* */
|
||||||
|
/* 1. The origin of this software must not be misrepresented; you must not */
|
||||||
|
/* claim that you wrote the original software. If you use this software */
|
||||||
|
/* in a product, an acknowledgment in the product documentation would be */
|
||||||
|
/* appreciated but is not required. */
|
||||||
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
||||||
|
/* be misrepresented as being the original software. */
|
||||||
|
/* 3. This notice may not be removed or altered from any source */
|
||||||
|
/* distribution. */
|
||||||
|
/* */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef DEBUGFLAG_H
|
||||||
|
#define DEBUGFLAG_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Data */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern unsigned char Debug; /* Debug mode */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* End of debugflag.h */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@ OBJS = abend.o \
|
|||||||
check.o \
|
check.o \
|
||||||
cmdline.o \
|
cmdline.o \
|
||||||
coll.o \
|
coll.o \
|
||||||
|
debugflag.o \
|
||||||
exprdefs.o \
|
exprdefs.o \
|
||||||
filepos.o \
|
filepos.o \
|
||||||
fname.o \
|
fname.o \
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ OBJS = abend.obj \
|
|||||||
check.obj \
|
check.obj \
|
||||||
cmdline.obj \
|
cmdline.obj \
|
||||||
coll.obj \
|
coll.obj \
|
||||||
|
debugflag.obj \
|
||||||
exprdefs.obj \
|
exprdefs.obj \
|
||||||
filepos.obj \
|
filepos.obj \
|
||||||
fname.obj \
|
fname.obj \
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
/* Segment definition */
|
/* Segment definition */
|
||||||
typedef struct SegDef SegDef;
|
typedef struct SegDef SegDef;
|
||||||
struct SegDef {
|
struct SegDef {
|
||||||
const char* Name; /* Segment name */
|
char* Name; /* Segment name */
|
||||||
unsigned Type; /* Segment type, see above */
|
unsigned Type; /* Segment type, see above */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,12 +37,13 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "abend.h"
|
#include "abend.h"
|
||||||
|
#include "debugflag.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* code */
|
/* code */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
@@ -81,10 +82,10 @@ void* xrealloc (void* P, size_t Size)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void xfree (const void* Block)
|
void xfree (void* Block)
|
||||||
/* Free the block, do some debugging */
|
/* Free the block, do some debugging */
|
||||||
{
|
{
|
||||||
free ((void*) Block);
|
free (Block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ void* xmalloc (size_t Size);
|
|||||||
void* xrealloc (void* P, size_t Size);
|
void* xrealloc (void* P, size_t Size);
|
||||||
/* Reallocate a memory block, check for out of memory */
|
/* Reallocate a memory block, check for out of memory */
|
||||||
|
|
||||||
void xfree (const void* Block);
|
void xfree (void* Block);
|
||||||
/* Free the block, do some debugging */
|
/* Free the block, do some debugging */
|
||||||
|
|
||||||
char* xstrdup (const char* S);
|
char* xstrdup (const char* S);
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ void InsertImport (Import* I)
|
|||||||
unsigned HashVal;
|
unsigned HashVal;
|
||||||
|
|
||||||
/* As long as the import is not inserted, V.Name is valid */
|
/* As long as the import is not inserted, V.Name is valid */
|
||||||
const char* Name = I->V.Name;
|
char* Name = I->V.Name;
|
||||||
|
|
||||||
/* Create a hash value for the given name */
|
/* Create a hash value for the given name */
|
||||||
HashVal = HashStr (Name) % HASHTAB_SIZE;
|
HashVal = HashStr (Name) % HASHTAB_SIZE;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ struct Import {
|
|||||||
FilePos Pos; /* File position of reference */
|
FilePos Pos; /* File position of reference */
|
||||||
union {
|
union {
|
||||||
struct Export* Exp; /* Matching export for this import */
|
struct Export* Exp; /* Matching export for this import */
|
||||||
const char* Name; /* Name if not in table */
|
char* Name; /* Name if not in table */
|
||||||
} V;
|
} V;
|
||||||
unsigned char Type; /* Type of import */
|
unsigned char Type; /* Type of import */
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user