comparison vm/vmcmd.c @ 331:3ddf1838e3b1 src

make static const various tables; NULL were changed to emtpy strings; patch by Diego Petten
author nicodvb
date Sat, 05 Jan 2008 15:17:28 +0000
parents 2146ff691bcd
children 2e9382be8e25
comparison
equal deleted inserted replaced
330:e851da7ec146 331:3ddf1838e3b1
51 /* freebsd compatibility */ 51 /* freebsd compatibility */
52 #ifndef PRIu16 52 #ifndef PRIu16
53 #define PRIu16 "d" 53 #define PRIu16 "d"
54 #endif 54 #endif
55 55
56 static const char *cmp_op_table[] = { 56 static const char cmp_op_table[][4] = {
57 NULL, "&", "==", "!=", ">=", ">", "<=", "<" 57 "", "&", "==", "!=", ">=", ">", "<=", "<"
58 }; 58 };
59 static const char *set_op_table[] = { 59 static const char set_op_table[][4] = {
60 NULL, "=", "<->", "+=", "-=", "*=", "/=", "%=", "rnd", "&=", "|=", "^=" 60 "", "=", "<->", "+=", "-=", "*=", "/=", "%=", "rnd", "&=", "|=", "^="
61 }; 61 };
62 62
63 static const char *link_table[] = { 63 static const char link_table[][16] = {
64 "LinkNoLink", "LinkTopC", "LinkNextC", "LinkPrevC", 64 "LinkNoLink", "LinkTopC", "LinkNextC", "LinkPrevC",
65 NULL, "LinkTopPG", "LinkNextPG", "LinkPrevPG", 65 "", "LinkTopPG", "LinkNextPG", "LinkPrevPG",
66 NULL, "LinkTopPGC", "LinkNextPGC", "LinkPrevPGC", 66 "", "LinkTopPGC", "LinkNextPGC", "LinkPrevPGC",
67 "LinkGoUpPGC", "LinkTailPGC", NULL, NULL, 67 "LinkGoUpPGC", "LinkTailPGC", "", "",
68 "RSM" 68 "RSM"
69 }; 69 };
70 70
71 static const char *system_reg_table[] = { 71 static const char *const system_reg_table[] = {
72 "Menu Description Language Code", 72 "Menu Description Language Code",
73 "Audio Stream Number", 73 "Audio Stream Number",
74 "Sub-picture Stream Number", 74 "Sub-picture Stream Number",
75 "Angle Number", 75 "Angle Number",
76 "Title Track Number", 76 "Title Track Number",
93 "Reserved 21", 93 "Reserved 21",
94 "Reserved 22", 94 "Reserved 22",
95 "Reserved 23" 95 "Reserved 23"
96 }; 96 };
97 97
98 static const char *system_reg_abbr_table[] = { 98 static const char system_reg_abbr_table[][8] = {
99 NULL, 99 "",
100 "ASTN", 100 "ASTN",
101 "SPSTN", 101 "SPSTN",
102 "AGLN", 102 "AGLN",
103 "TTN", 103 "TTN",
104 "VTS_TTN", 104 "VTS_TTN",
105 "TT_PGCN", 105 "TT_PGCN",
106 "PTTN", 106 "PTTN",
107 "HL_BTNN", 107 "HL_BTNN",
108 "NVTMR", 108 "NVTMR",
109 "NV_PGCN", 109 "NV_PGCN",
110 NULL, 110 "",
111 "CC_PLT", 111 "CC_PLT",
112 "PLT", 112 "PLT",
113 NULL, 113 "",
114 NULL, 114 "",
115 NULL, 115 "",
116 NULL, 116 "",
117 NULL, 117 "",
118 NULL, 118 "",
119 NULL, 119 "",
120 NULL, 120 "",
121 NULL, 121 "",
122 NULL, 122 "",
123 }; 123 };
124 124
125 static void print_system_reg(uint16_t reg) { 125 static void print_system_reg(uint16_t reg) {
126 if(reg < sizeof(system_reg_abbr_table) / sizeof(char *)) 126 if(reg < sizeof(system_reg_abbr_table) / sizeof(system_reg_abbr_table[0]))
127 fprintf(MSG_OUT, "%s (SRPM:%d)", system_reg_table[reg], reg); 127 fprintf(MSG_OUT, "%s (SRPM:%d)", system_reg_table[reg], reg);
128 else 128 else
129 fprintf(MSG_OUT, " WARNING: Unknown system register ( reg=%d ) ", reg); 129 fprintf(MSG_OUT, " WARNING: Unknown system register ( reg=%d ) ", reg);
130 } 130 }
131 131
142 else 142 else
143 print_g_reg(reg & 0x7f); 143 print_g_reg(reg & 0x7f);
144 } 144 }
145 145
146 static void print_cmp_op(uint8_t op) { 146 static void print_cmp_op(uint8_t op) {
147 if(op < sizeof(cmp_op_table) / sizeof(char *) && cmp_op_table[op] != NULL) 147 if(op < sizeof(cmp_op_table) / sizeof(cmp_op_table[0]))
148 fprintf(MSG_OUT, " %s ", cmp_op_table[op]); 148 fprintf(MSG_OUT, " %s ", cmp_op_table[op]);
149 else 149 else
150 fprintf(MSG_OUT, " WARNING: Unknown compare op "); 150 fprintf(MSG_OUT, " WARNING: Unknown compare op ");
151 } 151 }
152 152
153 static void print_set_op(uint8_t op) { 153 static void print_set_op(uint8_t op) {
154 if(op < sizeof(set_op_table) / sizeof(char *) && set_op_table[op] != NULL) 154 if(op < sizeof(set_op_table) / sizeof(cmp_op_table[0]))
155 fprintf(MSG_OUT, " %s ", set_op_table[op]); 155 fprintf(MSG_OUT, " %s ", set_op_table[op]);
156 else 156 else
157 fprintf(MSG_OUT, " WARNING: Unknown set op "); 157 fprintf(MSG_OUT, " WARNING: Unknown set op ");
158 } 158 }
159 159
283 283
284 static void print_linksub_instruction(command_t* command) { 284 static void print_linksub_instruction(command_t* command) {
285 uint32_t linkop = vm_getbits(command, 7, 8); 285 uint32_t linkop = vm_getbits(command, 7, 8);
286 uint32_t button = vm_getbits(command, 15, 6); 286 uint32_t button = vm_getbits(command, 15, 6);
287 287
288 if(linkop < sizeof(link_table)/sizeof(char *) && link_table[linkop] != NULL) 288 if(linkop < sizeof(link_table)/sizeof(link_table[0]))
289 fprintf(MSG_OUT, "%s (button %" PRIu8 ")", link_table[linkop], button); 289 fprintf(MSG_OUT, "%s (button %" PRIu8 ")", link_table[linkop], button);
290 else 290 else
291 fprintf(MSG_OUT, "WARNING: Unknown linksub instruction (%i)", linkop); 291 fprintf(MSG_OUT, "WARNING: Unknown linksub instruction (%i)", linkop);
292 } 292 }
293 293