Changed multi-line C comments into another style.

The left side doesn't look unbalanced.
This commit is contained in:
Greg King
2014-06-30 05:10:35 -04:00
parent 132d57f1ad
commit 0390c34e88
502 changed files with 8869 additions and 8884 deletions

View File

@@ -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;

View File

@@ -50,8 +50,8 @@
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.
*/

View File

@@ -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;

View File

@@ -64,8 +64,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.
*/

View File

@@ -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];

View File

@@ -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 */

View File

@@ -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)

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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)))

View File

@@ -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') {

View File

@@ -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 */

View File

@@ -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,10 +495,10 @@ 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);

View File

@@ -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,46 +255,46 @@ 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.
*/

View File

@@ -119,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;

View File

@@ -94,8 +94,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.
*/

View File

@@ -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);

View File

@@ -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,10 +66,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.
*/

View File

@@ -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;

View File

@@ -68,9 +68,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.
*/

View File

@@ -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,14 +68,14 @@
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.
*/
** 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;
@@ -99,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,

View File

@@ -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.
*/

View File

@@ -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
*/
@@ -68,14 +68,14 @@
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.
*/
** 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;
@@ -88,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;
@@ -129,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;

View File

@@ -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,9 +59,9 @@
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").
*/

View File

@@ -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);

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 2003 Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
@@ -65,8 +65,8 @@ 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.
*/

View File

@@ -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);

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 2000-2003 Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
@@ -49,15 +49,15 @@ 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".
*/

View File

@@ -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.
*/

View File

@@ -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!
*/

View File

@@ -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);

View File

@@ -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,20 +132,20 @@
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.
*/

View File

@@ -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);

View File

@@ -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;

View File

@@ -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,12 +165,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.
*/

View File

@@ -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.
*/

View File

@@ -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;

View File

@@ -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') {

View File

@@ -50,11 +50,11 @@
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.
*/

View File

@@ -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;

View File

@@ -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,8 +74,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.
*/

View File

@@ -115,8 +115,8 @@ void AddSearchPath (SearchPaths* P, const char* NewPath)
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));
}
@@ -125,8 +125,8 @@ void AddSearchPathFromEnv (SearchPaths* P, const char* EnvVar)
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;
@@ -162,9 +162,9 @@ void AddSubSearchPathFromEnv (SearchPaths* P, const char* EnvVar, const char* Su
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.
*/
#if defined(_WIN32)
char Dir[_MAX_PATH];
@@ -207,9 +207,9 @@ void AddSubSearchPathFromWinBin (SearchPaths* P, const char* SubDir)
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);
@@ -240,8 +240,8 @@ void PopSearchPath (SearchPaths* P)
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;

View File

@@ -71,33 +71,33 @@ void AddSearchPath (SearchPaths* P, const char* NewPath);
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 (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 (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 (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 (SearchPaths* P);
/* Remove a search path from the head of an existing search path list */
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.
*/

View File

@@ -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!
*/

View File

@@ -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!
*/

View File

@@ -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,10 +483,10 @@ 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);

View File

@@ -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,17 +404,17 @@ 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).
*/

View File

@@ -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));

View File

@@ -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 */

View File

@@ -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) {

View File

@@ -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 */

View File

@@ -119,8 +119,8 @@ struct TargetEntry {
};
/* Table that maps target names to ids. Sorted alphabetically for bsearch.
* Allows mupltiple 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 },
@@ -203,8 +203,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;

View File

@@ -107,8 +107,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 */

View File

@@ -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));
}

View File

@@ -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 */

View File

@@ -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;

View File

@@ -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)));