/* */
/* */
/* */
-/* (C) 2000-2008 Ullrich von Bassewitz */
-/* Roemerstrasse 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 2000-2009, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* Print the header for a new page. It is assumed that the given line is the
* last line of the previous page.
*/
-{
+{
/* Gte a pointer to the current input file */
const StrBuf* CurFile = GetFileName (L->File);
VER_MAJOR, VER_MINOR, VER_PATCH,
Copyright,
InFile,
- SB_GetLen (CurFile), SB_GetConstBuf (CurFile));
+ (int) SB_GetLen (CurFile), SB_GetConstBuf (CurFile));
/* Count pages, reset lines */
++PageNumber;
/* */
/* */
/* */
-/* (C) 2000-2008 Ullrich von Bassewitz */
-/* Roemerstrasse 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 2000-2009, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
if (Tok == Expected) {
NextTok ();
} else {
- Error (ErrMsg);
+ Error ("%s", ErrMsg);
}
}
/* */
/* */
/* */
-/* (C) 1998-2008, Ullrich von Bassewitz */
+/* (C) 1998-2009, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* Output the string and be sure to flush the output to keep it in
* sync with any error messages if the output is redirected to a file.
*/
- printf ("%*s\n", SB_GetLen (&SVal), SB_GetConstBuf (&SVal));
+ printf ("%.*s\n", (int) SB_GetLen (&SVal), SB_GetConstBuf (&SVal));
fflush (stdout);
NextTok ();
}
{
const OPCDesc* D;
unsigned Chars;
+ int Space;
const char* Target;
/* If we have a label, print that */
/* Print the mnemonic */
Chars = WriteOutput ("\t%s", D->Mnemo);
+
+ /* Space to leave before the operand */
+ Space = 9 - Chars;
/* Print the operand */
switch (E->AM) {
case AM65_ACC:
/* accumulator */
- Chars += WriteOutput ("%*sa", 9-Chars, "");
+ Chars += WriteOutput ("%*sa", Space, "");
break;
case AM65_IMM:
/* immidiate */
- Chars += WriteOutput ("%*s#%s", 9-Chars, "", E->Arg);
+ Chars += WriteOutput ("%*s#%s", Space, "", E->Arg);
break;
case AM65_ZP:
case AM65_ABS:
/* zeropage and absolute */
- Chars += WriteOutput ("%*s%s", 9-Chars, "", E->Arg);
+ Chars += WriteOutput ("%*s%s", Space, "", E->Arg);
break;
case AM65_ZPX:
case AM65_ABSX:
/* zeropage,X and absolute,X */
- Chars += WriteOutput ("%*s%s,x", 9-Chars, "", E->Arg);
+ Chars += WriteOutput ("%*s%s,x", Space, "", E->Arg);
break;
case AM65_ABSY:
/* absolute,Y */
- Chars += WriteOutput ("%*s%s,y", 9-Chars, "", E->Arg);
+ Chars += WriteOutput ("%*s%s,y", Space, "", E->Arg);
break;
case AM65_ZPX_IND:
/* (zeropage,x) */
- Chars += WriteOutput ("%*s(%s,x)", 9-Chars, "", E->Arg);
+ Chars += WriteOutput ("%*s(%s,x)", Space, "", E->Arg);
break;
case AM65_ZP_INDY:
/* (zeropage),y */
- Chars += WriteOutput ("%*s(%s),y", 9-Chars, "", E->Arg);
+ Chars += WriteOutput ("%*s(%s),y", Space, "", E->Arg);
break;
case AM65_ZP_IND:
/* (zeropage) */
- Chars += WriteOutput ("%*s(%s)", 9-Chars, "", E->Arg);
+ Chars += WriteOutput ("%*s(%s)", Space, "", E->Arg);
break;
case AM65_BRA:
/* branch */
Target = E->JumpTo? E->JumpTo->Name : E->Arg;
- Chars += WriteOutput ("%*s%s", 9-Chars, "", Target);
+ Chars += WriteOutput ("%*s%s", Space, "", Target);
break;
default:
}
/* Print usage info if requested by the debugging flag */
- if (Debug) {
+ if (Debug) {
char Use [128];
char Chg [128];
WriteOutput ("%*s; USE: %-12s CHG: %-12s SIZE: %u",
- 30-Chars, "",
+ (int)(30-Chars), "",
RegInfoDesc (E->Use, Use),
RegInfoDesc (E->Chg, Chg),
E->Size);
void g_leasp (int Offs)
/* Fetch the address of the specified symbol into the primary register */
{
- unsigned char Lo, Hi;
+ unsigned char Lo, Hi;
/* Calculate the offset relative to sp */
Offs -= StackPtr;
} while (Chunk);
/* Output the line */
- AddDataLine (Buf);
+ AddDataLine ("%s", Buf);
}
}
void g_asmcode (struct StrBuf* B)
/* Output one line of assembler code. */
{
- AddCodeLine ("%.*s", SB_GetLen (B), SB_GetConstBuf (B));
+ AddCodeLine ("%.*s", (int) SB_GetLen (B), SB_GetConstBuf (B));
}
if (CE_HasLabel (FirstEntry)) {
/* Get the entry following last */
CodeEntry* FollowingEntry = CS_GetNextEntry (S, Last);
- if (FollowingEntry) {
+ if (FollowingEntry) {
/* There is an entry after Last - move the labels */
CS_MoveLabels (S, FirstEntry, FollowingEntry);
} else {
const char* N = strchr (L, '\n');
if (N) {
/* We have a newline, just write the first part */
- WriteOutput ("%.*s\n; ", N - L, L);
+ WriteOutput ("%.*s\n; ", (int) (N - L), L);
L = N+1;
} else {
/* No Newline, write as is */
/* Preprocess each line and write it to the output file */
while (NextLine ()) {
Preprocess ();
- WriteOutput ("%.*s\n", SB_GetLen (Line), SB_GetConstBuf (Line));
+ WriteOutput ("%.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
}
/* Close the output file */
/* */
/* */
/* */
-/* (C) 1998-2004 Ullrich von Bassewitz */
-/* Römerstraße 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 1998-2009, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
fprintf (stderr, "\n");
if (Line) {
- Print (stderr, 1, "Input: %.*s\n", SB_GetLen (Line), SB_GetConstBuf (Line));
+ Print (stderr, 1, "Input: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
}
++WarningCount;
}
fprintf (stderr, "\n");
if (Line) {
- Print (stderr, 1, "Input: %.*s\n", SB_GetLen (Line), SB_GetConstBuf (Line));
+ Print (stderr, 1, "Input: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
}
++ErrorCount;
if (ErrorCount > 10) {
fprintf (stderr, "\n");
if (Line) {
- Print (stderr, 1, "Input: %.*s\n", SB_GetLen (Line), SB_GetConstBuf (Line));
+ Print (stderr, 1, "Input: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
}
exit (EXIT_FAILURE);
}
fprintf (stderr, "\n");
if (Line) {
- fprintf (stderr, "\nInput: %.*s\n", SB_GetLen (Line), SB_GetConstBuf (Line));
+ fprintf (stderr, "\nInput: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
}
/* Use abort to create a core dump */
/* */
/* */
/* */
-/* (C) 1998-2008, Ullrich von Bassewitz */
+/* (C) 1998-2009, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
Done:
if (Verbosity > 1 && SB_NotEmpty (Line)) {
printf ("%s(%u): %.*s\n", GetCurrentFile (), GetCurrentLine (),
- SB_GetLen (Line), SB_GetConstBuf (Line));
+ (int) SB_GetLen (Line), SB_GetConstBuf (Line));
}
}
NextToken ();
return 1;
} else {
- Error (ErrorMsg);
+ Error ("%s", ErrorMsg);
return 0;
}
}
*/
{
if (CurTok.Tok != Tok) {
- Error (Msg);
+ Error ("%s", Msg);
} else if (PendingToken) {
*PendingToken = 1;
} else {
/* */
/* */
/* */
-/* (C) 2000-2004 Ullrich von Bassewitz */
-/* Römerstrasse 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 2000-2009, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
xvsprintf (Buf, sizeof (Buf), Arg, ap);
va_end (ap);
Indent (ACol);
- Output (Buf);
+ Output ("%s", Buf);
/* Add the code stuff as comment */
LineComment (PC, D->Size);
/* */
/* */
/* */
-/* (C) 1998-2008, Ullrich von Bassewitz */
+/* (C) 1998-2009, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* Skip a token, print an error message if not found */
{
if (CfgTok != T) {
- CfgError (Msg);
+ CfgError ("%s", Msg);
}
CfgNextTok ();
}
/* */
/* */
/* */
-/* (C) 2002-2003 Ullrich von Bassewitz */
-/* Römerstrasse 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 2002-2009, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
case OPT_ARGSTR:
ArgStr = GetString (&StrPool, Val);
ArgLen = strlen (ArgStr);
- printf (" Data:%*s\"%s\"\n", 24-ArgLen, "", ArgStr);
+ printf (" Data:%*s\"%s\"\n", (int)(24-ArgLen), "", ArgStr);
break;
case OPT_ARGNUM:
printf (" Index:%27u\n", I);
/* Print the data */
- printf (" Name:%*s\"%s\"\n", 24-Len, "", Name);
+ printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
printf (" Size:%26lu\n", Size);
printf (" Modification time:%13lu (%s)\n", MTime, TimeToStr (MTime));
}
printf (" Index:%27u\n", I);
/* Print the data */
- printf (" Name:%*s\"%s\"\n", 24-Len, "", Name);
+ printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
printf (" Size:%26lu\n", Size);
printf (" Alignment:%21u\n", Align);
printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize,
/* Print the data */
printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize,
AddrSizeToStr (AddrSize));
- printf (" Name:%*s\"%s\"\n", 24-Len, "", Name);
+ printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
}
/* Destroy the string pool */
printf (" Type:%22s0x%02X (%s)\n", "", Type, GetExportFlags (Type, ConDes));
printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize,
AddrSizeToStr (AddrSize));
- printf (" Name:%*s\"%s\"\n", 24-Len, "", Name);
+ printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
if (HaveValue) {
printf (" Value:%15s0x%08lX (%lu)\n", "", Value, Value);
}
printf (" Type:%22s0x%02X (%s)\n", "", Type, GetExportFlags (Type, 0));
printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize,
AddrSizeToStr (AddrSize));
- printf (" Name:%*s\"%s\"\n", 24-Len, "", Name);
+ printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
if (HaveValue) {
printf (" Value:%15s0x%08lX (%lu)\n", "", Value, Value);
}
(void) ReadVar (F);
/* Print the size for this segment */
- printf (" %s:%*s%6lu\n", Name, 24-Len, "", Size);
+ printf (" %s:%*s%6lu\n", Name, (int)(24-Len), "", Size);
/* Seek to the end of the segment data (start of next) */
FileSetPos (F, NextSeg);