OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [c/] [src/] [librdbg/] [src/] [awk.svc] - Rev 1780

Go to most recent revision | Compare with Previous | Blame | View Log

#########################################################################
#
#  Component:   RDBG
#  Module:      awk.svc
#
#  Synopsis:    AWK script which transforms the server skeleton produced
#               by rpcgen(1) into something suitable for RDB servers.
#
#########################################################################
#
# awk.svc,v 1.4 2002/02/01 17:00:01 joel Exp
#
BEGIN {
    headerstarted = 0
    withinproc = 0
    brack = 0
}

$1 ~ /^\/\*HEADER_START\*\/$/ {
    headerstarted = 1
    printf("#include <rpc/types.h>\n");
    printf("#include <rpc/rpc.h>\n");
    printf("#include <stdio.h>\n");
    printf("#include <stdlib.h>\n");
    printf("#include <string.h>\n");
    printf("#include <bsp.h>\n");
    printf("#include <rdbg/servrpc.h>\n");
    printf("#include <rdbg/%s>\n", THEPROG);
    printf("#define fprintf(a,b,c) printf(b,c)\n");
}

$1 ~ /^\/\*HEADER_END\*\/$/ {
    headerstarted = 0
}

{
    if (headerstarted == 1) {
        print $0
    } else if ($1 ~ /.*_2.*/) {
        withinproc = 1
        printf("void\n");
        print $0
    } else if (withinproc == 1) {
        if ($1 == "switch") {
            print "\tDPRINTF ((\"remotedeb_2: %s (%d)\\n\", "
            print "\t\t(unsigned) rqstp->rq_proc < "
            print "\t\t(unsigned) (sizeof names / sizeof names[0]) ?"
            print "\t\tnames [rqstp->rq_proc] : \"???\", "
            print "\t\t(int) rqstp->rq_proc));\n"
        }
        for (i = 1; i <= NF; i++) {
            if ($i == "{") {
                brack++;
            } else if ($i == "}") {
                brack--;
                if (brack == 0) {
                    withinproc = 0;
                }
            }
        }
        if ($1 != "_rpcsvcdirty" ) {
            print $0
        }
    }
}

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.