shithub: orca

Download patch

ref: d18d5e6c06b31f8877544e165f2a1ded3f6a3bb9
parent: 199f056146a2d21313c822c8a6f23417602d386d
author: cancel <cancel@cancel.fm>
date: Tue Nov 27 08:27:30 EST 2018

Cleanup oper name def ordering

--- a/sim.c
+++ b/sim.c
@@ -71,10 +71,10 @@
   gbuf[y * width + x] = '.';
 }
 
-#define ORCA_EXPAND_SOLO_OPER_CHARS(_oper_name, _oper_char)                    \
+#define ORCA_EXPAND_SOLO_OPER_CHARS(_oper_char, _oper_name)                    \
   Orca_oper_char_##_oper_name = _oper_char,
-#define ORCA_EXPAND_DUAL_OPER_CHARS(_oper_name, _upper_oper_char,              \
-                                    _lower_oper_char)                          \
+#define ORCA_EXPAND_DUAL_OPER_CHARS(_upper_oper_char, _lower_oper_char,        \
+                                    _oper_name)                                \
   Orca_oper_upper_char_##_oper_name = _upper_oper_char,                        \
   Orca_oper_lower_char_##_oper_name = _lower_oper_char,
 #define ORCA_DEFINE_OPER_CHARS(_solo_defs, _dual_defs)                         \
@@ -195,16 +195,16 @@
 
 //////// Operators
 
-#define ORCA_SOLO_OPERATORS(_) _(bang, '*')
+#define ORCA_SOLO_OPERATORS(_) _('*', bang)
 
 #define ORCA_DUAL_OPERATORS(_)                                                 \
-  _(north, 'N', 'n')                                                           \
-  _(east, 'E', 'e')                                                            \
-  _(south, 'S', 's')                                                           \
-  _(west, 'W', 'w')                                                            \
-  _(add, 'A', 'a')                                                             \
-  _(modulo, 'M', 'm')                                                          \
-  _(increment, 'I', 'i')
+  _('N', 'n', north)                                                           \
+  _('E', 'e', east)                                                            \
+  _('S', 's', south)                                                           \
+  _('W', 'w', west)                                                            \
+  _('A', 'a', add)                                                             \
+  _('M', 'm', modulo)                                                          \
+  _('I', 'i', increment)
 
 ORCA_DECLARE_OPERATORS(ORCA_SOLO_OPERATORS, ORCA_DUAL_OPERATORS)
 
@@ -270,24 +270,24 @@
 
 //////// Run simulation
 
-#define SIM_EXPAND_SOLO_PHASE_0(_oper_name, _oper_char)                        \
+#define SIM_EXPAND_SOLO_PHASE_0(_oper_char, _oper_name)                        \
   case _oper_char:                                                             \
     oper_phase0_##_oper_name(gbuf, mbuf, height, width, iy, ix, cell_flags);   \
     break;
-#define SIM_EXPAND_SOLO_PHASE_1(_oper_name, _oper_char)                        \
+#define SIM_EXPAND_SOLO_PHASE_1(_oper_char, _oper_name)                        \
   case _oper_char:                                                             \
     oper_phase1_##_oper_name(gbuf, mbuf, height, width, iy, ix);               \
     break;
 
-#define SIM_EXPAND_DUAL_PHASE_0(_oper_name, _upper_oper_char,                  \
-                                _lower_oper_char)                              \
+#define SIM_EXPAND_DUAL_PHASE_0(_upper_oper_char, _lower_oper_char,            \
+                                _oper_name)                                    \
   case _upper_oper_char:                                                       \
   case _lower_oper_char:                                                       \
     oper_phase0_##_oper_name(gbuf, mbuf, height, width, iy, ix, cell_flags,    \
                              glyph_char);                                      \
     break;
-#define SIM_EXPAND_DUAL_PHASE_1(_oper_name, _upper_oper_char,                  \
-                                _lower_oper_char)                              \
+#define SIM_EXPAND_DUAL_PHASE_1(_upper_oper_char, _lower_oper_char,            \
+                                _oper_name)                                    \
   case _upper_oper_char:                                                       \
   case _lower_oper_char:                                                       \
     oper_phase1_##_oper_name(gbuf, mbuf, height, width, iy, ix, glyph_char);   \