1# regression tests for the proto utility
2
3TEST 01 'basics'
4	EXEC -nh
5		INPUT - $'#pragma prototyped
6
7void (*FUN)(struct namnod*);
8
9void (*signal(int, void (*)(int)))(int);
10
11main()
12{
13\tint n;
14
15\tn = nv_scan(root, (void(*)(struct namnod*))0,flag,flag);
16}'
17		OUTPUT - $'
18
19void (*FUN) __PROTO__((struct namnod*));
20
21void (*signal __PROTO__((int, void (*)(int)))) __PROTO__((int));
22
23main()
24{
25\tint n;
26
27\tn = nv_scan(root, (void(*)(struct namnod*))0,flag,flag);
28}'
29	EXEC -nh
30		INPUT - $'#pragma prototyped
31extern int\topen(), read(), write(), close();'
32		OUTPUT - $'
33extern __MANGLE__ int\topen(__VARARG__), read(__VARARG__), write(__VARARG__), close(__VARARG__);'
34	EXEC -nh
35		INPUT - $'#pragma prototyped
36
37char*\ta = "x\\ax";
38int\tb = \'\\v\';
39char*\tc = "a\\x1aFb";
40
41extern char* strcpy(const char*, const char*);
42
43typedef void (*signal_t)(int);
44
45int\tnl = \'\\n\';
46char*\ty = "y\\
47z";
48
49typedef char (*oops);
50
51struct test
52{
53\tint\t(*call)(int, ...);
54};
55
56#include <stdarg.h>
57
58int error(int level, char* format, ...)
59{
60\tva_list\tap;
61
62\tva_start(ap, format);
63\tva_end(ap);
64}
65
66int main(int argc, char** argv)
67{
68\tvoid exit(int);
69\tif (0);
70\telse while(xxx);
71\tdo return(0); while (1);
72\tif (ok) return(1);
73\texit(0);
74}'
75		OUTPUT - $'
76
77char*\ta = "x\\007x";
78int\tb = \'\\013\';
79char*\tc = "a\\657b";
80
81extern __MANGLE__ char* strcpy __PROTO__((const char*, const char*));
82
83typedef void (*signal_t) __PROTO__((int));
84
85int\tnl = \'\\n\';
86char*\ty = "y\\
87z";
88
89typedef char (*oops);
90
91struct test
92{
93\tint\t(*call) __PROTO__((int, ...));
94};
95
96#if !defined(va_start)
97#if defined(__STDARG__)
98#include <stdarg.h>
99#else
100#include <varargs.h>
101#endif
102#endif
103
104#line 22
105
106
107int error __PARAM__((int level, char* format, ...), (va_alist)) __OTORP__(va_dcl)
108{ __OTORP__(int level; char* format; )
109#line 25
110
111\tva_list\tap;
112
113\t__VA_START__(ap, format); __OTORP__(level = va_arg(ap, int );format = va_arg(ap, char* );)
114\tva_end(ap);
115}
116
117int main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;)
118#line 33
119{
120\tvoid exit __PROTO__((int));
121\tif (0);
122\telse while(xxx);
123\tdo return(0); while (1);
124\tif (ok) return(1);
125\texit(0);
126}'
127	EXEC -nh
128		INPUT - $'#pragma prototyped
129extern const char foo[];'
130		OUTPUT - $'
131extern __MANGLE__ const char foo[];'
132	EXEC -nh
133		INPUT - $'#pragma prototyped
134   extern void fun(int);
135/* extern void ( *signal( in1, void (*)(in2) ) )(in3); */
136   extern void ( *signal( in1, void (*)(in2) ) )(in3);
137/* extern void ( *foo(in1, in2) )(in3); */
138   extern void ( *foo(in1, in2) )(in3);'
139		OUTPUT - $'
140   extern __MANGLE__ void fun __PROTO__((int));
141/* extern void ( *signal( in1, void (*)(in2) ) )(in3); */
142   extern __MANGLE__ void ( *signal __PROTO__(( in1, void (*)(in2) ) )) __PROTO__((in3));
143/* extern void ( *foo(in1, in2) )(in3); */
144   extern __MANGLE__ void ( *foo __PROTO__((in1, in2) )) __PROTO__((in3));'
145	EXEC -nh
146		INPUT - $'#pragma prototyped
147
148extern unsigned long\tcsaddr(char*, int);
149extern int\t\tcscreat(char*, int);
150extern int\t\tcsdaemon(void);
151extern int\t\tcsfdmax(void);
152extern unsigned long\tcsinet(char*, unsigned short*, int*);
153extern char*\t\tcsname(void);
154extern int\t\tcsnote(char*);
155extern char*\t\tcsntoa(unsigned long);
156extern int\t\tcsopen(char*);
157extern char*\t\tcspath(unsigned long, char*, int);
158extern int\t\tcspoll(int, char*, char*, long);
159extern int\t\tcsrecv(int, char*, int*, int);
160extern int\t\tcssend(int, int*, int);
161extern int\t\tcsstat(char*, char*);'
162		OUTPUT - $'
163
164extern __MANGLE__ unsigned long\tcsaddr __PROTO__((char*, int));
165extern __MANGLE__ int\t\tcscreat __PROTO__((char*, int));
166extern __MANGLE__ int\t\tcsdaemon __PROTO__((void));
167extern __MANGLE__ int\t\tcsfdmax __PROTO__((void));
168extern __MANGLE__ unsigned long\tcsinet __PROTO__((char*, unsigned short*, int*));
169extern __MANGLE__ char*\t\tcsname __PROTO__((void));
170extern __MANGLE__ int\t\tcsnote __PROTO__((char*));
171extern __MANGLE__ char*\t\tcsntoa __PROTO__((unsigned long));
172extern __MANGLE__ int\t\tcsopen __PROTO__((char*));
173extern __MANGLE__ char*\t\tcspath __PROTO__((unsigned long, char*, int));
174extern __MANGLE__ int\t\tcspoll __PROTO__((int, char*, char*, long));
175extern __MANGLE__ int\t\tcsrecv __PROTO__((int, char*, int*, int));
176extern __MANGLE__ int\t\tcssend __PROTO__((int, int*, int));
177extern __MANGLE__ int\t\tcsstat __PROTO__((char*, char*));'
178	EXEC -nh
179		INPUT - $'#pragma prototyped
180
181int error(int (*function)(int), char* format)
182{
183}'
184		OUTPUT - $'
185
186int error __PARAM__((int (*function)(int), char* format), (function, format)) __OTORP__(int (*function)(); char* format;)
187#line 4
188{
189}'
190	EXEC -nh
191		INPUT - $'#pragma prototyped
192disp_form(pkt)
193register packet *pkt;
194{
195    char *rjust(), *ptr;
196
197    return(0);
198}'
199		OUTPUT - $'                  \ndisp_form(pkt)
200register packet *pkt;
201{
202    char *rjust(__VARARG__), *ptr;
203
204    return(0);
205}'
206	EXEC -nh
207		INPUT - $'#pragma prototyped
208int i = 0xbeef;
209int I = 0XBEEF;
210float f = 12.34f;
211float F = 56.78F;'
212		OUTPUT - $'                  \nint i = 0xbeef;
213int I = 0XBEEF;
214float f = 12.34;
215float F = 56.78;'
216
217TEST 02 'subtleties'
218	EXEC -nh
219		INPUT - $'#pragma prototyped
220
221/*
222 * license validation
223 * vulnerable to debugging and binary edits
224 */
225
226#include <ast.h>
227#include <cs.h>
228#include <error.h>
229#include <hashpart.h>
230#include <tm.h>
231
232#ifndef KEY
233#define KEY\t0x001010
234#endif
235
236static void
237signature(char* key, int keysize, const char* package,
238\t\tconst char* data, const char* text)
239{
240\tregister int\t\t\tc;
241\tregister const char*\t\td;
242\tregister char*\t\t\tk;
243\tregister const char*\t\tp;
244\tregister const unsigned char*\tt;
245\tregister unsigned long\t\th;
246
247\tstatic char\t\tsalt[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.";
248
249\tmemzero(key, keysize--);
250\td = data;
251\tk = key;
252\tp = package;
253\tt = (unsigned char*)text;
254\th = 0;
255\twhile (c = *d++)
256\t{
257\t\tHASHPART(h, c);
258\t\tk[h % keysize] ^= h >> 1;
259\t\tif (!(c = *p++)) p = package;
260\t\tHASHPART(h, c);
261\t\tk[h % keysize] ^= h >> 3;
262\t\tHASHPART(h, *t++);
263\t\tk[h % keysize] ^= h >> 5;
264\t\tc = 0;
265\t\twhile ((h & KEY) != KEY && c++ < 100)
266\t\t{
267\t\t\tHASHPART(h, 0);
268\t\t\tk[h % keysize] ^= h >> 7;
269\t\t}
270\t}
271\tfor (; k < &key[keysize]; k++)
272\t\t*k = salt[*(unsigned char*)k % (sizeof(salt) - 1)];
273}
274
275/*
276 * validate license for tool in package
277 * if pc!=0 then it is filled with license field data
278 */
279
280void
281pathcheck(const char* package, const char* tool, register PATHCHECK* pc)
282{
283\tint\tc;
284\tint\tn;
285\tchar*\tb;
286\tchar*\tk;
287\tchar*\tv;
288\tchar*\tu;
289\tlong\texpire;
290\ttime_t\tnow;
291\tchar\tkey[14];
292\tchar\tlicense[PATH_MAX];
293\tchar\tdata[PATH_MAX];
294\tchar\ttext[PATH_MAX];
295\t
296#ifdef\tpathcheck
297\tif (gen_license) (void)strcpy(data, gen_license);
298\telse
299#endif
300\t(void)sfsprintf(data, sizeof(data), "lib/%s/license", package);
301\tif (!pathpath(license, data,
302#ifdef\tpathcheck
303\t\tgen_license ? NiL :
304#endif
305\t\ttool, PATH_REGULAR|PATH_READ))
306\t\t\terror(3, "%s: not found", data);
307\tif ((n = open(license, 0)) < 0)
308\t\terror(3, "%s: cannot open", license);
309\tif ((c = read(n, data, sizeof(data) - 1)) < 0)
310\t\terror(3, "%s: cannot read", license);
311\tclose(n);
312\tdata[c] = 0;
313\tif (!pathpath(text, tool, NiL, PATH_REGULAR|PATH_READ|PATH_EXECUTE))
314\t\terror(3, "%s: not found", tool);
315\tif ((n = open(text, 0)) < 0)
316\t\terror(3, "%s: cannot open", text);
317\t(void)lseek(n, lseek(n, 0, SEEK_END) / 4, SEEK_SET);
318\tmemzero(text, c);
319\t(void)read(n, text, c);
320\tclose(n);
321
322\t/*
323\t * check signature
324\t */
325
326\tb = data;
327\twhile (tokscan(b, &b, " #%s
328", NiL) == 1);
329\tif (tokscan(b, &b, " %s ", &v) != 1)
330\t\terror(3, "%s: garbled", license);
331\tsignature(key, sizeof(key), package, b, text);
332
333\t/*
334\t * NOTE: no lib routines for signature compare/clear
335\t */
336
337\tn = 0;
338\twhile (*v)
339\t{
340\t\tk = key;
341\t\twhile (*v && *v != \'|\' && *k++ == *v++);
342\t\tif (!*k)
343\t\t{
344\t\t\tn = 1;
345\t\t\tbreak;
346\t\t}
347\t\twhile (*v && *v++ != \'|\');
348\t}
349#ifdef\tpathcheck
350\tif (!n)
351\t{
352\t\tsfprintf(sfstdout, "|%s|
353", key);
354\t\texit(0);
355\t}
356#endif
357\tfor (k = key; *k; *k++ = 0);
358\tif (!n) error(3, "%s: invalid", license);
359
360\t/*
361\t * loop on the fields
362\t */
363
364\tif (pc) memzero(pc, sizeof(*pc));
365\tfor (n = 0;; n++)
366\t{
367\t\twhile (tokscan(b, &b, " #%s
368", NiL) == 1);
369\t\tif (tokscan(b, &u, " %s=%s ", &k, &v) != 2) break;
370\t\tb = u;
371\t\tswitch (*k)
372\t\t{
373\t\tcase \'e\':
374\t\t\tif (!strcmp(k, "expire"))
375\t\t\t{
376\t\t\t\tnow = time(NiL);
377\t\t\t\texpire = (unsigned long)tmdate(v, &u, &now) - (unsigned long)now;
378\t\t\t\tif (*u)
379\t\t\t\t\terror(3, "%s: %s: invalid expiration date", license, v);
380\t\t\t\tif (expire <= 0)
381\t\t\t\t\terror(3, "license expired");
382\t\t\t\tif (expire < (60 * 60 * 24 * 7))
383\t\t\t\t\terror(1, "license expires in %s", fmtelapsed(expire, 1));
384\t\t\t\tif (pc) pc->date = expire;
385\t\t\t\tcontinue;
386\t\t\t}
387\t\t\tbreak;
388\t\tcase \'h\':
389\t\t\tif (!strcmp(k, "host"))
390\t\t\t{
391\t\t\t\tu = csname();
392\t\t\t\tif (!strmatch(u, v) && !strmatch(csntoa(csaddr(NiL, -1), 0), v))
393\t\t\t\t\terror(3, "%s: %s=%s not licensed", license, k, u);
394\t\t\t\tif (pc) pc->host = strdup(v);
395\t\t\t\tcontinue;
396\t\t\t}
397\t\t\tbreak;
398\t\tcase \'u\':
399\t\t\tif (!strcmp(k, "user"))
400\t\t\t{
401\t\t\t\tu = fmtuid(getuid());
402\t\t\t\tif (!strmatch(u, v))
403\t\t\t\t\terror(3, "%s: %s=%s not licensed", license, k, u);
404\t\t\t\tif (pc) pc->user = strdup(v);
405\t\t\t\tcontinue;
406\t\t\t}
407\t\t\tbreak;
408\t\t}
409#ifdef\tpathcheck
410\t\terror(1, "%s: %s: invalid key", license, k);
411#endif
412\t}
413\tif (*b) error(3, "%s: %s: invalid field", license, b);
414\tif (!n) error(3, "%s: empty", license);
415}'
416		OUTPUT - $'
417
418/*
419 * license validation
420 * vulnerable to debugging and binary edits
421 */
422
423#include <ast.h>
424#include <cs.h>
425#include <error.h>
426#include <hashpart.h>
427#include <tm.h>
428
429#ifndef KEY
430#define KEY\t0x001010
431#endif
432
433static void
434signature __PARAM__((char* key, int keysize, const char* package,
435\t\tconst char* data, const char* text), (key, keysize, package, data, text)) __OTORP__(char* key; int keysize; const char* package;
436\t\tconst char* data; const char* text;)
437#line 21
438{
439\tregister int\t\t\tc;
440\tregister const char*\t\td;
441\tregister char*\t\t\tk;
442\tregister const char*\t\tp;
443\tregister const unsigned char*\tt;
444\tregister unsigned long\t\th;
445
446\tstatic char\t\tsalt[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.";
447
448\tmemzero(key, keysize--);
449\td = data;
450\tk = key;
451\tp = package;
452\tt = (unsigned char*)text;
453\th = 0;
454\twhile (c = *d++)
455\t{
456\t\tHASHPART(h, c);
457\t\tk[h % keysize] ^= h >> 1;
458\t\tif (!(c = *p++)) p = package;
459\t\tHASHPART(h, c);
460\t\tk[h % keysize] ^= h >> 3;
461\t\tHASHPART(h, *t++);
462\t\tk[h % keysize] ^= h >> 5;
463\t\tc = 0;
464\t\twhile ((h & KEY) != KEY && c++ < 100)
465\t\t{
466\t\t\tHASHPART(h, 0);
467\t\t\tk[h % keysize] ^= h >> 7;
468\t\t}
469\t}
470\tfor (; k < &key[keysize]; k++)
471\t\t*k = salt[*(unsigned char*)k % (sizeof(salt) - 1)];
472}
473
474/*
475 * validate license for tool in package
476 * if pc!=0 then it is filled with license field data
477 */
478
479void
480pathcheck __PARAM__((const char* package, const char* tool, register PATHCHECK* pc), (package, tool, pc)) __OTORP__(const char* package; const char* tool; register PATHCHECK* pc;)
481#line 64
482{
483\tint\tc;
484\tint\tn;
485\tchar*\tb;
486\tchar*\tk;
487\tchar*\tv;
488\tchar*\tu;
489\tlong\texpire;
490\ttime_t\tnow;
491\tchar\tkey[14];
492\tchar\tlicense[PATH_MAX];
493\tchar\tdata[PATH_MAX];
494\tchar\ttext[PATH_MAX];
495\t
496#ifdef\tpathcheck
497\tif (gen_license) (void)strcpy(data, gen_license);
498\telse
499#endif
500\t(void)sfsprintf(data, sizeof(data), "lib/%s/license", package);
501\tif (!pathpath(license, data,
502#ifdef\tpathcheck
503\t\tgen_license ? NiL :
504#endif
505\t\ttool, PATH_REGULAR|PATH_READ))
506\t\t\terror(3, "%s: not found", data);
507\tif ((n = open(license, 0)) < 0)
508\t\terror(3, "%s: cannot open", license);
509\tif ((c = read(n, data, sizeof(data) - 1)) < 0)
510\t\terror(3, "%s: cannot read", license);
511\tclose(n);
512\tdata[c] = 0;
513\tif (!pathpath(text, tool, NiL, PATH_REGULAR|PATH_READ|PATH_EXECUTE))
514\t\terror(3, "%s: not found", tool);
515\tif ((n = open(text, 0)) < 0)
516\t\terror(3, "%s: cannot open", text);
517\t(void)lseek(n, lseek(n, 0, SEEK_END) / 4, SEEK_SET);
518\tmemzero(text, c);
519\t(void)read(n, text, c);
520\tclose(n);
521
522\t/*
523\t * check signature
524\t */
525
526\tb = data;
527\twhile (tokscan(b, &b, " #%s
528", NiL) == 1);
529\tif (tokscan(b, &b, " %s ", &v) != 1)
530\t\terror(3, "%s: garbled", license);
531\tsignature(key, sizeof(key), package, b, text);
532
533\t/*
534\t * NOTE: no lib routines for signature compare/clear
535\t */
536
537\tn = 0;
538\twhile (*v)
539\t{
540\t\tk = key;
541\t\twhile (*v && *v != \'|\' && *k++ == *v++);
542\t\tif (!*k)
543\t\t{
544\t\t\tn = 1;
545\t\t\tbreak;
546\t\t}
547\t\twhile (*v && *v++ != \'|\');
548\t}
549#ifdef\tpathcheck
550\tif (!n)
551\t{
552\t\tsfprintf(sfstdout, "|%s|
553", key);
554\t\texit(0);
555\t}
556#endif
557\tfor (k = key; *k; *k++ = 0);
558\tif (!n) error(3, "%s: invalid", license);
559
560\t/*
561\t * loop on the fields
562\t */
563
564\tif (pc) memzero(pc, sizeof(*pc));
565\tfor (n = 0;; n++)
566\t{
567\t\twhile (tokscan(b, &b, " #%s
568", NiL) == 1);
569\t\tif (tokscan(b, &u, " %s=%s ", &k, &v) != 2) break;
570\t\tb = u;
571\t\tswitch (*k)
572\t\t{
573\t\tcase \'e\':
574\t\t\tif (!strcmp(k, "expire"))
575\t\t\t{
576\t\t\t\tnow = time(NiL);
577\t\t\t\texpire = (unsigned long)tmdate(v, &u, &now) - (unsigned long)now;
578\t\t\t\tif (*u)
579\t\t\t\t\terror(3, "%s: %s: invalid expiration date", license, v);
580\t\t\t\tif (expire <= 0)
581\t\t\t\t\terror(3, "license expired");
582\t\t\t\tif (expire < (60 * 60 * 24 * 7))
583\t\t\t\t\terror(1, "license expires in %s", fmtelapsed(expire, 1));
584\t\t\t\tif (pc) pc->date = expire;
585\t\t\t\tcontinue;
586\t\t\t}
587\t\t\tbreak;
588\t\tcase \'h\':
589\t\t\tif (!strcmp(k, "host"))
590\t\t\t{
591\t\t\t\tu = csname();
592\t\t\t\tif (!strmatch(u, v) && !strmatch(csntoa(csaddr(NiL, -1), 0), v))
593\t\t\t\t\terror(3, "%s: %s=%s not licensed", license, k, u);
594\t\t\t\tif (pc) pc->host = strdup(v);
595\t\t\t\tcontinue;
596\t\t\t}
597\t\t\tbreak;
598\t\tcase \'u\':
599\t\t\tif (!strcmp(k, "user"))
600\t\t\t{
601\t\t\t\tu = fmtuid(getuid());
602\t\t\t\tif (!strmatch(u, v))
603\t\t\t\t\terror(3, "%s: %s=%s not licensed", license, k, u);
604\t\t\t\tif (pc) pc->user = strdup(v);
605\t\t\t\tcontinue;
606\t\t\t}
607\t\t\tbreak;
608\t\t}
609#ifdef\tpathcheck
610\t\terror(1, "%s: %s: invalid key", license, k);
611#endif
612\t}
613\tif (*b) error(3, "%s: %s: invalid field", license, b);
614\tif (!n) error(3, "%s: empty", license);
615}'
616	EXEC -nh
617		INPUT - $'extern char *malloc(), *realloc();
618
619# line 2 "parser.y"
620#pragma prototyped
621#include <ast.h>
622
623/************************************************************************
624*\t\t\t\t\t\t\t\t\t*
625*    David S. Rosenblum\t\t\t\t\t\t\t*
626*    AT&T Bell Laboratories\t\t\t\t\t\t*
627*    MH 3C-541\t\t\t\t\t\t\t\t*
628*    ulysses!dsr\t\t\t\t\t\t\t*
629*\t\t\t\t\t\t\t\t\t*
630*************************************************************************
631*\t\t\t\t\t\t\t\t\t*
632*\tYACC SPECIFICATION OF PARSER FOR APP TOOL\t\t\t*
633*\tVersion 2.00\t\t\t\t\t\t\t*
634*\t\t\t\t\t\t\t\t\t*
635************************************************************************/
636
637#include <error.h>
638#include <stdio.h>
639#include <hash.h>
640
641/*  pp.h is included just before the first %%, to avoid warning messages
642**  however we need hash.h (which is included by pp.h) now, for following
643**  #include\'s:
644*/
645
646#include <app.h>
647#include <typetbl.h>
648#include <symbol.h>
649#include <output.h>
650#include <state.h>
651#include <cctypes.h>
652#include <pdecls.h>\t/*  The declarations section is in pdecls.h,
653\t\t\t**  so that proto doesn\'t get confused.
654\t\t\t*/
655
656# line 39 "parser.y"
657typedef union  {
658    struct token_type* ltoken;
659    T1WORD             exptype;
660    BOOL\t       success;
661    int\t\t       count;
662    SIZE\t       expval;
663    struct {
664\tint\t      count;
665\tOUTFILE_KIND  okval;
666    }\t\t       inexpr;
667    struct {
668\tstruct token_type* ltoken;
669\tT1WORD\t\t   exptype;
670    }\t\t       exptoken;
671    struct {
672\tunsigned long\t   star_count;
673\tunsigned long\t   const_star_flags;
674    } star_specs;
675} YYSTYPE;
676# define T_DOUBLE 292
677# define T_DOUBLE_L 293
678# define T_FLOAT 294
679# define T_DECIMAL 288
680# define T_DECIMAL_L 289
681# define T_DECIMAL_U 290
682# define T_DECIMAL_UL 291
683# define T_OCTAL 296
684# define T_OCTAL_L 297
685# define T_OCTAL_U 298
686# define T_OCTAL_UL 299
687# define T_HEXADECIMAL 304
688# define T_HEXADECIMAL_L 305
689# define T_HEXADECIMAL_U 306
690# define T_HEXADECIMAL_UL 307
691# define T_ID 257
692# define T_INVALID 258
693# define T_CHARCONST 260
694# define T_WCHARCONST 261
695# define T_STRING 262
696# define T_WSTRING 263
697# define T_PTRMEM 264
698# define T_ADDADD 265
699# define T_SUBSUB 266
700# define T_LSHIFT 267
701# define T_RSHIFT 268
702# define T_LE 269
703# define T_GE 270
704# define T_EQ 271
705# define T_NE 272
706# define T_ANDAND 273
707# define T_OROR 274
708# define T_MPYEQ 275
709# define T_DIVEQ 276
710# define T_MODEQ 277
711# define T_ADDEQ 278
712# define T_SUBEQ 279
713# define T_LSHIFTEQ 280
714# define T_RSHIFTEQ 281
715# define T_ANDEQ 282
716# define T_XOREQ 283
717# define T_OREQ 284
718# define T_VARIADIC 286
719# define T_DOTREF 320
720# define T_PTRMEMREF 321
721# define T_SCOPE 322
722# define T_UMINUS 323
723# define T_AUTO 324
724# define T_BREAK 325
725# define T_CASE 326
726# define T_CHAR 327
727# define T_CONTINUE 328
728# define T_DEFAULT 329
729# define T_DO 330
730# define T_DOUBLE_T 331
731# define T_ELSE 332
732# define T_EXTERN 333
733# define T_FLOAT_T 334
734# define T_FOR 335
735# define T_GOTO 336
736# define T_IF 337
737# define T_INT 338
738# define T_LONG 339
739# define T_REGISTER 340
740# define T_RETURN 341
741# define T_SHORT 342
742# define T_SIZEOF 343
743# define T_STATIC 344
744# define T_STRUCT 345
745# define T_SWITCH 346
746# define T_TYPEDEF 347
747# define T_UNION 348
748# define T_UNSIGNED 349
749# define T_WHILE 350
750# define T_CONST 351
751# define T_ENUM 352
752# define T_SIGNED 353
753# define T_VOID 354
754# define T_VOLATILE 355
755# define T_ASM 356
756# define T_CATCH 357
757# define T_CLASS 358
758# define T_DELETE 359
759# define T_FRIEND 360
760# define T_INLINE 361
761# define T_NEW 362
762# define T_OPERATOR 363
763# define T_OVERLOAD 364
764# define T_PRIVATE 365
765# define T_PROTECTED 366
766# define T_PUBLIC 367
767# define T_TEMPLATE 368
768# define T_THIS 369
769# define T_THROW 370
770# define T_TRY 371
771# define T_VIRTUAL 372
772# define T_NOISES 373
773# define T_NOISE 374
774# define T_X_GROUP 375
775# define T_X_LINE 376
776# define T_X_STATEMENT 377
777# define T_ASSERT 400
778# define T_ASSUME 401
779# define T_IN 402
780# define T_PROMISE 403
781# define T_WHERE 404
782# define T_ALL 405
783# define T_SOME 406
784# define T_LANNO_DELIMITER 407
785# define T_RANNO_DELIMITER 408
786# define T_USERTYPE 409
787# define T_LOWEST_PRECEDENCE 410
788
789# line 146 "parser.y"
790#include <pp.h>
791/* take 1 out of next comment for 4096 drop of format = .................. */
792/* 23456789 */
793#ifdef YYDEBUG
794/**/
795print_trace(char* format, ...)
796{
797    va_list ap;
798
799    va_start(ap, format);
800    error(parser_tracing, "%:", format, ap);\t/*  %: descriptor says that
801\t\t\t\t\t\t**  format and va_list follow
802\t\t\t\t\t\t*/
803    va_end(ap);
804}
805#endif  /* YYDEBUG */'
806		OUTPUT - $'extern __MANGLE__ char *malloc(__VARARG__), *realloc(__VARARG__);
807
808# line 2 "parser.y"
809
810#include <ast.h>
811
812/************************************************************************
813*\t\t\t\t\t\t\t\t\t*
814*    David S. Rosenblum\t\t\t\t\t\t\t*
815*    AT&T Bell Laboratories\t\t\t\t\t\t*
816*    MH 3C-541\t\t\t\t\t\t\t\t*
817*    ulysses!dsr\t\t\t\t\t\t\t*
818*\t\t\t\t\t\t\t\t\t*
819*************************************************************************
820*\t\t\t\t\t\t\t\t\t*
821*\tYACC SPECIFICATION OF PARSER FOR APP TOOL\t\t\t*
822*\tVersion 2.00\t\t\t\t\t\t\t*
823*\t\t\t\t\t\t\t\t\t*
824************************************************************************/
825
826#include <error.h>
827#include <stdio.h>
828#include <hash.h>
829
830/*  pp.h is included just before the first %%, to avoid warning messages
831**  however we need hash.h (which is included by pp.h) now, for following
832**  #include\'s:
833*/
834
835#include <app.h>
836#include <typetbl.h>
837#include <symbol.h>
838#include <output.h>
839#include <state.h>
840#include <cctypes.h>
841#include <pdecls.h>\t/*  The declarations section is in pdecls.h,
842\t\t\t**  so that proto doesn\'t get confused.
843\t\t\t*/
844
845# line 39 "parser.y"
846typedef union  {
847    struct token_type* ltoken;
848    T1WORD             exptype;
849    BOOL\t       success;
850    int\t\t       count;
851    SIZE\t       expval;
852    struct {
853\tint\t      count;
854\tOUTFILE_KIND  okval;
855    }\t\t       inexpr;
856    struct {
857\tstruct token_type* ltoken;
858\tT1WORD\t\t   exptype;
859    }\t\t       exptoken;
860    struct {
861\tunsigned long\t   star_count;
862\tunsigned long\t   const_star_flags;
863    } star_specs;
864} YYSTYPE;
865# define T_DOUBLE 292
866# define T_DOUBLE_L 293
867# define T_FLOAT 294
868# define T_DECIMAL 288
869# define T_DECIMAL_L 289
870# define T_DECIMAL_U 290
871# define T_DECIMAL_UL 291
872# define T_OCTAL 296
873# define T_OCTAL_L 297
874# define T_OCTAL_U 298
875# define T_OCTAL_UL 299
876# define T_HEXADECIMAL 304
877# define T_HEXADECIMAL_L 305
878# define T_HEXADECIMAL_U 306
879# define T_HEXADECIMAL_UL 307
880# define T_ID 257
881# define T_INVALID 258
882# define T_CHARCONST 260
883# define T_WCHARCONST 261
884# define T_STRING 262
885# define T_WSTRING 263
886# define T_PTRMEM 264
887# define T_ADDADD 265
888# define T_SUBSUB 266
889# define T_LSHIFT 267
890# define T_RSHIFT 268
891# define T_LE 269
892# define T_GE 270
893# define T_EQ 271
894# define T_NE 272
895# define T_ANDAND 273
896# define T_OROR 274
897# define T_MPYEQ 275
898# define T_DIVEQ 276
899# define T_MODEQ 277
900# define T_ADDEQ 278
901# define T_SUBEQ 279
902# define T_LSHIFTEQ 280
903# define T_RSHIFTEQ 281
904# define T_ANDEQ 282
905# define T_XOREQ 283
906# define T_OREQ 284
907# define T_VARIADIC 286
908# define T_DOTREF 320
909# define T_PTRMEMREF 321
910# define T_SCOPE 322
911# define T_UMINUS 323
912# define T_AUTO 324
913# define T_BREAK 325
914# define T_CASE 326
915# define T_CHAR 327
916# define T_CONTINUE 328
917# define T_DEFAULT 329
918# define T_DO 330
919# define T_DOUBLE_T 331
920# define T_ELSE 332
921# define T_EXTERN 333
922# define T_FLOAT_T 334
923# define T_FOR 335
924# define T_GOTO 336
925# define T_IF 337
926# define T_INT 338
927# define T_LONG 339
928# define T_REGISTER 340
929# define T_RETURN 341
930# define T_SHORT 342
931# define T_SIZEOF 343
932# define T_STATIC 344
933# define T_STRUCT 345
934# define T_SWITCH 346
935# define T_TYPEDEF 347
936# define T_UNION 348
937# define T_UNSIGNED 349
938# define T_WHILE 350
939# define T_CONST 351
940# define T_ENUM 352
941# define T_SIGNED 353
942# define T_VOID 354
943# define T_VOLATILE 355
944# define T_ASM 356
945# define T_CATCH 357
946# define T_CLASS 358
947# define T_DELETE 359
948# define T_FRIEND 360
949# define T_INLINE 361
950# define T_NEW 362
951# define T_OPERATOR 363
952# define T_OVERLOAD 364
953# define T_PRIVATE 365
954# define T_PROTECTED 366
955# define T_PUBLIC 367
956# define T_TEMPLATE 368
957# define T_THIS 369
958# define T_THROW 370
959# define T_TRY 371
960# define T_VIRTUAL 372
961# define T_NOISES 373
962# define T_NOISE 374
963# define T_X_GROUP 375
964# define T_X_LINE 376
965# define T_X_STATEMENT 377
966# define T_ASSERT 400
967# define T_ASSUME 401
968# define T_IN 402
969# define T_PROMISE 403
970# define T_WHERE 404
971# define T_ALL 405
972# define T_SOME 406
973# define T_LANNO_DELIMITER 407
974# define T_RANNO_DELIMITER 408
975# define T_USERTYPE 409
976# define T_LOWEST_PRECEDENCE 410
977
978# line 146 "parser.y"
979#include <pp.h>
980/* take 1 out of next comment for 4096 drop of format = .................. */
981/* 23456789 */
982#ifdef YYDEBUG
983/**/
984print_trace __PARAM__((char* format, ...), (va_alist)) __OTORP__(va_dcl)
985{ __OTORP__(char* format; )
986#line 152
987
988    va_list ap;
989
990    __VA_START__(ap, format); __OTORP__(format = va_arg(ap, char* );)
991    error(parser_tracing, "%:", format, ap);\t/*  %: descriptor says that
992\t\t\t\t\t\t**  format and va_list follow
993\t\t\t\t\t\t*/
994    va_end(ap);
995}
996#endif  /* YYDEBUG */'
997	EXEC -nh
998		INPUT - $'#pragma prototyped
999disp_form(pkt)
1000register packet *pkt;
1001{
1002        /* FUNCTION STUB */
1003
1004    long atol();
1005    char *rjust(), *foo(), *ptr, *atime(), *disp_stfdit();
1006    int i;
1007
1008    return(0);
1009}'
1010		OUTPUT - $'
1011disp_form(pkt)
1012register packet *pkt;
1013{
1014        /* FUNCTION STUB */
1015
1016    long atol(__VARARG__);
1017    char *rjust(__VARARG__), *foo(__VARARG__), *ptr, *atime(__VARARG__), *disp_stfdit(__VARARG__);
1018    int i;
1019
1020    return(0);
1021}'
1022	EXEC -nh
1023		INPUT - $'#pragma prototyped
1024disp_form(pkt)
1025register packet *pkt;
1026{
1027        /* FUNCTION STUB */
1028
1029    long atol();
1030    extern char *fubar(int, int,int);
1031    char *rjust(int), *foo(int), *ptr, *atime(int), *disp_stfdit(int);
1032    int i;
1033
1034    return(0);
1035}'
1036		OUTPUT - $'
1037disp_form(pkt)
1038register packet *pkt;
1039{
1040        /* FUNCTION STUB */
1041
1042    long atol(__VARARG__);
1043    extern __MANGLE__ char *fubar __PROTO__((int, int,int));
1044    char *rjust __PROTO__((int)), *foo __PROTO__((int)), *ptr, *atime __PROTO__((int)), *disp_stfdit __PROTO__((int));
1045    int i;
1046
1047    return(0);
1048}'
1049	EXEC -nh
1050		INPUT - $'#pragma prototyped
1051
1052static Exid_t\t\tsymbols[] =
1053{
1054\tID,\t   BUILTIN(B_CLOCK),\tT_ELAPSED,
1055\tID,\t   BUILTIN(B_STATE),\t0,
1056\tID,\t   BUILTIN(B_DATE),\tT_DATE,
1057\tDECLARE,   T_DATE,\t\tT_DATE,
1058};'
1059		OUTPUT - $'
1060
1061static Exid_t\t\tsymbols[] =
1062{
1063\tID,\t   BUILTIN(B_CLOCK),\tT_ELAPSED,
1064\tID,\t   BUILTIN(B_STATE),\t0,
1065\tID,\t   BUILTIN(B_DATE),\tT_DATE,
1066\tDECLARE,   T_DATE,\t\tT_DATE,
1067};'
1068	EXEC -nh
1069		INPUT - $'#pragma prototyped
1070void Tfreehelper (void *p) {
1071    Ttable_t *tp;
1072    Tkvlist_t *kvlp;
1073    int i;
1074
1075    /* must be a table */
1076    tp = (Ttable_t *) p;
1077    for (i = 0; i < tp->ln; i++) {
1078        if ((kvlp = tp->lp[i])) {
1079            ((Mheader_t *) kvlp)->size = M_BYTE2SIZE (T_KVLISTSIZE (kvlp->n));
1080            Mfree (kvlp);
1081        }
1082    }
1083    ((Mheader_t *) tp->lp)->size = M_BYTE2SIZE (tp->ln * T_KVLISTPTRSIZE);
1084    Mfree (tp->lp);
1085}'
1086		OUTPUT - $'
1087void Tfreehelper  __PARAM__((__V_ *p), (p)) __OTORP__(__V_ *p;)
1088#line 2
1089{
1090    Ttable_t *tp;
1091    Tkvlist_t *kvlp;
1092    int i;
1093
1094    /* must be a table */
1095    tp = (Ttable_t *) p;
1096    for (i = 0; i < tp->ln; i++) {
1097        if ((kvlp = tp->lp[i])) {
1098            ((Mheader_t *) kvlp)->size = M_BYTE2SIZE (T_KVLISTSIZE (kvlp->n));
1099            Mfree (kvlp);
1100        }
1101    }
1102    ((Mheader_t *) tp->lp)->size = M_BYTE2SIZE (tp->ln * T_KVLISTPTRSIZE);
1103    Mfree (tp->lp);
1104}'
1105	EXEC -nh
1106		INPUT - $'#pragma prototyped
1107static void scalarstr (Tobj to) {
1108    switch (Tgettype (to)) {
1109    case T_INTEGER:
1110        appendi (Tgetinteger (to));
1111        break;
1112    case T_REAL:
1113        appends (to), appendd (Tgetreal (to));
1114        break;
1115    case T_STRING:
1116        appends ("\\""), appends (Tgetstring (to)), appends ("\\"");
1117        break;
1118    case T_CODE:
1119        codestr (to, 0);
1120        break;
1121    }
1122}'
1123		OUTPUT - $'
1124static void scalarstr  __PARAM__((Tobj to), (to)) __OTORP__(Tobj to;)
1125#line 2
1126{
1127    switch (Tgettype (to)) {
1128    case T_INTEGER:
1129        appendi (Tgetinteger (to));
1130        break;
1131    case T_REAL:
1132        appends (to), appendd (Tgetreal (to));
1133        break;
1134    case T_STRING:
1135        appends ("\\""), appends (Tgetstring (to)), appends ("\\"");
1136        break;
1137    case T_CODE:
1138        codestr (to, 0);
1139        break;
1140    }
1141}'
1142	EXEC -nh
1143		INPUT - $'#pragma prototyped
1144/*
1145 * G. S. Fowler
1146 * D. G. Korn
1147 * AT&T Bell Laboratories
1148 *
1149 * shell library support
1150 */
1151
1152#include <ast.h>
1153
1154/*
1155 * return pointer to the full path name of the shell
1156 *
1157 * SHELL is read from the environment and must start with /
1158 *
1159 * if set-uid or set-gid then the executable and its containing
1160 * directory must not be writable by the real user
1161 *
1162 * /bin/sh is returned by default
1163 *
1164 * NOTE: csh is rejected because the bsh/csh differentiation is
1165 *       not done for `csh script arg ...\'
1166 */
1167
1168char*
1169getshell(void)
1170{
1171\tregister char*\ts;
1172\tregister char*\tsh;
1173\tregister int\ti;
1174
1175\tif ((sh = getenv("SHELL")) && *sh == \'/\' && strmatch(sh, "*/(sh|*[!cC]sh)"))
1176\t{
1177\t\tif (!(i = getuid()))
1178\t\t{
1179\t\t\tif (!strmatch(sh, "?(/usr)?(/local)/?(l)bin/?([a-z])sh")) goto defshell;
1180\t\t}
1181\t\telse if (i != geteuid() || getgid() != getegid())
1182\t\t{
1183\t\t\tif (!access(sh, 2)) goto defshell;
1184\t\t\ts = strrchr(sh, \'/\');
1185\t\t\t*s = 0;
1186\t\t\ti = access(sh, 2);
1187\t\t\t*s = \'/\';
1188\t\t\tif (!i) goto defshell;
1189\t\t}
1190\t\treturn(sh);
1191\t}
1192 defshell:
1193\treturn("/bin/sh");
1194}'
1195		OUTPUT - $'
1196/*
1197 * G. S. Fowler
1198 * D. G. Korn
1199 * AT&T Bell Laboratories
1200 *
1201 * shell library support
1202 */
1203
1204#include <ast.h>
1205
1206/*
1207 * return pointer to the full path name of the shell
1208 *
1209 * SHELL is read from the environment and must start with /
1210 *
1211 * if set-uid or set-gid then the executable and its containing
1212 * directory must not be writable by the real user
1213 *
1214 * /bin/sh is returned by default
1215 *
1216 * NOTE: csh is rejected because the bsh/csh differentiation is
1217 *       not done for `csh script arg ...\'
1218 */
1219
1220char*
1221getshell __PARAM__((void), ())
1222#line 28
1223{
1224\tregister char*\ts;
1225\tregister char*\tsh;
1226\tregister int\ti;
1227
1228\tif ((sh = getenv("SHELL")) && *sh == \'/\' && strmatch(sh, "*/(sh|*[!cC]sh)"))
1229\t{
1230\t\tif (!(i = getuid()))
1231\t\t{
1232\t\t\tif (!strmatch(sh, "?(/usr)?(/local)/?(l)bin/?([a-z])sh")) goto defshell;
1233\t\t}
1234\t\telse if (i != geteuid() || getgid() != getegid())
1235\t\t{
1236\t\t\tif (!access(sh, 2)) goto defshell;
1237\t\t\ts = strrchr(sh, \'/\');
1238\t\t\t*s = 0;
1239\t\t\ti = access(sh, 2);
1240\t\t\t*s = \'/\';
1241\t\t\tif (!i) goto defshell;
1242\t\t}
1243\t\treturn(sh);
1244\t}
1245 defshell:
1246\treturn("/bin/sh");
1247}'
1248	EXEC -nh
1249		INPUT - $'#pragma prototyped
1250/*
1251 * Glenn Fowler
1252 * AT&T Bell Laboratories
1253 *
1254 * single quote s into sp
1255 * if type!=0 then /<getenv(<CO_ENV_TYPE>)/ translated to /<CO_ENV_TYPE>/
1256 */
1257
1258#include "colib.h"
1259
1260void
1261coquote(register Sfio_t* sp, register const char* s, int type)
1262{
1263\tregister int\tc;
1264
1265\tstatic char*\tmatch;
1266
1267\tif (type)
1268\t{
1269\t\tif (!match && !(match = getenv(CO_ENV_TYPE))) match = "";
1270\t\tif (!*match) type = 0;
1271\t}
1272\twhile (c = *s++)
1273\t{
1274\t\tsfputc(sp, c);
1275\t\tif (c == \'\\\'\')
1276\t\t{
1277\t\t\tsfputc(sp, \'\\\\\');
1278\t\t\tsfputc(sp, \'\\\'\');
1279\t\t\tsfputc(sp, \'\\\'\');
1280\t\t}
1281\t\telse if (type && c == \'/\' && *s == *match)
1282\t\t{
1283\t\t\tregister const char*\tx = s;
1284\t\t\tregister char*\t\tt = match;
1285
1286\t\t\twhile (*t && *t++ == *x) x++;
1287\t\t\tif (!*t && *x == \'/\')
1288\t\t\t{
1289\t\t\t\ts = x;
1290\t\t\t\tsfprintf(sp, "\'$%s\'", CO_ENV_TYPE);
1291\t\t\t}
1292\t\t}
1293\t}
1294}'
1295		OUTPUT - $'
1296/*
1297 * Glenn Fowler
1298 * AT&T Bell Laboratories
1299 *
1300 * single quote s into sp
1301 * if type!=0 then /<getenv(<CO_ENV_TYPE>)/ translated to /<CO_ENV_TYPE>/
1302 */
1303
1304#include "colib.h"
1305
1306void
1307coquote __PARAM__((register Sfio_t* sp, register const char* s, int type), (sp, s, type)) __OTORP__(register Sfio_t* sp; register const char* s; int type;)
1308#line 14
1309{
1310\tregister int\tc;
1311
1312\tstatic char*\tmatch;
1313
1314\tif (type)
1315\t{
1316\t\tif (!match && !(match = getenv(CO_ENV_TYPE))) match = "";
1317\t\tif (!*match) type = 0;
1318\t}
1319\twhile (c = *s++)
1320\t{
1321\t\tsfputc(sp, c);
1322\t\tif (c == \'\\\'\')
1323\t\t{
1324\t\t\tsfputc(sp, \'\\\\\');
1325\t\t\tsfputc(sp, \'\\\'\');
1326\t\t\tsfputc(sp, \'\\\'\');
1327\t\t}
1328\t\telse if (type && c == \'/\' && *s == *match)
1329\t\t{
1330\t\t\tregister const char*\tx = s;
1331\t\t\tregister char*\t\tt = match;
1332
1333\t\t\twhile (*t && *t++ == *x) x++;
1334\t\t\tif (!*t && *x == \'/\')
1335\t\t\t{
1336\t\t\t\ts = x;
1337\t\t\t\tsfprintf(sp, "\'$%s\'", CO_ENV_TYPE);
1338\t\t\t}
1339\t\t}
1340\t}
1341}'
1342	EXEC -nh
1343		INPUT - $'#pragma prototyped
1344
1345#include <stdarg.h>
1346
1347int error(int (*function)(int), char* format, ...)
1348{
1349\tva_list\tap;
1350
1351\tva_start(ap, format);
1352\toops(1,2);
1353\t(*call)(3, 4);
1354\tva_end(ap);
1355}'
1356		OUTPUT - $'
1357
1358#if !defined(va_start)
1359#if defined(__STDARG__)
1360#include <stdarg.h>
1361#else
1362#include <varargs.h>
1363#endif
1364#endif
1365
1366#line 3
1367
1368
1369int error __PARAM__((int (*function)(int), char* format, ...), (va_alist)) __OTORP__(va_dcl)
1370{ __OTORP__(int (*function)(); char* format; )
1371#line 6
1372
1373\tva_list\tap;
1374
1375\t__VA_START__(ap, format); __OTORP__(function = va_arg(ap, int (*)());format = va_arg(ap, char* );)
1376\toops(1,2);
1377\t(*call)(3, 4);
1378\tva_end(ap);
1379}'
1380	EXEC -nh
1381		INPUT - $'#pragma prototyped
1382
1383#if 1
1384int hello(int a)
1385#else
1386int hello(long a)
1387#endif
1388{
1389\treturn a != 0;
1390}'
1391		OUTPUT - $'
1392
1393#if 1
1394int hello __PARAM__((int a), (a)) __OTORP__(int a;)
1395#line 5
1396
1397#else
1398int hello __PARAM__((long a), (a)) __OTORP__(long a;)
1399#line 7
1400
1401#endif
1402{
1403\treturn a != 0;
1404}'
1405	EXEC -nh
1406		INPUT - $'#pragma prototyped
1407
1408#ifdef foo
1409NoN(foo)
1410#else
1411int hello(long a)
1412{
1413\treturn a != 0;
1414}
1415#endif'
1416		OUTPUT - $'
1417
1418#ifdef foo
1419NoN(foo)
1420#else
1421int hello __PARAM__((long a), (a)) __OTORP__(long a;)
1422#line 7
1423{
1424\treturn a != 0;
1425}
1426#endif'
1427	EXEC -nh
1428		INPUT - $'#pragma prototyped
1429
1430#ifdef foo
1431NoNo(long a, long b)
1432#else
1433int NoNo(long a)
1434#endif
1435{
1436\treturn a != 0;
1437}'
1438		OUTPUT - $'
1439
1440#ifdef foo
1441NoNo __PARAM__((long a, long b), (a, b)) __OTORP__(long a; long b;)
1442#line 5
1443
1444#else
1445int NoNo __PARAM__((long a), (a)) __OTORP__(long a;)
1446#line 7
1447
1448#endif
1449{
1450\treturn a != 0;
1451}'
1452	EXEC -nh
1453		INPUT - $'#pragma prototyped
1454
1455#include <stdarg.h>
1456
1457int error(int *function, char* format, ...)
1458{
1459\tva_list\tap;
1460
1461\tva_start(ap, format);
1462\tva_end(ap);
1463}'
1464		OUTPUT - $'
1465
1466#if !defined(va_start)
1467#if defined(__STDARG__)
1468#include <stdarg.h>
1469#else
1470#include <varargs.h>
1471#endif
1472#endif
1473
1474#line 3
1475
1476
1477int error __PARAM__((int *function, char* format, ...), (va_alist)) __OTORP__(va_dcl)
1478{ __OTORP__(int *function; char* format; )
1479#line 6
1480
1481\tva_list\tap;
1482
1483\t__VA_START__(ap, format); __OTORP__(function = va_arg(ap, int *);format = va_arg(ap, char* );)
1484\tva_end(ap);
1485}'
1486
1487TEST 03 'headers'
1488	EXEC -nh
1489		INPUT - $'#pragma prototyped
1490/*
1491 * K. P. Vo
1492 * AT&T Bell Laboratories
1493 *
1494 * sfio public definitions
1495 */
1496
1497#ifndef SF_READ\t\t/* protect against multiple #includes */
1498
1499#ifndef NULL
1500#define NULL\t0
1501#endif
1502#ifndef EOF
1503#define EOF\t(-1)
1504#endif
1505#ifndef SEEK_SET
1506#define SEEK_SET\t0
1507#define SEEK_CUR\t1
1508#define SEEK_END\t2
1509#endif
1510
1511typedef struct _sfdc_\tSfdisc_t;
1512typedef struct _sfio_\tSfile_t;
1513
1514#define SFIO\tSfile_t
1515#define SFDISC\tSfdisc_t
1516
1517/* discipline structure */
1518struct _sfdc_
1519{
1520\tint\t(*readf)(Sfile_t*, unsigned char*, int, char*);
1521\tint\t(*writef)(Sfile_t*, const unsigned char*, int, char*);
1522\tlong\t(*seekf)(Sfile_t*, long, int, char*);
1523\tint\t(*exceptf)(Sfile_t*, int, char*);
1524\tchar\t*handle;\t/* to store any state information\t*/
1525};
1526
1527/* a file structure */
1528struct _sfio_
1529{
1530\tunsigned char\t*next;\t/* next position to read/write from\t*/
1531\tunsigned char\t*endw;\t/* end of write buffer\t\t\t*/
1532\tunsigned char\t*endr;\t/* end of read buffer\t\t\t*/
1533\tunsigned char\t*endb;\t/* end of buffer\t\t\t*/
1534\tstruct _sfio_\t*push;\t/* the stream that was pushed on\t*/
1535\tshort\t\tflags;\t/* type of stream\t\t\t*/
1536\tshort\t\tfile;\t/* file descriptor\t\t\t*/
1537\tlong\t\torig;\t/* where we start in the file\t\t*/
1538#ifdef _SFIO_PRIVATE
1539\t_SFIO_PRIVATE
1540#endif
1541};
1542
1543/* bits for various types of files */
1544#define\tSF_READ\t\t000001\t/* open for reading\t\t\t*/
1545#define SF_WRITE\t000002\t/* open for writing\t\t\t*/
1546#define SF_STRING\t000004\t/* a string stream\t\t\t*/
1547#define SF_APPEND\t000010\t/* associated file is in append mode\t*/
1548#define SF_RELATIVE\t000020\t/* file pos is relative to starting pos\t*/
1549#define SF_MALLOC\t000040\t/* buffered space malloc-ed\t\t*/
1550#define SF_LINE\t\t000100\t/* line buffering\t\t\t*/
1551#define SF_KEEPFD\t000200\t/* keep file opened when closing stream\t*/
1552#define SF_SHARE\t000400\t/* file stream that is shared\t\t*/
1553#define SF_REUSE\t001000\t/* keep stream space after closing\t*/
1554#define SF_FLAGS\t000777\t/* PUBLIC FLAGS PASSABLE TO SFNEW()\t*/
1555#define SF_SETS\t\t001743\t/* flags passable to sfsetflag()\t*/
1556
1557#define SF_EOF\t\t002000\t/* eof was detected\t\t\t*/
1558#define SF_ERROR\t004000\t/* an error happened\t\t\t*/
1559
1560#define SF_BUFSIZE\t8192\t/* suggested default buffer size\t*/
1561#define SF_UNBOUND\t(-1)\t/* unbounded buffer size\t\t*/
1562
1563#define\tsfstdin\t\t(&_Sfstdin)\t/* standard input stream\t*/
1564#define\tsfstdout\t(&_Sfstdout)\t/* standard output stream\t*/
1565#define\tsfstderr\t(&_Sfstderr)\t/* standard error stream\t*/
1566
1567/* fast in-line functions */
1568#define sfputc(f,c)\t((f)->next >= (f)->endw ? \\
1569\t\t\t\t_sfflsbuf(f,(int)((unsigned char)(c))) : \\
1570\t\t\t\t(int)(*(f)->next++ = (unsigned char)(c)))
1571#define sfgetc(f)\t((f)->next >= (f)->endr ? _sffilbuf(f,1) : (int)(*(f)->next++))
1572#define sfslen()\t(_Sfi)
1573#define sffileno(f)\t((f)->file)
1574#define sforigin(f)\t(((f)->flags&SF_STRING) ? 0L : (f)->orig)
1575#define sfeof(f)\t(((f)->flags&(SF_EOF|SF_STRING)) && (f)->next >= (f)->endb)
1576#define sferror(f)\t((f)->flags&SF_ERROR)
1577#define sfclearerr(f)\t((f)->flags &= ~SF_ERROR)
1578#define sfpushed(f)\t((f)->push)
1579
1580#define sfpeek(f,bufp)\t(((bufp) || \\
1581\t\t\t  ((f)->flags&(SF_READ|SF_WRITE|SF_STRING)) == \\
1582\t\t\t   (SF_READ|SF_WRITE|SF_STRING)) ? _sfpeek(f,bufp) : \\
1583\t\t\t\t((f)->endb - (f)->next))
1584#define sfsync(f)\t(((f) && (((Sfile_t*)(f))->flags&SF_STRING)) ? 0 : _sfsync(f))
1585
1586/* coding long integers in a portable and compact fashion */
1587#define SF_SBITS\t6
1588#define SF_UBITS\t7
1589#define SF_SIGN\t\t(1 << SF_SBITS)
1590#define SF_MORE\t\t(1 << SF_UBITS)
1591#define SF_U1\t\tSF_MORE
1592#define SF_U2\t\t(SF_U1*SF_U1)
1593#define SF_U3\t\t(SF_U2*SF_U1)
1594#define SF_U4\t\t(SF_U3*SF_U1)
1595#define sfulen(v)\t((v) < SF_U1 ? 1 : (v) < SF_U2 ? 2 : \\
1596\t\t\t (v) < SF_U3 ? 3 : (v) < SF_U4 ? 4 : 5)
1597#define sfgetu(f)\t((_Sfi = sfgetc(f)) < 0 ? -1 : \\
1598\t\t\t\t((_Sfi&SF_MORE) ? _sfgetu(f) : (unsigned long)_Sfi))
1599#define sfgetl(f)\t((_Sfi = sfgetc(f)) < 0 ? -1 : \\
1600\t\t\t\t((_Sfi&(SF_MORE|SF_SIGN)) ? _sfgetl(f) : (long)_Sfi))
1601#define sfputu(f,v)\t_sfputu((f),(unsigned long)(v))
1602#define sfputl(f,v)\t_sfputl((f),(long)(v))
1603#define sfputd(f,v)\t_sfputd((f),(double)(v))
1604
1605#define sfecvt(v,n,d,s)\t_sfcvt((v),(n),(d),(s),1)
1606#define sffcvt(v,n,d,s)\t_sfcvt((v),(n),(d),(s),0)
1607
1608extern int\t\t_Sfi;
1609extern Sfile_t\t\t_Sfstdin, _Sfstdout, _Sfstderr;
1610
1611extern Sfile_t\t\t*sfnew(Sfile_t*, unsigned char*, int, int, int);
1612extern Sfile_t\t\t*sfopen(Sfile_t*, const char*, const char*);
1613extern Sfile_t\t\t*sfdopen(int, const char*);
1614extern Sfile_t\t\t*sfpopen(const char*, const char*, Sfile_t**);
1615extern Sfile_t\t\t*sfstack(Sfile_t*, Sfile_t*);
1616extern Sfile_t\t\t*sftmpfile(void);
1617extern int\t\t_sfflsbuf(Sfile_t*, int);
1618extern int\t\t_sffilbuf(Sfile_t*, int);
1619extern int\t\t_sfsync(Sfile_t*);
1620extern int\t\t_sfpeek(Sfile_t*, unsigned char**);
1621extern int\t\tsfclrlock(Sfile_t*);
1622extern unsigned char*\tsfsetbuf(Sfile_t*, unsigned char*, int);
1623extern Sfdisc_t*\tsfsetdisc(Sfile_t*,Sfdisc_t*);
1624extern int\t\tsfsetflag(Sfile_t*, int, int);
1625extern int\t\tsfpool(Sfile_t*, Sfile_t*, int);
1626extern int\t\tsfread(Sfile_t*, unsigned char*, int);
1627extern int\t\tsfwrite(Sfile_t*, const unsigned char*, int);
1628extern int\t\tsfmove(Sfile_t*, Sfile_t*, long, int);
1629extern int\t\tsfclose(Sfile_t*);
1630extern long\t\tsftell(Sfile_t*);
1631extern long\t\tsfseek(Sfile_t*, long, int);
1632extern int\t\tsfllen(long);
1633extern int\t\tsfdlen(double);
1634extern int\t\tsfputs(Sfile_t*, const char*, int);
1635extern char\t\t*sfgets(Sfile_t*, char*, int);
1636extern int\t\tsfnputc(Sfile_t*, unsigned char, int);
1637extern int\t\t_sfputu(Sfile_t*, unsigned long);
1638extern int\t\t_sfputl(Sfile_t*, long);
1639extern long\t\t_sfgetl(Sfile_t*);
1640extern unsigned long\t_sfgetu(Sfile_t*);
1641extern long\t\t_sfgetl(Sfile_t*);
1642extern int\t\t_sfputd(Sfile_t*, double);
1643extern double\t\tsfgetd(Sfile_t*);
1644extern int\t\tsfungetc(Sfile_t*, int);
1645extern char\t\t*_sfcvt(double, int, int*, int*, int);
1646extern int\t\tsfprintf(Sfile_t*, const char*, ...);
1647extern int\t\tsfsprintf(char*, int, const char*, ...);
1648extern int\t\tsfscanf(Sfile_t*, const char*, ...);
1649extern int\t\tsfsscanf(const char*, const char*, ...);
1650extern Sfile_t*\t\tsfstring(Sfile_t*);
1651extern int\t\tsfvprintf(Sfile_t*, const char*, va_list);
1652extern int\t\tsfvscanf(Sfile_t*, const char*, va_list);
1653
1654#endif /* SF_READ */'
1655		OUTPUT - $'
1656/*
1657 * K. P. Vo
1658 * AT&T Bell Laboratories
1659 *
1660 * sfio public definitions
1661 */
1662
1663#ifndef SF_READ\t\t/* protect against multiple #includes */
1664
1665#ifndef NULL
1666#define NULL\t0
1667#endif
1668#ifndef EOF
1669#define EOF\t(-1)
1670#endif
1671#ifndef SEEK_SET
1672#define SEEK_SET\t0
1673#define SEEK_CUR\t1
1674#define SEEK_END\t2
1675#endif
1676
1677typedef struct _sfdc_\tSfdisc_t;
1678typedef struct _sfio_\tSfile_t;
1679
1680#define SFIO\tSfile_t
1681#define SFDISC\tSfdisc_t
1682
1683/* discipline structure */
1684struct _sfdc_
1685{
1686\tint\t(*readf) __PROTO__((Sfile_t*, unsigned char*, int, char*));
1687\tint\t(*writef) __PROTO__((Sfile_t*, const unsigned char*, int, char*));
1688\tlong\t(*seekf) __PROTO__((Sfile_t*, long, int, char*));
1689\tint\t(*exceptf) __PROTO__((Sfile_t*, int, char*));
1690\tchar\t*handle;\t/* to store any state information\t*/
1691};
1692
1693/* a file structure */
1694struct _sfio_
1695{
1696\tunsigned char\t*next;\t/* next position to read/write from\t*/
1697\tunsigned char\t*endw;\t/* end of write buffer\t\t\t*/
1698\tunsigned char\t*endr;\t/* end of read buffer\t\t\t*/
1699\tunsigned char\t*endb;\t/* end of buffer\t\t\t*/
1700\tstruct _sfio_\t*push;\t/* the stream that was pushed on\t*/
1701\tshort\t\tflags;\t/* type of stream\t\t\t*/
1702\tshort\t\tfile;\t/* file descriptor\t\t\t*/
1703\tlong\t\torig;\t/* where we start in the file\t\t*/
1704#ifdef _SFIO_PRIVATE
1705\t_SFIO_PRIVATE
1706#endif
1707};
1708
1709/* bits for various types of files */
1710#define\tSF_READ\t\t000001\t/* open for reading\t\t\t*/
1711#define SF_WRITE\t000002\t/* open for writing\t\t\t*/
1712#define SF_STRING\t000004\t/* a string stream\t\t\t*/
1713#define SF_APPEND\t000010\t/* associated file is in append mode\t*/
1714#define SF_RELATIVE\t000020\t/* file pos is relative to starting pos\t*/
1715#define SF_MALLOC\t000040\t/* buffered space malloc-ed\t\t*/
1716#define SF_LINE\t\t000100\t/* line buffering\t\t\t*/
1717#define SF_KEEPFD\t000200\t/* keep file opened when closing stream\t*/
1718#define SF_SHARE\t000400\t/* file stream that is shared\t\t*/
1719#define SF_REUSE\t001000\t/* keep stream space after closing\t*/
1720#define SF_FLAGS\t000777\t/* PUBLIC FLAGS PASSABLE TO SFNEW()\t*/
1721#define SF_SETS\t\t001743\t/* flags passable to sfsetflag()\t*/
1722
1723#define SF_EOF\t\t002000\t/* eof was detected\t\t\t*/
1724#define SF_ERROR\t004000\t/* an error happened\t\t\t*/
1725
1726#define SF_BUFSIZE\t8192\t/* suggested default buffer size\t*/
1727#define SF_UNBOUND\t(-1)\t/* unbounded buffer size\t\t*/
1728
1729#define\tsfstdin\t\t(&_Sfstdin)\t/* standard input stream\t*/
1730#define\tsfstdout\t(&_Sfstdout)\t/* standard output stream\t*/
1731#define\tsfstderr\t(&_Sfstderr)\t/* standard error stream\t*/
1732
1733/* fast in-line functions */
1734#define sfputc(f,c)\t((f)->next >= (f)->endw ? \\
1735\t\t\t\t_sfflsbuf(f,(int)((unsigned char)(c))) : \\
1736\t\t\t\t(int)(*(f)->next++ = (unsigned char)(c)))
1737#define sfgetc(f)\t((f)->next >= (f)->endr ? _sffilbuf(f,1) : (int)(*(f)->next++))
1738#define sfslen()\t(_Sfi)
1739#define sffileno(f)\t((f)->file)
1740#define sforigin(f)\t(((f)->flags&SF_STRING) ? 0L : (f)->orig)
1741#define sfeof(f)\t(((f)->flags&(SF_EOF|SF_STRING)) && (f)->next >= (f)->endb)
1742#define sferror(f)\t((f)->flags&SF_ERROR)
1743#define sfclearerr(f)\t((f)->flags &= ~SF_ERROR)
1744#define sfpushed(f)\t((f)->push)
1745
1746#define sfpeek(f,bufp)\t(((bufp) || \\
1747\t\t\t  ((f)->flags&(SF_READ|SF_WRITE|SF_STRING)) == \\
1748\t\t\t   (SF_READ|SF_WRITE|SF_STRING)) ? _sfpeek(f,bufp) : \\
1749\t\t\t\t((f)->endb - (f)->next))
1750#define sfsync(f)\t(((f) && (((Sfile_t*)(f))->flags&SF_STRING)) ? 0 : _sfsync(f))
1751
1752/* coding long integers in a portable and compact fashion */
1753#define SF_SBITS\t6
1754#define SF_UBITS\t7
1755#define SF_SIGN\t\t(1 << SF_SBITS)
1756#define SF_MORE\t\t(1 << SF_UBITS)
1757#define SF_U1\t\tSF_MORE
1758#define SF_U2\t\t(SF_U1*SF_U1)
1759#define SF_U3\t\t(SF_U2*SF_U1)
1760#define SF_U4\t\t(SF_U3*SF_U1)
1761#define sfulen(v)\t((v) < SF_U1 ? 1 : (v) < SF_U2 ? 2 : \\
1762\t\t\t (v) < SF_U3 ? 3 : (v) < SF_U4 ? 4 : 5)
1763#define sfgetu(f)\t((_Sfi = sfgetc(f)) < 0 ? -1 : \\
1764\t\t\t\t((_Sfi&SF_MORE) ? _sfgetu(f) : (unsigned long)_Sfi))
1765#define sfgetl(f)\t((_Sfi = sfgetc(f)) < 0 ? -1 : \\
1766\t\t\t\t((_Sfi&(SF_MORE|SF_SIGN)) ? _sfgetl(f) : (long)_Sfi))
1767#define sfputu(f,v)\t_sfputu((f),(unsigned long)(v))
1768#define sfputl(f,v)\t_sfputl((f),(long)(v))
1769#define sfputd(f,v)\t_sfputd((f),(double)(v))
1770
1771#define sfecvt(v,n,d,s)\t_sfcvt((v),(n),(d),(s),1)
1772#define sffcvt(v,n,d,s)\t_sfcvt((v),(n),(d),(s),0)
1773
1774extern __MANGLE__ int\t\t_Sfi;
1775extern __MANGLE__ Sfile_t\t\t_Sfstdin, _Sfstdout, _Sfstderr;
1776
1777extern __MANGLE__ Sfile_t\t\t*sfnew __PROTO__((Sfile_t*, unsigned char*, int, int, int));
1778extern __MANGLE__ Sfile_t\t\t*sfopen __PROTO__((Sfile_t*, const char*, const char*));
1779extern __MANGLE__ Sfile_t\t\t*sfdopen __PROTO__((int, const char*));
1780extern __MANGLE__ Sfile_t\t\t*sfpopen __PROTO__((const char*, const char*, Sfile_t**));
1781extern __MANGLE__ Sfile_t\t\t*sfstack __PROTO__((Sfile_t*, Sfile_t*));
1782extern __MANGLE__ Sfile_t\t\t*sftmpfile __PROTO__((void));
1783extern __MANGLE__ int\t\t_sfflsbuf __PROTO__((Sfile_t*, int));
1784extern __MANGLE__ int\t\t_sffilbuf __PROTO__((Sfile_t*, int));
1785extern __MANGLE__ int\t\t_sfsync __PROTO__((Sfile_t*));
1786extern __MANGLE__ int\t\t_sfpeek __PROTO__((Sfile_t*, unsigned char**));
1787extern __MANGLE__ int\t\tsfclrlock __PROTO__((Sfile_t*));
1788extern __MANGLE__ unsigned char*\tsfsetbuf __PROTO__((Sfile_t*, unsigned char*, int));
1789extern __MANGLE__ Sfdisc_t*\tsfsetdisc __PROTO__((Sfile_t*,Sfdisc_t*));
1790extern __MANGLE__ int\t\tsfsetflag __PROTO__((Sfile_t*, int, int));
1791extern __MANGLE__ int\t\tsfpool __PROTO__((Sfile_t*, Sfile_t*, int));
1792extern __MANGLE__ int\t\tsfread __PROTO__((Sfile_t*, unsigned char*, int));
1793extern __MANGLE__ int\t\tsfwrite __PROTO__((Sfile_t*, const unsigned char*, int));
1794extern __MANGLE__ int\t\tsfmove __PROTO__((Sfile_t*, Sfile_t*, long, int));
1795extern __MANGLE__ int\t\tsfclose __PROTO__((Sfile_t*));
1796extern __MANGLE__ long\t\tsftell __PROTO__((Sfile_t*));
1797extern __MANGLE__ long\t\tsfseek __PROTO__((Sfile_t*, long, int));
1798extern __MANGLE__ int\t\tsfllen __PROTO__((long));
1799extern __MANGLE__ int\t\tsfdlen __PROTO__((double));
1800extern __MANGLE__ int\t\tsfputs __PROTO__((Sfile_t*, const char*, int));
1801extern __MANGLE__ char\t\t*sfgets __PROTO__((Sfile_t*, char*, int));
1802extern __MANGLE__ int\t\tsfnputc __PROTO__((Sfile_t*, unsigned char, int));
1803extern __MANGLE__ int\t\t_sfputu __PROTO__((Sfile_t*, unsigned long));
1804extern __MANGLE__ int\t\t_sfputl __PROTO__((Sfile_t*, long));
1805extern __MANGLE__ long\t\t_sfgetl __PROTO__((Sfile_t*));
1806extern __MANGLE__ unsigned long\t_sfgetu __PROTO__((Sfile_t*));
1807extern __MANGLE__ long\t\t_sfgetl __PROTO__((Sfile_t*));
1808extern __MANGLE__ int\t\t_sfputd __PROTO__((Sfile_t*, double));
1809extern __MANGLE__ double\t\tsfgetd __PROTO__((Sfile_t*));
1810extern __MANGLE__ int\t\tsfungetc __PROTO__((Sfile_t*, int));
1811extern __MANGLE__ char\t\t*_sfcvt __PROTO__((double, int, int*, int*, int));
1812extern __MANGLE__ int\t\tsfprintf __PROTO__((Sfile_t*, const char*, ...));
1813extern __MANGLE__ int\t\tsfsprintf __PROTO__((char*, int, const char*, ...));
1814extern __MANGLE__ int\t\tsfscanf __PROTO__((Sfile_t*, const char*, ...));
1815extern __MANGLE__ int\t\tsfsscanf __PROTO__((const char*, const char*, ...));
1816extern __MANGLE__ Sfile_t*\t\tsfstring __PROTO__((Sfile_t*));
1817extern __MANGLE__ int\t\tsfvprintf __PROTO__((Sfile_t*, const char*, va_list));
1818extern __MANGLE__ int\t\tsfvscanf __PROTO__((Sfile_t*, const char*, va_list));
1819
1820#endif /* SF_READ */'
1821	EXEC -nh
1822		INPUT - $'#pragma prototyped
1823
1824extern int\terrcount;\t\t/* level>=ERROR_ERROR count\t*/
1825extern int\terrno;\t\t\t/* system call error status\t*/
1826
1827extern void\terror(int, ...);
1828extern void\tliberror(char*, int, ...);
1829extern void*\tseterror(int, ...);
1830extern void\tverror(char*, int, va_list);
1831
1832extern int\tftwalk(char*, int (*)(struct FTW*), int, int (*)(struct FTW*, struct FTW*));
1833
1834int
1835ftwalk(char* file, int (*userf)(struct FTW*), int flags, int (*comparf)(struct FTW*, struct FTW*))
1836{
1837\tfunction(0);
1838\treturn(0);
1839}
1840
1841void
1842test()
1843{
1844\tint\t(*fun)(char*, int);
1845
1846\treturn((*fun)("", 0));
1847}'
1848		OUTPUT - $'
1849
1850extern __MANGLE__ int\terrcount;\t\t/* level>=ERROR_ERROR count\t*/
1851extern __MANGLE__ int\terrno;\t\t\t/* system call error status\t*/
1852
1853extern __MANGLE__ void\terror __PROTO__((int, ...));
1854extern __MANGLE__ void\tliberror __PROTO__((char*, int, ...));
1855extern __MANGLE__ __V_*\tseterror __PROTO__((int, ...));
1856extern __MANGLE__ void\tverror __PROTO__((char*, int, va_list));
1857
1858extern __MANGLE__ int\tftwalk __PROTO__((char*, int (*)(struct FTW*), int, int (*)(struct FTW*, struct FTW*)));
1859
1860int
1861ftwalk __PARAM__((char* file, int (*userf)(struct FTW*), int flags, int (*comparf)(struct FTW*, struct FTW*)), (file, userf, flags, comparf)) __OTORP__(char* file; int (*userf)(); int flags; int (*comparf)();)
1862#line 15
1863{
1864\tfunction(0);
1865\treturn(0);
1866}
1867
1868void
1869test()
1870{
1871\tint\t(*fun) __PROTO__((char*, int));
1872
1873\treturn((*fun)("", 0));
1874}'
1875	EXEC -nh
1876		INPUT - $'#pragma prototyped
1877
1878/*
1879 * 02/20/91 not processed correctly yet
1880 */
1881
1882f()
1883{
1884\tx = ((void(*)(int)))b;
1885\tx(a, ((void(*)(int)))b, c);
1886}'
1887		OUTPUT - $'
1888
1889/*
1890 * 02/20/91 not processed correctly yet
1891 */
1892
1893f()
1894{
1895\tx = ((void(*)(int)))b;
1896\tx(a, ((void(*)(int)))b, c);
1897}'
1898	EXEC -nh
1899		INPUT - $'#pragma prototyped
1900static void (*signal)(void (*handler)(int))
1901{
1902\tcall(*p);
1903}'
1904		OUTPUT - $'
1905static void (*signal) __PARAM__((void (*handler)(int)), (handler)) __OTORP__(void (*handler)();)
1906#line 3
1907{
1908\tcall(*p);
1909}'
1910	EXEC -nh
1911		INPUT - $'#pragma prototyped
1912typedef void (*SH_SIGTYPE)(int,void(*)(int));'
1913		OUTPUT - $'
1914typedef void (*SH_SIGTYPE) __PROTO__((int,void(*)(int)));'
1915	EXEC -nh
1916		INPUT - $'#pragma prototyped
1917/*
1918 * Main program for various posix programs
1919 */
1920
1921#define str(x)\t#x
1922#define string(x)\tstr(x)
1923#define paste(a,b)\ta##b
1924#define fun_name(x)\tpaste(b_,x)
1925
1926#if !lint
1927  static const char id[]="
1928@(#)"string(PROG)" (AT&T Bell Laboratories) "__DATE__"
1929";
1930#endif
1931
1932main(int argc, char *argv[])
1933{
1934\texit(fun_name(PROG)(argc,argv));
1935}'
1936		OUTPUT - $'
1937/*
1938 * Main program for various posix programs
1939 */
1940
1941#if defined(__STDC__) || defined(__STDPP__)
1942#define str(x)\t#x
1943#else
1944#define str(x)"x"
1945#endif
1946
1947#line 7
1948#define string(x)\tstr(x)
1949#if defined(__STDC__) || defined(__STDPP__)
1950#define paste(a,b)\ta##b
1951#else
1952#define paste(a,b)\ta/**/b
1953#endif
1954
1955#line 9
1956#define fun_name(x)\tpaste(b_,x)
1957
1958#if !lint
1959  static const char id[]="
1960@(#)"string(PROG)" (AT&T Bell Laboratories) "__DATE__"
1961";
1962#endif
1963
1964main __PARAM__((int argc, char *argv[]), (argc, argv)) __OTORP__(int argc; char *argv[];)
1965#line 18
1966{
1967\texit(fun_name(PROG)(argc,argv));
1968}'
1969
1970TEST 04 'more headers'
1971	EXEC -nh
1972		INPUT - $'#pragma prototyped
1973/*
1974 * Advanced Software Technology Department
1975 * AT&T Bell Laboratories
1976 *
1977 * libast miscellaneous interface definitions plus
1978 *
1979 *\t<limits.h>
1980 *\t<stddef.h>
1981 *\t<stdlib.h>
1982 *\t<sys/types.h>
1983 *\t<string.h>
1984 *\t<unistd.h>
1985 */
1986
1987#ifndef __AST_H__
1988#define __AST_H__
1989
1990#include <limits.h>
1991
1992struct stat;
1993struct _sfio_;
1994
1995#if defined(__STDC__) || defined(__cplusplus)
1996
1997#include <stddef.h>
1998#include <stdlib.h>
1999
2000#define strcopy\t\t_SYS_strcopy
2001#define strdup\t\t_SYS_strdup
2002#define strelapsed\t_SYS_strelapsed
2003#define strerror\t_SYS_strerror
2004#define stresc\t\t_SYS_stresc
2005#define streval\t\t_SYS_streval
2006#define strgid\t\t_SYS_strgid
2007#define strmatch\t_SYS_strmatch
2008#define strmode\t\t_SYS_strmode
2009#define stropt\t\t_SYS_stropt
2010#define strperm\t\t_SYS_strperm
2011#define strsignal\t_SYS_strsignal
2012#define strtape\t\t_SYS_strtape
2013#define strton\t\t_SYS_strton
2014#define struid\t\t_SYS_struid
2015
2016#include <string.h>
2017
2018#undef\tstrcopy
2019#undef\tstrdup
2020#undef\tstrelapsed
2021#undef\tstrerror
2022#undef\tstresc
2023#undef\tstreval
2024#undef\tstrgid
2025#undef\tstrmatch
2026#undef\tstrmode
2027#undef\tstropt
2028#undef\tstrperm
2029#undef\tstrsignal
2030#undef\tstrtape
2031#undef\tstrton
2032#undef\tstruid
2033
2034#else
2035
2036/* <stddef.h> */
2037
2038#ifndef _PTRDIFF_T
2039#define _PTRDIFF_T
2040typedef long ptrdiff_t;
2041#endif
2042
2043#ifndef _SIZE_T
2044#define _SIZE_T
2045typedef unsigned size_t;
2046#endif
2047
2048#ifndef _WCHAR_T
2049#define _WCHAR_T
2050typedef char wchar_t;
2051#endif
2052
2053#define offsetof(type,member) ((size_t)&(((type*)0)->member))
2054
2055/* <stdlib.h> */
2056
2057#define EXIT_FAILURE 1
2058#define EXIT_SUCCESS 0
2059#define MB_CUR_MAX 1
2060#define RAND_MAX 32767
2061
2062typedef struct
2063{
2064\tint quot;
2065\tint rem;
2066} div_t;
2067
2068typedef struct
2069{
2070\tlong quot;
2071\tlong rem;
2072} ldiv_t;
2073
2074extern double\t\tatof(const char*);
2075extern int\t\tatoi(const char*);
2076extern long\t\tatol(const char*);
2077extern double\t\tstrtod(const char*, char**);
2078extern long\t\tstrtol(const char*, char**, int);
2079extern unsigned long\tstrtoul(const char*, char**, int);
2080
2081extern int\t\trand(void);
2082extern void\t\tsrand(unsigned int);
2083
2084extern void*\t\tcalloc(size_t, size_t);
2085extern void\t\tfree(void*);
2086extern void*\t\tmalloc(size_t);
2087extern void*\t\trealloc(void*, size_t);
2088
2089extern void\t\tabort(void);
2090extern int\t\tatexit(void(*)(void));
2091extern void\t\texit(int);
2092extern char*\t\tgetenv(const char*);
2093extern int\t\tsystem(const char*);
2094
2095extern void*\t\tbsearch(const void*, const void*, size_t, size_t,
2096\t\t \t\tint(*)(const void*, const void*));
2097extern void\t\tqsort(void*, size_t, size_t,
2098\t\t\t\tint(*)(const void*, const void*));
2099
2100extern int\t\tabs(int);
2101extern div_t\t\tdiv(int, int);
2102extern long\t\tlabs(long);
2103extern ldiv_t\t\tldiv(long, long);
2104
2105extern int\t\tmblen(const char*, size_t);
2106extern int\t\tmbtowc(wchar_t*, const char*, size_t);
2107extern int\t\twctomb(char*, wchar_t);
2108extern size_t\t\tmbstowcs(wchar_t*, const char*, size_t);
2109extern size_t\t\twcstombs(char*, const wchar_t*, size_t);
2110
2111/* <string.h> */
2112
2113extern void*\t\tmemchr(const void*, int, size_t);
2114extern int\t\tmemcmp(const void*, const void*, size_t);
2115extern void*\t\tmemcpy(void*, const void*, size_t);
2116extern void*\t\tmemmove(void*, const void*, size_t);
2117extern void*\t\tmemset(void*, int, size_t);
2118extern char*\t\tstrcat(char*, const char*);
2119extern char*\t\tstrchr(const char*, int);
2120extern int\t\tstrcmp(const char*, const char*);
2121extern int\t\tstrcoll(const char*, const char*);
2122extern char*\t\tstrcpy(char*, const char*);
2123extern size_t\t\tstrcspn(const char*, const char*);
2124extern size_t\t\tstrlen(const char*);
2125extern char*\t\tstrncat(char*, const char*, size_t);
2126extern int\t\tstrncmp(const char*, const char*, size_t);
2127extern char*\t\tstrncpy(char*, const char*, size_t);
2128extern char*\t\tstrpbrk(const char*, const char*);
2129extern char*\t\tstrrchr(const char*, int);
2130extern size_t\t\tstrspn(const char*, const char*);
2131extern char*\t\tstrstr(const char*, const char*);
2132extern char*\t\tstrtok(char*, const char*);
2133extern size_t\t\tstrxfrm(char*, const char*, size_t);
2134
2135#endif
2136
2137#ifndef ptrdiff_t
2138#define _UNDEF_ptrdiff_t
2139#define ptrdiff_t\t_SYS_ptrdiff_t
2140#endif
2141#ifndef size_t
2142#define _UNDEF_size_t
2143#define size_t\t\t_SYS_size_t
2144#endif
2145#ifndef wchar_t
2146#define _UNDEF_wchar_t
2147#define wchar_t\t\t_SYS_wchar_t
2148#endif
2149
2150#include <sys/types.h>
2151
2152#ifdef\t_UNDEF_ptrdiff_t
2153#undef\t_UNDEF_ptrdiff_t
2154#undef\tptrdiff_t
2155#endif
2156#ifdef\t_UNDEF_size_t
2157#undef\t_UNDEF_size_t
2158#undef\tsize_t
2159#endif
2160#ifdef\t_UNDEF_wchar_t
2161#undef\t_UNDEF_wchar_t
2162#undef\twchar_t
2163#endif
2164
2165#if defined(__cplusplus) || defined(_POSIX_SOURCE)
2166
2167#include <unistd.h>
2168
2169#else
2170
2171/* <unistd.h> */
2172
2173#include <ast.unistd.h>
2174
2175#define\tSTDIN_FILENO\t0
2176#define\tSTDOUT_FILENO\t1
2177#define\tSTDERR_FILENO\t2
2178
2179#ifndef NULL
2180#define\tNULL\t\t0
2181#endif
2182
2183#ifndef SEEK_SET
2184#define\tSEEK_SET\t0
2185#define\tSEEK_CUR\t1
2186#define\tSEEK_END\t2
2187#endif
2188
2189#ifndef\tF_OK
2190#define\tF_OK\t\t0
2191#define\tX_OK\t\t1
2192#define\tW_OK\t\t2
2193#define\tR_OK\t\t4
2194#endif
2195
2196extern void\t\t_exit(int);
2197extern int\t\taccess(const char*, int);
2198extern unsigned\t\talarm(unsigned);
2199extern int\t\tchdir(const char*);
2200extern int\t\tchown(const char*, int, int);
2201extern int\t\tclose(int);
2202extern int\t\tdup(int);
2203extern int\t\tdup2(int, int);
2204extern int\t\texecl(const char*, ...);
2205extern int\t\texecle(const char*, ...);
2206extern int\t\texeclp(const char*, ...);
2207extern int\t\texecv(const char*, char*[]);
2208extern int\t\texecve(const char*, char*[], char*[]);
2209extern int\t\texecvp(const char*, char*[]);
2210extern int\t\tfork(void);
2211extern long\t\tfpathconf(int, int);
2212extern char*\t\tgetcwd(char*, int);
2213extern int\t\tgetegid(void);
2214extern int\t\tgeteuid(void);
2215extern int\t\tgetgid(void);
2216extern int\t\tgetgroups(int, int[]);
2217extern char*\t\tgetlogin(void);
2218extern int\t\tgetpgrp(void);
2219extern int\t\tgetpid(void);
2220extern int\t\tgetppid(void);
2221extern int\t\tgetuid(void);
2222extern int\t\tisatty(int);
2223extern int\t\tlink(const char*, const char*);
2224extern long\t\tlseek(int, long, int);
2225extern long\t\tpathconf(const char*, int);
2226extern int\t\tpause(void);
2227extern int\t\tpipe(int[]);
2228extern int\t\tread(int, char*, unsigned int);
2229extern int\t\trmdir(const char*);
2230extern int\t\tsetgid(int);
2231extern int\t\tsetpgid(int, int);
2232extern int\t\tsetsid(void);
2233extern int\t\tsetuid(int);
2234extern unsigned\t\tsleep(unsigned int);
2235extern long\t\tsysconf(int);
2236extern int\t\ttcgetpgrp(int);
2237extern int\t\ttcsetpgrp(int, int);
2238extern char*\t\tttyname(int);
2239extern int\t\tunlink(const char*);
2240extern int\t\twrite(int, const char*, unsigned int);
2241
2242#endif
2243
2244/* ast */
2245
2246#include <sfio.h>
2247
2248#ifndef PATH_MAX
2249#define PATH_MAX\t1024
2250#endif
2251
2252/*
2253 * pathcanon() flags
2254 */
2255
2256#define PATH_PHYSICAL\t01
2257#define PATH_DOTDOT\t02
2258#define PATH_EXISTS\t04
2259
2260/*
2261 * pathaccess() flags
2262 */
2263
2264#define PATH_READ\t004
2265#define PATH_WRITE\t002
2266#define PATH_EXECUTE\t001
2267#define\tPATH_REGULAR\t010
2268#define PATH_ABSOLUTE\t020
2269
2270#define allocate(t,n,x)\t(t*)calloc(1,sizeof(t)*(n)+(x))
2271#define deallocate(p)\tfree((char*)(p))
2272#define elements(x)\t(sizeof(x)/sizeof(x[0]))
2273#define reallocate(p,t,n,x)\t(t*)realloc((char*)(p),sizeof(t)*(n)+(x))
2274#define round(x,y)\t(((x)+(y)-1)&~((y)-1))
2275#define streq(a,b)\t(*(a)==*(b)&&!strcmp(a,b))
2276
2277#define NOT_USED(x)\t(&x,1)
2278
2279extern int\t\tchresc(const char*, char**);
2280extern int\t\tcmdclose(int);
2281extern int\t\tcmdkill(int, int);
2282extern int\t\tcmdopen(const char*, char**, char**, int*, const char*);
2283extern int\t\tcmdrun(const char*, char**);
2284extern long\t\tcopy(int, int, int);
2285extern int\t\tctoi(const char*);
2286extern void\t\tcvtatoe(const char*, const char*, int);
2287extern void\t\tcvtetoa(const char*, const char*, int);
2288extern int\t\tfclex(int, int);
2289extern char*\t\tfmtbase(long, int, int);
2290extern char*\t\tfmtdev(struct stat*);
2291extern char*\t\tfmtelapsed(unsigned long, int);
2292extern char*\t\tfmtfs(struct stat*);
2293extern char*\t\tfmtgid(int);
2294extern char*\t\tfmtmatch(const char*);
2295extern char*\t\tfmtmode(int, int);
2296extern char*\t\tfmtperm(int);
2297extern char*\t\tfmtuid(int);
2298extern char*\t\tgetcwd(char*, int);
2299extern char*\t\tgetpath(void);
2300extern char*\t\tgetshell(void);
2301extern int\t\tgetsymlink(const char*, char*, int);
2302extern char*\t\tgetuniv(void);
2303extern void\t\thsort(char**, int, int(*)(const char*, const char*));
2304extern struct _sfio_*\tlexline(const char*, int, int*);
2305extern int\t\tlexscan(char*, char**, const char*, ...);
2306extern int\t\tlpstat(const char*, struct stat*);
2307extern char*\t\tmemdup(const char*, int);
2308extern char*\t\tpathaccess(char*, const char*, const char*, const char*, int);
2309extern char*\t\tpathcanon(char*, int);
2310extern char*\t\tpathcat(char*, const char*, int, const char*, const char*);
2311extern void\t\tpathcheck(const char*, const char*, const char*);
2312extern char*\t\tpathkey(char*, char*, const char*, const char*);
2313extern char*\t\tpathpath(char*, const char*, const char*, int);
2314extern char*\t\tpathprobe(char*, char*, const char*, const char*, int);
2315extern char*\t\tpathrepl(char*, const char*, const char*);
2316extern char*\t\tpathtemp(char*, const char*, const char*);
2317extern int\t\tputsymlink(const char*, const char*);
2318extern int\t\tquery(int, const char*, ...);
2319extern int\t\tsetcwd(const char*, char*);
2320extern int\t\tsetuniv(const char*);
2321extern int\t\tsigcritical(int);
2322extern char*\t\tstrcopy(char*, const char*);
2323extern char*\t\tstrdup(const char*);
2324extern unsigned long\tstrelapsed(const char*, char**, int);
2325extern char*\t\tstrerror(int);
2326extern int\t\tstresc(char*);
2327extern long\t\tstreval(const char*, char**, long(*)(const char*, char**));
2328extern int\t\tstrgid(const char*);
2329extern int\t\tstrmatch(const char*, const char*);
2330extern int\t\tstrmode(const char*);
2331extern int\t\tstropt(const char*, char*, int, int(*)(char*, char*, int, const char*), char*);
2332extern int\t\tstrperm(const char*, char**, int);
2333extern char*\t\tstrsignal(int);
2334extern char*\t\tstrtape(const char*, char**);
2335extern long\t\tstrton(const char*, char**, char*, int);
2336extern int\t\tstruid(const char*);
2337extern int\t\ttabindex(char*, int, char*);
2338extern char*\t\ttablook(char*, int, char*);
2339extern long\t\ttblocks(struct stat*);
2340extern char*\t\ttokopen(char*, int);
2341extern void\t\ttokclose(char*);
2342extern char*\t\ttokread(char*);
2343extern int\t\ttouch(const char*, time_t, time_t, int);
2344extern void\t\twinsize(int*, int*);
2345
2346#endif'
2347		OUTPUT - $'
2348/*
2349 * Advanced Software Technology Department
2350 * AT&T Bell Laboratories
2351 *
2352 * libast miscellaneous interface definitions plus
2353 *
2354 *\t<limits.h>
2355 *\t<stddef.h>
2356 *\t<stdlib.h>
2357 *\t<sys/types.h>
2358 *\t<string.h>
2359 *\t<unistd.h>
2360 */
2361
2362#ifndef __AST_H__
2363#define __AST_H__
2364
2365#include <limits.h>
2366
2367struct stat;
2368struct _sfio_;
2369
2370#if defined(__STDC__) || defined(__cplusplus)
2371
2372#include <stddef.h>
2373#include <stdlib.h>
2374
2375#define strcopy\t\t_SYS_strcopy
2376#define strdup\t\t_SYS_strdup
2377#define strelapsed\t_SYS_strelapsed
2378#define strerror\t_SYS_strerror
2379#define stresc\t\t_SYS_stresc
2380#define streval\t\t_SYS_streval
2381#define strgid\t\t_SYS_strgid
2382#define strmatch\t_SYS_strmatch
2383#define strmode\t\t_SYS_strmode
2384#define stropt\t\t_SYS_stropt
2385#define strperm\t\t_SYS_strperm
2386#define strsignal\t_SYS_strsignal
2387#define strtape\t\t_SYS_strtape
2388#define strton\t\t_SYS_strton
2389#define struid\t\t_SYS_struid
2390
2391#include <string.h>
2392
2393#undef\tstrcopy
2394#undef\tstrdup
2395#undef\tstrelapsed
2396#undef\tstrerror
2397#undef\tstresc
2398#undef\tstreval
2399#undef\tstrgid
2400#undef\tstrmatch
2401#undef\tstrmode
2402#undef\tstropt
2403#undef\tstrperm
2404#undef\tstrsignal
2405#undef\tstrtape
2406#undef\tstrton
2407#undef\tstruid
2408
2409#else
2410
2411/* <stddef.h> */
2412
2413#ifndef _PTRDIFF_T
2414#define _PTRDIFF_T
2415typedef long ptrdiff_t;
2416#endif
2417
2418#ifndef _SIZE_T
2419#define _SIZE_T
2420typedef unsigned size_t;
2421#endif
2422
2423#ifndef _WCHAR_T
2424#define _WCHAR_T
2425typedef char wchar_t;
2426#endif
2427
2428#define offsetof(type,member) ((size_t)&(((type*)0)->member))
2429
2430/* <stdlib.h> */
2431
2432#define EXIT_FAILURE 1
2433#define EXIT_SUCCESS 0
2434#define MB_CUR_MAX 1
2435#define RAND_MAX 32767
2436
2437typedef struct
2438{
2439\tint quot;
2440\tint rem;
2441} div_t;
2442
2443typedef struct
2444{
2445\tlong quot;
2446\tlong rem;
2447} ldiv_t;
2448
2449extern __MANGLE__ double\t\tatof __PROTO__((const char*));
2450extern __MANGLE__ int\t\tatoi __PROTO__((const char*));
2451extern __MANGLE__ long\t\tatol __PROTO__((const char*));
2452extern __MANGLE__ double\t\tstrtod __PROTO__((const char*, char**));
2453extern __MANGLE__ long\t\tstrtol __PROTO__((const char*, char**, int));
2454extern __MANGLE__ unsigned long\tstrtoul __PROTO__((const char*, char**, int));
2455
2456extern __MANGLE__ int\t\trand __PROTO__((void));
2457extern __MANGLE__ void\t\tsrand __PROTO__((unsigned int));
2458
2459extern __MANGLE__ __V_*\t\tcalloc __PROTO__((size_t, size_t));
2460extern __MANGLE__ void\t\tfree __PROTO__((__V_*));
2461extern __MANGLE__ __V_*\t\tmalloc __PROTO__((size_t));
2462extern __MANGLE__ __V_*\t\trealloc __PROTO__((__V_*, size_t));
2463
2464extern __MANGLE__ void\t\tabort __PROTO__((void));
2465extern __MANGLE__ int\t\tatexit __PROTO__((void(*)(void)));
2466extern __MANGLE__ void\t\texit __PROTO__((int));
2467extern __MANGLE__ char*\t\tgetenv __PROTO__((const char*));
2468extern __MANGLE__ int\t\tsystem __PROTO__((const char*));
2469
2470extern __MANGLE__ __V_*\t\tbsearch __PROTO__((const __V_*, const __V_*, size_t, size_t,
2471\t\t \t\tint(*)(const __V_*, const __V_*)));
2472extern __MANGLE__ void\t\tqsort __PROTO__((__V_*, size_t, size_t,
2473\t\t\t\tint(*)(const __V_*, const __V_*)));
2474
2475extern __MANGLE__ int\t\tabs __PROTO__((int));
2476extern __MANGLE__ div_t\t\tdiv __PROTO__((int, int));
2477extern __MANGLE__ long\t\tlabs __PROTO__((long));
2478extern __MANGLE__ ldiv_t\t\tldiv __PROTO__((long, long));
2479
2480extern __MANGLE__ int\t\tmblen __PROTO__((const char*, size_t));
2481extern __MANGLE__ int\t\tmbtowc __PROTO__((wchar_t*, const char*, size_t));
2482extern __MANGLE__ int\t\twctomb __PROTO__((char*, wchar_t));
2483extern __MANGLE__ size_t\t\tmbstowcs __PROTO__((wchar_t*, const char*, size_t));
2484extern __MANGLE__ size_t\t\twcstombs __PROTO__((char*, const wchar_t*, size_t));
2485
2486/* <string.h> */
2487
2488extern __MANGLE__ __V_*\t\tmemchr __PROTO__((const __V_*, int, size_t));
2489extern __MANGLE__ int\t\tmemcmp __PROTO__((const __V_*, const __V_*, size_t));
2490extern __MANGLE__ __V_*\t\tmemcpy __PROTO__((__V_*, const __V_*, size_t));
2491extern __MANGLE__ __V_*\t\tmemmove __PROTO__((__V_*, const __V_*, size_t));
2492extern __MANGLE__ __V_*\t\tmemset __PROTO__((__V_*, int, size_t));
2493extern __MANGLE__ char*\t\tstrcat __PROTO__((char*, const char*));
2494extern __MANGLE__ char*\t\tstrchr __PROTO__((const char*, int));
2495extern __MANGLE__ int\t\tstrcmp __PROTO__((const char*, const char*));
2496extern __MANGLE__ int\t\tstrcoll __PROTO__((const char*, const char*));
2497extern __MANGLE__ char*\t\tstrcpy __PROTO__((char*, const char*));
2498extern __MANGLE__ size_t\t\tstrcspn __PROTO__((const char*, const char*));
2499extern __MANGLE__ size_t\t\tstrlen __PROTO__((const char*));
2500extern __MANGLE__ char*\t\tstrncat __PROTO__((char*, const char*, size_t));
2501extern __MANGLE__ int\t\tstrncmp __PROTO__((const char*, const char*, size_t));
2502extern __MANGLE__ char*\t\tstrncpy __PROTO__((char*, const char*, size_t));
2503extern __MANGLE__ char*\t\tstrpbrk __PROTO__((const char*, const char*));
2504extern __MANGLE__ char*\t\tstrrchr __PROTO__((const char*, int));
2505extern __MANGLE__ size_t\t\tstrspn __PROTO__((const char*, const char*));
2506extern __MANGLE__ char*\t\tstrstr __PROTO__((const char*, const char*));
2507extern __MANGLE__ char*\t\tstrtok __PROTO__((char*, const char*));
2508extern __MANGLE__ size_t\t\tstrxfrm __PROTO__((char*, const char*, size_t));
2509
2510#endif
2511
2512#ifndef ptrdiff_t
2513#define _UNDEF_ptrdiff_t
2514#define ptrdiff_t\t_SYS_ptrdiff_t
2515#endif
2516#ifndef size_t
2517#define _UNDEF_size_t
2518#define size_t\t\t_SYS_size_t
2519#endif
2520#ifndef wchar_t
2521#define _UNDEF_wchar_t
2522#define wchar_t\t\t_SYS_wchar_t
2523#endif
2524
2525#include <sys/types.h>
2526
2527#ifdef\t_UNDEF_ptrdiff_t
2528#undef\t_UNDEF_ptrdiff_t
2529#undef\tptrdiff_t
2530#endif
2531#ifdef\t_UNDEF_size_t
2532#undef\t_UNDEF_size_t
2533#undef\tsize_t
2534#endif
2535#ifdef\t_UNDEF_wchar_t
2536#undef\t_UNDEF_wchar_t
2537#undef\twchar_t
2538#endif
2539
2540#if defined(__cplusplus) || defined(_POSIX_SOURCE)
2541
2542#include <unistd.h>
2543
2544#else
2545
2546/* <unistd.h> */
2547
2548#include <ast.unistd.h>
2549
2550#define\tSTDIN_FILENO\t0
2551#define\tSTDOUT_FILENO\t1
2552#define\tSTDERR_FILENO\t2
2553
2554#ifndef NULL
2555#define\tNULL\t\t0
2556#endif
2557
2558#ifndef SEEK_SET
2559#define\tSEEK_SET\t0
2560#define\tSEEK_CUR\t1
2561#define\tSEEK_END\t2
2562#endif
2563
2564#ifndef\tF_OK
2565#define\tF_OK\t\t0
2566#define\tX_OK\t\t1
2567#define\tW_OK\t\t2
2568#define\tR_OK\t\t4
2569#endif
2570
2571extern __MANGLE__ void\t\t_exit __PROTO__((int));
2572extern __MANGLE__ int\t\taccess __PROTO__((const char*, int));
2573extern __MANGLE__ unsigned\t\talarm __PROTO__((unsigned));
2574extern __MANGLE__ int\t\tchdir __PROTO__((const char*));
2575extern __MANGLE__ int\t\tchown __PROTO__((const char*, int, int));
2576extern __MANGLE__ int\t\tclose __PROTO__((int));
2577extern __MANGLE__ int\t\tdup __PROTO__((int));
2578extern __MANGLE__ int\t\tdup2 __PROTO__((int, int));
2579extern __MANGLE__ int\t\texecl __PROTO__((const char*, ...));
2580extern __MANGLE__ int\t\texecle __PROTO__((const char*, ...));
2581extern __MANGLE__ int\t\texeclp __PROTO__((const char*, ...));
2582extern __MANGLE__ int\t\texecv __PROTO__((const char*, char*[]));
2583extern __MANGLE__ int\t\texecve __PROTO__((const char*, char*[], char*[]));
2584extern __MANGLE__ int\t\texecvp __PROTO__((const char*, char*[]));
2585extern __MANGLE__ int\t\tfork __PROTO__((void));
2586extern __MANGLE__ long\t\tfpathconf __PROTO__((int, int));
2587extern __MANGLE__ char*\t\tgetcwd __PROTO__((char*, int));
2588extern __MANGLE__ int\t\tgetegid __PROTO__((void));
2589extern __MANGLE__ int\t\tgeteuid __PROTO__((void));
2590extern __MANGLE__ int\t\tgetgid __PROTO__((void));
2591extern __MANGLE__ int\t\tgetgroups __PROTO__((int, int[]));
2592extern __MANGLE__ char*\t\tgetlogin __PROTO__((void));
2593extern __MANGLE__ int\t\tgetpgrp __PROTO__((void));
2594extern __MANGLE__ int\t\tgetpid __PROTO__((void));
2595extern __MANGLE__ int\t\tgetppid __PROTO__((void));
2596extern __MANGLE__ int\t\tgetuid __PROTO__((void));
2597extern __MANGLE__ int\t\tisatty __PROTO__((int));
2598extern __MANGLE__ int\t\tlink __PROTO__((const char*, const char*));
2599extern __MANGLE__ long\t\tlseek __PROTO__((int, long, int));
2600extern __MANGLE__ long\t\tpathconf __PROTO__((const char*, int));
2601extern __MANGLE__ int\t\tpause __PROTO__((void));
2602extern __MANGLE__ int\t\tpipe __PROTO__((int[]));
2603extern __MANGLE__ int\t\tread __PROTO__((int, char*, unsigned int));
2604extern __MANGLE__ int\t\trmdir __PROTO__((const char*));
2605extern __MANGLE__ int\t\tsetgid __PROTO__((int));
2606extern __MANGLE__ int\t\tsetpgid __PROTO__((int, int));
2607extern __MANGLE__ int\t\tsetsid __PROTO__((void));
2608extern __MANGLE__ int\t\tsetuid __PROTO__((int));
2609extern __MANGLE__ unsigned\t\tsleep __PROTO__((unsigned int));
2610extern __MANGLE__ long\t\tsysconf __PROTO__((int));
2611extern __MANGLE__ int\t\ttcgetpgrp __PROTO__((int));
2612extern __MANGLE__ int\t\ttcsetpgrp __PROTO__((int, int));
2613extern __MANGLE__ char*\t\tttyname __PROTO__((int));
2614extern __MANGLE__ int\t\tunlink __PROTO__((const char*));
2615extern __MANGLE__ int\t\twrite __PROTO__((int, const char*, unsigned int));
2616
2617#endif
2618
2619/* ast */
2620
2621#include <sfio.h>
2622
2623#ifndef PATH_MAX
2624#define PATH_MAX\t1024
2625#endif
2626
2627/*
2628 * pathcanon() flags
2629 */
2630
2631#define PATH_PHYSICAL\t01
2632#define PATH_DOTDOT\t02
2633#define PATH_EXISTS\t04
2634
2635/*
2636 * pathaccess() flags
2637 */
2638
2639#define PATH_READ\t004
2640#define PATH_WRITE\t002
2641#define PATH_EXECUTE\t001
2642#define\tPATH_REGULAR\t010
2643#define PATH_ABSOLUTE\t020
2644
2645#define allocate(t,n,x)\t(t*)calloc(1,sizeof(t)*(n)+(x))
2646#define deallocate(p)\tfree((char*)(p))
2647#define elements(x)\t(sizeof(x)/sizeof(x[0]))
2648#define reallocate(p,t,n,x)\t(t*)realloc((char*)(p),sizeof(t)*(n)+(x))
2649#define round(x,y)\t(((x)+(y)-1)&~((y)-1))
2650#define streq(a,b)\t(*(a)==*(b)&&!strcmp(a,b))
2651
2652#define NOT_USED(x)\t(&x,1)
2653
2654extern __MANGLE__ int\t\tchresc __PROTO__((const char*, char**));
2655extern __MANGLE__ int\t\tcmdclose __PROTO__((int));
2656extern __MANGLE__ int\t\tcmdkill __PROTO__((int, int));
2657extern __MANGLE__ int\t\tcmdopen __PROTO__((const char*, char**, char**, int*, const char*));
2658extern __MANGLE__ int\t\tcmdrun __PROTO__((const char*, char**));
2659extern __MANGLE__ long\t\tcopy __PROTO__((int, int, int));
2660extern __MANGLE__ int\t\tctoi __PROTO__((const char*));
2661extern __MANGLE__ void\t\tcvtatoe __PROTO__((const char*, const char*, int));
2662extern __MANGLE__ void\t\tcvtetoa __PROTO__((const char*, const char*, int));
2663extern __MANGLE__ int\t\tfclex __PROTO__((int, int));
2664extern __MANGLE__ char*\t\tfmtbase __PROTO__((long, int, int));
2665extern __MANGLE__ char*\t\tfmtdev __PROTO__((struct stat*));
2666extern __MANGLE__ char*\t\tfmtelapsed __PROTO__((unsigned long, int));
2667extern __MANGLE__ char*\t\tfmtfs __PROTO__((struct stat*));
2668extern __MANGLE__ char*\t\tfmtgid __PROTO__((int));
2669extern __MANGLE__ char*\t\tfmtmatch __PROTO__((const char*));
2670extern __MANGLE__ char*\t\tfmtmode __PROTO__((int, int));
2671extern __MANGLE__ char*\t\tfmtperm __PROTO__((int));
2672extern __MANGLE__ char*\t\tfmtuid __PROTO__((int));
2673extern __MANGLE__ char*\t\tgetcwd __PROTO__((char*, int));
2674extern __MANGLE__ char*\t\tgetpath __PROTO__((void));
2675extern __MANGLE__ char*\t\tgetshell __PROTO__((void));
2676extern __MANGLE__ int\t\tgetsymlink __PROTO__((const char*, char*, int));
2677extern __MANGLE__ char*\t\tgetuniv __PROTO__((void));
2678extern __MANGLE__ void\t\thsort __PROTO__((char**, int, int(*)(const char*, const char*)));
2679extern __MANGLE__ struct _sfio_*\tlexline __PROTO__((const char*, int, int*));
2680extern __MANGLE__ int\t\tlexscan __PROTO__((char*, char**, const char*, ...));
2681extern __MANGLE__ int\t\tlpstat __PROTO__((const char*, struct stat*));
2682extern __MANGLE__ char*\t\tmemdup __PROTO__((const char*, int));
2683extern __MANGLE__ char*\t\tpathaccess __PROTO__((char*, const char*, const char*, const char*, int));
2684extern __MANGLE__ char*\t\tpathcanon __PROTO__((char*, int));
2685extern __MANGLE__ char*\t\tpathcat __PROTO__((char*, const char*, int, const char*, const char*));
2686extern __MANGLE__ void\t\tpathcheck __PROTO__((const char*, const char*, const char*));
2687extern __MANGLE__ char*\t\tpathkey __PROTO__((char*, char*, const char*, const char*));
2688extern __MANGLE__ char*\t\tpathpath __PROTO__((char*, const char*, const char*, int));
2689extern __MANGLE__ char*\t\tpathprobe __PROTO__((char*, char*, const char*, const char*, int));
2690extern __MANGLE__ char*\t\tpathrepl __PROTO__((char*, const char*, const char*));
2691extern __MANGLE__ char*\t\tpathtemp __PROTO__((char*, const char*, const char*));
2692extern __MANGLE__ int\t\tputsymlink __PROTO__((const char*, const char*));
2693extern __MANGLE__ int\t\tquery __PROTO__((int, const char*, ...));
2694extern __MANGLE__ int\t\tsetcwd __PROTO__((const char*, char*));
2695extern __MANGLE__ int\t\tsetuniv __PROTO__((const char*));
2696extern __MANGLE__ int\t\tsigcritical __PROTO__((int));
2697extern __MANGLE__ char*\t\tstrcopy __PROTO__((char*, const char*));
2698extern __MANGLE__ char*\t\tstrdup __PROTO__((const char*));
2699extern __MANGLE__ unsigned long\tstrelapsed __PROTO__((const char*, char**, int));
2700extern __MANGLE__ char*\t\tstrerror __PROTO__((int));
2701extern __MANGLE__ int\t\tstresc __PROTO__((char*));
2702extern __MANGLE__ long\t\tstreval __PROTO__((const char*, char**, long(*)(const char*, char**)));
2703extern __MANGLE__ int\t\tstrgid __PROTO__((const char*));
2704extern __MANGLE__ int\t\tstrmatch __PROTO__((const char*, const char*));
2705extern __MANGLE__ int\t\tstrmode __PROTO__((const char*));
2706extern __MANGLE__ int\t\tstropt __PROTO__((const char*, char*, int, int(*)(char*, char*, int, const char*), char*));
2707extern __MANGLE__ int\t\tstrperm __PROTO__((const char*, char**, int));
2708extern __MANGLE__ char*\t\tstrsignal __PROTO__((int));
2709extern __MANGLE__ char*\t\tstrtape __PROTO__((const char*, char**));
2710extern __MANGLE__ long\t\tstrton __PROTO__((const char*, char**, char*, int));
2711extern __MANGLE__ int\t\tstruid __PROTO__((const char*));
2712extern __MANGLE__ int\t\ttabindex __PROTO__((char*, int, char*));
2713extern __MANGLE__ char*\t\ttablook __PROTO__((char*, int, char*));
2714extern __MANGLE__ long\t\ttblocks __PROTO__((struct stat*));
2715extern __MANGLE__ char*\t\ttokopen __PROTO__((char*, int));
2716extern __MANGLE__ void\t\ttokclose __PROTO__((char*));
2717extern __MANGLE__ char*\t\ttokread __PROTO__((char*));
2718extern __MANGLE__ int\t\ttouch __PROTO__((const char*, time_t, time_t, int));
2719extern __MANGLE__ void\t\twinsize __PROTO__((int*, int*));
2720
2721#endif'
2722	EXEC -nh
2723		INPUT - $'#pragma prototyped
2724
2725int (*_3d_sysent[])() = { _exit };'
2726		OUTPUT - $'
2727
2728int (*_3d_sysent[])(__VARARG__)= { _exit };'
2729	EXEC -nh
2730		INPUT - $'#pragma prototyped
2731
2732#define a\tz
2733#define q(s)\ta #s b
2734#define n(a,b)\tA a ## b Z
2735#define z\ta
2736#define H(s)\t"/usr/include" # s ".h"'
2737		OUTPUT - $'
2738
2739#define a\tz
2740#if defined(__STDC__) || defined(__STDPP__)
2741#define q(s)\ta #s b
2742#else
2743#define q(s)\ta"s"b
2744#endif
2745
2746#line 5
2747#if defined(__STDC__) || defined(__STDPP__)
2748#define n(a,b)\tA a ## b Z
2749#else
2750#define n(a,b)\tA a/**/b Z
2751#endif
2752
2753#line 6
2754#define z\ta
2755#if defined(__STDC__) || defined(__STDPP__)
2756#define H(s)\t"/usr/include" # s ".h"
2757#else
2758#define H(s)\t"/usr/include"s.h"
2759#endif
2760
2761#line 8'
2762	EXEC -nh
2763		INPUT - $'#pragma prototyped
2764f()
2765{
2766\ti = 1;
2767#ifdef XENIX
2768        if(ex_xenix(p))
2769#endif ;
2770\texecve(p, &t[0] ,xecenv);
2771}'
2772		OUTPUT - $'
2773f()
2774{
2775\ti = 1;
2776#ifdef XENIX
2777        if(ex_xenix(p))
2778#endif ;
2779\texecve(p, &t[0] ,xecenv);
2780}'
2781
2782TEST 05 'intermixed code'
2783	EXEC -nh
2784		INPUT - $'#pragma prototyped
2785/*
2786 *  edit.c - common routines for vi and emacs one line editors in shell
2787 *
2788 *   David Korn\t\t\t\tP.D. Sullivan
2789 *   AT&T Bell Laboratories\t\tAT&T Bell Laboratories
2790 *   Tel. x7975\t\t\t\tTel. x 2655
2791 *
2792 *   Coded April 1983.
2793 */
2794
2795#include\t<errno.h>
2796#include\t<ast.h>
2797#include\t<sfio.h>
2798#include\t<ctype.h>
2799#include\t"FEATURE/options"
2800#include\t"lexstates.h"
2801#include\t"path.h"
2802#include\t"FEATURE/sigrestart"
2803#include\t"FEATURE/select"
2804#include\t"FEATURE/time"
2805
2806#define MAXTRY\t12
2807#ifdef KSHELL
2808#   include\t"defs.h"
2809#   include\t"fault.h"
2810#   include\t"io.h"
2811#   include\t"terminal.h"
2812#   include\t"builtins.h"
2813#else
2814#   include\t"io.h"
2815#   include\t"terminal.h"
2816#   undef SIG_NORESTART
2817#   define SIG_NORESTART\t1
2818#   define _sobuf\ted_errbuf
2819    extern char ed_errbuf[];
2820    char e_version[] = "
2821@(#)Editlib version 01/31/92-alpha1\\0
2822";
2823#endif\t/* KSHELL */
2824#include\t"history.h"
2825#include\t"edit.h"
2826
2827#define BAD\t-1
2828#define GOOD\t0
2829#define\tTRUE\t(-1)
2830#define\tFALSE\t0
2831#define\tSYSERR\t-1
2832
2833#ifdef SHOPT_OLDTERMIO
2834#   undef tcgetattr
2835#   undef tcsetattr
2836#endif /* SHOPT_OLDTERMIO */
2837
2838#ifdef RT
2839#   define VENIX 1
2840#endif\t/* RT */
2841
2842#define lookahead\teditb.e_index
2843#define env\t\teditb.e_env
2844#define previous\teditb.e_lbuf
2845#define fildes\t\teditb.e_fd
2846
2847
2848#ifdef _hdr_sgtty
2849#   ifdef TIOCGETP
2850\tstatic int l_mask;
2851\tstatic struct tchars l_ttychars;
2852\tstatic struct ltchars l_chars;
2853\tstatic  char  l_changed;\t/* set if mode bits changed */
2854#\tdefine L_CHARS\t4
2855#\tdefine T_CHARS\t2
2856#\tdefine L_MASK\t1
2857#   endif /* TIOCGETP */
2858#endif /* _hdr_sgtty */
2859
2860#ifdef KSHELL
2861     static char macro[]\t= "_??";
2862#    define slowsig()\t(sh.trapnote&SH_SIGSLOW)
2863     static int keytrap(char*, int, int, int);
2864#else
2865     struct edit editb;
2866     extern int errno;
2867#    define slowsig()\t(0)
2868#endif\t/* KSHELL */
2869
2870
2871static struct termios savetty;
2872static int savefd = -1;
2873#ifdef future
2874    static int compare(const char*, const char*, int);
2875#endif  /* future */
2876#if SHOPT_VSH || SHOPT_ESH
2877    static struct termios ttyparm;\t/* initial tty parameters */
2878    static struct termios nttyparm;\t/* raw tty parameters */
2879    static char bellchr[] = "\\7";\t/* bell char */
2880    static char *overlay(char*,const char*);
2881#endif /* SHOPT_VSH || SHOPT_ESH */
2882
2883
2884/*
2885 * This routine returns true if fd refers to a terminal
2886 * This should be equivalent to isatty
2887 */
2888
2889int tty_check(int fd)
2890{
2891\tsavefd = -1;
2892\treturn(tty_get(fd,(struct termios*)0)==0);
2893}
2894
2895/*
2896 * Get the current terminal attributes
2897 * This routine remembers the attributes and just returns them if it
2898 *   is called again without an intervening tty_set()
2899 */
2900
2901int tty_get(int fd, struct termios *tty)
2902{
2903\tif(fd != savefd)
2904\t{
2905#ifndef SIG_NORESTART
2906\t\tvoid (*savint)() = sh.intfn;
2907\t\tsh.intfn = 0;
2908#endif\t/* SIG_NORESTART */
2909\t\twhile(tcgetattr(fd,&savetty) == SYSERR)
2910\t\t{
2911\t\t\tif(errno !=EINTR)
2912\t\t\t{
2913#ifndef SIG_NORESTART
2914\t\t\t\tsh.intfn = savint;
2915#endif\t/* SIG_NORESTART */
2916\t\t\t\treturn(SYSERR);
2917\t\t\t}
2918\t\t\terrno = 0;
2919\t\t}
2920#ifndef SIG_NORESTART
2921\t\tsh.intfn = savint;
2922#endif\t/* SIG_NORESTART */
2923\t\tsavefd = fd;
2924\t}
2925\tif(tty)
2926\t\t*tty = savetty;
2927\treturn(0);
2928}
2929
2930/*
2931 * Set the terminal attributes
2932 * If fd<0, then current attributes are invalidated
2933 */
2934
2935int tty_set(int fd, int action, struct termios *tty)
2936{
2937\tif(fd >=0)
2938\t{
2939#ifndef SIG_NORESTART
2940\t\tvoid (*savint)() = sh.intfn;
2941#endif\t/* SIG_NORESTART */
2942#ifdef future
2943\t\tif(savefd>=0 && compare(&savetty,tty,sizeof(struct termios)))
2944\t\t\treturn(0);
2945#endif
2946#ifndef SIG_NORESTART
2947\t\tsh.intfn = 0;
2948#endif\t/* SIG_NORESTART */
2949\t\twhile(tcsetattr(fd, action, tty) == SYSERR)
2950\t\t{
2951\t\t\tif(errno !=EINTR)
2952\t\t\t{
2953#ifndef SIG_NORESTART
2954\t\t\t\tsh.intfn = savint;
2955#endif\t/* SIG_NORESTART */
2956\t\t\t\treturn(SYSERR);
2957\t\t\t}
2958\t\t\terrno = 0;
2959\t\t}
2960#ifndef SIG_NORESTART
2961\t\tsh.intfn = savint;
2962#endif\t/* SIG_NORESTART */
2963\t\tsavetty = *tty;
2964\t}
2965\tsavefd = fd;
2966\treturn(0);
2967}
2968
2969#if SHOPT_ESH || SHOPT_VSH
2970/*{\tTTY_COOKED( fd )
2971 *
2972 *\tThis routine will set the tty in cooked mode.
2973 *\tIt is also called by error.done().
2974 *
2975}*/
2976
2977void tty_cooked(register int fd)
2978{
2979
2980\tif(editb.e_raw==0)
2981\t\treturn;
2982\tif(fd < 0)
2983\t\tfd = savefd;
2984#ifdef L_MASK
2985\t/* restore flags */
2986\tif(l_changed&L_MASK)
2987\t\tioctl(fd,TIOCLSET,&l_mask);
2988\tif(l_changed&T_CHARS)
2989\t\t/* restore alternate break character */
2990\t\tioctl(fd,TIOCSETC,&l_ttychars);
2991\tif(l_changed&L_CHARS)
2992\t\t/* restore alternate break character */
2993\t\tioctl(fd,TIOCSLTC,&l_chars);
2994\tl_changed = 0;
2995#endif\t/* L_MASK */
2996\t/*** don\'t do tty_set unless ttyparm has valid data ***/
2997\tif(savefd<0 || tty_set(fd, TCSANOW, &ttyparm) == SYSERR)
2998\t\treturn;
2999\teditb.e_raw = 0;
3000\treturn;
3001}
3002
3003/*{\tTTY_RAW( fd )
3004 *
3005 *\tThis routine will set the tty in raw mode.
3006 *
3007}*/
3008
3009tty_raw(register int fd)
3010{
3011#ifdef L_MASK
3012\tstruct ltchars lchars;
3013#endif\t/* L_MASK */
3014\tif(editb.e_raw==RAWMODE)
3015\t\treturn(GOOD);
3016#ifndef SHOPT_RAWONLY
3017\tif(editb.e_raw != ALTMODE)
3018#endif /* SHOPT_RAWONLY */
3019\t{
3020\t\tif(tty_get(fd,&ttyparm) == SYSERR)
3021\t\t\treturn(BAD);
3022\t}
3023#if  L_MASK || VENIX
3024\tif(!(ttyparm.sg_flags&ECHO) || (ttyparm.sg_flags&LCASE))
3025\t\treturn(BAD);
3026\tnttyparm = ttyparm;
3027\tnttyparm.sg_flags &= ~(ECHO | TBDELAY);
3028#   ifdef CBREAK
3029\tnttyparm.sg_flags |= CBREAK;
3030#   else
3031\tnttyparm.sg_flags |= RAW;
3032#   endif /* CBREAK */
3033\teditb.e_erase = ttyparm.sg_erase;
3034\teditb.e_kill = ttyparm.sg_kill;
3035\teditb.e_eof = cntl(\'D\');
3036\tif( tty_set(fd, TCSADRAIN, &nttyparm) == SYSERR )
3037\t\treturn(BAD);
3038\teditb.e_ttyspeed = (ttyparm.sg_ospeed>=B1200?FAST:SLOW);
3039#   ifdef TIOCGLTC
3040\t/* try to remove effect of ^V  and ^Y and ^O */
3041\tif(ioctl(fd,TIOCGLTC,&l_chars) != SYSERR)
3042\t{
3043\t\tlchars = l_chars;
3044\t\tlchars.t_lnextc = -1;
3045\t\tlchars.t_flushc = -1;
3046\t\tlchars.t_dsuspc = -1;\t/* no delayed stop process signal */
3047\t\tif(ioctl(fd,TIOCSLTC,&lchars) != SYSERR)
3048\t\t\tl_changed |= L_CHARS;
3049\t}
3050#   endif\t/* TIOCGLTC */
3051#else
3052
3053\tif (!(ttyparm.c_lflag & ECHO ))
3054\t\treturn(BAD);
3055
3056#   ifdef FLUSHO
3057\tttyparm.c_lflag &= ~FLUSHO;
3058#   endif /* FLUSHO */
3059\tnttyparm = ttyparm;
3060#  ifndef u370
3061\tnttyparm.c_iflag &= ~(IGNPAR|PARMRK|INLCR|IGNCR|ICRNL);
3062\tnttyparm.c_iflag |= BRKINT;
3063#   else
3064\tnttyparm.c_iflag &=
3065\t\t\t~(IGNBRK|PARMRK|INLCR|IGNCR|ICRNL|INPCK);
3066\tnttyparm.c_iflag |= (BRKINT|IGNPAR);
3067#   endif\t/* u370 */
3068\tnttyparm.c_lflag &= ~(ICANON|ECHO|ECHOK);
3069\tnttyparm.c_cc[VTIME] = 0;
3070\tnttyparm.c_cc[VMIN] = 1;
3071#   ifdef VDISCARD
3072\tnttyparm.c_cc[VDISCARD] = 0;
3073#   endif /* VDISCARD */
3074\teditb.e_eof = ttyparm.c_cc[VEOF];
3075\teditb.e_erase = ttyparm.c_cc[VERASE];
3076\teditb.e_kill = ttyparm.c_cc[VKILL];
3077\tif( tty_set(fd, TCSADRAIN, &nttyparm) == SYSERR )
3078\t\treturn(BAD);
3079\teditb.e_ttyspeed = (cfgetospeed(&ttyparm)>=B1200?FAST:SLOW);
3080#endif
3081\teditb.e_raw = RAWMODE;
3082\treturn(GOOD);
3083}
3084
3085#ifndef SHOPT_RAWONLY
3086
3087/*
3088 *
3089 *\tGet tty parameters and make ESC and \'\\r\' wakeup characters.
3090 *
3091 */
3092
3093#   ifdef TIOCGETC
3094tty_alt(register int fd)
3095{
3096\tint mask;
3097\tstruct tchars ttychars;
3098\tif(editb.e_raw==ALTMODE)
3099\t\treturn(GOOD);
3100\tif(editb.e_raw==RAWMODE)
3101\t\ttty_cooked(fd);
3102\tl_changed = 0;
3103\tif( editb.e_ttyspeed == 0)
3104\t{
3105\t\tif((tty_get(fd,&ttyparm) != SYSERR))
3106\t\t\teditb.e_ttyspeed = (ttyparm.sg_ospeed>=B1200?FAST:SLOW);
3107\t\teditb.e_raw = ALTMODE;
3108\t}
3109\tif(ioctl(fd,TIOCGETC,&l_ttychars) == SYSERR)
3110\t\treturn(BAD);
3111\tif(ioctl(fd,TIOCLGET,&l_mask)==SYSERR)
3112\t\treturn(BAD);
3113\tttychars = l_ttychars;
3114\tmask =  LCRTBS|LCRTERA|LCTLECH|LPENDIN|LCRTKIL;
3115\tif((l_mask|mask) != l_mask)
3116\t\tl_changed = L_MASK;
3117\tif(ioctl(fd,TIOCLBIS,&mask)==SYSERR)
3118\t\treturn(BAD);
3119\tif(ttychars.t_brkc!=ESC)
3120\t{
3121\t\tttychars.t_brkc = ESC;
3122\t\tl_changed |= T_CHARS;
3123\t\tif(ioctl(fd,TIOCSETC,&ttychars) == SYSERR)
3124\t\t\treturn(BAD);
3125\t}
3126\treturn(GOOD);
3127}
3128#   else
3129#\tifndef PENDIN
3130#\t    define PENDIN\t0
3131#\tendif /* PENDIN */
3132#\tifndef IEXTEN
3133#\t    define IEXTEN\t0
3134#\tendif /* IEXTEN */
3135
3136tty_alt(register int fd)
3137{
3138\tif(editb.e_raw==ALTMODE)
3139\t\treturn(GOOD);
3140\tif(editb.e_raw==RAWMODE)
3141\t\ttty_cooked(fd);
3142\tif((tty_get(fd, &ttyparm)==SYSERR) || (!(ttyparm.c_lflag&ECHO)))
3143\t\treturn(BAD);
3144#\tifdef FLUSHO
3145\t    ttyparm.c_lflag &= ~FLUSHO;
3146#\tendif /* FLUSHO */
3147\tnttyparm = ttyparm;
3148\teditb.e_eof = ttyparm.c_cc[VEOF];
3149#\tifdef ECHOCTL
3150\t    /* escape character echos as ^[ */
3151\t    nttyparm.c_lflag |= (ECHOE|ECHOK|ECHOCTL|PENDIN|IEXTEN);
3152\t    nttyparm.c_cc[VEOL2] = ESC;
3153#\telse
3154\t    /* switch VEOL2 and EOF, since EOF isn\'t echo\'d by driver */
3155\t    nttyparm.c_iflag &= ~(IGNCR|ICRNL);
3156\t    nttyparm.c_iflag |= INLCR;
3157\t    nttyparm.c_lflag |= (ECHOE|ECHOK);
3158\t    nttyparm.c_cc[VEOF] = ESC;\t/* make ESC the eof char */
3159\t    nttyparm.c_cc[VEOL] = \'\\r\';\t/* make CR an eol char */
3160\t    nttyparm.c_cc[VEOL2] = editb.e_eof;\t/* make EOF an eol char */
3161#\tendif /* ECHOCTL */
3162#\tifdef VWERASE
3163\t    nttyparm.c_cc[VWERASE] = cntl(\'W\');
3164#\tendif /* VWERASE */
3165#\tifdef VLNEXT
3166\t    nttyparm.c_cc[VLNEXT] = cntl(\'V\');
3167#\tendif /* VLNEXT */
3168\teditb.e_erase = ttyparm.c_cc[VERASE];
3169\teditb.e_kill = ttyparm.c_cc[VKILL];
3170\tif( tty_set(fd, TCSADRAIN, &nttyparm) == SYSERR )
3171\t\treturn(BAD);
3172\teditb.e_ttyspeed = (cfgetospeed(&ttyparm)>=B1200?FAST:SLOW);
3173\teditb.e_raw = ALTMODE;
3174\treturn(GOOD);
3175}
3176
3177#   endif /* TIOCGETC */
3178#endif\t/* SHOPT_RAWONLY */
3179
3180/*
3181 *\tE_WINDOW()
3182 *
3183 *\treturn the window size
3184 */
3185
3186int ed_window(void)
3187{
3188\tint\trows;
3189\tint\tcols = DFLTWINDOW-1;
3190\tregister char *cp = nv_strval(COLUMNS);
3191\tif(cp)
3192\t{
3193\t\tcols = atoi(cp)-1;
3194\t\tif(cols > MAXWINDOW)
3195\t\t\tcols = MAXWINDOW;
3196\t}
3197\twinsize(&rows,&cols);
3198\tif(cols < MINWINDOW)
3199\t\tcols = MINWINDOW;
3200\treturn(cols);
3201}
3202
3203/*\tE_FLUSH()
3204 *
3205 *\tFlush the output buffer.
3206 *
3207 */
3208
3209void ed_flush(void)
3210{
3211\tregister int n = editb.e_outptr-editb.e_outbase;
3212\tregister int fd = ERRIO;
3213\tif(n<=0)
3214\t\treturn;
3215\twrite(fd,editb.e_outbase,(unsigned)n);
3216\teditb.e_outptr = editb.e_outbase;
3217}
3218
3219/*
3220 * send the bell character ^G to the terminal
3221 */
3222
3223void ed_ringbell(void)
3224{
3225\twrite(ERRIO,bellchr,1);
3226}
3227
3228/*
3229 * send a carriage return line feed to the terminal
3230 */
3231
3232void ed_crlf(void)
3233{
3234#ifdef cray
3235\ted_putchar(\'\\r\');
3236#endif /* cray */
3237#ifdef u370
3238\ted_putchar(\'\\r\');
3239#endif\t/* u370 */
3240#ifdef VENIX
3241\ted_putchar(\'\\r\');
3242#endif /* VENIX */
3243\ted_putchar(\'\\n\');
3244\ted_flush();
3245}
3246
3247/*\tED_SETUP( max_prompt_size )
3248 *
3249 *\tThis routine sets up the prompt string
3250 *\tThe following is an unadvertised feature.
3251 *\t  Escape sequences in the prompt can be excluded from the calculated
3252 *\t  prompt length.  This is accomplished as follows:
3253 *\t  - if the prompt string starts with "%\\r, or contains \\r%\\r", where %
3254 *\t    represents any char, then % is taken to be the quote character.
3255 *\t  - strings enclosed by this quote character, and the quote character,
3256 *\t    are not counted as part of the prompt length.
3257 */
3258
3259void\ted_setup(int fd)
3260{
3261\tregister char *pp;
3262\tregister char *last;
3263\tchar *ppmax;
3264\tint myquote = 0;
3265\tint qlen = 1;
3266\tchar inquote = 0;
3267\teditb.e_fd = fd;
3268#ifdef KSHELL
3269\tif(!(last = sh.prompt))
3270\t\tlast = "";
3271\tsh.prompt = 0;
3272#else
3273\tlast = editb.e_prbuff;
3274#endif /* KSHELL */
3275\tif(sh.hist_ptr)
3276\t{
3277\t\tregister History_t *hp = sh.hist_ptr;
3278\t\teditb.e_hismax = hist_max(hp);
3279\t\teditb.e_hismin = hist_min(hp);
3280\t\teditb.e_hloff = 0;
3281\t}
3282\telse
3283\t{
3284\t\teditb.e_hismax = editb.e_hismin = editb.e_hloff = 0;
3285\t}
3286\teditb.e_hline = editb.e_hismax;
3287\teditb.e_wsize = ed_window()-2;
3288\teditb.e_crlf = YES;
3289\tpp = editb.e_prompt;
3290\tppmax = pp+PRSIZE-1;
3291\t*pp++ = \'\\r\';
3292\t{
3293\t\tregister int c;
3294\t\twhile(c= *last++) switch(c)
3295\t\t{
3296\t\t\tcase \'\\r\':
3297\t\t\t\tif(pp == (editb.e_prompt+2)) /* quote char */
3298\t\t\t\t\tmyquote = *(pp-1);
3299\t\t\t\t/*FALLTHROUGH*/
3300
3301\t\t\tcase \'\\n\':
3302\t\t\t\t/* start again */
3303\t\t\t\teditb.e_crlf = YES;
3304\t\t\t\tqlen = 1;
3305\t\t\t\tinquote = 0;
3306\t\t\t\tpp = editb.e_prompt+1;
3307\t\t\t\tbreak;
3308
3309\t\t\tcase \'\\t\':
3310\t\t\t\t/* expand tabs */
3311\t\t\t\twhile((pp-editb.e_prompt)%TABSIZE)
3312\t\t\t\t{
3313\t\t\t\t\tif(pp >= ppmax)
3314\t\t\t\t\t\tbreak;
3315\t\t\t\t\t*pp++ = \' \';
3316\t\t\t\t}
3317\t\t\t\tbreak;
3318
3319\t\t\tcase BELL:
3320\t\t\t\t/* cut out bells */
3321\t\t\t\tbreak;
3322
3323\t\t\tdefault:
3324\t\t\t\tif(c==myquote)
3325\t\t\t\t{
3326\t\t\t\t\tqlen += inquote;
3327\t\t\t\t\tinquote ^= 1;
3328\t\t\t\t}
3329\t\t\t\tif(pp < ppmax)
3330\t\t\t\t{
3331\t\t\t\t\tqlen += inquote;
3332\t\t\t\t\t*pp++ = c;
3333\t\t\t\t\tif(!inquote && !isprint(c))
3334\t\t\t\t\t\teditb.e_crlf = NO;
3335\t\t\t\t}
3336\t\t}
3337\t}
3338\teditb.e_plen = pp - editb.e_prompt - qlen;
3339\t*pp = 0;
3340\tif((editb.e_wsize -= editb.e_plen) < 7)
3341\t{
3342\t\tregister int shift = 7-editb.e_wsize;
3343\t\teditb.e_wsize = 7;
3344\t\tpp = editb.e_prompt+1;
3345\t\tstrcpy(pp,pp+shift);
3346\t\teditb.e_plen -= shift;
3347\t\tlast[-editb.e_plen-2] = \'\\r\';
3348\t}
3349\tsfsync(sfstderr);
3350\tqlen = sfpeek(sfstderr,&editb.e_outptr,SF_UNBOUND);
3351\tsfwrite(sfstderr,editb.e_outptr,0);
3352\teditb.e_outbase = editb.e_outptr;
3353\teditb.e_outlast = editb.e_outptr + qlen;
3354}
3355
3356#ifdef KSHELL
3357/*
3358 * look for edit macro named _i
3359 * if found, puts the macro definition into lookahead buffer and returns 1
3360 */
3361
3362ed_macro(register int i)
3363{
3364}
3365#endif /*KSHELL*/'
3366		OUTPUT - $'
3367/*
3368 *  edit.c - common routines for vi and emacs one line editors in shell
3369 *
3370 *   David Korn\t\t\t\tP.D. Sullivan
3371 *   AT&T Bell Laboratories\t\tAT&T Bell Laboratories
3372 *   Tel. x7975\t\t\t\tTel. x 2655
3373 *
3374 *   Coded April 1983.
3375 */
3376
3377#include\t<errno.h>
3378#include\t<ast.h>
3379#include\t<sfio.h>
3380#include\t<ctype.h>
3381#include\t"FEATURE/options"
3382#include\t"lexstates.h"
3383#include\t"path.h"
3384#include\t"FEATURE/sigrestart"
3385#include\t"FEATURE/select"
3386#include\t"FEATURE/time"
3387
3388#define MAXTRY\t12
3389#ifdef KSHELL
3390#   include\t"defs.h"
3391#   include\t"fault.h"
3392#   include\t"io.h"
3393#   include\t"terminal.h"
3394#   include\t"builtins.h"
3395#else
3396#   include\t"io.h"
3397#   include\t"terminal.h"
3398#   undef SIG_NORESTART
3399#   define SIG_NORESTART\t1
3400#   define _sobuf\ted_errbuf
3401    extern __MANGLE__ char ed_errbuf[];
3402    char e_version[] = "
3403@(#)Editlib version 01/31/92-alpha1\\0
3404";
3405#endif\t/* KSHELL */
3406#include\t"history.h"
3407#include\t"edit.h"
3408
3409#define BAD\t-1
3410#define GOOD\t0
3411#define\tTRUE\t(-1)
3412#define\tFALSE\t0
3413#define\tSYSERR\t-1
3414
3415#ifdef SHOPT_OLDTERMIO
3416#   undef tcgetattr
3417#   undef tcsetattr
3418#endif /* SHOPT_OLDTERMIO */
3419
3420#ifdef RT
3421#   define VENIX 1
3422#endif\t/* RT */
3423
3424#define lookahead\teditb.e_index
3425#define env\t\teditb.e_env
3426#define previous\teditb.e_lbuf
3427#define fildes\t\teditb.e_fd
3428
3429
3430#ifdef _hdr_sgtty
3431#   ifdef TIOCGETP
3432\tstatic int l_mask;
3433\tstatic struct tchars l_ttychars;
3434\tstatic struct ltchars l_chars;
3435\tstatic  char  l_changed;\t/* set if mode bits changed */
3436#\tdefine L_CHARS\t4
3437#\tdefine T_CHARS\t2
3438#\tdefine L_MASK\t1
3439#   endif /* TIOCGETP */
3440#endif /* _hdr_sgtty */
3441
3442#ifdef KSHELL
3443     static char macro[]\t= "_??";
3444#    define slowsig()\t(sh.trapnote&SH_SIGSLOW)
3445     static int keytrap __PROTO__((char*, int, int, int));
3446#else
3447     struct edit editb;
3448     extern __MANGLE__ int errno;
3449#    define slowsig()\t(0)
3450#endif\t/* KSHELL */
3451
3452
3453static struct termios savetty;
3454static int savefd = -1;
3455#ifdef future
3456    static int compare __PROTO__((const char*, const char*, int));
3457#endif  /* future */
3458#if SHOPT_VSH || SHOPT_ESH
3459    static struct termios ttyparm;\t/* initial tty parameters */
3460    static struct termios nttyparm;\t/* raw tty parameters */
3461    static char bellchr[] = "\\7";\t/* bell char */
3462    static char *overlay __PROTO__((char*,const char*));
3463#endif /* SHOPT_VSH || SHOPT_ESH */
3464
3465
3466/*
3467 * This routine returns true if fd refers to a terminal
3468 * This should be equivalent to isatty
3469 */
3470
3471int tty_check __PARAM__((int fd), (fd)) __OTORP__(int fd;)
3472#line 107
3473{
3474\tsavefd = -1;
3475\treturn(tty_get(fd,(struct termios*)0)==0);
3476}
3477
3478/*
3479 * Get the current terminal attributes
3480 * This routine remembers the attributes and just returns them if it
3481 *   is called again without an intervening tty_set()
3482 */
3483
3484int tty_get __PARAM__((int fd, struct termios *tty), (fd, tty)) __OTORP__(int fd; struct termios *tty;)
3485#line 119
3486{
3487\tif(fd != savefd)
3488\t{
3489#ifndef SIG_NORESTART
3490\t\tvoid (*savint)(__VARARG__)= sh.intfn;
3491\t\tsh.intfn = 0;
3492#endif\t/* SIG_NORESTART */
3493\t\twhile(tcgetattr(fd,&savetty) == SYSERR)
3494\t\t{
3495\t\t\tif(errno !=EINTR)
3496\t\t\t{
3497#ifndef SIG_NORESTART
3498\t\t\t\tsh.intfn = savint;
3499#endif\t/* SIG_NORESTART */
3500\t\t\t\treturn(SYSERR);
3501\t\t\t}
3502\t\t\terrno = 0;
3503\t\t}
3504#ifndef SIG_NORESTART
3505\t\tsh.intfn = savint;
3506#endif\t/* SIG_NORESTART */
3507\t\tsavefd = fd;
3508\t}
3509\tif(tty)
3510\t\t*tty = savetty;
3511\treturn(0);
3512}
3513
3514/*
3515 * Set the terminal attributes
3516 * If fd<0, then current attributes are invalidated
3517 */
3518
3519int tty_set __PARAM__((int fd, int action, struct termios *tty), (fd, action, tty)) __OTORP__(int fd; int action; struct termios *tty;)
3520#line 153
3521{
3522\tif(fd >=0)
3523\t{
3524#ifndef SIG_NORESTART
3525\t\tvoid (*savint)(__VARARG__)= sh.intfn;
3526#endif\t/* SIG_NORESTART */
3527#ifdef future
3528\t\tif(savefd>=0 && compare(&savetty,tty,sizeof(struct termios)))
3529\t\t\treturn(0);
3530#endif
3531#ifndef SIG_NORESTART
3532\t\tsh.intfn = 0;
3533#endif\t/* SIG_NORESTART */
3534\t\twhile(tcsetattr(fd, action, tty) == SYSERR)
3535\t\t{
3536\t\t\tif(errno !=EINTR)
3537\t\t\t{
3538#ifndef SIG_NORESTART
3539\t\t\t\tsh.intfn = savint;
3540#endif\t/* SIG_NORESTART */
3541\t\t\t\treturn(SYSERR);
3542\t\t\t}
3543\t\t\terrno = 0;
3544\t\t}
3545#ifndef SIG_NORESTART
3546\t\tsh.intfn = savint;
3547#endif\t/* SIG_NORESTART */
3548\t\tsavetty = *tty;
3549\t}
3550\tsavefd = fd;
3551\treturn(0);
3552}
3553
3554#if SHOPT_ESH || SHOPT_VSH
3555/*{\tTTY_COOKED( fd )
3556 *
3557 *\tThis routine will set the tty in cooked mode.
3558 *\tIt is also called by error.done().
3559 *
3560}*/
3561
3562void tty_cooked __PARAM__((register int fd), (fd)) __OTORP__(register int fd;)
3563#line 195
3564{
3565
3566\tif(editb.e_raw==0)
3567\t\treturn;
3568\tif(fd < 0)
3569\t\tfd = savefd;
3570#ifdef L_MASK
3571\t/* restore flags */
3572\tif(l_changed&L_MASK)
3573\t\tioctl(fd,TIOCLSET,&l_mask);
3574\tif(l_changed&T_CHARS)
3575\t\t/* restore alternate break character */
3576\t\tioctl(fd,TIOCSETC,&l_ttychars);
3577\tif(l_changed&L_CHARS)
3578\t\t/* restore alternate break character */
3579\t\tioctl(fd,TIOCSLTC,&l_chars);
3580\tl_changed = 0;
3581#endif\t/* L_MASK */
3582\t/*** don\'t do tty_set unless ttyparm has valid data ***/
3583\tif(savefd<0 || tty_set(fd, TCSANOW, &ttyparm) == SYSERR)
3584\t\treturn;
3585\teditb.e_raw = 0;
3586\treturn;
3587}
3588
3589/*{\tTTY_RAW( fd )
3590 *
3591 *\tThis routine will set the tty in raw mode.
3592 *
3593}*/
3594
3595tty_raw __PARAM__((register int fd), (fd)) __OTORP__(register int fd;)
3596#line 227
3597{
3598#ifdef L_MASK
3599\tstruct ltchars lchars;
3600#endif\t/* L_MASK */
3601\tif(editb.e_raw==RAWMODE)
3602\t\treturn(GOOD);
3603#ifndef SHOPT_RAWONLY
3604\tif(editb.e_raw != ALTMODE)
3605#endif /* SHOPT_RAWONLY */
3606\t{
3607\t\tif(tty_get(fd,&ttyparm) == SYSERR)
3608\t\t\treturn(BAD);
3609\t}
3610#if  L_MASK || VENIX
3611\tif(!(ttyparm.sg_flags&ECHO) || (ttyparm.sg_flags&LCASE))
3612\t\treturn(BAD);
3613\tnttyparm = ttyparm;
3614\tnttyparm.sg_flags &= ~(ECHO | TBDELAY);
3615#   ifdef CBREAK
3616\tnttyparm.sg_flags |= CBREAK;
3617#   else
3618\tnttyparm.sg_flags |= RAW;
3619#   endif /* CBREAK */
3620\teditb.e_erase = ttyparm.sg_erase;
3621\teditb.e_kill = ttyparm.sg_kill;
3622\teditb.e_eof = cntl(\'D\');
3623\tif( tty_set(fd, TCSADRAIN, &nttyparm) == SYSERR )
3624\t\treturn(BAD);
3625\teditb.e_ttyspeed = (ttyparm.sg_ospeed>=B1200?FAST:SLOW);
3626#   ifdef TIOCGLTC
3627\t/* try to remove effect of ^V  and ^Y and ^O */
3628\tif(ioctl(fd,TIOCGLTC,&l_chars) != SYSERR)
3629\t{
3630\t\tlchars = l_chars;
3631\t\tlchars.t_lnextc = -1;
3632\t\tlchars.t_flushc = -1;
3633\t\tlchars.t_dsuspc = -1;\t/* no delayed stop process signal */
3634\t\tif(ioctl(fd,TIOCSLTC,&lchars) != SYSERR)
3635\t\t\tl_changed |= L_CHARS;
3636\t}
3637#   endif\t/* TIOCGLTC */
3638#else
3639
3640\tif (!(ttyparm.c_lflag & ECHO ))
3641\t\treturn(BAD);
3642
3643#   ifdef FLUSHO
3644\tttyparm.c_lflag &= ~FLUSHO;
3645#   endif /* FLUSHO */
3646\tnttyparm = ttyparm;
3647#  ifndef u370
3648\tnttyparm.c_iflag &= ~(IGNPAR|PARMRK|INLCR|IGNCR|ICRNL);
3649\tnttyparm.c_iflag |= BRKINT;
3650#   else
3651\tnttyparm.c_iflag &=
3652\t\t\t~(IGNBRK|PARMRK|INLCR|IGNCR|ICRNL|INPCK);
3653\tnttyparm.c_iflag |= (BRKINT|IGNPAR);
3654#   endif\t/* u370 */
3655\tnttyparm.c_lflag &= ~(ICANON|ECHO|ECHOK);
3656\tnttyparm.c_cc[VTIME] = 0;
3657\tnttyparm.c_cc[VMIN] = 1;
3658#   ifdef VDISCARD
3659\tnttyparm.c_cc[VDISCARD] = 0;
3660#   endif /* VDISCARD */
3661\teditb.e_eof = ttyparm.c_cc[VEOF];
3662\teditb.e_erase = ttyparm.c_cc[VERASE];
3663\teditb.e_kill = ttyparm.c_cc[VKILL];
3664\tif( tty_set(fd, TCSADRAIN, &nttyparm) == SYSERR )
3665\t\treturn(BAD);
3666\teditb.e_ttyspeed = (cfgetospeed(&ttyparm)>=B1200?FAST:SLOW);
3667#endif
3668\teditb.e_raw = RAWMODE;
3669\treturn(GOOD);
3670}
3671
3672#ifndef SHOPT_RAWONLY
3673
3674/*
3675 *
3676 *\tGet tty parameters and make ESC and \'\\r\' wakeup characters.
3677 *
3678 */
3679
3680#   ifdef TIOCGETC
3681tty_alt __PARAM__((register int fd), (fd)) __OTORP__(register int fd;)
3682#line 312
3683{
3684\tint mask;
3685\tstruct tchars ttychars;
3686\tif(editb.e_raw==ALTMODE)
3687\t\treturn(GOOD);
3688\tif(editb.e_raw==RAWMODE)
3689\t\ttty_cooked(fd);
3690\tl_changed = 0;
3691\tif( editb.e_ttyspeed == 0)
3692\t{
3693\t\tif((tty_get(fd,&ttyparm) != SYSERR))
3694\t\t\teditb.e_ttyspeed = (ttyparm.sg_ospeed>=B1200?FAST:SLOW);
3695\t\teditb.e_raw = ALTMODE;
3696\t}
3697\tif(ioctl(fd,TIOCGETC,&l_ttychars) == SYSERR)
3698\t\treturn(BAD);
3699\tif(ioctl(fd,TIOCLGET,&l_mask)==SYSERR)
3700\t\treturn(BAD);
3701\tttychars = l_ttychars;
3702\tmask =  LCRTBS|LCRTERA|LCTLECH|LPENDIN|LCRTKIL;
3703\tif((l_mask|mask) != l_mask)
3704\t\tl_changed = L_MASK;
3705\tif(ioctl(fd,TIOCLBIS,&mask)==SYSERR)
3706\t\treturn(BAD);
3707\tif(ttychars.t_brkc!=ESC)
3708\t{
3709\t\tttychars.t_brkc = ESC;
3710\t\tl_changed |= T_CHARS;
3711\t\tif(ioctl(fd,TIOCSETC,&ttychars) == SYSERR)
3712\t\t\treturn(BAD);
3713\t}
3714\treturn(GOOD);
3715}
3716#   else
3717#\tifndef PENDIN
3718#\t    define PENDIN\t0
3719#\tendif /* PENDIN */
3720#\tifndef IEXTEN
3721#\t    define IEXTEN\t0
3722#\tendif /* IEXTEN */
3723
3724tty_alt __PARAM__((register int fd), (fd)) __OTORP__(register int fd;)
3725#line 354
3726{
3727\tif(editb.e_raw==ALTMODE)
3728\t\treturn(GOOD);
3729\tif(editb.e_raw==RAWMODE)
3730\t\ttty_cooked(fd);
3731\tif((tty_get(fd, &ttyparm)==SYSERR) || (!(ttyparm.c_lflag&ECHO)))
3732\t\treturn(BAD);
3733#\tifdef FLUSHO
3734\t    ttyparm.c_lflag &= ~FLUSHO;
3735#\tendif /* FLUSHO */
3736\tnttyparm = ttyparm;
3737\teditb.e_eof = ttyparm.c_cc[VEOF];
3738#\tifdef ECHOCTL
3739\t    /* escape character echos as ^[ */
3740\t    nttyparm.c_lflag |= (ECHOE|ECHOK|ECHOCTL|PENDIN|IEXTEN);
3741\t    nttyparm.c_cc[VEOL2] = ESC;
3742#\telse
3743\t    /* switch VEOL2 and EOF, since EOF isn\'t echo\'d by driver */
3744\t    nttyparm.c_iflag &= ~(IGNCR|ICRNL);
3745\t    nttyparm.c_iflag |= INLCR;
3746\t    nttyparm.c_lflag |= (ECHOE|ECHOK);
3747\t    nttyparm.c_cc[VEOF] = ESC;\t/* make ESC the eof char */
3748\t    nttyparm.c_cc[VEOL] = \'\\r\';\t/* make CR an eol char */
3749\t    nttyparm.c_cc[VEOL2] = editb.e_eof;\t/* make EOF an eol char */
3750#\tendif /* ECHOCTL */
3751#\tifdef VWERASE
3752\t    nttyparm.c_cc[VWERASE] = cntl(\'W\');
3753#\tendif /* VWERASE */
3754#\tifdef VLNEXT
3755\t    nttyparm.c_cc[VLNEXT] = cntl(\'V\');
3756#\tendif /* VLNEXT */
3757\teditb.e_erase = ttyparm.c_cc[VERASE];
3758\teditb.e_kill = ttyparm.c_cc[VKILL];
3759\tif( tty_set(fd, TCSADRAIN, &nttyparm) == SYSERR )
3760\t\treturn(BAD);
3761\teditb.e_ttyspeed = (cfgetospeed(&ttyparm)>=B1200?FAST:SLOW);
3762\teditb.e_raw = ALTMODE;
3763\treturn(GOOD);
3764}
3765
3766#   endif /* TIOCGETC */
3767#endif\t/* SHOPT_RAWONLY */
3768
3769/*
3770 *\tE_WINDOW()
3771 *
3772 *\treturn the window size
3773 */
3774
3775int ed_window __PARAM__((void), ())
3776#line 404
3777{
3778\tint\trows;
3779\tint\tcols = DFLTWINDOW-1;
3780\tregister char *cp = nv_strval(COLUMNS);
3781\tif(cp)
3782\t{
3783\t\tcols = atoi(cp)-1;
3784\t\tif(cols > MAXWINDOW)
3785\t\t\tcols = MAXWINDOW;
3786\t}
3787\twinsize(&rows,&cols);
3788\tif(cols < MINWINDOW)
3789\t\tcols = MINWINDOW;
3790\treturn(cols);
3791}
3792
3793/*\tE_FLUSH()
3794 *
3795 *\tFlush the output buffer.
3796 *
3797 */
3798
3799void ed_flush __PARAM__((void), ())
3800#line 427
3801{
3802\tregister int n = editb.e_outptr-editb.e_outbase;
3803\tregister int fd = ERRIO;
3804\tif(n<=0)
3805\t\treturn;
3806\twrite(fd,editb.e_outbase,(unsigned)n);
3807\teditb.e_outptr = editb.e_outbase;
3808}
3809
3810/*
3811 * send the bell character ^G to the terminal
3812 */
3813
3814void ed_ringbell __PARAM__((void), ())
3815#line 441
3816{
3817\twrite(ERRIO,bellchr,1);
3818}
3819
3820/*
3821 * send a carriage return line feed to the terminal
3822 */
3823
3824void ed_crlf __PARAM__((void), ())
3825#line 450
3826{
3827#ifdef cray
3828\ted_putchar(\'\\r\');
3829#endif /* cray */
3830#ifdef u370
3831\ted_putchar(\'\\r\');
3832#endif\t/* u370 */
3833#ifdef VENIX
3834\ted_putchar(\'\\r\');
3835#endif /* VENIX */
3836\ted_putchar(\'\\n\');
3837\ted_flush();
3838}
3839
3840/*\tED_SETUP( max_prompt_size )
3841 *
3842 *\tThis routine sets up the prompt string
3843 *\tThe following is an unadvertised feature.
3844 *\t  Escape sequences in the prompt can be excluded from the calculated
3845 *\t  prompt length.  This is accomplished as follows:
3846 *\t  - if the prompt string starts with "%\\r, or contains \\r%\\r", where %
3847 *\t    represents any char, then % is taken to be the quote character.
3848 *\t  - strings enclosed by this quote character, and the quote character,
3849 *\t    are not counted as part of the prompt length.
3850 */
3851
3852void\ted_setup __PARAM__((int fd), (fd)) __OTORP__(int fd;)
3853#line 477
3854{
3855\tregister char *pp;
3856\tregister char *last;
3857\tchar *ppmax;
3858\tint myquote = 0;
3859\tint qlen = 1;
3860\tchar inquote = 0;
3861\teditb.e_fd = fd;
3862#ifdef KSHELL
3863\tif(!(last = sh.prompt))
3864\t\tlast = "";
3865\tsh.prompt = 0;
3866#else
3867\tlast = editb.e_prbuff;
3868#endif /* KSHELL */
3869\tif(sh.hist_ptr)
3870\t{
3871\t\tregister History_t *hp = sh.hist_ptr;
3872\t\teditb.e_hismax = hist_max(hp);
3873\t\teditb.e_hismin = hist_min(hp);
3874\t\teditb.e_hloff = 0;
3875\t}
3876\telse
3877\t{
3878\t\teditb.e_hismax = editb.e_hismin = editb.e_hloff = 0;
3879\t}
3880\teditb.e_hline = editb.e_hismax;
3881\teditb.e_wsize = ed_window()-2;
3882\teditb.e_crlf = YES;
3883\tpp = editb.e_prompt;
3884\tppmax = pp+PRSIZE-1;
3885\t*pp++ = \'\\r\';
3886\t{
3887\t\tregister int c;
3888\t\twhile(c= *last++) switch(c)
3889\t\t{
3890\t\t\tcase \'\\r\':
3891\t\t\t\tif(pp == (editb.e_prompt+2)) /* quote char */
3892\t\t\t\t\tmyquote = *(pp-1);
3893\t\t\t\t/*FALLTHROUGH*/
3894
3895\t\t\tcase \'\\n\':
3896\t\t\t\t/* start again */
3897\t\t\t\teditb.e_crlf = YES;
3898\t\t\t\tqlen = 1;
3899\t\t\t\tinquote = 0;
3900\t\t\t\tpp = editb.e_prompt+1;
3901\t\t\t\tbreak;
3902
3903\t\t\tcase \'\\t\':
3904\t\t\t\t/* expand tabs */
3905\t\t\t\twhile((pp-editb.e_prompt)%TABSIZE)
3906\t\t\t\t{
3907\t\t\t\t\tif(pp >= ppmax)
3908\t\t\t\t\t\tbreak;
3909\t\t\t\t\t*pp++ = \' \';
3910\t\t\t\t}
3911\t\t\t\tbreak;
3912
3913\t\t\tcase BELL:
3914\t\t\t\t/* cut out bells */
3915\t\t\t\tbreak;
3916
3917\t\t\tdefault:
3918\t\t\t\tif(c==myquote)
3919\t\t\t\t{
3920\t\t\t\t\tqlen += inquote;
3921\t\t\t\t\tinquote ^= 1;
3922\t\t\t\t}
3923\t\t\t\tif(pp < ppmax)
3924\t\t\t\t{
3925\t\t\t\t\tqlen += inquote;
3926\t\t\t\t\t*pp++ = c;
3927\t\t\t\t\tif(!inquote && !isprint(c))
3928\t\t\t\t\t\teditb.e_crlf = NO;
3929\t\t\t\t}
3930\t\t}
3931\t}
3932\teditb.e_plen = pp - editb.e_prompt - qlen;
3933\t*pp = 0;
3934\tif((editb.e_wsize -= editb.e_plen) < 7)
3935\t{
3936\t\tregister int shift = 7-editb.e_wsize;
3937\t\teditb.e_wsize = 7;
3938\t\tpp = editb.e_prompt+1;
3939\t\tstrcpy(pp,pp+shift);
3940\t\teditb.e_plen -= shift;
3941\t\tlast[-editb.e_plen-2] = \'\\r\';
3942\t}
3943\tsfsync(sfstderr);
3944\tqlen = sfpeek(sfstderr,&editb.e_outptr,SF_UNBOUND);
3945\tsfwrite(sfstderr,editb.e_outptr,0);
3946\teditb.e_outbase = editb.e_outptr;
3947\teditb.e_outlast = editb.e_outptr + qlen;
3948}
3949
3950#ifdef KSHELL
3951/*
3952 * look for edit macro named _i
3953 * if found, puts the macro definition into lookahead buffer and returns 1
3954 */
3955
3956ed_macro __PARAM__((register int i), (i)) __OTORP__(register int i;)
3957#line 580
3958{
3959}
3960#endif /*KSHELL*/'
3961	EXEC -nh
3962		INPUT - $'#pragma prototyped
3963
3964typedef int (*signal_t)(int);
3965
3966struct test
3967{
3968\tint\t(*call)(int, ...);
3969};
3970
3971int main(int argc, char** argv)
3972{
3973\texit(0);
3974}'
3975		OUTPUT - $'
3976
3977typedef int (*signal_t) __PROTO__((int));
3978
3979struct test
3980{
3981\tint\t(*call) __PROTO__((int, ...));
3982};
3983
3984int main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;)
3985#line 11
3986{
3987\texit(0);
3988}'
3989	EXEC -nh
3990		INPUT - $'#pragma prototyped
3991
3992extern int\terrcount;\t\t/* level>=ERROR_ERROR count\t*/
3993extern int\terrno;\t\t\t/* system call error status\t*/
3994
3995extern void\terror(int, ...);
3996extern void\tliberror(char*, int, ...);
3997extern void*\tseterror(int, ...);
3998extern void\tverror(char*, int, va_list);
3999
4000static int\tftwalk(char*, int (*)(struct FTW*), int, int (*)(struct FTW*, struct FTW*));
4001
4002static int
4003ftwalk(char* file, int (*userf)(struct FTW*), int flags, int (*comparf)(struct FTW*, struct FTW*))
4004{
4005\tfunction(0);
4006\treturn(0);
4007}
4008
4009int\t(*fun)(char*, int);
4010
4011struct xxx
4012{
4013int\t(*fun)(char*, int);
4014};
4015
4016void
4017test()
4018{
4019\tint (*fun)(int, int);
4020\treturn (*fun)(a, b);
4021}
4022
4023void
4024test(int i)
4025{
4026\tint (*fun)(int, int);
4027\tint (*fun)(int, int);
4028\treturn (*fun)(a, b);
4029}
4030
4031void
4032xxx()
4033{
4034\tint\t(*fun)(char*, int);
4035
4036\treturn((*fun)("", 0));
4037}'
4038		OUTPUT - $'
4039
4040extern __MANGLE__ int\terrcount;\t\t/* level>=ERROR_ERROR count\t*/
4041extern __MANGLE__ int\terrno;\t\t\t/* system call error status\t*/
4042
4043extern __MANGLE__ void\terror __PROTO__((int, ...));
4044extern __MANGLE__ void\tliberror __PROTO__((char*, int, ...));
4045extern __MANGLE__ __V_*\tseterror __PROTO__((int, ...));
4046extern __MANGLE__ void\tverror __PROTO__((char*, int, va_list));
4047
4048static int\tftwalk __PROTO__((char*, int (*)(struct FTW*), int, int (*)(struct FTW*, struct FTW*)));
4049
4050static int
4051ftwalk __PARAM__((char* file, int (*userf)(struct FTW*), int flags, int (*comparf)(struct FTW*, struct FTW*)), (file, userf, flags, comparf)) __OTORP__(char* file; int (*userf)(); int flags; int (*comparf)();)
4052#line 15
4053{
4054\tfunction(0);
4055\treturn(0);
4056}
4057
4058int\t(*fun) __PROTO__((char*, int));
4059
4060struct xxx
4061{
4062int\t(*fun) __PROTO__((char*, int));
4063};
4064
4065void
4066test()
4067{
4068\tint (*fun) __PROTO__((int, int));
4069\treturn (*fun)(a, b);
4070}
4071
4072void
4073test __PARAM__((int i), (i)) __OTORP__(int i;)
4074#line 36
4075{
4076\tint (*fun) __PROTO__((int, int));
4077\tint (*fun) __PROTO__((int, int));
4078\treturn (*fun)(a, b);
4079}
4080
4081void
4082xxx()
4083{
4084\tint\t(*fun) __PROTO__((char*, int));
4085
4086\treturn((*fun)("", 0));
4087}'
4088	EXEC -nh
4089		INPUT - $'#pragma prototyped
4090/*
4091 * UNIX shell
4092 *
4093 * S. R. Bourne
4094 * Rewritten by David Korn
4095 * AT&T Bell Laboratories
4096 *
4097 */
4098
4099#include\t"defs.h"
4100#include\t"jobs.h"
4101#include\t"history.h"
4102#include\t"shnodes.h"
4103
4104
4105/* These routines are used by this module but defined elsewhere */
4106extern void\tmac_check(void);
4107extern void\tname_unscope(void);
4108extern void\trm_files(char*);
4109#ifdef VFORK
4110    extern void\tvfork_restore(void);
4111#endif\t/* VFORK */
4112
4113/* ========\terror handling\t======== */
4114
4115\t/* Find out if it is time to go away.
4116\t * `trapnote\' is set to SIGSET when fault is seen and
4117\t * no trap has been set.
4118\t */
4119
4120void sh_cfail(MSG message)
4121{
4122\tsh_fail(sh.cmdname,message);
4123}
4124
4125/*
4126 *  This routine is called when fatal errors are encountered
4127 *  A message is printed out and the shell tries to exit
4128 */
4129
4130void sh_fail(register const char *s1,MSG s2)
4131{
4132\tmac_check();
4133\tp_prp(s1);
4134\tif(s2)
4135\t\tsfprintf(sfstderr,": %s
4136",s2);
4137\telse
4138\t\tsfputc(sfstderr,\'\\n\');
4139\tsh_exit(ERROR);
4140}
4141
4142/* Arrive here from `FATAL\' errors
4143 *  a) exit command,
4144 *  b) default trap,
4145 *  c) fault with no trap set.
4146 *
4147 * Action is to return to command level or exit.
4148 */
4149
4150
4151void sh_exit(int xno)
4152{
4153\tregister unsigned state=(st.states&~(SH_ERREXIT|SH_MONITOR));
4154\tsh.exitval=xno;
4155\tif(xno==SIGFAIL)
4156\t\tsh.exitval |= sh.lastsig;
4157\tsh.un.com = 0;
4158\tif(state&(BUILTIN|LASTPIPE))
4159\t{
4160#if VSH || ESH
4161\t\ttty_cooked(-1);
4162#endif
4163\t\tio_clear((Sfile_t*)0);
4164\t\tLONGJMP(*sh.freturn,1);
4165\t}
4166\tstate |= (unsigned)sh_isoption(SH_ERREXIT|SH_MONITOR);
4167\tif( (state&(SH_ERREXIT|SH_FORKED)) ||
4168\t\t(!(state&(SH_PROFILE|SH_INTERACTIVE|FUNCTION)) && job_close() >= 0))
4169\t{
4170\t\tst.states = state;
4171\t\tsh_done(0);
4172\t}
4173\telse
4174\t{
4175\t\tif(!(state&FUNCTION))
4176\t\t{
4177\t\t\tsfsync(sfstderr);
4178\t\t\tname_unscope();
4179\t\t\targ_clear();
4180\t\t\tio_clear((Sfile_t*)0);
4181\t\t\tio_restore(0);
4182\t\t\tif(sh.input.file && sfpeek(sh.input.file,(unsigned char**)0)>0)
4183\t\t\t{
4184\t\t\t\tregister int n;
4185\t\t\t\tunsigned char *bp;
4186\t\t\t\t/* discard input buffer */
4187\t\t\t\tif((n = sfpeek(sh.input.file,&bp)) > 0)
4188\t\t\t\t\tsfread(sh.input.file,bp,n);
4189\t\t\t}
4190\t\t}
4191#ifdef VFORK
4192\t\tvfork_restore();
4193#endif\t/* VFORK */
4194\t\tst.execbrk = st.breakcnt = 0;
4195\t\tst.exec_flag = 0;
4196\t\tst.dot_depth = 0;
4197\t\thist_flush();
4198\t\tstate &= ~(FUNCTION|SH_HISTORY|SH_INTERACTIVE|SH_VERBOSE|
4199\t\t\tSH_MONITOR|BUILTIN|LASTPIPE|SH_VFORKED);
4200\t\tstate |= (unsigned)sh_isoption(SH_INTERACTIVE|SH_VERBOSE|SH_MONITOR);
4201\t\tjob.pipeflag = 0;
4202\t\tst.states = state;
4203\t\tLONGJMP(*sh.freturn,1);
4204\t}
4205}
4206
4207#ifdef JOBS
4208    /* send signal to background process groups */
4209static int job_terminate(register struct process *pw,register int sig)
4210    {
4211\tif(pw->p_pgrp)
4212\t\tjob_kill(pw,sig);
4213\treturn(0);
4214    }
4215#endif /* JOBS */
4216
4217/*
4218 * This is the exit routine for the shell
4219 */
4220
4221void sh_done(register int sig)
4222{
4223\tregister char *t;
4224\tregister int savxit = sh.exitval;
4225\tif(sh.trapnote&SIGBEGIN)
4226\t\treturn;
4227\tsh.trapnote = 0;
4228\tif(t=st.trapcom[0])
4229\t{
4230\t\tst.trapcom[0]=0; /*should free but not long */
4231\t\tsh.oldexit = savxit;
4232\t\tsh.intrap++;
4233\t\tsh_eval(t);
4234\t\tsh.intrap--;
4235\t}
4236\telse
4237\t{
4238\t\t/* avoid recursive call for set -e */
4239\t\tst.states &= ~SH_ERREXIT;
4240\t\tsh_chktrap();
4241\t}
4242\tsh_freeup();
4243#ifdef ACCT
4244\tdoacct();
4245#endif\t/* ACCT */
4246#if VSH || ESH
4247\tif(sh_isoption(SH_EMACS|SH_VI|SH_GMACS))
4248\t\ttty_cooked(-1);
4249#endif
4250\tif(st.states&SH_RMTMP)
4251\t/* clean up all temp files */
4252\t\trm_files(io_tmpname);
4253#ifdef JOBS
4254\tif(sig==SIGHUP || (sh_isoption(SH_INTERACTIVE)&&sh.login_sh))
4255\t\tjob_walk(sfstderr,job_terminate,SIGHUP,(char**)0);
4256#endif\t/* JOBS */
4257\tjob_close();
4258\tsfsync((Sfile_t*)sfstdin);
4259\tsfsync((Sfile_t*)sfstderr);
4260\tif(sig)
4261\t{
4262\t\t/* generate fault termination code */
4263\t\tsignal(sig,SIG_DFL);
4264\t\tsigrelease(sig);
4265\t\tkill(getpid(),sig);
4266\t\tpause();
4267\t}
4268\t_exit(savxit&EXITMASK);
4269}
4270'
4271		OUTPUT - $'
4272/*
4273 * UNIX shell
4274 *
4275 * S. R. Bourne
4276 * Rewritten by David Korn
4277 * AT&T Bell Laboratories
4278 *
4279 */
4280
4281#include\t"defs.h"
4282#include\t"jobs.h"
4283#include\t"history.h"
4284#include\t"shnodes.h"
4285
4286
4287/* These routines are used by this module but defined elsewhere */
4288extern __MANGLE__ void\tmac_check __PROTO__((void));
4289extern __MANGLE__ void\tname_unscope __PROTO__((void));
4290extern __MANGLE__ void\trm_files __PROTO__((char*));
4291#ifdef VFORK
4292    extern __MANGLE__ void\tvfork_restore __PROTO__((void));
4293#endif\t/* VFORK */
4294
4295/* ========\terror handling\t======== */
4296
4297\t/* Find out if it is time to go away.
4298\t * `trapnote\' is set to SIGSET when fault is seen and
4299\t * no trap has been set.
4300\t */
4301
4302void sh_cfail __PARAM__((MSG message), (message)) __OTORP__(MSG message;)
4303#line 33
4304{
4305\tsh_fail(sh.cmdname,message);
4306}
4307
4308/*
4309 *  This routine is called when fatal errors are encountered
4310 *  A message is printed out and the shell tries to exit
4311 */
4312
4313void sh_fail __PARAM__((register const char *s1,MSG s2), (s1, s2)) __OTORP__(register const char *s1;MSG s2;)
4314#line 43
4315{
4316\tmac_check();
4317\tp_prp(s1);
4318\tif(s2)
4319\t\tsfprintf(sfstderr,": %s
4320",s2);
4321\telse
4322\t\tsfputc(sfstderr,\'\\n\');
4323\tsh_exit(ERROR);
4324}
4325
4326/* Arrive here from `FATAL\' errors
4327 *  a) exit command,
4328 *  b) default trap,
4329 *  c) fault with no trap set.
4330 *
4331 * Action is to return to command level or exit.
4332 */
4333
4334
4335void sh_exit __PARAM__((int xno), (xno)) __OTORP__(int xno;)
4336#line 64
4337{
4338\tregister unsigned state=(st.states&~(SH_ERREXIT|SH_MONITOR));
4339\tsh.exitval=xno;
4340\tif(xno==SIGFAIL)
4341\t\tsh.exitval |= sh.lastsig;
4342\tsh.un.com = 0;
4343\tif(state&(BUILTIN|LASTPIPE))
4344\t{
4345#if VSH || ESH
4346\t\ttty_cooked(-1);
4347#endif
4348\t\tio_clear((Sfile_t*)0);
4349\t\tLONGJMP(*sh.freturn,1);
4350\t}
4351\tstate |= (unsigned)sh_isoption(SH_ERREXIT|SH_MONITOR);
4352\tif( (state&(SH_ERREXIT|SH_FORKED)) ||
4353\t\t(!(state&(SH_PROFILE|SH_INTERACTIVE|FUNCTION)) && job_close() >= 0))
4354\t{
4355\t\tst.states = state;
4356\t\tsh_done(0);
4357\t}
4358\telse
4359\t{
4360\t\tif(!(state&FUNCTION))
4361\t\t{
4362\t\t\tsfsync(sfstderr);
4363\t\t\tname_unscope();
4364\t\t\targ_clear();
4365\t\t\tio_clear((Sfile_t*)0);
4366\t\t\tio_restore(0);
4367\t\t\tif(sh.input.file && sfpeek(sh.input.file,(unsigned char**)0)>0)
4368\t\t\t{
4369\t\t\t\tregister int n;
4370\t\t\t\tunsigned char *bp;
4371\t\t\t\t/* discard input buffer */
4372\t\t\t\tif((n = sfpeek(sh.input.file,&bp)) > 0)
4373\t\t\t\t\tsfread(sh.input.file,bp,n);
4374\t\t\t}
4375\t\t}
4376#ifdef VFORK
4377\t\tvfork_restore();
4378#endif\t/* VFORK */
4379\t\tst.execbrk = st.breakcnt = 0;
4380\t\tst.exec_flag = 0;
4381\t\tst.dot_depth = 0;
4382\t\thist_flush();
4383\t\tstate &= ~(FUNCTION|SH_HISTORY|SH_INTERACTIVE|SH_VERBOSE|
4384\t\t\tSH_MONITOR|BUILTIN|LASTPIPE|SH_VFORKED);
4385\t\tstate |= (unsigned)sh_isoption(SH_INTERACTIVE|SH_VERBOSE|SH_MONITOR);
4386\t\tjob.pipeflag = 0;
4387\t\tst.states = state;
4388\t\tLONGJMP(*sh.freturn,1);
4389\t}
4390}
4391
4392#ifdef JOBS
4393    /* send signal to background process groups */
4394static int job_terminate __PARAM__((register struct process *pw,register int sig), (pw, sig)) __OTORP__(register struct process *pw;register int sig;)
4395#line 122
4396{
4397\tif(pw->p_pgrp)
4398\t\tjob_kill(pw,sig);
4399\treturn(0);
4400    }
4401#endif /* JOBS */
4402
4403/*
4404 * This is the exit routine for the shell
4405 */
4406
4407void sh_done __PARAM__((register int sig), (sig)) __OTORP__(register int sig;)
4408#line 134
4409{
4410\tregister char *t;
4411\tregister int savxit = sh.exitval;
4412\tif(sh.trapnote&SIGBEGIN)
4413\t\treturn;
4414\tsh.trapnote = 0;
4415\tif(t=st.trapcom[0])
4416\t{
4417\t\tst.trapcom[0]=0; /*should free but not long */
4418\t\tsh.oldexit = savxit;
4419\t\tsh.intrap++;
4420\t\tsh_eval(t);
4421\t\tsh.intrap--;
4422\t}
4423\telse
4424\t{
4425\t\t/* avoid recursive call for set -e */
4426\t\tst.states &= ~SH_ERREXIT;
4427\t\tsh_chktrap();
4428\t}
4429\tsh_freeup();
4430#ifdef ACCT
4431\tdoacct();
4432#endif\t/* ACCT */
4433#if VSH || ESH
4434\tif(sh_isoption(SH_EMACS|SH_VI|SH_GMACS))
4435\t\ttty_cooked(-1);
4436#endif
4437\tif(st.states&SH_RMTMP)
4438\t/* clean up all temp files */
4439\t\trm_files(io_tmpname);
4440#ifdef JOBS
4441\tif(sig==SIGHUP || (sh_isoption(SH_INTERACTIVE)&&sh.login_sh))
4442\t\tjob_walk(sfstderr,job_terminate,SIGHUP,(char**)0);
4443#endif\t/* JOBS */
4444\tjob_close();
4445\tsfsync((Sfile_t*)sfstdin);
4446\tsfsync((Sfile_t*)sfstderr);
4447\tif(sig)
4448\t{
4449\t\t/* generate fault termination code */
4450\t\tsignal(sig,SIG_DFL);
4451\t\tsigrelease(sig);
4452\t\tkill(getpid(),sig);
4453\t\tpause();
4454\t}
4455\t_exit(savxit&EXITMASK);
4456}
4457'
4458	EXEC -nh
4459		INPUT - $'#pragma prototyped
4460
4461extern char* strcpy(const char*, const char*);
4462
4463typedef void (*signal_t)(int);
4464
4465struct test
4466{
4467\tint\t(*call)(int, ...);
4468};
4469
4470static void (*signal)(void (*handler)(int))
4471{
4472\tint\t(*call)(int, ...);
4473\t(*call)(2, 2, 0);
4474\tcall(2,3,4);
4475}
4476
4477#include <stdarg.h>
4478
4479int error(int level, char* format, ...)
4480{
4481\tva_list\tap;
4482
4483\tva_start(ap, format);
4484\tva_end(ap);
4485}'
4486		OUTPUT - $'
4487
4488extern __MANGLE__ char* strcpy __PROTO__((const char*, const char*));
4489
4490typedef void (*signal_t) __PROTO__((int));
4491
4492struct test
4493{
4494\tint\t(*call) __PROTO__((int, ...));
4495};
4496
4497static void (*signal) __PARAM__((void (*handler)(int)), (handler)) __OTORP__(void (*handler)();)
4498#line 13
4499{
4500\tint\t(*call) __PROTO__((int, ...));
4501\t(*call)(2, 2, 0);
4502\tcall(2,3,4);
4503}
4504
4505#if !defined(va_start)
4506#if defined(__STDARG__)
4507#include <stdarg.h>
4508#else
4509#include <varargs.h>
4510#endif
4511#endif
4512
4513#line 19
4514
4515
4516int error __PARAM__((int level, char* format, ...), (va_alist)) __OTORP__(va_dcl)
4517{ __OTORP__(int level; char* format; )
4518#line 22
4519
4520\tva_list\tap;
4521
4522\t__VA_START__(ap, format); __OTORP__(level = va_arg(ap, int );format = va_arg(ap, char* );)
4523\tva_end(ap);
4524}'
4525	EXEC -nh
4526		INPUT - $'#pragma prototyped
4527
4528f()
4529{
4530\tif(*cp==\'?\')
4531\t\t(cp++,flag++);
4532\tif(1)
4533\t\t(x);
4534\tif(*1)
4535\t\t(x);
4536\tif(2)
4537\t\t(y,z);
4538}'
4539		OUTPUT - $'
4540
4541f()
4542{
4543\tif(*cp==\'?\')
4544\t\t(cp++,flag++);
4545\tif(1)
4546\t\t(x);
4547\tif(*1)
4548\t\t(x);
4549\tif(2)
4550\t\t(y,z);
4551}'
4552	EXEC -nh
4553		INPUT - $'#pragma prototyped
4554
4555extern int a, char b;
4556
4557static void (*signal)(void (*handler)(int))
4558{
4559\tint\t(*call)(int, ...);
4560\t(*call)(2, 2, 0);
4561\tcall(2,3,4);
4562\tcall(*p);
4563}'
4564		OUTPUT - $'
4565
4566extern __MANGLE__ int a, char b;
4567
4568static void (*signal) __PARAM__((void (*handler)(int)), (handler)) __OTORP__(void (*handler)();)
4569#line 6
4570{
4571\tint\t(*call) __PROTO__((int, ...));
4572\t(*call)(2, 2, 0);
4573\tcall(2,3,4);
4574\tcall(*p);
4575}'
4576
4577TEST 06 'option exercize'
4578	EXEC -nhp
4579		INPUT - $'extern int test(const char*);'
4580		OUTPUT - $'extern int test(const char*);'
4581	EXEC -nhpf
4582		INPUT - $'#pragma noprototyped\nextern int test(const char*);'
4583		OUTPUT - $'                    \nextern int test(const char*);'
4584	EXEC -nhpf
4585		INPUT - $'#pragma prototyped\nextern int test(const char*);'
4586		OUTPUT - $'                  \nextern __MANGLE__ int test __PROTO__((const char*));'
4587
4588TEST 07 'in place'
4589	EXEC -fhnr hello.c
4590		INPUT hello.c $'static int hello(const char* msg);
4591main(int argc, char** argv)
4592{
4593	return hello("hello world");
4594}
4595static int hello(const char* msg)
4596{
4597	printf("%s.\\n", msg);
4598	return 0;
4599}'
4600		OUTPUT hello.c $'static int hello __PROTO__((const char* msg));
4601main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;)
4602#line 3
4603{
4604	return hello("hello world");
4605}
4606static int hello __PARAM__((const char* msg), (msg)) __OTORP__(const char* msg;)
4607#line 7
4608{
4609	printf("%s.\\n", msg);
4610	return 0;
4611}'
4612
4613TEST 08 'buffer boundaries'
4614	EXEC -nhf
4615		INPUT - $'/*
4616  xxxxxxxxxxx xxxxx xxxxxxx.
4617*/
4618#ifndef xxxxxxxx
4619#define xxxxxxxx
4620
4621#if defined(xxxxxxxxxxx) || defined(xxxxxxxxxx)
4622extern "x" {
4623#endif
4624
4625#if defined(xxxxxxxxxxx)
4626/*
4627  xxxxx xxxxxxx xx [0..65535].
4628*/
4629#define xxxxxxxxx(xxxxxxx)  (((xxxxxxxx long) (xxxxxxx)) >> 8)
4630#define xxxxxxxxxxxxxx "#%04x%04x%04x"
4631#define xxxxxx  65535x
4632#define xxxxxxxxxxxx  65535x
4633#define xxxxxxxxxxxx  16
4634#define xxxxxxx(xxxxxxx)  (((xxxxxxxx long) (xxxxxxx))*257)
4635#define xxxxxxxxxx(xxxxx)  ((xxxxxxxx long) (xxxxx))
4636#define xxxxxxxx(xxxxx)  ((xxxxxxxx long) (xxxxx))
4637
4638xxxxxxx xxxxxxxx short xxxxxxx;
4639#else
4640/*
4641  xxxxx xxxxxxx xx [0..255].
4642*/
4643#define xxxxxxxxx(xxxxxxx)  ((xxxxxxxx long) (xxxxxxx))
4644#define xxxxxxxxxxxxxx "#%02x%02x%02x"
4645#define xxxxxx  255
4646#define xxxxxxxxxxxx  255
4647#define xxxxxxxxxxxx  8
4648#define xxxxxxx(xxxxxxx)  ((xxxxxxxx long) (xxxxxxx))
4649#define xxxxxxxxxx(xxxxx)  (((xxxxxxxx long) (xxxxx)) >> 8)
4650#define xxxxxxxx(xxxxx)  (((xxxxxxxx long) (xxxxx))*257)
4651
4652xxxxxxx xxxxxxxx char xxxxxxx;
4653#endif
4654
4655/*
4656  3x xxxxxxx.
4657*/
4658#define xxxxxxxxxxxxxxxxxx  xxxxxxx(80)
4659#define xxxxxxxxxxxxxxxxx  xxxxxxx(125)
4660#define xxxxxxxxxxxxxx  xxxxxxx(135)
4661#define xxxxxxxxxxxxx  xxxxxxx(185)
4662#define xxxxxxxxxxxxxx  xxxxxxx(110)
4663
4664/*
4665  xxxxxxx xxxxxxxxxxxx.
4666*/
4667xxxxxxx struct xxxxxxxxx
4668{
4669  char
4670    *xxxx;
4671
4672  long
4673    xxxxxx,
4674    xxxxxx,
4675    xxxxxx,
4676    xxxxxxx;
4677} xxxxxxxx;
4678
4679xxxxxxx struct xxxxxxxxxxxxxx
4680{
4681  char
4682    *xxxx;
4683
4684  xxxxxxxx char
4685    xxx,
4686    xxxxx,
4687    xxxx;
4688} xxxxxxxxxxxxx;
4689
4690xxxxxxx struct xxxxxxxxxxxx
4691{
4692  xxxxxxxx short
4693    xxx,
4694    xxxxx,
4695    xxxx,
4696    xxxxx;
4697
4698  xxxxxxxx char
4699    xxxxx;
4700
4701  char
4702    xxx[3];
4703
4704  xxxxxxxx long
4705    xxxxx;
4706} xxxxxxxxxxx;
4707
4708xxxxxxx struct xxxxxxxxxxxxxxxxx
4709{
4710  int
4711    xxxxx;
4712
4713  double
4714    xxxxxx;
4715} xxxxxxxxxxxxxxxx;
4716
4717xxxxxxx struct xxxxxxxxxxx
4718{
4719  double
4720    (*xxxxxxxx)(double),
4721    xxxxxxx;
4722} xxxxxxxxxx;
4723
4724xxxxxxx struct xxxxxxxxxx
4725{
4726  int
4727    x,
4728    x;
4729
4730  xxxxxxxx int
4731    xxxxx,
4732    xxxxxx;
4733
4734  int
4735    xxxxxxxxxxx,
4736    xxxxxxxxxxx;
4737} xxxxxxxxx;
4738
4739xxxxxxx struct xxxxxxxxxx
4740{
4741  /*
4742    xxxx xxxxxx.
4743  */
4744  xxxxxxxx
4745    xxxx;
4746  /*
4747    xxxx xxx xxxxx xxxxxxxxx xxxxxxx.
4748  */
4749  xxxx
4750    *xxxx;
4751
4752  char
4753    xxxxxxxx[xxxxxxxxxxxxx],
4754    xxxxxx[xxxxxxxxxxxxx],
4755    xxxxxx[xxxxxxxxxxxxx],
4756    xxxx[xxxxxxxxxxxxx];
4757
4758  xxxxxxxx int
4759    xxxxxx,
4760    xxxxxxxxx,
4761    xxxxxx,
4762    xxxxxxxx,
4763    xxxxxxxx,
4764    xxxxx,
4765    xxxx;
4766
4767  char
4768    *xxxx,
4769    *xxxx,
4770    *xxxx;
4771
4772  xxxxxxxxxxxxx
4773    xxxxxxxxx;
4774
4775  xxxxxxxxxxxxxx
4776    xxxxx;
4777
4778  /*
4779    xxxxxxxxxxx xxxxxxx.
4780  */
4781  xxxxxxxxxxxxxxx
4782    xxxxxxxxxxx;
4783
4784  xxxxxxxx int
4785    xxxxxxx;
4786
4787  /*
4788    xxxxxxxxxx xxxxxxx.
4789  */
4790  char
4791    *xxxxxxxxxxx,
4792    *xxx,
4793    *xxxx,
4794    *xxx,
4795    *xxxxxxx,
4796    *xxxxxxx;
4797
4798  xxxxxxxx int
4799    xxxxxxxxx,
4800    xxxxxxxxx,
4801    xxxxxxxxx;
4802
4803  int
4804    xxxx;
4805
4806  char
4807    *xxxxxxxxxxxxxxxx,
4808    *xxxxxxxxxxxx,
4809    *xxxxxxxxxxx;
4810
4811  /*
4812    xxxxx xxxxxxxxx xxxxxxx.
4813  */
4814  xxxxxxxx int
4815    xxxxxx,
4816    xxxxxxxxxx;
4817
4818  xxxxxxxxxxxxxx
4819    xxxxxxxxxx;
4820
4821  /*
4822    xxxxxxxxx xxxxxxx.
4823  */
4824  char
4825    *xxxxxxx,
4826    *xxxxx,
4827    *xxxxxxxxxx;
4828
4829  xxxxxxxx int
4830    xxxxxxxxxxxxxxxxxxxxxx,
4831    xxxxxxxxxxxxxxx,
4832    xxxxxxxxxxxxxxxx;
4833
4834  /*
4835    xxxxxxxxxxxxx xxxxxxx.
4836  */
4837  xxxxxxxx int
4838    xxxxxxx;
4839
4840  xxxxxxxxxxx
4841    xxxxxxxxxxxx;
4842
4843  char
4844    *xxxx;
4845
4846  long
4847    xxxxx;
4848} xxxxxxxxx;
4849
4850xxxxxxx struct xxxxxxxxxxxx
4851{
4852  char
4853    xxxxxxxx[xxxxxxxxxxxxx];
4854
4855  char
4856    *xxxxxxxx,
4857    *xxxx,
4858    *xxxxxxxxxxxxxxxx,
4859    *xxxxxxxxxxxx,
4860    *xxxxxxxxxxx,
4861    *xxxxx,
4862    *xxxxx,
4863    *xxxxxxx,
4864    *xxx,
4865    *xxxx;
4866
4867  xxxxxxxx int
4868    xxxxxxxxx,
4869    xxxxxxxxxxxx,
4870    xxxxxxx,
4871    xxxxxx;
4872
4873  xxxxxxxxxxxxxxxxx
4874    xxxxxxx;
4875} xxxxxxxxxxx;
4876
4877xxxxxxx struct xxxxxxxxxx
4878{
4879  double
4880    x,
4881    x,
4882    x;
4883} xxxxxxxxx;
4884
4885xxxxxxx struct xxxxxxxxxxxxxx
4886{
4887  xxxxxxxxxxxxx
4888    xxxxxxxxx;
4889
4890  xxxxxxxx int
4891    xxxxxxxxxxx;
4892
4893  double
4894    x,
4895    x;
4896
4897  xxxxxxxxxxx
4898    xxxxxx;
4899
4900  char
4901    *xxxx;
4902} xxxxxxxxxxxxx;
4903
4904xxxxxxx struct xxxxxxxxxxxxxx
4905{
4906  xxxxxxxx int
4907    xxxxx,
4908    xxxxxx;
4909
4910  int
4911    x,
4912    x;
4913} xxxxxxxxxxxxx;
4914
4915xxxxxxx struct xxxxxxxxxxxxxxxx
4916{
4917  xxxxxxx
4918    xxx,
4919    xxxxx,
4920    xxxx,
4921    xxxxxx;
4922
4923  xxxxxxxx short
4924    xxxxx;
4925} xxxxxxxxxxxxxxx;
4926
4927xxxxxxx struct xxxxxxxxxxxx
4928{
4929  double
4930    xx,
4931    xx,
4932    xx,
4933    xx;
4934} xxxxxxxxxxx;
4935
4936xxxxxxx struct xxxxxxxxxxxx
4937{
4938  xxxxxxxx int
4939    xxxxxx;
4940
4941  xxxxxxxx char
4942    *xxxx;
4943} xxxxxxxxxxx;
4944
4945xxxxxxx struct xxxxxxxxxxxxxxxxx
4946{
4947  xxxxxxxxx
4948    xxxxxxxxxxx,
4949    xxxxxxxxxxxxx,
4950    xxxxxxxxxxxx,
4951    xxxxxxxxxxx;
4952} xxxxxxxxxxxxxxxx;
4953
4954xxxxxxx struct xxxxxx
4955{
4956  xxxxxxxx
4957    xxxx;
4958
4959  xxxx
4960    *xxxx;
4961
4962  int
4963    xxxxxx,
4964    xxxxxx,
4965    xxxxxxxxx;
4966
4967  char
4968    xxxxxxxx[xxxxxxxxxxxxx];
4969
4970  long int
4971    xxxxxxxx;
4972
4973  int
4974    xxxx;
4975
4976  char
4977    xxxxxx[xxxxxxxxxxxxx],
4978    *xxxxxxxx,
4979    *xxxxx;
4980
4981  xxxxxxxxx
4982#if defined(xxxxxxxxxxx) || defined(xxxxxxxxxx)
4983    xxxxxxx;
4984#else
4985    xxxxx;
4986#endif
4987
4988  xxxxxxxx int
4989    xxxxx;
4990
4991  xxxxxxxxxxxxxxx
4992    xxxxxxxxxxx;
4993
4994  xxxxxxxx int
4995    xxxxxxx,
4996    xxxx,
4997    xxxxx;
4998
4999  int
5000    xxxxxx;
5001
5002  xxxxxxxxxxxxx
5003    xxxxxxxxx;
5004
5005  xxxxxxxxxxxxx
5006    xxxxxxxxx;
5007
5008  xxxxxxxx int
5009    xxxxx;
5010
5011  char
5012    *xxxxxxx,
5013    *xxxxxxxxx;
5014
5015  xxxxxxxxxxx
5016    *xxxxxxxx;
5017
5018  xxxxxxxx int
5019    xxxxxx;
5020
5021  xxxxxxxxxxxxxx
5022    xxxxxxxxxx;
5023
5024  xxxxxxxxxxxxxxx
5025    xxxxxxxxxxxxxxxx;
5026
5027  double
5028    xxxxx;
5029
5030  xxxxxxxxxxxxxxxx
5031    xxxxxxxxxxxx;
5032
5033  xxxxxxxxxxx
5034    xxxxxxxxxxxxx,
5035    xxxxxxxxxxxx;
5036
5037  xxxxxxxxxxxxxx
5038    xxxxx;
5039
5040  double
5041    xxxxxxxxxxxx,
5042    xxxxxxxxxxxx;
5043
5044  char
5045    *xxxxxxxxx;
5046
5047  xxxxxxxxxxxxxxx
5048    *xxxxxx;
5049
5050  xxxxxxxx long
5051    xxxxxxx;
5052
5053  xxxxxxxx int
5054    xxxxxxxxxxx;
5055
5056  xxxxxxxx char
5057    *xxxxxxxxxxxxx;
5058
5059  xxxxxxxxxxx
5060    xxxxxxxxxxxxxxxx,
5061    xxxxxxxxxxxx,
5062    xxxxxxxxxxx;
5063
5064  char
5065    *xxxxxxxx,
5066    *xxxx;
5067
5068  xxxxxxxx int
5069    xxxxxxx,
5070    xxxxx,
5071    xxxxxxxxxx;
5072
5073  int
5074    xxxx;
5075
5076  xxxxxxxxxx
5077    xxxxxx;
5078
5079  double
5080    xxxx;
5081
5082  xxxxxxxx long
5083    xxxxxxxxxxxx;
5084
5085  xxxxxxxx int
5086    xxxxxxxxxxxxxxxxxxxx;
5087
5088  double
5089    xxxxxxxxxxxxxxxxxxxxx,
5090    xxxxxxxxxxxxxxxxxxxxxxxx;
5091
5092  long int
5093    xxxxxxxxxxx;
5094
5095  char
5096    xxxxxxxxxxxxxxx[xxxxxxxxxxxxx];
5097
5098  xxxxxxxx int
5099    xxxxxxxxxxxxxx,
5100    xxxxxxxxxxx;
5101
5102  int
5103    xxxxxxxxxxxxxxxxxxxxxx,
5104    xxxxxxx;
5105
5106  xxxxxxxx int
5107    xxxxxx;
5108
5109  struct xxxxxx
5110    *xxxxxxxx,
5111    *xxxx,
5112    *xxxx;
5113} xxxxx;
5114
5115xxxxxxx struct xxxxxxxxxxxxx
5116{
5117  xxxxxxxxx
5118    *xxxxxxxxxx;
5119
5120  xxxxxxxx int
5121    xxxxxxx;
5122
5123  char
5124    *xxxxxxxx,
5125    *xxxx,
5126    *xxxxxxxxx,
5127    *xxxxxxxxx;
5128
5129  double
5130    xxxxxxx;
5131
5132  xxxxx
5133    *xxxx;
5134
5135  xxxxxxxxxxxxx
5136    xxxxxx;
5137} xxxxxxxxxxxx;
5138
5139xxxxxxx struct xxxxxxxxxxx
5140{
5141  const char
5142    *xxx;
5143
5144  xxxxx
5145    *(*xxxxxxx)(const xxxxxxxxx *);
5146
5147  xxxxxxxx int
5148    (*xxxxxxx)(const xxxxxxxxx *,xxxxx *),
5149    (*xxxxxx)(const xxxxxxxx char *,const xxxxxxxx int),
5150    xxxxxx,
5151    xxxxxxxxxxxx;
5152
5153  const char
5154    *xxxxxxxxxxx;
5155
5156  xxxx
5157    *xxxx;
5158
5159  struct xxxxxxxxxxx
5160    *xxxxxxxx,
5161    *xxxx;
5162} xxxxxxxxxx;
5163
5164/*
5165  xxxxx const xxxxxxxxxxxx.
5166*/
5167extern const char
5168  *xxxxxxxx,
5169  *xxxxxxxxxxxxxxx,
5170  *xxxxxxxxxxx,
5171  *xxxxxxxxxxxxxxxx,
5172  *xxxxxxxxxxxxxxxx,
5173  *xxxxxxxxxxxxxxxxxxx,
5174  *xxxxxxxxxxxxxxxx,
5175  *xxxxxxxxxxxxxxx,
5176  *xxxxxxxxxx,
5177  *xxxxxxxxxxxxx,
5178  *xxxxxxxxxxxxxx,
5179  *xxxxxxxxxxxxxxxxx,
5180  *xxxxxxxxxxxxxx,
5181  *xxxxxxxxxxxxxx,
5182  *xxxxxxxxxxxxxxxxxxxxxxxx,
5183  *xxxxxxxxxxxxx,
5184  *xxxxxxxxxxxxxx,
5185  *xxxxxxxxxxxxxxx;
5186
5187extern const xxxxxxxxxxxxx
5188  xxxxxxxxxxxx[235],
5189  xxxxxxxxxx[757];
5190
5191/*
5192  xxxxx xxxxxxxxx xxxxxxx.
5193*/
5194extern xxxxxx xxxxxxxxxxxx
5195  *xxxxxxxxxxxxxxxxx(const xxxxxxxxx *,const xxxxxxxxxxxx *);
5196
5197extern xxxxxx xxxxx
5198  *xxxxxxxxxxxxx(const xxxxx *,const xxxxxxxxx),
5199  *xxxxxxxxxxxxx(const xxxxxxxxx *),
5200  *xxxxxxxxxxxx(xxxxx *,const xxxxxxxx int),
5201  *xxxxxxxxxxxxx(const xxxxx *),
5202  *xxxxxxxxx(const xxxxx *,const double),
5203  *xxxxxxxxxxx(const xxxxx *,const xxxxxxxxxxxxx *),
5204  *xxxxxxxxx(const xxxxx *,const xxxxxxxxxxxxx *),
5205  *xxxxxxxxxx(const xxxxx *,const xxxxxxxx int,const xxxxxxxx int,
5206    const xxxxxxxx int),
5207  *xxxxxxxxxxx(const xxxxxxxx int,const xxxxxxxx int,const xxxxx *,
5208    const xxxxx *,const xxxxx *,const xxxxx *),
5209  *xxxxxxxxx(const xxxxx *,const xxxxxxxxxxxxx *),
5210  *xxxxxxxxxxxxxx(xxxxx *),
5211  *xxxxxxxxx(const xxxxx *,const double),
5212  *xxxxxxxxxxx(const xxxxx *),
5213  *xxxxxxxxxxxx(const xxxxx *),
5214  *xxxxxxxxx(const xxxxx *),
5215  *xxxxxxxxx(const xxxxx *),
5216  *xxxxxxxxxx(const xxxxx *,const xxxxxxxxx *),
5217  *xxxxxxxxxxxx(xxxxx *,const double),
5218  **xxxxxxxxxxxxxxxx(const xxxxx *,xxxxxxxx int *),
5219  *xxxxxxxxxxxx(xxxxx *),
5220  *xxxxxxxxxxx(xxxxx *),
5221  *xxxxxxxxxxxxx(const xxxxx *,const xxxxxxxxxxx *),
5222  *xxxxxxxxxxx(xxxxx *,const xxxxxxxx int),
5223  *xxxxxxxxxxxxx(xxxxx *,const xxxxxxxx int),
5224  *xxxxxxxxx(const xxxxxxxxx *),
5225  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5226  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5227  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5228  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5229  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5230  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5231  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5232  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5233  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5234  *xxxxxxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5235  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5236  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5237  *xxxxxxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5238  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5239  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5240  *xxxxxxxxx(xxxxxxxxx *),
5241  *xxxxxxxxxx(xxxxxxxxx *),
5242  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5243  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5244  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5245  *xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5246  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5247  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5248  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5249  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5250  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5251  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5252  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5253  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5254  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5255  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5256  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5257  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5258  *xxxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5259  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5260  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5261  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5262  *xxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5263  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5264  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5265  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5266  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5267  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5268  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5269  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5270  *xxxxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5271  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5272  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5273  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5274  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5275  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5276  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5277  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5278  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5279  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5280  *xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5281  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5282  *xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5283  *xxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5284  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5285  *xxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5286  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5287  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5288  *xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx),
5289  *xxxxxxxxxxxxxxxx(const xxxxx *),
5290  *xxxxxxxxx(const xxxxx *,const int,const int),
5291  *xxxxxxxxxxx(const xxxxx *,const double,const xxxxxxxx int,
5292    const xxxxxxxx int),
5293  *xxxxxxxxxxx(const xxxxx *,const xxxxxxxx int,const xxxxxxxx int),
5294  *xxxxxxxxxx(const xxxxx *,const xxxxxxxx int,const xxxxxxxx int),
5295  *xxxxxxxxxx(xxxxx *,const xxxxxxxx int,double,double),
5296  *xxxxxxxxxxxx(const xxxxx *,const double),
5297  *xxxxxxxxxx(const xxxxx *,const double,const double,const xxxxxxxx int),
5298  *xxxxxxxxxxx(xxxxx *,const xxxxxxxx int),
5299  *xxxxxxxxxxxx(xxxxx *,xxxxx *),
5300  *xxxxxxxxxxx(xxxxx *,const xxxxx *),
5301  *xxxxxxxxxx(xxxxx *,double),
5302  *xxxxxxxxx(xxxxx *,const double,const double),
5303  *xxxxxxxxx(xxxxx *,const xxxxxxxx int,const xxxxxxxx int);
5304
5305extern xxxxxx xxxxxxxxx
5306  *xxxxxxxxxxxxxx(const xxxxxxxxx *);
5307
5308extern xxxxxx xxxxxxxxx
5309  xxxxxxxxxxxx(xxxxx *);
5310
5311extern xxxxxx int
5312  xxxxxxxxxxxxx(const char *,int *,int *,xxxxxxxx int *,xxxxxxxx int *),
5313  xxxxxxxxxxxxxxxxxx(const char *,int *,int *,xxxxxxxx int *,xxxxxxxx int *);
5314
5315extern xxxxxx xxxxxxxxxx
5316  *xxxxxxxxxxxxx(const char *),
5317  *xxxxxxxxxxxxxxxxxx(const char *,xxxxx *(*)(const xxxxxxxxx *),
5318    xxxxxxxx int (*)(const xxxxxxxxx *,xxxxx *),
5319    xxxxxxxx int (*)(const xxxxxxxx char *,const xxxxxxxx int),
5320    const xxxxxxxx int,const xxxxxxxx int,const char *);
5321
5322extern xxxxxx xxxxxxxx int
5323  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5324  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5325  xxxxxxxxxxxxxxx(const xxxxx *),
5326  xxxxxxxxxx(const char *),
5327  xxxxxxxxxxx(xxxxx *),
5328  xxxxxxxxxxxxxxxxx(xxxxx *),
5329  xxxxxxxxxxxxx(xxxxx *),
5330  xxxxxxxxxx(const char *,const xxxxxxxx int),
5331  xxxxxxxxx(const xxxxx *),
5332  xxxxxxxxxxx(xxxxx *,const xxxxxxxxxxx *,int,int),
5333  xxxxxxxxxxxxxxxxxx(const char *,xxxxxxxxxxx *),
5334  xxxxxxxxxxxxxxx(xxxxx *),
5335  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5336  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5337  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5338  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5339  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5340  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5341  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5342  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5343  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5344  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5345  xxxxxxxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx, xxxxx *xxxxx),
5346  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5347  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5348  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5349  xxxxxxxxxx(const xxxxxxxxx *,xxxxx *),
5350  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5351  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5352  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5353  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5354  xxxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5355  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5356  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5357  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5358  xxxxxxxxxxxx(const xxxxxxxxx *,xxxxx *),
5359  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5360  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5361  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5362  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5363  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5364  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5365  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5366  xxxxxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5367  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5368  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5369  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5370  xxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5371  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5372  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5373  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5374  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5375  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5376  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5377  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5378  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5379  xxxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5380  xxxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5381  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5382  xxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5383  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5384  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx),
5385  xxxxxxxxxxxxx(const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx);
5386
5387extern xxxxxx xxxx
5388  xxxxxxxxxxxxxxxxx(const xxxxxxxxx *,xxxxx *),
5389  xxxxxxxxxxxxx(xxxxx *,const xxxxxxxxxxxx *),
5390  xxxxxxxxxxxxxx(xxxxx *),
5391  xxxxxxxxxxxxxxxxxxx(xxxxx *,const xxxxxxxxxxxxxxx *,xxxxx *,const int x,
5392    const int x,const xxxxxxxxxxx),
5393  xxxxxxxxxxxxx(xxxxx *,const char *,const char *),
5394  xxxxxxxxxxxx(xxxxx *,const char *),
5395  xxxxxxxxxxxxxx(xxxxx *,const xxxxxxxxxxxxxxxxx,xxxxx *,const int,const int),
5396  xxxxxxxxxxxxxxxx(xxxxx *),
5397  xxxxxxxxxxxxx(xxxxx *),
5398  xxxxxxxxxxxxx(xxxxx *,const xxxxxxxx int),
5399  xxxxxxxxxxxxxxxxxx(xxxxx *,const int),
5400  xxxxxxxxxxxxxxxxx(xxxxx *),
5401  xxxxxxxxxxxxx(xxxxx *,xxxx *,const xxxxxxxx int),
5402  xxxxxxxxxxxxxxxxxxx(xxxxxxxxxxxx *),
5403  xxxxxxxxxxxx(xxxxx *),
5404  xxxxxxxxxxxxxxxx(xxxxxxxxx *),
5405  xxxxxxxxxxxxx(xxxxx *),
5406  xxxxxxxxxxxxxxxxxx(xxxxxxxxxxx *),
5407  xxxxxxxxx(xxxxx *,const xxxxxxxxxxxx *),
5408  xxxxxxxxxxxxx(xxxxx *),
5409  xxxxxxxxxx(xxxxx *,const char *),
5410  xxxxxxxxxxxxxxx(const xxxxxxxxx *,xxxxxxxxxxxx *),
5411  xxxxxxxxxxxx(xxxxxxxxx *),
5412  xxxxxxxxxxxxxx(xxxxxxxxxxx *),
5413  xxxxxxxxx(const xxxxx *,xxxxx *,xxxxx *,xxxxx *,xxxxx *),
5414  xxxxxxxxxx(xxxxx *,const char *),
5415  xxxxxxxxxx(xxxxx *,const xxxxxxxxx),
5416  xxxxxxxxxxxxxx(xxxx *),
5417  xxxxxxxxxxxxxxxxxxx(xxxxx *,const xxxxxxxxxxxxxxx *,const xxxxxxxx int,
5418    const int x,const int x,const xxxxxxxxxxx),
5419  xxxxxxxxxx(xxxxx *),
5420  xxxxxxxxxxxxx(xxxxx *,const char *),
5421  xxxxxxxxxxxx(const xxxxxxxxx *,const int,char **,xxxxx **),
5422  xxxxxxxxxxxxx(const xxxxxxxxx *,const int,char **,xxxxx **),
5423  xxxxxxxxxxx(xxxxx *,const xxxxxxxx int),
5424  xxxxxxxxxxxxxx(xxxxx *),
5425  xxxxxxxxxxx(xxxxx *,const char *,const char *),
5426  xxxxxxxxxx(xxxxx *,const xxxxxxxxxxxxx *,const int),
5427  xxxxxxxxxxxxxxxxx(xxxxx *,const xxxxxxxxxxxxxx),
5428  xxxxxxxx(xxxxx *),
5429  xxxxxxxxxxxx(xxxxxxxxx *,const xxxxxxxx int),
5430  xxxxxxxxxxxxxx(xxxxx *),
5431  xxxxxxxxxxxxx(xxxxx *,const double),
5432  xxxxxxxxxxxxxxxxxxxxxxx(xxxxx *),
5433  xxxxxxxxx(xxxxx *),
5434  xxxxxxxxxxxx(xxxxx *,xxxxx *),
5435  xxxxxxxxxxxxxx(xxxxx *,const double),
5436  xxxxxxxxxxxx(const xxxxxxx,const xxxxxxx,const xxxxxxx,double *,double *,
5437    double *),
5438  xxxxxxxxxxxxxx(xxxxx **,const char *,const char *),
5439  xxxxxxxxxxxxxxxxx(xxxxx *,const xxxxxxxxxxxxxx),
5440  xxxxxxxxxxxxxxxx(xxxxx *,const char *);
5441
5442#if defined(xxxxxxxxxxx) || defined(xxxxxxxxxx)
5443}
5444#endif
5445
5446#endif'
5447		OUTPUT - $'/*
5448  xxxxxxxxxxx xxxxx xxxxxxx.
5449*/
5450#ifndef xxxxxxxx
5451#define xxxxxxxx
5452
5453#if defined(xxxxxxxxxxx) || defined(xxxxxxxxxx)
5454extern __MANGLE__ "x" {
5455#endif
5456
5457#if defined(xxxxxxxxxxx)
5458/*
5459  xxxxx xxxxxxx xx [0..65535].
5460*/
5461#define xxxxxxxxx(xxxxxxx)  (((xxxxxxxx long) (xxxxxxx)) >> 8)
5462#define xxxxxxxxxxxxxx "#%04x%04x%04x"
5463#define xxxxxx  65535x
5464#define xxxxxxxxxxxx  65535x
5465#define xxxxxxxxxxxx  16
5466#define xxxxxxx(xxxxxxx)  (((xxxxxxxx long) (xxxxxxx))*257)
5467#define xxxxxxxxxx(xxxxx)  ((xxxxxxxx long) (xxxxx))
5468#define xxxxxxxx(xxxxx)  ((xxxxxxxx long) (xxxxx))
5469
5470xxxxxxx xxxxxxxx short xxxxxxx;
5471#else
5472/*
5473  xxxxx xxxxxxx xx [0..255].
5474*/
5475#define xxxxxxxxx(xxxxxxx)  ((xxxxxxxx long) (xxxxxxx))
5476#define xxxxxxxxxxxxxx "#%02x%02x%02x"
5477#define xxxxxx  255
5478#define xxxxxxxxxxxx  255
5479#define xxxxxxxxxxxx  8
5480#define xxxxxxx(xxxxxxx)  ((xxxxxxxx long) (xxxxxxx))
5481#define xxxxxxxxxx(xxxxx)  (((xxxxxxxx long) (xxxxx)) >> 8)
5482#define xxxxxxxx(xxxxx)  (((xxxxxxxx long) (xxxxx))*257)
5483
5484xxxxxxx xxxxxxxx char xxxxxxx;
5485#endif
5486
5487/*
5488  3x xxxxxxx.
5489*/
5490#define xxxxxxxxxxxxxxxxxx  xxxxxxx(80)
5491#define xxxxxxxxxxxxxxxxx  xxxxxxx(125)
5492#define xxxxxxxxxxxxxx  xxxxxxx(135)
5493#define xxxxxxxxxxxxx  xxxxxxx(185)
5494#define xxxxxxxxxxxxxx  xxxxxxx(110)
5495
5496/*
5497  xxxxxxx xxxxxxxxxxxx.
5498*/
5499xxxxxxx struct xxxxxxxxx
5500{
5501  char
5502    *xxxx;
5503
5504  long
5505    xxxxxx,
5506    xxxxxx,
5507    xxxxxx,
5508    xxxxxxx;
5509} xxxxxxxx;
5510
5511xxxxxxx struct xxxxxxxxxxxxxx
5512{
5513  char
5514    *xxxx;
5515
5516  xxxxxxxx char
5517    xxx,
5518    xxxxx,
5519    xxxx;
5520} xxxxxxxxxxxxx;
5521
5522xxxxxxx struct xxxxxxxxxxxx
5523{
5524  xxxxxxxx short
5525    xxx,
5526    xxxxx,
5527    xxxx,
5528    xxxxx;
5529
5530  xxxxxxxx char
5531    xxxxx;
5532
5533  char
5534    xxx[3];
5535
5536  xxxxxxxx long
5537    xxxxx;
5538} xxxxxxxxxxx;
5539
5540xxxxxxx struct xxxxxxxxxxxxxxxxx
5541{
5542  int
5543    xxxxx;
5544
5545  double
5546    xxxxxx;
5547} xxxxxxxxxxxxxxxx;
5548
5549xxxxxxx struct xxxxxxxxxxx
5550{
5551  double
5552    (*xxxxxxxx) __PROTO__((double)),
5553    xxxxxxx;
5554} xxxxxxxxxx;
5555
5556xxxxxxx struct xxxxxxxxxx
5557{
5558  int
5559    x,
5560    x;
5561
5562  xxxxxxxx int
5563    xxxxx,
5564    xxxxxx;
5565
5566  int
5567    xxxxxxxxxxx,
5568    xxxxxxxxxxx;
5569} xxxxxxxxx;
5570
5571xxxxxxx struct xxxxxxxxxx
5572{
5573  /*
5574    xxxx xxxxxx.
5575  */
5576  xxxxxxxx
5577    xxxx;
5578  /*
5579    xxxx xxx xxxxx xxxxxxxxx xxxxxxx.
5580  */
5581  xxxx
5582    *xxxx;
5583
5584  char
5585    xxxxxxxx[xxxxxxxxxxxxx],
5586    xxxxxx[xxxxxxxxxxxxx],
5587    xxxxxx[xxxxxxxxxxxxx],
5588    xxxx[xxxxxxxxxxxxx];
5589
5590  xxxxxxxx int
5591    xxxxxx,
5592    xxxxxxxxx,
5593    xxxxxx,
5594    xxxxxxxx,
5595    xxxxxxxx,
5596    xxxxx,
5597    xxxx;
5598
5599  char
5600    *xxxx,
5601    *xxxx,
5602    *xxxx;
5603
5604  xxxxxxxxxxxxx
5605    xxxxxxxxx;
5606
5607  xxxxxxxxxxxxxx
5608    xxxxx;
5609
5610  /*
5611    xxxxxxxxxxx xxxxxxx.
5612  */
5613  xxxxxxxxxxxxxxx
5614    xxxxxxxxxxx;
5615
5616  xxxxxxxx int
5617    xxxxxxx;
5618
5619  /*
5620    xxxxxxxxxx xxxxxxx.
5621  */
5622  char
5623    *xxxxxxxxxxx,
5624    *xxx,
5625    *xxxx,
5626    *xxx,
5627    *xxxxxxx,
5628    *xxxxxxx;
5629
5630  xxxxxxxx int
5631    xxxxxxxxx,
5632    xxxxxxxxx,
5633    xxxxxxxxx;
5634
5635  int
5636    xxxx;
5637
5638  char
5639    *xxxxxxxxxxxxxxxx,
5640    *xxxxxxxxxxxx,
5641    *xxxxxxxxxxx;
5642
5643  /*
5644    xxxxx xxxxxxxxx xxxxxxx.
5645  */
5646  xxxxxxxx int
5647    xxxxxx,
5648    xxxxxxxxxx;
5649
5650  xxxxxxxxxxxxxx
5651    xxxxxxxxxx;
5652
5653  /*
5654    xxxxxxxxx xxxxxxx.
5655  */
5656  char
5657    *xxxxxxx,
5658    *xxxxx,
5659    *xxxxxxxxxx;
5660
5661  xxxxxxxx int
5662    xxxxxxxxxxxxxxxxxxxxxx,
5663    xxxxxxxxxxxxxxx,
5664    xxxxxxxxxxxxxxxx;
5665
5666  /*
5667    xxxxxxxxxxxxx xxxxxxx.
5668  */
5669  xxxxxxxx int
5670    xxxxxxx;
5671
5672  xxxxxxxxxxx
5673    xxxxxxxxxxxx;
5674
5675  char
5676    *xxxx;
5677
5678  long
5679    xxxxx;
5680} xxxxxxxxx;
5681
5682xxxxxxx struct xxxxxxxxxxxx
5683{
5684  char
5685    xxxxxxxx[xxxxxxxxxxxxx];
5686
5687  char
5688    *xxxxxxxx,
5689    *xxxx,
5690    *xxxxxxxxxxxxxxxx,
5691    *xxxxxxxxxxxx,
5692    *xxxxxxxxxxx,
5693    *xxxxx,
5694    *xxxxx,
5695    *xxxxxxx,
5696    *xxx,
5697    *xxxx;
5698
5699  xxxxxxxx int
5700    xxxxxxxxx,
5701    xxxxxxxxxxxx,
5702    xxxxxxx,
5703    xxxxxx;
5704
5705  xxxxxxxxxxxxxxxxx
5706    xxxxxxx;
5707} xxxxxxxxxxx;
5708
5709xxxxxxx struct xxxxxxxxxx
5710{
5711  double
5712    x,
5713    x,
5714    x;
5715} xxxxxxxxx;
5716
5717xxxxxxx struct xxxxxxxxxxxxxx
5718{
5719  xxxxxxxxxxxxx
5720    xxxxxxxxx;
5721
5722  xxxxxxxx int
5723    xxxxxxxxxxx;
5724
5725  double
5726    x,
5727    x;
5728
5729  xxxxxxxxxxx
5730    xxxxxx;
5731
5732  char
5733    *xxxx;
5734} xxxxxxxxxxxxx;
5735
5736xxxxxxx struct xxxxxxxxxxxxxx
5737{
5738  xxxxxxxx int
5739    xxxxx,
5740    xxxxxx;
5741
5742  int
5743    x,
5744    x;
5745} xxxxxxxxxxxxx;
5746
5747xxxxxxx struct xxxxxxxxxxxxxxxx
5748{
5749  xxxxxxx
5750    xxx,
5751    xxxxx,
5752    xxxx,
5753    xxxxxx;
5754
5755  xxxxxxxx short
5756    xxxxx;
5757} xxxxxxxxxxxxxxx;
5758
5759xxxxxxx struct xxxxxxxxxxxx
5760{
5761  double
5762    xx,
5763    xx,
5764    xx,
5765    xx;
5766} xxxxxxxxxxx;
5767
5768xxxxxxx struct xxxxxxxxxxxx
5769{
5770  xxxxxxxx int
5771    xxxxxx;
5772
5773  xxxxxxxx char
5774    *xxxx;
5775} xxxxxxxxxxx;
5776
5777xxxxxxx struct xxxxxxxxxxxxxxxxx
5778{
5779  xxxxxxxxx
5780    xxxxxxxxxxx,
5781    xxxxxxxxxxxxx,
5782    xxxxxxxxxxxx,
5783    xxxxxxxxxxx;
5784} xxxxxxxxxxxxxxxx;
5785
5786xxxxxxx struct xxxxxx
5787{
5788  xxxxxxxx
5789    xxxx;
5790
5791  xxxx
5792    *xxxx;
5793
5794  int
5795    xxxxxx,
5796    xxxxxx,
5797    xxxxxxxxx;
5798
5799  char
5800    xxxxxxxx[xxxxxxxxxxxxx];
5801
5802  long int
5803    xxxxxxxx;
5804
5805  int
5806    xxxx;
5807
5808  char
5809    xxxxxx[xxxxxxxxxxxxx],
5810    *xxxxxxxx,
5811    *xxxxx;
5812
5813  xxxxxxxxx
5814#if defined(xxxxxxxxxxx) || defined(xxxxxxxxxx)
5815    xxxxxxx;
5816#else
5817    xxxxx;
5818#endif
5819
5820  xxxxxxxx int
5821    xxxxx;
5822
5823  xxxxxxxxxxxxxxx
5824    xxxxxxxxxxx;
5825
5826  xxxxxxxx int
5827    xxxxxxx,
5828    xxxx,
5829    xxxxx;
5830
5831  int
5832    xxxxxx;
5833
5834  xxxxxxxxxxxxx
5835    xxxxxxxxx;
5836
5837  xxxxxxxxxxxxx
5838    xxxxxxxxx;
5839
5840  xxxxxxxx int
5841    xxxxx;
5842
5843  char
5844    *xxxxxxx,
5845    *xxxxxxxxx;
5846
5847  xxxxxxxxxxx
5848    *xxxxxxxx;
5849
5850  xxxxxxxx int
5851    xxxxxx;
5852
5853  xxxxxxxxxxxxxx
5854    xxxxxxxxxx;
5855
5856  xxxxxxxxxxxxxxx
5857    xxxxxxxxxxxxxxxx;
5858
5859  double
5860    xxxxx;
5861
5862  xxxxxxxxxxxxxxxx
5863    xxxxxxxxxxxx;
5864
5865  xxxxxxxxxxx
5866    xxxxxxxxxxxxx,
5867    xxxxxxxxxxxx;
5868
5869  xxxxxxxxxxxxxx
5870    xxxxx;
5871
5872  double
5873    xxxxxxxxxxxx,
5874    xxxxxxxxxxxx;
5875
5876  char
5877    *xxxxxxxxx;
5878
5879  xxxxxxxxxxxxxxx
5880    *xxxxxx;
5881
5882  xxxxxxxx long
5883    xxxxxxx;
5884
5885  xxxxxxxx int
5886    xxxxxxxxxxx;
5887
5888  xxxxxxxx char
5889    *xxxxxxxxxxxxx;
5890
5891  xxxxxxxxxxx
5892    xxxxxxxxxxxxxxxx,
5893    xxxxxxxxxxxx,
5894    xxxxxxxxxxx;
5895
5896  char
5897    *xxxxxxxx,
5898    *xxxx;
5899
5900  xxxxxxxx int
5901    xxxxxxx,
5902    xxxxx,
5903    xxxxxxxxxx;
5904
5905  int
5906    xxxx;
5907
5908  xxxxxxxxxx
5909    xxxxxx;
5910
5911  double
5912    xxxx;
5913
5914  xxxxxxxx long
5915    xxxxxxxxxxxx;
5916
5917  xxxxxxxx int
5918    xxxxxxxxxxxxxxxxxxxx;
5919
5920  double
5921    xxxxxxxxxxxxxxxxxxxxx,
5922    xxxxxxxxxxxxxxxxxxxxxxxx;
5923
5924  long int
5925    xxxxxxxxxxx;
5926
5927  char
5928    xxxxxxxxxxxxxxx[xxxxxxxxxxxxx];
5929
5930  xxxxxxxx int
5931    xxxxxxxxxxxxxx,
5932    xxxxxxxxxxx;
5933
5934  int
5935    xxxxxxxxxxxxxxxxxxxxxx,
5936    xxxxxxx;
5937
5938  xxxxxxxx int
5939    xxxxxx;
5940
5941  struct xxxxxx
5942    *xxxxxxxx,
5943    *xxxx,
5944    *xxxx;
5945} xxxxx;
5946
5947xxxxxxx struct xxxxxxxxxxxxx
5948{
5949  xxxxxxxxx
5950    *xxxxxxxxxx;
5951
5952  xxxxxxxx int
5953    xxxxxxx;
5954
5955  char
5956    *xxxxxxxx,
5957    *xxxx,
5958    *xxxxxxxxx,
5959    *xxxxxxxxx;
5960
5961  double
5962    xxxxxxx;
5963
5964  xxxxx
5965    *xxxx;
5966
5967  xxxxxxxxxxxxx
5968    xxxxxx;
5969} xxxxxxxxxxxx;
5970
5971xxxxxxx struct xxxxxxxxxxx
5972{
5973  const char
5974    *xxx;
5975
5976  xxxxx
5977    *(*xxxxxxx) __PROTO__((const xxxxxxxxx *));
5978
5979  xxxxxxxx int
5980    (*xxxxxxx) __PROTO__((const xxxxxxxxx *,xxxxx *)),
5981    (*xxxxxx) __PROTO__((const xxxxxxxx char *,const xxxxxxxx int)),
5982    xxxxxx,
5983    xxxxxxxxxxxx;
5984
5985  const char
5986    *xxxxxxxxxxx;
5987
5988  xxxx
5989    *xxxx;
5990
5991  struct xxxxxxxxxxx
5992    *xxxxxxxx,
5993    *xxxx;
5994} xxxxxxxxxx;
5995
5996/*
5997  xxxxx const xxxxxxxxxxxx.
5998*/
5999extern __MANGLE__ const char
6000  *xxxxxxxx,
6001  *xxxxxxxxxxxxxxx,
6002  *xxxxxxxxxxx,
6003  *xxxxxxxxxxxxxxxx,
6004  *xxxxxxxxxxxxxxxx,
6005  *xxxxxxxxxxxxxxxxxxx,
6006  *xxxxxxxxxxxxxxxx,
6007  *xxxxxxxxxxxxxxx,
6008  *xxxxxxxxxx,
6009  *xxxxxxxxxxxxx,
6010  *xxxxxxxxxxxxxx,
6011  *xxxxxxxxxxxxxxxxx,
6012  *xxxxxxxxxxxxxx,
6013  *xxxxxxxxxxxxxx,
6014  *xxxxxxxxxxxxxxxxxxxxxxxx,
6015  *xxxxxxxxxxxxx,
6016  *xxxxxxxxxxxxxx,
6017  *xxxxxxxxxxxxxxx;
6018
6019extern __MANGLE__ const xxxxxxxxxxxxx
6020  xxxxxxxxxxxx[235],
6021  xxxxxxxxxx[757];
6022
6023/*
6024  xxxxx xxxxxxxxx xxxxxxx.
6025*/
6026extern __MANGLE__ xxxxxx xxxxxxxxxxxx
6027  *xxxxxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *,const xxxxxxxxxxxx *));
6028
6029extern __MANGLE__ xxxxxx xxxxx
6030  *xxxxxxxxxxxxx __PROTO__((const xxxxx *,const xxxxxxxxx)),
6031  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *)),
6032  *xxxxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxx int)),
6033  *xxxxxxxxxxxxx __PROTO__((const xxxxx *)),
6034  *xxxxxxxxx __PROTO__((const xxxxx *,const double)),
6035  *xxxxxxxxxxx __PROTO__((const xxxxx *,const xxxxxxxxxxxxx *)),
6036  *xxxxxxxxx __PROTO__((const xxxxx *,const xxxxxxxxxxxxx *)),
6037  *xxxxxxxxxx __PROTO__((const xxxxx *,const xxxxxxxx int,const xxxxxxxx int,
6038    const xxxxxxxx int)),
6039  *xxxxxxxxxxx __PROTO__((const xxxxxxxx int,const xxxxxxxx int,const xxxxx *,
6040    const xxxxx *,const xxxxx *,const xxxxx *)),
6041  *xxxxxxxxx __PROTO__((const xxxxx *,const xxxxxxxxxxxxx *)),
6042  *xxxxxxxxxxxxxx __PROTO__((xxxxx *)),
6043  *xxxxxxxxx __PROTO__((const xxxxx *,const double)),
6044  *xxxxxxxxxxx __PROTO__((const xxxxx *)),
6045  *xxxxxxxxxxxx __PROTO__((const xxxxx *)),
6046  *xxxxxxxxx __PROTO__((const xxxxx *)),
6047  *xxxxxxxxx __PROTO__((const xxxxx *)),
6048  *xxxxxxxxxx __PROTO__((const xxxxx *,const xxxxxxxxx *)),
6049  *xxxxxxxxxxxx __PROTO__((xxxxx *,const double)),
6050  **xxxxxxxxxxxxxxxx __PROTO__((const xxxxx *,xxxxxxxx int *)),
6051  *xxxxxxxxxxxx __PROTO__((xxxxx *)),
6052  *xxxxxxxxxxx __PROTO__((xxxxx *)),
6053  *xxxxxxxxxxxxx __PROTO__((const xxxxx *,const xxxxxxxxxxx *)),
6054  *xxxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxx int)),
6055  *xxxxxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxx int)),
6056  *xxxxxxxxx __PROTO__((const xxxxxxxxx *)),
6057  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6058  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6059  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6060  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6061  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6062  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6063  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6064  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6065  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6066  *xxxxxxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6067  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6068  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6069  *xxxxxxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6070  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6071  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6072  *xxxxxxxxx __PROTO__((xxxxxxxxx *)),
6073  *xxxxxxxxxx __PROTO__((xxxxxxxxx *)),
6074  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6075  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6076  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6077  *xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6078  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6079  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6080  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6081  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6082  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6083  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6084  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6085  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6086  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6087  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6088  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6089  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6090  *xxxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6091  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6092  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6093  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6094  *xxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6095  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6096  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6097  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6098  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6099  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6100  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6101  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6102  *xxxxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6103  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6104  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6105  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6106  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6107  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6108  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6109  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6110  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6111  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6112  *xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6113  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6114  *xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6115  *xxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6116  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6117  *xxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6118  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6119  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6120  *xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx)),
6121  *xxxxxxxxxxxxxxxx __PROTO__((const xxxxx *)),
6122  *xxxxxxxxx __PROTO__((const xxxxx *,const int,const int)),
6123  *xxxxxxxxxxx __PROTO__((const xxxxx *,const double,const xxxxxxxx int,
6124    const xxxxxxxx int)),
6125  *xxxxxxxxxxx __PROTO__((const xxxxx *,const xxxxxxxx int,const xxxxxxxx int)),
6126  *xxxxxxxxxx __PROTO__((const xxxxx *,const xxxxxxxx int,const xxxxxxxx int)),
6127  *xxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxx int,double,double)),
6128  *xxxxxxxxxxxx __PROTO__((const xxxxx *,const double)),
6129  *xxxxxxxxxx __PROTO__((const xxxxx *,const double,const double,const xxxxxxxx int)),
6130  *xxxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxx int)),
6131  *xxxxxxxxxxxx __PROTO__((xxxxx *,xxxxx *)),
6132  *xxxxxxxxxxx __PROTO__((xxxxx *,const xxxxx *)),
6133  *xxxxxxxxxx __PROTO__((xxxxx *,double)),
6134  *xxxxxxxxx __PROTO__((xxxxx *,const double,const double)),
6135  *xxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxx int,const xxxxxxxx int));
6136
6137extern __MANGLE__ xxxxxx xxxxxxxxx
6138  *xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *));
6139
6140extern __MANGLE__ xxxxxx xxxxxxxxx
6141  xxxxxxxxxxxx __PROTO__((xxxxx *));
6142
6143extern __MANGLE__ xxxxxx int
6144  xxxxxxxxxxxxx __PROTO__((const char *,int *,int *,xxxxxxxx int *,xxxxxxxx int *)),
6145  xxxxxxxxxxxxxxxxxx __PROTO__((const char *,int *,int *,xxxxxxxx int *,xxxxxxxx int *));
6146
6147extern __MANGLE__ xxxxxx xxxxxxxxxx
6148  *xxxxxxxxxxxxx __PROTO__((const char *)),
6149  *xxxxxxxxxxxxxxxxxx __PROTO__((const char *,xxxxx *(*)(const xxxxxxxxx *),
6150    xxxxxxxx int (*)(const xxxxxxxxx *,xxxxx *),
6151    xxxxxxxx int (*)(const xxxxxxxx char *,const xxxxxxxx int),
6152    const xxxxxxxx int,const xxxxxxxx int,const char *));
6153
6154extern __MANGLE__ xxxxxx xxxxxxxx int
6155  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6156  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6157  xxxxxxxxxxxxxxx __PROTO__((const xxxxx *)),
6158  xxxxxxxxxx __PROTO__((const char *)),
6159  xxxxxxxxxxx __PROTO__((xxxxx *)),
6160  xxxxxxxxxxxxxxxxx __PROTO__((xxxxx *)),
6161  xxxxxxxxxxxxx __PROTO__((xxxxx *)),
6162  xxxxxxxxxx __PROTO__((const char *,const xxxxxxxx int)),
6163  xxxxxxxxx __PROTO__((const xxxxx *)),
6164  xxxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxxxxx *,int,int)),
6165  xxxxxxxxxxxxxxxxxx __PROTO__((const char *,xxxxxxxxxxx *)),
6166  xxxxxxxxxxxxxxx __PROTO__((xxxxx *)),
6167  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6168  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6169  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6170  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6171  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6172  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6173  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6174  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6175  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6176  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6177  xxxxxxxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx, xxxxx *xxxxx)),
6178  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6179  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6180  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6181  xxxxxxxxxx __PROTO__((const xxxxxxxxx *,xxxxx *)),
6182  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6183  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6184  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6185  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6186  xxxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6187  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6188  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6189  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6190  xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *,xxxxx *)),
6191  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6192  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6193  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6194  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6195  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6196  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6197  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6198  xxxxxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6199  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6200  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6201  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6202  xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6203  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6204  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6205  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6206  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6207  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6208  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6209  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6210  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6211  xxxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6212  xxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6213  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6214  xxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6215  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6216  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx)),
6217  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *xxxxxxxxxx,xxxxx *xxxxx));
6218
6219extern __MANGLE__ xxxxxx xxxx
6220  xxxxxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *,xxxxx *)),
6221  xxxxxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxxxxxx *)),
6222  xxxxxxxxxxxxxx __PROTO__((xxxxx *)),
6223  xxxxxxxxxxxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxxxxxxxxx *,xxxxx *,const int x,
6224    const int x,const xxxxxxxxxxx)),
6225  xxxxxxxxxxxxx __PROTO__((xxxxx *,const char *,const char *)),
6226  xxxxxxxxxxxx __PROTO__((xxxxx *,const char *)),
6227  xxxxxxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxxxxxxxxxxx,xxxxx *,const int,const int)),
6228  xxxxxxxxxxxxxxxx __PROTO__((xxxxx *)),
6229  xxxxxxxxxxxxx __PROTO__((xxxxx *)),
6230  xxxxxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxx int)),
6231  xxxxxxxxxxxxxxxxxx __PROTO__((xxxxx *,const int)),
6232  xxxxxxxxxxxxxxxxx __PROTO__((xxxxx *)),
6233  xxxxxxxxxxxxx __PROTO__((xxxxx *,xxxx *,const xxxxxxxx int)),
6234  xxxxxxxxxxxxxxxxxxx __PROTO__((xxxxxxxxxxxx *)),
6235  xxxxxxxxxxxx __PROTO__((xxxxx *)),
6236  xxxxxxxxxxxxxxxx __PROTO__((xxxxxxxxx *)),
6237  xxxxxxxxxxxxx __PROTO__((xxxxx *)),
6238  xxxxxxxxxxxxxxxxxx __PROTO__((xxxxxxxxxxx *)),
6239  xxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxxxxxx *)),
6240  xxxxxxxxxxxxx __PROTO__((xxxxx *)),
6241  xxxxxxxxxx __PROTO__((xxxxx *,const char *)),
6242  xxxxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *,xxxxxxxxxxxx *)),
6243  xxxxxxxxxxxx __PROTO__((xxxxxxxxx *)),
6244  xxxxxxxxxxxxxx __PROTO__((xxxxxxxxxxx *)),
6245  xxxxxxxxx __PROTO__((const xxxxx *,xxxxx *,xxxxx *,xxxxx *,xxxxx *)),
6246  xxxxxxxxxx __PROTO__((xxxxx *,const char *)),
6247  xxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxxx)),
6248  xxxxxxxxxxxxxx __PROTO__((xxxx *)),
6249  xxxxxxxxxxxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxxxxxxxxx *,const xxxxxxxx int,
6250    const int x,const int x,const xxxxxxxxxxx)),
6251  xxxxxxxxxx __PROTO__((xxxxx *)),
6252  xxxxxxxxxxxxx __PROTO__((xxxxx *,const char *)),
6253  xxxxxxxxxxxx __PROTO__((const xxxxxxxxx *,const int,char **,xxxxx **)),
6254  xxxxxxxxxxxxx __PROTO__((const xxxxxxxxx *,const int,char **,xxxxx **)),
6255  xxxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxx int)),
6256  xxxxxxxxxxxxxx __PROTO__((xxxxx *)),
6257  xxxxxxxxxxx __PROTO__((xxxxx *,const char *,const char *)),
6258  xxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxxxxxxx *,const int)),
6259  xxxxxxxxxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxxxxxxxx)),
6260  xxxxxxxx __PROTO__((xxxxx *)),
6261  xxxxxxxxxxxx __PROTO__((xxxxxxxxx *,const xxxxxxxx int)),
6262  xxxxxxxxxxxxxx __PROTO__((xxxxx *)),
6263  xxxxxxxxxxxxx __PROTO__((xxxxx *,const double)),
6264  xxxxxxxxxxxxxxxxxxxxxxx __PROTO__((xxxxx *)),
6265  xxxxxxxxx __PROTO__((xxxxx *)),
6266  xxxxxxxxxxxx __PROTO__((xxxxx *,xxxxx *)),
6267  xxxxxxxxxxxxxx __PROTO__((xxxxx *,const double)),
6268  xxxxxxxxxxxx __PROTO__((const xxxxxxx,const xxxxxxx,const xxxxxxx,double *,double *,
6269    double *)),
6270  xxxxxxxxxxxxxx __PROTO__((xxxxx **,const char *,const char *)),
6271  xxxxxxxxxxxxxxxxx __PROTO__((xxxxx *,const xxxxxxxxxxxxxx)),
6272  xxxxxxxxxxxxxxxx __PROTO__((xxxxx *,const char *));
6273
6274#if defined(xxxxxxxxxxx) || defined(xxxxxxxxxx)
6275}
6276#endif
6277
6278#endif'
6279	EXEC -fhn
6280		INPUT - $'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6281xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6282xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6283xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6284xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6285xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6286xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6287xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6288xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6289xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6290xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6291xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6292xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6293xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6294xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6295xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6296xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6297xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6298xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6299xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6300xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6301xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6302xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6303xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6304xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6305xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6306xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6307xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6308xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6309xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6310xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6311xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6312xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6313xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6314xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6315xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6316xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6317xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6318xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6319xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6320xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6321xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6322xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6323xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6324xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6325xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6326xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6327xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6328xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6329xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6330xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6331xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6332xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6333xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6334xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6335xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6336xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6337xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6338xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6339xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6340xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6341xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6342xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6343xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6344xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6345xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6346xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6347xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6348xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6349xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6350xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6351xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6352xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6353xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6354xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6355xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6356xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6357xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6358xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6359xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6360xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6361xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6362xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6363xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6364xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6365xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6366xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6367xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6368xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6369xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6370xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6371xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6372xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6373xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6374xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6375xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6376xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6377xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6378xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6379xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6380xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6381xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6382xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
6383f(x);'
6384		SAME OUTPUT INPUT
6385
6386TEST 09 'more buffer boundaries'
6387	EXEC -nh
6388		INPUT - $'#pragma prototyped
6389/*
6390 *\t$XConsortium: X.h,v 1.66 88/09/06 15:55:56 jim Exp $
6391 */
6392
6393/* Definitions for the X window system likely to be used by applications */
6394
6395#ifndef X_H
6396#define X_H
6397
6398/***********************************************************
6399Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
6400and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
6401
6402                        All Rights Reserved
6403
6404Permission to use, copy, modify, and distribute this software and its
6405documentation for any purpose and without fee is hereby granted,
6406provided that the above copyright notice appear in all copies and that
6407both that copyright notice and this permission notice appear in
6408supporting documentation, and that the names of Digital or MIT not be
6409used in advertising or publicity pertaining to distribution of the
6410software without specific, written prior permission.
6411
6412DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
6413ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
6414DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
6415ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
6416WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
6417ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
6418SOFTWARE.
6419
6420******************************************************************/
6421#define X_PROTOCOL\t11\t\t/* current protocol version */
6422#define X_PROTOCOL_REVISION 0\t\t/* current minor version */
6423
6424/* Resources */
6425
6426typedef unsigned long XID;
6427
6428typedef XID Window;
6429typedef XID Drawable;
6430typedef XID Font;
6431typedef XID Pixmap;
6432typedef XID Cursor;
6433typedef XID Colormap;
6434typedef XID GContext;
6435typedef XID KeySym;
6436
6437typedef unsigned long Mask;
6438
6439typedef unsigned long Atom;
6440
6441typedef unsigned long VisualID;
6442
6443typedef unsigned long Time;
6444
6445typedef unsigned char KeyCode;
6446
6447/*****************************************************************
6448 * RESERVED RESOURCE AND CONSTANT DEFINITIONS
6449 *****************************************************************/
6450
6451#define None                 0L\t/* universal null resource or null atom */
6452
6453#define ParentRelative       1L\t/* background pixmap in CreateWindow
6454\t\t\t\t    and ChangeWindowAttributes */
6455
6456#define CopyFromParent       0L\t/* border pixmap in CreateWindow
6457\t\t\t\t       and ChangeWindowAttributes
6458\t\t\t\t   special VisualID and special window
6459\t\t\t\t       class passed to CreateWindow */
6460
6461#define PointerWindow        0L\t/* destination window in SendEvent */
6462#define InputFocus           1L\t/* destination window in SendEvent */
6463
6464#define PointerRoot          1L\t/* focus window in SetInputFocus */
6465
6466#define AnyPropertyType      0L\t/* special Atom, passed to GetProperty */
6467
6468#define AnyKey\t\t     0L\t/* special Key Code, passed to GrabKey */
6469
6470#define AnyButton            0L\t/* special Button Code, passed to GrabButton */
6471
6472#define AllTemporary         0L\t/* special Resource ID passed to KillClient */
6473
6474#define CurrentTime          0L\t/* special Time */
6475
6476#define NoSymbol\t     0L\t/* special KeySym */
6477
6478/*****************************************************************
6479 * EVENT DEFINITIONS
6480 *****************************************************************/
6481
6482/* Input Event Masks. Used as event-mask window attribute and as arguments
6483   to Grab requests.  Not to be confused with event names.  */
6484
6485#define NoEventMask\t\t\t0L
6486#define KeyPressMask\t\t\t(1L<<0)
6487#define KeyReleaseMask\t\t\t(1L<<1)
6488#define ButtonPressMask\t\t\t(1L<<2)
6489#define ButtonReleaseMask\t\t(1L<<3)
6490#define EnterWindowMask\t\t\t(1L<<4)
6491#define LeaveWindowMask\t\t\t(1L<<5)
6492#define PointerMotionMask\t\t(1L<<6)
6493#define PointerMotionHintMask\t\t(1L<<7)
6494#define Button1MotionMask\t\t(1L<<8)
6495#define Button2MotionMask\t\t(1L<<9)
6496#define Button3MotionMask\t\t(1L<<10)
6497#define Button4MotionMask\t\t(1L<<11)
6498#define Button5MotionMask\t\t(1L<<12)
6499#define ButtonMotionMask\t\t(1L<<13)
6500#define KeymapStateMask\t\t\t(1L<<14)
6501#define ExposureMask\t\t\t(1L<<15)
6502#define VisibilityChangeMask\t\t(1L<<16)
6503#define StructureNotifyMask\t\t(1L<<17)
6504#define ResizeRedirectMask\t\t(1L<<18)
6505#define SubstructureNotifyMask\t\t(1L<<19)
6506#define SubstructureRedirectMask\t(1L<<20)
6507#define FocusChangeMask\t\t\t(1L<<21)
6508#define PropertyChangeMask\t\t(1L<<22)
6509#define ColormapChangeMask\t\t(1L<<23)
6510#define OwnerGrabButtonMask\t\t(1L<<24)
6511
6512/* Event names.  Used in "type" field in XEvent structures.  Not to be
6513confused with event masks above.  They start from 2 because 0 and 1
6514are reserved in the protocol for errors and replies. */
6515
6516#define KeyPress\t\t2
6517#define KeyRelease\t\t3
6518#define ButtonPress\t\t4
6519#define ButtonRelease\t\t5
6520#define MotionNotify\t\t6
6521#define EnterNotify\t\t7
6522#define LeaveNotify\t\t8
6523#define FocusIn\t\t\t9
6524#define FocusOut\t\t10
6525#define KeymapNotify\t\t11
6526#define Expose\t\t\t12
6527#define GraphicsExpose\t\t13
6528#define NoExpose\t\t14
6529#define VisibilityNotify\t15
6530#define CreateNotify\t\t16
6531#define DestroyNotify\t\t17
6532#define UnmapNotify\t\t18
6533#define MapNotify\t\t19
6534#define MapRequest\t\t20
6535#define ReparentNotify\t\t21
6536#define ConfigureNotify\t\t22
6537#define ConfigureRequest\t23
6538#define GravityNotify\t\t24
6539#define ResizeRequest\t\t25
6540#define CirculateNotify\t\t26
6541#define CirculateRequest\t27
6542#define PropertyNotify\t\t28
6543#define SelectionClear\t\t29
6544#define SelectionRequest\t30
6545#define SelectionNotify\t\t31
6546#define ColormapNotify\t\t32
6547#define ClientMessage\t\t33
6548#define MappingNotify\t\t34
6549#define LASTEvent\t\t35\t/* must be bigger than any event # */
6550
6551
6552/* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
6553   state in various key-, mouse-, and button-related events. */
6554
6555#define ShiftMask\t\t(1<<0)
6556#define LockMask\t\t(1<<1)
6557#define ControlMask\t\t(1<<2)
6558#define Mod1Mask\t\t(1<<3)
6559#define Mod2Mask\t\t(1<<4)
6560#define Mod3Mask\t\t(1<<5)
6561#define Mod4Mask\t\t(1<<6)
6562#define Mod5Mask\t\t(1<<7)
6563
6564/* modifier names.  Used to build a SetModifierMapping request or
6565   to read a GetModifierMapping request.  These correspond to the
6566   masks defined above. */
6567#define ShiftMapIndex\t\t0
6568#define LockMapIndex\t\t1
6569#define ControlMapIndex\t\t2
6570#define Mod1MapIndex\t\t3
6571#define Mod2MapIndex\t\t4
6572#define Mod3MapIndex\t\t5
6573#define Mod4MapIndex\t\t6
6574#define Mod5MapIndex\t\t7
6575
6576
6577/* button masks.  Used in same manner as Key masks above. Not to be confused
6578   with button names below. */
6579
6580#define Button1Mask\t\t(1<<8)
6581#define Button2Mask\t\t(1<<9)
6582#define Button3Mask\t\t(1<<10)
6583#define Button4Mask\t\t(1<<11)
6584#define Button5Mask\t\t(1<<12)
6585
6586#define AnyModifier\t\t(1<<15)  /* used in GrabButton, GrabKey */
6587
6588
6589/* button names. Used as arguments to GrabButton and as detail in ButtonPress
6590   and ButtonRelease events.  Not to be confused with button masks above.
6591   Note that 0 is already defined above as "AnyButton".  */
6592
6593#define Button1\t\t\t1
6594#define Button2\t\t\t2
6595#define Button3\t\t\t3
6596#define Button4\t\t\t4
6597#define Button5\t\t\t5
6598
6599/* Notify modes */
6600
6601#define NotifyNormal\t\t0
6602#define NotifyGrab\t\t1
6603#define NotifyUngrab\t\t2
6604#define NotifyWhileGrabbed\t3
6605
6606#define NotifyHint\t\t1\t/* for MotionNotify events */
6607\t\t
6608/* Notify detail */
6609
6610#define NotifyAncestor\t\t0
6611#define NotifyVirtual\t\t1
6612#define NotifyInferior\t\t2
6613#define NotifyNonlinear\t\t3
6614#define NotifyNonlinearVirtual\t4
6615#define NotifyPointer\t\t5
6616#define NotifyPointerRoot\t6
6617#define NotifyDetailNone\t7
6618
6619/* Visibility notify */
6620
6621#define VisibilityUnobscured\t\t0
6622#define VisibilityPartiallyObscured\t1
6623#define VisibilityFullyObscured\t\t2
6624
6625/* Circulation request */
6626
6627#define PlaceOnTop\t\t0
6628#define PlaceOnBottom\t\t1
6629
6630/* protocol families */
6631
6632#define FamilyInternet\t\t0
6633#define FamilyDECnet\t\t1
6634#define FamilyChaos\t\t2
6635
6636/* Property notification */
6637
6638#define PropertyNewValue\t0
6639#define PropertyDelete\t\t1
6640
6641/* Color Map notification */
6642
6643#define ColormapUninstalled\t0
6644#define ColormapInstalled\t1
6645
6646/* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */
6647
6648#define GrabModeSync\t\t0
6649#define GrabModeAsync\t\t1
6650
6651/* GrabPointer, GrabKeyboard reply status */
6652
6653#define GrabSuccess\t\t0
6654#define AlreadyGrabbed\t\t1
6655#define GrabInvalidTime\t\t2
6656#define GrabNotViewable\t\t3
6657#define GrabFrozen\t\t4
6658
6659/* AllowEvents modes */
6660
6661#define AsyncPointer\t\t0
6662#define SyncPointer\t\t1
6663#define ReplayPointer\t\t2
6664#define AsyncKeyboard\t\t3
6665#define SyncKeyboard\t\t4
6666#define ReplayKeyboard\t\t5
6667#define AsyncBoth\t\t6
6668#define SyncBoth\t\t7
6669
6670/* Used in SetInputFocus, GetInputFocus */
6671
6672#define RevertToNone\t\t(int)None
6673#define RevertToPointerRoot\t(int)PointerRoot
6674#define RevertToParent\t\t2
6675
6676/*****************************************************************
6677 * ERROR CODES
6678 *****************************************************************/
6679
6680#define Success\t\t   0\t/* everything\'s okay */
6681#define BadRequest\t   1\t/* bad request code */
6682#define BadValue\t   2\t/* int parameter out of range */
6683#define BadWindow\t   3\t/* parameter not a Window */
6684#define BadPixmap\t   4\t/* parameter not a Pixmap */
6685#define BadAtom\t\t   5\t/* parameter not an Atom */
6686#define BadCursor\t   6\t/* parameter not a Cursor */
6687#define BadFont\t\t   7\t/* parameter not a Font */
6688#define BadMatch\t   8\t/* parameter mismatch */
6689#define BadDrawable\t   9\t/* parameter not a Pixmap or Window */
6690#define BadAccess\t  10\t/* depending on context:
6691\t\t\t\t - key/button already grabbed
6692\t\t\t\t - attempt to free an illegal
6693\t\t\t\t   cmap entry
6694\t\t\t\t- attempt to store into a read-only
6695\t\t\t\t   color map entry.
6696 \t\t\t\t- attempt to modify the access control
6697\t\t\t\t   list from other than the local host.
6698\t\t\t\t*/
6699#define BadAlloc\t  11\t/* insufficient resources */
6700#define BadColor\t  12\t/* no such colormap */
6701#define BadGC\t\t  13\t/* parameter not a GC */
6702#define BadIDChoice\t  14\t/* choice not in range or already used */
6703#define BadName\t\t  15\t/* font or color name doesn\'t exist */
6704#define BadLength\t  16\t/* Request length incorrect */
6705#define BadImplementation 17\t/* server is defective */
6706
6707#define FirstExtensionError\t128
6708#define LastExtensionError\t255
6709
6710/*****************************************************************
6711 * WINDOW DEFINITIONS
6712 *****************************************************************/
6713
6714/* Window classes used by CreateWindow */
6715/* Note that CopyFromParent is already defined as 0 above */
6716
6717#define InputOutput\t\t1
6718#define InputOnly\t\t2
6719
6720/* Window attributes for CreateWindow and ChangeWindowAttributes */
6721
6722#define CWBackPixmap\t\t(1L<<0)
6723#define CWBackPixel\t\t(1L<<1)
6724#define CWBorderPixmap\t\t(1L<<2)
6725#define CWBorderPixel           (1L<<3)
6726#define CWBitGravity\t\t(1L<<4)
6727#define CWWinGravity\t\t(1L<<5)
6728#define CWBackingStore          (1L<<6)
6729#define CWBackingPlanes\t        (1L<<7)
6730#define CWBackingPixel\t        (1L<<8)
6731#define CWOverrideRedirect\t(1L<<9)
6732#define CWSaveUnder\t\t(1L<<10)
6733#define CWEventMask\t\t(1L<<11)
6734#define CWDontPropagate\t        (1L<<12)
6735#define CWColormap\t\t(1L<<13)
6736#define CWCursor\t        (1L<<14)
6737
6738/* ConfigureWindow structure */
6739
6740#define CWX\t\t\t(1<<0)
6741#define CWY\t\t\t(1<<1)
6742#define CWWidth\t\t\t(1<<2)
6743#define CWHeight\t\t(1<<3)
6744#define CWBorderWidth\t\t(1<<4)
6745#define CWSibling\t\t(1<<5)
6746#define CWStackMode\t\t(1<<6)
6747
6748
6749/* Bit Gravity */
6750
6751#define ForgetGravity\t\t0
6752#define NorthWestGravity\t1
6753#define NorthGravity\t\t2
6754#define NorthEastGravity\t3
6755#define WestGravity\t\t4
6756#define CenterGravity\t\t5
6757#define EastGravity\t\t6
6758#define SouthWestGravity\t7
6759#define SouthGravity\t\t8
6760#define SouthEastGravity\t9
6761#define StaticGravity\t\t10
6762
6763/* Window gravity + bit gravity above */
6764
6765#define UnmapGravity\t\t0
6766
6767/* Used in CreateWindow for backing-store hint */
6768
6769#define NotUseful               0
6770#define WhenMapped              1
6771#define Always                  2
6772
6773/* Used in GetWindowAttributes reply */
6774
6775#define IsUnmapped\t\t0
6776#define IsUnviewable\t\t1
6777#define IsViewable\t\t2
6778
6779/* Used in ChangeSaveSet */
6780
6781#define SetModeInsert           0
6782#define SetModeDelete           1
6783
6784/* Used in ChangeCloseDownMode */
6785
6786#define DestroyAll              0
6787#define RetainPermanent         1
6788#define RetainTemporary         2
6789
6790/* Window stacking method (in configureWindow) */
6791
6792#define Above                   0
6793#define Below                   1
6794#define TopIf                   2
6795#define BottomIf                3
6796#define Opposite                4
6797
6798/* Circulation direction */
6799
6800#define RaiseLowest             0
6801#define LowerHighest            1
6802
6803/* Property modes */
6804
6805#define PropModeReplace         0
6806#define PropModePrepend         1
6807#define PropModeAppend          2
6808
6809/*****************************************************************
6810 * GRAPHICS DEFINITIONS
6811 *****************************************************************/
6812
6813/* graphics functions, as in GC.alu */
6814
6815#define\tGXclear\t\t\t0x0\t\t/* 0 */
6816#define GXand\t\t\t0x1\t\t/* src AND dst */
6817#define GXandReverse\t\t0x2\t\t/* src AND NOT dst */
6818#define GXcopy\t\t\t0x3\t\t/* src */
6819#define GXandInverted\t\t0x4\t\t/* NOT src AND dst */
6820#define\tGXnoop\t\t\t0x5\t\t/* dst */
6821#define GXxor\t\t\t0x6\t\t/* src XOR dst */
6822#define GXor\t\t\t0x7\t\t/* src OR dst */
6823#define GXnor\t\t\t0x8\t\t/* NOT src AND NOT dst */
6824#define GXequiv\t\t\t0x9\t\t/* NOT src XOR dst */
6825#define GXinvert\t\t0xa\t\t/* NOT dst */
6826#define GXorReverse\t\t0xb\t\t/* src OR NOT dst */
6827#define GXcopyInverted\t\t0xc\t\t/* NOT src */
6828#define GXorInverted\t\t0xd\t\t/* NOT src OR dst */
6829#define GXnand\t\t\t0xe\t\t/* NOT src OR NOT dst */
6830#define GXset\t\t\t0xf\t\t/* 1 */
6831
6832/* LineStyle */
6833
6834#define LineSolid\t\t0
6835#define LineOnOffDash\t\t1
6836#define LineDoubleDash\t\t2
6837
6838/* capStyle */
6839
6840#define CapNotLast\t\t0
6841#define CapButt\t\t\t1
6842#define CapRound\t\t2
6843#define CapProjecting\t\t3
6844
6845/* joinStyle */
6846
6847#define JoinMiter\t\t0
6848#define JoinRound\t\t1
6849#define JoinBevel\t\t2
6850
6851/* fillStyle */
6852
6853#define FillSolid\t\t0
6854#define FillTiled\t\t1
6855#define FillStippled\t\t2
6856#define FillOpaqueStippled\t3
6857
6858/* fillRule */
6859
6860#define EvenOddRule\t\t0
6861#define WindingRule\t\t1
6862
6863/* subwindow mode */
6864
6865#define ClipByChildren\t\t0
6866#define IncludeInferiors\t1
6867
6868/* SetClipRectangles ordering */
6869
6870#define Unsorted\t\t0
6871#define YSorted\t\t\t1
6872#define YXSorted\t\t2
6873#define YXBanded\t\t3
6874
6875/* CoordinateMode for drawing routines */
6876
6877#define CoordModeOrigin\t\t0\t/* relative to the origin */
6878#define CoordModePrevious       1\t/* relative to previous point */
6879
6880/* Polygon shapes */
6881
6882#define Complex\t\t\t0\t/* paths may intersect */
6883#define Nonconvex\t\t1\t/* no paths intersect, but not convex */
6884#define Convex\t\t\t2\t/* wholly convex */
6885
6886/* Arc modes for PolyFillArc */
6887
6888#define ArcChord\t\t0\t/* join endpoints of arc */
6889#define ArcPieSlice\t\t1\t/* join endpoints to center of arc */
6890
6891/* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR\'ed into
6892   GC.stateChanges */
6893
6894#define GCFunction              (1L<<0)
6895#define GCPlaneMask             (1L<<1)
6896#define GCForeground            (1L<<2)
6897#define GCBackground            (1L<<3)
6898#define GCLineWidth             (1L<<4)
6899#define GCLineStyle             (1L<<5)
6900#define GCCapStyle              (1L<<6)
6901#define GCJoinStyle\t\t(1L<<7)
6902#define GCFillStyle\t\t(1L<<8)
6903#define GCFillRule\t\t(1L<<9)
6904#define GCTile\t\t\t(1L<<10)
6905#define GCStipple\t\t(1L<<11)
6906#define GCTileStipXOrigin\t(1L<<12)
6907#define GCTileStipYOrigin\t(1L<<13)
6908#define GCFont \t\t\t(1L<<14)
6909#define GCSubwindowMode\t\t(1L<<15)
6910#define GCGraphicsExposures     (1L<<16)
6911#define GCClipXOrigin\t\t(1L<<17)
6912#define GCClipYOrigin\t\t(1L<<18)
6913#define GCClipMask\t\t(1L<<19)
6914#define GCDashOffset\t\t(1L<<20)
6915#define GCDashList\t\t(1L<<21)
6916#define GCArcMode\t\t(1L<<22)
6917
6918#define GCLastBit\t\t22
6919/*****************************************************************
6920 * FONTS
6921 *****************************************************************/
6922
6923/* used in QueryFont -- draw direction */
6924
6925#define FontLeftToRight\t\t0
6926#define FontRightToLeft\t\t1
6927
6928#define FontChange\t\t255
6929
6930/*****************************************************************
6931 *  IMAGING
6932 *****************************************************************/
6933
6934/* ImageFormat -- PutImage, GetImage */
6935
6936#define XYBitmap\t\t0\t/* depth 1, XYFormat */
6937#define XYPixmap\t\t1\t/* depth == drawable depth */
6938#define ZPixmap\t\t\t2\t/* depth == drawable depth */
6939
6940/*****************************************************************
6941 *  COLOR MAP STUFF
6942 *****************************************************************/
6943
6944/* For CreateColormap */
6945
6946#define AllocNone\t\t0\t/* create map with no entries */
6947#define AllocAll\t\t1\t/* allocate entire map writeable */
6948
6949
6950/* Flags used in StoreNamedColor, StoreColors */
6951
6952#define DoRed\t\t\t(1<<0)
6953#define DoGreen\t\t\t(1<<1)
6954#define DoBlue\t\t\t(1<<2)
6955
6956/*****************************************************************
6957 * CURSOR STUFF
6958 *****************************************************************/
6959
6960/* QueryBestSize Class */
6961
6962#define CursorShape\t\t0\t/* largest size that can be displayed */
6963#define TileShape\t\t1\t/* size tiled fastest */
6964#define StippleShape\t\t2\t/* size stippled fastest */
6965
6966/*****************************************************************
6967 * KEYBOARD/POINTER STUFF
6968 *****************************************************************/
6969
6970#define AutoRepeatModeOff\t0
6971#define AutoRepeatModeOn\t1
6972#define AutoRepeatModeDefault\t2
6973
6974#define LedModeOff\t\t0
6975#define LedModeOn\t\t1
6976
6977/* masks for ChangeKeyboardControl */
6978
6979#define KBKeyClickPercent\t(1L<<0)
6980#define KBBellPercent\t\t(1L<<1)
6981#define KBBellPitch\t\t(1L<<2)
6982#define KBBellDuration\t\t(1L<<3)
6983#define KBLed\t\t\t(1L<<4)
6984#define KBLedMode\t\t(1L<<5)
6985#define KBKey\t\t\t(1L<<6)
6986#define KBAutoRepeatMode\t(1L<<7)
6987
6988#define MappingSuccess     \t0
6989#define MappingBusy        \t1
6990#define MappingFailed\t\t2
6991
6992#define MappingModifier\t\t0
6993#define MappingKeyboard\t\t1
6994#define MappingPointer\t\t2
6995
6996/*****************************************************************
6997 * SCREEN SAVER STUFF
6998 *****************************************************************/
6999
7000#define DontPreferBlanking\t0
7001#define PreferBlanking\t\t1
7002#define DefaultBlanking\t\t2
7003
7004#define DisableScreenSaver\t0
7005#define DisableScreenInterval\t0
7006
7007#define DontAllowExposures\t0
7008#define AllowExposures\t\t1
7009#define DefaultExposures\t2
7010
7011/* for ForceScreenSaver */
7012
7013#define ScreenSaverReset 0
7014#define ScreenSaverActive 1
7015
7016/*****************************************************************
7017 * HOSTS AND CONNECTIONS
7018 *****************************************************************/
7019
7020/* for ChangeHosts */
7021
7022#define HostInsert\t\t0
7023#define HostDelete\t\t1
7024
7025/* for ChangeAccessControl */
7026
7027#define EnableAccess\t\t1
7028#define DisableAccess\t\t0
7029
7030/* Display classes  used in opening the connection
7031 * Note that the statically allocated ones are even numbered and the
7032 * dynamically changeable ones are odd numbered */
7033
7034#define StaticGray\t\t0
7035#define GrayScale\t\t1
7036#define StaticColor\t\t2
7037#define PseudoColor\t\t3
7038#define TrueColor\t\t4
7039#define DirectColor\t\t5
7040
7041
7042/* Byte order  used in imageByteOrder and bitmapBitOrder */
7043
7044#define LSBFirst\t\t0
7045#define MSBFirst\t\t1
7046
7047#endif /* X_H */'
7048		OUTPUT - $'
7049/*
7050 *\t$XConsortium: X.h,v 1.66 88/09/06 15:55:56 jim Exp $
7051 */
7052
7053/* Definitions for the X window system likely to be used by applications */
7054
7055#ifndef X_H
7056#define X_H
7057
7058/***********************************************************
7059Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
7060and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
7061
7062                        All Rights Reserved
7063
7064Permission to use, copy, modify, and distribute this software and its
7065documentation for any purpose and without fee is hereby granted,
7066provided that the above copyright notice appear in all copies and that
7067both that copyright notice and this permission notice appear in
7068supporting documentation, and that the names of Digital or MIT not be
7069used in advertising or publicity pertaining to distribution of the
7070software without specific, written prior permission.
7071
7072DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
7073ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
7074DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
7075ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
7076WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
7077ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
7078SOFTWARE.
7079
7080******************************************************************/
7081#define X_PROTOCOL\t11\t\t/* current protocol version */
7082#define X_PROTOCOL_REVISION 0\t\t/* current minor version */
7083
7084/* Resources */
7085
7086typedef unsigned long XID;
7087
7088typedef XID Window;
7089typedef XID Drawable;
7090typedef XID Font;
7091typedef XID Pixmap;
7092typedef XID Cursor;
7093typedef XID Colormap;
7094typedef XID GContext;
7095typedef XID KeySym;
7096
7097typedef unsigned long Mask;
7098
7099typedef unsigned long Atom;
7100
7101typedef unsigned long VisualID;
7102
7103typedef unsigned long Time;
7104
7105typedef unsigned char KeyCode;
7106
7107/*****************************************************************
7108 * RESERVED RESOURCE AND CONSTANT DEFINITIONS
7109 *****************************************************************/
7110
7111#define None                 0L\t/* universal null resource or null atom */
7112
7113#define ParentRelative       1L\t/* background pixmap in CreateWindow
7114\t\t\t\t    and ChangeWindowAttributes */
7115
7116#define CopyFromParent       0L\t/* border pixmap in CreateWindow
7117\t\t\t\t       and ChangeWindowAttributes
7118\t\t\t\t   special VisualID and special window
7119\t\t\t\t       class passed to CreateWindow */
7120
7121#define PointerWindow        0L\t/* destination window in SendEvent */
7122#define InputFocus           1L\t/* destination window in SendEvent */
7123
7124#define PointerRoot          1L\t/* focus window in SetInputFocus */
7125
7126#define AnyPropertyType      0L\t/* special Atom, passed to GetProperty */
7127
7128#define AnyKey\t\t     0L\t/* special Key Code, passed to GrabKey */
7129
7130#define AnyButton            0L\t/* special Button Code, passed to GrabButton */
7131
7132#define AllTemporary         0L\t/* special Resource ID passed to KillClient */
7133
7134#define CurrentTime          0L\t/* special Time */
7135
7136#define NoSymbol\t     0L\t/* special KeySym */
7137
7138/*****************************************************************
7139 * EVENT DEFINITIONS
7140 *****************************************************************/
7141
7142/* Input Event Masks. Used as event-mask window attribute and as arguments
7143   to Grab requests.  Not to be confused with event names.  */
7144
7145#define NoEventMask\t\t\t0L
7146#define KeyPressMask\t\t\t(1L<<0)
7147#define KeyReleaseMask\t\t\t(1L<<1)
7148#define ButtonPressMask\t\t\t(1L<<2)
7149#define ButtonReleaseMask\t\t(1L<<3)
7150#define EnterWindowMask\t\t\t(1L<<4)
7151#define LeaveWindowMask\t\t\t(1L<<5)
7152#define PointerMotionMask\t\t(1L<<6)
7153#define PointerMotionHintMask\t\t(1L<<7)
7154#define Button1MotionMask\t\t(1L<<8)
7155#define Button2MotionMask\t\t(1L<<9)
7156#define Button3MotionMask\t\t(1L<<10)
7157#define Button4MotionMask\t\t(1L<<11)
7158#define Button5MotionMask\t\t(1L<<12)
7159#define ButtonMotionMask\t\t(1L<<13)
7160#define KeymapStateMask\t\t\t(1L<<14)
7161#define ExposureMask\t\t\t(1L<<15)
7162#define VisibilityChangeMask\t\t(1L<<16)
7163#define StructureNotifyMask\t\t(1L<<17)
7164#define ResizeRedirectMask\t\t(1L<<18)
7165#define SubstructureNotifyMask\t\t(1L<<19)
7166#define SubstructureRedirectMask\t(1L<<20)
7167#define FocusChangeMask\t\t\t(1L<<21)
7168#define PropertyChangeMask\t\t(1L<<22)
7169#define ColormapChangeMask\t\t(1L<<23)
7170#define OwnerGrabButtonMask\t\t(1L<<24)
7171
7172/* Event names.  Used in "type" field in XEvent structures.  Not to be
7173confused with event masks above.  They start from 2 because 0 and 1
7174are reserved in the protocol for errors and replies. */
7175
7176#define KeyPress\t\t2
7177#define KeyRelease\t\t3
7178#define ButtonPress\t\t4
7179#define ButtonRelease\t\t5
7180#define MotionNotify\t\t6
7181#define EnterNotify\t\t7
7182#define LeaveNotify\t\t8
7183#define FocusIn\t\t\t9
7184#define FocusOut\t\t10
7185#define KeymapNotify\t\t11
7186#define Expose\t\t\t12
7187#define GraphicsExpose\t\t13
7188#define NoExpose\t\t14
7189#define VisibilityNotify\t15
7190#define CreateNotify\t\t16
7191#define DestroyNotify\t\t17
7192#define UnmapNotify\t\t18
7193#define MapNotify\t\t19
7194#define MapRequest\t\t20
7195#define ReparentNotify\t\t21
7196#define ConfigureNotify\t\t22
7197#define ConfigureRequest\t23
7198#define GravityNotify\t\t24
7199#define ResizeRequest\t\t25
7200#define CirculateNotify\t\t26
7201#define CirculateRequest\t27
7202#define PropertyNotify\t\t28
7203#define SelectionClear\t\t29
7204#define SelectionRequest\t30
7205#define SelectionNotify\t\t31
7206#define ColormapNotify\t\t32
7207#define ClientMessage\t\t33
7208#define MappingNotify\t\t34
7209#define LASTEvent\t\t35\t/* must be bigger than any event # */
7210
7211
7212/* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
7213   state in various key-, mouse-, and button-related events. */
7214
7215#define ShiftMask\t\t(1<<0)
7216#define LockMask\t\t(1<<1)
7217#define ControlMask\t\t(1<<2)
7218#define Mod1Mask\t\t(1<<3)
7219#define Mod2Mask\t\t(1<<4)
7220#define Mod3Mask\t\t(1<<5)
7221#define Mod4Mask\t\t(1<<6)
7222#define Mod5Mask\t\t(1<<7)
7223
7224/* modifier names.  Used to build a SetModifierMapping request or
7225   to read a GetModifierMapping request.  These correspond to the
7226   masks defined above. */
7227#define ShiftMapIndex\t\t0
7228#define LockMapIndex\t\t1
7229#define ControlMapIndex\t\t2
7230#define Mod1MapIndex\t\t3
7231#define Mod2MapIndex\t\t4
7232#define Mod3MapIndex\t\t5
7233#define Mod4MapIndex\t\t6
7234#define Mod5MapIndex\t\t7
7235
7236
7237/* button masks.  Used in same manner as Key masks above. Not to be confused
7238   with button names below. */
7239
7240#define Button1Mask\t\t(1<<8)
7241#define Button2Mask\t\t(1<<9)
7242#define Button3Mask\t\t(1<<10)
7243#define Button4Mask\t\t(1<<11)
7244#define Button5Mask\t\t(1<<12)
7245
7246#define AnyModifier\t\t(1<<15)  /* used in GrabButton, GrabKey */
7247
7248
7249/* button names. Used as arguments to GrabButton and as detail in ButtonPress
7250   and ButtonRelease events.  Not to be confused with button masks above.
7251   Note that 0 is already defined above as "AnyButton".  */
7252
7253#define Button1\t\t\t1
7254#define Button2\t\t\t2
7255#define Button3\t\t\t3
7256#define Button4\t\t\t4
7257#define Button5\t\t\t5
7258
7259/* Notify modes */
7260
7261#define NotifyNormal\t\t0
7262#define NotifyGrab\t\t1
7263#define NotifyUngrab\t\t2
7264#define NotifyWhileGrabbed\t3
7265
7266#define NotifyHint\t\t1\t/* for MotionNotify events */
7267\t\t
7268/* Notify detail */
7269
7270#define NotifyAncestor\t\t0
7271#define NotifyVirtual\t\t1
7272#define NotifyInferior\t\t2
7273#define NotifyNonlinear\t\t3
7274#define NotifyNonlinearVirtual\t4
7275#define NotifyPointer\t\t5
7276#define NotifyPointerRoot\t6
7277#define NotifyDetailNone\t7
7278
7279/* Visibility notify */
7280
7281#define VisibilityUnobscured\t\t0
7282#define VisibilityPartiallyObscured\t1
7283#define VisibilityFullyObscured\t\t2
7284
7285/* Circulation request */
7286
7287#define PlaceOnTop\t\t0
7288#define PlaceOnBottom\t\t1
7289
7290/* protocol families */
7291
7292#define FamilyInternet\t\t0
7293#define FamilyDECnet\t\t1
7294#define FamilyChaos\t\t2
7295
7296/* Property notification */
7297
7298#define PropertyNewValue\t0
7299#define PropertyDelete\t\t1
7300
7301/* Color Map notification */
7302
7303#define ColormapUninstalled\t0
7304#define ColormapInstalled\t1
7305
7306/* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */
7307
7308#define GrabModeSync\t\t0
7309#define GrabModeAsync\t\t1
7310
7311/* GrabPointer, GrabKeyboard reply status */
7312
7313#define GrabSuccess\t\t0
7314#define AlreadyGrabbed\t\t1
7315#define GrabInvalidTime\t\t2
7316#define GrabNotViewable\t\t3
7317#define GrabFrozen\t\t4
7318
7319/* AllowEvents modes */
7320
7321#define AsyncPointer\t\t0
7322#define SyncPointer\t\t1
7323#define ReplayPointer\t\t2
7324#define AsyncKeyboard\t\t3
7325#define SyncKeyboard\t\t4
7326#define ReplayKeyboard\t\t5
7327#define AsyncBoth\t\t6
7328#define SyncBoth\t\t7
7329
7330/* Used in SetInputFocus, GetInputFocus */
7331
7332#define RevertToNone\t\t(int)None
7333#define RevertToPointerRoot\t(int)PointerRoot
7334#define RevertToParent\t\t2
7335
7336/*****************************************************************
7337 * ERROR CODES
7338 *****************************************************************/
7339
7340#define Success\t\t   0\t/* everything\'s okay */
7341#define BadRequest\t   1\t/* bad request code */
7342#define BadValue\t   2\t/* int parameter out of range */
7343#define BadWindow\t   3\t/* parameter not a Window */
7344#define BadPixmap\t   4\t/* parameter not a Pixmap */
7345#define BadAtom\t\t   5\t/* parameter not an Atom */
7346#define BadCursor\t   6\t/* parameter not a Cursor */
7347#define BadFont\t\t   7\t/* parameter not a Font */
7348#define BadMatch\t   8\t/* parameter mismatch */
7349#define BadDrawable\t   9\t/* parameter not a Pixmap or Window */
7350#define BadAccess\t  10\t/* depending on context:
7351\t\t\t\t - key/button already grabbed
7352\t\t\t\t - attempt to free an illegal
7353\t\t\t\t   cmap entry
7354\t\t\t\t- attempt to store into a read-only
7355\t\t\t\t   color map entry.
7356 \t\t\t\t- attempt to modify the access control
7357\t\t\t\t   list from other than the local host.
7358\t\t\t\t*/
7359#define BadAlloc\t  11\t/* insufficient resources */
7360#define BadColor\t  12\t/* no such colormap */
7361#define BadGC\t\t  13\t/* parameter not a GC */
7362#define BadIDChoice\t  14\t/* choice not in range or already used */
7363#define BadName\t\t  15\t/* font or color name doesn\'t exist */
7364#define BadLength\t  16\t/* Request length incorrect */
7365#define BadImplementation 17\t/* server is defective */
7366
7367#define FirstExtensionError\t128
7368#define LastExtensionError\t255
7369
7370/*****************************************************************
7371 * WINDOW DEFINITIONS
7372 *****************************************************************/
7373
7374/* Window classes used by CreateWindow */
7375/* Note that CopyFromParent is already defined as 0 above */
7376
7377#define InputOutput\t\t1
7378#define InputOnly\t\t2
7379
7380/* Window attributes for CreateWindow and ChangeWindowAttributes */
7381
7382#define CWBackPixmap\t\t(1L<<0)
7383#define CWBackPixel\t\t(1L<<1)
7384#define CWBorderPixmap\t\t(1L<<2)
7385#define CWBorderPixel           (1L<<3)
7386#define CWBitGravity\t\t(1L<<4)
7387#define CWWinGravity\t\t(1L<<5)
7388#define CWBackingStore          (1L<<6)
7389#define CWBackingPlanes\t        (1L<<7)
7390#define CWBackingPixel\t        (1L<<8)
7391#define CWOverrideRedirect\t(1L<<9)
7392#define CWSaveUnder\t\t(1L<<10)
7393#define CWEventMask\t\t(1L<<11)
7394#define CWDontPropagate\t        (1L<<12)
7395#define CWColormap\t\t(1L<<13)
7396#define CWCursor\t        (1L<<14)
7397
7398/* ConfigureWindow structure */
7399
7400#define CWX\t\t\t(1<<0)
7401#define CWY\t\t\t(1<<1)
7402#define CWWidth\t\t\t(1<<2)
7403#define CWHeight\t\t(1<<3)
7404#define CWBorderWidth\t\t(1<<4)
7405#define CWSibling\t\t(1<<5)
7406#define CWStackMode\t\t(1<<6)
7407
7408
7409/* Bit Gravity */
7410
7411#define ForgetGravity\t\t0
7412#define NorthWestGravity\t1
7413#define NorthGravity\t\t2
7414#define NorthEastGravity\t3
7415#define WestGravity\t\t4
7416#define CenterGravity\t\t5
7417#define EastGravity\t\t6
7418#define SouthWestGravity\t7
7419#define SouthGravity\t\t8
7420#define SouthEastGravity\t9
7421#define StaticGravity\t\t10
7422
7423/* Window gravity + bit gravity above */
7424
7425#define UnmapGravity\t\t0
7426
7427/* Used in CreateWindow for backing-store hint */
7428
7429#define NotUseful               0
7430#define WhenMapped              1
7431#define Always                  2
7432
7433/* Used in GetWindowAttributes reply */
7434
7435#define IsUnmapped\t\t0
7436#define IsUnviewable\t\t1
7437#define IsViewable\t\t2
7438
7439/* Used in ChangeSaveSet */
7440
7441#define SetModeInsert           0
7442#define SetModeDelete           1
7443
7444/* Used in ChangeCloseDownMode */
7445
7446#define DestroyAll              0
7447#define RetainPermanent         1
7448#define RetainTemporary         2
7449
7450/* Window stacking method (in configureWindow) */
7451
7452#define Above                   0
7453#define Below                   1
7454#define TopIf                   2
7455#define BottomIf                3
7456#define Opposite                4
7457
7458/* Circulation direction */
7459
7460#define RaiseLowest             0
7461#define LowerHighest            1
7462
7463/* Property modes */
7464
7465#define PropModeReplace         0
7466#define PropModePrepend         1
7467#define PropModeAppend          2
7468
7469/*****************************************************************
7470 * GRAPHICS DEFINITIONS
7471 *****************************************************************/
7472
7473/* graphics functions, as in GC.alu */
7474
7475#define\tGXclear\t\t\t0x0\t\t/* 0 */
7476#define GXand\t\t\t0x1\t\t/* src AND dst */
7477#define GXandReverse\t\t0x2\t\t/* src AND NOT dst */
7478#define GXcopy\t\t\t0x3\t\t/* src */
7479#define GXandInverted\t\t0x4\t\t/* NOT src AND dst */
7480#define\tGXnoop\t\t\t0x5\t\t/* dst */
7481#define GXxor\t\t\t0x6\t\t/* src XOR dst */
7482#define GXor\t\t\t0x7\t\t/* src OR dst */
7483#define GXnor\t\t\t0x8\t\t/* NOT src AND NOT dst */
7484#define GXequiv\t\t\t0x9\t\t/* NOT src XOR dst */
7485#define GXinvert\t\t0xa\t\t/* NOT dst */
7486#define GXorReverse\t\t0xb\t\t/* src OR NOT dst */
7487#define GXcopyInverted\t\t0xc\t\t/* NOT src */
7488#define GXorInverted\t\t0xd\t\t/* NOT src OR dst */
7489#define GXnand\t\t\t0xe\t\t/* NOT src OR NOT dst */
7490#define GXset\t\t\t0xf\t\t/* 1 */
7491
7492/* LineStyle */
7493
7494#define LineSolid\t\t0
7495#define LineOnOffDash\t\t1
7496#define LineDoubleDash\t\t2
7497
7498/* capStyle */
7499
7500#define CapNotLast\t\t0
7501#define CapButt\t\t\t1
7502#define CapRound\t\t2
7503#define CapProjecting\t\t3
7504
7505/* joinStyle */
7506
7507#define JoinMiter\t\t0
7508#define JoinRound\t\t1
7509#define JoinBevel\t\t2
7510
7511/* fillStyle */
7512
7513#define FillSolid\t\t0
7514#define FillTiled\t\t1
7515#define FillStippled\t\t2
7516#define FillOpaqueStippled\t3
7517
7518/* fillRule */
7519
7520#define EvenOddRule\t\t0
7521#define WindingRule\t\t1
7522
7523/* subwindow mode */
7524
7525#define ClipByChildren\t\t0
7526#define IncludeInferiors\t1
7527
7528/* SetClipRectangles ordering */
7529
7530#define Unsorted\t\t0
7531#define YSorted\t\t\t1
7532#define YXSorted\t\t2
7533#define YXBanded\t\t3
7534
7535/* CoordinateMode for drawing routines */
7536
7537#define CoordModeOrigin\t\t0\t/* relative to the origin */
7538#define CoordModePrevious       1\t/* relative to previous point */
7539
7540/* Polygon shapes */
7541
7542#define Complex\t\t\t0\t/* paths may intersect */
7543#define Nonconvex\t\t1\t/* no paths intersect, but not convex */
7544#define Convex\t\t\t2\t/* wholly convex */
7545
7546/* Arc modes for PolyFillArc */
7547
7548#define ArcChord\t\t0\t/* join endpoints of arc */
7549#define ArcPieSlice\t\t1\t/* join endpoints to center of arc */
7550
7551/* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR\'ed into
7552   GC.stateChanges */
7553
7554#define GCFunction              (1L<<0)
7555#define GCPlaneMask             (1L<<1)
7556#define GCForeground            (1L<<2)
7557#define GCBackground            (1L<<3)
7558#define GCLineWidth             (1L<<4)
7559#define GCLineStyle             (1L<<5)
7560#define GCCapStyle              (1L<<6)
7561#define GCJoinStyle\t\t(1L<<7)
7562#define GCFillStyle\t\t(1L<<8)
7563#define GCFillRule\t\t(1L<<9)
7564#define GCTile\t\t\t(1L<<10)
7565#define GCStipple\t\t(1L<<11)
7566#define GCTileStipXOrigin\t(1L<<12)
7567#define GCTileStipYOrigin\t(1L<<13)
7568#define GCFont \t\t\t(1L<<14)
7569#define GCSubwindowMode\t\t(1L<<15)
7570#define GCGraphicsExposures     (1L<<16)
7571#define GCClipXOrigin\t\t(1L<<17)
7572#define GCClipYOrigin\t\t(1L<<18)
7573#define GCClipMask\t\t(1L<<19)
7574#define GCDashOffset\t\t(1L<<20)
7575#define GCDashList\t\t(1L<<21)
7576#define GCArcMode\t\t(1L<<22)
7577
7578#define GCLastBit\t\t22
7579/*****************************************************************
7580 * FONTS
7581 *****************************************************************/
7582
7583/* used in QueryFont -- draw direction */
7584
7585#define FontLeftToRight\t\t0
7586#define FontRightToLeft\t\t1
7587
7588#define FontChange\t\t255
7589
7590/*****************************************************************
7591 *  IMAGING
7592 *****************************************************************/
7593
7594/* ImageFormat -- PutImage, GetImage */
7595
7596#define XYBitmap\t\t0\t/* depth 1, XYFormat */
7597#define XYPixmap\t\t1\t/* depth == drawable depth */
7598#define ZPixmap\t\t\t2\t/* depth == drawable depth */
7599
7600/*****************************************************************
7601 *  COLOR MAP STUFF
7602 *****************************************************************/
7603
7604/* For CreateColormap */
7605
7606#define AllocNone\t\t0\t/* create map with no entries */
7607#define AllocAll\t\t1\t/* allocate entire map writeable */
7608
7609
7610/* Flags used in StoreNamedColor, StoreColors */
7611
7612#define DoRed\t\t\t(1<<0)
7613#define DoGreen\t\t\t(1<<1)
7614#define DoBlue\t\t\t(1<<2)
7615
7616/*****************************************************************
7617 * CURSOR STUFF
7618 *****************************************************************/
7619
7620/* QueryBestSize Class */
7621
7622#define CursorShape\t\t0\t/* largest size that can be displayed */
7623#define TileShape\t\t1\t/* size tiled fastest */
7624#define StippleShape\t\t2\t/* size stippled fastest */
7625
7626/*****************************************************************
7627 * KEYBOARD/POINTER STUFF
7628 *****************************************************************/
7629
7630#define AutoRepeatModeOff\t0
7631#define AutoRepeatModeOn\t1
7632#define AutoRepeatModeDefault\t2
7633
7634#define LedModeOff\t\t0
7635#define LedModeOn\t\t1
7636
7637/* masks for ChangeKeyboardControl */
7638
7639#define KBKeyClickPercent\t(1L<<0)
7640#define KBBellPercent\t\t(1L<<1)
7641#define KBBellPitch\t\t(1L<<2)
7642#define KBBellDuration\t\t(1L<<3)
7643#define KBLed\t\t\t(1L<<4)
7644#define KBLedMode\t\t(1L<<5)
7645#define KBKey\t\t\t(1L<<6)
7646#define KBAutoRepeatMode\t(1L<<7)
7647
7648#define MappingSuccess     \t0
7649#define MappingBusy        \t1
7650#define MappingFailed\t\t2
7651
7652#define MappingModifier\t\t0
7653#define MappingKeyboard\t\t1
7654#define MappingPointer\t\t2
7655
7656/*****************************************************************
7657 * SCREEN SAVER STUFF
7658 *****************************************************************/
7659
7660#define DontPreferBlanking\t0
7661#define PreferBlanking\t\t1
7662#define DefaultBlanking\t\t2
7663
7664#define DisableScreenSaver\t0
7665#define DisableScreenInterval\t0
7666
7667#define DontAllowExposures\t0
7668#define AllowExposures\t\t1
7669#define DefaultExposures\t2
7670
7671/* for ForceScreenSaver */
7672
7673#define ScreenSaverReset 0
7674#define ScreenSaverActive 1
7675
7676/*****************************************************************
7677 * HOSTS AND CONNECTIONS
7678 *****************************************************************/
7679
7680/* for ChangeHosts */
7681
7682#define HostInsert\t\t0
7683#define HostDelete\t\t1
7684
7685/* for ChangeAccessControl */
7686
7687#define EnableAccess\t\t1
7688#define DisableAccess\t\t0
7689
7690/* Display classes  used in opening the connection
7691 * Note that the statically allocated ones are even numbered and the
7692 * dynamically changeable ones are odd numbered */
7693
7694#define StaticGray\t\t0
7695#define GrayScale\t\t1
7696#define StaticColor\t\t2
7697#define PseudoColor\t\t3
7698#define TrueColor\t\t4
7699#define DirectColor\t\t5
7700
7701
7702/* Byte order  used in imageByteOrder and bitmapBitOrder */
7703
7704#define LSBFirst\t\t0
7705#define MSBFirst\t\t1
7706
7707#endif /* X_H */'
7708	EXEC -nh
7709		INPUT - $'#pragma prototyped
7710#include <ast.h>
7711# include "stdio.h"
7712# define U(x) x
7713# define NLSTATE yyprevious=YYNEWLINE
7714# define BEGIN yybgin = yysvec + 1 +
7715# define INITIAL 0
7716# define YYLERR yysvec
7717# define YYSTATE (yyestate-yysvec-1)
7718# define YYOPTIM 1
7719# define YYLMAX BUFSIZ
7720# define output(c) putc(c,yyout)
7721# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
7722# define unput(c) {yytchar= (c);if(yytchar==\'\\n\')yylineno--;*yysptr++=yytchar;}
7723# define yymore() (yymorfg=1)
7724# define ECHO fprintf(yyout, "%s",yytext)
7725# define REJECT { nstr = yyreject(); goto yyfussy;}
7726int yyleng; extern char yytext[];
7727int yymorfg;
7728extern char *yysptr, yysbuf[];
7729int yytchar;
7730FILE *yyin = {stdin}, *yyout = {stdout};
7731extern int yylineno;
7732struct yysvf {
7733\tstruct yywork *yystoff;
7734\tstruct yysvf *yyother;
7735\tint *yystops;};
7736struct yysvf *yyestate;
7737extern struct yysvf yysvec[], *yybgin;
7738/*
7739 * lex.l - scanner for yeast announcements/specifications
7740 *
7741 * Author:\tBalachander Krishnamurthy
7742 * \t\tDavid S. Rosenblum
7743 * \t\tAT&T Bell Laboratories
7744 * Date:\tMon Feb 27 22:40:42 1989
7745 *
7746 */
7747
7748/*
7749 * Modification history:
7750 * \tMon Mar 12 13:38:46 1990 -- undef\'ing input to define own routine
7751 *      Tue Jun 26 14:14:24 1990 -- changed BLANKFREESTRING from * to +
7752 *
7753 * If any tokens are added here yeast.y has to change - :-(
7754 */
7755
7756#undef\tinput\t /* defeat lex */
7757
7758extern void savesb(char*);
7759extern void FixString(char[]);
7760extern void errmsg(char*);
7761extern char input(void);
7762
7763char c;
7764#include <h/globals.h>
7765#include <yeast.h>
7766
7767extern bool fParseFailed;
7768# define YYNEWLINE 10
7769yylex(){
7770int nstr; extern int yyprevious;
7771while((nstr = yylook()) >= 0)
7772yyfussy: switch(nstr){
7773case 0:
7774if(yywrap()) return(0); break;
7775case 1:
7776 ;
7777break;
7778case 2:
7779        {savesb("3dfile"); return(DDDFILECLASS);}
7780break;
7781case 3:
7782\t{savesb("addspec");return(ADDSPEC);}
7783break;
7784case 4:
7785\t{savesb("and"); return(AND);}
7786break;
7787case 5:
7788{savesb("announce"); return(ANNOUNCE);}
7789break;
7790case 6:
7791\t{savesb("at"); return(AT);}
7792break;
7793case 7:
7794\t{savesb("atime"); return(ATIME);}
7795break;
7796case 8:
7797{savesb("authattr"); return(AUTHATTR);}
7798break;
7799case 9:
7800\t{savesb("authobj"); return(AUTHOBJ);}
7801break;
7802case 10:
7803\t{savesb("between"); return(BETWEEN);}
7804break;
7805case 11:
7806\t{savesb("by"); return(BY);}
7807break;
7808case 12:
7809{savesb("capacity"); return(CAPACITY);}
7810break;
7811case 13:
7812\t{savesb("changed"); return(CHANGED);}
7813break;
7814case 14:
7815\t{savesb("count"); return(COUNT);}
7816break;
7817case 15:
7818\t{savesb("daily"); return(DAILY);}
7819break;
7820case 16:
7821\t{savesb("defattr"); return(DEFATTR);}
7822break;
7823case 17:
7824\t{savesb("defobj"); return(DEFOBJ);}
7825break;
7826case 18:
7827        {savesb("dir"); return(DIRCLASS);}
7828break;
7829case 19:
7830\t{savesb("do"); return(DO);}
7831break;
7832case 20:
7833{savesb("do_notify"); return(DO_NOTIFY);}
7834break;
7835case 21:
7836\t{savesb("do_rpc"); return(DO_RPC);}
7837break;
7838case 22:
7839\t{savesb("etime"); return(PETIME);}
7840break;
7841case 23:
7842\t{savesb("false"); return(FALSE);}
7843break;
7844case 24:
7845\t{savesb("fgspec"); return(FGSPEC);}
7846break;
7847case 25:
7848        {savesb("file"); return(FILECLASS);}
7849break;
7850case 26:
7851\t{savesb("filesys"); return(FILESYSTEMCLASS);}
7852break;
7853case 27:
7854\t{savesb("host"); return(HOSTCLASS);}
7855break;
7856case 28:
7857\t{savesb("in"); return(IN);}
7858break;
7859case 29:
7860\t{savesb("load"); return(LOAD);}
7861break;
7862case 30:
7863{savesb("where"); return(LOCATION);}
7864break;
7865case 31:
7866{savesb("loggedin"); return(LOGGEDIN);}
7867break;
7868case 32:
7869\t{savesb("lsspec"); return(LSSPEC);}
7870break;
7871case 33:
7872\t{savesb("mode"); return(MODE);}
7873break;
7874case 34:
7875\t{savesb("modgrp"); return(MODGRP);}
7876break;
7877case 35:
7878\t{savesb("monthly"); return(MONTHLY);}
7879break;
7880case 36:
7881{savesb("midnight"); return(MIDNIGHT);}
7882break;
7883case 37:
7884\t{savesb("mtime"); return(MTIME);}
7885break;
7886case 38:
7887\t{savesb("no"); return(NOON);}
7888break;
7889case 39:
7890\t{savesb("or"); return(OR);}
7891break;
7892case 40:
7893\t{savesb("owner"); return(OWNER);}
7894break;
7895case 41:
7896\t{savesb("process"); return(PROCESSCLASS);}
7897break;
7898case 42:
7899{savesb("readspec"); return(READSPEC);}
7900break;
7901case 43:
7902{savesb("regyeast"); return(REGYEAST);}
7903break;
7904case 44:
7905\t{savesb("repeat"); return(REPEAT);}
7906break;
7907case 45:
7908\t{savesb("rmattr"); return(RMATTR);}
7909break;
7910case 46:
7911\t{savesb("rmobj"); return(RMOBJ);}
7912break;
7913case 47:
7914\t{savesb("rmspec"); return(RMSPEC);}
7915break;
7916case 48:
7917\t{savesb("size"); return(SIZE);}
7918break;
7919case 49:
7920\t{savesb("status"); return(STATUS);}
7921break;
7922case 50:
7923\t{savesb("stime"); return(STIME);}
7924break;
7925case 51:
7926{savesb("suspspec"); return(SUSPSPEC);}
7927break;
7928case 52:
7929\t{savesb("then"); return(THEN);}
7930break;
7931case 53:
7932{savesb("timestamp"); return(TIMESTAMP);}
7933break;
7934case 54:
7935\t{savesb("today"); return(TODAY);}
7936break;
7937case 55:
7938{savesb("tomorrow"); return(TOMORROW);}
7939break;
7940case 56:
7941\t{savesb("true"); return(TRUE);}
7942break;
7943case 57:
7944\t{savesb("tty"); return(TTYCLASS);}
7945break;
7946case 58:
7947{savesb("unchanged"); return(UNCHANGED);}
7948break;
7949case 59:
7950\t{savesb("until"); return(UNTIL);}
7951break;
7952case 60:
7953\t{savesb("up"); return(UP);}
7954break;
7955case 61:
7956\t{savesb("user"); return(USERCLASS);}
7957break;
7958case 62:
7959\t{savesb("users"); return(USERS);}
7960break;
7961case 63:
7962\t{savesb("utime"); return(UTIME);}
7963break;
7964case 64:
7965\t{savesb("week"); return(WEEK);}
7966break;
7967case 65:
7968\t{savesb("weekly"); return(WEEKLY);}
7969break;
7970case 66:
7971\t{savesb("within"); return(WITHIN);}
7972break;
7973case 67:
7974\t{savesb("yearly"); return(YEARLY);}
7975break;
7976case 68:
7977  \t\treturn(NEWLINE);
7978break;
7979case 69:
7980\treturn (ASSIGN);
7981break;
7982case 70:
7983\treturn (COMMA);
7984break;
7985case 71:
7986\treturn (EQ);
7987break;
7988case 72:
7989\treturn (GE);
7990break;
7991case 73:
7992\treturn (GT);
7993break;
7994case 74:
7995\treturn (LE);
7996break;
7997case 75:
7998\treturn (LPAREN);
7999break;
8000case 76:
8001\treturn (LT);
8002break;
8003case 77:
8004\treturn (NE);
8005break;
8006case 78:
8007\treturn (RPAREN);
8008break;
8009case 79:
8010\treturn (PERCENT);
8011break;
8012case 80:
8013\treturn (LCURLY);
8014break;
8015case 81:
8016\treturn (RCURLY);
8017break;
8018case 82:
8019{savesb(yytext); return(HEX);}
8020break;
8021case 83:
8022\t{savesb(yytext); return(OCTAL);}
8023break;
8024case 84:
8025\t{savesb(yytext); return(INTEGER);}
8026break;
8027case 85:
8028{savesb(yytext); return(INTRANGE);}
8029break;
8030case 86:
8031{savesb(yytext); return(REAL);}
8032break;
8033case 87:
8034 { savesb(yytext); return(HOURSPEC); }
8035break;
8036case 88:
8037{ savesb(yytext); return(HOURMINSPEC); }
8038break;
8039case 89:
8040{ savesb(yytext); return(HOURMINSPEC); }
8041break;
8042case 90:
8043{
8044\t\tif((yylval.sb =  malloc (yyleng+1)) != NULL)
8045\t\t    strcpy(yylval.sb,yytext);
8046\t\treturn(GROUPLABEL);
8047\t    }
8048break;
8049case 91:
8050{
8051\t\tif((yylval.sb =  malloc (yyleng+1)) != NULL) {
8052\t\t    yytext[yyleng-1] = \'\\0\';
8053\t\t    strcpy(yylval.sb,yytext);
8054\t      }
8055\t\treturn(EVENTLABEL);
8056\t    }
8057break;
8058case 92:
8059{\t\t\t\t
8060\t\tif((yylval.sb =  malloc (yyleng+1)) != NULL)
8061\t\t    strcpy(yylval.sb,yytext);
8062\t\treturn(BLANKFREESTRING);
8063\t    }
8064break;
8065case 93:
8066{                       /* Quoted String Checker */
8067             if(yytext[yyleng-1] == \'\\\\\')
8068                yymore() ;
8069             else {
8070               c = input() ;
8071               if (c == \'\\n\') {
8072                  unput(c) ;
8073                  errmsg("String constant flows over line
8074 ") ;
8075                  yytext[yyleng] = \'\\0\' ;
8076                  return(QUOTEDSTRING) ;
8077               }
8078               else {
8079                  yytext[yyleng++] = \'"\' ;
8080                  yytext[yyleng] = \'\\0\' ;
8081                  FixString(yytext) ;
8082                  if((yylval.sb = malloc (yyleng+1)) != NULL)
8083                     strcpy(yylval.sb,yytext) ;
8084                  return(QUOTEDSTRING) ;
8085               }
8086             }
8087            }
8088break;
8089case 94:
8090\t    {
8091\t        errmsg("unknown character in input
8092") ;
8093\t    }
8094break;
8095case -1:
8096break;
8097default:
8098fprintf(yyout,"bad switch yylook %d",nstr);
8099} return(0); }
8100/* end of yylex */
8101
8102/*
8103 * ====================================================================
8104 * savesb - saves string value of token
8105 * ====================================================================
8106 */
8107
8108void
8109savesb(char* sb)
8110{
8111    if((yylval.sb = (char *)malloc(strlen(sb)+1)) != NULL)
8112\tstrcpy(yylval.sb,sb) ;
8113}
8114
8115/****
8116 * Routine FixString to delete the double quotes in the string
8117 ****/
8118void
8119FixString(char yytext[])
8120{
8121 int i;
8122
8123 for (i=1 ; i < yyleng -1 ; i++)
8124     yytext[i-1] = yytext[i] ;
8125 yytext[i-1] = \'\\0\' ;
8126}
8127
8128/*
8129 * ====================================================================
8130 * errmsg - Error routine for lex
8131 * ====================================================================
8132 */
8133void
8134errmsg(char* sb)
8135{
8136    sfprintf(sbMsg, "lexical error: %s", sb);
8137    fParseFailed = 1;
8138}
8139
8140char
8141input(void)\t\t\t\t\t\t/* a la awk/gpr */
8142{
8143    register c;
8144    extern char *lexprog;
8145
8146    if (yysptr > yysbuf)
8147\tc = U(*--yysptr);
8148    else
8149\tc = *lexprog++;
8150    return(c);
8151}
8152int yyvstop[] = {
81530,
8154
815592,
815694,
81570,
8158
81591,
816092,
816194,
81620,
8163
816468,
81650,
8166
81671,
816894,
81690,
8170
817192,
817294,
81730,
8174
817592,
817693,
817794,
81780,
8179
818079,
818192,
818294,
81830,
8184
818575,
818694,
81870,
8188
818978,
819092,
819194,
81920,
8193
819492,
819594,
81960,
8197
819870,
819994,
82000,
8201
820292,
820394,
82040,
8205
820683,
820784,
820892,
820994,
82100,
8211
821284,
821392,
821494,
82150,
8216
821784,
821892,
821994,
82200,
8221
822276,
822392,
822494,
82250,
8226
822769,
822892,
822994,
82300,
8231
823273,
823392,
823494,
82350,
8236
823794,
82380,
8239
824092,
824194,
82420,
8243
824492,
824594,
82460,
8247
824892,
824994,
82500,
8251
825292,
825394,
82540,
8255
825692,
825794,
82580,
8259
826092,
826194,
82620,
8263
826492,
826594,
82660,
8267
826892,
826994,
82700,
8271
827292,
827394,
82740,
8275
827692,
827794,
82780,
8279
828092,
828194,
82820,
8283
828492,
828594,
82860,
8287
828892,
828994,
82900,
8291
829292,
829394,
82940,
8295
829692,
829794,
82980,
8299
830092,
830194,
83020,
8303
830492,
830594,
83060,
8307
830892,
830994,
83100,
8311
831292,
831394,
83140,
8315
831680,
831792,
831894,
83190,
8320
832181,
832292,
832394,
83240,
8325
832692,
83270,
8328
832991,
833092,
83310,
8332
833377,
833492,
83350,
8336
833792,
833893,
83390,
8340
834193,
83420,
8343
834491,
834592,
834693,
83470,
8348
834990,
835092,
83510,
8352
835390,
835492,
83550,
8356
835790,
835891,
835992,
83600,
8361
836286,
836392,
83640,
8365
836692,
83670,
8368
836992,
83700,
8371
837283,
837384,
837492,
83750,
8376
837784,
837892,
83790,
8380
838191,
838292,
83830,
8384
838587,
838692,
83870,
8388
838992,
83900,
8391
839292,
83930,
8394
839574,
839692,
83970,
8398
839971,
840092,
84010,
8402
840372,
840492,
84050,
8406
840792,
84080,
8409
841092,
84110,
8412
84136,
841492,
84150,
8416
841792,
84180,
8419
842092,
84210,
8422
842311,
842492,
84250,
8426
842792,
84280,
8429
843092,
84310,
8432
843392,
84340,
8435
843692,
84370,
8438
843992,
84400,
8441
844292,
84430,
8444
844519,
844692,
84470,
8448
844992,
84500,
8451
845292,
84530,
8454
845592,
84560,
8457
845892,
84590,
8460
846192,
84620,
8463
846428,
846592,
84660,
8467
846892,
84690,
8470
847192,
84720,
8473
847492,
84750,
8476
847792,
84780,
8479
848092,
84810,
8482
848392,
84840,
8485
848639,
848792,
84880,
8489
849092,
84910,
8492
849392,
84940,
8495
849692,
84970,
8498
849992,
85000,
8501
850292,
85030,
8504
850592,
85060,
8507
850892,
85090,
8510
851192,
85120,
8513
851492,
85150,
8516
851792,
85180,
8519
852092,
85210,
8522
852392,
85240,
8525
852692,
85270,
8528
852960,
853092,
85310,
8532
853392,
85340,
8535
853692,
85370,
8538
853992,
85400,
8541
854292,
85430,
8544
854592,
85460,
8547
854885,
854992,
85500,
8551
855288,
855392,
85540,
8555
855687,
855792,
85580,
8559
856082,
856192,
85620,
8563
856492,
85650,
8566
856792,
85680,
8569
85704,
857192,
85720,
8573
857492,
85750,
8576
857792,
85780,
8579
858092,
85810,
8582
858392,
85840,
8585
858692,
85870,
8588
858992,
85900,
8591
859292,
85930,
8594
859592,
85960,
8597
859892,
85990,
8600
860118,
860292,
86030,
8604
860592,
86060,
8607
860892,
86090,
8610
861192,
86120,
8613
861492,
86150,
8616
861792,
86180,
8619
862092,
86210,
8622
862392,
86240,
8625
862692,
86270,
8628
862992,
86300,
8631
863292,
86330,
8634
863592,
86360,
8637
863892,
86390,
8640
864192,
86420,
8643
864492,
86450,
8646
864792,
86480,
8649
865092,
86510,
8652
865392,
86540,
8655
865692,
86570,
8658
865992,
86600,
8661
866292,
86630,
8664
866592,
86660,
8667
866892,
86690,
8670
867192,
86720,
8673
867492,
86750,
8676
867792,
86780,
8679
868092,
86810,
8682
868392,
86840,
8685
868692,
86870,
8688
868992,
86900,
8691
869292,
86930,
8694
869592,
86960,
8697
869892,
86990,
8700
870157,
870292,
87030,
8704
870592,
87060,
8707
870892,
87090,
8710
871192,
87120,
8713
871492,
87150,
8716
871792,
87180,
8719
872092,
87210,
8722
872392,
87240,
8725
872689,
872792,
87280,
8729
873092,
87310,
8732
873392,
87340,
8735
873692,
87370,
8738
873992,
87400,
8741
874292,
87430,
8744
874592,
87460,
8747
874892,
87490,
8750
875192,
87520,
8753
875492,
87550,
8756
875792,
87580,
8759
876092,
87610,
8762
876392,
87640,
8765
876692,
87670,
8768
876992,
87700,
8771
877292,
87730,
8774
877592,
87760,
8777
877892,
87790,
8780
878125,
878292,
87830,
8784
878527,
878692,
87870,
8788
878929,
879092,
87910,
8792
879392,
87940,
8795
879692,
87970,
8798
879992,
88000,
8801
880292,
88030,
8804
880533,
880692,
88070,
8808
880992,
88100,
8811
881292,
88130,
8814
881592,
88160,
8817
881838,
881992,
88200,
8821
882292,
88230,
8824
882592,
88260,
8827
882892,
88290,
8830
883192,
88320,
8833
883492,
88350,
8836
883792,
88380,
8839
884092,
88410,
8842
884392,
88440,
8845
884648,
884792,
88480,
8849
885092,
88510,
8852
885392,
88540,
8855
885692,
88570,
8858
885952,
886092,
88610,
8862
886392,
88640,
8865
886692,
88670,
8868
886992,
88700,
8871
887256,
887392,
88740,
8875
887692,
88770,
8878
887992,
88800,
8881
888261,
888392,
88840,
8885
888692,
88870,
8888
888964,
889092,
88910,
8892
889392,
88940,
8895
889692,
88970,
8898
889989,
890092,
89010,
8902
890392,
89040,
8905
890692,
89070,
8908
890992,
89100,
8911
89127,
891392,
89140,
8915
891692,
89170,
8918
891992,
89200,
8921
892292,
89230,
8924
892592,
89260,
8927
892892,
89290,
8930
893114,
893292,
89330,
8934
893515,
893692,
89370,
8938
893992,
89400,
8941
894292,
89430,
8944
894592,
89460,
8947
894892,
89490,
8950
895122,
895292,
89530,
8954
895523,
895692,
89570,
8958
895992,
89600,
8961
896292,
89630,
8964
896592,
89660,
8967
896892,
89690,
8970
897192,
89720,
8973
897492,
89750,
8976
897792,
89780,
8979
898092,
89810,
8982
898337,
898492,
89850,
8986
898740,
898892,
89890,
8990
899192,
89920,
8993
899492,
89950,
8996
899792,
89980,
8999
900092,
90010,
9002
900392,
90040,
9005
900646,
900792,
90080,
9009
901092,
90110,
9012
901392,
90140,
9015
901650,
901792,
90180,
9019
902092,
90210,
9022
902392,
90240,
9025
902654,
902792,
90280,
9029
903092,
90310,
9032
903392,
90340,
9035
903659,
903792,
90380,
9039
904062,
904192,
90420,
9043
904463,
904592,
90460,
9047
904892,
90490,
9050
905192,
90520,
9053
905492,
90550,
9056
90572,
905892,
90590,
9060
906192,
90620,
9063
906492,
90650,
9066
906792,
90680,
9069
907092,
90710,
9072
907392,
90740,
9075
907692,
90770,
9078
907992,
90800,
9081
908292,
90830,
9084
908517,
908692,
90870,
9088
908992,
90900,
9091
909221,
909392,
90940,
9095
909624,
909792,
90980,
9099
910092,
91010,
9102
910392,
91040,
9105
910692,
91070,
9108
910932,
911092,
91110,
9112
911392,
91140,
9115
911634,
911792,
91180,
9119
912092,
91210,
9122
912392,
91240,
9125
912692,
91270,
9128
912992,
91300,
9131
913244,
913392,
91340,
9135
913645,
913792,
91380,
9139
914047,
914192,
91420,
9143
914449,
914592,
91460,
9147
914892,
91490,
9150
915192,
91520,
9153
915492,
91550,
9156
915792,
91580,
9159
916065,
916192,
91620,
9163
916466,
916592,
91660,
9167
916867,
916992,
91700,
9171
91723,
917392,
91740,
9175
917692,
91770,
9178
917992,
91800,
9181
91829,
918392,
91840,
9185
918610,
918792,
91880,
9189
919092,
91910,
9192
919313,
919492,
91950,
9196
919716,
919892,
91990,
9200
920192,
92020,
9203
920426,
920592,
92060,
9207
920892,
92090,
9210
921192,
92120,
9213
921492,
92150,
9216
921735,
921892,
92190,
9220
922141,
922292,
92230,
9224
922592,
92260,
9227
922892,
92290,
9230
923192,
92320,
9233
923492,
92350,
9236
923792,
92380,
9239
924092,
92410,
9242
92435,
924492,
92450,
9246
92478,
924892,
92490,
9250
925112,
925292,
92530,
9254
925592,
92560,
9257
925830,
925992,
92600,
9261
926231,
926392,
92640,
9265
926636,
926792,
92680,
9269
927042,
927192,
92720,
9273
927443,
927592,
92760,
9277
927851,
927992,
92800,
9281
928292,
92830,
9284
928555,
928692,
92870,
9288
928992,
92900,
9291
929220,
929392,
92940,
9295
929653,
929792,
92980,
9299
930058,
930192,
93020,
93030};
9304# define YYTYPE int
9305struct yywork { YYTYPE verify, advance; } yycrank[] = {
93060,0,\t0,0,\t1,3,\t0,0,\t
93070,0,\t0,0,\t0,0,\t0,0,\t
93080,0,\t0,0,\t1,4,\t1,5,\t
93090,0,\t0,0,\t0,0,\t0,0,\t
931046,0,\t48,0,\t0,0,\t0,0,\t
93110,0,\t0,0,\t0,0,\t0,0,\t
93120,0,\t0,0,\t0,0,\t0,0,\t
93130,0,\t0,0,\t0,0,\t0,0,\t
93140,0,\t1,6,\t1,7,\t1,8,\t
93150,0,\t0,0,\t1,9,\t0,0,\t
93160,0,\t1,10,\t1,11,\t0,0,\t
93171,12,\t1,13,\t0,0,\t1,14,\t
93180,0,\t1,15,\t1,16,\t1,16,\t
93191,17,\t1,16,\t1,16,\t1,16,\t
93201,16,\t1,16,\t0,0,\t0,0,\t
93214,0,\t1,18,\t1,19,\t1,20,\t
932246,48,\t48,48,\t1,3,\t1,3,\t
93230,0,\t0,0,\t0,0,\t0,0,\t
93240,0,\t0,0,\t0,0,\t0,0,\t
93250,0,\t0,0,\t1,3,\t0,0,\t
93260,0,\t1,3,\t4,0,\t0,0,\t
93270,0,\t0,0,\t0,0,\t0,0,\t
93280,0,\t0,0,\t4,0,\t0,0,\t
93290,0,\t0,0,\t4,0,\t1,21,\t
93300,0,\t0,0,\t1,22,\t1,23,\t
93311,24,\t1,25,\t1,26,\t1,27,\t
93320,0,\t1,28,\t1,29,\t0,0,\t
93334,44,\t1,30,\t1,31,\t1,32,\t
93341,33,\t1,34,\t0,0,\t1,35,\t
93351,36,\t1,37,\t1,38,\t2,7,\t
93361,39,\t0,0,\t1,40,\t2,9,\t
93371,41,\t0,0,\t1,42,\t2,11,\t
93380,0,\t9,0,\t2,13,\t0,0,\t
93392,14,\t0,0,\t0,0,\t2,16,\t
93402,16,\t2,17,\t2,16,\t2,16,\t
93412,16,\t2,16,\t0,0,\t0,0,\t
93424,0,\t11,0,\t2,18,\t2,19,\t
93432,20,\t0,0,\t0,0,\t9,0,\t
93440,0,\t0,0,\t0,0,\t0,0,\t
93450,0,\t0,0,\t0,0,\t9,0,\t
93460,0,\t0,0,\t0,0,\t9,0,\t
93470,0,\t0,0,\t0,0,\t11,0,\t
93480,0,\t0,0,\t0,0,\t0,0,\t
93490,0,\t3,43,\t0,0,\t11,0,\t
93500,0,\t9,44,\t0,0,\t11,0,\t
93512,21,\t3,43,\t3,0,\t2,22,\t
93522,23,\t2,24,\t2,25,\t2,26,\t
93532,27,\t0,0,\t2,28,\t2,29,\t
93547,0,\t11,44,\t2,30,\t2,31,\t
93552,32,\t2,33,\t2,34,\t0,0,\t
93562,35,\t2,36,\t2,37,\t2,38,\t
93573,0,\t2,39,\t3,43,\t2,40,\t
93580,0,\t2,41,\t0,0,\t2,42,\t
93593,0,\t9,0,\t7,0,\t3,43,\t
93603,0,\t0,0,\t0,0,\t0,0,\t
93613,43,\t0,0,\t7,0,\t8,46,\t
93620,0,\t0,0,\t7,0,\t0,0,\t
93633,43,\t11,0,\t3,44,\t8,46,\t
93648,0,\t0,0,\t0,0,\t0,0,\t
93650,0,\t3,43,\t3,43,\t0,0,\t
93667,44,\t0,0,\t0,0,\t7,45,\t
93670,0,\t0,0,\t0,0,\t0,0,\t
93680,0,\t3,43,\t12,49,\t0,0,\t
93693,43,\t0,0,\t8,47,\t0,0,\t
93708,43,\t0,0,\t12,49,\t12,0,\t
937114,0,\t0,0,\t8,47,\t0,0,\t
93720,0,\t8,46,\t3,0,\t0,0,\t
93730,0,\t0,0,\t8,46,\t0,0,\t
93740,0,\t0,0,\t0,0,\t0,0,\t
93757,0,\t0,0,\t8,46,\t0,0,\t
93768,48,\t12,0,\t14,0,\t12,49,\t
93770,0,\t0,0,\t0,0,\t8,46,\t
93788,46,\t12,0,\t14,0,\t18,0,\t
937912,50,\t12,0,\t14,0,\t0,0,\t
93800,0,\t12,49,\t14,52,\t8,46,\t
938115,0,\t0,0,\t8,46,\t0,0,\t
93820,0,\t12,49,\t14,52,\t12,51,\t
938314,44,\t0,0,\t0,0,\t0,0,\t
93840,0,\t18,0,\t12,49,\t12,49,\t
93850,0,\t0,0,\t0,0,\t0,0,\t
93860,0,\t18,0,\t15,0,\t16,0,\t
93870,0,\t18,0,\t12,49,\t0,0,\t
93880,0,\t12,49,\t15,0,\t0,0,\t
938919,0,\t0,0,\t15,0,\t15,53,\t
939015,54,\t0,0,\t15,55,\t18,44,\t
93910,0,\t0,0,\t18,61,\t12,0,\t
939214,0,\t16,0,\t15,56,\t0,0,\t
939315,57,\t0,0,\t0,0,\t17,0,\t
93940,0,\t16,0,\t19,0,\t15,58,\t
93950,0,\t16,0,\t16,53,\t16,54,\t
939620,0,\t16,56,\t19,0,\t0,0,\t
93970,0,\t0,0,\t19,0,\t0,0,\t
93980,0,\t16,56,\t15,58,\t16,57,\t
93990,0,\t17,0,\t0,0,\t18,0,\t
94000,0,\t0,0,\t16,58,\t22,0,\t
940119,44,\t17,0,\t20,0,\t19,62,\t
940215,0,\t17,0,\t17,53,\t17,54,\t
94030,0,\t17,56,\t20,0,\t0,0,\t
940423,0,\t16,58,\t20,0,\t0,0,\t
94050,0,\t17,56,\t0,0,\t17,57,\t
94060,0,\t22,0,\t0,0,\t24,0,\t
94070,0,\t0,0,\t17,58,\t16,0,\t
940820,44,\t22,0,\t15,59,\t20,63,\t
94090,0,\t22,0,\t23,0,\t0,0,\t
941019,0,\t0,0,\t0,0,\t0,0,\t
94110,0,\t17,58,\t23,0,\t25,0,\t
941226,0,\t24,0,\t23,0,\t22,44,\t
94130,0,\t0,0,\t0,0,\t0,0,\t
94140,0,\t24,0,\t0,0,\t17,0,\t
94150,0,\t24,0,\t0,0,\t0,0,\t
941623,44,\t17,60,\t0,0,\t28,0,\t
941720,0,\t25,0,\t26,0,\t0,0,\t
941827,0,\t0,0,\t0,0,\t24,44,\t
94190,0,\t25,0,\t26,0,\t0,0,\t
94200,0,\t25,0,\t26,0,\t0,0,\t
94210,0,\t0,0,\t0,0,\t22,0,\t
94220,0,\t28,0,\t0,0,\t0,0,\t
94230,0,\t22,64,\t27,0,\t25,44,\t
942426,44,\t28,0,\t0,0,\t0,0,\t
942523,0,\t28,0,\t27,0,\t22,65,\t
94260,0,\t0,0,\t27,0,\t23,68,\t
94270,0,\t22,66,\t22,67,\t24,0,\t
94280,0,\t29,0,\t24,70,\t28,44,\t
94290,0,\t0,0,\t0,0,\t0,0,\t
943027,44,\t24,71,\t0,0,\t30,0,\t
94310,0,\t0,0,\t0,0,\t23,69,\t
943224,72,\t0,0,\t31,0,\t25,0,\t
943326,0,\t0,0,\t25,73,\t29,0,\t
943432,0,\t0,0,\t25,74,\t0,0,\t
94350,0,\t0,0,\t25,75,\t29,0,\t
94360,0,\t30,0,\t0,0,\t29,0,\t
943725,76,\t0,0,\t0,0,\t28,0,\t
943831,0,\t30,0,\t26,77,\t33,0,\t
943927,0,\t30,0,\t32,0,\t27,78,\t
944031,0,\t29,44,\t0,0,\t0,0,\t
944131,0,\t27,79,\t32,0,\t27,80,\t
944228,81,\t0,0,\t32,0,\t30,44,\t
94430,0,\t0,0,\t34,0,\t0,0,\t
94440,0,\t33,0,\t31,44,\t0,0,\t
94450,0,\t0,0,\t0,0,\t0,0,\t
944632,44,\t33,0,\t0,0,\t36,0,\t
94470,0,\t33,0,\t0,0,\t0,0,\t
94480,0,\t35,0,\t0,0,\t0,0,\t
944934,0,\t29,0,\t0,0,\t0,0,\t
94500,0,\t0,0,\t0,0,\t33,44,\t
945134,0,\t0,0,\t0,0,\t30,0,\t
945234,0,\t36,0,\t0,0,\t0,0,\t
945337,0,\t29,82,\t31,0,\t35,0,\t
94540,0,\t36,0,\t40,0,\t0,0,\t
945532,0,\t36,0,\t34,44,\t35,0,\t
945630,83,\t31,85,\t0,0,\t35,0,\t
945730,84,\t0,0,\t0,0,\t31,86,\t
94580,0,\t38,0,\t37,0,\t36,44,\t
945931,87,\t32,88,\t0,0,\t33,0,\t
946040,0,\t35,44,\t37,0,\t0,0,\t
94610,0,\t0,0,\t37,0,\t0,0,\t
946240,0,\t0,0,\t0,0,\t0,0,\t
946340,0,\t39,0,\t0,0,\t38,0,\t
94640,0,\t0,0,\t34,0,\t33,89,\t
946537,44,\t0,0,\t0,0,\t38,0,\t
946633,90,\t0,0,\t40,44,\t38,0,\t
94670,0,\t0,0,\t0,0,\t36,0,\t
94680,0,\t0,0,\t0,0,\t39,0,\t
94690,0,\t35,0,\t34,91,\t0,0,\t
94700,0,\t38,44,\t36,94,\t39,0,\t
947135,92,\t0,0,\t0,0,\t39,0,\t
94720,0,\t0,0,\t0,0,\t0,0,\t
947335,93,\t36,95,\t36,96,\t0,0,\t
947437,0,\t41,0,\t42,0,\t0,0,\t
94750,0,\t39,44,\t40,0,\t0,0,\t
94760,0,\t0,0,\t37,97,\t37,98,\t
94770,0,\t40,108,\t0,0,\t0,0,\t
94780,0,\t37,99,\t0,0,\t0,0,\t
947937,100,\t38,0,\t37,101,\t41,0,\t
948042,0,\t43,0,\t0,0,\t0,0,\t
94810,0,\t0,0,\t0,0,\t41,0,\t
948242,0,\t0,0,\t44,0,\t41,0,\t
948342,0,\t38,102,\t0,0,\t38,103,\t
948445,0,\t39,0,\t38,104,\t38,105,\t
94850,0,\t0,0,\t0,0,\t43,0,\t
948639,106,\t41,44,\t42,44,\t0,0,\t
948739,107,\t0,0,\t0,0,\t43,0,\t
948844,0,\t0,0,\t47,47,\t43,0,\t
94890,0,\t0,0,\t45,0,\t0,0,\t
949044,0,\t0,0,\t47,47,\t47,0,\t
949144,0,\t0,0,\t45,0,\t0,0,\t
949250,0,\t43,44,\t45,0,\t0,0,\t
94930,0,\t49,0,\t0,0,\t0,0,\t
94940,0,\t0,0,\t44,44,\t0,0,\t
94950,0,\t41,0,\t42,0,\t0,0,\t
949645,44,\t47,47,\t0,0,\t47,0,\t
94970,0,\t0,0,\t50,0,\t0,0,\t
94980,0,\t47,47,\t0,0,\t49,0,\t
949947,47,\t0,0,\t50,0,\t0,0,\t
95000,0,\t47,47,\t50,0,\t49,0,\t
95010,0,\t43,0,\t49,49,\t49,0,\t
95020,0,\t47,47,\t51,0,\t0,0,\t
95030,0,\t0,0,\t44,0,\t52,0,\t
950450,51,\t0,0,\t47,47,\t47,47,\t
950545,0,\t49,51,\t0,0,\t0,0,\t
95060,0,\t0,0,\t53,0,\t0,0,\t
95070,0,\t0,0,\t47,47,\t0,0,\t
950851,0,\t47,47,\t0,0,\t0,0,\t
95090,0,\t52,0,\t0,0,\t0,0,\t
951051,0,\t0,0,\t0,0,\t51,49,\t
951151,0,\t52,0,\t0,0,\t54,0,\t
951253,0,\t52,0,\t0,0,\t0,0,\t
951350,0,\t52,52,\t55,0,\t0,0,\t
951453,0,\t49,0,\t51,51,\t0,0,\t
951553,0,\t52,52,\t0,0,\t52,44,\t
951653,109,\t0,0,\t0,0,\t0,0,\t
95170,0,\t54,0,\t0,0,\t0,0,\t
951853,109,\t0,0,\t53,44,\t0,0,\t
951955,0,\t54,0,\t0,0,\t0,0,\t
95200,0,\t54,0,\t56,0,\t0,0,\t
952155,0,\t54,52,\t0,0,\t0,0,\t
952255,0,\t55,53,\t55,54,\t0,0,\t
952355,55,\t54,52,\t51,0,\t54,44,\t
95240,0,\t0,0,\t0,0,\t52,0,\t
952555,56,\t0,0,\t55,57,\t0,0,\t
952656,0,\t57,0,\t0,0,\t0,0,\t
95270,0,\t55,58,\t53,0,\t58,0,\t
952856,0,\t0,0,\t0,0,\t0,0,\t
952956,0,\t56,53,\t56,54,\t0,0,\t
953056,56,\t0,0,\t0,0,\t0,0,\t
953155,58,\t0,0,\t59,0,\t57,0,\t
953256,56,\t0,0,\t56,57,\t54,0,\t
95330,0,\t58,0,\t0,0,\t57,0,\t
95340,0,\t56,58,\t55,0,\t57,0,\t
95350,0,\t58,0,\t0,0,\t57,110,\t
95360,0,\t58,0,\t60,0,\t0,0,\t
953759,0,\t61,0,\t0,0,\t57,110,\t
953856,58,\t57,44,\t0,0,\t0,0,\t
953959,0,\t0,0,\t0,0,\t58,44,\t
954059,0,\t0,0,\t0,0,\t0,0,\t
954159,112,\t0,0,\t56,0,\t0,0,\t
954260,0,\t62,0,\t63,0,\t61,0,\t
954359,112,\t0,0,\t59,44,\t0,0,\t
954460,0,\t0,0,\t58,111,\t61,0,\t
954560,0,\t59,112,\t59,112,\t61,0,\t
95460,0,\t0,0,\t64,0,\t0,0,\t
95470,0,\t57,0,\t0,0,\t62,0,\t
954863,0,\t65,0,\t60,44,\t58,0,\t
95490,0,\t61,44,\t0,0,\t62,0,\t
955063,0,\t0,0,\t66,0,\t62,0,\t
955163,0,\t0,0,\t0,0,\t0,0,\t
955264,0,\t0,0,\t59,0,\t0,0,\t
95530,0,\t0,0,\t0,0,\t65,0,\t
955464,0,\t62,44,\t63,44,\t0,0,\t
955564,0,\t67,0,\t0,0,\t65,0,\t
955666,0,\t0,0,\t68,0,\t65,0,\t
95570,0,\t0,0,\t60,0,\t0,0,\t
955866,0,\t61,0,\t64,44,\t0,0,\t
955966,0,\t69,0,\t60,113,\t0,0,\t
95600,0,\t65,44,\t0,0,\t67,0,\t
95610,0,\t0,0,\t0,0,\t0,0,\t
956268,0,\t0,0,\t66,44,\t67,0,\t
95630,0,\t62,0,\t63,0,\t67,0,\t
956468,0,\t0,0,\t70,0,\t69,0,\t
956568,0,\t0,0,\t0,0,\t0,0,\t
95660,0,\t71,0,\t0,0,\t69,0,\t
95670,0,\t67,44,\t64,0,\t69,0,\t
95680,0,\t0,0,\t68,44,\t0,0,\t
956964,114,\t65,0,\t72,0,\t0,0,\t
957070,0,\t73,0,\t0,0,\t65,115,\t
95710,0,\t69,44,\t66,0,\t71,0,\t
957270,0,\t0,0,\t0,0,\t0,0,\t
957370,0,\t65,116,\t0,0,\t71,0,\t
95740,0,\t66,117,\t0,0,\t71,0,\t
957572,0,\t0,0,\t0,0,\t73,0,\t
95760,0,\t67,0,\t70,44,\t0,0,\t
957772,0,\t74,0,\t68,0,\t73,0,\t
957872,0,\t71,44,\t0,0,\t73,0,\t
957975,0,\t0,0,\t0,0,\t0,0,\t
95800,0,\t69,0,\t0,0,\t0,0,\t
95810,0,\t76,0,\t72,44,\t67,118,\t
95820,0,\t73,44,\t0,0,\t74,0,\t
958368,119,\t0,0,\t0,0,\t0,0,\t
95840,0,\t0,0,\t75,0,\t74,0,\t
95850,0,\t77,0,\t70,0,\t74,0,\t
958678,0,\t0,0,\t75,0,\t76,0,\t
95870,0,\t71,0,\t75,0,\t0,0,\t
958871,121,\t0,0,\t0,0,\t76,0,\t
95890,0,\t74,44,\t0,0,\t76,0,\t
959070,120,\t0,0,\t72,0,\t77,0,\t
959175,44,\t73,0,\t78,0,\t0,0,\t
959279,0,\t80,0,\t0,0,\t77,0,\t
95930,0,\t76,44,\t78,0,\t77,0,\t
959473,123,\t0,0,\t78,0,\t0,0,\t
95950,0,\t0,0,\t0,0,\t0,0,\t
959681,0,\t72,122,\t0,0,\t0,0,\t
95970,0,\t77,44,\t79,0,\t80,0,\t
959878,44,\t74,0,\t0,0,\t0,0,\t
95990,0,\t82,0,\t79,0,\t80,0,\t
960075,0,\t74,124,\t79,0,\t80,0,\t
96010,0,\t0,0,\t81,0,\t83,0,\t
96020,0,\t76,0,\t76,126,\t0,0,\t
96030,0,\t84,0,\t81,0,\t0,0,\t
960479,44,\t80,44,\t81,0,\t82,0,\t
960575,125,\t0,0,\t0,0,\t0,0,\t
960685,0,\t77,0,\t86,0,\t82,0,\t
960778,0,\t83,0,\t0,0,\t82,0,\t
960881,44,\t0,0,\t0,0,\t84,0,\t
960977,127,\t83,0,\t0,0,\t0,0,\t
96100,0,\t83,0,\t78,128,\t84,0,\t
96110,0,\t82,44,\t85,0,\t84,0,\t
961286,0,\t0,0,\t0,0,\t0,0,\t
961379,0,\t80,0,\t85,0,\t83,44,\t
961486,0,\t0,0,\t85,0,\t0,0,\t
961586,0,\t84,44,\t0,0,\t0,0,\t
96160,0,\t87,0,\t0,0,\t80,130,\t
961781,0,\t0,0,\t0,0,\t88,0,\t
961885,44,\t79,129,\t86,44,\t0,0,\t
96190,0,\t0,0,\t0,0,\t0,0,\t
96200,0,\t82,0,\t0,0,\t0,0,\t
96210,0,\t0,0,\t0,0,\t87,0,\t
96220,0,\t81,131,\t89,0,\t83,0,\t
96230,0,\t88,0,\t83,132,\t87,0,\t
962483,133,\t84,0,\t0,0,\t87,0,\t
962583,134,\t88,0,\t0,0,\t90,0,\t
96260,0,\t88,0,\t91,0,\t0,0,\t
962785,0,\t92,0,\t86,0,\t0,0,\t
962889,0,\t87,44,\t85,136,\t0,0,\t
962986,137,\t0,0,\t84,135,\t88,44,\t
963089,0,\t0,0,\t93,0,\t0,0,\t
963189,0,\t90,0,\t86,138,\t0,0,\t
963291,0,\t0,0,\t0,0,\t92,0,\t
96330,0,\t90,0,\t0,0,\t0,0,\t
963491,0,\t90,0,\t89,44,\t92,0,\t
963591,0,\t94,0,\t0,0,\t92,0,\t
963693,0,\t0,0,\t95,0,\t96,0,\t
96370,0,\t87,0,\t0,0,\t90,44,\t
963893,0,\t0,0,\t91,44,\t88,0,\t
963993,0,\t92,44,\t0,0,\t0,0,\t
964087,139,\t0,0,\t0,0,\t94,0,\t
96410,0,\t0,0,\t0,0,\t0,0,\t
964295,0,\t96,0,\t93,44,\t94,0,\t
964388,140,\t0,0,\t89,0,\t94,0,\t
964495,0,\t96,0,\t97,0,\t0,0,\t
964595,0,\t96,0,\t0,0,\t0,0,\t
96460,0,\t0,0,\t0,0,\t90,0,\t
964798,0,\t94,44,\t91,0,\t0,0,\t
96480,0,\t92,0,\t95,44,\t96,44,\t
964992,143,\t0,0,\t99,0,\t0,0,\t
965097,0,\t0,0,\t92,144,\t90,141,\t
96510,0,\t0,0,\t93,0,\t91,142,\t
965297,0,\t93,146,\t98,0,\t92,145,\t
965397,0,\t0,0,\t0,0,\t100,0,\t
96540,0,\t101,0,\t98,0,\t0,0,\t
965599,0,\t0,0,\t98,0,\t93,147,\t
96560,0,\t94,0,\t97,44,\t93,148,\t
965799,0,\t0,0,\t95,0,\t96,0,\t
965899,0,\t95,150,\t0,0,\t0,0,\t
965998,44,\t100,0,\t0,0,\t101,0,\t
96600,0,\t95,151,\t0,0,\t0,0,\t
96610,0,\t100,0,\t99,44,\t101,0,\t
96620,0,\t100,0,\t0,0,\t101,0,\t
966396,152,\t94,149,\t0,0,\t102,0,\t
9664103,0,\t0,0,\t0,0,\t0,0,\t
96650,0,\t104,0,\t97,0,\t100,44,\t
96660,0,\t101,44,\t0,0,\t0,0,\t
96670,0,\t97,153,\t0,0,\t0,0,\t
966898,0,\t0,0,\t0,0,\t0,0,\t
9669105,0,\t102,0,\t103,0,\t0,0,\t
96700,0,\t0,0,\t99,0,\t104,0,\t
96710,0,\t102,0,\t103,0,\t98,154,\t
967299,155,\t102,0,\t103,0,\t104,0,\t
96730,0,\t106,0,\t0,0,\t104,0,\t
96740,0,\t99,156,\t105,0,\t100,0,\t
96750,0,\t101,0,\t0,0,\t102,44,\t
9676103,44,\t0,0,\t105,0,\t0,0,\t
9677107,0,\t104,44,\t105,0,\t0,0,\t
96780,0,\t0,0,\t0,0,\t106,0,\t
96790,0,\t0,0,\t0,0,\t0,0,\t
96800,0,\t108,0,\t100,157,\t106,0,\t
9681105,44,\t0,0,\t0,0,\t106,0,\t
9682101,158,\t0,0,\t107,0,\t0,0,\t
9683109,0,\t0,0,\t0,0,\t0,0,\t
96840,0,\t0,0,\t107,0,\t102,0,\t
9685103,0,\t106,44,\t107,0,\t108,0,\t
9686102,159,\t104,0,\t0,0,\t0,0,\t
96870,0,\t0,0,\t0,0,\t108,0,\t
9688104,161,\t0,0,\t109,0,\t108,0,\t
9689107,44,\t0,0,\t0,0,\t0,0,\t
9690105,0,\t102,160,\t109,0,\t110,0,\t
9691111,0,\t0,0,\t109,0,\t0,0,\t
96920,0,\t108,44,\t109,109,\t105,162,\t
96930,0,\t113,0,\t0,0,\t0,0,\t
96940,0,\t106,0,\t109,109,\t0,0,\t
9695109,44,\t0,0,\t0,0,\t0,0,\t
9696106,163,\t110,0,\t111,0,\t0,0,\t
96970,0,\t0,0,\t0,0,\t0,0,\t
9698107,0,\t110,0,\t111,0,\t113,0,\t
96990,0,\t110,0,\t111,0,\t0,0,\t
97000,0,\t110,110,\t0,0,\t113,0,\t
9701112,0,\t108,0,\t114,0,\t113,0,\t
9702108,165,\t110,110,\t0,0,\t110,44,\t
9703111,44,\t0,0,\t107,164,\t115,0,\t
9704109,0,\t0,0,\t110,166,\t0,0,\t
97050,0,\t113,44,\t0,0,\t0,0,\t
97060,0,\t0,0,\t112,0,\t0,0,\t
9707114,0,\t0,0,\t0,0,\t116,0,\t
97080,0,\t110,166,\t112,0,\t0,0,\t
9709114,0,\t115,0,\t112,0,\t0,0,\t
9710114,0,\t0,0,\t112,112,\t0,0,\t
9711117,0,\t115,0,\t0,0,\t110,0,\t
9712111,0,\t115,0,\t112,112,\t0,0,\t
9713112,44,\t116,0,\t114,44,\t118,0,\t
97140,0,\t113,0,\t0,0,\t112,112,\t
9715112,112,\t116,0,\t0,0,\t115,44,\t
9716119,0,\t116,0,\t117,0,\t0,0,\t
9717113,167,\t0,0,\t0,0,\t120,0,\t
97180,0,\t0,0,\t117,0,\t0,0,\t
97190,0,\t118,0,\t117,0,\t116,44,\t
97200,0,\t0,0,\t0,0,\t0,0,\t
97210,0,\t118,0,\t119,0,\t121,0,\t
9722112,0,\t118,0,\t114,0,\t0,0,\t
9723117,44,\t120,0,\t119,0,\t0,0,\t
9724122,0,\t0,0,\t119,0,\t115,0,\t
97250,0,\t120,0,\t0,0,\t118,44,\t
97260,0,\t120,0,\t0,0,\t0,0,\t
97270,0,\t121,0,\t0,0,\t114,168,\t
9728119,44,\t0,0,\t0,0,\t116,0,\t
9729123,0,\t121,0,\t122,0,\t120,44,\t
97300,0,\t121,0,\t0,0,\t0,0,\t
97310,0,\t0,0,\t122,0,\t0,0,\t
9732117,0,\t124,0,\t122,0,\t125,0,\t
9733116,169,\t0,0,\t0,0,\t121,44,\t
97340,0,\t0,0,\t123,0,\t118,0,\t
9735126,0,\t0,0,\t0,0,\t117,170,\t
9736122,44,\t0,0,\t123,0,\t0,0,\t
9737119,0,\t118,171,\t123,0,\t124,0,\t
97380,0,\t125,0,\t0,0,\t120,0,\t
97390,0,\t0,0,\t120,173,\t124,0,\t
97400,0,\t125,0,\t126,0,\t124,0,\t
9741123,44,\t125,0,\t0,0,\t0,0,\t
97420,0,\t127,0,\t126,0,\t121,0,\t
9743128,0,\t119,172,\t126,0,\t0,0,\t
97440,0,\t124,44,\t0,0,\t125,44,\t
9745122,0,\t0,0,\t0,0,\t0,0,\t
97460,0,\t0,0,\t0,0,\t121,174,\t
9747126,44,\t129,0,\t0,0,\t127,0,\t
97480,0,\t0,0,\t128,0,\t0,0,\t
9749122,175,\t0,0,\t0,0,\t127,0,\t
9750123,0,\t0,0,\t128,0,\t127,0,\t
9751130,0,\t0,0,\t128,0,\t0,0,\t
97520,0,\t131,0,\t0,0,\t129,0,\t
97530,0,\t124,0,\t123,176,\t125,0,\t
9754124,177,\t127,44,\t0,0,\t129,0,\t
9755128,44,\t0,0,\t0,0,\t129,0,\t
9756126,0,\t0,0,\t130,0,\t0,0,\t
9757132,0,\t0,0,\t124,178,\t131,0,\t
97580,0,\t133,0,\t130,0,\t0,0,\t
97590,0,\t129,44,\t130,0,\t131,0,\t
9760126,179,\t0,0,\t0,0,\t131,0,\t
9761126,180,\t0,0,\t0,0,\t0,0,\t
9762134,0,\t135,0,\t132,0,\t0,0,\t
9763130,44,\t127,0,\t0,0,\t133,0,\t
9764128,0,\t131,44,\t132,0,\t0,0,\t
97650,0,\t0,0,\t132,0,\t133,0,\t
97660,0,\t0,0,\t0,0,\t133,0,\t
9767127,181,\t0,0,\t134,0,\t135,0,\t
97680,0,\t129,0,\t0,0,\t0,0,\t
9769132,44,\t128,182,\t134,0,\t135,0,\t
9770136,0,\t133,44,\t134,0,\t135,0,\t
97710,0,\t0,0,\t0,0,\t0,0,\t
9772130,0,\t138,0,\t0,0,\t129,183,\t
97730,0,\t131,0,\t0,0,\t130,184,\t
9774134,44,\t135,44,\t0,0,\t0,0,\t
9775137,0,\t0,0,\t136,0,\t0,0,\t
97760,0,\t139,0,\t0,0,\t0,0,\t
97770,0,\t0,0,\t136,0,\t138,0,\t
9778132,0,\t0,0,\t136,0,\t131,185,\t
97790,0,\t133,0,\t132,186,\t138,0,\t
9780133,187,\t0,0,\t137,0,\t138,0,\t
9781140,0,\t0,0,\t0,0,\t139,0,\t
9782136,44,\t0,0,\t137,0,\t0,0,\t
9783134,0,\t135,0,\t137,0,\t139,0,\t
97840,0,\t138,44,\t0,0,\t139,0,\t
97850,0,\t134,188,\t0,0,\t0,0,\t
9786141,0,\t0,0,\t140,0,\t0,0,\t
9787137,44,\t142,0,\t0,0,\t135,189,\t
97880,0,\t139,44,\t140,0,\t0,0,\t
97890,0,\t0,0,\t140,0,\t0,0,\t
97900,0,\t0,0,\t0,0,\t0,0,\t
9791136,0,\t0,0,\t141,0,\t0,0,\t
9792143,0,\t0,0,\t0,0,\t142,0,\t
9793140,44,\t138,0,\t141,0,\t0,0,\t
97940,0,\t144,0,\t141,0,\t142,0,\t
9795136,190,\t0,0,\t0,0,\t142,0,\t
9796137,0,\t0,0,\t0,0,\t0,0,\t
9797145,0,\t139,0,\t143,0,\t137,191,\t
9798141,44,\t137,192,\t0,0,\t138,193,\t
97990,0,\t142,44,\t143,0,\t144,0,\t
98000,0,\t0,0,\t143,0,\t0,0,\t
9801139,194,\t0,0,\t0,0,\t144,0,\t
9802140,0,\t146,0,\t145,0,\t144,0,\t
9803147,0,\t0,0,\t0,0,\t148,0,\t
9804143,44,\t0,0,\t145,0,\t0,0,\t
98050,0,\t0,0,\t145,0,\t0,0,\t
9806140,195,\t144,44,\t0,0,\t0,0,\t
9807141,0,\t0,0,\t0,0,\t146,0,\t
9808149,0,\t142,0,\t147,0,\t141,196,\t
9809145,44,\t148,0,\t142,197,\t146,0,\t
98100,0,\t0,0,\t147,0,\t146,0,\t
98110,0,\t148,0,\t147,0,\t150,0,\t
98120,0,\t148,0,\t0,0,\t0,0,\t
9813143,0,\t151,0,\t149,0,\t0,0,\t
9814152,0,\t146,44,\t143,198,\t0,0,\t
9815147,44,\t144,0,\t149,0,\t148,44,\t
98160,0,\t0,0,\t149,0,\t0,0,\t
98170,0,\t150,0,\t0,0,\t0,0,\t
9818145,0,\t0,0,\t0,0,\t151,0,\t
9819153,0,\t150,0,\t152,0,\t145,200,\t
9820149,44,\t150,0,\t0,0,\t151,0,\t
98210,0,\t0,0,\t152,0,\t151,0,\t
9822144,199,\t0,0,\t152,0,\t154,0,\t
98230,0,\t146,0,\t0,0,\t150,44,\t
9824147,0,\t0,0,\t153,0,\t148,0,\t
9825147,202,\t151,44,\t0,0,\t0,0,\t
9826152,44,\t0,0,\t153,0,\t0,0,\t
9827155,0,\t0,0,\t153,0,\t0,0,\t
98280,0,\t154,0,\t156,0,\t146,201,\t
9829149,0,\t148,203,\t0,0,\t0,0,\t
98300,0,\t154,0,\t0,0,\t149,204,\t
9831153,44,\t154,0,\t0,0,\t0,0,\t
98320,0,\t157,0,\t155,0,\t150,0,\t
98330,0,\t0,0,\t0,0,\t158,0,\t
9834156,0,\t151,0,\t155,0,\t154,44,\t
9835152,0,\t0,0,\t155,0,\t0,0,\t
9836156,0,\t0,0,\t0,0,\t0,0,\t
9837156,0,\t0,0,\t0,0,\t157,0,\t
9838151,206,\t150,205,\t0,0,\t0,0,\t
9839155,44,\t158,0,\t152,207,\t157,0,\t
9840153,0,\t0,0,\t156,44,\t157,0,\t
98410,0,\t158,0,\t159,0,\t0,0,\t
98420,0,\t158,0,\t0,0,\t0,0,\t
98430,0,\t0,0,\t0,0,\t154,0,\t
9844153,208,\t157,44,\t0,0,\t0,0,\t
98450,0,\t0,0,\t154,209,\t158,44,\t
98460,0,\t0,0,\t0,0,\t160,0,\t
9847159,0,\t0,0,\t0,0,\t0,0,\t
9848155,0,\t0,0,\t161,0,\t155,210,\t
9849159,0,\t0,0,\t156,0,\t0,0,\t
9850159,0,\t0,0,\t0,0,\t162,0,\t
9851163,0,\t0,0,\t0,0,\t0,0,\t
98520,0,\t160,0,\t164,0,\t0,0,\t
98530,0,\t157,0,\t159,44,\t156,211,\t
9854161,0,\t160,0,\t0,0,\t158,0,\t
9855157,212,\t160,0,\t0,0,\t0,0,\t
9856161,0,\t162,0,\t163,0,\t165,0,\t
9857161,0,\t0,0,\t0,0,\t0,0,\t
9858164,0,\t162,0,\t163,0,\t160,44,\t
98590,0,\t162,0,\t163,0,\t0,0,\t
9860164,0,\t0,0,\t161,44,\t166,0,\t
9861164,0,\t0,0,\t0,0,\t0,0,\t
98620,0,\t165,0,\t159,0,\t162,44,\t
9863163,44,\t0,0,\t0,0,\t0,0,\t
98640,0,\t165,0,\t164,44,\t167,0,\t
9865159,213,\t165,0,\t0,0,\t0,0,\t
98660,0,\t166,0,\t0,0,\t0,0,\t
98670,0,\t0,0,\t0,0,\t160,0,\t
98680,0,\t166,0,\t0,0,\t165,44,\t
98690,0,\t166,0,\t161,0,\t0,0,\t
98700,0,\t167,0,\t160,214,\t0,0,\t
9871168,0,\t0,0,\t169,0,\t162,0,\t
9872163,0,\t167,0,\t0,0,\t166,44,\t
98730,0,\t167,0,\t164,0,\t0,0,\t
98740,0,\t0,0,\t161,215,\t170,0,\t
98750,0,\t163,217,\t162,216,\t0,0,\t
9876164,218,\t0,0,\t168,0,\t167,44,\t
9877169,0,\t0,0,\t166,220,\t165,0,\t
98780,0,\t0,0,\t168,0,\t171,0,\t
9879169,0,\t0,0,\t168,0,\t0,0,\t
9880169,0,\t170,0,\t0,0,\t0,0,\t
9881172,0,\t0,0,\t0,0,\t166,0,\t
98820,0,\t170,0,\t173,0,\t165,219,\t
9883168,44,\t170,0,\t169,44,\t0,0,\t
98840,0,\t171,0,\t0,0,\t174,0,\t
98850,0,\t0,0,\t0,0,\t167,0,\t
98860,0,\t171,0,\t172,0,\t170,44,\t
98870,0,\t171,0,\t0,0,\t0,0,\t
9888173,0,\t0,0,\t172,0,\t175,0,\t
98890,0,\t167,221,\t172,0,\t0,0,\t
9890173,0,\t174,0,\t176,0,\t171,44,\t
9891173,0,\t0,0,\t0,0,\t0,0,\t
9892168,0,\t174,0,\t169,0,\t0,0,\t
9893172,44,\t174,0,\t0,0,\t0,0,\t
98940,0,\t175,0,\t173,44,\t177,0,\t
98950,0,\t0,0,\t0,0,\t170,0,\t
9896176,0,\t175,0,\t168,222,\t174,44,\t
98970,0,\t175,0,\t170,224,\t0,0,\t
9898176,0,\t169,223,\t0,0,\t178,0,\t
9899176,0,\t0,0,\t0,0,\t171,0,\t
9900179,0,\t177,0,\t171,225,\t175,44,\t
99010,0,\t0,0,\t180,0,\t0,0,\t
9902172,0,\t177,0,\t176,44,\t181,0,\t
99030,0,\t177,0,\t173,0,\t172,227,\t
9904171,226,\t178,0,\t0,0,\t173,228,\t
99050,0,\t0,0,\t179,0,\t174,0,\t
99060,0,\t178,0,\t0,0,\t177,44,\t
9907180,0,\t178,0,\t179,0,\t0,0,\t
9908174,229,\t181,0,\t179,0,\t0,0,\t
9909180,0,\t0,0,\t182,0,\t175,0,\t
9910180,0,\t181,0,\t0,0,\t178,44,\t
9911183,0,\t181,0,\t176,0,\t0,0,\t
9912179,44,\t0,0,\t0,0,\t0,0,\t
99130,0,\t0,0,\t180,44,\t0,0,\t
99140,0,\t0,0,\t0,0,\t181,44,\t
9915182,0,\t175,230,\t0,0,\t177,0,\t
99160,0,\t0,0,\t183,0,\t0,0,\t
9917182,0,\t184,0,\t0,0,\t0,0,\t
9918182,0,\t176,231,\t183,0,\t185,0,\t
9919186,0,\t0,0,\t183,0,\t178,0,\t
99200,0,\t0,0,\t187,0,\t178,233,\t
9921179,0,\t177,232,\t182,44,\t0,0,\t
99220,0,\t0,0,\t180,0,\t184,0,\t
9923183,44,\t0,0,\t0,0,\t181,0,\t
99240,0,\t185,0,\t186,0,\t184,0,\t
99250,0,\t179,234,\t181,236,\t184,0,\t
9926187,0,\t185,0,\t186,0,\t0,0,\t
9927180,235,\t185,0,\t186,0,\t0,0,\t
9928187,0,\t0,0,\t188,0,\t189,0,\t
9929187,0,\t184,44,\t0,0,\t0,0,\t
9930190,0,\t0,0,\t182,0,\t185,44,\t
9931186,44,\t0,0,\t0,0,\t0,0,\t
9932183,0,\t182,237,\t187,44,\t0,0,\t
99330,0,\t0,0,\t0,0,\t183,238,\t
9934188,0,\t189,0,\t0,0,\t191,0,\t
99350,0,\t0,0,\t190,0,\t0,0,\t
9936188,0,\t189,0,\t0,0,\t0,0,\t
9937188,0,\t189,0,\t190,0,\t0,0,\t
99380,0,\t184,0,\t190,0,\t192,0,\t
99390,0,\t0,0,\t0,0,\t185,0,\t
9940186,0,\t191,0,\t188,44,\t189,44,\t
99410,0,\t0,0,\t187,0,\t0,0,\t
9942190,44,\t191,0,\t0,0,\t0,0,\t
99430,0,\t191,0,\t184,239,\t0,0,\t
99440,0,\t192,0,\t193,0,\t194,0,\t
9945195,0,\t0,0,\t0,0,\t0,0,\t
99460,0,\t192,0,\t0,0,\t191,44,\t
9947187,240,\t192,0,\t0,0,\t0,0,\t
99480,0,\t0,0,\t0,0,\t196,0,\t
99490,0,\t0,0,\t188,0,\t189,0,\t
9950193,0,\t194,0,\t195,0,\t192,44,\t
9951190,0,\t188,241,\t189,242,\t0,0,\t
9952193,0,\t194,0,\t195,0,\t0,0,\t
9953193,0,\t194,0,\t195,0,\t190,243,\t
99540,0,\t196,0,\t197,0,\t198,0,\t
9955199,0,\t0,0,\t0,0,\t191,0,\t
99560,0,\t196,0,\t193,44,\t194,44,\t
9957195,44,\t196,0,\t0,0,\t0,0,\t
99580,0,\t0,0,\t0,0,\t200,0,\t
99590,0,\t0,0,\t0,0,\t192,0,\t
9960197,0,\t198,0,\t199,0,\t196,44,\t
99610,0,\t0,0,\t0,0,\t0,0,\t
9962197,0,\t198,0,\t199,0,\t0,0,\t
9963197,0,\t198,0,\t199,0,\t0,0,\t
99640,0,\t200,0,\t201,0,\t192,244,\t
9965202,0,\t0,0,\t193,0,\t194,0,\t
9966195,0,\t200,0,\t197,44,\t198,44,\t
9967199,44,\t200,0,\t194,246,\t0,0,\t
9968193,245,\t0,0,\t0,0,\t0,0,\t
99690,0,\t0,0,\t0,0,\t196,0,\t
9970201,0,\t0,0,\t202,0,\t200,44,\t
99710,0,\t0,0,\t0,0,\t0,0,\t
9972201,0,\t0,0,\t202,0,\t203,0,\t
9973201,0,\t204,0,\t202,0,\t0,0,\t
99740,0,\t0,0,\t0,0,\t196,247,\t
99750,0,\t0,0,\t197,0,\t198,0,\t
9976199,0,\t0,0,\t201,44,\t0,0,\t
9977202,44,\t197,248,\t0,0,\t199,250,\t
99780,0,\t203,0,\t0,0,\t204,0,\t
99790,0,\t0,0,\t205,0,\t200,0,\t
99800,0,\t203,0,\t200,251,\t204,0,\t
9981198,249,\t203,0,\t0,0,\t204,0,\t
9982206,0,\t0,0,\t0,0,\t207,0,\t
99830,0,\t208,0,\t0,0,\t0,0,\t
99840,0,\t0,0,\t209,0,\t203,44,\t
9985205,0,\t204,44,\t201,0,\t0,0,\t
9986202,0,\t0,0,\t0,0,\t0,0,\t
9987205,0,\t0,0,\t206,0,\t0,0,\t
9988205,0,\t207,0,\t0,0,\t208,0,\t
9989202,253,\t0,0,\t206,0,\t0,0,\t
9990209,0,\t207,0,\t206,0,\t208,0,\t
9991201,252,\t207,0,\t205,44,\t208,0,\t
9992209,0,\t0,0,\t210,0,\t0,0,\t
9993209,0,\t211,0,\t0,0,\t203,0,\t
9994206,44,\t204,0,\t0,0,\t207,44,\t
99950,0,\t208,44,\t203,254,\t0,0,\t
99960,0,\t0,0,\t209,44,\t0,0,\t
99970,0,\t0,0,\t0,0,\t0,0,\t
9998210,0,\t0,0,\t212,0,\t211,0,\t
99990,0,\t0,0,\t0,0,\t0,0,\t
10000210,0,\t213,0,\t205,0,\t211,0,\t
10001210,0,\t0,0,\t0,0,\t211,0,\t
100020,0,\t0,0,\t214,0,\t215,0,\t
10003206,0,\t0,0,\t0,0,\t207,0,\t
10004212,0,\t208,0,\t210,44,\t206,256,\t
100050,0,\t211,44,\t209,0,\t213,0,\t
10006212,0,\t205,255,\t216,0,\t0,0,\t
10007212,0,\t0,0,\t0,0,\t213,0,\t
10008214,0,\t215,0,\t0,0,\t213,0,\t
10009207,257,\t0,0,\t0,0,\t217,0,\t
10010214,0,\t215,0,\t212,44,\t209,258,\t
10011214,0,\t215,0,\t0,0,\t0,0,\t
10012216,0,\t213,44,\t218,0,\t0,0,\t
100130,0,\t0,0,\t210,0,\t0,0,\t
10014216,0,\t211,0,\t214,44,\t215,44,\t
10015216,0,\t217,0,\t0,0,\t0,0,\t
100160,0,\t0,0,\t0,0,\t219,0,\t
100170,0,\t217,0,\t220,0,\t0,0,\t
10018218,0,\t217,0,\t216,44,\t0,0,\t
100190,0,\t211,260,\t212,0,\t0,0,\t
10020218,0,\t210,259,\t0,0,\t0,0,\t
10021218,0,\t213,0,\t0,0,\t217,44,\t
10022213,261,\t219,0,\t221,0,\t222,0,\t
10023220,0,\t0,0,\t214,0,\t215,0,\t
100240,0,\t219,0,\t218,44,\t0,0,\t
10025220,0,\t219,0,\t0,0,\t0,0,\t
10026220,0,\t0,0,\t0,0,\t0,0,\t
10027214,262,\t0,0,\t216,0,\t0,0,\t
10028221,0,\t222,0,\t223,0,\t219,44,\t
10029215,263,\t216,264,\t220,44,\t224,0,\t
10030221,0,\t222,0,\t0,0,\t217,0,\t
10031221,0,\t222,0,\t0,0,\t0,0,\t
100320,0,\t0,0,\t0,0,\t0,0,\t
100330,0,\t0,0,\t218,0,\t0,0,\t
10034223,0,\t217,265,\t221,44,\t222,44,\t
100350,0,\t224,0,\t225,0,\t0,0,\t
10036223,0,\t218,266,\t0,0,\t0,0,\t
10037223,0,\t224,0,\t0,0,\t219,0,\t
100380,0,\t224,0,\t220,0,\t0,0,\t
100390,0,\t226,0,\t227,0,\t0,0,\t
100400,0,\t0,0,\t223,44,\t228,0,\t
10041225,0,\t219,267,\t0,0,\t224,44,\t
100420,0,\t0,0,\t0,0,\t0,0,\t
10043225,0,\t0,0,\t221,0,\t222,0,\t
10044225,0,\t0,0,\t0,0,\t226,0,\t
10045227,0,\t221,268,\t222,269,\t0,0,\t
100460,0,\t228,0,\t229,0,\t226,0,\t
10047227,0,\t0,0,\t225,44,\t226,0,\t
10048227,0,\t228,0,\t0,0,\t230,0,\t
100490,0,\t228,0,\t223,0,\t0,0,\t
100500,0,\t0,0,\t231,0,\t224,0,\t
100510,0,\t226,44,\t227,44,\t0,0,\t
10052229,0,\t0,0,\t0,0,\t228,44,\t
100530,0,\t0,0,\t223,270,\t0,0,\t
10054229,0,\t230,0,\t0,0,\t0,0,\t
10055229,0,\t0,0,\t0,0,\t0,0,\t
10056231,0,\t230,0,\t225,0,\t0,0,\t
100570,0,\t230,0,\t232,0,\t0,0,\t
10058231,0,\t233,0,\t229,44,\t234,0,\t
10059231,0,\t0,0,\t0,0,\t0,0,\t
100600,0,\t226,0,\t227,0,\t230,44,\t
100610,0,\t226,272,\t235,0,\t228,0,\t
10062225,271,\t227,273,\t231,44,\t0,0,\t
10063232,0,\t0,0,\t0,0,\t233,0,\t
100640,0,\t234,0,\t228,274,\t0,0,\t
10065232,0,\t0,0,\t236,0,\t233,0,\t
10066232,0,\t234,0,\t0,0,\t233,0,\t
10067235,0,\t234,0,\t229,0,\t0,0,\t
100680,0,\t237,0,\t0,0,\t238,0,\t
10069235,0,\t229,275,\t232,44,\t230,0,\t
10070235,0,\t233,44,\t0,0,\t234,44,\t
10071236,0,\t0,0,\t231,0,\t0,0,\t
100720,0,\t0,0,\t239,0,\t0,0,\t
10073236,0,\t0,0,\t235,44,\t237,0,\t
10074236,0,\t238,0,\t0,0,\t0,0,\t
100750,0,\t0,0,\t0,0,\t237,0,\t
100760,0,\t238,0,\t0,0,\t237,0,\t
100770,0,\t238,0,\t236,44,\t0,0,\t
10078239,0,\t0,0,\t232,0,\t240,0,\t
100790,0,\t233,0,\t241,0,\t234,0,\t
10080239,0,\t237,44,\t0,0,\t238,44,\t
10081239,0,\t0,0,\t0,0,\t0,0,\t
10082242,0,\t233,277,\t235,0,\t243,0,\t
100830,0,\t0,0,\t0,0,\t235,279,\t
10084232,276,\t240,0,\t239,44,\t0,0,\t
10085241,0,\t234,278,\t0,0,\t0,0,\t
100860,0,\t240,0,\t236,0,\t244,0,\t
10087241,0,\t240,0,\t242,0,\t0,0,\t
10088241,0,\t243,0,\t0,0,\t0,0,\t
10089245,0,\t237,0,\t242,0,\t238,0,\t
100900,0,\t243,0,\t242,0,\t240,44,\t
10091238,280,\t243,0,\t241,44,\t0,0,\t
100920,0,\t244,0,\t0,0,\t0,0,\t
100930,0,\t0,0,\t239,0,\t246,0,\t
10094242,44,\t244,0,\t245,0,\t243,44,\t
100950,0,\t244,0,\t0,0,\t0,0,\t
10096247,0,\t0,0,\t245,0,\t0,0,\t
100970,0,\t0,0,\t245,0,\t248,0,\t
100980,0,\t0,0,\t0,0,\t244,44,\t
100990,0,\t246,0,\t0,0,\t240,0,\t
10100249,0,\t239,281,\t241,0,\t0,0,\t
10101245,44,\t246,0,\t247,0,\t250,0,\t
10102241,283,\t246,0,\t240,282,\t0,0,\t
10103242,0,\t248,0,\t247,0,\t243,0,\t
10104251,0,\t242,284,\t247,0,\t0,0,\t
101050,0,\t248,0,\t249,0,\t246,44,\t
10106243,285,\t248,0,\t0,0,\t0,0,\t
101070,0,\t250,0,\t249,0,\t244,0,\t
10108247,44,\t0,0,\t249,0,\t252,0,\t
101090,0,\t250,0,\t251,0,\t248,44,\t
10110245,0,\t250,0,\t0,0,\t0,0,\t
10111253,0,\t0,0,\t251,0,\t0,0,\t
10112249,44,\t244,286,\t251,0,\t254,0,\t
101130,0,\t0,0,\t245,287,\t250,44,\t
101140,0,\t252,0,\t0,0,\t246,0,\t
101150,0,\t0,0,\t0,0,\t0,0,\t
10116251,44,\t252,0,\t253,0,\t255,0,\t
10117247,0,\t252,0,\t0,0,\t0,0,\t
101180,0,\t254,0,\t253,0,\t248,0,\t
10119256,0,\t0,0,\t253,0,\t0,0,\t
101200,0,\t254,0,\t257,0,\t252,44,\t
10121249,0,\t254,0,\t0,0,\t0,0,\t
101220,0,\t255,0,\t0,0,\t250,0,\t
10123253,44,\t0,0,\t250,290,\t258,0,\t
10124248,288,\t255,0,\t256,0,\t254,44,\t
10125251,0,\t255,0,\t249,289,\t0,0,\t
10126257,0,\t0,0,\t256,0,\t0,0,\t
101270,0,\t0,0,\t256,0,\t259,0,\t
10128257,0,\t0,0,\t260,0,\t255,44,\t
10129257,0,\t258,0,\t0,0,\t252,0,\t
10130261,0,\t0,0,\t251,291,\t0,0,\t
10131256,44,\t258,0,\t0,0,\t262,0,\t
10132253,0,\t258,0,\t257,44,\t0,0,\t
101330,0,\t259,0,\t0,0,\t254,0,\t
10134260,0,\t0,0,\t0,0,\t252,292,\t
10135254,293,\t259,0,\t261,0,\t258,44,\t
10136260,0,\t259,0,\t0,0,\t0,0,\t
10137260,0,\t262,0,\t261,0,\t255,0,\t
10138263,0,\t0,0,\t261,0,\t264,0,\t
101390,0,\t262,0,\t265,0,\t259,44,\t
10140256,0,\t262,0,\t260,44,\t0,0,\t
101410,0,\t0,0,\t257,0,\t0,0,\t
10142261,44,\t0,0,\t0,0,\t0,0,\t
10143255,294,\t0,0,\t263,0,\t262,44,\t
101440,0,\t264,0,\t0,0,\t258,0,\t
10145265,0,\t0,0,\t263,0,\t266,0,\t
10146257,295,\t264,0,\t263,0,\t0,0,\t
10147265,0,\t264,0,\t0,0,\t0,0,\t
10148265,0,\t267,0,\t0,0,\t259,0,\t
101490,0,\t0,0,\t260,0,\t0,0,\t
10150263,44,\t258,296,\t0,0,\t264,44,\t
10151261,0,\t266,0,\t265,44,\t0,0,\t
101520,0,\t0,0,\t268,0,\t262,0,\t
101530,0,\t266,0,\t0,0,\t267,0,\t
10154269,0,\t266,0,\t260,297,\t0,0,\t
10155261,298,\t0,0,\t0,0,\t267,0,\t
101560,0,\t270,0,\t271,0,\t267,0,\t
101570,0,\t0,0,\t0,0,\t266,44,\t
10158268,0,\t0,0,\t0,0,\t0,0,\t
10159263,0,\t0,0,\t269,0,\t264,0,\t
10160268,0,\t267,44,\t265,0,\t0,0,\t
10161268,0,\t0,0,\t269,0,\t270,0,\t
10162271,0,\t0,0,\t269,0,\t0,0,\t
101630,0,\t0,0,\t272,0,\t270,0,\t
10164271,0,\t0,0,\t268,44,\t270,0,\t
10165271,0,\t0,0,\t0,0,\t273,0,\t
10166269,44,\t274,0,\t0,0,\t266,0,\t
101670,0,\t265,299,\t0,0,\t0,0,\t
101680,0,\t270,44,\t271,44,\t0,0,\t
10169272,0,\t267,0,\t0,0,\t0,0,\t
101700,0,\t0,0,\t0,0,\t266,300,\t
10171272,0,\t273,0,\t275,0,\t274,0,\t
10172272,0,\t0,0,\t0,0,\t0,0,\t
101730,0,\t273,0,\t268,0,\t274,0,\t
10174276,0,\t273,0,\t0,0,\t274,0,\t
10175269,0,\t0,0,\t272,44,\t277,0,\t
10176267,301,\t269,302,\t278,0,\t0,0,\t
10177275,0,\t270,0,\t271,0,\t273,44,\t
101780,0,\t274,44,\t270,303,\t0,0,\t
10179275,0,\t0,0,\t276,0,\t0,0,\t
10180275,0,\t0,0,\t0,0,\t0,0,\t
101810,0,\t277,0,\t276,0,\t0,0,\t
10182278,0,\t0,0,\t276,0,\t279,0,\t
10183271,304,\t277,0,\t275,44,\t0,0,\t
10184278,0,\t277,0,\t272,0,\t0,0,\t
10185278,0,\t0,0,\t0,0,\t0,0,\t
10186276,44,\t0,0,\t0,0,\t273,0,\t
101870,0,\t274,0,\t272,305,\t277,44,\t
101880,0,\t279,0,\t278,44,\t280,0,\t
101890,0,\t0,0,\t0,0,\t0,0,\t
101900,0,\t279,0,\t281,0,\t273,306,\t
10191282,0,\t279,0,\t0,0,\t0,0,\t
101920,0,\t0,0,\t275,0,\t274,307,\t
101930,0,\t0,0,\t0,0,\t283,0,\t
10194275,308,\t280,0,\t0,0,\t279,44,\t
10195276,0,\t0,0,\t0,0,\t0,0,\t
10196281,0,\t280,0,\t282,0,\t277,0,\t
101970,0,\t280,0,\t278,0,\t0,0,\t
10198281,0,\t0,0,\t282,0,\t284,0,\t
10199281,0,\t283,0,\t282,0,\t0,0,\t
10200276,309,\t278,310,\t285,0,\t280,44,\t
10201286,0,\t283,0,\t0,0,\t0,0,\t
102020,0,\t283,0,\t281,44,\t0,0,\t
10203282,44,\t0,0,\t0,0,\t279,0,\t
102040,0,\t284,0,\t0,0,\t0,0,\t
102050,0,\t0,0,\t0,0,\t283,44,\t
10206285,0,\t284,0,\t286,0,\t287,0,\t
102070,0,\t284,0,\t0,0,\t0,0,\t
10208285,0,\t0,0,\t286,0,\t0,0,\t
10209285,0,\t0,0,\t286,0,\t280,0,\t
102100,0,\t0,0,\t288,0,\t284,44,\t
10211289,0,\t0,0,\t281,0,\t290,0,\t
10212282,0,\t287,0,\t285,44,\t0,0,\t
10213286,44,\t0,0,\t0,0,\t0,0,\t
102140,0,\t287,0,\t0,0,\t283,0,\t
102150,0,\t287,0,\t0,0,\t0,0,\t
10216288,0,\t282,312,\t289,0,\t281,311,\t
102170,0,\t290,0,\t283,313,\t291,0,\t
10218288,0,\t0,0,\t289,0,\t287,44,\t
10219288,0,\t290,0,\t289,0,\t284,0,\t
102200,0,\t290,0,\t292,0,\t0,0,\t
10221293,0,\t0,0,\t285,0,\t0,0,\t
10222286,0,\t0,0,\t288,44,\t294,0,\t
10223289,44,\t291,0,\t0,0,\t290,44,\t
10224285,314,\t0,0,\t0,0,\t0,0,\t
102250,0,\t291,0,\t0,0,\t0,0,\t
10226292,0,\t291,0,\t293,0,\t0,0,\t
102270,0,\t0,0,\t0,0,\t287,0,\t
10228292,0,\t294,0,\t293,0,\t295,0,\t
10229292,0,\t0,0,\t293,0,\t291,44,\t
102300,0,\t294,0,\t0,0,\t0,0,\t
10231296,0,\t294,0,\t288,0,\t0,0,\t
10232289,0,\t0,0,\t292,44,\t290,0,\t
10233293,44,\t0,0,\t0,0,\t289,317,\t
102340,0,\t295,0,\t287,315,\t294,44,\t
10235297,0,\t0,0,\t0,0,\t298,0,\t
102360,0,\t295,0,\t296,0,\t288,316,\t
102370,0,\t295,0,\t0,0,\t0,0,\t
10238290,318,\t0,0,\t296,0,\t291,0,\t
10239299,0,\t0,0,\t296,0,\t300,0,\t
102400,0,\t0,0,\t297,0,\t295,44,\t
102410,0,\t298,0,\t292,0,\t0,0,\t
10242293,0,\t0,0,\t297,0,\t0,0,\t
10243296,44,\t298,0,\t297,0,\t294,0,\t
102440,0,\t298,0,\t299,0,\t0,0,\t
10245301,0,\t300,0,\t0,0,\t302,0,\t
102460,0,\t0,0,\t299,0,\t0,0,\t
10247297,44,\t300,0,\t299,0,\t298,44,\t
102480,0,\t300,0,\t0,0,\t0,0,\t
10249303,0,\t0,0,\t0,0,\t295,0,\t
102500,0,\t0,0,\t301,0,\t0,0,\t
10251299,44,\t302,0,\t295,319,\t300,44,\t
10252296,0,\t0,0,\t301,0,\t296,320,\t
10253304,0,\t302,0,\t301,0,\t305,0,\t
102540,0,\t302,0,\t303,0,\t0,0,\t
102550,0,\t0,0,\t0,0,\t0,0,\t
10256297,0,\t306,0,\t303,0,\t298,0,\t
10257301,44,\t0,0,\t303,0,\t302,44,\t
102580,0,\t0,0,\t304,0,\t307,0,\t
10259298,322,\t305,0,\t0,0,\t0,0,\t
10260299,0,\t297,321,\t304,0,\t300,0,\t
10261303,44,\t305,0,\t304,0,\t306,0,\t
102620,0,\t305,0,\t0,0,\t0,0,\t
10263308,0,\t0,0,\t309,0,\t306,0,\t
102640,0,\t307,0,\t0,0,\t306,0,\t
10265304,44,\t0,0,\t0,0,\t305,44,\t
10266301,0,\t307,0,\t0,0,\t302,0,\t
102670,0,\t307,0,\t0,0,\t0,0,\t
102680,0,\t306,44,\t308,0,\t0,0,\t
10269309,0,\t0,0,\t0,0,\t0,0,\t
10270303,0,\t310,0,\t308,0,\t307,44,\t
10271309,0,\t0,0,\t308,0,\t303,323,\t
10272309,0,\t0,0,\t0,0,\t311,0,\t
10273312,0,\t0,0,\t0,0,\t0,0,\t
10274304,0,\t0,0,\t0,0,\t305,0,\t
10275308,44,\t313,0,\t309,44,\t310,0,\t
102760,0,\t0,0,\t0,0,\t0,0,\t
102770,0,\t306,0,\t0,0,\t310,0,\t
102780,0,\t311,0,\t312,0,\t310,0,\t
10279304,324,\t0,0,\t0,0,\t307,0,\t
10280314,0,\t311,0,\t312,0,\t313,0,\t
102810,0,\t311,0,\t312,0,\t0,0,\t
102820,0,\t310,44,\t315,0,\t313,0,\t
102830,0,\t316,0,\t0,0,\t313,0,\t
10284308,0,\t0,0,\t309,0,\t311,44,\t
10285312,44,\t0,0,\t314,0,\t0,0,\t
102860,0,\t0,0,\t307,325,\t0,0,\t
102870,0,\t313,44,\t314,0,\t0,0,\t
10288315,0,\t0,0,\t314,0,\t316,0,\t
102890,0,\t317,0,\t0,0,\t0,0,\t
10290315,0,\t0,0,\t0,0,\t316,0,\t
10291315,0,\t310,0,\t0,0,\t316,0,\t
10292314,44,\t0,0,\t0,0,\t0,0,\t
10293318,0,\t310,326,\t0,0,\t311,0,\t
10294312,0,\t319,0,\t315,44,\t317,0,\t
102950,0,\t316,44,\t0,0,\t0,0,\t
102960,0,\t313,0,\t0,0,\t317,0,\t
10297320,0,\t0,0,\t0,0,\t317,0,\t
10298312,327,\t0,0,\t318,0,\t0,0,\t
102990,0,\t321,0,\t0,0,\t319,0,\t
103000,0,\t313,328,\t318,0,\t0,0,\t
10301314,0,\t317,44,\t318,0,\t319,0,\t
103020,0,\t0,0,\t320,0,\t319,0,\t
103030,0,\t0,0,\t315,0,\t0,0,\t
103040,0,\t316,0,\t320,0,\t321,0,\t
10305318,44,\t322,0,\t320,0,\t0,0,\t
103060,0,\t319,44,\t314,329,\t321,0,\t
103070,0,\t0,0,\t0,0,\t321,0,\t
103080,0,\t0,0,\t0,0,\t0,0,\t
10309320,44,\t323,0,\t0,0,\t0,0,\t
10310324,0,\t317,0,\t0,0,\t322,0,\t
103110,0,\t321,44,\t317,330,\t0,0,\t
103120,0,\t0,0,\t0,0,\t322,0,\t
103130,0,\t0,0,\t0,0,\t322,0,\t
10314318,0,\t0,0,\t0,0,\t323,0,\t
10315325,0,\t319,0,\t324,0,\t0,0,\t
103160,0,\t0,0,\t319,332,\t323,0,\t
103170,0,\t322,44,\t324,0,\t323,0,\t
10318320,0,\t0,0,\t324,0,\t0,0,\t
103190,0,\t326,0,\t318,331,\t327,0,\t
10320328,0,\t321,0,\t325,0,\t0,0,\t
103210,0,\t323,44,\t0,0,\t320,333,\t
10322324,44,\t0,0,\t325,0,\t0,0,\t
103230,0,\t0,0,\t325,0,\t0,0,\t
103240,0,\t0,0,\t0,0,\t326,0,\t
10325329,0,\t327,0,\t328,0,\t0,0,\t
103260,0,\t322,0,\t321,334,\t326,0,\t
10327325,44,\t327,0,\t328,0,\t326,0,\t
10328322,335,\t327,0,\t328,0,\t0,0,\t
103290,0,\t330,0,\t0,0,\t331,0,\t
10330332,0,\t323,0,\t329,0,\t0,0,\t
10331324,0,\t326,44,\t0,0,\t327,44,\t
10332328,44,\t0,0,\t329,0,\t0,0,\t
103330,0,\t0,0,\t329,0,\t0,0,\t
103340,0,\t0,0,\t0,0,\t330,0,\t
103350,0,\t331,0,\t332,0,\t0,0,\t
10336325,0,\t0,0,\t0,0,\t330,0,\t
10337329,44,\t331,0,\t332,0,\t330,0,\t
10338333,0,\t331,0,\t332,0,\t0,0,\t
103390,0,\t334,0,\t0,0,\t335,0,\t
103400,0,\t326,0,\t0,0,\t327,0,\t
10341328,0,\t330,44,\t0,0,\t331,44,\t
10342332,44,\t0,0,\t0,0,\t0,0,\t
10343336,0,\t0,0,\t333,0,\t0,0,\t
103440,0,\t0,0,\t0,0,\t334,0,\t
103450,0,\t335,0,\t333,0,\t0,0,\t
10346329,0,\t0,0,\t333,0,\t334,0,\t
10347326,336,\t335,0,\t0,0,\t334,0,\t
10348337,0,\t335,0,\t336,0,\t0,0,\t
103490,0,\t338,0,\t0,0,\t0,0,\t
10350333,44,\t330,0,\t336,0,\t331,0,\t
10351332,0,\t334,44,\t336,0,\t335,44,\t
103520,0,\t0,0,\t0,0,\t0,0,\t
103530,0,\t0,0,\t337,0,\t0,0,\t
103540,0,\t0,0,\t0,0,\t338,0,\t
10355336,44,\t0,0,\t337,0,\t0,0,\t
103560,0,\t0,0,\t337,0,\t338,0,\t
103570,0,\t0,0,\t0,0,\t338,0,\t
103580,0,\t0,0,\t0,0,\t0,0,\t
10359333,0,\t0,0,\t0,0,\t0,0,\t
10360337,44,\t334,0,\t0,0,\t335,0,\t
103610,0,\t338,44,\t0,0,\t0,0,\t
103620,0,\t335,338,\t0,0,\t0,0,\t
103630,0,\t0,0,\t333,337,\t0,0,\t
10364336,0,\t0,0,\t0,0,\t0,0,\t
103650,0,\t0,0,\t0,0,\t0,0,\t
103660,0,\t0,0,\t0,0,\t0,0,\t
103670,0,\t0,0,\t0,0,\t0,0,\t
103680,0,\t0,0,\t0,0,\t0,0,\t
10369337,0,\t0,0,\t0,0,\t0,0,\t
103700,0,\t338,0,\t0,0,\t0,0,\t
103710,0};'
10372		OUTPUT - $'
10373#include <ast.h>
10374# include "stdio.h"
10375# define U(x) x
10376# define NLSTATE yyprevious=YYNEWLINE
10377# define BEGIN yybgin = yysvec + 1 +
10378# define INITIAL 0
10379# define YYLERR yysvec
10380# define YYSTATE (yyestate-yysvec-1)
10381# define YYOPTIM 1
10382# define YYLMAX BUFSIZ
10383# define output(c) putc(c,yyout)
10384# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
10385# define unput(c) {yytchar= (c);if(yytchar==\'\\n\')yylineno--;*yysptr++=yytchar;}
10386# define yymore() (yymorfg=1)
10387# define ECHO fprintf(yyout, "%s",yytext)
10388# define REJECT { nstr = yyreject(); goto yyfussy;}
10389int yyleng; extern __MANGLE__ char yytext[];
10390int yymorfg;
10391extern __MANGLE__ char *yysptr, yysbuf[];
10392int yytchar;
10393FILE *yyin = {stdin}, *yyout = {stdout};
10394extern __MANGLE__ int yylineno;
10395struct yysvf {
10396\tstruct yywork *yystoff;
10397\tstruct yysvf *yyother;
10398\tint *yystops;};
10399struct yysvf *yyestate;
10400extern __MANGLE__ struct yysvf yysvec[], *yybgin;
10401/*
10402 * lex.l - scanner for yeast announcements/specifications
10403 *
10404 * Author:\tBalachander Krishnamurthy
10405 * \t\tDavid S. Rosenblum
10406 * \t\tAT&T Bell Laboratories
10407 * Date:\tMon Feb 27 22:40:42 1989
10408 *
10409 */
10410
10411/*
10412 * Modification history:
10413 * \tMon Mar 12 13:38:46 1990 -- undef\'ing input to define own routine
10414 *      Tue Jun 26 14:14:24 1990 -- changed BLANKFREESTRING from * to +
10415 *
10416 * If any tokens are added here yeast.y has to change - :-(
10417 */
10418
10419#undef\tinput\t /* defeat lex */
10420
10421extern __MANGLE__ void savesb __PROTO__((char*));
10422extern __MANGLE__ void FixString __PROTO__((char[]));
10423extern __MANGLE__ void errmsg __PROTO__((char*));
10424extern __MANGLE__ char input __PROTO__((void));
10425
10426char c;
10427#include <h/globals.h>
10428#include <yeast.h>
10429
10430extern __MANGLE__ bool fParseFailed;
10431# define YYNEWLINE 10
10432yylex(){
10433int nstr; extern __MANGLE__ int yyprevious;
10434while((nstr = yylook()) >= 0)
10435yyfussy: switch(nstr){
10436case 0:
10437if(yywrap()) return(0); break;
10438case 1:
10439 ;
10440break;
10441case 2:
10442        {savesb("3dfile"); return(DDDFILECLASS);}
10443break;
10444case 3:
10445\t{savesb("addspec");return(ADDSPEC);}
10446break;
10447case 4:
10448\t{savesb("and"); return(AND);}
10449break;
10450case 5:
10451{savesb("announce"); return(ANNOUNCE);}
10452break;
10453case 6:
10454\t{savesb("at"); return(AT);}
10455break;
10456case 7:
10457\t{savesb("atime"); return(ATIME);}
10458break;
10459case 8:
10460{savesb("authattr"); return(AUTHATTR);}
10461break;
10462case 9:
10463\t{savesb("authobj"); return(AUTHOBJ);}
10464break;
10465case 10:
10466\t{savesb("between"); return(BETWEEN);}
10467break;
10468case 11:
10469\t{savesb("by"); return(BY);}
10470break;
10471case 12:
10472{savesb("capacity"); return(CAPACITY);}
10473break;
10474case 13:
10475\t{savesb("changed"); return(CHANGED);}
10476break;
10477case 14:
10478\t{savesb("count"); return(COUNT);}
10479break;
10480case 15:
10481\t{savesb("daily"); return(DAILY);}
10482break;
10483case 16:
10484\t{savesb("defattr"); return(DEFATTR);}
10485break;
10486case 17:
10487\t{savesb("defobj"); return(DEFOBJ);}
10488break;
10489case 18:
10490        {savesb("dir"); return(DIRCLASS);}
10491break;
10492case 19:
10493\t{savesb("do"); return(DO);}
10494break;
10495case 20:
10496{savesb("do_notify"); return(DO_NOTIFY);}
10497break;
10498case 21:
10499\t{savesb("do_rpc"); return(DO_RPC);}
10500break;
10501case 22:
10502\t{savesb("etime"); return(PETIME);}
10503break;
10504case 23:
10505\t{savesb("false"); return(FALSE);}
10506break;
10507case 24:
10508\t{savesb("fgspec"); return(FGSPEC);}
10509break;
10510case 25:
10511        {savesb("file"); return(FILECLASS);}
10512break;
10513case 26:
10514\t{savesb("filesys"); return(FILESYSTEMCLASS);}
10515break;
10516case 27:
10517\t{savesb("host"); return(HOSTCLASS);}
10518break;
10519case 28:
10520\t{savesb("in"); return(IN);}
10521break;
10522case 29:
10523\t{savesb("load"); return(LOAD);}
10524break;
10525case 30:
10526{savesb("where"); return(LOCATION);}
10527break;
10528case 31:
10529{savesb("loggedin"); return(LOGGEDIN);}
10530break;
10531case 32:
10532\t{savesb("lsspec"); return(LSSPEC);}
10533break;
10534case 33:
10535\t{savesb("mode"); return(MODE);}
10536break;
10537case 34:
10538\t{savesb("modgrp"); return(MODGRP);}
10539break;
10540case 35:
10541\t{savesb("monthly"); return(MONTHLY);}
10542break;
10543case 36:
10544{savesb("midnight"); return(MIDNIGHT);}
10545break;
10546case 37:
10547\t{savesb("mtime"); return(MTIME);}
10548break;
10549case 38:
10550\t{savesb("no"); return(NOON);}
10551break;
10552case 39:
10553\t{savesb("or"); return(OR);}
10554break;
10555case 40:
10556\t{savesb("owner"); return(OWNER);}
10557break;
10558case 41:
10559\t{savesb("process"); return(PROCESSCLASS);}
10560break;
10561case 42:
10562{savesb("readspec"); return(READSPEC);}
10563break;
10564case 43:
10565{savesb("regyeast"); return(REGYEAST);}
10566break;
10567case 44:
10568\t{savesb("repeat"); return(REPEAT);}
10569break;
10570case 45:
10571\t{savesb("rmattr"); return(RMATTR);}
10572break;
10573case 46:
10574\t{savesb("rmobj"); return(RMOBJ);}
10575break;
10576case 47:
10577\t{savesb("rmspec"); return(RMSPEC);}
10578break;
10579case 48:
10580\t{savesb("size"); return(SIZE);}
10581break;
10582case 49:
10583\t{savesb("status"); return(STATUS);}
10584break;
10585case 50:
10586\t{savesb("stime"); return(STIME);}
10587break;
10588case 51:
10589{savesb("suspspec"); return(SUSPSPEC);}
10590break;
10591case 52:
10592\t{savesb("then"); return(THEN);}
10593break;
10594case 53:
10595{savesb("timestamp"); return(TIMESTAMP);}
10596break;
10597case 54:
10598\t{savesb("today"); return(TODAY);}
10599break;
10600case 55:
10601{savesb("tomorrow"); return(TOMORROW);}
10602break;
10603case 56:
10604\t{savesb("true"); return(TRUE);}
10605break;
10606case 57:
10607\t{savesb("tty"); return(TTYCLASS);}
10608break;
10609case 58:
10610{savesb("unchanged"); return(UNCHANGED);}
10611break;
10612case 59:
10613\t{savesb("until"); return(UNTIL);}
10614break;
10615case 60:
10616\t{savesb("up"); return(UP);}
10617break;
10618case 61:
10619\t{savesb("user"); return(USERCLASS);}
10620break;
10621case 62:
10622\t{savesb("users"); return(USERS);}
10623break;
10624case 63:
10625\t{savesb("utime"); return(UTIME);}
10626break;
10627case 64:
10628\t{savesb("week"); return(WEEK);}
10629break;
10630case 65:
10631\t{savesb("weekly"); return(WEEKLY);}
10632break;
10633case 66:
10634\t{savesb("within"); return(WITHIN);}
10635break;
10636case 67:
10637\t{savesb("yearly"); return(YEARLY);}
10638break;
10639case 68:
10640  \t\treturn(NEWLINE);
10641break;
10642case 69:
10643\treturn (ASSIGN);
10644break;
10645case 70:
10646\treturn (COMMA);
10647break;
10648case 71:
10649\treturn (EQ);
10650break;
10651case 72:
10652\treturn (GE);
10653break;
10654case 73:
10655\treturn (GT);
10656break;
10657case 74:
10658\treturn (LE);
10659break;
10660case 75:
10661\treturn (LPAREN);
10662break;
10663case 76:
10664\treturn (LT);
10665break;
10666case 77:
10667\treturn (NE);
10668break;
10669case 78:
10670\treturn (RPAREN);
10671break;
10672case 79:
10673\treturn (PERCENT);
10674break;
10675case 80:
10676\treturn (LCURLY);
10677break;
10678case 81:
10679\treturn (RCURLY);
10680break;
10681case 82:
10682{savesb(yytext); return(HEX);}
10683break;
10684case 83:
10685\t{savesb(yytext); return(OCTAL);}
10686break;
10687case 84:
10688\t{savesb(yytext); return(INTEGER);}
10689break;
10690case 85:
10691{savesb(yytext); return(INTRANGE);}
10692break;
10693case 86:
10694{savesb(yytext); return(REAL);}
10695break;
10696case 87:
10697 { savesb(yytext); return(HOURSPEC); }
10698break;
10699case 88:
10700{ savesb(yytext); return(HOURMINSPEC); }
10701break;
10702case 89:
10703{ savesb(yytext); return(HOURMINSPEC); }
10704break;
10705case 90:
10706{
10707\t\tif((yylval.sb =  malloc (yyleng+1)) != NULL)
10708\t\t    strcpy(yylval.sb,yytext);
10709\t\treturn(GROUPLABEL);
10710\t    }
10711break;
10712case 91:
10713{
10714\t\tif((yylval.sb =  malloc (yyleng+1)) != NULL) {
10715\t\t    yytext[yyleng-1] = \'\\0\';
10716\t\t    strcpy(yylval.sb,yytext);
10717\t      }
10718\t\treturn(EVENTLABEL);
10719\t    }
10720break;
10721case 92:
10722{\t\t\t\t
10723\t\tif((yylval.sb =  malloc (yyleng+1)) != NULL)
10724\t\t    strcpy(yylval.sb,yytext);
10725\t\treturn(BLANKFREESTRING);
10726\t    }
10727break;
10728case 93:
10729{                       /* Quoted String Checker */
10730             if(yytext[yyleng-1] == \'\\\\\')
10731                yymore() ;
10732             else {
10733               c = input() ;
10734               if (c == \'\\n\') {
10735                  unput(c) ;
10736                  errmsg("String constant flows over line
10737 ") ;
10738                  yytext[yyleng] = \'\\0\' ;
10739                  return(QUOTEDSTRING) ;
10740               }
10741               else {
10742                  yytext[yyleng++] = \'"\' ;
10743                  yytext[yyleng] = \'\\0\' ;
10744                  FixString(yytext) ;
10745                  if((yylval.sb = malloc (yyleng+1)) != NULL)
10746                     strcpy(yylval.sb,yytext) ;
10747                  return(QUOTEDSTRING) ;
10748               }
10749             }
10750            }
10751break;
10752case 94:
10753\t    {
10754\t        errmsg("unknown character in input
10755") ;
10756\t    }
10757break;
10758case -1:
10759break;
10760default:
10761fprintf(yyout,"bad switch yylook %d",nstr);
10762} return(0); }
10763/* end of yylex */
10764
10765/*
10766 * ====================================================================
10767 * savesb - saves string value of token
10768 * ====================================================================
10769 */
10770
10771void
10772savesb __PARAM__((char* sb), (sb)) __OTORP__(char* sb;)
10773#line 402
10774{
10775    if((yylval.sb = (char *)malloc(strlen(sb)+1)) != NULL)
10776\tstrcpy(yylval.sb,sb) ;
10777}
10778
10779/****
10780 * Routine FixString to delete the double quotes in the string
10781 ****/
10782void
10783FixString __PARAM__((char yytext[]), (yytext)) __OTORP__(char yytext[];)
10784#line 412
10785{
10786 int i;
10787
10788 for (i=1 ; i < yyleng -1 ; i++)
10789     yytext[i-1] = yytext[i] ;
10790 yytext[i-1] = \'\\0\' ;
10791}
10792
10793/*
10794 * ====================================================================
10795 * errmsg - Error routine for lex
10796 * ====================================================================
10797 */
10798void
10799errmsg __PARAM__((char* sb), (sb)) __OTORP__(char* sb;)
10800#line 427
10801{
10802    sfprintf(sbMsg, "lexical error: %s", sb);
10803    fParseFailed = 1;
10804}
10805
10806char
10807input __PARAM__((void), ())
10808#line 434
10809{
10810    register c;
10811    extern __MANGLE__ char *lexprog;
10812
10813    if (yysptr > yysbuf)
10814\tc = U(*--yysptr);
10815    else
10816\tc = *lexprog++;
10817    return(c);
10818}
10819int yyvstop[] = {
108200,
10821
1082292,
1082394,
108240,
10825
108261,
1082792,
1082894,
108290,
10830
1083168,
108320,
10833
108341,
1083594,
108360,
10837
1083892,
1083994,
108400,
10841
1084292,
1084393,
1084494,
108450,
10846
1084779,
1084892,
1084994,
108500,
10851
1085275,
1085394,
108540,
10855
1085678,
1085792,
1085894,
108590,
10860
1086192,
1086294,
108630,
10864
1086570,
1086694,
108670,
10868
1086992,
1087094,
108710,
10872
1087383,
1087484,
1087592,
1087694,
108770,
10878
1087984,
1088092,
1088194,
108820,
10883
1088484,
1088592,
1088694,
108870,
10888
1088976,
1089092,
1089194,
108920,
10893
1089469,
1089592,
1089694,
108970,
10898
1089973,
1090092,
1090194,
109020,
10903
1090494,
109050,
10906
1090792,
1090894,
109090,
10910
1091192,
1091294,
109130,
10914
1091592,
1091694,
109170,
10918
1091992,
1092094,
109210,
10922
1092392,
1092494,
109250,
10926
1092792,
1092894,
109290,
10930
1093192,
1093294,
109330,
10934
1093592,
1093694,
109370,
10938
1093992,
1094094,
109410,
10942
1094392,
1094494,
109450,
10946
1094792,
1094894,
109490,
10950
1095192,
1095294,
109530,
10954
1095592,
1095694,
109570,
10958
1095992,
1096094,
109610,
10962
1096392,
1096494,
109650,
10966
1096792,
1096894,
109690,
10970
1097192,
1097294,
109730,
10974
1097592,
1097694,
109770,
10978
1097992,
1098094,
109810,
10982
1098380,
1098492,
1098594,
109860,
10987
1098881,
1098992,
1099094,
109910,
10992
1099392,
109940,
10995
1099691,
1099792,
109980,
10999
1100077,
1100192,
110020,
11003
1100492,
1100593,
110060,
11007
1100893,
110090,
11010
1101191,
1101292,
1101393,
110140,
11015
1101690,
1101792,
110180,
11019
1102090,
1102192,
110220,
11023
1102490,
1102591,
1102692,
110270,
11028
1102986,
1103092,
110310,
11032
1103392,
110340,
11035
1103692,
110370,
11038
1103983,
1104084,
1104192,
110420,
11043
1104484,
1104592,
110460,
11047
1104891,
1104992,
110500,
11051
1105287,
1105392,
110540,
11055
1105692,
110570,
11058
1105992,
110600,
11061
1106274,
1106392,
110640,
11065
1106671,
1106792,
110680,
11069
1107072,
1107192,
110720,
11073
1107492,
110750,
11076
1107792,
110780,
11079
110806,
1108192,
110820,
11083
1108492,
110850,
11086
1108792,
110880,
11089
1109011,
1109192,
110920,
11093
1109492,
110950,
11096
1109792,
110980,
11099
1110092,
111010,
11102
1110392,
111040,
11105
1110692,
111070,
11108
1110992,
111100,
11111
1111219,
1111392,
111140,
11115
1111692,
111170,
11118
1111992,
111200,
11121
1112292,
111230,
11124
1112592,
111260,
11127
1112892,
111290,
11130
1113128,
1113292,
111330,
11134
1113592,
111360,
11137
1113892,
111390,
11140
1114192,
111420,
11143
1114492,
111450,
11146
1114792,
111480,
11149
1115092,
111510,
11152
1115339,
1115492,
111550,
11156
1115792,
111580,
11159
1116092,
111610,
11162
1116392,
111640,
11165
1116692,
111670,
11168
1116992,
111700,
11171
1117292,
111730,
11174
1117592,
111760,
11177
1117892,
111790,
11180
1118192,
111820,
11183
1118492,
111850,
11186
1118792,
111880,
11189
1119092,
111910,
11192
1119392,
111940,
11195
1119660,
1119792,
111980,
11199
1120092,
112010,
11202
1120392,
112040,
11205
1120692,
112070,
11208
1120992,
112100,
11211
1121292,
112130,
11214
1121585,
1121692,
112170,
11218
1121988,
1122092,
112210,
11222
1122387,
1122492,
112250,
11226
1122782,
1122892,
112290,
11230
1123192,
112320,
11233
1123492,
112350,
11236
112374,
1123892,
112390,
11240
1124192,
112420,
11243
1124492,
112450,
11246
1124792,
112480,
11249
1125092,
112510,
11252
1125392,
112540,
11255
1125692,
112570,
11258
1125992,
112600,
11261
1126292,
112630,
11264
1126592,
112660,
11267
1126818,
1126992,
112700,
11271
1127292,
112730,
11274
1127592,
112760,
11277
1127892,
112790,
11280
1128192,
112820,
11283
1128492,
112850,
11286
1128792,
112880,
11289
1129092,
112910,
11292
1129392,
112940,
11295
1129692,
112970,
11298
1129992,
113000,
11301
1130292,
113030,
11304
1130592,
113060,
11307
1130892,
113090,
11310
1131192,
113120,
11313
1131492,
113150,
11316
1131792,
113180,
11319
1132092,
113210,
11322
1132392,
113240,
11325
1132692,
113270,
11328
1132992,
113300,
11331
1133292,
113330,
11334
1133592,
113360,
11337
1133892,
113390,
11340
1134192,
113420,
11343
1134492,
113450,
11346
1134792,
113480,
11349
1135092,
113510,
11352
1135392,
113540,
11355
1135692,
113570,
11358
1135992,
113600,
11361
1136292,
113630,
11364
1136592,
113660,
11367
1136857,
1136992,
113700,
11371
1137292,
113730,
11374
1137592,
113760,
11377
1137892,
113790,
11380
1138192,
113820,
11383
1138492,
113850,
11386
1138792,
113880,
11389
1139092,
113910,
11392
1139389,
1139492,
113950,
11396
1139792,
113980,
11399
1140092,
114010,
11402
1140392,
114040,
11405
1140692,
114070,
11408
1140992,
114100,
11411
1141292,
114130,
11414
1141592,
114160,
11417
1141892,
114190,
11420
1142192,
114220,
11423
1142492,
114250,
11426
1142792,
114280,
11429
1143092,
114310,
11432
1143392,
114340,
11435
1143692,
114370,
11438
1143992,
114400,
11441
1144292,
114430,
11444
1144592,
114460,
11447
1144825,
1144992,
114500,
11451
1145227,
1145392,
114540,
11455
1145629,
1145792,
114580,
11459
1146092,
114610,
11462
1146392,
114640,
11465
1146692,
114670,
11468
1146992,
114700,
11471
1147233,
1147392,
114740,
11475
1147692,
114770,
11478
1147992,
114800,
11481
1148292,
114830,
11484
1148538,
1148692,
114870,
11488
1148992,
114900,
11491
1149292,
114930,
11494
1149592,
114960,
11497
1149892,
114990,
11500
1150192,
115020,
11503
1150492,
115050,
11506
1150792,
115080,
11509
1151092,
115110,
11512
1151348,
1151492,
115150,
11516
1151792,
115180,
11519
1152092,
115210,
11522
1152392,
115240,
11525
1152652,
1152792,
115280,
11529
1153092,
115310,
11532
1153392,
115340,
11535
1153692,
115370,
11538
1153956,
1154092,
115410,
11542
1154392,
115440,
11545
1154692,
115470,
11548
1154961,
1155092,
115510,
11552
1155392,
115540,
11555
1155664,
1155792,
115580,
11559
1156092,
115610,
11562
1156392,
115640,
11565
1156689,
1156792,
115680,
11569
1157092,
115710,
11572
1157392,
115740,
11575
1157692,
115770,
11578
115797,
1158092,
115810,
11582
1158392,
115840,
11585
1158692,
115870,
11588
1158992,
115900,
11591
1159292,
115930,
11594
1159592,
115960,
11597
1159814,
1159992,
116000,
11601
1160215,
1160392,
116040,
11605
1160692,
116070,
11608
1160992,
116100,
11611
1161292,
116130,
11614
1161592,
116160,
11617
1161822,
1161992,
116200,
11621
1162223,
1162392,
116240,
11625
1162692,
116270,
11628
1162992,
116300,
11631
1163292,
116330,
11634
1163592,
116360,
11637
1163892,
116390,
11640
1164192,
116420,
11643
1164492,
116450,
11646
1164792,
116480,
11649
1165037,
1165192,
116520,
11653
1165440,
1165592,
116560,
11657
1165892,
116590,
11660
1166192,
116620,
11663
1166492,
116650,
11666
1166792,
116680,
11669
1167092,
116710,
11672
1167346,
1167492,
116750,
11676
1167792,
116780,
11679
1168092,
116810,
11682
1168350,
1168492,
116850,
11686
1168792,
116880,
11689
1169092,
116910,
11692
1169354,
1169492,
116950,
11696
1169792,
116980,
11699
1170092,
117010,
11702
1170359,
1170492,
117050,
11706
1170762,
1170892,
117090,
11710
1171163,
1171292,
117130,
11714
1171592,
117160,
11717
1171892,
117190,
11720
1172192,
117220,
11723
117242,
1172592,
117260,
11727
1172892,
117290,
11730
1173192,
117320,
11733
1173492,
117350,
11736
1173792,
117380,
11739
1174092,
117410,
11742
1174392,
117440,
11745
1174692,
117470,
11748
1174992,
117500,
11751
1175217,
1175392,
117540,
11755
1175692,
117570,
11758
1175921,
1176092,
117610,
11762
1176324,
1176492,
117650,
11766
1176792,
117680,
11769
1177092,
117710,
11772
1177392,
117740,
11775
1177632,
1177792,
117780,
11779
1178092,
117810,
11782
1178334,
1178492,
117850,
11786
1178792,
117880,
11789
1179092,
117910,
11792
1179392,
117940,
11795
1179692,
117970,
11798
1179944,
1180092,
118010,
11802
1180345,
1180492,
118050,
11806
1180747,
1180892,
118090,
11810
1181149,
1181292,
118130,
11814
1181592,
118160,
11817
1181892,
118190,
11820
1182192,
118220,
11823
1182492,
118250,
11826
1182765,
1182892,
118290,
11830
1183166,
1183292,
118330,
11834
1183567,
1183692,
118370,
11838
118393,
1184092,
118410,
11842
1184392,
118440,
11845
1184692,
118470,
11848
118499,
1185092,
118510,
11852
1185310,
1185492,
118550,
11856
1185792,
118580,
11859
1186013,
1186192,
118620,
11863
1186416,
1186592,
118660,
11867
1186892,
118690,
11870
1187126,
1187292,
118730,
11874
1187592,
118760,
11877
1187892,
118790,
11880
1188192,
118820,
11883
1188435,
1188592,
118860,
11887
1188841,
1188992,
118900,
11891
1189292,
118930,
11894
1189592,
118960,
11897
1189892,
118990,
11900
1190192,
119020,
11903
1190492,
119050,
11906
1190792,
119080,
11909
119105,
1191192,
119120,
11913
119148,
1191592,
119160,
11917
1191812,
1191992,
119200,
11921
1192292,
119230,
11924
1192530,
1192692,
119270,
11928
1192931,
1193092,
119310,
11932
1193336,
1193492,
119350,
11936
1193742,
1193892,
119390,
11940
1194143,
1194292,
119430,
11944
1194551,
1194692,
119470,
11948
1194992,
119500,
11951
1195255,
1195392,
119540,
11955
1195692,
119570,
11958
1195920,
1196092,
119610,
11962
1196353,
1196492,
119650,
11966
1196758,
1196892,
119690,
119700};
11971# define YYTYPE int
11972struct yywork { YYTYPE verify, advance; } yycrank[] = {
119730,0,\t0,0,\t1,3,\t0,0,\t
119740,0,\t0,0,\t0,0,\t0,0,\t
119750,0,\t0,0,\t1,4,\t1,5,\t
119760,0,\t0,0,\t0,0,\t0,0,\t
1197746,0,\t48,0,\t0,0,\t0,0,\t
119780,0,\t0,0,\t0,0,\t0,0,\t
119790,0,\t0,0,\t0,0,\t0,0,\t
119800,0,\t0,0,\t0,0,\t0,0,\t
119810,0,\t1,6,\t1,7,\t1,8,\t
119820,0,\t0,0,\t1,9,\t0,0,\t
119830,0,\t1,10,\t1,11,\t0,0,\t
119841,12,\t1,13,\t0,0,\t1,14,\t
119850,0,\t1,15,\t1,16,\t1,16,\t
119861,17,\t1,16,\t1,16,\t1,16,\t
119871,16,\t1,16,\t0,0,\t0,0,\t
119884,0,\t1,18,\t1,19,\t1,20,\t
1198946,48,\t48,48,\t1,3,\t1,3,\t
119900,0,\t0,0,\t0,0,\t0,0,\t
119910,0,\t0,0,\t0,0,\t0,0,\t
119920,0,\t0,0,\t1,3,\t0,0,\t
119930,0,\t1,3,\t4,0,\t0,0,\t
119940,0,\t0,0,\t0,0,\t0,0,\t
119950,0,\t0,0,\t4,0,\t0,0,\t
119960,0,\t0,0,\t4,0,\t1,21,\t
119970,0,\t0,0,\t1,22,\t1,23,\t
119981,24,\t1,25,\t1,26,\t1,27,\t
119990,0,\t1,28,\t1,29,\t0,0,\t
120004,44,\t1,30,\t1,31,\t1,32,\t
120011,33,\t1,34,\t0,0,\t1,35,\t
120021,36,\t1,37,\t1,38,\t2,7,\t
120031,39,\t0,0,\t1,40,\t2,9,\t
120041,41,\t0,0,\t1,42,\t2,11,\t
120050,0,\t9,0,\t2,13,\t0,0,\t
120062,14,\t0,0,\t0,0,\t2,16,\t
120072,16,\t2,17,\t2,16,\t2,16,\t
120082,16,\t2,16,\t0,0,\t0,0,\t
120094,0,\t11,0,\t2,18,\t2,19,\t
120102,20,\t0,0,\t0,0,\t9,0,\t
120110,0,\t0,0,\t0,0,\t0,0,\t
120120,0,\t0,0,\t0,0,\t9,0,\t
120130,0,\t0,0,\t0,0,\t9,0,\t
120140,0,\t0,0,\t0,0,\t11,0,\t
120150,0,\t0,0,\t0,0,\t0,0,\t
120160,0,\t3,43,\t0,0,\t11,0,\t
120170,0,\t9,44,\t0,0,\t11,0,\t
120182,21,\t3,43,\t3,0,\t2,22,\t
120192,23,\t2,24,\t2,25,\t2,26,\t
120202,27,\t0,0,\t2,28,\t2,29,\t
120217,0,\t11,44,\t2,30,\t2,31,\t
120222,32,\t2,33,\t2,34,\t0,0,\t
120232,35,\t2,36,\t2,37,\t2,38,\t
120243,0,\t2,39,\t3,43,\t2,40,\t
120250,0,\t2,41,\t0,0,\t2,42,\t
120263,0,\t9,0,\t7,0,\t3,43,\t
120273,0,\t0,0,\t0,0,\t0,0,\t
120283,43,\t0,0,\t7,0,\t8,46,\t
120290,0,\t0,0,\t7,0,\t0,0,\t
120303,43,\t11,0,\t3,44,\t8,46,\t
120318,0,\t0,0,\t0,0,\t0,0,\t
120320,0,\t3,43,\t3,43,\t0,0,\t
120337,44,\t0,0,\t0,0,\t7,45,\t
120340,0,\t0,0,\t0,0,\t0,0,\t
120350,0,\t3,43,\t12,49,\t0,0,\t
120363,43,\t0,0,\t8,47,\t0,0,\t
120378,43,\t0,0,\t12,49,\t12,0,\t
1203814,0,\t0,0,\t8,47,\t0,0,\t
120390,0,\t8,46,\t3,0,\t0,0,\t
120400,0,\t0,0,\t8,46,\t0,0,\t
120410,0,\t0,0,\t0,0,\t0,0,\t
120427,0,\t0,0,\t8,46,\t0,0,\t
120438,48,\t12,0,\t14,0,\t12,49,\t
120440,0,\t0,0,\t0,0,\t8,46,\t
120458,46,\t12,0,\t14,0,\t18,0,\t
1204612,50,\t12,0,\t14,0,\t0,0,\t
120470,0,\t12,49,\t14,52,\t8,46,\t
1204815,0,\t0,0,\t8,46,\t0,0,\t
120490,0,\t12,49,\t14,52,\t12,51,\t
1205014,44,\t0,0,\t0,0,\t0,0,\t
120510,0,\t18,0,\t12,49,\t12,49,\t
120520,0,\t0,0,\t0,0,\t0,0,\t
120530,0,\t18,0,\t15,0,\t16,0,\t
120540,0,\t18,0,\t12,49,\t0,0,\t
120550,0,\t12,49,\t15,0,\t0,0,\t
1205619,0,\t0,0,\t15,0,\t15,53,\t
1205715,54,\t0,0,\t15,55,\t18,44,\t
120580,0,\t0,0,\t18,61,\t12,0,\t
1205914,0,\t16,0,\t15,56,\t0,0,\t
1206015,57,\t0,0,\t0,0,\t17,0,\t
120610,0,\t16,0,\t19,0,\t15,58,\t
120620,0,\t16,0,\t16,53,\t16,54,\t
1206320,0,\t16,56,\t19,0,\t0,0,\t
120640,0,\t0,0,\t19,0,\t0,0,\t
120650,0,\t16,56,\t15,58,\t16,57,\t
120660,0,\t17,0,\t0,0,\t18,0,\t
120670,0,\t0,0,\t16,58,\t22,0,\t
1206819,44,\t17,0,\t20,0,\t19,62,\t
1206915,0,\t17,0,\t17,53,\t17,54,\t
120700,0,\t17,56,\t20,0,\t0,0,\t
1207123,0,\t16,58,\t20,0,\t0,0,\t
120720,0,\t17,56,\t0,0,\t17,57,\t
120730,0,\t22,0,\t0,0,\t24,0,\t
120740,0,\t0,0,\t17,58,\t16,0,\t
1207520,44,\t22,0,\t15,59,\t20,63,\t
120760,0,\t22,0,\t23,0,\t0,0,\t
1207719,0,\t0,0,\t0,0,\t0,0,\t
120780,0,\t17,58,\t23,0,\t25,0,\t
1207926,0,\t24,0,\t23,0,\t22,44,\t
120800,0,\t0,0,\t0,0,\t0,0,\t
120810,0,\t24,0,\t0,0,\t17,0,\t
120820,0,\t24,0,\t0,0,\t0,0,\t
1208323,44,\t17,60,\t0,0,\t28,0,\t
1208420,0,\t25,0,\t26,0,\t0,0,\t
1208527,0,\t0,0,\t0,0,\t24,44,\t
120860,0,\t25,0,\t26,0,\t0,0,\t
120870,0,\t25,0,\t26,0,\t0,0,\t
120880,0,\t0,0,\t0,0,\t22,0,\t
120890,0,\t28,0,\t0,0,\t0,0,\t
120900,0,\t22,64,\t27,0,\t25,44,\t
1209126,44,\t28,0,\t0,0,\t0,0,\t
1209223,0,\t28,0,\t27,0,\t22,65,\t
120930,0,\t0,0,\t27,0,\t23,68,\t
120940,0,\t22,66,\t22,67,\t24,0,\t
120950,0,\t29,0,\t24,70,\t28,44,\t
120960,0,\t0,0,\t0,0,\t0,0,\t
1209727,44,\t24,71,\t0,0,\t30,0,\t
120980,0,\t0,0,\t0,0,\t23,69,\t
1209924,72,\t0,0,\t31,0,\t25,0,\t
1210026,0,\t0,0,\t25,73,\t29,0,\t
1210132,0,\t0,0,\t25,74,\t0,0,\t
121020,0,\t0,0,\t25,75,\t29,0,\t
121030,0,\t30,0,\t0,0,\t29,0,\t
1210425,76,\t0,0,\t0,0,\t28,0,\t
1210531,0,\t30,0,\t26,77,\t33,0,\t
1210627,0,\t30,0,\t32,0,\t27,78,\t
1210731,0,\t29,44,\t0,0,\t0,0,\t
1210831,0,\t27,79,\t32,0,\t27,80,\t
1210928,81,\t0,0,\t32,0,\t30,44,\t
121100,0,\t0,0,\t34,0,\t0,0,\t
121110,0,\t33,0,\t31,44,\t0,0,\t
121120,0,\t0,0,\t0,0,\t0,0,\t
1211332,44,\t33,0,\t0,0,\t36,0,\t
121140,0,\t33,0,\t0,0,\t0,0,\t
121150,0,\t35,0,\t0,0,\t0,0,\t
1211634,0,\t29,0,\t0,0,\t0,0,\t
121170,0,\t0,0,\t0,0,\t33,44,\t
1211834,0,\t0,0,\t0,0,\t30,0,\t
1211934,0,\t36,0,\t0,0,\t0,0,\t
1212037,0,\t29,82,\t31,0,\t35,0,\t
121210,0,\t36,0,\t40,0,\t0,0,\t
1212232,0,\t36,0,\t34,44,\t35,0,\t
1212330,83,\t31,85,\t0,0,\t35,0,\t
1212430,84,\t0,0,\t0,0,\t31,86,\t
121250,0,\t38,0,\t37,0,\t36,44,\t
1212631,87,\t32,88,\t0,0,\t33,0,\t
1212740,0,\t35,44,\t37,0,\t0,0,\t
121280,0,\t0,0,\t37,0,\t0,0,\t
1212940,0,\t0,0,\t0,0,\t0,0,\t
1213040,0,\t39,0,\t0,0,\t38,0,\t
121310,0,\t0,0,\t34,0,\t33,89,\t
1213237,44,\t0,0,\t0,0,\t38,0,\t
1213333,90,\t0,0,\t40,44,\t38,0,\t
121340,0,\t0,0,\t0,0,\t36,0,\t
121350,0,\t0,0,\t0,0,\t39,0,\t
121360,0,\t35,0,\t34,91,\t0,0,\t
121370,0,\t38,44,\t36,94,\t39,0,\t
1213835,92,\t0,0,\t0,0,\t39,0,\t
121390,0,\t0,0,\t0,0,\t0,0,\t
1214035,93,\t36,95,\t36,96,\t0,0,\t
1214137,0,\t41,0,\t42,0,\t0,0,\t
121420,0,\t39,44,\t40,0,\t0,0,\t
121430,0,\t0,0,\t37,97,\t37,98,\t
121440,0,\t40,108,\t0,0,\t0,0,\t
121450,0,\t37,99,\t0,0,\t0,0,\t
1214637,100,\t38,0,\t37,101,\t41,0,\t
1214742,0,\t43,0,\t0,0,\t0,0,\t
121480,0,\t0,0,\t0,0,\t41,0,\t
1214942,0,\t0,0,\t44,0,\t41,0,\t
1215042,0,\t38,102,\t0,0,\t38,103,\t
1215145,0,\t39,0,\t38,104,\t38,105,\t
121520,0,\t0,0,\t0,0,\t43,0,\t
1215339,106,\t41,44,\t42,44,\t0,0,\t
1215439,107,\t0,0,\t0,0,\t43,0,\t
1215544,0,\t0,0,\t47,47,\t43,0,\t
121560,0,\t0,0,\t45,0,\t0,0,\t
1215744,0,\t0,0,\t47,47,\t47,0,\t
1215844,0,\t0,0,\t45,0,\t0,0,\t
1215950,0,\t43,44,\t45,0,\t0,0,\t
121600,0,\t49,0,\t0,0,\t0,0,\t
121610,0,\t0,0,\t44,44,\t0,0,\t
121620,0,\t41,0,\t42,0,\t0,0,\t
1216345,44,\t47,47,\t0,0,\t47,0,\t
121640,0,\t0,0,\t50,0,\t0,0,\t
121650,0,\t47,47,\t0,0,\t49,0,\t
1216647,47,\t0,0,\t50,0,\t0,0,\t
121670,0,\t47,47,\t50,0,\t49,0,\t
121680,0,\t43,0,\t49,49,\t49,0,\t
121690,0,\t47,47,\t51,0,\t0,0,\t
121700,0,\t0,0,\t44,0,\t52,0,\t
1217150,51,\t0,0,\t47,47,\t47,47,\t
1217245,0,\t49,51,\t0,0,\t0,0,\t
121730,0,\t0,0,\t53,0,\t0,0,\t
121740,0,\t0,0,\t47,47,\t0,0,\t
1217551,0,\t47,47,\t0,0,\t0,0,\t
121760,0,\t52,0,\t0,0,\t0,0,\t
1217751,0,\t0,0,\t0,0,\t51,49,\t
1217851,0,\t52,0,\t0,0,\t54,0,\t
1217953,0,\t52,0,\t0,0,\t0,0,\t
1218050,0,\t52,52,\t55,0,\t0,0,\t
1218153,0,\t49,0,\t51,51,\t0,0,\t
1218253,0,\t52,52,\t0,0,\t52,44,\t
1218353,109,\t0,0,\t0,0,\t0,0,\t
121840,0,\t54,0,\t0,0,\t0,0,\t
1218553,109,\t0,0,\t53,44,\t0,0,\t
1218655,0,\t54,0,\t0,0,\t0,0,\t
121870,0,\t54,0,\t56,0,\t0,0,\t
1218855,0,\t54,52,\t0,0,\t0,0,\t
1218955,0,\t55,53,\t55,54,\t0,0,\t
1219055,55,\t54,52,\t51,0,\t54,44,\t
121910,0,\t0,0,\t0,0,\t52,0,\t
1219255,56,\t0,0,\t55,57,\t0,0,\t
1219356,0,\t57,0,\t0,0,\t0,0,\t
121940,0,\t55,58,\t53,0,\t58,0,\t
1219556,0,\t0,0,\t0,0,\t0,0,\t
1219656,0,\t56,53,\t56,54,\t0,0,\t
1219756,56,\t0,0,\t0,0,\t0,0,\t
1219855,58,\t0,0,\t59,0,\t57,0,\t
1219956,56,\t0,0,\t56,57,\t54,0,\t
122000,0,\t58,0,\t0,0,\t57,0,\t
122010,0,\t56,58,\t55,0,\t57,0,\t
122020,0,\t58,0,\t0,0,\t57,110,\t
122030,0,\t58,0,\t60,0,\t0,0,\t
1220459,0,\t61,0,\t0,0,\t57,110,\t
1220556,58,\t57,44,\t0,0,\t0,0,\t
1220659,0,\t0,0,\t0,0,\t58,44,\t
1220759,0,\t0,0,\t0,0,\t0,0,\t
1220859,112,\t0,0,\t56,0,\t0,0,\t
1220960,0,\t62,0,\t63,0,\t61,0,\t
1221059,112,\t0,0,\t59,44,\t0,0,\t
1221160,0,\t0,0,\t58,111,\t61,0,\t
1221260,0,\t59,112,\t59,112,\t61,0,\t
122130,0,\t0,0,\t64,0,\t0,0,\t
122140,0,\t57,0,\t0,0,\t62,0,\t
1221563,0,\t65,0,\t60,44,\t58,0,\t
122160,0,\t61,44,\t0,0,\t62,0,\t
1221763,0,\t0,0,\t66,0,\t62,0,\t
1221863,0,\t0,0,\t0,0,\t0,0,\t
1221964,0,\t0,0,\t59,0,\t0,0,\t
122200,0,\t0,0,\t0,0,\t65,0,\t
1222164,0,\t62,44,\t63,44,\t0,0,\t
1222264,0,\t67,0,\t0,0,\t65,0,\t
1222366,0,\t0,0,\t68,0,\t65,0,\t
122240,0,\t0,0,\t60,0,\t0,0,\t
1222566,0,\t61,0,\t64,44,\t0,0,\t
1222666,0,\t69,0,\t60,113,\t0,0,\t
122270,0,\t65,44,\t0,0,\t67,0,\t
122280,0,\t0,0,\t0,0,\t0,0,\t
1222968,0,\t0,0,\t66,44,\t67,0,\t
122300,0,\t62,0,\t63,0,\t67,0,\t
1223168,0,\t0,0,\t70,0,\t69,0,\t
1223268,0,\t0,0,\t0,0,\t0,0,\t
122330,0,\t71,0,\t0,0,\t69,0,\t
122340,0,\t67,44,\t64,0,\t69,0,\t
122350,0,\t0,0,\t68,44,\t0,0,\t
1223664,114,\t65,0,\t72,0,\t0,0,\t
1223770,0,\t73,0,\t0,0,\t65,115,\t
122380,0,\t69,44,\t66,0,\t71,0,\t
1223970,0,\t0,0,\t0,0,\t0,0,\t
1224070,0,\t65,116,\t0,0,\t71,0,\t
122410,0,\t66,117,\t0,0,\t71,0,\t
1224272,0,\t0,0,\t0,0,\t73,0,\t
122430,0,\t67,0,\t70,44,\t0,0,\t
1224472,0,\t74,0,\t68,0,\t73,0,\t
1224572,0,\t71,44,\t0,0,\t73,0,\t
1224675,0,\t0,0,\t0,0,\t0,0,\t
122470,0,\t69,0,\t0,0,\t0,0,\t
122480,0,\t76,0,\t72,44,\t67,118,\t
122490,0,\t73,44,\t0,0,\t74,0,\t
1225068,119,\t0,0,\t0,0,\t0,0,\t
122510,0,\t0,0,\t75,0,\t74,0,\t
122520,0,\t77,0,\t70,0,\t74,0,\t
1225378,0,\t0,0,\t75,0,\t76,0,\t
122540,0,\t71,0,\t75,0,\t0,0,\t
1225571,121,\t0,0,\t0,0,\t76,0,\t
122560,0,\t74,44,\t0,0,\t76,0,\t
1225770,120,\t0,0,\t72,0,\t77,0,\t
1225875,44,\t73,0,\t78,0,\t0,0,\t
1225979,0,\t80,0,\t0,0,\t77,0,\t
122600,0,\t76,44,\t78,0,\t77,0,\t
1226173,123,\t0,0,\t78,0,\t0,0,\t
122620,0,\t0,0,\t0,0,\t0,0,\t
1226381,0,\t72,122,\t0,0,\t0,0,\t
122640,0,\t77,44,\t79,0,\t80,0,\t
1226578,44,\t74,0,\t0,0,\t0,0,\t
122660,0,\t82,0,\t79,0,\t80,0,\t
1226775,0,\t74,124,\t79,0,\t80,0,\t
122680,0,\t0,0,\t81,0,\t83,0,\t
122690,0,\t76,0,\t76,126,\t0,0,\t
122700,0,\t84,0,\t81,0,\t0,0,\t
1227179,44,\t80,44,\t81,0,\t82,0,\t
1227275,125,\t0,0,\t0,0,\t0,0,\t
1227385,0,\t77,0,\t86,0,\t82,0,\t
1227478,0,\t83,0,\t0,0,\t82,0,\t
1227581,44,\t0,0,\t0,0,\t84,0,\t
1227677,127,\t83,0,\t0,0,\t0,0,\t
122770,0,\t83,0,\t78,128,\t84,0,\t
122780,0,\t82,44,\t85,0,\t84,0,\t
1227986,0,\t0,0,\t0,0,\t0,0,\t
1228079,0,\t80,0,\t85,0,\t83,44,\t
1228186,0,\t0,0,\t85,0,\t0,0,\t
1228286,0,\t84,44,\t0,0,\t0,0,\t
122830,0,\t87,0,\t0,0,\t80,130,\t
1228481,0,\t0,0,\t0,0,\t88,0,\t
1228585,44,\t79,129,\t86,44,\t0,0,\t
122860,0,\t0,0,\t0,0,\t0,0,\t
122870,0,\t82,0,\t0,0,\t0,0,\t
122880,0,\t0,0,\t0,0,\t87,0,\t
122890,0,\t81,131,\t89,0,\t83,0,\t
122900,0,\t88,0,\t83,132,\t87,0,\t
1229183,133,\t84,0,\t0,0,\t87,0,\t
1229283,134,\t88,0,\t0,0,\t90,0,\t
122930,0,\t88,0,\t91,0,\t0,0,\t
1229485,0,\t92,0,\t86,0,\t0,0,\t
1229589,0,\t87,44,\t85,136,\t0,0,\t
1229686,137,\t0,0,\t84,135,\t88,44,\t
1229789,0,\t0,0,\t93,0,\t0,0,\t
1229889,0,\t90,0,\t86,138,\t0,0,\t
1229991,0,\t0,0,\t0,0,\t92,0,\t
123000,0,\t90,0,\t0,0,\t0,0,\t
1230191,0,\t90,0,\t89,44,\t92,0,\t
1230291,0,\t94,0,\t0,0,\t92,0,\t
1230393,0,\t0,0,\t95,0,\t96,0,\t
123040,0,\t87,0,\t0,0,\t90,44,\t
1230593,0,\t0,0,\t91,44,\t88,0,\t
1230693,0,\t92,44,\t0,0,\t0,0,\t
1230787,139,\t0,0,\t0,0,\t94,0,\t
123080,0,\t0,0,\t0,0,\t0,0,\t
1230995,0,\t96,0,\t93,44,\t94,0,\t
1231088,140,\t0,0,\t89,0,\t94,0,\t
1231195,0,\t96,0,\t97,0,\t0,0,\t
1231295,0,\t96,0,\t0,0,\t0,0,\t
123130,0,\t0,0,\t0,0,\t90,0,\t
1231498,0,\t94,44,\t91,0,\t0,0,\t
123150,0,\t92,0,\t95,44,\t96,44,\t
1231692,143,\t0,0,\t99,0,\t0,0,\t
1231797,0,\t0,0,\t92,144,\t90,141,\t
123180,0,\t0,0,\t93,0,\t91,142,\t
1231997,0,\t93,146,\t98,0,\t92,145,\t
1232097,0,\t0,0,\t0,0,\t100,0,\t
123210,0,\t101,0,\t98,0,\t0,0,\t
1232299,0,\t0,0,\t98,0,\t93,147,\t
123230,0,\t94,0,\t97,44,\t93,148,\t
1232499,0,\t0,0,\t95,0,\t96,0,\t
1232599,0,\t95,150,\t0,0,\t0,0,\t
1232698,44,\t100,0,\t0,0,\t101,0,\t
123270,0,\t95,151,\t0,0,\t0,0,\t
123280,0,\t100,0,\t99,44,\t101,0,\t
123290,0,\t100,0,\t0,0,\t101,0,\t
1233096,152,\t94,149,\t0,0,\t102,0,\t
12331103,0,\t0,0,\t0,0,\t0,0,\t
123320,0,\t104,0,\t97,0,\t100,44,\t
123330,0,\t101,44,\t0,0,\t0,0,\t
123340,0,\t97,153,\t0,0,\t0,0,\t
1233598,0,\t0,0,\t0,0,\t0,0,\t
12336105,0,\t102,0,\t103,0,\t0,0,\t
123370,0,\t0,0,\t99,0,\t104,0,\t
123380,0,\t102,0,\t103,0,\t98,154,\t
1233999,155,\t102,0,\t103,0,\t104,0,\t
123400,0,\t106,0,\t0,0,\t104,0,\t
123410,0,\t99,156,\t105,0,\t100,0,\t
123420,0,\t101,0,\t0,0,\t102,44,\t
12343103,44,\t0,0,\t105,0,\t0,0,\t
12344107,0,\t104,44,\t105,0,\t0,0,\t
123450,0,\t0,0,\t0,0,\t106,0,\t
123460,0,\t0,0,\t0,0,\t0,0,\t
123470,0,\t108,0,\t100,157,\t106,0,\t
12348105,44,\t0,0,\t0,0,\t106,0,\t
12349101,158,\t0,0,\t107,0,\t0,0,\t
12350109,0,\t0,0,\t0,0,\t0,0,\t
123510,0,\t0,0,\t107,0,\t102,0,\t
12352103,0,\t106,44,\t107,0,\t108,0,\t
12353102,159,\t104,0,\t0,0,\t0,0,\t
123540,0,\t0,0,\t0,0,\t108,0,\t
12355104,161,\t0,0,\t109,0,\t108,0,\t
12356107,44,\t0,0,\t0,0,\t0,0,\t
12357105,0,\t102,160,\t109,0,\t110,0,\t
12358111,0,\t0,0,\t109,0,\t0,0,\t
123590,0,\t108,44,\t109,109,\t105,162,\t
123600,0,\t113,0,\t0,0,\t0,0,\t
123610,0,\t106,0,\t109,109,\t0,0,\t
12362109,44,\t0,0,\t0,0,\t0,0,\t
12363106,163,\t110,0,\t111,0,\t0,0,\t
123640,0,\t0,0,\t0,0,\t0,0,\t
12365107,0,\t110,0,\t111,0,\t113,0,\t
123660,0,\t110,0,\t111,0,\t0,0,\t
123670,0,\t110,110,\t0,0,\t113,0,\t
12368112,0,\t108,0,\t114,0,\t113,0,\t
12369108,165,\t110,110,\t0,0,\t110,44,\t
12370111,44,\t0,0,\t107,164,\t115,0,\t
12371109,0,\t0,0,\t110,166,\t0,0,\t
123720,0,\t113,44,\t0,0,\t0,0,\t
123730,0,\t0,0,\t112,0,\t0,0,\t
12374114,0,\t0,0,\t0,0,\t116,0,\t
123750,0,\t110,166,\t112,0,\t0,0,\t
12376114,0,\t115,0,\t112,0,\t0,0,\t
12377114,0,\t0,0,\t112,112,\t0,0,\t
12378117,0,\t115,0,\t0,0,\t110,0,\t
12379111,0,\t115,0,\t112,112,\t0,0,\t
12380112,44,\t116,0,\t114,44,\t118,0,\t
123810,0,\t113,0,\t0,0,\t112,112,\t
12382112,112,\t116,0,\t0,0,\t115,44,\t
12383119,0,\t116,0,\t117,0,\t0,0,\t
12384113,167,\t0,0,\t0,0,\t120,0,\t
123850,0,\t0,0,\t117,0,\t0,0,\t
123860,0,\t118,0,\t117,0,\t116,44,\t
123870,0,\t0,0,\t0,0,\t0,0,\t
123880,0,\t118,0,\t119,0,\t121,0,\t
12389112,0,\t118,0,\t114,0,\t0,0,\t
12390117,44,\t120,0,\t119,0,\t0,0,\t
12391122,0,\t0,0,\t119,0,\t115,0,\t
123920,0,\t120,0,\t0,0,\t118,44,\t
123930,0,\t120,0,\t0,0,\t0,0,\t
123940,0,\t121,0,\t0,0,\t114,168,\t
12395119,44,\t0,0,\t0,0,\t116,0,\t
12396123,0,\t121,0,\t122,0,\t120,44,\t
123970,0,\t121,0,\t0,0,\t0,0,\t
123980,0,\t0,0,\t122,0,\t0,0,\t
12399117,0,\t124,0,\t122,0,\t125,0,\t
12400116,169,\t0,0,\t0,0,\t121,44,\t
124010,0,\t0,0,\t123,0,\t118,0,\t
12402126,0,\t0,0,\t0,0,\t117,170,\t
12403122,44,\t0,0,\t123,0,\t0,0,\t
12404119,0,\t118,171,\t123,0,\t124,0,\t
124050,0,\t125,0,\t0,0,\t120,0,\t
124060,0,\t0,0,\t120,173,\t124,0,\t
124070,0,\t125,0,\t126,0,\t124,0,\t
12408123,44,\t125,0,\t0,0,\t0,0,\t
124090,0,\t127,0,\t126,0,\t121,0,\t
12410128,0,\t119,172,\t126,0,\t0,0,\t
124110,0,\t124,44,\t0,0,\t125,44,\t
12412122,0,\t0,0,\t0,0,\t0,0,\t
124130,0,\t0,0,\t0,0,\t121,174,\t
12414126,44,\t129,0,\t0,0,\t127,0,\t
124150,0,\t0,0,\t128,0,\t0,0,\t
12416122,175,\t0,0,\t0,0,\t127,0,\t
12417123,0,\t0,0,\t128,0,\t127,0,\t
12418130,0,\t0,0,\t128,0,\t0,0,\t
124190,0,\t131,0,\t0,0,\t129,0,\t
124200,0,\t124,0,\t123,176,\t125,0,\t
12421124,177,\t127,44,\t0,0,\t129,0,\t
12422128,44,\t0,0,\t0,0,\t129,0,\t
12423126,0,\t0,0,\t130,0,\t0,0,\t
12424132,0,\t0,0,\t124,178,\t131,0,\t
124250,0,\t133,0,\t130,0,\t0,0,\t
124260,0,\t129,44,\t130,0,\t131,0,\t
12427126,179,\t0,0,\t0,0,\t131,0,\t
12428126,180,\t0,0,\t0,0,\t0,0,\t
12429134,0,\t135,0,\t132,0,\t0,0,\t
12430130,44,\t127,0,\t0,0,\t133,0,\t
12431128,0,\t131,44,\t132,0,\t0,0,\t
124320,0,\t0,0,\t132,0,\t133,0,\t
124330,0,\t0,0,\t0,0,\t133,0,\t
12434127,181,\t0,0,\t134,0,\t135,0,\t
124350,0,\t129,0,\t0,0,\t0,0,\t
12436132,44,\t128,182,\t134,0,\t135,0,\t
12437136,0,\t133,44,\t134,0,\t135,0,\t
124380,0,\t0,0,\t0,0,\t0,0,\t
12439130,0,\t138,0,\t0,0,\t129,183,\t
124400,0,\t131,0,\t0,0,\t130,184,\t
12441134,44,\t135,44,\t0,0,\t0,0,\t
12442137,0,\t0,0,\t136,0,\t0,0,\t
124430,0,\t139,0,\t0,0,\t0,0,\t
124440,0,\t0,0,\t136,0,\t138,0,\t
12445132,0,\t0,0,\t136,0,\t131,185,\t
124460,0,\t133,0,\t132,186,\t138,0,\t
12447133,187,\t0,0,\t137,0,\t138,0,\t
12448140,0,\t0,0,\t0,0,\t139,0,\t
12449136,44,\t0,0,\t137,0,\t0,0,\t
12450134,0,\t135,0,\t137,0,\t139,0,\t
124510,0,\t138,44,\t0,0,\t139,0,\t
124520,0,\t134,188,\t0,0,\t0,0,\t
12453141,0,\t0,0,\t140,0,\t0,0,\t
12454137,44,\t142,0,\t0,0,\t135,189,\t
124550,0,\t139,44,\t140,0,\t0,0,\t
124560,0,\t0,0,\t140,0,\t0,0,\t
124570,0,\t0,0,\t0,0,\t0,0,\t
12458136,0,\t0,0,\t141,0,\t0,0,\t
12459143,0,\t0,0,\t0,0,\t142,0,\t
12460140,44,\t138,0,\t141,0,\t0,0,\t
124610,0,\t144,0,\t141,0,\t142,0,\t
12462136,190,\t0,0,\t0,0,\t142,0,\t
12463137,0,\t0,0,\t0,0,\t0,0,\t
12464145,0,\t139,0,\t143,0,\t137,191,\t
12465141,44,\t137,192,\t0,0,\t138,193,\t
124660,0,\t142,44,\t143,0,\t144,0,\t
124670,0,\t0,0,\t143,0,\t0,0,\t
12468139,194,\t0,0,\t0,0,\t144,0,\t
12469140,0,\t146,0,\t145,0,\t144,0,\t
12470147,0,\t0,0,\t0,0,\t148,0,\t
12471143,44,\t0,0,\t145,0,\t0,0,\t
124720,0,\t0,0,\t145,0,\t0,0,\t
12473140,195,\t144,44,\t0,0,\t0,0,\t
12474141,0,\t0,0,\t0,0,\t146,0,\t
12475149,0,\t142,0,\t147,0,\t141,196,\t
12476145,44,\t148,0,\t142,197,\t146,0,\t
124770,0,\t0,0,\t147,0,\t146,0,\t
124780,0,\t148,0,\t147,0,\t150,0,\t
124790,0,\t148,0,\t0,0,\t0,0,\t
12480143,0,\t151,0,\t149,0,\t0,0,\t
12481152,0,\t146,44,\t143,198,\t0,0,\t
12482147,44,\t144,0,\t149,0,\t148,44,\t
124830,0,\t0,0,\t149,0,\t0,0,\t
124840,0,\t150,0,\t0,0,\t0,0,\t
12485145,0,\t0,0,\t0,0,\t151,0,\t
12486153,0,\t150,0,\t152,0,\t145,200,\t
12487149,44,\t150,0,\t0,0,\t151,0,\t
124880,0,\t0,0,\t152,0,\t151,0,\t
12489144,199,\t0,0,\t152,0,\t154,0,\t
124900,0,\t146,0,\t0,0,\t150,44,\t
12491147,0,\t0,0,\t153,0,\t148,0,\t
12492147,202,\t151,44,\t0,0,\t0,0,\t
12493152,44,\t0,0,\t153,0,\t0,0,\t
12494155,0,\t0,0,\t153,0,\t0,0,\t
124950,0,\t154,0,\t156,0,\t146,201,\t
12496149,0,\t148,203,\t0,0,\t0,0,\t
124970,0,\t154,0,\t0,0,\t149,204,\t
12498153,44,\t154,0,\t0,0,\t0,0,\t
124990,0,\t157,0,\t155,0,\t150,0,\t
125000,0,\t0,0,\t0,0,\t158,0,\t
12501156,0,\t151,0,\t155,0,\t154,44,\t
12502152,0,\t0,0,\t155,0,\t0,0,\t
12503156,0,\t0,0,\t0,0,\t0,0,\t
12504156,0,\t0,0,\t0,0,\t157,0,\t
12505151,206,\t150,205,\t0,0,\t0,0,\t
12506155,44,\t158,0,\t152,207,\t157,0,\t
12507153,0,\t0,0,\t156,44,\t157,0,\t
125080,0,\t158,0,\t159,0,\t0,0,\t
125090,0,\t158,0,\t0,0,\t0,0,\t
125100,0,\t0,0,\t0,0,\t154,0,\t
12511153,208,\t157,44,\t0,0,\t0,0,\t
125120,0,\t0,0,\t154,209,\t158,44,\t
125130,0,\t0,0,\t0,0,\t160,0,\t
12514159,0,\t0,0,\t0,0,\t0,0,\t
12515155,0,\t0,0,\t161,0,\t155,210,\t
12516159,0,\t0,0,\t156,0,\t0,0,\t
12517159,0,\t0,0,\t0,0,\t162,0,\t
12518163,0,\t0,0,\t0,0,\t0,0,\t
125190,0,\t160,0,\t164,0,\t0,0,\t
125200,0,\t157,0,\t159,44,\t156,211,\t
12521161,0,\t160,0,\t0,0,\t158,0,\t
12522157,212,\t160,0,\t0,0,\t0,0,\t
12523161,0,\t162,0,\t163,0,\t165,0,\t
12524161,0,\t0,0,\t0,0,\t0,0,\t
12525164,0,\t162,0,\t163,0,\t160,44,\t
125260,0,\t162,0,\t163,0,\t0,0,\t
12527164,0,\t0,0,\t161,44,\t166,0,\t
12528164,0,\t0,0,\t0,0,\t0,0,\t
125290,0,\t165,0,\t159,0,\t162,44,\t
12530163,44,\t0,0,\t0,0,\t0,0,\t
125310,0,\t165,0,\t164,44,\t167,0,\t
12532159,213,\t165,0,\t0,0,\t0,0,\t
125330,0,\t166,0,\t0,0,\t0,0,\t
125340,0,\t0,0,\t0,0,\t160,0,\t
125350,0,\t166,0,\t0,0,\t165,44,\t
125360,0,\t166,0,\t161,0,\t0,0,\t
125370,0,\t167,0,\t160,214,\t0,0,\t
12538168,0,\t0,0,\t169,0,\t162,0,\t
12539163,0,\t167,0,\t0,0,\t166,44,\t
125400,0,\t167,0,\t164,0,\t0,0,\t
125410,0,\t0,0,\t161,215,\t170,0,\t
125420,0,\t163,217,\t162,216,\t0,0,\t
12543164,218,\t0,0,\t168,0,\t167,44,\t
12544169,0,\t0,0,\t166,220,\t165,0,\t
125450,0,\t0,0,\t168,0,\t171,0,\t
12546169,0,\t0,0,\t168,0,\t0,0,\t
12547169,0,\t170,0,\t0,0,\t0,0,\t
12548172,0,\t0,0,\t0,0,\t166,0,\t
125490,0,\t170,0,\t173,0,\t165,219,\t
12550168,44,\t170,0,\t169,44,\t0,0,\t
125510,0,\t171,0,\t0,0,\t174,0,\t
125520,0,\t0,0,\t0,0,\t167,0,\t
125530,0,\t171,0,\t172,0,\t170,44,\t
125540,0,\t171,0,\t0,0,\t0,0,\t
12555173,0,\t0,0,\t172,0,\t175,0,\t
125560,0,\t167,221,\t172,0,\t0,0,\t
12557173,0,\t174,0,\t176,0,\t171,44,\t
12558173,0,\t0,0,\t0,0,\t0,0,\t
12559168,0,\t174,0,\t169,0,\t0,0,\t
12560172,44,\t174,0,\t0,0,\t0,0,\t
125610,0,\t175,0,\t173,44,\t177,0,\t
125620,0,\t0,0,\t0,0,\t170,0,\t
12563176,0,\t175,0,\t168,222,\t174,44,\t
125640,0,\t175,0,\t170,224,\t0,0,\t
12565176,0,\t169,223,\t0,0,\t178,0,\t
12566176,0,\t0,0,\t0,0,\t171,0,\t
12567179,0,\t177,0,\t171,225,\t175,44,\t
125680,0,\t0,0,\t180,0,\t0,0,\t
12569172,0,\t177,0,\t176,44,\t181,0,\t
125700,0,\t177,0,\t173,0,\t172,227,\t
12571171,226,\t178,0,\t0,0,\t173,228,\t
125720,0,\t0,0,\t179,0,\t174,0,\t
125730,0,\t178,0,\t0,0,\t177,44,\t
12574180,0,\t178,0,\t179,0,\t0,0,\t
12575174,229,\t181,0,\t179,0,\t0,0,\t
12576180,0,\t0,0,\t182,0,\t175,0,\t
12577180,0,\t181,0,\t0,0,\t178,44,\t
12578183,0,\t181,0,\t176,0,\t0,0,\t
12579179,44,\t0,0,\t0,0,\t0,0,\t
125800,0,\t0,0,\t180,44,\t0,0,\t
125810,0,\t0,0,\t0,0,\t181,44,\t
12582182,0,\t175,230,\t0,0,\t177,0,\t
125830,0,\t0,0,\t183,0,\t0,0,\t
12584182,0,\t184,0,\t0,0,\t0,0,\t
12585182,0,\t176,231,\t183,0,\t185,0,\t
12586186,0,\t0,0,\t183,0,\t178,0,\t
125870,0,\t0,0,\t187,0,\t178,233,\t
12588179,0,\t177,232,\t182,44,\t0,0,\t
125890,0,\t0,0,\t180,0,\t184,0,\t
12590183,44,\t0,0,\t0,0,\t181,0,\t
125910,0,\t185,0,\t186,0,\t184,0,\t
125920,0,\t179,234,\t181,236,\t184,0,\t
12593187,0,\t185,0,\t186,0,\t0,0,\t
12594180,235,\t185,0,\t186,0,\t0,0,\t
12595187,0,\t0,0,\t188,0,\t189,0,\t
12596187,0,\t184,44,\t0,0,\t0,0,\t
12597190,0,\t0,0,\t182,0,\t185,44,\t
12598186,44,\t0,0,\t0,0,\t0,0,\t
12599183,0,\t182,237,\t187,44,\t0,0,\t
126000,0,\t0,0,\t0,0,\t183,238,\t
12601188,0,\t189,0,\t0,0,\t191,0,\t
126020,0,\t0,0,\t190,0,\t0,0,\t
12603188,0,\t189,0,\t0,0,\t0,0,\t
12604188,0,\t189,0,\t190,0,\t0,0,\t
126050,0,\t184,0,\t190,0,\t192,0,\t
126060,0,\t0,0,\t0,0,\t185,0,\t
12607186,0,\t191,0,\t188,44,\t189,44,\t
126080,0,\t0,0,\t187,0,\t0,0,\t
12609190,44,\t191,0,\t0,0,\t0,0,\t
126100,0,\t191,0,\t184,239,\t0,0,\t
126110,0,\t192,0,\t193,0,\t194,0,\t
12612195,0,\t0,0,\t0,0,\t0,0,\t
126130,0,\t192,0,\t0,0,\t191,44,\t
12614187,240,\t192,0,\t0,0,\t0,0,\t
126150,0,\t0,0,\t0,0,\t196,0,\t
126160,0,\t0,0,\t188,0,\t189,0,\t
12617193,0,\t194,0,\t195,0,\t192,44,\t
12618190,0,\t188,241,\t189,242,\t0,0,\t
12619193,0,\t194,0,\t195,0,\t0,0,\t
12620193,0,\t194,0,\t195,0,\t190,243,\t
126210,0,\t196,0,\t197,0,\t198,0,\t
12622199,0,\t0,0,\t0,0,\t191,0,\t
126230,0,\t196,0,\t193,44,\t194,44,\t
12624195,44,\t196,0,\t0,0,\t0,0,\t
126250,0,\t0,0,\t0,0,\t200,0,\t
126260,0,\t0,0,\t0,0,\t192,0,\t
12627197,0,\t198,0,\t199,0,\t196,44,\t
126280,0,\t0,0,\t0,0,\t0,0,\t
12629197,0,\t198,0,\t199,0,\t0,0,\t
12630197,0,\t198,0,\t199,0,\t0,0,\t
126310,0,\t200,0,\t201,0,\t192,244,\t
12632202,0,\t0,0,\t193,0,\t194,0,\t
12633195,0,\t200,0,\t197,44,\t198,44,\t
12634199,44,\t200,0,\t194,246,\t0,0,\t
12635193,245,\t0,0,\t0,0,\t0,0,\t
126360,0,\t0,0,\t0,0,\t196,0,\t
12637201,0,\t0,0,\t202,0,\t200,44,\t
126380,0,\t0,0,\t0,0,\t0,0,\t
12639201,0,\t0,0,\t202,0,\t203,0,\t
12640201,0,\t204,0,\t202,0,\t0,0,\t
126410,0,\t0,0,\t0,0,\t196,247,\t
126420,0,\t0,0,\t197,0,\t198,0,\t
12643199,0,\t0,0,\t201,44,\t0,0,\t
12644202,44,\t197,248,\t0,0,\t199,250,\t
126450,0,\t203,0,\t0,0,\t204,0,\t
126460,0,\t0,0,\t205,0,\t200,0,\t
126470,0,\t203,0,\t200,251,\t204,0,\t
12648198,249,\t203,0,\t0,0,\t204,0,\t
12649206,0,\t0,0,\t0,0,\t207,0,\t
126500,0,\t208,0,\t0,0,\t0,0,\t
126510,0,\t0,0,\t209,0,\t203,44,\t
12652205,0,\t204,44,\t201,0,\t0,0,\t
12653202,0,\t0,0,\t0,0,\t0,0,\t
12654205,0,\t0,0,\t206,0,\t0,0,\t
12655205,0,\t207,0,\t0,0,\t208,0,\t
12656202,253,\t0,0,\t206,0,\t0,0,\t
12657209,0,\t207,0,\t206,0,\t208,0,\t
12658201,252,\t207,0,\t205,44,\t208,0,\t
12659209,0,\t0,0,\t210,0,\t0,0,\t
12660209,0,\t211,0,\t0,0,\t203,0,\t
12661206,44,\t204,0,\t0,0,\t207,44,\t
126620,0,\t208,44,\t203,254,\t0,0,\t
126630,0,\t0,0,\t209,44,\t0,0,\t
126640,0,\t0,0,\t0,0,\t0,0,\t
12665210,0,\t0,0,\t212,0,\t211,0,\t
126660,0,\t0,0,\t0,0,\t0,0,\t
12667210,0,\t213,0,\t205,0,\t211,0,\t
12668210,0,\t0,0,\t0,0,\t211,0,\t
126690,0,\t0,0,\t214,0,\t215,0,\t
12670206,0,\t0,0,\t0,0,\t207,0,\t
12671212,0,\t208,0,\t210,44,\t206,256,\t
126720,0,\t211,44,\t209,0,\t213,0,\t
12673212,0,\t205,255,\t216,0,\t0,0,\t
12674212,0,\t0,0,\t0,0,\t213,0,\t
12675214,0,\t215,0,\t0,0,\t213,0,\t
12676207,257,\t0,0,\t0,0,\t217,0,\t
12677214,0,\t215,0,\t212,44,\t209,258,\t
12678214,0,\t215,0,\t0,0,\t0,0,\t
12679216,0,\t213,44,\t218,0,\t0,0,\t
126800,0,\t0,0,\t210,0,\t0,0,\t
12681216,0,\t211,0,\t214,44,\t215,44,\t
12682216,0,\t217,0,\t0,0,\t0,0,\t
126830,0,\t0,0,\t0,0,\t219,0,\t
126840,0,\t217,0,\t220,0,\t0,0,\t
12685218,0,\t217,0,\t216,44,\t0,0,\t
126860,0,\t211,260,\t212,0,\t0,0,\t
12687218,0,\t210,259,\t0,0,\t0,0,\t
12688218,0,\t213,0,\t0,0,\t217,44,\t
12689213,261,\t219,0,\t221,0,\t222,0,\t
12690220,0,\t0,0,\t214,0,\t215,0,\t
126910,0,\t219,0,\t218,44,\t0,0,\t
12692220,0,\t219,0,\t0,0,\t0,0,\t
12693220,0,\t0,0,\t0,0,\t0,0,\t
12694214,262,\t0,0,\t216,0,\t0,0,\t
12695221,0,\t222,0,\t223,0,\t219,44,\t
12696215,263,\t216,264,\t220,44,\t224,0,\t
12697221,0,\t222,0,\t0,0,\t217,0,\t
12698221,0,\t222,0,\t0,0,\t0,0,\t
126990,0,\t0,0,\t0,0,\t0,0,\t
127000,0,\t0,0,\t218,0,\t0,0,\t
12701223,0,\t217,265,\t221,44,\t222,44,\t
127020,0,\t224,0,\t225,0,\t0,0,\t
12703223,0,\t218,266,\t0,0,\t0,0,\t
12704223,0,\t224,0,\t0,0,\t219,0,\t
127050,0,\t224,0,\t220,0,\t0,0,\t
127060,0,\t226,0,\t227,0,\t0,0,\t
127070,0,\t0,0,\t223,44,\t228,0,\t
12708225,0,\t219,267,\t0,0,\t224,44,\t
127090,0,\t0,0,\t0,0,\t0,0,\t
12710225,0,\t0,0,\t221,0,\t222,0,\t
12711225,0,\t0,0,\t0,0,\t226,0,\t
12712227,0,\t221,268,\t222,269,\t0,0,\t
127130,0,\t228,0,\t229,0,\t226,0,\t
12714227,0,\t0,0,\t225,44,\t226,0,\t
12715227,0,\t228,0,\t0,0,\t230,0,\t
127160,0,\t228,0,\t223,0,\t0,0,\t
127170,0,\t0,0,\t231,0,\t224,0,\t
127180,0,\t226,44,\t227,44,\t0,0,\t
12719229,0,\t0,0,\t0,0,\t228,44,\t
127200,0,\t0,0,\t223,270,\t0,0,\t
12721229,0,\t230,0,\t0,0,\t0,0,\t
12722229,0,\t0,0,\t0,0,\t0,0,\t
12723231,0,\t230,0,\t225,0,\t0,0,\t
127240,0,\t230,0,\t232,0,\t0,0,\t
12725231,0,\t233,0,\t229,44,\t234,0,\t
12726231,0,\t0,0,\t0,0,\t0,0,\t
127270,0,\t226,0,\t227,0,\t230,44,\t
127280,0,\t226,272,\t235,0,\t228,0,\t
12729225,271,\t227,273,\t231,44,\t0,0,\t
12730232,0,\t0,0,\t0,0,\t233,0,\t
127310,0,\t234,0,\t228,274,\t0,0,\t
12732232,0,\t0,0,\t236,0,\t233,0,\t
12733232,0,\t234,0,\t0,0,\t233,0,\t
12734235,0,\t234,0,\t229,0,\t0,0,\t
127350,0,\t237,0,\t0,0,\t238,0,\t
12736235,0,\t229,275,\t232,44,\t230,0,\t
12737235,0,\t233,44,\t0,0,\t234,44,\t
12738236,0,\t0,0,\t231,0,\t0,0,\t
127390,0,\t0,0,\t239,0,\t0,0,\t
12740236,0,\t0,0,\t235,44,\t237,0,\t
12741236,0,\t238,0,\t0,0,\t0,0,\t
127420,0,\t0,0,\t0,0,\t237,0,\t
127430,0,\t238,0,\t0,0,\t237,0,\t
127440,0,\t238,0,\t236,44,\t0,0,\t
12745239,0,\t0,0,\t232,0,\t240,0,\t
127460,0,\t233,0,\t241,0,\t234,0,\t
12747239,0,\t237,44,\t0,0,\t238,44,\t
12748239,0,\t0,0,\t0,0,\t0,0,\t
12749242,0,\t233,277,\t235,0,\t243,0,\t
127500,0,\t0,0,\t0,0,\t235,279,\t
12751232,276,\t240,0,\t239,44,\t0,0,\t
12752241,0,\t234,278,\t0,0,\t0,0,\t
127530,0,\t240,0,\t236,0,\t244,0,\t
12754241,0,\t240,0,\t242,0,\t0,0,\t
12755241,0,\t243,0,\t0,0,\t0,0,\t
12756245,0,\t237,0,\t242,0,\t238,0,\t
127570,0,\t243,0,\t242,0,\t240,44,\t
12758238,280,\t243,0,\t241,44,\t0,0,\t
127590,0,\t244,0,\t0,0,\t0,0,\t
127600,0,\t0,0,\t239,0,\t246,0,\t
12761242,44,\t244,0,\t245,0,\t243,44,\t
127620,0,\t244,0,\t0,0,\t0,0,\t
12763247,0,\t0,0,\t245,0,\t0,0,\t
127640,0,\t0,0,\t245,0,\t248,0,\t
127650,0,\t0,0,\t0,0,\t244,44,\t
127660,0,\t246,0,\t0,0,\t240,0,\t
12767249,0,\t239,281,\t241,0,\t0,0,\t
12768245,44,\t246,0,\t247,0,\t250,0,\t
12769241,283,\t246,0,\t240,282,\t0,0,\t
12770242,0,\t248,0,\t247,0,\t243,0,\t
12771251,0,\t242,284,\t247,0,\t0,0,\t
127720,0,\t248,0,\t249,0,\t246,44,\t
12773243,285,\t248,0,\t0,0,\t0,0,\t
127740,0,\t250,0,\t249,0,\t244,0,\t
12775247,44,\t0,0,\t249,0,\t252,0,\t
127760,0,\t250,0,\t251,0,\t248,44,\t
12777245,0,\t250,0,\t0,0,\t0,0,\t
12778253,0,\t0,0,\t251,0,\t0,0,\t
12779249,44,\t244,286,\t251,0,\t254,0,\t
127800,0,\t0,0,\t245,287,\t250,44,\t
127810,0,\t252,0,\t0,0,\t246,0,\t
127820,0,\t0,0,\t0,0,\t0,0,\t
12783251,44,\t252,0,\t253,0,\t255,0,\t
12784247,0,\t252,0,\t0,0,\t0,0,\t
127850,0,\t254,0,\t253,0,\t248,0,\t
12786256,0,\t0,0,\t253,0,\t0,0,\t
127870,0,\t254,0,\t257,0,\t252,44,\t
12788249,0,\t254,0,\t0,0,\t0,0,\t
127890,0,\t255,0,\t0,0,\t250,0,\t
12790253,44,\t0,0,\t250,290,\t258,0,\t
12791248,288,\t255,0,\t256,0,\t254,44,\t
12792251,0,\t255,0,\t249,289,\t0,0,\t
12793257,0,\t0,0,\t256,0,\t0,0,\t
127940,0,\t0,0,\t256,0,\t259,0,\t
12795257,0,\t0,0,\t260,0,\t255,44,\t
12796257,0,\t258,0,\t0,0,\t252,0,\t
12797261,0,\t0,0,\t251,291,\t0,0,\t
12798256,44,\t258,0,\t0,0,\t262,0,\t
12799253,0,\t258,0,\t257,44,\t0,0,\t
128000,0,\t259,0,\t0,0,\t254,0,\t
12801260,0,\t0,0,\t0,0,\t252,292,\t
12802254,293,\t259,0,\t261,0,\t258,44,\t
12803260,0,\t259,0,\t0,0,\t0,0,\t
12804260,0,\t262,0,\t261,0,\t255,0,\t
12805263,0,\t0,0,\t261,0,\t264,0,\t
128060,0,\t262,0,\t265,0,\t259,44,\t
12807256,0,\t262,0,\t260,44,\t0,0,\t
128080,0,\t0,0,\t257,0,\t0,0,\t
12809261,44,\t0,0,\t0,0,\t0,0,\t
12810255,294,\t0,0,\t263,0,\t262,44,\t
128110,0,\t264,0,\t0,0,\t258,0,\t
12812265,0,\t0,0,\t263,0,\t266,0,\t
12813257,295,\t264,0,\t263,0,\t0,0,\t
12814265,0,\t264,0,\t0,0,\t0,0,\t
12815265,0,\t267,0,\t0,0,\t259,0,\t
128160,0,\t0,0,\t260,0,\t0,0,\t
12817263,44,\t258,296,\t0,0,\t264,44,\t
12818261,0,\t266,0,\t265,44,\t0,0,\t
128190,0,\t0,0,\t268,0,\t262,0,\t
128200,0,\t266,0,\t0,0,\t267,0,\t
12821269,0,\t266,0,\t260,297,\t0,0,\t
12822261,298,\t0,0,\t0,0,\t267,0,\t
128230,0,\t270,0,\t271,0,\t267,0,\t
128240,0,\t0,0,\t0,0,\t266,44,\t
12825268,0,\t0,0,\t0,0,\t0,0,\t
12826263,0,\t0,0,\t269,0,\t264,0,\t
12827268,0,\t267,44,\t265,0,\t0,0,\t
12828268,0,\t0,0,\t269,0,\t270,0,\t
12829271,0,\t0,0,\t269,0,\t0,0,\t
128300,0,\t0,0,\t272,0,\t270,0,\t
12831271,0,\t0,0,\t268,44,\t270,0,\t
12832271,0,\t0,0,\t0,0,\t273,0,\t
12833269,44,\t274,0,\t0,0,\t266,0,\t
128340,0,\t265,299,\t0,0,\t0,0,\t
128350,0,\t270,44,\t271,44,\t0,0,\t
12836272,0,\t267,0,\t0,0,\t0,0,\t
128370,0,\t0,0,\t0,0,\t266,300,\t
12838272,0,\t273,0,\t275,0,\t274,0,\t
12839272,0,\t0,0,\t0,0,\t0,0,\t
128400,0,\t273,0,\t268,0,\t274,0,\t
12841276,0,\t273,0,\t0,0,\t274,0,\t
12842269,0,\t0,0,\t272,44,\t277,0,\t
12843267,301,\t269,302,\t278,0,\t0,0,\t
12844275,0,\t270,0,\t271,0,\t273,44,\t
128450,0,\t274,44,\t270,303,\t0,0,\t
12846275,0,\t0,0,\t276,0,\t0,0,\t
12847275,0,\t0,0,\t0,0,\t0,0,\t
128480,0,\t277,0,\t276,0,\t0,0,\t
12849278,0,\t0,0,\t276,0,\t279,0,\t
12850271,304,\t277,0,\t275,44,\t0,0,\t
12851278,0,\t277,0,\t272,0,\t0,0,\t
12852278,0,\t0,0,\t0,0,\t0,0,\t
12853276,44,\t0,0,\t0,0,\t273,0,\t
128540,0,\t274,0,\t272,305,\t277,44,\t
128550,0,\t279,0,\t278,44,\t280,0,\t
128560,0,\t0,0,\t0,0,\t0,0,\t
128570,0,\t279,0,\t281,0,\t273,306,\t
12858282,0,\t279,0,\t0,0,\t0,0,\t
128590,0,\t0,0,\t275,0,\t274,307,\t
128600,0,\t0,0,\t0,0,\t283,0,\t
12861275,308,\t280,0,\t0,0,\t279,44,\t
12862276,0,\t0,0,\t0,0,\t0,0,\t
12863281,0,\t280,0,\t282,0,\t277,0,\t
128640,0,\t280,0,\t278,0,\t0,0,\t
12865281,0,\t0,0,\t282,0,\t284,0,\t
12866281,0,\t283,0,\t282,0,\t0,0,\t
12867276,309,\t278,310,\t285,0,\t280,44,\t
12868286,0,\t283,0,\t0,0,\t0,0,\t
128690,0,\t283,0,\t281,44,\t0,0,\t
12870282,44,\t0,0,\t0,0,\t279,0,\t
128710,0,\t284,0,\t0,0,\t0,0,\t
128720,0,\t0,0,\t0,0,\t283,44,\t
12873285,0,\t284,0,\t286,0,\t287,0,\t
128740,0,\t284,0,\t0,0,\t0,0,\t
12875285,0,\t0,0,\t286,0,\t0,0,\t
12876285,0,\t0,0,\t286,0,\t280,0,\t
128770,0,\t0,0,\t288,0,\t284,44,\t
12878289,0,\t0,0,\t281,0,\t290,0,\t
12879282,0,\t287,0,\t285,44,\t0,0,\t
12880286,44,\t0,0,\t0,0,\t0,0,\t
128810,0,\t287,0,\t0,0,\t283,0,\t
128820,0,\t287,0,\t0,0,\t0,0,\t
12883288,0,\t282,312,\t289,0,\t281,311,\t
128840,0,\t290,0,\t283,313,\t291,0,\t
12885288,0,\t0,0,\t289,0,\t287,44,\t
12886288,0,\t290,0,\t289,0,\t284,0,\t
128870,0,\t290,0,\t292,0,\t0,0,\t
12888293,0,\t0,0,\t285,0,\t0,0,\t
12889286,0,\t0,0,\t288,44,\t294,0,\t
12890289,44,\t291,0,\t0,0,\t290,44,\t
12891285,314,\t0,0,\t0,0,\t0,0,\t
128920,0,\t291,0,\t0,0,\t0,0,\t
12893292,0,\t291,0,\t293,0,\t0,0,\t
128940,0,\t0,0,\t0,0,\t287,0,\t
12895292,0,\t294,0,\t293,0,\t295,0,\t
12896292,0,\t0,0,\t293,0,\t291,44,\t
128970,0,\t294,0,\t0,0,\t0,0,\t
12898296,0,\t294,0,\t288,0,\t0,0,\t
12899289,0,\t0,0,\t292,44,\t290,0,\t
12900293,44,\t0,0,\t0,0,\t289,317,\t
129010,0,\t295,0,\t287,315,\t294,44,\t
12902297,0,\t0,0,\t0,0,\t298,0,\t
129030,0,\t295,0,\t296,0,\t288,316,\t
129040,0,\t295,0,\t0,0,\t0,0,\t
12905290,318,\t0,0,\t296,0,\t291,0,\t
12906299,0,\t0,0,\t296,0,\t300,0,\t
129070,0,\t0,0,\t297,0,\t295,44,\t
129080,0,\t298,0,\t292,0,\t0,0,\t
12909293,0,\t0,0,\t297,0,\t0,0,\t
12910296,44,\t298,0,\t297,0,\t294,0,\t
129110,0,\t298,0,\t299,0,\t0,0,\t
12912301,0,\t300,0,\t0,0,\t302,0,\t
129130,0,\t0,0,\t299,0,\t0,0,\t
12914297,44,\t300,0,\t299,0,\t298,44,\t
129150,0,\t300,0,\t0,0,\t0,0,\t
12916303,0,\t0,0,\t0,0,\t295,0,\t
129170,0,\t0,0,\t301,0,\t0,0,\t
12918299,44,\t302,0,\t295,319,\t300,44,\t
12919296,0,\t0,0,\t301,0,\t296,320,\t
12920304,0,\t302,0,\t301,0,\t305,0,\t
129210,0,\t302,0,\t303,0,\t0,0,\t
129220,0,\t0,0,\t0,0,\t0,0,\t
12923297,0,\t306,0,\t303,0,\t298,0,\t
12924301,44,\t0,0,\t303,0,\t302,44,\t
129250,0,\t0,0,\t304,0,\t307,0,\t
12926298,322,\t305,0,\t0,0,\t0,0,\t
12927299,0,\t297,321,\t304,0,\t300,0,\t
12928303,44,\t305,0,\t304,0,\t306,0,\t
129290,0,\t305,0,\t0,0,\t0,0,\t
12930308,0,\t0,0,\t309,0,\t306,0,\t
129310,0,\t307,0,\t0,0,\t306,0,\t
12932304,44,\t0,0,\t0,0,\t305,44,\t
12933301,0,\t307,0,\t0,0,\t302,0,\t
129340,0,\t307,0,\t0,0,\t0,0,\t
129350,0,\t306,44,\t308,0,\t0,0,\t
12936309,0,\t0,0,\t0,0,\t0,0,\t
12937303,0,\t310,0,\t308,0,\t307,44,\t
12938309,0,\t0,0,\t308,0,\t303,323,\t
12939309,0,\t0,0,\t0,0,\t311,0,\t
12940312,0,\t0,0,\t0,0,\t0,0,\t
12941304,0,\t0,0,\t0,0,\t305,0,\t
12942308,44,\t313,0,\t309,44,\t310,0,\t
129430,0,\t0,0,\t0,0,\t0,0,\t
129440,0,\t306,0,\t0,0,\t310,0,\t
129450,0,\t311,0,\t312,0,\t310,0,\t
12946304,324,\t0,0,\t0,0,\t307,0,\t
12947314,0,\t311,0,\t312,0,\t313,0,\t
129480,0,\t311,0,\t312,0,\t0,0,\t
129490,0,\t310,44,\t315,0,\t313,0,\t
129500,0,\t316,0,\t0,0,\t313,0,\t
12951308,0,\t0,0,\t309,0,\t311,44,\t
12952312,44,\t0,0,\t314,0,\t0,0,\t
129530,0,\t0,0,\t307,325,\t0,0,\t
129540,0,\t313,44,\t314,0,\t0,0,\t
12955315,0,\t0,0,\t314,0,\t316,0,\t
129560,0,\t317,0,\t0,0,\t0,0,\t
12957315,0,\t0,0,\t0,0,\t316,0,\t
12958315,0,\t310,0,\t0,0,\t316,0,\t
12959314,44,\t0,0,\t0,0,\t0,0,\t
12960318,0,\t310,326,\t0,0,\t311,0,\t
12961312,0,\t319,0,\t315,44,\t317,0,\t
129620,0,\t316,44,\t0,0,\t0,0,\t
129630,0,\t313,0,\t0,0,\t317,0,\t
12964320,0,\t0,0,\t0,0,\t317,0,\t
12965312,327,\t0,0,\t318,0,\t0,0,\t
129660,0,\t321,0,\t0,0,\t319,0,\t
129670,0,\t313,328,\t318,0,\t0,0,\t
12968314,0,\t317,44,\t318,0,\t319,0,\t
129690,0,\t0,0,\t320,0,\t319,0,\t
129700,0,\t0,0,\t315,0,\t0,0,\t
129710,0,\t316,0,\t320,0,\t321,0,\t
12972318,44,\t322,0,\t320,0,\t0,0,\t
129730,0,\t319,44,\t314,329,\t321,0,\t
129740,0,\t0,0,\t0,0,\t321,0,\t
129750,0,\t0,0,\t0,0,\t0,0,\t
12976320,44,\t323,0,\t0,0,\t0,0,\t
12977324,0,\t317,0,\t0,0,\t322,0,\t
129780,0,\t321,44,\t317,330,\t0,0,\t
129790,0,\t0,0,\t0,0,\t322,0,\t
129800,0,\t0,0,\t0,0,\t322,0,\t
12981318,0,\t0,0,\t0,0,\t323,0,\t
12982325,0,\t319,0,\t324,0,\t0,0,\t
129830,0,\t0,0,\t319,332,\t323,0,\t
129840,0,\t322,44,\t324,0,\t323,0,\t
12985320,0,\t0,0,\t324,0,\t0,0,\t
129860,0,\t326,0,\t318,331,\t327,0,\t
12987328,0,\t321,0,\t325,0,\t0,0,\t
129880,0,\t323,44,\t0,0,\t320,333,\t
12989324,44,\t0,0,\t325,0,\t0,0,\t
129900,0,\t0,0,\t325,0,\t0,0,\t
129910,0,\t0,0,\t0,0,\t326,0,\t
12992329,0,\t327,0,\t328,0,\t0,0,\t
129930,0,\t322,0,\t321,334,\t326,0,\t
12994325,44,\t327,0,\t328,0,\t326,0,\t
12995322,335,\t327,0,\t328,0,\t0,0,\t
129960,0,\t330,0,\t0,0,\t331,0,\t
12997332,0,\t323,0,\t329,0,\t0,0,\t
12998324,0,\t326,44,\t0,0,\t327,44,\t
12999328,44,\t0,0,\t329,0,\t0,0,\t
130000,0,\t0,0,\t329,0,\t0,0,\t
130010,0,\t0,0,\t0,0,\t330,0,\t
130020,0,\t331,0,\t332,0,\t0,0,\t
13003325,0,\t0,0,\t0,0,\t330,0,\t
13004329,44,\t331,0,\t332,0,\t330,0,\t
13005333,0,\t331,0,\t332,0,\t0,0,\t
130060,0,\t334,0,\t0,0,\t335,0,\t
130070,0,\t326,0,\t0,0,\t327,0,\t
13008328,0,\t330,44,\t0,0,\t331,44,\t
13009332,44,\t0,0,\t0,0,\t0,0,\t
13010336,0,\t0,0,\t333,0,\t0,0,\t
130110,0,\t0,0,\t0,0,\t334,0,\t
130120,0,\t335,0,\t333,0,\t0,0,\t
13013329,0,\t0,0,\t333,0,\t334,0,\t
13014326,336,\t335,0,\t0,0,\t334,0,\t
13015337,0,\t335,0,\t336,0,\t0,0,\t
130160,0,\t338,0,\t0,0,\t0,0,\t
13017333,44,\t330,0,\t336,0,\t331,0,\t
13018332,0,\t334,44,\t336,0,\t335,44,\t
130190,0,\t0,0,\t0,0,\t0,0,\t
130200,0,\t0,0,\t337,0,\t0,0,\t
130210,0,\t0,0,\t0,0,\t338,0,\t
13022336,44,\t0,0,\t337,0,\t0,0,\t
130230,0,\t0,0,\t337,0,\t338,0,\t
130240,0,\t0,0,\t0,0,\t338,0,\t
130250,0,\t0,0,\t0,0,\t0,0,\t
13026333,0,\t0,0,\t0,0,\t0,0,\t
13027337,44,\t334,0,\t0,0,\t335,0,\t
130280,0,\t338,44,\t0,0,\t0,0,\t
130290,0,\t335,338,\t0,0,\t0,0,\t
130300,0,\t0,0,\t333,337,\t0,0,\t
13031336,0,\t0,0,\t0,0,\t0,0,\t
130320,0,\t0,0,\t0,0,\t0,0,\t
130330,0,\t0,0,\t0,0,\t0,0,\t
130340,0,\t0,0,\t0,0,\t0,0,\t
130350,0,\t0,0,\t0,0,\t0,0,\t
13036337,0,\t0,0,\t0,0,\t0,0,\t
130370,0,\t338,0,\t0,0,\t0,0,\t
130380,0};'
13039	EXEC -nh
13040		INPUT - $'#pragma prototyped
13041/* Adapted for ksh by David Korn */
13042/*+\tVI.C\t\t\tP.D. Sullivan
13043 *
13044 *\tOne line editor for the shell based on the vi editor.
13045 *
13046 *\t\tcbosgd!pds
13047-*/
13048
13049
13050#include\t<errno.h>
13051#include\t<stdlib.h>
13052#include\t<string.h>
13053
13054#ifdef KSHELL
13055#   include\t"defs.h"
13056#else
13057#   include\t"io.h"
13058#endif\t/* KSHELL */
13059
13060#include\t"history.h"
13061#include\t"edit.h"
13062#include\t"terminal.h"
13063
13064#ifdef OLDTERMIO
13065#   undef ECHOCTL
13066    extern char echoctl;
13067#else
13068#   ifdef ECHOCTL
13069#\tdefine echoctl\tECHOCTL
13070#   else
13071#\tdefine echoctl\t0
13072#   endif /* ECHOCTL */
13073#endif /*OLDTERMIO */
13074
13075#ifndef FIORDCHK
13076#   define NTICKS\t5\t\t/* number of ticks for typeahead */
13077#   ifndef KSHELL
13078#\tifdef _sys_times_
13079#\tinclude\t<sys/times.h>
13080#\telse
13081  \t   struct tms
13082\t   {
13083\t\ttime_t\ttms_utime;
13084\t\ttime_t\ttms_stime;
13085\t\ttime_t\ttms_cutime;
13086\t\ttime_t\ttms_cstime;
13087\t   };
13088#\tendif /* _sys_times */
13089#   endif /* KSHELL */
13090#endif /* FIORDCHK */
13091
13092#define\tMAXCHAR\tMAXLINE-2\t\t/* max char per line */
13093#define\tWINDOW\tMAXWINDOW\t\t/* max char in window of which */
13094\t\t\t\t\t/* WINDOW-2 are available to user */
13095\t\t\t\t\t/* actual window size may be smaller */
13096
13097
13098#undef isblank
13099#ifdef MULTIBYTE
13100    static int bigvi;
13101#   define gencpy(a,b)\ted_gencpy(a,b)
13102#   define genncpy(a,b,n)\ted_genncpy(a,b,n)
13103#   define genlen(str)\ted_genlen(str)
13104#   define digit(c)\t((c&~STRIP)==0 && isdigit(c))
13105#   define is_print(c)\t((c&~STRIP) || isprint(c))
13106#else
13107#   define gencpy(a,b)\tstrcpy((char*)(a),(char*)(b))
13108#   define genncpy(a,b,n) strncpy((char*)(a),(char*)(b),n)
13109#   define genlen(str)\tstrlen(str)
13110#   define isalph(v)\tisalnum(virtual[v])
13111#   define isblank(v)\tisspace(virtual[v])
13112#   define ismetach(v)\tismeta(virtual[v])
13113#   define digit(c)\tisdigit(c)
13114#   define is_print(c)\tisprint(c)
13115#endif\t/* MULTIBYTE */
13116#define fold(c)\t\t((c)&~040)\t/* lower and uppercase equivalent */
13117#ifdef INT16
13118/* save space by defining functions for these */
13119#   undef isalph
13120#   undef isblank
13121#   undef ismetach
13122    static int isalph(int);
13123    static int isblank(int);
13124    static int ismetach(int);
13125#endif\t/* INT16 */
13126
13127#undef putchar
13128#undef getchar
13129#define getchar()\ted_getchar()
13130#define putchar(c)\ted_putchar(c)
13131#define bell\t\ted_ringbell()\t/* ring terminal\'s bell */
13132#define crlf\t\ted_crlf()\t/* return and linefeed */
13133
13134#define in_raw\t\teditb.e_addnl\t\t/* next char input is raw */
13135#define crallowed\teditb.e_crlf
13136#define cur_virt\teditb.e_cur\t\t/* current virtual column */
13137#define cur_phys\teditb.e_pcur\t/* current phys column cursor is at */
13138#define curhline\teditb.e_hline\t\t/* current history line */
13139#define env\t\teditb.e_env
13140#define fildes\t\teditb.e_fd
13141#define findchar\teditb.e_fchar\t\t/* last find char */
13142#define first_virt\teditb.e_fcol\t\t/* first allowable column */
13143#define first_wind\teditb.e_globals[0]\t/* first column of window */
13144#define\tglobals\t\teditb.e_globals\t\t/* local global variables */
13145#define histmin\t\teditb.e_hismin
13146#define histmax\t\teditb.e_hismax
13147#define last_phys\teditb.e_peol\t\t/* last column in physical */
13148#define last_virt\teditb.e_eol\t\t/* last column */
13149#define last_wind\teditb.e_globals[1]\t/* last column in window */
13150#define\tlastmotion\teditb.e_globals[2]\t/* last motion */
13151#define lastrepeat\teditb.e_mode\t/* last repeat count for motion cmds */
13152#define\tlong_char\teditb.e_globals[3]\t/* line bigger than window */
13153#define\tlong_line\teditb.e_globals[4]\t/* line bigger than window */
13154#define lsearch\t\teditb.e_search\t\t/* last search string */
13155#define lookahead\teditb.e_index\t\t/* characters in buffer */
13156#define previous\teditb.e_lbuf\t\t/* lookahead buffer */
13157#define max_col\t\teditb.e_llimit\t\t/* maximum column */
13158#define\tocur_phys\teditb.e_globals[5]   /* old current physical position */
13159#define\tocur_virt\teditb.e_globals[6]\t/* old last virtual position */
13160#define\tofirst_wind\teditb.e_globals[7]\t/* old window first col */
13161#define\to_v_char\teditb.e_globals[8]\t/* prev virtual[ocur_virt] */
13162#define Prompt\t\teditb.e_prompt\t\t/* pointer to prompt */
13163#define plen\t\teditb.e_plen\t\t/* length of prompt */
13164#define physical\teditb.e_physbuf\t\t/* physical image */
13165#define repeat\t\teditb.e_repeat\t    /* repeat count for motion cmds */
13166#define ttyspeed\teditb.e_ttyspeed\t/* tty speed */
13167#define u_column\teditb.e_ucol\t\t/* undo current column */
13168#define U_saved\t\teditb.e_saved\t\t/* original virtual saved */
13169#define U_space\t\teditb.e_Ubuf\t\t/* used for U command */
13170#define u_space\t\teditb.e_ubuf\t\t/* used for u command */
13171#define usreof\t\teditb.e_eof\t\t/* user defined eof char */
13172#define usrerase\teditb.e_erase\t\t/* user defined erase char */
13173#define usrintr\t\teditb.e_intr\t\t/* user defined intr char */
13174#define usrkill\t\teditb.e_kill\t\t/* user defined kill char */
13175#define usrquit\t\teditb.e_quit\t\t/* user defined quit char */
13176#define virtual\t\teditb.e_inbuf\t/* pointer to virtual image buffer */
13177#define\twindow\t\teditb.e_window\t\t/* window buffer */
13178#define\tw_size\t\teditb.e_wsize\t\t/* window size */
13179#define\tinmacro\t\teditb.e_inmacro\t\t/* true when in macro */
13180#define yankbuf\t\teditb.e_killbuf\t\t/* yank/delete buffer */
13181
13182extern clock_t times();
13183
13184#define\tABORT\t-2\t\t\t/* user abort */
13185#define\tAPPEND\t-10\t\t\t/* append chars */
13186#define\tBAD\t-1\t\t\t/* failure flag */
13187#define\tBIGVI\t-15\t\t\t/* user wants real vi */
13188#define\tCONTROL\t-20\t\t\t/* control mode */
13189#define\tENTER\t-25\t\t\t/* enter flag */
13190#define\tGOOD\t0\t\t\t/* success flag */
13191#define\tINPUT\t-30\t\t\t/* input mode */
13192#define\tINSERT\t-35\t\t\t/* insert mode */
13193#define\tREPLACE\t-40\t\t\t/* replace chars */
13194#define\tSEARCH\t-45\t\t\t/* search flag */
13195#define\tTRANSLATE\t-50\t\t/* translate virt to phys only */
13196
13197#define\tDEL\t\'\\177\'\t\t\t/* interrupt char */
13198
13199#define\tTRUE\t1
13200#define\tFALSE\t0
13201
13202#define\tINVALID\t(-1)\t\t\t/* invalid column */
13203#define\tQUIT_C\t\'\\34\'\t\t\t/* quit char */
13204#define\tSYSERR\t(-1)\t\t\t/* system error */
13205
13206static char addnl;\t\t\t/* boolean - add newline flag */
13207static char last_cmd = \'\\0\';\t\t/* last command */
13208static char repeat_set;
13209static char nonewline;
13210static genchar *lastline;
13211static char paren_chars[] = "([{)]}";   /* for % command */
13212
13213#ifdef FIORDCHK
13214    static clock_t typeahead;\t\t/* typeahead occurred */
13215#else
13216    static int typeahead;\t\t/* typeahead occurred */
13217#endif\t/* FIORDCHK */
13218
13219static void\tdel_line(int);
13220static int\tgetcount(int);
13221static void\tgetline(int);
13222static int\tgetrchar(void);
13223static int\tmvcursor(int);
13224static void\tpr_prompt(void);
13225static void\tpr_string(const char*);
13226static void\tputstring(int, int);
13227static void\trefresh(int);
13228static void\treplace(int, int);
13229static void\trestore_v(void);
13230static void\tsave_last(void);
13231static void\tsave_v(void);
13232static int\tsearch(int);
13233static void\tsync_cursor(void);
13234static int\ttextmod(int,int);
13235
13236/*+\tVI_READ( fd, shbuf, nchar )
13237 *
13238 *\tThis routine implements a one line version of vi and is
13239 * called by _filbuf.c
13240 *
13241-*/
13242
13243vi_read(int fd, register char *shbuf, unsigned nchar)
13244{
13245\tregister int i;\t\t\t/* general variable */
13246\tregister int c;\t\t\t/* general variable */
13247\tregister int term_char;\t/* read() termination character */
13248\tchar prompt[PRSIZE+2];\t\t/* prompt */
13249\tgenchar Physical[2*MAXLINE];\t/* physical image */
13250\tgenchar Ubuf[MAXLINE];\t/* used for U command */
13251\tgenchar ubuf[MAXLINE];\t/* used for u command */
13252\tgenchar Window[WINDOW+10];\t/* window image */
13253\tchar cntl_char;\t\t\t/* TRUE if control character present */
13254\tint Globals[9];\t\t\t/* local global variables */
13255#ifndef FIORDCHK
13256\tclock_t oldtime, newtime;
13257\tstruct tms dummy;
13258#endif\t/* FIORDCHK */
13259\t
13260\t/*** setup prompt ***/
13261
13262\tPrompt = prompt;
13263\ted_setup(fd);
13264
13265#ifndef RAWONLY
13266\tif( !sh_isoption(SH_VIRAW) )
13267\t{
13268\t\t/*** Change the eol characters to \'\\r\' and eof  ***/
13269\t\t/* in addition to \'\\n\' and make eof an ESC\t*/
13270
13271\t\tif( tty_alt(ERRIO) == BAD )
13272\t\t{
13273\t\t\treturn(read(fd, shbuf, nchar));
13274\t\t}
13275
13276#   ifdef FIORDCHK
13277\t\tioctl(fd,FIORDCHK,&typeahead);
13278#   else
13279\t\t/* time the current line to determine typeahead */
13280\t\toldtime = times(&dummy);
13281#   endif /* FIORDCHK */
13282#   ifdef KSHELL
13283\t\t/* abort of interrupt has occurred */
13284\t\tif(sh.trapnote&SIGSET)
13285\t\t\ti = -1;
13286\t\telse
13287#   endif /* KSHELL */
13288\t\t/*** Read the line ***/
13289\t\ti = read(fd, shbuf, nchar);
13290#   ifndef FIORDCHK
13291\t\tnewtime = times(&dummy);
13292\t\ttypeahead = ((newtime-oldtime) < NTICKS);
13293#   endif /* FIORDCHK */
13294\t    if(echoctl)
13295\t    {
13296\t\tif( i <= 0 )
13297\t\t{
13298\t\t\t/*** read error or eof typed ***/
13299\t\t\ttty_cooked(ERRIO);
13300\t\t\treturn(i);
13301\t\t}
13302\t\tterm_char = shbuf[--i];
13303\t\tif( term_char == \'\\r\' )
13304\t\t\tterm_char = \'\\n\';
13305\t\tif( term_char==\'\\n\' || term_char==ESC )
13306\t\t\tshbuf[i--] = \'\\0\';
13307\t\telse
13308\t\t\tshbuf[i+1] = \'\\0\';
13309\t    }
13310\t    else
13311\t    {
13312\t\tc = shbuf[0];
13313
13314\t\t/*** Save and remove the last character if its an eol, ***/
13315\t\t/* changing \'\\r\' to \'\\n\' */
13316
13317\t\tif( i == 0 )
13318\t\t{
13319\t\t\t/*** ESC was typed as first char of line ***/
13320\t\t\tterm_char = ESC;
13321\t\t\tshbuf[i--] = \'\\0\';\t/* null terminate line */
13322\t\t}
13323\t\telse if( i<0 || c==usreof )
13324\t\t{
13325\t\t\t/*** read error or eof typed ***/
13326\t\t\ttty_cooked(ERRIO);
13327\t\t\tif( c == usreof )
13328\t\t\t\ti = 0;
13329\t\t\treturn(i);
13330\t\t}
13331\t\telse
13332\t\t{
13333\t\t\tterm_char = shbuf[--i];
13334\t\t\tif( term_char == \'\\r\' )
13335\t\t\t\tterm_char = \'\\n\';
13336\t\t\tif( term_char==\'\\n\' || term_char==usreof )
13337\t\t\t{
13338\t\t\t\t/*** remove terminator & null terminate ***/
13339\t\t\t\tshbuf[i--] = \'\\0\';
13340\t\t\t}
13341\t\t\telse
13342\t\t\t{
13343\t\t\t\t/** terminator was ESC, which is not xmitted **/
13344\t\t\t\tterm_char = ESC;
13345\t\t\t\tshbuf[i+1] = \'\\0\';
13346\t\t\t}
13347\t\t}
13348\t    }
13349\t}
13350\telse
13351#endif\t/* RAWONLY */
13352\t{
13353\t\t/*** Set raw mode ***/
13354
13355#ifndef RAWONLY
13356\t\tif( ttyspeed == 0 )
13357\t\t{
13358\t\t\t/*** never did TCGETA, so do it ***/
13359\t\t\t/* avoids problem if user does \'sh -o viraw\' */
13360\t\t\ttty_alt(ERRIO);
13361\t\t}
13362#endif /* RAWONLY */
13363\t\tif( tty_raw(ERRIO) == BAD )
13364\t\t{
13365\t\t\treturn(read(fd, shbuf, nchar));
13366\t\t}
13367\t\ti = INVALID;
13368\t}
13369
13370\t/*** Initialize some things ***/
13371
13372\tvirtual = (genchar*)shbuf;
13373#undef virtual
13374#define virtual\t\t((genchar*)shbuf)
13375#ifdef MULTIBYTE
13376\tshbuf[i+1] = 0;
13377\ti = ed_internal(shbuf,virtual)-1;
13378#endif /* MULTIBYTE */
13379\tglobals = Globals;
13380\tcur_phys = i + 1;
13381\tcur_virt = i;
13382\tfildes = fd;
13383\tfirst_virt = 0;
13384\tfirst_wind = 0;
13385\tlast_virt = i;
13386\tlast_phys = i;
13387\tlast_wind = i;
13388\tlong_line = \' \';
13389\tlong_char = \' \';
13390\to_v_char = \'\\0\';
13391\tocur_phys = 0;
13392\tin_raw = 0;
13393\tocur_virt = MAXCHAR;
13394\tofirst_wind = 0;
13395\tphysical = Physical;
13396\tu_column = INVALID - 1;
13397\tU_space = Ubuf;
13398\tu_space = ubuf;
13399\twindow = Window;
13400\twindow[0] = \'\\0\';
13401
13402#if KSHELL && (2*CHARSIZE*MAXLINE)<IOBSIZE
13403\tyankbuf = shbuf + MAXLINE*sizeof(genchar);
13404#else
13405\tif(yankbuf==0)
13406\t\tyankbuf = (genchar*)malloc(sizeof(genchar)*(MAXLINE));
13407#endif
13408#if KSHELL && (3*CHARSIZE*MAXLINE)<IOBSIZE
13409\tlastline = shbuf + (MAXLINE+MAXLINE)*sizeof(genchar);
13410#else
13411\tif(lastline==0)
13412\t\tlastline = (genchar*)malloc(sizeof(genchar)*(MAXLINE));
13413#endif
13414\tif( last_cmd == \'\\0\' )
13415\t{
13416\t\t/*** first time for this shell ***/
13417
13418\t\tlast_cmd = \'i\';
13419\t\tfindchar = INVALID;
13420\t\tlastmotion = \'\\0\';
13421\t\tlastrepeat = 1;
13422\t\trepeat = 1;
13423\t\t*yankbuf = 0;
13424\t}
13425
13426\t/*** fiddle around with prompt length ***/
13427\tif( nchar+plen > MAXCHAR )
13428\t\tnchar = MAXCHAR - plen;
13429\tmax_col = nchar - 2;
13430
13431#ifndef RAWONLY
13432\tif( !sh_isoption(SH_VIRAW) )
13433\t{
13434\t\tint kill_erase = 0;
13435#   ifndef ECHOCTL
13436\t\tcntl_char = FALSE;
13437#   endif /* !ECHOCTL */
13438\t\tfor(i=(echoctl?last_virt:0); i<=last_virt; ++i )
13439\t\t{
13440\t\t\t/*** change \\r to
13441, check for control characters, ***/
13442\t\t\t/* delete appropriate ^Vs,\t\t\t*/
13443\t\t\t/* and estimate last physical column */
13444
13445\t\t\tif( virtual[i] == \'\\r\' )
13446\t\t\t\tvirtual[i] = \'\\n\';
13447\t\t    if(!echoctl)
13448\t\t    {
13449\t\t\tc = virtual[i];
13450\t\t\tif( c==usrerase || c==usrkill )
13451\t\t\t{
13452\t\t\t\t/*** user typed escaped erase or kill char ***/
13453\t\t\t\tcntl_char = TRUE;
13454\t\t\t\tif(is_print(c))
13455\t\t\t\t\tkill_erase++;
13456\t\t\t}
13457\t\t\telse if( !is_print(c) )
13458\t\t\t{
13459\t\t\t\tcntl_char = TRUE;
13460
13461\t\t\t\tif( c == cntl(\'V\') )
13462\t\t\t\t{
13463\t\t\t\t\tif( i == last_virt )
13464\t\t\t\t\t{
13465\t\t\t\t\t\t/*** eol/eof was escaped ***/
13466\t\t\t\t\t\t/* so replace ^V with it */
13467\t\t\t\t\t\tvirtual[i] = term_char;
13468\t\t\t\t\t\tbreak;
13469\t\t\t\t\t}
13470
13471\t\t\t\t\t/*** delete ^V ***/
13472\t\t\t\t\tgencpy((&virtual[i]), (&virtual[i+1]));
13473\t\t\t\t\t--cur_virt;
13474\t\t\t\t\t--last_virt;
13475\t\t\t\t}
13476\t\t\t}
13477\t\t    }
13478\t\t}
13479
13480\t\t/*** copy virtual image to window ***/
13481\t\tif(last_virt > 0)
13482\t\t\tlast_phys = ed_virt_to_phys(virtual,physical,last_virt,0,0);
13483\t\tif( last_phys >= w_size )
13484\t\t{
13485\t\t\t/*** line longer than window ***/
13486\t\t\tlast_wind = w_size - 1;
13487\t\t}
13488\t\telse
13489\t\t\tlast_wind = last_phys;
13490\t\tgenncpy(window, virtual, last_wind+1);
13491
13492\t\tif( term_char!=ESC  && (last_virt==INVALID
13493\t\t\t|| virtual[last_virt]!=term_char) )
13494\t\t{
13495\t\t\t/*** Line not terminated with ESC or escaped (^V) ***/
13496\t\t\t/* eol, so return after doing a total update */
13497\t\t\t/* if( (speed is greater or equal to 1200 */
13498\t\t\t/* and something was typed) and */
13499\t\t\t/* (control character present */
13500\t\t\t/* or typeahead occurred) ) */
13501
13502\t\t\ttty_cooked(ERRIO);
13503\t\t\tif( ttyspeed==FAST && last_virt!=INVALID
13504# ifdef ECHOCTL
13505\t\t\t\t&& typeahead)
13506# else
13507\t\t\t\t&& (typeahead || cntl_char==TRUE) )
13508# endif /*ECHOCTL */
13509\t\t\t{
13510\t\t\t\trefresh(TRANSLATE);
13511\t\t\t\tpr_prompt();
13512\t\t\t\tputstring(0, last_phys+1);
13513\t\t\t\tif(echoctl)
13514\t\t\t\t\tcrlf;
13515\t\t\t\telse
13516\t\t\t\t\twhile(kill_erase-- > 0)
13517\t\t\t\t\t\tputchar(\' \');
13518\t\t\t}
13519
13520\t\t\tif( term_char==\'\\n\' )
13521\t\t\t{
13522\t\t\t\tif(!echoctl)
13523\t\t\t\t\tcrlf;
13524\t\t\t\tvirtual[++last_virt] = \'\\n\';
13525\t\t\t}
13526\t\t\tlast_cmd = \'i\';
13527\t\t\tsave_last();
13528#ifdef MULTIBYTE
13529\t\t\tvirtual[last_virt+1] = 0;
13530\t\t\tlast_virt = ed_external(virtual,shbuf);
13531\t\t\treturn(last_virt);
13532#else
13533\t\t\treturn(++last_virt);
13534#endif /* MULTIBYTE */
13535\t\t}
13536
13537\t\t/*** Line terminated with escape, or escaped eol/eof, ***/
13538\t\t/*  so set raw mode */
13539
13540\t\tif( tty_raw(ERRIO) == BAD )
13541\t\t{
13542\t\t\ttty_cooked(ERRIO);
13543\t\t\tvirtual[++last_virt] = \'\\n\';
13544#ifdef MULTIBYTE
13545\t\t\tvirtual[last_virt+1] = 0;
13546\t\t\tlast_virt = ed_external(virtual,shbuf);
13547\t\t\treturn(last_virt);
13548#else
13549\t\t\treturn(++last_virt);
13550#endif /* MULTIBYTE */
13551\t\t}
13552
13553\t\tif(echoctl) /*** for cntl-echo erase the ^[ ***/
13554\t\t\tpr_string("\\b\\b  \\b\\b");
13555
13556
13557\t\tif( crallowed == YES )
13558\t\t{
13559\t\t\t/*** start over since there may be ***/
13560\t\t\t/*** a control char, or cursor might not ***/
13561\t\t\t/*** be at left margin (this lets us know ***/
13562\t\t\t/*** where we are ***/
13563\t\t\tcur_phys = 0;
13564\t\t\twindow[0] = \'\\0\';
13565\t\t\tpr_prompt();
13566\t\t\tif( term_char==ESC && virtual[last_virt]!=ESC )
13567\t\t\t\trefresh(CONTROL);
13568\t\t\telse
13569\t\t\t\trefresh(INPUT);
13570\t\t}
13571\t\telse
13572\t\t{
13573\t\t\t/*** just update everything internally ***/
13574\t\t\trefresh(TRANSLATE);
13575\t\t}
13576\t}
13577\telse
13578#endif\t/* RAWONLY */
13579\t\tvirtual[0] = \'\\0\';
13580
13581\t/*** Handle usrintr, usrquit, or EOF ***/
13582
13583\ti = SETJMP(env);
13584\tif( i != 0 )
13585\t{
13586\t\tvirtual[0] = \'\\0\';
13587\t\ttty_cooked(ERRIO);
13588
13589\t\tswitch(i)
13590\t\t{
13591\t\tcase UEOF:
13592\t\t\t/*** EOF ***/
13593\t\t\treturn(0);
13594
13595\t\tcase UINTR:
13596\t\t\t/** interrupt **/
13597\t\t\treturn(SYSERR);
13598\t\t}
13599\t\treturn(SYSERR);
13600\t}
13601
13602\t/*** Get a line from the terminal ***/
13603
13604\tU_saved = FALSE;
13605
13606#ifdef RAWONLY
13607\tgetline(APPEND);
13608#else
13609\tif( sh_isoption(SH_VIRAW) || virtual[last_virt]==term_char )
13610\t\tgetline(APPEND);
13611\telse
13612\t\tgetline(ESC);
13613#endif\t/* RAWONLY */
13614
13615\t/*** add a new line if user typed unescaped
13616 ***/
13617\t/* to cause the shell to process the line */
13618\ttty_cooked(ERRIO);
13619\tif( addnl )
13620\t{
13621\t\tvirtual[++last_virt] = \'\\n\';
13622\t\tcrlf;
13623\t}
13624\tif( ++last_virt >= 0 )
13625\t{
13626#ifdef MULTIBYTE
13627\t\tif(bigvi)
13628\t\t{
13629\t\t\tbigvi = 0;
13630\t\t\tshbuf[last_virt-1] = \'\\n\';
13631\t\t}
13632\t\telse
13633\t\t{
13634\t\t\tvirtual[last_virt] = 0;
13635\t\t\tlast_virt = ed_external(virtual,shbuf);
13636\t\t}
13637#endif /* MULTIBYTE */
13638\t\treturn(last_virt);
13639\t}
13640\telse
13641\t\treturn(SYSERR);
13642}
13643
13644
13645/*{\tAPPEND( char, mode )
13646 *
13647 *\tThis routine will append char after cur_virt in the virtual image.
13648 * mode\t=\tAPPEND, shift chars right before appending
13649 *\t\tREPLACE, replace char if possible
13650 *
13651}*/
13652
13653#undef virtual
13654#define virtual\t\teditb.e_inbuf\t/* pointer to virtual image buffer */
13655
13656static void append(int c, int mode)
13657{
13658\tregister int i;
13659
13660\tif( last_virt<max_col && last_phys<max_col )
13661\t{
13662\t\tif( mode==APPEND || cur_virt==last_virt )
13663\t\t{
13664\t\t\tfor(i = ++last_virt;  i > cur_virt; --i)
13665\t\t\t{
13666\t\t\t\tvirtual[i] = virtual[i-1];
13667\t\t\t}
13668\t\t}
13669\t\tvirtual[++cur_virt] = c;
13670\t}
13671\telse
13672\t\tbell;
13673\treturn;
13674}
13675
13676/*{\tBACKWORD( nwords, cmd )
13677 *
13678 *\tThis routine will position cur_virt at the nth previous word.
13679 *
13680}*/
13681
13682static void backword(int nwords, register int cmd)
13683{
13684\tregister int tcur_virt = cur_virt;
13685\twhile( nwords-- && tcur_virt > first_virt )
13686\t{
13687\t\tif( !isblank(tcur_virt) && isblank(tcur_virt-1)
13688\t\t\t&& tcur_virt>first_virt )
13689\t\t\t--tcur_virt;
13690\t\telse if(cmd != \'B\')
13691\t\t{
13692\t\t\tregister int last = isalph(tcur_virt-1);
13693\t\t\tif((!isalph(tcur_virt) && last)
13694\t\t\t|| (isalph(tcur_virt) && !last))
13695\t\t\t\t--tcur_virt;
13696\t\t}
13697\t\twhile( isblank(tcur_virt) && tcur_virt>=first_virt )
13698\t\t\t--tcur_virt;
13699\t\tif( cmd == \'B\' )
13700\t\t{
13701\t\t\twhile( !isblank(tcur_virt) && tcur_virt>=first_virt )
13702\t\t\t\t--tcur_virt;
13703\t\t}
13704\t\telse
13705\t\t{
13706\t\t\tif( isalph(tcur_virt) )
13707\t\t\t\twhile( isalph(tcur_virt) && tcur_virt>=first_virt )
13708\t\t\t\t\t--tcur_virt;
13709\t\t\telse
13710\t\t\t\twhile( !isalph(tcur_virt) && !isblank(tcur_virt)
13711\t\t\t\t\t&& tcur_virt>=first_virt )
13712\t\t\t\t\t--tcur_virt;
13713\t\t}
13714\t\tcur_virt = ++tcur_virt;
13715\t}
13716\treturn;
13717}
13718
13719/*{\tCNTLMODE()
13720 *
13721 *\tThis routine implements the vi command subset.
13722 *\tThe cursor will always be positioned at the char of interest.
13723 *
13724}*/
13725
13726static int cntlmode(void)
13727{
13728\tregister int c;
13729\tregister int i;
13730\tgenchar tmp_u_space[MAXLINE];\t/* temporary u_space */
13731\tgenchar *real_u_space;\t\t/* points to real u_space */
13732\tint tmp_u_column = INVALID;\t/* temporary u_column */
13733\tint was_inmacro;
13734
13735\tif( U_saved == FALSE )
13736\t{
13737\t\t/*** save virtual image if never done before ***/
13738\t\tvirtual[last_virt+1] = \'\\0\';
13739\t\tgencpy(U_space, virtual);
13740\t\tU_saved = TRUE;
13741\t}
13742
13743\tsave_last();
13744
13745\treal_u_space = u_space;
13746\tcurhline = histmax;
13747\tfirst_virt = 0;
13748\trepeat = 1;
13749\tif( cur_virt > INVALID )
13750\t{
13751\t\t/*** make sure cursor is at the last char ***/
13752\t\tsync_cursor();
13753\t}
13754
13755\t/*** Read control char until something happens to cause a ***/
13756\t/* return to APPEND/REPLACE mode\t*/
13757
13758\twhile( c=getchar() )
13759\t{
13760\t\trepeat_set = 0;
13761\t\twas_inmacro = inmacro;
13762\t\tif( c == \'0\' )
13763\t\t{
13764\t\t\t/*** move to leftmost column ***/
13765\t\t\tcur_virt = 0;
13766\t\t\tsync_cursor();
13767\t\t\tcontinue;
13768\t\t}
13769
13770\t\tif( digit(c) )
13771\t\t{
13772\t\t\tlastrepeat = repeat;
13773\t\t\tc = getcount(c);
13774\t\t\tif( c == \'.\' )
13775\t\t\t\tlastrepeat = repeat;
13776\t\t}
13777
13778\t\t/*** see if it\'s a move cursor command ***/
13779
13780\t\tif( mvcursor(c) == GOOD )
13781\t\t{
13782\t\t\tsync_cursor();
13783\t\t\trepeat = 1;
13784\t\t\tcontinue;
13785\t\t}
13786
13787\t\t/*** see if it\'s a repeat of the last command ***/
13788
13789\t\tif( c == \'.\' )
13790\t\t{
13791\t\t\tc = last_cmd;
13792\t\t\trepeat = lastrepeat;
13793\t\t\ti = textmod(c, c);
13794\t\t}
13795\t\telse
13796\t\t{
13797\t\t\ti = textmod(c, 0);
13798\t\t}
13799
13800\t\t/*** see if it\'s a text modification command ***/
13801
13802\t\tswitch(i)
13803\t\t{
13804\t\tcase BAD:
13805\t\t\tbreak;
13806
13807\t\tdefault:\t\t/** input mode **/
13808\t\t\tif(!was_inmacro)
13809\t\t\t{
13810\t\t\t\tlast_cmd = c;
13811\t\t\t\tlastrepeat = repeat;
13812\t\t\t}
13813\t\t\trepeat = 1;
13814\t\t\tif( i == GOOD )
13815\t\t\t\tcontinue;
13816\t\t\treturn(i);
13817\t\t}
13818
13819\t\tswitch( c )
13820\t\t{
13821\t\t\t/***** Other stuff *****/
13822
13823\t\tcase cntl(\'L\'):\t\t/** Redraw line **/
13824\t\t\t/*** print the prompt and ***/
13825\t\t\t/* force a total refresh */
13826\t\t\tif(nonewline==0)
13827\t\t\t\tputchar(\'\\n\');
13828\t\t\tnonewline = 0;
13829\t\t\tpr_prompt();
13830\t\t\twindow[0] = \'\\0\';
13831\t\t\tcur_phys = first_wind;
13832\t\t\tofirst_wind = INVALID;
13833\t\t\tlong_line = \' \';
13834\t\t\tbreak;
13835
13836\t\tcase cntl(\'V\'):
13837\t\t{
13838\t\t\tregister const char *p = &e_version[5];
13839\t\t\tsave_v();
13840\t\t\tdel_line(BAD);
13841\t\t\twhile(c = *p++)
13842\t\t\t\tappend(c,APPEND);
13843\t\t\trefresh(CONTROL);
13844\t\t\ted_getchar();
13845\t\t\trestore_v();
13846\t\t\tbreak;
13847\t\t}
13848
13849\t\tcase \'/\':\t\t/** Search **/
13850\t\tcase \'?\':
13851\t\tcase \'N\':
13852\t\tcase \'n\':
13853\t\t\tsave_v();
13854\t\t\tswitch( search(c) )
13855\t\t\t{
13856\t\t\tcase GOOD:
13857\t\t\t\t/*** force a total refresh ***/
13858\t\t\t\twindow[0] = \'\\0\';
13859\t\t\t\tgoto newhist;
13860
13861\t\t\tcase BAD:
13862\t\t\t\t/*** no match ***/
13863\t\t\t\t\tbell;
13864
13865\t\t\tdefault:
13866\t\t\t\tif( u_column == INVALID )
13867\t\t\t\t\tdel_line(BAD);
13868\t\t\t\telse
13869\t\t\t\t\trestore_v();
13870\t\t\t\tbreak;
13871\t\t\t}
13872\t\t\tbreak;
13873
13874\t\tcase \'j\':\t\t/** get next command **/
13875\t\tcase \'+\':\t\t/** get next command **/
13876\t\t\tcurhline += repeat;
13877\t\t\tif( curhline > histmax )
13878\t\t\t{
13879\t\t\t\tcurhline = histmax;
13880\t\t\t\tgoto ringbell;
13881\t\t\t}
13882\t\t\telse if(curhline==histmax && tmp_u_column!=INVALID )
13883\t\t\t{
13884\t\t\t\tu_space = tmp_u_space;
13885\t\t\t\tu_column = tmp_u_column;
13886\t\t\t\trestore_v();
13887\t\t\t\tu_space = real_u_space;
13888\t\t\t\tbreak;
13889\t\t\t}
13890\t\t\tsave_v();
13891\t\t\tgoto newhist;
13892
13893\t\tcase \'k\':\t\t/** get previous command **/
13894\t\tcase \'-\':\t\t/** get previous command **/
13895\t\t\tif( curhline == histmax )
13896\t\t\t{
13897\t\t\t\tu_space = tmp_u_space;
13898\t\t\t\ti = u_column;
13899\t\t\t\tsave_v();
13900\t\t\t\tu_space = real_u_space;
13901\t\t\t\ttmp_u_column = u_column;
13902\t\t\t\tu_column = i;
13903\t\t\t}
13904
13905\t\t\tcurhline -= repeat;
13906\t\t\tif( curhline <= histmin )
13907\t\t\t{
13908\t\t\t\tcurhline = histmin + 1;
13909\t\t\t\tgoto ringbell;
13910\t\t\t}
13911\t\t\tsave_v();
13912\tnewhist:
13913\t\t\thist_copy((char*)virtual, MAXLINE, curhline, -1);
13914#ifdef MULTIBYTE
13915\t\t\ted_internal((char*)virtual,virtual);
13916#endif /* MULTIBYTE */
13917\t\t\tif( (last_virt = genlen((char*)virtual) - 1) >= 0 )
13918\t\t\t\tcur_virt = 0;
13919\t\t\telse
13920\t\t\t\tcur_virt = INVALID;
13921\t\t\tbreak;
13922
13923
13924\t\tcase \'u\':\t\t/** undo the last thing done **/
13925\t\t\trestore_v();
13926\t\t\tbreak;
13927
13928\t\tcase \'U\':\t\t/** Undo everything **/
13929\t\t\tsave_v();
13930\t\t\tif( virtual[0] == \'\\0\' )
13931\t\t\t\tgoto ringbell;
13932\t\t\telse
13933\t\t\t{
13934\t\t\t\tgencpy(virtual, U_space);
13935\t\t\t\tlast_virt = genlen(U_space) - 1;
13936\t\t\t\tcur_virt = 0;
13937\t\t\t}
13938\t\t\tbreak;
13939
13940#ifdef KSHELL
13941\t\tcase \'v\':
13942\t\t\tif(repeat_set==0)
13943\t\t\t\tgoto vcommand;
13944#endif /* KSHELL */
13945
13946\t\tcase \'G\':\t\t/** goto command repeat **/
13947\t\t\tif(repeat_set==0)
13948\t\t\t\trepeat = histmin+1;
13949\t\t\tif( repeat <= histmin || repeat > histmax )
13950\t\t\t{
13951\t\t\t\tgoto ringbell;
13952\t\t\t}
13953\t\t\tcurhline = repeat;
13954\t\t\tsave_v();
13955\t\t\tif(c == \'G\')
13956\t\t\t\tgoto newhist;
13957
13958#ifdef KSHELL
13959\t\tvcommand:
13960\t\t\tif(ed_fulledit()==GOOD)
13961\t\t\t\treturn(BIGVI);
13962\t\t\telse
13963\t\t\t\tgoto ringbell;
13964#endif\t/* KSHELL */
13965
13966\t\tcase \'#\':\t/** insert(delete) # to (no)comment command **/
13967\t\t\tif( cur_virt != INVALID )
13968\t\t\t{
13969\t\t\t\tregister genchar *p = &virtual[last_virt+1];
13970\t\t\t\t*p = 0;
13971\t\t\t\t/*** see whether first char is comment char ***/
13972\t\t\t\tc = (virtual[0]==\'#\');
13973\t\t\t\twhile(p-- >= virtual)
13974\t\t\t\t{
13975\t\t\t\t\tif(*p==\'\\n\' || *p==\';\' || *p==\'|\' || p<virtual)
13976\t\t\t\t\t{
13977\t\t\t\t\t\tif(c) /* delete \'#\' */
13978\t\t\t\t\t\t{
13979\t\t\t\t\t\t\tif(p[1]==\'#\')
13980\t\t\t\t\t\t\t{
13981\t\t\t\t\t\t\t\tlast_virt--;
13982\t\t\t\t\t\t\t\tgencpy(p+1,p+2);
13983\t\t\t\t\t\t\t}
13984\t\t\t\t\t\t}
13985\t\t\t\t\t\telse
13986\t\t\t\t\t\t{
13987\t\t\t\t\t\t\tcur_virt = p-virtual;
13988\t\t\t\t\t\t\tappend(\'#\', APPEND);
13989\t\t\t\t\t\t}
13990\t\t\t\t\t}
13991\t\t\t\t}
13992\t\t\t\tif(c)
13993\t\t\t\t{
13994\t\t\t\t\tcur_virt = 0;
13995\t\t\t\t\tbreak;
13996\t\t\t\t}
13997\t\t\t\trefresh(INPUT);
13998\t\t\t}
13999
14000\t\tcase \'\\n\':\t\t/** send to shell **/
14001\t\t\treturn(ENTER);
14002
14003\t\tdefault:
14004\t\tringbell:
14005\t\t\tbell;
14006\t\t\trepeat = 1;
14007\t\t\tcontinue;
14008\t\t}
14009
14010\t\trefresh(CONTROL);
14011\t\trepeat = 1;
14012\t}
14013/* NOTREACHED */
14014}
14015
14016/*{\tCURSOR( new_current_physical )
14017 *
14018 *\tThis routine will position the virtual cursor at
14019 * physical column x in the window.
14020 *
14021}*/
14022
14023static void cursor(register int x)
14024{
14025\tregister int delta;
14026
14027#ifdef MULTIBYTE
14028\twhile(physical[x]==MARKER)
14029\t\tx++;
14030#endif /* MULTIBYTE */
14031\tdelta = x - cur_phys;
14032
14033\tif( delta == 0 )
14034\t\treturn;
14035
14036\tif( delta > 0 )
14037\t{
14038\t\t/*** move to right ***/
14039\t\tputstring(cur_phys, delta);
14040\t}
14041\telse
14042\t{
14043\t\t/*** move to left ***/
14044
14045\t\tdelta = -delta;
14046
14047\t\t/*** attempt to optimize cursor movement ***/
14048\t\tif( crallowed==NO
14049\t\t\t|| (delta <= ((cur_phys-first_wind)+plen)>>1) )
14050\t\t{
14051\t\t\twhile( delta-- )
14052\t\t\t\tputchar(\'\\b\');
14053\t\t}
14054\t\telse
14055\t\t{
14056\t\t\tpr_prompt();
14057\t\t\tputstring(first_wind, x - first_wind);
14058\t\t}
14059\t}
14060\tcur_phys = x;
14061\treturn;
14062}
14063
14064/*{\tDELETE( nchars, mode )
14065 *
14066 *\tDelete nchars from the virtual space and leave cur_virt positioned
14067 * at cur_virt-1.
14068 *
14069 *\tIf mode\t= \'c\', do not save the characters deleted
14070 *\t\t= \'d\', save them in yankbuf and delete.
14071 *\t\t= \'y\', save them in yankbuf but do not delete.
14072 *
14073}*/
14074
14075static void cdelete(register int nchars, int mode)
14076{
14077\tregister int i;
14078\tregister genchar *vp;
14079
14080\tif( cur_virt < first_virt )
14081\t{
14082\t\tbell;
14083\t\treturn;
14084\t}
14085\tif( nchars > 0 )
14086\t{
14087\t\tvp = virtual+cur_virt;
14088\t\to_v_char = vp[0];
14089\t\tif( (cur_virt-- + nchars) > last_virt )
14090\t\t{
14091\t\t\t/*** set nchars to number actually deleted ***/
14092\t\t\tnchars = last_virt - cur_virt;
14093\t\t}
14094
14095\t\t/*** save characters to be deleted ***/
14096
14097\t\tif( mode != \'c\' )
14098\t\t{
14099\t\t\ti = vp[nchars];
14100\t\t\tvp[nchars] = 0;
14101\t\t\tgencpy(yankbuf,vp);
14102\t\t\tvp[nchars] = i;
14103\t\t}
14104
14105\t\t/*** now delete these characters ***/
14106
14107\t\tif( mode != \'y\' )
14108\t\t{
14109\t\t\tgencpy(vp,vp+nchars);
14110\t\t\tlast_virt -= nchars;
14111\t\t}
14112\t}
14113\treturn;
14114}
14115
14116/*{\tDEL_LINE( mode )
14117 *
14118 *\tThis routine will delete the line.
14119 *\tmode = GOOD, do a save_v()
14120 *
14121}*/
14122static void del_line(int mode)
14123{
14124\tif( last_virt == INVALID )
14125\t\treturn;
14126
14127\tif( mode == GOOD )
14128\t\tsave_v();
14129
14130\tcur_virt = 0;
14131\tfirst_virt = 0;
14132\tcdelete(last_virt+1, BAD);
14133\trefresh(CONTROL);
14134
14135\tcur_virt = INVALID;
14136\tcur_phys = 0;
14137\tfindchar = INVALID;
14138\tlast_phys = INVALID;
14139\tlast_virt = INVALID;
14140\tlast_wind = INVALID;
14141\tfirst_wind = 0;
14142\to_v_char = \'\\0\';
14143\tocur_phys = 0;
14144\tocur_virt = MAXCHAR;
14145\tofirst_wind = 0;
14146\twindow[0] = \'\\0\';
14147\treturn;
14148}
14149
14150/*{\tDELMOTION( motion, mode )
14151 *
14152 *\tDelete thru motion.
14153 *
14154 *\tmode\t= \'d\', save deleted characters, delete
14155 *\t\t= \'c\', do not save characters, change
14156 *\t\t= \'y\', save characters, yank
14157 *
14158 *\tReturns GOOD if operation successful; else BAD.
14159 *
14160}*/
14161
14162static int delmotion(int motion, int mode)
14163{
14164\tregister int begin;
14165\tregister int end;
14166\t/* the following saves a register */
14167#       define delta end
14168
14169\tif( cur_virt == INVALID )
14170\t\treturn(BAD);
14171\tif( mode != \'y\' )
14172\t\tsave_v();
14173\tbegin = cur_virt;
14174
14175\t/*** fake out the motion routines by appending a blank ***/
14176
14177\tvirtual[++last_virt] = \' \';
14178\tend = mvcursor(motion);
14179\tvirtual[last_virt--] = 0;
14180\tif(end==BAD)
14181\t\treturn(BAD);
14182
14183\tend = cur_virt;
14184\tif( mode==\'c\' && end>begin && strchr("wW", motion) )
14185\t{
14186\t\t/*** called by change operation, user really expects ***/
14187\t\t/* the effect of the eE commands, so back up to end of word */
14188\t\twhile( end>begin && isblank(end-1) )
14189\t\t\t--end;
14190\t\tif( end == begin )
14191\t\t\t++end;
14192\t}
14193
14194\tdelta = end - begin;
14195\tif( delta >= 0 )
14196\t{
14197\t\tcur_virt = begin;
14198\t\tif( strchr("eE;,TtFf%", motion) )
14199\t\t\t++delta;
14200\t}
14201\telse
14202\t{
14203\t\tdelta = -delta;
14204\t}
14205
14206\tcdelete(delta, mode);
14207\tif( mode == \'y\' )
14208\t\tcur_virt = begin;
14209#       undef delta
14210\treturn(GOOD);
14211}
14212
14213
14214/*{\tENDWORD( nwords, cmd )
14215 *
14216 *\tThis routine will move cur_virt to the end of the nth word.
14217 *
14218}*/
14219
14220static void endword(int nwords, register int cmd)
14221{
14222\tregister int tcur_virt = cur_virt;
14223\twhile( nwords-- )
14224\t{
14225\t\tif( !isblank(tcur_virt) && tcur_virt<=last_virt )
14226\t\t\t++tcur_virt;
14227\t\twhile( isblank(tcur_virt) && tcur_virt<=last_virt )
14228\t\t\t++tcur_virt;\t
14229\t\tif( cmd == \'E\' )
14230\t\t{
14231\t\t\twhile( !isblank(tcur_virt) && tcur_virt<=last_virt )
14232\t\t\t\t++tcur_virt;
14233\t\t}
14234\t\telse
14235\t\t{
14236\t\t\tif( isalph(tcur_virt) )
14237\t\t\t\twhile( isalph(tcur_virt) && tcur_virt<=last_virt )
14238\t\t\t\t\t++tcur_virt;
14239\t\t\telse
14240\t\t\t\twhile( !isalph(tcur_virt) && !isblank(tcur_virt)
14241\t\t\t\t\t&& tcur_virt<=last_virt )
14242\t\t\t\t\t++tcur_virt;
14243\t\t}
14244\t\tif( tcur_virt > first_virt )
14245\t\t\ttcur_virt--;
14246\t}
14247\tcur_virt = tcur_virt;
14248\treturn;
14249}
14250
14251/*{\tFORWARD( nwords, cmd )
14252 *
14253 *\tThis routine will move cur_virt forward to the next nth word.
14254 *
14255}*/
14256
14257static void forward(register int nwords, int cmd)
14258{
14259\tregister int tcur_virt = cur_virt;
14260\twhile( nwords-- )
14261\t{
14262\t\tif( cmd == \'W\' )
14263\t\t{
14264\t\t\twhile( !isblank(tcur_virt) && tcur_virt < last_virt )
14265\t\t\t\t++tcur_virt;
14266\t\t}
14267\t\telse
14268\t\t{
14269\t\t\tif( isalph(tcur_virt) )
14270\t\t\t{
14271\t\t\t\twhile( isalph(tcur_virt) && tcur_virt<last_virt )
14272\t\t\t\t\t++tcur_virt;
14273\t\t\t}
14274\t\t\telse
14275\t\t\t{
14276\t\t\t\twhile( !isalph(tcur_virt) && !isblank(tcur_virt)
14277\t\t\t\t\t&& tcur_virt < last_virt )
14278\t\t\t\t\t++tcur_virt;
14279\t\t\t}
14280\t\t}
14281\t\twhile( isblank(tcur_virt) && tcur_virt < last_virt )
14282\t\t\t++tcur_virt;
14283\t}
14284\tcur_virt = tcur_virt;
14285\treturn;
14286}
14287
14288
14289
14290/*{\tGETCOUNT(c)
14291 *
14292 *\tSet repeat to the user typed number and return the terminating
14293 * character.
14294 *
14295}*/
14296
14297static int getcount(register int c)
14298{
14299\tregister int i;
14300
14301\t/*** get any repeat count ***/
14302
14303\tif( c == \'0\' )
14304\t\treturn(c);
14305
14306\trepeat_set++;
14307\ti = 0;
14308\twhile( digit(c) )
14309\t{
14310\t\ti = i*10 + c - \'0\';
14311\t\tc = getchar();
14312\t}
14313
14314\tif( i > 0 )
14315\t\trepeat *= i;
14316\treturn(c);
14317}
14318
14319
14320/*{\tGETLINE( mode )
14321 *
14322 *\tThis routine will fetch a line.
14323 *\tmode\t= APPEND, allow escape to cntlmode subroutine
14324 *\t\t  appending characters.
14325 *\t\t= REPLACE, allow escape to cntlmode subroutine
14326 *\t\t  replacing characters.
14327 *\t\t= SEARCH, no escape allowed
14328 *\t\t= ESC, enter control mode immediately
14329 *
14330 *\tThe cursor will always be positioned after the last
14331 * char printed.
14332 *
14333 *\tThis routine returns when cr, nl, or (eof in column 0) is
14334 * received (column 0 is the first char position).
14335 *
14336}*/
14337
14338static void getline(register int mode)
14339{
14340\tregister int c;
14341\tregister int tmp;
14342
14343\taddnl = TRUE;
14344
14345\tif( mode == ESC )
14346\t{
14347\t\t/*** go directly to control mode ***/
14348\t\tgoto escape;
14349\t}
14350
14351\tfor(;;)
14352\t{
14353\t\tif( (c = getchar()) == cntl(\'V\') )
14354\t\t{
14355\t\t\t/*** implement ^V to escape next char ***/
14356\t\t\tin_raw++;
14357\t\t\tc = getchar();
14358\t\t\tin_raw = 0;
14359\t\t\tappend(c, mode);
14360\t\t\trefresh(INPUT);
14361\t\t\tcontinue;
14362\t\t}
14363
14364\t\tif( c == usreof )
14365\t\t\tc = UEOF;
14366\t\telse if( c == usrerase )
14367\t\t\tc = UERASE;
14368\t\telse if( c == usrkill )
14369\t\t\tc = UKILL;
14370
14371\t\tswitch( c )
14372\t\t{
14373\t\tcase ESC:\t\t/** enter control mode **/
14374\t\t\tif( mode == SEARCH )
14375\t\t\t{
14376\t\t\t\tbell;
14377\t\t\t\tcontinue;
14378\t\t\t}
14379\t\t\telse
14380\t\t\t{
14381\tescape:
14382\t\t\t\tif( mode == REPLACE )
14383\t\t\t\t\t--cur_virt;
14384\t\t\t\ttmp = cntlmode();
14385\t\t\t\tif( tmp == ENTER || tmp == BIGVI )
14386\t\t\t\t{
14387#ifdef MULTIBYTE
14388\t\t\t\t\tbigvi = (tmp==BIGVI);
14389#endif /* MULTIBYTE */
14390\t\t\t\t\treturn;
14391\t\t\t\t}
14392\t\t\t\tif( tmp == INSERT )
14393\t\t\t\t{
14394\t\t\t\t\tmode = APPEND;
14395\t\t\t\t\tcontinue;
14396\t\t\t\t}
14397\t\t\t\tmode = tmp;
14398\t\t\t}
14399\t\t\tbreak;
14400
14401\t\tcase UERASE:\t\t/** user erase char **/
14402\t\t\t\t/*** treat as backspace ***/
14403
14404\t\tcase \'\\b\':\t\t/** backspace **/
14405\t\t\tif( virtual[cur_virt] == \'\\\\\' )
14406\t\t\t{
14407\t\t\t\tcdelete(1, BAD);
14408\t\t\t\tappend(usrerase, mode);
14409\t\t\t}
14410\t\t\telse
14411\t\t\t{
14412\t\t\t\tif( mode==SEARCH && cur_virt==0 )
14413\t\t\t\t{
14414\t\t\t\t\tfirst_virt = 0;
14415\t\t\t\t\tcdelete(1, BAD);
14416\t\t\t\t\treturn;
14417\t\t\t\t}
14418\t\t\t\tcdelete(1, BAD);
14419\t\t\t}
14420\t\t\tbreak;
14421
14422\t\tcase cntl(\'W\'):\t\t/** delete back word **/
14423\t\t\tif( cur_virt > first_virt && isblank(cur_virt-1) )
14424\t\t\t{
14425\t\t\t\tcdelete(1, BAD);
14426\t\t\t}
14427\t\t\telse
14428\t\t\t{
14429\t\t\t\ttmp = cur_virt;
14430\t\t\t\tbackword(1, \'b\');
14431\t\t\t\tcdelete(tmp - cur_virt + 1, BAD);
14432\t\t\t}
14433\t\t\tbreak;
14434
14435\t\tcase UKILL:\t\t/** user kill line char **/
14436\t\t\tif( virtual[cur_virt] == \'\\\\\' )
14437\t\t\t{
14438\t\t\t\tcdelete(1, BAD);
14439\t\t\t\tappend(usrkill, mode);
14440\t\t\t}
14441\t\t\telse
14442\t\t\t{
14443\t\t\t\tif( mode == SEARCH )
14444\t\t\t\t{
14445\t\t\t\t\tcur_virt = 1;
14446\t\t\t\t\tdelmotion(\'$\', BAD);
14447\t\t\t\t}
14448\t\t\t\telse if(first_virt)
14449\t\t\t\t{
14450\t\t\t\t\ttmp = cur_virt;
14451\t\t\t\t\tcur_virt = first_virt;
14452\t\t\t\t\tcdelete(tmp - cur_virt + 1, BAD);
14453\t\t\t\t}
14454\t\t\t\telse
14455\t\t\t\t\tdel_line(GOOD);
14456\t\t\t}
14457\t\t\tbreak;
14458
14459\t\tcase UEOF:\t\t/** eof char **/
14460\t\t\tif( cur_virt != INVALID )
14461\t\t\t\tcontinue;
14462\t\t\taddnl = FALSE;
14463
14464\t\tcase \'\\n\':\t\t/** newline or return **/
14465\t\t\tif( mode != SEARCH )
14466\t\t\t\tsave_last();
14467\t\t\treturn;
14468
14469\t\tdefault:
14470\t\t\tif( mode == REPLACE )
14471\t\t\t{
14472\t\t\t\tif( cur_virt < last_virt )
14473\t\t\t\t{
14474\t\t\t\t\treplace(c, TRUE);
14475\t\t\t\t\tcontinue;
14476\t\t\t\t}
14477\t\t\t\tcdelete(1, BAD);
14478\t\t\t\tmode = APPEND;
14479\t\t\t}
14480\t\t\tappend(c, mode);
14481\t\t\tbreak;
14482\t\t}
14483\t\trefresh(INPUT);
14484
14485\t}
14486}
14487
14488/*{\tMVCURSOR( motion )
14489 *
14490 *\tThis routine will move the virtual cursor according to motion
14491 * for repeat times.
14492 *
14493 * It returns GOOD if successful; else BAD.
14494 *
14495}*/
14496
14497static int mvcursor(register int motion)
14498{
14499\tregister int count;
14500\tregister int tcur_virt;
14501\tregister int incr = -1;
14502\tregister int bound = 0;
14503\tstatic int last_find = 0;\t/* last find command */
14504
14505\tswitch(motion)
14506\t{
14507\t\t/***** Cursor move commands *****/
14508
14509\tcase \'0\':\t\t/** First column **/
14510\t\ttcur_virt = 0;
14511\t\tbreak;
14512
14513\tcase \'^\':\t\t/** First nonblank character **/
14514\t\ttcur_virt = first_virt;
14515\t\twhile( isblank(tcur_virt) && tcur_virt < last_virt )
14516\t\t\t++tcur_virt;
14517\t\tbreak;
14518
14519\tcase \'|\':
14520\t\ttcur_virt = repeat-1;
14521\t\tif(tcur_virt <= last_virt)
14522\t\t\tbreak;
14523\t\t/* fall through */
14524
14525\tcase \'$\':\t\t/** End of line **/
14526\t\ttcur_virt = last_virt;
14527\t\tbreak;
14528
14529\tcase \'h\':\t\t/** Left one **/
14530\tcase \'\\b\':
14531\t\tmotion = first_virt;
14532\t\tgoto walk;
14533
14534\tcase \' \':
14535\tcase \'l\':\t\t/** Right one **/
14536\t\tmotion = last_virt;
14537\t\tincr = 1;
14538\twalk:
14539\t\ttcur_virt = cur_virt;
14540\t\tif( incr*tcur_virt < motion)
14541\t\t{
14542\t\t\ttcur_virt += repeat*incr;
14543\t\t\tif( incr*tcur_virt > motion)
14544\t\t\t\ttcur_virt = motion;
14545\t\t}
14546\t\telse
14547\t\t{
14548\t\t\treturn(BAD);
14549\t\t}
14550\t\tbreak;
14551
14552\tcase \'B\':
14553\tcase \'b\':\t\t/** back word **/
14554\t\ttcur_virt = cur_virt;
14555\t\tbackword(repeat, motion);
14556\t\tif( cur_virt == tcur_virt )
14557\t\t\treturn(BAD);
14558\t\treturn(GOOD);
14559
14560\tcase \'E\':
14561\tcase \'e\':\t\t/** end of word **/
14562\t\ttcur_virt = cur_virt;
14563\t\tif(tcur_virt >=0)
14564\t\t\tendword(repeat, motion);
14565\t\tif( cur_virt == tcur_virt )
14566\t\t\treturn(BAD);
14567\t\treturn(GOOD);
14568
14569\tcase \',\':\t\t/** reverse find old char **/
14570\tcase \';\':\t\t/** find old char **/
14571\t\tswitch(last_find)
14572\t\t{
14573\t\tcase \'t\':
14574\t\tcase \'f\':
14575\t\t\tif(motion==\';\')
14576\t\t\t{
14577\t\t\t\tbound = last_virt;
14578\t\t\t\tincr = 1;
14579\t\t\t}
14580\t\t\tgoto find_b;
14581
14582\t\tcase \'T\':
14583\t\tcase \'F\':
14584\t\t\tif(motion==\',\')
14585\t\t\t{
14586\t\t\t\tbound = last_virt;
14587\t\t\t\tincr = 1;
14588\t\t\t}
14589\t\t\tgoto find_b;
14590
14591\t\tdefault:
14592\t\t\treturn(BAD);
14593\t\t}
14594
14595
14596\tcase \'t\':\t\t/** find up to new char forward **/
14597\tcase \'f\':\t\t/** find new char forward **/
14598\t\tbound = last_virt;
14599\t\tincr = 1;
14600
14601\tcase \'T\':\t\t/** find up to new char backward **/
14602\tcase \'F\':\t\t/** find new char backward **/
14603\t\tlast_find = motion;
14604\t\tif((findchar=getrchar())==ESC)
14605\t\t\treturn(GOOD);
14606find_b:
14607\t\ttcur_virt = cur_virt;
14608\t\tcount = repeat;
14609\t\twhile( count-- )
14610\t\t{
14611\t\t\twhile( incr*(tcur_virt+=incr) <= bound
14612\t\t\t\t&& virtual[tcur_virt] != findchar );
14613\t\t\tif( incr*tcur_virt > bound )
14614\t\t\t{
14615\t\t\t\treturn(BAD);
14616\t\t\t}
14617\t\t}
14618\t\tif( fold(last_find) == \'T\' )
14619\t\t\ttcur_virt -= incr;
14620\t\tbreak;
14621
14622\t/* new, undocumented feature */
14623        case \'%\':
14624\t{
14625\t\tint nextmotion;
14626\t\tint nextc;
14627\t\ttcur_virt = cur_virt;
14628\t\twhile( tcur_virt <= last_virt
14629\t\t\t&& strchr(paren_chars,virtual[tcur_virt])==(char*)0)
14630\t\t\t\ttcur_virt++;
14631\t\tif(tcur_virt > last_virt )
14632\t\t\treturn(BAD);
14633\t\tnextc = virtual[tcur_virt];
14634\t\tcount = strchr(paren_chars,nextc)-paren_chars;
14635\t\tif(count < 3)
14636\t\t{
14637\t\t\tincr = 1;
14638\t\t\tbound = last_virt;
14639\t\t\tnextmotion = paren_chars[count+3];
14640\t\t}
14641\t\telse
14642\t\t\tnextmotion = paren_chars[count-3];
14643\t\tcount = 1;
14644\t\twhile(count >0 &&  incr*(tcur_virt+=incr) <= bound)
14645\t\t{
14646\t\t        if(virtual[tcur_virt] == nextmotion)
14647\t\t        \tcount--;
14648\t\t        else if(virtual[tcur_virt]==nextc)
14649\t\t        \tcount++;
14650\t\t}
14651\t\tif(count)
14652\t\t\treturn(BAD);
14653\t\tbreak;
14654\t}
14655
14656\tcase \'W\':
14657\tcase \'w\':\t\t/** forward word **/
14658\t\ttcur_virt = cur_virt;
14659\t\tforward(repeat, motion);
14660\t\tif( tcur_virt == cur_virt )
14661\t\t\treturn(BAD);
14662\t\treturn(GOOD);
14663
14664\tdefault:
14665\t\treturn(BAD);
14666\t}
14667\tcur_virt = tcur_virt;
14668
14669\treturn(GOOD);
14670}
14671
14672/*{\tPR_PROMPT()
14673 *
14674 *\tPrint the prompt.
14675 *
14676}*/
14677
14678static void pr_prompt(void)
14679{
14680\tpr_string(Prompt);
14681\treturn;
14682}
14683
14684/*
14685 * print a string
14686 */
14687
14688static void pr_string(register const char *sp)
14689{
14690\t/*** copy string sp ***/
14691\tregister char *ptr = editb.e_outptr;
14692\twhile(*sp)
14693\t\t*ptr++ = *sp++;
14694\teditb.e_outptr = ptr;
14695\treturn;
14696}
14697
14698/*{\tPUTSTRING( column, nchars )
14699 *
14700 *\tPut nchars starting at column of physical into the workspace
14701 * to be printed.
14702 *
14703}*/
14704
14705static void putstring(register int col, register int nchars)
14706{
14707\twhile( nchars-- )
14708\t\tputchar(physical[col++]);
14709\treturn;
14710}
14711
14712/*{\tREFRESH( mode )
14713 *
14714 *\tThis routine will refresh the crt so the physical image matches
14715 * the virtual image and display the proper window.
14716 *
14717 *\tmode\t= CONTROL, refresh in control mode, ie. leave cursor
14718 *\t\t\tpositioned at last char printed.
14719 *\t\t= INPUT, refresh in input mode; leave cursor positioned
14720 *\t\t\tafter last char printed.
14721 *\t\t= TRANSLATE, perform virtual to physical translation
14722 *\t\t\tand adjust left margin only.
14723 *
14724 *\t\t+-------------------------------+
14725 *\t\t|   | |    virtual\t  | |   |
14726 *\t\t+-------------------------------+
14727 *\t\t  cur_virt\t\tlast_virt
14728 *
14729 *\t\t+-----------------------------------------------+
14730 *\t\t|\t  | |\t        physical\t | |    |
14731 *\t\t+-----------------------------------------------+
14732 *\t\t\tcur_phys\t\t\tlast_phys
14733 *
14734 *\t\t\t\t0\t\t\tw_size - 1
14735 *\t\t\t\t+-----------------------+
14736 *\t\t\t\t| | |  window\t\t|
14737 *\t\t\t\t+-----------------------+
14738 *\t\t\t\tcur_window = cur_phys - first_wind
14739}*/
14740
14741static void refresh(int mode)
14742{
14743\tregister int p;
14744\tregister int regb;
14745\tregister int first_w = first_wind;
14746\tint p_differ;
14747\tint new_lw;
14748\tint ncur_phys;
14749\tint opflag;\t\t\t/* search optimize flag */
14750
14751#\tdefine\tw\tregb
14752#\tdefine\tv\tregb
14753
14754\t/*** find out if it\'s necessary to start translating at beginning ***/
14755
14756\tif(lookahead>0)
14757\t{
14758\t\tp = previous[lookahead-1];
14759\t\tif(p != ESC && p != \'\\n\' && p != \'\\r\')
14760\t\t\tmode = TRANSLATE;
14761\t}
14762\tv = cur_virt;
14763\tif( v<ocur_virt || ocur_virt==INVALID
14764\t\t|| ( v==ocur_virt
14765\t\t\t&& (!is_print(virtual[v]) || !is_print(o_v_char))) )
14766\t{
14767\t\topflag = FALSE;
14768\t\tp = 0;
14769\t\tv = 0;
14770\t}
14771\telse
14772\t{
14773\t\topflag = TRUE;
14774\t\tp = ocur_phys;
14775\t\tv = ocur_virt;
14776\t\tif( !is_print(virtual[v]) )
14777\t\t{
14778\t\t\t/*** avoid double ^\'s ***/
14779\t\t\t++p;
14780\t\t\t++v;
14781\t\t}
14782\t}
14783\tvirtual[last_virt+1] = 0;
14784\tncur_phys = ed_virt_to_phys(virtual,physical,cur_virt,v,p);
14785\tp = genlen(physical);
14786\tif( --p < 0 )
14787\t\tlast_phys = 0;
14788\telse
14789\t\tlast_phys = p;
14790
14791\t/*** see if this was a translate only ***/
14792
14793\tif( mode == TRANSLATE )
14794\t\treturn;
14795
14796\t/*** adjust left margin if necessary ***/
14797
14798\tif( ncur_phys<first_w || ncur_phys>=(first_w + w_size) )
14799\t{
14800\t\tcursor(first_w);
14801\t\tfirst_w = ncur_phys - (w_size>>1);
14802\t\tif( first_w < 0 )
14803\t\t\tfirst_w = 0;
14804\t\tfirst_wind = cur_phys = first_w;
14805\t}
14806
14807\t/*** attempt to optimize search somewhat to find ***/
14808\t/*** out where physical and window images differ ***/
14809
14810\tif( first_w==ofirst_wind && ncur_phys>=ocur_phys && opflag==TRUE )
14811\t{
14812\t\tp = ocur_phys;
14813\t\tw = p - first_w;
14814\t}
14815\telse
14816\t{
14817\t\tp = first_w;
14818\t\tw = 0;
14819\t}
14820
14821\tfor(; (p<=last_phys && w<=last_wind); ++p, ++w)
14822\t{
14823\t\tif( window[w] != physical[p] )
14824\t\t\tbreak;
14825\t}
14826\tp_differ = p;
14827
14828\tif( (p>last_phys || p>=first_w+w_size) && w>last_wind
14829\t\t&& cur_virt==ocur_virt )
14830\t{
14831\t\t/*** images are identical ***/
14832\t\treturn;
14833\t}
14834
14835\t/*** copy the physical image to the window image ***/
14836
14837\tif( last_virt != INVALID )
14838\t{
14839\t\twhile( p <= last_phys && w < w_size )
14840\t\t\twindow[w++] = physical[p++];
14841\t}
14842\tnew_lw = w;
14843
14844\t/*** erase trailing characters if needed ***/
14845
14846\twhile( w <= last_wind )
14847\t\twindow[w++] = \' \';
14848\tlast_wind = --w;
14849
14850\tp = p_differ;
14851
14852\t/*** move cursor to start of difference ***/
14853
14854\tcursor(p);
14855
14856\t/*** and output difference ***/
14857
14858\tw = p - first_w;
14859\twhile( w <= last_wind )
14860\t\tputchar(window[w++]);
14861
14862\tcur_phys = w + first_w;
14863\tlast_wind = --new_lw;
14864
14865\tif( last_phys >= w_size )
14866\t{
14867\t\tif( first_w == 0 )
14868\t\t\tlong_char = \'>\';
14869\t\telse if( last_phys < (first_w+w_size) )
14870\t\t\tlong_char = \'<\';
14871\t\telse
14872\t\t\tlong_char = \'*\';
14873\t}
14874\telse
14875\t\tlong_char = \' \';
14876
14877\tif( long_line != long_char )
14878\t{
14879\t\t/*** indicate lines longer than window ***/
14880\t\twhile( w++ < w_size )
14881\t\t{
14882\t\t\tputchar(\' \');
14883\t\t\t++cur_phys;
14884\t\t}
14885\t\tputchar(long_char);
14886\t\t++cur_phys;
14887\t\tlong_line = long_char;
14888\t}
14889
14890\tocur_phys = ncur_phys;
14891\tocur_virt = cur_virt;
14892\tofirst_wind = first_w;
14893
14894\tif( mode==INPUT && cur_virt>INVALID )
14895\t\t++ncur_phys;
14896
14897\tcursor(ncur_phys);
14898\ted_flush();
14899\treturn;
14900}
14901
14902/*{\tREPLACE( char, increment )
14903 *
14904 *\tReplace the cur_virt character with char.  This routine attempts
14905 * to avoid using refresh().
14906 *
14907 *\tincrement\t= TRUE, increment cur_virt after replacement.
14908 *\t\t\t= FALSE, leave cur_virt where it is.
14909 *
14910}*/
14911
14912static void replace(register int c, register int increment)
14913{
14914\tregister int cur_window;
14915
14916\tif( cur_virt == INVALID )
14917\t{
14918\t\t/*** can\'t replace invalid cursor ***/
14919\t\tbell;
14920\t\treturn;
14921\t}
14922\tcur_window = cur_phys - first_wind;
14923\tif( ocur_virt == INVALID || !is_print(c)
14924\t\t|| !is_print(virtual[cur_virt])
14925\t\t|| !is_print(o_v_char)
14926#ifdef MULTIBYTE
14927\t\t|| icharset(c) || out_csize(icharset(o_v_char))>1
14928#endif /* MULTIBYTE */
14929\t\t|| (increment==TRUE && (cur_window==w_size-1)
14930\t\t\t|| !is_print(virtual[cur_virt+1])) )
14931\t{
14932\t\t/*** must use standard refresh routine ***/
14933
14934\t\tcdelete(1, BAD);
14935\t\tappend(c, APPEND);
14936\t\tif( increment==TRUE && cur_virt<last_virt )
14937\t\t\t++cur_virt;
14938\t\trefresh(CONTROL);
14939\t}
14940\telse
14941\t{
14942\t\tvirtual[cur_virt] = c;
14943\t\tphysical[cur_phys] = c;
14944\t\twindow[cur_window] = c;
14945\t\tputchar(c);
14946\t\tif( increment == TRUE )
14947\t\t{
14948\t\t\tc = virtual[++cur_virt];
14949\t\t\t++cur_phys;
14950\t\t}
14951\t\telse
14952\t\t{
14953\t\t\tputchar(\'\\b\');
14954\t\t}
14955\t\to_v_char = c;
14956\t\ted_flush();
14957\t}
14958\treturn;
14959}
14960
14961/*
14962#ifdef xxx
14963#endif
14964*/
14965/*{\tRESTORE_V()
14966 *
14967 *\tRestore the contents of virtual space from u_space.
14968 *
14969}*/
14970
14971static void restore_v(void)
14972{
14973\tregister int tmpcol;
14974\tgenchar tmpspace[MAXLINE];
14975
14976\tif( u_column == INVALID-1 )
14977\t{
14978\t\t/*** never saved anything ***/
14979\t\tbell;
14980\t\treturn;
14981\t}
14982\tgencpy(tmpspace, u_space);
14983\ttmpcol = u_column;
14984\tsave_v();
14985\tgencpy(virtual, tmpspace);
14986\tcur_virt = tmpcol;
14987\tlast_virt = genlen(tmpspace) - 1;
14988\tocur_virt = MAXCHAR;\t/** invalidate refresh optimization **/
14989\treturn;
14990}
14991
14992/*{\tSAVE_LAST()
14993 *
14994 *\tIf the user has typed something, save it in last line.
14995 *
14996}*/
14997
14998static void save_last(void)
14999{
15000\tregister int i;
15001
15002\tif( (i = cur_virt - first_virt + 1) > 0 )
15003\t{
15004\t\t/*** save last thing user typed ***/
15005\t\tgenncpy(lastline, (&virtual[first_virt]), i);
15006\t\tlastline[i] = \'\\0\';
15007\t}
15008\treturn;
15009}
15010
15011/*{\tSAVE_V()
15012 *
15013 *\tThis routine will save the contents of virtual in u_space.
15014 *
15015}*/
15016
15017static void save_v(void)
15018{
15019\tif(!inmacro)
15020\t{
15021\t\tvirtual[last_virt + 1] = \'\\0\';
15022\t\tgencpy(u_space, virtual);
15023\t\tu_column = cur_virt;
15024\t}
15025\treturn;
15026}
15027
15028/*{\tSEARCH( mode )
15029 *
15030 *\tSearch history file for regular expression.
15031 *
15032 *\tmode\t= \'/\'\trequire search string and search new to old
15033 *\tmode\t= \'?\'\trequire search string and search old to new
15034 *\tmode\t= \'N\'\trepeat last search in reverse direction
15035 *\tmode\t= \'n\'\trepeat last search
15036 *
15037}*/
15038
15039static int search(register int mode)
15040{
15041\tregister int new_direction;
15042\tregister int oldcurhline;
15043\tstatic int direction = -1;
15044\thistloc_t  location;
15045
15046\tif( mode == \'/\' || mode == \'?\')
15047\t{
15048\t\t/*** new search expression ***/
15049\t\tdel_line(BAD);
15050\t\tappend(mode, APPEND);
15051\t\trefresh(INPUT);
15052\t\tfirst_virt = 1;
15053\t\tgetline(SEARCH);
15054\t\tfirst_virt = 0;
15055\t\tvirtual[last_virt + 1] = \'\\0\';\t/*** make null terminated ***/
15056\t\tdirection = mode==\'/\' ? -1 : 1;
15057\t}
15058
15059\tif( cur_virt == INVALID )
15060\t{
15061\t\t/*** no operation ***/
15062\t\treturn(ABORT);
15063\t}
15064
15065\tif( cur_virt==0 ||  fold(mode)==\'N\' )
15066\t{
15067\t\t/*** user wants repeat of last search ***/
15068\t\tdel_line(BAD);
15069\t\tstrcpy( ((char*)virtual)+1, lsearch);
15070#ifdef MULTIBYTE
15071\t\t*((char*)virtual) = \'/\';
15072\t\ted_internal((char*)virtual,virtual);
15073#endif /* MULTIBYTE */
15074\t}
15075
15076\tif( mode == \'N\' )
15077\t\tnew_direction = -direction;
15078\telse
15079\t\tnew_direction = direction;
15080
15081\tif( new_direction==1 && curhline >= histmax )
15082\t\tcurhline = histmin + 1;
15083
15084\t/*** now search ***/
15085
15086\toldcurhline = curhline;
15087#ifdef MULTIBYTE
15088\ted_external(virtual,(char*)virtual);
15089#endif /* MULTIBYTE */
15090\tlocation = hist_find(((char*)virtual)+1, curhline, 1, new_direction);
15091\tstrncpy(lsearch, ((char*)virtual)+1, SEARCHSIZE);
15092\tif( (curhline=location.hist_command) >=0 )
15093\t{
15094\t\treturn(GOOD);
15095\t}
15096
15097\t/*** could not find matching line ***/
15098
15099\tcurhline = oldcurhline;
15100\treturn(BAD);
15101}
15102
15103/*{\tSYNC_CURSOR()
15104 *
15105 *\tThis routine will move the physical cursor to the same
15106 * column as the virtual cursor.
15107 *
15108}*/
15109
15110static void sync_cursor(void)
15111{
15112\tregister int p;
15113\tregister int v;
15114\tregister int c;
15115\tint new_phys;
15116
15117\tif( cur_virt == INVALID )
15118\t\treturn;
15119
15120\t/*** find physical col that corresponds to virtual col ***/
15121
15122\tnew_phys = 0;
15123\tif(first_wind==ofirst_wind && cur_virt>ocur_virt && ocur_virt!=INVALID)
15124\t{
15125\t\t/*** try to optimize search a little ***/
15126\t\tp = ocur_phys + 1;
15127#ifdef MULTIBYTE
15128\t\twhile(physical[p]==MARKER)
15129\t\t\tp++;
15130#endif /* MULTIBYTE */
15131\t\tv = ocur_virt + 1;
15132\t}
15133\telse
15134\t{
15135\t\tp = 0;
15136\t\tv = 0;
15137\t}
15138\tfor(; v <= last_virt; ++p, ++v)
15139\t{
15140#ifdef MULTIBYTE
15141\t\tint d;
15142\t\tc = virtual[v];
15143\t\tif(d = icharset(c))
15144\t\t{
15145\t\t\tif( v != cur_virt )
15146\t\t\t\tp += (out_csize(d)-1);
15147\t\t}
15148\t\telse
15149#else
15150\t\tc = virtual[v];
15151#endif\t/* MULTIBYTE */
15152\t\tif( !isprint(c) )
15153\t\t{
15154\t\t\tif( c == \'\\t\' )
15155\t\t\t{
15156\t\t\t\tp -= ((p+editb.e_plen)%TABSIZE);
15157\t\t\t\tp += (TABSIZE-1);
15158\t\t\t}
15159\t\t\telse
15160\t\t\t{
15161\t\t\t\t++p;
15162\t\t\t}
15163\t\t}
15164\t\tif( v == cur_virt )
15165\t\t{
15166\t\t\tnew_phys = p;
15167\t\t\tbreak;
15168\t\t}
15169\t}
15170
15171\tif( new_phys < first_wind || new_phys >= first_wind + w_size )
15172\t{
15173\t\t/*** asked to move outside of window ***/
15174
15175\t\twindow[0] = \'\\0\';
15176\t\trefresh(CONTROL);
15177\t\treturn;
15178\t}
15179
15180\tcursor(new_phys);
15181\ted_flush();
15182\tocur_phys = cur_phys;
15183\tocur_virt = cur_virt;
15184\to_v_char = virtual[ocur_virt];
15185
15186\treturn;
15187}
15188
15189/*{\tTEXTMOD( command, mode )
15190 *
15191 *\tModify text operations.
15192 *
15193 *\tmode != 0, repeat previous operation
15194 *
15195}*/
15196
15197static int textmod(register int c, int mode)
15198{
15199\tregister int i;
15200\tregister genchar *p = lastline;
15201\tregister int trepeat = repeat;
15202\tstatic int lastmacro;
15203\tgenchar *savep;
15204
15205\tif(mode && (fold(lastmotion)==\'F\' || fold(lastmotion)==\'T\'))
15206\t\tlastmotion = \';\';
15207
15208\tif( fold(c) == \'P\' )
15209\t{
15210\t\t/*** change p from lastline to yankbuf ***/
15211\t\tp = yankbuf;
15212\t}
15213
15214addin:
15215\tswitch( c )
15216\t{
15217\t\t\t/***** Input commands *****/
15218
15219#ifdef KSHELL
15220\tcase \'*\':\t\t/** do file name expansion in place **/
15221\tcase \'\\\\\':\t\t/** do file name completion in place **/
15222\t\tif( cur_virt == INVALID )
15223\t\t\treturn(BAD);
15224\tcase \'=\':\t\t/** list file name expansions **/
15225\t\tsave_v();
15226\t\ti = last_virt;
15227\t\t++last_virt;
15228\t\tvirtual[last_virt] = 0;
15229\t\tif( ed_expand((char*)virtual, &cur_virt, &last_virt, c) )
15230\t\t{
15231\t\t\tlast_virt = i;
15232\t\t\tbell;
15233\t\t}
15234\t\telse if(c == \'=\')
15235\t\t{
15236\t\t\tlast_virt = i;
15237\t\t\tnonewline++;
15238\t\t\ted_ungetchar(cntl(\'L\'));
15239\t\t\treturn(GOOD);
15240\t\t}
15241\t\telse
15242\t\t{
15243\t\t\t--cur_virt;
15244\t\t\t--last_virt;
15245\t\t\tocur_virt = MAXCHAR;
15246\t\t\treturn(APPEND);
15247\t\t}
15248\t\tbreak;
15249
15250\tcase \'@\':\t\t/** macro expansion **/
15251\t\tif( mode )
15252\t\t\tc = lastmacro;
15253\t\telse
15254\t\t\tif((c=getrchar())==ESC)
15255\t\t\t\treturn(GOOD);
15256\t\tif(!inmacro)
15257\t\t\tlastmacro = c;
15258\t\tif(ed_macro(c))
15259\t\t{
15260\t\t\tsave_v();
15261\t\t\tinmacro++;
15262\t\t\treturn(GOOD);
15263\t\t}
15264\t\tbell;
15265\t\treturn(BAD);
15266
15267#endif\t/* KSHELL */
15268\tcase \'_\':\t\t/** append last argument of prev command **/
15269\t\tsave_v();
15270\t\t{
15271\t\t\tgenchar tmpbuf[MAXLINE];
15272\t\t\tif(repeat_set==0)
15273\t\t\t\trepeat = -1;
15274\t\t\tp = (genchar*)hist_word(tmpbuf,MAXLINE,repeat);
15275#ifndef KSHELL
15276\t\t\tif(p==0)
15277\t\t\t{
15278\t\t\t\tbell;
15279\t\t\t\tbreak;
15280\t\t\t}
15281#endif\t/* KSHELL */
15282#ifdef MULTIBYTE
15283\t\t\ted_internal((char*)p,tmpbuf);
15284\t\t\tp = tmpbuf;
15285#endif /* MULTIBYTE */
15286\t\t\ti = \' \';
15287\t\t\tdo
15288\t\t\t{
15289\t\t\t\tappend(i,APPEND);
15290\t\t\t}
15291\t\t\twhile(i = *p++);
15292\t\t\treturn(APPEND);
15293\t\t}
15294
15295\tcase \'A\':\t\t/** append to end of line **/
15296\t\tcur_virt = last_virt;
15297\t\tsync_cursor();
15298
15299\tcase \'a\':\t\t/** append **/
15300\t\tif( fold(mode) == \'A\' )
15301\t\t{
15302\t\t\tc = \'p\';
15303\t\t\tgoto addin;
15304\t\t}
15305\t\tsave_v();
15306\t\tif( cur_virt != INVALID )
15307\t\t{
15308\t\t\tfirst_virt = cur_virt + 1;
15309\t\t\tcursor(cur_phys + 1);
15310\t\t\ted_flush();
15311\t\t}
15312\t\treturn(APPEND);
15313
15314\tcase \'I\':\t\t/** insert at beginning of line **/
15315\t\tcur_virt = first_virt;
15316\t\tsync_cursor();
15317
15318\tcase \'i\':\t\t/** insert **/
15319\t\tif( fold(mode) == \'I\' )
15320\t\t{
15321\t\t\tc = \'P\';
15322\t\t\tgoto addin;
15323\t\t}
15324\t\tsave_v();
15325\t\tif( cur_virt != INVALID )
15326 \t\t{
15327 \t\t\to_v_char = virtual[cur_virt];
15328\t\t\tfirst_virt = cur_virt--;
15329  \t\t}
15330\t\treturn(INSERT);
15331
15332\tcase \'C\':\t\t/** change to eol **/
15333\t\tc = \'$\';
15334\t\tgoto chgeol;
15335
15336\tcase \'c\':\t\t/** change **/
15337\t\tif( mode )
15338\t\t\tc = lastmotion;
15339\t\telse
15340\t\t\tc = getcount(getchar());
15341chgeol:
15342\t\tlastmotion = c;
15343\t\tif( c == \'c\' )
15344\t\t{
15345\t\t\tdel_line(GOOD);
15346\t\t\treturn(APPEND);
15347\t\t}
15348
15349\t\tif( delmotion(c, \'c\') == BAD )
15350\t\t\treturn(BAD);
15351
15352\t\tif( mode == \'c\' )
15353\t\t{
15354\t\t\tc = \'p\';
15355\t\t\ttrepeat = 1;
15356\t\t\tgoto addin;
15357\t\t}
15358\t\tfirst_virt = cur_virt + 1;
15359\t\treturn(APPEND);
15360
15361\tcase \'D\':\t\t/** delete to eol **/
15362\t\tc = \'$\';
15363\t\tgoto deleol;
15364
15365\tcase \'d\':\t\t/** delete **/
15366\t\tif( mode )
15367\t\t\tc = lastmotion;
15368\t\telse
15369\t\t\tc = getcount(getchar());
15370deleol:
15371\t\tlastmotion = c;
15372\t\tif( c == \'d\' )
15373\t\t{
15374\t\t\tdel_line(GOOD);
15375\t\t\tbreak;
15376\t\t}
15377\t\tif( delmotion(c, \'d\') == BAD )
15378\t\t\treturn(BAD);
15379\t\tif( cur_virt < last_virt )
15380\t\t\t++cur_virt;
15381\t\tbreak;
15382
15383\tcase \'P\':
15384\t\tif( p[0] == \'\\0\' )
15385\t\t\treturn(BAD);
15386\t\tif( cur_virt != INVALID )
15387\t\t{
15388\t\t\ti = virtual[cur_virt];
15389\t\t\tif(!is_print(i))
15390\t\t\t\tocur_virt = INVALID;
15391\t\t\t--cur_virt;
15392\t\t}
15393
15394\tcase \'p\':\t\t/** print **/
15395\t\tif( p[0] == \'\\0\' )
15396\t\t\treturn(BAD);
15397
15398\t\tif( mode != \'s\' && mode != \'c\' )
15399\t\t{
15400\t\t\tsave_v();
15401\t\t\tif( c == \'P\' )
15402\t\t\t{
15403\t\t\t\t/*** fix stored cur_virt ***/
15404\t\t\t\t++u_column;
15405\t\t\t}
15406\t\t}
15407\t\tif( mode == \'R\' )
15408\t\t\tmode = REPLACE;
15409\t\telse
15410\t\t\tmode = APPEND;
15411\t\tsavep = p;
15412\t\tfor(i=0; i<trepeat; ++i)
15413\t\t{
15414\t\t\twhile(c= *p++)
15415\t\t\t\tappend(c,mode);
15416\t\t\tp = savep;
15417\t\t}
15418\t\tbreak;
15419
15420\tcase \'R\':\t\t/* Replace many chars **/
15421\t\tif( mode == \'R\' )
15422\t\t{
15423\t\t\tc = \'P\';
15424\t\t\tgoto addin;
15425\t\t}
15426\t\tsave_v();
15427\t\tif( cur_virt != INVALID )
15428\t\t\tfirst_virt = cur_virt;
15429\t\treturn(REPLACE);
15430
15431\tcase \'r\':\t\t/** replace **/
15432\t\tif( mode )
15433\t\t\tc = *p;
15434\t\telse
15435\t\t\tif((c=getrchar())==ESC)
15436\t\t\t\treturn(GOOD);
15437\t\t*p = c;
15438\t\tsave_v();
15439\t\twhile(trepeat--)
15440\t\t\treplace(c, trepeat!=0);
15441\t\treturn(GOOD);
15442
15443\tcase \'S\':\t\t/** Substitute line - cc **/
15444\t\tc = \'c\';
15445\t\tgoto chgeol;
15446
15447\tcase \'s\':\t\t/** substitute **/
15448\t\tsave_v();
15449\t\tcdelete(repeat, BAD);
15450\t\tif( mode )
15451\t\t{
15452\t\t\tc = \'p\';
15453\t\t\ttrepeat = 1;
15454\t\t\tgoto addin;
15455\t\t}
15456\t\tfirst_virt = cur_virt + 1;
15457\t\treturn(APPEND);
15458
15459\tcase \'Y\':\t\t/** Yank to end of line **/
15460\t\tc = \'$\';
15461\t\tgoto yankeol;
15462
15463\tcase \'y\':\t\t/** yank thru motion **/
15464\t\tif( mode )
15465\t\t\tc = lastmotion;
15466\t\telse
15467\t\t\tc = getcount(getchar());
15468yankeol:
15469\t\tlastmotion = c;
15470\t\tif( c == \'y\' )
15471\t\t{
15472\t\t\tgencpy(yankbuf, virtual);
15473\t\t}
15474\t\telse if( delmotion(c, \'y\') == BAD )
15475\t\t{
15476\t\t\treturn(BAD);
15477\t\t}
15478\t\tbreak;
15479
15480\tcase \'x\':\t\t/** delete repeat chars forward - dl **/
15481\t\tc = \'l\';
15482\t\tgoto deleol;
15483
15484\tcase \'X\':\t\t/** delete repeat chars backward - dh **/
15485\t\tc = \'h\';
15486\t\tgoto deleol;
15487
15488\tcase \'~\':\t\t/** invert case and advance **/
15489\t\tif( cur_virt != INVALID )
15490\t\t{
15491\t\t\tsave_v();
15492\t\t\ti = INVALID;
15493\t\t\twhile(trepeat-->0 && i!=cur_virt)
15494\t\t\t{
15495\t\t\t\ti = cur_virt;
15496\t\t\t\tc = virtual[cur_virt];
15497#ifdef MULTIBYTE
15498\t\t\t\tif((c&~STRIP)==0)
15499#endif /* MULTIBYTE */
15500\t\t\t\tif( isupper(c) )
15501\t\t\t\t\tc = tolower(c);
15502\t\t\t\telse if( islower(c) )
15503\t\t\t\t\tc = toupper(c);
15504\t\t\t\treplace(c, TRUE);
15505\t\t\t}
15506\t\t\treturn(GOOD);
15507\t\t}
15508\t\telse
15509\t\t\treturn(BAD);
15510
15511\tdefault:
15512\t\treturn(BAD);
15513\t}
15514\trefresh(CONTROL);
15515\treturn(GOOD);
15516}
15517
15518#ifdef INT16
15519
15520/* making these functions reduces the size of the text region */
15521
15522static int isalph(register int c)
15523{
15524\tregister int v = virtual[c];
15525\treturn(isalnum(v));
15526}
15527
15528static int isblank(register int c)
15529{
15530\tregister int v = virtual[c];
15531\treturn(isspace(v));
15532}
15533
15534static int ismetach(register int c)
15535{
15536\tregister int v = virtual[c];
15537\treturn(ismeta(v));
15538}
15539
15540#endif\t/* INT16 */
15541
15542
15543#ifdef MULTIBYTE
15544int isalph(c)
15545register int c;
15546{
15547\tregister int v = virtual[c];
15548\treturn((v&~STRIP) || isalnum(v));
15549}
15550
15551
15552int isblank(c)
15553register int c;
15554{
15555\tregister int v = virtual[c];
15556\treturn((v&~STRIP)==0 && isspace(v));
15557}
15558
15559int ismetach(c)
15560register int c;
15561{
15562\tregister int v = virtual[c];
15563\treturn((v&~STRIP)==0 && ismeta(v));
15564}
15565
15566#endif\t/* MULTIBYTE */
15567
15568/*
15569 * get a character, after ^V processing
15570 */
15571static int getrchar()
15572{
15573\tregister int c;
15574\tif((c=getchar())== cntl(\'V\'))
15575\t{
15576\t\tin_raw++;
15577\t\tc = getchar();
15578\t\tin_raw = 0;
15579\t}
15580\treturn(c);
15581}'
15582		OUTPUT - $'
15583/* Adapted for ksh by David Korn */
15584/*+\tVI.C\t\t\tP.D. Sullivan
15585 *
15586 *\tOne line editor for the shell based on the vi editor.
15587 *
15588 *\t\tcbosgd!pds
15589-*/
15590
15591
15592#include\t<errno.h>
15593#include\t<stdlib.h>
15594#include\t<string.h>
15595
15596#ifdef KSHELL
15597#   include\t"defs.h"
15598#else
15599#   include\t"io.h"
15600#endif\t/* KSHELL */
15601
15602#include\t"history.h"
15603#include\t"edit.h"
15604#include\t"terminal.h"
15605
15606#ifdef OLDTERMIO
15607#   undef ECHOCTL
15608    extern __MANGLE__ char echoctl;
15609#else
15610#   ifdef ECHOCTL
15611#\tdefine echoctl\tECHOCTL
15612#   else
15613#\tdefine echoctl\t0
15614#   endif /* ECHOCTL */
15615#endif /*OLDTERMIO */
15616
15617#ifndef FIORDCHK
15618#   define NTICKS\t5\t\t/* number of ticks for typeahead */
15619#   ifndef KSHELL
15620#\tifdef _sys_times_
15621#\tinclude\t<sys/times.h>
15622#\telse
15623  \t   struct tms
15624\t   {
15625\t\ttime_t\ttms_utime;
15626\t\ttime_t\ttms_stime;
15627\t\ttime_t\ttms_cutime;
15628\t\ttime_t\ttms_cstime;
15629\t   };
15630#\tendif /* _sys_times */
15631#   endif /* KSHELL */
15632#endif /* FIORDCHK */
15633
15634#define\tMAXCHAR\tMAXLINE-2\t\t/* max char per line */
15635#define\tWINDOW\tMAXWINDOW\t\t/* max char in window of which */
15636\t\t\t\t\t/* WINDOW-2 are available to user */
15637\t\t\t\t\t/* actual window size may be smaller */
15638
15639
15640#undef isblank
15641#ifdef MULTIBYTE
15642    static int bigvi;
15643#   define gencpy(a,b)\ted_gencpy(a,b)
15644#   define genncpy(a,b,n)\ted_genncpy(a,b,n)
15645#   define genlen(str)\ted_genlen(str)
15646#   define digit(c)\t((c&~STRIP)==0 && isdigit(c))
15647#   define is_print(c)\t((c&~STRIP) || isprint(c))
15648#else
15649#   define gencpy(a,b)\tstrcpy((char*)(a),(char*)(b))
15650#   define genncpy(a,b,n) strncpy((char*)(a),(char*)(b),n)
15651#   define genlen(str)\tstrlen(str)
15652#   define isalph(v)\tisalnum(virtual[v])
15653#   define isblank(v)\tisspace(virtual[v])
15654#   define ismetach(v)\tismeta(virtual[v])
15655#   define digit(c)\tisdigit(c)
15656#   define is_print(c)\tisprint(c)
15657#endif\t/* MULTIBYTE */
15658#define fold(c)\t\t((c)&~040)\t/* lower and uppercase equivalent */
15659#ifdef INT16
15660/* save space by defining functions for these */
15661#   undef isalph
15662#   undef isblank
15663#   undef ismetach
15664    static int isalph __PROTO__((int));
15665    static int isblank __PROTO__((int));
15666    static int ismetach __PROTO__((int));
15667#endif\t/* INT16 */
15668
15669#undef putchar
15670#undef getchar
15671#define getchar()\ted_getchar()
15672#define putchar(c)\ted_putchar(c)
15673#define bell\t\ted_ringbell()\t/* ring terminal\'s bell */
15674#define crlf\t\ted_crlf()\t/* return and linefeed */
15675
15676#define in_raw\t\teditb.e_addnl\t\t/* next char input is raw */
15677#define crallowed\teditb.e_crlf
15678#define cur_virt\teditb.e_cur\t\t/* current virtual column */
15679#define cur_phys\teditb.e_pcur\t/* current phys column cursor is at */
15680#define curhline\teditb.e_hline\t\t/* current history line */
15681#define env\t\teditb.e_env
15682#define fildes\t\teditb.e_fd
15683#define findchar\teditb.e_fchar\t\t/* last find char */
15684#define first_virt\teditb.e_fcol\t\t/* first allowable column */
15685#define first_wind\teditb.e_globals[0]\t/* first column of window */
15686#define\tglobals\t\teditb.e_globals\t\t/* local global variables */
15687#define histmin\t\teditb.e_hismin
15688#define histmax\t\teditb.e_hismax
15689#define last_phys\teditb.e_peol\t\t/* last column in physical */
15690#define last_virt\teditb.e_eol\t\t/* last column */
15691#define last_wind\teditb.e_globals[1]\t/* last column in window */
15692#define\tlastmotion\teditb.e_globals[2]\t/* last motion */
15693#define lastrepeat\teditb.e_mode\t/* last repeat count for motion cmds */
15694#define\tlong_char\teditb.e_globals[3]\t/* line bigger than window */
15695#define\tlong_line\teditb.e_globals[4]\t/* line bigger than window */
15696#define lsearch\t\teditb.e_search\t\t/* last search string */
15697#define lookahead\teditb.e_index\t\t/* characters in buffer */
15698#define previous\teditb.e_lbuf\t\t/* lookahead buffer */
15699#define max_col\t\teditb.e_llimit\t\t/* maximum column */
15700#define\tocur_phys\teditb.e_globals[5]   /* old current physical position */
15701#define\tocur_virt\teditb.e_globals[6]\t/* old last virtual position */
15702#define\tofirst_wind\teditb.e_globals[7]\t/* old window first col */
15703#define\to_v_char\teditb.e_globals[8]\t/* prev virtual[ocur_virt] */
15704#define Prompt\t\teditb.e_prompt\t\t/* pointer to prompt */
15705#define plen\t\teditb.e_plen\t\t/* length of prompt */
15706#define physical\teditb.e_physbuf\t\t/* physical image */
15707#define repeat\t\teditb.e_repeat\t    /* repeat count for motion cmds */
15708#define ttyspeed\teditb.e_ttyspeed\t/* tty speed */
15709#define u_column\teditb.e_ucol\t\t/* undo current column */
15710#define U_saved\t\teditb.e_saved\t\t/* original virtual saved */
15711#define U_space\t\teditb.e_Ubuf\t\t/* used for U command */
15712#define u_space\t\teditb.e_ubuf\t\t/* used for u command */
15713#define usreof\t\teditb.e_eof\t\t/* user defined eof char */
15714#define usrerase\teditb.e_erase\t\t/* user defined erase char */
15715#define usrintr\t\teditb.e_intr\t\t/* user defined intr char */
15716#define usrkill\t\teditb.e_kill\t\t/* user defined kill char */
15717#define usrquit\t\teditb.e_quit\t\t/* user defined quit char */
15718#define virtual\t\teditb.e_inbuf\t/* pointer to virtual image buffer */
15719#define\twindow\t\teditb.e_window\t\t/* window buffer */
15720#define\tw_size\t\teditb.e_wsize\t\t/* window size */
15721#define\tinmacro\t\teditb.e_inmacro\t\t/* true when in macro */
15722#define yankbuf\t\teditb.e_killbuf\t\t/* yank/delete buffer */
15723
15724extern __MANGLE__ clock_t times(__VARARG__);
15725
15726#define\tABORT\t-2\t\t\t/* user abort */
15727#define\tAPPEND\t-10\t\t\t/* append chars */
15728#define\tBAD\t-1\t\t\t/* failure flag */
15729#define\tBIGVI\t-15\t\t\t/* user wants real vi */
15730#define\tCONTROL\t-20\t\t\t/* control mode */
15731#define\tENTER\t-25\t\t\t/* enter flag */
15732#define\tGOOD\t0\t\t\t/* success flag */
15733#define\tINPUT\t-30\t\t\t/* input mode */
15734#define\tINSERT\t-35\t\t\t/* insert mode */
15735#define\tREPLACE\t-40\t\t\t/* replace chars */
15736#define\tSEARCH\t-45\t\t\t/* search flag */
15737#define\tTRANSLATE\t-50\t\t/* translate virt to phys only */
15738
15739#define\tDEL\t\'\\177\'\t\t\t/* interrupt char */
15740
15741#define\tTRUE\t1
15742#define\tFALSE\t0
15743
15744#define\tINVALID\t(-1)\t\t\t/* invalid column */
15745#define\tQUIT_C\t\'\\34\'\t\t\t/* quit char */
15746#define\tSYSERR\t(-1)\t\t\t/* system error */
15747
15748static char addnl;\t\t\t/* boolean - add newline flag */
15749static char last_cmd = \'\\0\';\t\t/* last command */
15750static char repeat_set;
15751static char nonewline;
15752static genchar *lastline;
15753static char paren_chars[] = "([{)]}";   /* for % command */
15754
15755#ifdef FIORDCHK
15756    static clock_t typeahead;\t\t/* typeahead occurred */
15757#else
15758    static int typeahead;\t\t/* typeahead occurred */
15759#endif\t/* FIORDCHK */
15760
15761static void\tdel_line __PROTO__((int));
15762static int\tgetcount __PROTO__((int));
15763static void\tgetline __PROTO__((int));
15764static int\tgetrchar __PROTO__((void));
15765static int\tmvcursor __PROTO__((int));
15766static void\tpr_prompt __PROTO__((void));
15767static void\tpr_string __PROTO__((const char*));
15768static void\tputstring __PROTO__((int, int));
15769static void\trefresh __PROTO__((int));
15770static void\treplace __PROTO__((int, int));
15771static void\trestore_v __PROTO__((void));
15772static void\tsave_last __PROTO__((void));
15773static void\tsave_v __PROTO__((void));
15774static int\tsearch __PROTO__((int));
15775static void\tsync_cursor __PROTO__((void));
15776static int\ttextmod __PROTO__((int,int));
15777
15778/*+\tVI_READ( fd, shbuf, nchar )
15779 *
15780 *\tThis routine implements a one line version of vi and is
15781 * called by _filbuf.c
15782 *
15783-*/
15784
15785vi_read __PARAM__((int fd, register char *shbuf, unsigned nchar), (fd, shbuf, nchar)) __OTORP__(int fd; register char *shbuf; unsigned nchar;)
15786#line 205
15787{
15788\tregister int i;\t\t\t/* general variable */
15789\tregister int c;\t\t\t/* general variable */
15790\tregister int term_char;\t/* read() termination character */
15791\tchar prompt[PRSIZE+2];\t\t/* prompt */
15792\tgenchar Physical[2*MAXLINE];\t/* physical image */
15793\tgenchar Ubuf[MAXLINE];\t/* used for U command */
15794\tgenchar ubuf[MAXLINE];\t/* used for u command */
15795\tgenchar Window[WINDOW+10];\t/* window image */
15796\tchar cntl_char;\t\t\t/* TRUE if control character present */
15797\tint Globals[9];\t\t\t/* local global variables */
15798#ifndef FIORDCHK
15799\tclock_t oldtime, newtime;
15800\tstruct tms dummy;
15801#endif\t/* FIORDCHK */
15802\t
15803\t/*** setup prompt ***/
15804
15805\tPrompt = prompt;
15806\ted_setup(fd);
15807
15808#ifndef RAWONLY
15809\tif( !sh_isoption(SH_VIRAW) )
15810\t{
15811\t\t/*** Change the eol characters to \'\\r\' and eof  ***/
15812\t\t/* in addition to \'\\n\' and make eof an ESC\t*/
15813
15814\t\tif( tty_alt(ERRIO) == BAD )
15815\t\t{
15816\t\t\treturn(read(fd, shbuf, nchar));
15817\t\t}
15818
15819#   ifdef FIORDCHK
15820\t\tioctl(fd,FIORDCHK,&typeahead);
15821#   else
15822\t\t/* time the current line to determine typeahead */
15823\t\toldtime = times(&dummy);
15824#   endif /* FIORDCHK */
15825#   ifdef KSHELL
15826\t\t/* abort of interrupt has occurred */
15827\t\tif(sh.trapnote&SIGSET)
15828\t\t\ti = -1;
15829\t\telse
15830#   endif /* KSHELL */
15831\t\t/*** Read the line ***/
15832\t\ti = read(fd, shbuf, nchar);
15833#   ifndef FIORDCHK
15834\t\tnewtime = times(&dummy);
15835\t\ttypeahead = ((newtime-oldtime) < NTICKS);
15836#   endif /* FIORDCHK */
15837\t    if(echoctl)
15838\t    {
15839\t\tif( i <= 0 )
15840\t\t{
15841\t\t\t/*** read error or eof typed ***/
15842\t\t\ttty_cooked(ERRIO);
15843\t\t\treturn(i);
15844\t\t}
15845\t\tterm_char = shbuf[--i];
15846\t\tif( term_char == \'\\r\' )
15847\t\t\tterm_char = \'\\n\';
15848\t\tif( term_char==\'\\n\' || term_char==ESC )
15849\t\t\tshbuf[i--] = \'\\0\';
15850\t\telse
15851\t\t\tshbuf[i+1] = \'\\0\';
15852\t    }
15853\t    else
15854\t    {
15855\t\tc = shbuf[0];
15856
15857\t\t/*** Save and remove the last character if its an eol, ***/
15858\t\t/* changing \'\\r\' to \'\\n\' */
15859
15860\t\tif( i == 0 )
15861\t\t{
15862\t\t\t/*** ESC was typed as first char of line ***/
15863\t\t\tterm_char = ESC;
15864\t\t\tshbuf[i--] = \'\\0\';\t/* null terminate line */
15865\t\t}
15866\t\telse if( i<0 || c==usreof )
15867\t\t{
15868\t\t\t/*** read error or eof typed ***/
15869\t\t\ttty_cooked(ERRIO);
15870\t\t\tif( c == usreof )
15871\t\t\t\ti = 0;
15872\t\t\treturn(i);
15873\t\t}
15874\t\telse
15875\t\t{
15876\t\t\tterm_char = shbuf[--i];
15877\t\t\tif( term_char == \'\\r\' )
15878\t\t\t\tterm_char = \'\\n\';
15879\t\t\tif( term_char==\'\\n\' || term_char==usreof )
15880\t\t\t{
15881\t\t\t\t/*** remove terminator & null terminate ***/
15882\t\t\t\tshbuf[i--] = \'\\0\';
15883\t\t\t}
15884\t\t\telse
15885\t\t\t{
15886\t\t\t\t/** terminator was ESC, which is not xmitted **/
15887\t\t\t\tterm_char = ESC;
15888\t\t\t\tshbuf[i+1] = \'\\0\';
15889\t\t\t}
15890\t\t}
15891\t    }
15892\t}
15893\telse
15894#endif\t/* RAWONLY */
15895\t{
15896\t\t/*** Set raw mode ***/
15897
15898#ifndef RAWONLY
15899\t\tif( ttyspeed == 0 )
15900\t\t{
15901\t\t\t/*** never did TCGETA, so do it ***/
15902\t\t\t/* avoids problem if user does \'sh -o viraw\' */
15903\t\t\ttty_alt(ERRIO);
15904\t\t}
15905#endif /* RAWONLY */
15906\t\tif( tty_raw(ERRIO) == BAD )
15907\t\t{
15908\t\t\treturn(read(fd, shbuf, nchar));
15909\t\t}
15910\t\ti = INVALID;
15911\t}
15912
15913\t/*** Initialize some things ***/
15914
15915\tvirtual = (genchar*)shbuf;
15916#undef virtual
15917#define virtual\t\t((genchar*)shbuf)
15918#ifdef MULTIBYTE
15919\tshbuf[i+1] = 0;
15920\ti = ed_internal(shbuf,virtual)-1;
15921#endif /* MULTIBYTE */
15922\tglobals = Globals;
15923\tcur_phys = i + 1;
15924\tcur_virt = i;
15925\tfildes = fd;
15926\tfirst_virt = 0;
15927\tfirst_wind = 0;
15928\tlast_virt = i;
15929\tlast_phys = i;
15930\tlast_wind = i;
15931\tlong_line = \' \';
15932\tlong_char = \' \';
15933\to_v_char = \'\\0\';
15934\tocur_phys = 0;
15935\tin_raw = 0;
15936\tocur_virt = MAXCHAR;
15937\tofirst_wind = 0;
15938\tphysical = Physical;
15939\tu_column = INVALID - 1;
15940\tU_space = Ubuf;
15941\tu_space = ubuf;
15942\twindow = Window;
15943\twindow[0] = \'\\0\';
15944
15945#if KSHELL && (2*CHARSIZE*MAXLINE)<IOBSIZE
15946\tyankbuf = shbuf + MAXLINE*sizeof(genchar);
15947#else
15948\tif(yankbuf==0)
15949\t\tyankbuf = (genchar*)malloc(sizeof(genchar)*(MAXLINE));
15950#endif
15951#if KSHELL && (3*CHARSIZE*MAXLINE)<IOBSIZE
15952\tlastline = shbuf + (MAXLINE+MAXLINE)*sizeof(genchar);
15953#else
15954\tif(lastline==0)
15955\t\tlastline = (genchar*)malloc(sizeof(genchar)*(MAXLINE));
15956#endif
15957\tif( last_cmd == \'\\0\' )
15958\t{
15959\t\t/*** first time for this shell ***/
15960
15961\t\tlast_cmd = \'i\';
15962\t\tfindchar = INVALID;
15963\t\tlastmotion = \'\\0\';
15964\t\tlastrepeat = 1;
15965\t\trepeat = 1;
15966\t\t*yankbuf = 0;
15967\t}
15968
15969\t/*** fiddle around with prompt length ***/
15970\tif( nchar+plen > MAXCHAR )
15971\t\tnchar = MAXCHAR - plen;
15972\tmax_col = nchar - 2;
15973
15974#ifndef RAWONLY
15975\tif( !sh_isoption(SH_VIRAW) )
15976\t{
15977\t\tint kill_erase = 0;
15978#   ifndef ECHOCTL
15979\t\tcntl_char = FALSE;
15980#   endif /* !ECHOCTL */
15981\t\tfor(i=(echoctl?last_virt:0); i<=last_virt; ++i )
15982\t\t{
15983\t\t\t/*** change \\r to
15984, check for control characters, ***/
15985\t\t\t/* delete appropriate ^Vs,\t\t\t*/
15986\t\t\t/* and estimate last physical column */
15987
15988\t\t\tif( virtual[i] == \'\\r\' )
15989\t\t\t\tvirtual[i] = \'\\n\';
15990\t\t    if(!echoctl)
15991\t\t    {
15992\t\t\tc = virtual[i];
15993\t\t\tif( c==usrerase || c==usrkill )
15994\t\t\t{
15995\t\t\t\t/*** user typed escaped erase or kill char ***/
15996\t\t\t\tcntl_char = TRUE;
15997\t\t\t\tif(is_print(c))
15998\t\t\t\t\tkill_erase++;
15999\t\t\t}
16000\t\t\telse if( !is_print(c) )
16001\t\t\t{
16002\t\t\t\tcntl_char = TRUE;
16003
16004\t\t\t\tif( c == cntl(\'V\') )
16005\t\t\t\t{
16006\t\t\t\t\tif( i == last_virt )
16007\t\t\t\t\t{
16008\t\t\t\t\t\t/*** eol/eof was escaped ***/
16009\t\t\t\t\t\t/* so replace ^V with it */
16010\t\t\t\t\t\tvirtual[i] = term_char;
16011\t\t\t\t\t\tbreak;
16012\t\t\t\t\t}
16013
16014\t\t\t\t\t/*** delete ^V ***/
16015\t\t\t\t\tgencpy((&virtual[i]), (&virtual[i+1]));
16016\t\t\t\t\t--cur_virt;
16017\t\t\t\t\t--last_virt;
16018\t\t\t\t}
16019\t\t\t}
16020\t\t    }
16021\t\t}
16022
16023\t\t/*** copy virtual image to window ***/
16024\t\tif(last_virt > 0)
16025\t\t\tlast_phys = ed_virt_to_phys(virtual,physical,last_virt,0,0);
16026\t\tif( last_phys >= w_size )
16027\t\t{
16028\t\t\t/*** line longer than window ***/
16029\t\t\tlast_wind = w_size - 1;
16030\t\t}
16031\t\telse
16032\t\t\tlast_wind = last_phys;
16033\t\tgenncpy(window, virtual, last_wind+1);
16034
16035\t\tif( term_char!=ESC  && (last_virt==INVALID
16036\t\t\t|| virtual[last_virt]!=term_char) )
16037\t\t{
16038\t\t\t/*** Line not terminated with ESC or escaped (^V) ***/
16039\t\t\t/* eol, so return after doing a total update */
16040\t\t\t/* if( (speed is greater or equal to 1200 */
16041\t\t\t/* and something was typed) and */
16042\t\t\t/* (control character present */
16043\t\t\t/* or typeahead occurred) ) */
16044
16045\t\t\ttty_cooked(ERRIO);
16046\t\t\tif( ttyspeed==FAST && last_virt!=INVALID
16047# ifdef ECHOCTL
16048\t\t\t\t&& typeahead)
16049# else
16050\t\t\t\t&& (typeahead || cntl_char==TRUE) )
16051# endif /*ECHOCTL */
16052\t\t\t{
16053\t\t\t\trefresh(TRANSLATE);
16054\t\t\t\tpr_prompt();
16055\t\t\t\tputstring(0, last_phys+1);
16056\t\t\t\tif(echoctl)
16057\t\t\t\t\tcrlf;
16058\t\t\t\telse
16059\t\t\t\t\twhile(kill_erase-- > 0)
16060\t\t\t\t\t\tputchar(\' \');
16061\t\t\t}
16062
16063\t\t\tif( term_char==\'\\n\' )
16064\t\t\t{
16065\t\t\t\tif(!echoctl)
16066\t\t\t\t\tcrlf;
16067\t\t\t\tvirtual[++last_virt] = \'\\n\';
16068\t\t\t}
16069\t\t\tlast_cmd = \'i\';
16070\t\t\tsave_last();
16071#ifdef MULTIBYTE
16072\t\t\tvirtual[last_virt+1] = 0;
16073\t\t\tlast_virt = ed_external(virtual,shbuf);
16074\t\t\treturn(last_virt);
16075#else
16076\t\t\treturn(++last_virt);
16077#endif /* MULTIBYTE */
16078\t\t}
16079
16080\t\t/*** Line terminated with escape, or escaped eol/eof, ***/
16081\t\t/*  so set raw mode */
16082
16083\t\tif( tty_raw(ERRIO) == BAD )
16084\t\t{
16085\t\t\ttty_cooked(ERRIO);
16086\t\t\tvirtual[++last_virt] = \'\\n\';
16087#ifdef MULTIBYTE
16088\t\t\tvirtual[last_virt+1] = 0;
16089\t\t\tlast_virt = ed_external(virtual,shbuf);
16090\t\t\treturn(last_virt);
16091#else
16092\t\t\treturn(++last_virt);
16093#endif /* MULTIBYTE */
16094\t\t}
16095
16096\t\tif(echoctl) /*** for cntl-echo erase the ^[ ***/
16097\t\t\tpr_string("\\b\\b  \\b\\b");
16098
16099
16100\t\tif( crallowed == YES )
16101\t\t{
16102\t\t\t/*** start over since there may be ***/
16103\t\t\t/*** a control char, or cursor might not ***/
16104\t\t\t/*** be at left margin (this lets us know ***/
16105\t\t\t/*** where we are ***/
16106\t\t\tcur_phys = 0;
16107\t\t\twindow[0] = \'\\0\';
16108\t\t\tpr_prompt();
16109\t\t\tif( term_char==ESC && virtual[last_virt]!=ESC )
16110\t\t\t\trefresh(CONTROL);
16111\t\t\telse
16112\t\t\t\trefresh(INPUT);
16113\t\t}
16114\t\telse
16115\t\t{
16116\t\t\t/*** just update everything internally ***/
16117\t\t\trefresh(TRANSLATE);
16118\t\t}
16119\t}
16120\telse
16121#endif\t/* RAWONLY */
16122\t\tvirtual[0] = \'\\0\';
16123
16124\t/*** Handle usrintr, usrquit, or EOF ***/
16125
16126\ti = SETJMP(env);
16127\tif( i != 0 )
16128\t{
16129\t\tvirtual[0] = \'\\0\';
16130\t\ttty_cooked(ERRIO);
16131
16132\t\tswitch(i)
16133\t\t{
16134\t\tcase UEOF:
16135\t\t\t/*** EOF ***/
16136\t\t\treturn(0);
16137
16138\t\tcase UINTR:
16139\t\t\t/** interrupt **/
16140\t\t\treturn(SYSERR);
16141\t\t}
16142\t\treturn(SYSERR);
16143\t}
16144
16145\t/*** Get a line from the terminal ***/
16146
16147\tU_saved = FALSE;
16148
16149#ifdef RAWONLY
16150\tgetline(APPEND);
16151#else
16152\tif( sh_isoption(SH_VIRAW) || virtual[last_virt]==term_char )
16153\t\tgetline(APPEND);
16154\telse
16155\t\tgetline(ESC);
16156#endif\t/* RAWONLY */
16157
16158\t/*** add a new line if user typed unescaped
16159 ***/
16160\t/* to cause the shell to process the line */
16161\ttty_cooked(ERRIO);
16162\tif( addnl )
16163\t{
16164\t\tvirtual[++last_virt] = \'\\n\';
16165\t\tcrlf;
16166\t}
16167\tif( ++last_virt >= 0 )
16168\t{
16169#ifdef MULTIBYTE
16170\t\tif(bigvi)
16171\t\t{
16172\t\t\tbigvi = 0;
16173\t\t\tshbuf[last_virt-1] = \'\\n\';
16174\t\t}
16175\t\telse
16176\t\t{
16177\t\t\tvirtual[last_virt] = 0;
16178\t\t\tlast_virt = ed_external(virtual,shbuf);
16179\t\t}
16180#endif /* MULTIBYTE */
16181\t\treturn(last_virt);
16182\t}
16183\telse
16184\t\treturn(SYSERR);
16185}
16186
16187
16188/*{\tAPPEND( char, mode )
16189 *
16190 *\tThis routine will append char after cur_virt in the virtual image.
16191 * mode\t=\tAPPEND, shift chars right before appending
16192 *\t\tREPLACE, replace char if possible
16193 *
16194}*/
16195
16196#undef virtual
16197#define virtual\t\teditb.e_inbuf\t/* pointer to virtual image buffer */
16198
16199static void append __PARAM__((int c, int mode), (c, mode)) __OTORP__(int c; int mode;)
16200#line 618
16201{
16202\tregister int i;
16203
16204\tif( last_virt<max_col && last_phys<max_col )
16205\t{
16206\t\tif( mode==APPEND || cur_virt==last_virt )
16207\t\t{
16208\t\t\tfor(i = ++last_virt;  i > cur_virt; --i)
16209\t\t\t{
16210\t\t\t\tvirtual[i] = virtual[i-1];
16211\t\t\t}
16212\t\t}
16213\t\tvirtual[++cur_virt] = c;
16214\t}
16215\telse
16216\t\tbell;
16217\treturn;
16218}
16219
16220/*{\tBACKWORD( nwords, cmd )
16221 *
16222 *\tThis routine will position cur_virt at the nth previous word.
16223 *
16224}*/
16225
16226static void backword __PARAM__((int nwords, register int cmd), (nwords, cmd)) __OTORP__(int nwords; register int cmd;)
16227#line 644
16228{
16229\tregister int tcur_virt = cur_virt;
16230\twhile( nwords-- && tcur_virt > first_virt )
16231\t{
16232\t\tif( !isblank(tcur_virt) && isblank(tcur_virt-1)
16233\t\t\t&& tcur_virt>first_virt )
16234\t\t\t--tcur_virt;
16235\t\telse if(cmd != \'B\')
16236\t\t{
16237\t\t\tregister int last = isalph(tcur_virt-1);
16238\t\t\tif((!isalph(tcur_virt) && last)
16239\t\t\t|| (isalph(tcur_virt) && !last))
16240\t\t\t\t--tcur_virt;
16241\t\t}
16242\t\twhile( isblank(tcur_virt) && tcur_virt>=first_virt )
16243\t\t\t--tcur_virt;
16244\t\tif( cmd == \'B\' )
16245\t\t{
16246\t\t\twhile( !isblank(tcur_virt) && tcur_virt>=first_virt )
16247\t\t\t\t--tcur_virt;
16248\t\t}
16249\t\telse
16250\t\t{
16251\t\t\tif( isalph(tcur_virt) )
16252\t\t\t\twhile( isalph(tcur_virt) && tcur_virt>=first_virt )
16253\t\t\t\t\t--tcur_virt;
16254\t\t\telse
16255\t\t\t\twhile( !isalph(tcur_virt) && !isblank(tcur_virt)
16256\t\t\t\t\t&& tcur_virt>=first_virt )
16257\t\t\t\t\t--tcur_virt;
16258\t\t}
16259\t\tcur_virt = ++tcur_virt;
16260\t}
16261\treturn;
16262}
16263
16264/*{\tCNTLMODE()
16265 *
16266 *\tThis routine implements the vi command subset.
16267 *\tThe cursor will always be positioned at the char of interest.
16268 *
16269}*/
16270
16271static int cntlmode __PARAM__((void), ())
16272#line 688
16273{
16274\tregister int c;
16275\tregister int i;
16276\tgenchar tmp_u_space[MAXLINE];\t/* temporary u_space */
16277\tgenchar *real_u_space;\t\t/* points to real u_space */
16278\tint tmp_u_column = INVALID;\t/* temporary u_column */
16279\tint was_inmacro;
16280
16281\tif( U_saved == FALSE )
16282\t{
16283\t\t/*** save virtual image if never done before ***/
16284\t\tvirtual[last_virt+1] = \'\\0\';
16285\t\tgencpy(U_space, virtual);
16286\t\tU_saved = TRUE;
16287\t}
16288
16289\tsave_last();
16290
16291\treal_u_space = u_space;
16292\tcurhline = histmax;
16293\tfirst_virt = 0;
16294\trepeat = 1;
16295\tif( cur_virt > INVALID )
16296\t{
16297\t\t/*** make sure cursor is at the last char ***/
16298\t\tsync_cursor();
16299\t}
16300
16301\t/*** Read control char until something happens to cause a ***/
16302\t/* return to APPEND/REPLACE mode\t*/
16303
16304\twhile( c=getchar() )
16305\t{
16306\t\trepeat_set = 0;
16307\t\twas_inmacro = inmacro;
16308\t\tif( c == \'0\' )
16309\t\t{
16310\t\t\t/*** move to leftmost column ***/
16311\t\t\tcur_virt = 0;
16312\t\t\tsync_cursor();
16313\t\t\tcontinue;
16314\t\t}
16315
16316\t\tif( digit(c) )
16317\t\t{
16318\t\t\tlastrepeat = repeat;
16319\t\t\tc = getcount(c);
16320\t\t\tif( c == \'.\' )
16321\t\t\t\tlastrepeat = repeat;
16322\t\t}
16323
16324\t\t/*** see if it\'s a move cursor command ***/
16325
16326\t\tif( mvcursor(c) == GOOD )
16327\t\t{
16328\t\t\tsync_cursor();
16329\t\t\trepeat = 1;
16330\t\t\tcontinue;
16331\t\t}
16332
16333\t\t/*** see if it\'s a repeat of the last command ***/
16334
16335\t\tif( c == \'.\' )
16336\t\t{
16337\t\t\tc = last_cmd;
16338\t\t\trepeat = lastrepeat;
16339\t\t\ti = textmod(c, c);
16340\t\t}
16341\t\telse
16342\t\t{
16343\t\t\ti = textmod(c, 0);
16344\t\t}
16345
16346\t\t/*** see if it\'s a text modification command ***/
16347
16348\t\tswitch(i)
16349\t\t{
16350\t\tcase BAD:
16351\t\t\tbreak;
16352
16353\t\tdefault:\t\t/** input mode **/
16354\t\t\tif(!was_inmacro)
16355\t\t\t{
16356\t\t\t\tlast_cmd = c;
16357\t\t\t\tlastrepeat = repeat;
16358\t\t\t}
16359\t\t\trepeat = 1;
16360\t\t\tif( i == GOOD )
16361\t\t\t\tcontinue;
16362\t\t\treturn(i);
16363\t\t}
16364
16365\t\tswitch( c )
16366\t\t{
16367\t\t\t/***** Other stuff *****/
16368
16369\t\tcase cntl(\'L\'):\t\t/** Redraw line **/
16370\t\t\t/*** print the prompt and ***/
16371\t\t\t/* force a total refresh */
16372\t\t\tif(nonewline==0)
16373\t\t\t\tputchar(\'\\n\');
16374\t\t\tnonewline = 0;
16375\t\t\tpr_prompt();
16376\t\t\twindow[0] = \'\\0\';
16377\t\t\tcur_phys = first_wind;
16378\t\t\tofirst_wind = INVALID;
16379\t\t\tlong_line = \' \';
16380\t\t\tbreak;
16381
16382\t\tcase cntl(\'V\'):
16383\t\t{
16384\t\t\tregister const char *p = &e_version[5];
16385\t\t\tsave_v();
16386\t\t\tdel_line(BAD);
16387\t\t\twhile(c = *p++)
16388\t\t\t\tappend(c,APPEND);
16389\t\t\trefresh(CONTROL);
16390\t\t\ted_getchar();
16391\t\t\trestore_v();
16392\t\t\tbreak;
16393\t\t}
16394
16395\t\tcase \'/\':\t\t/** Search **/
16396\t\tcase \'?\':
16397\t\tcase \'N\':
16398\t\tcase \'n\':
16399\t\t\tsave_v();
16400\t\t\tswitch( search(c) )
16401\t\t\t{
16402\t\t\tcase GOOD:
16403\t\t\t\t/*** force a total refresh ***/
16404\t\t\t\twindow[0] = \'\\0\';
16405\t\t\t\tgoto newhist;
16406
16407\t\t\tcase BAD:
16408\t\t\t\t/*** no match ***/
16409\t\t\t\t\tbell;
16410
16411\t\t\tdefault:
16412\t\t\t\tif( u_column == INVALID )
16413\t\t\t\t\tdel_line(BAD);
16414\t\t\t\telse
16415\t\t\t\t\trestore_v();
16416\t\t\t\tbreak;
16417\t\t\t}
16418\t\t\tbreak;
16419
16420\t\tcase \'j\':\t\t/** get next command **/
16421\t\tcase \'+\':\t\t/** get next command **/
16422\t\t\tcurhline += repeat;
16423\t\t\tif( curhline > histmax )
16424\t\t\t{
16425\t\t\t\tcurhline = histmax;
16426\t\t\t\tgoto ringbell;
16427\t\t\t}
16428\t\t\telse if(curhline==histmax && tmp_u_column!=INVALID )
16429\t\t\t{
16430\t\t\t\tu_space = tmp_u_space;
16431\t\t\t\tu_column = tmp_u_column;
16432\t\t\t\trestore_v();
16433\t\t\t\tu_space = real_u_space;
16434\t\t\t\tbreak;
16435\t\t\t}
16436\t\t\tsave_v();
16437\t\t\tgoto newhist;
16438
16439\t\tcase \'k\':\t\t/** get previous command **/
16440\t\tcase \'-\':\t\t/** get previous command **/
16441\t\t\tif( curhline == histmax )
16442\t\t\t{
16443\t\t\t\tu_space = tmp_u_space;
16444\t\t\t\ti = u_column;
16445\t\t\t\tsave_v();
16446\t\t\t\tu_space = real_u_space;
16447\t\t\t\ttmp_u_column = u_column;
16448\t\t\t\tu_column = i;
16449\t\t\t}
16450
16451\t\t\tcurhline -= repeat;
16452\t\t\tif( curhline <= histmin )
16453\t\t\t{
16454\t\t\t\tcurhline = histmin + 1;
16455\t\t\t\tgoto ringbell;
16456\t\t\t}
16457\t\t\tsave_v();
16458\tnewhist:
16459\t\t\thist_copy((char*)virtual, MAXLINE, curhline, -1);
16460#ifdef MULTIBYTE
16461\t\t\ted_internal((char*)virtual,virtual);
16462#endif /* MULTIBYTE */
16463\t\t\tif( (last_virt = genlen((char*)virtual) - 1) >= 0 )
16464\t\t\t\tcur_virt = 0;
16465\t\t\telse
16466\t\t\t\tcur_virt = INVALID;
16467\t\t\tbreak;
16468
16469
16470\t\tcase \'u\':\t\t/** undo the last thing done **/
16471\t\t\trestore_v();
16472\t\t\tbreak;
16473
16474\t\tcase \'U\':\t\t/** Undo everything **/
16475\t\t\tsave_v();
16476\t\t\tif( virtual[0] == \'\\0\' )
16477\t\t\t\tgoto ringbell;
16478\t\t\telse
16479\t\t\t{
16480\t\t\t\tgencpy(virtual, U_space);
16481\t\t\t\tlast_virt = genlen(U_space) - 1;
16482\t\t\t\tcur_virt = 0;
16483\t\t\t}
16484\t\t\tbreak;
16485
16486#ifdef KSHELL
16487\t\tcase \'v\':
16488\t\t\tif(repeat_set==0)
16489\t\t\t\tgoto vcommand;
16490#endif /* KSHELL */
16491
16492\t\tcase \'G\':\t\t/** goto command repeat **/
16493\t\t\tif(repeat_set==0)
16494\t\t\t\trepeat = histmin+1;
16495\t\t\tif( repeat <= histmin || repeat > histmax )
16496\t\t\t{
16497\t\t\t\tgoto ringbell;
16498\t\t\t}
16499\t\t\tcurhline = repeat;
16500\t\t\tsave_v();
16501\t\t\tif(c == \'G\')
16502\t\t\t\tgoto newhist;
16503
16504#ifdef KSHELL
16505\t\tvcommand:
16506\t\t\tif(ed_fulledit()==GOOD)
16507\t\t\t\treturn(BIGVI);
16508\t\t\telse
16509\t\t\t\tgoto ringbell;
16510#endif\t/* KSHELL */
16511
16512\t\tcase \'#\':\t/** insert(delete) # to (no)comment command **/
16513\t\t\tif( cur_virt != INVALID )
16514\t\t\t{
16515\t\t\t\tregister genchar *p = &virtual[last_virt+1];
16516\t\t\t\t*p = 0;
16517\t\t\t\t/*** see whether first char is comment char ***/
16518\t\t\t\tc = (virtual[0]==\'#\');
16519\t\t\t\twhile(p-- >= virtual)
16520\t\t\t\t{
16521\t\t\t\t\tif(*p==\'\\n\' || *p==\';\' || *p==\'|\' || p<virtual)
16522\t\t\t\t\t{
16523\t\t\t\t\t\tif(c) /* delete \'#\' */
16524\t\t\t\t\t\t{
16525\t\t\t\t\t\t\tif(p[1]==\'#\')
16526\t\t\t\t\t\t\t{
16527\t\t\t\t\t\t\t\tlast_virt--;
16528\t\t\t\t\t\t\t\tgencpy(p+1,p+2);
16529\t\t\t\t\t\t\t}
16530\t\t\t\t\t\t}
16531\t\t\t\t\t\telse
16532\t\t\t\t\t\t{
16533\t\t\t\t\t\t\tcur_virt = p-virtual;
16534\t\t\t\t\t\t\tappend(\'#\', APPEND);
16535\t\t\t\t\t\t}
16536\t\t\t\t\t}
16537\t\t\t\t}
16538\t\t\t\tif(c)
16539\t\t\t\t{
16540\t\t\t\t\tcur_virt = 0;
16541\t\t\t\t\tbreak;
16542\t\t\t\t}
16543\t\t\t\trefresh(INPUT);
16544\t\t\t}
16545
16546\t\tcase \'\\n\':\t\t/** send to shell **/
16547\t\t\treturn(ENTER);
16548
16549\t\tdefault:
16550\t\tringbell:
16551\t\t\tbell;
16552\t\t\trepeat = 1;
16553\t\t\tcontinue;
16554\t\t}
16555
16556\t\trefresh(CONTROL);
16557\t\trepeat = 1;
16558\t}
16559/* NOTREACHED */
16560}
16561
16562/*{\tCURSOR( new_current_physical )
16563 *
16564 *\tThis routine will position the virtual cursor at
16565 * physical column x in the window.
16566 *
16567}*/
16568
16569static void cursor __PARAM__((register int x), (x)) __OTORP__(register int x;)
16570#line 985
16571{
16572\tregister int delta;
16573
16574#ifdef MULTIBYTE
16575\twhile(physical[x]==MARKER)
16576\t\tx++;
16577#endif /* MULTIBYTE */
16578\tdelta = x - cur_phys;
16579
16580\tif( delta == 0 )
16581\t\treturn;
16582
16583\tif( delta > 0 )
16584\t{
16585\t\t/*** move to right ***/
16586\t\tputstring(cur_phys, delta);
16587\t}
16588\telse
16589\t{
16590\t\t/*** move to left ***/
16591
16592\t\tdelta = -delta;
16593
16594\t\t/*** attempt to optimize cursor movement ***/
16595\t\tif( crallowed==NO
16596\t\t\t|| (delta <= ((cur_phys-first_wind)+plen)>>1) )
16597\t\t{
16598\t\t\twhile( delta-- )
16599\t\t\t\tputchar(\'\\b\');
16600\t\t}
16601\t\telse
16602\t\t{
16603\t\t\tpr_prompt();
16604\t\t\tputstring(first_wind, x - first_wind);
16605\t\t}
16606\t}
16607\tcur_phys = x;
16608\treturn;
16609}
16610
16611/*{\tDELETE( nchars, mode )
16612 *
16613 *\tDelete nchars from the virtual space and leave cur_virt positioned
16614 * at cur_virt-1.
16615 *
16616 *\tIf mode\t= \'c\', do not save the characters deleted
16617 *\t\t= \'d\', save them in yankbuf and delete.
16618 *\t\t= \'y\', save them in yankbuf but do not delete.
16619 *
16620}*/
16621
16622static void cdelete __PARAM__((register int nchars, int mode), (nchars, mode)) __OTORP__(register int nchars; int mode;)
16623#line 1037
16624{
16625\tregister int i;
16626\tregister genchar *vp;
16627
16628\tif( cur_virt < first_virt )
16629\t{
16630\t\tbell;
16631\t\treturn;
16632\t}
16633\tif( nchars > 0 )
16634\t{
16635\t\tvp = virtual+cur_virt;
16636\t\to_v_char = vp[0];
16637\t\tif( (cur_virt-- + nchars) > last_virt )
16638\t\t{
16639\t\t\t/*** set nchars to number actually deleted ***/
16640\t\t\tnchars = last_virt - cur_virt;
16641\t\t}
16642
16643\t\t/*** save characters to be deleted ***/
16644
16645\t\tif( mode != \'c\' )
16646\t\t{
16647\t\t\ti = vp[nchars];
16648\t\t\tvp[nchars] = 0;
16649\t\t\tgencpy(yankbuf,vp);
16650\t\t\tvp[nchars] = i;
16651\t\t}
16652
16653\t\t/*** now delete these characters ***/
16654
16655\t\tif( mode != \'y\' )
16656\t\t{
16657\t\t\tgencpy(vp,vp+nchars);
16658\t\t\tlast_virt -= nchars;
16659\t\t}
16660\t}
16661\treturn;
16662}
16663
16664/*{\tDEL_LINE( mode )
16665 *
16666 *\tThis routine will delete the line.
16667 *\tmode = GOOD, do a save_v()
16668 *
16669}*/
16670static void del_line __PARAM__((int mode), (mode)) __OTORP__(int mode;)
16671#line 1084
16672{
16673\tif( last_virt == INVALID )
16674\t\treturn;
16675
16676\tif( mode == GOOD )
16677\t\tsave_v();
16678
16679\tcur_virt = 0;
16680\tfirst_virt = 0;
16681\tcdelete(last_virt+1, BAD);
16682\trefresh(CONTROL);
16683
16684\tcur_virt = INVALID;
16685\tcur_phys = 0;
16686\tfindchar = INVALID;
16687\tlast_phys = INVALID;
16688\tlast_virt = INVALID;
16689\tlast_wind = INVALID;
16690\tfirst_wind = 0;
16691\to_v_char = \'\\0\';
16692\tocur_phys = 0;
16693\tocur_virt = MAXCHAR;
16694\tofirst_wind = 0;
16695\twindow[0] = \'\\0\';
16696\treturn;
16697}
16698
16699/*{\tDELMOTION( motion, mode )
16700 *
16701 *\tDelete thru motion.
16702 *
16703 *\tmode\t= \'d\', save deleted characters, delete
16704 *\t\t= \'c\', do not save characters, change
16705 *\t\t= \'y\', save characters, yank
16706 *
16707 *\tReturns GOOD if operation successful; else BAD.
16708 *
16709}*/
16710
16711static int delmotion __PARAM__((int motion, int mode), (motion, mode)) __OTORP__(int motion; int mode;)
16712#line 1124
16713{
16714\tregister int begin;
16715\tregister int end;
16716\t/* the following saves a register */
16717#       define delta end
16718
16719\tif( cur_virt == INVALID )
16720\t\treturn(BAD);
16721\tif( mode != \'y\' )
16722\t\tsave_v();
16723\tbegin = cur_virt;
16724
16725\t/*** fake out the motion routines by appending a blank ***/
16726
16727\tvirtual[++last_virt] = \' \';
16728\tend = mvcursor(motion);
16729\tvirtual[last_virt--] = 0;
16730\tif(end==BAD)
16731\t\treturn(BAD);
16732
16733\tend = cur_virt;
16734\tif( mode==\'c\' && end>begin && strchr("wW", motion) )
16735\t{
16736\t\t/*** called by change operation, user really expects ***/
16737\t\t/* the effect of the eE commands, so back up to end of word */
16738\t\twhile( end>begin && isblank(end-1) )
16739\t\t\t--end;
16740\t\tif( end == begin )
16741\t\t\t++end;
16742\t}
16743
16744\tdelta = end - begin;
16745\tif( delta >= 0 )
16746\t{
16747\t\tcur_virt = begin;
16748\t\tif( strchr("eE;,TtFf%", motion) )
16749\t\t\t++delta;
16750\t}
16751\telse
16752\t{
16753\t\tdelta = -delta;
16754\t}
16755
16756\tcdelete(delta, mode);
16757\tif( mode == \'y\' )
16758\t\tcur_virt = begin;
16759#       undef delta
16760\treturn(GOOD);
16761}
16762
16763
16764/*{\tENDWORD( nwords, cmd )
16765 *
16766 *\tThis routine will move cur_virt to the end of the nth word.
16767 *
16768}*/
16769
16770static void endword __PARAM__((int nwords, register int cmd), (nwords, cmd)) __OTORP__(int nwords; register int cmd;)
16771#line 1182
16772{
16773\tregister int tcur_virt = cur_virt;
16774\twhile( nwords-- )
16775\t{
16776\t\tif( !isblank(tcur_virt) && tcur_virt<=last_virt )
16777\t\t\t++tcur_virt;
16778\t\twhile( isblank(tcur_virt) && tcur_virt<=last_virt )
16779\t\t\t++tcur_virt;\t
16780\t\tif( cmd == \'E\' )
16781\t\t{
16782\t\t\twhile( !isblank(tcur_virt) && tcur_virt<=last_virt )
16783\t\t\t\t++tcur_virt;
16784\t\t}
16785\t\telse
16786\t\t{
16787\t\t\tif( isalph(tcur_virt) )
16788\t\t\t\twhile( isalph(tcur_virt) && tcur_virt<=last_virt )
16789\t\t\t\t\t++tcur_virt;
16790\t\t\telse
16791\t\t\t\twhile( !isalph(tcur_virt) && !isblank(tcur_virt)
16792\t\t\t\t\t&& tcur_virt<=last_virt )
16793\t\t\t\t\t++tcur_virt;
16794\t\t}
16795\t\tif( tcur_virt > first_virt )
16796\t\t\ttcur_virt--;
16797\t}
16798\tcur_virt = tcur_virt;
16799\treturn;
16800}
16801
16802/*{\tFORWARD( nwords, cmd )
16803 *
16804 *\tThis routine will move cur_virt forward to the next nth word.
16805 *
16806}*/
16807
16808static void forward __PARAM__((register int nwords, int cmd), (nwords, cmd)) __OTORP__(register int nwords; int cmd;)
16809#line 1219
16810{
16811\tregister int tcur_virt = cur_virt;
16812\twhile( nwords-- )
16813\t{
16814\t\tif( cmd == \'W\' )
16815\t\t{
16816\t\t\twhile( !isblank(tcur_virt) && tcur_virt < last_virt )
16817\t\t\t\t++tcur_virt;
16818\t\t}
16819\t\telse
16820\t\t{
16821\t\t\tif( isalph(tcur_virt) )
16822\t\t\t{
16823\t\t\t\twhile( isalph(tcur_virt) && tcur_virt<last_virt )
16824\t\t\t\t\t++tcur_virt;
16825\t\t\t}
16826\t\t\telse
16827\t\t\t{
16828\t\t\t\twhile( !isalph(tcur_virt) && !isblank(tcur_virt)
16829\t\t\t\t\t&& tcur_virt < last_virt )
16830\t\t\t\t\t++tcur_virt;
16831\t\t\t}
16832\t\t}
16833\t\twhile( isblank(tcur_virt) && tcur_virt < last_virt )
16834\t\t\t++tcur_virt;
16835\t}
16836\tcur_virt = tcur_virt;
16837\treturn;
16838}
16839
16840
16841
16842/*{\tGETCOUNT(c)
16843 *
16844 *\tSet repeat to the user typed number and return the terminating
16845 * character.
16846 *
16847}*/
16848
16849static int getcount __PARAM__((register int c), (c)) __OTORP__(register int c;)
16850#line 1259
16851{
16852\tregister int i;
16853
16854\t/*** get any repeat count ***/
16855
16856\tif( c == \'0\' )
16857\t\treturn(c);
16858
16859\trepeat_set++;
16860\ti = 0;
16861\twhile( digit(c) )
16862\t{
16863\t\ti = i*10 + c - \'0\';
16864\t\tc = getchar();
16865\t}
16866
16867\tif( i > 0 )
16868\t\trepeat *= i;
16869\treturn(c);
16870}
16871
16872
16873/*{\tGETLINE( mode )
16874 *
16875 *\tThis routine will fetch a line.
16876 *\tmode\t= APPEND, allow escape to cntlmode subroutine
16877 *\t\t  appending characters.
16878 *\t\t= REPLACE, allow escape to cntlmode subroutine
16879 *\t\t  replacing characters.
16880 *\t\t= SEARCH, no escape allowed
16881 *\t\t= ESC, enter control mode immediately
16882 *
16883 *\tThe cursor will always be positioned after the last
16884 * char printed.
16885 *
16886 *\tThis routine returns when cr, nl, or (eof in column 0) is
16887 * received (column 0 is the first char position).
16888 *
16889}*/
16890
16891static void getline __PARAM__((register int mode), (mode)) __OTORP__(register int mode;)
16892#line 1300
16893{
16894\tregister int c;
16895\tregister int tmp;
16896
16897\taddnl = TRUE;
16898
16899\tif( mode == ESC )
16900\t{
16901\t\t/*** go directly to control mode ***/
16902\t\tgoto escape;
16903\t}
16904
16905\tfor(;;)
16906\t{
16907\t\tif( (c = getchar()) == cntl(\'V\') )
16908\t\t{
16909\t\t\t/*** implement ^V to escape next char ***/
16910\t\t\tin_raw++;
16911\t\t\tc = getchar();
16912\t\t\tin_raw = 0;
16913\t\t\tappend(c, mode);
16914\t\t\trefresh(INPUT);
16915\t\t\tcontinue;
16916\t\t}
16917
16918\t\tif( c == usreof )
16919\t\t\tc = UEOF;
16920\t\telse if( c == usrerase )
16921\t\t\tc = UERASE;
16922\t\telse if( c == usrkill )
16923\t\t\tc = UKILL;
16924
16925\t\tswitch( c )
16926\t\t{
16927\t\tcase ESC:\t\t/** enter control mode **/
16928\t\t\tif( mode == SEARCH )
16929\t\t\t{
16930\t\t\t\tbell;
16931\t\t\t\tcontinue;
16932\t\t\t}
16933\t\t\telse
16934\t\t\t{
16935\tescape:
16936\t\t\t\tif( mode == REPLACE )
16937\t\t\t\t\t--cur_virt;
16938\t\t\t\ttmp = cntlmode();
16939\t\t\t\tif( tmp == ENTER || tmp == BIGVI )
16940\t\t\t\t{
16941#ifdef MULTIBYTE
16942\t\t\t\t\tbigvi = (tmp==BIGVI);
16943#endif /* MULTIBYTE */
16944\t\t\t\t\treturn;
16945\t\t\t\t}
16946\t\t\t\tif( tmp == INSERT )
16947\t\t\t\t{
16948\t\t\t\t\tmode = APPEND;
16949\t\t\t\t\tcontinue;
16950\t\t\t\t}
16951\t\t\t\tmode = tmp;
16952\t\t\t}
16953\t\t\tbreak;
16954
16955\t\tcase UERASE:\t\t/** user erase char **/
16956\t\t\t\t/*** treat as backspace ***/
16957
16958\t\tcase \'\\b\':\t\t/** backspace **/
16959\t\t\tif( virtual[cur_virt] == \'\\\\\' )
16960\t\t\t{
16961\t\t\t\tcdelete(1, BAD);
16962\t\t\t\tappend(usrerase, mode);
16963\t\t\t}
16964\t\t\telse
16965\t\t\t{
16966\t\t\t\tif( mode==SEARCH && cur_virt==0 )
16967\t\t\t\t{
16968\t\t\t\t\tfirst_virt = 0;
16969\t\t\t\t\tcdelete(1, BAD);
16970\t\t\t\t\treturn;
16971\t\t\t\t}
16972\t\t\t\tcdelete(1, BAD);
16973\t\t\t}
16974\t\t\tbreak;
16975
16976\t\tcase cntl(\'W\'):\t\t/** delete back word **/
16977\t\t\tif( cur_virt > first_virt && isblank(cur_virt-1) )
16978\t\t\t{
16979\t\t\t\tcdelete(1, BAD);
16980\t\t\t}
16981\t\t\telse
16982\t\t\t{
16983\t\t\t\ttmp = cur_virt;
16984\t\t\t\tbackword(1, \'b\');
16985\t\t\t\tcdelete(tmp - cur_virt + 1, BAD);
16986\t\t\t}
16987\t\t\tbreak;
16988
16989\t\tcase UKILL:\t\t/** user kill line char **/
16990\t\t\tif( virtual[cur_virt] == \'\\\\\' )
16991\t\t\t{
16992\t\t\t\tcdelete(1, BAD);
16993\t\t\t\tappend(usrkill, mode);
16994\t\t\t}
16995\t\t\telse
16996\t\t\t{
16997\t\t\t\tif( mode == SEARCH )
16998\t\t\t\t{
16999\t\t\t\t\tcur_virt = 1;
17000\t\t\t\t\tdelmotion(\'$\', BAD);
17001\t\t\t\t}
17002\t\t\t\telse if(first_virt)
17003\t\t\t\t{
17004\t\t\t\t\ttmp = cur_virt;
17005\t\t\t\t\tcur_virt = first_virt;
17006\t\t\t\t\tcdelete(tmp - cur_virt + 1, BAD);
17007\t\t\t\t}
17008\t\t\t\telse
17009\t\t\t\t\tdel_line(GOOD);
17010\t\t\t}
17011\t\t\tbreak;
17012
17013\t\tcase UEOF:\t\t/** eof char **/
17014\t\t\tif( cur_virt != INVALID )
17015\t\t\t\tcontinue;
17016\t\t\taddnl = FALSE;
17017
17018\t\tcase \'\\n\':\t\t/** newline or return **/
17019\t\t\tif( mode != SEARCH )
17020\t\t\t\tsave_last();
17021\t\t\treturn;
17022
17023\t\tdefault:
17024\t\t\tif( mode == REPLACE )
17025\t\t\t{
17026\t\t\t\tif( cur_virt < last_virt )
17027\t\t\t\t{
17028\t\t\t\t\treplace(c, TRUE);
17029\t\t\t\t\tcontinue;
17030\t\t\t\t}
17031\t\t\t\tcdelete(1, BAD);
17032\t\t\t\tmode = APPEND;
17033\t\t\t}
17034\t\t\tappend(c, mode);
17035\t\t\tbreak;
17036\t\t}
17037\t\trefresh(INPUT);
17038
17039\t}
17040}
17041
17042/*{\tMVCURSOR( motion )
17043 *
17044 *\tThis routine will move the virtual cursor according to motion
17045 * for repeat times.
17046 *
17047 * It returns GOOD if successful; else BAD.
17048 *
17049}*/
17050
17051static int mvcursor __PARAM__((register int motion), (motion)) __OTORP__(register int motion;)
17052#line 1459
17053{
17054\tregister int count;
17055\tregister int tcur_virt;
17056\tregister int incr = -1;
17057\tregister int bound = 0;
17058\tstatic int last_find = 0;\t/* last find command */
17059
17060\tswitch(motion)
17061\t{
17062\t\t/***** Cursor move commands *****/
17063
17064\tcase \'0\':\t\t/** First column **/
17065\t\ttcur_virt = 0;
17066\t\tbreak;
17067
17068\tcase \'^\':\t\t/** First nonblank character **/
17069\t\ttcur_virt = first_virt;
17070\t\twhile( isblank(tcur_virt) && tcur_virt < last_virt )
17071\t\t\t++tcur_virt;
17072\t\tbreak;
17073
17074\tcase \'|\':
17075\t\ttcur_virt = repeat-1;
17076\t\tif(tcur_virt <= last_virt)
17077\t\t\tbreak;
17078\t\t/* fall through */
17079
17080\tcase \'$\':\t\t/** End of line **/
17081\t\ttcur_virt = last_virt;
17082\t\tbreak;
17083
17084\tcase \'h\':\t\t/** Left one **/
17085\tcase \'\\b\':
17086\t\tmotion = first_virt;
17087\t\tgoto walk;
17088
17089\tcase \' \':
17090\tcase \'l\':\t\t/** Right one **/
17091\t\tmotion = last_virt;
17092\t\tincr = 1;
17093\twalk:
17094\t\ttcur_virt = cur_virt;
17095\t\tif( incr*tcur_virt < motion)
17096\t\t{
17097\t\t\ttcur_virt += repeat*incr;
17098\t\t\tif( incr*tcur_virt > motion)
17099\t\t\t\ttcur_virt = motion;
17100\t\t}
17101\t\telse
17102\t\t{
17103\t\t\treturn(BAD);
17104\t\t}
17105\t\tbreak;
17106
17107\tcase \'B\':
17108\tcase \'b\':\t\t/** back word **/
17109\t\ttcur_virt = cur_virt;
17110\t\tbackword(repeat, motion);
17111\t\tif( cur_virt == tcur_virt )
17112\t\t\treturn(BAD);
17113\t\treturn(GOOD);
17114
17115\tcase \'E\':
17116\tcase \'e\':\t\t/** end of word **/
17117\t\ttcur_virt = cur_virt;
17118\t\tif(tcur_virt >=0)
17119\t\t\tendword(repeat, motion);
17120\t\tif( cur_virt == tcur_virt )
17121\t\t\treturn(BAD);
17122\t\treturn(GOOD);
17123
17124\tcase \',\':\t\t/** reverse find old char **/
17125\tcase \';\':\t\t/** find old char **/
17126\t\tswitch(last_find)
17127\t\t{
17128\t\tcase \'t\':
17129\t\tcase \'f\':
17130\t\t\tif(motion==\';\')
17131\t\t\t{
17132\t\t\t\tbound = last_virt;
17133\t\t\t\tincr = 1;
17134\t\t\t}
17135\t\t\tgoto find_b;
17136
17137\t\tcase \'T\':
17138\t\tcase \'F\':
17139\t\t\tif(motion==\',\')
17140\t\t\t{
17141\t\t\t\tbound = last_virt;
17142\t\t\t\tincr = 1;
17143\t\t\t}
17144\t\t\tgoto find_b;
17145
17146\t\tdefault:
17147\t\t\treturn(BAD);
17148\t\t}
17149
17150
17151\tcase \'t\':\t\t/** find up to new char forward **/
17152\tcase \'f\':\t\t/** find new char forward **/
17153\t\tbound = last_virt;
17154\t\tincr = 1;
17155
17156\tcase \'T\':\t\t/** find up to new char backward **/
17157\tcase \'F\':\t\t/** find new char backward **/
17158\t\tlast_find = motion;
17159\t\tif((findchar=getrchar())==ESC)
17160\t\t\treturn(GOOD);
17161find_b:
17162\t\ttcur_virt = cur_virt;
17163\t\tcount = repeat;
17164\t\twhile( count-- )
17165\t\t{
17166\t\t\twhile( incr*(tcur_virt+=incr) <= bound
17167\t\t\t\t&& virtual[tcur_virt] != findchar );
17168\t\t\tif( incr*tcur_virt > bound )
17169\t\t\t{
17170\t\t\t\treturn(BAD);
17171\t\t\t}
17172\t\t}
17173\t\tif( fold(last_find) == \'T\' )
17174\t\t\ttcur_virt -= incr;
17175\t\tbreak;
17176
17177\t/* new, undocumented feature */
17178        case \'%\':
17179\t{
17180\t\tint nextmotion;
17181\t\tint nextc;
17182\t\ttcur_virt = cur_virt;
17183\t\twhile( tcur_virt <= last_virt
17184\t\t\t&& strchr(paren_chars,virtual[tcur_virt])==(char*)0)
17185\t\t\t\ttcur_virt++;
17186\t\tif(tcur_virt > last_virt )
17187\t\t\treturn(BAD);
17188\t\tnextc = virtual[tcur_virt];
17189\t\tcount = strchr(paren_chars,nextc)-paren_chars;
17190\t\tif(count < 3)
17191\t\t{
17192\t\t\tincr = 1;
17193\t\t\tbound = last_virt;
17194\t\t\tnextmotion = paren_chars[count+3];
17195\t\t}
17196\t\telse
17197\t\t\tnextmotion = paren_chars[count-3];
17198\t\tcount = 1;
17199\t\twhile(count >0 &&  incr*(tcur_virt+=incr) <= bound)
17200\t\t{
17201\t\t        if(virtual[tcur_virt] == nextmotion)
17202\t\t        \tcount--;
17203\t\t        else if(virtual[tcur_virt]==nextc)
17204\t\t        \tcount++;
17205\t\t}
17206\t\tif(count)
17207\t\t\treturn(BAD);
17208\t\tbreak;
17209\t}
17210
17211\tcase \'W\':
17212\tcase \'w\':\t\t/** forward word **/
17213\t\ttcur_virt = cur_virt;
17214\t\tforward(repeat, motion);
17215\t\tif( tcur_virt == cur_virt )
17216\t\t\treturn(BAD);
17217\t\treturn(GOOD);
17218
17219\tdefault:
17220\t\treturn(BAD);
17221\t}
17222\tcur_virt = tcur_virt;
17223
17224\treturn(GOOD);
17225}
17226
17227/*{\tPR_PROMPT()
17228 *
17229 *\tPrint the prompt.
17230 *
17231}*/
17232
17233static void pr_prompt __PARAM__((void), ())
17234#line 1640
17235{
17236\tpr_string(Prompt);
17237\treturn;
17238}
17239
17240/*
17241 * print a string
17242 */
17243
17244static void pr_string __PARAM__((register const char *sp), (sp)) __OTORP__(register const char *sp;)
17245#line 1650
17246{
17247\t/*** copy string sp ***/
17248\tregister char *ptr = editb.e_outptr;
17249\twhile(*sp)
17250\t\t*ptr++ = *sp++;
17251\teditb.e_outptr = ptr;
17252\treturn;
17253}
17254
17255/*{\tPUTSTRING( column, nchars )
17256 *
17257 *\tPut nchars starting at column of physical into the workspace
17258 * to be printed.
17259 *
17260}*/
17261
17262static void putstring __PARAM__((register int col, register int nchars), (col, nchars)) __OTORP__(register int col; register int nchars;)
17263#line 1667
17264{
17265\twhile( nchars-- )
17266\t\tputchar(physical[col++]);
17267\treturn;
17268}
17269
17270/*{\tREFRESH( mode )
17271 *
17272 *\tThis routine will refresh the crt so the physical image matches
17273 * the virtual image and display the proper window.
17274 *
17275 *\tmode\t= CONTROL, refresh in control mode, ie. leave cursor
17276 *\t\t\tpositioned at last char printed.
17277 *\t\t= INPUT, refresh in input mode; leave cursor positioned
17278 *\t\t\tafter last char printed.
17279 *\t\t= TRANSLATE, perform virtual to physical translation
17280 *\t\t\tand adjust left margin only.
17281 *
17282 *\t\t+-------------------------------+
17283 *\t\t|   | |    virtual\t  | |   |
17284 *\t\t+-------------------------------+
17285 *\t\t  cur_virt\t\tlast_virt
17286 *
17287 *\t\t+-----------------------------------------------+
17288 *\t\t|\t  | |\t        physical\t | |    |
17289 *\t\t+-----------------------------------------------+
17290 *\t\t\tcur_phys\t\t\tlast_phys
17291 *
17292 *\t\t\t\t0\t\t\tw_size - 1
17293 *\t\t\t\t+-----------------------+
17294 *\t\t\t\t| | |  window\t\t|
17295 *\t\t\t\t+-----------------------+
17296 *\t\t\t\tcur_window = cur_phys - first_wind
17297}*/
17298
17299static void refresh __PARAM__((int mode), (mode)) __OTORP__(int mode;)
17300#line 1703
17301{
17302\tregister int p;
17303\tregister int regb;
17304\tregister int first_w = first_wind;
17305\tint p_differ;
17306\tint new_lw;
17307\tint ncur_phys;
17308\tint opflag;\t\t\t/* search optimize flag */
17309
17310#\tdefine\tw\tregb
17311#\tdefine\tv\tregb
17312
17313\t/*** find out if it\'s necessary to start translating at beginning ***/
17314
17315\tif(lookahead>0)
17316\t{
17317\t\tp = previous[lookahead-1];
17318\t\tif(p != ESC && p != \'\\n\' && p != \'\\r\')
17319\t\t\tmode = TRANSLATE;
17320\t}
17321\tv = cur_virt;
17322\tif( v<ocur_virt || ocur_virt==INVALID
17323\t\t|| ( v==ocur_virt
17324\t\t\t&& (!is_print(virtual[v]) || !is_print(o_v_char))) )
17325\t{
17326\t\topflag = FALSE;
17327\t\tp = 0;
17328\t\tv = 0;
17329\t}
17330\telse
17331\t{
17332\t\topflag = TRUE;
17333\t\tp = ocur_phys;
17334\t\tv = ocur_virt;
17335\t\tif( !is_print(virtual[v]) )
17336\t\t{
17337\t\t\t/*** avoid double ^\'s ***/
17338\t\t\t++p;
17339\t\t\t++v;
17340\t\t}
17341\t}
17342\tvirtual[last_virt+1] = 0;
17343\tncur_phys = ed_virt_to_phys(virtual,physical,cur_virt,v,p);
17344\tp = genlen(physical);
17345\tif( --p < 0 )
17346\t\tlast_phys = 0;
17347\telse
17348\t\tlast_phys = p;
17349
17350\t/*** see if this was a translate only ***/
17351
17352\tif( mode == TRANSLATE )
17353\t\treturn;
17354
17355\t/*** adjust left margin if necessary ***/
17356
17357\tif( ncur_phys<first_w || ncur_phys>=(first_w + w_size) )
17358\t{
17359\t\tcursor(first_w);
17360\t\tfirst_w = ncur_phys - (w_size>>1);
17361\t\tif( first_w < 0 )
17362\t\t\tfirst_w = 0;
17363\t\tfirst_wind = cur_phys = first_w;
17364\t}
17365
17366\t/*** attempt to optimize search somewhat to find ***/
17367\t/*** out where physical and window images differ ***/
17368
17369\tif( first_w==ofirst_wind && ncur_phys>=ocur_phys && opflag==TRUE )
17370\t{
17371\t\tp = ocur_phys;
17372\t\tw = p - first_w;
17373\t}
17374\telse
17375\t{
17376\t\tp = first_w;
17377\t\tw = 0;
17378\t}
17379
17380\tfor(; (p<=last_phys && w<=last_wind); ++p, ++w)
17381\t{
17382\t\tif( window[w] != physical[p] )
17383\t\t\tbreak;
17384\t}
17385\tp_differ = p;
17386
17387\tif( (p>last_phys || p>=first_w+w_size) && w>last_wind
17388\t\t&& cur_virt==ocur_virt )
17389\t{
17390\t\t/*** images are identical ***/
17391\t\treturn;
17392\t}
17393
17394\t/*** copy the physical image to the window image ***/
17395
17396\tif( last_virt != INVALID )
17397\t{
17398\t\twhile( p <= last_phys && w < w_size )
17399\t\t\twindow[w++] = physical[p++];
17400\t}
17401\tnew_lw = w;
17402
17403\t/*** erase trailing characters if needed ***/
17404
17405\twhile( w <= last_wind )
17406\t\twindow[w++] = \' \';
17407\tlast_wind = --w;
17408
17409\tp = p_differ;
17410
17411\t/*** move cursor to start of difference ***/
17412
17413\tcursor(p);
17414
17415\t/*** and output difference ***/
17416
17417\tw = p - first_w;
17418\twhile( w <= last_wind )
17419\t\tputchar(window[w++]);
17420
17421\tcur_phys = w + first_w;
17422\tlast_wind = --new_lw;
17423
17424\tif( last_phys >= w_size )
17425\t{
17426\t\tif( first_w == 0 )
17427\t\t\tlong_char = \'>\';
17428\t\telse if( last_phys < (first_w+w_size) )
17429\t\t\tlong_char = \'<\';
17430\t\telse
17431\t\t\tlong_char = \'*\';
17432\t}
17433\telse
17434\t\tlong_char = \' \';
17435
17436\tif( long_line != long_char )
17437\t{
17438\t\t/*** indicate lines longer than window ***/
17439\t\twhile( w++ < w_size )
17440\t\t{
17441\t\t\tputchar(\' \');
17442\t\t\t++cur_phys;
17443\t\t}
17444\t\tputchar(long_char);
17445\t\t++cur_phys;
17446\t\tlong_line = long_char;
17447\t}
17448
17449\tocur_phys = ncur_phys;
17450\tocur_virt = cur_virt;
17451\tofirst_wind = first_w;
17452
17453\tif( mode==INPUT && cur_virt>INVALID )
17454\t\t++ncur_phys;
17455
17456\tcursor(ncur_phys);
17457\ted_flush();
17458\treturn;
17459}
17460
17461/*{\tREPLACE( char, increment )
17462 *
17463 *\tReplace the cur_virt character with char.  This routine attempts
17464 * to avoid using refresh().
17465 *
17466 *\tincrement\t= TRUE, increment cur_virt after replacement.
17467 *\t\t\t= FALSE, leave cur_virt where it is.
17468 *
17469}*/
17470
17471static void replace __PARAM__((register int c, register int increment), (c, increment)) __OTORP__(register int c; register int increment;)
17472#line 1874
17473{
17474\tregister int cur_window;
17475
17476\tif( cur_virt == INVALID )
17477\t{
17478\t\t/*** can\'t replace invalid cursor ***/
17479\t\tbell;
17480\t\treturn;
17481\t}
17482\tcur_window = cur_phys - first_wind;
17483\tif( ocur_virt == INVALID || !is_print(c)
17484\t\t|| !is_print(virtual[cur_virt])
17485\t\t|| !is_print(o_v_char)
17486#ifdef MULTIBYTE
17487\t\t|| icharset(c) || out_csize(icharset(o_v_char))>1
17488#endif /* MULTIBYTE */
17489\t\t|| (increment==TRUE && (cur_window==w_size-1)
17490\t\t\t|| !is_print(virtual[cur_virt+1])) )
17491\t{
17492\t\t/*** must use standard refresh routine ***/
17493
17494\t\tcdelete(1, BAD);
17495\t\tappend(c, APPEND);
17496\t\tif( increment==TRUE && cur_virt<last_virt )
17497\t\t\t++cur_virt;
17498\t\trefresh(CONTROL);
17499\t}
17500\telse
17501\t{
17502\t\tvirtual[cur_virt] = c;
17503\t\tphysical[cur_phys] = c;
17504\t\twindow[cur_window] = c;
17505\t\tputchar(c);
17506\t\tif( increment == TRUE )
17507\t\t{
17508\t\t\tc = virtual[++cur_virt];
17509\t\t\t++cur_phys;
17510\t\t}
17511\t\telse
17512\t\t{
17513\t\t\tputchar(\'\\b\');
17514\t\t}
17515\t\to_v_char = c;
17516\t\ted_flush();
17517\t}
17518\treturn;
17519}
17520
17521/*
17522#ifdef xxx
17523#endif
17524*/
17525/*{\tRESTORE_V()
17526 *
17527 *\tRestore the contents of virtual space from u_space.
17528 *
17529}*/
17530
17531static void restore_v __PARAM__((void), ())
17532#line 1933
17533{
17534\tregister int tmpcol;
17535\tgenchar tmpspace[MAXLINE];
17536
17537\tif( u_column == INVALID-1 )
17538\t{
17539\t\t/*** never saved anything ***/
17540\t\tbell;
17541\t\treturn;
17542\t}
17543\tgencpy(tmpspace, u_space);
17544\ttmpcol = u_column;
17545\tsave_v();
17546\tgencpy(virtual, tmpspace);
17547\tcur_virt = tmpcol;
17548\tlast_virt = genlen(tmpspace) - 1;
17549\tocur_virt = MAXCHAR;\t/** invalidate refresh optimization **/
17550\treturn;
17551}
17552
17553/*{\tSAVE_LAST()
17554 *
17555 *\tIf the user has typed something, save it in last line.
17556 *
17557}*/
17558
17559static void save_last __PARAM__((void), ())
17560#line 1960
17561{
17562\tregister int i;
17563
17564\tif( (i = cur_virt - first_virt + 1) > 0 )
17565\t{
17566\t\t/*** save last thing user typed ***/
17567\t\tgenncpy(lastline, (&virtual[first_virt]), i);
17568\t\tlastline[i] = \'\\0\';
17569\t}
17570\treturn;
17571}
17572
17573/*{\tSAVE_V()
17574 *
17575 *\tThis routine will save the contents of virtual in u_space.
17576 *
17577}*/
17578
17579static void save_v __PARAM__((void), ())
17580#line 1979
17581{
17582\tif(!inmacro)
17583\t{
17584\t\tvirtual[last_virt + 1] = \'\\0\';
17585\t\tgencpy(u_space, virtual);
17586\t\tu_column = cur_virt;
17587\t}
17588\treturn;
17589}
17590
17591/*{\tSEARCH( mode )
17592 *
17593 *\tSearch history file for regular expression.
17594 *
17595 *\tmode\t= \'/\'\trequire search string and search new to old
17596 *\tmode\t= \'?\'\trequire search string and search old to new
17597 *\tmode\t= \'N\'\trepeat last search in reverse direction
17598 *\tmode\t= \'n\'\trepeat last search
17599 *
17600}*/
17601
17602static int search __PARAM__((register int mode), (mode)) __OTORP__(register int mode;)
17603#line 2001
17604{
17605\tregister int new_direction;
17606\tregister int oldcurhline;
17607\tstatic int direction = -1;
17608\thistloc_t  location;
17609
17610\tif( mode == \'/\' || mode == \'?\')
17611\t{
17612\t\t/*** new search expression ***/
17613\t\tdel_line(BAD);
17614\t\tappend(mode, APPEND);
17615\t\trefresh(INPUT);
17616\t\tfirst_virt = 1;
17617\t\tgetline(SEARCH);
17618\t\tfirst_virt = 0;
17619\t\tvirtual[last_virt + 1] = \'\\0\';\t/*** make null terminated ***/
17620\t\tdirection = mode==\'/\' ? -1 : 1;
17621\t}
17622
17623\tif( cur_virt == INVALID )
17624\t{
17625\t\t/*** no operation ***/
17626\t\treturn(ABORT);
17627\t}
17628
17629\tif( cur_virt==0 ||  fold(mode)==\'N\' )
17630\t{
17631\t\t/*** user wants repeat of last search ***/
17632\t\tdel_line(BAD);
17633\t\tstrcpy( ((char*)virtual)+1, lsearch);
17634#ifdef MULTIBYTE
17635\t\t*((char*)virtual) = \'/\';
17636\t\ted_internal((char*)virtual,virtual);
17637#endif /* MULTIBYTE */
17638\t}
17639
17640\tif( mode == \'N\' )
17641\t\tnew_direction = -direction;
17642\telse
17643\t\tnew_direction = direction;
17644
17645\tif( new_direction==1 && curhline >= histmax )
17646\t\tcurhline = histmin + 1;
17647
17648\t/*** now search ***/
17649
17650\toldcurhline = curhline;
17651#ifdef MULTIBYTE
17652\ted_external(virtual,(char*)virtual);
17653#endif /* MULTIBYTE */
17654\tlocation = hist_find(((char*)virtual)+1, curhline, 1, new_direction);
17655\tstrncpy(lsearch, ((char*)virtual)+1, SEARCHSIZE);
17656\tif( (curhline=location.hist_command) >=0 )
17657\t{
17658\t\treturn(GOOD);
17659\t}
17660
17661\t/*** could not find matching line ***/
17662
17663\tcurhline = oldcurhline;
17664\treturn(BAD);
17665}
17666
17667/*{\tSYNC_CURSOR()
17668 *
17669 *\tThis routine will move the physical cursor to the same
17670 * column as the virtual cursor.
17671 *
17672}*/
17673
17674static void sync_cursor __PARAM__((void), ())
17675#line 2072
17676{
17677\tregister int p;
17678\tregister int v;
17679\tregister int c;
17680\tint new_phys;
17681
17682\tif( cur_virt == INVALID )
17683\t\treturn;
17684
17685\t/*** find physical col that corresponds to virtual col ***/
17686
17687\tnew_phys = 0;
17688\tif(first_wind==ofirst_wind && cur_virt>ocur_virt && ocur_virt!=INVALID)
17689\t{
17690\t\t/*** try to optimize search a little ***/
17691\t\tp = ocur_phys + 1;
17692#ifdef MULTIBYTE
17693\t\twhile(physical[p]==MARKER)
17694\t\t\tp++;
17695#endif /* MULTIBYTE */
17696\t\tv = ocur_virt + 1;
17697\t}
17698\telse
17699\t{
17700\t\tp = 0;
17701\t\tv = 0;
17702\t}
17703\tfor(; v <= last_virt; ++p, ++v)
17704\t{
17705#ifdef MULTIBYTE
17706\t\tint d;
17707\t\tc = virtual[v];
17708\t\tif(d = icharset(c))
17709\t\t{
17710\t\t\tif( v != cur_virt )
17711\t\t\t\tp += (out_csize(d)-1);
17712\t\t}
17713\t\telse
17714#else
17715\t\tc = virtual[v];
17716#endif\t/* MULTIBYTE */
17717\t\tif( !isprint(c) )
17718\t\t{
17719\t\t\tif( c == \'\\t\' )
17720\t\t\t{
17721\t\t\t\tp -= ((p+editb.e_plen)%TABSIZE);
17722\t\t\t\tp += (TABSIZE-1);
17723\t\t\t}
17724\t\t\telse
17725\t\t\t{
17726\t\t\t\t++p;
17727\t\t\t}
17728\t\t}
17729\t\tif( v == cur_virt )
17730\t\t{
17731\t\t\tnew_phys = p;
17732\t\t\tbreak;
17733\t\t}
17734\t}
17735
17736\tif( new_phys < first_wind || new_phys >= first_wind + w_size )
17737\t{
17738\t\t/*** asked to move outside of window ***/
17739
17740\t\twindow[0] = \'\\0\';
17741\t\trefresh(CONTROL);
17742\t\treturn;
17743\t}
17744
17745\tcursor(new_phys);
17746\ted_flush();
17747\tocur_phys = cur_phys;
17748\tocur_virt = cur_virt;
17749\to_v_char = virtual[ocur_virt];
17750
17751\treturn;
17752}
17753
17754/*{\tTEXTMOD( command, mode )
17755 *
17756 *\tModify text operations.
17757 *
17758 *\tmode != 0, repeat previous operation
17759 *
17760}*/
17761
17762static int textmod __PARAM__((register int c, int mode), (c, mode)) __OTORP__(register int c; int mode;)
17763#line 2159
17764{
17765\tregister int i;
17766\tregister genchar *p = lastline;
17767\tregister int trepeat = repeat;
17768\tstatic int lastmacro;
17769\tgenchar *savep;
17770
17771\tif(mode && (fold(lastmotion)==\'F\' || fold(lastmotion)==\'T\'))
17772\t\tlastmotion = \';\';
17773
17774\tif( fold(c) == \'P\' )
17775\t{
17776\t\t/*** change p from lastline to yankbuf ***/
17777\t\tp = yankbuf;
17778\t}
17779
17780addin:
17781\tswitch( c )
17782\t{
17783\t\t\t/***** Input commands *****/
17784
17785#ifdef KSHELL
17786\tcase \'*\':\t\t/** do file name expansion in place **/
17787\tcase \'\\\\\':\t\t/** do file name completion in place **/
17788\t\tif( cur_virt == INVALID )
17789\t\t\treturn(BAD);
17790\tcase \'=\':\t\t/** list file name expansions **/
17791\t\tsave_v();
17792\t\ti = last_virt;
17793\t\t++last_virt;
17794\t\tvirtual[last_virt] = 0;
17795\t\tif( ed_expand((char*)virtual, &cur_virt, &last_virt, c) )
17796\t\t{
17797\t\t\tlast_virt = i;
17798\t\t\tbell;
17799\t\t}
17800\t\telse if(c == \'=\')
17801\t\t{
17802\t\t\tlast_virt = i;
17803\t\t\tnonewline++;
17804\t\t\ted_ungetchar(cntl(\'L\'));
17805\t\t\treturn(GOOD);
17806\t\t}
17807\t\telse
17808\t\t{
17809\t\t\t--cur_virt;
17810\t\t\t--last_virt;
17811\t\t\tocur_virt = MAXCHAR;
17812\t\t\treturn(APPEND);
17813\t\t}
17814\t\tbreak;
17815
17816\tcase \'@\':\t\t/** macro expansion **/
17817\t\tif( mode )
17818\t\t\tc = lastmacro;
17819\t\telse
17820\t\t\tif((c=getrchar())==ESC)
17821\t\t\t\treturn(GOOD);
17822\t\tif(!inmacro)
17823\t\t\tlastmacro = c;
17824\t\tif(ed_macro(c))
17825\t\t{
17826\t\t\tsave_v();
17827\t\t\tinmacro++;
17828\t\t\treturn(GOOD);
17829\t\t}
17830\t\tbell;
17831\t\treturn(BAD);
17832
17833#endif\t/* KSHELL */
17834\tcase \'_\':\t\t/** append last argument of prev command **/
17835\t\tsave_v();
17836\t\t{
17837\t\t\tgenchar tmpbuf[MAXLINE];
17838\t\t\tif(repeat_set==0)
17839\t\t\t\trepeat = -1;
17840\t\t\tp = (genchar*)hist_word(tmpbuf,MAXLINE,repeat);
17841#ifndef KSHELL
17842\t\t\tif(p==0)
17843\t\t\t{
17844\t\t\t\tbell;
17845\t\t\t\tbreak;
17846\t\t\t}
17847#endif\t/* KSHELL */
17848#ifdef MULTIBYTE
17849\t\t\ted_internal((char*)p,tmpbuf);
17850\t\t\tp = tmpbuf;
17851#endif /* MULTIBYTE */
17852\t\t\ti = \' \';
17853\t\t\tdo
17854\t\t\t{
17855\t\t\t\tappend(i,APPEND);
17856\t\t\t}
17857\t\t\twhile(i = *p++);
17858\t\t\treturn(APPEND);
17859\t\t}
17860
17861\tcase \'A\':\t\t/** append to end of line **/
17862\t\tcur_virt = last_virt;
17863\t\tsync_cursor();
17864
17865\tcase \'a\':\t\t/** append **/
17866\t\tif( fold(mode) == \'A\' )
17867\t\t{
17868\t\t\tc = \'p\';
17869\t\t\tgoto addin;
17870\t\t}
17871\t\tsave_v();
17872\t\tif( cur_virt != INVALID )
17873\t\t{
17874\t\t\tfirst_virt = cur_virt + 1;
17875\t\t\tcursor(cur_phys + 1);
17876\t\t\ted_flush();
17877\t\t}
17878\t\treturn(APPEND);
17879
17880\tcase \'I\':\t\t/** insert at beginning of line **/
17881\t\tcur_virt = first_virt;
17882\t\tsync_cursor();
17883
17884\tcase \'i\':\t\t/** insert **/
17885\t\tif( fold(mode) == \'I\' )
17886\t\t{
17887\t\t\tc = \'P\';
17888\t\t\tgoto addin;
17889\t\t}
17890\t\tsave_v();
17891\t\tif( cur_virt != INVALID )
17892 \t\t{
17893 \t\t\to_v_char = virtual[cur_virt];
17894\t\t\tfirst_virt = cur_virt--;
17895  \t\t}
17896\t\treturn(INSERT);
17897
17898\tcase \'C\':\t\t/** change to eol **/
17899\t\tc = \'$\';
17900\t\tgoto chgeol;
17901
17902\tcase \'c\':\t\t/** change **/
17903\t\tif( mode )
17904\t\t\tc = lastmotion;
17905\t\telse
17906\t\t\tc = getcount(getchar());
17907chgeol:
17908\t\tlastmotion = c;
17909\t\tif( c == \'c\' )
17910\t\t{
17911\t\t\tdel_line(GOOD);
17912\t\t\treturn(APPEND);
17913\t\t}
17914
17915\t\tif( delmotion(c, \'c\') == BAD )
17916\t\t\treturn(BAD);
17917
17918\t\tif( mode == \'c\' )
17919\t\t{
17920\t\t\tc = \'p\';
17921\t\t\ttrepeat = 1;
17922\t\t\tgoto addin;
17923\t\t}
17924\t\tfirst_virt = cur_virt + 1;
17925\t\treturn(APPEND);
17926
17927\tcase \'D\':\t\t/** delete to eol **/
17928\t\tc = \'$\';
17929\t\tgoto deleol;
17930
17931\tcase \'d\':\t\t/** delete **/
17932\t\tif( mode )
17933\t\t\tc = lastmotion;
17934\t\telse
17935\t\t\tc = getcount(getchar());
17936deleol:
17937\t\tlastmotion = c;
17938\t\tif( c == \'d\' )
17939\t\t{
17940\t\t\tdel_line(GOOD);
17941\t\t\tbreak;
17942\t\t}
17943\t\tif( delmotion(c, \'d\') == BAD )
17944\t\t\treturn(BAD);
17945\t\tif( cur_virt < last_virt )
17946\t\t\t++cur_virt;
17947\t\tbreak;
17948
17949\tcase \'P\':
17950\t\tif( p[0] == \'\\0\' )
17951\t\t\treturn(BAD);
17952\t\tif( cur_virt != INVALID )
17953\t\t{
17954\t\t\ti = virtual[cur_virt];
17955\t\t\tif(!is_print(i))
17956\t\t\t\tocur_virt = INVALID;
17957\t\t\t--cur_virt;
17958\t\t}
17959
17960\tcase \'p\':\t\t/** print **/
17961\t\tif( p[0] == \'\\0\' )
17962\t\t\treturn(BAD);
17963
17964\t\tif( mode != \'s\' && mode != \'c\' )
17965\t\t{
17966\t\t\tsave_v();
17967\t\t\tif( c == \'P\' )
17968\t\t\t{
17969\t\t\t\t/*** fix stored cur_virt ***/
17970\t\t\t\t++u_column;
17971\t\t\t}
17972\t\t}
17973\t\tif( mode == \'R\' )
17974\t\t\tmode = REPLACE;
17975\t\telse
17976\t\t\tmode = APPEND;
17977\t\tsavep = p;
17978\t\tfor(i=0; i<trepeat; ++i)
17979\t\t{
17980\t\t\twhile(c= *p++)
17981\t\t\t\tappend(c,mode);
17982\t\t\tp = savep;
17983\t\t}
17984\t\tbreak;
17985
17986\tcase \'R\':\t\t/* Replace many chars **/
17987\t\tif( mode == \'R\' )
17988\t\t{
17989\t\t\tc = \'P\';
17990\t\t\tgoto addin;
17991\t\t}
17992\t\tsave_v();
17993\t\tif( cur_virt != INVALID )
17994\t\t\tfirst_virt = cur_virt;
17995\t\treturn(REPLACE);
17996
17997\tcase \'r\':\t\t/** replace **/
17998\t\tif( mode )
17999\t\t\tc = *p;
18000\t\telse
18001\t\t\tif((c=getrchar())==ESC)
18002\t\t\t\treturn(GOOD);
18003\t\t*p = c;
18004\t\tsave_v();
18005\t\twhile(trepeat--)
18006\t\t\treplace(c, trepeat!=0);
18007\t\treturn(GOOD);
18008
18009\tcase \'S\':\t\t/** Substitute line - cc **/
18010\t\tc = \'c\';
18011\t\tgoto chgeol;
18012
18013\tcase \'s\':\t\t/** substitute **/
18014\t\tsave_v();
18015\t\tcdelete(repeat, BAD);
18016\t\tif( mode )
18017\t\t{
18018\t\t\tc = \'p\';
18019\t\t\ttrepeat = 1;
18020\t\t\tgoto addin;
18021\t\t}
18022\t\tfirst_virt = cur_virt + 1;
18023\t\treturn(APPEND);
18024
18025\tcase \'Y\':\t\t/** Yank to end of line **/
18026\t\tc = \'$\';
18027\t\tgoto yankeol;
18028
18029\tcase \'y\':\t\t/** yank thru motion **/
18030\t\tif( mode )
18031\t\t\tc = lastmotion;
18032\t\telse
18033\t\t\tc = getcount(getchar());
18034yankeol:
18035\t\tlastmotion = c;
18036\t\tif( c == \'y\' )
18037\t\t{
18038\t\t\tgencpy(yankbuf, virtual);
18039\t\t}
18040\t\telse if( delmotion(c, \'y\') == BAD )
18041\t\t{
18042\t\t\treturn(BAD);
18043\t\t}
18044\t\tbreak;
18045
18046\tcase \'x\':\t\t/** delete repeat chars forward - dl **/
18047\t\tc = \'l\';
18048\t\tgoto deleol;
18049
18050\tcase \'X\':\t\t/** delete repeat chars backward - dh **/
18051\t\tc = \'h\';
18052\t\tgoto deleol;
18053
18054\tcase \'~\':\t\t/** invert case and advance **/
18055\t\tif( cur_virt != INVALID )
18056\t\t{
18057\t\t\tsave_v();
18058\t\t\ti = INVALID;
18059\t\t\twhile(trepeat-->0 && i!=cur_virt)
18060\t\t\t{
18061\t\t\t\ti = cur_virt;
18062\t\t\t\tc = virtual[cur_virt];
18063#ifdef MULTIBYTE
18064\t\t\t\tif((c&~STRIP)==0)
18065#endif /* MULTIBYTE */
18066\t\t\t\tif( isupper(c) )
18067\t\t\t\t\tc = tolower(c);
18068\t\t\t\telse if( islower(c) )
18069\t\t\t\t\tc = toupper(c);
18070\t\t\t\treplace(c, TRUE);
18071\t\t\t}
18072\t\t\treturn(GOOD);
18073\t\t}
18074\t\telse
18075\t\t\treturn(BAD);
18076
18077\tdefault:
18078\t\treturn(BAD);
18079\t}
18080\trefresh(CONTROL);
18081\treturn(GOOD);
18082}
18083
18084#ifdef INT16
18085
18086/* making these functions reduces the size of the text region */
18087
18088static int isalph __PARAM__((register int c), (c)) __OTORP__(register int c;)
18089#line 2484
18090{
18091\tregister int v = virtual[c];
18092\treturn(isalnum(v));
18093}
18094
18095static int isblank __PARAM__((register int c), (c)) __OTORP__(register int c;)
18096#line 2490
18097{
18098\tregister int v = virtual[c];
18099\treturn(isspace(v));
18100}
18101
18102static int ismetach __PARAM__((register int c), (c)) __OTORP__(register int c;)
18103#line 2496
18104{
18105\tregister int v = virtual[c];
18106\treturn(ismeta(v));
18107}
18108
18109#endif\t/* INT16 */
18110
18111
18112#ifdef MULTIBYTE
18113int isalph(c)
18114register int c;
18115{
18116\tregister int v = virtual[c];
18117\treturn((v&~STRIP) || isalnum(v));
18118}
18119
18120
18121int isblank(c)
18122register int c;
18123{
18124\tregister int v = virtual[c];
18125\treturn((v&~STRIP)==0 && isspace(v));
18126}
18127
18128int ismetach(c)
18129register int c;
18130{
18131\tregister int v = virtual[c];
18132\treturn((v&~STRIP)==0 && ismeta(v));
18133}
18134
18135#endif\t/* MULTIBYTE */
18136
18137/*
18138 * get a character, after ^V processing
18139 */
18140static int getrchar()
18141{
18142\tregister int c;
18143\tif((c=getchar())== cntl(\'V\'))
18144\t{
18145\t\tin_raw++;
18146\t\tc = getchar();
18147\t\tin_raw = 0;
18148\t}
18149\treturn(c);
18150}'
18151	EXEC -nh
18152		INPUT - $'#pragma prototyped
18153
18154/*
18155 * posix regex executor
18156 * single sized-record interface
18157 */
18158
18159/*nclude "reglib.*/
18160
18161#ifdef _AST_REGEX_DEBUG
18162#define DEBUG_TEST(f,y,n)	((debug&(f))?(y):(n))
18163#define DEBUG_CODE(f,y,n)	do if(debug&(f)){y}else{n} while(0)
18164#define DEBUG_INIT()		do { char* t; if (!debug) { debug = 0x80000000; if (t = getenv("_AST_regex_debug")) debug |= strtoul(t, NiL, 0); } } while (0)
18165static unsigned long	debug;
18166#else
18167#define DEBUG_INIT()
18168#define DEBUG_TEST(f,y,n)	(n)
18169#define DEBUG_CODE(f,y,n)	do {n} while(0)
18170#endif
18171
18172#define BEG_ALT		1	/* beginning of an alt			*/
18173#define BEG_ONE		2	/* beginning of one iteration of a rep	*/
18174#define BEG_REP		3	/* beginning of a repetition		*/
18175#define BEG_SUB		4	/* beginning of a subexpression		*/
18176#define END_ANY		5	/* end of any of above			*/
18177
18178/*
18179 * returns from parse()
18180 */
18181
18182#define NONE		0	/* no parse found			*/
18183#define GOOD		1	/* some parse was found			*/
18184#define BEST		2	/* an unbeatable parse was found	*/
18185#define BAD		3	/* error ocurred			*/
18186
18187/*
18188 * REG_SHELL_DOT test
18189 */
18190
18191#define LEADING(e,r,s)	((e)->leading&&*(s)==\'.\'&&((s)==(e)->beg||*((s)-1)==(r)->explicit))
18192
18193/*
18194 * Pos_t is for comparing parses. An entry is made in the
18195 * array at the beginning and at the end of each Group_t,
18196 * each iteration in a Group_t, and each Binary_t.
18197 */
18198
18199typedef struct
18200{
18201	unsigned char*	p;		/* where in string		*/
18202	size_t		length;		/* length in string		*/
18203	short		serial;		/* preorder subpattern number	*/
18204	short		be;		/* which end of pair		*/
18205} Pos_t;
18206
18207/* ===== begin library support ===== */
18208
18209#define vector(t,v,i)	(((i)<(v)->max)?(t*)((v)->vec+(i)*(v)->siz):(t*)vecseek(&(v),i))
18210
18211static Vector_t*
18212vecopen(int inc, int siz)
18213{
18214	Vector_t*	v;
18215	Stk_t*		sp;
18216
18217	if (inc <= 0)
18218		inc = 16;
18219	if (!(sp = stkopen(STK_SMALL|STK_NULL)))
18220		return 0;
18221	if (!(v = (Vector_t*)stkseek(sp, sizeof(Vector_t) + inc * siz)))
18222	{
18223		stkclose(sp);
18224		return 0;
18225	}
18226	v->stk = sp;
18227	v->vec = (char*)v + sizeof(Vector_t);
18228	v->max = v->inc = inc;
18229	v->siz = siz;
18230	v->cur = 0;
18231	return v;
18232}
18233
18234static void*
18235vecseek(Vector_t** p, int index)
18236{
18237	Vector_t*	v = *p;
18238
18239	if (index >= v->max)
18240	{
18241		while ((v->max += v->inc) <= index);
18242		if (!(v = (Vector_t*)stkseek(v->stk, sizeof(Vector_t) + v->max * v->siz)))
18243			return 0;
18244		*p = v;
18245		v->vec = (char*)v + sizeof(Vector_t);
18246	}
18247	return v->vec + index * v->siz;
18248}
18249
18250static void
18251vecclose(Vector_t* v)
18252{
18253	if (v)
18254		stkclose(v->stk);
18255}
18256
18257typedef struct
18258{
18259	Stk_pos_t	pos;
18260	char		data[1];
18261} Stk_frame_t;
18262
18263#define stknew(s,p)	((p)->offset=stktell(s),(p)->base=stkfreeze(s,0))
18264#define stkold(s,p)	stkset(s,(p)->base,(p)->offset)
18265
18266#define stkframe(s)	(*((Stk_frame_t**)(s)->_next-1))
18267#define stkdata(s,t)	((t*)stkframe(s)->data)
18268#define stkpop(s)	stkold(s,&(stkframe(s)->pos))
18269
18270static void*
18271stkpush(Stk_t* sp, size_t size)
18272{
18273	Stk_frame_t*	f;
18274	Stk_pos_t	p;
18275
18276	stknew(sp, &p);
18277	size = sizeof(Stk_frame_t) + sizeof(size_t) + size - 1;
18278	if (!(f = (Stk_frame_t*)stkalloc(sp, sizeof(Stk_frame_t) + sizeof(Stk_frame_t*) + size - 1)))
18279		return 0;
18280	f->pos = p;
18281	stkframe(sp) = f;
18282	return f->data;
18283}
18284
18285/* ===== end library support ===== */
18286
18287/*
18288 * Match_frame_t is for saving and restoring match records
18289 * around alternate attempts, so that fossils will not be
18290 * left in the match array.  These are the only entries in
18291 * the match array that are not otherwise guaranteed to
18292 * have current data in them when they get used.
18293 */
18294
18295typedef struct
18296{
18297	size_t			size;
18298	regmatch_t*		match;
18299	regmatch_t		save[1];
18300} Match_frame_t;
18301
18302#define matchframe	stkdata(stkstd,Match_frame_t)
18303#define matchpush(e,x)	((x)->re.group.number?_matchpush(e,x):0)
18304#define matchcopy(e,x)	((x)->re.group.number?memcpy(matchframe->match,matchframe->save,matchframe->size):(void*)0)
18305#define matchpop(e,x)	((x)->re.group.number?memcpy(matchframe->match,matchframe->save,matchframe->size),stkpop(stkstd):(void*)0)
18306
18307#define pospop(e)	(--(e)->pos->cur)
18308
18309/*
18310 * allocate a frame and push a match onto the stack
18311 */
18312
18313static int
18314_matchpush(Env_t* env, Rex_t* rex)
18315{
18316	Match_frame_t*	f;
18317	regmatch_t*	m;
18318	regmatch_t*	e;
18319	regmatch_t*	s;
18320	int		num;
18321
18322	if (rex->re.group.number <= 0 || (num = rex->re.group.last - rex->re.group.number + 1) <= 0)
18323		num = 0;
18324	if (!(f = (Match_frame_t*)stkpush(stkstd, sizeof(Match_frame_t) + (num - 1) * sizeof(regmatch_t))))
18325	{
18326		env->error = REG_ESPACE;
18327		return 1;
18328	}
18329	f->size = num * sizeof(regmatch_t);
18330	f->match = m = env->match + rex->re.group.number;
18331	e = m + num;
18332	s = f->save;
18333	while (m < e)
18334	{
18335		*s++ = *m;
18336		*m++ = state.nomatch;
18337	}
18338	return 0;
18339}
18340
18341/*
18342 * allocate a frame and push a pos onto the stack
18343 */
18344
18345static int
18346pospush(Env_t* env, Rex_t* rex, unsigned char* p, int be)
18347{
18348	Pos_t*	pos;
18349
18350	if (!(pos = vector(Pos_t, env->pos, env->pos->cur)))
18351	{
18352		env->error = REG_ESPACE;
18353		return 1;
18354	}
18355	pos->serial = rex->serial;
18356	pos->p = p;
18357	pos->be = be;
18358	env->pos->cur++;
18359	return 0;
18360}
18361
18362/*
18363 * two matches are known to have the same length
18364 * os is start of old pos array, ns is start of new,
18365 * oend and nend are end+1 pointers to ends of arrays.
18366 * oe and ne are ends (not end+1) of subarrays.
18367 * returns 1 if new is better, -1 if old, else 0.
18368 */
18369
18370#if _AST_REGEX_DEBUG
18371
18372static void
18373showmatch(regmatch_t* p)
18374{
18375	sfputc(sfstdout, \'(\');
18376	if (p->rm_so < 0)
18377		sfputc(sfstdout, \'?\');
18378	else
18379		sfprintf(sfstdout, "%d", p->rm_so);
18380	sfputc(sfstdout, \',\');
18381	if (p->rm_eo < 0)
18382		sfputc(sfstdout, \'?\');
18383	else
18384		sfprintf(sfstdout, "%d", p->rm_eo);
18385	sfputc(sfstdout, \')\');
18386}
18387
18388static int
18389better(Env_t* env, Pos_t* os, Pos_t* ns, Pos_t* oend, Pos_t* nend, int level)
18390#define better	_better
18391{
18392	int	i;
18393
18394	DEBUG_CODE(0x0040,{sfprintf(sfstdout, "AHA better old ");for (i = 0; i <= env->nsub; i++)showmatch(&env->best[i]);sfprintf(sfstdout, "\\n           new ");for (i = 0; i <= env->nsub; i++)showmatch(&env->match[i]);sfprintf(sfstdout, "\\n");},{0;});
18395	i = better(env, os, ns, oend, nend, 0);
18396	DEBUG_TEST(0x0040,(sfprintf(sfstdout, "           %s\\n", i <= 0 ? "OLD" : "NEW")),(0));
18397	return i;
18398}
18399
18400#endif
18401
18402static int
18403better(Env_t* env, Pos_t* os, Pos_t* ns, Pos_t* oend, Pos_t* nend, int level)
18404{
18405	Pos_t*	oe;
18406	Pos_t*	ne;
18407	int	k;
18408	int	n;
18409
18410	if (env->error)
18411		return -1;
18412	for (;;)
18413	{
18414		DEBUG_CODE(0x0040,{sfprintf(sfstdout, "   %-*.*sold ", (level + 3) * 4, (level + 3) * 4, "");for (oe = os; oe < oend; oe++)sfprintf(sfstdout, "<%d,%d,%d>", oe->p - env->beg, oe->serial, oe->be);sfprintf(sfstdout, "\\n   %-*.*snew ", (level + 3) * 4, (level + 3) * 4, "");for (oe = ns; oe < nend; oe++)sfprintf(sfstdout, "<%d,%d,%d>", oe->p - env->beg, oe->serial, oe->be);sfprintf(sfstdout, "\\n");},{0;});
18415		if (ns >= nend)
18416			return DEBUG_TEST(0x2000,(os < oend),(0));
18417		if (os >= oend)
18418			return DEBUG_TEST(0x2000,(-1),(1));
18419		n = os->serial;
18420		if (ns->serial > n)
18421			return -1;
18422		if (n > ns->serial)
18423		{
18424			env->error = REG_PANIC;
18425			return -1;
18426		}
18427		if (ns->p > os->p)
18428			return 1;
18429		if (os->p > ns->p)
18430			return -1;
18431		oe = os;
18432		k = 0;
18433		for (;;)
18434			if ((++oe)->serial == n)
18435			{
18436				if (oe->be != END_ANY)
18437					k++;
18438				else if (k-- <= 0)
18439					break;
18440			}
18441		ne = ns;
18442		k = 0;
18443		for (;;)
18444			if ((++ne)->serial == n)
18445			{
18446				if (ne->be != END_ANY)
18447					k++;
18448				else if (k-- <= 0)
18449					break;
18450			}
18451		if (ne->p > oe->p)
18452			return 1;
18453		if (oe->p > ne->p)
18454			return -1;
18455		if (k = better(env, os + 1, ns + 1, oe, ne, level + 1))
18456			return k;
18457		os = oe + 1;
18458		ns = ne + 1;
18459	}
18460}
18461
18462#undef	better
18463
18464#define follow(e,r,c,s)	((r)->next?parse(e,(r)->next,c,s):(c)?parse(e,c,0,s):BEST)
18465
18466static int		parse(Env_t*, Rex_t*, Rex_t*, unsigned char*);
18467
18468static int
18469parserep(Env_t* env, Rex_t* rex, Rex_t* cont, unsigned char* s, int n)
18470{
18471	int	i;
18472	int	r = NONE;
18473	Rex_t	catcher;
18474
18475	DEBUG_TEST(0x0010,(sfprintf(sfstdout, "AHA#%d parserep %d %d %d `%-.*s\'\\n", __LINE__, rex->lo, n, rex->hi, env->end - s, s)),(0));
18476	if ((rex->flags & REG_MINIMAL) && n >= rex->lo && n < rex->hi)
18477	{
18478		if (env->stack && pospush(env, rex, s, END_ANY))
18479			return BAD;
18480		i = follow(env, rex, cont, s);
18481		if (env->stack)
18482			pospop(env);
18483		switch (i)
18484		{
18485		case BAD:
18486			return BAD;
18487		case BEST:
18488		case GOOD:
18489			return BEST;
18490		}
18491	}
18492	if (n < rex->hi)
18493	{
18494		catcher.type = REX_REP_CATCH;
18495		catcher.serial = rex->serial;
18496		catcher.re.rep_catch.ref = rex;
18497		catcher.re.rep_catch.cont = cont;
18498		catcher.re.rep_catch.beg = s;
18499		catcher.re.rep_catch.n = n + 1;
18500		catcher.next = rex->next;
18501		if (env->stack)
18502		{
18503DEBUG_TEST(0x0001,(sfprintf(sfstdout,"AHA#%d PUSH (%d,%d)(%d,%d) (%d,%d)(%d,%d)\\n", __LINE__, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo)),(0));
18504			if (matchpush(env, rex))
18505				return BAD;
18506			if (pospush(env, rex, s, BEG_ONE))
18507				return BAD;
18508DEBUG_TEST(0x0001,(sfprintf(sfstdout,"AHA#%d PUSH (%d,%d)(%d,%d) (%d,%d)(%d,%d)\\n", __LINE__, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo)),(0));
18509		}
18510		r = parse(env, rex->re.group.expr.rex, &catcher, s);
18511		DEBUG_TEST(0x0010,(sfprintf(sfstdout, "AHA#%d parserep parse %d `%-.*s\'\\n", __LINE__, r, env->end - s, s)),(0));
18512		if (env->stack)
18513		{
18514DEBUG_TEST(0x0001,(sfprintf(sfstdout,"AHA#%d POP (%d,%d)(%d,%d) (%d,%d)(%d,%d)\\n", __LINE__, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo)),(0));
18515			pospop(env);
18516			matchpop(env, rex);
18517DEBUG_TEST(0x0001,(sfprintf(sfstdout,"AHA#%d POP (%d,%d)(%d,%d) (%d,%d)(%d,%d)\\n", __LINE__, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo)),(0));
18518		}
18519		switch (r)
18520		{
18521		case BAD:
18522			return BAD;
18523		case BEST:
18524			return BEST;
18525		case GOOD:
18526			if (rex->flags & REG_MINIMAL)
18527				return BEST;
18528			r = GOOD;
18529			break;
18530		}
18531	}
18532	if (n < rex->lo)
18533		return r;
18534	if (!(rex->flags & REG_MINIMAL) || n >= rex->hi)
18535	{
18536		if (env->stack && pospush(env, rex, s, END_ANY))
18537			return BAD;
18538		i = follow(env, rex, cont, s);
18539		if (env->stack)
18540			pospop(env);
18541		switch (i)
18542		{
18543		case BAD:
18544			r = BAD;
18545			break;
18546		case BEST:
18547			r = BEST;
18548			break;
18549		case GOOD:
18550			r = (rex->flags & REG_MINIMAL) ? BEST : GOOD;
18551			break;
18552		}
18553	}
18554	return r;
18555}
18556
18557static int
18558parsetrie(Env_t* env, Trie_node_t* x, Rex_t* rex, Rex_t* cont, unsigned char* s)
18559{
18560	unsigned char*	p;
18561	int		r;
18562
18563	if (rex->flags & REG_ICASE)
18564	{
18565		p = state.fold;
18566		for (;;)
18567		{
18568			if (s >= env->end)
18569				return NONE;
18570			while (x->c != p[*s])
18571				if (!(x = x->sib))
18572					return NONE;
18573			if (x->end)
18574				break;
18575			x = x->son;
18576			s++;
18577		}
18578	}
18579	else
18580	{
18581		for (;;)
18582		{
18583			if (s >= env->end)
18584				return NONE;
18585			while (x->c != *s)
18586				if (!(x = x->sib))
18587					return NONE;
18588			if (x->end)
18589				break;
18590			x = x->son;
18591			s++;
18592		}
18593	}
18594	s++;
18595	if (rex->flags & REG_MINIMAL)
18596		switch (follow(env, rex, cont, s))
18597		{
18598		case BAD:
18599			return BAD;
18600		case BEST:
18601		case GOOD:
18602			return BEST;
18603		}
18604	if (x->son)
18605		switch (parsetrie(env, x->son, rex, cont, s))
18606		{
18607		case BAD:
18608			return BAD;
18609		case BEST:
18610			return BEST;
18611		case GOOD:
18612			if (rex->flags & REG_MINIMAL)
18613				return BEST;
18614			r = GOOD;
18615			break;
18616		default:
18617			r = NONE;
18618			break;
18619		}
18620	else
18621		r = NONE;
18622	if (!(rex->flags & REG_MINIMAL))
18623		switch (follow(env, rex, cont, s))
18624		{
18625		case BAD:
18626			return BAD;
18627		case BEST:
18628			return BEST;
18629		case GOOD:
18630			return GOOD;
18631	}
18632	return r;
18633}
18634
18635static int
18636collmatch(Rex_t* rex, unsigned char* s, unsigned char* e, unsigned char** p)
18637{
18638	register Celt_t*	ce;
18639	unsigned char*		t;
18640	wchar_t			c;
18641	int			w;
18642	int			r;
18643	int			x;
18644	Ckey_t			key;
18645	Ckey_t			elt;
18646
18647	if ((w = mbsize(s)) > 1)
18648	{
18649		memcpy((char*)key, (char*)s, w);
18650		key[w] = 0;
18651		mbxfrm(elt, key, COLL_KEY_MAX);
18652		t = s;
18653		c = mbchar(t);
18654		x = 0;
18655	}
18656	else
18657	{
18658		key[0] = s[0];
18659		key[1] = 0;
18660		r = mbxfrm(elt, key, COLL_KEY_MAX);
18661		while (w < COLL_KEY_MAX && &s[w] < e)
18662		{
18663			key[w] = s[w];
18664			key[w + 1] = 0;
18665			if (mbxfrm(elt, key, COLL_KEY_MAX) != r)
18666				break;
18667			w++;
18668		}
18669		key[w] = 0;
18670		mbxfrm(elt, key, COLL_KEY_MAX);
18671		c = s[0];
18672		x = w - 1;
18673	}
18674	r = 1;
18675	for (ce = rex->re.collate.elements;; ce++)
18676	{
18677		switch (ce->typ)
18678		{
18679		case COLL_call:
18680			if (!x && (*ce->fun)(c))
18681				break;
18682			continue;
18683		case COLL_char:
18684			if (!strcmp((char*)ce->beg, (char*)elt))
18685				break;
18686			continue;
18687		case COLL_range:
18688			if (strcmp((char*)ce->beg, (char*)elt) <= ce->min && strcmp((char*)elt, (char*)ce->end) <= ce->max)
18689				break;
18690			continue;
18691		case COLL_range_lc:
18692			if (strcmp((char*)ce->beg, (char*)elt) <= ce->min && strcmp((char*)elt, (char*)ce->end) <= ce->max && (islower(c) || !isupper(c)))
18693				break;
18694			continue;
18695		case COLL_range_uc:
18696			if (strcmp((char*)ce->beg, (char*)elt) <= ce->min && strcmp((char*)elt, (char*)ce->end) <= ce->max && (isupper(c) || !islower(c)))
18697				break;
18698			continue;
18699		default:
18700			r = 0;
18701			break;
18702		}
18703		if (!x || r)
18704			break;
18705		r = 1;
18706		w = x--;
18707		key[w] = 0;
18708		mbxfrm(elt, key, COLL_KEY_MAX);
18709	}
18710	*p = s + w;
18711	return rex->re.collate.invert ? !r : r;
18712}
18713
18714static int
18715parse(Env_t* env, Rex_t* rex, Rex_t* cont, unsigned char* s)
18716{
18717	int		c;
18718	int		d;
18719	int		i;
18720	int		m;
18721	int		n;
18722	int		r;
18723	int*		f;
18724	unsigned char*	p;
18725	unsigned char*	t;
18726	unsigned char*	b;
18727	unsigned char*	e;
18728	regmatch_t*	o;
18729	Trie_node_t*	x;
18730	Rex_t*		q;
18731	Rex_t		catcher;
18732	Rex_t		next;
18733
18734	for (;;)
18735	{
18736		switch (rex->type)
18737		{
18738		case REX_ALT:
18739			if (matchpush(env, rex))
18740				return BAD;
18741			if (pospush(env, rex, s, BEG_ALT))
18742				return BAD;
18743			catcher.type = REX_ALT_CATCH;
18744			catcher.serial = rex->serial;
18745			catcher.re.alt_catch.cont = cont;
18746			catcher.next = rex->next;
18747			r = parse(env, rex->re.group.expr.binary.left, &catcher, s);
18748			if (r < BEST || (rex->flags & REG_MINIMAL))
18749			{
18750				matchcopy(env, rex);
18751				((Pos_t*)env->pos->vec + env->pos->cur - 1)->serial = catcher.serial = rex->re.group.expr.binary.serial;
18752				n = parse(env, rex->re.group.expr.binary.right, &catcher, s);
18753				if (n != NONE)
18754					r = n;
18755			}
18756			pospop(env);
18757			matchpop(env, rex);
18758			return r;
18759		case REX_ALT_CATCH:
18760			if (pospush(env, rex, s, END_ANY))
18761				return BAD;
18762			r = follow(env, rex, rex->re.alt_catch.cont, s);
18763			pospop(env);
18764			return r;
18765		case REX_BACK:
18766			o = &env->match[rex->lo];
18767			if (o->rm_so < 0)
18768				return NONE;
18769			i = o->rm_eo - o->rm_so;
18770			e = s + i;
18771			if (e > env->end)
18772				return NONE;
18773			t = env->beg + o->rm_so;
18774			if (!(rex->flags & REG_ICASE))
18775			{
18776				while (s < e)
18777					if (*s++ != *t++)
18778						return NONE;
18779			}
18780			else if (!mbwide())
18781			{
18782				p = state.fold;
18783				while (s < e)
18784					if (p[*s++] != p[*t++])
18785						return NONE;
18786			}
18787			else
18788			{
18789				while (s < e)
18790				{
18791					c = mbchar(s);
18792					d = mbchar(t);
18793					if (toupper(c) != toupper(d))
18794						return NONE;
18795				}
18796			}
18797			break;
18798		case REX_BEG:
18799			if ((!(rex->flags & REG_NEWLINE) || s <= env->beg || *(s - 1) != \'\\n\') && ((env->flags & REG_NOTBOL) || s != env->beg))
18800				return NONE;
18801			break;
18802		case REX_CLASS:
18803			if (LEADING(env, rex, s))
18804				return NONE;
18805			n = rex->hi;
18806			if (n > env->end - s)
18807				n = env->end - s;
18808			m = rex->lo;
18809			if (m > n)
18810				return NONE;
18811			r = NONE;
18812			if (!(rex->flags & REG_MINIMAL))
18813			{
18814				for (i = 0; i < n; i++)
18815					if (!settst(rex->re.charclass, s[i]))
18816					{
18817						n = i;
18818						break;
18819					}
18820				for (s += n; n-- >= m; s--)
18821					switch (follow(env, rex, cont, s))
18822					{
18823					case BAD:
18824						return BAD;
18825					case BEST:
18826						return BEST;
18827					case GOOD:
18828						r = GOOD;
18829						break;
18830					}
18831			}
18832			else
18833			{
18834				for (e = s + m; s < e; s++)
18835					if (!settst(rex->re.charclass, *s))
18836						return r;
18837				e += n - m;
18838				for (;;)
18839				{
18840					switch (follow(env, rex, cont, s))
18841					{
18842					case BAD:
18843						return BAD;
18844					case BEST:
18845					case GOOD:
18846						return BEST;
18847					}
18848					if (s >= e || !settst(rex->re.charclass, *s))
18849						break;
18850					s++;
18851				}
18852			}
18853			return r;
18854		case REX_COLL_CLASS:
18855			if (LEADING(env, rex, s))
18856				return NONE;
18857			n = rex->hi;
18858			if (n > env->end - s)
18859				n = env->end - s;
18860			m = rex->lo;
18861			if (m > n)
18862				return NONE;
18863			r = NONE;
18864			e = env->end;
18865			if (!(rex->flags & REG_MINIMAL))
18866			{
18867				if (!(b = (unsigned char*)stkpush(stkstd, n)))
18868				{
18869					env->error = REG_ESPACE;
18870					return BAD;
18871				}
18872				for (i = 0; s < e && i < n && collmatch(rex, s, e, &t); i++)
18873				{
18874					b[i] = t - s;
18875					s = t;
18876				}
18877				for (; i-- >= rex->lo; s -= b[i])
18878					switch (follow(env, rex, cont, s))
18879					{
18880					case BAD:
18881						stkpop(stkstd);
18882						return BAD;
18883        case BEST:
18884						stkpop(stkstd);
18885						return BEST;
18886					case GOOD:
18887						r = GOOD;
18888						break;
18889					}
18890				stkpop(stkstd);
18891			}
18892		}
18893	}
18894}'
18895	OUTPUT - $'\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
18896
18897/*
18898 * posix regex executor
18899 * single sized-record interface
18900 */
18901
18902/*nclude "reglib.*/
18903
18904#ifdef _AST_REGEX_DEBUG
18905#define DEBUG_TEST(f,y,n)	((debug&(f))?(y):(n))
18906#define DEBUG_CODE(f,y,n)	do if(debug&(f)){y}else{n} while(0)
18907#define DEBUG_INIT()		do { char* t; if (!debug) { debug = 0x80000000; if (t = getenv("_AST_regex_debug")) debug |= strtoul(t, NiL, 0); } } while (0)
18908static unsigned long	debug;
18909#else
18910#define DEBUG_INIT()
18911#define DEBUG_TEST(f,y,n)	(n)
18912#define DEBUG_CODE(f,y,n)	do {n} while(0)
18913#endif
18914
18915#define BEG_ALT		1	/* beginning of an alt			*/
18916#define BEG_ONE		2	/* beginning of one iteration of a rep	*/
18917#define BEG_REP		3	/* beginning of a repetition		*/
18918#define BEG_SUB		4	/* beginning of a subexpression		*/
18919#define END_ANY		5	/* end of any of above			*/
18920
18921/*
18922 * returns from parse()
18923 */
18924
18925#define NONE		0	/* no parse found			*/
18926#define GOOD		1	/* some parse was found			*/
18927#define BEST		2	/* an unbeatable parse was found	*/
18928#define BAD		3	/* error ocurred			*/
18929
18930/*
18931 * REG_SHELL_DOT test
18932 */
18933
18934#define LEADING(e,r,s)	((e)->leading&&*(s)==\'.\'&&((s)==(e)->beg||*((s)-1)==(r)->explicit))
18935
18936/*
18937 * Pos_t is for comparing parses. An entry is made in the
18938 * array at the beginning and at the end of each Group_t,
18939 * each iteration in a Group_t, and each Binary_t.
18940 */
18941
18942typedef struct
18943{
18944	unsigned char*	p;		/* where in string		*/
18945	size_t		length;		/* length in string		*/
18946	short		serial;		/* preorder subpattern number	*/
18947	short		be;		/* which end of pair		*/
18948} Pos_t;
18949
18950/* ===== begin library support ===== */
18951
18952#define vector(t,v,i)	(((i)<(v)->max)?(t*)((v)->vec+(i)*(v)->siz):(t*)vecseek(&(v),i))
18953
18954static Vector_t*
18955vecopen __PARAM__((int inc, int siz), (inc, siz)) __OTORP__(int inc; int siz;)
18956#line 62
18957{
18958	Vector_t*	v;
18959	Stk_t*		sp;
18960
18961	if (inc <= 0)
18962		inc = 16;
18963	if (!(sp = stkopen(STK_SMALL|STK_NULL)))
18964		return 0;
18965	if (!(v = (Vector_t*)stkseek(sp, sizeof(Vector_t) + inc * siz)))
18966	{
18967		stkclose(sp);
18968		return 0;
18969	}
18970	v->stk = sp;
18971	v->vec = (char*)v + sizeof(Vector_t);
18972	v->max = v->inc = inc;
18973	v->siz = siz;
18974	v->cur = 0;
18975	return v;
18976}
18977
18978static __V_*
18979vecseek __PARAM__((Vector_t** p, int index), (p, index)) __OTORP__(Vector_t** p; int index;)
18980#line 85
18981{
18982	Vector_t*	v = *p;
18983
18984	if (index >= v->max)
18985	{
18986		while ((v->max += v->inc) <= index);
18987		if (!(v = (Vector_t*)stkseek(v->stk, sizeof(Vector_t) + v->max * v->siz)))
18988			return 0;
18989		*p = v;
18990		v->vec = (char*)v + sizeof(Vector_t);
18991	}
18992	return v->vec + index * v->siz;
18993}
18994
18995static void
18996vecclose __PARAM__((Vector_t* v), (v)) __OTORP__(Vector_t* v;)
18997#line 101
18998{
18999	if (v)
19000		stkclose(v->stk);
19001}
19002
19003typedef struct
19004{
19005	Stk_pos_t	pos;
19006	char		data[1];
19007} Stk_frame_t;
19008
19009#define stknew(s,p)	((p)->offset=stktell(s),(p)->base=stkfreeze(s,0))
19010#define stkold(s,p)	stkset(s,(p)->base,(p)->offset)
19011
19012#define stkframe(s)	(*((Stk_frame_t**)(s)->_next-1))
19013#define stkdata(s,t)	((t*)stkframe(s)->data)
19014#define stkpop(s)	stkold(s,&(stkframe(s)->pos))
19015
19016static __V_*
19017stkpush __PARAM__((Stk_t* sp, size_t size), (sp, size)) __OTORP__(Stk_t* sp; size_t size;)
19018#line 121
19019{
19020	Stk_frame_t*	f;
19021	Stk_pos_t	p;
19022
19023	stknew(sp, &p);
19024	size = sizeof(Stk_frame_t) + sizeof(size_t) + size - 1;
19025	if (!(f = (Stk_frame_t*)stkalloc(sp, sizeof(Stk_frame_t) + sizeof(Stk_frame_t*) + size - 1)))
19026		return 0;
19027	f->pos = p;
19028	stkframe(sp) = f;
19029	return f->data;
19030}
19031
19032/* ===== end library support ===== */
19033
19034/*
19035 * Match_frame_t is for saving and restoring match records
19036 * around alternate attempts, so that fossils will not be
19037 * left in the match array.  These are the only entries in
19038 * the match array that are not otherwise guaranteed to
19039 * have current data in them when they get used.
19040 */
19041
19042typedef struct
19043{
19044	size_t			size;
19045	regmatch_t*		match;
19046	regmatch_t		save[1];
19047} Match_frame_t;
19048
19049#define matchframe	stkdata(stkstd,Match_frame_t)
19050#define matchpush(e,x)	((x)->re.group.number?_matchpush(e,x):0)
19051#define matchcopy(e,x)	((x)->re.group.number?memcpy(matchframe->match,matchframe->save,matchframe->size):(__V_*)0)
19052#define matchpop(e,x)	((x)->re.group.number?memcpy(matchframe->match,matchframe->save,matchframe->size),stkpop(stkstd):(__V_*)0)
19053
19054#define pospop(e)	(--(e)->pos->cur)
19055
19056/*
19057 * allocate a frame and push a match onto the stack
19058 */
19059
19060static int
19061_matchpush __PARAM__((Env_t* env, Rex_t* rex), (env, rex)) __OTORP__(Env_t* env; Rex_t* rex;)
19062#line 164
19063{
19064	Match_frame_t*	f;
19065	regmatch_t*	m;
19066	regmatch_t*	e;
19067	regmatch_t*	s;
19068	int		num;
19069
19070	if (rex->re.group.number <= 0 || (num = rex->re.group.last - rex->re.group.number + 1) <= 0)
19071		num = 0;
19072	if (!(f = (Match_frame_t*)stkpush(stkstd, sizeof(Match_frame_t) + (num - 1) * sizeof(regmatch_t))))
19073	{
19074		env->error = REG_ESPACE;
19075		return 1;
19076	}
19077	f->size = num * sizeof(regmatch_t);
19078	f->match = m = env->match + rex->re.group.number;
19079	e = m + num;
19080	s = f->save;
19081	while (m < e)
19082	{
19083		*s++ = *m;
19084		*m++ = state.nomatch;
19085	}
19086	return 0;
19087}
19088
19089/*
19090 * allocate a frame and push a pos onto the stack
19091 */
19092
19093static int
19094pospush __PARAM__((Env_t* env, Rex_t* rex, unsigned char* p, int be), (env, rex, p, be)) __OTORP__(Env_t* env; Rex_t* rex; unsigned char* p; int be;)
19095#line 196
19096{
19097	Pos_t*	pos;
19098
19099	if (!(pos = vector(Pos_t, env->pos, env->pos->cur)))
19100	{
19101		env->error = REG_ESPACE;
19102		return 1;
19103	}
19104	pos->serial = rex->serial;
19105	pos->p = p;
19106	pos->be = be;
19107	env->pos->cur++;
19108	return 0;
19109}
19110
19111/*
19112 * two matches are known to have the same length
19113 * os is start of old pos array, ns is start of new,
19114 * oend and nend are end+1 pointers to ends of arrays.
19115 * oe and ne are ends (not end+1) of subarrays.
19116 * returns 1 if new is better, -1 if old, else 0.
19117 */
19118
19119#if _AST_REGEX_DEBUG
19120
19121static void
19122showmatch __PARAM__((regmatch_t* p), (p)) __OTORP__(regmatch_t* p;)
19123#line 223
19124{
19125	sfputc(sfstdout, \'(\');
19126	if (p->rm_so < 0)
19127		sfputc(sfstdout, \'?\');
19128	else
19129		sfprintf(sfstdout, "%d", p->rm_so);
19130	sfputc(sfstdout, \',\');
19131	if (p->rm_eo < 0)
19132		sfputc(sfstdout, \'?\');
19133	else
19134		sfprintf(sfstdout, "%d", p->rm_eo);
19135	sfputc(sfstdout, \')\');
19136}
19137
19138static int
19139better __PARAM__((Env_t* env, Pos_t* os, Pos_t* ns, Pos_t* oend, Pos_t* nend, int level), (env, os, ns, oend, nend, level)) __OTORP__(Env_t* env; Pos_t* os; Pos_t* ns; Pos_t* oend; Pos_t* nend; int level;)
19140#line 239
19141
19142#define better	_better
19143{
19144	int	i;
19145
19146	DEBUG_CODE(0x0040,{sfprintf(sfstdout, "AHA better old ");for (i = 0; i <= env->nsub; i++)showmatch(&env->best[i]);sfprintf(sfstdout, "\\n           new ");for (i = 0; i <= env->nsub; i++)showmatch(&env->match[i]);sfprintf(sfstdout, "\\n");},{0;});
19147	i = better(env, os, ns, oend, nend, 0);
19148	DEBUG_TEST(0x0040,(sfprintf(sfstdout, "           %s\\n", i <= 0 ? "OLD" : "NEW")),(0));
19149	return i;
19150}
19151
19152#endif
19153
19154static int
19155better __PARAM__((Env_t* env, Pos_t* os, Pos_t* ns, Pos_t* oend, Pos_t* nend, int level), (env, os, ns, oend, nend, level)) __OTORP__(Env_t* env; Pos_t* os; Pos_t* ns; Pos_t* oend; Pos_t* nend; int level;)
19156#line 253
19157{
19158	Pos_t*	oe;
19159	Pos_t*	ne;
19160	int	k;
19161	int	n;
19162
19163	if (env->error)
19164		return -1;
19165	for (;;)
19166	{
19167		DEBUG_CODE(0x0040,{sfprintf(sfstdout, "   %-*.*sold ", (level + 3) * 4, (level + 3) * 4, "");for (oe = os; oe < oend; oe++)sfprintf(sfstdout, "<%d,%d,%d>", oe->p - env->beg, oe->serial, oe->be);sfprintf(sfstdout, "\\n   %-*.*snew ", (level + 3) * 4, (level + 3) * 4, "");for (oe = ns; oe < nend; oe++)sfprintf(sfstdout, "<%d,%d,%d>", oe->p - env->beg, oe->serial, oe->be);sfprintf(sfstdout, "\\n");},{0;});
19168		if (ns >= nend)
19169			return DEBUG_TEST(0x2000,(os < oend),(0));
19170		if (os >= oend)
19171			return DEBUG_TEST(0x2000,(-1),(1));
19172		n = os->serial;
19173		if (ns->serial > n)
19174			return -1;
19175		if (n > ns->serial)
19176		{
19177			env->error = REG_PANIC;
19178			return -1;
19179		}
19180		if (ns->p > os->p)
19181			return 1;
19182		if (os->p > ns->p)
19183			return -1;
19184		oe = os;
19185		k = 0;
19186		for (;;)
19187			if ((++oe)->serial == n)
19188			{
19189				if (oe->be != END_ANY)
19190					k++;
19191				else if (k-- <= 0)
19192					break;
19193			}
19194		ne = ns;
19195		k = 0;
19196		for (;;)
19197			if ((++ne)->serial == n)
19198			{
19199				if (ne->be != END_ANY)
19200					k++;
19201				else if (k-- <= 0)
19202					break;
19203			}
19204		if (ne->p > oe->p)
19205			return 1;
19206		if (oe->p > ne->p)
19207			return -1;
19208		if (k = better(env, os + 1, ns + 1, oe, ne, level + 1))
19209			return k;
19210		os = oe + 1;
19211		ns = ne + 1;
19212	}
19213}
19214
19215#undef	better
19216
19217#define follow(e,r,c,s)	((r)->next?parse(e,(r)->next,c,s):(c)?parse(e,c,0,s):BEST)
19218
19219static int		parse __PROTO__((Env_t*, Rex_t*, Rex_t*, unsigned char*));
19220
19221static int
19222parserep __PARAM__((Env_t* env, Rex_t* rex, Rex_t* cont, unsigned char* s, int n), (env, rex, cont, s, n)) __OTORP__(Env_t* env; Rex_t* rex; Rex_t* cont; unsigned char* s; int n;)
19223#line 319
19224{
19225	int	i;
19226	int	r = NONE;
19227	Rex_t	catcher;
19228
19229	DEBUG_TEST(0x0010,(sfprintf(sfstdout, "AHA#%d parserep %d %d %d `%-.*s\'\\n", __LINE__, rex->lo, n, rex->hi, env->end - s, s)),(0));
19230	if ((rex->flags & REG_MINIMAL) && n >= rex->lo && n < rex->hi)
19231	{
19232		if (env->stack && pospush(env, rex, s, END_ANY))
19233			return BAD;
19234		i = follow(env, rex, cont, s);
19235		if (env->stack)
19236			pospop(env);
19237		switch (i)
19238		{
19239		case BAD:
19240			return BAD;
19241		case BEST:
19242		case GOOD:
19243			return BEST;
19244		}
19245	}
19246	if (n < rex->hi)
19247	{
19248		catcher.type = REX_REP_CATCH;
19249		catcher.serial = rex->serial;
19250		catcher.re.rep_catch.ref = rex;
19251		catcher.re.rep_catch.cont = cont;
19252		catcher.re.rep_catch.beg = s;
19253		catcher.re.rep_catch.n = n + 1;
19254		catcher.next = rex->next;
19255		if (env->stack)
19256		{
19257DEBUG_TEST(0x0001,(sfprintf(sfstdout,"AHA#%d PUSH (%d,%d)(%d,%d) (%d,%d)(%d,%d)\\n", __LINE__, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo)),(0));
19258			if (matchpush(env, rex))
19259				return BAD;
19260			if (pospush(env, rex, s, BEG_ONE))
19261				return BAD;
19262DEBUG_TEST(0x0001,(sfprintf(sfstdout,"AHA#%d PUSH (%d,%d)(%d,%d) (%d,%d)(%d,%d)\\n", __LINE__, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo)),(0));
19263		}
19264		r = parse(env, rex->re.group.expr.rex, &catcher, s);
19265		DEBUG_TEST(0x0010,(sfprintf(sfstdout, "AHA#%d parserep parse %d `%-.*s\'\\n", __LINE__, r, env->end - s, s)),(0));
19266		if (env->stack)
19267		{
19268DEBUG_TEST(0x0001,(sfprintf(sfstdout,"AHA#%d POP (%d,%d)(%d,%d) (%d,%d)(%d,%d)\\n", __LINE__, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo)),(0));
19269			pospop(env);
19270			matchpop(env, rex);
19271DEBUG_TEST(0x0001,(sfprintf(sfstdout,"AHA#%d POP (%d,%d)(%d,%d) (%d,%d)(%d,%d)\\n", __LINE__, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo)),(0));
19272		}
19273		switch (r)
19274		{
19275		case BAD:
19276			return BAD;
19277		case BEST:
19278			return BEST;
19279		case GOOD:
19280			if (rex->flags & REG_MINIMAL)
19281				return BEST;
19282			r = GOOD;
19283			break;
19284		}
19285	}
19286	if (n < rex->lo)
19287		return r;
19288	if (!(rex->flags & REG_MINIMAL) || n >= rex->hi)
19289	{
19290		if (env->stack && pospush(env, rex, s, END_ANY))
19291			return BAD;
19292		i = follow(env, rex, cont, s);
19293		if (env->stack)
19294			pospop(env);
19295		switch (i)
19296		{
19297		case BAD:
19298			r = BAD;
19299			break;
19300		case BEST:
19301			r = BEST;
19302			break;
19303		case GOOD:
19304			r = (rex->flags & REG_MINIMAL) ? BEST : GOOD;
19305			break;
19306		}
19307	}
19308	return r;
19309}
19310
19311static int
19312parsetrie __PARAM__((Env_t* env, Trie_node_t* x, Rex_t* rex, Rex_t* cont, unsigned char* s), (env, x, rex, cont, s)) __OTORP__(Env_t* env; Trie_node_t* x; Rex_t* rex; Rex_t* cont; unsigned char* s;)
19313#line 408
19314{
19315	unsigned char*	p;
19316	int		r;
19317
19318	if (rex->flags & REG_ICASE)
19319	{
19320		p = state.fold;
19321		for (;;)
19322		{
19323			if (s >= env->end)
19324				return NONE;
19325			while (x->c != p[*s])
19326				if (!(x = x->sib))
19327					return NONE;
19328			if (x->end)
19329				break;
19330			x = x->son;
19331			s++;
19332		}
19333	}
19334	else
19335	{
19336		for (;;)
19337		{
19338			if (s >= env->end)
19339				return NONE;
19340			while (x->c != *s)
19341				if (!(x = x->sib))
19342					return NONE;
19343			if (x->end)
19344				break;
19345			x = x->son;
19346			s++;
19347		}
19348	}
19349	s++;
19350	if (rex->flags & REG_MINIMAL)
19351		switch (follow(env, rex, cont, s))
19352		{
19353		case BAD:
19354			return BAD;
19355		case BEST:
19356		case GOOD:
19357			return BEST;
19358		}
19359	if (x->son)
19360		switch (parsetrie(env, x->son, rex, cont, s))
19361		{
19362		case BAD:
19363			return BAD;
19364		case BEST:
19365			return BEST;
19366		case GOOD:
19367			if (rex->flags & REG_MINIMAL)
19368				return BEST;
19369			r = GOOD;
19370			break;
19371		default:
19372			r = NONE;
19373			break;
19374		}
19375	else
19376		r = NONE;
19377	if (!(rex->flags & REG_MINIMAL))
19378		switch (follow(env, rex, cont, s))
19379		{
19380		case BAD:
19381			return BAD;
19382		case BEST:
19383			return BEST;
19384		case GOOD:
19385			return GOOD;
19386	}
19387	return r;
19388}
19389
19390static int
19391collmatch __PARAM__((Rex_t* rex, unsigned char* s, unsigned char* e, unsigned char** p), (rex, s, e, p)) __OTORP__(Rex_t* rex; unsigned char* s; unsigned char* e; unsigned char** p;)
19392#line 486
19393{
19394	register Celt_t*	ce;
19395	unsigned char*		t;
19396	wchar_t			c;
19397	int			w;
19398	int			r;
19399	int			x;
19400	Ckey_t			key;
19401	Ckey_t			elt;
19402
19403	if ((w = mbsize(s)) > 1)
19404	{
19405		memcpy((char*)key, (char*)s, w);
19406		key[w] = 0;
19407		mbxfrm(elt, key, COLL_KEY_MAX);
19408		t = s;
19409		c = mbchar(t);
19410		x = 0;
19411	}
19412	else
19413	{
19414		key[0] = s[0];
19415		key[1] = 0;
19416		r = mbxfrm(elt, key, COLL_KEY_MAX);
19417		while (w < COLL_KEY_MAX && &s[w] < e)
19418		{
19419			key[w] = s[w];
19420			key[w + 1] = 0;
19421			if (mbxfrm(elt, key, COLL_KEY_MAX) != r)
19422				break;
19423			w++;
19424		}
19425		key[w] = 0;
19426		mbxfrm(elt, key, COLL_KEY_MAX);
19427		c = s[0];
19428		x = w - 1;
19429	}
19430	r = 1;
19431	for (ce = rex->re.collate.elements;; ce++)
19432	{
19433		switch (ce->typ)
19434		{
19435		case COLL_call:
19436			if (!x && (*ce->fun)(c))
19437				break;
19438			continue;
19439		case COLL_char:
19440			if (!strcmp((char*)ce->beg, (char*)elt))
19441				break;
19442			continue;
19443		case COLL_range:
19444			if (strcmp((char*)ce->beg, (char*)elt) <= ce->min && strcmp((char*)elt, (char*)ce->end) <= ce->max)
19445				break;
19446			continue;
19447		case COLL_range_lc:
19448			if (strcmp((char*)ce->beg, (char*)elt) <= ce->min && strcmp((char*)elt, (char*)ce->end) <= ce->max && (islower(c) || !isupper(c)))
19449				break;
19450			continue;
19451		case COLL_range_uc:
19452			if (strcmp((char*)ce->beg, (char*)elt) <= ce->min && strcmp((char*)elt, (char*)ce->end) <= ce->max && (isupper(c) || !islower(c)))
19453				break;
19454			continue;
19455		default:
19456			r = 0;
19457			break;
19458		}
19459		if (!x || r)
19460			break;
19461		r = 1;
19462		w = x--;
19463		key[w] = 0;
19464		mbxfrm(elt, key, COLL_KEY_MAX);
19465	}
19466	*p = s + w;
19467	return rex->re.collate.invert ? !r : r;
19468}
19469
19470static int
19471parse __PARAM__((Env_t* env, Rex_t* rex, Rex_t* cont, unsigned char* s), (env, rex, cont, s)) __OTORP__(Env_t* env; Rex_t* rex; Rex_t* cont; unsigned char* s;)
19472#line 565
19473{
19474	int		c;
19475	int		d;
19476	int		i;
19477	int		m;
19478	int		n;
19479	int		r;
19480	int*		f;
19481	unsigned char*	p;
19482	unsigned char*	t;
19483	unsigned char*	b;
19484	unsigned char*	e;
19485	regmatch_t*	o;
19486	Trie_node_t*	x;
19487	Rex_t*		q;
19488	Rex_t		catcher;
19489	Rex_t		next;
19490
19491	for (;;)
19492	{
19493		switch (rex->type)
19494		{
19495		case REX_ALT:
19496			if (matchpush(env, rex))
19497				return BAD;
19498			if (pospush(env, rex, s, BEG_ALT))
19499				return BAD;
19500			catcher.type = REX_ALT_CATCH;
19501			catcher.serial = rex->serial;
19502			catcher.re.alt_catch.cont = cont;
19503			catcher.next = rex->next;
19504			r = parse(env, rex->re.group.expr.binary.left, &catcher, s);
19505			if (r < BEST || (rex->flags & REG_MINIMAL))
19506			{
19507				matchcopy(env, rex);
19508				((Pos_t*)env->pos->vec + env->pos->cur - 1)->serial = catcher.serial = rex->re.group.expr.binary.serial;
19509				n = parse(env, rex->re.group.expr.binary.right, &catcher, s);
19510				if (n != NONE)
19511					r = n;
19512			}
19513			pospop(env);
19514			matchpop(env, rex);
19515			return r;
19516		case REX_ALT_CATCH:
19517			if (pospush(env, rex, s, END_ANY))
19518				return BAD;
19519			r = follow(env, rex, rex->re.alt_catch.cont, s);
19520			pospop(env);
19521			return r;
19522		case REX_BACK:
19523			o = &env->match[rex->lo];
19524			if (o->rm_so < 0)
19525				return NONE;
19526			i = o->rm_eo - o->rm_so;
19527			e = s + i;
19528			if (e > env->end)
19529				return NONE;
19530			t = env->beg + o->rm_so;
19531			if (!(rex->flags & REG_ICASE))
19532			{
19533				while (s < e)
19534					if (*s++ != *t++)
19535						return NONE;
19536			}
19537			else if (!mbwide())
19538			{
19539				p = state.fold;
19540				while (s < e)
19541					if (p[*s++] != p[*t++])
19542						return NONE;
19543			}
19544			else
19545			{
19546				while (s < e)
19547				{
19548					c = mbchar(s);
19549					d = mbchar(t);
19550					if (toupper(c) != toupper(d))
19551						return NONE;
19552				}
19553			}
19554			break;
19555		case REX_BEG:
19556			if ((!(rex->flags & REG_NEWLINE) || s <= env->beg || *(s - 1) != \'\\n\') && ((env->flags & REG_NOTBOL) || s != env->beg))
19557				return NONE;
19558			break;
19559		case REX_CLASS:
19560			if (LEADING(env, rex, s))
19561				return NONE;
19562			n = rex->hi;
19563			if (n > env->end - s)
19564				n = env->end - s;
19565			m = rex->lo;
19566			if (m > n)
19567				return NONE;
19568			r = NONE;
19569			if (!(rex->flags & REG_MINIMAL))
19570			{
19571				for (i = 0; i < n; i++)
19572					if (!settst(rex->re.charclass, s[i]))
19573					{
19574						n = i;
19575						break;
19576					}
19577				for (s += n; n-- >= m; s--)
19578					switch (follow(env, rex, cont, s))
19579					{
19580					case BAD:
19581						return BAD;
19582					case BEST:
19583						return BEST;
19584					case GOOD:
19585						r = GOOD;
19586						break;
19587					}
19588			}
19589			else
19590			{
19591				for (e = s + m; s < e; s++)
19592					if (!settst(rex->re.charclass, *s))
19593						return r;
19594				e += n - m;
19595				for (;;)
19596				{
19597					switch (follow(env, rex, cont, s))
19598					{
19599					case BAD:
19600						return BAD;
19601					case BEST:
19602					case GOOD:
19603						return BEST;
19604					}
19605					if (s >= e || !settst(rex->re.charclass, *s))
19606						break;
19607					s++;
19608				}
19609			}
19610			return r;
19611		case REX_COLL_CLASS:
19612			if (LEADING(env, rex, s))
19613				return NONE;
19614			n = rex->hi;
19615			if (n > env->end - s)
19616				n = env->end - s;
19617			m = rex->lo;
19618			if (m > n)
19619				return NONE;
19620			r = NONE;
19621			e = env->end;
19622			if (!(rex->flags & REG_MINIMAL))
19623			{
19624				if (!(b = (unsigned char*)stkpush(stkstd, n)))
19625				{
19626					env->error = REG_ESPACE;
19627					return BAD;
19628				}
19629				for (i = 0; s < e && i < n && collmatch(rex, s, e, &t); i++)
19630				{
19631					b[i] = t - s;
19632					s = t;
19633				}
19634				for (; i-- >= rex->lo; s -= b[i])
19635					switch (follow(env, rex, cont, s))
19636					{
19637					case BAD:
19638						stkpop(stkstd);
19639						return BAD;
19640        case BEST:
19641						stkpop(stkstd);
19642						return BEST;
19643					case GOOD:
19644						r = GOOD;
19645						break;
19646					}
19647				stkpop(stkstd);
19648			}
19649		}
19650	}
19651}'
19652
19653TEST 10 'how did this hide til 2002?'
19654	EXEC -h
19655		INPUT - $'#pragma prototyped
19656void fun(int arg)
19657{
19658	SPAN(next) = ratio * STSIZE(arg);
19659}'
19660		OUTPUT - $'
19661void fun __PARAM__((int arg), (arg)) __OTORP__(int arg;){
19662	SPAN(next) = ratio * STSIZE(arg);
19663}'
19664
19665TEST 11 'libpp splice'
19666	EXEC -nhf
19667	INPUT - $'int a = val>0?vau:0;
19668int b = val>0?val:0;'
19669	SAME OUTPUT INPUT
19670
19671TEST 12 'option exercises'
19672
19673	EXEC -s
19674		INPUT - $'/* : : generated by proto : : */
19675#pragma prototyped
19676extern int f(int);
19677extern int g(int);'
19678
19679	EXEC -s -p
19680		OUTPUT - $'/* : : generated by proto : : */
19681#pragma prototyped
19682extern int f(int);
19683extern int g(int);'
19684
19685	EXEC -s -f
19686
19687	EXEC -s
19688		INPUT - $'/* : : generated by configure : : */
19689#pragma prototyped
19690extern int f(int);
19691extern int g(int);'
19692		OUTPUT - $'
19693/* : : generated by proto : : */
19694/* : : generated by configure : : */
19695
19696
19697#if !defined(__PROTO__)
19698#include <prototyped.h>
19699#endif
19700#if !defined(__LINKAGE__)
19701#define __LINKAGE__		/* 2004-08-11 transition */
19702#endif
19703extern __MANGLE__ int f __PROTO__((int));
19704extern __MANGLE__ int g __PROTO__((int));'
19705
19706	EXEC -s -o type=test,type=gpl
19707		INPUT - $'/* : : generated by proto : : */
19708#pragma prototyped
19709extern int f(int);
19710extern int g(int);'
19711		OUTPUT -
19712
19713	EXEC -s -p -o type=test,type=gpl
19714		OUTPUT - $'/***********************************************************************
19715*                                                                      *
19716*                          Copyright (c) 2001                          *
19717*                                                                      *
19718*        This is free software; you can redistribute it and/or         *
19719*     modify it under the terms of the GNU General Public License      *
19720*            as published by the Free Software Foundation;             *
19721*       either version 2, or (at your option) any later version.       *
19722*                                                                      *
19723*           This software is distributed in the hope that it           *
19724*              will be useful, but WITHOUT ANY WARRANTY;               *
19725*         without even the implied warranty of MERCHANTABILITY         *
19726*                 or FITNESS FOR A PARTICULAR PURPOSE.                 *
19727*         See the GNU General Public License for more details.         *
19728*                                                                      *
19729*                You should have received a copy of the                *
19730*                      GNU General Public License                      *
19731*           along with this software (see the file COPYING.)           *
19732*                    If not, a copy is available at                    *
19733*                 http://www.gnu.org/copyleft/gpl.html                 *
19734*                                                                      *
19735***********************************************************************/
19736/* : : generated by proto : : */
19737#pragma prototyped
19738extern int f(int);
19739extern int g(int);'
19740
19741	EXEC -s -f -o type=test,type=gpl
19742
19743	EXEC -s -o type=test,type=gpl
19744		INPUT - $'/* : : generated by configure : : */
19745#pragma prototyped
19746extern int f(int);
19747extern int g(int);'
19748		OUTPUT - $'/***********************************************************************
19749*                                                                      *
19750*                          Copyright (c) 2001                          *
19751*                                                                      *
19752*        This is free software; you can redistribute it and/or         *
19753*     modify it under the terms of the GNU General Public License      *
19754*            as published by the Free Software Foundation;             *
19755*       either version 2, or (at your option) any later version.       *
19756*                                                                      *
19757*           This software is distributed in the hope that it           *
19758*              will be useful, but WITHOUT ANY WARRANTY;               *
19759*         without even the implied warranty of MERCHANTABILITY         *
19760*                 or FITNESS FOR A PARTICULAR PURPOSE.                 *
19761*         See the GNU General Public License for more details.         *
19762*                                                                      *
19763*                You should have received a copy of the                *
19764*                      GNU General Public License                      *
19765*           along with this software (see the file COPYING.)           *
19766*                    If not, a copy is available at                    *
19767*                 http://www.gnu.org/copyleft/gpl.html                 *
19768*                                                                      *
19769***********************************************************************/
19770
19771/* : : generated by proto : : */
19772/* : : generated by configure : : */
19773
19774
19775#if !defined(__PROTO__)
19776#include <prototyped.h>
19777#endif
19778#if !defined(__LINKAGE__)
19779#define __LINKAGE__		/* 2004-08-11 transition */
19780#endif
19781extern __MANGLE__ int f __PROTO__((int));
19782extern __MANGLE__ int g __PROTO__((int));'
19783
19784TEST 13 'already noticed'
19785
19786	EXEC -s
19787		INPUT - $'
19788/* Copyright (c) 2001 bogomips Corp. */
19789#pragma prototyped
19790extern int f(int);
19791extern int g(int);'
19792		OUTPUT - $'
19793/* : : generated by proto : : */
19794
19795/* Copyright (c) 2001 bogomips Corp. */
19796
19797
19798#if !defined(__PROTO__)
19799#include <prototyped.h>
19800#endif
19801#if !defined(__LINKAGE__)
19802#define __LINKAGE__		/* 2004-08-11 transition */
19803#endif
19804extern __MANGLE__ int f __PROTO__((int));
19805extern __MANGLE__ int g __PROTO__((int));'
19806
19807	EXEC -s -p
19808
19809	EXEC -s -f
19810
19811	EXEC -s
19812		INPUT - $'#pragma prototyped noticed
19813extern int f(int);
19814extern int g(int);'
19815		OUTPUT - $'
19816/* : : generated by proto : : */
19817
19818
19819#if !defined(__PROTO__)
19820#include <prototyped.h>
19821#endif
19822#if !defined(__LINKAGE__)
19823#define __LINKAGE__		/* 2004-08-11 transition */
19824#endif
19825extern __MANGLE__ int f __PROTO__((int));
19826extern __MANGLE__ int g __PROTO__((int));'
19827
19828	EXEC -s -o type=test,type=gpl
19829		INPUT - $'/* Copyright (c) 2001 bogomips Corp. */
19830#pragma prototyped
19831extern int f(int);
19832extern int g(int);'
19833		OUTPUT - $'
19834/* : : generated by proto : : */
19835/* Copyright (c) 2001 bogomips Corp. */
19836
19837
19838#if !defined(__PROTO__)
19839#include <prototyped.h>
19840#endif
19841#if !defined(__LINKAGE__)
19842#define __LINKAGE__		/* 2004-08-11 transition */
19843#endif
19844extern __MANGLE__ int f __PROTO__((int));
19845extern __MANGLE__ int g __PROTO__((int));'
19846
19847	EXEC -s -p -o type=test,type=gpl
19848		OUTPUT - $'
19849/* : : generated by proto : : */
19850/* Copyright (c) 2001 bogomips Corp. */
19851
19852
19853#if !defined(__PROTO__)
19854#include <prototyped.h>
19855#endif
19856#if !defined(__LINKAGE__)
19857#define __LINKAGE__		/* 2004-08-11 transition */
19858#endif
19859extern __MANGLE__ int f __PROTO__((int));
19860extern __MANGLE__ int g __PROTO__((int));'
19861
19862	EXEC -s -f -o type=test,type=gpl
19863
19864	EXEC -s -o type=test,type=gpl
19865		INPUT - $'#pragma prototyped noticed
19866extern int f(int);
19867extern int g(int);'
19868		OUTPUT - $'
19869/* : : generated by proto : : */
19870
19871
19872#if !defined(__PROTO__)
19873#include <prototyped.h>
19874#endif
19875#if !defined(__LINKAGE__)
19876#define __LINKAGE__		/* 2004-08-11 transition */
19877#endif
19878extern __MANGLE__ int f __PROTO__((int));
19879extern __MANGLE__ int g __PROTO__((int));'
19880
19881TEST 14 'already prototyped by __P() macros'
19882
19883	EXEC -f -h
19884		INPUT - $'typedef int (*fun_f) __P((void const *));
19885void fun __P((int));'
19886		SAME OUTPUT INPUT
19887
19888TEST 15 '#(define|undef) extern intercepts'
19889
19890	EXEC -f -h
19891		INPUT - $'#define extern __EXPORT__
19892extern fun(int);
19893#undef extern'
19894		OUTPUT - $'#undef __MANGLE__
19895#define __MANGLE__ __LINKAGE__ __EXPORT__
19896extern __MANGLE__ fun(int);
19897#undef __MANGLE__
19898#define __MANGLE__ __LINKAGE__'
19899
19900	EXEC -f -h -n
19901		OUTPUT - $'#undef __MANGLE__
19902
19903#line 1
19904#define __MANGLE__ __LINKAGE__ __EXPORT__
19905extern __MANGLE__ fun(int);
19906#undef __MANGLE__
19907
19908#line 3
19909#define __MANGLE__ __LINKAGE__'
19910
19911	EXEC -f -h
19912		INPUT - $'#define extern extern __IMPORT__
19913extern fun(int);
19914#undef extern'
19915		OUTPUT - $'#undef __MANGLE__
19916#define __MANGLE__ __LINKAGE__ __IMPORT__
19917extern __MANGLE__ fun(int);
19918#undef __MANGLE__
19919#define __MANGLE__ __LINKAGE__'
19920
19921	EXEC -f -h -n
19922		OUTPUT - $'#undef __MANGLE__
19923
19924#line 1
19925#define __MANGLE__ __LINKAGE__ __IMPORT__
19926extern __MANGLE__ fun(int);
19927#undef __MANGLE__
19928
19929#line 3
19930#define __MANGLE__ __LINKAGE__'
19931
19932TEST 16 'array arg prototypes'
19933
19934	EXEC -f -h
19935		INPUT - $'static void f(t1 a[A][B], t2 b[12], t3 c, t4 d)
19936{
19937	t5	e;
19938	return 0;
19939}'
19940		OUTPUT - $'static void f __PARAM__((t1 a[A][B], t2 b[12], t3 c, t4 d), (a, b, c, d)) __OTORP__(t1 a[A][B]; t2 b[12]; t3 c; t4 d;){
19941	t5	e;
19942	return 0;
19943}'
19944
19945TEST 17 'externalize'
19946
19947	EXEC -nh
19948		INPUT - $'#pragma prototyped
19949static int fun(int);
19950static int beg;
19951static int fun(int arg) { return !arg; }
19952static int end;'
19953		OUTPUT - $'                  \nstatic int fun __PROTO__((int));
19954static int beg;
19955static int fun __PARAM__((int arg), (arg)) __OTORP__(int arg;)
19956#line 4
19957{ return !arg; }
19958static int end;'
19959
19960	EXEC -nhx
19961		OUTPUT - $'                  \nextern int fun __PROTO__((int));
19962static int beg;
19963extern int fun __PARAM__((int arg), (arg)) __OTORP__(int arg;)
19964#line 4
19965{ return !arg; }
19966static int end;'
19967
19968	EXEC -nh
19969		INPUT - $'#pragma prototyped
19970#define __NTH(p)	__attribute__(nothrow) p
19971static __inline double
19972__NTH (atof (__const char *__nptr))
19973{
19974  return strtod (__nptr, (char **) NULL);
19975}'
19976		OUTPUT - $'
19977#define __NTH(p)	__attribute__(nothrow) p
19978static __inline double
19979__NTH (atof (__const char *__nptr))
19980{
19981  return strtod (__nptr, (char **) NULL);
19982}'
19983
19984	EXEC -nhx
19985
19986	EXEC -nh
19987		INPUT - $'#pragma prototyped
19988
19989__BEGIN_NAMESPACE_STD
19990typedef __clock_t clock_t;
19991__END_NAMESPACE_STD
19992#if defined __USE_XOPEN || defined __USE_POSIX || defined __USE_MISC
19993__USING_NAMESPACE_STD(clock_t)
19994#endif'
19995		OUTPUT - $'                  \n
19996__BEGIN_NAMESPACE_STD
19997typedef __clock_t clock_t;
19998__END_NAMESPACE_STD
19999#if defined __USE_XOPEN || defined __USE_POSIX || defined __USE_MISC
20000__USING_NAMESPACE_STD(clock_t)
20001#endif'
20002
20003	EXEC -nhx
20004