Mercurial > ~dholland > hg > ag > index.cgi
comparison lint/get-sources.sh @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 #!/bin/sh | |
2 # get-sources.sh - retrieve list of source files | |
3 # usage: get-sources [-t] [-m] [-x] | |
4 # | |
5 # The idea of this script is that it suppresses .cpp and .h files that | |
6 # correspond to .syn files. | |
7 | |
8 usage() { | |
9 echo "Usage: $0 [-t] [-m] [-x] topdir" 1>&2 | |
10 echo " -m show main sources" 1>&2 | |
11 echo " -t show tools sources" 1>&2 | |
12 echo " -x show examples sources" 1>&2 | |
13 } | |
14 | |
15 DO_TOOLS=0 | |
16 DO_MAIN=0 | |
17 DO_EXAMPLES=0 | |
18 | |
19 DSET=0 | |
20 FSET=0 | |
21 while [ "x$1" != x ]; do | |
22 case "$1" in | |
23 -t) DO_TOOLS=1; FSET=1;; | |
24 -m) DO_MAIN=1; FSET=1;; | |
25 -x) DO_EXAMPLES=1; FSET=1;; | |
26 -*) usage; exit 1;; | |
27 *) | |
28 if [ -d "$1" -a $DSET = 0 ]; then | |
29 TOPDIR="$1" | |
30 DSET=1 | |
31 else | |
32 usage | |
33 exit 1 | |
34 fi | |
35 ;; | |
36 esac | |
37 shift | |
38 done | |
39 | |
40 if [ $FSET = 0 ]; then | |
41 DO_TOOLS=1 | |
42 DO_MAIN=1 | |
43 DO_EXAMPLES=0 | |
44 fi | |
45 | |
46 if [ $DSET = 1 ]; then | |
47 cd "$TOPDIR" || exit 1 | |
48 TOPDIR="${TOPDIR}/" | |
49 fi | |
50 | |
51 ############################################################ | |
52 | |
53 get() { | |
54 ( | |
55 cd "$1" | |
56 ls *.syn 2>/dev/null | |
57 ls *.cpp *.hpp *.c *.h 2>/dev/null | |
58 true | |
59 ) | awk ' | |
60 { basename=$1; sub("\\.[^\\.]*$", "", basename); } | |
61 /\.syn$/ { hide[basename] = 1; doprint($1); next; } | |
62 { if (!hide[basename]) doprint($1); } | |
63 function doprint(f) { printf "%s/%s\n", dir, f; } | |
64 ' "dir=$1" | |
65 } | |
66 | |
67 if [ $DO_TOOLS = 1 ]; then | |
68 for DIR in cgbigen checksum helpgen insertsums; do | |
69 get $DIR | |
70 done | |
71 fi | |
72 | |
73 if [ $DO_MAIN = 1 ]; then | |
74 for DIR in \ | |
75 support agcore \ | |
76 guisupport icons dummygui vaclgui \ | |
77 ag1 \ | |
78 ag agcl \ | |
79 run \ | |
80 ; do | |
81 get anagram/$DIR | |
82 done | |
83 fi | |
84 | |
85 if [ $DO_EXAMPLES = 1 ]; then | |
86 for DIR in \ | |
87 include source \ | |
88 ; do | |
89 get oldclasslib/$DIR | |
90 done | |
91 for DIR in \ | |
92 dsl fc ffcalc hw mpp rcalc \ | |
93 ; do | |
94 get examples/$DIR | |
95 done | |
96 fi | |
97 | |
98 exit 0 | |
99 |