Split long lines
authorRobert Pengelly <robertapengelly@hotmail.com>
Thu, 21 May 2026 06:31:47 +0000 (07:31 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Thu, 21 May 2026 06:31:47 +0000 (07:31 +0100)
parse.c

diff --git a/parse.c b/parse.c
index 9ef7594b26542a46fc5c4ea4f03130d3026e85b1..199e2ee07c4b7a96dd13d00e9e496201f16a8a75 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -6103,10 +6103,12 @@ struct local_init {
 
 };
 
+static int scalar_count = 0;
 static int old_size = -1;
 
 static void switch_section (int sec) {
 
+    scalar_count = 0;
     old_size = -1;
     
     if (!state->ofp || current_section == sec) {
@@ -33172,14 +33174,37 @@ static void emit_global_scalar (int64_s value, int size) {
         
         } else {
         
-            fprintf (state->ofp, ", ");
+            if (scalar_count > 8) {
+            
+                fprintf (state->ofp, "\n    ");
+                scalar_count = 0;
+            
+            } else {
+                fprintf (state->ofp, ", ");
+            }
             
             if (size == (DATA_CHAR & 0x1f)) {
+            
+                if (!scalar_count) {
+                    fprintf (state->ofp, "db ");
+                }
+                
                 fprintf (state->ofp, "%ld", low & 0xFFUL);
+            
             } else if (size == (DATA_SHORT & 0x1f)) {
+            
+                if (!scalar_count) {
+                    fprintf (state->ofp, "dw ");
+                }
+                
                 fprintf (state->ofp, "%ld", low & 0xFFFFUL);
+            
             } else if (size == (DATA_LLONG & 0x1f) || size == (DATA_DOUBLE & 0x1f)) {
             
+                if (!scalar_count) {
+                    fprintf (state->ofp, "dq ");
+                }
+                
                 if (high & U32_MASK) {
                     fprintf (state->ofp, "%lu", high & U32_MASK);
                 }
@@ -33187,10 +33212,18 @@ static void emit_global_scalar (int64_s value, int size) {
                 fprintf (state->ofp, "%lu", low & U32_MASK);
             
             } else {
+            
+                if (!scalar_count) {
+                    fprintf (state->ofp, "dd ");
+                }
+                
                 fprintf (state->ofp, "%lu", low & U32_MASK);
+            
             }
         
         }
+        
+        ++scalar_count;
     
     } else if (state->syntax & ASM_SYNTAX_NASM) {
     
@@ -33512,9 +33545,9 @@ static char *emit_string_literal_global (void) {
     int value_count = 0, i;
     
     if ((state->syntax & ASM_SYNTAX_MASM) || (state->syntax & ASM_SYNTAX_NASM)) {
-        sprintf (label, "L%d", anon_label++);
+        sprintf (label, "LC%d", anon_label++);
     } else {
-        sprintf (label, ".L%d", anon_label++);
+        sprintf (label, ".LC%d", anon_label++);
     }
     
     parse_string_initializer_values (values, MAX_AGG_FIELDS, &value_count);