File: glossary

package info (click to toggle)
genparse 0.9.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,456 kB
  • sloc: ansic: 8,766; cpp: 6,059; sh: 5,336; java: 578; yacc: 482; lex: 315; makefile: 302
file content (265 lines) | stat: -rwxr-xr-x 7,483 bytes parent folder | download | duplicates (2)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#!/bin/bash
# Test __GLOSSARY__ and __GLOSSARY_GNU__

# Copyright (C) 2007 - 2016 Michael Geng <linux@MichaelGeng.de>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

if test "$VERBOSE" = yes; then
  set -x
fi

. test-lib.sh

echo "a / aparam string
b string
NONE / cparam string
#usage_begin
__GLOSSARY__
#usage_end" > x.gp

echo "   [ -a ] [ --aparam ] (type=STRING)
   [ -b ] (type=STRING)
   [ --cparam ] (type=STRING)
   [ -h ] [ --help ] (type=FLAG)
          Display this help and exit.
   [ -v ] [ --version ] (type=FLAG)
          Output version information and exit." > exp

for language in $all_languages
do
  gen_code x.gp $language
  if test $language = java; then
    java -classpath $CLASSPATH:classes simple --help > out || fail=1
  else
    parse_cl --help > out || fail=1
  fi
  cmp out exp || fail=1
done

# -------------------------------------------------------

echo "a / aparam string
b string
NONE / cparam string
#usage_begin
__GLOSSARY_GNU__
#usage_end" > x.gp

echo "  -a, --aparam
  -b
      --cparam
  -h, --help            Display this help and exit.
  -v, --version         Output version information and exit." > exp

for language in $all_languages
do
  gen_code x.gp $language
  if test $language = java; then
    java -classpath $CLASSPATH:classes simple --help > out || fail=1
  else
    parse_cl --help > out || fail=1
  fi
  cmp out exp || fail=1
done

# -------------------------------------------------------

echo "a / aparam string
b string
NONE / cparam string
#usage_begin
__GLOSSARY_GNU__(16)
#usage_end" > x.gp

echo "  -a, --aparam
  -b
      --cparam
  -h, --help    Display this help and exit.
  -v, --version Output version information and exit." > exp

for language in $all_languages
do
  gen_code x.gp $language
  if test $language = java; then
    java -classpath $CLASSPATH:classes simple --help > out || fail=1
  else
    parse_cl --help > out || fail=1
  fi
  cmp out exp || fail=1
done

# -------------------------------------------------------

echo "a / aparam*[=ax] string
NONE / bparam=bx string \"bx is the default for bparam\"
NONE / cparam=cxxxxxxxxxxxxxxxxxxxxx string \"cxxxxxxxxxxxxxxxxxxxxx is the default for cparam\"
#usage_begin
__GLOSSARY__
#usage_end" > x.gp

echo "   [ -a ] [ --aparam[=ax] ] (type=STRING)
   [ --bparam=bx ] (type=STRING)
          bx is the default for bparam
   [ --cparam=cxxxxxxxxxxxxxxxxxxxxx ] (type=STRING)
          cxxxxxxxxxxxxxxxxxxxxx is the default for cparam
   [ -h ] [ --help ] (type=FLAG)
          Display this help and exit.
   [ -v ] [ --version ] (type=FLAG)
          Output version information and exit." > exp

for language in $all_languages
do
  gen_code x.gp $language
  if test $language = java; then
    java -classpath $CLASSPATH:classes simple --help > out || fail=1
  else
    parse_cl --help > out || fail=1
  fi
  cmp out exp || fail=1
done

# -------------------------------------------------------

echo "a / aparam*[=ax] string
NONE / bparam=bx string \"bx is the default for bparam\"
NONE / cparam=cxxxxxxxxxxxxxxxxxxxxx string \"cxxxxxxxxxxxxxxxxxxxxx is the default for cparam\"
#usage_begin
__GLOSSARY_GNU__
#usage_end" > x.gp

