/* */
/* */
/* */
-/* (C) 1999-2000 Ullrich von Bassewitz */
+/* (C) 1999-2001 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
-/* EMail: uz@musoftware.de */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
#include <errno.h>
/* common */
+#include "print.h"
#include "xmalloc.h"
/* ld65 */
-#include "global.h"
+#include "bin.h"
+#include "config.h"
+#include "exports.h"
+#include "expr.h"
#include "error.h"
+#include "global.h"
#include "fileio.h"
+#include "lineinfo.h"
#include "segments.h"
-#include "exports.h"
-#include "config.h"
-#include "expr.h"
-#include "bin.h"
+#include "spool.h"
static unsigned BinWriteExpr (ExprNode* E, int Signed, unsigned Size,
- unsigned long Offs, void* Data)
+ unsigned long Offs attribute ((unused)),
+ void* Data)
/* Called from SegWrite for an expression. Evaluate the expression, check the
* range and write the expression value to the file.
*/
SegDesc* S = N->Seg;
/* Keep the user happy */
- if (Verbose) {
- printf (" Writing `%s'\n", S->Name);
- }
+ Print (stdout, 1, " Writing `%s'\n", GetString (S->Name));
/* Writes do only occur in the load area and not for BSS segments */
DoWrite = (S->Flags & SF_BSS) == 0 && /* No BSS segment */
S->Seg->Dumped == 0; /* Not already written */
/* Output the DoWrite flag for debugging */
- if (Verbose > 1) {
+ if (Verbosity > 1) {
PrintBoolVal ("bss", S->Flags & SF_BSS);
PrintBoolVal ("LoadArea", S->Load == M);
PrintBoolVal ("Dumped", S->Seg->Dumped);
* in the linker.
*/
Warning ("Segment `%s' in module `%s' requires larger alignment",
- S->Name, GetObjFileName (S->Seg->AlignObj));
+ GetString (S->Name), GetObjFileName (S->Seg->AlignObj));
}
/* Handle ALIGN and OFFSET/START */
* if the memory area is the load area.
*/
if (DoWrite) {
+ RelocLineInfo (S->Seg);
SegWrite (D->F, S->Seg, BinWriteExpr, D);
} else if (M->Flags & MF_FILL) {
WriteMult (D->F, M->FillVal, S->Seg->Size);
-static int BinUnresolved (const char* Name, void* D)
+static int BinUnresolved (unsigned Name attribute ((unused)), void* D)
/* Called if an unresolved symbol is encountered */
{
/* Unresolved symbols are an error in binary format. Bump the counter
return 0;
}
-
+
void BinWriteTarget (BinDesc* D, struct File* F)
/* Write a binary output file */
Memory* M;
/* Place the filename in the control structure */
- D->Filename = F->Name;
+ D->Filename = GetString (F->Name);
/* Check for unresolved symbols. The function BinUnresolved is called
* if we get an unresolved symbol.
}
/* Open the file */
- D->F = fopen (F->Name, "wb");
+ D->F = fopen (D->Filename, "wb");
if (D->F == 0) {
- Error ("Cannot open `%s': %s", F->Name, strerror (errno));
+ Error ("Cannot open `%s': %s", D->Filename, strerror (errno));
}
/* Keep the user happy */
- if (Verbose) {
- printf ("Opened `%s'...\n", F->Name);
- }
+ Print (stdout, 1, "Opened `%s'...\n", D->Filename);
/* Dump all memory areas */
M = F->MemList;
while (M) {
- if (Verbose) {
- printf (" Dumping `%s'\n", M->Name);
- }
+ Print (stdout, 1, " Dumping `%s'\n", GetString (M->Name));
BinWriteMem (D, M);
M = M->FNext;
}
/* Close the file */
if (fclose (D->F) != 0) {
- Error ("Cannot write to `%s': %s", F->Name, strerror (errno));
+ Error ("Cannot write to `%s': %s", D->Filename, strerror (errno));
}
/* Reset the file and filename */
+