~ubuntu-branches/ubuntu/maverick/uim/maverick

« back to all changes in this revision

Viewing changes to sigscheme/test-c/collect.sh.in

  • Committer: Bazaar Package Importer
  • Author(s): Masahito Omote
  • Date: 2008-06-25 19:56:33 UTC
  • mfrom: (3.1.18 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080625195633-8jljph4rfq00l8o7
Tags: 1:1.5.1-2
* uim-tcode: provide tutcode-custom.scm, tutcode-bushudic.scm
  and tutcode-rule.scm (Closes: #482659)
* Fix FTBFS: segv during compile (Closes: #483078).
  I personally think this bug is not specific for uim but is a optimization
  problem on gcc-4.3.1. (https://bugs.freedesktop.org/show_bug.cgi?id=16477)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# This thing may be better off incorporated in Makefile.am.
 
3
 
 
4
# FIXME: sed implementation dependency
 
5
#
 
6
# This script does not work on some sed implementations, at least BSD sed.
 
7
# So GNU sed is explicitly used as temporary solution.
 
8
#
 
9
# $ ./collect.sh test-storage.c
 
10
# line 1 "test-storage.c"
 
11
# sed: 25: "259 { p; s/^.*$/vector/ ...": unexpected EOF (pending }'s)
 
12
#
 
13
# man sed on *BSD:
 
14
# > The ``{'' can be preceded by white space and can be followed by white
 
15
# > space.  The function can be preceded by white space.  The terminating
 
16
# > ``}'' must be preceded by a newline or optional white space.
 
17
 
 
18
 
 
19
[ "x$2" = "x" ] || { echo >&2 "usage: collect.sh <c source>"; exit 1; }
 
20
 
 
21
echo "#line 1 \"$1\""
 
22
 
 
23
decls=`grep -n '^TST_CASE[[:space:]]*(' "$1" | \
 
24
    sed 's/^\([0-9]*:\)TST_CASE[[:space:]]*(/\1/'`
 
25
have_id=`echo "$decls" | sed -n '
 
26
    /^\([0-9]*\):\([_[:alnum:]]*\),.*$/ {
 
27
        s||\1 { p; s/^.*$/\2/; H; b skip_print; };|
 
28
        p
 
29
    }
 
30
    '`
 
31
need_id=`echo "$decls" | \
 
32
    grep -n '^[0-9]*:[[:space:]]*"' | \
 
33
    sed \
 
34
    's|^\([0-9]*\):\([0-9]*\):.*$|\2 { s/(/(tst_\1, /; p; s/^.*$/tst_\1/; H; b skip_print; };|'`
 
35
 
 
36
@SED@ -n "$have_id""$need_id;p;"'
 
37
    : skip_print
 
38
    $ { g
 
39
        s/\n\([[:alnum:]_]*\)/\n    TST_REGISTER(\1)/g
 
40
        s/^/TST_LIST_BEGIN()/
 
41
        p
 
42
        i\
 
43
TST_LIST_END()
 
44
    }
 
45
    ' "$1"