Merge https://github.com/cc65/cc65 into c1p
This commit is contained in:
@@ -50,8 +50,8 @@
|
||||
|
||||
void AbEnd (const char* Format, ...)
|
||||
/* Print a message preceeded by the program name and terminate the program
|
||||
* with an error exit code.
|
||||
*/
|
||||
** with an error exit code.
|
||||
*/
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -69,6 +69,3 @@ void AbEnd (const char* Format, ...)
|
||||
/* Terminate the program */
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -50,14 +50,11 @@
|
||||
|
||||
void AbEnd (const char* Format, ...) attribute ((format (printf, 1, 2), noreturn));
|
||||
/* Print a message preceeded by the program name and terminate the program
|
||||
* with an error exit code.
|
||||
*/
|
||||
** with an error exit code.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of abend.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -62,8 +62,8 @@ const char* AddrSizeToStr (unsigned char AddrSize)
|
||||
|
||||
unsigned char AddrSizeFromStr (const char* Str)
|
||||
/* Return the address size for a given string. Returns ADDR_SIZE_INVALID if
|
||||
* the string cannot be mapped to an address size.
|
||||
*/
|
||||
** the string cannot be mapped to an address size.
|
||||
*/
|
||||
{
|
||||
static const struct {
|
||||
const char* Name;
|
||||
@@ -92,6 +92,3 @@ unsigned char AddrSizeFromStr (const char* Str)
|
||||
/* Not found */
|
||||
return ADDR_SIZE_INVALID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -64,14 +64,11 @@ const char* AddrSizeToStr (unsigned char AddrSize);
|
||||
|
||||
unsigned char AddrSizeFromStr (const char* Str);
|
||||
/* Return the address size for a given string. Returns ADDR_SIZE_INVALID if
|
||||
* the string cannot be mapped to an address size.
|
||||
*/
|
||||
** the string cannot be mapped to an address size.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of addrsize.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
|
||||
|
||||
/* To factorize an alignment, we will use the following prime table. It lists
|
||||
* all primes up to 256, which means we're able to factorize alignments up to
|
||||
* 0x10000. This is checked in the code.
|
||||
*/
|
||||
** all primes up to 256, which means we're able to factorize alignments up to
|
||||
** 0x10000. This is checked in the code.
|
||||
*/
|
||||
static const unsigned char Primes[] = {
|
||||
2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
|
||||
31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
|
||||
@@ -138,8 +138,8 @@ static void Factorize (unsigned long Value, FactorizedNumber* F)
|
||||
|
||||
unsigned long LeastCommonMultiple (unsigned long Left, unsigned long Right)
|
||||
/* Calculate the least common multiple of two numbers and return
|
||||
* the result.
|
||||
*/
|
||||
** the result.
|
||||
*/
|
||||
{
|
||||
unsigned I;
|
||||
FactorizedNumber L, R;
|
||||
@@ -150,11 +150,11 @@ unsigned long LeastCommonMultiple (unsigned long Left, unsigned long Right)
|
||||
Factorize (Right, &R);
|
||||
|
||||
/* Generate the result from the factors.
|
||||
* Some thoughts on range problems: Since the largest numbers we can
|
||||
* factorize are 2^16 (0x10000), the only numbers that could produce an
|
||||
* overflow when using 32 bits are exactly these. But the LCM for 2^16
|
||||
* and 2^16 is 2^16 so this will never happen and we're safe.
|
||||
*/
|
||||
** Some thoughts on range problems: Since the largest numbers we can
|
||||
** factorize are 2^16 (0x10000), the only numbers that could produce an
|
||||
** overflow when using 32 bits are exactly these. But the LCM for 2^16
|
||||
** and 2^16 is 2^16 so this will never happen and we're safe.
|
||||
*/
|
||||
Res = L.Remainder * R.Remainder;
|
||||
for (I = 0; I < PRIME_COUNT; ++I) {
|
||||
unsigned P = (L.Powers[I] > R.Powers[I])? L.Powers[I] : R.Powers[I];
|
||||
@@ -182,6 +182,3 @@ unsigned long AlignCount (unsigned long Addr, unsigned long Alignment)
|
||||
{
|
||||
return AlignAddr (Addr, Alignment) - Addr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -50,13 +50,13 @@
|
||||
|
||||
|
||||
/* Maximum possible alignment. Beware: To increase the possible alignment it
|
||||
* is not enough to bump this value. Check the code inside.
|
||||
*/
|
||||
** is not enough to bump this value. Check the code inside.
|
||||
*/
|
||||
#define MAX_ALIGNMENT 0x10000UL
|
||||
|
||||
/* The following value marks what is considered a "large alignment" and worth
|
||||
* a warning if not suppressed.
|
||||
*/
|
||||
** a warning if not suppressed.
|
||||
*/
|
||||
#define LARGE_ALIGNMENT 0x101UL
|
||||
|
||||
|
||||
@@ -69,8 +69,8 @@
|
||||
|
||||
unsigned long LeastCommonMultiple (unsigned long Left, unsigned long Right);
|
||||
/* Calculate the least common multiple of two numbers and return
|
||||
* the result.
|
||||
*/
|
||||
** the result.
|
||||
*/
|
||||
|
||||
unsigned long AlignAddr (unsigned long Addr, unsigned long Alignment);
|
||||
/* Align an address to the given alignment */
|
||||
@@ -83,6 +83,3 @@ unsigned long AlignCount (unsigned long Addr, unsigned long Alignment);
|
||||
/* End of alignment.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -58,6 +58,3 @@ int AssertAtAsmTime (AssertAction A)
|
||||
{
|
||||
return (A & 0x02U) == 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -71,6 +71,3 @@ int AssertAtAsmTime (AssertAction A);
|
||||
/* End of assertion.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -55,6 +55,3 @@
|
||||
/* End of attrib.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -123,6 +123,3 @@ void BitMerge (void* Target, const void* Source, unsigned Size)
|
||||
*T++ |= *S++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -71,6 +71,3 @@ void BitMerge (void* Target, const void* Source, unsigned Size);
|
||||
/* End of bitops.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2000-2004 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstra<EFBFBD>e 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -50,8 +50,8 @@
|
||||
#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.
|
||||
*/
|
||||
** (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 */
|
||||
@@ -63,8 +63,8 @@
|
||||
#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:
|
||||
*/
|
||||
** 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)
|
||||
|
||||
@@ -76,6 +76,3 @@
|
||||
/* End of cddefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2000-2004 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -38,13 +38,13 @@
|
||||
|
||||
|
||||
/* This module contains replacements for functions in ctype.h besides other
|
||||
* functions. There is a problem with using ctype.h directly:
|
||||
* The parameter must have a value of "unsigned char" or EOF.
|
||||
* So on platforms where a char is signed, this may give problems or at
|
||||
* least warnings. The wrapper functions below will have an "char" parameter
|
||||
* but handle it correctly. They will NOT work for EOF, but this is not a
|
||||
* problem, since EOF is always handled separately.
|
||||
*/
|
||||
** functions. There is a problem with using ctype.h directly:
|
||||
** The parameter must have a value of "unsigned char" or EOF.
|
||||
** So on platforms where a char is signed, this may give problems or at
|
||||
** least warnings. The wrapper functions below will have an "char" parameter
|
||||
** but handle it correctly. They will NOT work for EOF, but this is not a
|
||||
** problem, since EOF is always handled separately.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -147,6 +147,3 @@ int IsQuote (char C)
|
||||
{
|
||||
return (C == '"' || C == '\'');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2000-2004 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -45,13 +45,13 @@
|
||||
|
||||
|
||||
/* This module contains replacements for functions in ctype.h besides other
|
||||
* functions. There is a problem with using ctype.h directly:
|
||||
* The parameter must have a value of "unsigned char" or EOF.
|
||||
* So on platforms where a char is signed, this may give problems or at
|
||||
* least warnings. The wrapper functions below will have an "char" parameter
|
||||
* but handle it correctly. They will NOT work for EOF, but this is not a
|
||||
* problem, since EOF is always handled separately.
|
||||
*/
|
||||
** functions. There is a problem with using ctype.h directly:
|
||||
** The parameter must have a value of "unsigned char" or EOF.
|
||||
** So on platforms where a char is signed, this may give problems or at
|
||||
** least warnings. The wrapper functions below will have an "char" parameter
|
||||
** but handle it correctly. They will NOT work for EOF, but this is not a
|
||||
** problem, since EOF is always handled separately.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -112,6 +112,3 @@ int IsQuote (char C);
|
||||
/* End of chartype.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -77,6 +77,3 @@ static void DefaultCheckFailed (const char* Msg, const char* Cond,
|
||||
/* Output a diagnostic and abort */
|
||||
AbEnd ("%s%s, file `%s', line %u", Msg, Cond, File, Line);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -73,9 +73,9 @@ extern void (*CheckFailed) (const char* Msg, const char* Cond,
|
||||
|
||||
#define ABORT(s) CheckFailed (MsgProgramAborted, s, __FILE__, __LINE__)
|
||||
/* Use this one instead of FAIL if there is no internal program error but an
|
||||
* error condition that is caused by the user or operating system (FAIL and
|
||||
* ABORT are essentially the same but the message differs).
|
||||
*/
|
||||
** error condition that is caused by the user or operating system (FAIL and
|
||||
** ABORT are essentially the same but the message differs).
|
||||
*/
|
||||
|
||||
#define PRECONDITION(c) \
|
||||
((void) ((c)? 0 : (CheckFailed (MsgPrecondition, #c, __FILE__, __LINE__), 0)))
|
||||
@@ -86,7 +86,5 @@ extern void (*CheckFailed) (const char* Msg, const char* Cond,
|
||||
|
||||
|
||||
/* End of check.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -106,8 +106,8 @@ static void AddArg (CmdLine* L, char* Arg)
|
||||
|
||||
static void ExpandFile (CmdLine* L, const char* Name)
|
||||
/* Add the contents of a file to the command line. Each line is a separate
|
||||
* argument with leading and trailing whitespace removed.
|
||||
*/
|
||||
** argument with leading and trailing whitespace removed.
|
||||
*/
|
||||
{
|
||||
char Buf [256];
|
||||
|
||||
@@ -124,8 +124,8 @@ static void ExpandFile (CmdLine* L, const char* Name)
|
||||
const char* B = Buf;
|
||||
|
||||
/* Skip trailing whitespace (this will also kill the newline that is
|
||||
* appended by fgets().
|
||||
*/
|
||||
** appended by fgets().
|
||||
*/
|
||||
unsigned Len = strlen (Buf);
|
||||
while (Len > 0 && IsSpace (Buf [Len-1])) {
|
||||
--Len;
|
||||
@@ -148,8 +148,8 @@ static void ExpandFile (CmdLine* L, const char* Name)
|
||||
}
|
||||
|
||||
/* Close the file, ignore errors here since we had the file open for
|
||||
* reading only.
|
||||
*/
|
||||
** reading only.
|
||||
*/
|
||||
(void) fclose (F);
|
||||
}
|
||||
|
||||
@@ -163,9 +163,9 @@ static void ExpandFile (CmdLine* L, const char* Name)
|
||||
|
||||
void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
|
||||
/* Initialize command line parsing. aArgVec is the argument array terminated by
|
||||
* a NULL pointer (as usual), ArgCount is the number of valid arguments in the
|
||||
* array. Both arguments are remembered in static storage.
|
||||
*/
|
||||
** a NULL pointer (as usual), ArgCount is the number of valid arguments in the
|
||||
** array. Both arguments are remembered in static storage.
|
||||
*/
|
||||
{
|
||||
CmdLine L;
|
||||
int I;
|
||||
@@ -187,9 +187,9 @@ void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
|
||||
NewCmdLine (&L);
|
||||
|
||||
/* Walk over the parameters and add them to the CmdLine struct. Add a
|
||||
* special handling for arguments preceeded by the '@' sign - these are
|
||||
* actually files containing arguments.
|
||||
*/
|
||||
** special handling for arguments preceeded by the '@' sign - these are
|
||||
** actually files containing arguments.
|
||||
*/
|
||||
for (I = 0; I < *aArgCount; ++I) {
|
||||
|
||||
/* Get the next argument */
|
||||
@@ -254,8 +254,8 @@ void InvDef (const char* Def)
|
||||
|
||||
const char* GetArg (unsigned* ArgNum, unsigned Len)
|
||||
/* Get an argument for a short option. The argument may be appended to the
|
||||
* option itself or may be separate. Len is the length of the option string.
|
||||
*/
|
||||
** option itself or may be separate. Len is the length of the option string.
|
||||
*/
|
||||
{
|
||||
const char* Arg = ArgVec[*ArgNum];
|
||||
if (Arg[Len] != '\0') {
|
||||
@@ -307,7 +307,3 @@ void LongOption (unsigned* ArgNum, const LongOpt* OptTab, unsigned OptCount)
|
||||
/* Invalid option */
|
||||
UnknownOption (Opt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -73,9 +73,9 @@ struct LongOpt {
|
||||
|
||||
void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName);
|
||||
/* Initialize command line parsing. aArgVec is the argument array terminated by
|
||||
* a NULL pointer (as usual), ArgCount is the number of valid arguments in the
|
||||
* array. Both arguments are remembered in static storage.
|
||||
*/
|
||||
** a NULL pointer (as usual), ArgCount is the number of valid arguments in the
|
||||
** array. Both arguments are remembered in static storage.
|
||||
*/
|
||||
|
||||
void UnknownOption (const char* Opt) attribute ((noreturn));
|
||||
/* Print an error about an unknown option and die. */
|
||||
@@ -91,8 +91,8 @@ void InvDef (const char* Def) attribute ((noreturn));
|
||||
|
||||
const char* GetArg (unsigned* ArgNum, unsigned Len);
|
||||
/* Get an argument for a short option. The argument may be appended to the
|
||||
* option itself or may be separate. Len is the length of the option string.
|
||||
*/
|
||||
** option itself or may be separate. Len is the length of the option string.
|
||||
*/
|
||||
|
||||
void LongOption (unsigned* ArgNum, const LongOpt* OptTab, unsigned OptCount);
|
||||
/* Handle a long command line option */
|
||||
@@ -102,6 +102,3 @@ void LongOption (unsigned* ArgNum, const LongOpt* OptTab, unsigned OptCount);
|
||||
/* End of cmdline.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ Collection* InitCollection (Collection* C)
|
||||
|
||||
void DoneCollection (Collection* C)
|
||||
/* Free the data for a collection. This will not free the data contained in
|
||||
* the collection.
|
||||
*/
|
||||
** the collection.
|
||||
*/
|
||||
{
|
||||
/* Free the pointer array */
|
||||
xfree (C->Items);
|
||||
@@ -110,9 +110,9 @@ void FreeCollection (Collection* C)
|
||||
|
||||
void CollGrow (Collection* C, unsigned Size)
|
||||
/* Grow the collection C so it is able to hold Size items without a resize
|
||||
* being necessary. This can be called for performance reasons if the number
|
||||
* of items to be placed in the collection is known in advance.
|
||||
*/
|
||||
** being necessary. This can be called for performance reasons if the number
|
||||
** of items to be placed in the collection is known in advance.
|
||||
*/
|
||||
{
|
||||
void** NewItems;
|
||||
|
||||
@@ -225,8 +225,8 @@ const void* CollConstLast (const Collection* C)
|
||||
#if !defined(HAVE_INLINE)
|
||||
void* CollPop (Collection* C)
|
||||
/* Remove the last segment from the stack and return it. Calls FAIL if the
|
||||
* collection is empty.
|
||||
*/
|
||||
** collection is empty.
|
||||
*/
|
||||
{
|
||||
/* We must have at least one entry */
|
||||
PRECONDITION (C->Count > 0);
|
||||
@@ -240,8 +240,8 @@ void* CollPop (Collection* C)
|
||||
|
||||
int CollIndex (Collection* C, const void* Item)
|
||||
/* Return the index of the given item in the collection. Return -1 if the
|
||||
* item was not found in the collection.
|
||||
*/
|
||||
** item was not found in the collection.
|
||||
*/
|
||||
{
|
||||
/* Linear search */
|
||||
unsigned I;
|
||||
@@ -260,9 +260,9 @@ int CollIndex (Collection* C, const void* Item)
|
||||
|
||||
void CollDelete (Collection* C, unsigned Index)
|
||||
/* Remove the item with the given index from the collection. This will not
|
||||
* free the item itself, just the pointer. All items with higher indices
|
||||
* will get moved to a lower position.
|
||||
*/
|
||||
** free the item itself, just the pointer. All items with higher indices
|
||||
** will get moved to a lower position.
|
||||
*/
|
||||
{
|
||||
/* Check the index */
|
||||
PRECONDITION (Index < C->Count);
|
||||
@@ -276,8 +276,8 @@ void CollDelete (Collection* C, unsigned Index)
|
||||
|
||||
void CollDeleteItem (Collection* C, const void* Item)
|
||||
/* Delete the item pointer from the collection. The item must be in the
|
||||
* collection, otherwise FAIL will be called.
|
||||
*/
|
||||
** collection, otherwise FAIL will be called.
|
||||
*/
|
||||
{
|
||||
/* Get the index of the entry */
|
||||
int Index = CollIndex (C, Item);
|
||||
@@ -293,8 +293,8 @@ void CollDeleteItem (Collection* C, const void* Item)
|
||||
#if !defined(HAVE_INLINE)
|
||||
void CollReplace (Collection* C, void* Item, unsigned Index)
|
||||
/* Replace the item at the given position. The old item will not be freed,
|
||||
* just the pointer will get replaced.
|
||||
*/
|
||||
** just the pointer will get replaced.
|
||||
*/
|
||||
{
|
||||
/* Check the index */
|
||||
PRECONDITION (Index < C->Count);
|
||||
@@ -308,10 +308,10 @@ void CollReplace (Collection* C, void* Item, unsigned Index)
|
||||
|
||||
void CollReplaceExpand (Collection* C, void* Item, unsigned Index)
|
||||
/* If Index is a valid index for the collection, replace the item at this
|
||||
* position by the one passed. If the collection is too small, expand it,
|
||||
* filling unused pointers with NULL, then add the new item at the given
|
||||
* position.
|
||||
*/
|
||||
** position by the one passed. If the collection is too small, expand it,
|
||||
** filling unused pointers with NULL, then add the new item at the given
|
||||
** position.
|
||||
*/
|
||||
{
|
||||
if (Index < C->Count) {
|
||||
/* Collection is already large enough */
|
||||
@@ -341,10 +341,10 @@ void CollReplaceExpand (Collection* C, void* Item, unsigned Index)
|
||||
|
||||
void CollMove (Collection* C, unsigned OldIndex, unsigned NewIndex)
|
||||
/* Move an item from one position in the collection to another. OldIndex
|
||||
* is the current position of the item, NewIndex is the new index after
|
||||
* the function has done it's work. Existing entries with indices NewIndex
|
||||
* and up are moved one position upwards.
|
||||
*/
|
||||
** is the current position of the item, NewIndex is the new index after
|
||||
** the function has done it's work. Existing entries with indices NewIndex
|
||||
** and up are moved one position upwards.
|
||||
*/
|
||||
{
|
||||
/* Get the item and remove it from the collection */
|
||||
void* Item = CollAt (C, OldIndex);
|
||||
@@ -364,11 +364,11 @@ void CollMove (Collection* C, unsigned OldIndex, unsigned NewIndex)
|
||||
|
||||
void CollMoveMultiple (Collection* C, unsigned Start, unsigned Count, unsigned Target)
|
||||
/* Move a range of items from one position to another. Start is the index
|
||||
* of the first item to move, Count is the number of items and Target is
|
||||
* the index of the target item. The item with the index Start will later
|
||||
* have the index Target. All items with indices Target and above are moved
|
||||
* to higher indices.
|
||||
*/
|
||||
** of the first item to move, Count is the number of items and Target is
|
||||
** the index of the target item. The item with the index Start will later
|
||||
** have the index Target. All items with indices Target and above are moved
|
||||
** to higher indices.
|
||||
*/
|
||||
{
|
||||
void** TmpItems;
|
||||
unsigned Bytes;
|
||||
@@ -391,9 +391,9 @@ void CollMoveMultiple (Collection* C, unsigned Start, unsigned Count, unsigned T
|
||||
memcpy (TmpItems, C->Items + Start, Bytes);
|
||||
|
||||
/* Check if the range has to be moved upwards or downwards. Move the
|
||||
* existing items to their final location, so that the space needed
|
||||
* for the items now in temporary storage is unoccupied.
|
||||
*/
|
||||
** existing items to their final location, so that the space needed
|
||||
** for the items now in temporary storage is unoccupied.
|
||||
*/
|
||||
if (Target < Start) {
|
||||
|
||||
/* Move downwards */
|
||||
@@ -473,9 +473,9 @@ static void QuickSort (Collection* C, int Lo, int Hi,
|
||||
|
||||
void CollTransfer (Collection* Dest, const Collection* Source)
|
||||
/* Transfer all items from Source to Dest. Anything already in Dest is left
|
||||
* untouched. The items in Source are not changed and are therefore in both
|
||||
* Collections on return.
|
||||
*/
|
||||
** untouched. The items in Source are not changed and are therefore in both
|
||||
** Collections on return.
|
||||
*/
|
||||
{
|
||||
/* Be sure there's enough room in Dest */
|
||||
CollGrow (Dest, Dest->Count + Source->Count);
|
||||
@@ -495,15 +495,12 @@ void CollSort (Collection* C,
|
||||
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
|
||||
* are pointers to objects.
|
||||
*/
|
||||
** 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
|
||||
** are pointers to objects.
|
||||
*/
|
||||
{
|
||||
if (C->Count > 1) {
|
||||
QuickSort (C, 0, C->Count-1, Compare, Data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -81,8 +81,8 @@ Collection* InitCollection (Collection* C);
|
||||
|
||||
void DoneCollection (Collection* C);
|
||||
/* Free the data for a collection. This will not free the data contained in
|
||||
* the collection.
|
||||
*/
|
||||
** the collection.
|
||||
*/
|
||||
|
||||
Collection* NewCollection (void);
|
||||
/* Create and return a new collection */
|
||||
@@ -92,9 +92,9 @@ void FreeCollection (Collection* C);
|
||||
|
||||
void CollGrow (Collection* C, unsigned Size);
|
||||
/* Grow the collection C so it is able to hold Size items without a resize
|
||||
* being necessary. This can be called for performance reasons if the number
|
||||
* of items to be placed in the collection is known in advance.
|
||||
*/
|
||||
** being necessary. This can be called for performance reasons if the number
|
||||
** of items to be placed in the collection is known in advance.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned CollCount (const Collection* C)
|
||||
@@ -195,8 +195,8 @@ const void* CollConstLast (const Collection* C);
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void* CollPop (Collection* C)
|
||||
/* Remove the last segment from the stack and return it. Calls FAIL if the
|
||||
* collection is empty.
|
||||
*/
|
||||
** collection is empty.
|
||||
*/
|
||||
{
|
||||
/* We must have at least one entry */
|
||||
PRECONDITION (C->Count > 0);
|
||||
@@ -207,31 +207,31 @@ INLINE void* CollPop (Collection* C)
|
||||
#else
|
||||
void* CollPop (Collection* C);
|
||||
/* Remove the last segment from the stack and return it. Calls FAIL if the
|
||||
* collection is empty.
|
||||
*/
|
||||
** collection is empty.
|
||||
*/
|
||||
#endif
|
||||
|
||||
int CollIndex (Collection* C, const void* Item);
|
||||
/* Return the index of the given item in the collection. Return -1 if the
|
||||
* item was not found in the collection.
|
||||
*/
|
||||
** item was not found in the collection.
|
||||
*/
|
||||
|
||||
void CollDelete (Collection* C, unsigned Index);
|
||||
/* Remove the item with the given index from the collection. This will not
|
||||
* free the item itself, just the pointer. All items with higher indices
|
||||
* will get moved to a lower position.
|
||||
*/
|
||||
** free the item itself, just the pointer. All items with higher indices
|
||||
** will get moved to a lower position.
|
||||
*/
|
||||
|
||||
void CollDeleteItem (Collection* C, const void* Item);
|
||||
/* Delete the item pointer from the collection. The item must be in the
|
||||
* collection, otherwise FAIL will be called.
|
||||
*/
|
||||
** collection, otherwise FAIL will be called.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void CollDeleteAll (Collection* C)
|
||||
/* Delete all items from the given collection. This will not free the items
|
||||
* itself, it will only remove the pointers.
|
||||
*/
|
||||
** itself, it will only remove the pointers.
|
||||
*/
|
||||
{
|
||||
/* This one is easy... */
|
||||
C->Count = 0;
|
||||
@@ -243,8 +243,8 @@ INLINE void CollDeleteAll (Collection* C)
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void CollReplace (Collection* C, void* Item, unsigned Index)
|
||||
/* Replace the item at the given position. The old item will not be freed,
|
||||
* just the pointer will get replaced.
|
||||
*/
|
||||
** just the pointer will get replaced.
|
||||
*/
|
||||
{
|
||||
/* Check the index */
|
||||
PRECONDITION (Index < C->Count);
|
||||
@@ -255,53 +255,49 @@ INLINE void CollReplace (Collection* C, void* Item, unsigned Index)
|
||||
#else
|
||||
void CollReplace (Collection* C, void* Item, unsigned Index);
|
||||
/* Replace the item at the given position. The old item will not be freed,
|
||||
* just the pointer will get replaced.
|
||||
*/
|
||||
** just the pointer will get replaced.
|
||||
*/
|
||||
#endif
|
||||
|
||||
void CollReplaceExpand (Collection* C, void* Item, unsigned Index);
|
||||
/* If Index is a valid index for the collection, replace the item at this
|
||||
* position by the one passed. If the collection is too small, expand it,
|
||||
* filling unused pointers with NULL, then add the new item at the given
|
||||
* position.
|
||||
*/
|
||||
** position by the one passed. If the collection is too small, expand it,
|
||||
** filling unused pointers with NULL, then add the new item at the given
|
||||
** position.
|
||||
*/
|
||||
|
||||
void CollMove (Collection* C, unsigned OldIndex, unsigned NewIndex);
|
||||
/* Move an item from one position in the collection to another. OldIndex
|
||||
* is the current position of the item, NewIndex is the new index after
|
||||
* the function has done it's work. Existing entries with indices NewIndex
|
||||
* and up are moved one position upwards.
|
||||
*/
|
||||
** is the current position of the item, NewIndex is the new index after
|
||||
** the function has done it's work. Existing entries with indices NewIndex
|
||||
** and up are moved one position upwards.
|
||||
*/
|
||||
|
||||
void CollMoveMultiple (Collection* C, unsigned Start, unsigned Count, unsigned Target);
|
||||
/* Move a range of items from one position to another. Start is the index
|
||||
* of the first item to move, Count is the number of items and Target is
|
||||
* the index of the target item. The item with the index Start will later
|
||||
* have the index Target. All items with indices Target and above are moved
|
||||
* to higher indices.
|
||||
*/
|
||||
** of the first item to move, Count is the number of items and Target is
|
||||
** the index of the target item. The item with the index Start will later
|
||||
** have the index Target. All items with indices Target and above are moved
|
||||
** to higher indices.
|
||||
*/
|
||||
|
||||
void CollTransfer (Collection* Dest, const Collection* Source);
|
||||
/* Transfer all items from Source to Dest. Anything already in Dest is left
|
||||
* untouched. The items in Source are not changed and are therefore in both
|
||||
* Collections on return.
|
||||
*/
|
||||
** untouched. The items in Source are not changed and are therefore in both
|
||||
** Collections on return.
|
||||
*/
|
||||
|
||||
void CollSort (Collection* C,
|
||||
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
|
||||
* are pointers to objects.
|
||||
*/
|
||||
** 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
|
||||
** are pointers to objects.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of coll.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ const char* CPUNames[CPU_COUNT] = {
|
||||
"65SC02",
|
||||
"65C02",
|
||||
"65816",
|
||||
"sunplus",
|
||||
"sweet16",
|
||||
"huc6280",
|
||||
"m740",
|
||||
@@ -72,7 +71,6 @@ const unsigned CPUIsets[CPU_COUNT] = {
|
||||
CPU_ISET_6502 | CPU_ISET_65SC02,
|
||||
CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02,
|
||||
CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02 | CPU_ISET_65816,
|
||||
CPU_ISET_SUNPLUS,
|
||||
CPU_ISET_SWEET16,
|
||||
CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02 | CPU_ISET_HUC6280,
|
||||
CPU_ISET_6502 | CPU_ISET_M740,
|
||||
@@ -121,8 +119,8 @@ int ValidAddrSizeForCPU (unsigned char AddrSize)
|
||||
|
||||
cpu_t FindCPU (const char* Name)
|
||||
/* Find a CPU by name and return the target id. CPU_UNKNOWN is returned if
|
||||
* the given name is no valid target.
|
||||
*/
|
||||
** the given name is no valid target.
|
||||
*/
|
||||
{
|
||||
unsigned I;
|
||||
|
||||
@@ -136,6 +134,3 @@ cpu_t FindCPU (const char* Name)
|
||||
/* Not found */
|
||||
return CPU_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ typedef enum {
|
||||
CPU_65SC02,
|
||||
CPU_65C02,
|
||||
CPU_65816,
|
||||
CPU_SUNPLUS, /* Not in the freeware version - sorry */
|
||||
CPU_SWEET16,
|
||||
CPU_HUC6280, /* Used in PC engine */
|
||||
CPU_M740, /* Mitsubishi 740 series MCUs */
|
||||
@@ -68,7 +67,6 @@ enum {
|
||||
CPU_ISET_65SC02 = 1 << CPU_65SC02,
|
||||
CPU_ISET_65C02 = 1 << CPU_65C02,
|
||||
CPU_ISET_65816 = 1 << CPU_65816,
|
||||
CPU_ISET_SUNPLUS = 1 << CPU_SUNPLUS,
|
||||
CPU_ISET_SWEET16 = 1 << CPU_SWEET16,
|
||||
CPU_ISET_HUC6280 = 1 << CPU_HUC6280,
|
||||
CPU_ISET_M740 = 1 << CPU_M740,
|
||||
@@ -96,14 +94,11 @@ int ValidAddrSizeForCPU (unsigned char AddrSize);
|
||||
|
||||
cpu_t FindCPU (const char* Name);
|
||||
/* Find a CPU by name and return the target id. CPU_UNKNOWN is returned if
|
||||
* the given name is no valid target.
|
||||
*/
|
||||
** the given name is no valid target.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of cpu.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,3 @@
|
||||
|
||||
|
||||
unsigned char Debug = 0; /* Debug mode */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,5 @@ extern unsigned char Debug; /* Debug mode */
|
||||
|
||||
|
||||
/* End of debugflag.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -232,6 +232,3 @@ void DumpExpr (const ExprNode* Expr, const ExprNode* (*ResolveSym) (const struct
|
||||
InternalDumpExpr (Expr, ResolveSym);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -145,6 +145,3 @@ void DumpExpr (const ExprNode* Expr, const ExprNode* (*ResolveSym) (const struct
|
||||
/* End of exprdefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -58,10 +58,10 @@ int CompareFileId (const void* Key, const void* Id)
|
||||
|
||||
const FileId* GetFileId (const char* Name, const FileId* Table, unsigned Count)
|
||||
/* Determine the id of the given file by looking at file extension of the name.
|
||||
* The table passed to the function must be sorted alphabetically. If the
|
||||
* extension is found, a pointer to the matching table entry is returned. If
|
||||
* no matching table entry was found, the function returns NULL.
|
||||
*/
|
||||
** The table passed to the function must be sorted alphabetically. If the
|
||||
** extension is found, a pointer to the matching table entry is returned. If
|
||||
** no matching table entry was found, the function returns NULL.
|
||||
*/
|
||||
{
|
||||
/* Determine the file type by the extension */
|
||||
const char* Ext = FindExt (Name);
|
||||
@@ -74,6 +74,3 @@ const FileId* GetFileId (const char* Name, const FileId* Table, unsigned Count)
|
||||
/* Search for a table entry and return it */
|
||||
return bsearch (Ext+1, Table, Count, sizeof (FileId), CompareFileId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
|
||||
|
||||
/* An entry for a table that maps extensions to some sort of identifier. Such
|
||||
* a table - sorted alphabetically - is passed to GetFileId.
|
||||
*/
|
||||
** a table - sorted alphabetically - is passed to GetFileId.
|
||||
*/
|
||||
typedef struct FileId FileId;
|
||||
struct FileId {
|
||||
const char Ext[4];
|
||||
@@ -66,15 +66,13 @@ int CompareFileId (const void* Key, const void* Id);
|
||||
|
||||
const FileId* GetFileId (const char* Name, const FileId* Table, unsigned Count);
|
||||
/* Determine the id of the given file by looking at file extension of the name.
|
||||
* The table passed to the function must be sorted alphabetically. If the
|
||||
* extension is found, a pointer to the matching table entry is returned. If
|
||||
* no matching table entry was found, the function returns NULL.
|
||||
*/
|
||||
** The table passed to the function must be sorted alphabetically. If the
|
||||
** extension is found, a pointer to the matching table entry is returned. If
|
||||
** no matching table entry was found, the function returns NULL.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of fileid.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -56,9 +56,9 @@ void InitFilePos (FilePos* P)
|
||||
|
||||
int CompareFilePos (const FilePos* P1, const FilePos* P2)
|
||||
/* Compare two file positions. Return zero if both are equal, return a value
|
||||
* > 0 if P1 is greater and P2, and a value < 0 if P1 is less than P2. The
|
||||
* compare rates file index over line over column.
|
||||
*/
|
||||
** > 0 if P1 is greater and P2, and a value < 0 if P1 is less than P2. The
|
||||
** compare rates file index over line over column.
|
||||
*/
|
||||
{
|
||||
if (P1->Name > P2->Name) {
|
||||
return 1;
|
||||
@@ -76,6 +76,3 @@ int CompareFilePos (const FilePos* P1, const FilePos* P2)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -68,15 +68,12 @@ void InitFilePos (FilePos* P);
|
||||
|
||||
int CompareFilePos (const FilePos* P1, const FilePos* P2);
|
||||
/* Compare two file positions. Return zero if both are equal, return a value
|
||||
* > 0 if P1 is greater and P2, and a value < 0 if P1 is less than P2. The
|
||||
* compare rates file index over line over column.
|
||||
*/
|
||||
** > 0 if P1 is greater and P2, and a value < 0 if P1 is less than P2. The
|
||||
** compare rates file index over line over column.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of filepos.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* filestat.c */
|
||||
/* */
|
||||
/* Replacement for buggy Microsoft code */
|
||||
/* Replacement for Windows code */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -34,22 +34,21 @@
|
||||
|
||||
|
||||
/* This module works around bugs in the time conversion code supplied by
|
||||
* Microsoft. See here for a description of the problem:
|
||||
* http://www.codeproject.com/KB/datetime/dstbugs.aspx
|
||||
* Please let me note that I find it absolutely unacceptable to just declare
|
||||
* buggy behaviour like this "works as designed" as Microsoft does. The
|
||||
* problems did even make it into .NET, where the DateTime builtin data type
|
||||
* has exactly the same problems as described in the article above.
|
||||
*/
|
||||
** Microsoft. See here for a description of the problem:
|
||||
** http://www.codeproject.com/KB/datetime/dstbugs.aspx
|
||||
** Please let me note that I find it absolutely unacceptable to just declare
|
||||
** buggy behaviour like this "works as designed" as Microsoft does. The
|
||||
** problems did even make it into .NET, where the DateTime builtin data type
|
||||
** has exactly the same problems as described in the article above.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#if defined(__WATCOMC__) && defined(__NT__)
|
||||
#define BUGGY_OS 1
|
||||
#include <errno.h>
|
||||
#include <windows.h>
|
||||
#if defined(_WIN32)
|
||||
# include <errno.h>
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
/* common */
|
||||
@@ -63,21 +62,21 @@
|
||||
|
||||
|
||||
|
||||
#if defined(BUGGY_OS)
|
||||
#if defined(_WIN32)
|
||||
|
||||
|
||||
|
||||
static time_t FileTimeToUnixTime (const FILETIME* T)
|
||||
/* Calculate a unix time_t value from a FILETIME. FILETIME contains a 64 bit
|
||||
* value with point zero at 1600-01-01 00:00:00 and counting 100ns intervals.
|
||||
* time_t is in seconds since 1970-01-01 00:00:00.
|
||||
*/
|
||||
** value with point zero at 1600-01-01 00:00:00 and counting 100ns intervals.
|
||||
** time_t is in seconds since 1970-01-01 00:00:00.
|
||||
*/
|
||||
{
|
||||
/* Offset between 1600-01-01 and the Epoch in seconds. Watcom C has no
|
||||
* way to express a number > 32 bit (known to me) but is able to do
|
||||
* calculations with 64 bit integers, so we need to do it this way.
|
||||
*/
|
||||
static const ULARGE_INTEGER Offs = { 0xB6109100UL, 0x00000020UL };
|
||||
** way to express a number > 32 bit (known to me) but is able to do
|
||||
** calculations with 64 bit integers, so we need to do it this way.
|
||||
*/
|
||||
static const ULARGE_INTEGER Offs = { { 0xB6109100UL, 0x00000020UL } };
|
||||
ULARGE_INTEGER V;
|
||||
V.LowPart = T->dwLowDateTime;
|
||||
V.HighPart = T->dwHighDateTime;
|
||||
@@ -100,10 +99,10 @@ int FileStat (const char* Path, struct stat* Buf)
|
||||
}
|
||||
|
||||
/* Open the file using backup semantics, so we won't change atime. Then
|
||||
* retrieve the correct times in UTC and replace the ones in Buf. Return
|
||||
* EACCES in case of errors to avoid the hassle of translating windows
|
||||
* error codes to standard ones.
|
||||
*/
|
||||
** retrieve the correct times in UTC and replace the ones in Buf. Return
|
||||
** EACCES in case of errors to avoid the hassle of translating windows
|
||||
** error codes to standard ones.
|
||||
*/
|
||||
H = CreateFile (Path,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* filestat.h */
|
||||
/* */
|
||||
/* Replacement for buggy Microsoft code */
|
||||
/* Replacement for Windows code */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -34,13 +34,13 @@
|
||||
|
||||
|
||||
/* This module works around bugs in the time conversion code supplied by
|
||||
* Microsoft. See here for a description of the problem:
|
||||
* http://www.codeproject.com/KB/datetime/dstbugs.aspx
|
||||
* Please let me note that I find it absolutely unacceptable to just declare
|
||||
* buggy behaviour like this "works as designed" as Microsoft does. The
|
||||
* problems did even make it into .NET, where the DateTime builtin data type
|
||||
* has exactly the same problems as described in the article above.
|
||||
*/
|
||||
** Microsoft. See here for a description of the problem:
|
||||
** http://www.codeproject.com/KB/datetime/dstbugs.aspx
|
||||
** Please let me note that I find it absolutely unacceptable to just declare
|
||||
** buggy behaviour like this "works as designed" as Microsoft does. The
|
||||
** problems did even make it into .NET, where the DateTime builtin data type
|
||||
** has exactly the same problems as described in the article above.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -68,6 +68,3 @@ int FileStat (const char* Path, struct stat* Buf);
|
||||
/* End of filestat.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* filetime.c */
|
||||
/* */
|
||||
/* Replacement for buggy Microsoft code */
|
||||
/* Replacement for Windows code */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -34,27 +34,21 @@
|
||||
|
||||
|
||||
/* This module works around bugs in the time conversion code supplied by
|
||||
* Microsoft. The problem described here:
|
||||
* http://www.codeproject.com/KB/datetime/dstbugs.aspx
|
||||
* is also true when setting file times via utime(), so we need a
|
||||
* replacement
|
||||
*/
|
||||
** Microsoft. The problem described here:
|
||||
** http://www.codeproject.com/KB/datetime/dstbugs.aspx
|
||||
** is also true when setting file times via utime(), so we need a
|
||||
** replacement
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#if defined(__WATCOMC__) && defined(__NT__)
|
||||
#define BUGGY_OS 1
|
||||
#include <errno.h>
|
||||
#include <windows.h>
|
||||
#if defined(_WIN32)
|
||||
# include <errno.h>
|
||||
# include <windows.h>
|
||||
#else
|
||||
#if defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__)
|
||||
/* 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
|
||||
|
||||
|
||||
/* common */
|
||||
@@ -68,21 +62,21 @@
|
||||
|
||||
|
||||
|
||||
#if defined(BUGGY_OS)
|
||||
#if defined(_WIN32)
|
||||
|
||||
|
||||
|
||||
static FILETIME* UnixTimeToFileTime (time_t T, FILETIME* FT)
|
||||
/* Calculate a FILETIME value from a time_t. FILETIME contains a 64 bit
|
||||
* value with point zero at 1600-01-01 00:00:00 and counting 100ns intervals.
|
||||
* time_t is in seconds since 1970-01-01 00:00:00.
|
||||
*/
|
||||
** value with point zero at 1600-01-01 00:00:00 and counting 100ns intervals.
|
||||
** time_t is in seconds since 1970-01-01 00:00:00.
|
||||
*/
|
||||
{
|
||||
/* Offset between 1600-01-01 and the Epoch in seconds. Watcom C has no
|
||||
* way to express a number > 32 bit (known to me) but is able to do
|
||||
* calculations with 64 bit integers, so we need to do it this way.
|
||||
*/
|
||||
static const ULARGE_INTEGER Offs = { 0xB6109100UL, 0x00000020UL };
|
||||
** way to express a number > 32 bit (known to me) but is able to do
|
||||
** calculations with 64 bit integers, so we need to do it this way.
|
||||
*/
|
||||
static const ULARGE_INTEGER Offs = { { 0xB6109100UL, 0x00000020UL } };
|
||||
ULARGE_INTEGER V;
|
||||
V.QuadPart = ((unsigned __int64) T + Offs.QuadPart) * 10000000U;
|
||||
FT->dwLowDateTime = V.LowPart;
|
||||
@@ -94,9 +88,9 @@ static FILETIME* UnixTimeToFileTime (time_t T, FILETIME* FT)
|
||||
|
||||
int SetFileTimes (const char* Path, time_t T)
|
||||
/* Set the time of last modification and the time of last access of a file to
|
||||
* the given time T. This calls utime() for system where it works, and applies
|
||||
* workarounds for all others (which in fact means "WINDOWS").
|
||||
*/
|
||||
** the given time T. This calls utime() for system where it works, and applies
|
||||
** workarounds for all others (which in fact means "WINDOWS").
|
||||
*/
|
||||
{
|
||||
HANDLE H;
|
||||
FILETIME FileTime;
|
||||
@@ -135,9 +129,9 @@ int SetFileTimes (const char* Path, time_t T)
|
||||
|
||||
int SetFileTimes (const char* Path, time_t T)
|
||||
/* Set the time of last modification and the time of last access of a file to
|
||||
* the given time T. This calls utime() for system where it works, and applies
|
||||
* workarounds for all others (which in fact means "WINDOWS").
|
||||
*/
|
||||
** the given time T. This calls utime() for system where it works, and applies
|
||||
** workarounds for all others (which in fact means "WINDOWS").
|
||||
*/
|
||||
{
|
||||
struct utimbuf U;
|
||||
|
||||
@@ -150,6 +144,3 @@ int SetFileTimes (const char* Path, time_t T)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* filetime.h */
|
||||
/* */
|
||||
/* Replacement for buggy Microsoft code */
|
||||
/* Replacement for Windows code */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -34,11 +34,11 @@
|
||||
|
||||
|
||||
/* This module works around bugs in the time conversion code supplied by
|
||||
* Microsoft. The problem described here:
|
||||
* http://www.codeproject.com/KB/datetime/dstbugs.aspx
|
||||
* is also true when setting file times via utime(), so we need a
|
||||
* replacement
|
||||
*/
|
||||
** Microsoft. The problem described here:
|
||||
** http://www.codeproject.com/KB/datetime/dstbugs.aspx
|
||||
** is also true when setting file times via utime(), so we need a
|
||||
** replacement
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -59,15 +59,12 @@
|
||||
|
||||
int SetFileTimes (const char* Path, time_t T);
|
||||
/* Set the time of last modification and the time of last access of a file to
|
||||
* the given time T. This calls utime() for system where it works, and applies
|
||||
* workarounds for all others (which in fact means "WINDOWS").
|
||||
*/
|
||||
** the given time T. This calls utime() for system where it works, and applies
|
||||
** workarounds for all others (which in fact means "WINDOWS").
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of filestat.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -95,8 +95,8 @@ static const FileId TypeTable[] = {
|
||||
|
||||
FILETYPE GetFileType (const char* Name)
|
||||
/* Determine the type of the given file by looking at the name. If the file
|
||||
* type could not be determined, the function returns FILETYPE_UNKOWN.
|
||||
*/
|
||||
** type could not be determined, the function returns FILETYPE_UNKOWN.
|
||||
*/
|
||||
{
|
||||
/* Search for a table entry */
|
||||
const FileId* F = GetFileId (Name, TypeTable, FILETYPE_COUNT);
|
||||
@@ -104,6 +104,3 @@ FILETYPE GetFileType (const char* Name)
|
||||
/* Return the result */
|
||||
return F? F->Id : FILETYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -65,13 +65,11 @@ typedef enum {
|
||||
|
||||
FILETYPE GetFileType (const char* Name);
|
||||
/* Determine the type of the given file by looking at the name. If the file
|
||||
* type could not be determined, the function returns FILETYPE_UNKOWN.
|
||||
*/
|
||||
** type could not be determined, the function returns FILETYPE_UNKOWN.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of filetype.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2000-2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -77,8 +77,8 @@ const char* FindExt (const char* Name)
|
||||
|
||||
const char* FindName (const char* Path)
|
||||
/* Return a pointer to the file name in Path. If there is no path leading to
|
||||
* the file, the function returns Path as name.
|
||||
*/
|
||||
** the file, the function returns Path as name.
|
||||
*/
|
||||
{
|
||||
/* Get the length of the name */
|
||||
int Len = strlen (Path);
|
||||
@@ -96,10 +96,10 @@ const char* FindName (const char* Path)
|
||||
|
||||
char* MakeFilename (const char* Origin, const char* Ext)
|
||||
/* Make a new file name from Origin and Ext. If Origin has an extension, it
|
||||
* is removed and Ext is appended. If Origin has no extension, Ext is simply
|
||||
* appended. The result is placed in a malloc'ed buffer and returned.
|
||||
* The function may be used to create "foo.o" from "foo.s".
|
||||
*/
|
||||
** is removed and Ext is appended. If Origin has no extension, Ext is simply
|
||||
** appended. The result is placed in a malloc'ed buffer and returned.
|
||||
** The function may be used to create "foo.o" from "foo.s".
|
||||
*/
|
||||
{
|
||||
char* Out;
|
||||
const char* P = FindExt (Origin);
|
||||
@@ -115,6 +115,3 @@ char* MakeFilename (const char* Origin, const char* Ext)
|
||||
}
|
||||
return Out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2000-2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -49,21 +49,18 @@ const char* FindExt (const char* Name);
|
||||
|
||||
const char* FindName (const char* Path);
|
||||
/* Return a pointer to the file name in Path. If there is no path leading to
|
||||
* the file, the function returns Path as name.
|
||||
*/
|
||||
** the file, the function returns Path as name.
|
||||
*/
|
||||
|
||||
char* MakeFilename (const char* Origin, const char* Ext);
|
||||
/* Make a new file name from Origin and Ext. If Origin has an extension, it
|
||||
* is removed and Ext is appended. If Origin has no extension, Ext is simply
|
||||
* appended. The result is placed in a malloc'ed buffer and returned.
|
||||
* The function may be used to create "foo.o" from "foo.s".
|
||||
*/
|
||||
** is removed and Ext is appended. If Origin has no extension, Ext is simply
|
||||
** appended. The result is placed in a malloc'ed buffer and returned.
|
||||
** The function may be used to create "foo.o" from "foo.s".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of fname.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
|
||||
|
||||
/* The compiler must use the same floating point arithmetic as the target
|
||||
* platform, otherwise expressions will yield a different result when
|
||||
* evaluated in the compiler or on the target platform. Since writing a target
|
||||
* and source library is almost double the work, we will at least add the
|
||||
* hooks here, and define functions for a plug in library that may be added
|
||||
* at a later time. Currently we use the builtin data types of the compiler
|
||||
* that translates cc65.
|
||||
*/
|
||||
** platform, otherwise expressions will yield a different result when
|
||||
** evaluated in the compiler or on the target platform. Since writing a target
|
||||
** and source library is almost double the work, we will at least add the
|
||||
** hooks here, and define functions for a plug in library that may be added
|
||||
** at a later time. Currently we use the builtin data types of the compiler
|
||||
** that translates cc65.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -236,6 +236,3 @@ Double FP_D_Div (Double Left, Double Right)
|
||||
D.V = Left.V / Right.V;
|
||||
return D;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,16 +34,15 @@
|
||||
|
||||
|
||||
/* The compiler must use the same floating point arithmetic as the target
|
||||
* platform, otherwise expressions will yield a different result when
|
||||
* evaluated in the compiler or on the target platform. Since writing a target
|
||||
* and source library is almost double the work, we will at least add the
|
||||
* hooks here, and define functions for a plug in library that may be added
|
||||
* at a later time. Currently we use the builtin data types of the compiler
|
||||
* that translates cc65.
|
||||
*
|
||||
* BEWARE: This code will currently only work on little endian systems!
|
||||
*
|
||||
*/
|
||||
** platform, otherwise expressions will yield a different result when
|
||||
** evaluated in the compiler or on the target platform. Since writing a target
|
||||
** and source library is almost double the work, we will at least add the
|
||||
** hooks here, and define functions for a plug in library that may be added
|
||||
** at a later time. Currently we use the builtin data types of the compiler
|
||||
** that translates cc65.
|
||||
**
|
||||
** BEWARE: This code will currently only work on little endian systems!
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -140,8 +139,3 @@ Double FP_D_Div (Double Left, Double Right);
|
||||
/* End of fp.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -70,6 +70,3 @@
|
||||
/* End of fragdefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@
|
||||
|
||||
void GT_AddArray (StrBuf* Type, unsigned ArraySize)
|
||||
/* Add an array with the given size to the type string in Type. This will
|
||||
* NOT add the element type!
|
||||
*/
|
||||
** NOT add the element type!
|
||||
*/
|
||||
{
|
||||
unsigned SizeBytes;
|
||||
|
||||
@@ -75,10 +75,10 @@ void GT_AddArray (StrBuf* Type, unsigned ArraySize)
|
||||
|
||||
unsigned GT_GetElementCount (StrBuf* Type)
|
||||
/* Retrieve the element count of an array stored in Type at the current index
|
||||
* position. Note: Index must point to the array token itself, since the size
|
||||
* of the element count is encoded there. The index position will get moved
|
||||
* past the array.
|
||||
*/
|
||||
** position. Note: Index must point to the array token itself, since the size
|
||||
** of the element count is encoded there. The index position will get moved
|
||||
** past the array.
|
||||
*/
|
||||
{
|
||||
/* Get the number of bytes for the element count */
|
||||
unsigned SizeBytes = GT_GET_SIZE (SB_Get (Type));
|
||||
@@ -99,15 +99,15 @@ unsigned GT_GetElementCount (StrBuf* Type)
|
||||
|
||||
const char* GT_AsString (const StrBuf* Type, StrBuf* String)
|
||||
/* Convert the type into a readable representation. The target string buffer
|
||||
* will be zero terminated and a pointer to the contents are returned.
|
||||
*/
|
||||
** will be zero terminated and a pointer to the contents are returned.
|
||||
*/
|
||||
{
|
||||
static const char HexTab[16] = "0123456789ABCDEF";
|
||||
unsigned I;
|
||||
|
||||
/* Convert Type into readable hex. String will have twice then length
|
||||
* plus a terminator.
|
||||
*/
|
||||
** plus a terminator.
|
||||
*/
|
||||
SB_Realloc (String, 2 * SB_GetLen (Type) + 1);
|
||||
SB_Clear (String);
|
||||
|
||||
@@ -123,6 +123,3 @@ const char* GT_AsString (const StrBuf* Type, StrBuf* String)
|
||||
/* Return the contents of String */
|
||||
return SB_GetConstBuf (String);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,21 +34,21 @@
|
||||
|
||||
|
||||
/* This module implements a specification for a "generic data type". It is
|
||||
* called generic, because it doesn't mimic a high level language. Instead it
|
||||
* tries to desrcibe the type as representation on the machine.
|
||||
* The reasoning behing this type is to allow a debugger to represent the
|
||||
* data to the user, independent of the actual source.
|
||||
* C data types may be mapped to generic ones, but attributes like const or
|
||||
* volatile are (of course) lost.
|
||||
*
|
||||
* The data type is stored in a char array and can be terminate by a zero
|
||||
* (see definition of GT_END below). The later is not really necessary but
|
||||
* allows handling of types using the usual string functions. This is in fact
|
||||
* one of the advantages of the choosen implementation:
|
||||
* String buffers may be used to dynamically build types. Types may be stored
|
||||
* as strings in the string pool of an object file. And a string pool may be
|
||||
* used to remove duplicates and reference types using unique ids.
|
||||
*/
|
||||
** called generic, because it doesn't mimic a high level language. Instead it
|
||||
** tries to desrcibe the type as representation on the machine.
|
||||
** The reasoning behing this type is to allow a debugger to represent the
|
||||
** data to the user, independent of the actual source.
|
||||
** C data types may be mapped to generic ones, but attributes like const or
|
||||
** volatile are (of course) lost.
|
||||
**
|
||||
** The data type is stored in a char array; and, can be terminated by a zero
|
||||
** (see definition of GT_END below). The latter is not really necessary; but,
|
||||
** allows handling of types using the usual string functions. This is in fact
|
||||
** one of the advantages of the chosen implementation:
|
||||
** String buffers may be used to dynamically build types. Types may be stored
|
||||
** as strings in the string pool of an object file. And a string pool may be
|
||||
** used to remove duplicates and reference types using unique ids.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -132,27 +132,23 @@
|
||||
|
||||
void GT_AddArray (StrBuf* Type, unsigned ArraySize);
|
||||
/* Add an array with the given size to the type string in Type. This will
|
||||
* NOT add the element type!
|
||||
*/
|
||||
** NOT add the element type!
|
||||
*/
|
||||
|
||||
unsigned GT_GetElementCount (StrBuf* Type);
|
||||
/* Retrieve the element count of an array stored in Type at the current index
|
||||
* position. Note: Index must point to the array token itself, since the size
|
||||
* of the element count is encoded there. The index position will get moved
|
||||
* past the array.
|
||||
*/
|
||||
** position. Note: Index must point to the array token itself, since the size
|
||||
** of the element count is encoded there. The index position will get moved
|
||||
** past the array.
|
||||
*/
|
||||
|
||||
const char* GT_AsString (const StrBuf* Type, StrBuf* String);
|
||||
/* Convert the type into a readable representation. The target string buffer
|
||||
* will be zero terminated and a pointer to the contents are returned.
|
||||
*/
|
||||
** will be zero terminated and a pointer to the contents are returned.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of gentype.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -46,10 +46,10 @@
|
||||
|
||||
unsigned HashInt (unsigned V)
|
||||
/* Return a hash value for the given integer. The function uses Robert
|
||||
* Jenkins' 32 bit integer hash function taken from
|
||||
* http://www.concentric.net/~ttwang/tech/inthash.htm
|
||||
* For 16 bit integers, the function may be suboptimal.
|
||||
*/
|
||||
** Jenkins' 32 bit integer hash function taken from
|
||||
** http://www.concentric.net/~ttwang/tech/inthash.htm
|
||||
** For 16 bit integers, the function may be suboptimal.
|
||||
*/
|
||||
{
|
||||
V = (V + 0x7ed55d16) + (V << 12);
|
||||
V = (V ^ 0xc761c23c) ^ (V >> 19);
|
||||
@@ -89,6 +89,3 @@ unsigned HashBuf (const StrBuf* S)
|
||||
}
|
||||
return H;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -64,6 +64,3 @@ unsigned HashBuf (const StrBuf* S) attribute ((const));
|
||||
/* End of hashfunc.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ HashTable* InitHashTable (HashTable* T, unsigned Slots, const HashFunctions* Fun
|
||||
|
||||
void DoneHashTable (HashTable* T)
|
||||
/* Destroy the contents of a hash table. Note: This will not free the entries
|
||||
* in the table!
|
||||
*/
|
||||
** in the table!
|
||||
*/
|
||||
{
|
||||
/* Just free the array with the table pointers */
|
||||
xfree (T->Table);
|
||||
@@ -103,8 +103,8 @@ static void HT_Alloc (HashTable* T)
|
||||
|
||||
HashNode* HT_FindHash (const HashTable* T, const void* Key, unsigned Hash)
|
||||
/* Find the node with the given key. Differs from HT_Find in that the hash
|
||||
* for the key is precalculated and passed to the function.
|
||||
*/
|
||||
** for the key is precalculated and passed to the function.
|
||||
*/
|
||||
{
|
||||
HashNode* N;
|
||||
|
||||
@@ -118,8 +118,8 @@ HashNode* HT_FindHash (const HashTable* T, const void* Key, unsigned Hash)
|
||||
while (N) {
|
||||
|
||||
/* First compare the full hash, to avoid calling the compare function
|
||||
* if it is not really necessary.
|
||||
*/
|
||||
** if it is not really necessary.
|
||||
*/
|
||||
if (N->Hash == Hash &&
|
||||
T->Func->Compare (Key, T->Func->GetKey (N)) == 0) {
|
||||
/* Found */
|
||||
@@ -188,8 +188,8 @@ void HT_Remove (HashTable* T, void* Entry)
|
||||
HashNode** Q = &T->Table[Slot];
|
||||
while (1) {
|
||||
/* If the pointer is NULL, the node is not in the table which we will
|
||||
* consider a serious error.
|
||||
*/
|
||||
** consider a serious error.
|
||||
*/
|
||||
CHECK (*Q != 0);
|
||||
if (*Q == N) {
|
||||
/* Found - remove it */
|
||||
@@ -206,12 +206,12 @@ void HT_Remove (HashTable* T, void* Entry)
|
||||
|
||||
void HT_Walk (HashTable* T, int (*F) (void* Entry, void* Data), void* Data)
|
||||
/* Walk over all nodes of a hash table, optionally deleting entries from the
|
||||
* table. For each node, the user supplied function F is called, passing a
|
||||
* pointer to the entry, and the data pointer passed to HT_Walk by the caller.
|
||||
* If F returns true, the node is deleted from the hash table otherwise it's
|
||||
* left in place. While deleting the node, the node is not accessed, so it is
|
||||
* safe for F to free the memory associcated with the entry.
|
||||
*/
|
||||
** table. For each node, the user supplied function F is called, passing a
|
||||
** pointer to the entry, and the data pointer passed to HT_Walk by the caller.
|
||||
** If F returns true, the node is deleted from the hash table otherwise it's
|
||||
** left in place. While deleting the node, the node is not accessed, so it is
|
||||
** safe for F to free the memory associcated with the entry.
|
||||
*/
|
||||
{
|
||||
unsigned I;
|
||||
|
||||
@@ -231,8 +231,8 @@ void HT_Walk (HashTable* T, int (*F) (void* Entry, void* Data), void* Data)
|
||||
/* Fetch the next node in chain now, because F() may delete it */
|
||||
HashNode* Next = (*Cur)->Next;
|
||||
/* Call the user function. N is also the pointer to the entry. If
|
||||
* the function returns true, the entry is to be deleted.
|
||||
*/
|
||||
** the function returns true, the entry is to be deleted.
|
||||
*/
|
||||
if (F (*Cur, Data)) {
|
||||
/* Delete the node from the chain */
|
||||
*Cur = Next;
|
||||
@@ -244,6 +244,3 @@ void HT_Walk (HashTable* T, int (*F) (void* Entry, void* Data), void* Data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -51,10 +51,10 @@
|
||||
|
||||
|
||||
/* Hash table node. NOTE: This structure must be the first member of a struct
|
||||
* that is hashed by the module. Having it first allows to omit a pointer to
|
||||
* the entry itself, because the C standard guarantees that a pointer to a
|
||||
* struct can be converted to its first member.
|
||||
*/
|
||||
** that is hashed by the module. Having it first allows to omit a pointer to
|
||||
** the entry itself, because the C standard guarantees that a pointer to a
|
||||
** struct can be converted to its first member.
|
||||
*/
|
||||
typedef struct HashNode HashNode;
|
||||
struct HashNode {
|
||||
HashNode* Next; /* Next entry in hash list */
|
||||
@@ -75,9 +75,9 @@ struct HashFunctions {
|
||||
|
||||
int (*Compare) (const void* Key1, const void* Key2);
|
||||
/* Compare two keys. The function must return a value less than zero if
|
||||
* Key1 is smaller than Key2, zero if both are equal, and a value greater
|
||||
* than zero if Key1 is greater then Key2.
|
||||
*/
|
||||
** Key1 is smaller than Key2, zero if both are equal, and a value greater
|
||||
** than zero if Key1 is greater then Key2.
|
||||
*/
|
||||
};
|
||||
|
||||
/* Hash table */
|
||||
@@ -122,8 +122,8 @@ HashTable* InitHashTable (HashTable* T, unsigned Slots, const HashFunctions* Fun
|
||||
|
||||
void DoneHashTable (HashTable* T);
|
||||
/* Destroy the contents of a hash table. Note: This will not free the entries
|
||||
* in the table!
|
||||
*/
|
||||
** in the table!
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE HashTable* NewHashTable (unsigned Slots, const HashFunctions* Func)
|
||||
@@ -151,8 +151,8 @@ INLINE unsigned HT_GetCount (const HashTable* T)
|
||||
|
||||
HashNode* HT_FindHash (const HashTable* T, const void* Key, unsigned Hash);
|
||||
/* Find the node with the given key. Differs from HT_Find in that the hash
|
||||
* for the key is precalculated and passed to the function.
|
||||
*/
|
||||
** for the key is precalculated and passed to the function.
|
||||
*/
|
||||
|
||||
void* HT_Find (const HashTable* T, const void* Key);
|
||||
/* Find the entry with the given key and return it */
|
||||
@@ -165,18 +165,15 @@ void HT_Remove (HashTable* T, void* Entry);
|
||||
|
||||
void HT_Walk (HashTable* T, int (*F) (void* Entry, void* Data), void* Data);
|
||||
/* Walk over all nodes of a hash table, optionally deleting entries from the
|
||||
* table. For each node, the user supplied function F is called, passing a
|
||||
* pointer to the entry, and the data pointer passed to HT_Walk by the caller.
|
||||
* If F returns true, the node is deleted from the hash table otherwise it's
|
||||
* left in place. While deleting the node, the node is not accessed, so it is
|
||||
* safe for F to free the memory associcated with the entry.
|
||||
*/
|
||||
** table. For each node, the user supplied function F is called, passing a
|
||||
** pointer to the entry, and the data pointer passed to HT_Walk by the caller.
|
||||
** If F returns true, the node is deleted from the hash table otherwise it's
|
||||
** left in place. While deleting the node, the node is not accessed, so it is
|
||||
** safe for F to free the memory associcated with the entry.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of hashtab.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
|
||||
|
||||
/* This module contains definitions for high level language symbols passed
|
||||
* down from the C compiler. They're collected in the assembler and written to
|
||||
* the object file in binary form, then again read by the linker and finally
|
||||
* placed in the debug info file.
|
||||
*/
|
||||
** down from the C compiler. They're collected in the assembler and written to
|
||||
** the object file in binary form, then again read by the linker and finally
|
||||
** placed in the debug info file.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -77,6 +77,3 @@
|
||||
/* End of hlldbgsyms.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -54,6 +54,3 @@
|
||||
/* End of inline.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -87,6 +87,3 @@ long IS_Pop (IntStack* S)
|
||||
PRECONDITION (S->Count > 0);
|
||||
return S->Stack[--S->Count];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -116,7 +116,5 @@ long IS_Pop (IntStack* S);
|
||||
|
||||
|
||||
/* End of intstack.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2004 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -39,17 +39,17 @@
|
||||
|
||||
|
||||
/* If we have stdint.h, include it, otherwise try some quesswork on types.
|
||||
* gcc and msvc don't define __STDC_VERSION__ without special flags, so check
|
||||
* for them explicitly. Undefined symbols are replaced by zero, so a check for
|
||||
* defined(__GNUC__) or defined(_MSC_VER) is not necessary.
|
||||
*/
|
||||
** gcc and msvc don't define __STDC_VERSION__ without special flags, so check
|
||||
** for them explicitly. Undefined symbols are replaced by zero, so a check for
|
||||
** defined(__GNUC__) or defined(_MSC_VER) is not necessary.
|
||||
*/
|
||||
#if (__STDC_VERSION__ >= 199901) || (__GNUC__ >= 3) || (_MSC_VER >= 1600)
|
||||
#include <stdint.h>
|
||||
#else
|
||||
|
||||
/* Assume long is the largest type available, and assume that pointers can be
|
||||
* safely converted into this type and back.
|
||||
*/
|
||||
** safely converted into this type and back.
|
||||
*/
|
||||
typedef long intptr_t;
|
||||
typedef unsigned long uintptr_t;
|
||||
typedef long intmax_t;
|
||||
@@ -62,7 +62,5 @@ typedef unsigned long uintmax_t;
|
||||
|
||||
|
||||
/* End of inttypes.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -67,6 +67,3 @@ struct LibHeader {
|
||||
/* End of libdefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -62,6 +62,3 @@
|
||||
/* End of lidefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -94,8 +94,8 @@ typedef unsigned char CharSet[32]; /* 256 bits */
|
||||
|
||||
static int RealChar (const unsigned char* Pattern)
|
||||
/* Return the next character from Pattern. If the next character is the
|
||||
* escape character, skip it and return the following.
|
||||
*/
|
||||
** escape character, skip it and return the following.
|
||||
*/
|
||||
{
|
||||
if (*Pattern == ESCAPE_CHAR) {
|
||||
Pattern++;
|
||||
@@ -146,9 +146,9 @@ static int RecursiveMatch (const unsigned char* Source, const unsigned char* Pat
|
||||
} 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.
|
||||
*/
|
||||
** CS, then check if the current char of Source is contained in
|
||||
** there.
|
||||
*/
|
||||
CS_CLEAR (CS); /* Clear the character set */
|
||||
|
||||
if (*Pattern == '?') {
|
||||
@@ -224,11 +224,11 @@ static int RecursiveMatch (const unsigned char* Source, const unsigned char* Pat
|
||||
|
||||
int MatchPattern (const char* Source, const char* Pattern)
|
||||
/* Match the string in Source against Pattern. Pattern may contain the
|
||||
* wildcards '*', '?', '[abcd]' '[ab-d]', '[!abcd]', '[!ab-d]'. The
|
||||
* function returns a value of zero if Source does not match Pattern,
|
||||
* otherwise a non zero value is returned. If Pattern contains an invalid
|
||||
* wildcard pattern (e.g. 'A[x'), the function returns zero.
|
||||
*/
|
||||
** wildcards '*', '?', '[abcd]' '[ab-d]', '[!abcd]', '[!ab-d]'. The
|
||||
** function returns a value of zero if Source does not match Pattern,
|
||||
** otherwise a non zero value is returned. If Pattern contains an invalid
|
||||
** wildcard pattern (e.g. 'A[x'), the function returns zero.
|
||||
*/
|
||||
{
|
||||
/* Handle the trivial cases */
|
||||
if (Pattern == 0 || *Pattern == '\0') {
|
||||
@@ -238,6 +238,3 @@ int MatchPattern (const char* Source, const char* Pattern)
|
||||
/* Do the real thing */
|
||||
return RecursiveMatch ((const unsigned char*) Source, (const unsigned char*) Pattern);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -50,17 +50,14 @@
|
||||
|
||||
int MatchPattern (const char* Source, const char* Pattern);
|
||||
/* Match the string in Source against Pattern. Pattern may contain the
|
||||
* wildcards '*', '?', '[abcd]' '[ab-d]', '[!abcd]', '[!ab-d]'. The
|
||||
* function returns a value of zero if Source does not match Pattern,
|
||||
* otherwise a non zero value is returned. If Pattern contains an invalid
|
||||
* wildcard pattern (e.g. 'A[x'), the function returns zero.
|
||||
*/
|
||||
** wildcards '*', '?', '[abcd]' '[ab-d]', '[!abcd]', '[!ab-d]'. The
|
||||
** function returns a value of zero if Source does not match Pattern,
|
||||
** otherwise a non zero value is returned. If Pattern contains an invalid
|
||||
** wildcard pattern (e.g. 'A[x'), the function returns zero.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of matchpat.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstra<EFBFBD>e 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -90,8 +90,8 @@ mmodel_t FindMemoryModel (const char* Name)
|
||||
|
||||
void SetMemoryModel (mmodel_t Model)
|
||||
/* Set the memory model updating the MemoryModel variables and the address
|
||||
* sizes for the segments.
|
||||
*/
|
||||
** sizes for the segments.
|
||||
*/
|
||||
{
|
||||
/* Remember the memory model */
|
||||
MemoryModel = Model;
|
||||
@@ -124,5 +124,3 @@ void SetMemoryModel (mmodel_t Model)
|
||||
/* Zeropage is always zeropage */
|
||||
ZpAddrSize = ADDR_SIZE_ZP;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstra<EFBFBD>e 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -74,14 +74,11 @@ mmodel_t FindMemoryModel (const char* Name);
|
||||
|
||||
void SetMemoryModel (mmodel_t Model);
|
||||
/* Set the memory model updating the MemoryModel variables and the address
|
||||
* sizes for the segments.
|
||||
*/
|
||||
** sizes for the segments.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of mmodel.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -92,6 +92,3 @@ struct ObjHeader {
|
||||
/* End of objdefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -72,6 +72,3 @@ struct Option {
|
||||
/* End of optdefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -72,6 +72,3 @@ void Print (FILE* F, unsigned V, const char* Format, ...)
|
||||
vfprintf (F, Format, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,3 @@ void Print (FILE* F, unsigned V, const char* Format, ...)
|
||||
/* End of print.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -76,6 +76,3 @@ enum {
|
||||
/* End of scopedefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,10 +35,12 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined(_WIN32)
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
/* Microsoft compiler */
|
||||
# include <io.h>
|
||||
# pragma warning(disable : 4996)
|
||||
#else
|
||||
/* Anyone else */
|
||||
# include <unistd.h>
|
||||
@@ -83,7 +85,7 @@ static char* CleanupPath (const char* Path)
|
||||
|
||||
|
||||
|
||||
static void Add (SearchPath* P, const char* New)
|
||||
static void Add (SearchPaths* P, const char* New)
|
||||
/* Cleanup a new search path and add it to the list */
|
||||
{
|
||||
/* Add a clean copy of the path to the collection */
|
||||
@@ -92,7 +94,7 @@ static void Add (SearchPath* P, const char* New)
|
||||
|
||||
|
||||
|
||||
SearchPath* NewSearchPath (void)
|
||||
SearchPaths* NewSearchPath (void)
|
||||
/* Create a new, empty search path list */
|
||||
{
|
||||
return NewCollection ();
|
||||
@@ -100,7 +102,7 @@ SearchPath* NewSearchPath (void)
|
||||
|
||||
|
||||
|
||||
void AddSearchPath (SearchPath* P, const char* NewPath)
|
||||
void AddSearchPath (SearchPaths* P, const char* NewPath)
|
||||
/* Add a new search path to the end of an existing list */
|
||||
{
|
||||
/* Allow a NULL path */
|
||||
@@ -111,20 +113,20 @@ void AddSearchPath (SearchPath* P, const char* NewPath)
|
||||
|
||||
|
||||
|
||||
void AddSearchPathFromEnv (SearchPath* P, const char* EnvVar)
|
||||
void AddSearchPathFromEnv (SearchPaths* P, const char* EnvVar)
|
||||
/* Add a search path from an environment variable to the end of an existing
|
||||
* list.
|
||||
*/
|
||||
** list.
|
||||
*/
|
||||
{
|
||||
AddSearchPath (P, getenv (EnvVar));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AddSubSearchPathFromEnv (SearchPath* P, const char* EnvVar, const char* SubDir)
|
||||
void AddSubSearchPathFromEnv (SearchPaths* P, const char* EnvVar, const char* SubDir)
|
||||
/* Add a search path from an environment variable, adding a subdirectory to
|
||||
* the environment variable value.
|
||||
*/
|
||||
** the environment variable value.
|
||||
*/
|
||||
{
|
||||
StrBuf Dir = AUTO_STRBUF_INITIALIZER;
|
||||
|
||||
@@ -157,21 +159,20 @@ void AddSubSearchPathFromEnv (SearchPath* P, const char* EnvVar, const char* Sub
|
||||
|
||||
|
||||
|
||||
void AddSubSearchPathFromWinBin (SearchPath* P, const char* SubDir)
|
||||
void AddSubSearchPathFromWinBin (SearchPaths* P, const char* SubDir)
|
||||
{
|
||||
/* Windows only:
|
||||
* Add a search path from the running binary, adding a subdirectory to
|
||||
* the parent directory of the directory containing the binary.
|
||||
*/
|
||||
#if defined(_MSC_VER)
|
||||
** Add a search path from the running binary, adding a subdirectory to
|
||||
** the parent directory of the directory containing the binary.
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
|
||||
char Dir[_MAX_PATH];
|
||||
char* Ptr;
|
||||
|
||||
if (_get_pgmptr (&Ptr) != 0) {
|
||||
if (GetModuleFileName (NULL, Dir, _MAX_PATH) == 0) {
|
||||
return;
|
||||
}
|
||||
strcpy (Dir, Ptr);
|
||||
|
||||
/* Remove binary name */
|
||||
Ptr = strrchr (Dir, '\\');
|
||||
@@ -204,11 +205,11 @@ void AddSubSearchPathFromWinBin (SearchPath* P, const char* SubDir)
|
||||
}
|
||||
|
||||
|
||||
int PushSearchPath (SearchPath* P, const char* NewPath)
|
||||
int PushSearchPath (SearchPaths* P, const char* NewPath)
|
||||
/* Add a new search path to the head of an existing search path list, provided
|
||||
* that it's not already there. If the path is already at the first position,
|
||||
* return zero, otherwise return a non zero value.
|
||||
*/
|
||||
** that it's not already there. If the path is already at the first position,
|
||||
** return zero, otherwise return a non zero value.
|
||||
*/
|
||||
{
|
||||
/* Generate a clean copy of NewPath */
|
||||
char* Path = CleanupPath (NewPath);
|
||||
@@ -227,7 +228,7 @@ int PushSearchPath (SearchPath* P, const char* NewPath)
|
||||
|
||||
|
||||
|
||||
void PopSearchPath (SearchPath* P)
|
||||
void PopSearchPath (SearchPaths* P)
|
||||
/* Remove a search path from the head of an existing search path list */
|
||||
{
|
||||
/* Remove the path at position 0 */
|
||||
@@ -237,10 +238,10 @@ void PopSearchPath (SearchPath* P)
|
||||
|
||||
|
||||
|
||||
char* SearchFile (const SearchPath* P, const char* File)
|
||||
char* SearchFile (const SearchPaths* P, const char* File)
|
||||
/* Search for a file in a list of directories. Return a pointer to a malloced
|
||||
* area that contains the complete path, if found, return 0 otherwise.
|
||||
*/
|
||||
** area that contains the complete path, if found, return 0 otherwise.
|
||||
*/
|
||||
{
|
||||
char* Name = 0;
|
||||
StrBuf PathName = AUTO_STRBUF_INITIALIZER;
|
||||
@@ -271,6 +272,3 @@ char* SearchFile (const SearchPath* P, const char* File)
|
||||
SB_Done (&PathName);
|
||||
return Name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#define STRINGIZE(arg) _STRINGIZE(arg)
|
||||
|
||||
/* A search path is a pointer to the list */
|
||||
typedef struct Collection SearchPath;
|
||||
typedef struct Collection SearchPaths;
|
||||
|
||||
|
||||
|
||||
@@ -63,46 +63,44 @@ typedef struct Collection SearchPath;
|
||||
|
||||
|
||||
|
||||
SearchPath* NewSearchPath (void);
|
||||
SearchPaths* NewSearchPath (void);
|
||||
/* Create a new, empty search path list */
|
||||
|
||||
void AddSearchPath (SearchPath* P, const char* NewPath);
|
||||
void AddSearchPath (SearchPaths* P, const char* NewPath);
|
||||
/* Add a new search path to the end of an existing list */
|
||||
|
||||
void AddSearchPathFromEnv (SearchPath* P, const char* EnvVar);
|
||||
void AddSearchPathFromEnv (SearchPaths* P, const char* EnvVar);
|
||||
/* Add a search path from an environment variable to the end of an existing
|
||||
* list.
|
||||
*/
|
||||
** list.
|
||||
*/
|
||||
|
||||
void AddSubSearchPathFromEnv (SearchPath* P, const char* EnvVar, const char* SubDir);
|
||||
void AddSubSearchPathFromEnv (SearchPaths* P, const char* EnvVar, const char* SubDir);
|
||||
/* Add a search path from an environment variable, adding a subdirectory to
|
||||
* the environment variable value.
|
||||
*/
|
||||
** the environment variable value.
|
||||
*/
|
||||
|
||||
void AddSubSearchPathFromWinBin (SearchPath* P, const char* SubDir);
|
||||
void AddSubSearchPathFromWinBin (SearchPaths* P, const char* SubDir);
|
||||
/* Windows only:
|
||||
* Add a search path from the running binary, adding a subdirectory to
|
||||
* the parent directory of the directory containing the binary.
|
||||
*/
|
||||
** Add a search path from the running binary, adding a subdirectory to
|
||||
** the parent directory of the directory containing the binary.
|
||||
*/
|
||||
|
||||
int PushSearchPath (SearchPath* P, const char* NewPath);
|
||||
int PushSearchPath (SearchPaths* P, const char* NewPath);
|
||||
/* Add a new search path to the head of an existing search path list, provided
|
||||
* that it's not already there. If the path is already at the first position,
|
||||
* return zero, otherwise return a non zero value.
|
||||
*/
|
||||
** that it's not already there. If the path is already at the first position,
|
||||
** return zero, otherwise return a non zero value.
|
||||
*/
|
||||
|
||||
void PopSearchPath (SearchPath* P);
|
||||
void PopSearchPath (SearchPaths* P);
|
||||
/* Remove a search path from the head of an existing search path list */
|
||||
|
||||
char* SearchFile (const SearchPath* P, const char* File);
|
||||
char* SearchFile (const SearchPaths* P, const char* File);
|
||||
/* Search for a file in a list of directories. Return a pointer to a malloced
|
||||
* area that contains the complete path, if found, return 0 otherwise.
|
||||
*/
|
||||
** area that contains the complete path, if found, return 0 otherwise.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of searchpath.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -52,6 +52,3 @@
|
||||
/* End of segdefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -65,6 +65,3 @@ int ValidSegName (const char* Name)
|
||||
/* Name is ok */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -68,6 +68,3 @@ int ValidSegName (const char* Name);
|
||||
/* End of segnames.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstra<EFBFBD>e 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -34,16 +34,16 @@
|
||||
|
||||
|
||||
/* According to the C standard, shifting a data type by the number of bits it
|
||||
* has causes undefined behaviour. So
|
||||
*
|
||||
* unsigned long l = 1;
|
||||
* unsigned u =32;
|
||||
* l <<= u;
|
||||
*
|
||||
* maybe illegal. The functions in this module behave safely in this respect,
|
||||
* and they use proper casting to distinguish signed from unsigned shifts.
|
||||
* They are not a general purpose replacement for the shift operator!
|
||||
*/
|
||||
** has causes undefined behaviour. So
|
||||
**
|
||||
** unsigned long l = 1;
|
||||
** unsigned u =32;
|
||||
** l <<= u;
|
||||
**
|
||||
** may be illegal. The functions in this module behave safely in that respect,
|
||||
** and they use proper casting to distinguish signed from unsigned shifts.
|
||||
** They are not a general purpose replacement for the shift operator!
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -125,6 +125,3 @@ unsigned long shr_l (unsigned long l, unsigned count)
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstra<EFBFBD>e 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -34,16 +34,16 @@
|
||||
|
||||
|
||||
/* According to the C standard, shifting a data type by the number of bits it
|
||||
* has causes undefined behaviour. So
|
||||
*
|
||||
* unsigned long l = 1;
|
||||
* unsigned u =32;
|
||||
* l <<= u;
|
||||
*
|
||||
* maybe illegal. The functions in this module behave safely in this respect,
|
||||
* and they use proper casting to distinguish signed from unsigned shifts.
|
||||
* They are not a general purpose replacement for the shift operator!
|
||||
*/
|
||||
** has causes undefined behaviour. So
|
||||
**
|
||||
** unsigned long l = 1;
|
||||
** unsigned u =32;
|
||||
** l <<= u;
|
||||
**
|
||||
** may be illegal. The functions in this module behave safely in that respect,
|
||||
** and they use proper casting to distinguish signed from unsigned shifts.
|
||||
** They are not a general purpose replacement for the shift operator!
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -79,6 +79,3 @@ unsigned long shr_l (unsigned long l, unsigned count);
|
||||
/* End of shift.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -75,8 +75,8 @@ StrBuf* SB_Init (StrBuf* B)
|
||||
|
||||
StrBuf* SB_InitFromString (StrBuf* B, const char* S)
|
||||
/* Initialize a string buffer from a literal string. Beware: The buffer won't
|
||||
* store a copy but a pointer to the actual string.
|
||||
*/
|
||||
** store a copy but a pointer to the actual string.
|
||||
*/
|
||||
{
|
||||
B->Allocated = 0;
|
||||
B->Len = strlen (S);
|
||||
@@ -126,8 +126,8 @@ void FreeStrBuf (StrBuf* B)
|
||||
|
||||
void SB_Realloc (StrBuf* B, unsigned NewSize)
|
||||
/* Reallocate the string buffer space, make sure at least NewSize bytes are
|
||||
* available.
|
||||
*/
|
||||
** available.
|
||||
*/
|
||||
{
|
||||
/* Get the current size, use a minimum of 8 bytes */
|
||||
unsigned NewAllocated = B->Allocated;
|
||||
@@ -141,9 +141,9 @@ void SB_Realloc (StrBuf* B, unsigned NewSize)
|
||||
}
|
||||
|
||||
/* Reallocate the buffer. Beware: The allocated size may be zero while the
|
||||
* length is not. This means that we have a buffer that wasn't allocated
|
||||
* on the heap.
|
||||
*/
|
||||
** length is not. This means that we have a buffer that wasn't allocated
|
||||
** on the heap.
|
||||
*/
|
||||
if (B->Allocated) {
|
||||
/* Just reallocate the block */
|
||||
B->Buf = xrealloc (B->Buf, NewAllocated);
|
||||
@@ -160,9 +160,9 @@ void SB_Realloc (StrBuf* B, unsigned NewSize)
|
||||
|
||||
static void SB_CheapRealloc (StrBuf* B, unsigned NewSize)
|
||||
/* Reallocate the string buffer space, make sure at least NewSize bytes are
|
||||
* available. This function won't copy the old buffer contents over to the new
|
||||
* buffer and may be used if the old contents are overwritten later.
|
||||
*/
|
||||
** available. This function won't copy the old buffer contents over to the new
|
||||
** buffer and may be used if the old contents are overwritten later.
|
||||
*/
|
||||
{
|
||||
/* Get the current size, use a minimum of 8 bytes */
|
||||
unsigned NewAllocated = B->Allocated;
|
||||
@@ -214,8 +214,8 @@ void SB_Drop (StrBuf* B, unsigned Count)
|
||||
|
||||
void SB_Terminate (StrBuf* B)
|
||||
/* Zero terminate the given string buffer. NOTE: The terminating zero is not
|
||||
* accounted for in B->Len, if you want that, you have to use AppendChar!
|
||||
*/
|
||||
** accounted for in B->Len, if you want that, you have to use AppendChar!
|
||||
*/
|
||||
{
|
||||
unsigned NewLen = B->Len + 1;
|
||||
if (NewLen > B->Allocated) {
|
||||
@@ -310,8 +310,8 @@ void SB_Append (StrBuf* Target, const StrBuf* Source)
|
||||
#if !defined(HAVE_INLINE)
|
||||
void SB_Cut (StrBuf* B, unsigned Len)
|
||||
/* Cut the contents of B at the given length. If the current length of the
|
||||
* buffer is smaller than Len, nothing will happen.
|
||||
*/
|
||||
** buffer is smaller than Len, nothing will happen.
|
||||
*/
|
||||
{
|
||||
if (Len < B->Len) {
|
||||
B->Len = Len;
|
||||
@@ -323,10 +323,10 @@ void SB_Cut (StrBuf* B, unsigned Len)
|
||||
|
||||
void SB_Slice (StrBuf* Target, const StrBuf* Source, unsigned Start, unsigned Len)
|
||||
/* Copy a slice from Source into Target. The current contents of Target are
|
||||
* destroyed. If Start is greater than the length of Source, or if Len
|
||||
* characters aren't available, the result will be a buffer with less than Len
|
||||
* bytes.
|
||||
*/
|
||||
** destroyed. If Start is greater than the length of Source, or if Len
|
||||
** characters aren't available, the result will be a buffer with less than Len
|
||||
** bytes.
|
||||
*/
|
||||
{
|
||||
/* Calculate the length of the resulting buffer */
|
||||
if (Start >= Source->Len) {
|
||||
@@ -352,8 +352,8 @@ void SB_Slice (StrBuf* Target, const StrBuf* Source, unsigned Start, unsigned Le
|
||||
|
||||
void SB_Move (StrBuf* Target, StrBuf* Source)
|
||||
/* Move the complete contents of Source to target. This will delete the old
|
||||
* contents of Target, and Source will be empty after the call.
|
||||
*/
|
||||
** contents of Target, and Source will be empty after the call.
|
||||
*/
|
||||
{
|
||||
/* Free the target string */
|
||||
if (Target->Allocated) {
|
||||
@@ -448,18 +448,18 @@ int SB_CompareStr (const StrBuf* S1, const char* S2)
|
||||
|
||||
void SB_VPrintf (StrBuf* S, const char* Format, va_list ap)
|
||||
/* printf function with S as target. The function is safe, which means that
|
||||
* the current contents of S are discarded, and are allocated again with
|
||||
* a matching size for the output. The function will call FAIL when problems
|
||||
* are detected (anything that let xsnprintf return -1).
|
||||
*/
|
||||
** the current contents of S are discarded, and are allocated again with
|
||||
** a matching size for the output. The function will call FAIL when problems
|
||||
** are detected (anything that let xsnprintf return -1).
|
||||
*/
|
||||
{
|
||||
va_list tmp;
|
||||
int SizeNeeded;
|
||||
|
||||
/* Since we must determine the space needed anyway, we will try with
|
||||
* the currently allocated memory. If the call succeeds, we've saved
|
||||
* an allocation. If not, we have to reallocate and try again.
|
||||
*/
|
||||
** the currently allocated memory. If the call succeeds, we've saved
|
||||
** an allocation. If not, we have to reallocate and try again.
|
||||
*/
|
||||
va_copy (tmp, ap);
|
||||
SizeNeeded = xvsnprintf (S->Buf, S->Allocated, Format, tmp);
|
||||
va_end (tmp);
|
||||
@@ -483,16 +483,13 @@ void SB_VPrintf (StrBuf* S, const char* Format, va_list ap)
|
||||
|
||||
void SB_Printf (StrBuf* S, const char* Format, ...)
|
||||
/* vprintf function with S as target. The function is safe, which means that
|
||||
* the current contents of S are discarded, and are allocated again with
|
||||
* a matching size for the output. The function will call FAIL when problems
|
||||
* are detected (anything that let xsnprintf return -1).
|
||||
*/
|
||||
** the current contents of S are discarded, and are allocated again with
|
||||
** a matching size for the output. The function will call FAIL when problems
|
||||
** are detected (anything that let xsnprintf return -1).
|
||||
*/
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, Format);
|
||||
SB_VPrintf (S, Format, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -95,10 +95,10 @@ StrBuf* SB_Init (StrBuf* B);
|
||||
|
||||
StrBuf* SB_InitFromString (StrBuf* B, const char* S);
|
||||
/* Initialize a string buffer from a literal string. Beware: The buffer won't
|
||||
* store a copy but a pointer to the actual string. A buffer initialized with
|
||||
* this routine may be "forgotten" without calling SB_Done, since no memory
|
||||
* has been allocated.
|
||||
*/
|
||||
** store a copy but a pointer to the actual string. A buffer initialized with
|
||||
** this routine may be "forgotten" without calling SB_Done, since no memory
|
||||
** has been allocated.
|
||||
*/
|
||||
|
||||
void SB_Done (StrBuf* B);
|
||||
/* Free the data of a string buffer (but not the struct itself) */
|
||||
@@ -111,8 +111,8 @@ void FreeStrBuf (StrBuf* B);
|
||||
|
||||
void SB_Realloc (StrBuf* B, unsigned NewSize);
|
||||
/* Reallocate the string buffer space, make sure at least NewSize bytes are
|
||||
* available.
|
||||
*/
|
||||
** available.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned SB_GetLen (const StrBuf* B)
|
||||
@@ -229,8 +229,8 @@ INLINE void SB_Reset (StrBuf* B)
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE char SB_Get (StrBuf* B)
|
||||
/* Return the next character from the string incrementing Index. Returns NUL
|
||||
* if the end of the string is reached.
|
||||
*/
|
||||
** if the end of the string is reached.
|
||||
*/
|
||||
{
|
||||
return (B->Index < B->Len)? B->Buf[B->Index++] : '\0';
|
||||
}
|
||||
@@ -241,8 +241,8 @@ INLINE char SB_Get (StrBuf* B)
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE char SB_Peek (const StrBuf* B)
|
||||
/* Look at the next character from the string without incrementing Index.
|
||||
* Returns NUL if the end of the string is reached.
|
||||
*/
|
||||
** Returns NUL if the end of the string is reached.
|
||||
*/
|
||||
{
|
||||
return (B->Index < B->Len)? B->Buf[B->Index] : '\0';
|
||||
}
|
||||
@@ -253,8 +253,8 @@ INLINE char SB_Peek (const StrBuf* B)
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE char SB_LookAt (const StrBuf* B, unsigned Index)
|
||||
/* Look at a specific character from the string. Returns NUL if the given
|
||||
* index is greater than the size of the string.
|
||||
*/
|
||||
** index is greater than the size of the string.
|
||||
*/
|
||||
{
|
||||
return (Index < B->Len)? B->Buf[Index] : '\0';
|
||||
}
|
||||
@@ -265,8 +265,8 @@ INLINE char SB_LookAt (const StrBuf* B, unsigned Index)
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE char SB_LookAtLast (const StrBuf* B)
|
||||
/* Look at the last character from the string. Returns NUL if the string buffer
|
||||
* is empty.
|
||||
*/
|
||||
** is empty.
|
||||
*/
|
||||
{
|
||||
return (B->Len > 0)? B->Buf[B->Len-1] : '\0';
|
||||
}
|
||||
@@ -304,8 +304,8 @@ void SB_Drop (StrBuf* B, unsigned Count);
|
||||
|
||||
void SB_Terminate (StrBuf* B);
|
||||
/* Zero terminate the given string buffer. NOTE: The terminating zero is not
|
||||
* accounted for in B->Len, if you want that, you have to use AppendChar!
|
||||
*/
|
||||
** accounted for in B->Len, if you want that, you have to use AppendChar!
|
||||
*/
|
||||
|
||||
void SB_CopyBuf (StrBuf* Target, const char* Buf, unsigned Size);
|
||||
/* Copy Buf to Target, discarding the old contents of Target */
|
||||
@@ -364,8 +364,8 @@ void SB_Append (StrBuf* Target, const StrBuf* Source);
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SB_Cut (StrBuf* B, unsigned Len)
|
||||
/* Cut the contents of B at the given length. If the current length of the
|
||||
* buffer is smaller than Len, nothing will happen.
|
||||
*/
|
||||
** buffer is smaller than Len, nothing will happen.
|
||||
*/
|
||||
{
|
||||
if (Len < B->Len) {
|
||||
B->Len = Len;
|
||||
@@ -374,21 +374,21 @@ INLINE void SB_Cut (StrBuf* B, unsigned Len)
|
||||
#else
|
||||
void SB_Cut (StrBuf* B, unsigned Len);
|
||||
/* Cut the contents of B at the given length. If the current length of the
|
||||
* buffer is smaller than Len, nothing will happen.
|
||||
*/
|
||||
** buffer is smaller than Len, nothing will happen.
|
||||
*/
|
||||
#endif
|
||||
|
||||
void SB_Slice (StrBuf* Target, const StrBuf* Source, unsigned Start, unsigned Len);
|
||||
/* Copy a slice from Source into Target. The current contents of Target are
|
||||
* destroyed. If Start is greater than the length of Source, or if Len
|
||||
* characters aren't available, the result will be a buffer with less than Len
|
||||
* bytes.
|
||||
*/
|
||||
** destroyed. If Start is greater than the length of Source, or if Len
|
||||
** characters aren't available, the result will be a buffer with less than Len
|
||||
** bytes.
|
||||
*/
|
||||
|
||||
void SB_Move (StrBuf* Target, StrBuf* Source);
|
||||
/* Move the complete contents of Source to target. This will delete the old
|
||||
* contents of Target, and Source will be empty after the call.
|
||||
*/
|
||||
** contents of Target, and Source will be empty after the call.
|
||||
*/
|
||||
|
||||
void SB_ToLower (StrBuf* S);
|
||||
/* Convert all characters in S to lower case */
|
||||
@@ -404,23 +404,20 @@ int SB_CompareStr (const StrBuf* S1, const char* S2);
|
||||
|
||||
void SB_VPrintf (StrBuf* S, const char* Format, va_list ap) attribute ((format (printf, 2, 0)));
|
||||
/* printf function with S as target. The function is safe, which means that
|
||||
* the current contents of S are discarded, and are allocated again with
|
||||
* a matching size for the output. The function will call FAIL when problems
|
||||
* are detected (anything that let xsnprintf return -1).
|
||||
*/
|
||||
** the current contents of S are discarded, and are allocated again with
|
||||
** a matching size for the output. The function will call FAIL when problems
|
||||
** are detected (anything that let xsnprintf return -1).
|
||||
*/
|
||||
|
||||
void SB_Printf (StrBuf* S, const char* Format, ...) attribute ((format (printf, 2, 3)));
|
||||
/* vprintf function with S as target. The function is safe, which means that
|
||||
* the current contents of S are discarded, and are allocated again with
|
||||
* a matching size for the output. The function will call FAIL when problems
|
||||
* are detected (anything that let xsnprintf return -1).
|
||||
*/
|
||||
** the current contents of S are discarded, and are allocated again with
|
||||
** a matching size for the output. The function will call FAIL when problems
|
||||
** are detected (anything that let xsnprintf return -1).
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of strbuf.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
|
||||
|
||||
/* A string pool is used to store identifiers and other strings. Each string
|
||||
* stored in the pool has a unique id, which may be used to access the string
|
||||
* in the pool. Identical strings are stored only once in the pool and have
|
||||
* identical ids. This means that instead of comparing strings, just the
|
||||
* string pool ids must be compared.
|
||||
*/
|
||||
** stored in the pool has a unique id, which may be used to access the string
|
||||
** in the pool. Identical strings are stored only once in the pool and have
|
||||
** identical ids. This means that instead of comparing strings, just the
|
||||
** string pool ids must be compared.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ static const void* HT_GetKey (const void* Entry);
|
||||
|
||||
static int HT_Compare (const void* Key1, const void* Key2);
|
||||
/* Compare two keys. The function must return a value less than zero if
|
||||
* Key1 is smaller than Key2, zero if both are equal, and a value greater
|
||||
* than zero if Key1 is greater then Key2.
|
||||
*/
|
||||
** Key1 is smaller than Key2, zero if both are equal, and a value greater
|
||||
** than zero if Key1 is greater then Key2.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -154,9 +154,9 @@ static const void* HT_GetKey (const void* Entry)
|
||||
|
||||
static int HT_Compare (const void* Key1, const void* Key2)
|
||||
/* Compare two keys. The function must return a value less than zero if
|
||||
* Key1 is smaller than Key2, zero if both are equal, and a value greater
|
||||
* than zero if Key1 is greater then Key2.
|
||||
*/
|
||||
** Key1 is smaller than Key2, zero if both are equal, and a value greater
|
||||
** than zero if Key1 is greater then Key2.
|
||||
*/
|
||||
{
|
||||
return SB_Compare (Key1, Key2);
|
||||
}
|
||||
@@ -228,9 +228,9 @@ const StrBuf* SP_Get (const StringPool* P, unsigned Index)
|
||||
|
||||
unsigned SP_Add (StringPool* P, const StrBuf* S)
|
||||
/* Add a string buffer to the buffer and return the index. If the string does
|
||||
* already exist in the pool, SP_AddBuf will just return the index of the
|
||||
* existing string.
|
||||
*/
|
||||
** already exist in the pool, SP_AddBuf will just return the index of the
|
||||
** existing string.
|
||||
*/
|
||||
{
|
||||
/* Search for a matching entry in the hash table */
|
||||
StringPoolEntry* E = HT_Find (&P->Tab, S);
|
||||
@@ -259,14 +259,14 @@ unsigned SP_Add (StringPool* P, const StrBuf* S)
|
||||
|
||||
unsigned SP_AddStr (StringPool* P, const char* S)
|
||||
/* Add a string to the buffer and return the index. If the string does already
|
||||
* exist in the pool, SP_Add will just return the index of the existing string.
|
||||
*/
|
||||
** exist in the pool, SP_Add will just return the index of the existing string.
|
||||
*/
|
||||
{
|
||||
unsigned Id;
|
||||
|
||||
/* First make a string buffer, then add it. This is some overhead, but the
|
||||
* routine will probably go.
|
||||
*/
|
||||
** routine will probably go.
|
||||
*/
|
||||
StrBuf Buf;
|
||||
Id = SP_Add (P, SB_InitFromString (&Buf, S));
|
||||
|
||||
@@ -281,6 +281,3 @@ unsigned SP_GetCount (const StringPool* P)
|
||||
{
|
||||
return CollCount (&P->Entries);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
|
||||
|
||||
/* A string pool is used to store identifiers and other strings. Each string
|
||||
* stored in the pool has a unique id, which may be used to access the string
|
||||
* in the pool. Identical strings are only stored once in the pool and have
|
||||
* identical ids. This means that instead of comparing strings, just the
|
||||
* string pool ids must be compared.
|
||||
*/
|
||||
** stored in the pool has a unique ID, which may be used to access the string
|
||||
** in the pool. Identical strings are only stored once in the pool and have
|
||||
** identical IDs. This means that instead of comparing strings, just the
|
||||
** string pool IDs must be compared.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -84,14 +84,14 @@ const StrBuf* SP_Get (const StringPool* P, unsigned Index);
|
||||
|
||||
unsigned SP_Add (StringPool* P, const StrBuf* S);
|
||||
/* Add a string buffer to the buffer and return the index. If the string does
|
||||
* already exist in the pool, SP_AddBuf will just return the index of the
|
||||
* existing string.
|
||||
*/
|
||||
** already exist in the pool, SP_AddBuf will just return the index of the
|
||||
** existing string.
|
||||
*/
|
||||
|
||||
unsigned SP_AddStr (StringPool* P, const char* S);
|
||||
/* Add a string to the buffer and return the index. If the string does already
|
||||
* exist in the pool, SP_Add will just return the index of the existing string.
|
||||
*/
|
||||
** exist in the pool, SP_Add will just return the index of the existing string.
|
||||
*/
|
||||
|
||||
unsigned SP_GetCount (const StringPool* P);
|
||||
/* Return the number of strings in the pool */
|
||||
@@ -101,6 +101,3 @@ unsigned SP_GetCount (const StringPool* P);
|
||||
/* End of strpool.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -80,6 +80,3 @@ void SS_Push (StrStack* S, const char* Val)
|
||||
CHECK (S->Count < sizeof (S->Stack) / sizeof (S->Stack[0]));
|
||||
S->Stack[S->Count++] = xstrdup (Val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -100,7 +100,5 @@ void SS_Push (StrStack* S, const char* Val);
|
||||
|
||||
|
||||
/* End of strstack.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2001-2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -49,9 +49,9 @@
|
||||
|
||||
char* StrCopy (char* Dest, size_t DestSize, const char* Source)
|
||||
/* Copy Source to Dest honouring the maximum size of the target buffer. In
|
||||
* constrast to strncpy, the resulting string will always be NUL terminated.
|
||||
* The function returns the pointer to the destintation buffer.
|
||||
*/
|
||||
** constrast to strncpy, the resulting string will always be NUL terminated.
|
||||
** The function returns the pointer to the destintation buffer.
|
||||
*/
|
||||
{
|
||||
size_t Len = strlen (Source);
|
||||
if (Len >= DestSize) {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2001-2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -50,9 +50,9 @@
|
||||
|
||||
char* StrCopy (char* Dest, size_t DestSize, const char* Source);
|
||||
/* Copy Source to Dest honouring the maximum size of the target buffer. In
|
||||
* constrast to strncpy, the resulting string will always be NUL terminated.
|
||||
* The function returns the pointer to the destintation buffer.
|
||||
*/
|
||||
** constrast to strncpy, the resulting string will always be NUL terminated.
|
||||
** The function returns the pointer to the destintation buffer.
|
||||
*/
|
||||
|
||||
int StrCaseCmp (const char* S1, const char* S2);
|
||||
/* Compare two strings ignoring case */
|
||||
@@ -62,6 +62,3 @@ int StrCaseCmp (const char* S1, const char* S2);
|
||||
/* End of strutil.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -103,6 +103,3 @@
|
||||
/* End of symdefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -119,12 +119,13 @@ struct TargetEntry {
|
||||
};
|
||||
|
||||
/* Table that maps target names to ids. Sorted alphabetically for bsearch.
|
||||
* Allows multiple entries for one target id (target name aliases).
|
||||
*/
|
||||
** Allows mupltiple entries for one target id (target name aliases).
|
||||
*/
|
||||
static const TargetEntry TargetMap[] = {
|
||||
{ "apple2", TGT_APPLE2 },
|
||||
{ "apple2enh", TGT_APPLE2ENH },
|
||||
{ "atari", TGT_ATARI },
|
||||
{ "atari5200", TGT_ATARI5200 },
|
||||
{ "atarixl", TGT_ATARIXL },
|
||||
{ "atmos", TGT_ATMOS },
|
||||
{ "bbc", TGT_BBC },
|
||||
@@ -158,6 +159,7 @@ static const TargetProperties PropertyTable[TGT_COUNT] = {
|
||||
{ "none", CPU_6502, BINFMT_BINARY, CTNone },
|
||||
{ "module", CPU_6502, BINFMT_O65, CTNone },
|
||||
{ "atari", CPU_6502, BINFMT_BINARY, CTAtari },
|
||||
{ "atari5200", CPU_6502, BINFMT_BINARY, CTAtari },
|
||||
{ "atarixl", CPU_6502, BINFMT_BINARY, CTAtari },
|
||||
{ "vic20", CPU_6502, BINFMT_BINARY, CTPET },
|
||||
{ "c16", CPU_6502, BINFMT_BINARY, CTPET },
|
||||
@@ -203,8 +205,8 @@ static int Compare (const void* Key, const void* Entry)
|
||||
|
||||
target_t FindTarget (const char* Name)
|
||||
/* Find a target by name and return the target id. TGT_UNKNOWN is returned if
|
||||
* the given name is no valid target.
|
||||
*/
|
||||
** the given name is no valid target.
|
||||
*/
|
||||
{
|
||||
/* Search for the name in the map */
|
||||
const TargetEntry* T;
|
||||
@@ -234,4 +236,3 @@ const char* GetTargetName (target_t Target)
|
||||
/* Return the array entry */
|
||||
return GetTargetProperties (Target)->Name;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ typedef enum {
|
||||
TGT_NONE,
|
||||
TGT_MODULE,
|
||||
TGT_ATARI,
|
||||
TGT_ATARI5200,
|
||||
TGT_ATARIXL,
|
||||
TGT_VIC20,
|
||||
TGT_C16,
|
||||
@@ -107,8 +108,8 @@ extern target_t Target;
|
||||
|
||||
target_t FindTarget (const char* Name);
|
||||
/* Find a target by name and return the target id. TGT_UNKNOWN is returned if
|
||||
* the given name is no valid target.
|
||||
*/
|
||||
** the given name is no valid target.
|
||||
*/
|
||||
|
||||
const TargetProperties* GetTargetProperties (target_t Target);
|
||||
/* Return the properties for a target */
|
||||
@@ -119,7 +120,5 @@ const char* GetTargetName (target_t Target);
|
||||
|
||||
|
||||
/* End of target.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ void TgtTranslateInit (void)
|
||||
|
||||
int TgtTranslateChar (int C)
|
||||
/* Translate one character from the source character set into the target
|
||||
* system character set.
|
||||
*/
|
||||
** system character set.
|
||||
*/
|
||||
{
|
||||
/* Translate */
|
||||
return Tab[C & 0xFF];
|
||||
@@ -98,8 +98,8 @@ int TgtTranslateChar (int C)
|
||||
|
||||
void TgtTranslateBuf (void* Buf, unsigned Len)
|
||||
/* Translate a buffer of the given length from the source character set into
|
||||
* the target system character set.
|
||||
*/
|
||||
** the target system character set.
|
||||
*/
|
||||
{
|
||||
/* Translate */
|
||||
unsigned char* B = (unsigned char*)Buf;
|
||||
@@ -113,8 +113,8 @@ void TgtTranslateBuf (void* Buf, unsigned Len)
|
||||
|
||||
void TgtTranslateStrBuf (StrBuf* Buf)
|
||||
/* Translate a string buffer from the source character set into the target
|
||||
* system character set.
|
||||
*/
|
||||
** system character set.
|
||||
*/
|
||||
{
|
||||
TgtTranslateBuf (SB_GetBuf (Buf), SB_GetLen (Buf));
|
||||
}
|
||||
@@ -127,8 +127,3 @@ void TgtTranslateSet (unsigned Index, unsigned char C)
|
||||
CHECK (Index > 0 && Index < sizeof (Tab));
|
||||
Tab[Index] = C;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -54,18 +54,18 @@ void TgtTranslateInit (void);
|
||||
|
||||
int TgtTranslateChar (int C);
|
||||
/* Translate one character from the source character set into the target
|
||||
* system character set.
|
||||
*/
|
||||
** system character set.
|
||||
*/
|
||||
|
||||
void TgtTranslateBuf (void* Buf, unsigned Len);
|
||||
/* Translate a buffer of the given length from the source character set into
|
||||
* the target system character set.
|
||||
*/
|
||||
** the target system character set.
|
||||
*/
|
||||
|
||||
void TgtTranslateStrBuf (StrBuf* Buf);
|
||||
/* Translate a string buffer from the source character set into the target
|
||||
* system character set.
|
||||
*/
|
||||
** system character set.
|
||||
*/
|
||||
|
||||
void TgtTranslateSet (unsigned Index, unsigned char C);
|
||||
/* Set the translation code for the given character */
|
||||
@@ -75,6 +75,3 @@ void TgtTranslateSet (unsigned Index, unsigned char C);
|
||||
/* End of tgttrans.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -74,7 +74,5 @@
|
||||
|
||||
|
||||
/* End of va_copy.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -33,8 +33,10 @@
|
||||
|
||||
|
||||
|
||||
#include "version.h"
|
||||
/* common */
|
||||
#include "xsprintf.h"
|
||||
#include "searchpath.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
|
||||
@@ -46,9 +48,6 @@
|
||||
|
||||
#define VER_MAJOR 2U
|
||||
#define VER_MINOR 14U
|
||||
#define VER_PATCH 0U
|
||||
#define VER_RC 0U
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -61,11 +60,11 @@
|
||||
const char* GetVersionAsString (void)
|
||||
/* Returns the version number as a string in a static buffer */
|
||||
{
|
||||
static char Buf[20];
|
||||
#if defined(VER_RC) && (VER_RC > 0U)
|
||||
xsnprintf (Buf, sizeof (Buf), "%u.%u.%u-rc%u", VER_MAJOR, VER_MINOR, VER_PATCH, VER_RC);
|
||||
static char Buf[60];
|
||||
#if defined(GIT_SHA)
|
||||
xsnprintf (Buf, sizeof (Buf), "%u.%u - Git %s", VER_MAJOR, VER_MINOR, STRINGIZE (GIT_SHA));
|
||||
#else
|
||||
xsnprintf (Buf, sizeof (Buf), "%u.%u.%u", VER_MAJOR, VER_MINOR, VER_PATCH);
|
||||
xsnprintf (Buf, sizeof (Buf), "%u.%u", VER_MAJOR, VER_MINOR);
|
||||
#endif
|
||||
return Buf;
|
||||
}
|
||||
@@ -75,8 +74,5 @@ const char* GetVersionAsString (void)
|
||||
unsigned GetVersionAsNumber (void)
|
||||
/* Returns the version number as a combined unsigned for use in a #define */
|
||||
{
|
||||
return ((VER_MAJOR * 0x100) + (VER_MINOR * 0x10) + VER_PATCH);
|
||||
return ((VER_MAJOR * 0x100) + (VER_MINOR * 0x10));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -55,7 +55,3 @@ unsigned GetVersionAsNumber (void);
|
||||
/* End of version.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -125,6 +125,3 @@ void* xdup (const void* Buf, size_t Size)
|
||||
{
|
||||
return memcpy (xmalloc (Size), Buf, Size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -68,6 +68,3 @@ void* xdup (const void* Buf, size_t Size);
|
||||
/* End of xmalloc.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2000-2004 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
@@ -55,12 +55,12 @@
|
||||
|
||||
|
||||
/* The following is a very basic vsnprintf like function called xvsnprintf. It
|
||||
* features only the basic format specifiers (especially the floating point
|
||||
* stuff is missing), but may be extended if required. Reason for supplying
|
||||
* my own implementation is that vsnprintf is standard but not implemented by
|
||||
* older compilers, and some that implement it, don't adhere to the standard
|
||||
* (for example Microsoft with its _vsnprintf).
|
||||
*/
|
||||
** features only the basic format specifiers (especially the floating point
|
||||
** stuff is missing), but may be extended if required. Reason for supplying
|
||||
** my own implementation is that vsnprintf is standard but not implemented by
|
||||
** older compilers, and some that implement it, don't adhere to the standard
|
||||
** (for example Microsoft with its _vsnprintf).
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -73,9 +73,9 @@ typedef struct {
|
||||
size_t BufFill;
|
||||
|
||||
/* Argument string buffer and string buffer pointer. The string buffer
|
||||
* must be big enough to hold a converted integer of the largest type
|
||||
* including an optional sign and terminating zero.
|
||||
*/
|
||||
** must be big enough to hold a converted integer of the largest type
|
||||
** including an optional sign and terminating zero.
|
||||
*/
|
||||
char ArgBuf[256];
|
||||
int ArgLen;
|
||||
|
||||
@@ -223,9 +223,9 @@ static void FormatInt (PrintfCtrl* P, uintmax_t Val)
|
||||
ToStr (P, Val);
|
||||
|
||||
/* The default precision for all integer conversions is one. This means
|
||||
* that the fPrec flag is always set and does not need to be checked
|
||||
* later on.
|
||||
*/
|
||||
** that the fPrec flag is always set and does not need to be checked
|
||||
** later on.
|
||||
*/
|
||||
if ((P->Flags & fPrec) == 0) {
|
||||
P->Flags |= fPrec;
|
||||
P->Prec = 1;
|
||||
@@ -305,9 +305,9 @@ static void FormatStr (PrintfCtrl* P, const char* Val)
|
||||
unsigned WidthPadding;
|
||||
|
||||
/* Get the string length limited to the precision. Beware: We cannot use
|
||||
* strlen here, because if a precision is given, the string may not be
|
||||
* zero terminated.
|
||||
*/
|
||||
** strlen here, because if a precision is given, the string may not be
|
||||
** zero terminated.
|
||||
*/
|
||||
int Len;
|
||||
if ((P->Flags & fPrec) != 0) {
|
||||
const char* S = memchr (Val, '\0', P->Prec);
|
||||
@@ -367,8 +367,8 @@ static void StoreOffset (PrintfCtrl* P)
|
||||
|
||||
int xvsnprintf (char* Buf, size_t Size, const char* Format, va_list ap)
|
||||
/* A basic vsnprintf implementation. Does currently only support integer
|
||||
* formats.
|
||||
*/
|
||||
** formats.
|
||||
*/
|
||||
{
|
||||
PrintfCtrl P;
|
||||
int Done;
|
||||
@@ -418,8 +418,8 @@ int xvsnprintf (char* Buf, size_t Size, const char* Format, va_list ap)
|
||||
if (F == '*') {
|
||||
P.Width = va_arg (P.ap, int);
|
||||
/* A negative field width argument is taken as a - flag followed
|
||||
* by a positive field width.
|
||||
*/
|
||||
** by a positive field width.
|
||||
*/
|
||||
if (P.Width < 0) {
|
||||
P.Flags |= fMinus;
|
||||
P.Width = -P.Width;
|
||||
@@ -445,8 +445,8 @@ int xvsnprintf (char* Buf, size_t Size, const char* Format, va_list ap)
|
||||
if (F == '*') {
|
||||
P.Prec = va_arg (P.ap, int);
|
||||
/* A negative precision argument is taken as if the precision
|
||||
* were omitted.
|
||||
*/
|
||||
** were omitted.
|
||||
*/
|
||||
if (P.Prec < 0) {
|
||||
P.Flags &= ~fPrec;
|
||||
}
|
||||
@@ -462,8 +462,8 @@ int xvsnprintf (char* Buf, size_t Size, const char* Format, va_list ap)
|
||||
}
|
||||
} else if (F == '-') {
|
||||
/* A negative precision argument is taken as if the precision
|
||||
* were omitted.
|
||||
*/
|
||||
** were omitted.
|
||||
*/
|
||||
F = *Format++; /* Skip the minus */
|
||||
while (IsDigit (F = *Format++)) ;
|
||||
P.Flags &= ~fPrec;
|
||||
@@ -581,8 +581,8 @@ int xvsnprintf (char* Buf, size_t Size, const char* Format, va_list ap)
|
||||
/* Handle the length by using a precision */
|
||||
if ((P.Flags & fPrec) != 0) {
|
||||
/* Precision already specified, use length of string
|
||||
* if less.
|
||||
*/
|
||||
** if less.
|
||||
*/
|
||||
if ((unsigned) P.Prec > SB_GetLen (S)) {
|
||||
P.Prec = SB_GetLen (S);
|
||||
}
|
||||
@@ -622,9 +622,9 @@ int xvsnprintf (char* Buf, size_t Size, const char* Format, va_list ap)
|
||||
va_end (P.ap);
|
||||
|
||||
/* Terminate the output string and return the number of chars that had
|
||||
* been written if the buffer was large enough.
|
||||
* Beware: The terminating zero is not counted for the function result!
|
||||
*/
|
||||
** been written if the buffer was large enough.
|
||||
** Beware: The terminating zero is not counted for the function result!
|
||||
*/
|
||||
AddChar (&P, '\0');
|
||||
return P.BufFill - 1;
|
||||
}
|
||||
@@ -633,8 +633,8 @@ int xvsnprintf (char* Buf, size_t Size, const char* Format, va_list ap)
|
||||
|
||||
int xsnprintf (char* Buf, size_t Size, const char* Format, ...)
|
||||
/* A basic snprintf implementation. Does currently only support integer
|
||||
* formats.
|
||||
*/
|
||||
** formats.
|
||||
*/
|
||||
{
|
||||
int Res;
|
||||
va_list ap;
|
||||
@@ -676,6 +676,3 @@ int xvsprintf (char* Buf, size_t BufSize, const char* Format, va_list ap)
|
||||
CHECK (Res >= 0 && (unsigned) (Res+1) < BufSize);
|
||||
return Res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,14 +34,14 @@
|
||||
|
||||
|
||||
/* We need a way to output a StrBuf, but on the other side, we don't want to
|
||||
* switch off gcc's printf format string checking. So we cheat as follows:
|
||||
* %m (which is a gcc extension and doesn't take an argument) switches %p
|
||||
* between outputting a pointer and a string buf. This works just one time,
|
||||
* so each StrBuf needs in fact a %m%p spec. There's no way to apply a width
|
||||
* and precision to such a StrBuf, but *not* using %p would bring up a warning
|
||||
* about a wrong argument type each time. Maybe gcc will one day allow custom
|
||||
* format specifiers and we can change this ...
|
||||
*/
|
||||
** switch off gcc's printf format string checking. So we cheat as follows:
|
||||
** %m (which is a gcc extension and doesn't take an argument) switches %p
|
||||
** between outputting a pointer and a string buf. This works just one time,
|
||||
** so each StrBuf needs in fact a %m%p spec. There's no way to apply a width
|
||||
** and precision to such a StrBuf, but *not* using %p would bring up a warning
|
||||
** about a wrong argument type each time. Maybe gcc will one day allow custom
|
||||
** format specifiers and we can change this ...
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -66,14 +66,14 @@
|
||||
int xvsnprintf (char* Buf, size_t Size, const char* Format, va_list ap)
|
||||
attribute ((format (printf, 3, 0)));
|
||||
/* A basic vsnprintf implementation. Does currently only support integer
|
||||
* formats.
|
||||
*/
|
||||
** formats.
|
||||
*/
|
||||
|
||||
int xsnprintf (char* Buf, size_t Size, const char* Format, ...)
|
||||
attribute ((format (printf, 3, 4)));
|
||||
/* A basic snprintf implementation. Does currently only support integer
|
||||
* formats.
|
||||
*/
|
||||
** formats.
|
||||
*/
|
||||
|
||||
int xsprintf (char* Buf, size_t BufSize, const char* Format, ...)
|
||||
attribute ((format (printf, 3, 4)));
|
||||
@@ -88,7 +88,3 @@ int xvsprintf (char* Buf, size_t BufSize, const char* Format, va_list ap)
|
||||
/* End of xsprintf.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user