/* */
/* */
/* */
-/* (C) 1998 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
-/* EMail: uz@musoftware.de */
+/* (C) 1998-2001 Ullrich von Bassewitz */
+/* Wacholderweg 14 */
+/* D-70597 Stuttgart */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
#include <string.h>
-#include "mem.h"
+/* common */
+#include "check.h"
+#include "xmalloc.h"
+
+/* ld65 */
#include "error.h"
+#include "fileinfo.h"
#include "objdata.h"
/* Allocate a new structure on the heap, insert it into the list, return it */
{
/* Allocate memory */
- ObjData* O = Xmalloc (sizeof (ObjData));
+ ObjData* O = xmalloc (sizeof (ObjData));
/* Initialize the data */
O->Next = 0;
O->Imports = 0;
O->DbgSymCount = 0;
O->DbgSyms = 0;
+ O->LineInfoCount = 0;
+ O->LineInfos = 0;
/* Link it into the list */
if (ObjLast) {
- ObjLast->Next = O;
- ObjLast = O;
+ ObjLast->Next = O;
+ ObjLast = O;
} else {
- /* First entry */
- ObjRoot = ObjLast = O;
+ /* First entry */
+ ObjRoot = ObjLast = O;
}
/* One object file more now */
void FreeObjData (ObjData* O)
/* Free a complete struct */
{
- Xfree (O->Name);
- Xfree (O->Imports);
- Xfree (O->Exports);
- Xfree (O->DbgSyms);
- Xfree (O);
+ xfree (O->Name);
+ xfree (O->Imports);
+ xfree (O->Exports);
+ xfree (O->DbgSyms);
+ xfree (O->LineInfos);
+ xfree (O);
+}
+
+
+
+const char* GetObjFileName (const ObjData* O)
+/* Get the name of the object file. Return "[linker generated]" if the object
+ * file is NULL.
+ */
+{
+ return O? O->Name : "[linker generated]";
}
+const char* GetSourceFileName (const ObjData* O, unsigned Index)
+/* Get the name of the source file with the given index. If O is NULL, return
+ * "[linker generated]" as the file name.
+ */
+{
+ /* Check if we have an object file */
+ if (O == 0) {
+
+ /* No object file */
+ return "[linker generated]";
+
+ } else {
+
+ /* Check the parameter */
+ PRECONDITION (Index < O->FileCount);
+
+ /* Return the name */
+ return O->Files[Index]->Name;
+
+ }
+}
+
+
+
+