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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [librdbg/] [src/] [awk.svc] - Rev 609

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.
#
#########################################################################
#
# $Id: awk.svc,v 1.2 2001-09-27 12:02:01 chris 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) printf(b)\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.