Mercurial > libdvdnav.hg
annotate vmcmd.c @ 67:61c0ee1bbb7a src
Moved get_current_nav_pci into dvdnac.c, changed example to use it instead of 'home-rolled'
check_packet.
author | richwareham |
---|---|
date | Thu, 25 Jul 2002 14:51:40 +0000 |
parents | 74aee0b81da0 |
children | 0e2abe7083de |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (C) 2000, 2001 Martin Norbäck, Håkan Hjort | |
3 * | |
4 * This file is part of libdvdnav, a DVD navigation library. It is modified | |
5 * from a file originally part of the Ogle DVD player. | |
6 * | |
7 * libdvdnav is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * libdvdnav is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | |
20 * | |
21 * $Id$ | |
22 * | |
23 */ | |
24 | |
25 #ifdef HAVE_CONFIG_H | |
26 #include "config.h" | |
27 #endif | |
28 | |
29 #include <stdio.h> | |
30 #include <ctype.h> | |
31 #include <inttypes.h> | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
32 #include <assert.h> |
0 | 33 |
34 #include "vmcmd.h" | |
35 | |
36 | |
37 /* freebsd compatibility */ | |
38 #ifndef PRIu8 | |
39 #define PRIu8 "d" | |
40 #endif | |
41 | |
42 /* freebsd compatibility */ | |
43 #ifndef PRIu16 | |
44 #define PRIu16 "d" | |
45 #endif | |
46 | |
47 static const char *cmp_op_table[] = { | |
48 NULL, "&", "==", "!=", ">=", ">", "<=", "<" | |
49 }; | |
50 static const char *set_op_table[] = { | |
51 NULL, "=", "<->", "+=", "-=", "*=", "/=", "%=", "rnd", "&=", "|=", "^=" | |
52 }; | |
53 | |
54 static const char *link_table[] = { | |
55 "LinkNoLink", "LinkTopC", "LinkNextC", "LinkPrevC", | |
56 NULL, "LinkTopPG", "LinkNextPG", "LinkPrevPG", | |
57 NULL, "LinkTopPGC", "LinkNextPGC", "LinkPrevPGC", | |
58 "LinkGoUpPGC", "LinkTailPGC", NULL, NULL, | |
59 "RSM" | |
60 }; | |
61 | |
62 static const char *system_reg_table[] = { | |
63 "Menu Description Language Code", | |
64 "Audio Stream Number", | |
65 "Sub-picture Stream Number", | |
66 "Angle Number", | |
67 "Title Track Number", | |
68 "VTS Title Track Number", | |
69 "VTS PGC Number", | |
70 "PTT Number for One_Sequential_PGC_Title", | |
71 "Highlighted Button Number", | |
72 "Navigation Timer", | |
73 "Title PGC Number for Navigation Timer", | |
74 "Audio Mixing Mode for Karaoke", | |
75 "Country Code for Parental Management", | |
76 "Parental Level", | |
77 "Player Configurations for Video", | |
78 "Player Configurations for Audio", | |
79 "Initial Language Code for Audio", | |
80 "Initial Language Code Extension for Audio", | |
81 "Initial Language Code for Sub-picture", | |
82 "Initial Language Code Extension for Sub-picture", | |
83 "Player Regional Code", | |
84 "Reserved 21", | |
85 "Reserved 22", | |
86 "Reserved 23" | |
87 }; | |
88 | |
89 static const char *system_reg_abbr_table[] = { | |
90 NULL, | |
91 "ASTN", | |
92 "SPSTN", | |
93 "AGLN", | |
94 "TTN", | |
95 "VTS_TTN", | |
96 "TT_PGCN", | |
97 "PTTN", | |
98 "HL_BTNN", | |
99 "NVTMR", | |
100 "NV_PGCN", | |
101 NULL, | |
102 "CC_PLT", | |
103 "PLT", | |
104 NULL, | |
105 NULL, | |
106 NULL, | |
107 NULL, | |
108 NULL, | |
109 NULL, | |
110 NULL, | |
111 NULL, | |
112 NULL, | |
113 NULL, | |
114 }; | |
115 | |
116 static void print_system_reg(uint16_t reg) { | |
117 if(reg < sizeof(system_reg_abbr_table) / sizeof(char *)) | |
10
6f0fb88d1463
Added some debug info, to hopefully help in tracking bugs in libdvdnav.
jcdutton
parents:
0
diff
changeset
|
118 fprintf(stderr, "%s (SRPM:%d)", system_reg_table[reg], reg); |
0 | 119 else |
10
6f0fb88d1463
Added some debug info, to hopefully help in tracking bugs in libdvdnav.
jcdutton
parents:
0
diff
changeset
|
120 fprintf(stderr, " WARNING: Unknown system register ( reg=%d ) ", reg); |
0 | 121 } |
122 | |
123 static void print_reg(uint8_t reg) { | |
124 if(reg & 0x80) | |
125 print_system_reg(reg & 0x7f); | |
126 else | |
127 if(reg < 16) | |
128 fprintf(stderr, "g[%" PRIu8 "]", reg); | |
129 else | |
130 fprintf(stderr, " WARNING: Unknown general register "); | |
131 } | |
132 | |
133 static void print_cmp_op(uint8_t op) { | |
134 if(op < sizeof(cmp_op_table) / sizeof(char *) && cmp_op_table[op] != NULL) | |
135 fprintf(stderr, " %s ", cmp_op_table[op]); | |
136 else | |
137 fprintf(stderr, " WARNING: Unknown compare op "); | |
138 } | |
139 | |
140 static void print_set_op(uint8_t op) { | |
141 if(op < sizeof(set_op_table) / sizeof(char *) && set_op_table[op] != NULL) | |
142 fprintf(stderr, " %s ", set_op_table[op]); | |
143 else | |
144 fprintf(stderr, " WARNING: Unknown set op "); | |
145 } | |
146 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
147 static void print_reg_or_data(command_t* command, int immediate, int byte) { |
0 | 148 if(immediate) { |
15 | 149 int i = vm_getbits(command, (byte*8), 16); |
0 | 150 |
151 fprintf(stderr, "0x%x", i); | |
152 if(isprint(i & 0xff) && isprint((i>>8) & 0xff)) | |
153 fprintf(stderr, " (\"%c%c\")", (char)((i>>8) & 0xff), (char)(i & 0xff)); | |
154 } else { | |
15 | 155 print_reg(vm_getbits(command, ((byte + 1)*8), 8)); |
0 | 156 } |
157 } | |
158 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
159 static void print_reg_or_data_2(command_t* command, int immediate, int byte) { |
0 | 160 if(immediate) |
15 | 161 fprintf(stderr, "0x%x", vm_getbits(command, ((byte*8)+1), 7)); |
0 | 162 else |
15 | 163 fprintf(stderr, "g[%" PRIu8 "]", vm_getbits(command, ((byte*8)+4), 4)); |
0 | 164 } |
165 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
166 static void print_if_version_1(command_t* command) { |
15 | 167 uint8_t op = vm_getbits(command, 9, 3); |
0 | 168 |
169 if(op) { | |
170 fprintf(stderr, "if ("); | |
15 | 171 print_reg(vm_getbits(command,24,8)); |
0 | 172 print_cmp_op(op); |
15 | 173 print_reg_or_data(command, vm_getbits(command, 8,1), 4); |
0 | 174 fprintf(stderr, ") "); |
175 } | |
176 } | |
177 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
178 static void print_if_version_2(command_t* command) { |
15 | 179 uint8_t op = vm_getbits(command, 9, 3); |
0 | 180 |
181 if(op) { | |
182 fprintf(stderr, "if ("); | |
15 | 183 print_reg(vm_getbits(command, 48, 8)); |
0 | 184 print_cmp_op(op); |
15 | 185 print_reg(vm_getbits(command, 56, 8)); |
0 | 186 fprintf(stderr, ") "); |
187 } | |
188 } | |
189 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
190 static void print_if_version_3(command_t* command) { |
15 | 191 uint8_t op = vm_getbits(command, 9, 3); |
0 | 192 |
193 if(op) { | |
194 fprintf(stderr, "if ("); | |
15 | 195 print_reg(vm_getbits(command, 20, 4)); |
0 | 196 print_cmp_op(op); |
15 | 197 print_reg_or_data(command, vm_getbits(command, 8, 1), 6); |
0 | 198 fprintf(stderr, ") "); |
199 } | |
200 } | |
201 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
202 static void print_if_version_4(command_t* command) { |
15 | 203 uint8_t op = vm_getbits(command, 9, 3); |
0 | 204 |
205 if(op) { | |
206 fprintf(stderr, "if ("); | |
15 | 207 print_reg(vm_getbits(command, 12, 4)); |
0 | 208 print_cmp_op(op); |
15 | 209 print_reg_or_data(command, vm_getbits(command, 8, 1), 4); |
0 | 210 fprintf(stderr, ") "); |
211 } | |
212 } | |
213 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
214 static void print_special_instruction(command_t* command) { |
15 | 215 uint8_t op = vm_getbits(command, 12, 4); |
0 | 216 |
217 switch(op) { | |
218 case 0: /* NOP */ | |
219 fprintf(stderr, "Nop"); | |
220 break; | |
221 case 1: /* Goto line */ | |
15 | 222 fprintf(stderr, "Goto %" PRIu8, vm_getbits(command, 56, 8)); |
0 | 223 break; |
224 case 2: /* Break */ | |
225 fprintf(stderr, "Break"); | |
226 break; | |
227 case 3: /* Parental level */ | |
228 fprintf(stderr, "SetTmpPML %" PRIu8 ", Goto %" PRIu8, | |
15 | 229 vm_getbits(command, 52, 4), vm_getbits(command, 56, 8)); |
0 | 230 break; |
231 default: | |
232 fprintf(stderr, "WARNING: Unknown special instruction (%i)", | |
15 | 233 vm_getbits(command, 12, 4)); |
0 | 234 } |
235 } | |
236 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
237 static void print_linksub_instruction(command_t* command) { |
15 | 238 int linkop = vm_getbits(command, 59, 5); |
239 int button = vm_getbits(command, 48, 6); | |
0 | 240 |
241 if(linkop < sizeof(link_table)/sizeof(char *) && link_table[linkop] != NULL) | |
242 fprintf(stderr, "%s (button %" PRIu8 ")", link_table[linkop], button); | |
243 else | |
244 fprintf(stderr, "WARNING: Unknown linksub instruction (%i)", linkop); | |
245 } | |
246 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
247 static void print_link_instruction(command_t* command, int optional) { |
15 | 248 uint8_t op = vm_getbits(command, 12, 4); |
0 | 249 |
250 if(optional && op) | |
251 fprintf(stderr, ", "); | |
252 | |
253 switch(op) { | |
254 case 0: | |
255 if(!optional) | |
256 fprintf(stderr, "WARNING: NOP (link)!"); | |
257 break; | |
258 case 1: | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
259 print_linksub_instruction(command); |
0 | 260 break; |
261 case 4: | |
15 | 262 fprintf(stderr, "LinkPGCN %" PRIu16, vm_getbits(command, 49, 15)); |
0 | 263 break; |
264 case 5: | |
265 fprintf(stderr, "LinkPTT %" PRIu16 " (button %" PRIu8 ")", | |
15 | 266 vm_getbits(command, 54, 10), vm_getbits(command, 48, 6)); |
0 | 267 break; |
268 case 6: | |
269 fprintf(stderr, "LinkPGN %" PRIu8 " (button %" PRIu8 ")", | |
15 | 270 vm_getbits(command, 57, 7), vm_getbits(command, 48, 6)); |
0 | 271 break; |
272 case 7: | |
273 fprintf(stderr, "LinkCN %" PRIu8 " (button %" PRIu8 ")", | |
15 | 274 vm_getbits(command, 56, 8), vm_getbits(command, 48, 6)); |
0 | 275 break; |
276 default: | |
277 fprintf(stderr, "WARNING: Unknown link instruction"); | |
278 } | |
279 } | |
280 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
281 static void print_jump_instruction(command_t* command) { |
15 | 282 switch(vm_getbits(command, 12, 4)) { |
0 | 283 case 1: |
284 fprintf(stderr, "Exit"); | |
285 break; | |
286 case 2: | |
15 | 287 fprintf(stderr, "JumpTT %" PRIu8, vm_getbits(command, 41, 7)); |
0 | 288 break; |
289 case 3: | |
15 | 290 fprintf(stderr, "JumpVTS_TT %" PRIu8, vm_getbits(command, 41, 7)); |
0 | 291 break; |
292 case 5: | |
293 fprintf(stderr, "JumpVTS_PTT %" PRIu8 ":%" PRIu16, | |
15 | 294 vm_getbits(command, 41, 7), vm_getbits(command, 22, 10)); |
0 | 295 break; |
296 case 6: | |
15 | 297 switch(vm_getbits(command, 40, 2)) { |
0 | 298 case 0: |
299 fprintf(stderr, "JumpSS FP"); | |
300 break; | |
301 case 1: | |
15 | 302 fprintf(stderr, "JumpSS VMGM (menu %" PRIu8 ")", vm_getbits(command, 44, 4)); |
0 | 303 break; |
304 case 2: | |
305 fprintf(stderr, "JumpSS VTSM (vts %" PRIu8 ", title %" PRIu8 | |
15 | 306 ", menu %" PRIu8 ")", vm_getbits(command, 32, 8), vm_getbits(command, 24, 8), vm_getbits(command, 44, 4)); |
0 | 307 break; |
308 case 3: | |
15 | 309 fprintf(stderr, "JumpSS VMGM (pgc %" PRIu8 ")", vm_getbits(command, 17, 15)); |
0 | 310 break; |
311 } | |
312 break; | |
313 case 8: | |
15 | 314 switch(vm_getbits(command, 40, 2)) { |
0 | 315 case 0: |
316 fprintf(stderr, "CallSS FP (rsm_cell %" PRIu8 ")", | |
15 | 317 vm_getbits(command, 32, 8)); |
0 | 318 break; |
319 case 1: | |
320 fprintf(stderr, "CallSS VMGM (menu %" PRIu8 | |
15 | 321 ", rsm_cell %" PRIu8 ")", vm_getbits(command, 44, 4), vm_getbits(command, 32, 8)); |
0 | 322 break; |
323 case 2: | |
324 fprintf(stderr, "CallSS VTSM (menu %" PRIu8 | |
15 | 325 ", rsm_cell %" PRIu8 ")", vm_getbits(command, 44, 4), vm_getbits(command, 32, 8)); |
0 | 326 break; |
327 case 3: | |
328 fprintf(stderr, "CallSS VMGM (pgc %" PRIu8 ", rsm_cell %" PRIu8 ")", | |
15 | 329 vm_getbits(command, 17, 15), vm_getbits(command, 32, 8)); |
0 | 330 break; |
331 } | |
332 break; | |
333 default: | |
334 fprintf(stderr, "WARNING: Unknown Jump/Call instruction"); | |
335 } | |
336 } | |
337 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
338 static void print_system_set(command_t* command) { |
0 | 339 int i; |
340 | |
15 | 341 switch(vm_getbits(command, 4, 4)) { |
0 | 342 case 1: /* Set system reg 1 &| 2 &| 3 (Audio, Subp. Angle) */ |
343 for(i = 1; i <= 3; i++) { | |
15 | 344 if(vm_getbits(command, ((2+i)*8), 1)) { |
0 | 345 print_system_reg(i); |
346 fprintf(stderr, " = "); | |
15 | 347 print_reg_or_data_2(command, vm_getbits(command, 3, 1), 2 + i); |
0 | 348 fprintf(stderr, " "); |
349 } | |
350 } | |
351 break; | |
352 case 2: /* Set system reg 9 & 10 (Navigation timer, Title PGC number) */ | |
353 print_system_reg(9); | |
354 fprintf(stderr, " = "); | |
15 | 355 print_reg_or_data(command, vm_getbits(command, 3, 1), 2); |
0 | 356 fprintf(stderr, " "); |
357 print_system_reg(10); | |
15 | 358 fprintf(stderr, " = %" PRIu8, vm_getbits(command, 40, 8)); /* ?? */ |
0 | 359 break; |
360 case 3: /* Mode: Counter / Register + Set */ | |
361 fprintf(stderr, "SetMode "); | |
15 | 362 if(vm_getbits(command, 40, 1)) |
0 | 363 fprintf(stderr, "Counter "); |
364 else | |
365 fprintf(stderr, "Register "); | |
15 | 366 print_reg(vm_getbits(command, 44, 4)); |
0 | 367 print_set_op(0x1); /* '=' */ |
15 | 368 print_reg_or_data(command, vm_getbits(command, 3, 1), 2); |
0 | 369 break; |
370 case 6: /* Set system reg 8 (Highlighted button) */ | |
371 print_system_reg(8); | |
15 | 372 if(vm_getbits(command, 3, 1)) /* immediate */ |
373 fprintf(stderr, " = 0x%x (button no %d)", vm_getbits(command, 32, 16), vm_getbits(command, 32, 6)); | |
0 | 374 else |
15 | 375 fprintf(stderr, " = g[%" PRIu8 "]", vm_getbits(command, 44, 4)); |
0 | 376 break; |
377 default: | |
378 fprintf(stderr, "WARNING: Unknown system set instruction (%i)", | |
15 | 379 vm_getbits(command, 4, 4)); |
0 | 380 } |
381 } | |
382 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
383 static void print_set_version_1(command_t* command) { |
15 | 384 uint8_t set_op = vm_getbits(command, 4, 4); |
0 | 385 |
386 if(set_op) { | |
15 | 387 print_reg(vm_getbits(command, 24, 8)); /* FIXME: This is different from decoder.c!!! */ |
0 | 388 print_set_op(set_op); |
15 | 389 print_reg_or_data(command, vm_getbits(command, 3, 1), 4); |
0 | 390 } else { |
391 fprintf(stderr, "NOP"); | |
392 } | |
393 } | |
394 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
395 static void print_set_version_2(command_t* command) { |
15 | 396 uint8_t set_op = vm_getbits(command, 4, 4); |
0 | 397 |
398 if(set_op) { | |
15 | 399 print_reg(vm_getbits(command, 12, 4)); |
0 | 400 print_set_op(set_op); |
15 | 401 print_reg_or_data(command, vm_getbits(command, 3, 1), 2); |
0 | 402 } else { |
403 fprintf(stderr, "NOP"); | |
404 } | |
405 } | |
406 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
407 void vmPrint_mnemonic(vm_cmd_t *vm_command) { |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
408 command_t command; |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
409 command.instruction =( (uint64_t) vm_command->bytes[0] << 56 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
410 ( (uint64_t) vm_command->bytes[1] << 48 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
411 ( (uint64_t) vm_command->bytes[2] << 40 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
412 ( (uint64_t) vm_command->bytes[3] << 32 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
413 ( (uint64_t) vm_command->bytes[4] << 24 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
414 ( (uint64_t) vm_command->bytes[5] << 16 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
415 ( (uint64_t) vm_command->bytes[6] << 8 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
416 (uint64_t) vm_command->bytes[7] ; |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
417 command.examined = 0; |
0 | 418 |
15 | 419 switch(vm_getbits(&command,0,3)) { /* three first bits */ |
0 | 420 case 0: /* Special instructions */ |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
421 print_if_version_1(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
422 print_special_instruction(&command); |
0 | 423 break; |
424 case 1: /* Jump/Call or Link instructions */ | |
15 | 425 if(vm_getbits(&command,3,1)) { |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
426 print_if_version_2(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
427 print_jump_instruction(&command); |
0 | 428 } else { |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
429 print_if_version_1(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
430 print_link_instruction(&command, 0); /* must be pressent */ |
0 | 431 } |
432 break; | |
433 case 2: /* Set System Parameters instructions */ | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
434 print_if_version_2(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
435 print_system_set(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
436 print_link_instruction(&command, 1); /* either 'if' or 'link' */ |
0 | 437 break; |
438 case 3: /* Set General Parameters instructions */ | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
439 print_if_version_3(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
440 print_set_version_1(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
441 print_link_instruction(&command, 1); /* either 'if' or 'link' */ |
0 | 442 break; |
443 case 4: /* Set, Compare -> LinkSub instructions */ | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
444 print_set_version_2(&command); |
0 | 445 fprintf(stderr, ", "); |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
446 print_if_version_4(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
447 print_linksub_instruction(&command); |
0 | 448 break; |
449 case 5: /* Compare -> (Set and LinkSub) instructions */ | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
450 print_if_version_4(&command); |
0 | 451 fprintf(stderr, "{ "); |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
452 print_set_version_2(&command); |
0 | 453 fprintf(stderr, ", "); |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
454 print_linksub_instruction(&command); |
0 | 455 fprintf(stderr, " }"); |
456 break; | |
457 case 6: /* Compare -> Set, always LinkSub instructions */ | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
458 print_if_version_4(&command); |
0 | 459 fprintf(stderr, "{ "); |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
460 print_set_version_2(&command); |
0 | 461 fprintf(stderr, " } "); |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
462 print_linksub_instruction(&command); |
0 | 463 break; |
464 default: | |
15 | 465 fprintf(stderr, "WARNING: Unknown instruction type (%i)", vm_getbits(&command, 0, 3)); |
0 | 466 } |
467 /* Check if there still are bits set that were not examined */ | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
468 |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
469 if(command.instruction & ~ command.examined) { |
12 | 470 fprintf(stderr, " libdvdnav: vmcmd.c: [WARNING, unknown bits:"); |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
471 fprintf(stderr, " %08llx", (command.instruction & ~ command.examined) ); |
0 | 472 fprintf(stderr, "]"); |
473 } | |
474 } | |
475 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
476 void vmPrint_CMD(int row, vm_cmd_t *vm_command) { |
0 | 477 int i; |
478 | |
479 fprintf(stderr, "(%03d) ", row + 1); | |
480 for(i = 0; i < 8; i++) | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
481 fprintf(stderr, "%02x ", vm_command->bytes[i]); |
0 | 482 fprintf(stderr, "| "); |
483 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
484 vmPrint_mnemonic(vm_command); |
0 | 485 fprintf(stderr, "\n"); |
486 } | |
10
6f0fb88d1463
Added some debug info, to hopefully help in tracking bugs in libdvdnav.
jcdutton
parents:
0
diff
changeset
|
487 |
6f0fb88d1463
Added some debug info, to hopefully help in tracking bugs in libdvdnav.
jcdutton
parents:
0
diff
changeset
|
488 |