1 /* output from Ox version G1.04 */
9 /* Y-file for translation of infix expressions to prefix and postfix */
17 #include "expr.oxout.h"
20 extern int yylex(void);
21 extern void yyerror(const char *);
24 #line 25 "expr.oxout.y"
28 #define yyyR USHRT_MAX
30 %type <yyyOxAttrbs> yyyAugNonterm
33 struct yyyStackItem *yyyOxStackItem;
41 static int yyyYok = 1;
43 extern yyyFT yyyRCIL[];
45 void yyyExecuteRRsection(yyyGNT *rootNode);
46 void yyyYoxInit(void);
47 void yyyDecorate(void);
48 struct yyyOxAttrbs; /* hack required to compensate for 'msta' behavior */
49 void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...);
50 void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...);
51 void yyyCheckUnsolvedInstTrav(yyyGNT *rootNode,long *nNZrc,long *cycleSum);
52 void yyyUnsolvedInstSearchTrav(yyyGNT *pNode);
53 void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode);
62 #line 63 "expr.oxout.y"
67 yyyDecorate(); yyyExecuteRRsection($<yyyOxAttrbs>2.yyyOxStackItem->node);
72 #line 73 "expr.oxout.y"
74 yyyGenIntNode(1,1,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1);
75 yyyAdjustINRC(1,1,0,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1);}}
79 #line 80 "expr.oxout.y"
81 yyyGenIntNode(2,3,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1,&$<yyyOxAttrbs>2,&$<yyyOxAttrbs>3);
82 yyyAdjustINRC(2,3,0,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1,&$<yyyOxAttrbs>2,&$<yyyOxAttrbs>3);}}
86 #line 87 "expr.oxout.y"
88 yyyGenIntNode(3,3,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1,&$<yyyOxAttrbs>2,&$<yyyOxAttrbs>3);
89 yyyAdjustINRC(3,3,0,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1,&$<yyyOxAttrbs>2,&$<yyyOxAttrbs>3);}}
93 #line 94 "expr.oxout.y"
95 yyyGenIntNode(4,3,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1,&$<yyyOxAttrbs>2,&$<yyyOxAttrbs>3);
96 yyyAdjustINRC(4,3,0,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1,&$<yyyOxAttrbs>2,&$<yyyOxAttrbs>3);}}
100 #line 101 "expr.oxout.y"
102 yyyGenIntNode(5,3,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1,&$<yyyOxAttrbs>2,&$<yyyOxAttrbs>3);
103 yyyAdjustINRC(5,3,0,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1,&$<yyyOxAttrbs>2,&$<yyyOxAttrbs>3);}}
107 #line 108 "expr.oxout.y"
109 yyyGenIntNode(6,3,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1,&$<yyyOxAttrbs>2,&$<yyyOxAttrbs>3);
110 yyyAdjustINRC(6,3,0,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1,&$<yyyOxAttrbs>2,&$<yyyOxAttrbs>3);}}
113 #line 114 "expr.oxout.y"
115 yyyGenIntNode(7,1,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1);
116 yyyAdjustINRC(7,1,0,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1);}}
120 #line 121 "expr.oxout.y"
122 yyyGenIntNode(8,1,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1);
123 yyyAdjustINRC(8,1,0,0,&$<yyyOxAttrbs>$,&$<yyyOxAttrbs>1);}}
137 #line 138 "expr.oxout.y"
138 long yyySSALspaceSize = 20000;
139 long yyyRSmaxSize = 1000;
140 long yyyTravStackMaxSize = 2000;
142 struct yyySolvedSAlistCell {yyyWAT attrbNum;
146 #define yyyLambdaSSAL 0
147 long yyySSALCfreeList = yyyLambdaSSAL;
148 long yyyNewSSALC = 1;
150 struct yyySolvedSAlistCell *yyySSALspace;
152 long yyyNbytesStackStg;
158 short yyyIIIEL[] = {0,
159 0,2,6,10,14,18,22,24,
163 0,0,0,0,0,0,0,0,0,0,0,0,
164 0,0,0,0,0,0,0,0,0,0,0,0,
174 void yyyfatal(char *msg)
175 {fputs(msg,stderr);exit(-1);}
179 #define yyySSALof 'S'
185 void yyyHandleOverflow(char which)
187 long oldSize,newSize;
191 msg1 = "SSAL overflow: ";
192 oldSize = yyySSALspaceSize;
195 msg1 = "ready set overflow: ";
196 oldSize = yyyRSmaxSize;
199 msg1 = "traversal stack overflow: ";
200 oldSize = yyyTravStackMaxSize;
204 newSize = (3*oldSize)/2;
205 if (newSize < 100) newSize = 100;
207 fprintf(stderr,"size was %ld.\n",oldSize);
208 msg2 = " Have to modify evaluator: -Y%c%ld.\n";
209 fprintf(stderr,msg2,which,newSize);
215 void yyySignalEnts(yyyGNT *node,long startP,long stopP)
218 while (startP < stopP)
220 if (!yyyEntL[startP]) dumNode = node;
221 else dumNode = (node->cL)[yyyEntL[startP]-1];
222 if (!(--((dumNode->refCountList)[yyyEntL[startP+1]]
227 if (++yyyRSTop == yyyAfterRS)
228 {yyyHandleOverflow(yyyRSof);
231 yyyRSTop->node = dumNode;
232 yyyRSTop->whichSym = yyyEntL[startP];
233 yyyRSTop->wa = yyyEntL[startP+1];
244 void yyySolveAndSignal() {
247 yyyGNT *yyyRSTopN,*yyyRefN;
248 yyyParent yyyRSTopNp;
251 yyyRSTopNp = (yyyRSTopN = yyyRSTop->node)->parent;
252 yyyRefN= (yyyws = (yyyRSTop->whichSym))?yyyRSTopNp.noderef:yyyRSTopN;
253 yyywa = yyyRSTop->wa;
255 switch(yyyRefN->prodNum) {
256 case 1: /***yacc rule 1***/
260 case 2: /***yacc rule 2***/
264 case 3: /***yacc rule 3***/
268 case 4: /***yacc rule 4***/
272 case 5: /***yacc rule 5***/
276 case 6: /***yacc rule 6***/
280 case 7: /***yacc rule 7***/
288 case 8: /***yacc rule 8***/
298 if (yyyws) /* the just-solved instance was inherited. */
299 {if (yyyRSTopN->prodNum)
300 {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopN->prodNum]] + yyywa;
301 yyySignalEnts(yyyRSTopN,yyyIEL[yyyiDum],
306 else /* the just-solved instance was synthesized. */
307 {if (!(yyyRSTopN->parentIsStack)) /* node has a parent. */
308 {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopNp.noderef->prodNum] +
312 yyySignalEnts(yyyRSTopNp.noderef,
317 else /* node is still on the stack--it has no parent yet. */
318 {yyypL = &(yyyRSTopNp.stackref->solvedSAlist);
319 if (yyySSALCfreeList == yyyLambdaSSAL)
320 {yyySSALspace[yyyNewSSALC].next = *yyypL;
321 if ((*yyypL = yyyNewSSALC++) == yyySSALspaceSize)
322 yyyHandleOverflow(yyySSALof);
325 {yyyiDum = yyySSALCfreeList;
326 yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next;
327 yyySSALspace[yyyiDum].next = *yyypL;
330 yyySSALspace[*yyypL].attrbNum = yyywa;
334 } /* yyySolveAndSignal */
341 #define condStg unsigned int conds;
342 #define yyyClearConds {yyyTST->conds = 0;}
343 #define yyySetCond(n) {yyyTST->conds += (1<<(n));}
344 #define yyyCond(n) ((yyyTST->conds & (1<<(n)))?1:0)
348 struct yyyTravStackItem {yyyGNT *node;
355 void yyyDoTraversals(yyyGNT *rootNode)
356 {struct yyyTravStackItem *yyyTravStack,*yyyTST,*yyyAfterTravStack;
357 yyyGNT *yyyTSTn,**yyyCLptr2;
358 int yyyi,yyyRL,yyyPass;
363 ((struct yyyTravStackItem *)
364 calloc((size_t)yyyTravStackMaxSize,
365 (size_t)sizeof(struct yyyTravStackItem)
370 (struct yyyTravStackItem *)NULL
372 {fputs("malloc error in traversal stack allocation\n",stderr);
376 yyyAfterTravStack = yyyTravStack + yyyTravStackMaxSize;
380 for (yyyi=0; yyyi<2; yyyi++) {
381 yyyTST = yyyTravStack;
382 yyyTST->node = rootNode;
386 while(yyyTST >= yyyTravStack)
387 {yyyTSTn = yyyTST->node;
399 if (yyyTSTn->prodNum)
401 {yyyCLptr2 = yyyTSTn->cL;
404 {if (++yyyTST == yyyAfterTravStack)
405 yyyHandleOverflow(yyyTSof);
407 {yyyTST->node = *yyyCLptr2;
413 } /* right to left */
414 else /* left to right */
416 yyyCLptr2 = yyyTSTn->cL + i;
419 if (++yyyTST == yyyAfterTravStack)
420 yyyHandleOverflow(yyyTSof);
422 {yyyTST->node = *yyyCLptr2;
427 } /* left to right */
432 switch(yyyTSTn->prodNum) {
438 yyyRL = 0;yyySetCond(0)
443 #line 444 "expr.oxout.y"
449 if (yyyCond(0) != yyyPass) {
452 #line 453 "expr.oxout.y"
454 if (yyyCond(1) != yyyPass) {
458 #line 459 "expr.oxout.y"
460 if (yyyCond(2) != yyyPass) {
464 #line 465 "expr.oxout.y"
476 #line 477 "expr.oxout.y"
481 if (yyyCond(0) != yyyPass) {
485 #line 486 "expr.oxout.y"
487 if (yyyCond(1) != yyyPass) {
490 #line 491 "expr.oxout.y"
492 if (yyyCond(2) != yyyPass) {
494 printf("postfix: ")/* missing ; */
496 #line 497 "expr.oxout.y"
509 yyyRL = 0;yyySetCond(0)
513 if (yyyCond(0) != yyyPass) {
517 #line 518 "expr.oxout.y"
528 if (yyyCond(0) != yyyPass) {
532 #line 533 "expr.oxout.y"
545 yyyRL = 0;yyySetCond(0)
549 if (yyyCond(0) != yyyPass) {
553 #line 554 "expr.oxout.y"
564 if (yyyCond(0) != yyyPass) {
568 #line 569 "expr.oxout.y"
581 yyyRL = 0;yyySetCond(0)
585 if (yyyCond(0) != yyyPass) {
589 #line 590 "expr.oxout.y"
600 if (yyyCond(0) != yyyPass) {
604 #line 605 "expr.oxout.y"
617 yyyRL = 0;yyySetCond(0)
621 if (yyyCond(0) != yyyPass) {
625 #line 626 "expr.oxout.y"
636 if (yyyCond(0) != yyyPass) {
640 #line 641 "expr.oxout.y"
676 yyyRL = 0;yyySetCond(0)
680 if (yyyCond(0) != yyyPass) {
682 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
684 #line 685 "expr.oxout.y"
695 if (yyyCond(0) != yyyPass) {
697 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
699 #line 700 "expr.oxout.y"
712 yyyRL = 0;yyySetCond(0)
716 if (yyyCond(0) != yyyPass) {
718 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
720 #line 721 "expr.oxout.y"
731 if (yyyCond(0) != yyyPass) {
733 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
735 #line 736 "expr.oxout.y"
744 if (yyyPass) goto yyyTpop; else goto yyyTpush;
747 } /* yyyDoTraversals */
749 void yyyExecuteRRsection(yyyGNT *rootNode) {
755 yyyCheckUnsolvedInstTrav(rootNode,&nNZrc,&cycleSum);
758 fputs("\n\n\n**********\n",stderr);
759 fputs("cycle detected in completed parse tree",stderr);
760 fputs(" after decoration.\n",stderr);
763 "number of unsolved attribute instances == %ld.\n",
767 "total number of remaining dependencies == %ld.\n",
770 fputs("average number of remaining dependencies\n",stderr);
771 fprintf(stderr," per unsolved instance == %f.\n",
772 ((float)(cycleSum)/(float)(nNZrc))
776 "searching parse tree for %ld unsolved instances:\n",
779 yyyUnsolvedInstSearchTravAux(rootNode);
781 yyyDoTraversals(rootNode);
782 } /* yyyExecuteRRsection */
786 yyyWAT yyyLRCIL[2] = {0,0,
791 void yyyYoxInit(void)
793 static int yyyInitDone = 0;
794 if (yyyInitDone) return;
796 if ((yyyRS = (struct yyyRSitem *)
797 calloc((size_t)(yyyRSmaxSize+1), (size_t)sizeof(struct yyyRSitem))
800 ((struct yyyRSitem *) NULL)
802 yyyfatal("malloc error in ox ready set space allocation\n");
804 yyyAfterRS = yyyRS + yyyRSmaxSize;
807 if ((yyySSALspace = (struct yyySolvedSAlistCell *)
808 calloc((size_t)(yyySSALspaceSize+1), (size_t)sizeof(struct yyySolvedSAlistCell))
811 ((struct yyySolvedSAlistCell *) NULL)
813 yyyfatal("malloc error in stack solved list space allocation\n");
816 yyyRSTop = yyyRS - 1;
821 void yyyDecorate(void)
823 while (yyyRSTop >= yyyRS)
829 void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...)
831 yyySIT **yyyOxStackItem = &yyval_OxAttrbs->yyyOxStackItem;
835 *yyyOxStackItem = (yyySIT *) malloc((size_t)sizeof(yyySIT));
836 if (*yyyOxStackItem == (yyySIT *) NULL)
837 yyyfatal("malloc error in ox yacc semantic stack space allocation\n");
838 (*yyyOxStackItem)->node =
839 (yyyGNT *) malloc((size_t)sizeof(yyyGNT));
840 if ((*yyyOxStackItem)->node == (yyyGNT *) NULL)
841 yyyfatal("malloc error in ox node space allocation\n");
842 (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL;
843 (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem;
844 (*yyyOxStackItem)->node->parentIsStack = 1;
845 (*yyyOxStackItem)->node->cLlen = yyyRHSlength;
846 (*yyyOxStackItem)->node->cL =
847 (yyyGNT **) calloc((size_t)yyyRHSlength, (size_t)sizeof(yyyGNT *));
848 if ((*yyyOxStackItem)->node->cL == (yyyGNT **) NULL)
849 yyyfatal("malloc error in ox child list space allocation\n");
850 (*yyyOxStackItem)->node->refCountListLen = yyyNattrbs;
851 (*yyyOxStackItem)->node->refCountList =
852 (yyyRCT *) calloc((size_t)yyyNattrbs, (size_t)sizeof(yyyRCT));
853 if ((*yyyOxStackItem)->node->refCountList == (yyyRCT *) NULL)
854 yyyfatal("malloc error in ox reference count list space allocation\n");
855 (*yyyOxStackItem)->node->prodNum = yyyProdNum;
856 va_start(ap, yyval_OxAttrbs);
857 for (i=1;i<=yyyRHSlength;i++)
858 {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem;
859 gnpDum = (*yyyOxStackItem)->node->cL[i-1] = yaccStDum->node;
860 gnpDum->whichSym = i;
861 gnpDum->parent.noderef = (*yyyOxStackItem)->node;
862 gnpDum->parentIsStack = 0;
869 #define yyyDECORfREQ 50
873 void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...)
875 yyySIT *yyyOxStackItem = yyval_OxAttrbs->yyyOxStackItem;
876 long SSALptr,SSALptrHead,*cPtrPtr;
881 static unsigned short intNodeCount = yyyDECORfREQ;
885 while (nextP < stopP)
886 {if (yyyRCIL[nextP] == yyyR)
887 {(yyyOxStackItem->node->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2];
890 {(((yyyOxStackItem->node->cL)[yyyRCIL[nextP]])->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2];
894 pL = yyyIIEL + yyyIIIEL[yyyProdNum];
895 va_start(ap, yyval_OxAttrbs);
896 for (i=1;i<=yyyRHSlength;i++)
897 {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem;
899 SSALptrHead = SSALptr = *(cPtrPtr = &(yaccStDum->solvedSAlist));
900 if (SSALptr != yyyLambdaSSAL)
901 {*cPtrPtr = yyyLambdaSSAL;
904 iTemp = (*pL+yyySSALspace[SSALptr].attrbNum);
905 yyySignalEnts(yyyOxStackItem->node,
909 SSALptr = *(cPtrPtr = &(yyySSALspace[SSALptr].next));
911 while (SSALptr != yyyLambdaSSAL);
912 *cPtrPtr = yyySSALCfreeList;
913 yyySSALCfreeList = SSALptrHead;
918 while (nextP < stopP)
919 {if (!yyyRCIL[nextP])
920 {if (yyyRCIL[nextP-2] == yyyR)
921 {pL = &(yyyOxStackItem->solvedSAlist);
922 if (yyySSALCfreeList == yyyLambdaSSAL)
923 {yyySSALspace[yyyNewSSALC].next = *pL;
924 if ((*pL = yyyNewSSALC++) == yyySSALspaceSize)
925 yyyHandleOverflow(yyySSALof);
928 {iTemp = yyySSALCfreeList;
929 yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next;
930 yyySSALspace[iTemp].next = *pL;
933 yyySSALspace[*pL].attrbNum = yyyRCIL[nextP-1];
936 {if ((gnpDum = (yyyOxStackItem->node->cL)[yyyRCIL[nextP-2]])->prodNum != 0)
938 iTemp = yyyIIEL[yyyIIIEL[gnpDum->prodNum]] + yyyRCIL[nextP-1];
939 yyySignalEnts(gnpDum,
949 {intNodeCount = yyyDECORfREQ;
956 void yyyGenLeaf(int nAttrbs,int typeNum,long startP,long stopP,YYSTYPE *yylval)
958 yyySIT **yyyOxStackItem = &yylval->yyyOxAttrbs.yyyOxStackItem;
959 (*yyyOxStackItem) = (yyySIT *) malloc((size_t)sizeof(yyySIT));
960 if ((*yyyOxStackItem) == (yyySIT *) NULL)
961 yyyfatal("malloc error in ox yacc semantic stack space allocation\n");
962 (*yyyOxStackItem)->node =
963 (yyyGNT *) malloc((size_t)sizeof(yyyGNT))
965 if ((*yyyOxStackItem)->node == (yyyGNT *) NULL)
966 yyyfatal("malloc error in ox node space allocation\n");
967 (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL;
968 (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem;
969 (*yyyOxStackItem)->node->parentIsStack = 1;
970 (*yyyOxStackItem)->node->cLlen = 0;
971 (*yyyOxStackItem)->node->cL = (yyyGNT **)NULL;
972 (*yyyOxStackItem)->node->refCountListLen = nAttrbs;
973 rcPdum = (*yyyOxStackItem)->node->refCountList =
974 (yyyRCT *) calloc((size_t)nAttrbs, (size_t)sizeof(yyyRCT));
975 if (rcPdum == (yyyRCT *) NULL)
976 yyyfatal("malloc error in ox reference count list space allocation\n");
977 while (startP < stopP) rcPdum[yyyLRCIL[startP++]] = 0;
978 (*yyyOxStackItem)->node->prodNum = 0;
979 (*yyyOxStackItem)->node->whichSym = 0;
992 #define yyyLastProdNum 8
998 int yyyProdsInd[] = {
1000 0, 2, 6, 10, 14, 18, 22, 24,
1005 int yyyProds[][2] = {
1006 { 116, 0},{ 462, 0},{ 462, 0},{ 462, 0},{ 412, 0},
1007 { 462, 0},{ 462, 0},{ 462, 0},{ 420, 0},{ 462, 0},
1008 { 462, 0},{ 462, 0},{ 452, 0},{ 462, 0},{ 462, 0},
1009 { 462, 0},{ 436, 0},{ 462, 0},{ 462, 0},{ 396, 0},
1010 { 462, 0},{ 404, 0},{ 462, 0},{ 619, 1},{ 462, 0},
1015 int yyySortsInd[] = {
1028 char *yyyStringTab[] = {
1111 0,0,"'*'","lexeme",0,
1142 0,0,"CONST","LRpost",0,
1280 #define yyySizeofProd(num) (yyyProdsInd[(num)+1] - yyyProdsInd[(num)])
1282 #define yyyGSoccurStr(prodNum,symPos) \
1283 (yyyStringTab[yyyProds[yyyProdsInd[(prodNum)] + (symPos)][0]])
1285 #define yyySizeofSort(num) (yyySortsInd[(num)+1] - yyySortsInd[(num)])
1287 #define yyySortOf(prodNum,symPos) \
1288 (yyyProds[yyyProdsInd[(prodNum)] + (symPos)][1])
1290 #define yyyAttrbStr(prodNum,symPos,attrbNum) \
1291 (yyyStringTab[yyySorts[yyySortsInd[yyySortOf(prodNum,symPos)] + \
1299 void yyyShowProd(int i)
1302 nSyms = yyySizeofProd(i);
1303 for (j=0; j<nSyms; j++)
1305 fprintf(stderr,"%s",yyyGSoccurStr(i,j));
1306 if (j == 0) fputs(" : ",stderr); else putc(' ',stderr);
1308 fputs(";\n",stderr);
1314 {int i; for (i=1; i<=yyyLastProdNum; i++) yyyShowProd(i);}
1318 void yyyShowSymsAndSorts()
1321 for (i=1; i<=yyyLastProdNum; i++)
1325 "\n\n\n---------------------------------- %3.1d\n",i);
1326 /* yyyShowProd(i); */
1327 nSyms = yyySizeofProd(i);
1328 for (j=0; j<nSyms; j++)
1331 fprintf(stderr,"%s\n",yyyGSoccurStr(i,j));
1332 sortSize = yyySizeofSort(yyySortOf(i,j));
1333 for (k=0; k<sortSize; k++)
1334 fprintf(stderr," %s\n",yyyAttrbStr(i,j,k));
1335 if (j == 0) fputs("->\n",stderr);
1344 void yyyCheckNodeInstancesSolved(yyyGNT *np)
1345 {int mysort,sortSize,i,prodNum,symPos,inTerminalNode;
1346 int nUnsolvedInsts = 0;
1348 if (np->prodNum != 0)
1349 {inTerminalNode = 0;
1350 prodNum = np->prodNum;
1354 {inTerminalNode = 1;
1355 prodNum = np->parent.noderef->prodNum;
1356 symPos = np->whichSym;
1358 mysort = yyySortOf(prodNum,symPos);
1359 sortSize = yyySizeofSort(mysort);
1360 for (i=0; i<sortSize; i++)
1361 if ((np->refCountList)[i] != 0) nUnsolvedInsts += 1;
1364 "\nFound node that has %d unsolved attribute instance(s).\n",
1367 fprintf(stderr,"Node is labeled \"%s\".\n",
1368 yyyGSoccurStr(prodNum,symPos));
1370 {fputs("Node is terminal. Its parent production is:\n ",stderr);
1371 yyyShowProd(prodNum);
1374 {fputs("Node is nonterminal. ",stderr);
1375 if (!(np->parentIsStack))
1377 "Node is %dth child in its parent production:\n ",
1380 yyyShowProd(np->parent.noderef->prodNum);
1382 fputs("Node is on left hand side of this production:\n ",stderr);
1383 yyyShowProd(np->prodNum);
1385 fputs("The following instances are unsolved:\n",stderr);
1386 for (i=0; i<sortSize; i++)
1387 if ((np->refCountList)[i] != 0)
1388 fprintf(stderr," %-16s still has %1d dependencies.\n",
1389 yyyAttrbStr(prodNum,symPos,i),(np->refCountList)[i]);
1395 void yyyCheckUnsolvedInstTrav(yyyGNT *pNode,long *nNZrc,long *cycleSum)
1396 {yyyGNT **yyyCLpdum;
1400 /* visit the refCountList of each node in the tree, and sum the non-zero refCounts */
1401 rcp = pNode->refCountList;
1402 i = pNode->refCountListLen;
1404 if (*rcp++) {*cycleSum += *(rcp - 1); (*nNZrc)++;}
1405 yyyCLpdum = pNode->cL;
1409 yyyCheckUnsolvedInstTrav(*yyyCLpdum,nNZrc,cycleSum);
1416 void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode)
1417 {yyyGNT **yyyCLpdum;
1420 yyyCheckNodeInstancesSolved(pNode);
1421 yyyCLpdum = pNode->cL;
1425 yyyUnsolvedInstSearchTravAux(*yyyCLpdum);
1432 void yyyUnsolvedInstSearchTrav(yyyGNT *pNode)
1433 {yyyGNT **yyyCLpdum;
1436 yyyCLpdum = pNode->cL;
1440 yyyUnsolvedInstSearchTravAux(*yyyCLpdum);