]> git.sur5r.net Git - cc65/blobdiff - src/ld65/fragment.h
Merge remote-tracking branch 'upstream/master' into a5200
[cc65] / src / ld65 / fragment.h
index 4165a15f3f22332f24a86d2003e7cc199aa56673..7d6dd92016727718228b5d4b77f5f9c219979b27 100644 (file)
@@ -1,15 +1,15 @@
 /*****************************************************************************/
 /*                                                                           */
-/*                               fragment.h                                 */
+/*                                fragment.h                                 */
 /*                                                                           */
-/*                       Code/data fragment routines                        */
+/*                        Code/data fragment routines                        */
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2003 Ullrich von Bassewitz                                       */
-/*               Römerstrasse 52                                             */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 1998-2011, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
 
 
 /* common */
+#include "coll.h"
 #include "filepos.h"
 
+/* Ld65 */
+#include "lineinfo.h"
 
 
 /*****************************************************************************/
-/*                                Forwards                                  */
+/*                                 Forwards                                  */
 /*****************************************************************************/
 
 
 
-struct LineInfo;
+struct ObjData;
 struct Section;
 
 
 
 /*****************************************************************************/
-/*                                          Data                                    */
+/*                                   Data                                    */
 /*****************************************************************************/
 
 
@@ -63,35 +66,49 @@ struct Section;
 /* Fragment structure */
 typedef struct Fragment Fragment;
 struct Fragment {
-    Fragment*          Next;           /* Next fragment in list */
-    struct ObjData*    Obj;            /* Source of fragment */
-    unsigned long              Size;           /* Size of data/expression */
-    struct ExprNode*   Expr;           /* Expression if FRAG_EXPR */
-    FilePos            Pos;            /* File position in source */
-    struct LineInfo*    LI;             /* Additional line info */
-    struct ExprNode*    WarnExpr;       /* Print warning if expr true */
-    struct ExprNode*    ErrorExpr;      /* Print error if expr true */
-    unsigned char      Type;           /* Type of fragment */
-    unsigned char              LitBuf [1];     /* Dynamically alloc'ed literal buffer */
+    Fragment*           Next;           /* Next fragment in list */
+    struct ObjData*     Obj;            /* Source of fragment */
+    struct Section*     Sec;            /* Section for this fragment */
+    unsigned            Size;           /* Size of data/expression */
+    struct ExprNode*    Expr;           /* Expression if FRAG_EXPR */
+    Collection          LineInfos;      /* Line info for this fragment */
+    unsigned char       Type;           /* Type of fragment */
+    unsigned char       LitBuf [1];     /* Dynamically alloc'ed literal buffer */
 };
 
 
 
 /*****************************************************************************/
-/*                                          Code                                    */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
 
-Fragment* NewFragment (unsigned char Type, unsigned long Size, struct Section* S);
+Fragment* NewFragment (unsigned char Type, unsigned Size, struct Section* S);
 /* Create a new fragment and insert it into the section S */
 
+#if defined(HAVE_INLINE)
+INLINE const char* GetFragmentSourceName (const Fragment* F)
+/* Return the name of the source file for this fragment */
+{
+    return GetSourceNameFromList (&F->LineInfos);
+}
+#else
+#  define GetFragmentSourceName(F)      GetSourceNameFromList (&(F)->LineInfos)
+#endif
 
-
-/* End of fragment.h */
-
+#if defined(HAVE_INLINE)
+INLINE unsigned GetFragmentSourceLine (const Fragment* F)
+/* Return the source file line for this fragment */
+{               
+    return GetSourceLineFromList (&F->LineInfos);
+}
+#else
+#  define GetFragmentSourceLine(F)      GetSourceLineFromList (&(F)->LineInfos)
 #endif
 
 
 
+/* End of fragment.h */
 
+#endif