commit 0edb2400c9be655222691f3abc6325fd2594e77c
parent 20b538cd28a95add96306cb58dcf6d992dd38290
Author: William Casarin <jb55@jb55.com>
Date: Tue, 24 Oct 2017 10:45:50 -0700
oplookup: make const
Diffstat:
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/mph-opcodes b/mph-opcodes
@@ -103,13 +103,13 @@ Vstrs = ",".join(map(str, V))
header = open('oplookup.h', 'w')
header.write("#include \"misc.h\"\n")
-header.write("extern int opcodes_g[{}];\n".format(len(G)))
-header.write("extern int opcodes_v[{}];\n".format(len(V)))
+header.write("extern const int opcodes_g[{}];\n".format(len(G)))
+header.write("extern const int opcodes_v[{}];\n".format(len(V)))
header.close()
cfile = open('oplookup.c', 'w')
cfile.write("#include \"oplookup.h\"\n".format(Gstrs))
-cfile.write("int opcodes_g[{}] = {{ {} }};\n".format(len(G), Gstrs))
-cfile.write("int opcodes_v[{}] = {{ {} }};\n".format(len(V), Vstrs))
+cfile.write("const int opcodes_g[{}] = {{ {} }};\n".format(len(G), Gstrs))
+cfile.write("const int opcodes_v[{}] = {{ {} }};\n".format(len(V), Vstrs))
cfile.close()
diff --git a/oplookup.c b/oplookup.c
@@ -1,3 +1,3 @@
#include "oplookup.h"
-int opcodes_g[120] = { 1,-118,0,2,-116,0,0,2,0,0,0,-114,3,-111,8,0,0,0,0,8,-110,-107,1,0,0,-101,0,-98,0,-92,0,10,1,1,0,0,0,0,-89,0,5,-88,2,-87,4,-86,-79,-78,2,0,-74,-73,-72,-70,-69,0,1,1,-63,-61,-59,-56,-55,0,0,0,-53,0,-49,0,1,-48,0,-47,0,0,2,-46,1,0,5,3,-44,-41,0,2,-38,-33,-30,14,-29,0,2,0,-28,0,-27,0,0,-26,0,0,-23,0,0,0,-20,1,-18,0,-15,-12,8,1,0,-10,10,2,6,7 };
-int opcodes_v[120] = { 66,111,5,90,50,33,76,105,6,104,65,77,55,32,116,49,71,85,75,113,60,26,52,88,46,57,86,41,96,36,18,19,69,56,95,63,42,51,30,117,4,13,80,64,68,72,67,59,74,89,83,34,44,53,24,23,48,39,22,47,21,70,20,109,112,7,103,40,25,43,8,2,9,73,99,110,81,14,15,106,97,45,17,16,29,12,10,1,120,114,58,118,31,82,37,62,92,102,3,108,107,11,28,93,27,94,79,115,98,78,87,54,38,101,35,100,119,91,84,61 };
+const int opcodes_g[120] = { 1,-118,0,2,-116,0,0,2,0,0,0,-114,3,-111,8,0,0,0,0,8,-110,-107,1,0,0,-101,0,-98,0,-92,0,10,1,1,0,0,0,0,-89,0,5,-88,2,-87,4,-86,-79,-78,2,0,-74,-73,-72,-70,-69,0,1,1,-63,-61,-59,-56,-55,0,0,0,-53,0,-49,0,1,-48,0,-47,0,0,2,-46,1,0,5,3,-44,-41,0,2,-38,-33,-30,14,-29,0,2,0,-28,0,-27,0,0,-26,0,0,-23,0,0,0,-20,1,-18,0,-15,-12,8,1,0,-10,10,2,6,7 };
+const int opcodes_v[120] = { 66,111,5,90,50,33,76,105,6,104,65,77,55,32,116,49,71,85,75,113,60,26,52,88,46,57,86,41,96,36,18,19,69,56,95,63,42,51,30,117,4,13,80,64,68,72,67,59,74,89,83,34,44,53,24,23,48,39,22,47,21,70,20,109,112,7,103,40,25,43,8,2,9,73,99,110,81,14,15,106,97,45,17,16,29,12,10,1,120,114,58,118,31,82,37,62,92,102,3,108,107,11,28,93,27,94,79,115,98,78,87,54,38,101,35,100,119,91,84,61 };
diff --git a/oplookup.h b/oplookup.h
@@ -1,3 +1,3 @@
#include "misc.h"
-extern int opcodes_g[120];
-extern int opcodes_v[120];
+extern const int opcodes_g[120];
+extern const int opcodes_v[120];