]> git.sur5r.net Git - cc65/blobdiff - src/ca65/fragment.c
Started to generalize line info handling. Remove separate FilePos fields and
[cc65] / src / ca65 / fragment.c
index bd0e704933d53c7daf04db8c1a05b1cacbf5c369..059371e77374c24cbfa2138b340b0a0b411f47b4 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2001 Ullrich von Bassewitz                                       */
-/*               Wacholderweg 14                                             */
-/*               D-70597 Stuttgart                                           */
-/* 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 "xmalloc.h"
+
+/* ca65 */
 #include "fragment.h"
 
 
 
 /*****************************************************************************/
-/*                             struct Fragment                              */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
 
-/* List of all fragments */
-Fragment* FragList = 0;
-Fragment* FragLast = 0;
+Fragment* NewFragment (unsigned char Type, unsigned short Len)
+/* Create, initialize and return a new fragment. The fragment will be inserted
+ * into the current segment.
+ */
+{
+    /* Create a new fragment */
+    Fragment* F = xmalloc (sizeof (*F));
+
+    /* Initialize it */
+    F->Next    = 0;
+    F->LineList = 0;
+    F->LI       = EmptyCollection;
+    GetFullLineInfo (&F->LI);
+    F->Len     = Len;
+    F->Type    = Type;
+
+    /* And return it */
+    return F;
+}