Moved segment name handling into a separate module.
New compiler options to set the default segment names from the command line. git-svn-id: svn://svn.cc65.org/cc65/trunk@222 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
28c25a9bdb
commit
9d85d084d0
6 changed files with 326 additions and 51 deletions
|
@ -6,10 +6,10 @@
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998 Ullrich von Bassewitz */
|
/* (C) 1998-2000 Ullrich von Bassewitz */
|
||||||
/* Wacholderweg 14 */
|
/* Wacholderweg 14 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70597 Stuttgart */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@musoftware.de */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
|
@ -36,9 +36,11 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/version.h"
|
/* common */
|
||||||
#include "../common/xmalloc.h"
|
#include "version.h"
|
||||||
|
#include "xmalloc.h"
|
||||||
|
|
||||||
|
/* cc65 */
|
||||||
#include "asmcode.h"
|
#include "asmcode.h"
|
||||||
#include "asmlabel.h"
|
#include "asmlabel.h"
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
@ -47,31 +49,25 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "litpool.h"
|
#include "litpool.h"
|
||||||
#include "optimize.h"
|
#include "optimize.h"
|
||||||
|
#include "segname.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "codegen.h"
|
#include "codegen.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Data */
|
/* Data */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Compiler relative stk ptr */
|
/* Compiler relative stk ptr */
|
||||||
int oursp = 0;
|
int oursp = 0;
|
||||||
|
|
||||||
/* Current segment */
|
/* Current segment */
|
||||||
static enum {
|
segment_t CurSeg = SEG_INV;
|
||||||
SEG_INV = -1, /* Invalid segment */
|
|
||||||
SEG_CODE,
|
|
||||||
SEG_RODATA,
|
|
||||||
SEG_DATA,
|
|
||||||
SEG_BSS
|
|
||||||
} CurSeg = SEG_CODE;
|
|
||||||
|
|
||||||
/* Segment names */
|
/* Segment names */
|
||||||
static char* SegmentNames [4];
|
|
||||||
static char* SegmentHints [4] = {
|
static char* SegmentHints [4] = {
|
||||||
"seg:code", "seg:rodata", "seg:data", "seg:bss"
|
"seg:code", "seg:rodata", "seg:data", "seg:bss"
|
||||||
};
|
};
|
||||||
|
@ -165,7 +161,7 @@ void g_preamble (void)
|
||||||
/* Allow auto import for runtime library routines */
|
/* Allow auto import for runtime library routines */
|
||||||
AddCodeLine (".autoimport\ton");
|
AddCodeLine (".autoimport\ton");
|
||||||
|
|
||||||
/* Switch the assembler into case sensible mode */
|
/* Switch the assembler into case sensitive mode */
|
||||||
AddCodeLine (".case\t\ton");
|
AddCodeLine (".case\t\ton");
|
||||||
|
|
||||||
/* Tell the assembler if we want to generate debug info */
|
/* Tell the assembler if we want to generate debug info */
|
||||||
|
@ -185,12 +181,6 @@ void g_preamble (void)
|
||||||
AddCodeLine (".endmacro");
|
AddCodeLine (".endmacro");
|
||||||
AddEmptyLine ();
|
AddEmptyLine ();
|
||||||
|
|
||||||
/* Define the default names for the segments */
|
|
||||||
SegmentNames [SEG_CODE] = xstrdup ("CODE");
|
|
||||||
SegmentNames [SEG_RODATA] = xstrdup ("RODATA");
|
|
||||||
SegmentNames [SEG_DATA] = xstrdup ("DATA");
|
|
||||||
SegmentNames [SEG_BSS] = xstrdup ("BSS");
|
|
||||||
|
|
||||||
/* Tell the optimizer that this is the end of the preamble */
|
/* Tell the optimizer that this is the end of the preamble */
|
||||||
AddCodeHint ("end_of_preamble");
|
AddCodeHint ("end_of_preamble");
|
||||||
}
|
}
|
||||||
|
@ -256,12 +246,11 @@ void g_usebss (void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void SegName (int Seg, const char* Name)
|
static void SegName (segment_t Seg, const char* Name)
|
||||||
/* Set the name of a segment */
|
/* Set the name of a segment */
|
||||||
{
|
{
|
||||||
/* Free the old name and set a new one */
|
/* Free the old name and set a new one */
|
||||||
xfree (SegmentNames [Seg]);
|
NewSegName (Seg, Name);
|
||||||
SegmentNames [Seg] = xstrdup (Name);
|
|
||||||
|
|
||||||
/* If the new segment is the current segment, emit a segment directive
|
/* If the new segment is the current segment, emit a segment directive
|
||||||
* with the new name.
|
* with the new name.
|
||||||
|
|
139
src/cc65/main.c
139
src/cc65/main.c
|
@ -39,11 +39,14 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "../common/cmdline.h"
|
/* common */
|
||||||
#include "../common/fname.h"
|
#include "abend.h"
|
||||||
#include "../common/version.h"
|
#include "cmdline.h"
|
||||||
#include "../common/xmalloc.h"
|
#include "fname.h"
|
||||||
|
#include "version.h"
|
||||||
|
#include "xmalloc.h"
|
||||||
|
|
||||||
|
/* cc65 */
|
||||||
#include "asmcode.h"
|
#include "asmcode.h"
|
||||||
#include "compile.h"
|
#include "compile.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
@ -54,6 +57,7 @@
|
||||||
#include "macrotab.h"
|
#include "macrotab.h"
|
||||||
#include "optimize.h"
|
#include "optimize.h"
|
||||||
#include "scanner.h"
|
#include "scanner.h"
|
||||||
|
#include "segname.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,11 +116,15 @@ static void Usage (void)
|
||||||
"\n"
|
"\n"
|
||||||
"Long options:\n"
|
"Long options:\n"
|
||||||
" --ansi\t\tStrict ANSI mode\n"
|
" --ansi\t\tStrict ANSI mode\n"
|
||||||
|
" --bss-name seg\tSet the name of the BSS segment\n"
|
||||||
|
" --code-name seg\tSet the name of the CODE segment\n"
|
||||||
" --cpu type\t\tSet cpu type\n"
|
" --cpu type\t\tSet cpu type\n"
|
||||||
|
" --data-name seg\tSet the name of the DATA segment\n"
|
||||||
" --debug\t\tDebug mode\n"
|
" --debug\t\tDebug mode\n"
|
||||||
" --debug-info\t\tAdd debug info to object file\n"
|
" --debug-info\t\tAdd debug info to object file\n"
|
||||||
" --help\t\tHelp (this text)\n"
|
" --help\t\tHelp (this text)\n"
|
||||||
" --include-dir dir\tSet an include directory search path\n"
|
" --include-dir dir\tSet an include directory search path\n"
|
||||||
|
" --rodata-name seg\tSet the name of the RODATA segment\n"
|
||||||
" --signed-chars\tDefault characters are signed\n"
|
" --signed-chars\tDefault characters are signed\n"
|
||||||
" --static-locals\tMake local variables static\n"
|
" --static-locals\tMake local variables static\n"
|
||||||
" --target sys\t\tSet the target system\n"
|
" --target sys\t\tSet the target system\n"
|
||||||
|
@ -194,25 +202,24 @@ static void SetSys (const char* Sys)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TGT_PET:
|
case TGT_PET:
|
||||||
cbmsys ("__PET__");
|
cbmsys ("__PET__");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TGT_NES:
|
case TGT_NES:
|
||||||
AddNumericMacro ("__NES__", 1);
|
AddNumericMacro ("__NES__", 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TGT_APPLE2:
|
case TGT_APPLE2:
|
||||||
AddNumericMacro ("__APPLE2__", 1);
|
AddNumericMacro ("__APPLE2__", 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TGT_GEOS:
|
case TGT_GEOS:
|
||||||
/* Do not handle as a CBM system */
|
/* Do not handle as a CBM system */
|
||||||
AddNumericMacro ("__GEOS__", 1);
|
AddNumericMacro ("__GEOS__", 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fputs ("Unknown system type\n", stderr);
|
AbEnd ("Unknown target system type");
|
||||||
exit (EXIT_FAILURE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +246,7 @@ static void DefineSym (const char* Def)
|
||||||
InvDef (Def);
|
InvDef (Def);
|
||||||
}
|
}
|
||||||
/* No value given. Define the macro with the value 1 */
|
/* No value given. Define the macro with the value 1 */
|
||||||
AddNumericMacro (Def, 1);
|
AddNumericMacro (Def, 1);
|
||||||
} else {
|
} else {
|
||||||
/* We have a value, P points to the '=' character. Since the argument
|
/* We have a value, P points to the '=' character. Since the argument
|
||||||
* is const, create a copy and replace the '=' in the copy by a zero
|
* is const, create a copy and replace the '=' in the copy by a zero
|
||||||
|
@ -262,6 +269,17 @@ static void DefineSym (const char* Def)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void CheckSegName (const char* Seg)
|
||||||
|
/* Abort if the given name is not a valid segment name */
|
||||||
|
{
|
||||||
|
/* Print an error and abort if the name is not ok */
|
||||||
|
if (!ValidSegName (Seg)) {
|
||||||
|
AbEnd ("Segment name `%s' is invalid", Seg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void OptAddSource (const char* Opt, const char* Arg)
|
static void OptAddSource (const char* Opt, const char* Arg)
|
||||||
/* Add source lines as comments in generated assembler file */
|
/* Add source lines as comments in generated assembler file */
|
||||||
{
|
{
|
||||||
|
@ -278,6 +296,40 @@ static void OptAnsi (const char* Opt, const char* Arg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void OptBssName (const char* Opt, const char* Arg)
|
||||||
|
/* Handle the --bss-name option */
|
||||||
|
{
|
||||||
|
/* Must have a segment name */
|
||||||
|
if (Arg == 0) {
|
||||||
|
NeedArg (Opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for a valid name */
|
||||||
|
CheckSegName (Arg);
|
||||||
|
|
||||||
|
/* Set the name */
|
||||||
|
NewSegName (SEG_BSS, Arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void OptCodeName (const char* Opt, const char* Arg)
|
||||||
|
/* Handle the --code-name option */
|
||||||
|
{
|
||||||
|
/* Must have a segment name */
|
||||||
|
if (Arg == 0) {
|
||||||
|
NeedArg (Opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for a valid name */
|
||||||
|
CheckSegName (Arg);
|
||||||
|
|
||||||
|
/* Set the name */
|
||||||
|
NewSegName (SEG_CODE, Arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void OptCPU (const char* Opt, const char* Arg)
|
static void OptCPU (const char* Opt, const char* Arg)
|
||||||
/* Handle the --cpu option */
|
/* Handle the --cpu option */
|
||||||
{
|
{
|
||||||
|
@ -289,13 +341,29 @@ static void OptCPU (const char* Opt, const char* Arg)
|
||||||
} else if (strcmp (Arg, "65C02") == 0) {
|
} else if (strcmp (Arg, "65C02") == 0) {
|
||||||
CPU = CPU_65C02;
|
CPU = CPU_65C02;
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr, "Invalid CPU: `%s'\n", Arg);
|
AbEnd ("Invalid CPU: `%s'", Arg);
|
||||||
exit (EXIT_FAILURE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void OptDataName (const char* Opt, const char* Arg)
|
||||||
|
/* Handle the --code-name option */
|
||||||
|
{
|
||||||
|
/* Must have a segment name */
|
||||||
|
if (Arg == 0) {
|
||||||
|
NeedArg (Opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for a valid name */
|
||||||
|
CheckSegName (Arg);
|
||||||
|
|
||||||
|
/* Set the name */
|
||||||
|
NewSegName (SEG_DATA, Arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void OptDebug (const char* Opt, const char* Arg)
|
static void OptDebug (const char* Opt, const char* Arg)
|
||||||
/* Compiler debug mode */
|
/* Compiler debug mode */
|
||||||
{
|
{
|
||||||
|
@ -332,6 +400,23 @@ static void OptIncludeDir (const char* Opt, const char* Arg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void OptRodataName (const char* Opt, const char* Arg)
|
||||||
|
/* Handle the --rodata-name option */
|
||||||
|
{
|
||||||
|
/* Must have a segment name */
|
||||||
|
if (Arg == 0) {
|
||||||
|
NeedArg (Opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for a valid name */
|
||||||
|
CheckSegName (Arg);
|
||||||
|
|
||||||
|
/* Set the name */
|
||||||
|
NewSegName (SEG_RODATA, Arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void OptSignedChars (const char* Opt, const char* Arg)
|
static void OptSignedChars (const char* Opt, const char* Arg)
|
||||||
/* Make default characters signed */
|
/* Make default characters signed */
|
||||||
{
|
{
|
||||||
|
@ -383,11 +468,15 @@ int main (int argc, char* argv[])
|
||||||
static const LongOpt OptTab[] = {
|
static const LongOpt OptTab[] = {
|
||||||
{ "--add-source", 0, OptAddSource },
|
{ "--add-source", 0, OptAddSource },
|
||||||
{ "--ansi", 0, OptAnsi },
|
{ "--ansi", 0, OptAnsi },
|
||||||
|
{ "--bss-name", 1, OptBssName },
|
||||||
|
{ "--code-name", 1, OptCodeName },
|
||||||
{ "--cpu", 1, OptCPU },
|
{ "--cpu", 1, OptCPU },
|
||||||
|
{ "--data-name", 1, OptDataName },
|
||||||
{ "--debug", 0, OptDebug },
|
{ "--debug", 0, OptDebug },
|
||||||
{ "--debug-info", 0, OptDebugInfo },
|
{ "--debug-info", 0, OptDebugInfo },
|
||||||
{ "--help", 0, OptHelp },
|
{ "--help", 0, OptHelp },
|
||||||
{ "--include-dir", 1, OptIncludeDir },
|
{ "--include-dir", 1, OptIncludeDir },
|
||||||
|
{ "--rodata-name", 1, OptRodataName },
|
||||||
{ "--signed-chars", 0, OptSignedChars },
|
{ "--signed-chars", 0, OptSignedChars },
|
||||||
{ "--static-locals", 0, OptStaticLocals },
|
{ "--static-locals", 0, OptStaticLocals },
|
||||||
{ "--target", 1, OptTarget },
|
{ "--target", 1, OptTarget },
|
||||||
|
@ -404,6 +493,9 @@ int main (int argc, char* argv[])
|
||||||
/* Initialize the cmdline module */
|
/* Initialize the cmdline module */
|
||||||
InitCmdLine (argc, argv, "cc65");
|
InitCmdLine (argc, argv, "cc65");
|
||||||
|
|
||||||
|
/* Initialize the default segment names */
|
||||||
|
InitSegNames ();
|
||||||
|
|
||||||
/* Parse the command line */
|
/* Parse the command line */
|
||||||
I = 1;
|
I = 1;
|
||||||
while (I < argc) {
|
while (I < argc) {
|
||||||
|
@ -528,8 +620,7 @@ int main (int argc, char* argv[])
|
||||||
|
|
||||||
/* Did we have a file spec on the command line? */
|
/* Did we have a file spec on the command line? */
|
||||||
if (InputFile == 0) {
|
if (InputFile == 0) {
|
||||||
fprintf (stderr, "%s: No input files\n", argv [0]);
|
AbEnd ("No input files");
|
||||||
exit (EXIT_FAILURE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the input file */
|
/* Open the input file */
|
||||||
|
|
|
@ -38,6 +38,7 @@ OBJS = anonname.o \
|
||||||
preproc.o \
|
preproc.o \
|
||||||
pragma.o \
|
pragma.o \
|
||||||
scanner.o \
|
scanner.o \
|
||||||
|
segname.o \
|
||||||
stdfunc.o \
|
stdfunc.o \
|
||||||
stmt.o \
|
stmt.o \
|
||||||
symentry.o \
|
symentry.o \
|
||||||
|
|
|
@ -97,6 +97,7 @@ OBJS = anonname.obj \
|
||||||
preproc.obj \
|
preproc.obj \
|
||||||
stmt.obj \
|
stmt.obj \
|
||||||
scanner.obj \
|
scanner.obj \
|
||||||
|
segname.obj \
|
||||||
stdfunc.obj \
|
stdfunc.obj \
|
||||||
symentry.obj \
|
symentry.obj \
|
||||||
symtab.obj \
|
symtab.obj \
|
||||||
|
@ -153,6 +154,7 @@ FILE pragma.obj
|
||||||
FILE preproc.obj
|
FILE preproc.obj
|
||||||
FILE stmt.obj
|
FILE stmt.obj
|
||||||
FILE scanner.obj
|
FILE scanner.obj
|
||||||
|
FILE segname.obj
|
||||||
FILE stdfunc.obj
|
FILE stdfunc.obj
|
||||||
FILE symentry.obj
|
FILE symentry.obj
|
||||||
FILE symtab.obj
|
FILE symtab.obj
|
||||||
|
|
108
src/cc65/segname.c
Normal file
108
src/cc65/segname.c
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* segname.c */
|
||||||
|
/* */
|
||||||
|
/* Segment name management */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* (C) 2000 Ullrich von Bassewitz */
|
||||||
|
/* Wacholderweg 14 */
|
||||||
|
/* D-70597 Stuttgart */
|
||||||
|
/* EMail: uz@musoftware.de */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* 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. */
|
||||||
|
/* */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
/* common */
|
||||||
|
#include "xmalloc.h"
|
||||||
|
|
||||||
|
/* cc65 */
|
||||||
|
#include "check.h"
|
||||||
|
#include "segname.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Data */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Actual names for the segments */
|
||||||
|
char* SegmentNames[SEG_COUNT];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Code */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void InitSegNames (void)
|
||||||
|
/* Initialize the segment names */
|
||||||
|
{
|
||||||
|
SegmentNames [SEG_BSS] = xstrdup ("BSS");
|
||||||
|
SegmentNames [SEG_CODE] = xstrdup ("CODE");
|
||||||
|
SegmentNames [SEG_DATA] = xstrdup ("DATA");
|
||||||
|
SegmentNames [SEG_RODATA] = xstrdup ("RODATA");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void NewSegName (segment_t Seg, const char* Name)
|
||||||
|
/* Set a new name for a segment */
|
||||||
|
{
|
||||||
|
/* Check the parameter */
|
||||||
|
CHECK (Seg != SEG_INV);
|
||||||
|
|
||||||
|
/* Free the old name and set a new one */
|
||||||
|
xfree (SegmentNames [Seg]);
|
||||||
|
SegmentNames [Seg] = xstrdup (Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int ValidSegName (const char* Name)
|
||||||
|
/* Return true if the given segment name is valid, return false otherwise */
|
||||||
|
{
|
||||||
|
/* Must start with '_' or a letter */
|
||||||
|
if (*Name != '_' && !isalpha(*Name)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Can have letters, digits or the underline */
|
||||||
|
while (*++Name) {
|
||||||
|
if (*Name != '_' && !isalnum(*Name)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Name is ok */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
84
src/cc65/segname.h
Normal file
84
src/cc65/segname.h
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* segname.h */
|
||||||
|
/* */
|
||||||
|
/* Segment name management */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* (C) 2000 Ullrich von Bassewitz */
|
||||||
|
/* Wacholderweg 14 */
|
||||||
|
/* D-70597 Stuttgart */
|
||||||
|
/* EMail: uz@musoftware.de */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* 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 SEGNAME_H
|
||||||
|
#define SEGNAME_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Data */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Current segment */
|
||||||
|
typedef enum segment_t {
|
||||||
|
SEG_INV = -1, /* Invalid segment */
|
||||||
|
SEG_CODE,
|
||||||
|
SEG_RODATA,
|
||||||
|
SEG_DATA,
|
||||||
|
SEG_BSS,
|
||||||
|
SEG_COUNT
|
||||||
|
} segment_t;
|
||||||
|
|
||||||
|
/* Actual names for the segments */
|
||||||
|
extern char* SegmentNames[SEG_COUNT];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Code */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void InitSegNames (void);
|
||||||
|
/* Initialize the segment names */
|
||||||
|
|
||||||
|
void NewSegName (segment_t Seg, const char* Name);
|
||||||
|
/* Set a new name for a segment */
|
||||||
|
|
||||||
|
int ValidSegName (const char* Name);
|
||||||
|
/* Return true if the given segment name is valid, return false otherwise */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* End of segname.h */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue