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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [mw/] [src/] [nanox/] [elkspatch.pl] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 673 markom
#!/usr/bin/perl
2
# elkspatch.pl
3
#
4
# Perl script to hack AllocReq macros for ELKS bcc compiler
5
#
6
# This script rewrites the AllocReq macro which uses ANSI C's '##'
7
# token pasting operator to an input compatible with the bcc compiler
8
#
9
# This is only required if desiring to build client/server Nano-X for ELKS
10
# To run:
11
#       mv client.c client.dist
12
#       ./elkspatch.pl < client.dist > client.c
13
#
14
 
15
while (<>) {
16
        if (/^(.*)AllocReq\(([A-Za-z]+)\)(.*)$/) {
17
                print("#if ELKS /* KLUDGE */\n");
18
                printf("%s((nx%sReq *)nxAllocReq(GrNum%s,(long)sizeof(nx%sReq), 0L))%s /* KLUDGE */\n",
19
                        $1, $2, $2, $2, $3);
20
                print("#else /* KLUDGE */\n");
21
                print;
22
                print("#endif /* KLUDGE */\n");
23
        } elsif (/^(.*)AllocReqExtra\(([A-Za-z]+) *, *(.*)\)(;)$/) {
24
                print("#if ELKS /* KLUDGE */\n");
25
                printf("%s((nx%sReq *)nxAllocReq(GrNum%s,(long)sizeof(nx%sReq), (long)%s))%s /* KLUDGE */\n",
26
                        $1, $2, $2, $2, $3, $4);
27
                print("#else /* KLUDGE */\n");
28
                print;
29
                print("#endif /* KLUDGE */\n");
30
        } else {
31
                print;
32
        }
33
}

powered by: WebSVN 2.1.0

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