*** ../src/lisp.h~ Wed Sep 10 03:04:09 1997 --- ../src/lisp.h Fri Feb 27 23:15:39 1998 *************** struct interval *** 449,454 **** --- 449,459 ---- unsigned int total_length; /* Length of myself and both children. */ unsigned int position; /* Cache of interval's character position. */ + /* This field is usually updated + simultaneously with an interval + traversal, there is no guaranty + that it is valid for a random + interval. */ struct interval *left; /* Intervals which precede me. */ struct interval *right; /* Intervals which succeed me. */ *** ../src/syntax.c~ Fri Jan 30 17:50:06 1998 --- ../src/syntax.c Sat Feb 28 00:34:13 1998 *************** update_syntax_table (pos, count, init, o *** 122,127 **** --- 122,142 ---- invalidate = 0; if (NULL_INTERVAL_P (i)) return; + /* interval_of () updates only ->position of the return value, + update the parents manually to speed up update_interval. */ + while (!NULL_PARENT (i)) + { + if (AM_RIGHT_CHILD (i)) + i->parent->position = i->position + - LEFT_TOTAL_LENGTH (i) + TOTAL_LENGTH (i) /* right end */ + - TOTAL_LENGTH (i->parent) + + LEFT_TOTAL_LENGTH (i->parent); + else + i->parent->position = i->position - LEFT_TOTAL_LENGTH (i) + + TOTAL_LENGTH (i); + i = i->parent; + } + i = gl_state.forward_i; gl_state.b_property = i->position - 1 - gl_state.offset; gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset; goto update; *** ../src/intervals.c~ Sat Jul 12 02:29:11 1997 --- ../src/intervals.c Sat Feb 28 00:28:56 1998 *************** previous_interval (interval) *** 672,678 **** } /* Find the interval containing POS given some non-NULL INTERVAL ! in the same tree. */ INTERVAL update_interval (i, pos) register INTERVAL i; --- 672,679 ---- } /* Find the interval containing POS given some non-NULL INTERVAL ! in the same tree. Note that we need to update interval->position ! if we go down the tree. */ INTERVAL update_interval (i, pos) register INTERVAL i; *************** update_interval (i, pos) *** 686,707 **** if (pos < i->position) { /* Move left. */ ! if (pos >= i->position - TOTAL_LENGTH (i->left)) ! i = i->left; /* Move to the left child */ else if (NULL_PARENT (i)) error ("Point before start of properties"); ! else i = i->parent; continue; } else if (pos >= INTERVAL_LAST_POS (i)) { /* Move right. */ ! if (pos < INTERVAL_LAST_POS (i) + TOTAL_LENGTH (i->right)) ! i = i->right; /* Move to the right child */ else if (NULL_PARENT (i)) error ("Point after end of properties"); else ! i = i->parent; continue; } else --- 687,717 ---- if (pos < i->position) { /* Move left. */ ! if (pos >= i->position - TOTAL_LENGTH (i->left)) ! { ! i->left->position = i->position - TOTAL_LENGTH (i->left) ! + LEFT_TOTAL_LENGTH (i->left); ! i = i->left; /* Move to the left child */ ! } else if (NULL_PARENT (i)) error ("Point before start of properties"); ! else ! i = i->parent; continue; } else if (pos >= INTERVAL_LAST_POS (i)) { /* Move right. */ ! if (pos < INTERVAL_LAST_POS (i) + TOTAL_LENGTH (i->right)) ! { ! i->right->position = INTERVAL_LAST_POS (i) + ! LEFT_TOTAL_LENGTH (i->right); ! i = i->right; /* Move to the right child */ ! } else if (NULL_PARENT (i)) error ("Point after end of properties"); else ! i = i->parent; continue; } else