Removed (pretty inconsistently used) tab chars from source code base.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* abend.c */
|
||||
/* abend.c */
|
||||
/* */
|
||||
/* Abnormal program end */
|
||||
/* Abnormal program end */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* abend.h */
|
||||
/* abend.h */
|
||||
/* */
|
||||
/* Abnormal program end */
|
||||
/* Abnormal program end */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* attrib.h */
|
||||
/* */
|
||||
/* Handle gcc attributes */
|
||||
/* Handle gcc attributes */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -39,13 +39,13 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define attribute(a) __attribute__(a)
|
||||
# define attribute(a) __attribute__(a)
|
||||
#else
|
||||
# define attribute(a)
|
||||
#endif
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* bitops.c */
|
||||
/* */
|
||||
/* Single bit operations */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
/* */
|
||||
/* bitops.c */
|
||||
/* */
|
||||
/* Single bit operations */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 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. */
|
||||
/* */
|
||||
/* 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: */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* 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. */
|
||||
/* */
|
||||
/* be misrepresented as being the original software. */
|
||||
/* 3. This notice may not be removed or altered from any source */
|
||||
/* distribution. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -53,11 +53,11 @@ unsigned BitFind (unsigned long Val)
|
||||
Mask = 1;
|
||||
Bit = 0;
|
||||
while (1) {
|
||||
if (Val & Mask) {
|
||||
return Bit;
|
||||
}
|
||||
Mask <<= 1;
|
||||
++Bit;
|
||||
if (Val & Mask) {
|
||||
return Bit;
|
||||
}
|
||||
Mask <<= 1;
|
||||
++Bit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,12 +115,12 @@ void BitMerge (void* Target, const void* Source, unsigned Size)
|
||||
/* Merge the bits of two char arrays (that is, do an or for the full array) */
|
||||
{
|
||||
/* Make char arrays */
|
||||
unsigned char* T = Target;
|
||||
unsigned char* T = Target;
|
||||
const unsigned char* S = Source;
|
||||
|
||||
/* Merge the arrays */
|
||||
while (Size--) {
|
||||
*T++ |= *S++;
|
||||
*T++ |= *S++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* bitops.h */
|
||||
/* bitops.h */
|
||||
/* */
|
||||
/* Single bit operations */
|
||||
/* Single bit operations */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* cddefs.h */
|
||||
/* cddefs.h */
|
||||
/* */
|
||||
/* Definitions for module constructor/destructors */
|
||||
/* Definitions for module constructor/destructors */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -39,37 +39,37 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* ConDes types. Count is only 7 because we want to encode 0..count in 3 bits */
|
||||
#define CD_TYPE_COUNT 7 /* Number of table types */
|
||||
#define CD_TYPE_MIN 0 /* Minimum numeric type value */
|
||||
#define CD_TYPE_MAX 6 /* Maximum numeric type value */
|
||||
#define CD_TYPE_COUNT 7 /* Number of table types */
|
||||
#define CD_TYPE_MIN 0 /* Minimum numeric type value */
|
||||
#define CD_TYPE_MAX 6 /* Maximum numeric type value */
|
||||
|
||||
/* ConDes priorities, zero is no valid priority and used to mark an empty
|
||||
* (missing) decl for this type throughout the code.
|
||||
*/
|
||||
#define CD_PRIO_NONE 0 /* No priority (no decl) */
|
||||
#define CD_PRIO_MIN 1 /* Lowest priority */
|
||||
#define CD_PRIO_DEF 7 /* Default priority */
|
||||
#define CD_PRIO_MAX 32 /* Highest priority */
|
||||
#define CD_PRIO_NONE 0 /* No priority (no decl) */
|
||||
#define CD_PRIO_MIN 1 /* Lowest priority */
|
||||
#define CD_PRIO_DEF 7 /* Default priority */
|
||||
#define CD_PRIO_MAX 32 /* Highest priority */
|
||||
|
||||
/* Predefined types */
|
||||
#define CD_TYPE_CON 0 /* Constructor */
|
||||
#define CD_TYPE_DES 1 /* Destructor */
|
||||
#define CD_TYPE_CON 0 /* Constructor */
|
||||
#define CD_TYPE_DES 1 /* Destructor */
|
||||
#define CD_TYPE_INT 2 /* Interruptor */
|
||||
|
||||
/* When part of an export in an object file, type and priority are encoded in
|
||||
* one byte. In this case, the following macros access the fields:
|
||||
*/
|
||||
#define CD_GET_TYPE(v) (((v) >> 5) & 0x07)
|
||||
#define CD_GET_PRIO(v) (((v) & 0x1F) + 1)
|
||||
#define CD_GET_TYPE(v) (((v) >> 5) & 0x07)
|
||||
#define CD_GET_PRIO(v) (((v) & 0x1F) + 1)
|
||||
|
||||
/* Macro to build the byte value: */
|
||||
#define CD_BUILD(type,prio) ((((type) & 0x07) << 5) | (((prio) - 1) & 0x1F))
|
||||
#define CD_BUILD(type,prio) ((((type) & 0x07) << 5) | (((prio) - 1) & 0x1F))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* chartype.c */
|
||||
/* chartype.c */
|
||||
/* */
|
||||
/* Character classification functions */
|
||||
/* Character classification functions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* chartype.h */
|
||||
/* chartype.h */
|
||||
/* */
|
||||
/* Character classification functions */
|
||||
/* Character classification functions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ INLINE int IsControl (char C)
|
||||
return iscntrl ((unsigned char) C);
|
||||
}
|
||||
#else
|
||||
# define IsControl(C) iscntrl (C)
|
||||
# define IsControl(C) iscntrl (C)
|
||||
#endif
|
||||
|
||||
int IsSpace (char C);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* check.c */
|
||||
/* check.c */
|
||||
/* */
|
||||
/* Assert like macros */
|
||||
/* Assert like macros */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -41,38 +41,38 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Predefined messages */
|
||||
const char* MsgInternalError = "Internal error: ";
|
||||
const char* MsgPrecondition = "Precondition violated: ";
|
||||
const char* MsgCheckFailed = "Check failed: ";
|
||||
const char* MsgProgramAborted = "Program aborted: ";
|
||||
const char* MsgInternalError = "Internal error: ";
|
||||
const char* MsgPrecondition = "Precondition violated: ";
|
||||
const char* MsgCheckFailed = "Check failed: ";
|
||||
const char* MsgProgramAborted = "Program aborted: ";
|
||||
|
||||
|
||||
|
||||
static void DefaultCheckFailed (const char* msg, const char* cond,
|
||||
const char* file, unsigned line)
|
||||
attribute ((noreturn));
|
||||
const char* file, unsigned line)
|
||||
attribute ((noreturn));
|
||||
|
||||
void (*CheckFailed) (const char* Msg, const char* Cond,
|
||||
const char* File, unsigned Line) attribute ((noreturn))
|
||||
= DefaultCheckFailed;
|
||||
const char* File, unsigned Line) attribute ((noreturn))
|
||||
= DefaultCheckFailed;
|
||||
/* Function pointer that is called from check if the condition code is true. */
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
static void DefaultCheckFailed (const char* Msg, const char* Cond,
|
||||
const char* File, unsigned Line)
|
||||
const char* File, unsigned Line)
|
||||
{
|
||||
/* Output a diagnostic and abort */
|
||||
AbEnd ("%s%s, file `%s', line %u", Msg, Cond, File, Line);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* check.h */
|
||||
/* check.h */
|
||||
/* */
|
||||
/* Assert like macros */
|
||||
/* Assert like macros */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -48,16 +48,16 @@
|
||||
|
||||
|
||||
|
||||
extern const char* MsgInternalError; /* "Internal error: " */
|
||||
extern const char* MsgPrecondition; /* "Precondition violated: " */
|
||||
extern const char* MsgCheckFailed; /* "Check failed: " */
|
||||
extern const char* MsgProgramAborted; /* "Program aborted: " */
|
||||
extern const char* MsgInternalError; /* "Internal error: " */
|
||||
extern const char* MsgPrecondition; /* "Precondition violated: " */
|
||||
extern const char* MsgCheckFailed; /* "Check failed: " */
|
||||
extern const char* MsgProgramAborted; /* "Program aborted: " */
|
||||
|
||||
|
||||
|
||||
extern void (*CheckFailed) (const char* Msg, const char* Cond,
|
||||
const char* File, unsigned Line)
|
||||
attribute ((noreturn));
|
||||
const char* File, unsigned Line)
|
||||
attribute ((noreturn));
|
||||
/* Function pointer that is called from check if the condition code is true. */
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ extern void (*CheckFailed) (const char* Msg, const char* Cond,
|
||||
#define PRECONDITION(c) \
|
||||
((void) ((c)? 0 : (CheckFailed (MsgPrecondition, #c, __FILE__, __LINE__), 0)))
|
||||
|
||||
#define CHECK(c) \
|
||||
#define CHECK(c) \
|
||||
((void) ((c)? 0 : (CheckFailed (MsgCheckFailed, #c, __FILE__, __LINE__), 0)))
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* cmdline.c */
|
||||
/* cmdline.c */
|
||||
/* */
|
||||
/* Helper functions for command line parsing */
|
||||
/* Helper functions for command line parsing */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -62,14 +62,14 @@ unsigned ArgCount = 0;
|
||||
/* Struct to pass the command line */
|
||||
typedef struct {
|
||||
char** Vec; /* The argument vector */
|
||||
unsigned Count; /* Actual number of arguments */
|
||||
unsigned Size; /* Number of argument allocated */
|
||||
unsigned Count; /* Actual number of arguments */
|
||||
unsigned Size; /* Number of argument allocated */
|
||||
} CmdLine;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Helper functions */
|
||||
/* Helper functions */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -89,13 +89,13 @@ static void AddArg (CmdLine* L, char* Arg)
|
||||
/* Add one argument to the list */
|
||||
{
|
||||
if (L->Size <= L->Count) {
|
||||
/* No space left, reallocate */
|
||||
unsigned NewSize = L->Size * 2;
|
||||
char** NewVec = xmalloc (NewSize * sizeof (L->Vec[0]));
|
||||
memcpy (NewVec, L->Vec, L->Count * sizeof (L->Vec[0]));
|
||||
xfree (L->Vec);
|
||||
L->Vec = NewVec;
|
||||
L->Size = NewSize;
|
||||
/* No space left, reallocate */
|
||||
unsigned NewSize = L->Size * 2;
|
||||
char** NewVec = xmalloc (NewSize * sizeof (L->Vec[0]));
|
||||
memcpy (NewVec, L->Vec, L->Count * sizeof (L->Vec[0]));
|
||||
xfree (L->Vec);
|
||||
L->Vec = NewVec;
|
||||
L->Size = NewSize;
|
||||
}
|
||||
|
||||
/* We have space left, add a copy of the argument */
|
||||
@@ -114,36 +114,36 @@ static void ExpandFile (CmdLine* L, const char* Name)
|
||||
/* Try to open the file for reading */
|
||||
FILE* F = fopen (Name, "r");
|
||||
if (F == 0) {
|
||||
AbEnd ("Cannot open \"%s\": %s", Name, strerror (errno));
|
||||
AbEnd ("Cannot open \"%s\": %s", Name, strerror (errno));
|
||||
}
|
||||
|
||||
/* File is open, read all lines */
|
||||
while (fgets (Buf, sizeof (Buf), F) != 0) {
|
||||
|
||||
/* Get a pointer to the buffer */
|
||||
const char* B = Buf;
|
||||
/* Get a pointer to the buffer */
|
||||
const char* B = Buf;
|
||||
|
||||
/* Skip trailing whitespace (this will also kill the newline that is
|
||||
* appended by fgets().
|
||||
*/
|
||||
unsigned Len = strlen (Buf);
|
||||
while (Len > 0 && IsSpace (Buf [Len-1])) {
|
||||
--Len;
|
||||
}
|
||||
Buf [Len] = '\0';
|
||||
/* Skip trailing whitespace (this will also kill the newline that is
|
||||
* appended by fgets().
|
||||
*/
|
||||
unsigned Len = strlen (Buf);
|
||||
while (Len > 0 && IsSpace (Buf [Len-1])) {
|
||||
--Len;
|
||||
}
|
||||
Buf [Len] = '\0';
|
||||
|
||||
/* Skip leading spaces */
|
||||
while (IsSpace (*B)) {
|
||||
++B;
|
||||
}
|
||||
/* Skip leading spaces */
|
||||
while (IsSpace (*B)) {
|
||||
++B;
|
||||
}
|
||||
|
||||
/* Skip empty lines to work around problems with some editors */
|
||||
if (*B == '\0') {
|
||||
continue;
|
||||
}
|
||||
/* Skip empty lines to work around problems with some editors */
|
||||
if (*B == '\0') {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Add anything not empty to the command line */
|
||||
AddArg (L, xstrdup (B));
|
||||
/* Add anything not empty to the command line */
|
||||
AddArg (L, xstrdup (B));
|
||||
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ static void ExpandFile (CmdLine* L, const char* Name)
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -167,20 +167,20 @@ void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
|
||||
* array. Both arguments are remembered in static storage.
|
||||
*/
|
||||
{
|
||||
CmdLine L;
|
||||
CmdLine L;
|
||||
int I;
|
||||
|
||||
/* Get the program name from argv[0] but strip a path */
|
||||
if (*(aArgVec)[0] == 0) {
|
||||
/* Use the default name given */
|
||||
ProgName = aProgName;
|
||||
/* Use the default name given */
|
||||
ProgName = aProgName;
|
||||
} else {
|
||||
/* Strip a path */
|
||||
ProgName = FindName ((*aArgVec)[0]);
|
||||
if (ProgName[0] == '\0') {
|
||||
/* Use the default */
|
||||
ProgName = aProgName;
|
||||
}
|
||||
/* Strip a path */
|
||||
ProgName = FindName ((*aArgVec)[0]);
|
||||
if (ProgName[0] == '\0') {
|
||||
/* Use the default */
|
||||
ProgName = aProgName;
|
||||
}
|
||||
}
|
||||
|
||||
/* Make a CmdLine struct */
|
||||
@@ -192,21 +192,21 @@ void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
|
||||
*/
|
||||
for (I = 0; I < *aArgCount; ++I) {
|
||||
|
||||
/* Get the next argument */
|
||||
char* Arg = (*aArgVec)[I];
|
||||
/* Get the next argument */
|
||||
char* Arg = (*aArgVec)[I];
|
||||
|
||||
/* Is this a file argument? */
|
||||
if (Arg && Arg[0] == '@') {
|
||||
/* Is this a file argument? */
|
||||
if (Arg && Arg[0] == '@') {
|
||||
|
||||
/* Expand the file */
|
||||
ExpandFile (&L, Arg+1);
|
||||
/* Expand the file */
|
||||
ExpandFile (&L, Arg+1);
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
/* No file, just add a copy */
|
||||
AddArg (&L, Arg);
|
||||
/* No file, just add a copy */
|
||||
AddArg (&L, Arg);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Store the new argument list in a safe place... */
|
||||
@@ -259,17 +259,17 @@ const char* GetArg (unsigned* ArgNum, unsigned Len)
|
||||
{
|
||||
const char* Arg = ArgVec[*ArgNum];
|
||||
if (Arg[Len] != '\0') {
|
||||
/* Argument appended */
|
||||
return Arg + Len;
|
||||
/* Argument appended */
|
||||
return Arg + Len;
|
||||
} else {
|
||||
/* Separate argument */
|
||||
Arg = ArgVec[*ArgNum + 1];
|
||||
if (Arg == 0) {
|
||||
/* End of arguments */
|
||||
NeedArg (ArgVec[*ArgNum]);
|
||||
}
|
||||
++(*ArgNum);
|
||||
return Arg;
|
||||
/* Separate argument */
|
||||
Arg = ArgVec[*ArgNum + 1];
|
||||
if (Arg == 0) {
|
||||
/* End of arguments */
|
||||
NeedArg (ArgVec[*ArgNum]);
|
||||
}
|
||||
++(*ArgNum);
|
||||
return Arg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,25 +283,25 @@ void LongOption (unsigned* ArgNum, const LongOpt* OptTab, unsigned OptCount)
|
||||
|
||||
/* Search the table for a match */
|
||||
while (OptCount) {
|
||||
if (strcmp (Opt, OptTab->Option) == 0) {
|
||||
/* Found, call the function */
|
||||
if (OptTab->ArgCount > 0) {
|
||||
/* We need an argument, check if we have one */
|
||||
const char* Arg = ArgVec[++(*ArgNum)];
|
||||
if (Arg == 0) {
|
||||
NeedArg (Opt);
|
||||
}
|
||||
OptTab->Func (Opt, Arg);
|
||||
} else {
|
||||
OptTab->Func (Opt, 0);
|
||||
}
|
||||
/* Done */
|
||||
return;
|
||||
}
|
||||
if (strcmp (Opt, OptTab->Option) == 0) {
|
||||
/* Found, call the function */
|
||||
if (OptTab->ArgCount > 0) {
|
||||
/* We need an argument, check if we have one */
|
||||
const char* Arg = ArgVec[++(*ArgNum)];
|
||||
if (Arg == 0) {
|
||||
NeedArg (Opt);
|
||||
}
|
||||
OptTab->Func (Opt, Arg);
|
||||
} else {
|
||||
OptTab->Func (Opt, 0);
|
||||
}
|
||||
/* Done */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Next table entry */
|
||||
--OptCount;
|
||||
++OptTab;
|
||||
/* Next table entry */
|
||||
--OptCount;
|
||||
++OptTab;
|
||||
}
|
||||
|
||||
/* Invalid option */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* cmdline.h */
|
||||
/* cmdline.h */
|
||||
/* */
|
||||
/* Helper functions for command line parsing */
|
||||
/* Helper functions for command line parsing */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -56,17 +56,17 @@ extern char** ArgVec;
|
||||
extern unsigned ArgCount;
|
||||
|
||||
/* Structure defining a long option */
|
||||
typedef struct LongOpt LongOpt;
|
||||
typedef struct LongOpt LongOpt;
|
||||
struct LongOpt {
|
||||
const char* Option;
|
||||
unsigned ArgCount;
|
||||
void (*Func) (const char* Opt, const char* Arg);
|
||||
const char* Option;
|
||||
unsigned ArgCount;
|
||||
void (*Func) (const char* Opt, const char* Arg);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* coll.c */
|
||||
/* coll.c */
|
||||
/* */
|
||||
/* Collection (dynamic array) */
|
||||
/* Collection (dynamic array) */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ const Collection EmptyCollection = STATIC_COLLECTION_INITIALIZER;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -139,13 +139,13 @@ void CollInsert (Collection* C, void* Item, unsigned Index)
|
||||
|
||||
/* Grow the array if necessary */
|
||||
if (C->Count >= C->Size) {
|
||||
/* Must grow */
|
||||
/* Must grow */
|
||||
CollGrow (C, (C->Size == 0)? 4 : C->Size * 2);
|
||||
}
|
||||
|
||||
/* Move the existing elements if needed */
|
||||
if (C->Count != Index) {
|
||||
memmove (C->Items+Index+1, C->Items+Index, (C->Count-Index) * sizeof (void*));
|
||||
memmove (C->Items+Index+1, C->Items+Index, (C->Count-Index) * sizeof (void*));
|
||||
}
|
||||
++C->Count;
|
||||
|
||||
@@ -246,10 +246,10 @@ int CollIndex (Collection* C, const void* Item)
|
||||
/* Linear search */
|
||||
unsigned I;
|
||||
for (I = 0; I < C->Count; ++I) {
|
||||
if (Item == C->Items[I]) {
|
||||
/* Found */
|
||||
return (int)I;
|
||||
}
|
||||
if (Item == C->Items[I]) {
|
||||
/* Found */
|
||||
return (int)I;
|
||||
}
|
||||
}
|
||||
|
||||
/* Not found */
|
||||
@@ -352,8 +352,8 @@ void CollMove (Collection* C, unsigned OldIndex, unsigned NewIndex)
|
||||
|
||||
/* Correct NewIndex if needed */
|
||||
if (NewIndex >= OldIndex) {
|
||||
/* Position has changed with removal */
|
||||
--NewIndex;
|
||||
/* Position has changed with removal */
|
||||
--NewIndex;
|
||||
}
|
||||
|
||||
/* Now insert it at the new position */
|
||||
@@ -378,7 +378,7 @@ void CollMoveMultiple (Collection* C, unsigned Start, unsigned Count, unsigned T
|
||||
|
||||
/* Check for trivial parameters */
|
||||
if (Count == 0 || Start == Target) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Calculate the raw memory space used by the items to move */
|
||||
@@ -396,24 +396,24 @@ void CollMoveMultiple (Collection* C, unsigned Start, unsigned Count, unsigned T
|
||||
*/
|
||||
if (Target < Start) {
|
||||
|
||||
/* Move downwards */
|
||||
unsigned BytesToMove = (Start - Target) * sizeof (void*);
|
||||
memmove (C->Items+Target+Count, C->Items+Target, BytesToMove);
|
||||
/* Move downwards */
|
||||
unsigned BytesToMove = (Start - Target) * sizeof (void*);
|
||||
memmove (C->Items+Target+Count, C->Items+Target, BytesToMove);
|
||||
|
||||
} else if (Target < Start + Count) {
|
||||
|
||||
/* Target is inside range */
|
||||
FAIL ("Not supported");
|
||||
/* Target is inside range */
|
||||
FAIL ("Not supported");
|
||||
|
||||
} else {
|
||||
|
||||
/* Move upwards */
|
||||
unsigned ItemsToMove = (Target - Start - Count);
|
||||
unsigned BytesToMove = ItemsToMove * sizeof (void*);
|
||||
memmove (C->Items+Start, C->Items+Target-ItemsToMove, BytesToMove);
|
||||
/* Move upwards */
|
||||
unsigned ItemsToMove = (Target - Start - Count);
|
||||
unsigned BytesToMove = ItemsToMove * sizeof (void*);
|
||||
memmove (C->Items+Start, C->Items+Target-ItemsToMove, BytesToMove);
|
||||
|
||||
/* Adjust the target index */
|
||||
Target -= Count;
|
||||
/* Adjust the target index */
|
||||
Target -= Count;
|
||||
}
|
||||
|
||||
/* Move the old items to their final location */
|
||||
@@ -426,8 +426,8 @@ void CollMoveMultiple (Collection* C, unsigned Start, unsigned Count, unsigned T
|
||||
|
||||
|
||||
static void QuickSort (Collection* C, int Lo, int Hi,
|
||||
int (*Compare) (void*, const void*, const void*),
|
||||
void* Data)
|
||||
int (*Compare) (void*, const void*, const void*),
|
||||
void* Data)
|
||||
/* Internal recursive sort function. */
|
||||
{
|
||||
/* Get a pointer to the items */
|
||||
@@ -435,37 +435,37 @@ static void QuickSort (Collection* C, int Lo, int Hi,
|
||||
|
||||
/* Quicksort */
|
||||
while (Hi > Lo) {
|
||||
int I = Lo + 1;
|
||||
int J = Hi;
|
||||
while (I <= J) {
|
||||
while (I <= J && Compare (Data, Items[Lo], Items[I]) >= 0) {
|
||||
++I;
|
||||
}
|
||||
while (I <= J && Compare (Data, Items[Lo], Items[J]) < 0) {
|
||||
--J;
|
||||
}
|
||||
if (I <= J) {
|
||||
/* Swap I and J */
|
||||
void* Tmp = Items[I];
|
||||
Items[I] = Items[J];
|
||||
Items[J] = Tmp;
|
||||
++I;
|
||||
--J;
|
||||
}
|
||||
}
|
||||
if (J != Lo) {
|
||||
/* Swap J and Lo */
|
||||
void* Tmp = Items[J];
|
||||
Items[J] = Items[Lo];
|
||||
Items[Lo] = Tmp;
|
||||
}
|
||||
if (J > (Hi + Lo) / 2) {
|
||||
QuickSort (C, J + 1, Hi, Compare, Data);
|
||||
Hi = J - 1;
|
||||
} else {
|
||||
QuickSort (C, Lo, J - 1, Compare, Data);
|
||||
Lo = J + 1;
|
||||
}
|
||||
int I = Lo + 1;
|
||||
int J = Hi;
|
||||
while (I <= J) {
|
||||
while (I <= J && Compare (Data, Items[Lo], Items[I]) >= 0) {
|
||||
++I;
|
||||
}
|
||||
while (I <= J && Compare (Data, Items[Lo], Items[J]) < 0) {
|
||||
--J;
|
||||
}
|
||||
if (I <= J) {
|
||||
/* Swap I and J */
|
||||
void* Tmp = Items[I];
|
||||
Items[I] = Items[J];
|
||||
Items[J] = Tmp;
|
||||
++I;
|
||||
--J;
|
||||
}
|
||||
}
|
||||
if (J != Lo) {
|
||||
/* Swap J and Lo */
|
||||
void* Tmp = Items[J];
|
||||
Items[J] = Items[Lo];
|
||||
Items[Lo] = Tmp;
|
||||
}
|
||||
if (J > (Hi + Lo) / 2) {
|
||||
QuickSort (C, J + 1, Hi, Compare, Data);
|
||||
Hi = J - 1;
|
||||
} else {
|
||||
QuickSort (C, Lo, J - 1, Compare, Data);
|
||||
Lo = J + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,8 +492,8 @@ void CollTransfer (Collection* Dest, const Collection* Source)
|
||||
|
||||
|
||||
void CollSort (Collection* C,
|
||||
int (*Compare) (void*, const void*, const void*),
|
||||
void* Data)
|
||||
int (*Compare) (void*, const void*, const void*),
|
||||
void* Data)
|
||||
/* Sort the collection using the given compare function. The data pointer is
|
||||
* passed as *first* element to the compare function, it's not used by the
|
||||
* sort function itself. The other two pointer passed to the Compare function
|
||||
@@ -501,7 +501,7 @@ void CollSort (Collection* C,
|
||||
*/
|
||||
{
|
||||
if (C->Count > 1) {
|
||||
QuickSort (C, 0, C->Count-1, Compare, Data);
|
||||
QuickSort (C, 0, C->Count-1, Compare, Data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* coll.h */
|
||||
/* coll.h */
|
||||
/* */
|
||||
/* Collection (dynamic array) */
|
||||
/* Collection (dynamic array) */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -54,16 +54,16 @@
|
||||
/* An array of pointers that grows if needed */
|
||||
typedef struct Collection Collection;
|
||||
struct Collection {
|
||||
unsigned Count; /* Number of items in the list */
|
||||
unsigned Size; /* Size of allocated array */
|
||||
void** Items; /* Array with dynamic size */
|
||||
unsigned Count; /* Number of items in the list */
|
||||
unsigned Size; /* Size of allocated array */
|
||||
void** Items; /* Array with dynamic size */
|
||||
};
|
||||
|
||||
/* An empty collection */
|
||||
extern const Collection EmptyCollection;
|
||||
|
||||
/* Initializer for static collections */
|
||||
#define STATIC_COLLECTION_INITIALIZER { 0, 0, 0 }
|
||||
#define STATIC_COLLECTION_INITIALIZER { 0, 0, 0 }
|
||||
|
||||
/* Initializer for auto collections */
|
||||
#define AUTO_COLLECTION_INITIALIZER EmptyCollection
|
||||
@@ -71,7 +71,7 @@ extern const Collection EmptyCollection;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ INLINE unsigned CollCount (const Collection* C)
|
||||
return C->Count;
|
||||
}
|
||||
#else
|
||||
# define CollCount(C) (C)->Count
|
||||
# define CollCount(C) (C)->Count
|
||||
#endif
|
||||
|
||||
void CollInsert (Collection* C, void* Item, unsigned Index);
|
||||
@@ -144,7 +144,7 @@ INLINE void* CollAtUnchecked (const Collection* C, unsigned Index)
|
||||
return C->Items[Index];
|
||||
}
|
||||
#else
|
||||
# define CollAtUnchecked(C, Index) ((C)->Items[(Index)])
|
||||
# define CollAtUnchecked(C, Index) ((C)->Items[(Index)])
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
@@ -237,7 +237,7 @@ INLINE void CollDeleteAll (Collection* C)
|
||||
C->Count = 0;
|
||||
}
|
||||
#else
|
||||
# define CollDeleteAll(C) ((C)->Count = 0)
|
||||
# define CollDeleteAll(C) ((C)->Count = 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
@@ -288,8 +288,8 @@ void CollTransfer (Collection* Dest, const Collection* Source);
|
||||
*/
|
||||
|
||||
void CollSort (Collection* C,
|
||||
int (*Compare) (void*, const void*, const void*),
|
||||
void* Data);
|
||||
int (*Compare) (void*, const void*, const void*),
|
||||
void* Data);
|
||||
/* Sort the collection using the given compare function. The data pointer is
|
||||
* passed as *first* element to the compare function, it's not used by the
|
||||
* sort function itself. The other two pointer passed to the Compare function
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ const unsigned CPUIsets[CPU_COUNT] = {
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -128,9 +128,9 @@ cpu_t FindCPU (const char* Name)
|
||||
|
||||
/* Check all CPU names */
|
||||
for (I = 0; I < CPU_COUNT; ++I) {
|
||||
if (StrCaseCmp (CPUNames [I], Name) == 0) {
|
||||
return (cpu_t)I;
|
||||
}
|
||||
if (StrCaseCmp (CPUNames [I], Name) == 0) {
|
||||
return (cpu_t)I;
|
||||
}
|
||||
}
|
||||
|
||||
/* Not found */
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -53,11 +53,11 @@ typedef enum {
|
||||
CPU_65SC02,
|
||||
CPU_65C02,
|
||||
CPU_65816,
|
||||
CPU_SUNPLUS, /* Not in the freeware version - sorry */
|
||||
CPU_SUNPLUS, /* Not in the freeware version - sorry */
|
||||
CPU_SWEET16,
|
||||
CPU_HUC6280, /* Used in PC engine */
|
||||
CPU_M740, /* Mitsubishi 740 series MCUs */
|
||||
CPU_COUNT /* Number of different CPUs */
|
||||
CPU_COUNT /* Number of different CPUs */
|
||||
} cpu_t;
|
||||
|
||||
/* CPU instruction sets */
|
||||
@@ -86,7 +86,7 @@ extern const unsigned CPUIsets[CPU_COUNT];
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
|
||||
|
||||
unsigned char Debug = 0; /* Debug mode */
|
||||
unsigned char Debug = 0; /* Debug mode */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
|
||||
|
||||
extern unsigned char Debug; /* Debug mode */
|
||||
extern unsigned char Debug; /* Debug mode */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* exprdefs.c */
|
||||
/* exprdefs.c */
|
||||
/* */
|
||||
/* Expression tree definitions */
|
||||
/* Expression tree definitions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -50,113 +50,113 @@ static void InternalDumpExpr (const ExprNode* Expr, const ExprNode* (*ResolveSym
|
||||
/* Dump an expression in RPN to stdout */
|
||||
{
|
||||
if (Expr == 0) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
InternalDumpExpr (Expr->Left, ResolveSym);
|
||||
InternalDumpExpr (Expr->Right, ResolveSym);
|
||||
|
||||
switch (Expr->Op) {
|
||||
|
||||
case EXPR_LITERAL:
|
||||
case EXPR_ULABEL:
|
||||
printf (" $%04lX", Expr->V.IVal);
|
||||
break;
|
||||
case EXPR_LITERAL:
|
||||
case EXPR_ULABEL:
|
||||
printf (" $%04lX", Expr->V.IVal);
|
||||
break;
|
||||
|
||||
case EXPR_SYMBOL:
|
||||
case EXPR_SYMBOL:
|
||||
printf (" SYM(");
|
||||
if (ResolveSym && (Expr = ResolveSym (Expr->V.Sym)) != 0) {
|
||||
InternalDumpExpr (Expr, ResolveSym);
|
||||
}
|
||||
printf (") ");
|
||||
break;
|
||||
break;
|
||||
|
||||
case EXPR_SECTION:
|
||||
printf (" SEC");
|
||||
break;
|
||||
case EXPR_SECTION:
|
||||
printf (" SEC");
|
||||
break;
|
||||
|
||||
case EXPR_SEGMENT:
|
||||
printf (" SEG");
|
||||
break;
|
||||
case EXPR_SEGMENT:
|
||||
printf (" SEG");
|
||||
break;
|
||||
|
||||
case EXPR_MEMAREA:
|
||||
printf (" MEM");
|
||||
break;
|
||||
|
||||
case EXPR_PLUS:
|
||||
printf (" +");
|
||||
break;
|
||||
case EXPR_PLUS:
|
||||
printf (" +");
|
||||
break;
|
||||
|
||||
case EXPR_MINUS:
|
||||
printf (" -");
|
||||
break;
|
||||
case EXPR_MINUS:
|
||||
printf (" -");
|
||||
break;
|
||||
|
||||
case EXPR_MUL:
|
||||
printf (" *");
|
||||
break;
|
||||
case EXPR_MUL:
|
||||
printf (" *");
|
||||
break;
|
||||
|
||||
case EXPR_DIV:
|
||||
printf (" /");
|
||||
break;
|
||||
case EXPR_DIV:
|
||||
printf (" /");
|
||||
break;
|
||||
|
||||
case EXPR_MOD:
|
||||
printf (" MOD");
|
||||
break;
|
||||
case EXPR_MOD:
|
||||
printf (" MOD");
|
||||
break;
|
||||
|
||||
case EXPR_OR:
|
||||
printf (" OR");
|
||||
break;
|
||||
case EXPR_OR:
|
||||
printf (" OR");
|
||||
break;
|
||||
|
||||
case EXPR_XOR:
|
||||
printf (" XOR");
|
||||
break;
|
||||
case EXPR_XOR:
|
||||
printf (" XOR");
|
||||
break;
|
||||
|
||||
case EXPR_AND:
|
||||
printf (" AND");
|
||||
break;
|
||||
case EXPR_AND:
|
||||
printf (" AND");
|
||||
break;
|
||||
|
||||
case EXPR_SHL:
|
||||
printf (" SHL");
|
||||
break;
|
||||
case EXPR_SHL:
|
||||
printf (" SHL");
|
||||
break;
|
||||
|
||||
case EXPR_SHR:
|
||||
printf (" SHR");
|
||||
break;
|
||||
case EXPR_SHR:
|
||||
printf (" SHR");
|
||||
break;
|
||||
|
||||
case EXPR_EQ:
|
||||
printf (" =");
|
||||
break;
|
||||
case EXPR_EQ:
|
||||
printf (" =");
|
||||
break;
|
||||
|
||||
case EXPR_NE:
|
||||
printf ("<>");
|
||||
break;
|
||||
case EXPR_NE:
|
||||
printf ("<>");
|
||||
break;
|
||||
|
||||
case EXPR_LT:
|
||||
printf (" <");
|
||||
break;
|
||||
case EXPR_LT:
|
||||
printf (" <");
|
||||
break;
|
||||
|
||||
case EXPR_GT:
|
||||
printf (" >");
|
||||
break;
|
||||
case EXPR_GT:
|
||||
printf (" >");
|
||||
break;
|
||||
|
||||
case EXPR_LE:
|
||||
printf (" <=");
|
||||
break;
|
||||
case EXPR_LE:
|
||||
printf (" <=");
|
||||
break;
|
||||
|
||||
case EXPR_GE:
|
||||
printf (" >=");
|
||||
break;
|
||||
case EXPR_GE:
|
||||
printf (" >=");
|
||||
break;
|
||||
|
||||
case EXPR_BOOLAND:
|
||||
printf (" BOOL_AND");
|
||||
break;
|
||||
case EXPR_BOOLAND:
|
||||
printf (" BOOL_AND");
|
||||
break;
|
||||
|
||||
case EXPR_BOOLOR:
|
||||
printf (" BOOL_OR");
|
||||
break;
|
||||
case EXPR_BOOLOR:
|
||||
printf (" BOOL_OR");
|
||||
break;
|
||||
|
||||
case EXPR_BOOLXOR:
|
||||
printf (" BOOL_XOR");
|
||||
break;
|
||||
case EXPR_BOOLXOR:
|
||||
printf (" BOOL_XOR");
|
||||
break;
|
||||
|
||||
case EXPR_MAX:
|
||||
printf (" MAX");
|
||||
@@ -166,60 +166,60 @@ static void InternalDumpExpr (const ExprNode* Expr, const ExprNode* (*ResolveSym
|
||||
printf (" MIN");
|
||||
break;
|
||||
|
||||
case EXPR_UNARY_MINUS:
|
||||
printf (" NEG");
|
||||
break;
|
||||
case EXPR_UNARY_MINUS:
|
||||
printf (" NEG");
|
||||
break;
|
||||
|
||||
case EXPR_NOT:
|
||||
printf (" ~");
|
||||
break;
|
||||
case EXPR_NOT:
|
||||
printf (" ~");
|
||||
break;
|
||||
|
||||
case EXPR_SWAP:
|
||||
printf (" SWAP");
|
||||
break;
|
||||
case EXPR_SWAP:
|
||||
printf (" SWAP");
|
||||
break;
|
||||
|
||||
case EXPR_BOOLNOT:
|
||||
printf (" BOOL_NOT");
|
||||
break;
|
||||
case EXPR_BOOLNOT:
|
||||
printf (" BOOL_NOT");
|
||||
break;
|
||||
|
||||
case EXPR_BANK:
|
||||
printf (" BANK");
|
||||
break;
|
||||
|
||||
case EXPR_BYTE0:
|
||||
printf (" BYTE0");
|
||||
break;
|
||||
case EXPR_BYTE0:
|
||||
printf (" BYTE0");
|
||||
break;
|
||||
|
||||
case EXPR_BYTE1:
|
||||
printf (" BYTE1");
|
||||
break;
|
||||
case EXPR_BYTE1:
|
||||
printf (" BYTE1");
|
||||
break;
|
||||
|
||||
case EXPR_BYTE2:
|
||||
printf (" BYTE2");
|
||||
break;
|
||||
case EXPR_BYTE2:
|
||||
printf (" BYTE2");
|
||||
break;
|
||||
|
||||
case EXPR_BYTE3:
|
||||
printf (" BYTE3");
|
||||
break;
|
||||
case EXPR_BYTE3:
|
||||
printf (" BYTE3");
|
||||
break;
|
||||
|
||||
case EXPR_WORD0:
|
||||
printf (" WORD0");
|
||||
break;
|
||||
case EXPR_WORD0:
|
||||
printf (" WORD0");
|
||||
break;
|
||||
|
||||
case EXPR_WORD1:
|
||||
printf (" WORD1");
|
||||
break;
|
||||
case EXPR_WORD1:
|
||||
printf (" WORD1");
|
||||
break;
|
||||
|
||||
case EXPR_FARADDR:
|
||||
printf (" FARADDR");
|
||||
break;
|
||||
case EXPR_FARADDR:
|
||||
printf (" FARADDR");
|
||||
break;
|
||||
|
||||
case EXPR_DWORD:
|
||||
printf (" DWORD");
|
||||
break;
|
||||
case EXPR_DWORD:
|
||||
printf (" DWORD");
|
||||
break;
|
||||
|
||||
default:
|
||||
AbEnd ("Unknown Op type: %u", Expr->Op);
|
||||
AbEnd ("Unknown Op type: %u", Expr->Op);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* exprdefs.h */
|
||||
/* exprdefs.h */
|
||||
/* */
|
||||
/* Expression tree definitions */
|
||||
/* Expression tree definitions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -39,64 +39,64 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Expression type masks */
|
||||
#define EXPR_TYPEMASK 0xC0
|
||||
#define EXPR_BINARYNODE 0x00
|
||||
#define EXPR_UNARYNODE 0x40
|
||||
#define EXPR_LEAFNODE 0x80
|
||||
#define EXPR_TYPEMASK 0xC0
|
||||
#define EXPR_BINARYNODE 0x00
|
||||
#define EXPR_UNARYNODE 0x40
|
||||
#define EXPR_LEAFNODE 0x80
|
||||
|
||||
/* Type of expression nodes */
|
||||
#define EXPR_NULL 0x00 /* Internal error or NULL node */
|
||||
#define EXPR_NULL 0x00 /* Internal error or NULL node */
|
||||
|
||||
/* Leaf node codes */
|
||||
#define EXPR_LITERAL (EXPR_LEAFNODE | 0x01)
|
||||
#define EXPR_SYMBOL (EXPR_LEAFNODE | 0x02)
|
||||
#define EXPR_LITERAL (EXPR_LEAFNODE | 0x01)
|
||||
#define EXPR_SYMBOL (EXPR_LEAFNODE | 0x02)
|
||||
#define EXPR_SECTION (EXPR_LEAFNODE | 0x03)
|
||||
#define EXPR_SEGMENT (EXPR_LEAFNODE | 0x04) /* Linker only */
|
||||
#define EXPR_MEMAREA (EXPR_LEAFNODE | 0x05) /* Linker only */
|
||||
#define EXPR_ULABEL (EXPR_LEAFNODE | 0x06) /* Assembler only */
|
||||
#define EXPR_SEGMENT (EXPR_LEAFNODE | 0x04) /* Linker only */
|
||||
#define EXPR_MEMAREA (EXPR_LEAFNODE | 0x05) /* Linker only */
|
||||
#define EXPR_ULABEL (EXPR_LEAFNODE | 0x06) /* Assembler only */
|
||||
|
||||
/* Binary operations, left and right hand sides are valid */
|
||||
#define EXPR_PLUS (EXPR_BINARYNODE | 0x01)
|
||||
#define EXPR_MINUS (EXPR_BINARYNODE | 0x02)
|
||||
#define EXPR_MUL (EXPR_BINARYNODE | 0x03)
|
||||
#define EXPR_DIV (EXPR_BINARYNODE | 0x04)
|
||||
#define EXPR_MOD (EXPR_BINARYNODE | 0x05)
|
||||
#define EXPR_OR (EXPR_BINARYNODE | 0x06)
|
||||
#define EXPR_XOR (EXPR_BINARYNODE | 0x07)
|
||||
#define EXPR_AND (EXPR_BINARYNODE | 0x08)
|
||||
#define EXPR_SHL (EXPR_BINARYNODE | 0x09)
|
||||
#define EXPR_SHR (EXPR_BINARYNODE | 0x0A)
|
||||
#define EXPR_EQ (EXPR_BINARYNODE | 0x0B)
|
||||
#define EXPR_NE (EXPR_BINARYNODE | 0x0C)
|
||||
#define EXPR_LT (EXPR_BINARYNODE | 0x0D)
|
||||
#define EXPR_GT (EXPR_BINARYNODE | 0x0E)
|
||||
#define EXPR_LE (EXPR_BINARYNODE | 0x0F)
|
||||
#define EXPR_GE (EXPR_BINARYNODE | 0x10)
|
||||
#define EXPR_BOOLAND (EXPR_BINARYNODE | 0x11)
|
||||
#define EXPR_BOOLOR (EXPR_BINARYNODE | 0x12)
|
||||
#define EXPR_BOOLXOR (EXPR_BINARYNODE | 0x13)
|
||||
#define EXPR_PLUS (EXPR_BINARYNODE | 0x01)
|
||||
#define EXPR_MINUS (EXPR_BINARYNODE | 0x02)
|
||||
#define EXPR_MUL (EXPR_BINARYNODE | 0x03)
|
||||
#define EXPR_DIV (EXPR_BINARYNODE | 0x04)
|
||||
#define EXPR_MOD (EXPR_BINARYNODE | 0x05)
|
||||
#define EXPR_OR (EXPR_BINARYNODE | 0x06)
|
||||
#define EXPR_XOR (EXPR_BINARYNODE | 0x07)
|
||||
#define EXPR_AND (EXPR_BINARYNODE | 0x08)
|
||||
#define EXPR_SHL (EXPR_BINARYNODE | 0x09)
|
||||
#define EXPR_SHR (EXPR_BINARYNODE | 0x0A)
|
||||
#define EXPR_EQ (EXPR_BINARYNODE | 0x0B)
|
||||
#define EXPR_NE (EXPR_BINARYNODE | 0x0C)
|
||||
#define EXPR_LT (EXPR_BINARYNODE | 0x0D)
|
||||
#define EXPR_GT (EXPR_BINARYNODE | 0x0E)
|
||||
#define EXPR_LE (EXPR_BINARYNODE | 0x0F)
|
||||
#define EXPR_GE (EXPR_BINARYNODE | 0x10)
|
||||
#define EXPR_BOOLAND (EXPR_BINARYNODE | 0x11)
|
||||
#define EXPR_BOOLOR (EXPR_BINARYNODE | 0x12)
|
||||
#define EXPR_BOOLXOR (EXPR_BINARYNODE | 0x13)
|
||||
#define EXPR_MAX (EXPR_BINARYNODE | 0x14)
|
||||
#define EXPR_MIN (EXPR_BINARYNODE | 0x15)
|
||||
|
||||
/* Unary operations, right hand side is empty */
|
||||
#define EXPR_UNARY_MINUS (EXPR_UNARYNODE | 0x01)
|
||||
#define EXPR_NOT (EXPR_UNARYNODE | 0x02)
|
||||
#define EXPR_SWAP (EXPR_UNARYNODE | 0x03)
|
||||
#define EXPR_BOOLNOT (EXPR_UNARYNODE | 0x04)
|
||||
#define EXPR_UNARY_MINUS (EXPR_UNARYNODE | 0x01)
|
||||
#define EXPR_NOT (EXPR_UNARYNODE | 0x02)
|
||||
#define EXPR_SWAP (EXPR_UNARYNODE | 0x03)
|
||||
#define EXPR_BOOLNOT (EXPR_UNARYNODE | 0x04)
|
||||
#define EXPR_BANK (EXPR_UNARYNODE | 0x05)
|
||||
|
||||
#define EXPR_BYTE0 (EXPR_UNARYNODE | 0x08)
|
||||
#define EXPR_BYTE1 (EXPR_UNARYNODE | 0x09)
|
||||
#define EXPR_BYTE2 (EXPR_UNARYNODE | 0x0A)
|
||||
#define EXPR_BYTE3 (EXPR_UNARYNODE | 0x0B)
|
||||
#define EXPR_WORD0 (EXPR_UNARYNODE | 0x0C)
|
||||
#define EXPR_WORD1 (EXPR_UNARYNODE | 0x0D)
|
||||
#define EXPR_BYTE0 (EXPR_UNARYNODE | 0x08)
|
||||
#define EXPR_BYTE1 (EXPR_UNARYNODE | 0x09)
|
||||
#define EXPR_BYTE2 (EXPR_UNARYNODE | 0x0A)
|
||||
#define EXPR_BYTE3 (EXPR_UNARYNODE | 0x0B)
|
||||
#define EXPR_WORD0 (EXPR_UNARYNODE | 0x0C)
|
||||
#define EXPR_WORD1 (EXPR_UNARYNODE | 0x0D)
|
||||
#define EXPR_FARADDR (EXPR_UNARYNODE | 0x0E)
|
||||
#define EXPR_DWORD (EXPR_UNARYNODE | 0x0F)
|
||||
|
||||
@@ -105,19 +105,19 @@
|
||||
/* The expression node itself */
|
||||
typedef struct ExprNode ExprNode;
|
||||
struct ExprNode {
|
||||
unsigned char Op; /* Operand/Type */
|
||||
ExprNode* Left; /* Left leaf */
|
||||
ExprNode* Right; /* Right leaf */
|
||||
struct ObjData* Obj; /* Object file reference (linker) */
|
||||
unsigned char Op; /* Operand/Type */
|
||||
ExprNode* Left; /* Left leaf */
|
||||
ExprNode* Right; /* Right leaf */
|
||||
struct ObjData* Obj; /* Object file reference (linker) */
|
||||
union {
|
||||
long IVal; /* If this is a int value */
|
||||
struct SymEntry* Sym; /* If this is a symbol */
|
||||
unsigned SecNum; /* If this is a section and Obj != 0 */
|
||||
long IVal; /* If this is a int value */
|
||||
struct SymEntry* Sym; /* If this is a symbol */
|
||||
unsigned SecNum; /* If this is a section and Obj != 0 */
|
||||
unsigned ImpNum; /* If this is an import and Obj != 0 */
|
||||
struct Import* Imp; /* If this is an import and Obj == 0 */
|
||||
struct Import* Imp; /* If this is an import and Obj == 0 */
|
||||
struct MemoryArea* Mem; /* If this is a memory area */
|
||||
struct Segment* Seg; /* If this is a segment */
|
||||
struct Section* Sec; /* If this is a section and Obj == 0 */
|
||||
struct Segment* Seg; /* If this is a segment */
|
||||
struct Section* Sec; /* If this is a section and Obj == 0 */
|
||||
} V;
|
||||
};
|
||||
|
||||
@@ -125,14 +125,14 @@ struct ExprNode {
|
||||
|
||||
/* Macros to determine the expression type */
|
||||
#define EXPR_NODETYPE(Op) ((Op) & EXPR_TYPEMASK)
|
||||
#define EXPR_IS_LEAF(Op) (EXPR_NODETYPE (Op) == EXPR_LEAFNODE)
|
||||
#define EXPR_IS_UNARY(Op) (EXPR_NODETYPE (Op) == EXPR_UNARYNODE)
|
||||
#define EXPR_IS_BINARY(OP) (EXPR_NODETYPE (Op) == EXPR_BINARYNODE)
|
||||
#define EXPR_IS_LEAF(Op) (EXPR_NODETYPE (Op) == EXPR_LEAFNODE)
|
||||
#define EXPR_IS_UNARY(Op) (EXPR_NODETYPE (Op) == EXPR_UNARYNODE)
|
||||
#define EXPR_IS_BINARY(OP) (EXPR_NODETYPE (Op) == EXPR_BINARYNODE)
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ const FileId* GetFileId (const char* Name, const FileId* Table, unsigned Count)
|
||||
|
||||
/* Do we have an extension? */
|
||||
if (Ext == 0) {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Search for a table entry and return it */
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -49,14 +49,14 @@
|
||||
*/
|
||||
typedef struct FileId FileId;
|
||||
struct FileId {
|
||||
const char Ext[4];
|
||||
const char Ext[4];
|
||||
int Id;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* filepos.c */
|
||||
/* filepos.c */
|
||||
/* */
|
||||
/* File position data structure */
|
||||
/* File position data structure */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* filepos.h */
|
||||
/* filepos.h */
|
||||
/* */
|
||||
/* File position data structure */
|
||||
/* File position data structure */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ struct FilePos {
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
/* The Windows compilers have the file in the wrong directory */
|
||||
# include <sys/utime.h>
|
||||
#else
|
||||
# include <sys/types.h> /* FreeBSD needs this */
|
||||
# include <sys/types.h> /* FreeBSD needs this */
|
||||
# include <utime.h>
|
||||
#endif
|
||||
#endif
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -43,42 +43,42 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
static const FileId TypeTable[] = {
|
||||
/* Upper case stuff for obsolete operating systems */
|
||||
{ "A", FILETYPE_LIB },
|
||||
{ "A65", FILETYPE_ASM },
|
||||
{ "ASM", FILETYPE_ASM },
|
||||
{ "C", FILETYPE_C },
|
||||
{ "A", FILETYPE_LIB },
|
||||
{ "A65", FILETYPE_ASM },
|
||||
{ "ASM", FILETYPE_ASM },
|
||||
{ "C", FILETYPE_C },
|
||||
{ "EMD", FILETYPE_O65 },
|
||||
{ "GRC", FILETYPE_GR },
|
||||
{ "GRC", FILETYPE_GR },
|
||||
{ "JOY", FILETYPE_O65 },
|
||||
{ "LIB", FILETYPE_LIB },
|
||||
{ "LIB", FILETYPE_LIB },
|
||||
{ "MOU", FILETYPE_O65 },
|
||||
{ "O", FILETYPE_OBJ },
|
||||
{ "O", FILETYPE_OBJ },
|
||||
{ "O65", FILETYPE_O65 },
|
||||
{ "OBJ", FILETYPE_OBJ },
|
||||
{ "S", FILETYPE_ASM },
|
||||
{ "OBJ", FILETYPE_OBJ },
|
||||
{ "S", FILETYPE_ASM },
|
||||
{ "SER", FILETYPE_O65 },
|
||||
{ "TGI", FILETYPE_O65 },
|
||||
|
||||
{ "a", FILETYPE_LIB },
|
||||
{ "a65", FILETYPE_ASM },
|
||||
{ "asm", FILETYPE_ASM },
|
||||
{ "c", FILETYPE_C },
|
||||
{ "a", FILETYPE_LIB },
|
||||
{ "a65", FILETYPE_ASM },
|
||||
{ "asm", FILETYPE_ASM },
|
||||
{ "c", FILETYPE_C },
|
||||
{ "emd", FILETYPE_O65 },
|
||||
{ "grc", FILETYPE_GR },
|
||||
{ "grc", FILETYPE_GR },
|
||||
{ "joy", FILETYPE_O65 },
|
||||
{ "lib", FILETYPE_LIB },
|
||||
{ "lib", FILETYPE_LIB },
|
||||
{ "mou", FILETYPE_O65 },
|
||||
{ "o", FILETYPE_OBJ },
|
||||
{ "o", FILETYPE_OBJ },
|
||||
{ "o65", FILETYPE_O65 },
|
||||
{ "obj", FILETYPE_OBJ },
|
||||
{ "s", FILETYPE_ASM },
|
||||
{ "obj", FILETYPE_OBJ },
|
||||
{ "s", FILETYPE_ASM },
|
||||
{ "ser", FILETYPE_O65 },
|
||||
{ "tgi", FILETYPE_O65 },
|
||||
};
|
||||
@@ -88,7 +88,7 @@ static const FileId TypeTable[] = {
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -51,14 +51,14 @@ typedef enum {
|
||||
FILETYPE_ASM, /* Assembler file */
|
||||
FILETYPE_OBJ, /* Object file */
|
||||
FILETYPE_LIB, /* Library file */
|
||||
FILETYPE_GR, /* GEOS resource file */
|
||||
FILETYPE_GR, /* GEOS resource file */
|
||||
FILETYPE_O65 /* O65 object file */
|
||||
} FILETYPE;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* fname.c */
|
||||
/* fname.c */
|
||||
/* */
|
||||
/* File name handling utilities */
|
||||
/* File name handling utilities */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ const char* FindExt (const char* Name)
|
||||
/* Get the length of the name */
|
||||
unsigned Len = strlen (Name);
|
||||
if (Len < 2) {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get a pointer to the last character */
|
||||
@@ -62,14 +62,14 @@ const char* FindExt (const char* Name)
|
||||
|
||||
/* Search for the dot, beware of subdirectories */
|
||||
while (S >= Name && *S != '.' && *S != '\\' && *S != '/') {
|
||||
--S;
|
||||
--S;
|
||||
}
|
||||
|
||||
/* Did we find an extension? */
|
||||
if (*S == '.') {
|
||||
return S;
|
||||
return S;
|
||||
} else {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ const char* FindName (const char* Path)
|
||||
|
||||
/* Search for the path separator */
|
||||
while (Len > 0 && Path[Len-1] != '\\' && Path[Len-1] != '/') {
|
||||
--Len;
|
||||
--Len;
|
||||
}
|
||||
|
||||
/* Return the name or path */
|
||||
@@ -104,14 +104,14 @@ char* MakeFilename (const char* Origin, const char* Ext)
|
||||
char* Out;
|
||||
const char* P = FindExt (Origin);
|
||||
if (P == 0) {
|
||||
/* No dot, add the extension */
|
||||
Out = xmalloc (strlen (Origin) + strlen (Ext) + 1);
|
||||
strcpy (Out, Origin);
|
||||
strcat (Out, Ext);
|
||||
/* No dot, add the extension */
|
||||
Out = xmalloc (strlen (Origin) + strlen (Ext) + 1);
|
||||
strcpy (Out, Origin);
|
||||
strcat (Out, Ext);
|
||||
} else {
|
||||
Out = xmalloc (P - Origin + strlen (Ext) + 1);
|
||||
memcpy (Out, Origin, P - Origin);
|
||||
strcpy (Out + (P - Origin), Ext);
|
||||
Out = xmalloc (P - Origin + strlen (Ext) + 1);
|
||||
memcpy (Out, Origin, P - Origin);
|
||||
strcpy (Out + (P - Origin), Ext);
|
||||
}
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* fname.h */
|
||||
/* fname.h */
|
||||
/* */
|
||||
/* File name handling utilities */
|
||||
/* File name handling utilities */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ union Double {
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* fragdefs.h */
|
||||
/* fragdefs.h */
|
||||
/* */
|
||||
/* Fragment definitions for the bin65 binary utils */
|
||||
/* */
|
||||
@@ -39,31 +39,31 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Masks for the fragment type byte */
|
||||
#define FRAG_TYPEMASK 0x38 /* Mask the type of the fragment */
|
||||
#define FRAG_BYTEMASK 0x07 /* Mask for byte count */
|
||||
#define FRAG_TYPEMASK 0x38 /* Mask the type of the fragment */
|
||||
#define FRAG_BYTEMASK 0x07 /* Mask for byte count */
|
||||
|
||||
/* Fragment types */
|
||||
#define FRAG_LITERAL 0x00 /* Literal data */
|
||||
#define FRAG_LITERAL 0x00 /* Literal data */
|
||||
|
||||
#define FRAG_EXPR 0x08 /* Expression */
|
||||
#define FRAG_EXPR8 (FRAG_EXPR | 1) /* 8 bit expression */
|
||||
#define FRAG_EXPR16 (FRAG_EXPR | 2) /* 16 bit expression */
|
||||
#define FRAG_EXPR24 (FRAG_EXPR | 3) /* 24 bit expression */
|
||||
#define FRAG_EXPR32 (FRAG_EXPR | 4) /* 32 bit expression */
|
||||
#define FRAG_EXPR 0x08 /* Expression */
|
||||
#define FRAG_EXPR8 (FRAG_EXPR | 1) /* 8 bit expression */
|
||||
#define FRAG_EXPR16 (FRAG_EXPR | 2) /* 16 bit expression */
|
||||
#define FRAG_EXPR24 (FRAG_EXPR | 3) /* 24 bit expression */
|
||||
#define FRAG_EXPR32 (FRAG_EXPR | 4) /* 32 bit expression */
|
||||
|
||||
#define FRAG_SEXPR 0x10 /* Signed expression */
|
||||
#define FRAG_SEXPR8 (FRAG_SEXPR | 1)/* 8 bit signed expression */
|
||||
#define FRAG_SEXPR16 (FRAG_SEXPR | 2)/* 16 bit signed expression */
|
||||
#define FRAG_SEXPR24 (FRAG_SEXPR | 3)/* 24 bit signed expression */
|
||||
#define FRAG_SEXPR32 (FRAG_SEXPR | 4)/* 32 bit signed expression */
|
||||
#define FRAG_SEXPR 0x10 /* Signed expression */
|
||||
#define FRAG_SEXPR8 (FRAG_SEXPR | 1)/* 8 bit signed expression */
|
||||
#define FRAG_SEXPR16 (FRAG_SEXPR | 2)/* 16 bit signed expression */
|
||||
#define FRAG_SEXPR24 (FRAG_SEXPR | 3)/* 24 bit signed expression */
|
||||
#define FRAG_SEXPR32 (FRAG_SEXPR | 4)/* 32 bit signed expression */
|
||||
|
||||
#define FRAG_FILL 0x20 /* Fill bytes */
|
||||
#define FRAG_FILL 0x20 /* Fill bytes */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ unsigned HashStr (const char* S)
|
||||
/* Do the hash */
|
||||
H = L = 0;
|
||||
while (*S) {
|
||||
H = ((H << 3) ^ ((unsigned char) *S++)) + L++;
|
||||
H = ((H << 3) ^ ((unsigned char) *S++)) + L++;
|
||||
}
|
||||
return H;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ unsigned HashBuf (const StrBuf* S)
|
||||
/* Do the hash */
|
||||
H = L = 0;
|
||||
for (I = 0; I < SB_GetLen (S); ++I) {
|
||||
H = ((H << 3) ^ ((unsigned char) SB_AtUnchecked (S, I))) + L++;
|
||||
H = ((H << 3) ^ ((unsigned char) SB_AtUnchecked (S, I))) + L++;
|
||||
}
|
||||
return H;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* inline.h */
|
||||
/* inline.h */
|
||||
/* */
|
||||
/* Definitions to use the inline compiler feature */
|
||||
/* Definitions to use the inline compiler feature */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -39,14 +39,14 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Defines */
|
||||
/* Defines */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#if defined(__GNUC__) && !defined(DISABLE_INLINE)
|
||||
# define HAVE_INLINE 1
|
||||
# define INLINE static __inline__
|
||||
# define HAVE_INLINE 1
|
||||
# define INLINE static __inline__
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* libdefs.h */
|
||||
/* libdefs.h */
|
||||
/* */
|
||||
/* Library file definitions */
|
||||
/* Library file definitions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -39,27 +39,27 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Defines for magic and version */
|
||||
#define LIB_MAGIC 0x7A55616E
|
||||
#define LIB_VERSION 0x000D
|
||||
#define LIB_MAGIC 0x7A55616E
|
||||
#define LIB_VERSION 0x000D
|
||||
|
||||
/* Size of an library file header */
|
||||
#define LIB_HDR_SIZE 12
|
||||
#define LIB_HDR_SIZE 12
|
||||
|
||||
|
||||
|
||||
/* Header structure for the library */
|
||||
typedef struct LibHeader LibHeader;
|
||||
struct LibHeader {
|
||||
unsigned long Magic; /* 32: Magic number */
|
||||
unsigned Version; /* 16: Version number */
|
||||
unsigned Flags; /* 16: flags */
|
||||
unsigned long IndexOffs; /* 32: Offset to directory */
|
||||
unsigned long Magic; /* 32: Magic number */
|
||||
unsigned Version; /* 16: Version number */
|
||||
unsigned Flags; /* 16: flags */
|
||||
unsigned long IndexOffs; /* 32: Offset to directory */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* lidefs.h */
|
||||
/* lidefs.h */
|
||||
/* */
|
||||
/* Definitions for line information */
|
||||
/* */
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ typedef unsigned char CharSet[32]; /* 256 bits */
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -85,10 +85,10 @@ typedef unsigned char CharSet[32]; /* 256 bits */
|
||||
#define ESCAPE_CHAR '\\'
|
||||
|
||||
/* Utility macro used in RecursiveMatch */
|
||||
#define IncPattern() Pattern++; \
|
||||
if (*Pattern == '\0') { \
|
||||
return 0; \
|
||||
}
|
||||
#define IncPattern() Pattern++; \
|
||||
if (*Pattern == '\0') { \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -98,10 +98,10 @@ static int RealChar (const unsigned char* Pattern)
|
||||
*/
|
||||
{
|
||||
if (*Pattern == ESCAPE_CHAR) {
|
||||
Pattern++;
|
||||
return (*Pattern == '\0') ? -1 : *Pattern;
|
||||
Pattern++;
|
||||
return (*Pattern == '\0') ? -1 : *Pattern;
|
||||
} else {
|
||||
return *Pattern;
|
||||
return *Pattern;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,107 +115,107 @@ static int RecursiveMatch (const unsigned char* Source, const unsigned char* Pat
|
||||
|
||||
while (1) {
|
||||
|
||||
if (*Pattern == '\0') {
|
||||
if (*Pattern == '\0') {
|
||||
|
||||
/* Reached the end of Pattern, what about Source? */
|
||||
return (*Source == '\0') ? 1 : 0;
|
||||
/* Reached the end of Pattern, what about Source? */
|
||||
return (*Source == '\0') ? 1 : 0;
|
||||
|
||||
} else if (*Pattern == '*') {
|
||||
} else if (*Pattern == '*') {
|
||||
|
||||
if (*++Pattern == '\0') {
|
||||
/* A trailing '*' is always a match */
|
||||
return 1;
|
||||
}
|
||||
if (*++Pattern == '\0') {
|
||||
/* A trailing '*' is always a match */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Check the rest of the string */
|
||||
while (*Source) {
|
||||
if (RecursiveMatch (Source++, Pattern)) {
|
||||
/* Match! */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/* Check the rest of the string */
|
||||
while (*Source) {
|
||||
if (RecursiveMatch (Source++, Pattern)) {
|
||||
/* Match! */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* No match... */
|
||||
return 0;
|
||||
/* No match... */
|
||||
return 0;
|
||||
|
||||
} else if (*Source == '\0') {
|
||||
} else if (*Source == '\0') {
|
||||
|
||||
/* End of Source reached, no match */
|
||||
return 0;
|
||||
/* End of Source reached, no match */
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
/* Check a single char. Build a set of all possible characters in
|
||||
* CS, then check if the current char of Source is contained in
|
||||
* there.
|
||||
/* Check a single char. Build a set of all possible characters in
|
||||
* CS, then check if the current char of Source is contained in
|
||||
* there.
|
||||
*/
|
||||
CS_CLEAR (CS); /* Clear the character set */
|
||||
CS_CLEAR (CS); /* Clear the character set */
|
||||
|
||||
if (*Pattern == '?') {
|
||||
if (*Pattern == '?') {
|
||||
|
||||
/* All chars are allowed */
|
||||
CS_SETALL (CS);
|
||||
++Pattern; /* Skip '?' */
|
||||
/* All chars are allowed */
|
||||
CS_SETALL (CS);
|
||||
++Pattern; /* Skip '?' */
|
||||
|
||||
} else if (*Pattern == ESCAPE_CHAR) {
|
||||
} else if (*Pattern == ESCAPE_CHAR) {
|
||||
|
||||
/* Use the next char as is */
|
||||
IncPattern ();
|
||||
CS_ADD (CS, *Pattern);
|
||||
++Pattern; /* Skip the character */
|
||||
/* Use the next char as is */
|
||||
IncPattern ();
|
||||
CS_ADD (CS, *Pattern);
|
||||
++Pattern; /* Skip the character */
|
||||
|
||||
} else if (*Pattern == '[') {
|
||||
} else if (*Pattern == '[') {
|
||||
|
||||
/* A set follows */
|
||||
int Invert = 0;
|
||||
IncPattern ();
|
||||
if (*Pattern == '!') {
|
||||
IncPattern ();
|
||||
Invert = 1;
|
||||
}
|
||||
while (*Pattern != ']') {
|
||||
/* A set follows */
|
||||
int Invert = 0;
|
||||
IncPattern ();
|
||||
if (*Pattern == '!') {
|
||||
IncPattern ();
|
||||
Invert = 1;
|
||||
}
|
||||
while (*Pattern != ']') {
|
||||
|
||||
int C1;
|
||||
if ((C1 = RealChar (Pattern)) == -1) {
|
||||
return 0;
|
||||
}
|
||||
IncPattern ();
|
||||
if (*Pattern != '-') {
|
||||
CS_ADD (CS, C1);
|
||||
} else {
|
||||
int C2;
|
||||
int C1;
|
||||
if ((C1 = RealChar (Pattern)) == -1) {
|
||||
return 0;
|
||||
}
|
||||
IncPattern ();
|
||||
if (*Pattern != '-') {
|
||||
CS_ADD (CS, C1);
|
||||
} else {
|
||||
int C2;
|
||||
unsigned char C;
|
||||
IncPattern ();
|
||||
if ((C2 = RealChar (Pattern)) == -1) {
|
||||
return 0;
|
||||
}
|
||||
IncPattern ();
|
||||
for (C = C1; C <= C2; C++) {
|
||||
CS_ADD (CS, C);
|
||||
}
|
||||
}
|
||||
}
|
||||
IncPattern ();
|
||||
if ((C2 = RealChar (Pattern)) == -1) {
|
||||
return 0;
|
||||
}
|
||||
IncPattern ();
|
||||
for (C = C1; C <= C2; C++) {
|
||||
CS_ADD (CS, C);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Skip ']' */
|
||||
++Pattern;
|
||||
if (Invert) {
|
||||
++Pattern;
|
||||
if (Invert) {
|
||||
/* Reverse all bits in the set */
|
||||
CS_INVERT (CS);
|
||||
}
|
||||
CS_INVERT (CS);
|
||||
}
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
/* Include the char in the charset, then skip it */
|
||||
CS_ADD (CS, *Pattern);
|
||||
++Pattern;
|
||||
/* Include the char in the charset, then skip it */
|
||||
CS_ADD (CS, *Pattern);
|
||||
++Pattern;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!CS_CONTAINS (CS, *Source)) {
|
||||
/* No match */
|
||||
return 0;
|
||||
}
|
||||
++Source;
|
||||
}
|
||||
if (!CS_CONTAINS (CS, *Source)) {
|
||||
/* No match */
|
||||
return 0;
|
||||
}
|
||||
++Source;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ int MatchPattern (const char* Source, const char* Pattern)
|
||||
{
|
||||
/* Handle the trivial cases */
|
||||
if (Pattern == 0 || *Pattern == '\0') {
|
||||
return (Source == 0 || *Source == '\0');
|
||||
return (Source == 0 || *Source == '\0');
|
||||
}
|
||||
|
||||
/* Do the real thing */
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ unsigned char ZpAddrSize = ADDR_SIZE_ZP;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -77,9 +77,9 @@ mmodel_t FindMemoryModel (const char* Name)
|
||||
|
||||
/* Check all CPU names */
|
||||
for (I = 0; I < MMODEL_COUNT; ++I) {
|
||||
if (strcmp (MemoryModelNames[I], Name) == 0) {
|
||||
return (mmodel_t)I;
|
||||
}
|
||||
if (strcmp (MemoryModelNames[I], Name) == 0) {
|
||||
return (mmodel_t)I;
|
||||
}
|
||||
}
|
||||
|
||||
/* Not found */
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ extern unsigned char ZpAddrSize;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* objdefs.h */
|
||||
/* objdefs.h */
|
||||
/* */
|
||||
/* Object file definitions */
|
||||
/* Object file definitions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -39,20 +39,20 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Defines for magic and version */
|
||||
#define OBJ_MAGIC 0x616E7A55
|
||||
#define OBJ_VERSION 0x0011
|
||||
#define OBJ_MAGIC 0x616E7A55
|
||||
#define OBJ_VERSION 0x0011
|
||||
|
||||
/* Size of an object file header */
|
||||
#define OBJ_HDR_SIZE (24*4)
|
||||
#define OBJ_HDR_SIZE (24*4)
|
||||
|
||||
/* Flag bits */
|
||||
#define OBJ_FLAGS_DBGINFO 0x0001 /* File has debug info */
|
||||
#define OBJ_FLAGS_DBGINFO 0x0001 /* File has debug info */
|
||||
#define OBJ_HAS_DBGINFO(x) (((x) & OBJ_FLAGS_DBGINFO) != 0)
|
||||
|
||||
|
||||
@@ -60,21 +60,21 @@
|
||||
/* Header structure */
|
||||
typedef struct ObjHeader ObjHeader;
|
||||
struct ObjHeader {
|
||||
unsigned long Magic; /* 32: Magic number */
|
||||
unsigned Version; /* 16: Version number */
|
||||
unsigned Flags; /* 16: flags */
|
||||
unsigned long OptionOffs; /* 32: Offset to option table */
|
||||
unsigned long OptionSize; /* 32: Size of options */
|
||||
unsigned long FileOffs; /* 32: Offset to file table */
|
||||
unsigned long FileSize; /* 32: Size of files */
|
||||
unsigned long SegOffs; /* 32: Offset to segment table */
|
||||
unsigned long SegSize; /* 32: Size of segment table */
|
||||
unsigned long ImportOffs; /* 32: Offset to import list */
|
||||
unsigned long ImportSize; /* 32: Size of import list */
|
||||
unsigned long ExportOffs; /* 32: Offset to export list */
|
||||
unsigned long ExportSize; /* 32: Size of export list */
|
||||
unsigned long DbgSymOffs; /* 32: Offset to list of debug symbols */
|
||||
unsigned long DbgSymSize; /* 32: Size of debug symbols */
|
||||
unsigned long Magic; /* 32: Magic number */
|
||||
unsigned Version; /* 16: Version number */
|
||||
unsigned Flags; /* 16: flags */
|
||||
unsigned long OptionOffs; /* 32: Offset to option table */
|
||||
unsigned long OptionSize; /* 32: Size of options */
|
||||
unsigned long FileOffs; /* 32: Offset to file table */
|
||||
unsigned long FileSize; /* 32: Size of files */
|
||||
unsigned long SegOffs; /* 32: Offset to segment table */
|
||||
unsigned long SegSize; /* 32: Size of segment table */
|
||||
unsigned long ImportOffs; /* 32: Offset to import list */
|
||||
unsigned long ImportSize; /* 32: Size of import list */
|
||||
unsigned long ExportOffs; /* 32: Offset to export list */
|
||||
unsigned long ExportSize; /* 32: Size of export list */
|
||||
unsigned long DbgSymOffs; /* 32: Offset to list of debug symbols */
|
||||
unsigned long DbgSymSize; /* 32: Size of debug symbols */
|
||||
unsigned long LineInfoOffs; /* 32: Offset to list of line infos */
|
||||
unsigned long LineInfoSize; /* 32: Size of line infos */
|
||||
unsigned long StrPoolOffs; /* 32: Offset to string pool */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* optdefs.h */
|
||||
/* optdefs.h */
|
||||
/* */
|
||||
/* Definitions for object file options */
|
||||
/* Definitions for object file options */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -39,32 +39,32 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Type of options */
|
||||
#define OPT_ARGMASK 0xC0 /* Mask for argument */
|
||||
#define OPT_ARGSTR 0x00 /* String argument */
|
||||
#define OPT_ARGNUM 0x40 /* Numerical argument */
|
||||
#define OPT_ARGMASK 0xC0 /* Mask for argument */
|
||||
#define OPT_ARGSTR 0x00 /* String argument */
|
||||
#define OPT_ARGNUM 0x40 /* Numerical argument */
|
||||
|
||||
#define OPT_COMMENT (OPT_ARGSTR+0) /* Generic comment */
|
||||
#define OPT_AUTHOR (OPT_ARGSTR+1) /* Author specification */
|
||||
#define OPT_TRANSLATOR (OPT_ARGSTR+2) /* Translator specification */
|
||||
#define OPT_COMPILER (OPT_ARGSTR+3) /* Compiler specification */
|
||||
#define OPT_OS (OPT_ARGSTR+4) /* Operating system specification */
|
||||
#define OPT_COMMENT (OPT_ARGSTR+0) /* Generic comment */
|
||||
#define OPT_AUTHOR (OPT_ARGSTR+1) /* Author specification */
|
||||
#define OPT_TRANSLATOR (OPT_ARGSTR+2) /* Translator specification */
|
||||
#define OPT_COMPILER (OPT_ARGSTR+3) /* Compiler specification */
|
||||
#define OPT_OS (OPT_ARGSTR+4) /* Operating system specification */
|
||||
|
||||
#define OPT_DATETIME (OPT_ARGNUM+0) /* Date/time of translation */
|
||||
#define OPT_DATETIME (OPT_ARGNUM+0) /* Date/time of translation */
|
||||
|
||||
|
||||
|
||||
/* Structure to encode options */
|
||||
typedef struct Option Option;
|
||||
struct Option {
|
||||
Option* Next; /* For list of options */
|
||||
unsigned char Type; /* Type of option */
|
||||
unsigned long Val; /* Value attribute or string index */
|
||||
Option* Next; /* For list of options */
|
||||
unsigned char Type; /* Type of option */
|
||||
unsigned long Val; /* Value attribute or string index */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* print.c */
|
||||
/* print.c */
|
||||
/* */
|
||||
/* Program output */
|
||||
/* Program output */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2001 Ullrich von Bassewitz */
|
||||
/* (C) 2001 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
@@ -41,17 +41,17 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
unsigned char Verbosity = 0; /* Verbose operation flag */
|
||||
unsigned char Verbosity = 0; /* Verbose operation flag */
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ void Print (FILE* F, unsigned V, const char* Format, ...)
|
||||
|
||||
/* Check the verbosity */
|
||||
if (V > Verbosity) {
|
||||
/* Don't output this message */
|
||||
return;
|
||||
/* Don't output this message */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* print.h */
|
||||
/* print.h */
|
||||
/* */
|
||||
/* Program output */
|
||||
/* Program output */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2001 Ullrich von Bassewitz */
|
||||
/* (C) 2001 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
@@ -46,23 +46,23 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
extern unsigned char Verbosity; /* Verbose operation flag */
|
||||
extern unsigned char Verbosity; /* Verbose operation flag */
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
void Print (FILE* F, unsigned V, const char* Format, ...)
|
||||
attribute ((format (printf, 3, 4)));
|
||||
attribute ((format (printf, 3, 4)));
|
||||
/* Output according to Verbosity */
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* symdefs.h */
|
||||
/* symdefs.h */
|
||||
/* */
|
||||
/* Scope definitions for the bin65 binary utils */
|
||||
/* */
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ static char* CleanupPath (const char* Path)
|
||||
|
||||
/* Check for a trailing path separator and remove it */
|
||||
if (Len > 0 && (Path[Len-1] == '\\' || Path[Len-1] == '/')) {
|
||||
--Len;
|
||||
--Len;
|
||||
}
|
||||
|
||||
/* Allocate memory for the new string */
|
||||
@@ -130,8 +130,8 @@ void AddSubSearchPathFromEnv (SearchPath* P, const char* EnvVar, const char* Sub
|
||||
|
||||
const char* EnvVal = getenv (EnvVar);
|
||||
if (EnvVal == 0) {
|
||||
/* Not found */
|
||||
return;
|
||||
/* Not found */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Copy the environment variable to the buffer */
|
||||
@@ -139,9 +139,9 @@ void AddSubSearchPathFromEnv (SearchPath* P, const char* EnvVar, const char* Sub
|
||||
|
||||
/* Add a path separator if necessary */
|
||||
if (SB_NotEmpty (&Dir)) {
|
||||
if (SB_LookAtLast (&Dir) != '\\' && SB_LookAtLast (&Dir) != '/') {
|
||||
SB_AppendChar (&Dir, '/');
|
||||
}
|
||||
if (SB_LookAtLast (&Dir) != '\\' && SB_LookAtLast (&Dir) != '/') {
|
||||
SB_AppendChar (&Dir, '/');
|
||||
}
|
||||
}
|
||||
|
||||
/* Add the subdirectory and terminate the string */
|
||||
@@ -252,19 +252,19 @@ char* SearchFile (const SearchPath* P, const char* File)
|
||||
/* Copy the next path element into the buffer */
|
||||
SB_CopyStr (&PathName, CollConstAt (P, I));
|
||||
|
||||
/* Add a path separator and the filename */
|
||||
if (SB_NotEmpty (&PathName)) {
|
||||
SB_AppendChar (&PathName, '/');
|
||||
}
|
||||
SB_AppendStr (&PathName, File);
|
||||
SB_Terminate (&PathName);
|
||||
/* Add a path separator and the filename */
|
||||
if (SB_NotEmpty (&PathName)) {
|
||||
SB_AppendChar (&PathName, '/');
|
||||
}
|
||||
SB_AppendStr (&PathName, File);
|
||||
SB_Terminate (&PathName);
|
||||
|
||||
/* Check if this file exists */
|
||||
if (access (SB_GetBuf (&PathName), 0) == 0) {
|
||||
/* The file exists, we're done */
|
||||
Name = xstrdup (SB_GetBuf (&PathName));
|
||||
/* Check if this file exists */
|
||||
if (access (SB_GetBuf (&PathName), 0) == 0) {
|
||||
/* The file exists, we're done */
|
||||
Name = xstrdup (SB_GetBuf (&PathName));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Cleanup and return the result of the search */
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ typedef struct Collection SearchPath;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* segdefs.h */
|
||||
/* segdefs.h */
|
||||
/* */
|
||||
/* Constants and flags for segments */
|
||||
/* */
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -52,14 +52,14 @@ int ValidSegName (const char* Name)
|
||||
{
|
||||
/* Must start with '_' or a letter */
|
||||
if ((*Name != '_' && !IsAlpha(*Name)) || strlen(Name) > 80) {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Can have letters, digits or the underline */
|
||||
while (*++Name) {
|
||||
if (*Name != '_' && !IsAlNum(*Name)) {
|
||||
return 0;
|
||||
}
|
||||
if (*Name != '_' && !IsAlNum(*Name)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Name is ok */
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* strbuf.c */
|
||||
/* strbuf.c */
|
||||
/* */
|
||||
/* Variable sized string buffers */
|
||||
/* Variable sized string buffers */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ const StrBuf EmptyStrBuf = STATIC_STRBUF_INITIALIZER;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -132,12 +132,12 @@ void SB_Realloc (StrBuf* B, unsigned NewSize)
|
||||
/* Get the current size, use a minimum of 8 bytes */
|
||||
unsigned NewAllocated = B->Allocated;
|
||||
if (NewAllocated == 0) {
|
||||
NewAllocated = 8;
|
||||
NewAllocated = 8;
|
||||
}
|
||||
|
||||
/* Round up to the next power of two */
|
||||
while (NewAllocated < NewSize) {
|
||||
NewAllocated *= 2;
|
||||
NewAllocated *= 2;
|
||||
}
|
||||
|
||||
/* Reallocate the buffer. Beware: The allocated size may be zero while the
|
||||
@@ -167,12 +167,12 @@ static void SB_CheapRealloc (StrBuf* B, unsigned NewSize)
|
||||
/* Get the current size, use a minimum of 8 bytes */
|
||||
unsigned NewAllocated = B->Allocated;
|
||||
if (NewAllocated == 0) {
|
||||
NewAllocated = 8;
|
||||
NewAllocated = 8;
|
||||
}
|
||||
|
||||
/* Round up to the next power of two */
|
||||
while (NewAllocated < NewSize) {
|
||||
NewAllocated *= 2;
|
||||
NewAllocated *= 2;
|
||||
}
|
||||
|
||||
/* Free the old buffer if there is one */
|
||||
@@ -219,7 +219,7 @@ void SB_Terminate (StrBuf* B)
|
||||
{
|
||||
unsigned NewLen = B->Len + 1;
|
||||
if (NewLen > B->Allocated) {
|
||||
SB_Realloc (B, NewLen);
|
||||
SB_Realloc (B, NewLen);
|
||||
}
|
||||
B->Buf[B->Len] = '\0';
|
||||
}
|
||||
@@ -266,7 +266,7 @@ void SB_AppendChar (StrBuf* B, int C)
|
||||
{
|
||||
unsigned NewLen = B->Len + 1;
|
||||
if (NewLen > B->Allocated) {
|
||||
SB_Realloc (B, NewLen);
|
||||
SB_Realloc (B, NewLen);
|
||||
}
|
||||
B->Buf[B->Len] = (char) C;
|
||||
B->Len = NewLen;
|
||||
@@ -279,7 +279,7 @@ void SB_AppendBuf (StrBuf* B, const char* S, unsigned Size)
|
||||
{
|
||||
unsigned NewLen = B->Len + Size;
|
||||
if (NewLen > B->Allocated) {
|
||||
SB_Realloc (B, NewLen);
|
||||
SB_Realloc (B, NewLen);
|
||||
}
|
||||
memcpy (B->Buf + B->Len, S, Size);
|
||||
B->Len = NewLen;
|
||||
@@ -314,7 +314,7 @@ void SB_Cut (StrBuf* B, unsigned Len)
|
||||
*/
|
||||
{
|
||||
if (Len < B->Len) {
|
||||
B->Len = Len;
|
||||
B->Len = Len;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -330,17 +330,17 @@ void SB_Slice (StrBuf* Target, const StrBuf* Source, unsigned Start, unsigned Le
|
||||
{
|
||||
/* Calculate the length of the resulting buffer */
|
||||
if (Start >= Source->Len) {
|
||||
/* Target will be empty */
|
||||
SB_Clear (Target);
|
||||
return;
|
||||
/* Target will be empty */
|
||||
SB_Clear (Target);
|
||||
return;
|
||||
}
|
||||
if (Start + Len > Source->Len) {
|
||||
Len = Source->Len - Start;
|
||||
Len = Source->Len - Start;
|
||||
}
|
||||
|
||||
/* Make sure we have enough room in the target string buffer */
|
||||
if (Len > Target->Allocated) {
|
||||
SB_Realloc (Target, Len);
|
||||
SB_Realloc (Target, Len);
|
||||
}
|
||||
|
||||
/* Copy the slice */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* strbuf.h */
|
||||
/* strbuf.h */
|
||||
/* */
|
||||
/* Variable sized string buffers */
|
||||
/* Variable sized string buffers */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ struct StrBuf {
|
||||
extern const StrBuf EmptyStrBuf;
|
||||
|
||||
/* Initializer for static string bufs */
|
||||
#define STATIC_STRBUF_INITIALIZER { 0, 0, 0, 0 }
|
||||
#define STATIC_STRBUF_INITIALIZER { 0, 0, 0, 0 }
|
||||
|
||||
/* Initializer for auto string bufs */
|
||||
#define AUTO_STRBUF_INITIALIZER { 0, 0, 0, 0 }
|
||||
@@ -77,7 +77,7 @@ extern const StrBuf EmptyStrBuf;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -368,7 +368,7 @@ INLINE void SB_Cut (StrBuf* B, unsigned Len)
|
||||
*/
|
||||
{
|
||||
if (Len < B->Len) {
|
||||
B->Len = Len;
|
||||
B->Len = Len;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* strutil.h */
|
||||
/* strutil.h */
|
||||
/* */
|
||||
/* String utility functions */
|
||||
/* String utility functions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -56,9 +56,9 @@ char* StrCopy (char* Dest, size_t DestSize, const char* Source)
|
||||
size_t Len = strlen (Source);
|
||||
if (Len >= DestSize) {
|
||||
memcpy (Dest, Source, DestSize-1);
|
||||
Dest[DestSize-1] = '\0';
|
||||
Dest[DestSize-1] = '\0';
|
||||
} else {
|
||||
memcpy (Dest, Source, Len+1);
|
||||
memcpy (Dest, Source, Len+1);
|
||||
}
|
||||
return Dest;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* strutil.h */
|
||||
/* strutil.h */
|
||||
/* */
|
||||
/* String utility functions */
|
||||
/* String utility functions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* symdefs.h */
|
||||
/* symdefs.h */
|
||||
/* */
|
||||
/* Symbol definitions for the bin65 binary utils */
|
||||
/* Symbol definitions for the bin65 binary utils */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -43,15 +43,15 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Number of module constructor/destructor declarations for an export */
|
||||
#define SYM_CONDES_MASK 0x0007U
|
||||
#define SYM_CONDES_MASK 0x0007U
|
||||
|
||||
#define SYM_IS_CONDES(x) (((x) & SYM_CONDES_MASK) != 0)
|
||||
#define SYM_IS_CONDES(x) (((x) & SYM_CONDES_MASK) != 0)
|
||||
#define SYM_GET_CONDES_COUNT(x) ((x) & SYM_CONDES_MASK)
|
||||
#define SYM_INC_CONDES_COUNT(x) ((x)++)
|
||||
|
||||
@@ -63,12 +63,12 @@
|
||||
#define SYM_HAS_SIZE(x) (((x) & SYM_MASK_SIZE) == SYM_SIZE)
|
||||
|
||||
/* Symbol value type */
|
||||
#define SYM_CONST 0x0000U /* Mask bit for const values */
|
||||
#define SYM_EXPR 0x0010U /* Mask bit for expr values */
|
||||
#define SYM_MASK_VAL 0x0010U /* Value mask */
|
||||
#define SYM_CONST 0x0000U /* Mask bit for const values */
|
||||
#define SYM_EXPR 0x0010U /* Mask bit for expr values */
|
||||
#define SYM_MASK_VAL 0x0010U /* Value mask */
|
||||
|
||||
#define SYM_IS_CONST(x) (((x) & SYM_MASK_VAL) == SYM_CONST)
|
||||
#define SYM_IS_EXPR(x) (((x) & SYM_MASK_VAL) == SYM_EXPR)
|
||||
#define SYM_IS_CONST(x) (((x) & SYM_MASK_VAL) == SYM_CONST)
|
||||
#define SYM_IS_EXPR(x) (((x) & SYM_MASK_VAL) == SYM_EXPR)
|
||||
|
||||
/* Symbol usage */
|
||||
#define SYM_EQUATE 0x0000U /* Mask bit for an equate */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* target.c */
|
||||
/* target.c */
|
||||
/* */
|
||||
/* Target specification */
|
||||
/* Target specification */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -175,12 +175,12 @@ static const TargetProperties PropertyTable[TGT_COUNT] = {
|
||||
};
|
||||
|
||||
/* Target system */
|
||||
target_t Target = TGT_NONE;
|
||||
target_t Target = TGT_NONE;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* target.h */
|
||||
/* target.h */
|
||||
/* */
|
||||
/* Target specification */
|
||||
/* Target specification */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -44,14 +44,14 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Supported target systems */
|
||||
typedef enum {
|
||||
TGT_UNKNOWN = -1, /* Not specified or invalid target */
|
||||
TGT_UNKNOWN = -1, /* Not specified or invalid target */
|
||||
TGT_NONE,
|
||||
TGT_MODULE,
|
||||
TGT_ATARI,
|
||||
@@ -73,7 +73,7 @@ typedef enum {
|
||||
TGT_NES,
|
||||
TGT_SUPERVISION,
|
||||
TGT_LYNX,
|
||||
TGT_COUNT /* Number of target systems */
|
||||
TGT_COUNT /* Number of target systems */
|
||||
} target_t;
|
||||
|
||||
/* Collection of target properties */
|
||||
@@ -86,17 +86,17 @@ struct TargetProperties {
|
||||
};
|
||||
|
||||
/* Target system */
|
||||
extern target_t Target;
|
||||
extern target_t Target;
|
||||
|
||||
/* Types of available output formats */
|
||||
#define BINFMT_DEFAULT 0 /* Default (binary) */
|
||||
#define BINFMT_BINARY 1 /* Straight binary format */
|
||||
#define BINFMT_O65 2 /* Andre Fachats o65 format */
|
||||
#define BINFMT_DEFAULT 0 /* Default (binary) */
|
||||
#define BINFMT_BINARY 1 /* Straight binary format */
|
||||
#define BINFMT_O65 2 /* Andre Fachats o65 format */
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* tgttrans.c */
|
||||
/* tgttrans.c */
|
||||
/* */
|
||||
/* Character set translation */
|
||||
/* Character set translation */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ static unsigned char Tab[256] = {
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -104,8 +104,8 @@ void TgtTranslateBuf (void* Buf, unsigned Len)
|
||||
/* Translate */
|
||||
unsigned char* B = (unsigned char*)Buf;
|
||||
while (Len--) {
|
||||
*B = Tab[*B];
|
||||
++B;
|
||||
*B = Tab[*B];
|
||||
++B;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* tgttrans.h */
|
||||
/* tgttrans.h */
|
||||
/* */
|
||||
/* Character set translation */
|
||||
/* Character set translation */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* version.c */
|
||||
/* */
|
||||
/* Version information for the cc65 compiler package */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* version.c */
|
||||
/* */
|
||||
/* Version information for the cc65 compiler package */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2009, Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
/* */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* */
|
||||
/* 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: */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* 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. */
|
||||
/* */
|
||||
/* be misrepresented as being the original software. */
|
||||
/* 3. This notice may not be removed or altered from any source */
|
||||
/* distribution. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#define VER_MAJOR 2U
|
||||
#define VER_MINOR 13U
|
||||
#define VER_MAJOR 2U
|
||||
#define VER_MINOR 13U
|
||||
#define VER_PATCH 9U
|
||||
#define VER_RC 0U
|
||||
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* version.h */
|
||||
/* */
|
||||
/* Version information for the cc65 compiler package */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* version.h */
|
||||
/* */
|
||||
/* Version information for the cc65 compiler package */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2009, Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
/* */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* */
|
||||
/* 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: */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* 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. */
|
||||
/* */
|
||||
/* be misrepresented as being the original software. */
|
||||
/* 3. This notice may not be removed or altered from any source */
|
||||
/* distribution. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* xmalloc.c */
|
||||
/* */
|
||||
/* Memory allocation subroutines */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* xmalloc.c */
|
||||
/* */
|
||||
/* Memory allocation subroutines */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2000-2006 Ullrich von Bassewitz */
|
||||
/* R<>merstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
/* */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* */
|
||||
/* 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: */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* 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. */
|
||||
/* */
|
||||
/* be misrepresented as being the original software. */
|
||||
/* 3. This notice may not be removed or altered from any source */
|
||||
/* distribution. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* code */
|
||||
/* code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ void* xrealloc (void* P, size_t Size)
|
||||
|
||||
/* Check for errors */
|
||||
if (N == 0 && Size != 0) {
|
||||
AbEnd ("Out of memory in realloc - requested block size = %lu", (unsigned long) Size);
|
||||
AbEnd ("Out of memory in realloc - requested block size = %lu", (unsigned long) Size);
|
||||
}
|
||||
|
||||
/* Return the pointer to the new block */
|
||||
@@ -104,16 +104,16 @@ char* xstrdup (const char* S)
|
||||
/* Allow dup'ing of NULL strings */
|
||||
if (S) {
|
||||
|
||||
/* Get the length of the string */
|
||||
unsigned Len = strlen (S) + 1;
|
||||
/* Get the length of the string */
|
||||
unsigned Len = strlen (S) + 1;
|
||||
|
||||
/* Allocate memory and return a copy */
|
||||
return memcpy (xmalloc (Len), S, Len);
|
||||
/* Allocate memory and return a copy */
|
||||
return memcpy (xmalloc (Len), S, Len);
|
||||
|
||||
} else {
|
||||
|
||||
/* Return a NULL pointer */
|
||||
return 0;
|
||||
/* Return a NULL pointer */
|
||||
return 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* xmalloc.h */
|
||||
/* xmalloc.h */
|
||||
/* */
|
||||
/* Memory allocation subroutines */
|
||||
/* Memory allocation subroutines */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* xsprintf.c */
|
||||
/* xsprintf.c */
|
||||
/* */
|
||||
/* Replacement sprintf function */
|
||||
/* Replacement sprintf function */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -649,7 +649,7 @@ int xsnprintf (char* Buf, size_t Size, const char* Format, ...)
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* xsprintf.h */
|
||||
/* xsprintf.h */
|
||||
/* */
|
||||
/* Replacement sprintf function */
|
||||
/* Replacement sprintf function */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -58,29 +58,29 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
int xvsnprintf (char* Buf, size_t Size, const char* Format, va_list ap)
|
||||
attribute ((format (printf, 3, 0)));
|
||||
attribute ((format (printf, 3, 0)));
|
||||
/* A basic vsnprintf implementation. Does currently only support integer
|
||||
* formats.
|
||||
*/
|
||||
|
||||
int xsnprintf (char* Buf, size_t Size, const char* Format, ...)
|
||||
attribute ((format (printf, 3, 4)));
|
||||
attribute ((format (printf, 3, 4)));
|
||||
/* A basic snprintf implementation. Does currently only support integer
|
||||
* formats.
|
||||
*/
|
||||
|
||||
int xsprintf (char* Buf, size_t BufSize, const char* Format, ...)
|
||||
attribute ((format (printf, 3, 4)));
|
||||
attribute ((format (printf, 3, 4)));
|
||||
/* Replacement function for sprintf. Will FAIL on errors. */
|
||||
|
||||
int xvsprintf (char* Buf, size_t BufSize, const char* Format, va_list ap)
|
||||
attribute ((format (printf, 3, 0)));
|
||||
attribute ((format (printf, 3, 0)));
|
||||
/* Replacement function for sprintf. Will FAIL on errors. */
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user