nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone
Blob Blame History Raw
From 78daaf6e506ac36dca5d6ff92618e83723d8ed23 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sun, 28 Apr 2013 13:27:51 +0200
Subject: [PATCH 371/482] 	* grub-core/term/morse.c: Macroify dih and
 dah.

---
 ChangeLog              |  4 +++
 grub-core/term/morse.c | 75 ++++++++++++++++++++++++++------------------------
 2 files changed, 43 insertions(+), 36 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3144dd0..287770e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-04-28  Vladimir Serbinenko  <phcoder@gmail.com>
+
+	* grub-core/term/morse.c: Macroify dih and dah.
+
 2013-04-27  Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
 
 	* include/grub/macho.h: Set GRUB_MACHO_FAT_EFI_MAGIC as unsigned.
diff --git a/grub-core/term/morse.c b/grub-core/term/morse.c
index 0fdc3b4..ba84dfe 100644
--- a/grub-core/term/morse.c
+++ b/grub-core/term/morse.c
@@ -27,45 +27,48 @@
 GRUB_MOD_LICENSE ("GPLv3+");
 
 #define BASE_TIME 250
+#define DIH 1
+#define DAH 3
+#define END 0
 
 static const char codes[0x80][6] =
   {
-    ['0'] = { 3, 3, 3, 3, 3, 0 },
-    ['1'] = { 1, 3, 3, 3, 3, 0 },
-    ['2'] = { 1, 1, 3, 3, 3, 0 },
-    ['3'] = { 1, 1, 1, 3, 3, 0 },
-    ['4'] = { 1, 1, 1, 1, 3, 0 },
-    ['5'] = { 1, 1, 1, 1, 1, 0 },
-    ['6'] = { 3, 1, 1, 1, 1, 0 },
-    ['7'] = { 3, 3, 1, 1, 1, 0 },
-    ['8'] = { 3, 3, 3, 1, 1, 0 },
-    ['9'] = { 3, 3, 3, 3, 1, 0 },
-    ['a'] = { 1, 3, 0 },
-    ['b'] = { 3, 1, 1, 1, 0 },
-    ['c'] = { 3, 1, 3, 1, 0 },
-    ['d'] = { 3, 1, 1, 0 },
-    ['e'] = { 1, 0 },
-    ['f'] = { 1, 1, 3, 1, 0 },
-    ['g'] = { 3, 3, 1, 0 },
-    ['h'] = { 1, 1, 1, 1, 0 },
-    ['i'] = { 1, 1, 0 },
-    ['j'] = { 1, 3, 3, 3, 0 },
-    ['k'] = { 3, 1, 3, 0 },
-    ['l'] = { 1, 3, 1, 1, 0 },
-    ['m'] = { 3, 3, 0 },
-    ['n'] = { 3, 1, 0 },
-    ['o'] = { 3, 3, 3, 0 },
-    ['p'] = { 1, 3, 3, 1, 0 },
-    ['q'] = { 3, 3, 1, 3, 0 },
-    ['r'] = { 1, 3, 1, 0 },
-    ['s'] = { 1, 1, 1, 0 },
-    ['t'] = { 3, 0 },
-    ['u'] = { 1, 1, 3, 0 },
-    ['v'] = { 1, 1, 1, 3, 0 },
-    ['w'] = { 1, 3, 3, 0 },
-    ['x'] = { 3, 1, 1, 3, 0 },
-    ['y'] = { 3, 1, 3, 3, 0 },
-    ['z'] = { 3, 3, 1, 1, 0 }
+    ['0'] = { DAH, DAH, DAH, DAH, DAH, END },
+    ['1'] = { DIH, DAH, DAH, DAH, DAH, END },
+    ['2'] = { DIH, DIH, DAH, DAH, DAH, END },
+    ['3'] = { DIH, DIH, DIH, DAH, DAH, END },
+    ['4'] = { DIH, DIH, DIH, DIH, DAH, END },
+    ['5'] = { DIH, DIH, DIH, DIH, DIH, END },
+    ['6'] = { DAH, DIH, DIH, DIH, DIH, END },
+    ['7'] = { DAH, DAH, DIH, DIH, DIH, END },
+    ['8'] = { DAH, DAH, DAH, DIH, DIH, END },
+    ['9'] = { DAH, DAH, DAH, DAH, DIH, END },
+    ['a'] = { DIH, DAH, END },
+    ['b'] = { DAH, DIH, DIH, DIH, END },
+    ['c'] = { DAH, DIH, DAH, DIH, END },
+    ['d'] = { DAH, DIH, DIH, END },
+    ['e'] = { DIH, END },
+    ['f'] = { DIH, DIH, DAH, DIH, END },
+    ['g'] = { DAH, DAH, DIH, END },
+    ['h'] = { DIH, DIH, DIH, DIH, END },
+    ['i'] = { DIH, DIH, END },
+    ['j'] = { DIH, DAH, DAH, DAH, END },
+    ['k'] = { DAH, DIH, DAH, END },
+    ['l'] = { DIH, DAH, DIH, DIH, END },
+    ['m'] = { DAH, DAH, END },
+    ['n'] = { DAH, DIH, END },
+    ['o'] = { DAH, DAH, DAH, END },
+    ['p'] = { DIH, DAH, DAH, DIH, END },
+    ['q'] = { DAH, DAH, DIH, DAH, END },
+    ['r'] = { DIH, DAH, DIH, END },
+    ['s'] = { DIH, DIH, DIH, END },
+    ['t'] = { DAH, END },
+    ['u'] = { DIH, DIH, DAH, END },
+    ['v'] = { DIH, DIH, DIH, DAH, END },
+    ['w'] = { DIH, DAH, DAH, END },
+    ['x'] = { DAH, DIH, DIH, DAH, END },
+    ['y'] = { DAH, DIH, DAH, DAH, END },
+    ['z'] = { DAH, DAH, DIH, DIH, END }
   };
 
 static void
-- 
1.8.2.1