File: ucgen

package info (click to toggle)
tom 1.1.1-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,340 kB
  • ctags: 2,244
  • sloc: objc: 27,863; ansic: 9,804; sh: 7,411; yacc: 3,377; lex: 966; asm: 208; makefile: 62; cpp: 10
file content (67 lines) | stat: -rw-r--r-- 1,384 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
61
62
63
64
65
66
67
#! /bin/sh
# ucgen --- generate the files needed by the TOM String classes.
# Written by Pieter J. Schoenmakers <tiggr@ics.ele.tue.nl>
#
# Copyright (C) 1996 Pieter J. Schoenmakers.
#
# This file is part of TOM.  TOM is distributed under the terms of the
# TOM License, a copy of which can be found in the TOM distribution; see
# the file LICENSE.
#
# $Id: ucgen,v 1.4 1998/01/05 00:56:03 tiggr Exp $

TOM_LIB_OPTIONS=${TOM_LIB_OPTIONS-":gc-pth 15000"}
UC=${UC:-"uc"}

while test $# -ne 0
do
  case $1 in
  -u)
      shift
      UNICODEDATA=$1
      ;;
  -m)
      shift
      ISOMAP=$1
      ;;
  -p)
      shift
      PREFIX=$1
      ;;
  *)
      echo $0 '-u unicode-data-file [-m iso-map-file] [-p output-prefix]' >&2
      exit 2
      ;;
  esac
  shift
done

if test -z "$ISOMAP"; then
	PREFIX=${PREFIX:-"unicode"}
else
	PREFIX=${PREFIX:-${ISOMAP}}
	ISOMAP="-m $ISOMAP"
	# We have a mapping, thus we can create a mapping file!
	$UC map $TOM_LIB_OPTIONS -u $UNICODEDATA $ISOMAP -o ${PREFIX}.map
fi

(cat << EOF
digit digit
islower lower
isupper upper
letter letter
numeric numeric
punctuation punctuation
space space
EOF
) | while read predicate suffix
do
  $UC $predicate $TOM_LIB_OPTIONS -u $UNICODEDATA $ISOMAP \
	-o ${PREFIX}.p.$suffix
done

for conversion in lower upper title
do
  $UC $conversion $TOM_LIB_OPTIONS -u $UNICODEDATA $ISOMAP \
	-o ${PREFIX}.c.$conversion
done