antlr3 1.8.0 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. data/History.txt +35 -0
  2. data/Manifest.txt +73 -0
  3. data/README.txt +6 -13
  4. data/java/RubyTarget.java +43 -19
  5. data/java/antlr-full-3.2.1.jar +0 -0
  6. data/lib/antlr3/debug.rb +2 -0
  7. data/lib/antlr3/debug/event-hub.rb +55 -55
  8. data/lib/antlr3/debug/record-event-listener.rb +2 -2
  9. data/lib/antlr3/debug/rule-tracer.rb +14 -14
  10. data/lib/antlr3/debug/socket.rb +47 -47
  11. data/lib/antlr3/debug/trace-event-listener.rb +8 -8
  12. data/lib/antlr3/main.rb +29 -9
  13. data/lib/antlr3/modes/ast-builder.rb +7 -7
  14. data/lib/antlr3/modes/filter.rb +19 -17
  15. data/lib/antlr3/profile.rb +34 -6
  16. data/lib/antlr3/recognizers.rb +50 -1
  17. data/lib/antlr3/streams.rb +19 -15
  18. data/lib/antlr3/streams/rewrite.rb +241 -229
  19. data/lib/antlr3/template/group-file-lexer.rb +6 -8
  20. data/lib/antlr3/template/group-file-parser.rb +16 -16
  21. data/lib/antlr3/template/group-file.rb +1 -1
  22. data/lib/antlr3/test/call-stack.rb +13 -13
  23. data/lib/antlr3/test/core-extensions.rb +69 -69
  24. data/lib/antlr3/test/functional.rb +0 -4
  25. data/lib/antlr3/test/grammar.rb +70 -70
  26. data/lib/antlr3/token.rb +41 -17
  27. data/lib/antlr3/tree.rb +11 -14
  28. data/lib/antlr3/tree/debug.rb +53 -53
  29. data/lib/antlr3/tree/visitor.rb +11 -11
  30. data/lib/antlr3/tree/wizard.rb +35 -35
  31. data/lib/antlr3/util.rb +18 -0
  32. data/lib/antlr3/version.rb +1 -1
  33. data/rakefile +1 -0
  34. data/samples/ANTLRv3Grammar.g +3 -3
  35. data/samples/JavaScript.g +702 -0
  36. data/samples/standard/C/C.g +543 -0
  37. data/samples/standard/C/C.tokens +175 -0
  38. data/samples/standard/C/C__testrig.st +0 -0
  39. data/samples/standard/C/c.rb +12 -0
  40. data/samples/standard/C/input +3479 -0
  41. data/samples/standard/C/output +171 -0
  42. data/samples/standard/LL-star/LLStar.g +101 -0
  43. data/samples/standard/LL-star/input +12 -0
  44. data/samples/standard/LL-star/ll-star.rb +12 -0
  45. data/samples/standard/LL-star/output +2 -0
  46. data/samples/standard/calc/Calculator.g +47 -0
  47. data/samples/standard/calc/Calculator.py +16 -0
  48. data/samples/standard/calc/Calculator.rb +28 -0
  49. data/samples/standard/cminus/CMinus.g +141 -0
  50. data/samples/standard/cminus/bytecode.group +80 -0
  51. data/samples/standard/cminus/cminus.rb +16 -0
  52. data/samples/standard/cminus/input +9 -0
  53. data/samples/standard/cminus/java.group +91 -0
  54. data/samples/standard/cminus/output +11 -0
  55. data/samples/standard/cminus/python.group +48 -0
  56. data/samples/standard/dynamic-scope/DynamicScopes.g +50 -0
  57. data/samples/standard/dynamic-scope/dynamic-scopes.rb +12 -0
  58. data/samples/standard/dynamic-scope/input +7 -0
  59. data/samples/standard/dynamic-scope/output +4 -0
  60. data/samples/standard/fuzzy/FuzzyJava.g +89 -0
  61. data/samples/standard/fuzzy/fuzzy.py +11 -0
  62. data/samples/standard/fuzzy/fuzzy.rb +9 -0
  63. data/samples/standard/fuzzy/input +13 -0
  64. data/samples/standard/fuzzy/output +12 -0
  65. data/samples/standard/hoisted-predicates/HoistedPredicates.g +40 -0
  66. data/samples/standard/hoisted-predicates/hoisted-predicates.rb +13 -0
  67. data/samples/standard/hoisted-predicates/input +1 -0
  68. data/samples/standard/hoisted-predicates/output +1 -0
  69. data/samples/standard/island-grammar/Javadoc.g +46 -0
  70. data/samples/standard/island-grammar/Simple.g +104 -0
  71. data/samples/standard/island-grammar/input +11 -0
  72. data/samples/standard/island-grammar/island.rb +12 -0
  73. data/samples/standard/island-grammar/output +16 -0
  74. data/samples/standard/java/Java.g +827 -0
  75. data/samples/standard/java/input +80 -0
  76. data/samples/standard/java/java.rb +13 -0
  77. data/samples/standard/java/output +1 -0
  78. data/samples/standard/python/Python.g +718 -0
  79. data/samples/standard/python/PythonTokenSource.rb +107 -0
  80. data/samples/standard/python/input +210 -0
  81. data/samples/standard/python/output +24 -0
  82. data/samples/standard/python/python.rb +14 -0
  83. data/samples/standard/rakefile +18 -0
  84. data/samples/standard/scopes/SymbolTable.g +66 -0
  85. data/samples/standard/scopes/input +12 -0
  86. data/samples/standard/scopes/output +3 -0
  87. data/samples/standard/scopes/scopes.rb +12 -0
  88. data/samples/standard/simplecTreeParser/SimpleC.g +113 -0
  89. data/samples/standard/simplecTreeParser/SimpleCWalker.g +64 -0
  90. data/samples/standard/simplecTreeParser/input +12 -0
  91. data/samples/standard/simplecTreeParser/output +1 -0
  92. data/samples/standard/simplecTreeParser/simplec.rb +18 -0
  93. data/samples/standard/treeparser/Lang.g +24 -0
  94. data/samples/standard/treeparser/LangDumpDecl.g +17 -0
  95. data/samples/standard/treeparser/input +1 -0
  96. data/samples/standard/treeparser/output +2 -0
  97. data/samples/standard/treeparser/treeparser.rb +18 -0
  98. data/samples/standard/tweak/Tweak.g +68 -0
  99. data/samples/standard/tweak/input +9 -0
  100. data/samples/standard/tweak/output +16 -0
  101. data/samples/standard/tweak/tweak.rb +13 -0
  102. data/samples/standard/xml/README +16 -0
  103. data/samples/standard/xml/XML.g +123 -0
  104. data/samples/standard/xml/input +21 -0
  105. data/samples/standard/xml/output +39 -0
  106. data/samples/standard/xml/xml.rb +9 -0
  107. data/templates/Ruby.stg +4 -4
  108. data/test/functional/ast-output/auto-ast.rb +0 -5
  109. data/test/functional/ast-output/rewrites.rb +4 -4
  110. data/test/unit/test-scope.rb +45 -0
  111. metadata +96 -8
