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