]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/CodeTools/TianoTools/Pccts/antlr/fcache.c
6 * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
7 * Set (PCCTS) -- PCCTS is in the public domain. An individual or
8 * company may do whatever they wish with source code distributed with
9 * PCCTS or the code generated by PCCTS, including the incorporation of
10 * PCCTS, or its output, into commerical software.
12 * We encourage users to develop software with PCCTS. However, we do ask
13 * that credit is given to us for developing PCCTS. By "credit",
14 * we mean that if you incorporate our source code into one of your
15 * programs (commercial product, research project, or otherwise) that you
16 * acknowledge this fact somewhere in the documentation, research report,
17 * etc... If you like PCCTS and have developed a nice tool with the
18 * output, please mention that you developed it using PCCTS. In
19 * addition, we ask that this header remain intact in our source code.
20 * As long as these guidelines are kept, we expect to continue enhancing
21 * this system and expect to make other tools available as they are
39 CacheEntry
*dumpFcache1(char *prev
)
41 CacheEntry
*dumpFcache1(prev
)
50 CacheEntry
*least
=NULL
;
54 for (p
=table
; p
<&(table
[HashTableSize
]); p
++) {
56 CacheEntry
*q
=(CacheEntry
*) *p
;
58 if ( q
!= NULL
&& low
==0 ) low
= p
-table
;
60 if (strcmp(q
->str
,prev
) > 0) {
64 if (strcmp(q
->str
,least
->str
) < 0) {
72 if ( *p
!= NULL
) hi
= p
-table
;
78 void reportFcache(CacheEntry
*q
)
86 fprintf(stdout
,"\nrule ");
87 for (qstr
=q
->str
; *qstr
!= '*' ; qstr
++) {
88 fprintf(stdout
,"%c",*qstr
);
92 if (*qstr
== 'i') fprintf(stdout
," First[");
93 if (*qstr
== 'o') fprintf(stdout
," Follow[");
95 fprintf(stdout
,"%s]",qstr
);
96 if (q
->incomplete
) fprintf(stdout
," *** incomplete ***");
98 MR_dumpTokenSet(stdout
,1,q
->fset
);
113 fprintf(stdout
,"\n\nDump of First/Follow Cache\n");
116 next
=dumpFcache1(prev
);
117 if (next
== NULL
) break;
122 fprintf(stdout
,"\nEnd dump of First/Follow Cache\n");