Merge branch 'linux1'
[oweals/cde.git] / cde / programs / dthelp / parser / pass2 / eltdef / context.dat
1 startcomment
2   comcon:comcon {
3 /* $XConsortium: context.dat /main/3 1995/07/17 19:52:49 lehors $ */
4 /*
5               Copyright 1986 Tandem Computers Incorporated.
6 This product and information is proprietary of Tandem Computers Incorporated.
7                    Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
8
9 Context.dat defines the state transitions for program ELTDEF.
10 */
11                   }
12
13   ;
14
15 endcomment
16   incom:incom
17   ;
18
19 entstart
20   start:entdec
21   error:entdec
22   ;
23
24 entsystem
25   entval:typedec {enttype(M_SYSTEM) ;}
26   ;
27
28 entst
29   entval:typedec {enttype(M_STARTTAG) ;}
30   ;
31
32 entet
33   entval:typedec {enttype(M_ENDTAG) ;}
34   ;
35
36 entmd
37   entval:typedec {enttype(M_MD) ;}
38   ;
39
40 entpi
41   entval:piorsdata {enttype(M_PI) ;}
42   ;
43
44 entsdata
45   entval:piorsdata {enttype(M_SDATA) ;}
46   ;
47
48 entcdata
49   entval:typedec {enttype(M_CDATAENT) ;}
50   ;
51
52 typecode
53   piorsdata:codetagc {
54             entity->wheredef = M_DELTDEF ;
55             enttype(entity->type == M_PI ? M_CODEPI : M_CODESDATA) ;
56             entity->codeindex = ++codeent ;
57             }
58   ;
59
60 endofcode
61   inentc:start
62   ;
63
64 lit
65   value:value,
66   litcon:litcon
67   ;
68
69 lita
70   value:value,
71   litcon:litcon
72   ;
73
74 entlit
75   entval:declitent,
76   piorsdata:declitent,
77   typedec:declitent {entclen = 0 ;}
78
79   declitent:postent,
80   edeclitent:postent {
81             entcontent[entclen] = M_EOS ;
82             entity->content = 
83               (M_WCHAR *) m_malloc(entclen + 1, "entity content") ;
84             w_strcpy(entity->content, entcontent) ;
85             entity->wheredef = M_DELTDEF ;
86             }
87   ;
88
89 entlita
90   entval:declitaent,
91   piorsdata:declitaent,
92   typedec:declitaent {entclen = 0 ;}
93
94   declitaent:postent,
95   edclitaent:postent {
96             entcontent[entclen] = M_EOS ;
97             entity->content = 
98               (M_WCHAR *) m_malloc(entclen + 1, "entity content") ;
99             w_strcpy(entity->content, entcontent) ;
100             entity->wheredef = M_DELTDEF ;
101             }
102   ;
103
104 cro
105   litcon:litcon
106   ;
107
108 litrs
109   litcon:litcon
110   ;
111
112 litrsc
113   litcon:litcon
114   ;
115
116 litre
117   litcon:litcon
118   ;
119
120 litrec
121   litcon:litcon
122   ;
123
124 littab
125   litcon:litcon
126   ;
127
128 littabc
129   litcon:litcon
130   ;
131
132 litspace
133   litcon:litcon
134   ;
135
136 litcspace
137   litcon:litcon
138   ;
139
140 refc
141   charent:charent
142   ;
143
144 signon
145   start:insignon {restart = RSIGNON ;}
146   error:insignon
147   ;
148
149 gdef
150   start:globdef,
151   insignon:globdef {
152             endsignon() ;
153             restart = RGLOBDEF ;
154             /* fprintf(globdef, "#line %d \"%s\"\n", m_line, iffile) ; */
155             }
156
157   error:globdef {
158             endsignon() ;
159             /* fprintf(globdef, "#line %d \"%s\"\n", m_line, iffile) ; */
160             }
161
162   ;
163
164 gdec
165   start:globdec,
166   insignon:globdec {
167             endsignon() ;
168             restart = RGLOBDEC ;
169             /* fprintf(globdec, "#line %d \"%s\"\n", m_line, iffile) ; */
170             }
171   globdef:globdec {
172             restart = RGLOBDEC ;
173             /* fprintf(globdec, "#line %d \"%s\"\n", m_line, iffile) ; */
174             }
175
176   error:globdec {
177             if (! signonend) endsignon() ;
178             restart = RGLOBDEC ;
179             /* fprintf(globdec, "#line %d \"%s\"\n", m_line, iffile) ; */
180             }
181   ;
182
183 inisstring
184   start:iniss,
185   insignon:iniss {
186             endsignon() ;
187             gss = stringcnt ;
188             instring = TRUE ;
189             }
190
191   inies:iniss {
192             endstring() ;
193             gss = stringcnt ;
194             if (gss) 
195               m_error("Multiple specification of global start string") ;
196             instring = TRUE ;
197             }
198
199   inisc:iniss,
200   iniec:iniss,
201   initc:iniss,
202   inipc:iniss,
203   inistc:iniss {
204             if (gss) 
205               m_error("Multiple specification of global start string") ;
206             gss = stringcnt ;
207             instring = TRUE ;
208             }
209
210   globdef:iniss,
211   globdec:iniss {
212             gss = stringcnt ;
213             instring = TRUE ;
214             }
215   ;
216
217 iniestring
218   start:inies,
219   insignon:inies {
220             endsignon() ;
221             ges = stringcnt ;
222             instring = TRUE ;
223             }
224
225   iniss:inies {
226             if (ges) 
227               m_error("Multiple specification of global end string") ;
228             endstring() ;
229             ges = stringcnt ;
230             instring = TRUE ;
231             }
232
233   inisc:inies,
234   iniec:inies,
235   initc:inies,
236   inipc:inies,
237   inistc:inies {
238             if (ges) 
239               m_error("Multiple specification of global end string") ;
240             ges = stringcnt ;
241             instring = TRUE ;
242             }
243
244   globdef:inies,
245   globdec:inies {
246             ges = stringcnt ;
247             instring = TRUE ;
248             }
249   ;
250
251 inistring
252   start:inistc,
253   insignon:inistc {
254             endsignon() ;
255             /* fprintf(stfile, "#line %d \"%s\"\n", m_line, iffile) ; */
256             finistc = FALSE ;
257             }
258
259   iniss:inistc,
260   inies:inistc {
261             finistc = FALSE ;
262             endstring() ;
263             if (! finistc) 
264               m_error("Multiple specification of global string code") ;
265             }
266
267   iniec:inistc,
268   initc:inistc,
269   inipc:inistc,
270   inisc:inistc {
271             if (! finistc) 
272               m_error("Multiple specification of global string code") ;
273             /* fprintf(stfile, "#line %d \"%s\"\n", m_line, iffile) ; */
274             finistc = FALSE ;
275             }
276
277   globdef:inistc,
278   globdec:inistc {
279             finistc = FALSE ;
280             /* fprintf(stfile, "#line %d \"%s\"\n", m_line, iffile) ;  */
281             }
282   ;
283
284 inistart
285   start:inisc,
286   insignon:inisc {
287             endsignon() ;
288             /* fprintf(sfile, "#line %d \"%s\"\n", m_line, iffile) ; */
289             }
290
291   iniss:inisc,
292   inies:inisc {endstring() ;}
293
294   iniec:inisc,
295   initc:inisc,
296   inipc:inisc,
297   inistc:inisc,
298   globdef:inisc,
299   globdec:inisc {
300             /* fprintf(sfile, "#line %d \"%s\"\n", m_line, iffile) ; */
301             }
302   ;
303
304 iniend
305   start:iniec,
306   insignon:iniec {
307             endsignon() ;
308             /* fprintf(efile, "#line %d \"%s\"\n", m_line, iffile) ; */
309             }
310
311   iniss:iniec,
312   inies:iniec {endstring() ;}
313
314   inisc:iniec,
315   initc:iniec,
316   inipc:iniec,
317   inistc:iniec,
318   globdef:iniec,
319   globdec:iniec {
320             /* fprintf(efile, "#line %d \"%s\"\n", m_line, iffile) ; */
321             }
322   ;
323
324 initext
325   start:initc,
326   insignon:initc {
327             endsignon() ;
328             /* fprintf(tfile, "#line %d \"%s\"\n", m_line, iffile) ; */
329             finitext = FALSE ;
330             }
331
332   iniss:initc,
333   inies:initc {endstring() ;}
334
335   inisc:initc,
336   iniec:initc,
337   inipc:initc,
338   inistc:initc,
339   globdef:initc,
340   globdec:initc {
341             /* fprintf(tfile, "#line %d \"%s\"\n", m_line, iffile) ; */
342             finitext = FALSE ;
343             }
344   ;
345
346 initpi
347   start:inipc,
348   insignon:inipc {
349             endsignon() ;
350             /* fprintf(pfile, "#line %d \"%s\"\n", m_line, iffile) ; */
351             finipi = FALSE ;
352             }
353
354   iniss:inipc,
355   inies:inipc {endstring() ;}
356
357   inisc:inipc,
358   iniec:inipc,
359   initc:inipc,
360   inistc:inipc,
361   globdef:inipc,
362   globdec:inipc {
363             /* fprintf(pfile, "#line %d \"%s\"\n", m_line, iffile) ; */
364             finipi = FALSE ;
365             }
366   ;
367
368 elt
369   start:needn,
370   insignon:needn {
371             endsignon() ;
372             endini() ;
373             }
374
375   inelt:needn
376
377   globdef:needn,
378   globdec:needn,
379   inisc:needn,
380   iniec:needn,
381   initc:needn,
382   inipc:needn {endini() ;}
383
384   inss:needn,
385   ines:needn {endstring() ;}
386
387   insc:needn
388   inec:needn
389   intc:needn
390   inpc:needn
391   instc:needn
392   inparam:needn
393   preparam:needn
394   error:needn
395   ;
396
397 tagc
398   postent:start
399   codetagc:inentc {
400             startcode(entity->codeindex, &inent, entfile,
401                       "c", nopar, nopar, "") ;
402             }
403   close:preparam
404   sschain:inss {
405             *getaction(starray) = stringcnt ;
406             instring = TRUE ;
407             }
408   eschain:ines {
409             *getaction(etarray) = stringcnt ;
410             instring = TRUE ;
411             }
412   pcchain:inpc {
413             *getaction(pcarray) = ++pactions ;
414             startcode(pactions, &inpc, pfile, "p", pproto, pformal, pftype) ;
415             }
416   tcchain:intc {
417             *getaction(tcarray) = ++tactions ;
418             startcode(tactions, &intext, tfile, "t", tproto, tformal, 
419                       tftype) ;
420             }
421   scchain:insc {
422             *getaction(scarray) = ++sactions ;
423             startcode(sactions, &insc, sfile, "s", nopar, nopar, "") ;
424             }
425   ecchain:inec {
426             *getaction(ecarray) = ++eactions ;
427             startcode(eactions, &inec, efile, "e", nopar, nopar, "") ;
428             }
429   stcchain:instc {
430             *getaction(stcarray) = ++stactions ;
431             startcode(stactions, &instc, stfile, "st", stproto, stformal, 
432                       stft) ;
433             }
434   ;
435
436 sep
437   sschain:sschain {*getaction(starray) = stringcnt ;}
438   eschain:eschain {*getaction(etarray) = stringcnt ;}
439   pcchain:pcchain {*getaction(pcarray) = pactions + 1 ;}
440   tcchain:tcchain {*getaction(tcarray) = tactions + 1 ;}
441   scchain:scchain {*getaction(scarray) = sactions + 1 ;}
442   ecchain:ecchain {*getaction(ecarray) = eactions + 1 ;}
443   stcchain:stcchain {*getaction(stcarray) = stactions + 1 ;}
444   postvalue:invalue
445   ;
446
447 param
448   preparam:inparam
449   ;
450
451 vi
452   cvar:pname
453   cvalue:value
454   ;
455
456 rend
457   postpname:inparam
458   ;
459
460 grpo
461   postpname:invalue
462   ;
463
464 grpc
465   invalue:postpname
466   postvalue:postpname
467   ;
468
469
470 sss
471   inelt:sschain
472   inss:sschain,
473   ines:sschain {endstring() ;}
474
475   inpc:sschain
476   intc:sschain
477   insc:sschain
478   inec:sschain
479   instc:sschain
480   inparam:sschain
481   preparam:sschain
482   ;
483
484 ess
485   iniss:inisc,
486   inss:inelt {endstring() ;}
487   ;
488
489 ses
490   inelt:eschain 
491   inss:eschain,
492   ines:eschain {endstring() ;}
493
494   inpc:eschain
495   intc:eschain
496   insc:eschain
497   inec:eschain
498   instc:eschain
499   inparam:eschain
500   preparam:eschain
501   ;
502
503 ees
504   inies:inisc,
505   ines:inelt {endstring() ;}
506   ;
507
508 scode
509   inss:scchain,
510   ines:scchain {endstring() ;}
511
512   inparam:scchain
513   inelt:scchain
514   inpc:scchain
515   intc:scchain
516   insc:scchain
517   inec:scchain
518   instc:scchain
519   preparam:scchain
520   ;
521
522 ecode
523   inss:ecchain,
524   ines:ecchain {endstring() ;}
525
526   insc:ecchain
527   inparam:ecchain
528   inelt:ecchain
529   inec:ecchain
530   intc:ecchain
531   inpc:ecchain
532   instc:eschain
533   preparam:ecchain
534   ;
535
536 tcode
537   inss:tcchain,
538   ines:tcchain {endstring() ;}
539
540   insc:tcchain
541   inec:tcchain
542   inparam:tcchain
543   inelt:tcchain
544   preparam:tcchain
545   inpc:tcchain
546   intc:tcchain
547   instc:tcchain
548   ;
549
550 pcode
551   inelt:pcchain
552   preparam:pcchain
553   inparam:pcchain
554   inss:pcchain,
555   ines:pcchain {endstring() ;}
556   inpc:pcchain
557   intc:pcchain
558   insc:pcchain
559   inec:pcchain
560   instc:pcchain
561   ;
562
563 stcode
564   inelt:stcchain
565   preparam:stcchain
566   inparam:stcchain
567   inss:stcchain,
568   ines:stcchain {endstring() ;}
569
570   inpc:stcchain
571   intc:stcchain
572   insc:stcchain
573   inec:stcchain
574   instc:stcchain
575   ;
576
577 endfile
578   start:finish,
579   insignon:finish {
580             endsignon() ;
581             endini() ;
582             }
583
584   globdef:finish,
585   globdec:finish,
586   inistc:finish,
587   inisc:finish,
588   iniec:finish,
589   initc:finish,
590   inipc:finish {endini() ;}        
591   ;
592
593 wildcard
594   stcchain:stcchain,
595   sschain:sschain,
596   eschain:eschain,
597   scchain:scchain,
598   ecchain:ecchain,
599   tcchain:tcchain,
600   pcchain:pcchain {
601             *nextchain = (CHAIN *) m_malloc(sizeof(CHAIN), "chain") ;
602             (*nextchain)->elt = 1 ;
603             (*nextchain)->next = NULL ;
604             nextchain = &(*nextchain)->next ;
605             }
606   ;
607
608 literal
609   value:postvalue {value(literal) ;}
610   ;
611
612 name
613   needn:close {startelement() ;}
614   inparam:cvar {storecvar() ;}
615   pname:postpname {storepname() ;}
616   invalue:cvalue {cvalue() ;}
617   value:postvalue {value(name) ;}
618   entdec:entval {addent() ;}
619
620   stcchain:stcchain,
621   sschain:sschain,
622   eschain:eschain,
623   scchain:scchain,
624   ecchain:ecchain,
625   tcchain:tcchain,
626   pcchain:pcchain {
627             *nextchain = (CHAIN *) m_malloc(sizeof(CHAIN), "chain") ;
628             (*nextchain)->next = NULL ;
629             if ((*nextchain)->elt = m_packedlook(m_entree, name))
630                 (*nextchain)->elt++ ;
631               else
632                 m_err1("Undefined element: %s", name) ;
633             nextchain = &(*nextchain)->next ;
634             }
635   ;
636
637 text
638   declitent:declitent {
639             if (entclen >= M_LITLEN) {
640               curcon = EDECLITENT ;
641               m_error("Entity content too long") ;
642               }
643             else entcontent[entclen++] = textchar ;
644             }
645   declitaent:declitaent {
646             if (entclen >= M_LITLEN) {
647               curcon = EDCLITAENT ;
648               m_error("Entity content too long") ;
649               }
650             else entcontent[entclen++] = textchar ;
651             }
652   edeclitent:edeclitent
653   edclitaent:edclitaent
654   insignon:insignon {
655             socr = (LOGICAL) (textchar == '\n') ;
656             signonmsg[sochar++] = textchar ;
657             if (sochar >= SOCHAR) {
658               m_error("Exceeded buffer for sign-on message") ;
659               exit(TRUE) ;
660               }
661             }
662   globdef:globdef {
663             fprintf(globdef, "%c", textchar) ;
664             /* if (textchar == '\n') fprintf(globdef, "#line %d \"%s\"\n", 
665               m_line, iffile) ; */
666             }
667   globdec:globdec {
668             fprintf(globdec, "%c", textchar) ;
669             /* if (textchar == '\n') fprintf(globdec, "#line %d \"%s\"\n",
670               m_line, iffile) ; */
671             }
672   iniss:iniss,
673   inss:inss {
674             if (! stringstart) fprintf(string, ",\n") ;
675             fprintf(string, "  %d", textchar) ;
676             stringstart = FALSE ;
677             stringcnt++ ;
678             }
679   inies:inies,
680   ines:ines {
681             if (! stringstart) fprintf(string, ",\n") ;
682             fprintf(string, "  %d", textchar) ;
683             stringstart = FALSE ;
684             stringcnt++ ;
685             }
686   inisc:inisc,
687   insc:insc {
688             fprintf(sfile, "%c", textchar) ;
689             /* if (textchar == '\n') fprintf(sfile, "#line %d \"%s\"\n",
690               m_line, iffile) ;  */
691             }
692   iniec:iniec,
693   inec:inec {
694             fprintf(efile, "%c", textchar) ;
695             /* if (textchar == '\n') fprintf(efile, "#line %d \"%s\"\n",
696               m_line, iffile) ;  */
697             }
698   initc:initc,
699   intc:intc {
700             fprintf(tfile, "%c", textchar) ;
701             /* if (textchar == '\n') fprintf(tfile, "#line %d \"%s\"\n",
702               m_line, iffile) ;  */
703             }
704   inipc:inipc,
705   inpc:inpc {
706             fprintf(pfile, "%c", textchar) ;
707             /* if (textchar == '\n') fprintf(pfile, "#line %d \"%s\"\n",
708               m_line, iffile) ;  */
709             }
710   inistc:inistc,
711   instc:instc {
712             fprintf(stfile, "%c", textchar) ;
713             /* if (textchar == '\n') fprintf(stfile, "#line %d \"%s\"\n",
714               m_line, iffile) ; */
715             }
716   inentc:inentc {
717             fprintf(entfile, "%c", textchar) ;
718             /* if (textchar == '\n') fprintf(entfile, "#line %d \"%s\"\n",
719               m_line, iffile) ;  */
720             }
721   ;
722