File: gen-scale.sh

package info (click to toggle)
libcdk5 5.0.20050424-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,504 kB
  • ctags: 2,620
  • sloc: ansic: 29,645; sh: 4,283; makefile: 634; cpp: 42; sed: 40
file content (60 lines) | stat: -rw-r--r-- 1,032 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#! /bin/sh
# $Id: gen-scale.sh,v 1.4 2004/08/29 01:15:01 tom Exp $
#
# This script generates source variations from scale.c for different datatypes.

UPPER="$1"
MIXED="$2"
DTYPE="$3"
CTYPE="$4"

# The widget provides for setting the digits.  Turn on/off the corresponding
# ifdef.
case $CTYPE in
float|*double)
	float=1
	print=f
	;;
long*long)
	float=0
	print=ll
	;;
unsigned*long)
	float=0
	print=lu
	;;
unsigned)
	float=0
	print=u
	;;
long)
	float=0
	print=l
	;;
*)
	float=0
	print=d
	;;
esac

if test $float = 0 ; then
sed	-e '/^#if <FLOAT>/,/^#endif <FLOAT>/d' \
	-e '/^#if <INT>/d' \
	-e '/^#endif <INT>/d' \
	-e 's/<UPPER>/'"$UPPER"'/g' \
	-e 's/<MIXED>/'"$MIXED"'/g' \
	-e 's/<DTYPE>/'"$DTYPE"'/g' \
	-e 's/<CTYPE>/'"$CTYPE"'/g' \
	-e 's/<PRINT>/'"$print"'/g' \
	$5
else
sed	-e '/^#if <INT>/,/^#endif <INT>/d' \
	-e '/^#if <FLOAT>/d' \
	-e '/^#endif <FLOAT>/d' \
	-e 's/<UPPER>/'"$UPPER"'/g' \
	-e 's/<MIXED>/'"$MIXED"'/g' \
	-e 's/<DTYPE>/'"$DTYPE"'/g' \
	-e 's/<CTYPE>/'"$CTYPE"'/g' \
	-e 's/<PRINT>/'"$print"'/g' \
	$5
fi