stage4/generate_iec/generate_iec.cc
changeset 547 dab341e80664
parent 459 01f6664bf8c5
child 580 b6350d9f204d
--- a/stage4/generate_iec/generate_iec.cc	Wed May 09 22:59:10 2012 +0100
+++ b/stage4/generate_iec/generate_iec.cc	Wed May 09 23:00:10 2012 +0100
@@ -234,43 +234,37 @@
 
 void *visit(fixed_point_c *symbol) {return print_token(symbol);}
 
-void *visit(days_c *symbol) {
-  symbol->days->accept(*this);
-  s4o.print("d");
-  if (symbol->hours != NULL)
+/* SYM_REF5(interval_c, days, hours, minutes, seconds, milliseconds) */
+void *visit(interval_c *symbol) {
+  if (NULL != symbol->days) {
+    symbol->days->accept(*this);
+    s4o.print("d");
+  }
+
+  if (NULL != symbol->hours) {
     symbol->hours->accept(*this);
-  return NULL;
-}
-
-void *visit(hours_c *symbol) {
-  symbol->hours->accept(*this);
-  s4o.print("h");
-  if (symbol->minutes != NULL)
+    s4o.print("h");
+  }
+
+  if (NULL != symbol->minutes) {
     symbol->minutes->accept(*this);
-  return NULL;
-}
-
-void *visit(minutes_c *symbol) {
-  symbol->minutes->accept(*this);
-  s4o.print("m");
-  if (symbol->seconds != NULL)
+    s4o.print("m");
+  }
+
+  if (NULL != symbol->seconds) {
     symbol->seconds->accept(*this);
-  return NULL;
-}
-
-void *visit(seconds_c *symbol) {
-  symbol->seconds->accept(*this);
-  s4o.print("s");
-  if (symbol->milliseconds != NULL)
+    s4o.print("s");
+  }
+
+  if (NULL != symbol->milliseconds) {
     symbol->milliseconds->accept(*this);
-  return NULL;
-}
-
-void *visit(milliseconds_c *symbol) {
-  symbol->milliseconds->accept(*this);
-  s4o.print("ms");
-  return NULL;
-}
+    s4o.print("ms");
+  }
+
+  return NULL;
+}
+
+
 
 /************************************/
 /* B 1.2.3.2 - Time of day and Date */