From: uz Date: Wed, 4 Jan 2012 22:02:02 +0000 (+0000) Subject: Moved the segdefs module to ca65, since it was used only there and renamed it X-Git-Tag: V2.13.3~84 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=02cbc7da254e5218394c9ff55e75bb80df633823;p=cc65 Moved the segdefs module to ca65, since it was used only there and renamed it to segdef, since there might be a new segdefs module in common soon. git-svn-id: svn://svn.cc65.org/cc65/trunk@5381 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/ca65/make/gcc.mak b/src/ca65/make/gcc.mak index 46d432bbd..9d8e782a9 100644 --- a/src/ca65/make/gcc.mak +++ b/src/ca65/make/gcc.mak @@ -55,6 +55,7 @@ OBJS = anonname.o \ pseudo.o \ repeat.o \ scanner.o \ + segdef.o \ segment.o \ sizeof.o \ span.o \ diff --git a/src/ca65/make/watcom.mak b/src/ca65/make/watcom.mak index 8760b0691..e7802d8cb 100644 --- a/src/ca65/make/watcom.mak +++ b/src/ca65/make/watcom.mak @@ -88,6 +88,7 @@ OBJS = anonname.obj \ pseudo.obj \ repeat.obj \ scanner.obj \ + segdef.obj \ segment.obj \ sizeof.obj \ span.obj \ diff --git a/src/ca65/segdef.c b/src/ca65/segdef.c new file mode 100644 index 000000000..a08a18dc1 --- /dev/null +++ b/src/ca65/segdef.c @@ -0,0 +1,83 @@ +/*****************************************************************************/ +/* */ +/* segdef.c */ +/* */ +/* Segment definitions for the ca65 assembler */ +/* */ +/* */ +/* */ +/* (C) 1998-2012, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* 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 "xmalloc.h" + +/* ca65 */ +#include "segdef.h" + + + +/*****************************************************************************/ +/* Code */ +/*****************************************************************************/ + + + +SegDef* NewSegDef (const char* Name, unsigned char AddrSize) +/* Create a new segment definition and return it */ +{ + /* Allocate memory */ + SegDef* D = xmalloc (sizeof (SegDef)); + + /* Initialize it */ + D->Name = xstrdup (Name); + D->AddrSize = AddrSize; + + /* Return the result */ + return D; +} + + + +void FreeSegDef (SegDef* D) +/* Free a segment definition */ +{ + xfree (D->Name); + xfree (D); +} + + + +SegDef* DupSegDef (const SegDef* Def) +/* Duplicate a segment definition and return it */ +{ + return NewSegDef (Def->Name, Def->AddrSize); +} + + + + diff --git a/src/ca65/segdef.h b/src/ca65/segdef.h new file mode 100644 index 000000000..bea326ecd --- /dev/null +++ b/src/ca65/segdef.h @@ -0,0 +1,86 @@ +/*****************************************************************************/ +/* */ +/* segdef.h */ +/* */ +/* Segment definitions for the ca65 assembler */ +/* */ +/* */ +/* */ +/* (C) 1998-2012, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* 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 SEGDEF_H +#define SEGDEF_H + + + +/* common */ +#include "addrsize.h" + + + +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +/* Segment definition */ +typedef struct SegDef SegDef; +struct SegDef { + char* Name; /* Segment name */ + unsigned char AddrSize; /* Default address size */ +}; + +/* Initializer for static SegDefs */ +#define STATIC_SEGDEF_INITIALIZER(name, addrsize) { name, addrsize } + + + +/*****************************************************************************/ +/* Code */ +/*****************************************************************************/ + + + +SegDef* NewSegDef (const char* Name, unsigned char AddrSize); +/* Create a new segment definition and return it */ + +void FreeSegDef (SegDef* D); +/* Free a segment definition */ + +SegDef* DupSegDef (const SegDef* D); +/* Duplicate a segment definition and return it */ + + + +/* End of segdefs.h */ + +#endif + + + diff --git a/src/ca65/segment.h b/src/ca65/segment.h index 0575bc774..faa3c5289 100644 --- a/src/ca65/segment.h +++ b/src/ca65/segment.h @@ -42,10 +42,10 @@ #include "coll.h" #include "fragdefs.h" #include "inline.h" -#include "segdefs.h" /* ca65 */ #include "fragment.h" +#include "segdef.h" diff --git a/src/common/make/gcc.mak b/src/common/make/gcc.mak index 049f44eed..54484a7a7 100644 --- a/src/common/make/gcc.mak +++ b/src/common/make/gcc.mak @@ -37,7 +37,6 @@ OBJS = abend.o \ mmodel.o \ print.o \ searchpath.o \ - segdefs.o \ segnames.o \ shift.o \ strbuf.o \ diff --git a/src/common/make/watcom.mak b/src/common/make/watcom.mak index 99a9924fc..e9d7e01c1 100644 --- a/src/common/make/watcom.mak +++ b/src/common/make/watcom.mak @@ -79,7 +79,6 @@ OBJS = abend.obj \ mmodel.obj \ print.obj \ searchpath.obj \ - segdefs.obj \ segnames.obj \ shift.obj \ strbuf.obj \ diff --git a/src/common/segdefs.c b/src/common/segdefs.c deleted file mode 100644 index 5e0c5e9e1..000000000 --- a/src/common/segdefs.c +++ /dev/null @@ -1,81 +0,0 @@ -/*****************************************************************************/ -/* */ -/* segdefs.c */ -/* */ -/* Segment definitions for the bin65 binary utils */ -/* */ -/* */ -/* */ -/* (C) 2002-2003 Ullrich von Bassewitz */ -/* Römerstraße 52 */ -/* D-70794 Filderstadt */ -/* 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 "xmalloc.h" -#include "segdefs.h" - - - -/*****************************************************************************/ -/* Code */ -/*****************************************************************************/ - - - -SegDef* NewSegDef (const char* Name, unsigned char AddrSize) -/* Create a new segment definition and return it */ -{ - /* Allocate memory */ - SegDef* D = xmalloc (sizeof (SegDef)); - - /* Initialize it */ - D->Name = xstrdup (Name); - D->AddrSize = AddrSize; - - /* Return the result */ - return D; -} - - - -void FreeSegDef (SegDef* D) -/* Free a segment definition */ -{ - xfree (D->Name); - xfree (D); -} - - - -SegDef* DupSegDef (const SegDef* Def) -/* Duplicate a segment definition and return it */ -{ - return NewSegDef (Def->Name, Def->AddrSize); -} - - - - diff --git a/src/common/segdefs.h b/src/common/segdefs.h deleted file mode 100644 index 5fbb8cb13..000000000 --- a/src/common/segdefs.h +++ /dev/null @@ -1,86 +0,0 @@ -/*****************************************************************************/ -/* */ -/* segdefs.h */ -/* */ -/* Segment definitions for the bin65 binary utils */ -/* */ -/* */ -/* */ -/* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstraße 52 */ -/* D-70794 Filderstadt */ -/* 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 SEGDEFS_H -#define SEGDEFS_H - - - -/* common */ -#include "addrsize.h" - - - -/*****************************************************************************/ -/* Data */ -/*****************************************************************************/ - - - -/* Segment definition */ -typedef struct SegDef SegDef; -struct SegDef { - char* Name; /* Segment name */ - unsigned char AddrSize; /* Default address size */ -}; - -/* Initializer for static SegDefs */ -#define STATIC_SEGDEF_INITIALIZER(name, addrsize) { name, addrsize } - - - -/*****************************************************************************/ -/* Code */ -/*****************************************************************************/ - - - -SegDef* NewSegDef (const char* Name, unsigned char AddrSize); -/* Create a new segment definition and return it */ - -void FreeSegDef (SegDef* D); -/* Free a segment definition */ - -SegDef* DupSegDef (const SegDef* D); -/* Duplicate a segment definition and return it */ - - - -/* End of segdefs.h */ - -#endif - - - diff --git a/src/ld65/condes.c b/src/ld65/condes.c index 1e0406a64..836c9a58a 100644 --- a/src/ld65/condes.c +++ b/src/ld65/condes.c @@ -40,7 +40,6 @@ #include "check.h" #include "coll.h" #include "fragdefs.h" -#include "segdefs.h" #include "xmalloc.h" /* ld65 */ diff --git a/src/ld65/segments.c b/src/ld65/segments.c index b67d0e221..a4e54317c 100644 --- a/src/ld65/segments.c +++ b/src/ld65/segments.c @@ -37,6 +37,7 @@ #include /* common */ +#include "addrsize.h" #include "alignment.h" #include "check.h" #include "coll.h" @@ -44,7 +45,6 @@ #include "fragdefs.h" #include "hashfunc.h" #include "print.h" -#include "segdefs.h" #include "symdefs.h" #include "xmalloc.h" @@ -105,7 +105,7 @@ static Segment* NewSegment (unsigned Name, unsigned char AddrSize) S->ReadOnly = 0; S->Dumped = 0; S->BankRef = 0; - + /* Insert the segment into the segment list and assign the segment id */ S->Id = CollCount (&SegmentList); CollAppend (&SegmentList, S); diff --git a/src/od65/dump.c b/src/od65/dump.c index 92ead85c1..e0cf5c010 100644 --- a/src/od65/dump.c +++ b/src/od65/dump.c @@ -46,7 +46,6 @@ #include "objdefs.h" #include "optdefs.h" #include "scopedefs.h" -#include "segdefs.h" #include "symdefs.h" #include "xmalloc.h"