-void CfgProcess (void)
-/* Process the config file after reading in object files and libraries */
-{
- ProcessSymbols (); /* ######## */
- ProcessMemory ();
- ProcessSegments ();
- ProcessFormats ();
-}
-
-
-
static void CreateRunDefines (SegDesc* S, unsigned long SegAddr)
/* Create the defines for a RUN segment */
{
-unsigned CfgAssignSegments (void)
-/* Assign segments, define linker symbols where requested. The function will
- * return the number of memory area overflows (so zero means anything went ok).
+unsigned CfgProcess (void)
+/* Process the config file after reading in object files and libraries. This
+ * includes postprocessing of the config file data but also assigning segments
+ * and defining segment/memory area related symbols. The function will return
+ * the number of memory area overflows (so zero means anything went ok).
* In case of overflows, a short mapfile can be generated later, to ease the
* task of rearranging segments for the user.
*/
{
unsigned Overflows = 0;
+ unsigned I;
+
+ /* Do postprocessing of the config file data */
+ ProcessSymbols (); /* ######## */
+ ProcessMemory ();
+ ProcessSegments ();
+ ProcessFormats ();
/* Walk through each of the memory sections. Add up the sizes and check
* for an overflow of the section. Assign the start addresses of the
* segments while doing this.
*/
- unsigned I;
for (I = 0; I < CollCount (&MemoryAreas); ++I) {
unsigned J;
void CfgRead (void);
/* Read the configuration */
-void CfgProcess (void);
-/* Process the config file after reading in object files and libraries */
-
-unsigned CfgAssignSegments (void);
-/* Assign segments, define linker symbols where requested. The function will
- * return the number of memory area overflows (so zero means anything went ok).
+unsigned CfgProcess (void);
+/* Process the config file after reading in object files and libraries. This
+ * includes postprocessing of the config file data but also assigning segments
+ * and defining segment/memory area related symbols. The function will return
+ * the number of memory area overflows (so zero means anything went ok).
* In case of overflows, a short mapfile can be generated later, to ease the
* task of rearranging segments for the user.
*/
/* */
/* */
/* */
-/* (C) 1998-2003 Ullrich von Bassewitz */
-/* Römerstrasse 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 1998-2010, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
const char* OutputName = "a.out"; /* Name of output file */
+unsigned OutputNameUsed = 0; /* Output name was used by %O */
unsigned ModuleId = 0; /* Id for o65 module */
/* */
/* */
/* */
-/* (C) 1998-2003 Ullrich von Bassewitz */
-/* Römerstrasse 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 1998-2010, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
extern const char* OutputName; /* Name of output file */
+extern unsigned OutputNameUsed; /* Output name was used by %O */
extern unsigned ModuleId; /* Id for o65 module */
+static void OptOutputName (const char* Opt, const char* Arg)
+/* Give the name of the output file */
+{
+ /* If the name of the output file has been used in the config before
+ * (by using %O) we're actually changing it later, which - in most cases -
+ * gives unexpected results, so emit a warning in this case.
+ */
+ if (OutputNameUsed) {
+ Warning ("Option `%s' should preceede options `-t' or `-C'", Opt);
+ }
+ OutputName = Arg;
+}
+
+
+
static void OptStartAddr (const char* Opt, const char* Arg)
/* Set the default start address */
{
break;
case 'o':
- OutputName = GetArg (&I, 2);
+ OptOutputName (Arg, GetArg (&I, 2));
break;
case 't':
/* Create the condes tables if requested */
ConDesCreate ();
- /* Process data from the config file */
- CfgProcess ();
-
- /* Assign start addresses for the segments, define linker symbols. The
- * function will return the number of memory area overflows (zero on
- * success).
+ /* Process data from the config file. Assign start addresses for the
+ * segments, define linker symbols. The function will return the number
+ * of memory area overflows (zero on success).
*/
- MemoryAreaOverflows = CfgAssignSegments ();
+ MemoryAreaOverflows = CfgProcess ();
/* Check module assertions */
CheckAssertions ();
if (OutputName) {
SB_AppendStr (&CfgSVal, OutputName);
}
+ OutputNameUsed = 1;
NextChar ();
break;
SB_Clear (&CfgSVal);
}
SB_Terminate (&CfgSVal);
+ OutputNameUsed = 1;
CfgTok = CFGTOK_STRCON;
break;