source: trunk/mkopcode_spec.awk @ 566

Last change on this file since 566 was 566, checked in by moo, 6 years ago

add id/name in comments for readability

  • Property svn:eol-style set to native
File size: 745 bytes
Line 
1#! /usr/bin/awk -f
2# vim:ts=4:sw=4
3# process eaccelerator/opcodes.c
4BEGIN {
5    FS=" "
6    max = 0;
7    started = 0
8}
9
10/OPDEF/ {
11    if (started) {
12        name = "";
13        if (match($0, /"([^"]+)"/, m)) { 
14            name = m[1]; 
15        } 
16        sub(/"[^"]*"/, "");
17        if (!match($0, /EXT_([^ |]+).*OP[1S]_([^ |]+).*OP2_([^ |]+).*RES_([^ |)]+).*/, array)) {
18            print "error" $0
19            exit
20        }
21        id = "";
22        if (match($0, /\/\* *([0-9]+) *\*\//, comments)) {
23            id = comments[1];
24        }
25        printf "\tOPSPEC(%10s, %10s, %10s, %10s) /* %s %-30s */\n", array[1], array[2], array[3], array[4], id, name;
26        next
27    }
28}
29/^}/ {
30    print $0
31    exit;
32}
33/^[ ]*,[ ]*$/ {
34    next
35}
36{
37    if (started) {
38        print $0
39        next
40    }
41}
42
43/^static/ {
44    started = 1;
45    print "static const xc_opcode_spec_t xc_opcode_spec[] = {"
46}
Note: See TracBrowser for help on using the repository browser.