]> git.sur5r.net Git - cc65/blobdiff - src/cc65/codeent.c
Working on the backend
[cc65] / src / cc65 / codeent.c
index bdf8d268a8c050de4e81cbc286558713c49b1bd4..d8f852bc9507c6429d8f22f724d263f4f27079c9 100644 (file)
@@ -73,6 +73,7 @@ CodeEntry* NewCodeEntry (const OPCDesc* D, am_t AM, const char* Arg, CodeLabel*
     E->Arg     = (Arg && Arg[0] != '\0')? xstrdup (Arg) : 0;
     E->Num     = 0;
     E->Flags   = 0;
+    E->Info    = D->Info;
     E->Use     = D->Use;
     E->Chg     = D->Chg;
     if (E->OPC == OPC_JSR && E->Arg) {
@@ -119,6 +120,51 @@ int CodeEntryHasLabel (const CodeEntry* E)
 
 
 
+int CodeEntryHasMark (const CodeEntry* E)
+/* Return true if the given code entry has the CEF_USERMARK flag set */
+{
+    return (E->Flags & CEF_USERMARK) != 0;
+}
+
+
+
+void CodeEntrySetMark (CodeEntry* E)
+/* Set the CEF_USERMARK flag for the given entry */
+{
+    E->Flags |= CEF_USERMARK;
+}
+
+
+
+void CodeEntryResetMark (CodeEntry* E)
+/* Reset the CEF_USERMARK flag for the given entry */
+{
+    E->Flags &= ~CEF_USERMARK;
+}
+
+
+
+CodeLabel* GetCodeLabel (CodeEntry* E, unsigned Index)
+/* Get a label from this code entry */
+{
+    return CollAt (&E->Labels, Index);
+}
+
+
+
+void MoveCodeLabel (CodeLabel* L, CodeEntry* E)
+/* Move the code label L from it's former owner to the code entry E. */
+{
+    /* Delete the label from the owner */
+    CollDeleteItem (&L->Owner->Labels, L);
+
+    /* Set the new owner */
+    CollAppend (&E->Labels, L);
+    L->Owner = E;
+}
+
+
+
 void OutputCodeEntry (const CodeEntry* E, FILE* F)
 /* Output the code entry to a file */
 {