echo "  -a, --aparam[=ax]
      --bparam=bx       bx is the default for bparam
      --cparam=cxxxxxxxxxxxxxxxxxxxxxcxxxxxxxxxxxxxxxxxxxxx is the default for cparam
  -h, --help            Display this help and exit.
  -v, --version         Output version information and exit." > exp

for language in $all_languages
do
  gen_code x.gp $language
  if test $language = java; then
    java -classpath $CLASSPATH:classes simple --help > out || fail=1
  else
    parse_cl --help > out || fail=1
  fi
  cmp out exp || fail=1
done

# -------------------------------------------------------

echo "a int 12 [2..20]
b float 1.2 [1.0..2]
c char 'b'
d string {\"abc\"}
e flag
#usage_begin
__GLOSSARY__
#usage_end" > x.gp

echo "   [ -a ] (type=INTEGER, range=2...20, default=12)
   [ -b ] (type=REAL, range=1.0...2, default=1.2)
   [ -c ] (type=CHARACTER, default='b')
   [ -d ] (type=STRING, default=abc)
   [ -e ] (type=FLAG)
   [ -h ] [ --help ] (type=FLAG)
          Display this help and exit.
   [ -v ] [ --version ] (type=FLAG)
          Output version information and exit." > exp

for language in $all_languages
do
  gen_code x.gp $language
  if test $language = java; then
    java -classpath $CLASSPATH:classes simple --help > out || fail=1
  else
    parse_cl --help > out || fail=1
  fi
  cmp out exp || fail=1
done

# -------------------------------------------------------

echo "a long 12 [2..20]
b ulong 34 [20..50]
c intmax 56 [50..60]
d uintmax 78 [70..80]
e double 1.2 [1..2.0]
#usage_begin
__GLOSSARY__
#usage_end" > x.gp

echo "   [ -a ] (type=LONG, range=2...20, default=12)
   [ -b ] (type=UNSIGNED LONG, range=20...50, default=34)
   [ -c ] (type=INTMAX, range=50...60, default=56)
   [ -d ] (type=UINTMAX, range=70...80, default=78)
   [ -e ] (type=DOUBLE, range=1...2.0, default=1.2)
   [ -h ] [ --help ] (type=FLAG)
          Display this help and exit.
   [ -v ] [ --version ] (type=FLAG)
          Output version information and exit." > exp

$GENPARSE --gnulib x.gp >/dev/null                                                   || fail=1
gcc $CFLAGS -o parse_cl $GNULIB_CPPFLAGS parse_cl.c $GNULIB_LDFLAGS $srcdir/simple.c || fail=1
parse_cl --help > out                                                                || fail=1
cmp out exp                                                                          || fail=1

# -------------------------------------------------------

echo "a int \"comment for a\"
\"left aligned comment for a\"
            \"not left aligned comment for a\"
\"another left aligned comment for a\"
b string 
\"left aligned comment for b\"
            \"not left aligned comment for b\"
#usage_begin
__GLOSSARY__

__GLOSSARY_GNU__
#usage_end" > x.gp

echo "   [ -a ] (type=INTEGER)
          comment for a
left aligned comment for a
          not left aligned comment for a
another left aligned comment for a
   [ -b ] (type=STRING)
left aligned comment for b
          not left aligned comment for b
   [ -h ] [ --help ] (type=FLAG)
          Display this help and exit.
   [ -v ] [ --version ] (type=FLAG)
          Output version information and exit.

  -a                    comment for a
left aligned comment for a
                        not left aligned comment for a
another left aligned comment for a
  -b                    left aligned comment for b
                        not left aligned comment for b
  -h, --help            Display this help and exit.
  -v, --version         Output version information and exit." > exp

for language in $all_languages
do
  gen_code x.gp $language
  if test $language = java; then
    java -classpath $CLASSPATH:classes simple --help > out || fail=1
  else
    parse_cl --help > out || fail=1
  fi
  cmp out exp || fail=1
done

exit $fail