annotate udis86-1.4/tests/gen.c @ 1:4a9dcbd9e54f

-files of 0.13 beta -fixes so that it now compiles with the current dmd version
author marton@basel.hu
date Tue, 05 Apr 2011 20:44:01 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
1 #include <stdio.h>
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
2 #include <udis86.h>
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
3
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
4 #ifdef _WIN32
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
5 # include <io.h>
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
6 # include <fcntl.h>
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
7 #endif
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
8
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
9 /* help string */
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
10 int main(int argc, char **argv)
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
11 {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
12 ud_t ud_obj;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
13
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
14 #ifdef _WIN32
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
15 _setmode(_fileno(stdin), _O_BINARY);
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
16 #endif
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
17
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
18 ud_init(&ud_obj);
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
19 ud_set_input_file(&ud_obj, stdin);
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
20
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
21 if (strcmp(argv[1],"-16") == 0)
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
22 ud_set_mode(&ud_obj, 16);
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
23 else if (strcmp(argv[1],"-32") == 0)
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
24 ud_set_mode(&ud_obj, 32);
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
25 else if (strcmp(argv[1],"-64") == 0)
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
26 ud_set_mode(&ud_obj, 64);
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
27
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
28 ud_set_syntax(&ud_obj, UD_SYN_INTEL);
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
29
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
30 while (ud_disassemble(&ud_obj))
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
31 printf("\t%s\n", ud_insn_asm(&ud_obj));
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
32 }