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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [contrib/] [uninclude] - Blame information for rev 723

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 723 jeremybenn
#! /bin/sh
2
 
3
# (C) 1998, 2007 Free Software Foundation
4
# Originally by Alexandre Oliva 
5
 
6
# This gawk/shell script is free software; you can redistribute it and/or
7
# modify it under the terms of the GNU General Public License as published
8
# by the Free Software Foundation; either version 3, or (at your option)
9
# any later version.
10
 
11
# Given a preprocessed C/C++ code snippet, this script will replace any
12
# standard header files with an actual #include <...> directive.
13
 
14
# Example:
15
#     # 1 "test.c"
16
#     # 1 "/usr/include/stdio.h" 1 3
17
#     
18
#     # 1 "test.c" 2
19
#
20
#     main() { printf("Hello world!\n"); }
21
 
22
# is replaced with
23
#     # 1 "test.c"
24
#     #include 
25
#     main() { printf("Hello world!\n"); }
26
 
27
 
28
# Header files whose pathnames contain any of the following patterns
29
# are considered as standard headers: usr/include, g++-include,
30
# include/g++, include/c++/, gcc-lib//include.
31
 
32
gawk ${EXCLUDEPATT+-vexclude="$EXCLUDEPATT"} \
33
     ${INCLUDEPATT+-vinclude="$INCLUDEPATT"} '
34
BEGIN {
35
  skipping = 0;
36
  cppline = "^# [0-9]+ \"[^\"]*/(usr/include|g\\+\\+-include|include/g\\+\\+|include/c\\+\\+/[^/]+|gcc-lib/[^\"]+/include|gcc/include)/([^\"]+)\"( [1-4])*$"
37
}
38
!skipping && $0 ~ cppline &&
39
(exclude == "" || $3 !~ exclude) && (include == "" || $3 ~ include) {
40
  skipping = 1;
41
  printf "%s\n", "#include <" gensub(cppline, "\\2", "", $0) ">"
42
  next;
43
}
44
skipping && /^# [0-9]+ / && $3 == lastincluded {
45
  skipping = 0;
46
  next;
47
}
48
!skipping && /^# [0-9]+ / {
49
  lastincluded = $3;
50
}
51
!skipping { print }
52
' ${1+"$@"}

powered by: WebSVN 2.1.0

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