]> git.sur5r.net Git - cc65/blobdiff - src/ca65/fragment.c
New module strstack
[cc65] / src / ca65 / fragment.c
index 2d269be2101a0530e40fa554f0f6e5ec5430fba2..0d5a4b2e51801f9f2cbaeabcb4755bf0b99c6f0e 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2000 Ullrich von Bassewitz                                       */
-/*               Wacholderweg 14                                             */
-/*               D-70597 Stuttgart                                           */
-/* EMail:        uz@musoftware.de                                            */
+/* (C) 1998-2003 Ullrich von Bassewitz                                       */
+/*               Römerstrasse 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"
+#include "lineinfo.h"
+#include "scanner.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->Pos     = CurPos;
+    F->LI       = UseLineInfo (CurLineInfo);
+    F->Len     = Len;
+    F->Type    = Type;
+
+    /* And return it */
+    return F;
+}
+