878ddf1f |
1 | #include <stdio.h>\r |
2 | #include <ctype.h>\r |
3 | \r |
4 | #include "set.h"\r |
5 | #include "syn.h"\r |
6 | #include "hash.h"\r |
7 | #include "generic.h"\r |
8 | \r |
9 | void \r |
10 | #ifdef __USE_PROTOS\r |
11 | dumpcycles(void)\r |
12 | #else\r |
13 | dumpcycles()\r |
14 | #endif\r |
15 | {\r |
16 | Cycle *c;\r |
17 | CacheEntry *f;\r |
18 | ListNode *p;\r |
19 | int i=0;\r |
20 | int k;\r |
21 | int degree;\r |
22 | \r |
23 | for (k=1; k <= CLL_k; k++) {\r |
24 | if (Cycles[k] == NULL) continue;\r |
25 | \r |
26 | for (p = Cycles[k]->next; p!=NULL; p=p->next) {\r |
27 | c = (Cycle *) p->elem;\r |
28 | degree=set_deg(c->cyclicDep);\r |
29 | fprintf(stderr,"Cycle %d: (degree %d) %s -->\n", i++, degree, RulePtr[c->croot]->rname);\r |
30 | fprintf(stderr," *self*\n");\r |
31 | MR_dumpRuleSet(c->cyclicDep);\r |
32 | fprintf(stderr,"\n");\r |
33 | f = (CacheEntry *)\r |
34 | hash_get(Fcache,Fkey(RulePtr[c->croot]->rname,'o',k));\r |
35 | if (f == NULL) {\r |
36 | fprintf(stderr," *** FOLLOW(%s) must be in cache but isn't ***\n",\r |
37 | RulePtr[c->croot]->rname);\r |
38 | };\r |
39 | };\r |
40 | };\r |
41 | }\r |
42 | \r |
43 | void \r |
44 | #ifdef __USE_PROTOS\r |
45 | dumpfostack(int k) \r |
46 | #else\r |
47 | dumpfostack(k) \r |
48 | int k;\r |
49 | #endif\r |
50 | {\r |
51 | int i=0;\r |
52 | int *pi;\r |
53 | \r |
54 | fprintf(stderr,"\n");\r |
55 | if (FoStack[k] == NULL) {\r |
56 | fprintf(stderr,"FoStack[%d] is null\n",k);\r |
57 | };\r |
58 | if (FoTOS[k] == NULL) {\r |
59 | fprintf(stderr,"FoTOS[%d] is null\n",k);\r |
60 | }\r |
61 | if (FoTOS[k] != NULL && FoStack[k] != NULL) {\r |
62 | for (pi=FoStack[k]; pi <= FoTOS[k]; pi++) {\r |
63 | i++;\r |
64 | fprintf(stderr,"#%d rule %d %s\n",i,*pi,RulePtr[*pi]->rname);\r |
65 | }\r |
66 | }\r |
67 | }\r |