~ubuntu-branches/ubuntu/hardy/uim/hardy

« 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: 2007-04-21 03:46:09 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070421034609-gpcurkutp8vaysqj
Tags: 1:1.4.1-3
* Switch to dh_gtkmodules for the gtk 2.10 transition (Closes:
  #419318)
  - debian/control: Add ${misc:Depends} and remove libgtk2.0-bin on
    uim-gtk2.0.
  - debian/uim-gtk2.0.post{inst,rm}: Removed.

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"