diff main.c @ 4:0990d9322fc8

Implement address-ranged labels. Breaks compatibility of label files.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 25 Feb 2015 04:15:07 +0200
parents ec2f8f6f1dc9
children b91c47026822
line wrap: on
line diff
--- a/main.c	Wed Feb 25 04:13:08 2015 +0200
+++ b/main.c	Wed Feb 25 04:15:07 2015 +0200
@@ -422,6 +422,7 @@
       }
 
       while (!feof (file)) {
+        int tmp;
         fType = fgetc (file);
 
         if (feof (file))
@@ -429,16 +430,11 @@
 
         ungetc (fType, file);
 
-#if(0)
-	/* This is the old behaviour. -- Cameron */
-        if (!fscanf (file, "%X:", &address1) || address1 > 65535 || 
-            !fgets (labelname, sizeof labelname, file)) {
-#else
 	/* This is the xa-compatible label scanner. */
-	if (!fscanf(file, "%s%i", labelname, &address1) ||
-		address1 > 65535 ||
-		!fgets(strig, sizeof strig, file)) {
-#endif
+	if (!fscanf(file, "%s%i,%i,%i", labelname, &address1, &tmp, &address2) ||
+            address1 > 65535 ||
+            !fgets(strig, sizeof strig, file)) {
+
 	LabelError:
           fprintf (stderr, "%s: Error in label file %s.\n", prog, optarg);
 	  fprintf (stderr, "Address(?): 0x%x ... Label(?): \"%s\"\n\n",
@@ -461,7 +457,7 @@
         for (scanner = labelname; *(unsigned char *)scanner < 32; scanner++)
           if (!*scanner) goto LabelError;         /* label name missing */
 
-        AddLabel (address1, scanner);
+        AddLabel (address1, scanner, address2 != 0, address2);
       }
 
       fclose (file);