X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcc65%2Fcodelab.h;h=8f298e0fbcada69b2c4002e3be48a76738cc7d6b;hb=f196e7c5c93c3f29f1bb672d70be20e120d68729;hp=8e6ef97bb56092d149b8e36b8c99d93925c029e0;hpb=1fbf554c6370e8d4c50393e3b78cdae9c32129f9;p=cc65 diff --git a/src/cc65/codelab.h b/src/cc65/codelab.h index 8e6ef97bb..8f298e0fb 100644 --- a/src/cc65/codelab.h +++ b/src/cc65/codelab.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* label.h */ +/* codelab.h */ /* */ /* Code label structure */ /* */ @@ -33,8 +33,8 @@ -#ifndef LABEL_H -#define LABEL_H +#ifndef CODELAB_H +#define CODELAB_H @@ -61,16 +61,12 @@ struct CodeEntry; -/* Label flags, bitmapped */ -#define LF_DEF 0x0001U /* Label was defined */ - /* Label structure */ typedef struct CodeLabel CodeLabel; struct CodeLabel { CodeLabel* Next; /* Next in hash list */ char* Name; /* Label name */ - unsigned short Hash; /* Hash over the name */ - unsigned short Flags; /* Flag flags */ + unsigned Hash; /* Hash over the name */ struct CodeEntry* Owner; /* Owner entry */ Collection JumpFrom; /* Entries that jump here */ }; @@ -89,18 +85,40 @@ CodeLabel* NewCodeLabel (const char* Name, unsigned Hash); void FreeCodeLabel (CodeLabel* L); /* Free the given code label */ -void AddLabelRef (CodeLabel* L, struct CodeEntry* E); +#if defined(HAVE_INLINE) +INLINE unsigned CL_GetRefCount (const CodeLabel* L) +/* Get the number of references for this label */ +{ + return CollCount (&L->JumpFrom); +} +#else +# define CL_GetRefCount(L) CollCount (&(L)->JumpFrom) +#endif + +#if defined(HAVE_INLINE) +INLINE struct CodeEntry* CL_GetRef (CodeLabel* L, unsigned Index) +/* Get a code entry referencing this label */ +{ + return CollAt (&L->JumpFrom, Index); +} +#else +# define CL_GetRef(L, Index) CollAt (&(L)->JumpFrom, (Index)) +#endif + +void CL_AddRef (CodeLabel* L, struct CodeEntry* E); /* Let the CodeEntry E reference the label L */ -unsigned RemoveLabelRef (CodeLabel* L, const struct CodeEntry* E); -/* Remove a reference to this label, return the number of remaining references */ +void CL_MoveRefs (CodeLabel* OldLabel, CodeLabel* NewLabel); +/* Move all references to OldLabel to point to NewLabel. OldLabel will have no + * more references on return. + */ -void OutputCodeLabel (FILE* F, const CodeLabel* L); +void CL_Output (const CodeLabel* L, FILE* F); /* Output the code label to a file */ -/* End of label.h */ +/* End of codelab.h */ #endif