1
|
1 #!/usr/bin/perl
|
|
2 #
|
|
3 # mnemonics.pl - generates mnemonic{.h,.c} from mnemonics.dat
|
|
4 #
|
|
5 # Copyright (c) 2002, 2003, 2004 Vivek Mohan <vivek@sig9.com>
|
|
6 # All rights reserved.
|
|
7 # See (LICENSE)
|
|
8 #
|
|
9 #
|
|
10
|
|
11
|
|
12 open(mnm_c,">mnemonics.c") || die "Couldn't create mnemonics.c.";
|
|
13 open(mnm_h,">mnemonics.h") || die "Couldn't create mnemonics.h.";
|
|
14
|
|
15 print mnm_c "/* Do not edit, generated by mnemonics.pl */ \n";
|
|
16 print mnm_c "const char* ud_mnemonics[] = \n{\n";
|
|
17
|
|
18 print mnm_h "/* Do not edit, Generated by mnemonics.pl */ \n\n";
|
|
19 print mnm_h "#ifndef UD_MNEMONICS_H\n";
|
|
20 print mnm_h "#define UD_MNEMONICS_H\n\n";
|
|
21 print mnm_h "extern const char* ud_mnemonics[];\n\n";
|
|
22 print mnm_h "enum ud_mnemonic_code \n{ \n";
|
|
23
|
|
24 while($mnm = <STDIN>) {
|
|
25 chop($mnm);
|
|
26 print mnm_c " \"$mnm\",\n";
|
|
27 print mnm_h " UD_I$mnm,\n";
|
|
28 }
|
|
29
|
|
30 print mnm_c " \"I3vil\",\n";
|
|
31 print mnm_h " UD_I3vil\n";
|
|
32
|
|
33 print mnm_c "};\n";
|
|
34 print mnm_h "};\n";
|
|
35 print mnm_h "#endif\n";
|
|
36
|
|
37 close(mnm_c);
|
|
38 close(mnm_h);
|