/* * LoadHistory - load history from file */ void LoadHistory( const char *cmd ) { FILE *f; char str[MAX_INPUT_LINE]; int cnt; read_state rs; int i; historyLoaded = true; while( EditVars.HistoryFile != NULL ) { f = fopen( EditVars.HistoryFile, "rt" ); if( f == NULL ) { break; } cnt = 0; rs = READ_NONE; while( fgets( str, MAX_INPUT_LINE, f ) != NULL ) { for( i = strlen( str ); i && isWSorCtrlZ( str[i - 1 ]); --i ) { str[i - 1] = '\0'; } if( cnt == 0 ) { cnt = atoi( str ); rs++; if( rs >= READ_LAST ) { break; } continue; } switch( rs ) { case READ_CMD: updateHist( &EditVars.CLHist, str ); break; case READ_FIND: updateHist( &EditVars.FindHist, str ); break; case READ_FILTER: updateHist( &EditVars.FilterHist, str ); break; case READ_LASTFILES: updateHist( &EditVars.LastFilesHist, str ); break; } cnt--; } fclose( f ); break; } if( cmd != NULL ) { ReplaceString( &EditVars.CLHist.data[EditVars.CLHist.curr % EditVars.CLHist.max], cmd ); EditVars.CLHist.curr++; } } /* LoadHistory */
void updateParStat(Node *c) { double unb; totalNodes++; if (maxHeight<c->height) maxHeight=c->height; unb=getImb(c); maxImb=max(unb, maxImb); minImb=min(unb, minImb); updateHist(c, unb); getImb_Tseng(c); if (c->pp!=NULL){ if ((c->type==BIN)&&(c->pp->pp==NULL)){ rootSize[c->pp->ind]=c->sizeChildren; rootUnb[c->pp->ind]=unb; } else{ c->pp->size[c->pp->ind]=c->sizeChildren; c->pp->unb[c->pp->ind]=unb; } /* update statistics per node*/ c->pp->ind++; c->pp->sizeChildren+=c->sizeChildren; if (c->pp->maxSizeChildren<c->sizeChildren) c->pp->maxSizeChildren=c->sizeChildren; } else treeImb = unb; }