source: trunk/mkopcode_spec.awk @ 5

Last change on this file since 5 was 5, checked in by moo, 9 years ago

use the name of awk instead of gawk

File size: 571 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    delete opcodes;
9}
10
11/OPDEF/ {
12    if (started) {
13        sub(/".*"/, "")
14        if (!match($0, /EXT_([^ |]+).*OP[1S]_([^ |]+).*OP2_([^ |]+).*RES_([^ |)]+).*/, array)) {
15            print "error" $0
16            exit
17        }
18        printf "\tOPSPEC(%10s, %10s, %10s, %10s)\n", array[1], array[2], array[3], array[4]
19        next
20    }
21}
22/^}/ {
23    print $0
24    exit;
25}
26/^[ ]*,[ ]*$/ {
27    next
28}
29{
30    if (started) {
31        print $0
32        next
33    }
34}
35
36/^static/ {
37    started = 1;
38    print "static const xc_opcode_spec_t xc_opcode_spec[] = {"
39}
Note: See TracBrowser for help on using the repository browser.