@@ -0,0 +1,175 @@
1
+ T__29=29
2
+ T__28=28
3
+ T__27=27
4
+ T__26=26
5
+ FloatTypeSuffix=16
6
+ T__25=25
7
+ T__24=24
8
+ T__23=23
9
+ LETTER=11
10
+ T__93=93
11
+ T__94=94
12
+ T__91=91
13
+ T__92=92
14
+ STRING_LITERAL=9
15
+ T__90=90
16
+ FLOATING_POINT_LITERAL=10
17
+ COMMENT=20
18
+ T__99=99
19
+ T__98=98
20
+ T__97=97
21
+ T__96=96
22
+ T__95=95
23
+ T__80=80
24
+ T__81=81
25
+ T__82=82
26
+ T__83=83
27
+ LINE_COMMENT=21
28
+ IntegerTypeSuffix=14
29
+ CHARACTER_LITERAL=8
30
+ T__85=85
31
+ T__84=84
32
+ T__87=87
33
+ T__86=86
34
+ T__89=89
35
+ T__88=88
36
+ WS=19
37
+ T__71=71
38
+ T__72=72
39
+ T__70=70
40
+ LINE_COMMAND=22
41
+ T__76=76
42
+ T__75=75
43
+ T__74=74
44
+ T__73=73
45
+ DECIMAL_LITERAL=7
46
+ EscapeSequence=12
47
+ T__79=79
48
+ T__78=78
49
+ T__77=77
50
+ T__68=68
51
+ T__69=69
52
+ T__66=66
53
+ T__67=67
54
+ T__64=64
55
+ T__65=65
56
+ T__62=62
57
+ T__63=63
58
+ Exponent=15
59
+ T__61=61
60
+ T__60=60
61
+ HexDigit=13
62
+ T__55=55
63
+ T__56=56
64
+ T__57=57
65
+ T__58=58
66
+ T__51=51
67
+ T__52=52
68
+ T__53=53
69
+ T__54=54
70
+ IDENTIFIER=4
71
+ T__59=59
72
+ HEX_LITERAL=5
73
+ T__50=50
74
+ T__42=42
75
+ T__43=43
76
+ T__40=40
77
+ T__41=41
78
+ T__46=46
79
+ T__47=47
80
+ T__44=44
81
+ T__45=45
82
+ T__48=48
83
+ T__49=49
84
+ OCTAL_LITERAL=6
85
+ T__100=100
86
+ T__30=30
87
+ T__31=31
88
+ T__32=32
89
+ T__33=33
90
+ T__34=34
91
+ T__35=35
92
+ T__36=36
93
+ T__37=37
94
+ T__38=38
95
+ T__39=39
96
+ UnicodeEscape=18
97
+ OctalEscape=17
98
+ '>='=86
99
+ '~'=64
100
+ '=='=81
101
+ '/'=56
102
+ 'switch'=93
103
+ '/='=67
104
+ '%='=68
105
+ '>'=84
106
+ '||'=77
107
+ '&&'=78
108
+ 'volatile'=47
109
+ ';'=24
110
+ 'return'=100
111
+ 'typedef'=23
112
+ 'for'=96
113
+ '+'=54
114
+ 'extern'=27
115
+ '.'=61
116
+ '^'=80
117
+ '>>'=88
118
+ 'struct'=42
119
+ 'static'=28
120
+ '++'=58
121
+ 'else'=92
122
+ '^='=74
123
+ '+='=69
124
+ 'break'=99
125
+ '{'=40
126
+ '...'=53
127
+ '>>='=72
128
+ 'void'=31
129
+ '?'=76
130
+ 'int'=34
131
+ 'if'=91
132
+ '&='=73
133
+ ':'=44
134
+ '('=48
135
+ 'while'=94
136
+ '-'=55
137
+ ','=25
138
+ 'default'=90
139
+ '-='=70
140
+ 'short'=33
141
+ ']'=51
142
+ '<<='=71
143
+ 'long'=35
144
+ 'sizeof'=60
145
+ 'enum'=45
146
+ '!'=65
147
+ '|'=79
148
+ '|='=75
149
+ 'const'=46
150
+ 'goto'=97
151
+ '='=26
152
+ 'unsigned'=39
153
+ 'signed'=38
154
+ ')'=49
155
+ 'union'=43
156
+ '*='=66
157
+ 'auto'=29
158
+ '%'=57
159
+ '->'=62
160
+ 'do'=95
161
+ 'case'=89
162
+ 'char'=32
163
+ 'float'=36
164
+ '}'=41
165
+ 'double'=37
166
+ '<<'=87
167
+ '<='=85
168
+ '!='=82
169
+ 'continue'=98
170
+ '<'=83
171
+ '--'=59
172
+ '['=50
173
+ '*'=52
174
+ 'register'=30
175
+ '&'=63
File without changes
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/ruby
2
+ # encoding: utf-8
3
+ $:.unshift( File.dirname( __FILE__ ) )
4
+ require 'CLexer'
5
+ require 'CParser'
6
+
7
+ for file in ARGV
8
+ input = ANTLR3::FileStream.new( file )
9
+ lexer = C::Lexer.new( input )
10
+ parser = C::Parser.new( lexer )
11
+ parser.translation_unit
12
+ end
@@ -0,0 +1,3479 @@
1
+ typedef unsigned int size_t;
2
+ # 325 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stddef.h" 3 4
3
+ typedef long int wchar_t;
4
+ # 34 "/usr/include/stdlib.h" 2 3 4
5
+
6
+
7
+ # 96 "/usr/include/stdlib.h" 3 4
8
+
9
+ typedef int _Bool;
10
+
11
+
12
+ typedef struct
13
+ {
14
+ int quot;
15
+ int rem;
16
+ } div_t;
17
+
18
+
19
+
20
+ typedef struct
21
+ {
22
+ long int quot;
23
+ long int rem;
24
+ } ldiv_t;
25
+
26
+
27
+
28
+ # 140 "/usr/include/stdlib.h" 3 4
29
+ extern size_t __ctype_get_mb_cur_max (void) ;
30
+
31
+
32
+
33
+
34
+ extern double atof ( char *__nptr);
35
+
36
+ extern int atoi ( char *__nptr);
37
+
38
+ extern long int atol ( char *__nptr);
39
+
40
+ extern long long int atoll ( char *__nptr);
41
+
42
+ extern double strtod ( char *__restrict __nptr,
43
+ char **__restrict __endptr) ;
44
+
45
+ # 181 "/usr/include/stdlib.h" 3 4
46
+
47
+
48
+ extern long int strtol ( char *__restrict __nptr,
49
+ char **__restrict __endptr, int __base);
50
+
51
+ extern unsigned long int strtoul ( char *__restrict __nptr,
52
+ char **__restrict __endptr, int __base);
53
+
54
+
55
+
56
+
57
+ extern long long int strtoq ( char *__restrict __nptr,
58
+ char **__restrict __endptr, int __base) ;
59
+ extern unsigned long long int strtouq ( char *__restrict __nptr,
60
+ char **__restrict __endptr, int __base);
61
+
62
+
63
+
64
+
65
+
66
+ extern long long int strtoll ( char *__restrict __nptr,
67
+ char **__restrict __endptr, int __base);
68
+
69
+
70
+ extern unsigned long long int strtoull ( char *__restrict __nptr,
71
+ char **__restrict __endptr, int __base);
72
+
73
+ # 277 "/usr/include/stdlib.h" 3 4
74
+ extern double __strtod_internal ( char *__restrict __nptr,
75
+ char **__restrict __endptr, int __group);
76
+
77
+ extern float __strtof_internal ( char *__restrict __nptr,
78
+ char **__restrict __endptr, int __group)
79
+ ;
80
+ extern long double __strtold_internal ( char *__restrict __nptr,
81
+ char **__restrict __endptr,
82
+ int __group) ;
83
+
84
+ extern long int __strtol_internal ( char *__restrict __nptr,
85
+ char **__restrict __endptr,
86
+ int __base, int __group)
87
+ ;
88
+
89
+
90
+
91
+ extern unsigned long int __strtoul_internal ( char *__restrict __nptr,
92
+ char **__restrict __endptr,
93
+ int __base, int __group)
94
+ ;
95
+
96
+
97
+
98
+
99
+
100
+ extern long long int __strtoll_internal ( char *__restrict __nptr,
101
+ char **__restrict __endptr,
102
+ int __base, int __group)
103
+ ;
104
+
105
+
106
+
107
+
108
+ extern unsigned long long int __strtoull_internal ( char *
109
+ __restrict __nptr,
110
+ char **__restrict __endptr,
111
+ int __base, int __group)
112
+ ;
113
+ # 424 "/usr/include/stdlib.h" 3 4
114
+ extern char *l64a (long int __n);
115
+
116
+
117
+ extern long int a64l ( char *__s)
118
+ ;
119
+
120
+
121
+
122
+
123
+ # 1 "/usr/include/sys/types.h" 1 3 4
124
+ # 29 "/usr/include/sys/types.h" 3 4
125
+
126
+
127
+ # 1 "/usr/include/bits/types.h" 1 3 4
128
+ # 28 "/usr/include/bits/types.h" 3 4
129
+ # 1 "/usr/include/bits/wordsize.h" 1 3 4
130
+ # 29 "/usr/include/bits/types.h" 2 3 4
131
+
132
+
133
+ # 1 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stddef.h" 1 3 4
134
+ # 32 "/usr/include/bits/types.h" 2 3 4
135
+
136
+
137
+ typedef unsigned char __u_char;
138
+ typedef unsigned short int __u_short;
139
+ typedef unsigned int __u_int;
140
+ typedef unsigned long int __u_long;
141
+
142
+
143
+ typedef signed char __int8_t;
144
+ typedef unsigned char __uint8_t;
145
+ typedef signed short int __int16_t;
146
+ typedef unsigned short int __uint16_t;
147
+ typedef signed int __int32_t;
148
+ typedef unsigned int __uint32_t;
149
+
150
+
151
+
152
+
153
+ typedef signed long long int __int64_t;
154
+ typedef unsigned long long int __uint64_t;
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+ typedef long long int __quad_t;
163
+ typedef unsigned long long int __u_quad_t;
164
+ # 129 "/usr/include/bits/types.h" 3 4
165
+ # 1 "/usr/include/bits/typesizes.h" 1 3 4
166
+ # 130 "/usr/include/bits/types.h" 2 3 4
167
+
168
+
169
+
170
+
171
+
172
+
173
+ typedef __u_quad_t __dev_t;
174
+ typedef unsigned int __uid_t;
175
+ typedef unsigned int __gid_t;
176
+ typedef unsigned long int __ino_t;
177
+ typedef __u_quad_t __ino64_t;
178
+ typedef unsigned int __mode_t;
179
+ typedef unsigned int __nlink_t;
180
+ typedef long int __off_t;
181
+ typedef __quad_t __off64_t;
182
+ typedef int __pid_t;
183
+ typedef struct { int __val[2]; } __fsid_t;
184
+ typedef long int __clock_t;
185
+ typedef unsigned long int __rlim_t;
186
+ typedef __u_quad_t __rlim64_t;
187
+ typedef unsigned int __id_t;
188
+ typedef long int __time_t;
189
+ typedef unsigned int __useconds_t;
190
+ typedef long int __suseconds_t;
191
+
192
+ typedef int __daddr_t;
193
+ typedef long int __swblk_t;
194
+ typedef int __key_t;
195
+
196
+
197
+ typedef int __clockid_t;
198
+
199
+
200
+ typedef int __timer_t;
201
+
202
+
203
+ typedef long int __blksize_t;
204
+
205
+
206
+
207
+
208
+ typedef long int __blkcnt_t;
209
+ typedef __quad_t __blkcnt64_t;
210
+
211
+
212
+ typedef unsigned long int __fsblkcnt_t;
213
+ typedef __u_quad_t __fsblkcnt64_t;
214
+
215
+
216
+ typedef unsigned long int __fsfilcnt_t;
217
+ typedef __u_quad_t __fsfilcnt64_t;
218
+
219
+ typedef int __ssize_t;
220
+
221
+
222
+
223
+ typedef __off64_t __loff_t;
224
+ typedef __quad_t *__qaddr_t;
225
+ typedef char *__caddr_t;
226
+
227
+
228
+ typedef int __intptr_t;
229
+
230
+
231
+ typedef unsigned int __socklen_t;
232
+ # 32 "/usr/include/sys/types.h" 2 3 4
233
+
234
+
235
+
236
+ typedef __u_char u_char;
237
+ typedef __u_short u_short;
238
+ typedef __u_int u_int;
239
+ typedef __u_long u_long;
240
+ typedef __quad_t quad_t;
241
+ typedef __u_quad_t u_quad_t;
242
+ typedef __fsid_t fsid_t;
243
+
244
+
245
+
246
+
247
+ typedef __loff_t loff_t;
248
+
249
+
250
+
251
+ typedef __ino_t ino_t;
252
+ # 62 "/usr/include/sys/types.h" 3 4
253
+ typedef __dev_t dev_t;
254
+
255
+
256
+
257
+
258
+ typedef __gid_t gid_t;
259
+
260
+
261
+
262
+
263
+ typedef __mode_t mode_t;
264
+
265
+
266
+
267
+
268
+ typedef __nlink_t nlink_t;
269
+
270
+
271
+
272
+
273
+ typedef __uid_t uid_t;
274
+
275
+
276
+
277
+
278
+
279
+ typedef __off_t off_t;
280
+ # 100 "/usr/include/sys/types.h" 3 4
281
+ typedef __pid_t pid_t;
282
+
283
+
284
+
285
+
286
+ typedef __id_t id_t;
287
+
288
+
289
+
290
+
291
+ typedef __ssize_t ssize_t;
292
+
293
+
294
+
295
+
296
+
297
+ typedef __daddr_t daddr_t;
298
+ typedef __caddr_t caddr_t;
299
+
300
+
301
+
302
+
303
+
304
+ typedef __key_t key_t;
305
+ # 133 "/usr/include/sys/types.h" 3 4
306
+ # 1 "/usr/include/time.h" 1 3 4
307
+ # 74 "/usr/include/time.h" 3 4
308
+
309
+
310
+ typedef __time_t time_t;
311
+
312
+
313
+
314
+ # 92 "/usr/include/time.h" 3 4
315
+ typedef __clockid_t clockid_t;
316
+ # 104 "/usr/include/time.h" 3 4
317
+ typedef __timer_t timer_t;
318
+ # 134 "/usr/include/sys/types.h" 2 3 4
319
+ # 147 "/usr/include/sys/types.h" 3 4
320
+ # 1 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stddef.h" 1 3 4
321
+ # 148 "/usr/include/sys/types.h" 2 3 4
322
+
323
+
324
+
325
+ typedef unsigned long int ulong;
326
+ typedef unsigned short int ushort;
327
+ typedef unsigned int uint;
328
+ # 191 "/usr/include/sys/types.h" 3 4
329
+ typedef int int8_t ;
330
+ typedef int int16_t ;
331
+ typedef int int32_t ;
332
+ typedef int int64_t ;
333
+
334
+
335
+ typedef unsigned int u_int8_t ;
336
+ typedef unsigned int u_int16_t ;
337
+ typedef unsigned int u_int32_t ;
338
+ typedef unsigned int u_int64_t ;
339
+
340
+ typedef int register_t ;
341
+ # 213 "/usr/include/sys/types.h" 3 4
342
+ # 1 "/usr/include/endian.h" 1 3 4
343
+ # 37 "/usr/include/endian.h" 3 4
344
+ # 1 "/usr/include/bits/endian.h" 1 3 4
345
+ # 38 "/usr/include/endian.h" 2 3 4
346
+ # 214 "/usr/include/sys/types.h" 2 3 4
347
+
348
+
349
+ # 1 "/usr/include/sys/select.h" 1 3 4
350
+ # 31 "/usr/include/sys/select.h" 3 4
351
+ # 1 "/usr/include/bits/select.h" 1 3 4
352
+ # 32 "/usr/include/sys/select.h" 2 3 4
353
+
354
+
355
+ # 1 "/usr/include/bits/sigset.h" 1 3 4
356
+ # 23 "/usr/include/bits/sigset.h" 3 4
357
+ typedef int __sig_atomic_t;
358
+
359
+
360
+
361
+
362
+ typedef struct
363
+ {
364
+ unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
365
+ } __sigset_t;
366
+ # 35 "/usr/include/sys/select.h" 2 3 4
367
+
368
+
369
+
370
+ typedef __sigset_t sigset_t;
371
+
372
+
373
+
374
+
375
+
376
+ # 1 "/usr/include/time.h" 1 3 4
377
+ # 118 "/usr/include/time.h" 3 4
378
+ struct timespec
379
+ {
380
+ __time_t tv_sec;
381
+ long int tv_nsec;
382
+ };
383
+ # 45 "/usr/include/sys/select.h" 2 3 4
384
+
385
+ # 1 "/usr/include/bits/time.h" 1 3 4
386
+ # 69 "/usr/include/bits/time.h" 3 4
387
+ struct timeval
388
+ {
389
+ __time_t tv_sec;
390
+ __suseconds_t tv_usec;
391
+ };
392
+ # 47 "/usr/include/sys/select.h" 2 3 4
393
+
394
+
395
+ typedef __suseconds_t suseconds_t;
396
+
397
+
398
+
399
+
400
+
401
+ typedef long int __fd_mask;
402
+ # 67 "/usr/include/sys/select.h" 3 4
403
+ typedef struct
404
+ {
405
+
406
+
407
+
408
+
409
+
410
+
411
+ __fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask))];
412
+
413
+
414
+ } fd_set;
415
+
416
+
417
+
418
+
419
+
420
+
421
+ typedef __fd_mask fd_mask;
422
+ # 99 "/usr/include/sys/select.h" 3 4
423
+
424
+ # 109 "/usr/include/sys/select.h" 3 4
425
+ extern int select (int __nfds, fd_set *__restrict __readfds,
426
+ fd_set *__restrict __writefds,
427
+ fd_set *__restrict __exceptfds,
428
+ struct timeval *__restrict __timeout);
429
+ # 128 "/usr/include/sys/select.h" 3 4
430
+
431
+ # 217 "/usr/include/sys/types.h" 2 3 4
432
+
433
+
434
+ # 1 "/usr/include/sys/sysmacros.h" 1 3 4
435
+ # 29 "/usr/include/sys/sysmacros.h" 3 4
436
+
437
+ extern unsigned int gnu_dev_major (unsigned long long int __dev)
438
+ ;
439
+
440
+ extern unsigned int gnu_dev_minor (unsigned long long int __dev)
441
+ ;
442
+
443
+ extern unsigned long long int gnu_dev_makedev (unsigned int __major,
444
+ unsigned int __minor)
445
+ ;
446
+
447
+
448
+ extern unsigned int
449
+ gnu_dev_major (unsigned long long int __dev)
450
+ {
451
+ return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
452
+ }
453
+
454
+ extern unsigned int
455
+ gnu_dev_minor (unsigned long long int __dev)
456
+ {
457
+ return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
458
+ }
459
+
460
+ extern unsigned long long int
461
+ gnu_dev_makedev (unsigned int __major, unsigned int __minor)
462
+ {
463
+ return ((__minor & 0xff) | ((__major & 0xfff) << 8)
464
+ | (((unsigned long long int) (__minor & ~0xff)) << 12)
465
+ | (((unsigned long long int) (__major & ~0xfff)) << 32));
466
+ }
467
+ # 220 "/usr/include/sys/types.h" 2 3 4
468
+ # 231 "/usr/include/sys/types.h" 3 4
469
+ typedef __blkcnt_t blkcnt_t;
470
+
471
+
472
+
473
+ typedef __fsblkcnt_t fsblkcnt_t;
474
+
475
+
476
+
477
+ typedef __fsfilcnt_t fsfilcnt_t;
478
+ # 266 "/usr/include/sys/types.h" 3 4
479
+ # 1 "/usr/include/bits/pthreadtypes.h" 1 3 4
480
+ # 23 "/usr/include/bits/pthreadtypes.h" 3 4
481
+ # 1 "/usr/include/bits/sched.h" 1 3 4
482
+ # 83 "/usr/include/bits/sched.h" 3 4
483
+ struct __sched_param
484
+ {
485
+ int __sched_priority;
486
+ };
487
+ # 24 "/usr/include/bits/pthreadtypes.h" 2 3 4
488
+
489
+
490
+ struct _pthread_fastlock
491
+ {
492
+ long int __status;
493
+ int __spinlock;
494
+
495
+ };
496
+
497
+
498
+
499
+ typedef struct _pthread_descr_struct *_pthread_descr;
500
+
501
+
502
+
503
+
504
+
505
+ typedef struct __pthread_attr_s
506
+ {
507
+ int __detachstate;
508
+ int __schedpolicy;
509
+ struct __sched_param __schedparam;
510
+ int __inheritsched;
511
+ int __scope;
512
+ size_t __guardsize;
513
+ int __stackaddr_set;
514
+ void *__stackaddr;
515
+ size_t __stacksize;
516
+ } pthread_attr_t;
517
+
518
+
519
+
520
+
521
+
522
+ typedef long long __pthread_cond_align_t;
523
+
524
+
525
+
526
+
527
+ typedef struct
528
+ {
529
+ struct _pthread_fastlock __c_lock;
530
+ _pthread_descr __c_waiting;
531
+ char __padding[48 - sizeof (struct _pthread_fastlock)
532
+ - sizeof (_pthread_descr) - sizeof (__pthread_cond_align_t)];
533
+ __pthread_cond_align_t __align;
534
+ } pthread_cond_t;
535
+
536
+
537
+
538
+ typedef struct
539
+ {
540
+ int __dummy;
541
+ } pthread_condattr_t;
542
+
543
+
544
+ typedef unsigned int pthread_key_t;
545
+
546
+
547
+
548
+
549
+
550
+ typedef struct
551
+ {
552
+ int __m_reserved;
553
+ int __m_count;
554
+ _pthread_descr __m_owner;
555
+ int __m_kind;
556
+ struct _pthread_fastlock __m_lock;
557
+ } pthread_mutex_t;
558
+
559
+
560
+
561
+ typedef struct
562
+ {
563
+ int __mutexkind;
564
+ } pthread_mutexattr_t;
565
+
566
+
567
+
568
+ typedef int pthread_once_t;
569
+ # 150 "/usr/include/bits/pthreadtypes.h" 3 4
570
+ typedef unsigned long int pthread_t;
571
+ # 267 "/usr/include/sys/types.h" 2 3 4
572
+
573
+
574
+
575
+ # 434 "/usr/include/stdlib.h" 2 3 4
576
+
577
+
578
+
579
+
580
+
581
+
582
+ extern long int random (void);
583
+
584
+
585
+ extern void srandom (unsigned int __seed);
586
+
587
+
588
+
589
+
590
+
591
+ extern char *initstate (unsigned int __seed, char *__statebuf,
592
+ size_t __statelen) ;
593
+
594
+
595
+
596
+ extern char *setstate (char *__statebuf) ;
597
+
598
+
599
+
600
+
601
+
602
+
603
+
604
+ struct random_data
605
+ {
606
+ int32_t *fptr;
607
+ int32_t *rptr;
608
+ int32_t *state;
609
+ int rand_type;
610
+ int rand_deg;
611
+ int rand_sep;
612
+ int32_t *end_ptr;
613
+ };
614
+
615
+ extern int random_r (struct random_data *__restrict __buf,
616
+ int32_t *__restrict __result) ;
617
+
618
+ extern int srandom_r (unsigned int __seed, struct random_data *__buf)
619
+ ;
620
+
621
+ extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
622
+ size_t __statelen,
623
+ struct random_data *__restrict __buf)
624
+ ;
625
+
626
+ extern int setstate_r (char *__restrict __statebuf,
627
+ struct random_data *__restrict __buf)
628
+ ;
629
+
630
+
631
+
632
+
633
+
634
+
635
+ extern int rand (void);
636
+
637
+ extern void srand (unsigned int __seed);
638
+
639
+
640
+
641
+
642
+ extern int rand_r (unsigned int *__seed);
643
+
644
+
645
+
646
+
647
+
648
+
649
+
650
+ extern double drand48 (void);
651
+ extern double erand48 (unsigned short int __xsubi[3]) ;
652
+
653
+
654
+ extern long int lrand48 (void);
655
+ extern long int nrand48 (unsigned short int __xsubi[3])
656
+ ;
657
+
658
+
659
+ extern long int mrand48 (void);
660
+ extern long int jrand48 (unsigned short int __xsubi[3])
661
+ ;
662
+
663
+
664
+ extern void srand48 (long int __seedval);
665
+ extern unsigned short int *seed48 (unsigned short int __seed16v[3])
666
+ ;
667
+ extern void lcong48 (unsigned short int __param[7]) ;
668
+
669
+
670
+
671
+
672
+
673
+ struct drand48_data
674
+ {
675
+ unsigned short int __x[3];
676
+ unsigned short int __old_x[3];
677
+ unsigned short int __c;
678
+ unsigned short int __init;
679
+ unsigned long long int __a;
680
+ };
681
+
682
+
683
+ extern int drand48_r (struct drand48_data *__restrict __buffer,
684
+ double *__restrict __result) ;
685
+ extern int erand48_r (unsigned short int __xsubi[3],
686
+ struct drand48_data *__restrict __buffer,
687
+ double *__restrict __result) ;
688
+
689
+
690
+ extern int lrand48_r (struct drand48_data *__restrict __buffer,
691
+ long int *__restrict __result)
692
+ ;
693
+ extern int nrand48_r (unsigned short int __xsubi[3],
694
+ struct drand48_data *__restrict __buffer,
695
+ long int *__restrict __result)
696
+ ;
697
+
698
+
699
+ extern int mrand48_r (struct drand48_data *__restrict __buffer,
700
+ long int *__restrict __result)
701
+ ;
702
+ extern int jrand48_r (unsigned short int __xsubi[3],
703
+ struct drand48_data *__restrict __buffer,
704
+ long int *__restrict __result)
705
+ ;
706
+
707
+
708
+ extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
709
+ ;
710
+
711
+ extern int seed48_r (unsigned short int __seed16v[3],
712
+ struct drand48_data *__buffer) ;
713
+
714
+ extern int lcong48_r (unsigned short int __param[7],
715
+ struct drand48_data *__buffer)
716
+ ;
717
+
718
+
719
+
720
+
721
+
722
+
723
+
724
+
725
+
726
+ extern void *malloc (size_t __size) ;
727
+
728
+ extern void *calloc (size_t __nmemb, size_t __size)
729
+ ;
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+ extern void *realloc (void *__ptr, size_t __size) ;
738
+
739
+ extern void free (void *__ptr);
740
+
741
+
742
+
743
+
744
+ extern void cfree (void *__ptr);
745
+
746
+
747
+
748
+ # 1 "/usr/include/alloca.h" 1 3 4
749
+ # 25 "/usr/include/alloca.h" 3 4
750
+ # 1 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stddef.h" 1 3 4
751
+ # 26 "/usr/include/alloca.h" 2 3 4
752
+
753
+
754
+
755
+
756
+
757
+
758
+
759
+ extern void *alloca (size_t __size);
760
+
761
+
762
+
763
+
764
+
765
+
766
+ # 607 "/usr/include/stdlib.h" 2 3 4
767
+
768
+
769
+
770
+
771
+ extern void *valloc (size_t __size) ;
772
+ # 620 "/usr/include/stdlib.h" 3 4
773
+
774
+
775
+ extern void abort (void) ;
776
+
777
+
778
+
779
+ extern int atexit (void (*__func) (void)) ;
780
+
781
+
782
+
783
+
784
+
785
+ extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
786
+ ;
787
+
788
+
789
+
790
+
791
+
792
+
793
+ extern void exit (int __status) ;
794
+
795
+ # 652 "/usr/include/stdlib.h" 3 4
796
+
797
+
798
+ extern char *getenv ( char *__name) ;
799
+
800
+
801
+
802
+
803
+ extern char *__secure_getenv ( char *__name) ;
804
+
805
+
806
+
807
+
808
+
809
+ extern int putenv (char *__string) ;
810
+
811
+
812
+
813
+
814
+
815
+ extern int setenv ( char *__name, char *__value, int __replace)
816
+ ;
817
+
818
+
819
+ extern int unsetenv ( char *__name) ;
820
+
821
+
822
+
823
+
824
+
825
+
826
+ extern int clearenv (void);
827
+ # 691 "/usr/include/stdlib.h" 3 4
828
+ extern char *mktemp (char *__template) ;
829
+ # 702 "/usr/include/stdlib.h" 3 4
830
+ extern int mkstemp (char *__template) ;
831
+ # 721 "/usr/include/stdlib.h" 3 4
832
+ extern char *mkdtemp (char *__template) ;
833
+
834
+
835
+
836
+
837
+
838
+
839
+
840
+
841
+ extern int system ( char *__command);
842
+
843
+ # 749 "/usr/include/stdlib.h" 3 4
844
+ extern char *realpath ( char *__restrict __name,
845
+ char *__restrict __resolved) ;
846
+
847
+
848
+
849
+
850
+
851
+
852
+ typedef int (*__compar_fn_t) ( void *, void *);
853
+
854
+
855
+
856
+
857
+
858
+
859
+
860
+
861
+
862
+ extern void *bsearch ( void *__key, void *__base,
863
+ size_t __nmemb, size_t __size, __compar_fn_t __compar)
864
+ ;
865
+
866
+
867
+
868
+ extern void qsort (void *__base, size_t __nmemb, size_t __size,
869
+ __compar_fn_t __compar) ;
870
+
871
+
872
+
873
+ extern int abs (int __x) ;
874
+ extern long int labs (long int __x) ;
875
+
876
+
877
+
878
+
879
+
880
+
881
+
882
+
883
+
884
+
885
+
886
+
887
+ extern div_t div (int __numer, int __denom)
888
+ ;
889
+ extern ldiv_t ldiv (long int __numer, long int __denom)
890
+ ;
891
+
892
+ # 814 "/usr/include/stdlib.h" 3 4
893
+ extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
894
+ int *__restrict __sign) ;
895
+
896
+
897
+
898
+
899
+ extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
900
+ int *__restrict __sign) ;
901
+
902
+
903
+
904
+
905
+ extern char *gcvt (double __value, int __ndigit, char *__buf)
906
+ ;
907
+
908
+
909
+
910
+
911
+ extern char *qecvt (long double __value, int __ndigit,
912
+ int *__restrict __decpt, int *__restrict __sign)
913
+ ;
914
+ extern char *qfcvt (long double __value, int __ndigit,
915
+ int *__restrict __decpt, int *__restrict __sign)
916
+ ;
917
+ extern char *qgcvt (long double __value, int __ndigit, char *__buf)
918
+ ;
919
+
920
+
921
+
922
+
923
+ extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
924
+ int *__restrict __sign, char *__restrict __buf,
925
+ size_t __len) ;
926
+ extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
927
+ int *__restrict __sign, char *__restrict __buf,
928
+ size_t __len) ;
929
+
930
+ extern int qecvt_r (long double __value, int __ndigit,
931
+ int *__restrict __decpt, int *__restrict __sign,
932
+ char *__restrict __buf, size_t __len)
933
+ ;
934
+ extern int qfcvt_r (long double __value, int __ndigit,
935
+ int *__restrict __decpt, int *__restrict __sign,
936
+ char *__restrict __buf, size_t __len)
937
+ ;
938
+
939
+
940
+
941
+
942
+
943
+
944
+
945
+ extern int mblen ( char *__s, size_t __n);
946
+
947
+
948
+ extern int mbtowc (wchar_t *__restrict __pwc,
949
+ char *__restrict __s, size_t __n);
950
+
951
+
952
+ extern int wctomb (char *__s, wchar_t __wchar);
953
+
954
+
955
+
956
+ extern size_t mbstowcs (wchar_t *__restrict __pwcs,
957
+ char *__restrict __s, size_t __n);
958
+
959
+ extern size_t wcstombs (char *__restrict __s,
960
+ wchar_t *__restrict __pwcs, size_t __n)
961
+ ;
962
+
963
+
964
+
965
+
966
+
967
+
968
+
969
+
970
+ extern int rpmatch ( char *__response) ;
971
+ # 954 "/usr/include/stdlib.h" 3 4
972
+ extern int getloadavg (double __loadavg[], int __nelem)
973
+ ;
974
+
975
+
976
+
977
+
978
+
979
+
980
+ # 119 "./test.priv.h" 2
981
+ # 1 "/usr/include/string.h" 1 3 4
982
+ # 28 "/usr/include/string.h" 3 4
983
+
984
+
985
+
986
+
987
+
988
+ # 1 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stddef.h" 1 3 4
989
+ # 34 "/usr/include/string.h" 2 3 4
990
+
991
+
992
+
993
+
994
+ extern void *memcpy (void *__restrict __dest,
995
+ void *__restrict __src, size_t __n)
996
+ ;
997
+
998
+
999
+ extern void *memmove (void *__dest, void *__src, size_t __n)
1000
+ ;
1001
+
1002
+
1003
+
1004
+
1005
+
1006
+
1007
+ extern void *memccpy (void *__restrict __dest, void *__restrict __src,
1008
+ int __c, size_t __n)
1009
+ ;
1010
+
1011
+
1012
+
1013
+
1014
+
1015
+ extern void *memset (void *__s, int __c, size_t __n) ;
1016
+
1017
+
1018
+ extern int memcmp ( void *__s1, void *__s2, size_t __n)
1019
+ ;
1020
+
1021
+
1022
+ extern void *memchr ( void *__s, int __c, size_t __n)
1023
+ ;
1024
+
1025
+ # 82 "/usr/include/string.h" 3 4
1026
+
1027
+
1028
+ extern char *strcpy (char *__restrict __dest, char *__restrict __src)
1029
+ ;
1030
+
1031
+ extern char *strncpy (char *__restrict __dest,
1032
+ char *__restrict __src, size_t __n)
1033
+ ;
1034
+
1035
+
1036
+ extern char *strcat (char *__restrict __dest, char *__restrict __src)
1037
+ ;
1038
+
1039
+ extern char *strncat (char *__restrict __dest, char *__restrict __src,
1040
+ size_t __n) ;
1041
+
1042
+
1043
+ extern int strcmp ( char *__s1, char *__s2)
1044
+ ;
1045
+
1046
+ extern int strncmp ( char *__s1, char *__s2, size_t __n)
1047
+ ;
1048
+
1049
+
1050
+ extern int strcoll ( char *__s1, char *__s2)
1051
+ ;
1052
+
1053
+ extern size_t strxfrm (char *__restrict __dest,
1054
+ char *__restrict __src, size_t __n)
1055
+ ;
1056
+
1057
+ # 130 "/usr/include/string.h" 3 4
1058
+ extern char *strdup ( char *__s)
1059
+ ;
1060
+ # 165 "/usr/include/string.h" 3 4
1061
+
1062
+
1063
+ extern char *strchr ( char *__s, int __c)
1064
+ ;
1065
+
1066
+ extern char *strrchr ( char *__s, int __c)
1067
+ ;
1068
+
1069
+ # 181 "/usr/include/string.h" 3 4
1070
+
1071
+
1072
+
1073
+ extern size_t strcspn ( char *__s, char *__reject)
1074
+ ;
1075
+
1076
+
1077
+ extern size_t strspn ( char *__s, char *__accept)
1078
+ ;
1079
+
1080
+ extern char *strpbrk ( char *__s, char *__accept)
1081
+ ;
1082
+
1083
+ extern char *strstr ( char *__haystack, char *__needle)
1084
+ ;
1085
+
1086
+
1087
+
1088
+ extern char *strtok (char *__restrict __s, char *__restrict __delim)
1089
+ ;
1090
+
1091
+
1092
+
1093
+
1094
+ extern char *__strtok_r (char *__restrict __s,
1095
+ char *__restrict __delim,
1096
+ char **__restrict __save_ptr)
1097
+ ;
1098
+
1099
+ extern char *strtok_r (char *__restrict __s, char *__restrict __delim,
1100
+ char **__restrict __save_ptr)
1101
+ ;
1102
+ # 240 "/usr/include/string.h" 3 4
1103
+
1104
+
1105
+ extern size_t strlen ( char *__s)
1106
+ ;
1107
+
1108
+ # 254 "/usr/include/string.h" 3 4
1109
+
1110
+
1111
+ extern char *strerror (int __errnum);
1112
+
1113
+ # 281 "/usr/include/string.h" 3 4
1114
+ extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
1115
+ ;
1116
+
1117
+
1118
+
1119
+
1120
+
1121
+ extern void __bzero (void *__s, size_t __n) ;
1122
+
1123
+
1124
+
1125
+ extern void bcopy ( void *__src, void *__dest, size_t __n)
1126
+ ;
1127
+
1128
+
1129
+ extern void bzero (void *__s, size_t __n) ;
1130
+
1131
+
1132
+ extern int bcmp ( void *__s1, void *__s2, size_t __n)
1133
+ ;
1134
+
1135
+
1136
+ extern char *index ( char *__s, int __c)
1137
+ ;
1138
+
1139
+
1140
+ extern char *rindex ( char *__s, int __c)
1141
+ ;
1142
+
1143
+
1144
+
1145
+ extern int ffs (int __i) ;
1146
+ # 325 "/usr/include/string.h" 3 4
1147
+ extern int strcasecmp ( char *__s1, char *__s2)
1148
+ ;
1149
+
1150
+
1151
+ extern int strncasecmp ( char *__s1, char *__s2, size_t __n)
1152
+ ;
1153
+ # 348 "/usr/include/string.h" 3 4
1154
+ extern char *strsep (char **__restrict __stringp,
1155
+ char *__restrict __delim)
1156
+ ;
1157
+ # 426 "/usr/include/string.h" 3 4
1158
+
1159
+ # 120 "./test.priv.h" 2
1160
+
1161
+
1162
+
1163
+
1164
+
1165
+
1166
+ # 1 "/usr/include/signal.h" 1 3 4
1167
+ # 31 "/usr/include/signal.h" 3 4
1168
+
1169
+
1170
+ # 1 "/usr/include/bits/sigset.h" 1 3 4
1171
+ # 103 "/usr/include/bits/sigset.h" 3 4
1172
+ extern int __sigismember ( __sigset_t *, int);
1173
+ extern int __sigaddset (__sigset_t *, int);
1174
+ extern int __sigdelset (__sigset_t *, int);
1175
+ # 34 "/usr/include/signal.h" 2 3 4
1176
+
1177
+
1178
+
1179
+
1180
+
1181
+
1182
+
1183
+ typedef __sig_atomic_t sig_atomic_t;
1184
+
1185
+ # 58 "/usr/include/signal.h" 3 4
1186
+ # 1 "/usr/include/bits/signum.h" 1 3 4
1187
+ # 59 "/usr/include/signal.h" 2 3 4
1188
+ # 75 "/usr/include/signal.h" 3 4
1189
+ typedef void (*__sighandler_t) (int);
1190
+
1191
+
1192
+
1193
+
1194
+ extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler)
1195
+ ;
1196
+ # 90 "/usr/include/signal.h" 3 4
1197
+
1198
+
1199
+ extern __sighandler_t signal (int __sig, __sighandler_t __handler);
1200
+ # 103 "/usr/include/signal.h" 3 4
1201
+
1202
+ # 115 "/usr/include/signal.h" 3 4
1203
+ extern int kill (__pid_t __pid, int __sig);
1204
+
1205
+
1206
+
1207
+
1208
+
1209
+
1210
+ extern int killpg (__pid_t __pgrp, int __sig);
1211
+
1212
+
1213
+
1214
+
1215
+ extern int raise (int __sig);
1216
+
1217
+
1218
+
1219
+
1220
+ extern __sighandler_t ssignal (int __sig, __sighandler_t __handler);
1221
+ extern int gsignal (int __sig);
1222
+
1223
+
1224
+
1225
+
1226
+ extern void psignal (int __sig, char *__s);
1227
+ # 150 "/usr/include/signal.h" 3 4
1228
+ extern int __sigpause (int __sig_or_mask, int __is_sig);
1229
+ # 179 "/usr/include/signal.h" 3 4
1230
+ extern int sigblock (int __mask);
1231
+
1232
+
1233
+ extern int sigsetmask (int __mask);
1234
+
1235
+
1236
+ extern int siggetmask (void);
1237
+ # 199 "/usr/include/signal.h" 3 4
1238
+ typedef __sighandler_t sig_t;
1239
+
1240
+
1241
+
1242
+
1243
+
1244
+
1245
+
1246
+ # 1 "/usr/include/time.h" 1 3 4
1247
+ # 208 "/usr/include/signal.h" 2 3 4
1248
+
1249
+
1250
+ # 1 "/usr/include/bits/siginfo.h" 1 3 4
1251
+ # 25 "/usr/include/bits/siginfo.h" 3 4
1252
+ # 1 "/usr/include/bits/wordsize.h" 1 3 4
1253
+ # 26 "/usr/include/bits/siginfo.h" 2 3 4
1254
+
1255
+
1256
+
1257
+
1258
+
1259
+
1260
+
1261
+ typedef union sigval
1262
+ {
1263
+ int sival_int;
1264
+ void *sival_ptr;
1265
+ } sigval_t;
1266
+ # 51 "/usr/include/bits/siginfo.h" 3 4
1267
+ typedef struct siginfo
1268
+ {
1269
+ int si_signo;
1270
+ int si_errno;
1271
+
1272
+ int si_code;
1273
+
1274
+ union
1275
+ {
1276
+ int _pad[((128 / sizeof (int)) - 3)];
1277
+
1278
+
1279
+ struct
1280
+ {
1281
+ __pid_t si_pid;
1282
+ __uid_t si_uid;
1283
+ } _kill;
1284
+
1285
+
1286
+ struct
1287
+ {
1288
+ int si_tid;
1289
+ int si_overrun;
1290
+ sigval_t si_sigval;
1291
+ } _timer;
1292
+
1293
+
1294
+ struct
1295
+ {
1296
+ __pid_t si_pid;
1297
+ __uid_t si_uid;
1298
+ sigval_t si_sigval;
1299
+ } _rt;
1300
+
1301
+
1302
+ struct
1303
+ {
1304
+ __pid_t si_pid;
1305
+ __uid_t si_uid;
1306
+ int si_status;
1307
+ __clock_t si_utime;
1308
+ __clock_t si_stime;
1309
+ } _sigchld;
1310
+
1311
+
1312
+ struct
1313
+ {
1314
+ void *si_addr;
1315
+ } _sigfault;
1316
+
1317
+
1318
+ struct
1319
+ {
1320
+ long int si_band;
1321
+ int si_fd;
1322
+ } _sigpoll;
1323
+ } _sifields;
1324
+ } siginfo_t;
1325
+ # 129 "/usr/include/bits/siginfo.h" 3 4
1326
+ enum
1327
+ {
1328
+ SI_ASYNCNL = -60,
1329
+
1330
+ SI_TKILL = -6,
1331
+
1332
+ SI_SIGIO,
1333
+
1334
+ SI_ASYNCIO,
1335
+
1336
+ SI_MESGQ,
1337
+
1338
+ SI_TIMER,
1339
+
1340
+ SI_QUEUE,
1341
+
1342
+ SI_USER,
1343
+
1344
+ SI_KERNEL = 0x80
1345
+
1346
+ };
1347
+
1348
+
1349
+
1350
+ enum
1351
+ {
1352
+ ILL_ILLOPC = 1,
1353
+
1354
+ ILL_ILLOPN,
1355
+
1356
+ ILL_ILLADR,
1357
+
1358
+ ILL_ILLTRP,
1359
+
1360
+ ILL_PRVOPC,
1361
+
1362
+ ILL_PRVREG,
1363
+
1364
+ ILL_COPROC,
1365
+
1366
+ ILL_BADSTK
1367
+
1368
+ };
1369
+
1370
+
1371
+ enum
1372
+ {
1373
+ FPE_INTDIV = 1,
1374
+
1375
+ FPE_INTOVF,
1376
+
1377
+ FPE_FLTDIV,
1378
+
1379
+ FPE_FLTOVF,
1380
+
1381
+ FPE_FLTUND,
1382
+
1383
+ FPE_FLTRES,
1384
+
1385
+ FPE_FLTINV,
1386
+
1387
+ FPE_FLTSUB
1388
+
1389
+ };
1390
+
1391
+
1392
+ enum
1393
+ {
1394
+ SEGV_MAPERR = 1,
1395
+
1396
+ SEGV_ACCERR
1397
+
1398
+ };
1399
+
1400
+
1401
+ enum
1402
+ {
1403
+ BUS_ADRALN = 1,
1404
+
1405
+ BUS_ADRERR,
1406
+
1407
+ BUS_OBJERR
1408
+
1409
+ };
1410
+
1411
+
1412
+ enum
1413
+ {
1414
+ TRAP_BRKPT = 1,
1415
+
1416
+ TRAP_TRACE
1417
+
1418
+ };
1419
+
1420
+
1421
+ enum
1422
+ {
1423
+ CLD_EXITED = 1,
1424
+
1425
+ CLD_KILLED,
1426
+
1427
+ CLD_DUMPED,
1428
+
1429
+ CLD_TRAPPED,
1430
+
1431
+ CLD_STOPPED,
1432
+
1433
+ CLD_CONTINUED
1434
+
1435
+ };
1436
+
1437
+
1438
+ enum
1439
+ {
1440
+ POLL_IN = 1,
1441
+
1442
+ POLL_OUT,
1443
+
1444
+ POLL_MSG,
1445
+
1446
+ POLL_ERR,
1447
+
1448
+ POLL_PRI,
1449
+
1450
+ POLL_HUP
1451
+
1452
+ };
1453
+ # 273 "/usr/include/bits/siginfo.h" 3 4
1454
+ typedef struct sigevent
1455
+ {
1456
+ sigval_t sigev_value;
1457
+ int sigev_signo;
1458
+ int sigev_notify;
1459
+
1460
+ union
1461
+ {
1462
+ int _pad[((64 / sizeof (int)) - 3)];
1463
+
1464
+
1465
+
1466
+ __pid_t _tid;
1467
+
1468
+ struct
1469
+ {
1470
+ void (*_function) (sigval_t);
1471
+ void *_attribute;
1472
+ } _sigev_thread;
1473
+ } _sigev_un;
1474
+ } sigevent_t;
1475
+
1476
+
1477
+
1478
+
1479
+
1480
+
1481
+ enum
1482
+ {
1483
+ SIGEV_SIGNAL = 0,
1484
+
1485
+ SIGEV_NONE,
1486
+
1487
+ SIGEV_THREAD,
1488
+
1489
+
1490
+ SIGEV_THREAD_ID = 4
1491
+
1492
+ };
1493
+ # 211 "/usr/include/signal.h" 2 3 4
1494
+
1495
+
1496
+
1497
+ extern int sigemptyset (sigset_t *__set);
1498
+
1499
+
1500
+ extern int sigfillset (sigset_t *__set);
1501
+
1502
+
1503
+ extern int sigaddset (sigset_t *__set, int __signo);
1504
+
1505
+
1506
+ extern int sigdelset (sigset_t *__set, int __signo);
1507
+
1508
+
1509
+ extern int sigismember ( sigset_t *__set, int __signo);
1510
+ # 243 "/usr/include/signal.h" 3 4
1511
+ # 1 "/usr/include/bits/sigaction.h" 1 3 4
1512
+ # 25 "/usr/include/bits/sigaction.h" 3 4
1513
+ struct sigaction
1514
+ {
1515
+
1516
+
1517
+ union
1518
+ {
1519
+
1520
+ __sighandler_t sa_handler;
1521
+
1522
+ void (*sa_sigaction) (int, siginfo_t *, void *);
1523
+ }
1524
+ __sigaction_handler;
1525
+
1526
+
1527
+
1528
+
1529
+
1530
+
1531
+
1532
+ __sigset_t sa_mask;
1533
+
1534
+
1535
+ int sa_flags;
1536
+
1537
+
1538
+ void (*sa_restorer) (void);
1539
+ };
1540
+ # 244 "/usr/include/signal.h" 2 3 4
1541
+
1542
+
1543
+ extern int sigprocmask (int __how, sigset_t *__restrict __set,
1544
+ sigset_t *__restrict __oset);
1545
+
1546
+
1547
+
1548
+
1549
+
1550
+
1551
+ extern int sigsuspend ( sigset_t *__set);
1552
+
1553
+
1554
+ extern int sigaction (int __sig, struct sigaction *__restrict __act,
1555
+ struct sigaction *__restrict __oact);
1556
+
1557
+
1558
+ extern int sigpending (sigset_t *__set);
1559
+
1560
+
1561
+
1562
+
1563
+
1564
+
1565
+ extern int sigwait ( sigset_t *__restrict __set, int *__restrict __sig);
1566
+
1567
+
1568
+
1569
+
1570
+
1571
+
1572
+ extern int sigwaitinfo ( sigset_t *__restrict __set,
1573
+ siginfo_t *__restrict __info);
1574
+
1575
+
1576
+
1577
+
1578
+
1579
+
1580
+ extern int sigtimedwait ( sigset_t *__restrict __set,
1581
+ siginfo_t *__restrict __info,
1582
+ struct timespec *__restrict __timeout);
1583
+
1584
+
1585
+
1586
+ extern int sigqueue (__pid_t __pid, int __sig, union sigval __val)
1587
+ ;
1588
+ # 299 "/usr/include/signal.h" 3 4
1589
+ extern char * _sys_siglist[65];
1590
+ extern char * sys_siglist[65];
1591
+
1592
+
1593
+ struct sigvec
1594
+ {
1595
+ __sighandler_t sv_handler;
1596
+ int sv_mask;
1597
+
1598
+ int sv_flags;
1599
+
1600
+ };
1601
+ # 323 "/usr/include/signal.h" 3 4
1602
+ extern int sigvec (int __sig, struct sigvec *__vec,
1603
+ struct sigvec *__ovec);
1604
+
1605
+
1606
+
1607
+ # 1 "/usr/include/bits/sigcontext.h" 1 3 4
1608
+ # 28 "/usr/include/bits/sigcontext.h" 3 4
1609
+ # 1 "/usr/include/asm/sigcontext.h" 1 3 4
1610
+ # 18 "/usr/include/asm/sigcontext.h" 3 4
1611
+ struct _fpreg {
1612
+ unsigned short significand[4];
1613
+ unsigned short exponent;
1614
+ };
1615
+
1616
+ struct _fpxreg {
1617
+ unsigned short significand[4];
1618
+ unsigned short exponent;
1619
+ unsigned short padding[3];
1620
+ };
1621
+
1622
+ struct _xmmreg {
1623
+ unsigned long element[4];
1624
+ };
1625
+
1626
+ struct _fpstate {
1627
+
1628
+ unsigned long cw;
1629
+ unsigned long sw;
1630
+ unsigned long tag;
1631
+ unsigned long ipoff;
1632
+ unsigned long cssel;
1633
+ unsigned long dataoff;
1634
+ unsigned long datasel;
1635
+ struct _fpreg _st[8];
1636
+ unsigned short status;
1637
+ unsigned short magic;
1638
+
1639
+
1640
+ unsigned long _fxsr_env[6];
1641
+ unsigned long mxcsr;
1642
+ unsigned long reserved;
1643
+ struct _fpxreg _fxsr_st[8];
1644
+ struct _xmmreg _xmm[8];
1645
+ unsigned long padding[56];
1646
+ };
1647
+
1648
+
1649
+
1650
+ struct sigcontext {
1651
+ unsigned short gs, __gsh;
1652
+ unsigned short fs, __fsh;
1653
+ unsigned short es, __esh;
1654
+ unsigned short ds, __dsh;
1655
+ unsigned long edi;
1656
+ unsigned long esi;
1657
+ unsigned long ebp;
1658
+ unsigned long esp;
1659
+ unsigned long ebx;
1660
+ unsigned long edx;
1661
+ unsigned long ecx;
1662
+ unsigned long eax;
1663
+ unsigned long trapno;
1664
+ unsigned long err;
1665
+ unsigned long eip;
1666
+ unsigned short cs, __csh;
1667
+ unsigned long eflags;
1668
+ unsigned long esp_at_signal;
1669
+ unsigned short ss, __ssh;
1670
+ struct _fpstate * fpstate;
1671
+ unsigned long oldmask;
1672
+ unsigned long cr2;
1673
+ };
1674
+ # 29 "/usr/include/bits/sigcontext.h" 2 3 4
1675
+ # 329 "/usr/include/signal.h" 2 3 4
1676
+
1677
+
1678
+ extern int sigreturn (struct sigcontext *__scp);
1679
+ # 341 "/usr/include/signal.h" 3 4
1680
+ extern int siginterrupt (int __sig, int __interrupt);
1681
+
1682
+ # 1 "/usr/include/bits/sigstack.h" 1 3 4
1683
+ # 26 "/usr/include/bits/sigstack.h" 3 4
1684
+ struct sigstack
1685
+ {
1686
+ void *ss_sp;
1687
+ int ss_onstack;
1688
+ };
1689
+
1690
+
1691
+
1692
+ enum
1693
+ {
1694
+ SS_ONSTACK = 1,
1695
+
1696
+ SS_DISABLE
1697
+
1698
+ };
1699
+ # 50 "/usr/include/bits/sigstack.h" 3 4
1700
+ typedef struct sigaltstack
1701
+ {
1702
+ void *ss_sp;
1703
+ int ss_flags;
1704
+ size_t ss_size;
1705
+ } stack_t;
1706
+ # 344 "/usr/include/signal.h" 2 3 4
1707
+ # 352 "/usr/include/signal.h" 3 4
1708
+ extern int sigstack (struct sigstack *__ss, struct sigstack *__oss);
1709
+
1710
+
1711
+
1712
+ extern int sigaltstack ( struct sigaltstack *__restrict __ss,
1713
+ struct sigaltstack *__restrict __oss);
1714
+ # 380 "/usr/include/signal.h" 3 4
1715
+ # 1 "/usr/include/bits/pthreadtypes.h" 1 3 4
1716
+ # 381 "/usr/include/signal.h" 2 3 4
1717
+ # 1 "/usr/include/bits/sigthread.h" 1 3 4
1718
+ # 31 "/usr/include/bits/sigthread.h" 3 4
1719
+ extern int pthread_sigmask (int __how,
1720
+ __sigset_t *__restrict __newmask,
1721
+ __sigset_t *__restrict __oldmask);
1722
+
1723
+
1724
+ extern int pthread_kill (pthread_t __threadid, int __signo);
1725
+ # 382 "/usr/include/signal.h" 2 3 4
1726
+
1727
+
1728
+
1729
+
1730
+
1731
+
1732
+ extern int __libc_current_sigrtmin (void);
1733
+
1734
+ extern int __libc_current_sigrtmax (void);
1735
+
1736
+
1737
+
1738
+
1739
+ # 127 "./test.priv.h" 2
1740
+ # 135 "./test.priv.h"
1741
+ # 1 "/usr/include/curses.h" 1 3 4
1742
+ # 58 "/usr/include/curses.h" 3 4
1743
+ # 1 "/usr/include/ncurses/ncurses_dll.h" 1 3 4
1744
+ # 59 "/usr/include/curses.h" 2 3 4
1745
+ # 106 "/usr/include/curses.h" 3 4
1746
+ typedef unsigned long chtype;
1747
+
1748
+ # 1 "/usr/include/stdio.h" 1 3 4
1749
+ # 30 "/usr/include/stdio.h" 3 4
1750
+
1751
+
1752
+
1753
+
1754
+ # 1 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stddef.h" 1 3 4
1755
+ # 35 "/usr/include/stdio.h" 2 3 4
1756
+ # 44 "/usr/include/stdio.h" 3 4
1757
+
1758
+
1759
+ typedef struct _IO_FILE FILE;
1760
+
1761
+
1762
+
1763
+
1764
+
1765
+ # 62 "/usr/include/stdio.h" 3 4
1766
+ typedef struct _IO_FILE __FILE;
1767
+ # 72 "/usr/include/stdio.h" 3 4
1768
+ # 1 "/usr/include/libio.h" 1 3 4
1769
+ # 32 "/usr/include/libio.h" 3 4
1770
+ # 1 "/usr/include/_G_config.h" 1 3 4
1771
+ # 14 "/usr/include/_G_config.h" 3 4
1772
+ # 1 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stddef.h" 1 3 4
1773
+ # 354 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stddef.h" 3 4
1774
+ typedef unsigned int wint_t;
1775
+ # 15 "/usr/include/_G_config.h" 2 3 4
1776
+ # 24 "/usr/include/_G_config.h" 3 4
1777
+ # 1 "/usr/include/wchar.h" 1 3 4
1778
+ # 48 "/usr/include/wchar.h" 3 4
1779
+ # 1 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stddef.h" 1 3 4
1780
+ # 49 "/usr/include/wchar.h" 2 3 4
1781
+
1782
+ # 1 "/usr/include/bits/wchar.h" 1 3 4
1783
+ # 51 "/usr/include/wchar.h" 2 3 4
1784
+ # 76 "/usr/include/wchar.h" 3 4
1785
+ typedef struct
1786
+ {
1787
+ int __count;
1788
+ union
1789
+ {
1790
+ wint_t __wch;
1791
+ char __wchb[4];
1792
+ } __value;
1793
+ } __mbstate_t;
1794
+ # 25 "/usr/include/_G_config.h" 2 3 4
1795
+
1796
+ typedef struct
1797
+ {
1798
+ __off_t __pos;
1799
+ __mbstate_t __state;
1800
+ } _G_fpos_t;
1801
+ typedef struct
1802
+ {
1803
+ __off64_t __pos;
1804
+ __mbstate_t __state;
1805
+ } _G_fpos64_t;
1806
+ # 44 "/usr/include/_G_config.h" 3 4
1807
+ # 1 "/usr/include/gconv.h" 1 3 4
1808
+ # 28 "/usr/include/gconv.h" 3 4
1809
+ # 1 "/usr/include/wchar.h" 1 3 4
1810
+ # 48 "/usr/include/wchar.h" 3 4
1811
+ # 1 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stddef.h" 1 3 4
1812
+ # 49 "/usr/include/wchar.h" 2 3 4
1813
+ # 29 "/usr/include/gconv.h" 2 3 4
1814
+
1815
+
1816
+ # 1 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stddef.h" 1 3 4
1817
+ # 32 "/usr/include/gconv.h" 2 3 4
1818
+
1819
+
1820
+
1821
+
1822
+
1823
+ enum
1824
+ {
1825
+ __GCONV_OK = 0,
1826
+ __GCONV_NOCONV,
1827
+ __GCONV_NODB,
1828
+ __GCONV_NOMEM,
1829
+
1830
+ __GCONV_EMPTY_INPUT,
1831
+ __GCONV_FULL_OUTPUT,
1832
+ __GCONV_ILLEGAL_INPUT,
1833
+ __GCONV_INCOMPLETE_INPUT,
1834
+
1835
+ __GCONV_ILLEGAL_DESCRIPTOR,
1836
+ __GCONV_INTERNAL_ERROR
1837
+ };
1838
+
1839
+
1840
+
1841
+ enum
1842
+ {
1843
+ __GCONV_IS_LAST = 0x0001,
1844
+ __GCONV_IGNORE_ERRORS = 0x0002
1845
+ };
1846
+
1847
+
1848
+
1849
+ struct __gconv_step;
1850
+ struct __gconv_step_data;
1851
+ struct __gconv_loaded_object;
1852
+ struct __gconv_trans_data;
1853
+
1854
+
1855
+
1856
+ typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *,
1857
+ unsigned char **, unsigned char *,
1858
+ unsigned char **, size_t *, int, int);
1859
+
1860
+
1861
+ typedef wint_t (*__gconv_btowc_fct) (struct __gconv_step *, unsigned char);
1862
+
1863
+
1864
+ typedef int (*__gconv_init_fct) (struct __gconv_step *);
1865
+ typedef void (*__gconv_end_fct) (struct __gconv_step *);
1866
+
1867
+
1868
+
1869
+ typedef int (*__gconv_trans_fct) (struct __gconv_step *,
1870
+ struct __gconv_step_data *, void *,
1871
+ unsigned char *,
1872
+ unsigned char **,
1873
+ unsigned char *, unsigned char **,
1874
+ size_t *);
1875
+
1876
+
1877
+ typedef int (*__gconv_trans_context_fct) (void *, unsigned char *,
1878
+ unsigned char *,
1879
+ unsigned char *, unsigned char *);
1880
+
1881
+
1882
+ typedef int (*__gconv_trans_query_fct) ( char *, char ***,
1883
+ size_t *);
1884
+
1885
+
1886
+ typedef int (*__gconv_trans_init_fct) (void **, const char *);
1887
+ typedef void (*__gconv_trans_end_fct) (void *);
1888
+
1889
+ struct __gconv_trans_data
1890
+ {
1891
+
1892
+ __gconv_trans_fct __trans_fct;
1893
+ __gconv_trans_context_fct __trans_context_fct;
1894
+ __gconv_trans_end_fct __trans_end_fct;
1895
+ void *__data;
1896
+ struct __gconv_trans_data *__next;
1897
+ };
1898
+
1899
+
1900
+
1901
+ struct __gconv_step
1902
+ {
1903
+ struct __gconv_loaded_object *__shlib_handle;
1904
+ char *__modname;
1905
+
1906
+ int __counter;
1907
+
1908
+ char *__from_name;
1909
+ char *__to_name;
1910
+
1911
+ __gconv_fct __fct;
1912
+ __gconv_btowc_fct __btowc_fct;
1913
+ __gconv_init_fct __init_fct;
1914
+ __gconv_end_fct __end_fct;
1915
+
1916
+
1917
+
1918
+ int __min_needed_from;
1919
+ int __max_needed_from;
1920
+ int __min_needed_to;
1921
+ int __max_needed_to;
1922
+
1923
+
1924
+ int __stateful;
1925
+
1926
+ void *__data;
1927
+ };
1928
+
1929
+
1930
+
1931
+ struct __gconv_step_data
1932
+ {
1933
+ unsigned char *__outbuf;
1934
+ unsigned char *__outbufend;
1935
+
1936
+
1937
+
1938
+ int __flags;
1939
+
1940
+
1941
+
1942
+ int __invocation_counter;
1943
+
1944
+
1945
+
1946
+ int __internal_use;
1947
+
1948
+ __mbstate_t *__statep;
1949
+ __mbstate_t __state;
1950
+
1951
+
1952
+
1953
+ struct __gconv_trans_data *__trans;
1954
+ };
1955
+
1956
+
1957
+
1958
+ typedef struct __gconv_info
1959
+ {
1960
+ size_t __nsteps;
1961
+ struct __gconv_step *__steps;
1962
+ struct __gconv_step_data __data [];
1963
+ } *__gconv_t;
1964
+ # 45 "/usr/include/_G_config.h" 2 3 4
1965
+ typedef union
1966
+ {
1967
+ struct __gconv_info __cd;
1968
+ struct
1969
+ {
1970
+ struct __gconv_info __cd;
1971
+ struct __gconv_step_data __data;
1972
+ } __combined;
1973
+ } _G_iconv_t;
1974
+
1975
+ typedef int _G_int16_t ;
1976
+ typedef int _G_int32_t ;
1977
+ typedef unsigned int _G_uint16_t ;
1978
+ typedef unsigned int _G_uint32_t ;
1979
+ # 33 "/usr/include/libio.h" 2 3 4
1980
+ # 53 "/usr/include/libio.h" 3 4
1981
+ # 1 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stdarg.h" 1 3 4
1982
+ # 43 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stdarg.h" 3 4
1983
+ typedef int __gnuc_va_list;
1984
+ # 54 "/usr/include/libio.h" 2 3 4
1985
+ # 166 "/usr/include/libio.h" 3 4
1986
+ struct _IO_jump_t; struct _IO_FILE;
1987
+ # 176 "/usr/include/libio.h" 3 4
1988
+ typedef void _IO_lock_t;
1989
+
1990
+
1991
+
1992
+
1993
+
1994
+ struct _IO_marker {
1995
+ struct _IO_marker *_next;
1996
+ struct _IO_FILE *_sbuf;
1997
+
1998
+
1999
+
2000
+ int _pos;
2001
+ # 199 "/usr/include/libio.h" 3 4
2002
+ };
2003
+
2004
+
2005
+ enum __codecvt_result
2006
+ {
2007
+ __codecvt_ok,
2008
+ __codecvt_partial,
2009
+ __codecvt_error,
2010
+ __codecvt_noconv
2011
+ };
2012
+ # 267 "/usr/include/libio.h" 3 4
2013
+ struct _IO_FILE {
2014
+ int _flags;
2015
+
2016
+
2017
+
2018
+
2019
+ char* _IO_read_ptr;
2020
+ char* _IO_read_end;
2021
+ char* _IO_read_base;
2022
+ char* _IO_write_base;
2023
+ char* _IO_write_ptr;
2024
+ char* _IO_write_end;
2025
+ char* _IO_buf_base;
2026
+ char* _IO_buf_end;
2027
+
2028
+ char *_IO_save_base;
2029
+ char *_IO_backup_base;
2030
+ char *_IO_save_end;
2031
+
2032
+ struct _IO_marker *_markers;
2033
+
2034
+ struct _IO_FILE *_chain;
2035
+
2036
+ int _fileno;
2037
+
2038
+
2039
+
2040
+ int _flags2;
2041
+
2042
+ __off_t _old_offset;
2043
+
2044
+
2045
+
2046
+ unsigned short _cur_column;
2047
+ signed char _vtable_offset;
2048
+ char _shortbuf[1];
2049
+
2050
+
2051
+
2052
+ _IO_lock_t *_lock;
2053
+ # 315 "/usr/include/libio.h" 3 4
2054
+ __off64_t _offset;
2055
+
2056
+
2057
+
2058
+
2059
+
2060
+ void *__pad1;
2061
+ void *__pad2;
2062
+
2063
+ int _mode;
2064
+
2065
+ char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];
2066
+
2067
+ };
2068
+
2069
+
2070
+ typedef struct _IO_FILE _IO_FILE;
2071
+
2072
+
2073
+ struct _IO_FILE_plus;
2074
+
2075
+ extern struct _IO_FILE_plus _IO_2_1_stdin_;
2076
+ extern struct _IO_FILE_plus _IO_2_1_stdout_;
2077
+ extern struct _IO_FILE_plus _IO_2_1_stderr_;
2078
+ # 354 "/usr/include/libio.h" 3 4
2079
+ typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
2080
+
2081
+
2082
+
2083
+
2084
+
2085
+
2086
+
2087
+ typedef __ssize_t __io_write_fn (void *__cookie, char *__buf,
2088
+ size_t __n);
2089
+
2090
+
2091
+
2092
+
2093
+
2094
+
2095
+
2096
+ typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
2097
+
2098
+
2099
+ typedef int __io_close_fn (void *__cookie);
2100
+ # 406 "/usr/include/libio.h" 3 4
2101
+ extern int __underflow (_IO_FILE *);
2102
+ extern int __uflow (_IO_FILE *);
2103
+ extern int __overflow (_IO_FILE *, int);
2104
+ extern wint_t __wunderflow (_IO_FILE *);
2105
+ extern wint_t __wuflow (_IO_FILE *);
2106
+ extern wint_t __woverflow (_IO_FILE *, wint_t);
2107
+ # 444 "/usr/include/libio.h" 3 4
2108
+ extern int _IO_getc (_IO_FILE *__fp);
2109
+ extern int _IO_putc (int __c, _IO_FILE *__fp);
2110
+ extern int _IO_feof (_IO_FILE *__fp);
2111
+ extern int _IO_ferror (_IO_FILE *__fp);
2112
+
2113
+ extern int _IO_peekc_locked (_IO_FILE *__fp);
2114
+
2115
+
2116
+
2117
+
2118
+
2119
+ extern void _IO_flockfile (_IO_FILE *);
2120
+ extern void _IO_funlockfile (_IO_FILE *);
2121
+ extern int _IO_ftrylockfile (_IO_FILE *);
2122
+ # 474 "/usr/include/libio.h" 3 4
2123
+ extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
2124
+ __gnuc_va_list, int *__restrict);
2125
+ extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
2126
+ __gnuc_va_list);
2127
+ extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
2128
+ extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);
2129
+
2130
+ extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
2131
+ extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);
2132
+
2133
+ extern void _IO_free_backup_area (_IO_FILE *);
2134
+ # 73 "/usr/include/stdio.h" 2 3 4
2135
+ # 86 "/usr/include/stdio.h" 3 4
2136
+
2137
+
2138
+ typedef _G_fpos_t fpos_t;
2139
+
2140
+
2141
+
2142
+
2143
+ # 138 "/usr/include/stdio.h" 3 4
2144
+ # 1 "/usr/include/bits/stdio_lim.h" 1 3 4
2145
+ # 139 "/usr/include/stdio.h" 2 3 4
2146
+
2147
+
2148
+
2149
+ extern struct _IO_FILE *stdin;
2150
+ extern struct _IO_FILE *stdout;
2151
+ extern struct _IO_FILE *stderr;
2152
+
2153
+
2154
+
2155
+
2156
+
2157
+
2158
+
2159
+
2160
+
2161
+ extern int remove ( char *__filename);
2162
+
2163
+ extern int rename ( char *__old, char *__new);
2164
+
2165
+
2166
+
2167
+
2168
+
2169
+
2170
+
2171
+
2172
+
2173
+ extern FILE *tmpfile (void);
2174
+ # 180 "/usr/include/stdio.h" 3 4
2175
+ extern char *tmpnam (char *__s);
2176
+
2177
+
2178
+
2179
+
2180
+
2181
+ extern char *tmpnam_r (char *__s);
2182
+ # 198 "/usr/include/stdio.h" 3 4
2183
+ extern char *tempnam ( char *__dir, char *__pfx)
2184
+ ;
2185
+
2186
+
2187
+
2188
+
2189
+
2190
+
2191
+
2192
+
2193
+ extern int fclose (FILE *__stream);
2194
+
2195
+
2196
+
2197
+
2198
+ extern int fflush (FILE *__stream);
2199
+
2200
+ # 223 "/usr/include/stdio.h" 3 4
2201
+ extern int fflush_unlocked (FILE *__stream);
2202
+ # 237 "/usr/include/stdio.h" 3 4
2203
+
2204
+
2205
+
2206
+
2207
+
2208
+
2209
+ extern FILE *fopen ( char *__restrict __filename,
2210
+ char *__restrict __modes);
2211
+
2212
+
2213
+
2214
+
2215
+ extern FILE *freopen ( char *__restrict __filename,
2216
+ char *__restrict __modes,
2217
+ FILE *__restrict __stream);
2218
+ # 264 "/usr/include/stdio.h" 3 4
2219
+
2220
+ # 275 "/usr/include/stdio.h" 3 4
2221
+ extern FILE *fdopen (int __fd, char *__modes);
2222
+ # 296 "/usr/include/stdio.h" 3 4
2223
+
2224
+
2225
+
2226
+ extern void setbuf (FILE *__restrict __stream, char *__restrict __buf);
2227
+
2228
+
2229
+
2230
+ extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
2231
+ int __modes, size_t __n);
2232
+
2233
+
2234
+
2235
+
2236
+
2237
+ extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
2238
+ size_t __size);
2239
+
2240
+
2241
+ extern void setlinebuf (FILE *__stream);
2242
+
2243
+
2244
+
2245
+
2246
+
2247
+
2248
+
2249
+
2250
+ extern int fprintf (FILE *__restrict __stream,
2251
+ char *__restrict __format, ...);
2252
+
2253
+
2254
+
2255
+
2256
+ extern int printf ( char *__restrict __format, ...);
2257
+
2258
+ extern int sprintf (char *__restrict __s,
2259
+ char *__restrict __format, ...);
2260
+
2261
+
2262
+
2263
+
2264
+
2265
+ extern int vfprintf (FILE *__restrict __s, char *__restrict __format,
2266
+ __gnuc_va_list __arg);
2267
+
2268
+
2269
+
2270
+
2271
+ extern int vprintf ( char *__restrict __format, __gnuc_va_list __arg);
2272
+
2273
+ extern int vsprintf (char *__restrict __s, char *__restrict __format,
2274
+ __gnuc_va_list __arg);
2275
+
2276
+
2277
+
2278
+
2279
+
2280
+ extern int snprintf (char *__restrict __s, size_t __maxlen,
2281
+ char *__restrict __format, ...)
2282
+ ;
2283
+
2284
+ extern int vsnprintf (char *__restrict __s, size_t __maxlen,
2285
+ char *__restrict __format, __gnuc_va_list __arg)
2286
+ ;
2287
+
2288
+ # 390 "/usr/include/stdio.h" 3 4
2289
+
2290
+
2291
+
2292
+
2293
+
2294
+ extern int fscanf (FILE *__restrict __stream,
2295
+ char *__restrict __format, ...);
2296
+
2297
+
2298
+
2299
+
2300
+ extern int scanf ( char *__restrict __format, ...);
2301
+
2302
+ extern int sscanf ( char *__restrict __s,
2303
+ char *__restrict __format, ...);
2304
+
2305
+ # 432 "/usr/include/stdio.h" 3 4
2306
+
2307
+
2308
+
2309
+
2310
+
2311
+ extern int fgetc (FILE *__stream);
2312
+ extern int getc (FILE *__stream);
2313
+
2314
+
2315
+
2316
+
2317
+
2318
+ extern int getchar (void);
2319
+
2320
+ # 456 "/usr/include/stdio.h" 3 4
2321
+ extern int getc_unlocked (FILE *__stream);
2322
+ extern int getchar_unlocked (void);
2323
+ # 467 "/usr/include/stdio.h" 3 4
2324
+ extern int fgetc_unlocked (FILE *__stream);
2325
+
2326
+
2327
+
2328
+
2329
+
2330
+
2331
+
2332
+
2333
+
2334
+
2335
+
2336
+ extern int fputc (int __c, FILE *__stream);
2337
+ extern int putc (int __c, FILE *__stream);
2338
+
2339
+
2340
+
2341
+
2342
+
2343
+ extern int putchar (int __c);
2344
+
2345
+ # 500 "/usr/include/stdio.h" 3 4
2346
+ extern int fputc_unlocked (int __c, FILE *__stream);
2347
+
2348
+
2349
+
2350
+
2351
+
2352
+
2353
+
2354
+ extern int putc_unlocked (int __c, FILE *__stream);
2355
+ extern int putchar_unlocked (int __c);
2356
+
2357
+
2358
+
2359
+
2360
+
2361
+
2362
+ extern int getw (FILE *__stream);
2363
+
2364
+
2365
+ extern int putw (int __w, FILE *__stream);
2366
+
2367
+
2368
+
2369
+
2370
+
2371
+
2372
+
2373
+
2374
+ extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream);
2375
+
2376
+
2377
+
2378
+
2379
+
2380
+
2381
+ extern char *gets (char *__s);
2382
+
2383
+ # 580 "/usr/include/stdio.h" 3 4
2384
+
2385
+
2386
+
2387
+
2388
+
2389
+ extern int fputs ( char *__restrict __s, FILE *__restrict __stream);
2390
+
2391
+
2392
+
2393
+
2394
+
2395
+ extern int puts ( char *__s);
2396
+
2397
+
2398
+
2399
+
2400
+
2401
+
2402
+ extern int ungetc (int __c, FILE *__stream);
2403
+
2404
+
2405
+
2406
+
2407
+
2408
+
2409
+ extern size_t fread (void *__restrict __ptr, size_t __size,
2410
+ size_t __n, FILE *__restrict __stream);
2411
+
2412
+
2413
+
2414
+
2415
+ extern size_t fwrite ( void *__restrict __ptr, size_t __size,
2416
+ size_t __n, FILE *__restrict __s);
2417
+
2418
+ # 633 "/usr/include/stdio.h" 3 4
2419
+ extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
2420
+ size_t __n, FILE *__restrict __stream);
2421
+ extern size_t fwrite_unlocked ( void *__restrict __ptr, size_t __size,
2422
+ size_t __n, FILE *__restrict __stream);
2423
+
2424
+
2425
+
2426
+
2427
+
2428
+
2429
+
2430
+
2431
+ extern int fseek (FILE *__stream, long int __off, int __whence);
2432
+
2433
+
2434
+
2435
+
2436
+ extern long int ftell (FILE *__stream);
2437
+
2438
+
2439
+
2440
+
2441
+ extern void rewind (FILE *__stream);
2442
+
2443
+ # 688 "/usr/include/stdio.h" 3 4
2444
+
2445
+
2446
+
2447
+
2448
+
2449
+
2450
+ extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
2451
+
2452
+
2453
+
2454
+
2455
+ extern int fsetpos (FILE *__stream, fpos_t *__pos);
2456
+ # 711 "/usr/include/stdio.h" 3 4
2457
+
2458
+ # 720 "/usr/include/stdio.h" 3 4
2459
+
2460
+
2461
+ extern void clearerr (FILE *__stream);
2462
+
2463
+ extern int feof (FILE *__stream);
2464
+
2465
+ extern int ferror (FILE *__stream);
2466
+
2467
+
2468
+
2469
+
2470
+ extern void clearerr_unlocked (FILE *__stream);
2471
+ extern int feof_unlocked (FILE *__stream);
2472
+ extern int ferror_unlocked (FILE *__stream);
2473
+
2474
+
2475
+
2476
+
2477
+
2478
+
2479
+
2480
+
2481
+ extern void perror ( char *__s);
2482
+
2483
+
2484
+
2485
+
2486
+
2487
+
2488
+ # 1 "/usr/include/bits/sys_errlist.h" 1 3 4
2489
+ # 27 "/usr/include/bits/sys_errlist.h" 3 4
2490
+ extern int sys_nerr;
2491
+ extern char * sys_errlist[];
2492
+ # 750 "/usr/include/stdio.h" 2 3 4
2493
+
2494
+
2495
+
2496
+
2497
+ extern int fileno (FILE *__stream);
2498
+
2499
+
2500
+
2501
+
2502
+ extern int fileno_unlocked (FILE *__stream);
2503
+ # 769 "/usr/include/stdio.h" 3 4
2504
+ extern FILE *popen ( char *__command, char *__modes);
2505
+
2506
+
2507
+
2508
+
2509
+
2510
+ extern int pclose (FILE *__stream);
2511
+
2512
+
2513
+
2514
+
2515
+
2516
+ extern char *ctermid (char *__s);
2517
+ # 809 "/usr/include/stdio.h" 3 4
2518
+ extern void flockfile (FILE *__stream);
2519
+
2520
+
2521
+
2522
+ extern int ftrylockfile (FILE *__stream);
2523
+
2524
+
2525
+ extern void funlockfile (FILE *__stream);
2526
+ # 836 "/usr/include/stdio.h" 3 4
2527
+
2528
+ # 109 "/usr/include/curses.h" 2 3 4
2529
+ # 1 "/usr/include/ncurses/unctrl.h" 1 3 4
2530
+ # 54 "/usr/include/ncurses/unctrl.h" 3 4
2531
+ # 1 "/usr/include/ncurses/curses.h" 1 3 4
2532
+ # 55 "/usr/include/ncurses/unctrl.h" 2 3 4
2533
+
2534
+
2535
+ char * unctrl (chtype);
2536
+ # 110 "/usr/include/curses.h" 2 3 4
2537
+ # 1 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stdarg.h" 1 3 4
2538
+ # 105 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stdarg.h" 3 4
2539
+ typedef __gnuc_va_list va_list;
2540
+ # 111 "/usr/include/curses.h" 2 3 4
2541
+ # 133 "/usr/include/curses.h" 3 4
2542
+ typedef unsigned char NCURSES_BOOL;
2543
+ # 143 "/usr/include/curses.h" 3 4
2544
+ # 1 "/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stdbool.h" 1 3 4
2545
+ # 144 "/usr/include/curses.h" 2 3 4
2546
+ # 181 "/usr/include/curses.h" 3 4
2547
+ extern int COLORS;
2548
+ extern int COLOR_PAIRS;
2549
+ # 199 "/usr/include/curses.h" 3 4
2550
+ extern chtype acs_map[];
2551
+ # 289 "/usr/include/curses.h" 3 4
2552
+ typedef struct screen SCREEN;
2553
+ typedef struct _win_st WINDOW;
2554
+
2555
+ typedef chtype attr_t;
2556
+ # 325 "/usr/include/curses.h" 3 4
2557
+ struct ldat;
2558
+
2559
+ struct _win_st
2560
+ {
2561
+ short _cury, _curx;
2562
+
2563
+
2564
+ short _maxy, _maxx;
2565
+ short _begy, _begx;
2566
+
2567
+ short _flags;
2568
+
2569
+
2570
+ attr_t _attrs;
2571
+ chtype _bkgd;
2572
+
2573
+
2574
+ _Bool _notimeout;
2575
+ _Bool _clear;
2576
+ _Bool _leaveok;
2577
+ _Bool _scroll;
2578
+ _Bool _idlok;
2579
+ _Bool _idcok;
2580
+ _Bool _immed;
2581
+ _Bool _sync;
2582
+ _Bool _use_keypad;
2583
+ int _delay;
2584
+
2585
+ struct ldat *_line;
2586
+
2587
+
2588
+ short _regtop;
2589
+ short _regbottom;
2590
+
2591
+
2592
+ int _parx;
2593
+ int _pary;
2594
+ WINDOW *_parent;
2595
+
2596
+
2597
+ struct pdat
2598
+ {
2599
+ short _pad_y, _pad_x;
2600
+ short _pad_top, _pad_left;
2601
+ short _pad_bottom, _pad_right;
2602
+ } _pad;
2603
+
2604
+ short _yoffset;
2605
+
2606
+
2607
+
2608
+
2609
+ };
2610
+
2611
+ extern WINDOW * stdscr;
2612
+ extern WINDOW * curscr;
2613
+ extern WINDOW * newscr;
2614
+
2615
+ extern int LINES;
2616
+ extern int COLS;
2617
+ extern int TABSIZE;
2618
+
2619
+
2620
+
2621
+
2622
+ extern int ESCDELAY;
2623
+
2624
+ extern char ttytype[];
2625
+
2626
+
2627
+
2628
+
2629
+
2630
+ extern _Bool is_term_resized (int, int);
2631
+ extern char * keybound (int, int);
2632
+ extern const char * curses_version (void);
2633
+ extern int assume_default_colors (int, int);
2634
+ extern int define_key (const char *, int);
2635
+ extern int key_defined (const char *);
2636
+ extern int keyok (int, _Bool);
2637
+ extern int resize_term (int, int);
2638
+ extern int resizeterm (int, int);
2639
+ extern int use_default_colors (void);
2640
+ extern int use_extended_names (_Bool);
2641
+ extern int wresize (WINDOW *, int, int);
2642
+ # 508 "/usr/include/curses.h" 3 4
2643
+ extern int addch (const chtype);
2644
+ extern int addchnstr (const chtype *, int);
2645
+ extern int addchstr (const chtype *);
2646
+ extern int addnstr (const char *, int);
2647
+ extern int addstr (const char *);
2648
+ extern int attroff (attr_t);
2649
+ extern int attron (attr_t);
2650
+ extern int attrset (attr_t);
2651
+ extern int attr_get (attr_t *, short *, void *);
2652
+ extern int attr_off (attr_t, void *);
2653
+ extern int attr_on (attr_t, void *);
2654
+ extern int attr_set (attr_t, short, void *);
2655
+ extern int baudrate (void);
2656
+ extern int beep (void);
2657
+ extern int bkgd (chtype);
2658
+ extern void bkgdset (chtype);
2659
+ extern int border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);
2660
+ extern int box (WINDOW *, chtype, chtype);
2661
+ extern _Bool can_change_color (void);
2662
+ extern int cbreak (void);
2663
+ extern int chgat (int, attr_t, short, const void *);
2664
+ extern int clear (void);
2665
+ extern int clearok (WINDOW *,_Bool);
2666
+ extern int clrtobot (void);
2667
+ extern int clrtoeol (void);
2668
+ extern int color_content (short,short*,short*,short*);
2669
+ extern int color_set (short,void*);
2670
+ extern int COLOR_PAIR (int);
2671
+ extern int copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int);
2672
+ extern int curs_set (int);
2673
+ extern int def_prog_mode (void);
2674
+ extern int def_shell_mode (void);
2675
+ extern int delay_output (int);
2676
+ extern int delch (void);
2677
+ extern void delscreen (SCREEN *);
2678
+ extern int delwin (WINDOW *);
2679
+ extern int deleteln (void);
2680
+ extern WINDOW * derwin (WINDOW *,int,int,int,int);
2681
+ extern int doupdate (void);
2682
+ extern WINDOW * dupwin (WINDOW *);
2683
+ extern int echo (void);
2684
+ extern int echochar (const chtype);
2685
+ extern int erase (void);
2686
+ extern int endwin (void);
2687
+ extern char erasechar (void);
2688
+ extern void filter (void);
2689
+ extern int flash (void);
2690
+ extern int flushinp (void);
2691
+ extern chtype getbkgd (WINDOW *);
2692
+ extern int getch (void);
2693
+ extern int getnstr (char *, int);
2694
+ extern int getstr (char *);
2695
+ extern WINDOW * getwin (FILE *);
2696
+ extern int halfdelay (int);
2697
+ extern _Bool has_colors (void);
2698
+ extern _Bool has_ic (void);
2699
+ extern _Bool has_il (void);
2700
+ extern int hline (chtype, int);
2701
+ extern void idcok (WINDOW *, _Bool);
2702
+ extern int idlok (WINDOW *, _Bool);
2703
+ extern void immedok (WINDOW *, _Bool);
2704
+ extern chtype inch (void);
2705
+ extern int inchnstr (chtype *, int);
2706
+ extern int inchstr (chtype *);
2707
+ extern WINDOW * initscr (void);
2708
+ extern int init_color (short,short,short,short);
2709
+ extern int init_pair (short,short,short);
2710
+ extern int innstr (char *, int);
2711
+ extern int insch (chtype);
2712
+ extern int insdelln (int);
2713
+ extern int insertln (void);
2714
+ extern int insnstr (const char *, int);
2715
+ extern int insstr (const char *);
2716
+ extern int instr (char *);
2717
+ extern int intrflush (WINDOW *,_Bool);
2718
+ extern _Bool isendwin (void);
2719
+ extern _Bool is_linetouched (WINDOW *,int);
2720
+ extern _Bool is_wintouched (WINDOW *);
2721
+ extern char * keyname (int);
2722
+ extern int keypad (WINDOW *,_Bool);
2723
+ extern char killchar (void);
2724
+ extern int leaveok (WINDOW *,_Bool);
2725
+ extern char * longname (void);
2726
+ extern int meta (WINDOW *,_Bool);
2727
+ extern int move (int, int);
2728
+ extern int mvaddch (int, int, const chtype);
2729
+ extern int mvaddchnstr (int, int, const chtype *, int);
2730
+ extern int mvaddchstr (int, int, const chtype *);
2731
+ extern int mvaddnstr (int, int, const char *, int);
2732
+ extern int mvaddstr (int, int, const char *);
2733
+ extern int mvchgat (int, int, int, attr_t, short, const void *);
2734
+ extern int mvcur (int,int,int,int);
2735
+ extern int mvdelch (int, int);
2736
+ extern int mvderwin (WINDOW *, int, int);
2737
+ extern int mvgetch (int, int);
2738
+ extern int mvgetnstr (int, int, char *, int);
2739
+ extern int mvgetstr (int, int, char *);
2740
+ extern int mvhline (int, int, chtype, int);
2741
+ extern chtype mvinch (int, int);
2742
+ extern int mvinchnstr (int, int, chtype *, int);
2743
+ extern int mvinchstr (int, int, chtype *);
2744
+ extern int mvinnstr (int, int, char *, int);
2745
+ extern int mvinsch (int, int, chtype);
2746
+ extern int mvinsnstr (int, int, const char *, int);
2747
+ extern int mvinsstr (int, int, const char *);
2748
+ extern int mvinstr (int, int, char *);
2749
+ extern int mvprintw (int,int, const char *,...)
2750
+ ;
2751
+ extern int mvscanw (int,int, char *,...)
2752
+ ;
2753
+ extern int mvvline (int, int, chtype, int);
2754
+ extern int mvwaddch (WINDOW *, int, int, const chtype);
2755
+ extern int mvwaddchnstr (WINDOW *, int, int, const chtype *, int);
2756
+ extern int mvwaddchstr (WINDOW *, int, int, const chtype *);
2757
+ extern int mvwaddnstr (WINDOW *, int, int, const char *, int);
2758
+ extern int mvwaddstr (WINDOW *, int, int, const char *);
2759
+ extern int mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);
2760
+ extern int mvwdelch (WINDOW *, int, int);
2761
+ extern int mvwgetch (WINDOW *, int, int);
2762
+ extern int mvwgetnstr (WINDOW *, int, int, char *, int);
2763
+ extern int mvwgetstr (WINDOW *, int, int, char *);
2764
+ extern int mvwhline (WINDOW *, int, int, chtype, int);
2765
+ extern int mvwin (WINDOW *,int,int);
2766
+ extern chtype mvwinch (WINDOW *, int, int);
2767
+ extern int mvwinchnstr (WINDOW *, int, int, chtype *, int);
2768
+ extern int mvwinchstr (WINDOW *, int, int, chtype *);
2769
+ extern int mvwinnstr (WINDOW *, int, int, char *, int);
2770
+ extern int mvwinsch (WINDOW *, int, int, chtype);
2771
+ extern int mvwinsnstr (WINDOW *, int, int, const char *, int);
2772
+ extern int mvwinsstr (WINDOW *, int, int, const char *);
2773
+ extern int mvwinstr (WINDOW *, int, int, char *);
2774
+ extern int mvwprintw (WINDOW*,int,int, const char *,...)
2775
+ ;
2776
+ extern int mvwscanw (WINDOW *,int,int, char *,...)
2777
+ ;
2778
+ extern int mvwvline (WINDOW *,int, int, chtype, int);
2779
+ extern int napms (int);
2780
+ extern WINDOW * newpad (int,int);
2781
+ extern SCREEN * newterm ( char *,FILE *,FILE *);
2782
+ extern WINDOW * newwin (int,int,int,int);
2783
+ extern int nl (void);
2784
+ extern int nocbreak (void);
2785
+ extern int nodelay (WINDOW *,_Bool);
2786
+ extern int noecho (void);
2787
+ extern int nonl (void);
2788
+ extern void noqiflush (void);
2789
+ extern int noraw (void);
2790
+ extern int notimeout (WINDOW *,_Bool);
2791
+ extern int overlay (const WINDOW*,WINDOW *);
2792
+ extern int overwrite (const WINDOW*,WINDOW *);
2793
+ extern int pair_content (short,short*,short*);
2794
+ extern int PAIR_NUMBER (int);
2795
+ extern int pechochar (WINDOW *, const chtype);
2796
+ extern int pnoutrefresh (WINDOW*,int,int,int,int,int,int);
2797
+ extern int prefresh (WINDOW *,int,int,int,int,int,int);
2798
+ extern int printw (const char *,...)
2799
+ ;
2800
+ extern int putp (const char *);
2801
+ extern int putwin (WINDOW *, FILE *);
2802
+ extern void qiflush (void);
2803
+ extern int raw (void);
2804
+ extern int redrawwin (WINDOW *);
2805
+ extern int refresh (void);
2806
+ extern int resetty (void);
2807
+ extern int reset_prog_mode (void);
2808
+ extern int reset_shell_mode (void);
2809
+ extern int ripoffline (int, int (*)(WINDOW *, int));
2810
+ extern int savetty (void);
2811
+ extern int scanw ( char *,...)
2812
+ ;
2813
+ extern int scr_dump (const char *);
2814
+ extern int scr_init (const char *);
2815
+ extern int scrl (int);
2816
+ extern int scroll (WINDOW *);
2817
+ extern int scrollok (WINDOW *,_Bool);
2818
+ extern int scr_restore (const char *);
2819
+ extern int scr_set (const char *);
2820
+ extern int setscrreg (int,int);
2821
+ extern SCREEN * set_term (SCREEN *);
2822
+ extern int slk_attroff (const chtype);
2823
+ extern int slk_attr_off (const attr_t, void *);
2824
+ extern int slk_attron (const chtype);
2825
+ extern int slk_attr_on (attr_t,void*);
2826
+ extern int slk_attrset (const chtype);
2827
+ extern attr_t slk_attr (void);
2828
+ extern int slk_attr_set (const attr_t,short,void*);
2829
+ extern int slk_clear (void);
2830
+ extern int slk_color (short);
2831
+ extern int slk_init (int);
2832
+ extern char * slk_label (int);
2833
+ extern int slk_noutrefresh (void);
2834
+ extern int slk_refresh (void);
2835
+ extern int slk_restore (void);
2836
+ extern int slk_set (int,const char *,int);
2837
+ extern int slk_touch (void);
2838
+ extern int standout (void);
2839
+ extern int standend (void);
2840
+ extern int start_color (void);
2841
+ extern WINDOW * subpad (WINDOW *, int, int, int, int);
2842
+ extern WINDOW * subwin (WINDOW *,int,int,int,int);
2843
+ extern int syncok (WINDOW *, _Bool);
2844
+ extern chtype termattrs (void);
2845
+ extern char * termname (void);
2846
+ extern int tigetflag ( char *);
2847
+ extern int tigetnum ( char *);
2848
+ extern char * tigetstr ( char *);
2849
+ extern void timeout (int);
2850
+ extern int touchline (WINDOW *, int, int);
2851
+ extern int touchwin (WINDOW *);
2852
+ extern char * tparm ( char *, ...);
2853
+ extern int typeahead (int);
2854
+ extern int ungetch (int);
2855
+ extern int untouchwin (WINDOW *);
2856
+ extern void use_env (_Bool);
2857
+ extern int vidattr (chtype);
2858
+ extern int vidputs (chtype, int (*)(int));
2859
+ extern int vline (chtype, int);
2860
+ extern int vwprintw (WINDOW *, const char *,va_list);
2861
+ extern int vw_printw (WINDOW *, const char *,va_list);
2862
+ extern int vwscanw (WINDOW *, char *,va_list);
2863
+ extern int vw_scanw (WINDOW *, char *,va_list);
2864
+ extern int waddch (WINDOW *, const chtype);
2865
+ extern int waddchnstr (WINDOW *,const chtype *,int);
2866
+ extern int waddchstr (WINDOW *,const chtype *);
2867
+ extern int waddnstr (WINDOW *,const char *,int);
2868
+ extern int waddstr (WINDOW *,const char *);
2869
+ extern int wattron (WINDOW *, int);
2870
+ extern int wattroff (WINDOW *, int);
2871
+ extern int wattrset (WINDOW *, int);
2872
+ extern int wattr_get (WINDOW *, attr_t *, short *, void *);
2873
+ extern int wattr_on (WINDOW *, attr_t, void *);
2874
+ extern int wattr_off (WINDOW *, attr_t, void *);
2875
+ extern int wattr_set (WINDOW *, attr_t, short, void *);
2876
+ extern int wbkgd (WINDOW *, chtype);
2877
+ extern void wbkgdset (WINDOW *,chtype);
2878
+ extern int wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);
2879
+ extern int wchgat (WINDOW *, int, attr_t, short, const void *);
2880
+ extern int wclear (WINDOW *);
2881
+ extern int wclrtobot (WINDOW *);
2882
+ extern int wclrtoeol (WINDOW *);
2883
+ extern int wcolor_set (WINDOW*,short,void*);
2884
+ extern void wcursyncup (WINDOW *);
2885
+ extern int wdelch (WINDOW *);
2886
+ extern int wdeleteln (WINDOW *);
2887
+ extern int wechochar (WINDOW *, const chtype);
2888
+ extern int werase (WINDOW *);
2889
+ extern int wgetch (WINDOW *);
2890
+ extern int wgetnstr (WINDOW *,char *,int);
2891
+ extern int wgetstr (WINDOW *, char *);
2892
+ extern int whline (WINDOW *, chtype, int);
2893
+ extern chtype winch (WINDOW *);
2894
+ extern int winchnstr (WINDOW *, chtype *, int);
2895
+ extern int winchstr (WINDOW *, chtype *);
2896
+ extern int winnstr (WINDOW *, char *, int);
2897
+ extern int winsch (WINDOW *, chtype);
2898
+ extern int winsdelln (WINDOW *,int);
2899
+ extern int winsertln (WINDOW *);
2900
+ extern int winsnstr (WINDOW *, const char *,int);
2901
+ extern int winsstr (WINDOW *, const char *);
2902
+ extern int winstr (WINDOW *, char *);
2903
+ extern int wmove (WINDOW *,int,int);
2904
+ extern int wnoutrefresh (WINDOW *);
2905
+ extern int wprintw (WINDOW *, const char *,...)
2906
+ ;
2907
+ extern int wredrawln (WINDOW *,int,int);
2908
+ extern int wrefresh (WINDOW *);
2909
+ extern int wscanw (WINDOW *, char *,...)
2910
+ ;
2911
+ extern int wscrl (WINDOW *,int);
2912
+ extern int wsetscrreg (WINDOW *,int,int);
2913
+ extern int wstandout (WINDOW *);
2914
+ extern int wstandend (WINDOW *);
2915
+ extern void wsyncdown (WINDOW *);
2916
+ extern void wsyncup (WINDOW *);
2917
+ extern void wtimeout (WINDOW *,int);
2918
+ extern int wtouchln (WINDOW *,int,int,int);
2919
+ extern int wvline (WINDOW *,chtype,int);
2920
+ # 1166 "/usr/include/curses.h" 3 4
2921
+ typedef unsigned long mmask_t;
2922
+
2923
+ typedef struct
2924
+ {
2925
+ short id;
2926
+ int x, y, z;
2927
+ mmask_t bstate;
2928
+ }
2929
+ MEVENT;
2930
+
2931
+ extern int getmouse (MEVENT *);
2932
+ extern int ungetmouse (MEVENT *);
2933
+ extern mmask_t mousemask (mmask_t, mmask_t *);
2934
+ extern _Bool wenclose (const WINDOW *, int, int);
2935
+ extern int mouseinterval (int);
2936
+ extern _Bool wmouse_trafo (const WINDOW* win,int* y, int* x, _Bool to_screen);
2937
+ extern _Bool mouse_trafo (int*, int*, _Bool);
2938
+
2939
+
2940
+
2941
+
2942
+
2943
+ extern int mcprint (char *, int);
2944
+ extern int has_key (int);
2945
+
2946
+
2947
+
2948
+ extern void _tracef (const char *, ...) ;
2949
+ extern void _tracedump (const char *, WINDOW *);
2950
+ extern char * _traceattr (attr_t);
2951
+ extern char * _traceattr2 (int, chtype);
2952
+ extern char * _nc_tracebits (void);
2953
+ extern char * _tracechar (int);
2954
+ extern char * _tracechtype (chtype);
2955
+ extern char * _tracechtype2 (int, chtype);
2956
+ # 1210 "/usr/include/curses.h" 3 4
2957
+ extern char * _tracemouse (const MEVENT *);
2958
+ extern void trace (const unsigned int);
2959
+ # 136 "./test.priv.h" 2
2960
+ # 1 "/usr/include/term.h" 1 3 4
2961
+ # 82 "/usr/include/term.h" 3 4
2962
+ # 1 "/usr/include/termios.h" 1 3 4
2963
+ # 36 "/usr/include/termios.h" 3 4
2964
+
2965
+
2966
+
2967
+
2968
+ # 1 "/usr/include/bits/termios.h" 1 3 4
2969
+ # 25 "/usr/include/bits/termios.h" 3 4
2970
+ typedef unsigned char cc_t;
2971
+ typedef unsigned int speed_t;
2972
+ typedef unsigned int tcflag_t;
2973
+
2974
+
2975
+ struct termios
2976
+ {
2977
+ tcflag_t c_iflag;
2978
+ tcflag_t c_oflag;
2979
+ tcflag_t c_cflag;
2980
+ tcflag_t c_lflag;
2981
+ cc_t c_line;
2982
+ cc_t c_cc[32];
2983
+ speed_t c_ispeed;
2984
+ speed_t c_ospeed;
2985
+
2986
+
2987
+ };
2988
+ # 41 "/usr/include/termios.h" 2 3 4
2989
+ # 49 "/usr/include/termios.h" 3 4
2990
+ extern speed_t cfgetospeed ( struct termios *__termios_p);
2991
+
2992
+
2993
+ extern speed_t cfgetispeed ( struct termios *__termios_p);
2994
+
2995
+
2996
+ extern int cfsetospeed (struct termios *__termios_p, speed_t __speed);
2997
+
2998
+
2999
+ extern int cfsetispeed (struct termios *__termios_p, speed_t __speed);
3000
+
3001
+
3002
+
3003
+ extern int cfsetspeed (struct termios *__termios_p, speed_t __speed);
3004
+
3005
+
3006
+
3007
+
3008
+ extern int tcgetattr (int __fd, struct termios *__termios_p);
3009
+
3010
+
3011
+
3012
+ extern int tcsetattr (int __fd, int __optional_actions,
3013
+ struct termios *__termios_p);
3014
+
3015
+
3016
+
3017
+
3018
+ extern void cfmakeraw (struct termios *__termios_p);
3019
+
3020
+
3021
+
3022
+ extern int tcsendbreak (int __fd, int __duration);
3023
+
3024
+
3025
+
3026
+
3027
+
3028
+ extern int tcdrain (int __fd);
3029
+
3030
+
3031
+
3032
+ extern int tcflush (int __fd, int __queue_selector);
3033
+
3034
+
3035
+
3036
+ extern int tcflow (int __fd, int __action);
3037
+ # 105 "/usr/include/termios.h" 3 4
3038
+ # 1 "/usr/include/sys/ttydefaults.h" 1 3 4
3039
+ # 106 "/usr/include/termios.h" 2 3 4
3040
+
3041
+
3042
+
3043
+ # 83 "/usr/include/term.h" 2 3 4
3044
+ # 674 "/usr/include/term.h" 3 4
3045
+ typedef struct termtype {
3046
+ char *term_names;
3047
+ char *str_table;
3048
+ char *Booleans;
3049
+ short *Numbers;
3050
+ char **Strings;
3051
+
3052
+
3053
+ char *ext_str_table;
3054
+ char **ext_Names;
3055
+
3056
+ unsigned short num_Booleans;
3057
+ unsigned short num_Numbers;
3058
+ unsigned short num_Strings;
3059
+
3060
+ unsigned short ext_Booleans;
3061
+ unsigned short ext_Numbers;
3062
+ unsigned short ext_Strings;
3063
+
3064
+
3065
+ } TERMTYPE;
3066
+
3067
+ typedef struct term {
3068
+ TERMTYPE type;
3069
+ short Filedes;
3070
+ struct termios Ottyb,
3071
+ Nttyb;
3072
+ int _baudrate;
3073
+ char * _termname;
3074
+ } TERMINAL;
3075
+
3076
+ extern TERMINAL * cur_term;
3077
+ # 730 "/usr/include/term.h" 3 4
3078
+ extern char * const boolnames[];
3079
+ extern char * const boolcodes[];
3080
+ extern char * const boolfnames[];
3081
+ extern char * const numnames[];
3082
+ extern char * const numcodes[];
3083
+ extern char * const numfnames[];
3084
+ extern char * const strnames[];
3085
+ extern char * const strcodes[];
3086
+ extern char * const strfnames[];
3087
+
3088
+
3089
+
3090
+
3091
+ extern int _nc_set_tty_mode (struct termios *buf);
3092
+ extern int _nc_get_tty_mode (struct termios *buf);
3093
+ extern int _nc_read_entry (const char * const, char * const, TERMTYPE *const);
3094
+ extern int _nc_read_file_entry (const char *const, TERMTYPE *);
3095
+ extern char * _nc_first_name (const char *const);
3096
+ extern int _nc_name_match (const char *const, const char *const, const char *const);
3097
+ extern int _nc_read_termcap_entry (const char *const, TERMTYPE *const);
3098
+ extern const TERMTYPE * _nc_fallback (const char *);
3099
+
3100
+
3101
+ extern TERMINAL * set_curterm (TERMINAL *);
3102
+ extern int del_curterm (TERMINAL *);
3103
+
3104
+
3105
+ extern int restartterm ( char *, int, int *);
3106
+ extern int setupterm ( char *,int,int *);
3107
+ # 772 "/usr/include/term.h" 3 4
3108
+ extern char * tgetstr ( char *, char **);
3109
+ extern char * tgoto (const char *, int, int);
3110
+ extern int tgetent (char *, const char *);
3111
+ extern int tgetflag ( char *);
3112
+ extern int tgetnum ( char *);
3113
+ extern int tputs (const char *, int, int (*)(int));
3114
+ # 137 "./test.priv.h" 2
3115
+ # 153 "./test.priv.h"
3116
+ extern char *optarg;
3117
+ extern int optind;
3118
+ # 163 "./test.priv.h"
3119
+ # 1 "/usr/include/assert.h" 1 3 4
3120
+ # 65 "/usr/include/assert.h" 3 4
3121
+
3122
+
3123
+
3124
+ extern void __assert_fail ( char *__assertion, char *__file,
3125
+ unsigned int __line, char *__function)
3126
+ ;
3127
+
3128
+
3129
+ extern void __assert_perror_fail (int __errnum, char *__file,
3130
+ unsigned int __line,
3131
+ char *__function)
3132
+ ;
3133
+
3134
+
3135
+
3136
+
3137
+ extern void __assert (const char *__assertion, const char *__file, int __line)
3138
+ ;
3139
+
3140
+
3141
+
3142
+ # 164 "./test.priv.h" 2
3143
+ # 1 "/usr/include/ctype.h" 1 3 4
3144
+ # 30 "/usr/include/ctype.h" 3 4
3145
+
3146
+ # 48 "/usr/include/ctype.h" 3 4
3147
+ enum
3148
+ {
3149
+ _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)),
3150
+ _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)),
3151
+ _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)),
3152
+ _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)),
3153
+ _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)),
3154
+ _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)),
3155
+ _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)),
3156
+ _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)),
3157
+ _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)),
3158
+ _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)),
3159
+ _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)),
3160
+ _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8))
3161
+ };
3162
+ # 81 "/usr/include/ctype.h" 3 4
3163
+ extern unsigned short int **__ctype_b_loc (void)
3164
+ ;
3165
+ extern __int32_t **__ctype_tolower_loc (void)
3166
+ ;
3167
+ extern __int32_t **__ctype_toupper_loc (void)
3168
+ ;
3169
+ # 96 "/usr/include/ctype.h" 3 4
3170
+
3171
+
3172
+
3173
+
3174
+
3175
+
3176
+ extern int isalnum (int);
3177
+ extern int isalpha (int);
3178
+ extern int iscntrl (int);
3179
+ extern int isdigit (int);
3180
+ extern int islower (int);
3181
+ extern int isgraph (int);
3182
+ extern int isprint (int);
3183
+ extern int ispunct (int);
3184
+ extern int isspace (int);
3185
+ extern int isupper (int);
3186
+ extern int isxdigit (int);
3187
+
3188
+
3189
+
3190
+ extern int tolower (int __c);
3191
+
3192
+
3193
+ extern int toupper (int __c);
3194
+
3195
+
3196
+ # 142 "/usr/include/ctype.h" 3 4
3197
+ extern int isascii (int __c);
3198
+
3199
+
3200
+
3201
+ extern int toascii (int __c);
3202
+
3203
+
3204
+
3205
+ extern int _toupper (int);
3206
+ extern int _tolower (int);
3207
+ # 323 "/usr/include/ctype.h" 3 4
3208
+
3209
+ # 165 "./test.priv.h" 2
3210
+ # 21 "hanoi.c" 2
3211
+ # 36 "hanoi.c"
3212
+ struct Peg {
3213
+ size_t Length[9];
3214
+ int Count;
3215
+ };
3216
+
3217
+ static struct Peg Pegs[3];
3218
+ static int PegPos[] =
3219
+ {19, 39, 59};
3220
+ static int TileColour[] =
3221
+ {
3222
+ 2,
3223
+ 5,
3224
+ 1,
3225
+ 4,
3226
+ 6,
3227
+ 3,
3228
+ 2,
3229
+ 5,
3230
+ 1,
3231
+ };
3232
+ static int NMoves = 0;
3233
+
3234
+ static void InitTiles(int NTiles);
3235
+ static void DisplayTiles(void);
3236
+ static void MakeMove(int From, int To);
3237
+ static void AutoMove(int From, int To, int Num);
3238
+ static void Usage(void);
3239
+ static int Solved(int NumTiles);
3240
+ static int GetMove(int *From, int *To);
3241
+ static int InvalidMove(int From, int To);
3242
+
3243
+ int
3244
+ main(int argc, char **argv)
3245
+ {
3246
+ int NTiles, FromCol, ToCol;
3247
+ _Bool AutoFlag = 0;
3248
+
3249
+ ;
3250
+
3251
+ switch (argc) {
3252
+ case 1:
3253
+ NTiles = 7;
3254
+ break;
3255
+ case 2:
3256
+ NTiles = atoi(argv[1]);
3257
+ if (NTiles > 9 || NTiles < 3) {
3258
+ fprintf(stderr, "Range %d to %d\n", 3, 9);
3259
+ exit(1);
3260
+ }
3261
+ break;
3262
+ case 3:
3263
+ if (strcmp(argv[2], "a")) {
3264
+ Usage();
3265
+ exit(1);
3266
+ }
3267
+ NTiles = atoi(argv[1]);
3268
+ if (NTiles > 9 || NTiles < 3) {
3269
+ fprintf(stderr, "Range %d to %d\n", 3, 9);
3270
+ exit(1);
3271
+ }
3272
+ AutoFlag = 1;
3273
+ break;
3274
+ default:
3275
+ Usage();
3276
+ exit(1);
3277
+ }
3278
+
3279
+
3280
+
3281
+ initscr();
3282
+ if (has_colors()) {
3283
+ int i;
3284
+ int bg = 0;
3285
+ start_color();
3286
+
3287
+
3288
+
3289
+
3290
+ for (i = 0; i < 9; i++)
3291
+ init_pair(i + 1, bg, TileColour[i]);
3292
+ }
3293
+ cbreak();
3294
+ if (LINES < 24) {
3295
+ endwin();
3296
+ fprintf(stderr, "Min screen length 24 lines\n");
3297
+ exit(1);
3298
+ }
3299
+ if (AutoFlag) {
3300
+ curs_set(0);
3301
+ leaveok(stdscr, 1);
3302
+ }
3303
+ InitTiles(NTiles);
3304
+ DisplayTiles();
3305
+ if (AutoFlag) {
3306
+ do {
3307
+ noecho();
3308
+ AutoMove(0, 2, NTiles);
3309
+ } while (!Solved(NTiles));
3310
+ sleep(2);
3311
+ } else {
3312
+ echo();
3313
+ for (;;) {
3314
+ if (GetMove(&FromCol, &ToCol))
3315
+ break;
3316
+ if (InvalidMove(FromCol, ToCol)) {
3317
+ (wmove(stdscr,(LINES-3),0) == (-1) ? (-1) : waddnstr(stdscr,"Invalid Move !!",-1));
3318
+ wrefresh(stdscr);
3319
+ beep();
3320
+ continue;
3321
+ }
3322
+ MakeMove(FromCol, ToCol);
3323
+ if (Solved(NTiles)) {
3324
+ mvprintw((LINES-3), 0,
3325
+ "Well Done !! You did it in %d moves", NMoves);
3326
+ wrefresh(stdscr);
3327
+ sleep(5);
3328
+ break;
3329
+ }
3330
+ }
3331
+ }
3332
+ endwin();
3333
+ exit(0);
3334
+ }
3335
+
3336
+ static int
3337
+ InvalidMove(int From, int To)
3338
+ {
3339
+ if (From >= 3)
3340
+ return 1;
3341
+ if (From < 0)
3342
+ return 1;
3343
+ if (To >= 3)
3344
+ return 1;
3345
+ if (To < 0)
3346
+ return 1;
3347
+ if (From == To)
3348
+ return 1;
3349
+ if (!Pegs[From].Count)
3350
+ return 1;
3351
+ if (Pegs[To].Count &&
3352
+ Pegs[From].Length[Pegs[From].Count - 1] >
3353
+ Pegs[To].Length[Pegs[To].Count - 1])
3354
+ return 1;
3355
+ return 0;
3356
+ }
3357
+
3358
+ static void
3359
+ InitTiles(int NTiles)
3360
+ {
3361
+ int Size, SlotNo;
3362
+
3363
+ for (Size = NTiles * 2 + 1, SlotNo = 0; Size >= 3; Size -= 2)
3364
+ Pegs[0].Length[SlotNo++] = Size;
3365
+
3366
+ Pegs[0].Count = NTiles;
3367
+ Pegs[1].Count = 0;
3368
+ Pegs[2].Count = 0;
3369
+ }
3370
+
3371
+ static void
3372
+ DisplayTiles(void)
3373
+ {
3374
+ int Line, peg, SlotNo;
3375
+ char TileBuf[8192];
3376
+
3377
+ werase(stdscr);
3378
+ (wmove(stdscr,1,24) == (-1) ? (-1) : waddnstr(stdscr,"T O W E R S O F H A N O I",-1));
3379
+ (wmove(stdscr,3,34) == (-1) ? (-1) : waddnstr(stdscr,"SJR 1990",-1));
3380
+ mvprintw(19, 5, "Moves : %d", NMoves);
3381
+ ((stdscr)->_attrs = (((1UL) << ((10) + 8))));
3382
+ (wmove(stdscr,16,8) == (-1) ? (-1) : waddnstr(stdscr," ",-1));
3383
+
3384
+
3385
+ for (Line = 6; Line < 16; Line++) {
3386
+ (wmove(stdscr,Line,19) == (-1) ? (-1) : waddch(stdscr,' '));
3387
+ (wmove(stdscr,Line,39) == (-1) ? (-1) : waddch(stdscr,' '));
3388
+ (wmove(stdscr,Line,59) == (-1) ? (-1) : waddch(stdscr,' '));
3389
+ }
3390
+ (wmove(stdscr,16,19) == (-1) ? (-1) : waddch(stdscr,'1'));
3391
+ (wmove(stdscr,16,39) == (-1) ? (-1) : waddch(stdscr,'2'));
3392
+ (wmove(stdscr,16,59) == (-1) ? (-1) : waddch(stdscr,'3'));
3393
+ ((stdscr)->_attrs = (0L));
3394
+
3395
+
3396
+ for (peg = 0; peg < 3; peg++) {
3397
+ for (SlotNo = 0; SlotNo < Pegs[peg].Count; SlotNo++) {
3398
+ memset(TileBuf, ' ', Pegs[peg].Length[SlotNo]);
3399
+ TileBuf[Pegs[peg].Length[SlotNo]] = '\0';
3400
+ if (has_colors())
3401
+ ((stdscr)->_attrs = ((((((Pegs[peg].Length[SlotNo])-1)/2)) << ((0) + 8))));
3402
+ else
3403
+ ((stdscr)->_attrs = (((1UL) << ((10) + 8))));
3404
+ (wmove(stdscr,16 - (SlotNo + 1),(int) (PegPos[peg] - Pegs[peg].Length[SlotNo] / 2)) == (-1) ? (-1) : waddnstr(stdscr,TileBuf,-1));
3405
+
3406
+
3407
+ }
3408
+ }
3409
+ ((stdscr)->_attrs = (0L));
3410
+ wrefresh(stdscr);
3411
+ }
3412
+
3413
+ static int
3414
+ GetMove(int *From, int *To)
3415
+ {
3416
+ (wmove(stdscr,(LINES-3),0) == (-1) ? (-1) : waddnstr(stdscr,"Next move ('q' to quit) from ",-1));
3417
+ wclrtoeol(stdscr);
3418
+ wrefresh(stdscr);
3419
+ if ((*From = wgetch(stdscr)) == 'q')
3420
+ return 1;
3421
+ *From -= ('0' + 1);
3422
+ waddnstr(stdscr," to ",-1);
3423
+ wclrtoeol(stdscr);
3424
+ wrefresh(stdscr);
3425
+
3426
+ if ((*To = wgetch(stdscr)) == 'q')
3427
+ return 1;
3428
+ *To -= ('0' + 1);
3429
+ wrefresh(stdscr);
3430
+ napms(500);
3431
+
3432
+ wmove(stdscr,(LINES-3),0);
3433
+ wclrtoeol(stdscr);
3434
+ wrefresh(stdscr);
3435
+ return 0;
3436
+ }
3437
+
3438
+ static void
3439
+ MakeMove(int From, int To)
3440
+ {
3441
+ Pegs[From].Count--;
3442
+ Pegs[To].Length[Pegs[To].Count] = Pegs[From].Length[Pegs[From].Count];
3443
+ Pegs[To].Count++;
3444
+ NMoves++;
3445
+ DisplayTiles();
3446
+ }
3447
+
3448
+ static void
3449
+ AutoMove(int From, int To, int Num)
3450
+ {
3451
+ if (Num == 1) {
3452
+ MakeMove(From, To);
3453
+ napms(500);
3454
+ return;
3455
+ }
3456
+ AutoMove(From, (3-((From)+(To))), Num - 1);
3457
+ MakeMove(From, To);
3458
+ napms(500);
3459
+ AutoMove((3-((From)+(To))), To, Num - 1);
3460
+ }
3461
+
3462
+ static int
3463
+ Solved(int NumTiles)
3464
+ {
3465
+ int i;
3466
+
3467
+ for (i = 1; i < 3; i++)
3468
+ if (Pegs[i].Count == NumTiles)
3469
+ return 1;
3470
+ return 0;
3471
+ }
3472
+
3473
+ static void
3474
+ Usage(void)
3475
+ {
3476
+ fprintf(stderr, "Usage: hanoi [<No Of Tiles>] [a]\n");
3477
+ fprintf(stderr,
3478
+ "The 'a' option causes the tower to be solved automatically\n");
3479
+ }