]> git.sur5r.net Git - cc65/blobdiff - src/cc65/codelab.h
Fixed the cc65 code that handled an addition of a pointer to a 32-bit offset.
[cc65] / src / cc65 / codelab.h
index 0aef14857b015242d922b6ffd356ac9e771bbe29..103049b2323002599933b2efb73fe28a7e127664 100644 (file)
@@ -1,15 +1,15 @@
 /*****************************************************************************/
 /*                                                                           */
-/*                                codelab.h                                 */
+/*                                 codelab.h                                 */
 /*                                                                           */
-/*                          Code label structure                            */
+/*                           Code label structure                            */
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2001     Ullrich von Bassewitz                                        */
-/*              Wacholderweg 14                                              */
-/*              D-70597 Stuttgart                                            */
-/* EMail:       uz@musoftware.de                                             */
+/* (C) 2001-2009, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
 
 
 
-#include <stdio.h>
-
 /* common */
 #include "coll.h"
 
 
 
 /*****************************************************************************/
-/*                                Forwards                                  */
+/*                                 Forwards                                  */
 /*****************************************************************************/
 
 
@@ -56,29 +54,25 @@ struct CodeEntry;
 
 
 /*****************************************************************************/
-/*                            struct CodeLabel                              */
+/*                             struct CodeLabel                              */
 /*****************************************************************************/
 
 
 
-/* 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 */
-    struct CodeEntry*  Owner;          /* Owner entry */
-    Collection         JumpFrom;       /* Entries that jump here */
+    CodeLabel*          Next;           /* Next in hash list */
+    char*               Name;           /* Label name */
+    unsigned            Hash;           /* Hash over the name */
+    struct CodeEntry*   Owner;          /* Owner entry */
+    Collection          JumpFrom;       /* Entries that jump here */
 };
 
 
 
 /*****************************************************************************/
-/*                                          Code                                    */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
@@ -89,24 +83,39 @@ CodeLabel* NewCodeLabel (const char* Name, unsigned Hash);
 void FreeCodeLabel (CodeLabel* L);
 /* Free the given code label */
 
-void AddLabelRef (CodeLabel* L, struct CodeEntry* E);
-/* Let the CodeEntry E reference the label L */
+#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
 
-unsigned RemoveLabelRef (CodeLabel* L, const struct CodeEntry* E);
-/* Remove a reference to this label, return the number of remaining references */
+#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 MoveLabelRefs (CodeLabel* OldLabel, CodeLabel* NewLabel);
+void CL_AddRef (CodeLabel* L, struct CodeEntry* E);
+/* Let the CodeEntry E reference the label L */
+
+void CL_MoveRefs (CodeLabel* OldLabel, CodeLabel* NewLabel);
 /* Move all references to OldLabel to point to NewLabel. OldLabel will have no
- * more references on return.
- */
+** more references on return.
+*/
 
-void OutputCodeLabel (const CodeLabel* L, FILE* F);
-/* Output the code label to a file */
+void CL_Output (const CodeLabel* L);
+/* Output the code label to the output file */
 
 
 
 /* End of codelab.h */
-#endif
-
-
 
+#endif