]> git.sur5r.net Git - cc65/blobdiff - src/ca65/main.c
Renamed some stuff. Write out the segment size as var, not 32 bit.
[cc65] / src / ca65 / main.c
index 2d1cd5432748b9476c384bf93d482d48c935b015..7364891bc7208c54fac12eed9fbde5f7bd8c7678 100644 (file)
@@ -807,12 +807,12 @@ static void CreateObjFile (void)
     /* Write the export list */
     WriteExports ();
 
-    /* Write the scopes if requested */
-    WriteScopes ();
-
     /* Write debug symbols if requested */
     WriteDbgSyms ();
 
+    /* Write the scopes if requested */
+    WriteScopes ();
+
     /* Write line infos if requested */
     WriteLineInfos ();
 
@@ -866,10 +866,13 @@ int main (int argc, char* argv [])
     /* Initialize the include search paths */
     InitIncludePaths ();
 
+    /* Create the predefined segments */
+    SegInit ();
+
     /* Enter the base lexical level. We must do that here, since we may
      * define symbols using -D.
      */
-    SymEnterLevel (&GlobalNameSpace, SCOPETYPE_FILE, ADDR_SIZE_DEFAULT, 0);
+    SymEnterLevel (&GlobalNameSpace, SCOPE_FILE, ADDR_SIZE_DEFAULT, 0);
 
     /* Initialize the line infos. Must be done here, since we need line infos
      * for symbol definitions.
@@ -991,8 +994,8 @@ int main (int argc, char* argv [])
         SetMemoryModel (MMODEL_NEAR);
     }
 
-    /* Initialize the segments */
-    InitSegments ();
+    /* Set the default segment sizes according to the memory model */
+    SetSegmentSizes ();
 
     /* Initialize the scanner, open the input file */
     InitScanner (InFile);
@@ -1008,9 +1011,9 @@ int main (int argc, char* argv [])
         CheckPseudo ();
     }
 
-    /* If we didn't have any errors, check the unnamed labels */
+    /* If we didn't have any errors, check and cleanup the unnamed labels */
     if (ErrorCount == 0) {
-        ULabCheck ();
+        ULabDone ();
     }
 
     /* If we didn't have any errors, check the symbol table */
@@ -1018,25 +1021,30 @@ int main (int argc, char* argv [])
         SymCheck ();
     }
 
+    /* If we didn't have any errors, close the file scope lexical level */
+    if (ErrorCount == 0) {
+        SymLeaveLevel ();
+    }
+
     /* If we didn't have any errors, check and resolve the segment data */
     if (ErrorCount == 0) {
-        SegCheck ();
+        SegDone ();
     }
 
-    /* If we didn't have any errors, check the assertions */
+    /* If we didn't have any errors, check       the assertions */
     if (ErrorCount == 0) {
         CheckAssertions ();
     }
 
-    /* If we didn't have an errors, index the line infos */
-    MakeLineInfoIndex ();
-
     /* Dump the data */
     if (Verbosity >= 2) {
         SymDump (stdout);
         SegDump ();
     }
 
+    /* If we didn't have an errors, finish off the line infos */
+    DoneLineInfo ();
+
     /* If we didn't have any errors, create the object, listing and
      * dependency files
      */