Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!vdsvax!montnaro From: montnaro@sprite.steinmetz.ge.com (Skip Montanaro) Newsgroups: comp.windows.news Subject: Re: Did anyone get my program "treeedit" to work? Message-ID: Date: 17 Mar 89 03:43:08 GMT References: <4367@psuvax1.cs.psu.edu> Sender: news@vdsvax.steinmetz.ge.com Reply-To: (Skip Montanaro) Organization: GE Corporate Research & Development Lines: 54 In-reply-to: callahan@gondor.cs.psu.edu's message of 14 Mar 89 21:38:56 GMT The only response I have had to date is from a person who was unable to get the source to compile for some unknown reason. We have been trying to determine why the program works for me and not for him, but have so far been unsuccessful. There are three places in the code where you neglected to place space around either "=*" or "=&". This results in an ambiguity detected by Sun's C compiler. It can't tell if you are using an assignment operator followed by * or &, or the old-fashioned versions of *= and &=. I suspect you weren't using a Sun for treeedit development. My diffs follow. I have not tested them yet. diff -rc2 treeedit.c~ treeedit.c *** treeedit.c~ Mon Mar 13 22:11:03 1989 --- treeedit.c Thu Mar 16 22:35:32 1989 *************** *** 76,80 **** if (depth>*maxdepth) *maxdepth=depth; findxy(root->left,rank,depth+1,maxdepth); ! root->rank=*rank; root->depth=depth; (*rank)++; --- 76,80 ---- if (depth>*maxdepth) *maxdepth=depth; findxy(root->left,rank,depth+1,maxdepth); ! root->rank = *rank; root->depth=depth; (*rank)++; *************** *** 169,177 **** } else if (cps_rightbutton(&id,&geomx)) { ! insplace=&root; while ((*insplace)!=NULL) { if ((float) ((*insplace)->rank) > geomx) ! insplace=&((*insplace)->left); ! else insplace=&((*insplace)->right); } *insplace=(struct bst *) malloc(sizeof(struct bst)); --- 169,177 ---- } else if (cps_rightbutton(&id,&geomx)) { ! insplace = &root; while ((*insplace)!=NULL) { if ((float) ((*insplace)->rank) > geomx) ! insplace = &((*insplace)->left); ! else insplace = &((*insplace)->right); } *insplace=(struct bst *) malloc(sizeof(struct bst)); -- Skip Montanaro (montanaro@sprite.crd.ge.com)